query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Put backquote in front of crucial characters
def dequote(in_string) in_string.gsub(/[$,"\\\n]/) {|x| "\\"+x} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requote(value) return restore_ends(value, '\"') end", "def escape_quotes(unfiltered)\n unfiltered.to_s.gsub(/'/, \"''\")\n end", "def qesc(s)\n s.gsub(\"'\", \"''\")\nend", "def _quoteString ( str )\n str.gsub( /\\\\/, '\\&\\&' ).gsub( /'/, \"''\" ) # ' (for ruby-mode)\n end", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") \n end", "def esc(inString)\n #2015-04-04 BN: gsub stumbles on apostrophes so I created a unique treatment for them\n # from http://stackoverflow.com/questions/8929218/how-to-replace-an-apostrophe-using-gsub\n inString = inString.gsub(/[']/, \"\\\\\\\\\\'\")\n\n #For each of the characters in the list of characters to be escaped\n $eChars.each do |thisChar|\n #Replace every instance of thisChar with thisChar appended to an\n #escape character. We have to escape the escape to use it\n inString = inString.gsub(thisChar, \"\\\\\"+thisChar)\n end\n return inString\nend", "def quote\n %q[(?:\"|')?]\n end", "def handle_special_characters(text)\n\n if text.include?(\"'\") then\n text.gsub!(\"'\",\"_\")\n end\n if text.include?(\"\\\\\") then\n text.gsub!(\"\\\\\",\"_\")\n end\n\n text\n end", "def to_escaped_for_sql_like\n gsub(/[\\\\%_]/) { |x| '\\\\' + x }.gsub(\"*\", \"%\")\n end", "def quote_string(string)\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def quote_str(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def right_single_quote(str)\n str.gsub(/(\\S)(\\')/, '\\1' + @rsquote)\n end", "def fquote(text)\n text.to_s.gsub(\"'\",'&apos;')\n end", "def change_quotemarks!\n local_copy.in_place :perl, \"s/\\\"/'/g\"\n end", "def escape_for_single_quotes(str)\n str.gsub \"'\", \"''\"\n end", "def singleq2utf\n self.gsub(\"'\", '%EF%BC%87')\n end", "def escape_double_quotes\r\n return self.gsub('\"', '\\\"')\r\n end", "def escape_double_quote (s)\n if ( /\"/ =~ s )\n return '\"' + s.gsub('\"','\"\"') + '\"'\n else\n return '\"' + s + '\"'\n end\nend", "def lex_en_interp_backslash_delimited; end", "def lex_en_interp_backslash_delimited; end", "def lex_en_interp_backslash_delimited; end", "def quote_string(s)\n s.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\") # ' (for ruby-mode)\n end", "def workaround_quotations(text)\n if single_quote?(text) && !double_quote?(text)\n double_quoted(text)\n elsif double_quote?(text) && !single_quote?(text)\n single_quoted(text)\n elsif single_quote?(text) && double_quote?(text)\n single_quoted(text.tr(\"'\", \"\\u2019\"))\n else\n single_quoted(text)\n end\n end", "def quote_transform(input)\n input.gsub(/\"/, '&quot;')\n end", "def escape_quotes input\n\t\tinput.gsub!(/([\\'\\\"])/,\"\\\\\\1\") #single quote\n\t\t\n\t\treturn input\n\tend", "def left_double_quote(str)\n str.gsub(/(\\\")(\\S)/, @ldquote + '\\2')\n end", "def escape_special_characters(word)\n LUCENE_SPECIAL_CHARS.each do |c|\n word.gsub!(c, \"\\\\#{c}\")\n end\n\n # need to use a block since doing gsub without a block with a '+' doesn't work\n word.gsub!('+') {|m| '\\+'}\n end", "def latex_escape(s)\n quote_count = 0\n s.to_s.\n gsub(/([{}_$&%#])/, \"__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__\\\\1\").\n gsub(/\\\\/, BACKSLASH).\n gsub(/__LATEX_HELPER_TEMPORARY_BACKSLASH_PLACEHOLDER__/, BS).\n gsub(/\\^/, HAT).\n gsub(/~/, TILDE).\n gsub(/\"/) do\n quote_count += 1\n quote_count.odd? ? %{\"`} : %{\"'}\n end\n end", "def apostraphize(str)\n str.gsub(/(\\w)(\\')(\\w)/, '\\1' + @rsquote + '\\3')\n end", "def right_double_quote(str)\n str.gsub(/(\\S)(\\\")/, '\\1' + @rdquote)\n end", "def escape_quotes(beg_str, end_str)\n case [beg_str[-1], end_str]\n when ['(', ')'], ['[', ']'], ['{', '}']\n [beg_str.sub(/.\\z/) { \"\\0\" }, \"\\0\"]\n else\n [beg_str, end_str]\n end\n end", "def escape(input); input.to_s.gsub('\"', '\\\\\"'); end", "def character_escape(string)\n string.gsub(/^'/, '').gsub(/'$/, '').gsub(/\\\\'/, \"'\")\n end", "def quote_string(s)\n s.gsub('\\\\'.freeze, '\\&\\&'.freeze).gsub(\"'\".freeze, \"''\".freeze) # ' (for ruby-mode)\n end", "def escape_quotes(text)\n text.gsub(\"'\", \"''\")\n end", "def fix_double_escape(escaped)\n escaped.gsub(/&amp;([a-z]+|(#\\d+));/i) { \"&#{$1};\" }\n end", "def escape(x)\n x = x.to_s\n x.gsub! @delimiter, @edelim if @delimiter\n x.gsub! @internal_delimiter, @eidelim\n x\n end", "def esc(word)\n word.gsub(\"&\", \"&amp;\").gsub(\"<\", \"&lt;\")\n end", "def fixQuotes(text)\n if (text != nil) then\n text = text.gsub(\"\\342\\200\\230\", \"'\")\n text = text.gsub(\"\\342\\200\\231\", \"'\")\n text = text.gsub(\"\\342\\200\\234\", '\"')\n text = text.gsub(\"\\342\\200\\235\", '\"')\n end\n result = text\n result\n end", "def escape_shell_special_chars(string)\n string.gsub(/([ ()])/, '\\\\\\\\\\1')\n end", "def generate_sql_escape(token)\n escaped_token = token.gsub(/\\\\|'/, '\\0\\0\\0\\0').gsub(\"?\", \"\\\\\\\\77\")\n \"'\" + escaped_token + \"'\"\n end", "def replace_quote(string)\n # do not know those two are different\n # ERB::Util.html_escape string.to_s.gsub 'aaa', 'bbb'\n # ERB::Util.html_escape string.to_s\n # since it is safebuffer and html_safe, this will output with single\n # quotes for example: data-datatable-multiselect=' <select multiple='multi\n # ERB::Util.html_escape string\n # replace single quote with double quote\n string.to_s.tr \"'\", '\"'\n end", "def escape_characters(string)\n ['&','-','?','|','!',\"'\",'+'].each do |syn_char|\n string = string.gsub(syn_char,'\\\\\\\\' + \"#{syn_char}\")\n end\n return string\n end", "def quote\n quote_of_the_day[0...second_to_last_index(quote_of_the_day, \"~\")].gsub(/(\\A[^a-zA-z0-9\"']*|\\s*\\z)/, \"\")\n end", "def e(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').\n gsub(/\\n/, \"'\\n'\").\n sub(/^$/, \"''\")\n end", "def escape_for_double_quotes(str)\n str.gsub(/[\\\\\"`$]/) { |c| \"\\\\#{c}\" }\nend", "def sanitize_sql_like(text, escape_character = '\\\\')\n text.to_s.gsub(/(^|.)([%_])/) do |s|\n ($1 == escape_character) ? s : [$1, escape_character, $2].compact.join\n end\n end", "def quote_and_escape(text, quote = '\"')\n \"#{quote}#{text.gsub(/#{quote}/) { |m| \"#{m}\\\\#{m}#{m}\" }}#{quote}\"\n end", "def lex_en_plain_backslash_delimited; end", "def lex_en_plain_backslash_delimited; end", "def lex_en_plain_backslash_delimited; end", "def deslash( str )\n str.gsub( '\\\\\"', '\"' ).gsub( \"\\\\\\\\\", \"\\\\\" )\n end", "def qq esc = nil\n %[\"#{esc ? self.gsub('\"') { esc } : self}\"]\n end", "def quote( val )\n\t\treturn %q{\"%s\"} % [ val.to_s.gsub(/\"/, '\\\\\"') ]\n\tend", "def likeEscape( str )\n str.gsub( \"\\\\\", \"\\\\\\\\\" ).gsub( \"%\", \"\\%\" ).gsub( \"_\", \"\\_\" )\n end", "def escape_custodian_for_search(custodian)\n\treturn custodian.encode(\"utf-8\")\n\t\t.gsub(\"\\\\\",\"\\\\\\\\\\\\\") #Escape \\\n\t\t.gsub(\"?\",\"\\\\?\") #Escape ?\n\t\t.gsub(\"*\",\"\\\\*\") #Escape *\n\t\t.gsub(\"\\\"\",\"\\\\\\\"\") #Escape \"\n\t\t.gsub(\"\\u201C\".encode(\"utf-8\"),\"\\\\\\u201C\".encode(\"utf-8\")) #Escape left smart quote\n\t\t.gsub(\"\\u201D\".encode(\"utf-8\"),\"\\\\\\u201D\".encode(\"utf-8\")) #Escape right smart quote\n\t\t.gsub(\"'\",\"\\\\\\\\'\") #Escape '\n\t\t.gsub(\"{\",\"\\\\{\")\n\t\t.gsub(\"}\",\"\\\\}\")\nend", "def to_inner_quotes(string)\n\t\t\t\tstring.sub(/«|\\\"|\\'|“/, \"„\").sub(/»|\\\"|\\'|”/, \"“\")\n\t\t\tend", "def unquote(part)\n return part if part.blank?\n\n part.start_with?('\"') ? part[1..-2] : part\n end", "def rdf_string_prep value\n return unless value.present?\n # the next two steps have been moved here from `export_rdf.rake`\n value.gsub!(\"\\r\\n\", '') # remove CrLf\n value.gsub!(\"\\\\\", '') # remove \"\\\" to avoid illegal control characters\n return value unless value =~ SINGLE_QUOTE_REGEXP\n value.strip!\n # replace initial or final \"'\" with \"\\'\"\n value.gsub(%r{^'|'$}, %q{\\\\\\'})\n end", "def remove_special_characters(string)\n string.gsub(/[~\"'&#%]/, '-')\n end", "def dequote(string)\n string.strip.gsub(/\\A\"(.*)\"\\z/m, '\\1')\nend", "def escape_special_char(str)\n str.gsub('[', '\\[').gsub(']', '\\]').gsub('(', '\\(').gsub(')', '\\)') if str\n end", "def bad_sanitize(str)\n str.gsub(/'/,\"''\")\nend", "def e_sh(str)\n str.to_s.gsub(/(?=[^a-zA-Z0-9_.\\/\\-\\x7F-\\xFF\\n])/n, '\\\\').gsub(/\\n/, \"'\\n'\").sub(/^$/, \"''\")\nend", "def escape(string); end", "def sanitize_like(string, escape_character = \"\\\\\")\n pattern = Regexp.union(escape_character, \"%\", \"_\")\n string.gsub(pattern) { |x| [escape_character, x].join }\nend", "def escape(text)\n return text.gsub(/[\\`*_{}\\[\\]()#+\\-.!]/, \"\\\\\\\\\\\\0\")\n end", "def quote_string(s) #:nodoc:\n s.gsub(/'/, \"''\") # ' (for ruby-mode)\n end", "def escaped_title(title)\n title.gsub(/([\\[\\]\\(\\)])/){ '\\\\' + $1 }\n end", "def escape(line)\n s = line.sub(/\\s+$/, '').\n gsub(/\\\\/, \"\\\\bs\\?C-q\").\n gsub(/([_\\${}&%#])/, '\\\\\\\\\\1').\n gsub(/\\?C-q/, \"{}\").\n gsub(/\\^/, \"\\\\up{}\").\n gsub(/~/, \"\\\\sd{}\").\n gsub(/\\*/, \"$*$\").\n gsub(/<</, \"<{}<\").\n gsub(/>>/, \">{}>\").\n gsub(/\\[\\]/, \"$[\\\\,]$\").\n gsub(/,,/, \",{},\").\n gsub(/`/, \"\\\\bq{}\")\n s\nend", "def escape(str); end", "def lex_en_plain_backslash_delimited=(_arg0); end", "def lex_en_plain_backslash_delimited=(_arg0); end", "def lex_en_plain_backslash_delimited=(_arg0); end", "def shell_escape(s)\n s = s.to_s\n if s !~ /^[0-9A-Za-z+,.\\/:=@_-]+$/\n s = s.gsub(\"'\") { \"'\\\\''\" }\n s = \"'#{s}'\"\n end\n s\n end", "def sanitize_sql_like(string, escape_character = '\\\\')\n pattern = Regexp.union(escape_character, '%', '_')\n string.gsub(pattern) { |x| [escape_character, x].join }\n end", "def dquote( str ) #:nodoc:\n unless str =~ /^\".*?\"$/\n '\"' + str.gsub(/[\"\\\\]/n) {|s| '\\\\' + s } + '\"'\n else\n str\n end\n end", "def unquote\n s = self.dup\n\n case self[0,1]\n when \"'\", '\"', '`'\n s[0] = ''\n end\n\n case self[-1,1]\n when \"'\", '\"', '`'\n s[-1] = ''\n end\n\n return s\n end", "def consume_escaped; end", "def quote(val, column=nil)\n return val unless val.is_a?(String)\n \"'#{val.gsub(/\\'/, \"\\\\\\\\'\")}'\" # \" <= for Emacs font-lock\n end", "def unquote(string)\n if string =~ /^\"/\n string.gsub!(/^\"|\"$/, '').gsub(/\\\\\"/, '\"')\n else\n string\n end\n end", "def single_inside_double_quote(str)\n str.gsub(/(\\\")(\\')(\\S)/, @ldquote + @lsquote + '\\3')\n .gsub(/(\\\")(\\')(\\S)/, '\\1' + @rsquote + @rdquote)\n end", "def escape_single_quotes(str)\n str.gsub(\"'\", '\\\\\\\\\\'')\nend", "def add_quotes_to_string(string)\n string = \"'#{string}'\"\n end", "def solr_param_quote(val, options = {})\n options[:quote] ||= '\"'\n unless val =~ /^[a-zA-Z0-9$_\\-\\^]+$/\n val = options[:quote] +\n # Yes, we need crazy escaping here, to deal with regexp esc too!\n val.gsub(\"'\", \"\\\\\\\\\\'\").gsub('\"', \"\\\\\\\\\\\"\") +\n options[:quote]\n end\n return val\n end", "def escape_special_chars(data)\n data = data.dup\n data.gsub! /&/n , \"&amp;\"\n data.gsub! /\\\"/n , \"&quot;\"\n data.gsub! />/n , \"&gt;\"\n data.gsub! /</n , \"&lt;\"\n data.gsub! /'/ , \"&#039;\"\n return data\n end", "def ascii_quotes\n value = self.gsub(/'/, \"&#39;\").gsub(/\"/, \"&#34;\")\n return value\n end", "def parse_escaped_chars; end", "def rb_quote(str)\n return '' if !str || str.empty?\n \"\\\"#{str.gsub(\"\\\"\", \"\\\\\\\"\")}\\\"\"\n end", "def left_single_quote(str)\n str.gsub(/(\\')(\\S)/, @lsquote + '\\2')\n end", "def extra_escape(string)\n string.gsub('\\\\', '\\\\\\\\\\\\').\n gsub(\"\\\\'\", '\\\\\\\\' + \"'\").\n gsub('\\\\\\\\\\\\', '\\\\\\\\\\\\')\n end", "def tex_quote\n to_s.tex_quote\n end", "def escape(text)\n text.gsub('\"', '\\\"')\nend", "def escape(s)\n s.gsub('\"', '\\\"')\nend", "def solr_param_quote(val, options = {})\n options[:quote] ||= '\"'\n unless val =~ /^[a-zA-Z$_\\-\\^]+$/\n val = options[:quote] +\n # Yes, we need crazy escaping here, to deal with regexp esc too!\n val.gsub(\"'\", \"\\\\\\\\\\'\").gsub('\"', \"\\\\\\\\\\\"\") + \n options[:quote]\n end\n return val\n end", "def squote!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 38 )\n\n type = SQUOTE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 173:10: '\\\\''\n match( 0x27 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 38 )\n\n end", "def lex_en_interp_backslash_delimited=(_arg0); end", "def lex_en_interp_backslash_delimited=(_arg0); end", "def lex_en_interp_backslash_delimited=(_arg0); end", "def escape_like(str)\n str.gsub(/[!%_]/){ |x| '!' + x }\n end" ]
[ "0.77381307", "0.7003321", "0.68669194", "0.681717", "0.67351776", "0.6669662", "0.6633347", "0.6620168", "0.6601471", "0.6572463", "0.654746", "0.65407354", "0.6539323", "0.6532504", "0.6509874", "0.6505717", "0.6491979", "0.648449", "0.6461159", "0.6461159", "0.6461159", "0.64537793", "0.6451101", "0.64332145", "0.6427336", "0.64043754", "0.63973266", "0.6357723", "0.6347401", "0.6342833", "0.6333559", "0.6323843", "0.63211846", "0.63181394", "0.6315705", "0.6313415", "0.630011", "0.62838113", "0.6267573", "0.62654555", "0.62644726", "0.62617016", "0.62616843", "0.6256781", "0.6253422", "0.62470824", "0.62463206", "0.6238992", "0.62382203", "0.62382203", "0.62382203", "0.6224747", "0.6224318", "0.62231344", "0.6220037", "0.62187064", "0.61949664", "0.6178392", "0.617622", "0.61635906", "0.61601186", "0.61428016", "0.6142406", "0.6141011", "0.6138978", "0.61345226", "0.6133183", "0.61272925", "0.6121474", "0.6118252", "0.6113", "0.6110896", "0.6110896", "0.6110896", "0.610409", "0.6098366", "0.6092884", "0.6083619", "0.60810953", "0.60749316", "0.60727584", "0.60691446", "0.6067859", "0.6061801", "0.6059513", "0.60589397", "0.6056529", "0.60542357", "0.60531414", "0.60500413", "0.6049669", "0.6049084", "0.60405076", "0.60268337", "0.60231227", "0.6022663", "0.60209185", "0.60209185", "0.60209185", "0.6020368" ]
0.60359836
93
Strip leading and trailing whitespace
def strip_whitespace self.url = url.strip rescue '' self.explicit_refspec = explicit_refspec.strip rescue '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n end", "def strip_leading_whitespace(text)\n return text if text.empty?\n leading_spaces = text.lines.first[/^(\\s+)/, 1]\n text.gsub(/^#{leading_spaces}/, '')\n end", "def strip(s)\n s.gsub(/^\\s+/, '').gsub(/\\s+$/, '')\n end", "def trim_whitespace; end", "def dewhitespace\n gsub(/\\s+/,' ').strip\n end", "def compact_whitespace s\n s.gsub(/\\s+/, ' ').gsub(/>\\s</, '><').strip\n end", "def strip_whitespace!\n replace(self.strip_whitespace)\n end", "def strip_trailing_whitespace(text)\n text.split(\"\\n\").collect(&:strip).join(\"\\n\")\n end", "def rstrip\r\n match = rewrite(/\\s+\\z/)\r\n match ? match[0] : ''\r\n end", "def trim_whitespace\n @expression.strip!\n end", "def rstrip() end", "def remove_leading_and_trailing_whitespace(text)\n pre_blocks = text.split(DO_NOT_TOUCH_WHITESPACE)\n\n output = []\n pre_blocks.each.with_index do |block, index|\n if index % 2 == 0\n output << block.gsub(/[ \\t]*\\n[ \\t]*/im, \"\\n\").gsub(/ *\\t */im, \"\\t\")\n else\n output << block\n end\n end\n\n output.join\n end", "def strip() end", "def trimmed_whitespace(text)\n text.gsub(/[\\t\\n\\f\\r ]+/ium, ' ')\n end", "def trim\n self.gsub(/^\\s+/,'').gsub(/\\s+$/,'')\n end", "def trim_all_whitespace(text)\n text.to_a.map do |line|\n left_spacing(line) + line.squeeze(\" \").squeeze(\" \").lstrip #the 2. is a tab\n end.join\n end", "def strip_leading_whitespace(str)\n str.gsub(/^(\\s+)/, '').gsub(/^->/, '')\n end", "def strip_space!\n replace self.gsub(/:\\s*/, \":\").gsub(/\\n/, \"\").gsub(/\\s+/, \" \").gsub(/(\\/\\*).*?(\\*\\/)/, \"\")\n end", "def strip_whitespace\n code.gsub!(WHITESPACE_REGEX, ' ')\n\n code\n end", "def rstrip!\n erase! @result.length - 1 - (@result.rindex(/[^\\s]/) || -1)\n end", "def rstrip!() end", "def strip_trailing_whitespace(code)\n code.gsub(/[ \\t]+$/, '')\n end", "def tighten\n gsub(/[\\t ]+/,' ').strip\n end", "def normalize_whitespace(text)\n text.to_s.gsub(/[[:space:]]+/, ' ').strip\n end", "def lstrip\n `return self.replace(/^\\s*/, '');`\n end", "def lstrip\n `return self.replace(/^\\s*/, '');`\n end", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def clean_whitespace(a)\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\nend", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def clean_whitespace(a)\n\n a.gsub(\"\\r\", ' ').gsub(\"\\n\", ' ').squeeze(\" \").strip\n\nend", "def strip_naked\n return self if blank?\n self.downcase.strip.gsub(/([\\s]{2,})/, ' ')\n end", "def remove_whitespace\n # NOTE: According to the docs, \\s only matches [ \\t\\r\\n\\f], i.e. it does not\n # match e.g. non-breaking space (&nbsp). The POSIX character class\n # [[:space:]] does match non-breaking space. This is relevant because\n # in Heroku, space in ENV variables might be translated as &nbsp.\n # DOC: http://ruby-doc.org/core-2.5.1/Regexp.html#class-Regexp-label-Character+Classes\n # SOURCE: http://stackoverflow.com/a/13288542\n gsub(/[[:space:]]/, '')\n end", "def strip_side_space!\n replace self.gsub(/^\\s+/, \"\").gsub(/\\s+$/, $/)\n end", "def strong_strip\n reverse.gsub(/^\\p{Zs}+|^\\p{Cf}+/, '').reverse.gsub(/^\\p{Zs}+|^\\p{Cf}+/, '')\n end", "def strip_surrounding_empty_lines(str)\n str.sub(/\\A[[:space:]]*^/, \"\")\n .sub(/$[[:space:]]*\\z/, \"\")\n end", "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "def strip_trailing_whitespace\n %w( title abstract year ).each {|attribute|\n self.send(attribute).to_s.strip!\n }\n end", "def strip_squeeze\n strip.squeeze(\" \")\n end", "def trim(**props)\n transform(type: :trim, **props) do |value|\n if value\n value = value.strip\n value = nil if value.empty?\n end\n value\n end\n end", "def trimming_for_diff_text(code)\n # gsub(/^\\s*$/, '') means remove empty lines\n code.strip.gsub(/^\\s*$/, '')\n end", "def strip!() end", "def lstrip() end", "def normalize_whitespace!\n @raw.gsub!(/\\s+/, ' ')\n end", "def evaporate\n self.gsub(/\\s/, '')\n end", "def remove_whitespace\n self.name = self.name.strip\n self.phone = self.phone.strip\n end", "def trim_whitespace=(_arg0); end", "def remove_whitespace\n self.first_name = self.first_name.strip\n self.last_name = self.last_name.strip\n self.biography = self.biography.strip\n end", "def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end", "def kill_leading_whitespace!(s)\n if s.is_a?(Array)\n s.map{|i| kill_leading_whitespace!(i)}\n else\n s.gsub!(/^ */,\"\").chomp\n s.gsub!(/\\A\\n/,\"\")\n s.gsub!(/\\n\\z/,\"\")\n s\n end\n end", "def strip_leading_indentation\n if (indent = leading_indentation_length) > 0\n collect { |line| line =~ /^[\\s]+[^\\s]/ ? line[indent..-1] : line }.join\n else\n self\n end\n end", "def squish\n self.gsub(/[\\n\\t]/, '').squeeze(' ').strip\n end", "def normalize_whitespace(line)\n line.gsub(/\\s+/, ' ')\n end", "def normalize_whitespace(input)\n input.to_s.gsub(%r!\\s+!, \" \").tap(&:strip!)\n end", "def strip_all_spaces(text)\n text&&text.gsub(/&nbsp;|\\xC2\\xA0|\\xA0/, ' ').strip\n end", "def left_strip(str)\n output = \"\"\n whitespace = \"\\n\\t \"\n i = 0\n left = true\n while i < str.length\n if !left\n output << str[i]\n elsif !whitespace.include? str[i]\n left = false\n output << str[i]\n end\n i+=1\n end\n return output\nend", "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n end", "def unindent(text)\n text.strip.gsub(/^\\s+/, \"\")\n end", "def strip!\n acc = 0\n new_te = self.text_elements.drop_while { |te|\n te.text == ' ' && acc += 1\n }\n self.left += self.text_elements.take(acc).inject(0) { |m, te| m += te.width }\n self.text_elements = new_te\n\n self.text_elements.reverse!\n acc = 0\n new_te = self.text_elements.drop_while { |te|\n te.text == ' ' && acc += 1\n }\n self.right -= self.text_elements.take(acc).inject(0) { |m, te| m += te.width }\n self.text_elements = new_te.reverse\n self\n end", "def strip_whitespace\n self.tags = tags.gsub(/\\s+/, '')\n # self.tags = tags.strip\n self.title = title.strip\n self.description = description.strip\n # self.keywords = keywords.strip\n self.body = body.strip\n end", "def clean( input )\n input.gsub( %r/\\s+/, '' )\n end", "def strip_blanks\n self.title = self.title.strip\n self.code = self.code.strip\n self.complement_title = self.complement_title.strip\n end", "def normalize_source(source)\n source.chop.gsub(/\\s*\\n\\s*/, ' ')\n end", "def white_out(str)\n str.delete(\" \\n\\t\")\nend", "def lstrip!() end", "def strip_lines(value)\n value.to_s.gsub(/\\n\\s*/, ' ')\n end", "def remove_whitespace\n self.title = self.title.strip\n self.description = self.description.strip\n end", "def remove_whitespace(ooxml)\n ooxml.gsub(/\\s+/, ' ').gsub(/>\\s+</, '><').strip\nend", "def undent\n indent = split(\"\\n\").select { |line| !line.strip.empty? }.map { |line| line.index(/[^\\s]/) }.compact.min || 0\n gsub(/^[[:blank:]]{#{indent}}/, '').chomp\n end", "def normalize_whitespace(input); end", "def rstrip_except_escapes(string)\n string.sub(/(?<!\\\\)\\s+$/, '')\n end", "def pre_proccess(text)\n text.to_s.strip.gsub(/[[:space:]]+/, ' ').gsub(/\\s{2,}/, ' ')\n end", "def strip(s)\n Sanitize.clean(s)\n end", "def force_strip(str)\n str[0] = \"\"\n end", "def clean t\n # line feed should be removed also\n !t ? '' : t.gsub(\"\\n\",' ').gsub(\"\\t\",' ').strip.gsub(/\\s\\s+/,' ')\nend", "def remove_whitespace\n self.time = self.time.strip\n self.description = self.description.strip\n self.venue = self.venue.strip.downcase\n self.location = self.location.strip.downcase\n end", "def trim\n self.content = self.content.squeeze(\"\\n\").squeeze(\" \").strip\n end", "def remove_whitespace\n self.attributes.each { |key, value| self[key] = value.strip if value.respond_to?(:strip) }\n end", "def strip!\n \"\"\n end", "def scrub\n self.gsub(/[^a-zA-Z\\s0-9\\.]/, '').gsub(/\\t/, ' ').gsub(/\\r/, ' ').gsub(/\\s\\s/, '').lstrip.rstrip\n end", "def admin_strip_text(str)\n\t\tstr.gsub(/\\t|\\n/,'')\n\t\tstr.strip\n\tend", "def strip(*fields)\n sanitize(*fields) { |value| value.strip }\n end", "def whitespace\n @input = @input.gsub(/\\ +/, ' ').strip\n end", "def strip_empty_space\n self.title = title.strip if self.title\n self.preview = preview.strip if self.preview\n self.content = content.strip if self.content\n end", "def removeWhitespace(a)\n\toutString = \"\"\n\ta.split(\"\").each do |i|\n\t\toutString += i unless i == \" \"\n\tend\n\treturn outString\nend", "def clean text\n text.gsub(/(\\n|\\t|\\r)/, ' ').gsub(/>\\s*</, '><').squeeze(' ')\n end", "def remove_trailing_spaces(source)\n for_outstrings_of(source) do |str|\n str.gsub! /\\s+/im, ' '\n str.gsub! /\\s*(=|\\+|\\-|<|>|\\?|\\|\\||&&|\\!|\\{|\\}|,|\\)|\\(|;|\\]|\\[|:|\\*|\\/)\\s*/im, '\\1'\n str.gsub! /;(\\]|\\)|\\}|\\.|\\?|:)/, '\\1' # removing wrong added semicolons\n str.gsub /([^\\d\\w_\\$]typeof)\\s+([\\w\\d\\$_]+)/, '\\1(\\2)'\n end\n end", "def stripped\n @stripped ||= strip @text\n end", "def stripped_content\n\t\treturn self.content.gsub( /<.*?>/, '' ).tr( \"\\n\\t \", ' ' ).strip\n\tend", "def clean(str)\n return nil unless str\n str.gsub(/\\p{Space}/, ' ').strip.squeeze(' ')\n end", "def remove_whitespace( answer_string )\n if @whitespace.nil?\n answer_string\n elsif [:strip, :chomp].include?(@whitespace)\n answer_string.send(@whitespace)\n elsif @whitespace == :collapse\n answer_string.gsub(/\\s+/, \" \")\n elsif [:strip_and_collapse, :chomp_and_collapse].include?(@whitespace)\n result = answer_string.send(@whitespace.to_s[/^[a-z]+/])\n result.gsub(/\\s+/, \" \")\n elsif @whitespace == :remove\n answer_string.gsub(/\\s+/, \"\")\n else\n answer_string\n end\n end", "def squash(text)\n return text.scrub.gsub(/[[:space:]]+/, ' ').strip\nend", "def stripn\n encode( universal_newline: true )\n .gsub(\"\\n\", \"\")\n .strip\n end", "def strip_blanks\n self.title = self.title.strip\n self.unit = self.unit.strip\n end", "def remove_returns_and_spaces(file_contents)\n clean_file =\n file_contents\n .gsub!(/\\n+/, '')\n .gsub!(/(\\s+)(?![^<])/, '')\n\n clean_file\n end", "def clean_up_spaces(string)\n string.gsub(\"\\n\", ' ').gsub(/[[:space:]]+/, ' ').strip if string.is_a? String\n end", "def clean_white_space\n @content.gsub!(/\\n{2,}/, \"\\n\")\n write_content_to_file\n end", "def remove_empty_lines(source)\n for_outstrings_of(source) do |str|\n str.gsub /\\n\\s*\\n/m, \"\\n\"\n end\n end", "def trim(node)\n if (extra_comma = /(?<trail>,\\s*[\\]}]\\s*)$/.match(node))\n node.sub(extra_comma[:trail],\n extra_comma[:trail]\n .slice(1, node.length.pred)\n .sub(/^\\s/, \"\\n\"))\n else node\n end\n end", "def unindent!\n gsub!(/^[ \\t]{#{minimum_leading_whitespace}}/, '')\n end", "def strip(str); end" ]
[ "0.8021187", "0.79838777", "0.7959773", "0.78956157", "0.7775048", "0.77323127", "0.7660412", "0.7628947", "0.7580976", "0.7565837", "0.75448084", "0.7543182", "0.75327295", "0.7481093", "0.74383956", "0.7429741", "0.7405567", "0.7389328", "0.7346857", "0.734037", "0.72765994", "0.7263", "0.7248711", "0.72302556", "0.72290313", "0.72290313", "0.71603954", "0.71603954", "0.7141434", "0.7114082", "0.7114082", "0.7101359", "0.7100595", "0.708405", "0.7056145", "0.7034938", "0.7027851", "0.70200163", "0.70158887", "0.7006843", "0.69811726", "0.6962162", "0.6959652", "0.69166887", "0.689587", "0.6880406", "0.6869782", "0.6854504", "0.6834881", "0.6834881", "0.68027246", "0.6800194", "0.67826086", "0.6771172", "0.677052", "0.6765754", "0.6730657", "0.6729859", "0.6728243", "0.6725156", "0.6697688", "0.6692098", "0.66797024", "0.6675521", "0.66727453", "0.66592264", "0.66553897", "0.6654126", "0.6653919", "0.6612183", "0.6609313", "0.6602637", "0.65979135", "0.65937257", "0.6583343", "0.6580484", "0.6569062", "0.6563408", "0.6561991", "0.65617025", "0.6550654", "0.65383255", "0.65315014", "0.65305763", "0.65281355", "0.6512922", "0.65102077", "0.64745146", "0.6470165", "0.6468627", "0.6467512", "0.645985", "0.6459108", "0.64457715", "0.64386505", "0.6438605", "0.64353895", "0.6429068", "0.64266485", "0.642088", "0.6418685" ]
0.0
-1
Check format of refspec
def validate_refspec begin valid_git_refspec_path?(explicit_refspec) rescue => e errors.add(:explicit_refspec, e.message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_git_refspec?(refspec)\n refspec.match(GIT_REFSPEC_REGEX)\n end", "def validate_gemspec; end", "def valid_gemspec?; end", "def validate(ref_name)\n not_allowed_prefixes = %w(refs/heads/ refs/remotes/ -)\n return false if ref_name.start_with?(*not_allowed_prefixes)\n return false if ref_name == 'HEAD'\n\n begin\n Rugged::Reference.valid_name?(\"refs/heads/#{ref_name}\")\n rescue ArgumentError\n return false\n end\n end", "def valid_refspec_path?(refspec)\n !refspec || refspec == '' || parse_refspec(refspec) ? true : false\n end", "def check_commit_change_for_untagged_version\n return unless spec\n return unless spec.version == Version.new('0.0.1')\n ref_spec = related_specifications.find { |s| s.version != '0.0.1' }\n return unless ref_spec\n unless ref_spec.source[:commit] == spec.source[:commit]\n error \"Attempt to rewrite the commit of 0.0.1 version.\"\n end\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def validate_ref(repo, ref)\n ref_valid = true\n cmd = \"git ls-remote --tags --exit-code #{repo} #{ref} >/dev/null\"\n system(cmd)\n if $?.exitstatus != 0\n ref_valid = false\n end\n ref_valid\n end", "def validate_gemspec\n build_command(Jeweler::Commands::ValidateGemspec).run\n end", "def validate_gemspec\n Jeweler::Commands::ValidateGemspec.build_for(self).run\n end", "def validate_gemspec\n Juwelier::Commands::ValidateGemspec.build_for(self).run\n end", "def has_valid_issue_ref?(body, general_ref_spec, flake_config)\n body.scan(general_ref_spec) do |reference|\n $stderr.puts \" Determining if reference ##{reference[1]} meets criteria...\"\n issue_id = reference[1].to_i\n if issue_has_label?(issue_id, flake_config['repo'], flake_config['label'])\n $stderr.puts \" Reference ##{reference[1]} points to a valid flake issue\"\n return true\n end\n end\n\n return false\n end", "def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n errors << \"\\tError: Your custom commit doesn't seem like following conventional commit rules.\"\n errors << \"\\tCheck https://www.conventionalcommits.org\"\n end\n end\n errors << \"\\tError: Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(']')[1]&.length.to_i > 50\n errors << \"\\tError: Commit message subject should start in Capital.\" if line.split(']')[1] && line.split(']')[1].lstrip[0] == line.split(']')[1].lstrip[0].downcase\n end\n return errors\nend", "def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end", "def test_checkformat_good\n @f.set_address(@success,@from)\n success,msg= @f.check_format\n assert success,\"check did not succeed\"\n\n end", "def git_changes?(patchdef)\n patchdef.find {|p| p[1] =~ /^[^.]/}\n end", "def check_message_format\n missed_revs = `git rev-list #{$oldrev}..#{$newrev}`.split(\"\\n\")\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !$regex.match(message)\n puts \"[POLICY] Your message is not formatted correctly\"\n puts \"\\n\\tRefused message: #{message}\"\n puts \"\\nYour commit message should absolutely reference the issue number in redmine\"\n puts \"\\n\\tYou should use one of the below referencing keywords or fixing keywords\"\n puts \"\\n\\tReferencing keywords:\"\n puts \"\\t\\trefs #XXX\"\n puts \"\\t\\treferences #XXX\"\n puts \"\\t\\tIssueID #XXX\"\n puts \"\\n\\tFixing keywords:\"\n puts \"\\t\\tfixes #XXX\"\n puts \"\\t\\tcloses #XXX\"\n puts \"\\n\\treplace XXX with the issue's number.\"\n puts \"\\n\\tN.B: If the current commit is not related to any issue (which is usually a bad idea)\"\n puts \"\\tYou can use the MISC: keyword to bypass referencing an issue as follows.\"\n puts \"\\n\\t\\tMISC: Commit message\"\n puts \"\\n\\tN.B: There's a whitespace between MISC: and the commit message.\"\n puts \"\"\n exit 1\n end\n end\nend", "def check_ref(ref, revision)\n # First check that revision is present\n begin\n git.show(revision)\n rescue Git::GitExecuteError => e\n STDERR.puts \"[#{DateTime.now} #{to}] Issue when checking revision #{revision}: #{e}\".yellow\n return false\n end\n\n # TODO: check that branch and tags contains the change\n return true\n end", "def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n return errors << \"Error : Your commit message seems like not following conventional commit rules, please check your commit's convention\"\n end\n end\n errors << \"Error : Your commit message contains #{line.length} characters. Commit message should be less than 72 characters in length.\" if line.length > 72\n errors << \"Error : Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(':')[1].length > 50\n errors << \"Error : Commit message subject should start in Capital.\" if line.split(':')[1].lstrip[0] == line.split(':')[1].lstrip[0].downcase\n return errors\nend", "def verify_with_schema(test_file)\n schema_file = '../json_schema/cr_metadata_api_format_corrected.json'\n schema = Pathname.new(schema_file)\n schemer = JSONSchemer.schema(schema)\n json_file = nil\n File.open(test_file,\"r\") do |f|\n json_file = JSON.parse(f.read)\n end\n if schemer.valid?(json_file)\n # puts test_file + \" matches \" + schema_file\n return true\n else\n # puts \"** \"+test_file + \" does not match \" + schema_file\n return false\n end\nend", "def parse_refspec(spec)\n parsed_refspec = spec.match(REF_COMPONENT_REGEX)\n return nil if parsed_refspec.nil?\n if parsed_refspec[1]\n # Should be first class. If no type component, return fail\n if parsed_refspec[3]\n { type: parsed_refspec[3], name: parsed_refspec[4] }\n else\n nil\n end\n elsif parsed_refspec[3]\n { type: nil, name: \"#{parsed_refspec[3]}/#{parsed_refspec[4]}\" }\n else\n { type: nil, name: parsed_refspec[4] }\n end\n end", "def valid_format?(fmt)\n format_string_has_v_or_d?(fmt)\n format_string_does_not_have_v_and_d?(fmt)\n format_string_is_all_valid_chars?(fmt)\n format_string_has_unique_chars?(fmt)\n format_string_has_big_t_only_at_the_end?(fmt)\n end", "def valid?\n return false if @author_email.nil?\n return false if @repository_url.nil?\n return false if @sha.nil?\n pattern = Regexp.new(\"^[a-fA-F0-9]{40}$\")\n return false if @sha !~ pattern\n true\n end", "def warnings_for_spec(spec, file)\n license = spec.license\n source = spec.source\n text = file.read\n warnings = []\n warnings << \"The name of the spec should match the name of the file\" unless path_matches_name?(file, spec)\n warnings << \"Missing license[:type]\" unless license && license[:type]\n warnings << \"Github repositories should end in `.git'\" if source && source[:git] =~ /github.com/ && source[:git] !~ /.*\\.git/\n warnings << \"Github repositories should start with `https'\" if source && source[:git] =~ /github.com/ && source[:git] !~ /https:\\/\\/github.com/\n warnings << \"The description should end with a dot\" if spec.description != spec.summary && spec.description !~ /.*\\./\n warnings << \"The summary should end with a dot\" if spec.summary !~ /.*\\./\n warnings << \"Missing license[:file] or [:text]\" unless license && (license[:file] || license[:text])\n warnings << \"Comments must be deleted\" if text =~ /^\\w*#\\n\\w*#/ # allow a single line comment as it is generally used in subspecs\n warnings\n end", "def check_format(file)\n \tbegin\n content = file_content(file)\n content = content.split(\"\\n\").reject { |c| c.empty? }\n read_file(content)\n rescue\n raise_error ERROR_READING_FILE\n end\n end", "def check_message_format(regex, oldrev, newrev)\n missed_revs = `git rev-list #{oldrev}..#{newrev}`.split(\"\\n\")\n bad_commits = \"\"\n auth_fail = 0\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !regex.match(message) then\n bad_commits += \"#{rev}\\n\"\n else\n # Increment fail counter on failure\n auth_fail += verify_authcode(msg)\n end\n \n end\n\n if auth_fail > 0 or bad_commits.split(\"\\n\").nitems.to_i > 0 then\n puts \"[POLICY] Please ensure that your commit messages contain ticket or a current authorization numbers\"\n puts \"The list of commits you sent were: \"\n puts bad_commits\n exit 1\n end\nend", "def valid # rubocop:disable Metrics/AbcSize\n errors = []\n warnings = []\n\n %w{name version}.each do |field|\n next unless params[field.to_sym].nil?\n\n errors.push(\"Missing profile #{field} in #{ref}\")\n end\n\n if %r{[\\/\\\\]} =~ params[:name]\n errors.push(\"The profile name (#{params[:name]}) contains a slash\" \\\n \" which is not permitted. Please remove all slashes from `inspec.yml`.\")\n end\n\n # if version is set, ensure it is correct\n if !params[:version].nil? && !valid_version?(params[:version])\n errors.push(\"Version needs to be in SemVer format\")\n end\n\n %w{title summary maintainer copyright license}.each do |field|\n next unless params[field.to_sym].nil?\n\n warnings.push(\"Missing profile #{field} in #{ref}\")\n end\n\n # if license is set, ensure it is in SPDX format or marked as proprietary\n if !params[:license].nil? && !valid_license?(params[:license])\n warnings.push(\"License '#{params[:license]}' needs to be in SPDX format or marked as 'Proprietary'. See https://spdx.org/licenses/.\")\n end\n\n [errors, warnings]\n end", "def verify_commits expected_commits\n expected_commits.diff! commits_in_current_repo(expected_commits.headers)\nend", "def mod(name, args = nil)\n puts \"INFO: validating module '#{name}'\"\n if args.is_a? Hash and args.has_key?(:git) and args.has_key?(:ref)\n if validate_repo(args[:git])\n if args[:ref] == 'master' or args[:ref] =~ /stable\\/.*/ or validate_ref(args[:git], args[:ref])\n puts \"INFO: module '#{name}' is valid\"\n else\n @valid = false\n puts \"ERROR: module '#{name}' is not referencing a tag (#{args[:ref]})\"\n end\n else\n @valid = false\n puts \"ERROR: module '#{name}' doesn't reference a valid repo\"\n end\n else\n @valid = false\n puts \"ERROR: module '#{name}' doesn't have a git repo or ref\"\n end\n end", "def check_component_file(release_date, component_name, component_file_type, architecture_name, expected_content)\n component_file = distribution\n .component_files\n .with_component_name(component_name)\n .with_file_type(component_file_type)\n .with_architecture_name(architecture_name)\n .order_updated_asc\n .last\n\n expect(component_file).not_to be_nil\n expect(component_file.updated_at).to eq(release_date)\n\n unless expected_content.nil?\n component_file.file.use_file do |file_path|\n expect(File.read(file_path)).to eq(expected_content)\n end\n end\n end", "def verify_reference_nbr(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end", "def is_ref? ; !!metadata[:ref] ; end", "def valid?(message)\n super do |payload|\n payload.get(:data, :github_kit, :commit_comment) ||\n payload.get(:data, :github_kit, :status)\n end\n end", "def needs_checkout?\n expected = ref.sha1\n actual = rev_parse('HEAD')\n\n ! (expected == actual)\n end", "def valid?\n valid_format? @format\n end", "def verify_reference_nbr(test_data)\n verify_values_match(test_data[UseOfCollections::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end", "def refspec=(refspec)\n if refspec =~ /^\\+?(.*)(?:\\:.*)$/\n @branch = $1\n else\n raise ArgumentError, \"refspec syntax error. Should be: branch:refs/heads/branch\"\n end\n @refspec = refspec\n end", "def validate_build!(field, value)\n raise InvalidSemanticVersion.new(\"#{field} is invalid\") unless value.all? { |b| b =~ BUILD_PATTERN }\n true\n end", "def check_spec_path\n expected = \"#{spec.name}/#{spec.version}/#{spec.name}.podspec\"\n relative_path = spec_path.relative_path_from(source.repo).to_s\n unless relative_path == expected\n error \"Incorrect path, the path is `#{relative_path}` and should be `#{expected}`.\"\n end\n end", "def check(config = {})\n defaults = {validator: 'clang-format', file_extensions: ['.h', '.m', '.mm'], ignore_file_patterns: []}\n config = defaults.merge(config)\n validator = *config[:validator]\n file_extensions = [*config[:file_extensions]]\n ignore_file_patterns = [*config[:ignore_file_patterns]]\n\n diff = ''\n case danger.scm_provider\n when :github\n diff = github.pr_diff\n when :gitlab\n diff = gitlab.mr_diff\n when :bitbucket_server\n diff = bitbucket_server.pr_diff\n else\n raise 'Unknown SCM Provider'\n end\n\n changes = get_changes(diff, file_extensions, ignore_file_patterns)\n offending_files, patches = resolve_changes(validator, changes)\n\n message = ''\n unless offending_files.empty?\n message = 'Code style violations detected in the following files:' + \"\\n\"\n offending_files.each do |file_name|\n message += '* `' + file_name + \"`\\n\\n\"\n end\n message += 'Execute one of the following actions and commit again:' + \"\\n\"\n message += '1. Run `%s` on the offending files' % validator + \"\\n\"\n message += '2. Apply the suggested patches with `git apply patch`.' + \"\\n\\n\"\n message += patches.join(\"\\n\")\n end\n\n return if message.empty?\n fail VIOLATION_ERROR_MESSAGE\n markdown '### Code Style Check'\n markdown '---'\n markdown message\n end", "def check_update(component_def, spec, gem_name_to_version)\n component_def.each_line do |line|\n # TODO: Some of the component files handle multiple versions with a case statement (for example net-ssh). \n # Add more logic to compare each of those versions. For now there are only a hand full. \n if line =~ /pkg.version/\n ver = Gem::Version.new(line.scan(/\\d\\.*/).join(''))\n if gem_name_to_version[spec.name] > ver\n warn \"Update needed for: #{spec.name} \\nUpgrade from #{ver} to #{gem_name_to_version[spec.name]}\\n\\n\"\n end\n end\n end\nend", "def validate!\n validate_patches!\n validate_new_branch_name! if new_branch?\n validate_permissions!\n end", "def checkStructForContent(studentDir, contentInfo, shortName)\n rtn = []\n\n content = getRawFileContents(\"#{studentDir}/data.h\")\n contentInfo.each{|fieldInfo|\n structContent = getStructContent(content, fieldInfo[0])\n\n if (structContent == '')\n print \"Unable to get struct content (#{studentDir}, #{fieldInfo[0]}\"\n next\n end\n\n fieldInfo[1].each{|field|\n if (!structContent.match(/\\b#{field}\\b/))\n rtn << [\"Struct #{fieldInfo[0]} does not have #{shortName} #{field}.\", 5]\n end\n }\n }\n\n return rtn\nend", "def test_parsing_require_all_fields\n value_ = ::Versionomy.parse('2.0', :semver)\n assert_equal([2, 0, 0, ''], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_raises(::Versionomy::Errors::ParseError) do\n value_ = ::Versionomy.parse('2.0b1', :semver)\n end\n end", "def verify_ref_1l_condition\n Unified835Output::BenignNull.new\n end", "def valid?(ver)\n !!(ver =~ /\\A#{REGEX_FULL}\\Z/)\n end", "def ensure_metadata_as_expected!\n expected_metadata_rb = <<~E\n name 'local-cookbook'\n maintainer ''\n maintainer_email ''\n license ''\n description 'Installs/Configures local-cookbook'\n long_description 'Installs/Configures local-cookbook'\n version '2.3.4'\n\n E\n expect(IO.read(metadata_path)).to eq(expected_metadata_rb)\n end", "def is_changelog_format_correct?\n parser = Danger::Changelog::Config.parser\n changelog_file = Danger::Changelog::ChangelogFile.new(filename, parser: parser)\n\n if changelog_file.exists?\n changelog_file.parse\n changelog_file.bad_lines.each do |line|\n markdown <<~MARKDOWN\n ```markdown\n #{line.map(&:strip).join(\"\\n\")}\n ```\n MARKDOWN\n end\n messaging.fail(parser.bad_line_message(filename), sticky: false) if changelog_file.bad_lines?\n\n changelog_file.global_failures.each do |failure|\n messaging.fail(failure, sticky: false)\n end\n\n changelog_file.good?\n else\n messaging.fail(\"The #{filename} file does not exist.\", sticky: false)\n false\n end\n end", "def check_changelog\n current_repo = File.basename(`git remote get-url origin`.chomp, '.git').freeze\n slug_re = '([a-zA-Z]*/[a-zA-Z]*)'\n links = %r{\\[#{slug_re}?\\#([0-9]+)\\]\\(https://github.com/#{slug_re}/(issues|pull)/([0-9]+)\\)}\n links_typos = %r{https://github.com/#{slug_re}/(issue|pulls)/([0-9]+)}\n\n all_warnings = []\n inside_entry = false\n last_line_has_correct_ending = false\n\n File.readlines('CHANGELOG.md').each_with_index do |line, idx|\n line.chomp! # Remove \\n the end, it's easier for checks below\n was_inside_entry = inside_entry\n just_started_new_entry = line.start_with?('* ')\n inside_entry = true if just_started_new_entry\n inside_entry = false if /^ \\[.*\\]\\(.*\\)$/ =~ line # link-only line\n\n if was_inside_entry && !inside_entry && !last_line_has_correct_ending\n # We just ended an entry's description by starting the links, but description didn't end with '. '\n # Note: entry descriptions can be on multiple lines, hence the need to wait for the next line\n # to not be inside an entry to be able to consider the previous line as the end of entry description.\n all_warnings.concat [\n { line: idx, message: 'Line describing your entry should end with a period and 2 spaces.' }\n ]\n end\n # Store if current line has correct ending, for next iteration, so that if the next line isn't\n # part of the entry description, we can check if previous line ends description correctly.\n # Also, lines just linking to CHANGELOG to other repositories (StencilSwiftKit & Stencil mainly)\n # should be considered as not needing the '. ' ending.\n last_line_has_correct_ending = line.end_with?('. ') || line.end_with?('/CHANGELOG.md)')\n\n # Now, check that links [#nn](.../nn) have matching numbers in link title & URL\n wrong_links = line.scan(links).reject do |m|\n slug = m[0] || \"SwiftGen/#{current_repo}\"\n (slug == m[2]) && (m[1] == m[4])\n end\n all_warnings.concat Array(wrong_links.map do |m|\n link_text = \"#{m[0]}##{m[1]}\"\n link_url = \"#{m[2]}##{m[4]}\"\n { line: idx + 1, message: \"Link text is #{link_text} but links points to #{link_url}.\" }\n end)\n\n # Flag common typos in GitHub issue/PR URLs\n typo_links = line.scan(links_typos)\n all_warnings.concat Array(typo_links.map do |_|\n { line: idx + 1, message: 'This looks like a GitHub link URL with a typo. Issue links should use `/issues/123` (plural) and PR links should use `/pull/123` (singular).' }\n end)\n end\n all_warnings\nend", "def validate_hcl?(hcl)\n return false if hcl.nil?\n\n !/^#[a-f|0-9]{6}$/.match(hcl).nil?\n end", "def invalid?\n @ref.invalid?\n end", "def scm_string?; SCM_FALSE; end", "def validate_format\n JSON.parse(content) && nil if content\n rescue JSON::ParserError => err\n err.message\n end", "def validate_format\n JSON.parse(content) && nil if content\n rescue JSON::ParserError => err\n err.message\n end", "def check_org_unit_updated_data_validity(org_unit_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Identifier Name Code Path Type),\n 'properties' => {\n 'Identifier' => { 'type' => 'string' },\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'Path' => { 'type' => 'string' },\n 'Type' => {\n 'required' => %w(Id Code Name),\n 'properties' => {\n 'Id' => { 'type' => 'integer' },\n 'Code' => { 'type' => 'string' },\n 'Name' => { 'type' => 'string' }\n }\n }\n }\n }\n JSON::Validator.validate!(schema, org_unit_data, validate_schema: true)\nend", "def check_spec_path(name, version, spec)\n unless spec.name == name && spec.version.to_s == version.to_s\n message = \"Incorrect path #{spec.defined_in_file}\"\n report.add_message(:error, message, name, spec.version)\n end\n end", "def validate(expected_digest)\n if not bundle_exists? then\n raise BundleNotFound.new(\"repo = #{@repo}; bundle = #{@bundle}\")\n end\n\n if not command_exists? then\n raise CommandNotFound.new(\"repo = #{@repo}; bundle = #{@bundle}; command = #{@command}\")\n end\n if self.digest != expected_digest then\n raise BundleNotFound, \"digest does not match ('#{self.digest}' != '#{expected_digest}')\", caller\n end\n return true\n end", "def verify_comment(line) \n end", "def valid?\n formats.count > 0\n end", "def assert_def_equal(expected, str)\n assert_equal expected, cmd.parse_definition(outdent(str))\n end", "def assert_def_equal(expected, str)\n assert_equal expected, cmd.parse_definition(outdent(str))\n end", "def validate_repo(repo)\n repo_valid = true\n if /review\\.fuel-infra\\.org/.match(repo).nil? and /github\\.com\\/fuel-infra/.match(repo).nil?\n repo_valid = false\n end\n repo_valid\n end", "def valid?\n raise 'ChangelogLine subclass must implement the valid? method'\n end", "def git_url_must_be_valid\n matched = false\n\n [/^https?:\\/\\/.+\\.git$/i, /^git@.+:.+\\.git$/i].each do |valid_form|\n if valid_form.match git_url\n matched = true\n break\n end\n end\n\n unless matched\n errors.add(:git_url, 'must be of form http[s]://host/path/to/repository.git OR git@host:path/to/repository.git')\n end\n end", "def verify\n @files = []\n @manifest = nil\n\n verify_required_files\n\n rescue Errno::ENOENT => e\n raise FoobarMod::Package::FormatError.new e.message\n rescue Gem::Package::TarInvalidError => e\n raise FoobarMod::Package::FormatError.new e.message, @mod\n end", "def verify_integrity(object, entry)\n base_name = remove_dot_json(entry.name)\n if object[\"raw_data\"][\"id\"] != base_name\n yield(\"ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object[\"raw_data\"][\"id\"]}')\")\n elsif RESERVED_NAMES.match?(entry.parent.name)\n yield(\"Data bag name ('#{entry.parent.name}') must not match #{RESERVED_NAMES.inspect}\")\n end\n end", "def refPathValid?(lane)\n refPath = @referencePaths[lane.to_s]\n\n # If reference is null or empty, return false \n if refPath == nil || refPath.eql?(\"\")\n return false\n end\n\n # A reference path \"sequence\" implies building only sequence, and no\n # alignment. Hence it is a valid reference\n if refPath.downcase.eql?(\"sequence\")\n return true\n end\n\n # A reference path is invalid if any of the following is true\n # 1) It does not exist, or is not a valid directory\n # 2) It does not end with string \"/squash\"\n # If all of above are false, reference path is valid\n if !File::exist?(refPath) || !File::directory?(refPath) ||\n !refPath.match(/\\/squash$/)\n return false\n end\n return true\n end", "def test_validate_file\n file_list = [\n '0|0|SYSTEM>569274(100)|1553184699.650330000|288d',\n '1|288d|569274>735567(12):735567>561180(3):735567>689881(2):SYSTEM>532260(100)|1553184699.652449000|92a2',\n '2|92a2|569274>577469(9):735567>717802(1):577469>402207(2):SYSTEM>794343(100)|1553184699.658215000|4d25'\n ]\n assert validate_file file_list, [0, 0], '0'\n end", "def check_commit_version\n metadata = Chef::Cookbook::Metadata.new\n metadata.from_file(File.join(Config.settings['jenkins']['workspace_dir'], 'cookbooks', @cookbook, 'metadata.rb'))\n metadata.version\n end", "def pre_conversion_sanity_check()\r\n # Do a dry run of the bug conversion checking the mappings between BugZilla and FogBugz fields\r\n # If the FB API allowed creation of things like projects and priorities, this wouldn't be necessary\r\n missing_fields = []\r\n\r\n @bz_reader.each_bug do |bz_bug|\r\n verify_field_mappings(bz_bug, missing_fields)\r\n end\r\n\r\n missing_fields\r\n end", "def valid?(message)\n super do |payload|\n payload.get(:data, :code_fetcher, :info, :commit_sha) &&\n !payload.get(:data, :code_fetcher, :asset)\n end\n end", "def test_format_tag\n version = VMLib::Version.new 'foo', 1, 2, 3, 'rc.1', 'sha.5114f85'\n\n # Make sure all fields are included in the tag\n assert_equal 'v1.2.3-rc.1+sha.5114f85', version.tag\n\n # Changing the build should reflect in the tag\n version.build = 'sha.0012312'\n assert_equal 'v1.2.3-rc.1+sha.0012312', version.tag\n\n # Removing the build should reflect in the tag\n version.build = ''\n assert_equal 'v1.2.3-rc.1', version.tag\n\n # Changing the prerelease should reflect in the tag\n version.prerelease = 'alpha.02'\n assert_equal 'v1.2.3-a.2', version.tag\n\n # Removing the prerelease should reflect in the tag\n version.prerelease = ''\n assert_equal 'v1.2.3', version.tag\n\n # Having a build metadata and no prerelease should reflect in the tag\n version.build = 'sha.12ab32d'\n assert_equal 'v1.2.3+sha.12ab32d', version.tag\n end", "def validity_check\n\n if strand == '+'\n\n codon = ref_seq[0..2].map(&:last).join\n return true if codon.include?('N')\n codon == 'ATG'\n\n elsif strand == '-'\n\n codon = ref_seq[-3..-1].map(&:last).join\n return true if codon.include?('N')\n codon == 'CAT'\n\n end\n\n end", "def ensure_metadata_as_expected!\n expected_metadata_rb = <<~E\n name 'foo'\n maintainer ''\n maintainer_email ''\n license ''\n description 'Installs/Configures foo'\n long_description 'Installs/Configures foo'\n version '1.0.0'\n\n E\n expect(IO.read(metadata_path)).to eq(expected_metadata_rb)\n end", "def check_cop_definition\n cop\n rescue => exception\n raise format(FAILURE, exception: exception)\n end", "def check_course_template_updated_data_validity(course_template_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' }\n }\n }\n JSON::Validator.validate!(schema, course_template_data, validate_schema: true)\nend", "def test_validation\n \n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-')\n pcba_pn = '500-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No - PCB, PCBA part numbers are not unique.\n pcba_pn = '600-123-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert( pn.error_message)\n assert_equal('The PCB part number (600-123-a0 a) and the PCBA part number ' +\n \"(600-123-00 b) must be unique - YOUR PART NUMBER WAS NOT CREATED\",\n pn.error_message)\n \n\n # Valid? - No - Format bad, short prefix\n pcb_pn = '12-123-a0'.split('-')\n pcba_pn = '34-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No - Format bad, illegal characters in the prefix\n pcb_pn = '12e-123-a0'.split('-')\n pcba_pn = 'pcb-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, wrong number of characters in the number\n pcb_pn = '127-3-a0'.split('-')\n pcba_pn = '128-21-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the number\n pcb_pn = '127-###-a0'.split('-')\n pcba_pn = '128-JPA-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the dash number\n pcb_pn = '127-714-*'.split('-')\n pcba_pn = '128-755-!&'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert(!pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes\n pcb_pn = '127-714-01'.split('-')\n pcba_pn = '128-755-a0'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n\n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No, pcb pn exists.\n pcb_pn = '252-700-b0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n \n # Valid? - No, pcb pn duplicates pcba pn \n pcb_pn = '259-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'b'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n # Valid? - No, pcb pn prefix contains the wrong number of characters \n pcb_pn = '12-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No, pcb pn prefix contains illegal characters \n pcb_pn = '12e-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains wrong number of characters \n pcb_pn = '127-3-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n #assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains illegal characters \n pcb_pn = '127-#*@-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn dash number contains wrong number of, and illegal, characters \n pcb_pn = '127-714-@'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes \n pcb_pn = '127-714-01'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n \n assert(!pn.exists?)\n assert_nil(pn.error_message)\n pn.save\n assert(pn.exists?)\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n\n assert(PartNumber.valid_prefix?('100'))\n assert(!PartNumber.valid_prefix?('1'))\n assert(!PartNumber.valid_prefix?('a'))\n assert(!PartNumber.valid_prefix?('10'))\n assert(!PartNumber.valid_prefix?('a7'))\n assert(!PartNumber.valid_prefix?('1aa'))\n assert(!PartNumber.valid_prefix?('a00'))\n assert(!PartNumber.valid_prefix?('1776'))\n assert(!PartNumber.valid_prefix?('a345'))\n \n assert(PartNumber.valid_number?('100'))\n assert(!PartNumber.valid_number?('1'))\n assert(!PartNumber.valid_number?('a'))\n assert(!PartNumber.valid_number?('10'))\n assert(!PartNumber.valid_number?('a7'))\n assert(!PartNumber.valid_number?('1aa'))\n assert(!PartNumber.valid_number?('a00'))\n assert(!PartNumber.valid_number?('1776'))\n assert(!PartNumber.valid_number?('a345'))\n \n assert(PartNumber.valid_dash_number?('a0'))\n assert(PartNumber.valid_dash_number?('0a'))\n assert(!PartNumber.valid_dash_number?('a'))\n assert(!PartNumber.valid_dash_number?('4'))\n assert(!PartNumber.valid_dash_number?('aa33'))\n assert(!PartNumber.valid_dash_number?('333'))\n \n # Create known part numbers for testing.\n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-802-00'.split('-')\n pcba_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-01'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n\n pn = PartNumber.initial_part_number\n pcb_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert(!pn.valid_components?('not'=='new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n pcba_pn = '700-900-90'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n \n pcba_pn = '000-000-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n end", "def test_third_line\n assert_equal \" def valid_working_gemspec_args\\n\",\n Working.file_third_line(__FILE__)\n end", "def verify_valid_update\n if branch_merge\n verify_valid_branch_merge\n elsif !overwrite?\n verify_non_destructive\n end\n end", "def one_nine?\n @comments.any? do |comment|\n comment['version'] == @spec.version and comment['works_for_me']\n end\n end", "def gemspec?; end", "def missing_check v \n v.one_of_type? Hash, LinkSpec\n end", "def valid_format?(format)\n return false if format.nil?\n\n FORMATS.include? format.to_sym\n end", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil?\n return true\n end\n\n false\n end", "def matches_moov_definition?(io)\n maybe_atom_size, maybe_ftyp_atom_signature = safe_read(io, 8).unpack('N1a4')\n minimum_ftyp_atom_size = 4 + 4 + 4 + 4\n maybe_atom_size >= minimum_ftyp_atom_size && maybe_ftyp_atom_signature == 'ftyp'\n end", "def _semantics_check(clazz, buffer)\n end", "def verify_config(opts)\n opts = check_params(opts,[:instance_format,:data])\n super(opts)\n end", "def check_conventions\n\tcheck_encoding\n\tcheck_yaml\n\tcheck_merge\n\tcheck_cucumber\n\tcheck_ruby\nend", "def check(config = {})\n defaults = {validator: 'clang-format', file_extensions: ['.h', '.m', '.mm'], ignore_file_patterns: []}\n config = defaults.merge(config)\n validator = *config[:validator]\n file_extensions = [*config[:file_extensions]]\n ignore_file_patterns = [*config[:ignore_file_patterns]]\n\n diff = git.added_files.concat git.modified_files\n offending_files, patches = resolve_changes(validator, diff)\n\n message = ''\n unless offending_files.empty?\n message = 'Code style violations detected in the following files:' + \"\\n\"\n offending_files.each do |file_name|\n message += '* `' + file_name + \"`\\n\\n\"\n end\n message += 'Execute one of the following actions and commit again:' + \"\\n\"\n message += '1. Run `%s` on the offending files' % validator + \"\\n\"\n message += '2. Apply the suggested patches with `git apply patch`.' + \"\\n\\n\"\n message += patches.join(\"\\n\")\n end\n\n return if message.empty?\n fail VIOLATION_ERROR_MESSAGE\n markdown '### Code Style Check'\n markdown '---'\n markdown message\n end", "def valid?\n if Gem.loaded_specs.has_key?(\"json-schema\")\n return validation_errors.empty?\n else\n return true\n end\n end", "def test_format_build\n version = VMLib::Version.new\n\n # Test that an emtpy build corresponds to an empty string\n version.build = ''\n assert_equal '', version.format('%b')\n\n # Test that a custom build prints exactly as entered\n version.build = '001'\n assert_equal '+001', version.format('%b')\n\n version.build = '20130313144700'\n assert_equal '+20130313144700', version.format('%b')\n\n version.build = 'exp.sha.5114f85'\n assert_equal '+exp.sha.5114f85', version.format('%b')\n end", "def validates_format_of(*args)\n validates_with(FormatValidator, _merge_attributes(args))\n end", "def resembles_gridref?\n !!(self.upcase =~ /^\\w\\w\\d{2,}/)\n end", "def semantic?\n !!(self =~ /^v?\\d+\\.\\d+\\.\\d+$/ ||\n self =~ /^v?\\d+\\.\\d+\\.\\d+\\.(dev|pre)\\d+$/\n )\n end", "def git_ref_type\n Pkg::Util.in_project_root do\n stdout, _, _ = Pkg::Util::Execution.capture3(\"#{GIT} cat-file -t #{git_describe}\")\n stdout.strip\n end\n end", "def object_ref_item_schema\n {\n 'type' => 'object',\n 'additionalProperties' => false,\n 'properties' => {\n \"spec\" => {\n 'type' => 'string',\n 'pattern' => '^https?://'\n },\n \"id\" => {\n 'type' => 'string',\n 'pattern' => '^https?://'\n },\n \"name\" => {\n 'type' => 'string',\n 'pattern' => '^[^\\n]+$'\n }\n }\n }\n end", "def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end", "def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end" ]
[ "0.7634264", "0.6585689", "0.6480538", "0.63305", "0.6256705", "0.60151297", "0.59479856", "0.59479856", "0.59479856", "0.5900144", "0.58977306", "0.586551", "0.58257085", "0.58159834", "0.5685376", "0.56827205", "0.5572799", "0.5551575", "0.550738", "0.5500304", "0.54869676", "0.547353", "0.5448382", "0.542406", "0.5418323", "0.541439", "0.54003495", "0.5373817", "0.5368943", "0.53538984", "0.5337361", "0.5320568", "0.5298089", "0.5295415", "0.52869946", "0.5283219", "0.5264005", "0.52593404", "0.52307135", "0.5197703", "0.51601815", "0.5144491", "0.5134847", "0.5132789", "0.512997", "0.5129773", "0.5121303", "0.5120079", "0.51140994", "0.5112353", "0.511165", "0.51051027", "0.51026237", "0.50986356", "0.5090683", "0.5090683", "0.5088777", "0.5088478", "0.5086463", "0.50798696", "0.50616014", "0.50547194", "0.50547194", "0.50435674", "0.50412196", "0.5034733", "0.502979", "0.5024874", "0.50080067", "0.5006779", "0.5003015", "0.50022084", "0.49961475", "0.49815747", "0.49793193", "0.49639177", "0.49590594", "0.4944001", "0.4932174", "0.4925185", "0.49210876", "0.49208716", "0.49178225", "0.49122304", "0.49097934", "0.490964", "0.4909505", "0.4906392", "0.49061197", "0.4904422", "0.4898054", "0.48921928", "0.48886415", "0.48884597", "0.4885591", "0.48842052", "0.4875692", "0.48749092", "0.48695606", "0.48695606" ]
0.7281103
1
Validate a Git SSH urls
def valid_git_ssh_url?(url) url.match(GIT_SSH_URL_REGEX) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_url_must_be_valid\n matched = false\n\n [/^https?:\\/\\/.+\\.git$/i, /^git@.+:.+\\.git$/i].each do |valid_form|\n if valid_form.match git_url\n matched = true\n break\n end\n end\n\n unless matched\n errors.add(:git_url, 'must be of form http[s]://host/path/to/repository.git OR git@host:path/to/repository.git')\n end\n end", "def check_git_ssh_source(s)\n if git = s[:git]\n if git =~ %r{\\w+\\@(\\w|\\.)+\\:(/\\w+)*}\n results.add_warning('source', 'Git SSH URLs will NOT work for ' \\\n 'people behind firewalls configured to only allow HTTP, ' \\\n 'therefore HTTPS is preferred.', true)\n end\n end\n end", "def git_url?(url)\n url.include?('.git') || url.include?('git@') || url.include?('git://')\n end", "def is_url_valid\n\t\tunless self.long_url.starts_with?(\"http://\", \"https://\")\n\t\t\terrors.add(:long_url, \"invalid format\")\n\t\tend\n\tend", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(SSH_REGEXP).nil?\n return true\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n false\n end", "def validate_target_bosh_host\n URI.parse(target_bosh_host)\n true\n rescue\n false\n end", "def valid?\n Wgit::Url.valid?(self)\n end", "def check_remote_path_valid\n @ssh.exec!(\"ls #{@remote_path}\") do |ch, stream, data|\n if stream == :stderr and not data.nil?\n raise RemotePathInvalidException, \"remote path #{@remote_path} not found\"\n end\n end\n end", "def check_url_validation\n errors.add(:url, I18n.t('url_not_proper')) unless UrlShort.is_valid? (url)\n end", "def url_must_be_valid\n url.blank? ||\n (url_is_remote? and url_has_suffix? and url_matches?) ||\n errors.add(:url, :invalid)\n end", "def check_host(url)\n if url.scheme !~ /^https?$/\n [422, {}, \"Invalid url: #{url}\"]\n else\n @host_check.call url\n end\n end", "def check_repo(url)\n output = `git ls-remote #{url} 2>&1`\n if ($? != 0)\n raise BadRepo.new(url + \"<<<\" + output.to_s + \">>>\")\n end\n end", "def url_valid?\n ALLOWED_URLS.each do |host, url_allowed|\n if url.include? url_allowed\n @host = host\n return true\n end\n end\n false\n end", "def parse_url url\n begin\n URI.parse(url)\n \n rescue URI::InvalidURIError\n if m = url.match(\"^(#{USERINFO})@(#{HOST}):(#{REL_PATH})$\")\n URI::Generic.new \"ssh\", m[1], m[2], 22, nil, \"/\" + m[3], nil, nil, nil\n \n else\n raise\n end\n end\n end", "def perform_github_source_checks(s)\n require 'uri'\n\n if git = s[:git]\n return unless git =~ /^#{URI.regexp}$/\n git_uri = URI.parse(git)\n if git_uri.host\n perform_github_uri_checks(git, git_uri) if git_uri.host.end_with?('github.com')\n end\n end\n end", "def valid_url\n unless UrlValidator.valid_entry_url? self.url\n errors.add :url, \"URL #{self.url} is not a valid http, https or protocol-relative URL\"\n end\n end", "def parse_url(input)\n hosts = \"github\\.com|bitbucket\\.org|gitlab\\.com\"\n\n # HTTPS/HTTP link pointing to recognised hosts\n if input =~ /^(?:https?:\\/\\/)?(?:[^.@]+@)?(?:www\\.)?(#{hosts})\\/([^\\/]+)\\/([^\\/]+)/i\n { host: $1.downcase(), user: $2, repo: $3.sub(/\\.git$/, \"\") }\n # SSH\n elsif input =~ /^git@(#{hosts}):([^\\/]+)\\/([^\\/]+)\\.git$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # provider:user/repo\n elsif input =~ /^(github|bitbucket|gitlab):\\/?([^\\/]+)\\/([^\\/]+)\\/?$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # user/repo - Common GitHub shorthand\n elsif input =~ /^\\/?([^\\/]+)\\/([^\\/]+)\\/?$/\n { host: \"github.com\", user: $1, repo: $2 }\n else\n raise \"Unsupported URL: #{input}\"\n end\nend", "def save_git_url\n puts \"\\nPlease enter your #{@git_service} url :\"\n puts 'example: http://gitlab.example.com/'\n puts '-----------------------------------'\n\n begin\n input = STDIN.gets.chomp\n exit! if input == 'quit'\n # force scheme if not specified\n # TODO - Find a way to clear this... Find the correct scheme.\n if input.start_with?('gitlab.com')\n input = \"https://#{input}\"\n elsif !input.start_with?('http://', 'https://')\n input = \"http://#{input}\"\n end\n # Call the entered url to know if it exist or not.\n # If not, would raise an exception\n get(url: input)\n input\n rescue Interrupt\n exit!\n rescue Exception\n puts \"\\nOops, seems to be a bad url. Try again or quit (quit)\"\n save_git_url\n end\n end", "def valid?\n (uri.host =~ LINK_REGEX || uri.host =~ LINK_IP_REGEX) ? true : false\n end", "def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end", "def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end", "def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end", "def proper_url? \n\t\tif !(self.long_url.start_with?('http://') || self.long_url.start_with?('https://'))\n\t\t\terrors.add(:long_url, \"is in invalid format.\")\n\t\tend \n\tend", "def validate_url\r\n url = @hostname\r\n #puts \"DEBUG: url: \" + url\r\n \r\n url_part = []\r\n url_parts = url.split('.') \r\n #puts \"DEBUG: url_parts[0]: \" + url_parts[0]\r\n \r\n if url_parts[0].is_a? Numeric \r\n validate_sub_url(url_parts[0])\r\n validate_sub_url(url_parts[1])\r\n validate_sub_url(url_parts[2])\r\n validate_sub_url(url_parts[3])\r\n else # letters\r\n #puts \"URL just letters\"\r\n end\r\n ping_url\r\n end", "def valid_url?\n\t\t# http:// or not http://\n\t\tx = self.long_url.start_with?(\"http://\", \"https://\")\n\t\tif x == false\n\t\t\treturn \"http://\" + self.long_url\n\t\telse\n\t\t\treturn self.long_url\n\t\tend\n\tend", "def validate\n needs :http_url unless http_url\n end", "def check_submissions(url)\n url = url.downcase\n if url.include?(\"http://www.\")\n valid_url?(url) ? url : false\n elsif url.include?(\"www.\")\n valid_url?(url.insert(0,\"http://\")) ? url : false\n else\n valid_url?(url.insert(0,\"http://www.\")) ? url : false\n end\nend", "def contains_invalid_urls(markdown)\n urls = markdown.scan(/]\\((?<matching>http[^\\)\"]+)/).flatten # matches [text](url) or [text](url \"title\")\n urls += markdown.scan(/<(?<matching>http[^>]+)/).flatten # matches <url>\n urls += markdown.scan(/: (?<matching>http[^\"\\n]+)/).flatten # matches [id]: url or [id]: url \"title\"\n urls.each do |url|\n begin\n check_url(url.strip) # strip url because matches on [text](url \"title\") end with a space\n rescue => e\n declare_url_error('content', url, \"got an error : '#{e}'\")\n end\n end\n end", "def validate_url_format\n valid_url = false\n begin\n uri = URI.parse(url)\n valid_url = uri.scheme.present? || uri.host.present?\n rescue URI::InvalidURIError\n valid_url = false\n end\n errors.add(:url, 'format is invalid') unless valid_url\n end", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil?\n return true\n end\n\n false\n end", "def validate_full_url\n if self.full_url.nil?\n return\n end\n\n if((self.full_url =~ URI::regexp(\"http\")) == nil && (self.full_url =~ URI::regexp(\"https\")) == nil)\n self.errors.add(:full_url, \"Full url is not a valid url\")\n end\n end", "def validate_ref(repo, ref)\n ref_valid = true\n cmd = \"git ls-remote --tags --exit-code #{repo} #{ref} >/dev/null\"\n system(cmd)\n if $?.exitstatus != 0\n ref_valid = false\n end\n ref_valid\n end", "def url_is_valid\n errors.add(:url, \"url is not valid\") unless is_http_url? || is_spotify_url?\n end", "def valid_url?\n # Not sure if we should make a change in the user initial data, we could just return as invalid.\n my_target_url = target_url.match(/http/) ? target_url : target_url.prepend(\"http://\")\n\n response = HTTParty.get(my_target_url) rescue nil\n\n return if response&.code == 200\n\n errors.add(:short_url)\n end", "def split_url\n match = /(?:(?:git|ssh)@(.*):|(?:https?:\\/\\/(.*?)\\/))(.*).git/.match(url)\n match.captures.compact if match\n end", "def url_is_valid_url\n uri = URI.parse(url)\n if !uri.kind_of?(URI::HTTP)\n errors.add(:url, \"must be a valid HTTP/HTTPS URL\")\n end\n rescue URI::InvalidURIError\n end", "def validate_url\n self.url = ExternalWork.format_url(self.url)\n errors.add_to_base(t('invalid_url', :default => \"Not a valid URL\")) unless self.url_active?\n end", "def check_if_link_is_valid\n uri = URI.parse(self.url.split(\" \")[0])\n self.url = uri\n if !%w( http https ).include?(uri.scheme)\n self.url = nil\n end\n end", "def validate_url(string)\n schemes = ['http', 'https']\n match = string.match(URI.regexp(schemes))\n return (0 == match.begin(0) and string.size == match.end(0)) if match\n false\n end", "def is?(url)\n return true if url.match('https?://github\\.com/(.+)/(.+)')\n end", "def errors\n errors = []\n\n if repo_url\n begin\n uri = URI(repo_url)\n errors << \"Invalid repository URL. Only SSH supported at the moment. Expected format: ssh://host/path/to/repo.git\" \\\n unless uri.scheme == 'ssh'\n rescue URI::InvalidURIError\n errors << \"Invalid repository URL. Expected format: ssh://host/path/to/repo.git\"\n end\n end\n\n unless [ssh_private_file, ssh_public_file].select { |v| v } .empty?\n errors << \"Missing SSH user.\" unless ssh_user\n errors << \"Missing private SSH key.\" unless ssh_private_file\n errors << \"Missing public SSH key.\" unless ssh_public_file\n end\n\n unless [docker_user, docker_password, docker_email].select { |v| v } .empty?\n errors << \"Missing Docker user.\" unless docker_user\n errors << \"Missing Docker password.\" unless docker_password\n errors << \"Missing Docker email.\" unless docker_email\n end\n\n if ping_url\n begin\n uri = URI(ping_url)\n errors << \"Invalid ping URL. Only HTTP / HTTPS supported at the moment. Expected format: https://domain.tld/api/notify\" \\\n unless uri.scheme == 'http' || uri.scheme == 'https'\n rescue URI::InvalidURIError\n errors << \"Invalid ping URL. Expected format: https://domain.tld/api/notify\"\n end\n end\n\n errors\n end", "def allowed_ssh?\n port_protocol_allowed('22')\n end", "def build_host_regex_check(regex)\n @host_check = lambda do |url|\n if url.host.to_s !~ regex\n [422, {}, \"URL must match #{regex.inspect}\"]\n end\n end\n end", "def attempt_to_clone_using_http_auth?(remote_url, dir)\n processed_remote_url, credential_exists,\n repo_username_key, repo_password_key = get_remote_credentials(remote_url)\n\n # if it is not https format\n # we will assume it is ssh format and use normal clone\n if processed_remote_url.nil?\n clone_success, = git_clone(remote_url, dir)\n\n return true if clone_success\n\n fail_to_access(remote_url)\n else\n # otherwise\n # it is https url\n # and wheter it has credentials or not, still clone it\n\n @logger.info(\"Attempting to using your configured credentials for #{remote_url}\")\n\n clone_success, error_msg = git_clone(processed_remote_url, dir)\n\n return true if clone_success\n\n # we fail, so raise corresponding messages\n\n # we has credentials\n if credential_exists\n credentials_are_present_but_fail_to_access(remote_url,\n repo_username_key,\n repo_password_key)\n else\n # we has internet but unable to connect\n if error_msg.match?('fatal: unable to access')\n fail_to_access(remote_url)\n # we has no internet or has no credentials\n else\n internet_down_or_credential_not_found_to_access(remote_url,\n repo_username_key,\n repo_password_key)\n end\n end\n end\n\n return false\n end", "def validate_source_url(spec)\n return if spec.source.nil? || spec.source[:http].nil?\n url = URI(spec.source[:http])\n return if url.scheme == 'https' || url.scheme == 'file'\n warning('http', \"The URL (`#{url}`) doesn't use the encrypted HTTPS protocol. \" \\\n 'It is crucial for Pods to be transferred over a secure protocol to protect your users from man-in-the-middle attacks. '\\\n 'This will be an error in future releases. Please update the URL to use https.')\n end", "def long_url_is_an_url\n errors.add(:long_url, \"This is not a valid url\") unless is_valid_url?(self.long_url_with_protocol)\n end", "def remote?\n !(url =~ /^https?/).nil?\n end", "def github_url_matching(url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end", "def check(url)\n LongURL::URL.check url\n end", "def ensure_ontology_url_format\n if self.ontology_urls.blank?\n errors.add(:ontology_urls, \"cannot be empty if SearchFacet is ontology-based\")\n else\n self.ontology_urls.each do |ontology_url|\n # check that entry is a Hash with :name and :url field\n unless ontology_url.is_a?(Hash) && ontology_url.with_indifferent_access.keys.sort == %w(name url)\n errors.add(:ontology_urls, \"contains a misformed entry: #{ontology_url}. Must be a Hash with a :name and :url field\")\n end\n santized_url = ontology_url.with_indifferent_access\n unless url_valid?(santized_url[:url])\n errors.add(:ontology_urls, \"contains an invalid URL: #{santized_url[:url]}\")\n end\n end\n end\n end", "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end", "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end", "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end", "def all_valid?\n valid_url?\n end", "def validate_uri(url)\n return validate({:url => url})\n end", "def validate_url(url)\n results = /\\A(?:(?:https?|ftp):\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!10(?:\\.\\d{1,3}){3})(?!127(?:\\.\\d{1,3}){3})(?!169\\.254(?:\\.\\d{1,3}){2})(?!192\\.168(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?\\z/.match(url)\n return false if results.nil? || results.length == 0\n response = Typhoeus.get(url)\n return true if response.code == 200\n true\n end", "def ssh?\n true\n end", "def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end", "def harmonize_remote_url(expected_url)\n remote_url = Cocaine::CommandLine.new(\"git config --get remote.origin.url\").run.chomp\n if remote_url != expected_url\n puts \"#{remote_url.inspect} does not match #{expected_url.inspect}. Updating it.\"\n Cocaine::CommandLine.new(\"git remote\", \"set-url origin #{expected_url}\").run\n end\n end", "def ensure_ontology_url_format\n if self.ontology_urls.blank?\n errors.add(:ontology_urls, \"cannot be empty if SearchFacet is ontology-based\")\n else\n self.ontology_urls.each do |ontology_url|\n # check that entry is a Hash with :name and :url field\n unless ontology_url.is_a?(Hash) && ontology_url.with_indifferent_access.keys.sort == %w(browser_url name url)\n errors.add(:ontology_urls, \"contains a misformed entry: #{ontology_url}. Must be a Hash with a :name, :url, and :browser_url field\")\n end\n santized_url = ontology_url.with_indifferent_access\n unless url_valid?(santized_url[:url])\n errors.add(:ontology_urls, \"contains an invalid URL: #{santized_url[:url]}\")\n end\n end\n end\n end", "def validate(url)\n if url && url.is_a?(String) && url.match(/(^$)|(^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$)/ix)\n return true\n else\n raise InvalidURL\n end\n end", "def valid_host?\n return false if invalid_uri_error?\n \n # check for wildcard definition e.g. *.github.com\n wildcard_hosts = Array.new\n @valid_hosts.each do |valid_host|\n result = valid_host.scan(/^\\*\\.(.*\\..*)$/)\n wildcard_hosts << result[0] unless result.empty?\n end\n return wildcard_hosts.include?(@host.scan(/^(?:.*\\.)?(.*\\..*)$/)[0]) unless wildcard_hosts.empty?\n \n # basic check\n return @valid_hosts.include?(@host) || @valid_hosts.empty? \n end", "def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end", "def invalid_url?(url)\n url.include? 'hurl.it'\n end", "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end", "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end", "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end", "def url?(url)\n assert_type(url, String) # This includes Wgit::Url's.\n hash = { 'url' => url }\n @client[:urls].find(hash).any?\n end", "def valid_url?(url)\r\n uri = URI.parse(url)\r\n return true if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)\r\n false\r\n rescue\r\n false\r\n end", "def url_valid?\n uri = URI(full_url)\n Net::HTTP.start(uri.host, uri.port, :use_ssl => full_url.start_with?(\"https\")) do |http|\n response = http.request_get(full_url)\n return response.is_a?(Net::HTTPOK) || response.is_a?(Net::HTTPRedirection)\n end\n end", "def validate_url\n url = params[:url] || params[:program][:url]\n begin\n URI.parse(url) if url\n rescue URI::InvalidURIError\n raise ExceptionTypes::BadRequestError.new(\"Invalid characters used in URL: #{url}\")\n end\n end", "def url_exists?(github_url)\n url = URI.parse(github_url)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.is_a?(Net::HTTPRedirection)\n url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL\n else\n res.code[0] != '4' # false if http code starts with 4 - error on your side.\n end\nrescue Errno::ENOENT\n false # false if can't find the server\nend", "def valid_url?(url)\n uri = URI.parse(url)\n return true if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)\n false\n rescue\n false\n end", "def verify_url!\n fail InvalidUrlException unless uri.to_s =~ URI::regexp\n fail UnsupportedFileException if !valid_readers_format? && !valid_file_format?\n end", "def absolute_url?(string); end", "def is_a_real_url?\n begin\n URI.parse(long_url)\n rescue URI::InvalidURIError\n errors.add(:message, \"must be a valid URL\")\n end \n end", "def test_for_match(ssh, cmd, regex)\n res = ssh.exec!(cmd)\n if res !~ /#{regex}/\n error(regex+\" (\"+cmd+\") does not match \"+res)\n end\nend", "def valid_url?\n @url =~ URI::regexp\n end", "def value_url_valid?\n begin\n uri = URI.parse(value)\n uri = URI.parse(\"http://#{url}\") if uri.scheme.nil?\n if uri.scheme.downcase != 'http' and uri.scheme.downcase != 'https'\n @errors_data << 'validate_no_http_s_url'\n return false\n end\n value = uri.to_s\n return true\n rescue\n @errors_data << 'validate_invalid_url'\n return false\n end\n end", "def valid_url?(url)\n\t\turi = URI.parse(url)\n\t\treturn true if uri.is_a?(URI::HTTP) || uri.is_a?(URI::HTTPS)\n\t\tfalse\n\trescue\n\t\tfalse\n\tend", "def http_url\n errors[:url] << 'not a valid url' unless URI.parse(url).kind_of?(URI::HTTP)\n rescue URI::InvalidURIError\n errors[:url] << 'not a valid url'\n end", "def is_url?(url)\n\t\tputs \"Validate the URL format is valid: #{url}\" if @verbose\n\t\tbegin\n\t\t\tif url =~ /(http|https)\\:\\/\\/((.)+)/i\n\t\t\t\thost=$2.split('/')[0]\n\t\t\t\thost=host.split(':')[0]\n\t\t\t\tif is_ip?(host) or is_fqdn?(host)\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"Unknown URL format: #{url}\" if @verbose\n\t\t\t\treturn false\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn false\n\t\tend\n\tend", "def is_url?(path)\n path.to_s =~ %r{\\Ahttps?://}\n end", "def git_clone(url, target)\n cmd = \"git clone #{url} #{target}\"\n\n protocol = 'git'\n protocols = url.split(':')[0]\n protocols.split('+').each do |proto|\n next if proto == 'git'\n protocol = proto\n end\n\n if protocol.length == 0\n syserr 'Empty protocol'\n raise\n end\n\n case protocol\n when /http/i, /ftp/i, /https/i, /ssh/i, /git/i\n else\n syserr \"Unsupported protocol #{protocol}\"\n raise\n end\n\n unless sysexec(cmd)\n syserr 'git failed'\n raise\n end\nend", "def valid_url?(uri)\n parsed = URI.parse(uri)\n return (parsed.scheme == 'http' || parsed.scheme == 'https')\n rescue URI::InvalidURIError\n false\n end", "def valid_request?\n if env.include_all?(['SSH_CLIENT', 'SSH_CONNECTION', 'SSH_ORIGINAL_COMMAND'])\n if valid_command?(env['SSH_ORIGINAL_COMMAND'])\n return true\n end\n end\n false\n end", "def url?(link)\n true if link =~ /\\Ahttps?:\\/\\//\nend", "def valid_url?\n !Sailpoint.config.url.blank?\n end", "def url?(url_hash)\n @@db.client[:urls].find(url_hash).any?\n end", "def valid_link?(url)\n # GET or HEAD? Head is more friendly to the server, but some pages\n # May behave differently depending on HEAD or GET.\n HTTParty.head(url,\n verify: false, # don't verify ssl certs\n ).code == 200\n end", "def valid?\n return false if @author_email.nil?\n return false if @repository_url.nil?\n return false if @sha.nil?\n pattern = Regexp.new(\"^[a-fA-F0-9]{40}$\")\n return false if @sha !~ pattern\n true\n end", "def validate_job_seeker_url\r\n if not self.video_url .blank?\r\n if not self.video_url.match(/^(http|https):\\/\\/[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(([0-9]{1,5})?\\/.*)?$/ix)\r\n errors.add(\"URL\",\"Invalid URL\")\r\n end\r\n end\r\n end", "def valid_url?(url)\n resp = Curl.get url\n\n if resp.body_str.include? @invalid_text\n return false\n else\n return true\n end\nend", "def validate(url)\n begin\n uri = URI.parse(url)\n if uri.class != URI::HTTP\n\t return false\n end\n rescue URI::InvalidURIError\n\t return false\n end\n return true\nend", "def validate_url(link_text, validations)\n r = basic_validate_and_sanitize_string(link_text, validations)\n return r if !r.success?\n link_text = r.data[:sanitized_val]\n\n uri_value = URI.parse(link_text)\n\n if allowed_uri_class.include?(uri_value.class)\n success_with_data(sanitized_val: link_text)\n else\n error_result_obj(\"only https/http links are allowed\")\n end\n rescue => e\n error_result_obj(\"Invalid URL passed.\")\n end", "def original_is_valid?\n valid_host? && valid_length? && valid_scheme?\n end", "def assert_valid_url(string)\n assert string.to_s.match(/https?:\\/\\/[\\S]+/)\nend", "def build_host_string_check(hostname)\n @host_check = lambda do |url|\n if url.host != hostname\n [422, {}, \"URL must be from #{hostname}\"]\n end\n end\n end", "def valid_url?(url)\n begin\n Net::HTTP.get_response(URI(url)).code == \"200\" ? true : false\n rescue SocketError\n false\n end\nend", "def validate_each(record, attribute, value)\n if value.is_a?(Array)\n record.errors.add(attribute, 'must start with http:// or https://') if value.any? { |e| !e.match?(URL_REGEX) }\n else\n record.errors.add(attribute, 'must start with http:// or https://') unless value.match?(URL_REGEX)\n end\n end" ]
[ "0.80382884", "0.7494356", "0.67685974", "0.6469758", "0.64237416", "0.63534147", "0.6352756", "0.63049835", "0.62823087", "0.6242235", "0.621529", "0.6212526", "0.61539316", "0.61320907", "0.6125146", "0.60870737", "0.6063904", "0.60533315", "0.6048245", "0.6045237", "0.6045237", "0.6045237", "0.60417885", "0.60169524", "0.59885716", "0.5987668", "0.59634", "0.59075", "0.5895982", "0.588439", "0.587856", "0.5870438", "0.5841306", "0.5824848", "0.5805628", "0.5796133", "0.57687664", "0.57445836", "0.57377183", "0.5724054", "0.57176673", "0.57120335", "0.57093114", "0.5684655", "0.5670118", "0.5668327", "0.56600267", "0.5651028", "0.5618256", "0.5600239", "0.5597826", "0.5597826", "0.5597826", "0.55972755", "0.559373", "0.55930537", "0.55800045", "0.55745125", "0.55742866", "0.55653715", "0.55528104", "0.55479974", "0.5544914", "0.55401474", "0.55361235", "0.55361235", "0.55361235", "0.5535491", "0.5525907", "0.55130535", "0.5512019", "0.55097765", "0.5504413", "0.5493809", "0.54896456", "0.54858905", "0.54613894", "0.545912", "0.54560083", "0.5447712", "0.54371303", "0.5435514", "0.5435467", "0.54338014", "0.54122126", "0.5401686", "0.5397889", "0.5397329", "0.5395592", "0.5393647", "0.53873545", "0.53797334", "0.53784496", "0.53775", "0.5371374", "0.53524417", "0.5340652", "0.5327866", "0.53105944", "0.53036004" ]
0.8440473
0
Validate a Git refspec [+]: [+]refs//:refs// GIT_REFSPEC_REGEX = /\A\+?([^:])(:([^:]))?\z/
def valid_git_refspec?(refspec) refspec.match(GIT_REFSPEC_REGEX) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_refspec\n begin\n valid_git_refspec_path?(explicit_refspec)\n rescue => e\n errors.add(:explicit_refspec, e.message)\n end\n end", "def valid_refspec_path?(refspec)\n !refspec || refspec == '' || parse_refspec(refspec) ? true : false\n end", "def validate(ref_name)\n not_allowed_prefixes = %w(refs/heads/ refs/remotes/ -)\n return false if ref_name.start_with?(*not_allowed_prefixes)\n return false if ref_name == 'HEAD'\n\n begin\n Rugged::Reference.valid_name?(\"refs/heads/#{ref_name}\")\n rescue ArgumentError\n return false\n end\n end", "def git_url_must_be_valid\n matched = false\n\n [/^https?:\\/\\/.+\\.git$/i, /^git@.+:.+\\.git$/i].each do |valid_form|\n if valid_form.match git_url\n matched = true\n break\n end\n end\n\n unless matched\n errors.add(:git_url, 'must be of form http[s]://host/path/to/repository.git OR git@host:path/to/repository.git')\n end\n end", "def refspec=(refspec)\n if refspec =~ /^\\+?(.*)(?:\\:.*)$/\n @branch = $1\n else\n raise ArgumentError, \"refspec syntax error. Should be: branch:refs/heads/branch\"\n end\n @refspec = refspec\n end", "def short_pattern\n /\n (?:^|\\W) # beginning of string or non-word char\n (?:(#{qualifier_regex})(?:\\s))? # qualifier (optional)\n (?:(#{REPOSITORY_NAME})? # repository name (optional)\n \\#|(?:GH\\-))(\\d+) # issue number\n (?=\n \\.+[ \\t]| # dots followed by space or non-word character\n \\.+$| # dots at end of line\n [^0-9a-zA-Z_.]| # non-word character except dot\n $ # end of line\n )\n /ix\n end", "def validate_ref(repo, ref)\n ref_valid = true\n cmd = \"git ls-remote --tags --exit-code #{repo} #{ref} >/dev/null\"\n system(cmd)\n if $?.exitstatus != 0\n ref_valid = false\n end\n ref_valid\n end", "def parse_refspec(spec)\n parsed_refspec = spec.match(REF_COMPONENT_REGEX)\n return nil if parsed_refspec.nil?\n if parsed_refspec[1]\n # Should be first class. If no type component, return fail\n if parsed_refspec[3]\n { type: parsed_refspec[3], name: parsed_refspec[4] }\n else\n nil\n end\n elsif parsed_refspec[3]\n { type: nil, name: \"#{parsed_refspec[3]}/#{parsed_refspec[4]}\" }\n else\n { type: nil, name: parsed_refspec[4] }\n end\n end", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(SSH_REGEXP).nil?\n return true\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n false\n end", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil?\n return true\n end\n\n false\n end", "def validate_gemspec; end", "def url_pattern\n %r{\n (?:^|\\W) # beginning of string or non-word char\n (?:(#{qualifier_regex})(?:\\s))? # qualifier (optional)\n https://github.com/\n (#{REPOSITORY_NAME}) # repository name\n /(?:issues|pulls)/\n (\\d+) # issue number\n (?=\n \\.+[ \\t]| # dots followed by space or non-word character\n \\.+$| # dots at end of line\n [^0-9a-zA-Z_.]| # non-word character except dot\n $ # end of line\n )\n }ix\n end", "def valid_git_ssh_url?(url)\n url.match(GIT_SSH_URL_REGEX)\n end", "def regex_verify_string_comment\n /('(?:[^']|(?:\\\\'))*%(?:[^']|(?:\\\\'))*'|\"(?:[^\"]|(?:\\\\\"))*%(?:[^\"]|(?:\\\\\"))*\")/\nend", "def validate_gemspec\n Juwelier::Commands::ValidateGemspec.build_for(self).run\n end", "def check_commit_change_for_untagged_version\n return unless spec\n return unless spec.version == Version.new('0.0.1')\n ref_spec = related_specifications.find { |s| s.version != '0.0.1' }\n return unless ref_spec\n unless ref_spec.source[:commit] == spec.source[:commit]\n error \"Attempt to rewrite the commit of 0.0.1 version.\"\n end\n end", "def valid_gemspec?; end", "def match_params\n /([^\\s\\:]+)\\s*\\/\\s*([^\\s\\.git]+)/.match(self.url)\n end", "def validate_gemspec\n build_command(Jeweler::Commands::ValidateGemspec).run\n end", "def validate_gemspec\n Jeweler::Commands::ValidateGemspec.build_for(self).run\n end", "def matcher(uri)\n rex = /.+\\/github.com\\/([\\w-]+\\/[\\w-]+)/\n return rex.match(uri)\n end", "def matcher(uri)\n rex = /github.com\\/([\\w-]+\\/[\\w-]+)/\n return rex.match(uri)\n end", "def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end", "def mixed_syntax?\n !/\n [><=^~]{1,2} # comparison operators\n \\s*\n \\d\\. # MAJOR\n (?:\n (?:x|\\*) # MINOR is wildcard\n |\n \\d\\.(?:x|\\*) # MINOR is digit and PATCH is wildcard\n )\n /x.match(requirement).nil?\n end", "def test_match\n reg = RustRegexp.new(\"(https?://[^/]+)[-a-zA-Z0-9./]+\")\n assert_false reg.match(\"http://masamitsu-murase.12345/hoge.html\").nil?\n assert_nil reg.match(\"http:///masamitsu-murase.12345/hoge.html\")\n end", "def git_changes?(patchdef)\n patchdef.find {|p| p[1] =~ /^[^.]/}\n end", "def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(HG_REGEXP).nil?\n return true\n end\n\n false\n end", "def has_valid_issue_ref?(body, general_ref_spec, flake_config)\n body.scan(general_ref_spec) do |reference|\n $stderr.puts \" Determining if reference ##{reference[1]} meets criteria...\"\n issue_id = reference[1].to_i\n if issue_has_label?(issue_id, flake_config['repo'], flake_config['label'])\n $stderr.puts \" Reference ##{reference[1]} points to a valid flake issue\"\n return true\n end\n end\n\n return false\n end", "def module_regex(module_name)\n \"github.com\\\\/ministryofjustice\\\\/cloud-platform-terraform-#{module_name}.ref=...\"\nend", "def parts_of_reference (docset, ref_str)\n\tref = ref_str.split\n\tif ref.length != 2\n\t\tTextMate.exit_show_tool_tip \"Cannot parse reference: #{str}\"\n\tend\n\n\tlanguage, type, klass, thing = ref[0].split('/')\n\tRef.new(docset, language, type, klass, thing, ref[1])\nend", "def validate_http_referer(ref)\n # This expects 'ref' to be a valid (or at least mostly valid) url. It may through an exception if it isn't\n ref_uri = Addressable::URI.heuristic_parse(ref, :scheme => 'http')\n address_uri = address_as_uri\n \n schemes_match?(ref_uri.scheme, address_uri.scheme) && hosts_match?(ref_uri.host, address_uri.host) && paths_match?(ref_uri.path, address_uri.path)\n# schemes_match?(ref_uri.scheme) && hosts_match?(ref_uri.host) && paths_match?(ref_uri.path)\n end", "def git_url?(url)\n url.include?('.git') || url.include?('git@') || url.include?('git://')\n end", "def validate_repo(repo)\n repo_valid = true\n if /review\\.fuel-infra\\.org/.match(repo).nil? and /github\\.com\\/fuel-infra/.match(repo).nil?\n repo_valid = false\n end\n repo_valid\n end", "def make_regexp(schemes = nil)\n unless schemes\n @regexp[:ABS_URI_REF]\n else\n /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x\n end\n end", "def make_regexp(schemes = nil)\n unless schemes\n @regexp[:ABS_URI_REF]\n else\n /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x\n end\n end", "def regexp_anchored?(regexp)\n regexp.source =~ /\\A(\\\\A|\\^).*(\\\\Z|\\$)\\Z/m ? true : false\n end", "def validate_documentation_url(spec)\n validate_url(spec.documentation_url) if spec.documentation_url\n end", "def back_ref(kind)\n if lm = @last_match\n res = case kind\n when :&\n lm[0]\n when :\"`\"\n lm.pre_match\n when :\"'\"\n lm.post_match\n when :+\n lm.captures.last\n end\n\n return res\n end\n\n return nil\n end", "def back_ref(kind)\n if lm = last_match()\n res = case kind\n when :&\n lm[0]\n when :\"`\"\n lm.pre_match\n when :\"'\"\n lm.post_match\n when :+\n lm.captures.last\n end\n\n return res\n end\n\n return nil\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def valid_gemspec?\n gemspec_helper.valid?\n end", "def check_scheme(v)\n if v && parser.regexp[:SCHEME] !~ v\n raise InvalidComponentError,\n \"bad component(expected scheme component): #{v}\"\n end\n\n return true\n end", "def check_format_rules(line_number, line)\n errors = []\n unless line_number > 0\n conventions = ['feat', 'fix', 'build', 'chore', 'ci', 'docs', 'style', 'refactor', 'perf', 'test']\n conventional_commit_conventions = conventions.map{|x| Regexp.new '(^' + x + ')' + '(\\(.*\\))?!?: [\\w+\\D\\-\\d+]'}\n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n errors << \"\\tError: Your custom commit doesn't seem like following conventional commit rules.\"\n errors << \"\\tCheck https://www.conventionalcommits.org\"\n end\n end\n errors << \"\\tError: Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(']')[1]&.length.to_i > 50\n errors << \"\\tError: Commit message subject should start in Capital.\" if line.split(']')[1] && line.split(']')[1].lstrip[0] == line.split(']')[1].lstrip[0].downcase\n end\n return errors\nend", "def valid_name?(name)\n name =~ /^[^\\/?*:;{}\\\\]+$/\n end", "def match_hex(line)\n\tline.scan(/\\w\\:[\\s\\w]*(#[a-f0-9]{6}|#[a-f0-9]{3})+/i)\nend", "def rev_parse(rev)\n git.exec(\"rev-parse\",\"--verify\",rev).chomp\n end", "def gem_line_regex(gem_name = '(.*)')\n /^\\s*gem\\s*['\"]#{gem_name}['\"]\\s*(,\\s*['\"](.+)['\"])?\\s*(,\\s*(.*))?\\n?$/\n end", "def terraform_ref?\n /^\\${[a-zA-Z0-9\\._-]+}$/.match(vpn_connection_id)\n end", "def is_absolute_part(part)\n part.strip.starts_with?('/') || part.strip.starts_with?('\\\\') ||\n part.strip =~ /^[A-Za-z]:([\\/\\\\])?/\n end", "def parse_git_uri(laser_gem)\n code_uri = laser_gem.gem_spec.source_code_uri\n if code_uri\n matches = matcher(code_uri)\n return matches[1] if matches\n end\n parse_additional_uris(laser_gem)\n end", "def valid?\n return false if @author_email.nil?\n return false if @repository_url.nil?\n return false if @sha.nil?\n pattern = Regexp.new(\"^[a-fA-F0-9]{40}$\")\n return false if @sha !~ pattern\n true\n end", "def rev_parse(ref)\n commit = git \"rev-parse #{ref}^{commit}\", :path => @full_path\n commit.chomp\n rescue R10K::ExecutionFailure => e\n logger.error \"Could not resolve ref #{ref.inspect} for git repo #{@full_path}\"\n raise\n end", "def check_path(v)\n # raise if both hier and opaque are not nil, because:\n # absoluteURI = scheme \":\" ( hier_part | opaque_part )\n # hier_part = ( net_path | abs_path ) [ \"?\" query ]\n if v && @opaque\n raise InvalidURIError,\n \"path conflicts with opaque\"\n end\n\n # If scheme is ftp, path may be relative.\n # See RFC 1738 section 3.2.2, and RFC 2396.\n if @scheme && @scheme != \"ftp\"\n if v && v != '' && parser.regexp[:ABS_PATH] !~ v\n raise InvalidComponentError,\n \"bad component(expected absolute path component): #{v}\"\n end\n else\n if v && v != '' && parser.regexp[:ABS_PATH] !~ v &&\n parser.regexp[:REL_PATH] !~ v\n raise InvalidComponentError,\n \"bad component(expected relative path component): #{v}\"\n end\n end\n\n return true\n end", "def needs_checkout?\n expected = ref.sha1\n actual = rev_parse('HEAD')\n\n ! (expected == actual)\n end", "def validate_hcl?(hcl)\n return false if hcl.nil?\n\n !/^#[a-f|0-9]{6}$/.match(hcl).nil?\n end", "def gem_git_reference(options) # :nodoc:\n ref = options.delete :ref\n branch = options.delete :branch\n tag = options.delete :tag\n\n reference = nil\n reference ||= ref\n reference ||= branch\n reference ||= tag\n reference ||= 'master'\n\n if ref && branch\n warn <<-WARNING\nGem dependencies file #{@path} includes git reference for both ref and branch but only ref is used.\n WARNING\n end\n if (ref || branch) && tag\n warn <<-WARNING\nGem dependencies file #{@path} includes git reference for both ref/branch and tag but only ref/branch is used.\n WARNING\n end\n\n reference\n end", "def valid_token?(token)\n return token =~ /^[\\w\\-\\.~_\\+\\/]+$/\n end", "def check_ref(ref, revision)\n # First check that revision is present\n begin\n git.show(revision)\n rescue Git::GitExecuteError => e\n STDERR.puts \"[#{DateTime.now} #{to}] Issue when checking revision #{revision}: #{e}\".yellow\n return false\n end\n\n # TODO: check that branch and tags contains the change\n return true\n end", "def check_message_format(regex, oldrev, newrev)\n missed_revs = `git rev-list #{oldrev}..#{newrev}`.split(\"\\n\")\n bad_commits = \"\"\n auth_fail = 0\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !regex.match(message) then\n bad_commits += \"#{rev}\\n\"\n else\n # Increment fail counter on failure\n auth_fail += verify_authcode(msg)\n end\n \n end\n\n if auth_fail > 0 or bad_commits.split(\"\\n\").nitems.to_i > 0 then\n puts \"[POLICY] Please ensure that your commit messages contain ticket or a current authorization numbers\"\n puts \"The list of commits you sent were: \"\n puts bad_commits\n exit 1\n end\nend", "def valid?(ver)\n !!(ver =~ /\\A#{REGEX_FULL}\\Z/)\n end", "def git_ref\n `git rev-parse --short HEAD`.strip\nend", "def git_refs()\n # This glob pattern matches recursively so we will find a branch named\n # something like 'feature/subfeature/the-cool-feature'.\n # TODO: get remotes also\n git_dir = git_git_dir()\n\n locals = Dir.glob(File.join(git_dir, 'refs', 'heads', '**', '*')).select do |f|\n !File.directory? f\n end.map do |f|\n {\n 'name' => f.split('/refs/heads/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n remotes = Dir.glob(File.join(git_dir, 'refs', 'remotes', '**', '*')).select do |f|\n !File.directory?(f) and !f.end_with? \"/HEAD\"\n end.map do |f|\n {\n 'name' => f.split('/refs/remotes/')[1],\n 'hash' => File.open(f).read().rstrip\n }\n end\n\n locals + remotes\nend", "def check_spec_path(name, version, spec)\n unless spec.name == name && spec.version.to_s == version.to_s\n message = \"Incorrect path #{spec.defined_in_file}\"\n report.add_message(:error, message, name, spec.version)\n end\n end", "def container_repository_name_regex\n @container_repository_regex ||= %r{\\A[a-z0-9]+((?:[._/]|__|[-])[a-z0-9]+)*\\Z}\n end", "def filter_branch_refs(refs)\n refs.select do |r|\n ref_name = r[\"ref\"]\n ref_name.start_with? \"refs/heads\"\n end\n end", "def build_url_field_regex\n if Properties && Properties['jenkins_url']\n / \\((#{Regexp::escape(Properties['jenkins_url'])}[^)]+)\\)/\n else\n # Use this test to set the build url matching pattern\n if ENV['BUILD_URL']\n # Don't set build_url directly from the env var, since we want\n # to make sure they match\n / \\((#{Regexp::escape(ENV['BUILD_URL'])})\\)/\n else\n / \\((https?:[^)]+)\\)/\n end\n end\nend", "def parse_commit_message!(message)\n match = message.match(/ \\(#(?<pr_number>[0-9]*)\\)?$/)\n {\n \"pr_number\" => match && match[:pr_number] ? match[:pr_number].to_i : nil\n }\nend", "def _validate_source(s)\n if git = s[:git]\n tag, commit = s.values_at(:tag, :commit)\n version = spec.version.to_s\n\n if git =~ %r{http://EXAMPLE}\n results.add_error('source', 'The Git source still contains the ' \\\n 'example URL.')\n end\n if commit && commit.downcase =~ /head/\n results.add_error('source', 'The commit of a Git source cannot be' \\\n ' `HEAD`.')\n end\n if tag && !tag.to_s.include?(version)\n results.add_warning('source', 'The version should be included in' \\\n ' the Git tag.')\n end\n if tag.nil?\n results.add_warning('source', 'Git sources should specify a tag.', true)\n end\n end\n\n perform_github_source_checks(s)\n check_git_ssh_source(s)\n end", "def check_for_invalid_external_references(record, logical_urls)\n if record.respond_to?(:to_array)\n record.each {|e| check_for_invalid_external_references(e, logical_urls)}\n elsif record.respond_to?(:each)\n record.each do |k, v|\n if k == 'ref' && !logical_urls.has_key?(v)\n URIResolver.ensure_reference_is_valid(v, RequestContext.get(:repo_id))\n elsif k != '_resolved'\n check_for_invalid_external_references(v, logical_urls)\n end\n end\n end\n end", "def check_message_format\n missed_revs = `git rev-list #{$oldrev}..#{$newrev}`.split(\"\\n\")\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !$regex.match(message)\n puts \"[POLICY] Your message is not formatted correctly\"\n puts \"\\n\\tRefused message: #{message}\"\n puts \"\\nYour commit message should absolutely reference the issue number in redmine\"\n puts \"\\n\\tYou should use one of the below referencing keywords or fixing keywords\"\n puts \"\\n\\tReferencing keywords:\"\n puts \"\\t\\trefs #XXX\"\n puts \"\\t\\treferences #XXX\"\n puts \"\\t\\tIssueID #XXX\"\n puts \"\\n\\tFixing keywords:\"\n puts \"\\t\\tfixes #XXX\"\n puts \"\\t\\tcloses #XXX\"\n puts \"\\n\\treplace XXX with the issue's number.\"\n puts \"\\n\\tN.B: If the current commit is not related to any issue (which is usually a bad idea)\"\n puts \"\\tYou can use the MISC: keyword to bypass referencing an issue as follows.\"\n puts \"\\n\\t\\tMISC: Commit message\"\n puts \"\\n\\tN.B: There's a whitespace between MISC: and the commit message.\"\n puts \"\"\n exit 1\n end\n end\nend", "def check_format_rules(line_number, line)\n conventional_commit_conventions = [ 'feat(.*): ', 'fix(.*): ', 'chore(.*): ', 'install(.*): ', 'improvement(.*): ', 'ci(.*): ', 'ui(.*): ', 'style(.*): ' ] \n conventional_commit_check = conventional_commit_conventions.map{|x| line.match(x)}.compact\n errors = []\n if conventional_commit_check.empty?\n unless line.include?('HOTFIX')\n return errors << \"Error : Your commit message seems like not following conventional commit rules, please check your commit's convention\"\n end\n end\n errors << \"Error : Your commit message contains #{line.length} characters. Commit message should be less than 72 characters in length.\" if line.length > 72\n errors << \"Error : Your subject contains #{line.split(':')[1].length} characters. Subject should be less than 50 characters\" if line.split(':')[1].length > 50\n errors << \"Error : Commit message subject should start in Capital.\" if line.split(':')[1].lstrip[0] == line.split(':')[1].lstrip[0].downcase\n return errors\nend", "def validate_social_media_url(spec)\n validate_url(spec.social_media_url, 'CocoaPods') if spec.social_media_url\n end", "def url_regexp\n /\\Ahttps?:\\/\\/([\\A\\s:@]+:[\\A\\s:@]*@)?[-[[:alnum:]]]+(\\.[-[[:alnum:]]]+)+\\.?(:\\d{1,5})?([\\/?]\\S*)?\\z/iux\n end", "def uriish? str\n (str.include? ':') && (UriSniffRx.match? str)\n end", "def component_reference\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n begin\n # at line 38:5: '-' IDENT NL\n match( T__41, TOKENS_FOLLOWING_T__41_IN_component_reference_237 )\n match( IDENT, TOKENS_FOLLOWING_IDENT_IN_component_reference_239 )\n match( NL, TOKENS_FOLLOWING_NL_IN_component_reference_241 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n\n end\n\n return \n end", "def check_branch_name\n if /#{BRANCH_PREFIX}-[0-9]+-#{TEAM_NAMES}/i !~ @git_branch\n @exit_value = 1\n return \"Bad branch name '#{@git_branch.chomp}'\\n\"\n end\nend", "def test_allow_colons_in_path_component\n assert_sanitized \"<a href=\\\"./this:that\\\">foo</a>\"\n end", "def github_url_matching(url)\n matches = /github\\.com.(.*?)\\/(.*)/.match(url)\n matches ? [matches[1], matches[2].sub(/\\.git\\z/, '')] : [nil, nil]\n end", "def valid_version?(version)\n version =~ /\\d+\\.\\d+\\.\\d+(\\.(alpha|beta|rc)(\\.\\d+)?)?/\nend", "def parse_references\n globbed_references = body.scan(/(.*?\\))/)\n\n globbed_references.each do |reference|\n url = reference.first.scan(/(?<=\\().*(?=\\))/).first\n next unless url\n\n if url.include?('users')\n # Do nothing for now when it's a mention of a user\n # FIXME - this is junk\n elsif url.include?('ideas') && idea = Idea.find_by_sha(url.gsub('/ideas/', ''))\n # When this is an idea we know about, make a hard link\n self.idea_references.build(:referenced_id => idea.id)\n else\n # Just leave it in the body without doing anything.\n end\n end\n end", "def valid_path?(path)\n # Maximum length\n return false if path.length > 255\n # Valid characters allowed\n ch = /[A-Za-z0-9_\\-.$\\/~\"'@:+]*/\n # Require leading slash, maximum one wildcard allowed at start or end\n !!path.match(/^\\/( \\*#{ch} | #{ch}\\* | #{ch} )$/x)\nend", "def perform_github_source_checks(s)\n require 'uri'\n\n if git = s[:git]\n return unless git =~ /^#{URI.regexp}$/\n git_uri = URI.parse(git)\n if git_uri.host\n perform_github_uri_checks(git, git_uri) if git_uri.host.end_with?('github.com')\n end\n end\n end", "def validate_relative_uri( uri, dir, doc )\n return validate_anchor(uri, doc) if uri.path.empty?\n\n path = if uri.path =~ %r/^\\//\n ::File.join(::Webby.site.output_dir, uri.path)\n else\n ::File.join(dir, uri.path)\n end\n path = ::File.join(path, 'index.html') if ::File.extname(path).empty?\n\n uri_str = path.dup\n (uri_str << '#' << uri.fragment) if uri.fragment\n return if @valid_uris.include? uri_str\n\n if test ?f, path\n valid = if uri.fragment\n validate_anchor(uri, Hpricot(::File.read(path)))\n else true end\n @valid_uris << uri_str if valid\n else\n @log.error \"invalid URI '#{uri.to_s}'\"\n end\n end", "def resembles_gridref?\n !!(self.upcase =~ /^\\w\\w\\d{2,}/)\n end", "def test_absolute_uri_uri_parse\n \"#{URI::REGEXP::PATTERN::UNRESERVED};:&=+$,\".split(//).each do |char|\n parser = HttpParser.new\n req = parser.env\n http = \"GET http://#{char}@example.com/ HTTP/1.0\\r\\n\\r\\n\"\n assert_equal req, parser.headers(req, http)\n assert_equal 'http', req['rack.url_scheme']\n assert_equal '/', req['REQUEST_URI']\n assert_equal '/', req['REQUEST_PATH']\n assert_equal '', req['QUERY_STRING']\n\n assert_equal 'example.com', req['HTTP_HOST']\n assert_equal 'example.com', req['SERVER_NAME']\n assert_equal '80', req['SERVER_PORT']\n assert_equal \"\", http\n assert ! parser.keepalive?\n end\n end", "def match?(spec, allow_prerelease = false)\n @dependency.match? spec, nil, allow_prerelease\n end", "def clean_pgn\n /\\[[\\w\\\"\\s\\d\\.\\-\\:]*\\]/\n end", "def test_allow_colons_in_path_component\n assert_sanitized(\"<a href=\\\"./this:that\\\">foo</a>\")\n end", "def rev_parse(*args)\n return args if args.empty?\n \n sandbox do |git,w,i|\n shas = git.run('', :rev_parse, '', {}, args).split(\"\\n\")\n \n # Grit::Git#run only makes stdout available, not stderr, and so this\n # wonky check relies on the fact that git rev-parse will print the\n # unresolved ref to stdout and quit if it can't succeed. That means\n # the last printout will not look like a sha in the event of an error.\n unless shas.last.to_s =~ SHA\n raise \"could not resolve to a sha: #{shas.last}\"\n end\n \n shas\n end\n end", "def regexp_with_working_captures?(node); end", "def check_spec_path\n expected = \"#{spec.name}/#{spec.version}/#{spec.name}.podspec\"\n relative_path = spec_path.relative_path_from(source.repo).to_s\n unless relative_path == expected\n error \"Incorrect path, the path is `#{relative_path}` and should be `#{expected}`.\"\n end\n end", "def verify_reference_nbr(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::REFERENCE_NBR.name], element_value(reference_nbr_input))\n end", "def _validate_module_name(m)\n unless m.nil? || m =~ /^[a-z_][0-9a-z_]*$/i\n results.add_error('module_name', 'The module name of a spec' \\\n ' should be a valid C99 identifier.')\n end\n end", "def invalid_uri?(uri)\n uri.grep(/^(#{PROTOCOLS.join('|')}):\\/\\/\\w/).empty?\n end", "def refPathValid?(lane)\n refPath = @referencePaths[lane.to_s]\n\n # If reference is null or empty, return false \n if refPath == nil || refPath.eql?(\"\")\n return false\n end\n\n # A reference path \"sequence\" implies building only sequence, and no\n # alignment. Hence it is a valid reference\n if refPath.downcase.eql?(\"sequence\")\n return true\n end\n\n # A reference path is invalid if any of the following is true\n # 1) It does not exist, or is not a valid directory\n # 2) It does not end with string \"/squash\"\n # If all of above are false, reference path is valid\n if !File::exist?(refPath) || !File::directory?(refPath) ||\n !refPath.match(/\\/squash$/)\n return false\n end\n return true\n end", "def validate_full_url\n if self.full_url.nil?\n return\n end\n\n if((self.full_url =~ URI::regexp(\"http\")) == nil && (self.full_url =~ URI::regexp(\"https\")) == nil)\n self.errors.add(:full_url, \"Full url is not a valid url\")\n end\n end", "def _validate_name(name)\n if name =~ %r{/}\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'a slash.')\n end\n\n if name =~ /\\s/\n results.add_error('name', 'The name of a spec should not contain ' \\\n 'whitespace.')\n end\n\n if name[0, 1] == '.'\n results.add_error('name', 'The name of a spec should not begin' \\\n ' with a period.')\n end\n end", "def check_changelog\n current_repo = File.basename(`git remote get-url origin`.chomp, '.git').freeze\n slug_re = '([a-zA-Z]*/[a-zA-Z]*)'\n links = %r{\\[#{slug_re}?\\#([0-9]+)\\]\\(https://github.com/#{slug_re}/(issues|pull)/([0-9]+)\\)}\n links_typos = %r{https://github.com/#{slug_re}/(issue|pulls)/([0-9]+)}\n\n all_warnings = []\n inside_entry = false\n last_line_has_correct_ending = false\n\n File.readlines('CHANGELOG.md').each_with_index do |line, idx|\n line.chomp! # Remove \\n the end, it's easier for checks below\n was_inside_entry = inside_entry\n just_started_new_entry = line.start_with?('* ')\n inside_entry = true if just_started_new_entry\n inside_entry = false if /^ \\[.*\\]\\(.*\\)$/ =~ line # link-only line\n\n if was_inside_entry && !inside_entry && !last_line_has_correct_ending\n # We just ended an entry's description by starting the links, but description didn't end with '. '\n # Note: entry descriptions can be on multiple lines, hence the need to wait for the next line\n # to not be inside an entry to be able to consider the previous line as the end of entry description.\n all_warnings.concat [\n { line: idx, message: 'Line describing your entry should end with a period and 2 spaces.' }\n ]\n end\n # Store if current line has correct ending, for next iteration, so that if the next line isn't\n # part of the entry description, we can check if previous line ends description correctly.\n # Also, lines just linking to CHANGELOG to other repositories (StencilSwiftKit & Stencil mainly)\n # should be considered as not needing the '. ' ending.\n last_line_has_correct_ending = line.end_with?('. ') || line.end_with?('/CHANGELOG.md)')\n\n # Now, check that links [#nn](.../nn) have matching numbers in link title & URL\n wrong_links = line.scan(links).reject do |m|\n slug = m[0] || \"SwiftGen/#{current_repo}\"\n (slug == m[2]) && (m[1] == m[4])\n end\n all_warnings.concat Array(wrong_links.map do |m|\n link_text = \"#{m[0]}##{m[1]}\"\n link_url = \"#{m[2]}##{m[4]}\"\n { line: idx + 1, message: \"Link text is #{link_text} but links points to #{link_url}.\" }\n end)\n\n # Flag common typos in GitHub issue/PR URLs\n typo_links = line.scan(links_typos)\n all_warnings.concat Array(typo_links.map do |_|\n { line: idx + 1, message: 'This looks like a GitHub link URL with a typo. Issue links should use `/issues/123` (plural) and PR links should use `/pull/123` (singular).' }\n end)\n end\n all_warnings\nend", "def git_hook_needed?\n !File.executable?(@git_hook_path) || !File.read(@git_hook_path).match(/#{@pf_git_hook_name} \\$1/) || !pf_git_hook_valid?\n end" ]
[ "0.74208856", "0.6419382", "0.6360152", "0.6356998", "0.5620991", "0.55655235", "0.5505946", "0.547096", "0.5430591", "0.53878546", "0.53277755", "0.53088284", "0.5228049", "0.5225696", "0.52102226", "0.51929605", "0.51921016", "0.5188488", "0.5184116", "0.51330084", "0.5059149", "0.50407135", "0.5033418", "0.5033418", "0.50259584", "0.50194824", "0.49775657", "0.49748215", "0.49545854", "0.49444944", "0.4938586", "0.49128816", "0.4907048", "0.48966825", "0.48966825", "0.48553744", "0.4839813", "0.48357886", "0.4833379", "0.4825571", "0.4825571", "0.4825571", "0.4785207", "0.4784694", "0.4768503", "0.4746417", "0.4697355", "0.46764147", "0.4672252", "0.4666772", "0.4662258", "0.46578312", "0.4649579", "0.46264726", "0.46237049", "0.46208078", "0.46200776", "0.45994774", "0.4596384", "0.45944947", "0.45910412", "0.45808843", "0.45692754", "0.45675316", "0.4563364", "0.45613194", "0.45591098", "0.45542198", "0.4551051", "0.45419443", "0.45310184", "0.45267457", "0.45200717", "0.45139843", "0.45114735", "0.44974807", "0.44973874", "0.4489681", "0.4486272", "0.44837755", "0.447757", "0.44710928", "0.4463857", "0.44609025", "0.44534945", "0.44498333", "0.44461992", "0.44409344", "0.4413812", "0.44132435", "0.44097465", "0.43943003", "0.43925008", "0.43860045", "0.43816245", "0.4380911", "0.43791983", "0.43717718", "0.43706268", "0.43609086" ]
0.79908866
0
Allow null or empty components
def valid_refspec_path?(refspec) !refspec || refspec == '' || parse_refspec(refspec) ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty()\n \n end", "def not_empty!(*args)\n if args.any?{|arg| arg.nil? or arg.to_s.empty?}\n coercion_error!\n end\n args\n end", "def effectively_empty( value )\n value.nil? || value.to_s.empty?\n end", "def is_empty?\n end", "def empty?()\n fields.empty?\n end", "def empty?\n super\n end", "def empty?\n super\n end", "def null?; false end", "def empty?\n @fields.empty?\n end", "def empty_required_value?( value )\n required? && value.nil?\n end", "def blank?(only_visible_tags = T.unsafe(nil)); end", "def check_value_empty(data)\n case @type\n when 'str', 'text', 'password', 'img', 'url'\n data.empty?\n when 'int', 'float', 'enum'\n # These values are always non-empty\n false\n when 'set'\n data == 0\n else\n raise \"Invalid type #{@type.inspect} encountered on attribute #{@name.inspect}\"\n end\n end", "def valid?(component)\n true\n end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?; end", "def empty?\n name.blank?\n end", "def any_present?\n if name.blank? and phone.blank? and license_plate.blank?\n errors.add :base, \"You must fill in at least one field\"\n end\n end", "def empty?() end", "def empty?() end", "def empty?() end", "def component_present\n if component.nil?\n errors.add(:component, 'is not valid.')\n end\n end", "def nil_or_empty_string?(obj)\n obj.nil? || obj.empty?\n end", "def blank_param?(data)\n data.blank? || data.try(:values).try(:all?, &:blank?)\n end", "def blank?\n self.nil? || self.empty?\n end", "def empty?\n @fields.values.empty?\n end", "def allow_empty_options\n true\n end", "def valid_record?( record )\n !record[:name].nil? and !record[:type].nil? and !record[:value].nil? and\n !record[:name].empty? and !record[:type].empty? and !record[:value].empty?\nend", "def blank?(param)\n param.nil? || param.empty?\n end", "def blank?\n true\n end", "def blank?\n true\n end", "def blank?\n true\n end", "def empty?; false; end", "def empty?; false; end", "def empty?\n\t\treturn self.fields.empty?\n\tend", "def any_empty(*params)\n params.each do |param|\n if param == nil or param == ''\n return true\n end\n end\n false\n end", "def validate\n super\n validates_presence :components unless initial?\n validates_presence :version\n end", "def skip_blanks?() @skip_blanks end", "def given?(field)\n !field.empty?\nend", "def blank?\n false\n end", "def blank?\n false\n end", "def blank?\n false\n end", "def parse_component_values(input = T.unsafe(nil)); end", "def empty2nil(value)\n value unless value.is_a?(String) && value.empty? && !value.nil?\n end", "def parse_component_value(input = T.unsafe(nil)); end", "def not_empty\n return unless equipment_model.nil?\n errors.add(:base, 'Reservation must be for an object')\n end", "def value_empty?\n if value === nil or value === \"\"\n return true\n end\n return false\n end", "def nil_or_empty?(obj)\n obj.nil? || (obj.respond_to?(:empty?) && obj.empty?)\n end", "def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end", "def _blank?(value)\n value.nil? || value == ''\n end", "def empty?\n value.empty?\n end", "def empty?\n @value.nil? || (@value.respond_to?(:empty?) && @value.empty?)\n end", "def weed_nils\n subject.reject! { |s| s == \"\" } if subject.present?\n end", "def blank?( object )\n return object.nil? || object.empty?\n end", "def empty?\n @value.nil? || @value.empty?\n end", "def null?\n true\n end", "def empty_to_null\n attributes_before_type_cast.each do | key, value |\n write_attribute(key, nil) if value.kind_of?( String ) && value.empty?\n end\n end", "def optionalize\n without_values(nil)\n end", "def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end", "def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end", "def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end", "def empty?\n @parts.empty?\n end", "def empty?\n @parts.empty?\n end", "def empty?\n\t\t\t\t\tfalse\n\t\t\t\tend", "def any?\n not blank?\n end", "def blank?\n value.blank?\n end", "def skip_include_blank?; end", "def empty?\n end", "def empty?\n end", "def empty?\n end", "def blank?\n empty?\n end", "def blank?\r\n nil? || (respond_to?(:empty?) && empty?)\r\n end", "def empty?\n end", "def empty?\n end", "def empty?\n end", "def empty?\n end", "def check_for_nulls\n# if self.name.nil? && self.dynamic_type_id.nil?\n# flash[:notice] = \"You must fill in something !\"\n if self.dynamic_type_id.nil?\n self.dynamic_type_id = 3\n end\n if self.name.nil?\n self.name = \"please enter a name\"\n end\n# end\n end", "def empty?\n city.blank? && user.blank? && name.blank? && from_date.blank? && to_date.blank?\n end", "def empty?\n !value\n end", "def empty?\n @val==nil\n end", "def immediate?; @unbound_fields.empty?; end", "def empty?\n false\n end", "def empty?\n false\n end", "def blank?\n empty?\n end", "def field_empty_afterward?(*args)\n Log.debug(\"[GRIDIUM::Element] Checking the field after sending #{args}, to see if it's empty\")\n check_again = has_characters?(*args) && no_symbols?(*args)\n field_is_empty_but_should_not_be = check_again && field_empty?\n if field_is_empty_but_should_not_be\n raise \"Browser Error: tried to input #{args} but found an empty string afterward: #{value}\"\n end\n end", "def nullp\n self.parse_null.singleton?\n end", "def value?\n !element_value.nil? && element_value != ''\n end", "def safe_empty(thing)\n thing.class.method_defined?(:empty?) && thing.empty?\n end", "def create_blank(data)\n Types.check( binding, { :data => String } )\n\n case data\n when /^([^`]*)`([^`]*)`([^`]*)$/\n then \n placeholder, solution, validator = $1, $2, $3\n\n if validator == ''\n then validator = 'exact'\n end\n\n Blank.new(placeholder, solution, validator)\n else raise \"Invalid blank specification: #{data}\"\n end\n end", "def empty?\n @parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)\n end", "def empty?\n return false if @opts[:values]\n super\n end", "def empty?\n false\n end" ]
[ "0.63970834", "0.633438", "0.62710434", "0.61425763", "0.6133463", "0.6041666", "0.6041666", "0.60091186", "0.5993046", "0.59828436", "0.59771365", "0.5943053", "0.59361565", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.59213", "0.5905352", "0.586384", "0.5863292", "0.5863292", "0.5863292", "0.58556914", "0.58339155", "0.5831928", "0.58298385", "0.5816427", "0.5806299", "0.5801611", "0.5789988", "0.5787226", "0.5787226", "0.5787226", "0.57770663", "0.57770663", "0.5743916", "0.5742229", "0.57414603", "0.57385164", "0.573125", "0.5730767", "0.5730767", "0.5730767", "0.57276636", "0.5718644", "0.570911", "0.57065105", "0.5702026", "0.56986934", "0.5696555", "0.56936324", "0.56890297", "0.56863165", "0.56852084", "0.56843984", "0.568406", "0.5679881", "0.5678779", "0.5672375", "0.56714696", "0.5671238", "0.5671238", "0.56661993", "0.56661993", "0.56650573", "0.56650406", "0.56606996", "0.5650089", "0.56432724", "0.56432724", "0.56432724", "0.56412214", "0.5641026", "0.56393415", "0.56393415", "0.56393415", "0.56393415", "0.5635431", "0.563175", "0.56282353", "0.5620615", "0.5619728", "0.5613845", "0.5613845", "0.5612763", "0.5610857", "0.5609122", "0.560549", "0.5586529", "0.5585835", "0.55763507", "0.5572306", "0.55671966" ]
0.0
-1
Parse a reference component. Two possibilities: 1) refs/type/name 2) name
def parse_refspec(spec) parsed_refspec = spec.match(REF_COMPONENT_REGEX) return nil if parsed_refspec.nil? if parsed_refspec[1] # Should be first class. If no type component, return fail if parsed_refspec[3] { type: parsed_refspec[3], name: parsed_refspec[4] } else nil end elsif parsed_refspec[3] { type: nil, name: "#{parsed_refspec[3]}/#{parsed_refspec[4]}" } else { type: nil, name: parsed_refspec[4] } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parts_of_reference (docset, ref_str)\n\tref = ref_str.split\n\tif ref.length != 2\n\t\tTextMate.exit_show_tool_tip \"Cannot parse reference: #{str}\"\n\tend\n\n\tlanguage, type, klass, thing = ref[0].split('/')\n\tRef.new(docset, language, type, klass, thing, ref[1])\nend", "def component_reference\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n begin\n # at line 38:5: '-' IDENT NL\n match( T__41, TOKENS_FOLLOWING_T__41_IN_component_reference_237 )\n match( IDENT, TOKENS_FOLLOWING_IDENT_IN_component_reference_239 )\n match( NL, TOKENS_FOLLOWING_NL_IN_component_reference_241 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n\n end\n\n return \n end", "def reference(name, type)\n \n end", "def reference\n @refs ||= strip(:reference)\n end", "def parse_references\n globbed_references = body.scan(/(.*?\\))/)\n\n globbed_references.each do |reference|\n url = reference.first.scan(/(?<=\\().*(?=\\))/).first\n next unless url\n\n if url.include?('users')\n # Do nothing for now when it's a mention of a user\n # FIXME - this is junk\n elsif url.include?('ideas') && idea = Idea.find_by_sha(url.gsub('/ideas/', ''))\n # When this is an idea we know about, make a hard link\n self.idea_references.build(:referenced_id => idea.id)\n else\n # Just leave it in the body without doing anything.\n end\n end\n end", "def get_field_reference(content)\n segments, fragments = get_field_schema(content[:ref])\n # fragments first\n results = get_fragments(fragments) unless fragments.nil?\n # segments second\n unless segments.nil? || results\n results = get_segments(segments) unless segments.empty?\n end\n results\n end", "def resolve_reference_string(ref)\n resolve_reference(Nidyx::Pointer.new(ref).path) if ref\n end", "def format_ref(ref, type)\n len = ref.length\n case type\n when \"soybase\"\n if len < 4\n chr = ref.slice(2, len)\n return \"gm0#{chr}\"\n end\n when \"jcvi\"\n if len < 5\n chr = ref.slice(3, len)\n return \"chr0#{chr}\"\n end\n when \"medicago\"\n if ref =~ /chr[0-9]/\n return \"Mt#{ref.slice(/[0-9]/)}\"\n else\n return ref\n end\n when \"hapmap\"\n return ref.gsub(/0/, '')\n when \"cajca\"\n if ref =~ /CcLG[0-9]+/\n return \"Cc#{ref.slice(/[0-9]+/)}\"\n else\n return ref\n end\n end\n ref\n end", "def cfn_ref(s)\n\t\t\treturn cfn_raw({ \"Ref\" => s })\n\t\tend", "def lookup(oid_or_ref_name)\n rugged.rev_parse(oid_or_ref_name)\n end", "def visit_reference(binding_type)\n #VAPI.log.debug \"VERBOSE: visit_reference called: input=#{self.input}\"\n visit(binding_type.binding_class.binding_type)\n end", "def back_ref(kind)\n if lm = last_match()\n res = case kind\n when :&\n lm[0]\n when :\"`\"\n lm.pre_match\n when :\"'\"\n lm.post_match\n when :+\n lm.captures.last\n end\n\n return res\n end\n\n return nil\n end", "def reference\n value_for('reference')\n end", "def on_reference(name)\n end", "def back_ref(kind)\n if lm = @last_match\n res = case kind\n when :&\n lm[0]\n when :\"`\"\n lm.pre_match\n when :\"'\"\n lm.post_match\n when :+\n lm.captures.last\n end\n\n return res\n end\n\n return nil\n end", "def get_refs(way)\n return [] if !way.tags.has_key?('ref')\n return way.tags['ref'].split(/(;|,)/).collect {|ref| ref.strip}\n end", "def reference(refType, refName)\r\n\r\n refout = <<EOF\r\n #{refType} #{refName}();\r\nEOF\r\n\r\n return refout\r\n\r\n end", "def visit_reference(binding_type)\n visit(binding_type.resolved_type)\n end", "def resolve_reference; end", "def lookup_ref (workitem, prefix='')\n\n ref = lookup_vf_attribute(workitem, 'ref', :prefix => prefix)\n ref ? ref.to_s : nil\n end", "def raw_to_reference( line )\n a = line.split(', ')\n\n if a[-1] == 'Unpublished observations.'\n title = a.pop.chop\n pages = volume = year = journal = ''\n else\n title = ''\n\n pages_or_volume = a.pop.chop\n if pages_or_volume =~ %r{pp\\.\\s}\n pages = pages_or_volume\n pages.gsub!('pp. ', '')\n volume = a.pop\n else\n pages = ''\n volume = pages_or_volume\n end\n\n volume.gsub!('vol. ', '')\n\n year_and_journal = a.pop\n year_and_journal =~ %r{\\((\\d+)\\)\\s(.+)}\n year = $1\n journal = $2\n end\n\n authors = []\n\n last_name = nil\n a.each do |e|\n if last_name\n authors << \"#{last_name}, #{e}\"\n last_name = nil\n else\n last_name = e\n end\n end\n\n ref = {\n 'title' => title,\n 'pages' => pages,\n 'volume' => volume,\n 'year' => year,\n 'journal' => journal,\n 'authors' => authors,\n }\n\n Bio::Reference.new(ref)\n end", "def extract_ref(id)\n pair = extract_raw_ref(id)\n\n [\n pair[0].strip,\n pair[1].delete_prefix('/').delete_suffix('/')\n ]\n end", "def locate_internal_refs1(refs, identifier, ident)\n #file, _filename = targetfile(filedesc, read: true)\n file, _filename = @files.targetfile_id(ident, read: true)\n xml = Nokogiri::XML(file) { |config| config.huge }\n t = xml.xpath(\"//*/@id\").each_with_object({}) { |i, x| x[i.text] = true }\n refs.each do |schema, ids|\n ids.keys.select { |id| t[id] }.each do |id|\n n = xml.at(\"//*[@id = '#{id}']\") and\n n.at(\"./ancestor-or-self::*[@type = '#{schema}']\") and\n refs[schema][id] = identifier\n end\n end\n end", "def parseReferencePath(output)\n if(output.match(/BUILD_PATH=\\s+[Ss]equence/) ||\n output.match(/BUILD_PATH=[Ss]equence/))\n @refPath = \"sequence\"\n\n elsif(output.match(/BUILD_PATH=\\s+\\/data/) ||\n output.match(/BUILD_PATH=\\/data/))\n @refPath = output.slice(/\\/data\\/slx\\/references\\/\\S+/)\n \n # Since reference paths starting with /data/slx/references represent\n # format of reference paths in alkek, change the prefix of these paths\n # to match the file-system structure in ardmore.\n @refPath.gsub!(/\\/data\\/slx\\/references/,\n \"/stornext/snfs5/next-gen/Illumina/genomes\")\n\n elsif(output.match(/BUILD_PATH=\\s+\\/stornext/) ||\n output.match(/BUILD_PATH=\\/stornext/))\n # If LIMS already has correct path corresponding to the file\n # system structure in ardmore, return that path without any\n # modifications.\n @refPath = output.slice(/\\/stornext\\/\\S+/)\n end\n end", "def validate_refspec\n begin\n valid_git_refspec_path?(explicit_refspec)\n rescue => e\n errors.add(:explicit_refspec, e.message)\n end\n end", "def parse_object_ref(ref)\n prefix = ref[1]\n ref = ref[0]\n # Let's make sure the value isn't nil. If it is, return the default Hash.\n return {} if ref.nil?\n class_name = underscore(ref.class)\n id = \"#{class_name}_#{ref.id || 'new'}\"\n\n if ref.respond_to?(:model_modifiers)\n class_name = model_classes(ref)\n elsif prefix\n class_name = \"#{prefix}_#{class_name}\"\n id = \"#{prefix}_#{id}\"\n end\n\n {'id' => id, 'class' => class_name}\n end", "def eName2Exp(name)\n # puts \"eName2Exp with name=#{name}\"\n ref = $refs.find do |ref|\n if ref.ref.respond_to?(:name) then\n ref.ref.name == name.to_sym\n else\n ref.name == name.to_sym\n end\n end\n # puts \"ref=#{ref}\"\n unless ref\n return Value.new($bit8,name.to_i)\n end\n return ref\nend", "def full_ref # rubocop:disable Metrics/AbcSize\n @full_ref ||= begin\n ref = \"#{refparts[:perfix]}#{refparts[:series]} #{refparts[:code]}\"\n ref += \"pt#{refparts[:prt]}\" if refparts[:prt] # long_to_short(refparts, \"prt\").to_s\n ref += \"ver#{refparts[:ver]}\" if refparts[:ver] # long_to_short(refparts, \"vol\").to_s\n ref += \"v#{refparts[:vol]}\" if refparts[:vol]\n ref\n end\n end", "def resolved_ref\n \"resolved-#{ref}\"\n end", "def reference\n [ type, identifier ]\n end", "def ref_type\n # numeral, boolean, closure, atom, pair, handle, string, environment, or rail\n return quoted.struc_type if handle? \n return :NUMBER if instance_of?(Fixnum) || instance_of?(Bignum)\n return :\"TRUTH-VALUE\" if instance_of?(TrueClass) || instance_of?(FalseClass)\n return :FUNCTION if instance_of?(Closure)\n return :SEQUENCE if instance_of?(Rail)\n return :BINDINGS if instance_of?(Environment)\n\n raise_error(self, \"atom #{self.to_s} has no referential type\") if atom?\n raise_error(self, \"pair #{self.to_s} has no referential type\") if pair?\n raise_error(self, \"ref_type : #{self.to_s} is ill-structured\") \n end", "def extract_named_references\n extract ExtractNamedReferences, 'workbook.xml', 'Named references'\n apply_rewrite RewriteFormulaeToAst, 'Named references'\n replace ReplaceRangesWithArrayLiterals, 'Named references', 'Named references'\n end", "def add_reference( type, source, component, name, weight=nil )\n r = Ref.new( type, source, component, name, \n weight ? weight : Ref::DEFAULT_WEIGHT )\n add_reference_obj(r)\n return r\n end", "def ref\n @ref ||= self.node.attributes.to_h[\"ref\"]\n end", "def fetch_references(fragment)\n # Loop through each key in the current hash element\n fragment.each do |key, element|\n # Loop through arrays and keep looking,\n # unless they are enum or required arrays\n if element.is_a?(Array) && %w[enum required].index(key).nil?\n element.each do |value|\n fetch_references(anyKey: value)\n end\n end\n\n # Skip this element if it's not a hash, no $ref will exist\n next unless element.is_a?(Hash)\n\n # If we have a reference to follow\n if element.key?('$ref')\n file, path = element['$ref'].split('#')\n\n # Fetch the reference from the file that it's defined to be in\n referenced_property = if file.blank?\n # This is an internal reference (lives within the file we're parsing)\n parsed_json['definitions'][path.split('/').last]\n else\n # Fetch the reference from an external file\n referenced_file = UmmJsonSchema.new(schema_type, file)\n referenced_file.fetch_references(referenced_file.parsed_json)\n referenced_schema = referenced_file.parsed_json\n referenced_schema['definitions'][path.split('/').last]\n end\n\n # Merge the retrieved reference into the schema\n element.merge!(referenced_property)\n\n # Remove the $ref key so we don't attempt to parse it again\n element.delete('$ref')\n end\n\n # Keep diggin'\n fetch_references(element)\n end\n end", "def get_field_schema(reference)\n schema = get_url(reference, :reference) if reference.is_a? String\n return [\n schema['segments'] || nil,\n schema['fragments'] || nil\n ] - ['', nil] if schema.is_a? Hash\n end", "def aref\n \"#{aref_prefix}-#{full_name}\"\n end", "def aref\n type = singleton ? 'c' : 'i'\n # % characters are not allowed in html names => dash instead\n \"#{aref_prefix}-#{type}-#{html_name}\"\n end", "def parse(data)\n @children.clear\n data = StringIO.new(data)\n while !data.eof?\n mode = Util.read_bytes_until(data, ' ').to_i(8)\n name = repository.set_encoding Util.read_bytes_until(data, \"\\0\")\n id = repository.set_encoding data.read(20).unpack(\"H*\").first\n @children[name] = Reference.new(:repository => repository, :id => id, :mode => mode)\n end\n end", "def rev_parse_target(revspec)\n obj = rugged.rev_parse(revspec)\n Ref.dereference_object(obj)\n end", "def ref_into_url(base, project, ref)\n\t\tcase ref\n\t\t\twhen /\\[(\\b[0-9a-f]{5,40}\\b)\\]/:\n\t\t\t\t[rev_url(base, project, $1), :changeset]\n\n\t\t\twhen /r(\\d+)/:\n\t\t\t\t[rev_url(base, project, $1), :changeset]\n\n when /changeset:(\\w+)/:\n [rev_url(base, project, $1), :changeset]\n\n when /commit:(\\w+)/:\n [rev_url(base, project, $1), :changeset]\n\n\t\t\twhen /\\#(\\d+)/:\n\t\t\t\t[bug_url(base, project, $1), :ticket]\n\n when /wiki:(\\S+\\#?\\S+)/:\n [wiki_url(base, project, $1), :wiki]\n\t\tend\n\tend", "def parse_object_ref(ref)\n object, options = ref\n\n if object.respond_to?(:haml_attributes)\n object.haml_attributes(options)\n else\n orig_parse_object_ref(ref)\n end\n end", "def ref\n @ref ||= maybe_ref || api.master_ref.ref\n end", "def ref(reference)\n Ref.new(reference)\n end", "def match_agency_ref_by_name name\n raise \"match_agency_ref_by_name must be redefined in children classes\"\n end", "def convert_ref_tags; end", "def parse_reference_ids full_document\n full_document.gsub(/%r(\\d+)/) do\n if Reference.exists? $1\n reference = Reference.find($1)\n reference.decorate.to_link\n else\n broken_markdown_link \"reference\", $1\n end\n end\n end", "def reference_name\n name + (section && \"(#{section})\").to_s\n end", "def refspec=(refspec)\n if refspec =~ /^\\+?(.*)(?:\\:.*)$/\n @branch = $1\n else\n raise ArgumentError, \"refspec syntax error. Should be: branch:refs/heads/branch\"\n end\n @refspec = refspec\n end", "def split_name_into_components(component)\n raise ArgumentError, \"Must pass a :row, :version AND :field\" if component.nil?\n component[:field] = [component[:field]] unless component[:field].is_a?(Array)\n \n component[:field].each do |field|\n NAME_BITS.zip(PEOPLE_BITS).each do |field_name, people_name|\n t.combine(:row => component[:row], :version => component[:version],\n :field => \"#{field}_#{field_name}\") do |row|\n \n # Grab the original, composite name\n name = row.send(\"#{field}_name\")\n \n unless name.nil?\n # Fix various name formatting errors\n name = self.class.fix_carrot_names(name) unless name.index(\"^\").nil?\n \n # Extract just the component you want\n (Fech::Translator::NAME_PARSER.parse(name)[people_name] || \"\").strip\n else\n nil\n end\n end\n end\n end\n end", "def strip_references(val)\n if val.match?(/\\A(.*)\\|ref=.*\\z/)\n val.match(/\\A(.*)\\|ref=.*\\z/)[1]\n else\n val\n end\n end", "def parse_name(name)\n parts = name.split(/(::|#|\\.)/)\n if parts.length == 1 then\n # Daniel Choi fixed this line from the official rdoc \n if parts.first =~ /^[a-z=<|^&*-+\\/\\[]/ then\n type = '.'\n meth = parts.pop\n else\n type = nil\n meth = nil\n end\n elsif parts.length == 2 or parts.last =~ /::|#|\\./ then\n type = parts.pop\n meth = nil\n elsif parts[-2] != '::' or parts.last !~ /^[A-Z]/ then\n meth = parts.pop\n type = parts.pop\n end\n klass = parts.join\n [klass, type, meth]\n end", "def n_ref(ref)\n `#{@native}.refs[#{ref}]`\n end", "def inspct ctxt, opts\n sprintf(\"#<Reference%s->%s>\", @my_parse_id, @target_parse_id)\n end", "def reference(*args_or_name, block)\n # Check the args\n def_args = extract_definition_args(args_or_name)\n require_arg def_args, :name\n # puts \"reference #{def_args}\"\n name = def_args[:name]\n return unless version_wanted(def_args)\n\n raise \"polymorphic reference #{name} must specify :type and :for\" if def_args.key?(:for) ^ def_args.key?(:type)\n\n if def_args.key?(:for) && def_args.key?(:type)\n ref_type = def_args[:type]\n return unless ref_type.to_s == def_args[:for].to_s.camelize # Skip where the polymorph isn't us\n end\n\n # This reference is to be generated\n\n @put_stack.push(reference_record = new_h)\n block.call\n @put_stack.pop\n\n raise \"reference #{name} must yield a block returning hash\" unless reference_record.is_a?(Hash)\n raise \"reference #{name} must yield a hash with an :id\" unless reference_record.key?(:id)\n\n unless def_args[:link_id] == false\n ref_id = reference_record[:id]\n put_field \"#{name}_id\", ref_id\n end\n\n if def_args.key?(:type)\n put_field \"#{name}_type\", ref_type if def_args.key?(:generate_from_type) # TODO: doc\n ref_key = ref_type.to_s.underscore.pluralize\n else\n ref_key = name\n end\n\n (@references[ref_key] ||= Set.new) << reference_record\n end", "def remove_prefix_refs(ref)\n regex = %r{\\Arefs/(?<stripped_ref>.+)\\Z}\n match = regex.match(ref)\n fail InvalidRefPrefixError, \"ref: #{ref}\" unless match\n match[:stripped_ref]\n end", "def ref\n # memoizing this is worthwhile ~ 3 percent of calls are the \"first time\n # around\" in an average run of Puppet. --daniel 2012-07-17\n @ref ||= \"#{self.class.name.to_s.capitalize}[#{self.title}]\"\n end", "def lookup_references!(cat, derefd, parsed)\n parsed_cat = parsed.detect { |pcat| \"#{pcat[:scheme]}#{pcat[:term]}\" == cat.identifier }\n raise Occi::Core::Errors::ParsingError, \"Category #{cat.identifier} not in the model\" unless parsed_cat\n lookup_action_references!(cat, derefd, parsed_cat[:actions])\n\n if cat.is_a?(Occi::Core::Mixin)\n lookup_depends_references!(cat, derefd, parsed_cat[self::DEPENDS_KEY])\n lookup_applies_references!(cat, derefd, parsed_cat[self::APPLIES_KEY])\n else\n # only Occi::Core::Kind is left here\n lookup_parent_references!(cat, derefd, parsed_cat[self::PARENT_KEY])\n end\n end", "def referenced_element\n ref = @xml.attributes['ref'].value\n @referenced_element ||= if ref =~ /:/\n prefix, element = ref.split(':')\n schema.find_element(element) || schema.find_attribute(\"@#{element}\") if schema = Schema.find(prefix)\n else\n self.schema.find_element(ref) || self.schema.find_attribute(\"@#{ref}\")\n end\n end", "def parse_schema_and_table_name table_name\n return [nil, table_name] if table_name.count('.') == 0\n\n if table_name.count('.') > 1\n raise \"Invalid relation reference #{table_name} (only one '.' is allowed)\"\n end\n\n schema_name, table_name = table_name.split('.')\n [schema_name, table_name]\n end", "def named_references\n return @named_references if @named_references\n @named_references = {}\n i = input('Named references')\n i.each_line do |line|\n sheet, name, ref = *line.split(\"\\t\")\n key = sheet.size != 0 ? [sheet, name] : name\n @named_references[key] = eval(ref)\n end\n close(i)\n @named_references\n end", "def initialize( name, type, ref, data=[] )\n @name = name\n @type = type\n @ref = ref\n @data = data\n end", "def revision_from_ref(repo_path, ref)\n begin\n show_ref(repo_path, ref)\n rescue GitError\n begin\n git('rev-parse', ref)\n ref\n rescue GitError\n raise InvalidGitRef, ref\n end\n end\n end", "def valid_git_refspec?(refspec)\n refspec.match(GIT_REFSPEC_REGEX)\n end", "def ref(named)\n load_refs(named).detect { |ref| ref.match?(named) }\n end", "def referencing_link_name\n Domgen.error(\"referencing_link_name on #{name} is invalid as #{characteristic_container.characteristic_kind} is not a reference\") unless reference?\n base_name = \"#{self.respond_to?(:component_name) ? component_name : name}#{referenced_entity.primary_key.name}\"\n self.collection? ? Reality::Naming.pluralize(base_name) : base_name\n end", "def rev_parse(ref)\n commit = git \"rev-parse #{ref}^{commit}\", :path => @full_path\n commit.chomp\n rescue R10K::ExecutionFailure => e\n logger.error \"Could not resolve ref #{ref.inspect} for git repo #{@full_path}\"\n raise\n end", "def named_references(text, match = nil)\n return [] unless (text = text.to_s).include?('%')\n patterns = match || [SPRINTF_NAMED_REFERENCE, SPRINTF_FMT_NAMED_REFERENCE]\n Array.wrap(patterns).flat_map { |pattern|\n text.scan(pattern).map(&:shift)\n }.compact_blank!.uniq.map!(&:to_sym)\n end", "def validate(ref_name)\n not_allowed_prefixes = %w(refs/heads/ refs/remotes/ -)\n return false if ref_name.start_with?(*not_allowed_prefixes)\n return false if ref_name == 'HEAD'\n\n begin\n Rugged::Reference.valid_name?(\"refs/heads/#{ref_name}\")\n rescue ArgumentError\n return false\n end\n end", "def create_field_reference( source, name, type_info )\n QueryParts::FieldReference.new(type_info, source, name)\n end", "def aref\n type = singleton ? 'c' : 'i'\n \"#alias-#{type}-#{html_name}\"\n end", "def match parser, index\r\n raise \"reference name not set\" unless name\r\n parser.match? name, index\r\n end", "def follow(n, pointer)\n # We already checked that nodes have at most one of these in the XmlParser.\n if n.key?('ref')\n reference = n['ref']\n if reference[':']\n namespace, reference = reference.split(':', 2)\n end\n\n node = lookup(reference, n.name)\n\n visit(node, pointer)\n\n elsif n.key?('type')\n reference = n['type']\n if default_value_r208(pointer, reference)\n return\n end\n\n node = lookup(reference, 'complexType', 'simpleType')\n\n if node.name == 'complexType'\n case reference\n when 'cpv_set'\n # Always expand, as mapping differs.\n when 'empty'\n # Do nothing with empty elements.\n when 'val', 'val_range', 'country', 'nuts', 'no_works', 'supplies', 'non_published'\n # Do nothing with simple elements.\n when 'text_ft_single_line', 'text_ft_multi_lines', 'btx'\n # Hardcode common types to make sample smaller.\n paragraph = BuildNode.new('P')\n paragraph.contents << SecureRandom.hex(8)\n pointer.children << paragraph\n return\n else\n # This edge case avoids extra XPaths in F08.\n if basename == 'F08_2014' && reference == 'contact_contracting_body'\n reference = 'contact_buyer'\n end\n # Reference repeated types to make sample smaller. (Sample will be invalid.)\n if @types.key?(reference)\n add_node('comment', pointer, content: \"see #{@types[reference]}\")\n return\n end\n @types[reference] = n.attributes.fetch('name')\n end\n end\n visit(node, pointer)\n\n elsif n.key?('base')\n if n.name == 'extension'\n reference = n['base']\n if default_value_r208(pointer, reference)\n return\n end\n\n node = lookup(reference, 'complexType', 'simpleType')\n\n if node.name == 'complexType' && ['text_ft_multi_lines', 'btx'].include?(reference)\n # Hardcode common types to make sample smaller. Drops attributes. Only for CRITERIA_EVALUATION on F13.\n paragraph = BuildNode.new('P')\n paragraph.contents << SecureRandom.hex(8)\n pointer.children << paragraph\n return\n end\n visit(node, pointer)\n\n # Based on the analysis in `visit`, we can skip visiting `base` if within a `complexType`, but not if within a `simpleType`.\n elsif n.parent.name == 'simpleType'\n reference = n['base']\n if reference[':']\n namespace, reference = reference.split(':', 2)\n end\n\n if namespace != 'xs'\n node = lookup(reference, 'simpleType')\n\n visit(node, pointer)\n end\n end\n end\n\n n.element_children.each do |c|\n visit(c, pointer)\n end\n end", "def parse_link_definition; end", "def handle_references_label(vals)\n @references_collection << vals.last\n @references = vals.last if matches_mdes_version(vals)\n end", "def visitComponent component,args=nil\n name=component.name\n type=component.type\n \"component :#{name} => #{type.capitalize}\"\n end", "def fb_ref(options)\n options.assert_valid_keys(FB_REF_VALID_OPTION_KEYS)\n validate_fb_ref_has_either_url_or_handle(options)\n validate_fb_ref_does_not_have_both_url_and_handle(options)\n tag(\"fb:ref\", stringify_vals(options))\n end", "def commit_ref(ref, repo_param)\n ref_class = ref.class.to_s.split(\"::\")[1].to_s\n \"<a class=\\\"ref #{ref_class}\\\" href=\\\"\" + prefix_url(\"#{repo_param}/#{ref.name}\") + \"\\\">#{ref.name}</a>\"\n end", "def references; end", "def references; end", "def initialize(type, ref, role='')\n if type !~ /^(node|way|relation)$/\n raise ArgumentError.new(\"type must be 'node', 'way', or 'relation'\")\n end\n if ref.to_s !~ /^[0-9]+$/\n raise ArgumentError\n end\n @type = type\n @ref = ref.to_i\n @role = role\n end", "def ref_params\n params.fetch(:ref, {})\n end", "def reference\n @data['reference']\n end", "def ref?\n schema[\"$ref\"]\n end", "def gem_git_reference(options) # :nodoc:\n ref = options.delete :ref\n branch = options.delete :branch\n tag = options.delete :tag\n\n reference = nil\n reference ||= ref\n reference ||= branch\n reference ||= tag\n reference ||= 'master'\n\n if ref && branch\n warn <<-WARNING\nGem dependencies file #{@path} includes git reference for both ref and branch but only ref is used.\n WARNING\n end\n if (ref || branch) && tag\n warn <<-WARNING\nGem dependencies file #{@path} includes git reference for both ref/branch and tag but only ref/branch is used.\n WARNING\n end\n\n reference\n end", "def xref_name\n self['fileRef'].xref_name\n end", "def refname\n\t\treturn self.class.refname\n\tend", "def get_reference(html)\n\t\t\t\t\n\t\t\t\tentry = parse_entry_html(html)\n\t\t\t\tif !entry.nil?\n\t\t\t\t\tentry = Reference.from_bibtex(entry)\n\t\t\t\tend\n\t\t\t\tentry\n\t\t\tend", "def get_ref_name_by_sha(oauth_token, ref_sha)\n client = Octokit::Client.new(access_token: oauth_token)\n ref_response = client.refs(full_repo_name).find { |x| x[:object][:sha] == ref_sha }\n ref_response[:ref].match(/refs\\/(.*)/).captures.first\n end", "def _ref(r_name)\n __t_stringish(r_name)\n if _root.resources.set!(r_name).nil?\n ::Kernel.raise ::SparkleFormation::Error::NotFound::Resource.new(:name => r_name)\n else\n ::SparkleFormation::GoogleStruct.new(\"ref\").set!(__attribute_key(r_name))\n end\n end", "def initialize(type, ref, role='')\n if type !~ /^(node|way|relation)$/\n raise ArgumentError.new(\"type must be 'node', 'way', or 'relation'\")\n end\n if ref.to_s !~ /^[0-9]+$/\n raise ArgumentError\n end\n @type = type\n @ref = ref.to_i\n @role = role\n end", "def dereference(node = xml)\n return unless node\n debug(\"dereference(#{node.inspect})\")\n if reference = extract_first_node(\".//#{CDA_NAMESPACE}:reference[@value]\", node)\n debug(\"dereference reference: #{reference.inspect}\")\n if name = extract_first_node(\"//[@ID='#{reference.attributes['value'].gsub(\"#\",'')}']/text()\", root_element)\n debug(\"dereference name: #{name.inspect}\")\n name.value\n end\n end\n end", "def referent_identifier ref, label = nil\n safe_join [\n (label.if_present || ref.model_name.human.split.first),\n homelink(ref),\n ': '.html_safe\n ]\n end", "def determine_type(doc,reference)\n\n # Class Members.\n if reference =~ @static_member_regexp\n\n return [doc, reference]\n\n #Super Instance Members.\n elsif reference =~ /^super$/\n\n # Scan evidence of a superclass.\n doc.scan(@extends_regexp)\n return [doc, $7] if $7 != nil\n\n # 'this' instance members.\n elsif reference =~ /^(this)?$/\n\n # Locate class name.\n doc.scan(/^\\s*(\\b(public|dynamic|final)+)\\s+(class|interface)\\s+(\\w+)\\s+/)\n return [doc, $4] if $4 != nil\n\n # Instance Members.\n else\n\n @return_type_void = false\n\n log_append(\"Determining type of '#{reference}'.\")\n\n property_chain = [reference]\n\n if reference.match( /\\./)\n property_chain = reference.split(\".\")\n end\n\n # Where casting has occoured we may have a short cut to exploit as the type\n # we are searching for at that point in the chain will be referenced in the\n # local document.\n shortcut = nil\n property_chain.reverse.each do |p|\n if p =~ @static_member_regexp\n shortcut = p\n break\n end\n end\n\n property_chain.slice!(0,property_chain.rindex(shortcut)) if shortcut\n\n log_append(\"Ancestor list: \"+property_chain.join(\", \"))\n return search_ancestor(doc,property_chain)\n\n end\n\n end", "def references\n @references ||= ApiFactory.new 'GitData::References'\n end", "def lookup_anchor(name)\n if node = anchor_map[name]\n if 'reference' == node.node_name\n if series = node.at('./seriesInfo[@name=\"RFC\"]')\n \"RFC #{series['value']}\"\n elsif title = node.at('.//title')\n title.text\n end\n else\n node['title']\n end\n end\n end", "def object_ref_item_schema\n {\n 'type' => 'object',\n 'additionalProperties' => false,\n 'properties' => {\n \"spec\" => {\n 'type' => 'string',\n 'pattern' => '^https?://'\n },\n \"id\" => {\n 'type' => 'string',\n 'pattern' => '^https?://'\n },\n \"name\" => {\n 'type' => 'string',\n 'pattern' => '^[^\\n]+$'\n }\n }\n }\n end", "def reference\n @reference\n end", "def resolve_single_reference(reference)\n plugin_name = reference['_plugin']\n hook = get_hook(plugin_name, :resolve_reference)\n\n begin\n validate_proc = get_hook(plugin_name, :validate_resolve_reference)\n rescue PluginError\n validate_proc = proc { |*args| }\n end\n\n validate_proc.call(reference)\n\n begin\n # Evaluate the plugin and then recursively evaluate any plugin returned by it.\n hook.call(reference)\n rescue StandardError => e\n loc = \"resolve_reference in #{plugin_name}\"\n raise PluginError::ExecutionError.new(e.message, plugin_name, loc)\n end\n end", "def parse_component_value(input = T.unsafe(nil)); end" ]
[ "0.7027189", "0.65883344", "0.6315223", "0.6203796", "0.59370536", "0.5904405", "0.58219314", "0.58185077", "0.5750216", "0.56840336", "0.5617649", "0.5593436", "0.55749047", "0.5569696", "0.5558918", "0.55410755", "0.55352235", "0.5485166", "0.54585737", "0.54434454", "0.5419911", "0.54159266", "0.5412589", "0.5409321", "0.5408179", "0.53987753", "0.53895015", "0.53859586", "0.5368212", "0.53530955", "0.5347768", "0.5311194", "0.5304146", "0.52785707", "0.5276079", "0.5270117", "0.5243258", "0.52266663", "0.5219676", "0.52086085", "0.5194271", "0.5192315", "0.5191422", "0.5186337", "0.51858926", "0.5177954", "0.51671326", "0.51558584", "0.5144091", "0.5133842", "0.5125385", "0.5119382", "0.51186633", "0.51159275", "0.51146704", "0.5079232", "0.506647", "0.50583386", "0.50551486", "0.5053002", "0.50387883", "0.50290793", "0.5018049", "0.5014444", "0.50058365", "0.5005573", "0.49947774", "0.49739397", "0.49604136", "0.4957985", "0.49541506", "0.49535614", "0.49512827", "0.4933935", "0.49299988", "0.4929857", "0.4905567", "0.48981053", "0.48948878", "0.48948878", "0.48923507", "0.48917058", "0.48844746", "0.48792917", "0.4876624", "0.48762488", "0.487595", "0.48702708", "0.4867105", "0.48486516", "0.48443937", "0.48442975", "0.4834898", "0.48334074", "0.4831587", "0.48220894", "0.48137534", "0.47963193", "0.4794222", "0.47912678" ]
0.78108215
0
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Set of the user control visibility
def visible=(visible) @visible = visible @cImage.visible = visible end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visible=(vis)\n if vis\n show\n else\n hide\n end\n end", "def visible=(visible)\n @visible = visible\n for i in 0 .. @ucControls.size-1\n @ucControls[i].visible = visible\n end\n end", "def visible=(visibility)\n end", "def visible=(bool)\n make_visible !!bool\n end", "def visible(value)\n @ole.Visible = value\n nil\n end", "def visible(value)\n @ole.Visible = value\n nil\n end", "def visible=(visible)\n @visible = visible\n @cLabel.visible = visible\n @cValue.visible = visible\n end", "def visible=(value)\n @bar.visible = @background.visible = value\n end", "def visible=(value)\n @viewport.visible = value\n end", "def visibility(b)\n @is_visible = b\n return self\n end", "def visible=(visible)\n @visible = visible\n @cVolumeLabel.visible = visible\n @cMuteLabel.visible = visible\n @ucVolumeBar.visible = visible\n @cVolumeValue.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @cVolumeLabel.visible = visible\n @cMuteLabel.visible = visible\n @ucVolumeBar.visible = visible\n @cVolumeValue.visible = visible\n end", "def visible(value = true)\n boolean = value ? true : false\n\n model.visible = boolean\n end", "def visible=(visible)\n @visible = visible\n @ucIcon.visible = visible\n @cSkillName.visible = visible\n @cSkillMpCost.visible = visible\n end", "def visibility=(v)\n @visibility = v\n end", "def visible=(value)\n super(value && @data)\n @selector.visible = value && (@selected || @moving)\n end", "def visible=(value)\n if @in_save\n @buttons.each { |button| button.visible = value }\n else\n super(value)\n end\n end", "def setVisible(visible=true)\n DOM.setVisible(@element, visible)\n end", "def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend", "def visible=(v)\n if @visible ^ v\n @visible=v\n MY_LOGGER.warn(\"FIXING JTTWindow.visible= by not exploding #{@name}'s message queue when pane \" << (v ? \"shown\" : \"hidden\"))\n addmessage @parent, :paint\n end\n end", "def visible=(visible)\n @visible = visible\n @cIcon.visible = visible\n end", "def visiblity_changed\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end", "def visiblity_changed\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end", "def visible=(visible)\n @visible = visible\n @ucIcon.visible = visible\n @cItemName.visible = visible\n @cItemNumber.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @ucIcon.visible = visible\n @cItemName.visible = visible\n @cItemNumber.visible = visible\n end", "def sprite_set_visible=(v)\n @spriteset.visible = v\n end", "def visible?\n @style.display != 'none'\n end", "def visible=(visible)\n @visible = visible\n @ucActStates.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n @ucAtkStat.visible = visible\n @ucDefStat.visible = visible\n @ucSpiStat.visible = visible\n @ucAgiStat.visible = visible\n @ucEvaStat.visible = visible\n @ucHitStat.visible = visible\n @ucCriStat.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @cImage.visible = visible\n @cBorders.visible = visible\n end", "def visible(value = true)\n model.visible = Vedeu::Boolean.coerce(value)\n end", "def visible=(visible)\n @visible = visible\n @ucIcon.visible = visible\n @cItemName.visible = visible\n @cItemPrice.visible = visible\n @cItemPossess.visible = visible\n @ucItemNumber.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @ucStat.visible = visible\n @ucCompareStat.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @cLabelNumber.visible = visible\n end", "def visibility= visibility\n case visibility\n when :all\n @visibility = :private\n else\n @visibility = visibility\n end\n end", "def visible=(visible)\n @visible = visible\n @ucCharFace.visible = visible\n @cCharName.visible = visible\n @ucCharLvl.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @ucCharFace.visible = visible\n @cCharName.visible = visible\n @ucCharLvl.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n end", "def visible=(visible)\n @visible = visible\n @cEquipKind.visible = visible\n @ucIcon.visible = visible\n @cEquipName.visible = visible\n end", "def visible=(bool)\n if @back\n @back.visible = bool\n end\n super(bool)\n end", "def visible=(bool)\n if @back\n @back.visible = bool\n end\n super(bool)\n end", "def visible=(visible)\n @visible = visible\n @ucActStates.visible = visible\n @cCharImage.visible = visible\n @cCharName.visible = visible\n @ucCharLvl.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n @ucExp.visible = visible\n @cExpGauge.visible = visible\n end", "def is_visible?\n visibility && ( visibility > 0 )\n end", "def visibility?\n @visibility || true\n end", "def visibility=(value)\n super('open')\n end", "def visible=(value)\n @viewport.visible = value if @viewport\n @message_window.viewport.visible = value if @message_window\n end", "def toggle\n style[:hidden] = !style[:hidden]\n update_visibility\n end", "def visible=(value)\n @old_visible_value = self.new_record? ? value : self.visible\n super(value)\n end", "def visibility=(v); end", "def visible=(n)\n super\n @background_image.visible = n if @background_image != nil\n end", "def visible=(visible)\n @visible = visible\n @cEnemyGraphic.visible = visible\n end", "def set_visibility\n default_accessor = @options.fetch(:accessor, self.class::DEFAULT_ACCESSOR)\n @reader_visibility = @options.fetch(:reader, default_accessor)\n @writer_visibility = @options.fetch(:writer, default_accessor)\n end", "def visibility\n return nil if @visibility.nil?\n @visibility ? '1' : '0'\n end", "def visible=(visible)\n @visible = visible\n @ucEncounters.visible = visible\n @ucDefeated.visible = visible\n @ucEscaped.visible = visible\n @ucExp.visible = visible\n @ucGold.visible = visible\n end", "def visible?\n @visible\n end", "def visible?\n @visible\n end", "def visible=(visible)\n @visible = visible\n @ucHpCompareStat.visible = visible\n @ucMpCompareStat.visible = visible\n @ucAtkCompareStat.visible = visible\n @ucDefCompareStat.visible = visible\n @ucSpiCompareStat.visible = visible\n @ucAgiCompareStat.visible = visible\n @ucEvaCompareStat.visible = visible\n @ucHitCompareStat.visible = visible\n @ucCriCompareStat.visible = visible\n end", "def visible=(value)\n @message_window.viewport.visible = value if @message_window\n end", "def visible?\n true\n end", "def visible=(visible)\n @visible = visible\n @cCharGraphic.visible = visible\n end", "def visibility_changed?\n !(@old_visible_value == visible)\n end", "def visible?\n !value.nil?\n end", "def visible=(value)\n super\n @move_info.visible = value\n @skills.each { |skill| skill.visible = value }\n end", "def is_externally_visible=(value)\n @is_externally_visible = value\n end", "def visible\n @ole.Visible\n end", "def visible\n @ole.Visible\n end", "def visible\n @ole.Visible\n end", "def visible\n @ole.Visible\n end", "def hidden?\n not visible\n end", "def show\n style[:hidden] = false\n update_visibility\n end", "def visibility; end", "def visibility; end", "def visibility; end", "def visibility; end", "def visibility; end", "def visible?\n\t\t\t@visible\n\t\tend", "def visibility\n @visibility ||= begin\n visibility = resource_decorator.model.visibility.first\n visibility if valid_visibilities.include? visibility\n end\n end", "def visible(default_visibility)\n @default_visibility = default_visibility\n end", "def visibility(name)\n Tk.execute_only(:tkwait, :visibility, name)\n end", "def init_visibility\n return if actor? && [email protected]_battler.dead_key.empty?\n @battler_visible = [email protected]? && (@battler.enemy? ? \n [email protected] : true)\n self.opacity = 0 unless @battler_visible\n end", "def show\n self.visible = true\n end", "def switch_visibility(params = {})\n @visible = params[:visible] || !@visible\n reset_visiblility_counters\n end", "def visible= visible_value\n @ole_excel.Visible = @visible = visible_value\n @ole_excel.DisplayAlerts = @visible if @displayalerts == :if_visible\n end", "def set_visible_with_cascade!(state)\n set_visible(state)\n force_visibility_cascade\n self.save\n self\n end", "def test_invisible\n [@window, @sprite, @bitmap].each{|container|\n uc = UCNumericUpDown.new(container, Rect.new(200, 48, 100, 24), 5)\n uc.visible = false\n uc.draw()\n }\n return true\n end", "def wrapper_visibility\n @field_config[:hide_on_load] = !@field_config[:initially_visible] if @field_config&.key?(:initially_visible)\n return '' unless @field_config[:hide_on_load]\n\n ' hidden'\n end", "def is_public?\n !@@hide_status_choices.include?(self.status)\n end", "def visible\n return @bar.visible\n end", "def visible?\n end", "def hide!\n visible(false)\n end", "def hide!\n visible(false)\n end", "def hide\n @visible = false\n self\n end", "def ongoing_visibility=(visibility)\n @visibility = visibility\n end", "def ongoing_visibility=(visibility)\n @visibility = visibility\n end", "def is_hidden?\n\t\tself.hidden\n\tend", "def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end", "def visible=(state)\n return false if (state ? true : false) == self.visible?\n if state\n iws = [300, 300]\n @dialog = ::UI::WebDialog.new(@title, false, @title, iws.x, iws.y, 800, 600, false)\n # Callbacks\n @dialog.add_action_callback('init') { |dlg, params|\n unless @init_called\n @init_called = true\n ds = eval(params)\n #@border_size = [iws.x - ds.x, iws.y - ds.y]\n if RUBY_PLATFORM =~ /mswin|mingw/i && @handle\n ws = AMS::Window.get_size(@handle)\n cr = AMS::Window.get_client_rect(@handle)\n cs = [cr[2] - cr[0], cr[3] - cr[1]]\n @border_size = [ws.x - cs.x, ws.y - cs.y]\n else\n @border_size = [2, 24]\n end\n end\n @sliders.each { |name, data|\n generate_slider_html(name, false)\n }\n dlg.execute_script(\"update_size();\")\n }\n @dialog.add_action_callback('size_changed') { |dlg, params|\n @size = eval(params)\n update_placement\n }\n @dialog.add_action_callback('mouse_enter') { |dlg, params|\n @mouse_over = true\n }\n @dialog.add_action_callback('mouse_leave') { |dlg, params|\n @mouse_over = false\n AMS::Sketchup.activate if RUBY_PLATFORM =~ /mswin|mingw/i\n }\n @dialog.add_action_callback('update_note') { |dlg, params|\n next if RUBY_PLATFORM !~ /mswin|mingw/i\n cmd = \"\"\n if AMS::Sketchup.is_main_window_active?\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').fadeIn(750);\"\n elsif AMS::Window.is_active?(@handle)\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note2').fadeIn(750);\"\n else\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note1').fadeIn(750);\"\n end\n dlg.execute_script(cmd)\n }\n # Set content\n dir = File.dirname(__FILE__)\n dir.force_encoding(\"UTF-8\") if RUBY_VERSION !~ /1.8/\n url = File.join(dir, 'html/control_panel.html')\n @dialog.set_file(url)\n # Show dialog\n RUBY_PLATFORM =~ /mswin|mingw/i ? @dialog.show : @dialog.show_modal\n # Assign the on_close callback. Important: This must be called after\n # showing dialog in order to work on Mac OS X.\n @dialog.set_on_close {\n if RUBY_PLATFORM =~ /mswin|mingw/i\n AMS::Sketchup.include_dialog(@handle)\n AMS::Sketchup.remove_observer(self)\n end\n @dialog.execute_script('uninit();')\n @dialog = nil\n @handle = nil\n @mouse_over = false\n @init_called = false\n }\n # Find dialog window handle\n @handle = RUBY_PLATFORM =~ /mswin|mingw/i ? AMS::Sketchup.find_window_by_caption(@title) : nil\n if @handle\n # Add observer\n AMS::Sketchup.add_observer(self)\n # Remove dialog caption and borders\n layered = AMS::System.get_windows_version < 6.0 ? 0 : 0x00080000\n style_ex = 0x00010000 | layered # WS_EX_CONTROLPARENT | WS_EX_LAYERED\n #style = 0x54000000 # WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS\n style = 0x94000000 # WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS\n AMS::Window.lock_update(@handle)\n AMS::Window.set_long(@handle, -20, style_ex)\n AMS::Window.set_long(@handle, -16, style)\n AMS::Window.lock_update(nil)\n AMS::Window.set_pos(@handle, 0, 0, 0, 0, 0, 0x0267)\n AMS::Window.set_layered_attributes(@handle, 0, 200, 2)\n AMS::Sketchup.ignore_dialog(@handle)\n AMS::Sketchup.activate\n end\n else\n @dialog.close\n end\n true\n end", "def invisible?\n false\n end", "def invisible?\n false\n end", "def none?\n self.display_on == \"none\"\n end", "def invisible?\n false\n end", "def icons_visible=(value)\n @icons_visible = value\n end" ]
[ "0.725057", "0.715895", "0.7083419", "0.6959489", "0.69367146", "0.69367146", "0.6829695", "0.67854863", "0.6764412", "0.6728918", "0.66418266", "0.6640898", "0.66404456", "0.6627523", "0.6609199", "0.65964514", "0.65940666", "0.6546558", "0.6520928", "0.6510744", "0.6403504", "0.63793963", "0.63793963", "0.6359014", "0.6359014", "0.6352227", "0.6344427", "0.63433003", "0.6335766", "0.6320064", "0.6301835", "0.6290103", "0.62888455", "0.6282965", "0.6265066", "0.6265066", "0.6253394", "0.62525386", "0.62525386", "0.6225462", "0.62146866", "0.6198021", "0.61851", "0.61815166", "0.6175111", "0.6157483", "0.614563", "0.61369824", "0.6120812", "0.61140275", "0.61056346", "0.6063493", "0.60609597", "0.60609597", "0.6055545", "0.60442215", "0.6005592", "0.6002316", "0.59957373", "0.5972822", "0.5952865", "0.5942063", "0.59264797", "0.59264797", "0.59264797", "0.59264797", "0.5882772", "0.5881174", "0.58784246", "0.58784246", "0.58784246", "0.58784246", "0.58784246", "0.5869761", "0.58676076", "0.58556104", "0.5815628", "0.58073205", "0.5805185", "0.5800047", "0.57820344", "0.5767787", "0.5764604", "0.5755097", "0.5739289", "0.57296735", "0.5724164", "0.5686794", "0.5686794", "0.5672149", "0.56721026", "0.56721026", "0.5644452", "0.5634505", "0.56306165", "0.56070065", "0.56070065", "0.5601235", "0.5592543", "0.55811596" ]
0.6366749
23
Set of the user control activity
def active=(active) @active = active @cImage.active = active end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def set_activity_participant\n @activity_participant = current_user\n end", "def set_user_activity\n @user_activity = UserActivity.find(params[:id])\n end", "def show\n set_user_activity\n end", "def set_activity\n @activity = current_user.activities.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_ActivityID(value)\n set_input(\"ActivityID\", value)\n end", "def set_activity\n @activity = PublicActivity::Activity.find(params[:id])\n end", "def set_activity\n begin\n @activity = Activity.find(params[:id])\n rescue\n end\n end", "def set_activities_user\n @activities_user = ActivitiesUser.find(params[:id])\n end", "def activities=(value)\n @activities = value\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n end", "def set_activity\n @activity = Activity.where(uuid: params[:id])\n end", "def set_activity\n @activity = Activity.find(params[:id])\n @reciever = Reciever.find(@activity.reciever_id)\n end", "def set_dev_activity\n @dev_activity = DevActivity.find(params[:id])\n end", "def active=(value)\n super(value)\n @info_window.active = value unless @info_window.nil?\n go_up if value\n end", "def set_activity\n @activity = Activity.find(params[:id]) if params[:id]\n @project = Project.find(params[:project_id])\n\n end", "def user_action=(value)\n @user_action = value\n end", "def set_user; end", "def ui=(value)\n @@ui = value\n value\n end", "def set_usertipactivityrecord\n @usertipactivityrecord = Usertipactivityrecord.find(params[:id])\n end", "def activity_owner\n self\n end", "def set_activity\n @activity = Activity.find_by_id(params[:id])\n end", "def set_Thread(value)\n set_input(\"Thread\", value)\n end", "def set_Thread(value)\n set_input(\"Thread\", value)\n end", "def set_activity_group\n @activity_group = ActivityGroup.find(params[:id])\n end", "def activity_type=(value)\n @activity_type = value\n end", "def set_activity_level\n @activity_level = ActivityLevel.find(params[:id])\n end", "def initialize activity\n @activity = activity\n end", "def set_status_activity\n @status_activity = StatusActivity.find(params[:id])\n end", "def set_type_activity\n @type_activity = TypeActivity.find(params[:id])\n end", "def set_project_activity\n @project_activity = ProjectActivity.find(params[:id])\n end", "def set_activity_item\n @activity_item = ActivityItem.find(params[:id])\n end", "def set_programme_activity\n @programme_activity = ProgrammeActivity.find( params[:id] )\n end", "def set_owner\n @goal.owner = current_user\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_user_action\n @user_action = UserAction.find(params[:id])\n end", "def set_user_activity_history\n @user_activity_history = UserActivityHistory.find(params[:id])\n end", "def active=(active)\n @active = active\n for i in 0 .. @ucControls.size-1\n @ucControls[i].active = active\n end\n end", "def set_activity\n @activity = PublicActivity::Activity.find(params[:activity_id])\n unless @activity\n head :bad_request\n end\n end", "def set_activity_and_group\n @activity = Activity.find(params[:id] || params[:activity_id])\n @group = @activity.group\n end", "def set_actum\n @actum = Actum.find(params[:id])\n end", "def set_actum\n @actum = Actum.find(params[:id])\n end", "def set_activity\n @activity = Activity.with_deleted.find(params[:id])\n end", "def user_flow_attributes=(value)\n @user_flow_attributes = value\n end", "def setCurrentTask _obj, _args\n \"_obj setCurrentTask _args;\" \n end", "def set_activity_register\n @activity_register = ActivityRegister.find(params[:id])\n end", "def set_ShowUser(value)\n set_input(\"ShowUser\", value)\n end", "def set_user\n @clinician = current_user\n end", "def IsActive=(arg0)", "def IsActive=(arg0)", "def activity\n end", "def set_activity_category\n @activity_category = ActivityCategory.find(params[:id])\n end", "def initialize(*args)\n super\n @action = :set\nend", "def set_user_widget\n @user_widget = UserWidget.find(params[:id])\n end", "def set_user_step\n @user_step = UserStep.find(params[:id])\n end", "def set_setting\n end", "def set_computers_activity\n @computers_activity = ComputersActivity.find(params[:id])\n end", "def load_user_activity\n @activity = current_user.activities.find(params[:entry][:activity_id])\n end", "def set_user\n @cUser = current_user\n puts \"***#{@cUser}\"\n end" ]
[ "0.6543812", "0.6543812", "0.6543812", "0.6543812", "0.636757", "0.6331631", "0.62381357", "0.622229", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.59626406", "0.5870153", "0.58449334", "0.58449334", "0.58449334", "0.58449334", "0.58449334", "0.58449334", "0.58449334", "0.58449334", "0.58449334", "0.5841732", "0.58355355", "0.580258", "0.579711", "0.57327694", "0.57327694", "0.57327694", "0.57327694", "0.57327694", "0.57327694", "0.57327694", "0.57327694", "0.56171095", "0.56103045", "0.5601654", "0.5601424", "0.5583117", "0.55726933", "0.5552389", "0.55440325", "0.5518018", "0.5512646", "0.5503303", "0.54789555", "0.54789555", "0.5471347", "0.5463376", "0.5460669", "0.5459457", "0.54525805", "0.5452487", "0.5411375", "0.5354371", "0.5353798", "0.5349733", "0.53417236", "0.53417236", "0.5341523", "0.5340289", "0.53348583", "0.5316088", "0.53029954", "0.53029954", "0.530004", "0.5279796", "0.5271622", "0.5267996", "0.52473533", "0.524493", "0.52235967", "0.52235967", "0.51987576", "0.5198602", "0.51861787", "0.51757944", "0.51740474", "0.51663864", "0.51616836", "0.5160868", "0.51600295" ]
0.0
-1
////////////////////////////////////////////////////////////////////////// Constructors ////////////////////////////////////////////////////////////////////////// Object Initialization window : window in which the control will be drawn image : name of the image in Cache.picture align : background image alignment opacity : background image opacity valign : background image vertical alignment active : control activity visible : control visibility
def initialize(window, image, align=0, opacity=255, valign=0, active=true, visible=true) super(active, visible) self.image = image @cImage = CImage.new(window, Rect.new(0, 0, window.width, window.height), nil, nil, align, opacity, valign, active, visible) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(actor)\n super(Combo_Window_Settings[0], Combo_Window_Settings[1], Combo_Window_Settings[2], Combo_Window_Settings[3])\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z = 4000\n @combo_page = 0\n @max_size = ((self.width - 32) / 52).to_i\n if Combo_Window_Bg != nil\n @background_image = Sprite.new\n @background_image.bitmap = RPG::Cache.windowskin(Combo_Window_Bg)\n @background_image.x = self.x + Combo_Window_Bg_Postion[0]\n @background_image.y = self.y + Combo_Window_Bg_Postion[1]\n @background_image.z = self.z - 1\n @background_image.visible = self.visible\n end\n self.back_opacity = Combo_Window_Settings[4]\n self.opacity = Combo_Window_Settings[4] if Combo_Window_Settings[5] \n @actor = actor\n create_input_images if Input_Images\n refresh\n end", "def initialize(window, rect, img_bitmap, src_rect, align=0, opacity=255, \n valign=0, active=true, visible=true)\n super(window, active, visible)\n self.rect = rect\n self.img_bitmap = img_bitmap\n self.src_rect = src_rect\n self.align = align\n self.opacity = opacity\n self.valign = valign\n end", "def initialize(window, rect, iconIndex, align=0, opacity=255, valign=0, \n active=true, visible=true)\n super(active, visible)\n self.iconIndex = iconIndex\n @cIcon = CImage.new(window, rect, nil, nil, align, opacity, valign, \n active, visible)\n end", "def initialize(x, y, width, height, image)\n super(x, y, width, height)\n \n @ucImage = UCBackgroundImage.new(self, \"\", 1, 128, 1)\n \n window_update(image)\n end", "def initialize(window, rect, bitmap, src_rect, align=0, opacity=255, \n valign=0, border=0, border_color=nil,\n active=true, visible=true)\n super(active, visible)\n \n if border > 0 && !border_color.nil?\n vertices = [[rect.x, rect.y],[rect.x+rect.width, rect.y],\n [rect.x+rect.width, rect.y+rect.height],\n [rect.x, rect.y+rect.height]]\n @cBorders = CPolygon.new(window, vertices, nil, false, nil,\n border, border_color)\n rect = Rect.new(rect.x + border, rect.y + border, \n rect.width - border*2, rect.height - border*2)\n end\n \n @cImage = CImage.new(window, rect, bitmap, src_rect, align, opacity, valign)\n end", "def initialize(iParent)\n super(iParent)\n\n # This attribute will be changed only if the icon is changed.\n # It is used instead of the Wx::BitmapButton::bitmap_label because it can be nil, and in this case we don't want to replace it with the default icon internally.\n @Icon = nil\n \n # Create all components\n lSTTitle = Wx::StaticText.new(self, Wx::ID_ANY, 'Title')\n @TCTitle = Wx::TextCtrl.new(self)\n @TCTitle.min_size = [300, @TCTitle.min_size.height]\n lSTIcon = Wx::StaticText.new(self, Wx::ID_ANY, 'Icon')\n @BBIcon = Wx::BitmapButton.new(self, Wx::ID_ANY, Wx::Bitmap.new)\n evt_button(@BBIcon) do |iEvent|\n # display the icon chooser dialog\n require 'pbs/Windows/ChooseIconDialog'\n showModal(ChooseIconDialog, self, @BBIcon.bitmap_label) do |iModalResult, iDialog|\n case iModalResult\n when Wx::ID_OK\n lNewIcon = iDialog.getSelectedBitmap\n if (lNewIcon != nil)\n @Icon = lNewIcon\n setBBIcon\n end\n end\n end\n end\n\n # Put them in sizers\n lMainSizer = Wx::BoxSizer.new(Wx::VERTICAL)\n lMainSizer.add_item([0,0], :proportion => 1)\n lMainSizer.add_item(lSTTitle, :flag => Wx::ALIGN_CENTRE, :proportion => 0)\n lMainSizer.add_item(@TCTitle, :flag => Wx::GROW, :proportion => 0)\n lIconSizer = Wx::BoxSizer.new(Wx::HORIZONTAL)\n lIconSizer.add_item(lSTIcon, :flag => Wx::ALIGN_CENTRE, :proportion => 0)\n lIconSizer.add_item([8,0], :proportion => 0)\n lIconSizer.add_item(@BBIcon, :flag => Wx::ALIGN_CENTRE, :proportion => 0)\n lMainSizer.add_item([0,8], :proportion => 0)\n lMainSizer.add_item(lIconSizer, :flag => Wx::ALIGN_CENTRE, :proportion => 0)\n lMainSizer.add_item([0,0], :proportion => 1)\n self.sizer = lMainSizer\n\n end", "def control; tab.image(:name, 'imgControl'); end", "def initialize(actor)\n super(Input_Window_Settings[0], Input_Window_Settings[1], actor.bar_size + 32, 64)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z = 4000\n if Input_Window_Bg != nil\n @background_image = Sprite.new\n @background_image.bitmap = RPG::Cache.windowskin(Input_Window_Bg)\n @background_image.x = self.x + Input_Window_Bg_Postion[0]\n @background_image.y = self.y + Input_Window_Bg_Postion[1]\n @background_image.z = self.z - 1\n @background_image.visible = self.visible\n end\n self.back_opacity = Input_Window_Settings[2]\n self.opacity = Input_Window_Settings[2] if Input_Window_Settings[3] \n @actor = actor\n create_input_images if Input_Images\n refresh\n end", "def initialize(battler)\n x,y = Scan_Window_Settings[0], Scan_Window_Settings[1]\n w,h = Scan_Window_Settings[2], Scan_Window_Settings[3]\n super(x,y,w,h)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z = 4950\n if Scan_Window_Bg != nil\n @background_image = Sprite.new\n @background_image.bitmap = RPG::Cache.windowskin(Scan_Window_Bg)\n @background_image.x = self.x + Scan_Window_Bg_Postion[0]\n @background_image.y = self.y + Scan_Window_Bg_Postion[1]\n @background_image.z = self.z - 1\n @background_image.visible = self.visible\n end\n self.back_opacity = Scan_Window_Settings[4]\n self.opacity = Scan_Window_Settings[4] if Scan_Window_Settings[5]\n @battler = battler\n refresh\n end", "def initialize(window, rect, actor, align=0, opacity=255, valign=0, direction=0,\n active=true, visible=true)\n super(active, visible)\n self.actor = actor\n @direction = direction\n @cCharGraphic = CImage.new(window, rect, nil, nil, align, opacity, valign,\n active, visible)\n end", "def initialize(window, rect, enemy, align=0, opacity=255, valign=0, resize_mode=nil, \n active=true, visible=true)\n super(active, visible)\n self.enemy = enemy\n @cEnemyGraphic = CResizableImage.new(window, rect, \n nil, nil, align, opacity, valign, resize_mode, \n active, visible)\n end", "def monitor; tab.image(:name, 'imgMonitor'); end", "def initialize(x, y, width, height, actor)\n super(x, y, width, height)\n @cBackCharImage = CResizableImage.new(self, Rect.new(0, 0, self.contents.width, self.contents.height), \n nil, nil, 0, 255, 2, 3)\n window_update(actor)\n end", "def initialize(x, y, window)\n\t\tsuper(\"images/alien.png\") \n\t\t@x = x\n \t @y = y\n \t\t@window = window\n\tend", "def draw_imgui\n\n\t\tend", "def initialize window, path, tileable = false\n super\n @image = Gosu::Image.new(window, path, tileable)\n end", "def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end", "def create_gui\n \n # The root\n \n root = TkRoot.new { title \"Camera Control\" }\n TkGrid.columnconfigure root, 0, :weight => 1\n TkGrid.rowconfigure root, 0, :weight => 1\n\n # Enclosing frame\n\n content = Tk::Tile::Frame.new(root) { padding \"5 5 12 12\" }\n content.grid :sticky => 'nsew'\n\n # -------------- Controller Details frame --------------\n\n details = Tk::Tile::Labelframe.new(content) { text 'Image Control' }\n details.grid :column => 0, :row => 0, :sticky => 'nsew', :columnspan => 4\n details['borderwidth'] = 2\n\n # Entries in the details frame\n\n row = 0\n\n @slider_controls.keys.sort.each do |key|\n control = @slider_controls[key]\n $vars[key] = TkVariable.new\n $vars[key].value = control.default\n @labels[key] = Tk::Tile::Label.new(details) { text \"#{key}:\" }\n @labels[key].grid :column => 0, :row => row, :sticky => 'ew'\n @entries[key] = Tk::Tile::Scale.new(details, variable: $vars[key]) {\n orient 'horizontal';\n length 300;\n from control.min.to_f;\n to control.max.to_f;\n command { tk_callback('sliding_bar', key) }\n }\n @entries[key].grid :column => 1, :row => row, :sticky => 'ew'\n\n val = Tk::Tile::Entry.new(details, :width => 6, :textvariable => $vars[key] )\n val.grid :column => 3, :row => row, :sticky => 'ew'\n row += 1\n end # each controls\n TkWinfo.children(details).each {|w| TkGrid.configure w, :padx => 5, :pady => 3}\n TkGrid.columnconfigure(content, 0,\t:weight => 1) \n \n # -------------- Toggle frame ---------------\n\n tf = Tk::Tile::Labelframe.new(content) { \n text 'Options';\n padding \"5 5 12 12\"\n }\n tf.grid :column => 0, :row => 2, :sticky => 'nsew', :columnspan => 6\n tf['borderwidth'] = 2\n\n column = 1\n row = 1\n @toggle_controls.keys.sort.each do |key|\n control = @toggle_controls[key]\n $vars[key] = TkVariable.new\n $vars[key].value = control.default\n @entries[key] = Tk::Tile::CheckButton.new(tf) {\n text key;\n command { tk_callback('toggle_button', key) }\n onvalue 1;\n offvalue 0;\n variable $vars[key]\n }\n @entries[key].grid :column => column, :row => row, :sticky => 'ew'\n row += 1\n end # toggle controls\n\n @choice_controls.keys.sort.each do |key|\n control = @choice_controls[key]\n\n # the label\n\n l = Tk::Tile::Label.new(tf) { text key }\n\n # the combo box\n\n $vars[key] = TkVariable.new\n $vars[key].value = control.choices[control.default.to_i.to_s]\n @entries[key] = Tk::Tile::Combobox.new(tf) { \n textvariable $vars[key];\n values control.choices.values \n }\n @entries[key].bind(\"<ComboboxSelected>\") { combo_box(key) }\n l.grid :column => 2, :row => row, :sticky => 'ew'\n @entries[key].grid :column => 1, :row => row, :sticky => 'ew'\n row += 1\n end # choice controls\n\n # -------------- Motor control frame --------------\n\n # Only show this part if the camera supports motor controls\n\n if @motor_controls.size > 0\n \n mcf = Tk::Tile::Labelframe.new(content) { text 'Motor Controls' }\n mcf.grid :column => 0, :row => 3, :sticky => 'nsew', :columnspan => 6\n mcf['borderwidth'] = 4\n\n image_path = File.dirname(__FILE__) + '/imgs/'\n\n au = TkPhotoImage.new(:file => image_path + 'Arrow-Up-icon.gif')\n ad = TkPhotoImage.new(:file => image_path + 'Arrow-Down-icon.gif')\n al = TkPhotoImage.new(:file => image_path + 'Arrow-Left-icon.gif')\n ar = TkPhotoImage.new(:file => image_path + 'Arrow-Right-icon.gif')\n ri = TkPhotoImage.new(:file => image_path + 'reset.gif')\n\n tu = Tk::Tile::Button.new(mcf) {\n image au;\n command { tk_callback('tilt_up') }\n }\n tu.grid :column => 2, :row => 1, :stick => 'ew'\n\n td = Tk::Tile::Button.new(mcf) {\n image ad;\n command { tk_callback('tilt_down') }\n }\n td.grid :column => 2, :row => 3, :stick => 'ew'\n\n pl = Tk::Tile::Button.new(mcf) {\n image al;\n command { tk_callback('pan_left') }\n }\n pl.grid :column => 1, :row => 2, :stick => 'ew'\n\n pr = Tk::Tile::Button.new(mcf) {\n image ar;\n command { tk_callback('pan_right') }\n }\n pr.grid :column => 3, :row => 2, :stick => 'ew'\n\n ro = Tk::Tile::Button.new(mcf) {\n image ri;\n command { tk_callback('reset_to_origin') }\n }\n ro.grid :column => 2, :row => 2, :stick => 'ew'\n end\n\n # -------------- Message frame --------------\n\n mf = Tk::Tile::Labelframe.new(content) { text 'Messages' }\n mf.grid :column => 0, :row => 4, :sticky => 'nsew', :columnspan => 6\n mf['borderwidth'] = 2\n\n \n TkGrid.columnconfigure(mf, 0, :weight => 1)\n TkGrid.rowconfigure(mf, 0, :weight => 1)\n\n @msg_text = TkText.new(mf) { height 10; background \"white\" }\n @msg_text.grid :column => 0, :row => 2\n @msg_text['state'] = :normal\n\n TkWinfo.children(content).each {|w| TkGrid.configure w, :padx => 5, :pady => 5}\n# TkWinfo.children(data).each {|w| TkGrid.configure w, :padx => 5, :pady => 3}\n\n end", "def init_variables\n\t\t@canvas = Magick::ImageList.new \n\t\t@canvas_width = 2880\n\t\t@canvas_height = 1800\n\t\t@quote = self.quote\n\t\t@citation = self.citation\n\t\t@highlight = self.colour_scheme.highlight\n\t\t@quote_marks = self.layout_scheme.quote_marks \n\t\t@font_size = self.layout_scheme.font_size.to_i\n\t\t@col = self.layout_scheme.col.to_i\n\t\t@position = self.layout_scheme.position\n\t\t@underline = self.layout_scheme.underline\n\tend", "def display(params = {})\n if params[:pathForImage].nil?\n disp = ImageWindow.new(self)\n disp.show\n else\n pict = Image.new(params[:pathForImage])\n disp = ImageWindow.new(pict)\n disp.show\n end\n end", "def initialize(window, item, rect, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @item = item\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], item.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cItemName = CLabel.new(window, rects[1], item.name)\n @cItemName.active = active\n @cItemName.visible = visible\n @cItemName.cut_overflow = true\n \n @cItemNumber = CLabel.new(window, rects[2], \n sprintf(MENU_CONFIG::ITEM_NUMBER_PATTERN, \n $game_party.item_number(item)), 2)\n @cItemNumber.active = active\n @cItemNumber.visible = visible\n end", "def initialize(window, victory_item, rect, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @victory_item = victory_item\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], victory_item.item.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cItemName = CLabel.new(window, rects[1], victory_item.item.name)\n @cItemName.active = active\n @cItemName.visible = visible\n @cItemName.cut_overflow = true\n \n @cItemNumber = CLabel.new(window, rects[2], \n sprintf(VICTORY_CONFIG::ITEM_NUMBER_PATTERN, \n victory_item.quantity), 2)\n @cItemNumber.active = active\n @cItemNumber.visible = visible\n end", "def init_window\n self.z = 10_000\n lock\n @name_window.visible = false\n @name_window.lock\n @name_text.text = ''\n update_windowskin\n init_pause_coordinates\n self.pauseskin = RPG::Cache.windowskin(PauseSkin)\n self.back_opacity = ($game_system.message_frame == 0 ? 255 : 0)\n unlock\n @name_window.unlock\n end", "def image_bk(name)\n image = TkPhotoImage.new\n image.file = \"./images/#{name}\"\n label = TkLabel.new(@frame)\n label.image = image\n label.place('height' => image.height, 'width' => image.width,'x' => 290, 'y' => -15)\n end", "def initialize(window, actor, rect, spacing=18, right_pad=2,\n active=true, visible=true)\n super(active, visible)\n @actor = actor\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing, right_pad)\n \n @ucActStates = UCLabelIconsSwitchableList.new(window, rects[0], rects[0], \n \"\", [0], MENU_CONFIG::ACT_STATES_MAX_ICONS, \n MENU_CONFIG::ACT_STATES_ICONS_TIMEOUT) \n @ucActStates.active = active\n @ucActStates.visible = visible\n \n iconsArray = []\n for i in 0 .. actor.states.size-1\n iconsArray[i] = actor.states[i].icon_index\n end\n @ucActStates.icons = iconsArray\n \n bodyImg = MENU_CONFIG::BODY_IMAGES[actor.id]\n @cCharImage = CImage.new(window, rects[1], Cache.picture(bodyImg.filename), \n bodyImg.src_rect)\n @cCharImage.valign = 2\n @cCharImage.active = active\n @cCharImage.visible = visible\n \n if actor.dead?\n @cCharImage.active = false \n end\n \n @cCharName = CLabel.new(window, rects[2], \n actor.name, 1, Font.bold_font)\n @cCharName.active = active\n @cCharName.visible = visible\n \n @ucCharLvl = UCLabelValue.new(window, rects[3][0], rects[3][1], \n Vocab::lvl_label, actor.level)\n @ucCharLvl.cLabel.font = Font.party_stat_font\n @ucCharLvl.cValue.font = Font.party_stat_font\n @ucCharLvl.cLabel.align = 2\n @ucCharLvl.cValue.align = 2\n @ucCharLvl.active = active\n @ucCharLvl.visible = visible\n \n @ucHpStat = UCLabelIconValue.new(window, rects[4][1], rects[4][0], rects[4][2],\n Vocab::hp_label, MENU_CONFIG::ICON_HP, \n sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.hp, actor.maxhp))\n @ucHpStat.cValue.align = 2\n @ucHpStat.cValue.font = Font.party_stat_font\n \n if actor.hp == 0\n @ucHpStat.cValue.font.color = Color.knockout_color\n elsif actor.hp < actor.maxhp / 4\n @ucHpStat.cValue.font.color = Color.crisis_color\n else\n @ucHpStat.cValue.font.color = Color.normal_color\n end\n \n @ucHpStat.active = active\n @ucHpStat.visible = visible\n @cHpStatGauge = UCBar.new(window, rects[5], \n Color.hp_gauge_color1, Color.hp_gauge_color2, Color.gauge_back_color, \n actor.hp, actor.maxhp, 1, Color.gauge_border_color)\n @cHpStatGauge.active = active\n @cHpStatGauge.visible = visible\n \n @ucMpStat = UCLabelIconValue.new(window, rects[6][1], rects[6][0], rects[6][2],\n Vocab::mp_label, MENU_CONFIG::ICON_MP, \n sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.mp, actor.maxmp))\n @ucMpStat.cValue.align = 2\n @ucMpStat.cValue.font = Font.party_stat_font\n \n if actor.mp < actor.maxmp / 4\n @ucMpStat.cValue.font.color = Color.crisis_color\n else\n @ucMpStat.cValue.font.color = Color.normal_color\n end\n \n @ucMpStat.active = active\n @ucMpStat.visible = visible\n @cMpStatGauge = UCBar.new(window, rects[7], \n Color.mp_gauge_color1, Color.mp_gauge_color2, Color.gauge_back_color, \n actor.mp, actor.maxmp, 1, Color.gauge_border_color) \n @cMpStatGauge.active = active\n @cMpStatGauge.visible = visible\n \n if (actor.next_exp == 0)\n gauge_min = 1\n gauge_max = 1\n exp_value = MENU_CONFIG::MAX_EXP_GAUGE_VALUE\n else\n gauge_min = actor.now_exp\n gauge_max = actor.next_exp\n exp_value = sprintf(MENU_CONFIG::GAUGE_PATTERN, actor.now_exp, actor.next_exp)\n end\n \n @ucExp = UCLabelIconValue.new(window, rects[8][1], rects[8][0], rects[8][2],\n Vocab::exp_label, MENU_CONFIG::ICON_EXP, \n exp_value)\n @ucExp.cValue.align = 2\n @ucExp.cValue.font = Font.party_stat_font\n @ucExp.active = active\n @ucExp.visible = visible\n \n @cExpGauge = UCBar.new(window, rects[9], \n Color.exp_gauge_color1, Color.exp_gauge_color2, Color.gauge_back_color, \n gauge_min, gauge_max, 1, Color.gauge_border_color) \n @cExpGauge.active = active\n @cExpGauge.visible = visible\n \n end", "def visible=(visible)\n @visible = visible\n @cImage.visible = visible\n @cBorders.visible = visible\n end", "def initialize()\n screen=Gdk::Screen.default\n\t\t#Variable pour resize le texte\n\t\t@pad=screen.height*0.03\n\t\t@police=screen.height*0.02\n win = Gtk::Window.new\n\t\tw=screen.width\n\t\th=screen.height\n win.set_default_size(w/4,h/10)\n win.set_resizable(false)\n\t\twin.window_position= :center_always\n\n\t\t@menu=Gtk::Box.new(:vertical, 25)\n\t\t@gtkObject= Gtk::Table.new(3,3)\n\t\[email protected](@menu,1,2,1,2)\n\n\t\t@buffer = GdkPixbuf::Pixbuf.new(file: File.dirname(__FILE__) + \"/../../../../Assets/Backgrounds/nature.jpg\")\n\t\t@[email protected](w/4,h/10+100)\n\n pb = Text.new(\"Login not found \\n OR \\nwrong password\",@police)\n\t\tpb.colorChange(\"red\")\n @menu.pack_start(pb.gtkObject,expand: false, fill: true, padding: @pad)\n\t\[email protected](Gtk::Image.new(pixbuf: @buffer),0,3,0,3)\n\t\twin.add(@gtkObject)\n\t\twin.show_all\n\n end", "def initialize(window, skill, rect, mpCost, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @skill = skill\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], skill.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cSkillName = CLabel.new(window, rects[1], skill.name)\n @cSkillName.active = active\n @cSkillName.visible = visible\n @cSkillName.cut_overflow = true\n \n @cSkillMpCost = CLabel.new(window, rects[2], \n sprintf(MENU_CONFIG::SKILL_COST_PATTERN, mpCost), 2)\n @cSkillMpCost.active = active\n @cSkillMpCost.visible = visible\n end", "def cntrl_settg; det.image(:id, 'imgCtrlSettings'); end", "def initialize(id,sprite,viewport,previous=false)\r\n super(viewport)\r\n @id=id\r\n @sprite=sprite\r\n @previous=previous\r\n @locked=false\r\n @selected=false\r\n @selcolor=Color.new(0,0,0)\r\n @unselcolor=Color.new(220,220,220)\r\n @prevcolor=Color.new(64,128,192)\r\n @contents=Bitmap.new(64,64)\r\n self.z = (@previous) ? 49 : 50\r\n @iconbitmap=AnimatedBitmap.new(\"Graphics/Pictures/animFrameIcon\")\r\n self.bitmap=@contents\r\n self.invalidate\r\n end", "def initialize(window)\n # @lines is an array of strings\n @lines = Array.new\n @current_pos = 0\n @current = true\n @hidden = false\n @cur_start_y = START_Y\n @font = Gosu::Font.new(window, Gosu::default_font_name, FONT_HEIGHT)\n @ctc = Gosu::Image.load_tiles(window, \"resources/sakura.png\", 20, 20, false)\n end", "def initialize\r\n clear\r\n @visible = false\r\n end", "def initialize(x, y, width, height)\n super(x, y, width, height)\n x = 20\n sw = self.contents.width\n dw = sw*2/3 - x\n \n # Window Skins\n @cWindowSkinsLabel = CLabel.new(self, Rect.new(x, WLH/2, sw/3, WLH), \n Vocab::system_window_skin_label, 0, Font.bold_font)\n \n @cWindowSkinsOptions = []\n @cWindowSkinsOptions.push(CLabel.new(self, Rect.new(sw/3, WLH/2, dw/5, WLH), \n \"\", 1))\n @cWindowSkinsOptions.push(CLabel.new(self, Rect.new(sw/3+dw*1/5, WLH/2, dw/5, WLH), \n \"\", 1)) \n @cWindowSkinsOptions.push(CLabel.new(self, Rect.new(sw/3+dw*2/5, WLH/2, dw/5, WLH), \n \"\", 1)) \n @cWindowSkinsOptions.push(CLabel.new(self, Rect.new(sw/3+dw*3/5, WLH/2, dw/5, WLH), \n \"\", 1)) \n @cWindowSkinsOptions.push(CLabel.new(self, Rect.new(sw/3+dw*4/5, WLH/2, dw/5, WLH), \n \"\", 1)) \n \n # BGM Volume/BGM Mute\n @ucBGMVolume = UCVolumeControl.new(self, Rect.new(x, WLH*2+WLH/2, sw-x*2, WLH), Vocab::system_bgm_label,\n text_color(YE::SYSTEM::BGM_COLOUR1),\n text_color(YE::SYSTEM::BGM_COLOUR2),\n Color.gauge_back_color, 2, Color.volume_border_color)\n \n # Sound Volume/Sound Mute\n @ucSFXVolume = UCVolumeControl.new(self, Rect.new(x, WLH*4+WLH/2, sw-x*2, WLH), Vocab::system_sfx_label,\n text_color(YE::SYSTEM::SFX_COLOUR1),\n text_color(YE::SYSTEM::SFX_COLOUR2),\n Color.gauge_back_color, 2, Color.volume_border_color)\n \n # Ambience Volume/Ambience Mute\n @ucBGSVolume = UCVolumeControl.new(self, Rect.new(x, WLH*6+WLH/2, sw-x*2, WLH), Vocab::system_bgs_label,\n text_color(YE::SYSTEM::BGS_COLOUR1),\n text_color(YE::SYSTEM::BGS_COLOUR2),\n Color.gauge_back_color, 2, Color.volume_border_color)\n \n # Battle Animations\n @cBattleAnimLabel = CLabel.new(self, Rect.new(x, WLH*8, sw/3, WLH), \n Vocab::system_ani_label, 0, Font.bold_font)\n @cBattleAnimOptions = []\n @cBattleAnimOptions.push(CLabel.new(self, Rect.new(sw/3, WLH*8, dw/2, WLH), \n Vocab::system_ani_on_command, 1))\n @cBattleAnimOptions.push(CLabel.new(self, Rect.new(sw/3+dw*1/2, WLH*8, dw/2, WLH), \n Vocab::system_ani_off_command, 1))\n \n # Auto-Dash\n @cAutoDashLabel = CLabel.new(self, Rect.new(x, WLH*9, sw/3, WLH), \n Vocab::system_autodash_label, 0, Font.bold_font)\n @cAutoDashOptions = []\n @cAutoDashOptions.push(CLabel.new(self, Rect.new(sw/3, WLH*9, dw/2, WLH), \n Vocab::system_autodash_on_command, 1))\n @cAutoDashOptions.push(CLabel.new(self, Rect.new(sw/3+dw*1/2, WLH*9, dw/2, WLH), \n Vocab::system_autodash_off_command, 1))\n \n # Instant Text\n @cInstantTextLabel = CLabel.new(self, Rect.new(x, WLH*10, sw/3, WLH), \n Vocab::system_instanttext_label, 0, Font.bold_font)\n @cInstantTextOptions = []\n @cInstantTextOptions.push(CLabel.new(self, Rect.new(sw/3, WLH*10, dw/2, WLH), \n Vocab::system_instanttext_on_command, 1))\n @cInstantTextOptions.push(CLabel.new(self, Rect.new(sw/3+dw*1/2, WLH*10, dw/2, WLH), \n Vocab::system_instanttext_off_command, 1))\n \n # Difficulty\n @cDifficultyLabel = CLabel.new(self, Rect.new(x, WLH*11, sw/3, WLH), \n Vocab::system_difficulty_label, 0, Font.bold_font)\n @cDifficultyOptions = [] \n @cDifficultyOptions.push(CLabel.new(self, Rect.new(sw/3, WLH*11, dw/3, WLH), \n \"\", 1))\n @cDifficultyOptions.push(CLabel.new(self, Rect.new(sw/3+dw*1/3, WLH*11, dw/3, WLH), \n \"\", 1))\n @cDifficultyOptions.push(CLabel.new(self, Rect.new(sw/3+dw*2/3, WLH*11, dw/3, WLH), \n \"\", 1))\n \n # In-game Tutorials\n @cInGameTutoLabel = CLabel.new(self, Rect.new(x, WLH*12, sw-x, WLH), \n Vocab::system_tutorials_label, 0, Font.bold_font)\n if $game_system.outline_enable == nil ||\n $game_system.outline_enable.size == 0\n @cInGameTutoLabel.active = false\n end\n \n # Return to Title\n @cReturnTitleLabel = CLabel.new(self, Rect.new(x, WLH*13, sw-x, WLH), \n Vocab::system_totitle_label, 0, Font.bold_font)\n \n window_update()\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def createImageView\n @imageView = NSImageView.alloc.initWithFrame(IMAGE_FRAME).tap do |obj|\n obj.autoresizingMask = NSViewMinYMargin\n obj.imageScaling = NSScaleToFit # NSScaleProportionally\n obj.editable = true\n end\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n @char_info_window.ucExp.visible = false\n @char_info_window.ucExpGauge.visible = false\n @char_info_window.ucTotalExp.visible = false\n @char_info_window.refresh()\n\n @item_window = Window_Equip_Item.new(425, 40, 215, 272 + 72, @actor, @equip_index)\n @item_window.active = false\n @item_window.index = -1\n @item_window.window_update($game_party.items)\n \n @equip_window = Window_Status_Equip.new(200, 40, 225, 272, @actor)\n @equip_window.active = false\n @equip_window.height = @equip_window.height + 72\n @equip_window.index = @equip_index\n\n @status_window = Window_Equip_Compare_Status.new(200, 40, 225, 344, @actor)\n @status_window.active = false \n @status_window.visible = false\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @equip_window.help_window = @help_window\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @equip_window.detail_window = @equip_details_window\n @item_window.detail_window = @equip_details_window\n \n @command_window = Window_Command.new(200, \n [Vocab::equip_command, \n Vocab::equip_optimize_command, \n Vocab::equip_remove_command,\n Vocab::equip_remove_all_command], 2)\n @command_window.opacity = 0\n @command_window.x = 0\n @command_window.y = 48\n @command_window.active = true\n \n @optimize_modes_window = Window_Optimize_Modes.new(0, 0, 400, 64, MENU_CONFIG::OPTIMIZE_MODES)\n @optimize_modes_window.visible = false\n @optimize_modes_window.active = false\n @optimize_modes_window.help_window = @help_window\n \n @optimize_modes_window_headers = Window_Selectable_Headers.new(@optimize_modes_window)\n width_remain = (640 - @optimize_modes_window_headers.width)/2\n @optimize_modes_window_headers.x = width_remain.floor\n height_remain = (480 - @optimize_modes_window_headers.height)/2\n @optimize_modes_window_headers.y = height_remain.floor\n @optimize_modes_window_headers.visible = false\n @optimize_modes_window_headers.addHeader(Vocab::optimize_mode_text, \n 0, @optimize_modes_window.contents.width, \n 1, Font.optimize_mode_header_font)\n @optimize_modes_window_headers.refresh()\n end", "def initialize(width, height, imageID, active_layer)\n @width = width\n @height = height\n @imageID = imageID\n @active_layer = active_layer\n end", "def initialize(manager,ic)\n\t\tsuper(manager.win)\n\t\t@manager = manager\n\t\t#Chargement de la campagne\n\t\t@adventure = manager.session\n\t\tscreen = Constants::SCREEN\n\t\t@pad=Constants::BUTTON_PADDING\n\t\t@ic=ic\n\t\t@gtkObject = Gtk::Table.new(3,3)\n\t\t@scrol=ScrollableArea.new(:vertical)\n\t\t@boxV=Gtk::Box.new(:vertical)\n\t\t@overAllStars = @adventure.overAllStars.to_s\n\n\t\t@etoileTotal=Gtk::Box.new(:horizontal)\n\t\ta=Gtk::Alignment.new(0.5,0,0.5,1)\n\t\ta.add(@boxV)\n\t\[email protected](a,0,1,1,2)\n\n\t\[email protected]_start(@etoileTotal ,expand: false, fill: true, padding:@pad)\n\t\t@st=Star.new(1,1,@ic)\n\t\[email protected]_start(@st.stars,expand: false, fill: true, padding:@pad)\n\t\tnbEtoile=Text.new(@overAllStars)\n\n\t\tnbEtoile.title\n\t\[email protected]_start(nbEtoile.gtkObject,expand: false, fill: true, padding:@pad)\n\n\t\[email protected]_start(@scrol.gtkObject,expand: true, fill: true, padding: @pad)\n\n\t\t@[email protected]\n\t\[email protected](:loc)\n\n @b=Gtk::Box.new(:horizontal, 25)\n\t\[email protected](@b)\n\n\t\t@icones=LevelNumbers.new(manager,@adventure ,@adventure.overAllStarsHash,@ic)\n\t\[email protected]_start(@icones.im,expand: false, fill: true, padding: @pad)\n @menuR=Gtk::Box.new(:horizontal, 25)\n\t\[email protected](@menuR)\n\n\t\tretour=Text.new(@textManager.getButtonLabel(\"adventure\", \"back\"))\n @boxV.pack_start(retour.gtkObject ,expand: false, fill: true, padding:@pad)\n \tretour.onClick{\n\t\t\tmanager.session.updateSave\n\t\t\tmanager.updateSave\n \tmanager.mainScreen.applyOn(@parent)\n\t\t}\n @gtkObject.attach(Gtk::Image.new(pixbuf: @buffer),0,3,0,3)\n\tend", "def visible=(visible)\n @visible = visible\n @cImage.visible = visible\n end", "def initialize\n @mouse = Mouse\n @position = @mouse.getMousePos\n @cursor = Win32API.new(\"user32\", \"ShowCursor\", \"i\", \"i\" ) \n @visible = false\n if @position.nil?\n @x = 0\n @y = 0\n else\n @x = @position[0]\n @y = @position[1]\n end\n @static_x = @x\n @static_y = @y\n @object_ox = nil\n @object_oy = nil\n # used to make on screen mouse sprite (if a graphics path is defined)\n @viewport = Viewport.new(0,0,Graphics.width,Graphics.height)\n @viewport.z = 0x3FFFFFFF\n @sprite = Sprite.new(@viewport)\n if !@@graphics_path.nil?\n @sprite.bitmap = BitmapCache.load_bitmap(@@graphics_path)\n self.show\n end\n @sprite.visible = @visible\n @sprite.x = @x\n @sprite.y = @y\n # ===================================================================\n end", "def create_layout\n self.bitmap = Cache.UI(LayoutImage)\n self.x = Graphics.center_width(self.bitmap.width)\n self.y = Graphics.height - self.bitmap.height - 16\n end", "def create_avatar_window\n @avatar_window = Window_AvatarList.new(0, 0, Graphics.width)\n @avatar_window.y = Graphics.height - @avatar_window.height\n @avatar_window.visible = false\n @avatar_window.active = false\n @avatar_window.set_handler(:ok, method(:avatar_selected))\n @avatar_window.set_handler(:cancel, method(:close_avatar))\n end", "def window_update(image)\n if image != nil\n @ucImage.image = image\n end\n refresh()\n end", "def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end", "def initialize(p, opts, x, y, width, height, padLeft, padRight, padTop, padBottom, app)\n \n @parentApp = app #Stores the parent app for the initialization of image data later in the code.\n \n @drawColor = FXRGB(255, 0, 0) #variable that stores the active draw color\n @mouseDown = false #checks if mouse is depressed\n #@dirty = false #Checks if canvas has data in it\n @brushSize = 1 #stores the active brush size\n @parent = p #stores the parent app for object initialization\n @canvasWidth = width #stores the current canvas width\n @canvasHeight = height #stores the current canvas height\n \n @layerArray = Array.new #stores hide/show state of each layer.\n @imageArray = Array.new #stores the image data of each layer.\n @dirtyArray = Array.new #stores the dirty status of each layer.\n @activeIndex = 0\n \n @saved = false #Checks if the image has been saved.\n @savePath = \"\" #Stores the image save path\n\n #The horitzontal frame that stores the verticle frame. \n @parentFrame = FXHorizontalFrame.new(p, opts, x, y, width, height, \n padLeft, padRight, padTop, padBottom)\n \n #Canvas Frame is the vertical frame that stores the canvas.\n @canvas_frame = FXVerticalFrame.new(@parentFrame,FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT, \n 0, 0, 0, 0, 0, 0, 0, 0) \n \n #exportImage stores the image data that is saved.\n @exportImage = FXPNGImage.new(app, nil, @canvasWidth, @canvasHeight)\n \n @exportImage.create #initializes the image object.\n @exportImage.resize(@canvasWidth, @canvasHeight) #Sizes the image to match canvas width and height\n \n #Stores the image that is in the active layer.\n createImage() #Calls the createImage method. \n @activeImage = @imageArray[@activeIndex] #Sets the active image to the image stored in the first index of the imageArray\n \n \n #canvas stores the canvas object that is draw on.\n @canvas = FXCanvas.new(@canvas_frame, nil, 0, LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_TOP|LAYOUT_LEFT, 0, 0, width, height) \n \n #On creation, connect to the SEL_Paint handler. Every time the canvas changes, the canvas is repainted.\n @canvas.connect(SEL_PAINT, method(:onCanvasRepaint))\n \n @canvas.resize(@canvasWidth, @canvasHeight) #Sets the canvas to the default width and height.\n \n #Event handler that checks for left mouse button depression. \n @canvas.connect(SEL_LEFTBUTTONPRESS) do |sender, sel, event|\n \n @canvas.grab #grabs the canvas. Windows stores mouse data when mouse is inside canvas.\n @mouseDown = true #The mouse is depressed. Set mouseDown to true.\n \n #Get device context for the canvas\n dc = FXDCWindow.new(@activeImage)\n\n # Set the foreground color for drawing\n dc.foreground = @drawColor\n #dc.fillRectangle(event.win_x, event.win_y, 2, 2)\n \n #Defines draw alogrithms for a single click or \"Point edit\" on the canvas. \n if @mouseDown #make sure mouse is down.\n if @brushSize == 1 || @brushSize == 2 || @brushSize == 3 #If any of the square draw brushes \n dc.drawLine(event.last_x, event.last_y, event.win_x, event.win_y) #draw a line from the x,y coordinate of mouse depression to latest x,y coordinate.\n end\n if @brushSize == 2 #If brush two...\n \n i=0\n while i < 10 #Draw a series of lines within a 10X10 pixel square onto canvas.\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n \n if @brushSize == 3 || @brushSize == 5 #Draw a series of lines within a 30X30 pixel square onto canvas.\n i=0\n while i < 30\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n if @brushSize == 4 #Paint bucket fills the entire canvas with current draw color.\n dc.foreground = @drawColor\n dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w + @canvas.width, event.rect.h + @canvas.height)\n end\n if @brushSize == 6 #Draws a white line of size 10X10 over any draw data.(Eraser handler)\n i=0\n while i < 10\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n i += 1\n end\n end\n\n \n @dirtyArray[@activeIndex] = true # Since there is draw data in the active image, set the image's dirty value to true.\n @canvas.update #Redraw the canvas to display the image data changes onto the canvas.\n # Release the DC immediately\n dc.end\n end\n end\n \n @canvas.connect(SEL_MOTION) do |sender, sel, event| #On mouse motion.\n if @mouseDown\n # Get device context for the canvas\n dc = FXDCWindow.new(@activeImage)\n\n # Set the foreground color for drawing\n dc.foreground = @drawColor\n \n \n #While there is mouse motion, continue to repeat the same draw algorithms as for single points\n if @brushSize == 1 || @brushSize == 2 || @brushSize == 3\n dc.drawLine(event.last_x, event.last_y, event.win_x, event.win_y)\n end\n if @brushSize == 2\n \n i=0\n while i < 10\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n if @brushSize == 3 || @brushSize == 5\n i=0\n while i < 30\n dc.drawLine(event.last_x+i, event.last_y, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x, event.win_y)\n dc.drawLine(event.last_x, event.last_y, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y, event.win_x, event.win_y+i)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y)\n dc.drawLine(event.last_x, event.last_y+i, event.win_x+i, event.win_y+i)\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y)\n i += 1\n end\n end\n if @brushSize == 4\n dc.foreground = @drawColor\n dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w + @canvas.width, event.rect.h + @canvas.height)\n end\n if @brushSize == 6\n i=0\n while i < 10\n dc.drawLine(event.last_x+i, event.last_y+i, event.win_x+i, event.win_y+i)\n i += 1\n end\n end\n\n # We have drawn something, so now the canvas is dirty\n @dirtyArray[@activeIndex] = true\n @canvas.update\n # Release the DC immediately\n dc.end\n end\n end\n \n @canvas.connect(SEL_LEFTBUTTONRELEASE) do |sender, sel, event| #On left mouse release\n @canvas.ungrab #Remove canvas device draw context\n @mouseDown = false #Set mouse down to false\n @canvas.update #Redraw the canvas to reflect changes in image data\n end\n end", "def initialize(window, equipItem, rect, equipKindLabel, \n active=true, visible=true)\n super(active, visible)\n @equipItem = equipItem\n \n @cEquipKind = CLabel.new(window, rect, equipKindLabel)\n @cEquipKind.active = active\n @cEquipKind.visible = visible\n \n if equipItem != nil\n icon_index = equipItem.icon_index\n name = equipItem.name\n else\n icon_index = nil\n name = nil\n end\n \n # Changes y to draw items under the equipkind label\n temp = Rect.new(rect.x,rect.y+rect.height,rect.width,rect.height)\n \n # Determine rectangles to position controls\n rects = determine_rects(temp)\n\n @ucIcon = UCIcon.new(window, rects[0], icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n \n @cEquipName = CLabel.new(window, rects[1], name)\n @cEquipName.active = active\n @cEquipName.visible = visible\n @cEquipName.cut_overflow = true\n end", "def initialize(window)\n @window = window # Reference to the application window\n\n @column_style = Gtk::CssProvider.new\n @column_style.load(data: 'button {background-image: image(grey); opacity: 0;} button:hover {opacity: 0.5;}')\n\n @empty_cell_style = Gtk::CssProvider.new\n @empty_cell_style.load(data: 'button {background-image: image(white);}')\n\n @mask_style = Gtk::CssProvider.new\n @mask_style.load(data: 'button {background-image: image(grey); opacity: 0.5;}')\n\n @player_1_token_style = Gtk::CssProvider.new\n @player_1_token_style.load(data: \"button {background-image: image(#FF0000);}\")\n\n @player_2_token_style = Gtk::CssProvider.new\n @player_2_token_style.load(data: \"button {background-image: image(#FFFF00);}\")\n\n @t_style = Gtk::CssProvider.new\n @t_style.load(data: 'button {background-image: url(\"./src/game_board/t.png\");}')\n\n @t_selected_style = Gtk::CssProvider.new\n @t_selected_style.load(data: 'button {background-image: url(\"./src/game_board/t_selected.png\");}')\n\n @o_style = Gtk::CssProvider.new\n @o_style.load(data: 'button {background-image: url(\"./src/game_board/o.png\");}')\n\n @o_selected_style = Gtk::CssProvider.new\n @o_selected_style.load(data: 'button {background-image: url(\"./src/game_board/o_selected.png\");}')\n end", "def initialize(br)\n @br = br # get battle result\n @messages_index = 0 # shows the actual mesage of the window\n @messages = [] # array of mesages: exp, gold,e tc\n super(0, 0, 640, (Wep::Lines_to_show * 32) + 32)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.y = 0\n self.back_opacity = 160\n self.visible = false\n generate_messages\n refresh\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n @char_info_window = Window_Char_Info.new(0, 0, 200, 128, @actor)\n \n @status_window = Window_Status.new(200, 40, 440, 440, @actor)\n \n @status_equip_window = Window_Status_Equip.new(415, 40, 225, 272, @actor)\n @status_equip_window.active = false\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(@status_equip_window.x,\n @status_equip_window.y, \n @status_equip_window.width-32, \n @status_equip_window.height-32)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 480, positions)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.index = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @help_window.visible = false\n \n @status_equip_window.help_window = @help_window\n end", "def start\n super\n if VICTORY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(VICTORY_CONFIG::IMAGE_BG)\n @bg.opacity = VICTORY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 0, 640, 56, Vocab::victory_help_text)\n @help_window.cText.align = 1\n @help_window.cText.font.bold = true\n # Refresh for the text alignment\n @help_window.refresh()\n\n if VICTORY_CONFIG::DIVIDE_EXP\n exp_by_actor = (@exp / $game_party.members.size).to_i\n else\n exp_by_actor = @exp\n end\n \n @actor_remaining_exp = []\n @victory_char_info_windows = []\n @victory_new_skill_windows = []\n @victory_level_up_windows = []\n for i in 0 .. $game_party.members.size-1 \n actor_exp = ActorExp.new(exp_by_actor, determine_tick($game_party.members[i].next_exp, exp_by_actor))\n @actor_remaining_exp.push(actor_exp)\n \n if i%2 == 0 \n x = -320\n else\n x = 640\n end\n victory_char_info_window = Window_Victory_Char_Info.new(x, (i/2).to_i*128+168, 320, 128, $game_party.members[i])\n victory_char_info_window.active = false\n @victory_char_info_windows.push(victory_char_info_window)\n\n victory_new_skill_window = Window_Victory_New_Skill.new((i%2)*320, (i/2).to_i*128+168+128-56, 320, 56, nil)\n victory_new_skill_window.active = false\n victory_new_skill_window.visible = false\n @victory_new_skill_windows.push(victory_new_skill_window)\n\n victory_level_up_window = Window_Victory_Level_Up.new((i%2)*320+200, (i/2).to_i*128+168, 120, 56)\n victory_level_up_window.active = false\n victory_level_up_window.visible = false\n victory_level_up_window.opacity = 0\n @victory_level_up_windows.push(victory_level_up_window)\n end\n\n @victory_item_window = Window_Victory_Item.new(160, 488, 320, 256, @drop_items)\n @victory_item_window.active = false\n @victory_item_window.visible = false\n\n @exp_window = Window_Victory_Exp.new(20, 83, 300, 56, @exp)\n @gold_window = Window_Victory_Gold.new(320, 83, 300, 56, @gold)\n\n [@help_window, @victory_item_window, @exp_window, @gold_window]+\n @victory_char_info_windows+@victory_new_skill_windows.each{\n |w| w.opacity = VICTORY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = VICTORY_CONFIG::WINDOW_BACK_OPACITY\n }\n \n end", "def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end", "def initialize(window, enemy, rect, spacing=24,\n active=true, visible=true)\n super(active, visible)\n @enemy = enemy\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucEncounters = UCLabelIconValue.new(window, rects[0][1], \n rects[0][0], rects[0][2],\n Vocab::encounters_label, BESTIARY_CONFIG::ICON_ENCOUNTERS, 0)\n @ucEncounters.cValue.align = 2\n @ucEncounters.active = active\n @ucEncounters.visible = visible\n \n @ucDefeated = UCLabelIconValue.new(window, rects[1][1], \n rects[1][0], rects[1][2],\n Vocab::defeated_label, BESTIARY_CONFIG::ICON_DEFEATED, 0)\n @ucDefeated.cValue.align = 2\n @ucDefeated.active = active\n @ucDefeated.visible = visible\n \n @ucEscaped = UCLabelIconValue.new(window, rects[2][1], \n rects[2][0], rects[2][2],\n Vocab::escaped_label, BESTIARY_CONFIG::ICON_ESCAPED, 0)\n @ucEscaped.cValue.align = 2\n @ucEscaped.active = active\n @ucEscaped.visible = visible\n \n @ucExp = UCLabelIconValue.new(window, rects[3][1], \n rects[3][0], rects[3][2],\n Vocab::exp_label,BESTIARY_CONFIG::ICON_EXP, 0)\n @ucExp.cValue.align = 2\n @ucExp.active = active\n @ucExp.visible = visible\n \n @ucGold = UCLabelIconValue.new(window, rects[4][1], \n rects[4][0], rects[4][2],\n Vocab::gold_label, BESTIARY_CONFIG::ICON_GOLD, 0)\n @ucGold.cValue.align = 2\n @ucGold.active = active\n @ucGold.visible = visible\n \n end", "def window_update(actor)\n if actor != nil\n bodyImg = MENU_CONFIG::BODY_IMAGES[actor.id]\n bitmap = Cache.picture(bodyImg.filename)\n @cBackCharImage.img_bitmap = bitmap\n @cBackCharImage.src_rect = Rect.new(bodyImg.src_rect.x, bodyImg.src_rect.y, \n bitmap.width, bitmap.height)\n end\n refresh()\n end", "def initialize(window, item, rect, itemNumberPattern, spacing=8,\n active=true, visible=true)\n super(active, visible)\n @item = item\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucIcon = UCIcon.new(window, rects[0], item.icon_index)\n @ucIcon.active = active\n @ucIcon.visible = visible\n\n @cItemName = CLabel.new(window, rects[1], item.name)\n @cItemName.active = active\n @cItemName.visible = visible\n @cItemName.cut_overflow = true\n\n @cItemPrice = CLabel.new(window, rects[2], item.price)\n @cItemPrice.active = active\n @cItemPrice.visible = visible\n\n @cItemPossess = CLabel.new(window, rects[3], $game_party.item_number(item))\n @cItemPossess.active = active\n @cItemPossess.visible = visible\n\n @ucItemNumber = UCNumericUpDown.new(window, rects[4], 0, itemNumberPattern)\n @ucItemNumber.active = active\n @ucItemNumber.visible = visible\n end", "def create_all_shared_acts_win\n h,w = Graphics.height, Graphics.width\n @all_shared_acts_win = Window_BasicTextTB.new(0,0,200,55)\n @all_shared_acts_win.viewport = @viewport\n \n @all_shared_acts_win.text = actions_left_txt_era\n @all_shared_acts_win.no_skin\n @all_shared_acts_win.font_size = 14\n @all_shared_acts_win.hide\n end", "def create_graphic\n y = @enchant_list.bottom_corner\n h = Graphics.height - y - @enchant_window.height\n @graphic = GraphicUnifier.new(0, y, Graphics.width, h)\n @graphic.viewport = @viewport2\n @enchant_window.graphic = @graphic\n @enchant_window.scroll = @enchant_list.item\n end", "def initialize title, grid\n\t\t@grid = grid\n\t\tsuper @grid.width * 2, @grid.height * 2, false\n\t\tself.caption = title\n\t\t@counter = 0\n\n\t\t@white = Gosu::Image.new(self, \"white.png\", true)\n\t\t@red = Gosu::Image.new(self, \"red.png\", true)\n\n\t\t@time = Time.now\n\tend", "def initialize_title_image\n @title_image = Gosu::Image.new(@window, Const::PATH_IMAGE_TITLE, false)\n @img_size_factor = (@window.width - Const::GAME_WIN_GAP).to_f / @title_image.width\n @img_x = (@window.width - @title_image.width * @img_size_factor) / 2\n @img_y = 20\n end", "def initialize_title_image\n @title_image = Gosu::Image.new(@window, Const::PATH_IMAGE_TITLE, false)\n @img_size_factor = (@window.width - Const::GAME_WIN_GAP).to_f / @title_image.width\n @img_x = (@window.width - @title_image.width * @img_size_factor) / 2\n @img_y = 20\n end", "def start\n super\n create_menu_background\n if PARTY_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(PARTY_CONFIG::IMAGE_BG)\n @bg.opacity = PARTY_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor_positions_backup = {}\n for i in 0 .. $game_party.members.size-1\n @actor_positions_backup[$game_party.members[i].id] = $game_party.actor_positions[i]\n end\n @party_order_window = Window_Party_Order.new(160, 0, 480, 156, $game_party.members)\n @party_order_window.active = false\n @party_order_window.index = -1\n\n @command_window = Window_Command.new(160, \n [Vocab::formation_change_command, \n Vocab::formation_order_command, \n Vocab::formation_revert_command])\n @command_window.x = 0\n @command_window.y = 0\n @command_window.height = @party_order_window.height\n @command_window.active = true\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n @battle_formation_details_window = Window_BattleFormationDetails.new(0,384,640,96,nil)\n @battle_formation_details_window.visible = false\n\n @battle_formation_index_backup = $game_party.battle_formation_index\n @battle_formations_window = Window_Battle_Formations.new(0, 156, 640, 228, PARTY_CONFIG::BATTLE_FORMATIONS)\n @battle_formations_window.active = false\n @battle_formations_window.index = $game_party.battle_formation_index\n @battle_formations_window.help_window = @help_window\n @battle_formations_window.detail_window = @battle_formation_details_window\n \n [@help_window, @battle_formation_details_window, @party_order_window,\n @command_window, @battle_formations_window].each{\n |w| w.opacity = PARTY_CONFIG::WINDOW_OPACITY;\n w.back_opacity = PARTY_CONFIG::WINDOW_BACK_OPACITY\n }\n end", "def set_img\n\n end", "def initialize(window, rectLabel, rectValue, label, value, active=true, \n visible=true)\n super(active, visible)\n @cLabel = CLabel.new(window, rectLabel, label)\n @cLabel.active = active\n @cLabel.visible = visible\n @cValue = CLabel.new(window, rectValue, value)\n @cValue.active = active\n @cValue.visible = visible \n end", "def create_skill_preview_wtb\n w,h,g = 155, 55, Graphics\n @skill_prev_win = Window_BasicTextTB.new(g.width-w, g.height-h, w,h)\n @skill_prev_win.viewport = @viewport\n @skill_prev_win.font_size = 20\n @skill_prev_win.hide\n end", "def draw()\n if self.image != nil\n bitmap = Cache.picture(self.image)\n @cImage.img_bitmap = bitmap\n @cImage.src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)\n @cImage.draw()\n end\n end", "def draw()\n if [email protected]?\n @cBorders.draw()\n end\n @cImage.draw()\n end", "def initialize(image)\n @image_location = image\n @auto_size = false\n super()\n end", "def execImage(img)\n @window = img[1]\n if !img[2]\n\n if @window.child.children[0].child != nil\n @window.child.children[0].remove(@window.child.children[0].child)\n end\n @window.child.children[0].child = (Gtk::Image.new(:file =>img[0]))\n @window.child.children[0].child.show_all\n\n @window.child.children[0].signal_connect(\"button_press_event\"){\n @window.hide\n Gtk.main_quit\n }\n\n @window.show_all\n Gtk.main\n\n else\n Gtk.main_quit\n end\n end", "def initialize(main_window)\n\t\tsuper()\n\t\t@main_window = main_window\n\t\t@grid_sensitive_spin_button_list = Array.new\n\t\tself.enable_popup = true\n\t\tself.add(w = Box_Widget.new(self), :tab_label => 'Box')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Net_Widget.new(self), :tab_label => 'Net')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Pin_Widget.new(self), :tab_label => 'Pin')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Path_Widget.new(self), :tab_label => 'Path')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Sym_Widget.new(self), :tab_label => 'Sym')\n\t\tself.set_tab_reorderable(w, true)\n\tend", "def initialize(window, x, y, width, height, color=0xffff0000, z_order=0)\n\t\t\t@window = window\n\t\t\t@x = x\n\t\t\t@y = y\n\t\t\t@width = width\n\t\t\t@height = height\n\t\t\t@color = color\n\t\t\t@z_order = z_order\t\n\t\tend", "def initialize(window, text, center, pressed = \"#{IMG_PATH}buttons/pressed.png\", normal = \"#{IMG_PATH}buttons/normal.png\", &block)\n @window, @center, @block = window, center, block\n @block = (proc {}) if @block.nil?\n @text = Rubydraw::Text.new(text, Rubydraw::Color::Black)\n @pressed, @normal = [pressed, normal].collect {|elem| Rubydraw::Image.new(elem)}\n @image = @normal\n @mouse_position = Point[0, 0]\n @text_position = (@center - Point[width, height])\n @being_pressed = false\n # Assume that the button is not being drawn.\n @showing = false\n register_actions(window)\n end", "def draw()\n if visible\n \n case self.align \n when 0 # Left\n x = self.rect.x\n when 1 # Middle\n x = self.rect.x + self.rect.width/2 - self.src_rect.width/2\n when 2 # Right\n x = self.rect.x + self.rect.width - self.src_rect.width\n else\n x = 0\n end\n \n case self.valign \n when 0 # Top\n y = self.rect.y\n when 1 # Middle\n y = self.rect.y + self.rect.height/2 - self.src_rect.height/2\n when 2 # Bottom\n y = self.rect.y + self.rect.height - self.src_rect.height\n else\n y = 0\n end\n\n if !active\n opacity = Font.inactive_alpha()\n else\n opacity = self.opacity\n end\n \n bitmap.blt(x, y, self.img_bitmap, self.src_rect, opacity)\n end\n end", "def initialize\n @msg_win = MessageWindow.new\n @opts_win = OptionsWindow.new\n @board_win = BoardWindow.new\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @skill_back_window = Window_Base.new(200, 56, 440, 328)\n @dataviews_window = Window_Dataviews.new(200, 56, 440, 56, MENU_CONFIG::SKILL_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @status_window = Window_Skill_Status.new(0, 0, 200, 128, @actor)\n \n @skill_window = Window_Skill.new(200, 96, 440, 272, @actor, @dataviews_window.selected_view)\n @skill_window.opacity = 0\n @skill_window.help_window = @help_window\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96,nil)\n @skill_details_window.visible = false\n @skill_window.detail_window = @skill_details_window\n \n @target_window = Window_Party_Status.new(140, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @skill_back_window = Window_Base.new(200, 56, 440, 328)\n @dataviews_window = Window_Dataviews.new(200, 56, 440, 56, MENU_CONFIG::SKILL_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @status_window = Window_Skill_Status.new(0, 0, 200, 128, @actor)\n \n @skill_window = Window_Skill.new(200, 96, 440, 272, @actor, @dataviews_window.selected_view)\n @skill_window.opacity = 0\n @skill_window.help_window = @help_window\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96,nil)\n @skill_details_window.visible = false\n @skill_window.detail_window = @skill_details_window\n \n @target_window = Window_Party_Status.new(140, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def initialize(viewport,commands,scene)\n @commands = commands\n @scene = scene\n @index = 0\n offset = 0\n @path = \"Graphics/EBDX/Pictures/UI/\"\n @viewport = viewport\n @sprites = {}\n @visibility = [false,false,false,false]\n baseColor = Color.white\n shadowColor = Color.new(0,0,0,192)\n # apply styling from PBS\n self.applyMetrics\n # generate sprites\n @sprites[\"sel\"] = SpriteSheet.new(@viewport,4)\n @sprites[\"sel\"].setBitmap(pbSelBitmap(@path+@selImg,Rect.new(0,0,92,38)))\n @sprites[\"sel\"].speed = 4\n @sprites[\"sel\"].ox = @sprites[\"sel\"].src_rect.width/2\n @sprites[\"sel\"].oy = @sprites[\"sel\"].src_rect.height/2\n @sprites[\"sel\"].z = 99999\n @sprites[\"sel\"].visible = false\n # fill sprites with text\n bmp = pbBitmap(@path+@btnImg)\n for i in [email protected]\n k = @commands.length - 1 - i\n @sprites[\"choice#{i}\"] = Sprite.new(@viewport)\n @sprites[\"choice#{i}\"].x = Graphics.width - bmp.width - 14 + bmp.width/2\n @sprites[\"choice#{i}\"].y = Graphics.height - 136 - k*(bmp.height+4) + bmp.height/2\n @sprites[\"choice#{i}\"].z = 99998\n @sprites[\"choice#{i}\"].bitmap = Bitmap.new(bmp.width,bmp.height)\n @sprites[\"choice#{i}\"].center!\n @sprites[\"choice#{i}\"].opacity = 0\n choice = @sprites[\"choice#{i}\"].bitmap\n pbSetSystemFont(choice)\n choice.blt(0,0,bmp,bmp.rect)\n pbDrawOutlineText(choice,0,8,bmp.width,bmp.height,@commands[i],baseColor,shadowColor,1)\n end\n bmp.dispose\n end", "def create_skill_display_wtb\n w,h,g = 360, 53, Graphics\n @skill_disp_win = Window_BasicTextTB.new(g.width/2,0,w,h)\n @skill_disp_win.viewport = @viewport\n @skill_disp_win.no_skin\n @skill_disp_win.font_size = 20\n @skill_disp_win.hide\n end", "def create_info_window\n y = @enemy_list_window.y\n x = @enemy_list_window.width\n @info_window = Window_EnemyInfo.new(x, y, Graphics.width - x, Graphics.height - y)\n @enemy_list_window.set_info_window(@info_window)\n @category_window.z = 9999\n @info_window.viewport = @viewport\n end", "def initialize(viewport)\n super(viewport)\n self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)\n self.ox = 16 + Targer_Arrow_Adjust[0]\n self.oy = 96 + Targer_Arrow_Adjust[1]\n self.z = 2500\n @blink_count = 0\n @index = 0\n @help_window = nil\n update\n end", "def initialize(width, commands, icons = false, unit = nil)\n # Compute window height from command quantity\n super(0, 0, width, commands.size * 32 + 8)\n @icons = icons\n @unit = unit\n @item_max = commands.size\n @commands = commands\n \n self.contents = Bitmap.new(@width, @height)\n refresh\n self.index = 0\n end", "def initialize(x = 0, y = 0, width = Graphics.width, height = Graphics.height,\n wrap_type = :word, draw_scroll_for_one = false, skin = nil)\n #==========================================================================\n # Here we set the windowskin for the book. It can be provided in the\n # constructor of your window when it calls super, or you can rely on this\n # default setting which will, if my Window Swap script is active, cause\n # it to use a file called \"Book Window\" found in the Graphics/Windows\n # folder. If you are not using the aforementioned script, it will use the\n # default windowskin. You may modify this section to change the default\n # setting if you wish, but I would leave in the \"skin ||\" part so that\n # children of this class can still provide their own windows.\n #\n # If you choose to provide a windowskin from a child class, it must be as\n # a Bitmap rather than a file name, so remember to load it up. A child\n # window's call to this method that provides a windowskin would look\n # something like this:\n # super(0, 0, 544, 416, Cache.windows(\"Child Window\"))\n #\n # We also set @wrap to our desired wrap type and initialize @pagetext to\n # an empty hash with an empty array as its default value, though if\n # @pagetext has already been initialized (which it should have in a child\n # class) it will only set the default, not empty the hash.\n #==========================================================================\n @skin = skin || \n ($imported[\"ESSA - Window Swap\"] ? Cache.windows(\"Book Window\") :\n Cache.system(\"Window\"))\n @wrap = wrap_type and @pagetext ||= {} and @pagetext.default = []\n @draw_scroll_for_one = draw_scroll_for_one\n super(x, y, width, height)\n #==========================================================================\n # This sets the Z-value of the window to 255, to make sure\n # that it displays on top of everything else, and defaults @page (a local\n # variable that holds an integer that determines the current page) to 1.\n # It then builds the window's contents and sets it as the active window.\n #==========================================================================\n self.z, @page = 255, 1\n refresh\n activate\n end", "def initialize\r\n\t super(0,Graphics.height-WIN_HEIGHT,Graphics.width,WIN_HEIGHT)\r\n\t @x, @y, @i = 10, 50, 0\r\n\t @party_size = $game_party.all_members.size\r\n contents.font.size = FONT_SIZE\r\n\t self.back_opacity = WIN_OPACITY\r\n self.opacity = FRAME_OPACITY\r\n @actor_hp = []\r\n @actor_mp = []\r\n\t fhiz_hud\r\n\t check_visible\r\n end", "def visible=(state)\n return false if (state ? true : false) == self.visible?\n if state\n iws = [300, 300]\n @dialog = ::UI::WebDialog.new(@title, false, @title, iws.x, iws.y, 800, 600, false)\n # Callbacks\n @dialog.add_action_callback('init') { |dlg, params|\n unless @init_called\n @init_called = true\n ds = eval(params)\n #@border_size = [iws.x - ds.x, iws.y - ds.y]\n if RUBY_PLATFORM =~ /mswin|mingw/i && @handle\n ws = AMS::Window.get_size(@handle)\n cr = AMS::Window.get_client_rect(@handle)\n cs = [cr[2] - cr[0], cr[3] - cr[1]]\n @border_size = [ws.x - cs.x, ws.y - cs.y]\n else\n @border_size = [2, 24]\n end\n end\n @sliders.each { |name, data|\n generate_slider_html(name, false)\n }\n dlg.execute_script(\"update_size();\")\n }\n @dialog.add_action_callback('size_changed') { |dlg, params|\n @size = eval(params)\n update_placement\n }\n @dialog.add_action_callback('mouse_enter') { |dlg, params|\n @mouse_over = true\n }\n @dialog.add_action_callback('mouse_leave') { |dlg, params|\n @mouse_over = false\n AMS::Sketchup.activate if RUBY_PLATFORM =~ /mswin|mingw/i\n }\n @dialog.add_action_callback('update_note') { |dlg, params|\n next if RUBY_PLATFORM !~ /mswin|mingw/i\n cmd = \"\"\n if AMS::Sketchup.is_main_window_active?\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').fadeIn(750);\"\n elsif AMS::Window.is_active?(@handle)\n cmd << \"$('#note1').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note2').fadeIn(750);\"\n else\n cmd << \"$('#note2').css('display', 'none');\"\n cmd << \"$('#note3').css('display', 'none');\"\n cmd << \"$('#note1').fadeIn(750);\"\n end\n dlg.execute_script(cmd)\n }\n # Set content\n dir = File.dirname(__FILE__)\n dir.force_encoding(\"UTF-8\") if RUBY_VERSION !~ /1.8/\n url = File.join(dir, 'html/control_panel.html')\n @dialog.set_file(url)\n # Show dialog\n RUBY_PLATFORM =~ /mswin|mingw/i ? @dialog.show : @dialog.show_modal\n # Assign the on_close callback. Important: This must be called after\n # showing dialog in order to work on Mac OS X.\n @dialog.set_on_close {\n if RUBY_PLATFORM =~ /mswin|mingw/i\n AMS::Sketchup.include_dialog(@handle)\n AMS::Sketchup.remove_observer(self)\n end\n @dialog.execute_script('uninit();')\n @dialog = nil\n @handle = nil\n @mouse_over = false\n @init_called = false\n }\n # Find dialog window handle\n @handle = RUBY_PLATFORM =~ /mswin|mingw/i ? AMS::Sketchup.find_window_by_caption(@title) : nil\n if @handle\n # Add observer\n AMS::Sketchup.add_observer(self)\n # Remove dialog caption and borders\n layered = AMS::System.get_windows_version < 6.0 ? 0 : 0x00080000\n style_ex = 0x00010000 | layered # WS_EX_CONTROLPARENT | WS_EX_LAYERED\n #style = 0x54000000 # WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS\n style = 0x94000000 # WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS\n AMS::Window.lock_update(@handle)\n AMS::Window.set_long(@handle, -20, style_ex)\n AMS::Window.set_long(@handle, -16, style)\n AMS::Window.lock_update(nil)\n AMS::Window.set_pos(@handle, 0, 0, 0, 0, 0, 0x0267)\n AMS::Window.set_layered_attributes(@handle, 0, 200, 2)\n AMS::Sketchup.ignore_dialog(@handle)\n AMS::Sketchup.activate\n end\n else\n @dialog.close\n end\n true\n end", "def initialize(viewport, type, x, y, visible = true)\n super(viewport)\n self.visible = visible\n #self.bitmap = Bitmap.new(32,32)\n @wait = 6\n @pattern = [0,1,2,3]\n @p_index = 0 #pattern index\n @type = type\n @x = x; @y = y # Denotes map's tile x/y\n self.zoom_x = 0\n self.zoom_y = 0\n @anim = false\n self.z = 20000\n\n moveto(@x, @y)\n refresh \n end", "def initialize(width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT)\n super()\n self.set_size_request(width, height)\n self.resizable = false\n self.title = DEFAULT_TITLE\n @transition = [] # Screen transition table\n @interval_time = DEFAULT_INTERVAL # milli seconds\n\n # Nyle main frame\n me = self\n Nyle.module_eval {\n _set_frame(me)\n }\n\n # Mouse events\n self.add_events([:button_press_mask,\n :button_release_mask])\n\n # Signal handler for mouse pressed\n self.signal_connect(:button_press_event) do |widget, event|\n Nyle.module_eval {\n _set_mouse_down(event.button, true)\n }\n false\n end\n\n # Signal handler for mouse released\n self.signal_connect(:button_release_event) do |widget, event|\n Nyle.module_eval {\n _set_mouse_down(event.button, false)\n }\n false\n end\n\n # Signal handler for key pressed\n self.signal_connect(:key_press_event) do |widget, event|\n Nyle.module_eval {\n _set_key_down(event.keyval, true)\n }\n # [debug]\n # puts \"keyname: [#{Gdk::Keyval.to_name(event.keyval)}]\"\n false\n end\n\n # Signal handler for key released\n self.signal_connect(:key_release_event) do |widget, event|\n Nyle.module_eval {\n _set_key_down(event.keyval, false)\n }\n false\n end\n\n self.signal_connect(:destroy) do\n _quit\n end\n end", "def initialize(rect)\n mask = NSBorderlessWindowMask\n backing = NSBackingStoreBuffered\n initWithContentRect(rect, styleMask:mask, backing:backing, defer:true)\n # self.level = NSStatusWindowLevel\n self.backgroundColor = NSColor.clearColor # NSColor.blackColor \n self.hasShadow = true\n self.alphaValue = 0.75\n self.opaque = false\n self.hidesOnDeactivate = true\n # self.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces\n @initial_location = NSPoint.new\n end", "def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n @title_prefix = title_prefix\n @max_contents_len = @win.maxx - 3 # 2 for borders\n end", "def new_box(x, y)\n image = UIImage.imageNamed(\"box1\")\n image_view = UIImageView.alloc.initWithFrame([[x, y], [image.size.height, image.size.width]])\n image_view.image = image\n image_view.setAccessibilityLabel('Box')\n image_view\n end", "def initialize(x, y, width, height, actor)\n super(x, y, width, height)\n \n self.contents.dispose\n self.contents = Bitmap.new((self.width - 32)*2, self.height - 32)\n \n width = ((self.contents.width)/2).floor\n \n @actor = actor\n \n @ucCompareStat = UCCompareCharStatus.new(self, actor, Rect.new(0,0,width,self.contents.height))\n \n @cElementalResistLabel = CLabel.new(self, Rect.new(width,0,185,WLH), Vocab::elem_resist_label)\n\n @ucElementalResistGraph = UCGraph.new(self, width+100, 85, 40, [0], MENU_CONFIG::PERCENTAGE_PATTERN,\n MENU_CONFIG::ELEM_RES_MAX,\n MENU_CONFIG::ELEM_RES_MIN,\n Font.graph_label_font,\n Color.pos_resist_gauge_color1, Color.pos_resist_gauge_color2,\n Color.neg_resist_gauge_color1, Color.neg_resist_gauge_color2, \n nil, 2, Color.resist_border_color1, Color.resist_border_color2)\n \n @cStatesResistLabel = CLabel.new(self, Rect.new(width,160,185,WLH), Vocab::states_resist_label)\n \n @ucStatesResistGraph = UCGraph.new(self, width+100,245, 40, [0], MENU_CONFIG::PERCENTAGE_PATTERN,\n MENU_CONFIG::STATES_RES_MAX,\n MENU_CONFIG::STATES_RES_MIN,\n Font.graph_label_font,\n Color.pos_resist_gauge_color1, Color.pos_resist_gauge_color2,\n nil, nil,\n nil, 2, Color.resist_border_color1, Color.resist_border_color2)\n \n end", "def create_materials_window\n width = Graphics.width / 2\n @materials_window = Window_ForgeMaterials.new(0, 0, width)\n y = Graphics.height - @materials_window.height\n #y = @gold_window.y - @materials_window.height\n @materials_window.y = y\n end", "def InitializeComponent()\n\t\t\tself.@templatesLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@topGbx = System.Windows.Forms.GroupBox.new()\n\t\t\tself.@templateListbox = System.Windows.Forms.ListBox.new()\n\t\t\tself.@engineCombox = System.Windows.Forms.ComboBox.new()\n\t\t\tself.@languageCombox = System.Windows.Forms.ComboBox.new()\n\t\t\tself.@removeBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@newsaveBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@fileNameTextbox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@displayNameTxtbox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@languageLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@engineLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@nameLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@fileNameLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@editBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@openFileDialogBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@noteTextLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@noteLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@openFileDialog = System.Windows.Forms.OpenFileDialog.new()\n\t\t\tself.@getItFromOnlineBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@prefixTxtBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@prefixLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@suffixLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@suffixTxtBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.SuspendLayout()\n\t\t\t# \n\t\t\t# templatesLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(9, 5)\n\t\t\[email protected] = \"templatesLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(60, 16)\n\t\t\[email protected] = 31\n\t\t\[email protected] = \"Templates\"\n\t\t\t# \n\t\t\t# topGbx\n\t\t\t# \n\t\t\[email protected] = ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)))\n\t\t\[email protected] = System.Drawing.Point.new(80, 5)\n\t\t\[email protected] = \"topGbx\"\n\t\t\[email protected] = System.Drawing.Size.new(370, 8)\n\t\t\[email protected] = 30\n\t\t\[email protected] = false\n\t\t\t# \n\t\t\t# templateListbox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(10, 30)\n\t\t\[email protected] = \"templateListbox\"\n\t\t\[email protected] = System.Drawing.Size.new(160, 303)\n\t\t\[email protected] = 1\n\t\t\[email protected] { |sender, e| self.@templateListbox_SelectedIndexChanged(sender, e) }\n\t\t\t# \n\t\t\t# engineCombox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(262, 60)\n\t\t\[email protected] = \"engineCombox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 21)\n\t\t\[email protected] = 5\n\t\t\t# \n\t\t\t# languageCombox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(262, 30)\n\t\t\[email protected] = \"languageCombox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 21)\n\t\t\[email protected] = 3\n\t\t\t# \n\t\t\t# removeBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(291, 210)\n\t\t\[email protected] = \"removeBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(64, 23)\n\t\t\[email protected] = 16\n\t\t\[email protected] = \"Remove\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@removeBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# newsaveBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(361, 210)\n\t\t\[email protected] = \"newsaveBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(93, 23)\n\t\t\[email protected] = 17\n\t\t\[email protected] = \"New/Save\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@newsaveBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# fileNameTextbox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 120)\n\t\t\[email protected] = \"fileNameTextbox\"\n\t\t\[email protected] = System.Drawing.Size.new(164, 20)\n\t\t\[email protected] = 9\n\t\t\t# \n\t\t\t# displayNameTxtbox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 90)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"displayNameTxtbox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 7\n\t\t\t# \n\t\t\t# languageLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 30)\n\t\t\[email protected] = \"languageLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 2\n\t\t\[email protected] = \"Language:\"\n\t\t\t# \n\t\t\t# engineLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 60)\n\t\t\[email protected] = \"engineLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 4\n\t\t\[email protected] = \"Engine:\"\n\t\t\t# \n\t\t\t# nameLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 90)\n\t\t\[email protected] = \"nameLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 6\n\t\t\[email protected] = \"DisplayName:\"\n\t\t\t# \n\t\t\t# fileNameLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 120)\n\t\t\[email protected] = \"fileNameLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 8\n\t\t\[email protected] = \"File:\"\n\t\t\t# \n\t\t\t# editBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(228, 210)\n\t\t\[email protected] = \"editBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(57, 23)\n\t\t\[email protected] = 15\n\t\t\[email protected] = \"Edit\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@editBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# openFileDialogBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(430, 118)\n\t\t\[email protected] = \"openFileDialogBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(24, 23)\n\t\t\[email protected] = 10\n\t\t\[email protected] = \"...\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@openFileDialogBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# noteTextLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(246, 276)\n\t\t\[email protected] = \"noteTextLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(210, 60)\n\t\t\[email protected] = 20\n\t\t\t# \n\t\t\t# noteLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Font.new(\"Microsoft Sans Serif\", 7.8f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((0)))\n\t\t\[email protected] = System.Drawing.Point.new(190, 275)\n\t\t\[email protected] = \"noteLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(50, 18)\n\t\t\[email protected] = 19\n\t\t\[email protected] = \"Note:\"\n\t\t\t# \n\t\t\t# openFileDialog\n\t\t\t# \n\t\t\[email protected] = \"Template Text File (*.txt)|*.txt\"\n\t\t\[email protected] = \"Select Template Text File\"\n\t\t\t# \n\t\t\t# getItFromOnlineBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(228, 244)\n\t\t\[email protected] = \"getItFromOnlineBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(226, 23)\n\t\t\[email protected] = 18\n\t\t\[email protected] = \"Get it from online\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@getItFromOnlineBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# prefixTxtBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 150)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"prefixTxtBox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 12\n\t\t\t# \n\t\t\t# prefixLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 150)\n\t\t\[email protected] = \"prefixLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 11\n\t\t\[email protected] = \"Prefix:\"\n\t\t\t# \n\t\t\t# suffixLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 180)\n\t\t\[email protected] = \"suffixLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 13\n\t\t\[email protected] = \"Suffix:\"\n\t\t\t# \n\t\t\t# suffixTxtBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 180)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"suffixTxtBox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 14\n\t\t\t# \n\t\t\t# TemplateOptionsPage\n\t\t\t# \n\t\t\tself.@AutoScaleDimensions = System.Drawing.SizeF.new(6f, 13f)\n\t\t\tself.@AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\n\t\t\[email protected](self.@suffixLbl)\n\t\t\[email protected](self.@suffixTxtBox)\n\t\t\[email protected](self.@prefixLbl)\n\t\t\[email protected](self.@prefixTxtBox)\n\t\t\[email protected](self.@getItFromOnlineBtn)\n\t\t\[email protected](self.@noteTextLbl)\n\t\t\[email protected](self.@noteLbl)\n\t\t\[email protected](self.@openFileDialogBtn)\n\t\t\[email protected](self.@editBtn)\n\t\t\[email protected](self.@fileNameLbl)\n\t\t\[email protected](self.@nameLbl)\n\t\t\[email protected](self.@engineLbl)\n\t\t\[email protected](self.@languageLbl)\n\t\t\[email protected](self.@displayNameTxtbox)\n\t\t\[email protected](self.@fileNameTextbox)\n\t\t\[email protected](self.@newsaveBtn)\n\t\t\[email protected](self.@removeBtn)\n\t\t\[email protected](self.@languageCombox)\n\t\t\[email protected](self.@engineCombox)\n\t\t\[email protected](self.@templateListbox)\n\t\t\[email protected](self.@templatesLbl)\n\t\t\[email protected](self.@topGbx)\n\t\t\tself.@Name = \"TemplateOptionsPage\"\n\t\t\tself.ResumeLayout(false)\n\t\t\tself.PerformLayout()\n\t\tend", "def initialize(height, width)\n @visible = true\n # do we set height and width ?? XXX\n @window = Ncurses.newpad(height, width)\n @padheight = height\n @padwidth = width\n @height = height\n @width = width\n @sheight = height\n @swidth = width\n init_vars\n end", "def initialize(parent, skin = {})\n super(parent, :opts => LAYOUT_FILL)\n @mouse_down = false\n @cmds = []\n @cmd_time = nil\n @colors = { 'R' => 0xff0000ff,\n 'B' => 0xfff0000f,\n 'G' => 0xff00aa00,\n 'D' => 0xff000000 }\n @color = 'D'\n\n # We may want a 2-pixel border on the inside-top of this pane, otherwise\n # no borders.\n self.padLeft = self.padBottom = self.padRight = self.padTop = 0\n\n # Draw the top-level board\n frames = FXPacker.new(self, :opts => LAYOUT_FILL)\n\n # Buttons go on the right\n button_list = FXPacker.new(frames, :opts => LAYOUT_FILL_Y |\n LAYOUT_SIDE_RIGHT | LAYOUT_FIX_WIDTH, :width => BUTTON_WIDTH)\n button_clear = FXButton.new(button_list, \"Clear\", :opts => FRAME_RAISED |\n FRAME_THICK | LAYOUT_FILL_X | LAYOUT_SIDE_TOP)\n button_clear.connect(SEL_COMMAND) { clear_board }\n\n # Now draw the color buttons\n @colors.each do |c,v|\n button = FXButton.new(button_list, \" \", :opts => FRAME_RAISED |\n FRAME_THICK | LAYOUT_FILL_X | LAYOUT_SIDE_TOP)\n button.connect(SEL_COMMAND) { @color = c }\n button.backColor = v\n end\n\n # Exit button at the bottom all by itself\n button_bye = FXButton.new(button_list, \"Close\", :opts => FRAME_RAISED |\n FRAME_THICK | LAYOUT_FILL_X | LAYOUT_SIDE_BOTTOM)\n button_bye.connect(SEL_COMMAND) { @on_line_block.call('/leave') }\n\n # Drawing area goes on the left\n cframe = FXHorizontalFrame.new(frames, :opts => LAYOUT_FILL | FRAME_SUNKEN |\n FRAME_THICK | LAYOUT_SIDE_LEFT, :padLeft => 0, :padRight => 0,\n :padTop => 0, :padBottom => 0, :hSpacing => 0, :vSpacing => 0)\n @canvas = FXCanvas.new(cframe, :opts => LAYOUT_FILL)\n @canvas.connect(SEL_PAINT, method(:board_draw))\n @canvas.connect(SEL_LEFTBUTTONPRESS, method(:left_button_down))\n @canvas.connect(SEL_LEFTBUTTONRELEASE, method(:left_button_up))\n @canvas.connect(SEL_MOTION, method(:mouse_motion))\n\n # Backup of the canvas on which we're drawing\n @image = FXImage.new(app, :width => 1920, :height => 1080)\n @image.create\n FXDCWindow.new(@image) do |dc|\n dc.foreground = BACK_COLOR\n dc.fillRectangle(0, 0, 1920, 1080)\n end\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, YE::SYSTEM::WINDOW_HELP)\n @system_window = Window_System.new(0, 0, 640, 384)\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cWindowSkinsLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGMVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucSFXVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGSVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cBattleAnimLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cAutoDashLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInstantTextLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cDifficultyLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInGameTutoLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cReturnTitleLabel.rect.y, \n @system_window.width-32, 24)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 384, positions, true)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.z = 1000\n if @menu_index != nil\n @command_window.index = @menu_index\n update_help()\n else\n @command_window.index = 0\n end\n\n @last_index = -1\n end", "def initialize(window, rect, statLabel, iconIndex, format=nil, spacing=8,\n active=true, visible=true)\n super(active, visible) \n @format = format\n \n # Determine rectangles to position controls\n rects = determine_rects(rect, spacing)\n \n @ucStat = UCLabelIconValue.new(window, rects[0][1], rects[0][0], rects[0][2],\n statLabel, iconIndex, 0)\n @ucStat.cValue.align = 2\n @ucStat.visible = visible\n @ucStat.active = active\n\n @ucCompareStat = UCLabelValue.new(window, rects[1][0], rects[1][1],\n MENU_CONFIG::EQUIP_STATUS_SEPARATOR, 0)\n @ucCompareStat.cLabel.font = Font.party_stat_font\n @ucCompareStat.cLabel.align = 1\n @ucCompareStat.cValue.align = 2\n @ucCompareStat.visible = visible\n @ucCompareStat.active = active\n end", "def initialize(window, rect, volumeLabel, bar_color1, bar_color2, bar_back_color,\n bar_border, bar_border_color,\n active=true, visible=true)\n super(active, visible)\n \n # Determine rectangles to position controls\n rects = determine_rects(rect)\n \n @cVolumeLabel = CLabel.new(window, rects[0], volumeLabel, 0, Font.bold_font)\n @cVolumeLabel.active = active\n @cVolumeLabel.visible = visible\n \n @ucVolumeBar = UCBar.new(window, rects[1], bar_color1, bar_color2,\n bar_back_color, 0, 100, bar_border, bar_border_color)\n @ucVolumeBar.active = active\n @ucVolumeBar.visible = visible\n \n @cMuteLabel = CLabel.new(window, rects[2], Vocab::system_mute_volume_label, 1)\n @cMuteLabel.active = active\n @cMuteLabel.visible = visible\n \n @cVolumeValue = CLabel.new(window, rects[3], 0, 1)\n @cVolumeValue.active = active\n @cVolumeValue.visible = visible\n end", "def initialize(window, rect, volumeLabel, bar_color1, bar_color2, bar_back_color,\n bar_border, bar_border_color,\n active=true, visible=true)\n super(active, visible)\n \n # Determine rectangles to position controls\n rects = determine_rects(rect)\n \n @cVolumeLabel = CLabel.new(window, rects[0], volumeLabel, 0, Font.bold_font)\n @cVolumeLabel.active = active\n @cVolumeLabel.visible = visible\n \n @ucVolumeBar = UCBar.new(window, rects[1], bar_color1, bar_color2,\n bar_back_color, 0, 100, bar_border, bar_border_color)\n @ucVolumeBar.active = active\n @ucVolumeBar.visible = visible\n \n @cMuteLabel = CLabel.new(window, rects[2], Vocab::system_mute_volume_label, 1)\n @cMuteLabel.active = active\n @cMuteLabel.visible = visible\n \n @cVolumeValue = CLabel.new(window, rects[3], 0, 1)\n @cVolumeValue.active = active\n @cVolumeValue.visible = visible\n end", "def initialize(x, y, width, height, slot_id)\n super(x, y, width, height)\n \n @cEmptyLabel = CLabel.new(self, Rect.new(0,0, contents.width, contents.height - WLH), Wora_NSS::EMPTY_SLOT_TEXT, 1)\n\n @ucTime = UCLabelIcon.new(self, Rect.new(368,0,80,WLH), Rect.new(342,0,24,24), \"\", 188)\n @ucTime.cLabel.align = 2\n @ucTime.visible = Wora_NSS::DRAW_PLAYTIME\n \n @ucGold = UCLabelIcon.new(self, Rect.new(230,0,80,WLH), Rect.new(206,0,24,24), \"\", 147)\n @ucGold.cLabel.align = 2\n @ucGold.visible = Wora_NSS::DRAW_GOLD\n \n @ucScreenshot = UCImageBorder.new(self, Rect.new(0, 30, contents.width, 176), nil, nil, \n 0, 255, 0, 2, Color.image_border_color)\n @ucScreenshot.visible = Wora_NSS::SCREENSHOT_IMAGE\n \n @ucLocation = UCLabelValue.new(self, Rect.new(0,0,80,WLH), \n Rect.new(0,@ucScreenshot.cImage.rect.height-18,\n @ucScreenshot.cImage.rect.width-2,(WLH*2)),\n Vocab::save_location_label, \"\")\n @ucLocation.visible = Wora_NSS::DRAW_LOCATION\n @ucLocation.cLabel.font = Font.bold_font\n @ucLocation.cValue.align = 2\n @ucLocation.cValue.font = Font.save_location_font\n @ucLocation.cValue.cut_overflow = true\n \n @ucCharFacesList = []\n \n window_update(slot_id)\n end", "def initialize(x, y, width, height, slot_id)\n super(x, y, width, height)\n \n @cEmptyLabel = CLabel.new(self, Rect.new(0,0, contents.width, contents.height - WLH), Wora_NSS::EMPTY_SLOT_TEXT, 1)\n\n @ucTime = UCLabelIcon.new(self, Rect.new(368,0,80,WLH), Rect.new(342,0,24,24), \"\", 188)\n @ucTime.cLabel.align = 2\n @ucTime.visible = Wora_NSS::DRAW_PLAYTIME\n \n @ucGold = UCLabelIcon.new(self, Rect.new(230,0,80,WLH), Rect.new(206,0,24,24), \"\", 147)\n @ucGold.cLabel.align = 2\n @ucGold.visible = Wora_NSS::DRAW_GOLD\n \n @ucScreenshot = UCImageBorder.new(self, Rect.new(0, 30, contents.width, 176), nil, nil, \n 0, 255, 0, 2, Color.image_border_color)\n @ucScreenshot.visible = Wora_NSS::SCREENSHOT_IMAGE\n \n @ucLocation = UCLabelValue.new(self, Rect.new(0,0,80,WLH), \n Rect.new(0,@ucScreenshot.cImage.rect.height-18,\n @ucScreenshot.cImage.rect.width-2,(WLH*2)),\n Vocab::save_location_label, \"\")\n @ucLocation.visible = Wora_NSS::DRAW_LOCATION\n @ucLocation.cLabel.font = Font.bold_font\n @ucLocation.cValue.align = 2\n @ucLocation.cValue.font = Font.save_location_font\n @ucLocation.cValue.cut_overflow = true\n \n @ucCharFacesList = []\n \n window_update(slot_id)\n end", "def initialize(parent_wnd)\r\n super(parent_wnd)\r\n \r\n @core_game = nil\r\n @splash_name = File.join(@resource_path, \"icons/mariazza_title_trasp.png\")\r\n @algorithm_name = \"AlgCpuMariazza\" \r\n #core game name (created on base class)\r\n @core_name_class = 'CoreGameMariazza'\r\n \r\n # game commands\r\n @game_cmd_bt_list = []\r\n\r\n ## NOTE: don't forget to initialize variables also in ntfy_base_gui_start_new_game\r\n end" ]
[ "0.7140153", "0.6880777", "0.6833494", "0.6740844", "0.66967905", "0.6687944", "0.6615173", "0.6612384", "0.64079523", "0.6341161", "0.6303596", "0.615773", "0.61414814", "0.61060673", "0.60875916", "0.60066813", "0.59810704", "0.5975251", "0.59717256", "0.5956071", "0.5897997", "0.5881515", "0.5859328", "0.58173215", "0.58081084", "0.57835746", "0.57642144", "0.5764048", "0.5760232", "0.5754083", "0.57497066", "0.5744295", "0.57383335", "0.5733691", "0.5733691", "0.5731104", "0.57300675", "0.5703558", "0.5702391", "0.5699026", "0.5675766", "0.56712425", "0.56633234", "0.5659546", "0.5645844", "0.56359476", "0.5635354", "0.5633716", "0.56269306", "0.5626165", "0.56179565", "0.5611739", "0.5610641", "0.5607638", "0.5606138", "0.56039566", "0.5592817", "0.5578962", "0.5570314", "0.5570314", "0.5561489", "0.5552169", "0.5551791", "0.5545173", "0.55260223", "0.5523444", "0.55180866", "0.5495811", "0.5495516", "0.5492207", "0.5488793", "0.54822147", "0.5478803", "0.54741305", "0.54741305", "0.54518515", "0.54467463", "0.54407567", "0.5433929", "0.5427576", "0.5425897", "0.5410891", "0.54021615", "0.5390296", "0.5382487", "0.53812295", "0.5376816", "0.53761", "0.5375098", "0.53730416", "0.5369234", "0.53680754", "0.53672636", "0.53671396", "0.53661966", "0.5364569", "0.5364569", "0.534097", "0.534097", "0.53407884" ]
0.74796516
0
////////////////////////////////////////////////////////////////////////// Public Methods ////////////////////////////////////////////////////////////////////////// Draw the background image on the window
def draw() if self.image != nil bitmap = Cache.picture(self.image) @cImage.img_bitmap = bitmap @cImage.src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) @cImage.draw() end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_background\n @background.draw\n end", "def draw_background\n\t\tcolor = self.colour_scheme.background\t\n\t\[email protected]_image(@canvas_width, @canvas_height) { self.background_color = color }\n\tend", "def draw_background\n Gosu.draw_rect(0, 0, 1000, 700, @background, ZOrder::BACKGROUND, mode=:default)\n\tend", "def draw_background\n\t\tGosu::draw_rect(@x,\n\t\t\t\t\t\t@y, \n\t\t\t\t\t\t@bg_width,\n\t\t\t\t\t\t@bg_height, \n\t\t\t\t\t\t@background_colour,\n\t\t\t\t\t\t@z)\n\tend", "def draw_background\r\n Gosu.draw_rect 0, 0, self.width, self.height, Gosu::Color::BLACK\r\n end", "def draw_background(windowskin)\r\n self.contents.clear\r\n bitmap = RPGCache.windowskin(windowskin)\r\n self.contents.blt(0, 0, bitmap, bitmap.rect)\r\n end", "def draw_background\n options = translate( x: offsets.left, y: offsets.top ).merge( width: width, height: height, foreground: foreground, background: background )\n \n pencil.draw_rectangle( options )\n end", "def create_background\n @background = Window.new(@viewport, @x, @y, @width, @height, skin: @skin)\n end", "def draw_background\n draw_quad( 0, 0, TOP_COLOR,\n @width, 0, TOP_COLOR,\n 0, @height, BOTTOM_COLOR,\n @width, @height, BOTTOM_COLOR,\n -1 )\n end", "def draw_background(img)\n\t\tx = y = 0\n\t\tbegin\n\t\t\timg.draw(x, y, BACKGROUND_Z)\n\n\t\t\tx += img.width\n\t\t\tif x > @width\n\t\t\t\tx = 0\n\t\t\t\ty += img.height\n\t\t\tend\n\t\tend until y > @height\n\tend", "def draw\n @background_image.draw(0, 0, ZOrder::BACKGROUND)\n @boxes.each { |box| box.draw }\n end", "def draw_background\n Gosu.draw_rect(0, 0, 600, 800, @background, ZOrder::BACKGROUND, mode=:default)\n Gosu.draw_rect(40, 40, 510, 710, @player, ZOrder::PLAYER, mode=:default)\n #Gosu.draw_rect(40, 370, 200, 700, @u_background, ZOrder::U_BACKGROUND, mode=:default)\n display_track(@album.tracks[@present_track].name.chomp+ \" from album \" + @album.title)\n draw_albums()\n draw_buttons()\n\tend", "def draw\n\t\t# Complete the missing code\n\t\tdraw_background()\n\tend", "def draw\n @img_background = Game::images[\"background\"]\n @img_background.draw(0, 0, ZOrder::BACKGROUND, (ScreenWidth * 1.0) /@img_background.width, (ScreenHeight * 1.0) /@img_background.height)\n @@game_state.draw\n\n if Game.fading?\n delta = (Gosu::milliseconds - @@start_fade).to_f / (@@end_fade - @@start_fade)\n alpha = @@fading_off ? delta : 1 - delta\n @img_background.draw(0, 0, ZOrder::BACKGROUND, (ScreenWidth * 1.0) /@img_background.width, (ScreenHeight * 1.0) /@img_background.height, Gosu::Color.new((alpha * 0xff).to_i, 0xff, 0xff, 0xff))\n end\n end", "def draw_background(options={})\n settings = {z: -1, fixed: true}.merge(options)\n show_shape(:background, settings)\n end", "def create_background_bitmap\n @background.bitmap = Bitmap.new(@width, @height)\n @background.bitmap.fill_rect(0, 0, @width, @height, BORDER_COLOR)\n @background.bitmap.fill_rect(1, 1, @width - 2, @height - 2, BACK_COLOR)\n end", "def background_bitmap\n bitmap = Bitmap.new(@width, @spr_h)\n bitmap.fill_rect(0, 0, bitmap.width, bitmap.height, Color::BLACK)\n bitmap\n end", "def draw\n\t\tdraw_background\n\t\[email protected](@x+1, \n\t\t\t\t @y+1, \n\t\t\t\t @z, \n\t\t\t\t 1, # Default scale_x \n\t\t\t\t 1, # Default scale_y \n\t\t\t\t @text_colour)\n\tend", "def create_background\n @background_sprite = Sprite.new(@viewport)\n @background_sprite.set_bitmap('save_background', :interface)\n end", "def on_background_init()\n background_path = LVGL::Hacks.get_asset_path(\"app-background.svg\")\n if File.exist?(background_path)\n @background = LVGL::LVImage.new(@screen).tap do |el|\n el.set_protect(LVGL::PROTECT::POS)\n el.set_height(LVGUI.pixel_scale(1280))\n el.set_width(LVGUI.pixel_scale(720))\n el.set_src(\"#{background_path}?height=#{LVGUI.pixel_scale(1280)}\")\n el.set_x((@screen.get_width() - el.get_width()) / 2) # center\n el.set_y(@screen.get_height() - el.get_height()) # Stick to the bottom\n end\n end\n end", "def draw_bitmap_bg\n self.bitmap.gradient_fill_rect(padding, padding, base_width,\n base_height, color1, color2)\n self.bitmap.blur\n self.bitmap.blur\n end", "def draw_bitmap_bg\n self.bitmap.gradient_fill_rect(padding, padding, base_width,\n base_height, color1, color2)\n self.bitmap.blur\n self.bitmap.blur\n end", "def draw\n @img_background.draw(0, 0, 0)\n\n color = 0xfff4cc00\n @logo_font.draw_rel(\"Level #{@level}\", Game::ScreenWidth / 2, 120, ZOrder::Hud, 0.5, 0.5, 2, 2, color)\n\n end", "def create_background\n add_disposable @background = UI::BlurScreenshot.new(@__last_scene)\n @background.opacity -= 255 / ENTERING_ANIMATION_DURATION * ENTERING_ANIMATION_DURATION\n end", "def background(image)\n\t\tself.add(Background.new(image), self)\n\tend", "def draw_background\n draw_line(690 ,0, Gosu::Color::RED, 690, 600, Gosu::Color::RED, ZOrder::PLAYER, mode=:default)#Person's torso\n Gosu.draw_rect(0, 0, 1000, 600, @background1 , ZOrder::BACKGROUND, mode = :default)\n end", "def create_background_sprite\n @background = Sprite.new\n @background.bitmap = background_bitmap\n @background.opacity = 128\n @background.y = @spr_y\n @background.x = @x\n end", "def update_background\n @background.x, @background.y, @background.z = 0,0,self.z - 1 #self.x, self.y, self.z - 1\n end", "def paint_background(options = HashWithIndifferentAccess.new)\n options.reverse_merge! theme[:background] if theme[:background]\n if options\n if image = options[:image]\n image = Textures::Texture.new(engine.find_file(image)).send(:image)#engine.image(options[:image]).image_list\n if options[:mode] == :tile or options[:mode].nil?\n graphics_context.composite_tiled!(image, OverCompositeOp)#AtopCompositeOp)\n else #scale\n image.resize!(width, height)\n graphics_context.composite!(image, 0, 0, OverCompositeOp)#AtopCompositeOp)\n end\n end\n if arr = options[:effect] || options[:effects]\n paint_effects! graphics_context, arr\n end\n end\n end", "def create_background\n @background = Sprite.new\n @background.bitmap = SceneManager.background_bitmap\n end", "def background; end", "def updateBackground\n\t\tif @redraw\n\t\t\[email protected]\n\t\t\[email protected] { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\t\[email protected] { |box|\n\t\t\t\tbox.draw\n\t\t\t}\n\t\t\t@redraw = false\n\t\tend\n\tend", "def updateBackground\n\t\tdrawMap()\n\tend", "def create_sub_background\n @sub_background = Sprite.new(@viewport).set_bitmap('tcard/background', :interface)\n end", "def draw()\n if [email protected]?\n @cBorders.draw()\n end\n @cImage.draw()\n end", "def snapshot_for_background\n $game_temp.background_bitmap.dispose\n $game_temp.background_bitmap = Graphics.snap_to_bitmap\n $game_temp.background_bitmap.blur\n end", "def load_editor_background\n x_extra = (self.width / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil\n y_extra = (self.height / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil\n\n @editor_background = Gosu.record(1, 1) do\n x = -x_extra\n while (x < EDITOR_WIDTH + x_extra)\n y = -y_extra\n while (y < EDITOR_HEIGHT + y_extra)\n color = position_in_bounds?(x, y) ? Gosu::Color::WHITE : Gosu::Color.new(255 / 2, 255, 255, 255)\n background = @background_images[@track.background_type]\n background.draw(x * TILE_SIZE, y * TILE_SIZE, 0, 1, 1, color)\n y += 1\n end\n x += 1\n end\n end\nend", "def create_background_sprite\n # create background sprite\n @background = Sprite.new(@v)\n create_background_bitmap\n end", "def create_background\n @background = ShaderedSprite.new(@viewport).set_bitmap(name = background_name, :battleback)\n @grounds = Array.new(@battle_scene.logic.bank_count) do |bank|\n BattleUI::GroundSprite.new(@viewport, name, bank)\n end\n end", "def draw_imgui\n\n\t\tend", "def draw\n @img.draw(@x, @y + @dy, 2, 1.0, 1.0, @color)\n end", "def initialize(x, y, width, height, image)\n super(x, y, width, height)\n \n @ucImage = UCBackgroundImage.new(self, \"\", 1, 128, 1)\n \n window_update(image)\n end", "def board_draw(*params)\n FXDCWindow.new(@canvas) do |dc|\n dc.drawImage(@image, 0, 0)\n end\n end", "def setBackground(r,g,b,a)\n super(r,g,b,a) if @image == nil\n @imageAlignment.override_background_color(:normal,Gdk::RGBA.new(r,g,b,a))\n self\n end", "def changeBackground(image)\n\t\[email protected](@background)\n\t\t@background = Gtk::Image.new(file: File.dirname(__FILE__) + \"/../Assets/\"[email protected]+\"/\"[email protected]+\"/Menus/\"+image+\".png\")\n\t\[email protected](@background,0,1,0,1)\n\t\tshow_all\n\tend", "def clear_board\n FXDCWindow.new(@image) do |dc|\n dc.foreground = BACK_COLOR\n dc.fillRectangle(0, 0, IMG_WIDTH, IMG_HEIGHT)\n end\n board_draw\n end", "def create_other_background\n @background = Sprite.new\n @background.bitmap = Cache.picture(BACKGROUND_PICTURE)\n @background.opacity = BACKGROUND_OPACITY\n @background.z = 10\n end", "def render_background\n render_unvisited\n render_grid_lines\n end", "def render_gradiated_background(top_color='#4a465a', bottom_color='black')\n Image.new(@columns, @rows, GradientFill.new(0, 0, 100, 0, top_color, bottom_color))\n end", "def setBackground\r\n r = g = b = a = 0.0\r\n case $background\r\n when 0\r\n r = g = b = 0.0\r\n when 1\r\n r = g = b = 1.0\r\n when 2\r\n r = 0.1\r\n g = 0.3\r\n b = 0.6\r\n when 3\r\n r = g = b = 0.5\r\n else\r\n r = g = b = 0.0\r\n end\r\n a = 1.0\r\n glClearColor(r,g,b,a)\r\nend", "def draw\n # draw the \"background\" translucid energy bar\n super\n \n @energy = Engine::Game.game_state.energy\n # clip the opaque image to draw only the remaining energy\n Engine::Game.instance.clip_to(@x - @image.width / 2, @y - @image.height / 2, @energy * BarWidth, @image.height) do\n @image, @image_full = @image_full, @image # swap transparent and opaque images\n super # draw the \"foreground\" opaque var\n end\n \n @image, @image_full = @image_full, @image # back to normal\n end", "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Start!\")\r\n @function_UI.big_font.draw_text(\"SPACE WAR\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.big_font.draw_text(\"Instructions: \", @function_UI.pos-100, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::RED)\r\n @function_UI.font.draw_text(\"# Press SPACE BAR to fire bullets\", @function_UI.pos-180, 140, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# Use the ARROW KEYS to navigate the Spaceship\", @function_UI.pos-180, 180, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# You have 3 Life Lines\", @function_UI.pos-180, 220, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @function_UI.font.draw_text(\"# Press ESC to leave the Game\", @function_UI.pos-180, 260, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n draw_border((SCREEN_WIDTH/3) + 105, 305)\r\n end", "def draw\r\n @image.bmp.draw(@x, @y, ZOrder::TOP)\r\n end", "def draw\r\n draw_background\r\n draw_h(@balls)\r\n end", "def draw_custom_image\r\r\n bitmap = Cache.picture($game_map.ach_display.graphic)\r\r\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\r\r\n target = Rect.new(0,0,contents.width,contents.height)\r\r\n contents.stretch_blt(target, bitmap, rect, 255)\r\r\n end", "def draw\n call Screen.setColor(true)\n call Screen.drawRectangle(@x, @y, @x + @size, @y + @size)\n end", "def draw\n @image.draw(@x - @width / 2, @y - @height / 2, 1)\n end", "def draw\n @img.draw(@x, @y, 2, 1.0, 1.0, @color)\n end", "def update_graphics\n @base_ui.update_background_animation\n end", "def create_menu_background\n @menuback_sprite = Sprite.new\n @menuback_sprite.bitmap = $game_temp.background_bitmap\n @menuback_sprite.color.set(16, 16, 16, 128)\n update_menu_background\n end", "def window_update(actor)\n if actor != nil\n bodyImg = MENU_CONFIG::BODY_IMAGES[actor.id]\n bitmap = Cache.picture(bodyImg.filename)\n @cBackCharImage.img_bitmap = bitmap\n @cBackCharImage.src_rect = Rect.new(bodyImg.src_rect.x, bodyImg.src_rect.y, \n bitmap.width, bitmap.height)\n end\n refresh()\n end", "def create_focus_sprite\n @focus_bg = Sprite_Screen.new(@viewport1)\n @focus_bg.bitmap.fill_rect(@focus_bg.bitmap.rect, Color.new(255,255,255))\n @focus_bg.z = 3\n @focus_bg.opacity = 0\n end", "def background\n fetch('dnd.backgrounds')\n end", "def background\n fetch('dnd.backgrounds')\n end", "def draw\r\n # Complete the missing code\r\n #draw_albums(albums)\r\n draw_background\r\n end", "def setup\n size 200, 200 \n no_stroke\n background 0 \n c = load_image \"cait.jpg\" \n xoff, yoff = 0, 0\n p = 2\n pix = p * 3 \n (c.width * c.height).times do |i| \n pixel = c.pixels[i] \n fill red( pixel ), 0, 0\n rect xoff, yoff, p, pix \n fill 0, green( pixel ), 0\n rect xoff+p, yoff, p, pix \n fill 0, 0, blue( pixel )\n rect xoff+p*2, yoff, p, pix \n xoff += pix\n if xoff >= (width-pix)\n xoff = 0\n yoff += pix\n end\n end \nend", "def render_background\n render_unvisited\n render_grid_lines\n render_labels\n end", "def create_background\n @background_sprite = Plane.new\n @background_sprite.bitmap = Cache.parallax(Settings::REGISTR_WALLPAPER)\n @background_sprite.x_speed = 1\n @background_sprite.y_speed = 1\n end", "def draw\n @image.drawAtPoint( @location,\n :fromRect, @image_rect,\n :operation, OSX::NSCompositeSourceOver,\n :fraction, 1.0\n )\n end", "def step\n # Draw everything\n @image.draw @screen\n end", "def setup \n size 640, 360 \n\tbackground 127 \n\tno_stroke\t\n\t(0...height).step(20) do |i|\n\t\tfill 0 \n\t\trect 0, i, width, 10 \n\t\tfill 255 \n\t\trect i, 0, 10, height \n\tend\nend", "def setup\n size(640, 360)\n background(102)\nend", "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 create_background_image\n split_tile_set_into_tiles\n create_image_list\n\n montage_cmd = \"montage #{@image_list.join(' ')} \"\n montage_cmd += \"-tile #{@maps[:background][0].size}x \"\n montage_cmd += \"-geometry 32x32+0+0 media/grid_one/full_map_image.png\"\n\n system(\"#{montage_cmd}\")\n\n @background_image = Gosu::Image.new(@window,\n 'media/grid_one/full_map_image.png',\n false)\n\n FileUtils.rm_r Dir.glob('media/tmp/*')\n end", "def draw\n\t\[email protected](@x, @y, 1)\n\tend", "def create_background(cache_back_bmp, size)\n # Initialize variables\n bmp = Bitmap.new(cache_back_bmp.width, size)\n # Copy the pixels to have a background matching the viewport length\n base_y = 0\n while base_y < bmp.height\n bmp.blt(0, base_y, cache_back_bmp, cache_back_bmp.rect)\n base_y += cache_back_bmp.height\n end\n bmp.update\n # Create the sprite\n @background_sprite = push 0, 0, nil\n @background_sprite.set_bitmap(bmp)\n end", "def colorize!(fg, bg)\n set_colors(fg, bg)\n num = @cwin.maxx * @cwin.maxy\n self.home\n self.go(0, 0) { @cwin.addstr(' '*num) }\n @cwin.refresh\n end", "def draw\n @image.draw(@x, @y, 1)\n end", "def draw\r\n @image.bmp.draw(@x - @radius, @y- @radius, 1)\r\n end", "def draw\n @menu_background.draw\n @current_view.draw\n if @alert_view != nil\n @alert_view.draw\n end\n end", "def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end", "def background\n return @background if defined?(@background)\n @background = true\n end", "def update_menu_background\n end", "def draw\r\n @background_image.bmp.draw(0, 0, ZOrder::BACKGROUND)\r\n @function_UI.place_button((SCREEN_WIDTH/3) + 100, 300, \"Close\")\r\n draw_border((SCREEN_WIDTH/3) + 105, 305, mouse_x, mouse_y)\r\n @function_UI.big_font.draw_text(\"GAME OVER!\", @function_UI.pos- 120, 30, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Your Score: #{@score}\", @function_UI.pos-100, 200, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n @score_font.draw_text(\"Time of Game PLay: #{@game_play_time} Seconds\", @function_UI.pos-140, 100, ZOrder::TOP, 1.0, 1.0, Gosu::Color::YELLOW)\r\n end", "def draw(window)\n window.draw_quad(top_left_x_view, top_left_y_view, 0x33ffffff,\n bottom_right_x_view, top_left_y_view, 0x33ffffff,\n bottom_right_x_view, bottom_right_y_view, 0x33ffffff,\n top_left_x_view, bottom_right_y_view, 0x33ffffff, 100)\n end", "def dispose_background\n @background.dispose;\n end", "def draw \n\t\[email protected](@x, @y, 1)\n\tend", "def set_desktop_background!\n command = <<-EOF \n /usr/bin/osascript -e 'tell application \"Finder\"\n set desktop picture to POSIX file \"#{File.expand_path(@desktop_image)}\"\n end tell'\n EOF\n `#{command}`\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, YE::SYSTEM::WINDOW_HELP)\n @system_window = Window_System.new(0, 0, 640, 384)\n \n positions = []\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cWindowSkinsLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGMVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucSFXVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.ucBGSVolume.cVolumeLabel.rect.y-12, \n @system_window.width-32, 48)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cBattleAnimLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cAutoDashLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInstantTextLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cDifficultyLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cInGameTutoLabel.rect.y, \n @system_window.width-32, 24)))\n positions.push(CursorPosition.new(Rect.new(0, @system_window.cReturnTitleLabel.rect.y, \n @system_window.width-32, 24)))\n \n @command_window = Window_Custom_Selectable.new(0, 0, 640, 384, positions, true)\n @command_window.opacity = 0\n @command_window.visible = true\n @command_window.active = true\n @command_window.z = 1000\n if @menu_index != nil\n @command_window.index = @menu_index\n update_help()\n else\n @command_window.index = 0\n end\n\n @last_index = -1\n end", "def drawRect(rect)\n set_images unless @circle_image\n # erase whatever graphics were there before with clear\n NSColor.clearColor.set\n NSRectFill(frame) \n # if our window transparency is >0.7, we decide to draw the circle. Otherwise, draw the pentagram.\n # If we called -disolveToPoint:fraction: instead of -compositeToPoint:operation:, then the image\n # could itself be drawn with less than full opaqueness, but since we're already setting the alpha\n # on the entire window, we don't bother with that here.\n image_to_draw = (window.alphaValue > 0.7) ? @circle_image : @penta_image\n # same as `image_to_draw.compositeToPoint([0,0], operation:NSCompositeSourceOver)`\n # apart that compositeToPoint usage is now discouraged as the behavior it provides is not recommended \n # for general use\n image_to_draw.drawAtPoint([0,0], fromRect:frame, operation:NSCompositeSourceOver, fraction:1.0)\n window.invalidateShadow\n end", "def draw\r\n @image_player.bmp.draw(@x, @y, ZOrder::TOP)\r\n end", "def draw\n @tip_img.draw(@x, @y, @z)\n @top = @y + @tip_img.height\n while @top <= 600 - @line_img.height\n @line_img.draw(@x, @top, @z)\n @top += @line_img.height\n end\n end", "def draw\n raise \"image not set to Sprite\" if @image.nil?\n return if !@visible\n\n Window.draw_ex(@x, @y, @image,\n scale_x: @scale_x, scale_y: @scale_y,\n alpha: @alpha, blend: @blend,\n angle: @angle, center_x: @center_x, center_y: @center_y)\n end", "def draw()\n if visible\n \n case self.align \n when 0 # Left\n x = self.rect.x\n when 1 # Middle\n x = self.rect.x + self.rect.width/2 - self.src_rect.width/2\n when 2 # Right\n x = self.rect.x + self.rect.width - self.src_rect.width\n else\n x = 0\n end\n \n case self.valign \n when 0 # Top\n y = self.rect.y\n when 1 # Middle\n y = self.rect.y + self.rect.height/2 - self.src_rect.height/2\n when 2 # Bottom\n y = self.rect.y + self.rect.height - self.src_rect.height\n else\n y = 0\n end\n\n if !active\n opacity = Font.inactive_alpha()\n else\n opacity = self.opacity\n end\n \n bitmap.blt(x, y, self.img_bitmap, self.src_rect, opacity)\n end\n end", "def draw\n @screen.insert(@frame, 0, 0)\n @screen.draw(0, 0, 0)\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end", "def initialize(actor)\n super(Input_Window_Settings[0], Input_Window_Settings[1], actor.bar_size + 32, 64)\n self.contents = Bitmap.new(width - 32, height - 32)\n self.z = 4000\n if Input_Window_Bg != nil\n @background_image = Sprite.new\n @background_image.bitmap = RPG::Cache.windowskin(Input_Window_Bg)\n @background_image.x = self.x + Input_Window_Bg_Postion[0]\n @background_image.y = self.y + Input_Window_Bg_Postion[1]\n @background_image.z = self.z - 1\n @background_image.visible = self.visible\n end\n self.back_opacity = Input_Window_Settings[2]\n self.opacity = Input_Window_Settings[2] if Input_Window_Settings[3] \n @actor = actor\n create_input_images if Input_Images\n refresh\n end", "def draw\n Viewport.new.draw content, Size([0,0]), header, footer\n end", "def draw_item_image\n draw_bg_gradient\n if @obj.rename_image\n draw_rename_image\n elsif $imported[\"YEA-ShopOptions\"] && @obj.image\n draw_shop_options_image\n else\n icon_index = @obj.icon_index\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n target = Rect.new(0, 0, 96, 96)\n contents.stretch_blt(target, bitmap, rect)\n end\n end", "def draw_board_window\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n TkCanvas.new(@root, bg: \"#ffffff\", height: heightpx, width: widthpx) { grid(row: 1, column: 1) }\n end", "def draw_rect x, y, w, h, c\n @screen.fill_rect x, y, w, h, c\n @screen.fill_rect x + 1, y + 1, w - 2, h - 2, 0x000000\n end" ]
[ "0.81973857", "0.81378835", "0.8053062", "0.789294", "0.773947", "0.76038134", "0.7596194", "0.7561345", "0.7546212", "0.7372357", "0.7358918", "0.73348624", "0.7295203", "0.7199637", "0.71928895", "0.7183833", "0.7025411", "0.695291", "0.6885535", "0.68232393", "0.6783896", "0.6783896", "0.6781997", "0.66270256", "0.6600878", "0.65589577", "0.65490407", "0.6548473", "0.6530924", "0.65181315", "0.65156657", "0.65120375", "0.64981955", "0.64760923", "0.6458066", "0.63755715", "0.6365368", "0.63251805", "0.627131", "0.6237654", "0.62257695", "0.62230647", "0.6191495", "0.6177425", "0.61736315", "0.6170953", "0.6166457", "0.61285573", "0.6122983", "0.6109792", "0.61066955", "0.6100489", "0.6098685", "0.605899", "0.6031408", "0.6031029", "0.5976001", "0.59614915", "0.5946854", "0.59376734", "0.5936933", "0.593603", "0.5927609", "0.5927609", "0.59139055", "0.5908744", "0.59009045", "0.58982587", "0.5890965", "0.5889972", "0.5870959", "0.5870061", "0.58537734", "0.58521926", "0.58375585", "0.5836821", "0.582425", "0.58198047", "0.5818372", "0.5805169", "0.58051556", "0.5802619", "0.58010364", "0.57984924", "0.5797617", "0.5791321", "0.5784576", "0.57654566", "0.57634723", "0.5736994", "0.5733719", "0.5721901", "0.57194775", "0.57167435", "0.5714054", "0.571349", "0.56972045", "0.5693668", "0.5668569", "0.566468", "0.56541985" ]
0.0
-1
This Boardprint method is given for free and does not need to be modified It is used to make your game playable.
def print @stacks.each { |stack| p stack } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_board\n\t\tputs \"GAME BOARD AT TIME: #{@current_turn}\"\n\t\tprint full_game_board.map{|c| c.join(\"\")}.join(\"\\n\")\n\tend", "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 display_board\n puts \"#{human.name}: #{human.marker}, #{computer.name}: #{computer.marker}\"\n puts \"Round #{@round}.\"\n puts \"Score: #{human.score} - #{computer.score}\"\n puts \"\"\n board.draw\n puts \"\"\n end", "def print_board\n dic = {0 => @slot.empty, 1 => @slot.cross, 2 => @slot.circle}\n dic[1], dic[2] = [@slot.circle, @slot.cross] if @@cpt_game.even?\n printed_board = []\n @board.board.each do |k,v|\n row = []\n v.each { |num| row << dic[num] }\n printed_board << row\n end\n print_board_array(printed_board)\n end", "def print_board\n print to_s\n # @board.each do |row|\n # row.each do |square|\n # print \" #{square.number} \"\n # end\n # puts \"\"\n # end\n end", "def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end", "def printBoard\n\t\tputs \"Player 1's Board\"\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\t\tputs \"Player 2's Board\";\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\t\tputs \"Player 1's GY\"\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\t\tputs \"Player 2's GY\";\n\t\[email protected] do |c|\n\t\t\tc.printCard\n\t\tend\n\tend", "def print\n Board.print_grid(hidden_ships_grid)\n end", "def print_board\r\n\t\t@board_array.each do |char|\r\n\t\t\tprint \"#{char} \"\r\n\t\tend\r\n\t\tputs \"\"\r\n\t\t@board_array\r\n\tend", "def print\n Board.print_grid(hidden_ships_grid)\n end", "def display\n puts \"\\n GAME BOARD \"\n puts \" Turn #{turn_count}\"\n puts \"*************\"\n puts \"* #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} *\"\n puts \"*************\\n\\n\"\n end", "def display\n \"\\n=============COMPUTER BOARD=============\\n\" +\n \"#{@npc.board.render}\\n\" +\n \"==============PLAYER BOARD==============\\n\" +\n \"#{@user_board.render(true)}\\n\"\n end", "def display\n puts \"#{@board.join(\" \")}\"\n end", "def print_board\n reputs('|')\n clear_screen!\n move_to_home!\n @players.each_with_index do |value,index|\n p board[index]\n puts\n end\n\n end", "def print_board\n\t\tputs \"**********************************\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"| Actual board |\"\n\t\tputs \"| ♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟ |\"\n\t\tputs \"**********************************\"\n\t\[email protected]_index do |i|\n\t\t\t@board[i].each_index do |y|\n\t\t\t\tif y == 0\n\t\t\t\t\tprint 8 - i\n\t\t\t\tend\n\n\t\t\t\tif @board[i][y] == nil\n\t\t\t\t\tprint \"#{@board[i][y]} --\"\n\t\t\t\telse\n\t\t\t\t\tprint \" #{@board[i][y].piecename}\"\n\t\t\t\tend\n\n\t\t\tend\n\t\t\tputs \"\\n\"\n\t\tend\n\t\tputs \" a b c d e f g h\"\n\t\tputs \"\\n\\n\\n\\n\"\n\tend", "def printBoard\n\t\tprint(\"#{@field[0].value} | #{@field[1].value} | #{@field[2].value}\\n---------\\n#{@field[3].value} | #{@field[4].value} | #{@field[5].value}\\n---------\\n#{@field[6].value} | #{@field[7].value} | #{@field[8].value}\")\n\tend", "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 to_s\n print_chess_board\n end", "def display_board (game)\n puts \" #{game[0]} | #{game[1]} | #{game[2]} \"\n puts \"-----------\"\n puts \" #{game[3]} | #{game[4]} | #{game[5]} \"\n puts \"-----------\"\n puts \" #{game[6]} | #{game[7]} | #{game[8]} \"\nend", "def print_board \n puts @board\n flush!\n reputs @board\n end", "def print_board\n reputs\n @hash.each do |player, position|\n puts \" |\" * (position - 1) + player + \"|\" + \" |\" * (length - position)\n end\n end", "def cheat\n Board.print_grid(@grid)\n end", "def display_board(game)\n \n puts \" #{game[0]} #{VERTBAR} #{game[1]} #{VERTBAR} #{game[2]} \"\n puts \"#{SEP}\"\n puts \" #{game[3]} #{VERTBAR} #{game[4]} #{VERTBAR} #{game[5]} \"\n puts \"#{SEP}\"\n puts \" #{game[6]} #{VERTBAR} #{game[7]} #{VERTBAR} #{game[8]} \"\n \nend", "def board\n # Returns a printed copy of the board\n end", "def print_boards\n puts \" SHIP STATUS SHOTS TAKEN\".colorize(:white)\n puts \" 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10\".colorize(:white)\n row_letter = ('A'..'Z').to_a\n row_number = 0\n @board.grid.each do |row1|\n print row_letter[row_number].colorize(:white) + ' '\n row1.each {|cell| print cell.to_s + ' '}\n print \" \"\n print row_letter[row_number].colorize(:white) + ' '\n @target_board.grid[row_number].each {|cell| print cell.to_s + ' '}\n print \"\\n\"\n row_number += 1\n end\n end", "def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend", "def show_board\n # Show empty board at initialization and get variable at each player turn\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 print_board\n\n\t\[email protected]_with_index do |row, i|\n\n\t\t\trow.each do |space|\n\n\t\t\t\tprint \"|#{space}|\"\n\n\t\t\tend\n\n\t\t\tif i == 2\n\t\t\t\tputs \"\"\n\t\t\telse\n\t\t\t\tputs \"\"\n\t\t\t\tputs \"---------\"\n\t\t\tend\n\n\t\tend\n\n\tend", "def play_Print()\n\t \n\t\tloop do \n\t\t\t#call the method set position returning player and position\n\t\t\tboard_table.printBoard(@board_table, @board_table.getBoardDimension())\n\t\t\tposition = player1.getMove(board_table.getBoard())\n\t\t\tboard_table.setPosition(player1,position)\n\t\t\tbreak if board_table.anyMoveLeft?() == false || board_table.check_winner(player1) == true\n\n\t\t\tboard_table.printBoard(@board_table, @board_table.getBoardDimension())\n\t\t\tposition = player2.getMove(board_table.getBoard())\n\t\t\tboard_table.setPosition(player2,position)\n\t\t\tbreak if board_table.anyMoveLeft?() == false || board_table.check_winner(player2) == true\n\t\tend\n\t\t\tboard_table.printBoard(@board_table, @board_table.getBoardDimension())\n\t\treturn board_table.results(board_table,player1,player2)\n\tend", "def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "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(board, round, player_score, computer_score)\n system('clear') || system('cls')\n puts \"Round #{round}\"\n puts \"Player: #{player_score} Computer: #{computer_score}\"\n puts \"You are a #{PLAYER_MARKER}. \" \\\n \"Computer is #{COMPUTER_MARKER}\"\n puts ''\n puts 'BOARD MAPPING'\n puts ' 7 | 8 | 9 '\n puts '---+---+---'\n puts ' 4 | 5 | 6 '\n puts '---+---+---'\n puts ' 1 | 2 | 3 '\n puts ''\n puts 'GAME BOARD'\n puts ' | |'\n puts \" #{board[7]} | #{board[8]} | #{board[9]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{board[4]} | #{board[5]} | #{board[6]}\"\n puts ' | |'\n puts '-----+-----+-----'\n puts ' | |'\n puts \" #{board[1]} | #{board[2]} | #{board[3]}\"\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 \" #{@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 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 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 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\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\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 print_boards\n\t\tputs \" SHIP STATUS SHOTS TAKEN\".colorize(:light_red)\n\t\tputs \" 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10\".colorize(:green)\n\t\trow_letter = ('A'..'Z').to_a\n\t\trow_number = 0\n\t\[email protected] do |row1|\n\t\t\tprint row_letter[row_number].colorize(:green) + ' '\n\t\t\tprint_cell(row1)\n\t\t\tprint \" \"\n\t\t\tprint row_letter[row_number].colorize(:green) + ' '\n\t\t\tprint_row_number(row_number)\n\t\t\tprint \"\\n\"\n\t\t\trow_number += 1\n\t\tend\n\tend", "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 puts green(\"You're #{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 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_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 show_board\n\t\[email protected] do |space|\n\t\t\tif !(space.class == String)\n\t\t\t\tif (space.type == 'pawn') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2659\" + \" \"\n\t\t\t\telsif (space.type == 'pawn') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265F\" + \" \"\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2656\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'rook') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265C\" + \" \"\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2658\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'knight') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265E\" + \" \"\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2657\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'bishop') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265D\" + \" \"\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2655\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'queen') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265B\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'w')\n\t\t\t\t\tprint \"\\u2654\" + \" \"\t\t\t\n\t\t\t\telsif (space.type == 'king') && (space.color == 'b')\n\t\t\t\t\tprint \"\\u265A\" + \" \"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tprint space\n\t\t\t\tend\n\t\t\telsif !(space == \"\")\n\t\t\t\tprint space + \" \"\n\t\t\telse\n\t\t\t\tputs space + \" \"\n\t\t\tend\n\t\tend\n\t\tputs \"---------------\"\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\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(some_array,some_letter) \n include FormatBoard\n \n if some_letter == \"X\" \n other_letter = \"O\"\n else\n other_letter = \"X\"\n end\n\n#converts the game array to a usable string\n def make_sentence(array) \n\tsentence = \"\"\n\tarray.each do |mini_arrays|\n mini_arrays.each do |element|\n sentence << \"a#{element}a \"\n end\n end \n \n\tsentence\n end\n\n some_array_string = make_sentence(some_array)\n sep_strings = some_array_string.split(' ')\n\n board_hash = {\"a1a\" => \"#{some_letter}\", \"a10a\" => \"#{other_letter}\", \"aa\" => \"?\"}\n\n print \"\\n\\n\"\n center2\n puts \"CURRENT BOARD\"\n center2\n puts \"_____________\"\n print \"\\n\\n\"\n center; 3.times{print \"_ \"} \n print \"\\n\\n\"\n center; print board_hash[sep_strings[0]] + \" \" + board_hash[sep_strings[1]] + \" \" + board_hash[sep_strings[2]];puts\n center; print board_hash[sep_strings[3]] + \" \" + board_hash[sep_strings[4]] + \" \" + board_hash[sep_strings[5]];puts\n center; print board_hash[sep_strings[6]] + \" \" + board_hash[sep_strings[7]] + \" \" + board_hash[sep_strings[8]];puts\n center; 3.times{print \"_ \"}; puts; puts\n \n some_array\n \n end", "def display_board\n\t board =\" | | \\n-----------\\n | | \\n-----------\\n | | \"\n\t puts board\n\tend", "def show_board_game(current_game)\n puts \"#{current_game.players[0].name.capitalize} #{current_game.players[0].avatar} #{current_game.players[0].symbol} \\u{1F19A} #{current_game.players[1].name.capitalize} #{current_game.players[1].avatar} #{current_game.players[1].symbol}\"\n puts \"\"\n for i in 0..2 do\n puts \"----------------\"\n for j in 0..2 do\n print \"| #{current_game.board.boardcase[i][j].content} \"\n end\n puts \"|\"\n end\n puts \"----------------\"\n end", "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 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 boardprint\n p @board\n puts \"#{@words}\" + \" words\"\n puts \"#{@phraseletters}\" + \" letters overall\"\n puts \"#{guess_count}\" + \" guesses made / \"\"#{@guesses_remaining}\" + \" guesses remaining\"\n puts \"#{@remaining}\" + \" letters remaining\"\n end", "def draw_board\n\t\tputs \"#{@board[\"a1\"]} | #{@board[\"a2\"]} | #{@board[\"a3\"]}\"\n\t\tputs \"-----------\"\n\t\tputs \"#{@board[\"b1\"]} | #{@board[\"b2\"]} | #{@board[\"b3\"]}\"\n\t\tputs \"-----------\"\n\t\tputs \"#{@board[\"c1\"]} | #{@board[\"c2\"]} | #{@board[\"c3\"]}\"\n\tend", "def display_board(brd, score_board)\n system 'clear'\n puts \"Best of 5! Currently Player is on #{score_board[:player]}\"\n puts \"and the computer is on #{score_board[:computer]}\"\n puts \"You're a #{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 \" | |\"\nend", "def display\n @board.each { |x| \n puts x.join(\" \")\n }\n end", "def print_board\n if @board.nil?\n puts \"Board not initialized\"\n elsif @board.respond_to?(\"each\")\n @board.each do |row|\n row.each do |cell|\n print \"#{cell} \"\n end\n puts \"\\n\"\n end\n end\n puts \"\\n\"\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 show_user_board\n puts @player_board.render(true)\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 drawBoard\n @board.each do |element|\n print \"#{element} \"\n puts \"\"\n end\n end", "def show_board # show the game board\n print @board[0..2]\n puts \"\\n\"\n print @board[3..5]\n puts \"\\n\"\n print @board[6..8]\n puts \"\\n\"\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 draw_board()\n @board\n p \"#{@board[0]} || #{@board[1]} || #{@board[2]}\"\n p \"===========\"\n p \"#{@board[3]} || #{@board[4]} || #{@board[5]}\"\n p \"===========\"\n p \"#{@board[6]} || #{@board[7]} || #{@board[8]}\"\n puts \"\\n\"\n puts \"\\n\"\n end", "def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\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 print_game_board(game_board)\n puts game_board[0].join(\" | \")\n puts \"-------------------------\"\n puts game_board[1].join(\" | \")\n puts \"-------------------------\"\n puts game_board[2].join(\" | \")\n puts \"-------------------------\"\n puts game_board[3].join(\" | \")\n puts \"-------------------------\"\n puts game_board[4].join(\" | \")\n puts \"-------------------------\"\n puts game_board[5].join(\" | \")\n puts \"-------------------------\"\n puts game_board[6].join(\" | \")\nend", "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_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 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 printBoard(board)\n\tputs \"#{board[7]} | #{board[8]} | #{board[9]}\"\n\tputs \"--+---+--\"\n\tputs \"#{board[4]} | #{board[5]} | #{board[6]}\"\n\tputs \"--+---+--\"\n\tputs \"#{board[1]} | #{board[2]} | #{board[3]}\"\nend", "def display_board(gameState)\n puts \" #{gameState[0]} | #{gameState[1]} | #{gameState[2]} \"\n puts \"-----------\"\n puts \" #{gameState[3]} | #{gameState[4]} | #{gameState[5]} \"\n puts \"-----------\"\n puts \" #{gameState[6]} | #{gameState[7]} | #{gameState[8]} \"\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 draw\n print \" | |\\n\" \\\n \"#{board_line(0)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(1)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(2)}\\n\" \\\n \" | |\\n\"\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 render\n @board.grid.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n if all_even?(row_i, col_i) || all_odd?(row_i, col_i) # this condition is for white # the two cases where the board is white is when either both row and col are even or both are odd, amazing, quite elegant\n print_piece(col, row_i, col_i, piece_color(col), \"#9AB3C9\")\n else\n print_piece(col, row_i, col_i, piece_color(col), \"#4A7190\") # this is for black lol the hex colors don't make it as clear anymore lol\n end\n end\n puts # make a new line after each row\n end\n nil # so it doesn't return the whole board just a placeholder while you play with this thing\n end", "def PrintBoard(board)\n #Display board in same format as instuctions, with values filled in\n for i in 0..8\n print \"|\" + board[i]\n if i % 3 == 2\n #Start new line every 3 columns\n print \"|\\n\"\n end\n end\n end", "def display_board\n puts \"\\n---------------\\n\".center(5)\n @board.play_area[0..2].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[3..5].each { |square| print square.to_s.center(5) }\n puts \"\\n\\n\"\n @board.play_area[6..8].each { |square| print square.to_s.center(5) }\n puts \"\\n---------------\\n\".center(5)\n end", "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\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 draw_board game\n\t\t\t\tstring = ''\n\t\t\t\tprint \" \"\n\t\t\t\t0.upto(14) do |x|\n\t\t\t\t\tprint \"%5s\" % [x.to_s]\n\t\t\t\tend\n\t\t\t\tgame.board.each_with_index do |square, row, column|\n\t\t\t\t\tanti_string = square.tile\n\t\t\t\t\tanti_string ||= ' '\n\t\t\t\t\tif column == 0\n\t\t\t\t\t\tputs string\n\t\t\t\t\t\tstring = \"%-3s\" % [row.to_s]\n\t\t\t\t\tend\n\t\t\t\t\tcase square.multiplier\n\t\t\t\t\twhen 3\n\t\t\t\t\t\tif square.type == :word\n\t\t\t\t\t\t\tstring +=\"[ \".green + anti_string + \" ]\".green\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstring +=\"[ \".blue + anti_string + \" ]\".blue\n\t\t\t\t\t\tend\n\t\t\t\t\twhen 2\n\t\t\t\t\t\tif square.type == :word\n\t\t\t\t\t\t\tstring +=\"[ \".light_red + anti_string + \" ]\".light_red\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tstring +=\"[ \".light_cyan + anti_string + \" ]\".light_cyan\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tstring += \"[ \" + anti_string + \" ]\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tputs string\n\t\t\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\n end", "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 draw_board\n clear_screen\n print_logo\n put_column_headers\n @rows.each do |row|\n row_string = \"\"\n slots_filled_in_row = 0\n row.each do |slot|\n if slot\n color_code = slot\n if @players.size == 2\n slot = \"X\" if slot == 1\n slot = \"O\" if slot == 2\n end\n color_code = COLOR_CODES[color_code]\n slot = slot.to_s.colorize(color_code)\n slots_filled_in_row += 1\n else\n slot = '.'\n end\n row_string << (slot + \" \")\n end\n center_puts((' ' * 11 * slots_filled_in_row) + row_string)\n end\n put_column_headers\n end" ]
[ "0.7558168", "0.74995106", "0.7419121", "0.7382993", "0.73380345", "0.7308744", "0.7292794", "0.7261575", "0.7251224", "0.72454286", "0.7226249", "0.72082895", "0.719844", "0.7180073", "0.7172382", "0.7153194", "0.7150651", "0.71344894", "0.71186835", "0.7101451", "0.7099203", "0.7084269", "0.70803016", "0.7079937", "0.7077945", "0.7062115", "0.7048916", "0.7038937", "0.7029485", "0.7028938", "0.7026431", "0.70252067", "0.70232034", "0.70232034", "0.7021268", "0.7020453", "0.7015269", "0.7009951", "0.70076907", "0.70023227", "0.69976825", "0.6995478", "0.69946617", "0.69946134", "0.6994061", "0.6993692", "0.6987634", "0.6987029", "0.6987029", "0.6981857", "0.69785494", "0.69736224", "0.697136", "0.6967562", "0.6966698", "0.6963744", "0.69578695", "0.6951368", "0.6950099", "0.6937621", "0.6929454", "0.692362", "0.6909517", "0.69071144", "0.6904809", "0.6902594", "0.6898416", "0.6898358", "0.6896771", "0.6895391", "0.689245", "0.689245", "0.68921477", "0.68915015", "0.688102", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.6880038", "0.68781644", "0.68704134", "0.68696386", "0.68659115", "0.686327", "0.6861675", "0.6857591", "0.68554884", "0.6848712", "0.6847091", "0.6838078", "0.68375534", "0.68373495", "0.6836513", "0.6835676" ]
0.0
-1
comment has no user_id
def test_01_comment_on_post_as_unregistered_user published_post = Post.published.first post :create, {:post_id => published_post.id } assert_not_nil assigns['post'] comment = assigns['comment'] assert_not_nil comment assert comment.errors['user_name'] assert comment.errors['user_email'] assert comment.errors['body'] # now a successful comment post :create, {:post_id => published_post.id, :comment => { :user_name => 'El Rug', :user_email => '[email protected]', :body => 'Very nice. Whatever.' }} assert_not_nil assigns['post'] comment = assigns['comment'] assert comment.errors.empty? assert_equal false, comment.published? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_want_notified_new_comment user_eject\n EntrMissionUser\n .includes(:user)\n .where(\"entr_mission_users.mission_id = ? AND users.mail_comments = ? AND users.id != ?\", \n self.id, \n true, \n user_eject.id)\n .collect { |l| l.user }\n end", "def add_comment(model_task_comment, user)\n if !model_task_comment.comment.blank?\n model_task_comment.user_id = user.id\n self.model_comments << model_task_comment\n end\n model_task_comment\n end", "def already_commented_by_user?(the_user)\n !self.comments.where([\"user_id = ?\", the_user.id]).empty?\n end", "def add_comment(eco_task_comment, user)\n if !eco_task_comment.comment.blank?\n eco_task_comment.user_id = user.id\n self.eco_comments << eco_task_comment\n end\n eco_task_comment\n end", "def comments_given(user_id)\n comments = Comment.where(user_id: user_id)\n end", "def user_comment?(user_id)\n @current_user.id == user_id\n end", "def comments\n object.comments.where(:user_id => current_user)\n end", "def get_comments_only\n self.comments.includes(:comments, :user).where(parent_comment_id: nil)\n end", "def notes_to_self(user_id)\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type = ? AND user_id = ?\", id, 'Screen', 6, user_id])\n end", "def delete_comment user\n edit_comment user, nil\n end", "def make_comment(content, user)\n return if content.blank?\n comment = PublicEarth::Db::Comment.new(PublicEarth::Db::Discussion.one.comment(self.id, user.id, content))\n @comments << comment\n comment\n end", "def comment_user\n self.user\n end", "def force_user\n params[:comment][:user_id] = current_user.id\n end", "def commentable_user\n current_user\n end", "def get_replies_only\n self.comments.includes(:user).where.not(parent_comment_id: nil)\n end", "def show\n @comments = @news.comments.where.not(user_id: nil)\n @comment = @news.comments.build\n end", "def commentsBy\n c = comments.where(:user_id => self.id).all\n if c\n c\n end\n end", "def comments(user)\n self.design_review_comments.to_ary.find_all { |comment| comment.user == user }\n end", "def add_comment\n if current_user.id.to_s == params[:user_id].to_s\n comment = Comment.new(:user_id => params[:user_id], :post_id => params[:post_id],\\\n :content => params[:content], :upvotes => 0, :downvotes => 0, :rank => 0)\n comment.save!\n end\n end", "def comments\n @user = User.find(params[:id])\n end", "def comment_user\n return self.user.username\n end", "def comment_owner\n unless current_user.id == @comment.user.id\n flash[:notice] = \"You don't have access to that!\"\n redirect_to @post\n end\n \n end", "def collapse_comment_on_comment(id)\n unless session[:shown_reply_to_comment].nil? ||\n\tsession[:shown_reply_to_comment].empty?\n session[:shown_reply_to_comment].delete(id) if session[:shown_reply_to_comment].include? id\n end\n end", "def isCommentCreator(current_user, comment_id)\n Comment.where(:user_id => current_user, :id => comment_id).exists? \n end", "def isCommentCreator(current_user, comment_id)\n Comment.where(:user_id => current_user, :id => comment_id).exists? \n end", "def all_commenters_except(user)\n commenters = self.all_commenters\n commenters.delete_if { |commenter| commenter == user }\n end", "def comment_params\n params[:comment][:user_id] ||= current_user.id if params[:comment]\n params.require(:comment).permit(:body, :user_id)\n end", "def commented_user\n @commented_user ||= case commentable.class.to_s\n when \"User\"\n commentable\n when \"BlogPost\"\n if commentable.blog.owner_type == \"User\"\n commentable.blog.owner\n elsif commentable.blog.owner_type == \"Group\"\n commentable.blog.owner.owner\n end\n when \"Photo\"\n if commentable.owner_type == \"User\"\n commentable.owner\n elsif commentable.owner_type == \"Group\"\n commentable.owner.owner\n end\n when \"Event\"\n commentable.user\n when \"Group\"\n commentable.owner\n when \"NewsItem\"\n commentable.creator\n end\n end", "def CommentCount\n return Comment.where(:user_id => id).count\n end", "def commenters\n # User.joins(:comments).where(comments: {discussion_id: id}).uniq\n User.where(id: comments.pluck(:author_id))\n end", "def comment uid=nil\n (ref = ref_if_any uid) ? ref.comment : \"\"\n end", "def subscription_on_comments user\n commentable_subscriptions.where{user_id == user.id}.first \n end", "def comment_owner\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def watch_comment_by_user_ids\n self.watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n end", "def allow_comment?(user) \n # for now, we allow everyone\n return true \n end", "def comment_params\n params.require(:comment).permit!.merge(:user_id => current_user.id)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :body)\n end", "def add_comment\n @issue.comment @user_message.empty? ? @message : @user_message\n end", "def subscribe_to_comments_if_unset user\n subscription = subscription_on_comments user\n unless subscription\n subscription = build_comment_subscription user\n subscription.subscribed = true\n subscription.save!\n end\n end", "def comment_params\n params.require(:comment).permit(:body, :commenter, :user, :user_id, :id) \n end", "def find_comments_by_user(user)\n Comment.where(commentator_id: user.id, commentable_type: self.class.name)\n .order('created_at DESC')\n end", "def follow_up_comment_without_response\n if !self.question.nil? && self.question.level > 0 && !self.comments.nil? && self.response.nil? then\n errors.add_to_base \" You may not comment upon a blank response. Use the parent question to add general comments.\" \n end\n end", "def set_comment\n @comment = Comment.includes(:user).find(params[:id])\n end", "def show\n @comment = Comment.new\n # if @comment.present?\n # @comment = Comment.all\n # end\n @users = User.all\n end", "def create\n @commentable = find_commentable\n @comment = @commentable.comments.build(params[:comment]) do |c|\n c.user = current_user\n end\n respond_to do |format|\n if @comment.save\n format.html { redirect_to @commentable, notice: 'comment was successfully created.' }\n format.json { render json: @comment, status: :created, location: @comment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def get_comments\n @public_comments = @user_key.comments.public_only.chronological\n @private_comments = @user_key.comments.private_only.chronological\n @comment = @user_key.comments.build\n end", "def show\n @user_creator = User.find(@issue.userCreator)\n @user = User.find(current_user.id);\n @comments = Comment.all\n \n @comments = @comments.select{|comment| comment.issue_id == @issue.id}\n @comment = Comment.new\n @comment.issue_id = @issue.id\n @comment.user_id = @user.id\n \n end", "def comment_exists_when_rejected\n return if accepted || comment.present?\n\n errors.add(:comment, \"can't be blank when accepted is false\")\n end", "def saved_comments\n self.comments.reject{ |c| !c.persisted?}\n end", "def comment_params\n params.require(:comment).permit(:user_id, :post_id, :body)\n end", "def create\n @comment = @commentable.comments.new comment_params\n @comment.user_id = @current_user.id\n if @comment.save\n redirect_to :back, notice: 'Your comment was successfully posted!'\n else\n redirect_to :back, notice: \"Your comment wasn't posted!\"\n end\n end", "def show\n @user = User.find_by_username(params[:id]) || raise_404\n raise_404 if @user.id == 122 # the id of [deleted] user\n\n @comments = @user.comments.order(:karma).reverse_order.limit(5)\n # @participated = Ama.where(id: @comments.map(&:ama_id)).where.not(id: @user.amas)\n\n respond_to do |format|\n format.html { if @user.belongs_to_only_one_op? then redirect_to op_path(@user.ops.first) end }\n end\n end", "def new_unmoderated_comment(user_id, comment_id, url_title)\n @user = User.find(user_id)\n @utitle = url_title\n @comment = Comment.find(comment_id)\n\n mail :to => recipient(@user.email), :subject => \"New 25c Testimonial Note for #{@utitle}\"\n end", "def user_want_notified_new_comment_advanced user_eject\n EntrMissionUser\n .includes(:user)\n .where(\"entr_mission_users.mission_id = ? AND users.mail_comments = ? AND users.id != ? AND entr_mission_users.state = ?\", \n self.id, \n true, \n user_eject.id, \n EntrMissionUser::Status::CONFIRMED)\n .collect { |l| l.user }\n end", "def change_user\n if self.id.present?\n self.user_id = Comment.find(self.id).user_id\n end\n\n end", "def regular_comments\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type < ?\", id, 'Screen', 5])\n end", "def comments_mentioning_user(other_user_id, options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments/#{other_user_id}\", options))\n end", "def root_comments\n self.comment_threads.where(:parent_id => nil)\n end", "def comment_params\r\n params.require(:comment).permit(:user_id, :post_id, :body)\r\n end", "def comment uid=nil\n ((ref = ref_for uid, false) && ref.comment) || \"\"\n end", "def create\n @comment = current_user.comments.new(comment_params)\n @comment.user_id = current_user.id\n if @comment.save\n render json: @comment\n else\n render :json => @comment.errors\n end\n end", "def reposts\n Comment.where(:original_id => self.id).where(['id != ?', self.id])\n end", "def add_comment(user_comment, topic_id)\n comment = Comment.new\n comment.description = user_comment\n comment.user = self\n comment.topic = Topic.find(topic_id)\n comment.save\n end", "def comments\n \tComment.where(commentable: commentable, parent_id: id)\n end", "def comment comment\n end", "def comments=(value)\n super(value.blank? ? nil : value)\n end", "def watch_comment_by_user_ids\n user_ids = watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n user_ids += repository.watch_by_user_ids\n user_ids.uniq!\n\n user_ids - unwatch_comment_by_user_ids\n end", "def comment_params\n params.require(:comment).permit(:content, :user_id, :post_id)\n end", "def build_comment_subscription user\n commentable_subscriptions.where{user_id == user.id}.build\n end", "def create\n @post = Post.find(params[:post_id])\n @comment = @post.comments.create(params[:comment].permit(:comment))\n @comment.user_id = current_user.id if current_user\n\n if @comment.save\n redirect_to post_path(@post)\n else\n render 'new'\n end\n end", "def user_comment_params\n params.require(:user_comment).permit(:user_id, :user_email, :imdb_datum_id, :comment)\n end", "def notify_comment(comment_id)\n puts \"comment parent #{comment_id}\"\n comment = Comment.find comment_id\n\n if comment.parent_id\n parent = Comment.find(comment.parent_id, include:[:user,:article])\n puts parent\n if parent and comment.user_id != parent.user_id\n commented_user= parent.user\n commented_article = parent.article\n\n if commented_user && commented_article\n\n key=\"new_comment.#{commented_article.id}.#{comment.user_id}\"\n notification = Notification.find_by_key(key)\n puts key\n\n if !notification\n Notification.create user_id: commented_user.id,\n key: key,\n content: \"#{commented_article.id}.#{comment.id}\"\n else\n Notification.update(notification.id,\n user_id: commented_user.id,\n key: key,\n content: \"#{commented_article.id}.#{comment.id}\",read:false)\n end\n end\n end\n end\n end", "def authorized_user? comment\n comment.user_id == current_user.id || comment.post.user_id == current_user.id\n end", "def user_comments\n comments = Comment.where(:commentable_id => self.id, :commentable_type => \"Conversation\")\n str = \"\"\n comments.each do |comment|\n user_name = Invitee.where(:id => comment.user_id).first.name_of_the_invitee rescue nil\n desc = comment.description if user_name.present?\n str += \"#{user_name} => #{desc}\" + ' ~ ' \n end\n str\n end", "def feedback(user_id_param)\n if user_id == user_id_param\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type = ?\", id, 'Screen', 5])\n else\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type = ? AND user_id = ?\", id, 'Screen', 5, user_id_param])\n end\n end", "def users_comments(post_id)\n @comments = []\n comments = Post.find(post_id).comments\n for comment in comments\n if (is_admin? || comment.commentable.user == current_user)\n @comments << comment\n end\n end\n @comments\n end", "def comment?; end", "def comment?; end", "def comment_params\n params.require(:comment).permit(:user_id, :post_id, :text).merge(user_id: current_user.id)\n end", "def set_user_comment\n @user_comment = UserComment.find(params[:id])\n end", "def set_user_comment\n @user_comment = UserComment.find(params[:id])\n end", "def find_comments_by_user(user)\n commentable = self.base_class.name.to_s\n Comment.where(:user_id => user.id, :commentable_type => commentable).order('created_at DESC')\n end", "def unreviewed_comments\n comments.select {|comment| comment.approved.nil? }\n end", "def correct_user_for_deleting_comment\n\t @comment = Comment.find(params[:id])\n\t @user = @comment.user\n\t redirect_to(login_url) unless current_user?(@user)\n\t end", "def root_comments\n comment_threads.where(parent_id: nil)\n end", "def comment_notification(user_id, comment_id)\n user = User.find(user_id)\n @comment = Comment.find(comment_id)\n mail(\n :to => user.email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Comment on \" + @comment.ultimate_parent.commentable_name.gsub(\"&gt;\", \">\").gsub(\"&lt;\", \"<\")\n )\n end", "def unsubscribe_from_comments user\n subscription = find_or_build_comment_subscription user\n subscription.subscribed = false\n subscription.save!\n end", "def add_comment\n data = request.subset(:post_id, :username, :comment)\n comment = Comment.new\n\n # If the user is logged in the user_id field should be set instead of the\n # username field.\n if logged_in?\n data.delete('username')\n data['user_id'] = user.id\n end\n\n begin\n comment.update(data)\n flash[:success] = 'The comment has been added'\n rescue => e\n Ramaze::Log.error(e)\n\n flash[:form_errors] = comment.errors\n flash[:error] = 'The comment could not be added'\n end\n\n redirect_referrer\n end", "def comment_params\n params[:comment][:user_id] = current_user.id\n params.require(:comment).permit(:text_data, :post_id, :user_id)\n end", "def create\n # On crée l'objet depuis les informations renvoyées par l'utilisateur\n @comment = Comment.new(params[:comment])\n\n # Controle de l'ACL\n # On leve une exception si l'objet est incorrect ou qu'il n'est pas créable par l'utilisateur courant\n raise Exceptions::UserCreateDeniedError.new unless @comment && @comment.creatable_by?(current_user)\n\n # L'utilisateur a t'il utiliser le bouton preview ?\n @preview_mode = (params[:commit] == t(:comment_preview, :default => 'preview'))\n # Pour l'utilisation de threads, on a besoin de savoir quel est le commentaire parent\n @comment.parent_id = params[:comment][:parent_id]\n #L'utilisateur est celui qui a crée le commentaire\n @comment.user = current_user\n\n respond_to do |format|\n # Si on est pas en mode preview et que l'enregistrement de l'objet dans la base se passe bien\n if !@preview_mode && @comment.save\n # alors on redirige vers la page de l'enregistrement\n flash[:notice] = t :comment_successfully_created\n format.html { redirect_to(@comment.announcement) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def can_create_comment?(post); true; end", "def set_comment\n @comment = current_user.comments.find(params[:id])\n end", "def comment_reply\n CommentMailer.comment_reply(Comment.where('parent_id is not null').last.id)\n end", "def buyer_comment\n Comment.find_by(id: self.buyer_comment_id)\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def comment\n @comment\n end", "def commented_by?(person)\n !!self.comments.find(:first, :conditions => [\"comments.person_id = ?\", person.id])\n end", "def show_comment_on_comment(id)\n if session[:shown_reply_to_comment].nil? ||\n\tsession[:shown_reply_to_comment].empty?\n session[:shown_reply_to_comment] = [ id ]\n else\n session[:shown_reply_to_comment] << id unless session[:shown_reply_to_comment].include? id\n end\n end" ]
[ "0.690646", "0.6878028", "0.6849248", "0.6833303", "0.6759081", "0.67547745", "0.67137176", "0.6664328", "0.6633982", "0.64892286", "0.648777", "0.64758795", "0.64752275", "0.64308465", "0.64157987", "0.6399419", "0.6384165", "0.633936", "0.63352036", "0.6315776", "0.63078594", "0.6284746", "0.626112", "0.6251031", "0.6251031", "0.6223226", "0.6215927", "0.6200044", "0.61759174", "0.6137381", "0.6133338", "0.612706", "0.61188877", "0.61169815", "0.61107606", "0.61034656", "0.60980177", "0.60789883", "0.6075931", "0.6069313", "0.6054737", "0.60505044", "0.6044661", "0.6044583", "0.60416985", "0.60292363", "0.60273933", "0.60184646", "0.60108715", "0.6004129", "0.60039926", "0.6002058", "0.6001619", "0.6001304", "0.5998195", "0.5992975", "0.59860116", "0.5978823", "0.5968321", "0.5967952", "0.5965297", "0.5962337", "0.5961748", "0.59569347", "0.5941142", "0.59373194", "0.59307134", "0.59243524", "0.5922925", "0.59222525", "0.5919026", "0.590662", "0.5901505", "0.5884012", "0.5880881", "0.58806485", "0.58788544", "0.587284", "0.587284", "0.58706254", "0.5867222", "0.5867222", "0.586639", "0.5863179", "0.5862188", "0.58620566", "0.585858", "0.58550537", "0.58538383", "0.584877", "0.58448136", "0.58401376", "0.5839694", "0.58383316", "0.5836802", "0.58296996", "0.58296996", "0.58268195", "0.5819843", "0.5812743" ]
0.5889517
73
must update user attributes comment must have user_id comment must show up on post unless it's marked as spam
def test_02_comment_on_post_as_guest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n params[:comment][:user_id]= current_user\n \n @[email protected](params[:id])\n \n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to([@blog,@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 force_user\n params[:comment][:user_id] = current_user.id\n end", "def update?\n\t\[email protected] == @user\n\tend", "def allow_comment?(user) \n # for now, we allow everyone\n return true \n end", "def update\n #if @user && @user.posts.include(@post)\n @comment.update(comment_params)\n json_response(@comment)\n end", "def update\n @user = User.find(params[:user_id])\n if current_user.role?(:admin)\n @comment = @user.comments.find(params[:id])\n else\n @comment = current_user.comments.find(params[:id])\n end\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to(@commentable, :notice => 'Comment was successfully created.') }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_comment\n if current_user.id.to_s == params[:user_id].to_s\n comment = Comment.new(:user_id => params[:user_id], :post_id => params[:post_id],\\\n :content => params[:content], :upvotes => 0, :downvotes => 0, :rank => 0)\n comment.save!\n end\n end", "def before_update_save(record)\n record.comments.each do |comment|\n comment.user = current_user\n end\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n @comment.update(post_id: params[:post_id])\n user_emails = []\n if current_user.parent_user.present?\n user_emails << current_user.parent_user.email\n current_user.parent_user.users.each {|user| user_emails << user.email }\n else\n user_emails << current_user.email\n current_user.users.each {|user| user_emails << user.email }\n end\n TestMailer.comment_email(user_emails, 'Comment edited, please check...').deliver\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_comment?(user_id)\n @current_user.id == user_id\n end", "def update\n @comment = Comment.find(params[:id])\n\n properly_owned = (current_user == @comment.user)\n\n flash[:error] = \"Must be author of a comment to update it.\" unless properly_owned\n\n respond_to do |format|\n if properly_owned and @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def check_for_spam\n if self.spam?\n self.update_column(:approved, false)\n elsif !approved\n self.update_column(:approved, true)\n end\n end", "def correct_user\n comment = Comment.find(params[:id])\n message = 'You may only edit your own comments.'\n unless current_user?(comment.user)\n redirect_to(context_url(context), alert: message)\n end\n end", "def correct_user\n @comment = current_user.comments.find_by(id: params[:id])\n unless @comment.user == current_user || current_user.admin? || @comment.user == @comment.advert.user\n redirect_to @comment.advert\n end\n end", "def comment_moderation(user_id, comment_id, url_title, response)\n @user = User.find(user_id)\n @utitle = url_title\n @comment = Comment.find(comment_id)\n\n mail :to => recipient(@user.email), :subject => \"25c Testimonial Notification for #{@utitle}\"\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :body)\n end", "def comment_params\n params[:comment][:user_id] ||= current_user.id if params[:comment]\n params.require(:comment).permit(:body, :user_id)\n end", "def update\n return forbidden unless user_owns_comment\n return bad_request(@comment.errors.full_messages) unless @comment.update_attributes(text: comment_params[:text])\n\n render json: {data: {message: 'The comment has been updated'}}, status: :ok\n end", "def comment_params\n params.require(:comment).permit(:user_id, :post_id, :body)\n end", "def already_commented_by_user?(the_user)\n !self.comments.where([\"user_id = ?\", the_user.id]).empty?\n end", "def comment_params\n params.require(:comment).permit!.merge(:user_id => current_user.id)\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.ip = request.ip\n @comment.useragent = request.user_agent\n if @current_user && @current_user.admin?\n @comment.moderator_id = @current_user.id\n end\n\n\n respond_to do |format|\n if @comment.save\n @spam_status = blogspam_check\n unless @spam_status == 0\n @comment.destroy\n else\n User.find(1).send_comment_mail(@comment)\n end\n\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n format.js {\n @post_status = 'ok'\n render \"main/#{@theme}/update_comment_form\"\n }\n else\n @comment.name = @comment.name_backup\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n format.js {\n @post_status = 'fail'\n render \"main/#{@theme}/update_comment_form\"\n }\n end\n end\n end", "def comment_params\r\n params.require(:comment).permit(:user_id, :post_id, :body)\r\n end", "def user_comment_params\n params.require(:user_comment).permit(:user_id, :user_email, :imdb_datum_id, :comment)\n end", "def update\n @comment = Comment.find(params[:id])\n @comment_indent = params[:indent].to_i\n @page = @comment.page\n\n if @comment.user != current_user\n render(:text => \"You can't edit other people's comments\")\n return false\n end\n\n if [email protected]_attributes(params[:comment])\n render(:text => \"You can't edit other people's comments\")\n return false\n end\n end", "def comment_params\n params.require(:comment).permit(:user_id, :post_id, :text).merge(user_id: current_user.id)\n end", "def comment_owner\n unless current_user.id == @comment.user.id\n flash[:notice] = \"You don't have access to that!\"\n redirect_to @post\n end\n \n end", "def comment\n\t Hookup.where(:user_id => params[:user_id], :challenge_id => params[:challenge_id]).update_attribute(:u,:c)\n end", "def watch_comment_by_user_ids\n self.watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n end", "def comment_update(message)\n @user = message.user\n @message=message\n mail to: @user.email, subject: \"New comment for your Message Board (Socail Trip App)\", from:'[email protected]'\n \n end", "def comment_params\n params.require(:comment).permit(:body, :post_id, votes_attributes: [:up], users_attributes: [:email])\n end", "def correct_user\n \t\t@comment = Comment.find(params[:post_id])\n \t\tredirect_to request.referrer || root_url unless current_user?(@comment.user)\n \tend", "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end", "def change_user\n if self.id.present?\n self.user_id = Comment.find(self.id).user_id\n end\n\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def critiq_rating\n user_comments = Comment.where(user_id: self.id, deleted: true)\n rating = 0\n user_comments.each do |c|\n rating += c.upvotes.size * 10\n rating -= c.downvotes.size * 2\n end\n # Grant creator permissions if this user for the first time has over 1000 creator heat\n if !self.creator and rating > 1000 \n self.update_attribute(creator: true)\n end\n rating\n end", "def comments_mentioning_user(other_user_id, options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments/#{other_user_id}\", options))\n end", "def update\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n #@comment.create_activity :update, owner: current_user\n format.html { redirect_to postings_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_unmoderated_comment(user_id, comment_id, url_title)\n @user = User.find(user_id)\n @utitle = url_title\n @comment = Comment.find(comment_id)\n\n mail :to => recipient(@user.email), :subject => \"New 25c Testimonial Note for #{@utitle}\"\n end", "def comment_params\n params.require(:comment).permit(:user, :message, :time_sent, :isFixed)\n end", "def comment_params\n params.require(:comment).permit(:body, :commenter, :user, :user_id, :id) \n end", "def comment_params\n params[:comment][:user_id] = current_user.id\n params.require(:comment).permit(:text_data, :post_id, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :user_name, :content, :micropost_id, :product_id)\n end", "def watch_comment_by_user_ids\n user_ids = watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n user_ids += repository.watch_by_user_ids\n user_ids.uniq!\n\n user_ids - unwatch_comment_by_user_ids\n end", "def add_comment(model_task_comment, user)\n if !model_task_comment.comment.blank?\n model_task_comment.user_id = user.id\n self.model_comments << model_task_comment\n end\n model_task_comment\n end", "def comment_params\n params.require(:comment).permit(:activity_id, :body, :user_id)\n end", "def set_user_comment\n @user_comment = UserComment.find(params[:id])\n end", "def set_user_comment\n @user_comment = UserComment.find(params[:id])\n end", "def correct_user\n @comment = Comment.find_by_id(params[:id])\n @user = User.find_by_id(@comment.user_id)\n redirect_to(root_url) unless current_user?(@user)\n end", "def comment_params\n params.require(:comment).permit(:content, :user_id, :post_id)\n end", "def lock!(user = User.current)\n self.comment = \"Agenda closed\"\n self.author = user\n self.locked = true\n self.save\n end", "def authorized_user? comment\n comment.user_id == current_user.id || comment.post.user_id == current_user.id\n end", "def correct_user\n return if current_user_is_admin? || current_user.id == @comment.user_id\n flash[:danger] = 'Not authorized.'\n redirect_to users_path\n end", "def comment_params\n params.require(:comment).permit(:text, :user_id, :event_id, :flagged)\n end", "def rate_comment\n render nothing: true\n comment = Comment.find(params[:id])\n\n if(!comment.user_ratings.include? current_user.id)\n comment.user_ratings.push(current_user.id)\n comment.save\n else\n return redirect_to_back(root_path)\n end\n\n end", "def repost_by(user)\n c = Comment.new\n c.content = self.content\n # if this was a repost itself, use this post's original\n c.original = self.original ? self.original : self\n c.user = user\n c.original.save if c.save # update cache on responders\n c\n end", "def update\r\n @comment = Comment.find(params[:id])\r\n if @comment.update_attribute(:filtered, \"true\")\r\n flash[:success] = \"Comment were successfully approved.\"\r\n redirect_to moderator_url\r\n else\r\n flash[:error] = \"There was an error approving the comment.\"\r\n redirect_to moderator_url\r\n end\r\n end", "def post_comment_params\n params.require(:post_comment).permit(:user_id, :post_id, :content)\n end", "def spam_check\n CommentSpamCheckWorker.perform_in(5.seconds, id)\n end", "def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end", "def add_comment(eco_task_comment, user)\n if !eco_task_comment.comment.blank?\n eco_task_comment.user_id = user.id\n self.eco_comments << eco_task_comment\n end\n eco_task_comment\n end", "def comment_params\n params.require(:comment).permit(:body, :user_id, :post_id)\n end", "def permitted_to_comment?(user)\n self.is_writable? && self.is_commentable? && self.permitted_to_read?(user)\n end", "def comment_params\n params.require(:comment).permit(:post_id, :content, :user_id)\n end", "def update \n commentable = find_commentable_object\n @comment = Comment.find(params[:id])\n \n respond_with do |format|\n if @comment.update_attributes(params[:comment])\n @comment.pending_for_moderation\n @comment_updated = @comment\n @comment = Comment.new\n \n flash.now[:notice] = 'Comment was successfully updated.'\n else\n flash.now[:alert] = 'Comment was not successfully updated.'\n end\n end\n \n # respond_to do |format|\n # if @comment.update_attributes(params[:comment])\n # format.html { redirect_to(@post, :notice => 'Comment was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def mark_as_spam!\n update_attribute(:approved, false)\n Akismetor.submit_spam(akismet_attributes)\n end", "def comments_params\n params.require(:comment).permit(:user_id, :body, :item)\n end", "def post_params\n params.require(:comment).permit(:user_id, :post_id, :content)\n end", "def comment_params\n params.require(:comment).permit(:body, :user_name)\n end", "def comment_params\n params.permit(:user_id, :bet_id, :text)\n end", "def like(user)\n comment_vote = CommentVote.new\n comment_vote.comment = self\n comment_vote.user = user\n comment_vote.value = true\n comment_vote.save\n comment_vote\n end", "def comment_params\n params.permit(:description, :post_id, :user_id)\n end", "def edited_comment_notification(user_id, comment_id)\n user = User.find(user_id)\n @comment = Comment.find(comment_id)\n mail(\n :to => user.email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Edited comment on \" + @comment.ultimate_parent.commentable_name.gsub(\"&gt;\", \">\").gsub(\"&lt;\", \"<\")\n )\n end", "def comment_params\n params.require(:comment).permit(:user_id, :activity_id, :content)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :micropost_id, :content)\n end", "def comment_params\n params.require(:comment).permit(:text, :user_id, :post_id)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :article_id, :body)\n end", "def conditionally_update\n return true unless params[:user]\n @user.update(user_params)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :blog_id, :content)\n end", "def update\n @comment = current_user.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = @parent.find(params[:id])\n\n respond_to do |format|\n # Comments can only be edited by the submitter (if not anonymous) and administrators.\n if !current_user or (!current_user.is_admin and @comment.user != current_user)\n format.html { redirect_to([@group,@project,@task], :notice => 'You must be the poster of this comment or an administrator to edit it.') }\n format.xml { render :status => :unprocessable_entity }\n elsif @comment.update_attributes(params[:comment])\n format.html { redirect_to([@group,@project,@task], :notice => 'Comment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def comment_params\n params.require(:comment).permit(:content, :user_id,:post_id)\n end", "def send_comment_notifications(comment)\n plan_detail = comment.commentable\n plan = plan_detail.plan\n users = plan.members.select { |u| u.opt_in == true }\n # exclude user making the comment\n users = users - Array(comment.user)\n\n users.each do |user|\n logger.info \"[soph] sending notification email to #{user.email} about comment.id #{comment.id}\"\n UserMailer.delay.new_comment_notification(to_user: user,\n comment_text: comment.comment,\n commenter: comment.user,\n passage_ref: plan_detail.passage_ref,\n plan_url: plan_path(plan))\n end\n end", "def update\n respond_to do |format|\n @description = @micropost.description\n @title = @micropost.title \n @priority = @micropost.priority\n @kind = @micropost.kind \n @status = @micropost.status \n if @micropost.update(micropost_params)\n if(@title.to_s != @micropost.title.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Changed title to \" + @micropost.title.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@priority.to_s != @micropost.priority.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Priority changed from \"+ @priority.to_s + \" to \" + @micropost.priority.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@kind.to_s != @micropost.kind.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Kind changed from \"+ @kind.to_s + \" to \" + @micropost.kind.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@status.to_s != @micropost.status.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Status changed from \"+ @status.to_s + \" to \" + @micropost.status.to_s\n @comment.user = User.new\n @comment.save\n end\n if(@description.to_s != @micropost.description.to_s)\n @comment = @micropost.comments.new\n @comment.body = \"Description changed to \" + @micropost.description.to_s\n @comment.user = User.new\n @comment.save\n end\n format.html { redirect_to @micropost, notice: 'Issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @micropost }\n else\n format.html { render :edit }\n format.json { render json: @micropost.errors, status: :unprocessable_entity }\n end\n end\n end", "def like_comment(id = nil, user_id = nil)\n comment = Comment.where(:id => id).first\n if not comment.nil?\n #check to make sure user cant like comment more than once\n #users_who_liked is a string which is a comma-separated list of ids of users who like a comment\n\n users = comment.users_who_liked\n if not users.nil?\n users = comment.users_who_liked.split(\",\")\n end\n\n if not user_id.nil? and (users.nil? or not users.include?(user_id.to_s))\n comment.numlikes += 1\n users = users.join(\",\")\n users += \",\" + user_id.to_s\n comment.users_who_liked = users\n comment.save\n return SUCCESS\n end\n end\n return FAILED\n end", "def update_comment\n get_comment\n @pcp_item = @pcp_comment.pcp_item\n @pcp_subject = @pcp_item.pcp_subject\n @pcp_step = @pcp_subject.current_step\n if @pcp_step.status_closed?\n render_bad_logic t( 'pcp_items.msg.subj_closed')\n return\n end\n if user_has_permission?( :to_update ) then\n respond_to do |format|\n if @pcp_comment.update( pcp_comment_params )\n format.html { redirect_to @pcp_comment.pcp_item, notice: t( 'pcp_comments.msg.edit_ok' )}\n else\n format.html { render :edit_comment }\n end\n end\n else\n render_no_permission\n end\n end", "def comment_params\n params.require(:comment).permit(:link_id, :body, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:link_id, :body, :user_id)\n end", "def mark_as_spam!\n update_attribute(:approved, true)\n Akismetor.submit_spam(akismet_attributes)\n end", "def comment_params\n params.require(:comment).permit(:post, :url, :question, :demand_id, :user_id)\n end", "def subscribe_to_comments_if_unset user\n subscription = subscription_on_comments user\n unless subscription\n subscription = build_comment_subscription user\n subscription.subscribed = true\n subscription.save!\n end\n end", "def comment_params\n params.require(:comment).permit(:content, :item_id, :user)\n end", "def comment_params\n params.require(:comment).permit(:comment, :user_id, :preset_id)\n end", "def comment_params\n params.require(:comment).permit(:body, :question_id, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:content, :user_id, :post_id)\n end", "def comment_params\n params.require(:comment).permit(:content, :user_id, :post_id)\n end", "def spam_comment_params\n params.require(:spam_comment).permit(:name, :email, :website, :content, :blog_spam_result, :blog_spam_reason, :blog_spam_blocker, :blog_spam_version, :ip, :useragent)\n end", "def comment_params\n params.require(:comment).permit(:rob_id, :name, :content).merge(user: current_user)\n end", "def set_comment\n @comment = Comment.includes(:user).find(params[:id])\n end" ]
[ "0.65451944", "0.65294504", "0.64585066", "0.63818955", "0.63593227", "0.6357558", "0.62625563", "0.6227534", "0.62039506", "0.61980426", "0.6182508", "0.61361754", "0.61339885", "0.6129209", "0.6124243", "0.61223435", "0.61197555", "0.61193013", "0.61052686", "0.60733074", "0.6071733", "0.6067653", "0.60608745", "0.6058781", "0.60203034", "0.60071063", "0.6007074", "0.59977114", "0.59906983", "0.5985142", "0.5981521", "0.5967053", "0.59658015", "0.59570444", "0.5945965", "0.5940005", "0.5940005", "0.59378374", "0.59357095", "0.5933168", "0.5922717", "0.59016347", "0.5900246", "0.5898857", "0.58981365", "0.5886074", "0.58850634", "0.58838207", "0.5883508", "0.5883508", "0.5855323", "0.5852936", "0.5848677", "0.5847652", "0.5845533", "0.5842934", "0.5836112", "0.58307445", "0.5822733", "0.5816268", "0.58016634", "0.57978106", "0.5787274", "0.5787262", "0.57808876", "0.5778767", "0.57787424", "0.57761896", "0.5775077", "0.5757543", "0.57567847", "0.57421523", "0.5738652", "0.5737046", "0.5734691", "0.5732398", "0.57246196", "0.5724427", "0.57229286", "0.5721945", "0.57205504", "0.57201976", "0.5714507", "0.5693937", "0.5688388", "0.56868505", "0.56783974", "0.5675184", "0.5671133", "0.5671133", "0.5668122", "0.5668059", "0.5666662", "0.5665332", "0.5662607", "0.5659382", "0.5659239", "0.5659239", "0.56455326", "0.5641598", "0.56380045" ]
0.0
-1
comment must have user_id comment must skip spamcheck if user is moderator comment must show up on post unless it's marked as spam
def test_03_comment_on_post_as_member end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_comment?(user) \n # for now, we allow everyone\n return true \n end", "def spam_check\n CommentSpamCheckWorker.perform_in(5.seconds, id)\n end", "def comment_moderation(user_id, comment_id, url_title, response)\n @user = User.find(user_id)\n @utitle = url_title\n @comment = Comment.find(comment_id)\n\n mail :to => recipient(@user.email), :subject => \"25c Testimonial Notification for #{@utitle}\"\n end", "def is_spam? \n # You'll need to get your own Akismet API key from www.akismet.com\n \n #return false;\n \n @akismet = Akismet.new('key', 'webpage') \n \n return nil unless @akismet.verifyAPIKey\n \n return self.spam!(:exempt => true) if @akismet.commentCheck(\n self.author_ip, # remote IP\n self.user_agent, # user agent\n self.referrer, # http referer\n self.page.url, # permalink\n 'comment', # comment type\n self.author, # author name\n self.author_email, # author email\n self.author_url, # author url\n self.content, # comment text\n {}) # other\n end", "def already_commented_by_user?(the_user)\n !self.comments.where([\"user_id = ?\", the_user.id]).empty?\n end", "def user_comment?(user_id)\n @current_user.id == user_id\n end", "def test_check_for_spam\n comment = new_comment(:pseud_id => create_pseud)\n assert !comment.approved\n assert comment.check_for_spam # should always return true\n assert comment.approved\n # TODO - test for actual spam\n end", "def create\n @comment = Comment.new(comment_params)\n @comment.ip = request.ip\n @comment.useragent = request.user_agent\n if @current_user && @current_user.admin?\n @comment.moderator_id = @current_user.id\n end\n\n\n respond_to do |format|\n if @comment.save\n @spam_status = blogspam_check\n unless @spam_status == 0\n @comment.destroy\n else\n User.find(1).send_comment_mail(@comment)\n end\n\n format.html { redirect_to @comment, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n format.js {\n @post_status = 'ok'\n render \"main/#{@theme}/update_comment_form\"\n }\n else\n @comment.name = @comment.name_backup\n format.html { render :new }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n format.js {\n @post_status = 'fail'\n render \"main/#{@theme}/update_comment_form\"\n }\n end\n end\n end", "def comments_mentioning_user(other_user_id, options={})\n self.class.parse_comments(request(singular(user_id) + \"/comments/#{other_user_id}\", options))\n end", "def new_unmoderated_comment(user_id, comment_id, url_title)\n @user = User.find(user_id)\n @utitle = url_title\n @comment = Comment.find(comment_id)\n\n mail :to => recipient(@user.email), :subject => \"New 25c Testimonial Note for #{@utitle}\"\n end", "def can_see_comment?(comment); comment.user.admin?; end", "def test_mark_as_spam\n comment = create_comment\n assert comment.mark_as_spam!\n assert !comment.approved\n # TODO - what happens if a signed comment is marked as spam? can it even be done?\n end", "def toggle_spam_comment(article_id, id)\n put \"articles/#{article_id}/comments/#{id}/toggle_spam\", nil\n end", "def comment_moderator? comment\n id == comment.holder_id\n end", "def is_spam?\n #if we've got another comment marked as spam from this ip address, then spam it instantly\n if Comment.filter([\"ip = ? and reported_as_spam = ?\", self.ip, true]).first\n self.reported_as_spam = true\n return true\n else\n old = self.reported_as_spam \n self.reported_as_spam = Thoth::Plugin::ThothAkismet.new_client.check self.ip || \"\", 'user_agent', self.akismet_options \n if self.reported_as_spam != old || !self.spam_checked\n self.spam_checked = true\n self.save if self.id #only save the comment if it's already been saved\n end\n return self.reported_as_spam\n end\n end", "def is_spam?(args)\n return call_akismet('comment-check', args)\n end", "def make_comment(content, user)\n return if content.blank?\n comment = PublicEarth::Db::Comment.new(PublicEarth::Db::Discussion.one.comment(self.id, user.id, content))\n @comments << comment\n comment\n end", "def authorized_user? comment\n comment.user_id == current_user.id || comment.post.user_id == current_user.id\n end", "def spam?(env)\n\t\t\tparams = { blog: 'http://sivers.org/',\n\t\t\t\tuser_ip: env['REMOTE_ADDR'],\n\t\t\t\tuser_agent: env['HTTP_USER_AGENT'],\n\t\t\t\treferrer: env['HTTP_REFERER'],\n\t\t\t\tcomment_type: 'comment',\n\t\t\t\tcomment_author: env['rack.request.form_hash']['name'],\n\t\t\t\tcomment_author_email: env['rack.request.form_hash']['email'],\n\t\t\t\tcomment_content: env['rack.request.form_hash']['comment'] }\n\t\t\tparams.each {|k,v| params[k] = URI.encode_www_form_component(v)}\n\t\t\tkey = Sivers.config['akismet']\n\t\t\turi = URI(\"http://#{key}.rest.akismet.com/1.1/comment-check\")\n\t\t\t'true' == Net::HTTP.post_form(uri, params).body\n\t\tend", "def send_comment_notifications(comment)\n plan_detail = comment.commentable\n plan = plan_detail.plan\n users = plan.members.select { |u| u.opt_in == true }\n # exclude user making the comment\n users = users - Array(comment.user)\n\n users.each do |user|\n logger.info \"[soph] sending notification email to #{user.email} about comment.id #{comment.id}\"\n UserMailer.delay.new_comment_notification(to_user: user,\n comment_text: comment.comment,\n commenter: comment.user,\n passage_ref: plan_detail.passage_ref,\n plan_url: plan_path(plan))\n end\n end", "def can_create_comment?(post); true; end", "def add_comment(eco_task_comment, user)\n if !eco_task_comment.comment.blank?\n eco_task_comment.user_id = user.id\n self.eco_comments << eco_task_comment\n end\n eco_task_comment\n end", "def commentable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :commenter)\n end", "def do_comment\n\t\t# 发布评论时要知道这个评论属于哪篇文章,所以要在 Article 模型上调用 find 方法查找文章对象。\n\t\t@message = Message.find(params[:message_id])\n\t\tcommenter = session[:username]\n\t comment_message = params[:comment_message]\n\t if comment_message == ''\n\t \tredirect_to \"/show/messages/#{@message.id}\"\n\t else\n\t \t@comment = @message.comments.new\n\t \[email protected] = commenter\n\t \[email protected]_message = comment_message\n\t \[email protected]\n\t \tredirect_to \"/show/messages/#{@message.id}\"\n\t end\n\tend", "def comments_given(user_id)\n comments = Comment.where(user_id: user_id)\n end", "def ensure_authorized_to_comment\n @comment = initialize_comment(\n params,\n author_id: @current_user.id,\n community_id: @current_community.id\n )\n\n unless @comment.listing.visible_to?(@current_user, @current_community)\n flash[:error] = t(\"layouts.notifications.you_are_not_authorized_to_view_this_content\")\n redirect_to search_path and return\n end\n end", "def prevent_commenting?\n prevent_commenting_until? && prevent_commenting_until > Time.current\n end", "def correct_user\n @comment = current_user.comments.find_by(id: params[:id])\n unless @comment.user == current_user || current_user.admin? || @comment.user == @comment.advert.user\n redirect_to @comment.advert\n end\n end", "def add_comment\n if current_user.id.to_s == params[:user_id].to_s\n comment = Comment.new(:user_id => params[:user_id], :post_id => params[:post_id],\\\n :content => params[:content], :upvotes => 0, :downvotes => 0, :rank => 0)\n comment.save!\n end\n end", "def add_comment(model_task_comment, user)\n if !model_task_comment.comment.blank?\n model_task_comment.user_id = user.id\n self.model_comments << model_task_comment\n end\n model_task_comment\n end", "def collapse_comment_on_comment(id)\n unless session[:shown_reply_to_comment].nil? ||\n\tsession[:shown_reply_to_comment].empty?\n session[:shown_reply_to_comment].delete(id) if session[:shown_reply_to_comment].include? id\n end\n end", "def comment_owner\n unless current_user.id == @comment.user.id\n flash[:notice] = \"You don't have access to that!\"\n redirect_to @post\n end\n \n end", "def is_reply_allowed?(comment)\n if comment.parent_id.nil?\n true\n # redirect_to(post, :alert => \"You are not allowed man to reply a reply! Don't even try boy, it could cost you the life!\")\n end\n end", "def comments?\n !!user && user.admin?\n end", "def comment_notification(user_id, comment_id)\n user = User.find(user_id)\n @comment = Comment.find(comment_id)\n mail(\n :to => user.email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Comment on \" + @comment.ultimate_parent.commentable_name.gsub(\"&gt;\", \">\").gsub(\"&lt;\", \"<\")\n )\n end", "def show_comment_on_comment(id)\n if session[:shown_reply_to_comment].nil? ||\n\tsession[:shown_reply_to_comment].empty?\n session[:shown_reply_to_comment] = [ id ]\n else\n session[:shown_reply_to_comment] << id unless session[:shown_reply_to_comment].include? id\n end\n end", "def send_comment(data)\n current_user.comments.create!(content: data['comment'], blog_id: data['blog_id'])\n end", "def comment_exists_when_rejected\n return if accepted || comment.present?\n\n errors.add(:comment, \"can't be blank when accepted is false\")\n end", "def commented(request, comment)\n @request = request\n @comment = comment\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end", "def comment\n @user = User.find_by_id(session[:remember_token]) \n @dream = Dream.find_by_id(params[:id])\n @c = params[:comment]\n #uses Captcha to avoid robots\n @answer = @c.key\n open('http://captchator.com/captcha/check_answer/dreamatic/' + @answer) do |f|\n pp f.meta\n f.each do |line|\n @key = line\n end\n end\n if @key== '1' # after verifying captcha, returns true or false \n @comment = Comment.new(:user_id => @user.id, :dream_id => @dream.id, :content => @c.content)\n if @comment.save!\n redirect_to 'home/dreamList'\n else\n flash.now[:error] = \"Comment was not posted due to an unknown error, please try again later or contact [email protected].\"\n render 'new'\n end\n else\n flash.now[:error] = \"Check your verification number.\"\n redirect_to 'home/loggedin'\n end\n end", "def check_comment(options={})\n return false if invalid_options?\n message = call_akismet('comment-check', options)\n {:spam => !self.class.valid_responses.include?(message), :message => message}\n end", "def create\n story = Story.find(params[:story_id])\n unless story.disable_commenting\n @comment.user_id = current_user.id\n @comment.story_id = params[:story_id]\n @comment.score = 0\n \n # Akismet hook\n if [email protected]? : @comment.is_approved = true else @comment.is_approved = false end\n \n @comment.save\n \n if @comment.is_approved\n flash[:notice] = 'Comment posted.'\n else\n flash[:error] = 'Comment marked as spam please contact an administrator.'\n end \n else\n flash[:error] = \"Commenting has been disabled for this story.\"\n end\n respond_to do |format|\n format.html { redirect_to @comment.story }\n format.js { render :layout => false}\n end\n end", "def like_comment(id = nil, user_id = nil)\n comment = Comment.where(:id => id).first\n if not comment.nil?\n #check to make sure user cant like comment more than once\n #users_who_liked is a string which is a comma-separated list of ids of users who like a comment\n\n users = comment.users_who_liked\n if not users.nil?\n users = comment.users_who_liked.split(\",\")\n end\n\n if not user_id.nil? and (users.nil? or not users.include?(user_id.to_s))\n comment.numlikes += 1\n users = users.join(\",\")\n users += \",\" + user_id.to_s\n comment.users_who_liked = users\n comment.save\n return SUCCESS\n end\n end\n return FAILED\n end", "def commented (commentable, comment, email)\n @commentable = commentable\n @comment = comment\n mail :to => email,\n :subject =>\"#{@commentable.class} \\\"#{@commentable.title}\\\" has been commented\"\n end", "def correct_user\n comment = Comment.find(params[:id])\n message = 'You may only edit your own comments.'\n unless current_user?(comment.user)\n redirect_to(context_url(context), alert: message)\n end\n end", "def spam_comment_params\n params.require(:spam_comment).permit(:name, :email, :website, :content, :blog_spam_result, :blog_spam_reason, :blog_spam_blocker, :blog_spam_version, :ip, :useragent)\n end", "def can_comment?(person)\n self.reviewer != person && !commented_by?(person)\n end", "def comment_affirmative?(comment)\n !!(comment =~ /(^lgtm$)|(^:\\+1:\\s+$)|(^:ok:\\s+$)|(^looks\\s+good(?:\\s+to\\s+me)?$)|(^:shipit:\\s+$)|(^:rocket:\\s+$)|(^:100:\\s+$)/i)\n end", "def check_for_spamming\n #first check if it is a new conversation\n if !params[:message][:conversation_id]\n if current_user.conversations.recent.count < 5 #max 5 new convos/hour\n false\n else\n true\n end\n else\n false #limit_replies\n end\n end", "def on_comment(msg)\n end", "def correct_user\n return if current_user_is_admin? || current_user.id == @comment.user_id\n flash[:danger] = 'Not authorized.'\n redirect_to users_path\n end", "def correct_user\n \t\t@comment = Comment.find(params[:post_id])\n \t\tredirect_to request.referrer || root_url unless current_user?(@comment.user)\n \tend", "def new_comment(comment, commenter, author, question)\n if author.privacy_setting.notify_on_post_comment \n @comment, @commenter, @author, @post = comment, commenter, author, question\n mail(\n :subject => \"#{@commenter.name.titleize} just commented on your post.\",\n :from => \"[email protected]\",\n :to => author.email,\n :date => Time.now\n )\n end\n end", "def add_comment\n @issue.comment @user_message.empty? ? @message : @user_message\n end", "def comment_notification(user, commenter, post, comment)\n @user = user\n @commenter = commenter\n @post = post\n @comment = comment\n\n mail to: user.email, subject: \"#{commenter.username} has commented on your post!\"\n end", "def is_spam?\n if self.owner and self.owner.spammer?\n return true\n else\n return false\n end\n end", "def comment_notice(comment)\n @comment = comment\n\n #mail to: \"[email protected]\", subject: \"新しいコメントが投稿されました。\"\n mail to: \"[email protected]\", subject: \"新しいコメントが投稿されました。\"\n end", "def create\n @comment = @item.comments.new(params[:comment])\n \n if logged_in?\n @comment.user = current_user\n else\n @comment.byline = \"Anonieme Bangerd\" if @comment.byline.empty?\n @comment.content = @comment.content.gsub(/((<a\\s+.*?href.+?\\\".*?\\\")([^\\>]*?)>)/, '\\2 rel=\"nofollow\" \\3>')\n \n unless verify_recaptcha\n @item.errors.add(\"Word\")\n flash.now[:notice] = \"Je reactie kon niet geplaatst worden. Scroll naar beneden, corrigeer en probeer het opnieuw. Heb je de CAPTCHA correct overgetikt?\"\n render :template => 'items/show'\n return\n end\n end \n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Reactie is succesvol geplaatst.'\n format.html { redirect_to(@comment.item) }\n format.xml { render :xml => @comment, :status => :created, :location => @comment }\n else\n flash.now[:notice] = \"Je reactie kon niet geplaatst worden. Scroll naar beneden, corrigeer en probeer het opnieuw.\"\n format.html { render :template => 'items/show' }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @comment = @codebank.comments.build\n impressionist(@codebank, \"message...\") if !user_signed_in? or (user_signed_in? and current_user != @codebank.writer)\n end", "def commentable_user\n current_user\n end", "def show\n @message = Message.find(params[:id])\n if user_signed_in?\n @new_comment = Comment.build_from(@message, current_user.id, \"\")\n end\n #@user_who_commented = current_chef\n #@comment = Comment.build_from( @message, @user_who_commented.id, \"\" )\n end", "def accept_comments?\n !locked?\n end", "def create\n @comment = @snippet.comments.build(comment_params)\n @comment.user = current_user\n\n respond_to do |format|\n if @comment.save\n unless @comment.snippet.user == current_user\n Resque.enqueue(CommentMailerWorker, @comment.id)\n end\n format.html { redirect_to @comment.snippet, notice: 'Comment was successfully created.' }\n format.json { render :show, status: :created, location: @comment }\n else\n format.html { render @comment.snippet }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def congratulate_for_accepted_comment(comment)\n @comment = comment\n @structure = @comment.structure\n @admin = @structure.admin\n @conversation = @comment\n mail to: @comment.commentable.contact_email,\n subject: \"Vous avez reçu un avis de #{@comment.author_name}\",\n reply_to: generate_reply_to('admin', 'comment')\n end", "def find_commentable\n @commentable = Micropost.find_by_id(params[:comment][:micropost_id])\n if params[:comment][:comment_id]\n @commentable = Comment.find_by_id(params[:comment][:comment_id]) if params[:comment][:comment_id]\n end\n end", "def comment comment\n end", "def comment\n if logged_in?\n if params[:comment]\n @comment = Comment.new(params[:comment])\n @comment.user_id = current_user.id\n @comment.save\n \n @user = current_user\n \n \t#look up the answerer \n @answer = Question.find(@comment.parent_id)\n @answer_user = User.find(@answer.user_id)\n @notified_user = get_user_to_be_notified(5,@answer_user)\n\n #This will allow this method to send emails for questions and answers\n if(@answer.parentid > 0)\n @question = Question.find(@answer.parentid)\n\n if(@notified_user != nil)\n UserMailer.deliver_new_comment(@answer_user,@comment, @question)\n end\n else\n if(@notified_user != nil)\n UserMailer.deliver_new_comment(@answer_user,@comment, @answer)\n end\n\n end\n \n respond_to do |format|\n flash[:notice] = 'Your comment was submitted successfully.'\n \n format.html { redirect_to(:back)}\n format.xml { render :xml => @comment }\n end\n end\n else\n flash[:notice] = 'Your must login or create an account to comment to a question.'\n redirect_to :controller => 'account', :action => 'login'\n end\n end", "def can_be_commented?\n hash.key?('comments_url') && hash.key?('comments_count')\n end", "def comment?; end", "def comment?; end", "def commented_by?(person)\n !!self.comments.find(:first, :conditions => [\"comments.person_id = ?\", person.id])\n end", "def set_spam_comment\n @spam_comment = SpamComment.find(params[:id])\n end", "def permitted_to_comment?(user)\n self.is_writable? && self.is_commentable? && self.permitted_to_read?(user)\n end", "def allows_comment?(a_person=nil)\n self.alive?\n end", "def newcomment_mail(comment)\n @comment = comment.contentcom\n @email = User.find(comment.user_id).email\n @fname = User.find(comment.user_id).fname\n @lname = User.find(comment.user_id).lname\n @url = 'http://minervasi.co/login'\n mail(to: [\"[email protected]\"], subject: 'User comment')\n end", "def redmine_add_comment(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tresulted_task = redmine_check_task(m, params, certificate)\n\t\t\tif ! resulted_task.nil?\n\t\t\t\t# Best way to save text line\n\t\t\t\tmessageEntry = params[:message].to_s.strip\n\t\t\t\t# Ajout d'un commentaire\n\t\t\t\tresulted_task.notes = messageEntry\t\n\t\t\t\t# Save an issue\n\t\t\t\tif ! resulted_task.save\n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\[email protected] m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasnotbeenupdated}\"\n\t\t\t\telse \n\t\t\t\t\t# on indique à l'utilisateur\n\t\t\t\t\[email protected] m.replyto, \"#{certificate[:username]}, #{@redmine_l_thetask} ##{resulted_task.id} #{@redmine_l_hasbeenupdated} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{resulted_task.id}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tm.reply \"#{@redmine_l_thetask} ##{params[:task]} #{@redmine_l_doesnotexistsinredmine}\"\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end", "def user_want_notified_new_comment user_eject\n EntrMissionUser\n .includes(:user)\n .where(\"entr_mission_users.mission_id = ? AND users.mail_comments = ? AND users.id != ?\", \n self.id, \n true, \n user_eject.id)\n .collect { |l| l.user }\n end", "def edited_comment_notification(user_id, comment_id)\n user = User.find(user_id)\n @comment = Comment.find(comment_id)\n mail(\n :to => user.email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Edited comment on \" + @comment.ultimate_parent.commentable_name.gsub(\"&gt;\", \">\").gsub(\"&lt;\", \"<\")\n )\n end", "def watch_comment_by_user_ids\n self.watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n end", "def item_comment(comment, recipient)\n @comment = comment\n @recipient = recipient\n @commentable = comment.commentable\n mail(:to => \"#{recipient.name} <#{recipient.email}>\", :subject => \"A User has just left a comment on your #{comment.commentable.class.to_s}\")\n end", "def comment_sent_notification(comment_id)\n @comment = Comment.find(comment_id)\n @noreply = true # don't give reply link to your own comment\n mail(\n :to => @comment.comment_owner_email,\n :subject => \"[#{ArchiveConfig.APP_NAME}] Comment you left on \" + @comment.ultimate_parent.commentable_name.gsub(\"&gt;\", \">\").gsub(\"&lt;\", \"<\")\n )\n end", "def comments\n object.comments.where(:user_id => current_user)\n end", "def comment_has_been_validated(comment)\n @comment = comment\n @user = comment.user\n @structure = @comment.structure\n mail to: @comment.email, subject: \"Votre avis est maintenant visible\"\n end", "def validate_comment(comment)\n if comment.content.length < Loudmouth.min_comment_length\n flash[:error] = \"Comments must be at least #{Loudmouth.min_comment_length} characters in length.\"\n return false\n end\n \n if Loudmouth.max_comment_length > 0 and\n comment.content.length > Loudmouth.max_comment_length\n flash[:error] = \"Comments cannot be more than #{Loudmouth.max_comment_length} characters in length.\"\n return false\n end\n true\n end", "def directed_at(other_user_id, options={})\n parse_comments(request(singular(id) + \"comments\" + other_user_id.to_s, options))\n end", "def create\n @comment = @song.comments.new(params[:comment])\n @comment.user = current_user\n @comment.flagged = false\n\n if @comment.save\n redirect_to song_path(@song)\n else\n redirect_to song_path(@song), notice: \"comment not saved\"\n end\n \n end", "def comment_params\n params.require(:comment).permit(:user_id, :blog_id, :content)\n end", "def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end", "def comment_anniversary(comment)\n return if comment.user.nil?\n return unless comment.user.email_newsletter_opt_in\n @comment = comment\n @user = comment.user\n @structure = @comment.structure\n mail to: @comment.email, subject: \"Un an déjà... bon anniversaire !\"\n end", "def comment_params\n params.require(:comment).permit(:user_id, :body)\n end", "def feedback(user_id_param)\n if user_id == user_id_param\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type = ?\", id, 'Screen', 5])\n else\n Comment.find(:all, :order => \"created_at DESC\", :conditions => [\"commentable_id = ? AND commentable_type = ? AND comment_type = ? AND user_id = ?\", id, 'Screen', 5, user_id_param])\n end\n end", "def check_spam( options = {} )\n before_action :set_akismet_params_on_record, only: options[:only], except: options[:except]\n\n define_method( :set_akismet_params_on_record ) do\n return unless record = instance_variable_get( \"@\" + options[:instance].to_s )\n # if we checking for spam when creating / updating a user and the\n # current user is not that user (e.g. curator or admin action), we\n # don't want to send akismet the current user's info\n if record.is_a?( User ) && current_user && current_user != record\n return\n end\n # No point in setting this info if we know this user isn't a spammer\n return if current_user && current_user.known_non_spammer?\n record.acts_as_spammable_user_ip = Logstasher.ip_from_request_env( request.env )\n record.acts_as_spammable_user_agent = request.user_agent\n record.acts_as_spammable_referrer = request.referrer\n end\n end", "def ensure_not_spam!(params, feedback_form)\n if spam?(params[:content], params[:title])\n flash[:error] = t(\"layouts.notifications.feedback_considered_spam\")\n return render_form(feedback_form)\n else\n false\n end\n end", "def comment(text)\n comments.create!(user_id: current_user.id,\n content: text)\n end", "def comment_params\n params[:comment][:user_id] ||= current_user.id if params[:comment]\n params.require(:comment).permit(:body, :user_id)\n end", "def comment_params\n params.require(:comment).permit(:user_id, :micropost_id, :content)\n end", "def show\n @user = User.find_by_username(params[:id]) || raise_404\n raise_404 if @user.id == 122 # the id of [deleted] user\n\n @comments = @user.comments.order(:karma).reverse_order.limit(5)\n # @participated = Ama.where(id: @comments.map(&:ama_id)).where.not(id: @user.amas)\n\n respond_to do |format|\n format.html { if @user.belongs_to_only_one_op? then redirect_to op_path(@user.ops.first) end }\n end\n end", "def dislike\n @comment.disliked_by current_user\n end", "def comment_params\n params.require(:comment).permit(:post_id, :body, :user_id)\n end", "def comment_params\r\n params.require(:comment).permit(:user_id, :post_id, :body)\r\n end", "def new_comment_notification(comment)\n\n blog = Post.find comment.post_id\n sender = User.find comment.user_id\n blog_owner = User.find blog.user_id\n #@subscribe = Subscribe.find :all, :conditions => [\"model_id = ? and model_type = ?\",blog.id, \"Post\"],:select => [\"user_id\"]\n #@subscribers = User.find :all, :conditions => [\"id in (?)\",@subscribe], :select => [\"email\"]\n setup_email(blog_owner)\n\n @subject += \"У ваc новый комментарий\"\n\n body[:comment]= comment\n body[:from_who] = sender\n body[:url] = RAILS_URL + \"posts/show/#{comment.post_id}#comments\"\n\n end" ]
[ "0.7010616", "0.68067414", "0.6707428", "0.6690456", "0.662083", "0.64736736", "0.64639485", "0.6441988", "0.64373755", "0.6390721", "0.6315077", "0.6279278", "0.6205962", "0.6182887", "0.61715144", "0.61646914", "0.6125215", "0.6101237", "0.6079182", "0.6046708", "0.60342026", "0.6030325", "0.60223484", "0.60189116", "0.60063374", "0.599825", "0.5988376", "0.597563", "0.59740645", "0.5958247", "0.59577906", "0.5955609", "0.5902626", "0.5899614", "0.58884627", "0.5871705", "0.5851874", "0.5832463", "0.58316964", "0.5829527", "0.5808371", "0.5797933", "0.5785387", "0.5776196", "0.5772087", "0.5770985", "0.576766", "0.57567775", "0.57548654", "0.5752734", "0.5747867", "0.5742976", "0.5730555", "0.5727552", "0.57162946", "0.57129526", "0.57005024", "0.5699998", "0.5697786", "0.56975657", "0.5694005", "0.56924736", "0.5688381", "0.5680028", "0.56741005", "0.5670068", "0.5657332", "0.56452197", "0.5637804", "0.5637804", "0.5636805", "0.5631932", "0.5628507", "0.56201524", "0.5614586", "0.55995065", "0.55985683", "0.5590664", "0.5587123", "0.5586532", "0.5582311", "0.55724484", "0.55715436", "0.5569318", "0.55658025", "0.55650365", "0.5562656", "0.55577964", "0.5552846", "0.5549474", "0.55486834", "0.55460745", "0.5541713", "0.5528581", "0.5528217", "0.55264914", "0.552477", "0.5513866", "0.5513107", "0.5507451", "0.5507311" ]
0.0
-1
GET /prescription_rows GET /prescription_rows.json
def index @prescription_rows = PrescriptionRow.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n render 'rows.html'\n end", "def rows\r\n @all_rows\r\n end", "def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end", "def rows\n RowCollection.new(@data)\n end", "def rows\n return @rows\n end", "def index\n @transcriptions = Transcription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transcriptions }\n end\n end", "def rows\n @rows.lazy\n end", "def rows\n (report[\"data\"][\"rows\"] || []).map { |row| Row.new(self, row) }\n end", "def index\n @users_prescriptions = UsersPrescription.all\n end", "def set_prescription_row\n @prescription_row = PrescriptionRow.find(params[:id])\n end", "def rows\n @rows ||= if ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n result.entries\n else\n [].tap do |row_hashes|\n result.entries.map do |row|\n hash = {}\n result.fields.each do |field|\n hash[field] = row[result.fields.index(field)]\n end\n row_hashes << hash\n end\n end\n end\n end", "def index\n @invoice_rows = @invoice.invoice_rows\n end", "def rows \n @r\n end", "def index\n @prescriptions = Prescription.all\n end", "def rows(parts=@parts)\n \n @renderer.rows(parts)\n \n end", "def rows\n @array\n end", "def index\n # @cd = DisDatasource.all\n a = DisDatasource.paginate(:page => params[:page], :per_page => 10).order(:id)\n rowcount = a.count\n a = a.as_json\n rows = [{\"rows\" => rowcount}]\n result = {\"raw\" => a ,\"count\" => rows}\n # n = c.to_a << @m\n respond_with result\n end", "def results_with_rows\n load_from_rows(@dataset.all, true)\n end", "def get_promotions_list\n # get params for paging\n unless params[:id].blank?\n @client_id = params[:id]\n else\n @client_id = @clients[0].id\n end\n\n rows = Array.new\n rows = get_rows(Promotion.get_by_client(@client_id).active.\n order_id_desc.page(params[:page]).per(params[:rp]), @client_id)\n count = Promotion.get_by_client(@client_id).active.order_by_promotion_name.count\n\n render json: {page: params[:page], total: count, rows: rows}\n end", "def index\n @prescription_details = PrescriptionDetail.all\n end", "def all_rows\n @rows\n end", "def get_rows(solrparams, params)\n params.key?(:rows) ? solrparams.merge!(:rows => params[:rows]) : solrparams.merge!(:rows => 100000000) # if user passes in the rows they want, use that, else just return everything\n end", "def search_results_table_rows\n search_results_table.rows_text\n end", "def rows(transcoder = self.transcoder)\n @rows.lazy.map { |row| transcoder.decode(row, 0) }\n end", "def rows\n self.choice_questions.includes(:question_content).includes(:choice_answers)\n end", "def ug_resource_details_table_rows\n ug_resources_details_table.rows_text[1..-2]\n end", "def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end", "def show_row\n @dataset = Dataset.find(params[:dataset_id])\n if params[:row_id].gsub(/[0-9]/,\"\").length == 0 #il n'y a que des chiffres\n @data = ActiveRecord::Base.connection.select_one(\"SELECT * from dataset_#{@dataset.id} WHERE id = #{params[:row_id]} LIMIT 1\")\n render :inline => @data.to_json \n else\n render :text => 'Invalid parameters'\n end\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def row\n get_row\n respond_to_action(:row)\n end", "def create\n @prescription_row = PrescriptionRow.new(prescription_row_params)\n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n\n respond_to do |format|\n if @prescription_row.save\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully created.' }\n format.json { render :show, status: :created, location: @prescription_row }\n else\n format.html { render :new }\n format.json { render json: @prescription_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @rows = Row.all\n end", "def index\n @section_rows = SectionRow.all\n end", "def rows rows_results = nil\n res = rows_results || results\n\n if res.blank?\n body_content << \"<td>#{FOUND_NO_DATABASE_ISSUES}</td>\" << \"\\n\"\n return\n end\n\n res.each do |object|\n row object, *yield(object)\n end\n end", "def index\n # @notas = Nota.paginate(:page => params[:page], :per_page => params[:rows])\n find_nota\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notas }\n end\n end", "def wikidata_rows\n sparql_client = SPARQL::Client.new(\n \"https://query.wikidata.org/sparql\",\n method: :get,\n headers: { 'User-Agent': \"Connor's Random Ruby Scripts Data Fetcher/1.0 ([email protected]) Ruby 3.1\" }\n )\n\n # Get the response from the Wikidata query.\n rows = sparql_client.query(sparql_query)\n\n rows.map! do |row|\n key_hash = row.to_h\n {\n name: key_hash[:itemLabel].to_s,\n wikidata_id: key_hash[:item].to_s.sub('http://www.wikidata.org/entity/Q', ''),\n steam_app_id: key_hash[:steamAppId].to_s.to_i\n }\n end\n\n rows\nend", "def rows(options = {})\n if options[:verify]\n verified_rows\n else\n @rows ||=\n begin\n rows = super\n has_query_facets = !rows.empty?\n if @search.facet_response['facet_fields']\n if data = @search.facet_response['facet_fields'][key]\n data.each_slice(2) do |value, count|\n row = FacetRow.new(@field.cast(value), count, self)\n rows << row\n end\n end\n end\n sort_rows!(rows) if has_query_facets\n rows\n end\n end\n end", "def rows\n @rows ||= csv_rows[1..-1]\n end", "def rows\n @rows ||= csv_rows[1..-1]\n end", "def data_rows\n @rows[@num_header_rows..-1]\n end", "def rows\r\n assert_exists\r\n arr_rows = get_rows\r\n table_rows = Array.new(arr_rows.length)\r\n for i in 0..arr_rows.length - 1 do\r\n table_rows[i] = TableRow.new(@container, :jssh_name, arr_rows[i])\r\n end\r\n return table_rows\r\n end", "def index\n @aquizitions_rows = AquizitionsRow.all\n end", "def show\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @infographic.to_json(:include => :rows) }\n end\n end", "def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def get_technician_results_for_page(page: 1)\n response = @http_client.get(@url + \"&per_page=25&page=#{page}\")\n json = response.body\n JSON.parse json\n end", "def getRows\n return @grid.getRows\n end", "def index\n @inscriptions = Inscription.all\n end", "def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend", "def rows\n Array.new self\n end", "def index\n render :json => UserInterest.all\n end", "def rows\n fail \"Implement #{self.class}#rows\"\n end", "def to_response\n slice(:id, :username, :cash, :referrals).to_json\n end", "def index\n @prescription_medicines = PrescriptionMedicine.where(prescription_id: params[:prescription_id])\n end", "def rows=(value)\n @rows = value\n end", "def index\n @journal_entries = JournalEntry.desc(:entry_date).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n # [{\"name\":\"temperature\",\"type\":\"areaspline\",\"data\":[[1327213807000,0],[1327214100000,0],[1327214403000,0],[1327214700000,0],[1327215000000,24],[1327215301000,59.8],[1327215603000,95.4],[1327215901000,120.8],[1327216202000,131.6]]}]\n format.json { render json: JournalEntry.all.as_json(only: [:purity, :fitness, :devotional, :chrissy, :relational, :discipline, :facepicking, :stress]) }\n end\n end", "def load_rows\n @rows = document.xpath('//td[@id=\"search_table_wrapper\"]//tr')\n raise(PageParserNoRowException.new()) if rows.size.zero?\n end", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def rows\n @rows ||=\n begin\n rows = []\n @facet_values.each_slice(2) do |pair|\n rows << new_row(pair)\n end\n rows\n end\n end", "def show\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n with src AS (SELECT daughters(ear_num)\n FROM kine WHERE id = #{params[:id]})\n select json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n end\n end", "def rows(opts={'start' => nil, 'limit' => nil})\n Cursor.new({'collection' => link('rows'),\n 'start' => opts['start'],\n 'limit' => opts['limit']}.update(@opts))\n end", "def rows\n @columns.each do |column|\n @rows << Array.new(@columns.size) do |i|\n \"#{column}#{i + 1}\"\n end\n end\n @rows\n end", "def enrolled_patients\n begin\n patients = enroller_table_data(params, current_user)\n rescue InvalidQueryError => e\n return render json: e, status: :bad_request\n end\n\n render json: patients\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end", "def ug_resource_details_table_rows\n ug_resources_details_table.rows_text[1..-2].delete_if{ |row| row.first.empty?}\n end", "def table_rows(table)\n table.xpath('.//tr').drop 1\n end", "def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end", "def prescription_row_params\n params.require(:prescription_row).permit(:id_prescription, :id_product, :dose_per_ha)\n end", "def rows\n @rows ||= star_file.sheets.first.rows\n end", "def rows(range = 'Sheet1!A1:E')\n get_spreadsheet_data('1eu1Dk67gKnrIgQQ9Fm0Y-RCMzRfZf1UaTQzEt7hjWp0', range)\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end", "def rows\n links.map { |link| link.row }\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 index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def row; end", "def license_details_table_rows\n resources_details_tables[1].rows_text\n end", "def index\n @ice_classs =IceClass.all\n render :json => {:successful=>true, :total=>@ice_classs.length, :data=> @ice_classs }\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def rows()\n ([email protected](GRT_COLROW)) ? cr[1] : nil\n end", "def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.json {\n @interviews = Interview.select(\"annotations, interviews.id, interviews.slug, storyteller_name\").where(\"is_demo = ? AND annotations != ?\", 0, \"\")\n render json: @interviews\n }\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def index\n trips = Trip.all\n render json: trips\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def rows\n @rows ||= begin\n row_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def rows\n 1\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def rows\n rows = []\n unless columns.empty?\n 0.upto(columns.first.items.last_i) do |rnum|\n row = {}\n columns.each do |col|\n row[col.header] = col[rnum]\n end\n rows << row\n end\n end\n rows\n end", "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def scubooks\n sections = Section.all\n render json: sections\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: InvoiceDrugsDatatable.new(params, view_context: view_context) }\n end\n end" ]
[ "0.6478178", "0.6422939", "0.6422939", "0.6422939", "0.6280199", "0.61504316", "0.6112614", "0.60659045", "0.6045267", "0.6002428", "0.5982811", "0.5894429", "0.587916", "0.5870322", "0.58657676", "0.58511263", "0.583577", "0.5819273", "0.5818478", "0.57955325", "0.5757333", "0.5720812", "0.5673389", "0.5664047", "0.5651166", "0.56416595", "0.56185454", "0.558698", "0.55379796", "0.55335623", "0.55254066", "0.5523088", "0.55142033", "0.54894024", "0.54879", "0.54761124", "0.54628676", "0.5455517", "0.5440607", "0.5437951", "0.541822", "0.5409572", "0.5409572", "0.5390568", "0.53706217", "0.53699356", "0.53629076", "0.5358735", "0.5349482", "0.53463995", "0.53411734", "0.53389055", "0.5337393", "0.5334185", "0.53210235", "0.53108764", "0.53034794", "0.5301854", "0.53004247", "0.5298232", "0.52850527", "0.5281788", "0.52681696", "0.52607614", "0.5247499", "0.5239765", "0.5228722", "0.52264005", "0.5226106", "0.52091736", "0.5207999", "0.52010125", "0.5198565", "0.5193795", "0.51907694", "0.5190539", "0.5186878", "0.5175693", "0.51697737", "0.5168438", "0.5160619", "0.5156539", "0.5150297", "0.5144007", "0.51439625", "0.514357", "0.5140492", "0.51297843", "0.5128702", "0.51241004", "0.5121392", "0.5121292", "0.5121292", "0.5120674", "0.51180714", "0.51134187", "0.5110794", "0.51054424", "0.50937986", "0.50927794" ]
0.72599727
0
GET /prescription_rows/1 GET /prescription_rows/1.json
def show @products=Product.where("id<?",100000000) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @prescription_rows = PrescriptionRow.all\n end", "def set_prescription_row\n @prescription_row = PrescriptionRow.find(params[:id])\n end", "def show_row\n @dataset = Dataset.find(params[:dataset_id])\n if params[:row_id].gsub(/[0-9]/,\"\").length == 0 #il n'y a que des chiffres\n @data = ActiveRecord::Base.connection.select_one(\"SELECT * from dataset_#{@dataset.id} WHERE id = #{params[:row_id]} LIMIT 1\")\n render :inline => @data.to_json \n else\n render :text => 'Invalid parameters'\n end\n end", "def rows\n @rows\n end", "def create\n @prescription_row = PrescriptionRow.new(prescription_row_params)\n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n\n respond_to do |format|\n if @prescription_row.save\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully created.' }\n format.json { render :show, status: :created, location: @prescription_row }\n else\n format.html { render :new }\n format.json { render json: @prescription_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def index\n @transcriptions = Transcription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transcriptions }\n end\n end", "def rows\n render 'rows.html'\n end", "def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end", "def index\n @prescription_details = PrescriptionDetail.all\n end", "def row\n get_row\n respond_to_action(:row)\n end", "def index\n @prescriptions = Prescription.all\n end", "def index\n # @cd = DisDatasource.all\n a = DisDatasource.paginate(:page => params[:page], :per_page => 10).order(:id)\n rowcount = a.count\n a = a.as_json\n rows = [{\"rows\" => rowcount}]\n result = {\"raw\" => a ,\"count\" => rows}\n # n = c.to_a << @m\n respond_with result\n end", "def index\n @invoice_rows = @invoice.invoice_rows\n end", "def index\n @users_prescriptions = UsersPrescription.all\n end", "def show\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @infographic.to_json(:include => :rows) }\n end\n end", "def rows\n RowCollection.new(@data)\n end", "def rows\r\n @all_rows\r\n end", "def show\n @transcription = Transcription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transcription }\n end\n end", "def show\n @tgl_row = TglRow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tgl_row }\n end\n end", "def rows \n @r\n end", "def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end", "def rows\n @rows.lazy\n end", "def rows\n @array\n end", "def show\n if (params[:redirect] == \"on\")\n sql = <<-SQL\n with src AS (SELECT daughters(ear_num)\n FROM kine WHERE id = #{params[:id]})\n select json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n end\n end", "def index\n @prescription_medicines = PrescriptionMedicine.where(prescription_id: params[:prescription_id])\n end", "def rows\n return @rows\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end", "def to_response\n slice(:id, :username, :cash, :referrals).to_json\n end", "def destroy\n \n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n @prescription_row.destroy\n respond_to do |format|\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def rows\n @rows ||= if ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n result.entries\n else\n [].tap do |row_hashes|\n result.entries.map do |row|\n hash = {}\n result.fields.each do |field|\n hash[field] = row[result.fields.index(field)]\n end\n row_hashes << hash\n end\n end\n end\n end", "def get_promotions_list\n # get params for paging\n unless params[:id].blank?\n @client_id = params[:id]\n else\n @client_id = @clients[0].id\n end\n\n rows = Array.new\n rows = get_rows(Promotion.get_by_client(@client_id).active.\n order_id_desc.page(params[:page]).per(params[:rp]), @client_id)\n count = Promotion.get_by_client(@client_id).active.order_by_promotion_name.count\n\n render json: {page: params[:page], total: count, rows: rows}\n end", "def get_patient\n @patient = Patient.pluck(:id,:name)\n render json: @patient\n end", "def index\n # @notas = Nota.paginate(:page => params[:page], :per_page => params[:rows])\n find_nota\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notas }\n end\n end", "def index\n \n respond_to do |format|\n format.html # index.html.erb\n format.json {\n @interviews = Interview.select(\"annotations, interviews.id, interviews.slug, storyteller_name\").where(\"is_demo = ? AND annotations != ?\", 0, \"\")\n render json: @interviews\n }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def row; end", "def index\n @precincts = Precinct.all(:order => \"number\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @precincts }\n end\n end", "def rows\n 1\n end", "def update\n \n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n respond_to do |format|\n if @prescription_row.update(prescription_row_params)\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully updated.' }\n format.json { render :show, status: :ok, location: @prescription_row }\n else\n format.html { render :edit }\n format.json { render json: @prescription_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end", "def rows(parts=@parts)\n \n @renderer.rows(parts)\n \n end", "def show\n @java_dynamic_row = JavaDynamicRow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @java_dynamic_row }\n end\n end", "def get_technician_results_for_page(page: 1)\n response = @http_client.get(@url + \"&per_page=25&page=#{page}\")\n json = response.body\n JSON.parse json\n end", "def index\n @journal_entries = JournalEntry.desc(:entry_date).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n # [{\"name\":\"temperature\",\"type\":\"areaspline\",\"data\":[[1327213807000,0],[1327214100000,0],[1327214403000,0],[1327214700000,0],[1327215000000,24],[1327215301000,59.8],[1327215603000,95.4],[1327215901000,120.8],[1327216202000,131.6]]}]\n format.json { render json: JournalEntry.all.as_json(only: [:purity, :fitness, :devotional, :chrissy, :relational, :discipline, :facepicking, :stress]) }\n end\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end", "def index\n render :json => UserInterest.all\n end", "def index\n @rows = Row.all\n end", "def ug_resource_details_table_rows\n ug_resources_details_table.rows_text[1..-2]\n end", "def index\n # @cd = DisAlcoholInteraction.all\n a = DisAlcoholInteraction.paginate(:page => params[:page], :per_page => 3).order(:id)\n @m = array = []\n a.each do |m|\n # user = User.where(id: m.user_two).last\n h = {}\n h[\"id\"] = m.id\n h[\"name\"] = m.name\n h[\"description\"] = m.description\n h[\"datasource_id\"] = m.datasource_id\n\n # Start - Logic to lookup for data source name\n if m.datasource_id\n @DisDatasource = DisDatasource.where(id:m.datasource_id).last\n # Above m.status_id has value 1 and @DisStatus is an object\n h[\"datasource_name\"] = @DisDatasource.name\n else\n h[\"datasource_name\"] =\"No Data\"\n end\n # End - Logic to lookup for data source name\n array << h\n end\n rowcount = a.count\n a = a.as_json\n rows = [{\"rows\" => rowcount}]\n result = {\"raw\" => a ,\"count\" => rows , \"final\" => @m}\n # n = c.to_a << @m\n respond_with result\n end", "def index\n @creations = Creation.where(user_id: params[:user_id])\n\n render json: @creations\n end", "def index\n @requisitions = Requisition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitions }\n end\n end", "def index\n @inscriptions = Inscription.all\n end", "def results_with_rows\n load_from_rows(@dataset.all, true)\n end", "def get_rows(solrparams, params)\n params.key?(:rows) ? solrparams.merge!(:rows => params[:rows]) : solrparams.merge!(:rows => 100000000) # if user passes in the rows they want, use that, else just return everything\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def index\n @section_rows = SectionRow.all\n end", "def show\n @inscriptionprepaconcour = Inscriptionprepaconcour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inscriptionprepaconcour }\n end\n end", "def show\n @rowempl = Rowempl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rowempl }\n end\n end", "def get_row_by_id(id)\n require_relative 'datarow'\n DataRow.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/rows/#{id}\"))\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: InvoiceDrugsDatatable.new(params, view_context: view_context) }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def show_dataset\n @dataset = Dataset.find(params[:dataset_id])\n @data = (ActiveRecord::Base.connection.select_all(\"SELECT * from dataset_#{@dataset.id} ORDER BY id ASC\")).to_json\n render :inline => @data\n end", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def rows\n @rows ||= csv_rows[1..-1]\n end", "def rows\n @rows ||= csv_rows[1..-1]\n end", "def prescription_row_params\n params.require(:prescription_row).permit(:id_prescription, :id_product, :dose_per_ha)\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def index\n @aquizitions_rows = AquizitionsRow.all\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def index\n @publication_types = PublicationType.find(:all, :conditions => {:client_id => session[:client_id]})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @publication_types }\n end\n end", "def search\n render json: PersonScantronAppointment.first(10)\n end", "def index\n @participant_ratings = ParticipantRating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_ratings }\n end\n end", "def wikidata_rows\n sparql_client = SPARQL::Client.new(\n \"https://query.wikidata.org/sparql\",\n method: :get,\n headers: { 'User-Agent': \"Connor's Random Ruby Scripts Data Fetcher/1.0 ([email protected]) Ruby 3.1\" }\n )\n\n # Get the response from the Wikidata query.\n rows = sparql_client.query(sparql_query)\n\n rows.map! do |row|\n key_hash = row.to_h\n {\n name: key_hash[:itemLabel].to_s,\n wikidata_id: key_hash[:item].to_s.sub('http://www.wikidata.org/entity/Q', ''),\n steam_app_id: key_hash[:steamAppId].to_s.to_i\n }\n end\n\n rows\nend", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n if params[:id].present?\n @prescription = Prescription.find_by_id(params[:id].to_i)\n if @prescription.present?\n @order = @prescription.order\n render 'prescriptions/detail'\n else\n @prescriptions = Prescription.all\n render :index\n end\n end\n @prescriptions = Prescription.all\n @new_prescriptions = @prescriptions.where(status: 'Pending')\n @sent_prescriptions = @prescriptions.where(status: 'Proceed').order(:id)\n @reject_prescriptions = @prescriptions.where(status: 'Reject').order(:id)\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend", "def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end", "def show\n @prescription = Prescription.find(params[:id])\n end", "def show\n\n @Cliente = Client.where(bill_id: params[:id])\n @Cliente.each do |mitad|\n mitad.ISV = mitad.ISV.round(2)\n mitad.Total = mitad.Total.round(2)\n end\n# @Cliente = Client.find_by_sql(['SELECT * FROM clients WHERE bill_id = ?',:id])\n render json: @Cliente\n end", "def import_row(data) #TODO: Research use\n return @client.raw(\"post\", \"/config/importers/import_row\", nil, data)\n end", "def index\n trips = Trip.all\n render json: trips\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def index\n @trips = Trip.all\n\n render json: @trips\n end", "def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end", "def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end", "def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def index_json\n @ni = Note.all\n p = params()\n if (p.has_key?(\"lat\") && p.has_key?(\"lon\"))\n @ni = notes_in_range(p['lat'].to_f, p['lon'].to_f)\n end\n @notes = @ni\n\n render :json => @notes.to_json( )\n end", "def index\n @samples = Sample.all\n # selecionar data de recepcao\n if params[:query].present?\n if params[:query][:start_time_recepcao].present?\n date = params[:query][:start_time_recepcao].to_date\n @samples = @samples.where(\"data_recepcao >= ?\", date)\n end\n if params[:query][:end_time_recepcao].present?\n date = params[:query][:end_time_recepcao].to_date\n @samples = @samples.where(\"data_recepcao <= ?\", date)\n end\n\n # selecionar data de liberacao\n if params[:query][:start_time_liberacao].present?\n date = params[:query][:start_time_liberacao].to_date\n @samples = @samples.where(\"data_liberacao >= ?\", date)\n end\n if params[:query][:end_time_liberacao].present?\n date = params[:query][:end_time_liberacao].to_date\n @samples = @samples.where(\"data_liberacao <= ?\", date)\n end\n\n # Será utilizado para verificar quais tabelas serão mostradas ao usuário parametros tabela samples\n search_fields = {\n status: 'samples',\n programa: 'samples',\n matriz: 'samples',\n area_analitica: 'samples',\n rg: 'rg',\n name: 'client',\n city: 'client',\n state: 'client',\n codigo_rejeicao: 'rejection_reasons'\n }\n search_fields.each do |key, value|\n if value == 'client'\n item = \"client_#{key.to_s}\".to_sym\n else\n item = key\n end\n if params[:query][:end_time_liberacao].present?\n date = params[:query][:end_time_liberacao].to_date\n @samples = @samples.where(\"data_liberacao <= ?\", date)\n end\n end\n\n # Será utilizado para verificar quais tabelas serão mostradas ao usuário parametros tabela samples\n search_fields = {\n status: 'samples',\n programa: 'samples',\n matriz: 'samples',\n area_analitica: 'samples',\n rg: 'rg',\n name: 'client',\n city: 'client',\n state: 'client',\n codigo_rejeicao: 'rejection_reasons'\n }\n search_fields.each do |key, value|\n if value == 'client'\n item = \"client_#{key.to_s}\".to_sym\n else\n item = key\n end\n if params[:query][item].present?\n case value\n when 'rg'\n @samples = @samples.where('rg ILIKE ?', \"%#{params[:query][:rg]}%\")\n when 'samples'\n @samples = @samples.where(key => params[:query][item])\n when 'client'\n @samples = @samples.includes(:client).where(\"clients.#{key.to_s}\".to_sym => params[:query][item])\n when 'rejection_reasons'\n @samples = @samples.includes(:rejection_reasons).where(\"rejection_reasons.codigo\".to_sym => params[:query][:codigo_rejeicao]).references(:rejection_reasons)\n end\n end\n end\n end\n @quantidade = @samples.count\n @samples_export = @samples\n export(@samples_export)\n @samples = @samples.page(params[:page])\n end", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { \n invoice = Invoice.find(params[:invoice_id]) \n records = JqxConverter.jqxGrid(invoice.invoice_line_items)\n\n render json: records\n }\n end\n end", "def index\n\n @category_subscriptions = CategorySubscription.all\n\n render json: @category_subscriptions\n\n end" ]
[ "0.71127987", "0.63060755", "0.62820715", "0.61719143", "0.6120837", "0.6033352", "0.6033352", "0.6033352", "0.602832", "0.59287435", "0.58512247", "0.58153886", "0.57445663", "0.571086", "0.5702518", "0.56980884", "0.565374", "0.56497526", "0.5636128", "0.56186014", "0.5511727", "0.5506674", "0.5486775", "0.5460418", "0.5437752", "0.54286474", "0.5423747", "0.54214525", "0.54069483", "0.5402376", "0.54003906", "0.5399259", "0.5393314", "0.53651863", "0.53647226", "0.53627586", "0.53613085", "0.5359027", "0.5354677", "0.5342834", "0.5340657", "0.53376806", "0.5333618", "0.53315413", "0.5319029", "0.53187585", "0.53182405", "0.53171813", "0.5310024", "0.530589", "0.53002125", "0.5298396", "0.5294575", "0.5289951", "0.52849674", "0.5284007", "0.5275341", "0.5272765", "0.52471405", "0.5238023", "0.5237504", "0.5235825", "0.52350324", "0.52341163", "0.52274483", "0.5225281", "0.5212535", "0.5200835", "0.519734", "0.51912546", "0.51887554", "0.51887554", "0.51861906", "0.5182706", "0.51757896", "0.51749974", "0.51657563", "0.5161326", "0.51559436", "0.51491517", "0.5137779", "0.51255924", "0.5124398", "0.5117679", "0.5117192", "0.51140344", "0.5111958", "0.51117945", "0.5111591", "0.5111297", "0.51111066", "0.51111066", "0.5108517", "0.510631", "0.5101775", "0.51012933", "0.5099462", "0.50984126", "0.50929254", "0.5092747", "0.5088822" ]
0.0
-1
POST /prescription_rows POST /prescription_rows.json
def create @prescription_row = PrescriptionRow.new(prescription_row_params) @prescription=Prescription.where(id: @prescription_row.id_prescription).first respond_to do |format| if @prescription_row.save format.html { redirect_to @prescription, notice: 'Prescription row was successfully created.' } format.json { render :show, status: :created, location: @prescription_row } else format.html { render :new } format.json { render json: @prescription_row.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @prescription_rows = PrescriptionRow.all\n end", "def prescription_row_params\n params.require(:prescription_row).permit(:id_prescription, :id_product, :dose_per_ha)\n end", "def set_prescription_row\n @prescription_row = PrescriptionRow.find(params[:id])\n end", "def create\n @invoice_row = @invoice.invoice_rows.create(invoice_row_params)#InvoiceRow.new(invoice_row_params)\n\n respond_to do |format|\n if @invoice_row.save\n format.html { redirect_to edit_invoice_path(@invoice), notice: 'Invoice row was successfully created.' }\n format.json { render action: 'show', status: :created, location: @invoice_row }\n else\n format.html { render action: 'new' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @row = Row.new(row_params)\n\n respond_to do |format|\n if @row.save\n format.html { redirect_to @row, notice: 'Row was successfully created.' }\n format.json { render :show, status: :created, location: @row }\n else\n format.html { render :new }\n format.json { render json: @row.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_row(options = nil)\n require_relative 'datarow'\n DataRow.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/rows\", options))\n end", "def import_row(data) #TODO: Research use\n return @client.raw(\"post\", \"/config/importers/import_row\", nil, data)\n end", "def create_rows\n # Once rows are created from the json_date they cannot be recreated to avoid possible duplication.\n return false if import_rows.size > 0\n rows = JSON.parse(json_data)\n logger.info \"Import File: creating #{rows.count} import rows.\"\n # account for title row\n row_count = 2\n import_errors = []\n added_rows = []\n rows.each do |row|\n # new_row = ImportRow.new(import_file_id: import_file_id, title: row[\"title\"], json_data: row.to_json)\n new_row = ImportRow.new(import_file: self, title: row[\"title\"], json_data: row.to_json)\n logger.info \"Create Rows: creating row #{row_count} with title #{new_row.title}.\"\n if new_row.valid?\n added_rows << new_row\n else\n logger.error \"Create Rows: error on row #{row_count}: #{new_row.errors.full_messages}.\"\n import_errors << { \"Row #{row_count}\": new_row.errors.full_messages.join(\",\") }\n end\n row_count += 1\n end\n import_errors = validate_rows(import_errors,added_rows)\n logger.error \"Create Rows: row creation aborted. #{import_errors.count} validation errors.\"\n if import_errors.empty?\n save_rows(added_rows)\n else\n import_errors << { \"Rows #{row_count-1}\": \"Import rows not created. #{import_errors.count} validation errors.\" }\n end\n #reload\n import_errors\n end", "def create\n fail = 0\n @errors = []\n @rows = []\n params[:rows].each_value do |pnum|\n num = PartNum.new(pnum)\n @rows << num\n if ! num.save\n fail = 1\n @errors << num.errors\n end\n end\n \n respond_to do |format|\n if fail == 0\n flash[:notice] = 'Part numbers was successfully created.'\n format.html { redirect_to( part_nums_path() ) }\n format.xml { render :xml => @part_num, :status => :created, :location => @part_num }\n else\n flash[:notice] = 'Part number creation failed.'\n format.html { render :action => \"new\" }\n format.xml { render :xml => @errors, :status => :unprocessable_entity }\n end\n end\n end", "def rows\n RowCollection.new(@data)\n end", "def create\n @aquizitions_row = AquizitionsRow.new(aquizitions_row_params)\n\n respond_to do |format|\n if @aquizitions_row.save\n format.html { redirect_to @aquizitions_row, notice: 'Aquizitions row was successfully created.' }\n format.json { render action: 'show', status: :created, location: @aquizitions_row }\n else\n format.html { render action: 'new' }\n format.json { render json: @aquizitions_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tgl_row = TglRow.new(params[:tgl_row])\n\n respond_to do |format|\n if @tgl_row.save\n format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully created.' }\n format.json { render json: @tgl_row, status: :created, location: @tgl_row }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tgl_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n set_assoc_work_param()\n @transcription = Transcription.new(params[:transcription])\n\n respond_to do |format|\n if @transcription.save\n int_rebuild_value = \"0\"\n if (params[:rebuild])\n int_rebuild_value = params[:rebuild]\n end\n if int_rebuild_value.to_i > 0\n int_tei_ret = doeditiontei(@transcription.digital_edition_id)\n end\n arr_prev_page_data = get_prev_page_last_line_data(@transcription.page_id)\n do_page_lines(arr_prev_page_data[0], arr_prev_page_data[1], @transcription.page_id)\n dopagetei(@transcription.page_id)\n str_redirect_link = \"/pages/\"[email protected]_id.to_s+\"/edit?notice=New%20Transcription%20Saved%20With%20ID%20\"[email protected]_s\n format.html { redirect_to str_redirect_link }\n format.json { render json: @transcription, status: :created, location: @transcription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transcription.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n \n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n @prescription_row.destroy\n respond_to do |format|\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @patient = Patient.find(params[:patient_id])\n @prescription = @patient.prescriptions.build(prescription_params)\n @prescription.formulary_status = FORMULARY_STATUSES.sample\n @prescription.date_prescribed = Time.zone.now\n @prescription.active = true\n\n respond_to do |format|\n if @prescription.save\n format.html { redirect_to @patient, notice: 'Prescription was successfully created.' }\n format.json { render :show, status: :created, location: @prescription }\n else\n format.html { render :new }\n format.json { render json: @prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def rows(parts=@parts)\n \n @renderer.rows(parts)\n \n end", "def create\n authorize(@extractions_extraction_forms_projects_sections_type1.project, policy_class: ExtractionsExtractionFormsProjectsSectionsType1RowPolicy)\n\n @extractions_extraction_forms_projects_sections_type1_row = @extractions_extraction_forms_projects_sections_type1.extractions_extraction_forms_projects_sections_type1_rows.build(extractions_extraction_forms_projects_sections_type1_row_params)\n\n respond_to do |format|\n if @extractions_extraction_forms_projects_sections_type1_row.save\n format.html { redirect_to edit_timepoints_extractions_extraction_forms_projects_sections_type1_path(@extractions_extraction_forms_projects_sections_type1),\n notice: t('success') }\n format.json { head :no_content }\n else\n format.html { render '/extractions_extraction_forms_projects_sections_type1s/edit_timepoints' }\n format.json { render :json => @extractions_extraction_forms_projects_sections_type1_row.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rows\n @rows\n end", "def save\n if row_data[:id] == 0\n row = Vh.new\n else\n row = Vh.find(row_data[:id])\n end\n\n row.name = row_data[:name]\n row.exp1_type = row_data[:exp1_type]\n row.exp1_value = row_data[:exp1_value]\n row.exp2_type = row_data[:exp2_type]\n row.exp2_value = row_data[:exp2_value]\n row.condition = row_data[:condition]\n row.save\n\n render json: {\n data: Vh.all\n }\n end", "def row_params\n params.require(:row).permit(:identifier, :project_id, :data)\n end", "def rows\n render 'rows.html'\n end", "def prescription_params\n params.require(:prescription).permit(:quantity, :unit, :observation, :hospitalization_id, :medicaments)\n end", "def prescription_params\n params.require(:prescription).permit(:user_id, :prescribed_at, :drug_id, :quantity, :quantity)\n end", "def create\n @users_prescription = UsersPrescription.new(users_prescription_params)\n\n respond_to do |format|\n if @users_prescription.save\n format.html { redirect_to @users_prescription, notice: 'Users prescription was successfully created.' }\n format.json { render :show, status: :created, location: @users_prescription }\n else\n format.html { render :new }\n format.json { render json: @users_prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def rows=(value)\n @rows = value\n end", "def create\n @section_row = SectionRow.new(section_row_params)\n\n respond_to do |format|\n if @section_row.save\n flash[:success] = \"Section row was successfully created.\"\n format.html { redirect_to @section_row }\n format.json { render :show, status: :created, location: @section_row }\n else\n format.html { render :new }\n format.json { render json: @section_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def users_prescription_params\n params.require(:users_prescription).permit(:user_id, :prescription_id)\n end", "def update\n \n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n respond_to do |format|\n if @prescription_row.update(prescription_row_params)\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully updated.' }\n format.json { render :show, status: :ok, location: @prescription_row }\n else\n format.html { render :edit }\n format.json { render json: @prescription_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n is_private = params[:is_private]\n custom_count = params[:total_count]\n \n @hackathon = Hackathon.new(hackathon_params)\n respond_to do |format|\n if @hackathon.save\n format.html { redirect_to @hackathon, notice: 'Hackathon was successfully created.' }\n format.json { render :show, status: :created, location: @hackathon }\n else\n format.html { render :new }\n format.json { render json: @hackathon.errors, status: :unprocessable_entity }\n end\n end\n \n list = custom_count.split(\",\")\n list.each_slice(2){ |x| \n customtable = CustomeTable.new()\n customtable.question = params[\"cus_field\"+x[0].to_s]\n customtable.answer = params[\"cus_field\"+x[1].to_s]\n customtable.identifier_id = @hackathon.id\n customtable.identifier = @hackathon\n customtable.save!\n } \n\n end", "def create\n @promotion = Promotion.new(promotion_params)\n @render_hidden_input = true if request.xhr?\n respond_to do |format|\n if @promotion.save\n format.html { render :partial => \"row_table\", :locals => { :promotion => @promotion, :render_hidden_input => @render_hidden_input } }\n else\n format.json { render :json => { :errors => @promotion.errors }, :status => 409 }\n end\n end\n end", "def create\n if !params[:_json].blank?\n params[:_json] = JSON.parse params[:_json] if params[:_json].is_a? String\n \n #Routine de transformation en CSV\n json = params[:_json][0]\n headers = []\n values = []\n csv_string = CSV.generate do |csv|\n json.each do |key, value|\n if (!key.blank? && !value.blank? && value!=\"Autre\")\n #Exclusion de certain champs Limesurvey\n if !['id','Complété','Dernière page vue','Langue de départ', 'FusionQuestion', 'Code'].include?(key)\n #Nettoyage des champs du type \"champs [other]\"\n if key.include?(\" [other]\")\n #puts \"test [other]\"\n key = key.split(\" [other]\")[0] \n end\n headers << key\n values << value \n end\n end\n end\n csv << headers\n csv << values\n end\n \n @questionnaire = Questionnaire.new(params[:questionnaire])\n @questionnaire.content = csv_string\n profil_id, category_id = json['FusionQuestion'].to_s.split(\"/\")\n @questionnaire.profil = Profil.find(id=profil_id)\n @questionnaire.category = Category.find(id=category_id)\n end\n \n respond_to do |format|\n if @questionnaire.save\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully created.' }\n format.json { render json: @questionnaire, status: :created, location: @questionnaire }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def index\n @transcriptions = Transcription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transcriptions }\n end\n end", "def create\n @java_dynamic_row = JavaDynamicRow.new(params[:java_dynamic_row])\n\n respond_to do |format|\n if @java_dynamic_row.save\n format.html { redirect_to @java_dynamic_row, :notice => 'Java dynamic row was successfully created.' }\n format.json { render :json => @java_dynamic_row, :status => :created, :location => @java_dynamic_row }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @java_dynamic_row.errors, :status => :unprocessable_entity }\n end\n end\n end", "def feed_rows(rows)\n write_bytes(27, 74, rows)\n end", "def index\n @prescription_details = PrescriptionDetail.all\n end", "def index\n @users_prescriptions = UsersPrescription.all\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def rows\n @rows\n end", "def create\n @container_row = ContainerRow.new(container_row_params)\n respond_to do |format|\n if @container_row.save\n flash[:success] = 'Row was successfully created.'\n format.html { redirect_to admin_container_row_url(@container_row) }\n format.json { render :show, status: :created, location: @container_row }\n else\n set_new\n format.html { render :new }\n format.json { render json: @container_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_row(hash)\n raise ORM::TableError, \"Something went wrong.\" unless hash[:id].present?\n\n update_counter(hash[:id])\n result_table = table << hash\n File.write(@table_path, JSON.generate(result_table))\n end", "def index\n @prescriptions = Prescription.all\n end", "def create\n @prescription_detail = PrescriptionDetail.new(prescription_detail_params)\n\n respond_to do |format|\n if @prescription_detail.save\n format.html { redirect_to @prescription_detail, notice: 'Prescription detail was successfully created.' }\n format.json { render :show, status: :created, location: @prescription_detail }\n else\n format.html { render :new }\n format.json { render json: @prescription_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # @cd = DisDatasource.all\n a = DisDatasource.paginate(:page => params[:page], :per_page => 10).order(:id)\n rowcount = a.count\n a = a.as_json\n rows = [{\"rows\" => rowcount}]\n result = {\"raw\" => a ,\"count\" => rows}\n # n = c.to_a << @m\n respond_with result\n end", "def build_row(data = self.data)\n values = data.to_a\n keys = self.data.column_names.to_a\n hash = {}\n values.each_with_index do |val, i|\n key = (keys[i] || i).to_s\n hash[key] = val\n end\n line = hash.to_json.to_s\n output << \" #{line}\"\n end", "def batch_modify_rows(action, rows, per_page=100)\n if not per_page.is_a? Fixnum or not per_page > 0\n raise VeritableError.new(\"Batch upload or delete must have integer page size greater than 0.\")\n end\n batch = []\n rows.each do |row|\n Util.check_row(row)\n batch.push(row)\n if batch.size == per_page\n post(link('rows'), {'action' => action, 'rows' => batch}) \n batch = []\n end \n end\n if batch.size > 0\n post(link('rows'), {'action' => action, 'rows' => batch})\n end\n end", "def create\n @trainees = TraineeBatch.new(params[:participants][:ids], params[:training_calendar_id])\n respond_to do |format|\n if @trainees.save\n format.html { redirect_to training_calendar_path(params[:training_calendar_id]), :notice => 'The participant(s) were successfully added.' }\n format.json { render :json => @trainees, :status => :created, :location => @trainees }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trainees.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @prescription = Prescription.new(prescription_params)\n @prescription.user_id = current_user.id\n\n respond_to do |format|\n # FIXME: new and delete hook\n if @prescription.save\n if (Stock.where(:user_id => current_user.id, :drug_id => @prescription.drug_id).first!= nil)\n new_quantity = Stock.where(:user_id => current_user.id, :drug_id => @prescription.drug_id).order(\"updated_at DESC\").first.quantity_available + @prescription.quantity\n else\n new_quantity = @prescription.quantity\n end\n @stock = Stock.new(user_id: current_user.id, quantity_available: new_quantity, drug_id: @prescription.drug_id)\n @stock.save\n format.html { redirect_to @prescription, notice: 'Prescription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prescription }\n else\n format.html { render action: 'new' }\n format.json { render json: @prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @topic = Topic.new(params[:topic])\n row = @ws.num_rows()+1\n\n respond_to do |format|\n if @topic.save\n @ws[row,1] = @topic.id\n @ws[row,2] = @topic.topic\n @ws[row,3] = @topic.subject.subject\n @ws[row,4] = @topic.seab_sub_topic.topic\n @ws[row,5] = @topic.description\n @ws.save()\n format.html { redirect_to @topic, notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @invoice_rows = @invoice.invoice_rows\n end", "def prescription_detail_params\n params.require(:prescription_detail).permit(:qty, :price, :drug_id, :prescription_id)\n end", "def row; end", "def row\n new_row = RowBuilder.new\n\n yield new_row\n\n @rows << new_row\n end", "def import_row(server, row, pastel)\n scenario_id, *values = row\n print \"Importing scenario #{scenario_id}... \"\n\n RestClient.put(\n \"#{server}/api/v3/scenarios/#{scenario_id}\",\n { scenario: { user_values: user_values(values) } }.to_json,\n accept: :json, content_type: :json\n )\n\n puts pastel.green(\"done (#{values.length} user values).\")\n true\nrescue RestClient::NotFound\n puts pastel.red(\"scenario not found.\")\n false\nrescue RestClient::UnprocessableEntity => ex\n puts pastel.red(\"validation error.\")\n\n JSON.parse(ex.http_body)['errors'].each do |msg|\n puts pastel.red(\" * #{msg}\")\n end\n\n false\nend", "def batch_upload_rows(rows, per_page=100); batch_modify_rows('put', rows, per_page); end", "def rower_params\n params.require(:rower).permit(:rodzaj_roweru_id, :rozmiar_id, :rodzaj, :wielkosc_ramy, :stan, :stan_roweru_id)\n end", "def handle_row(row,row_i)\n new_trial_lesson = self.account.trial_lessons.new\n\n ts_external_id = value_for(row,'time_slot_external_id')\n if ts_external_id \n time_slot_id = TimeSlot.where(external_id: ts_external_id).pluck(:id).first\n\n contact_exid = value_for(row,'contact_external_id')\n contact = map_contact(contact_exid) if contact_exid\n if contact\n new_trial_lesson.contact_id = contact.id \n new_trial_lesson.time_slot_id = time_slot_id\n\n (valid_headers-%W(contact_external_id time_slot_external_id)).each do |header|\n new_trial_lesson.send(\"#{header}=\",value_for(row,header))\n end\n \n archived = value_for(row, 'archived')\n new_trial_lesson.archived = (archived == \"true\" ? true : false)\n new_trial_lesson.skip_broadcast = true\n new_trial_lesson.activity_on_trial_time = true\n if new_trial_lesson.save!\n ImportedId.new value: new_trial_lesson.id\n else\n FailedRow.new(value: row_i,\n message: new_trial_lesson.errors.messages.map{|attr,err_array| \"#{attr}: #{err_array.join(' and ')}\" }.join(' AND '))\n end\n\n else\n FailedRow.new value: row_i, message: \"contact not found\"\n end\n else\n FailedRow.new value: row_i, message: \"no timeslot specified\"\n end\n end", "def new\n @infographic = Infographic.new\n # @infographic.rows.build\n 3.times { @infographic.rows.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @infographic }\n end\n end", "def rows\n @rows ||= if ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n result.entries\n else\n [].tap do |row_hashes|\n result.entries.map do |row|\n hash = {}\n result.fields.each do |field|\n hash[field] = row[result.fields.index(field)]\n end\n row_hashes << hash\n end\n end\n end\n end", "def create_rows\n (row_count.to_i - rows.size).times { rows.create(position: rows.size) }\n end", "def create_draft_table_rows_with_http_info(table_id_or_name, batch_input_hub_db_table_row_v3_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RowsBatchApi.create_draft_table_rows ...'\n end\n # verify the required parameter 'table_id_or_name' is set\n if @api_client.config.client_side_validation && table_id_or_name.nil?\n fail ArgumentError, \"Missing the required parameter 'table_id_or_name' when calling RowsBatchApi.create_draft_table_rows\"\n end\n # verify the required parameter 'batch_input_hub_db_table_row_v3_request' is set\n if @api_client.config.client_side_validation && batch_input_hub_db_table_row_v3_request.nil?\n fail ArgumentError, \"Missing the required parameter 'batch_input_hub_db_table_row_v3_request' when calling RowsBatchApi.create_draft_table_rows\"\n end\n # resource path\n local_var_path = '/cms/v3/hubdb/tables/{tableIdOrName}/rows/draft/batch/create'.sub('{' + 'tableIdOrName' + '}', CGI.escape(table_id_or_name.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'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(batch_input_hub_db_table_row_v3_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'BatchResponseHubDbTableRowV3'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"RowsBatchApi.create_draft_table_rows\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RowsBatchApi#create_draft_table_rows\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @rowempl = Rowempl.new(params[:rowempl])\n\n respond_to do |format|\n if @rowempl.save\n format.html { redirect_to @rowempl, notice: 'Rowempl was successfully created.' }\n format.json { render json: @rowempl, status: :created, location: @rowempl }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rowempl.errors, status: :unprocessable_entity }\n end\n end\n end", "def sample_row_params\n params.require(:sample_row).permit(:id, :fcid, :lane, :sampleId, :sampleRef, :index, :description, :control, :receipe, :operator, :sampleProject)\n end", "def row\n get_row\n respond_to_action(:row)\n end", "def process_row(row)\n row\n end", "def aquizitions_row_params\n params.require(:aquizitions_row).permit(:file_lines, :id)\n end", "def rows(parts, fields = [\n [\n \"Sub Assembly\",\n \"sub_assembly\" \n ],\n [ \n \"Part Name\", \n \"part_name\"\n ],\n [ \n \"Quantity\", \n \"quantity\"\n ],\n [ \n \"Width\",\n \"width\"\n ],\n [ \n \"Length\",\n \"length\"\n ],\n [ \n \"Thickness\", \n \"thickness\"\n ],\n [ \n \"Material\",\n \"material\"\n ]\n ])\n \n # TODO: Get the order of items in a list to be configurable somehow...\n \n html = <<-EOS\n \n <table>\n <thead>\n <tr>\n \n EOS\n \n # List each heading for the coumns based on the `fields` parameter.\n fields.each { |f|\n \n html += \"<th>#{f[0].to_s}</th>\"\n \n }\n\n \n html += <<-EOS\n \n </tr>\n </thead>\n <tbody>\n \n EOS\n \n if parts != nil\n \n all_rows = ''\n \n parts.each { |p| \n \n all_rows += row(p, fields)\n \n }\n \n puts \"[HTMLRenderer.rows] all_rows: #{all_rows}\" if $cutlister_debug\n \n html += all_rows.to_s\n \n else\n \n UI.messagebox \"Sorry, there are no parts to cutlist...\", MB_OK\n \n end\n \n html += <<-EOS\n \n </tbody>\n </table>\n \n EOS\n \n html += section_footer(parts)\n \n html\n \n end", "def add_payment_entry_row\n @ac = ApplicationController.new\n \n @day = params[:payment_date][3..4]\n @month = params[:payment_date][0..1]\n @year = params[:payment_date][6..9]\n \n @total_payment = params[:amount].to_s\n 3.times do\n @total_payment.sub!(\",\", \"\")\n end\n @total_payment = @total_payment.to_f\n \n @pfd = PaymentFromDestination.create(:payment_date => \"#{@year}-#{@month}-#{@day}\", :payment_num => params[:payment_num], :destination_id => params[:destination_id], :job_id => params[:job_id], :tickets => params[:tickets], :net_mbf => params[:net_mbf], :tonnage => params[:tonnage], :total_payment => @total_payment, :wood_type => params[:wood_type])\n end", "def rows\n (report[\"data\"][\"rows\"] || []).map { |row| Row.new(self, row) }\n end", "def rows\n return @rows if @rows\n if execute && result['rows']\n @rows ||= result['rows'].map{|v| ViewRow.new(v, model)}\n else \n [ ]\n end\n end", "def invoice_insert(h)\n\t\trows = @database.execute <<-SQL\n\t\tINSERT INTO invoices\n\t\t\t( number\n\t\t\t, organization\n\t\t\t, updated\n\t\t , amount\n\t\t\t, amount_outstanding\n\t\t\t, discount\n\t\t \t, invoice_id\n\t\t\t, matter\n\t\t\t, date\n\t\t\t, status)\n\t\tVALUES\n\t\t('#{h['number']}'\n\t\t, '#{h['organization']}'\n\t\t, '#{h['updated']}'\n\t\t, '#{h['amount']}'\n\t\t, '#{h['amount_outstanding']}'\n\t\t, '#{h['discount']}'\n\t\t, '#{h['invoice_id']}'\n\t\t, '#{h['matter']}'\n\t\t, '#{h['date']}'\n\t\t, '#{h['status']}'\n\t \t )\n\t\t SQL\n\tend", "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 add_row(table_name, column_values)\n options = {\n :query => {\n 'ZOHO_ACTION' => 'ADDROW',\n },\n :body => column_values\n }\n\n send_request get_uri(table_name), 'post', options\n end", "def create\n @services = params[:inputserv]#[:inputcantidad]\n @quantity = params[:inputcantidad]\n @citation = Citation.new(citation_params)\n @client = Client.where(:id => @citation.client_id).select(:email)\n @client_name = Client.where(:id => @citation.client_id).select(:name, :firstlastname)\n\n respond_to do |format|\n if @citation.save\n cont = 0\n @services.each do |p|\n detalle = CitationDetail.new(service_id: p, quantity: @quantity[cont], citation_id:@citation.id)\n detalle.save\n cont +=1\n end\n #NotifyMailer.notify_mail(@citation).deliver\n \n format.html { redirect_to @citation, notice: 'Citation was successfully created.' }\n format.json { render :show, status: :created, location: @citation }\n else\n @clients = Client.all.map{|p| [ p.name, p.id ] }\n @services_combo = Service.all.map{|p| [ p.name, p.id ] }\n @citation_details = CitationDetail.where(:service_id => params[:id])\n #@services = params[:inputserv][:inputcantidad]\n format.html { render :new }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end", "def table_rows(table)\n table.xpath('.//tr').drop 1\n end", "def new\n @java_dynamic_row = JavaDynamicRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @java_dynamic_row }\n end\n end", "def create_transcriptions_listtranscription(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/transcriptions/listtranscription.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'status' => options['status'],\r\n 'dateTranscribed' => options['date_transcribed']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def invoice_row_params\n params.require(:invoice_row).permit(:invoice_id, :desc, :value)\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end", "def create_row(params)\n\t\tself.google_doc.restart_session_if_necessary\n\t\treset_worksheet_obj if @worksheet_obj == nil\n\t\t# add the keys if they don't exist\n\t\tparams.each do | key, value |\n\t\t\tif(!@worksheet_obj.list.keys.include?(key))\n\t\t\t\tadd_column_key(key)\n\t\t\tend\n\t\tend\n\t\t# save key changes\n\t\tif(@worksheet_obj.dirty?)\n\t\t\t@worksheet_obj.synchronize\n\t\tend\n\t\t#push the new row\n\t\tnew_row = @worksheet_obj.list.push(params)\n\t\t@worksheet_obj.save\n\t\treturn new_row\n\tend", "def create\n @metadonnee = Metadonnee.new(metadonnee_params)\n #puts \"yesssssssssss\"\n # @metadonnee.champs = [\n # {\"id\"=> params[:metadonnee][:id1], \"nom\" => params[:metadonnee][:ndc1], \"type\" => params[:metadonnee][:tdc1], \"description\" => params[:metadonnee][:ddc1]}, \n # {\"id\"=> params[:metadonnee][:id2], \"nom\" => params[:metadonnee][:ndc2], \"type\" => params[:metadonnee][:tdc2], \"description\" => params[:metadonnee][:ddc2]},\n # {\"id\"=> params[:metadonnee][:id3], \"nom\" => params[:metadonnee][:ndc3], \"type\" => params[:metadonnee][:tdc3], \"description\" => params[:metadonnee][:ddc3]}, \n # {\"id\"=> params[:metadonnee][:id4], \"nom\" => params[:metadonnee][:ndc4], \"type\" => params[:metadonnee][:tdc4], \"description\" => params[:metadonnee][:ddc4]},\n # {\"id\"=> params[:metadonnee][:id5], \"nom\" => params[:metadonnee][:ndc5], \"type\" => params[:metadonnee][:tdc5], \"description\" => params[:metadonnee][:ddc5]}\n # ]\n #puts params[:metadonnee][:rows_attributes].keys\n #@metadonnee.champs = [:metadonnee][:rows_attributes]\n \n if params[:metadonnee][:format] == 'autre' \n @metadonnee.format = params[:metadonnee][:autre]\n end\n @metadonnee.date = !params[:date1].blank? ? params[:date1] : params[:date2] \n @metadonnee.created_by = current_user.email\n #puts params[:metadonnee][:titre]\n #puts params[:metadonnee][:rows][:champ_nom]\n respond_to do |format|\n if @metadonnee.save\n format.html { redirect_to @metadonnee, notice: 'Metadonnee was successfully created.' }\n format.json { render :show, status: :created, location: @metadonnee }\n else\n format.html { render :new }\n format.json { render json: @metadonnee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_escrow_using_post(escrow_params, opts = {})\n data, _status_code, _headers = create_escrow_using_post_with_http_info(escrow_params, opts)\n data\n end", "def post(data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n jss.each do |key, value|\n # Check if we have it on the query too\n unless input.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Not enough data for a new resource\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n \n\n # Insert the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n fields[table].push matching_field\n if @engine.config[\"dbengine\"] == :mysql\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID()))\"\n else\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(last_insert_rowid()))\"\n end\n end\n end\n queries = [] \n inserts.each do |table, values|\n queries.push \"INSERT INTO #{table}(#{fields[table].join(',')}) VALUES (#{inserts[table].join(',')});\"\n end\n # Connect to the database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n results = []\n rid = nil\n # Find the ID to return in the response (only for the first query)\n queries.each do |q|\n results.push dbe.query(dblink, q)\n if @engine.config[\"dbengine\"] == :mysql\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID());\"), \"id\")\n else\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(last_insert_rowid());\"), \"id\")\n end\n end\n @engine.http_status = \"201 Created\"\n resp = {status: \"201 created\", id: rid}\n end\n return resp\n end", "def add_row(row)\n case\n when row.is_a?(Array)\n @rows << Hash[@parameters.zip(row.collect { |value| value.strip })]\n @row_elements << Row.new(\"|#{row.join('|')}|\")\n when row.is_a?(Hash)\n @rows << row.each_value { |value| value.strip! }\n @row_elements << Row.new(\"|#{ordered_row_values(row).join('|')}|\")\n else\n raise(ArgumentError, \"Can only add row from a Hash or an Array but received #{row.class}\")\n end\n end", "def rows(parts, fields = [\n [\n \"Sub Assembly\",\n \"sub_assembly\" \n ],\n [ \n \"Part Name\", \n \"part_name\"\n ],\n [ \n \"Quantity\", \n \"quantity\"\n ],\n [ \n \"Width\",\n \"width\"\n ],\n [ \n \"Length\",\n \"length\"\n ],\n [ \n \"Thickness\", \n \"thickness\"\n ],\n [ \n \"Material\",\n \"material\"\n ]\n ])\n \n data = ''\n\n # List each heading for the coumns based on the `fields` parameter.\n fields.each { |f|\n data += \"#{f[0].to_s}\"\n data += f == fields.last ? \"\\n\" : \",\"\n }\n \n # Loop through each part and generate a row.\n if parts != nil\n \n all_rows = ''\n \n parts.each { |p| \n \n all_rows += row(p, fields)\n \n }\n \n puts \"[CSVRenderer.rows] all_rows: #{all_rows}\" if $cutlister_debug\n \n data += all_rows.to_s\n \n else\n \n UI.messagebox \"Sorry, there are no parts to cutlist... Please make sure you selected parts before cutlisting.\", MB_OK\n \n end\n \n data\n \n end", "def new\n @tgl_row = TglRow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tgl_row }\n end\n end", "def prescription_params\n params.require(:prescription).permit(:drug_number, :quantity, :frequency, :refills, :dispense_as_written, :patient_id, :drug_name, :formulary_status, :pharmacy_id)\n end", "def row(row)\n Row.new(@data, row)\n end", "def create\n begin\n @prescription = current_user.prescriptions.new(prescription_params)\n @prescription.save!\n render_success_response \"Prescription sent to admin successfully\"\n rescue => e\n bad_request_error(e.message)\n end\n end", "def index\n @prescription_medicines = PrescriptionMedicine.where(prescription_id: params[:prescription_id])\n end", "def line_item_insert(h)\n\t\trows = @database.execute <<-SQL\n\t\tINSERT INTO invoice_lines\n\t\t\t\t(number\n\t\t\t\t, invoice_id\n\t\t\t\t, line_id\n\t\t\t\t, _order\n\t\t\t\t, description\n\t\t\t\t, amount\n\t\t\t\t, first_expense_id\n\t\t \t, first_time_entry_id\n\t\t\t\t, line_item_date\n\t\t\t\t, person\n\t\t\t\t, name\n\t\t\t\t, matter\n\t\t\t\t, unit_cost\n\t\t\t\t, quantity\n\t\t\t\t, type\n\t\t\t\t, updated\n\t\t\t\t)\n\t\tVALUES\n\t\t\t ('#{h['number']}'\n\t\t\t , '#{h['invoice_id']}'\n\t\t\t , '#{h['line_id']}'\n\t\t\t , '#{h['order']}'\n\t\t\t , '#{h['description']}'\n\t\t\t , '#{h['amount']}'\n\t\t\t , '#{h['first_expense_id']}'\n\t\t\t , '#{h['first_time_entry_id']}'\n\t\t\t , '#{h['line_item_date']}'\n\t\t , '#{h['person']}'\n\t\t\t , '#{h['name']}'\n\t\t\t , '#{h['matter']}'\n\t\t\t , '#{h['unit_cost']}'\n\t\t\t , '#{h['quantity']}'\n\t\t\t , '#{h['type']}'\n\t\t\t , '#{h['updated']}'\n\t\t\t )\n\t\tSQL\n\tend", "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 show_row\n @dataset = Dataset.find(params[:dataset_id])\n if params[:row_id].gsub(/[0-9]/,\"\").length == 0 #il n'y a que des chiffres\n @data = ActiveRecord::Base.connection.select_one(\"SELECT * from dataset_#{@dataset.id} WHERE id = #{params[:row_id]} LIMIT 1\")\n render :inline => @data.to_json \n else\n render :text => 'Invalid parameters'\n end\n end", "def autogrow_table_rows\n wait_until_bus_section_load\n tables.last.rows_text\n end", "def get_rows(solrparams, params)\n params.key?(:rows) ? solrparams.merge!(:rows => params[:rows]) : solrparams.merge!(:rows => 100000000) # if user passes in the rows they want, use that, else just return everything\n end", "def create\n @transcription = Transcription.new(transcription_params)\n\n respond_to do |format|\n if @transcription.save\n\n format.html { redirect_to @transcription, notice: 'Transcription was successfully created.' }\n format.json { render :show, status: :created, location: @transcription }\n else\n format.html { render :new }\n format.json { render json: @transcription.errors, status: :unprocessable_entity }\n end\n end\n end", "def rows\n @array\n end", "def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end", "def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_transaction\n @results = []\n result_params = params.fetch(:result, {})\n\n result_params.each do |rp|\n permitted_rp = rp.permit(*Api::V1::Result::STRONG_PARAMETERS)\n result = Api::V1::Result.new(permitted_rp)\n result.save!\n\n @results << result\n end\n\n #session.commit_transaction\n #end\n\n render json: @results\n end", "def write_row(row)\n end" ]
[ "0.64642286", "0.6381454", "0.62451756", "0.5641393", "0.54272866", "0.5425547", "0.54190195", "0.5292091", "0.52874905", "0.527435", "0.5249497", "0.5248934", "0.5202156", "0.51881605", "0.5184491", "0.5170243", "0.51695687", "0.5143078", "0.51152897", "0.5106153", "0.5095522", "0.50934696", "0.5082658", "0.5075226", "0.5073259", "0.50405407", "0.5035777", "0.5027474", "0.5016029", "0.4999704", "0.49934468", "0.49867034", "0.4979363", "0.4967474", "0.49631122", "0.494681", "0.49428886", "0.49428886", "0.49428886", "0.49345806", "0.49234655", "0.4906239", "0.48996618", "0.48904952", "0.48857373", "0.48793378", "0.48744354", "0.48631036", "0.4862796", "0.4855543", "0.4854984", "0.48505816", "0.48298824", "0.481242", "0.48114783", "0.47791183", "0.47724885", "0.47711098", "0.47691885", "0.4756663", "0.47482744", "0.47341132", "0.472204", "0.4712979", "0.470653", "0.4706112", "0.4702114", "0.47004148", "0.46985695", "0.46934372", "0.46904016", "0.4688515", "0.4678282", "0.46730226", "0.46705723", "0.46697605", "0.46669137", "0.46667516", "0.46656352", "0.46642357", "0.46536303", "0.46522856", "0.46507105", "0.46490377", "0.46488032", "0.4628759", "0.46275845", "0.4626987", "0.46257097", "0.46252716", "0.4622527", "0.4621472", "0.46122876", "0.46118385", "0.4603409", "0.4597311", "0.4592237", "0.45843518", "0.45787165", "0.45661458" ]
0.65303224
0
PATCH/PUT /prescription_rows/1 PATCH/PUT /prescription_rows/1.json
def update @prescription=Prescription.where(id: @prescription_row.id_prescription).first respond_to do |format| if @prescription_row.update(prescription_row_params) format.html { redirect_to @prescription, notice: 'Prescription row was successfully updated.' } format.json { render :show, status: :ok, location: @prescription_row } else format.html { render :edit } format.json { render json: @prescription_row.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @invoice_row.update(invoice_row_params)\n format.html { redirect_to @invoice_row, notice: 'Invoice row was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoice_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @sample_row.update(sample_row_params)\n format.html { redirect_to @sample_row, notice: '' }\n format.json { render :show, status: :ok, location: @sample_row }\n else\n format.html { render :edit }\n format.json { render json: @sample_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n format.html { render :partial => \"row_table\", :locals => {:promotion => @promotion} }\n else\n format.json { render :json => { :errors => @promotion.errors }, :status => 409 }\n end\n end\n end", "def set_prescription_row\n @prescription_row = PrescriptionRow.find(params[:id])\n end", "def update\n respond_to do |format|\n if @row.update(row_params)\n format.html { redirect_to @row, notice: 'Row was successfully updated.' }\n format.json { render :show, status: :ok, location: @row }\n else\n format.html { render :edit }\n format.json { render json: @row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aquizitions_row.update(aquizitions_row_params)\n format.html { redirect_to @aquizitions_row, notice: 'Aquizitions row was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @aquizitions_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prescription.update(prescription_params)\n format.html { redirect_to @prescription, notice: 'Prescription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tgl_row = TglRow.find(params[:id])\n\n respond_to do |format|\n if @tgl_row.update_attributes(params[:tgl_row])\n format.html { redirect_to @tgl_row, notice: 'Tgl row was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tgl_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @row = Row.find(params[:id])\n respond_to do |format|\n if @row.update_attributes(:remark => params[:remark])\n @cells = params[:cells]\n @cells.each do |field_id,value|\n @cell = Cell.find(:first, :conditions => ['row_id = ? and field_id = ?', @row.id , field_id])\n if @cell == nil\n Cell.new(:row_id => @row.id, :field_id => field_id, :value => value).save\n else\n @cell.update_attributes(:row_id => @row.id, :field_id => field_id, :value => value)\n end\n end\n forward_to_front_desk :format => format, :object => @row, :screen_id =>@row.screen_id\n else\n back_to_operation_form :format => format, :action => 'edit', :object_errors => @row.errors\n end\n end\n end", "def update_row_resource(resource, params)\n resource.attributes = params\n resource.save\n end", "def update\n respond_to do |format|\n if @prescription.update(prescription_params)\n format.html { redirect_to @patient, notice: 'Prescription was successfully updated.' }\n format.json { render :show, status: :ok, location: @prescription }\n else\n format.html { render :edit }\n format.json { render json: @prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @prescription_detail.update(prescription_detail_params)\n format.html { redirect_to @prescription_detail, notice: 'Prescription detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @prescription_detail }\n else\n format.html { render :edit }\n format.json { render json: @prescription_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @section_row.update(section_row_params)\n flash[:success] = \"Section row was successfully updated.\"\n format.html { redirect_to @section_row }\n format.json { render :show, status: :ok, location: @section_row }\n else\n format.html { render :edit }\n format.json { render json: @section_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @users_prescription.update(users_prescription_params)\n format.html { redirect_to @users_prescription, notice: 'Users prescription was successfully updated.' }\n format.json { render :show, status: :ok, location: @users_prescription }\n else\n format.html { render :edit }\n format.json { render json: @users_prescription.errors, status: :unprocessable_entity }\n end\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 update\n record = InvoiceLineItem.find(params[:id])\n print record.to_json\n record.update_attributes(params[:record]) \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n @java_dynamic_row = JavaDynamicRow.find(params[:id])\n\n respond_to do |format|\n if @java_dynamic_row.update_attributes(params[:java_dynamic_row])\n format.html { redirect_to @java_dynamic_row, :notice => 'Java dynamic row was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @java_dynamic_row.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n @table = Table.find(params[:id])\n\n respond_to do |format|\n if @table.update_attributes(params[:table].permit(:name, :notes, :x, :y, :table_type, :guest_ids => []))\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @annotation_specs = args[:annotation_specs] if args.key?(:annotation_specs)\n @rows = args[:rows] if args.key?(:rows)\n end", "def update\n respond_to do |format|\n if @container_row.update(container_row_params)\n flash[:success] = 'Row was successfully updated.'\n if @page\n format.html { redirect_to admin_page_url(@page) }\n else\n format.html { redirect_to admin_container_row_url(@container_row) }\n end\n format.json { render :show, status: :ok, location: @container_row }\n else\n format.html { render :edit }\n format.json { render json: @container_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rowempl = Rowempl.find(params[:id])\n\n respond_to do |format|\n if @rowempl.update_attributes(params[:rowempl])\n format.html { redirect_to @rowempl, notice: 'Rowempl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rowempl.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rower.update(rower_params)\n format.html { redirect_to @rower, notice: 'Rower was successfully updated.' }\n format.json { render :show, status: :ok, location: @rower }\n else\n format.html { render :edit }\n format.json { render json: @rower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n p = trial_params.clone\n if p[\"question_ids\"].nil?\n p[\"question_ids\"] = []\n end\n\n respond_to do |format|\n if @trial.update(p)\n format.html { redirect_to @trial, notice: 'Trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n row = Passage.find_by_id( params[:id] )\n is_ok = row && row.update_attributes( passage_params )\n render( status: (is_ok ? :ok : 400), json: { success: is_ok } )\n end", "def update\n @slide.row_order_position = slide_params[:row_order_position]\n if @slide.save\n render nothing: true\n else\n render json: {files: [{\n error: @slide.errors.full_messages.join(\" \")\n }]}, status: 400\n end\n end", "def create\n @prescription_row = PrescriptionRow.new(prescription_row_params)\n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n\n respond_to do |format|\n if @prescription_row.save\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully created.' }\n format.json { render :show, status: :created, location: @prescription_row }\n else\n format.html { render :new }\n format.json { render json: @prescription_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @table1_copy1.update(table1_copy1_params)\n format.html { redirect_to @table1_copy1, notice: 'Table1 copy1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @table1_copy1 }\n else\n format.html { render :edit }\n format.json { render json: @table1_copy1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pre_contrato.update(pre_contrato_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: @pre_contrato.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update\n respond_to do |format|\n if @library_row.update(library_row_params)\n format.html { redirect_to @library_row, notice: 'Library row was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_row }\n else\n format.html { render :edit }\n format.json { render json: @library_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n electronic_prescription_params[:status] = electronic_prescription_params[:status].to_i\n\n respond_to do |format|\n if @electronic_prescription.update(electronic_prescription_params)\n format.html { redirect_to @electronic_prescription, notice: 'Electronic prescription was successfully updated.' }\n format.json { render :show, status: :ok, location: @electronic_prescription }\n else\n format.html { render :edit }\n format.json { render json: @electronic_prescription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update(&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 #@food_item automatically set to FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n if request.xhr?\n format.html { render partial: 'row', locals: {food_item: @food_item, index: 0}}\n else\n format.html { redirect_to @food_item, notice: 'Food item was successfully updated.' }\n end\n format.json { head :no_content }\n else\n if request.xhr?\n format.html { render partial: 'row_form', locals: {food_item: @food_item}, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n end\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_table_row_with_http_info(name, slide_index, shape_index, row_index, dto, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.update_table_row ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'shape_index' is set\n if @api_client.config.client_side_validation && shape_index.nil?\n fail ArgumentError, \"Missing the required parameter 'shape_index' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'row_index' is set\n if @api_client.config.client_side_validation && row_index.nil?\n fail ArgumentError, \"Missing the required parameter 'row_index' when calling SlidesApi.update_table_row\"\n end\n # verify the required parameter 'dto' is set\n if @api_client.config.client_side_validation && dto.nil?\n fail ArgumentError, \"Missing the required parameter 'dto' when calling SlidesApi.update_table_row\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/rows/{rowIndex}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'shapeIndex', shape_index)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'rowIndex', row_index)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.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 header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dto)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'TableRow')\n return data, status_code, headers\n end", "def update\n @line = Line.find_by_no(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def prescription_row_params\n params.require(:prescription_row).permit(:id_prescription, :id_product, :dose_per_ha)\n end", "def update\n respond_to do |format|\n if @transplice.update(transplice_params)\n format.html { redirect_to @transplice, notice: 'Transplice was successfully updated.' }\n format.json { render :show, status: :ok, location: @transplice }\n else\n format.html { render :edit }\n format.json { render json: @transplice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @presponsable.update(presponsable_params)\n format.html { redirect_to @presponsable, notice: 'Presponsable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @presponsable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub1_line_item.update(sub1_line_item_params)\n format.html { redirect_to @sub1_line_item, notice: 'Sub1 line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @sub1_line_item }\n else\n format.html { render :edit }\n format.json { render json: @sub1_line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sample_line = SampleLine.find(params[:id])\n\n respond_to do |format|\n if @sample_line.update_attributes(params[:sample_line])\n format.html { redirect_to @sample_line, notice: 'Sample line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inscriptionprepaconcour = Inscriptionprepaconcour.find(params[:id])\n\n respond_to do |format|\n if @inscriptionprepaconcour.update_attributes(params[:inscriptionprepaconcour])\n format.html { redirect_to @inscriptionprepaconcour, notice: 'Inscriptionprepaconcour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inscriptionprepaconcour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @custom_table = CustomTable.find(params[:id])\n\n respond_to do |format|\n if @custom_table.update_attributes(params[:custom_table])\n format.html { redirect_to @custom_table, notice: 'Custom table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custom_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end", "def update\n Client.transaction do\n @client.update!(client_params)\n end\n\n respond_to do |format|\n set_clients_grid\n format.html { redirect_to @client, notice: 'Client was successfully updated.'}\n format.js\n end\n rescue ActiveRecord::Rollback\n respond_to do |format|\n format.html { render :edit }\n format.js { render :edit }\n end\n end", "def update\n @pre = Pre.find(params[:id])\n\n respond_to do |format|\n if @pre.update_attributes(params[:pre])\n format.html { redirect_to @pre, notice: 'Pre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_detail.update(line_detail_params)\n format.html { redirect_to @line_detail, notice: 'Line detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @line_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @requisition = Requisition.find(params[:id])\n\n respond_to do |format|\n if @requisition.update_attributes(params[:requisition])\n format.html { redirect_to @requisition, notice: 'Requisition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sub_data_table.update(sub_data_table_params)\n format.html { redirect_to @sub_data_table.data_table, notice: 'Se actualizó el set de datos correctamente.' }\n format.json { render :show, status: :ok, location: @sub_data_table }\n else\n format.html { render :edit }\n format.json { render json: @sub_data_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @line_item1 = LineItem1.find(params[:id])\n\n respond_to do |format|\n if @line_item1.update_attributes(params[:line_item1])\n format.html { redirect_to @line_item1, :notice => 'Line item1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @line_item1.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 @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @docs_ponto.update(docs_ponto_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: @docs_ponto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_row = TaskRow.find(params[:id])\n\n respond_to do |format|\n if @task_row.update_attributes(params[:task_row])\n format.html { redirect_to(@task_row, :notice => 'Task row was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task_row.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n if @prepagada.update_attributes(params[:prepagada])\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trial_document.update(trial_document_params)\n format.html { redirect_to @trial_document, notice: 'Trial document was successfully updated.' }\n format.json { render :show, status: :ok, location: @trial_document }\n else\n format.html { render :edit }\n format.json { render json: @trial_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\n end", "def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: document.errors, status: 422\n end\n\n end", "def update\n @plate = Plate.find(params[:id])\n saved = @plate.update_attributes(get_first_indexed_params(:plate))\n respond_to do |format|\n if saved\n success_message = 'Plate was successfully updated.'\n format.html do\n flash[:notice] = success_message\n redirect_to plate_url(@plate)\n end\n flash.now[:notice] = success_message\n format.js\n else\n format.html { render :action => 'edit' }\n format.js { render :action => 'edit' }\n end\n end\n end", "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @recurrence = args[:recurrence] if args.key?(:recurrence)\n @recurrence_id = args[:recurrence_id] if args.key?(:recurrence_id)\n @server_id = args[:server_id] if args.key?(:server_id)\n end", "def update\n @dummy_table = DummyTable.find(params[:id])\n\n respond_to do |format|\n if @dummy_table.update_attributes(params[:dummy_table])\n format.html { redirect_to @dummy_table, notice: 'Dummy table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dummy_table.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(@refenciacontable)\n end", "def update\n @line_item = LineItem.find(params[:id])\n\n respond_to do |format|\n success = @line_item.update_attributes(line_item_params)\n if success\n @reviewed = @line_item.reviewed || @line_item.campaign.reviewed?\n\n if line_item_params[:reviewed]\n @update_edit_row = true\n end\n\n format.js\n else\n format.js { render \"shared/error.js\", locals: { message: @line_item.errors.full_messages.join(\"\\n\") } }\n end\n end\n end", "def update\n invoice_params[:data_prevenda] = Date.today\n respond_to do |format|\n puts 'esse é o id da venda ' + @invoice.id.to_s + invoice_params[:data_prevenda].to_s\n if @invoice.update(invoice_params)\n #ataualiza a data de prevenda em cada item lançado para o relatorio de analise geral\n #Item.where(invoice_id: @invoice.id).update_all(data_prevenda: invoice_params[:data_prevenda])\n format.html { redirect_to @invoice, notice: 'atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @invoice }\n sweetalert_success('Dados atualizados com sucesso!', 'Sucesso!', useRejections: false)\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @congestion = Congestion.find(params[:id])\n\n respond_to do |format|\n if @congestion.update_attributes(params[:congestion])\n format.html { redirect_to @congestion, notice: 'Congestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @congestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = t('scaffold.notice.updated', :item => Refenciacontable.model_name.human) if @refenciacontable.update_attributes(params[:refenciacontable])\n respond_with(@refenciacontable, :location => refenciacontables_path)\n end", "def update\n @receipt = Receipt.find(params[:id])\n params[:receipt][:receipt_lines_attributes] = @receipt.process_removed_lines(params[:receipt][:receipt_lines_attributes])\n\n respond_to do |format|\n if @receipt.update_attributes(receipt_params)\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n @receipt.update_attributes(:deposit_check_id => deposit_check.id) if deposit_check\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end", "def update\n @pre_step = PreStep.find(params[:id])\n\n respond_to do |format|\n if @pre_step.update_attributes(params[:pre_step])\n format.html { redirect_to @pre_step, notice: 'Pre step was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pre_step.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @add_to_invoice_client.update(add_to_invoice_client_params)\n format.html { redirect_to @add_to_invoice_client, notice: 'Add to invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_to_invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @add_to_invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def line_item_update(h)\n\t\trows = @database.execute <<-SQL\n\t\tUPDATE invoice_lines\n\t\tSET\n\t\t\t\t_order = '#{h['order']}'\n\t\t\t, invoice_id = '#{h['invoice_id']}'\n\t\t\t, name = '#{h['name']}'\n\t\t\t, matter = '#{h['matter']}'\n\t\t\t, description = '#{h['description']}'\n\t\t\t, amount = '#{h['amount']}'\n\t\t\t, first_expense_id = '#{h['first_expense_id']}'\n\t\t\t, first_time_entry_id = '#{h['first_time_entry_id']}'\n\t\t\t, line_item_date = '#{h['line_item_date']}'\n\t\t\t, person = '#{h['person']}'\n\t\t\t, unit_cost = '#{h['unit_cost']}'\n\t\t\t, quantity = '#{h['quantity']}'\n\t\t\t, type = '#{h['type']}'\n\t\t\t, updated = '#{h['updated']}'\n\t\tWHERE (number = '#{h['number']}' AND line_id = '#{h['line_id']}');\n\t\tSQL\n\tend", "def update\n respond_to do |format|\n if @table.update(table_params)\n format.html { redirect_to @table, notice: 'Table was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @table.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @therapist_consent = TherapistConsent.find(params[:id])\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'edit', therapist_consent: @therapist_consent}}\n end\n end", "def update\n @squadron_document = SquadronDocument.find(params[:id])\n\n respond_to do |format|\n if @squadron_document.update_attributes(params[:squadron_document])\n format.html { redirect_to @squadron_document, :notice => 'Squadron document was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @squadron_document.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tbody.update(tbody_params)\n format.html { redirect_to @tbody, notice: 'Tbody was successfully updated.' }\n format.json { render :show, status: :ok, location: @tbody }\n else\n format.html { render :edit }\n format.json { render json: @tbody.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n \n @prescription=Prescription.where(id: @prescription_row.id_prescription).first\n @prescription_row.destroy\n respond_to do |format|\n format.html { redirect_to @prescription, notice: 'Prescription row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update!(**args)\n @response_aggregation_type = args[:response_aggregation_type] if args.key?(:response_aggregation_type)\n @rows = args[:rows] if args.key?(:rows)\n end", "def update\n respond_to do |format|\n if @transcription.update(transcription_params)\n format.html { redirect_to @transcription, notice: 'Transcription was successfully updated.' }\n format.json { render :show, status: :ok, location: @transcription }\n else\n format.html { render :edit }\n format.json { render json: @transcription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invent_journal_line = InventJournalLine.find(params[:id])\n\n respond_to do |format|\n if @invent_journal_line.update_attributes(params[:invent_journal_line])\n format.html { redirect_to @invent_journal_line, notice: 'Invent journal line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invent_journal_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pre_enrollment.update(pre_enrollment_params)\n format.html { redirect_to @pre_enrollment, notice: 'Pre enrollment was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_enrollment }\n else\n format.html { render :edit }\n format.json { render json: @pre_enrollment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n course = Course.includes(:professors).find(params[:id])\n course.update!(course_params)\n \n course.professor_ids=(params[:professors])\n\n render json: course.to_json(include: :professors)\n end" ]
[ "0.62912524", "0.62644726", "0.61803424", "0.61260873", "0.61047447", "0.60863405", "0.59917754", "0.59543204", "0.59264123", "0.58878165", "0.58099526", "0.5801209", "0.57682484", "0.5762273", "0.5759523", "0.57157946", "0.56973946", "0.5637743", "0.56302476", "0.5628837", "0.56082815", "0.5602738", "0.55981684", "0.5555863", "0.55535316", "0.5552559", "0.554767", "0.5541587", "0.5530711", "0.5528415", "0.55045974", "0.5492791", "0.5480803", "0.54675734", "0.5460551", "0.54407424", "0.5435308", "0.5434612", "0.54043657", "0.5403452", "0.53954893", "0.539197", "0.5386057", "0.5381027", "0.538101", "0.53773296", "0.5372126", "0.5361637", "0.5361429", "0.53608125", "0.535564", "0.5353915", "0.5353129", "0.5348157", "0.53460485", "0.53435737", "0.5342345", "0.5338367", "0.5333809", "0.53323597", "0.5319152", "0.53179115", "0.53179115", "0.53074956", "0.53019875", "0.5290202", "0.52871346", "0.5284272", "0.52805734", "0.5279646", "0.5272937", "0.5270552", "0.5256258", "0.5246813", "0.52458984", "0.524456", "0.5244236", "0.52440274", "0.52433676", "0.5236834", "0.52238005", "0.522328", "0.52227277", "0.5218949", "0.5217387", "0.5216004", "0.52114713", "0.52065533", "0.52023816", "0.5202378", "0.5202101", "0.5201349", "0.51984465", "0.5190804", "0.5186297", "0.5186281", "0.518255", "0.5181184", "0.51795775", "0.51774025" ]
0.7086263
0
DELETE /prescription_rows/1 DELETE /prescription_rows/1.json
def destroy @prescription=Prescription.where(id: @prescription_row.id_prescription).first @prescription_row.destroy respond_to do |format| format.html { redirect_to @prescription, notice: 'Prescription row was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; 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 destroy\n @aquizitions_row.destroy\n respond_to do |format|\n format.html { redirect_to aquizitions_rows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @row.destroy\n respond_to do |format|\n format.html { redirect_to rows_url, notice: 'Row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tgl_row = TglRow.find(params[:id])\n @tgl_row.destroy\n\n respond_to do |format|\n format.html { redirect_to tgl_rows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @section_row.destroy\n respond_to do |format|\n flash[:success] = \"Section row was successfully destroyed.\"\n format.html { redirect_to section_rows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @java_dynamic_row = JavaDynamicRow.find(params[:id])\n @java_dynamic_row.destroy\n\n respond_to do |format|\n format.html { redirect_to java_dynamic_rows_url }\n format.json { head :ok }\n end\n end", "def destroy\n @container = @container_row.container\n @container_row.destroy\n respond_to do |format|\n flash[:success] = 'Row was successfully deleted.' \n format.html { redirect_to admin_container_url(@container) }\n format.json { head :no_content }\n end\n end", "def destroy\n @prescription_detail.destroy\n respond_to do |format|\n format.html { redirect_to prescription_details_url, notice: 'Prescription detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @row = Row.find(params[:id])\n @row.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n format.json { head :no_content }\n end\n end", "def destroy\n @table1_copy1.destroy\n respond_to do |format|\n format.html { redirect_to table1_copy1s_url, notice: 'Table1 copy1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prescription.destroy\n respond_to do |format|\n format.html { redirect_to prescriptions_url, notice: 'Prescription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete()\n db = PG connect( {dbname: 'bounty_hunter',\n host: 'localhost'\n })\n sql = 'DELETE from bounty_hunter'\n db.prepare('delete_one', sql)\n db.exec_prepared('delete_one', value)\n db.close()\nend", "def delete_one()\n #connect to db\n db = PG.connect({ dbname: \"bounty_hunters\", host: \"localhost\" })\n #write SQL statement string\n sql = \"DELETE FROM bounties WHERE id = $1\"\n #make values array - in this case it only needs one value\n values = [@id]\n #prepare statemnt\n db.prepare(\"delete_one\", sql)\n #run prepared statement\n db.exec_prepared(\"delete_one\", values)\n #close db link\n db.close()\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\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 delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete()\n sql = \"DELETE FROM transactions\n WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\n @users_prescription.destroy\n respond_to do |format|\n format.html { redirect_to users_prescriptions_url, notice: 'Users prescription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end", "def destroy\n logger.debug \"Deletion Transcription ID: \"+params[:id]\n @transcription = Transcription.find(params[:id])\n int_page_id = @transcription.page_id\n int_transcription_id = @transcriptionl.id\n @transcription.destroy\n\n arr_prev_page_data = get_prev_page_last_line_data(int_page_id)\n do_page_lines(arr_prev_page_data[0], arr_prev_page_data[1], int_page_id)\n\n str_redirect_link = \"/pages/\"[email protected]_page_id.to_s+\"/edit?notice=New%20Transcription%20With%20ID%20\"+int_transcription_id.to_s+\"%20Deleted\"\n\n respond_to do |format|\n format.html { redirect_to str_redirect_link }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def test_delete1()\n key = \"_Delete1\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end", "def destroy\n @library_row.destroy\n respond_to do |format|\n format.html { redirect_to library_rows_url, notice: 'Library row was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def delete\n sql = \"DELETE FROM albums WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def destroy\n @raw_datum = RawDatum.find(params[:id])\n @raw_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_data_url }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def delete_row lb # {{{\n index = lb.current_index\n id = lb.list[lb.current_index].first\n lb.list().delete_at(index)\n lb.touch\n ret = @db.execute(\"UPDATE #{@tablename} SET status = ? WHERE rowid = ?\", [ \"x\", id ])\nend", "def destroy\n @squadron_document = SquadronDocument.find(params[:id])\n @squadron_document.destroy\n\n respond_to do |format|\n format.html { redirect_to squadron_documents_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rowempl = Rowempl.find(params[:id])\n @rowempl.destroy\n\n respond_to do |format|\n format.html { redirect_to rowempls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def delete(query)\n\n connect if @persevere.nil?\n\n deleted = 0\n\n if ! query.is_a?(DataMapper::Query)\n resources = [query].flatten\n else\n resources = read_many(query)\n end\n\n resources.each do |resource|\n tblname = resource.model.storage_name\n id = resource.attributes(:field)['id']\n \n # Retrieve the ID from persever if the resource doesn't have an ID field\n if id.nil?\n query = Persevere.enhance(resource.query)\n path = \"/#{tblname}/#{query.to_json_query_filter}[={'id':id}]\"\n response = @persevere.retrieve(path, {})\n id = JSON.parse(response.body)[0]['id'].match(/(\\w+\\/)*(\\d+)/)[2]\n end\n \n path = \"/#{tblname}/#{id}\"\n # path = \"/#{tblname}/#{resource.key.first}\"\n \n DataMapper.logger.debug(\"(Delete) PATH/QUERY: #{path}\")\n\n result = @persevere.delete(path)\n\n if result.code == \"204\" # ok\n deleted += 1\n end\n end\n return deleted\n end", "def delete_plant_row(delete_name)\n CONNECTION.execute(\"DELETE FROM backyard WHERE name = '#{delete_name}';\")\nend", "def destroy\n @inscriptionprepaconcour = Inscriptionprepaconcour.find(params[:id])\n @inscriptionprepaconcour.destroy\n\n respond_to do |format|\n format.html { redirect_to inscriptionprepaconcours_url }\n format.json { head :no_content }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incrustation_tmp = @incrustation.dup\n @incrustation.destroy\n record_activity(@incrustation_tmp)\n respond_to do |format|\n format.html { redirect_to admin_incrustations_url, notice: 'Вставка была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def delete()\n\n db = PG.connect({dbname: \"pizza_shop\", host: \"localhost\"})\n sql = \"DELETE FROM pizza_orders WHERE id = $1\"\n values = [@id]\n db.prepare(\"Delete\", sql)\n db.exec_prepared(\"Delete\", values)\n db.close\n\n end", "def destroy\n @purchase_datum.destroy\n respond_to do |format|\n format.html { redirect_to purchase_data_url }\n format.json { head :no_content }\n end\n end", "def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def destroy\n @import_trial_log_datum.destroy\n respond_to do |format|\n format.html { redirect_to import_trial_log_data_url, notice: 'Import trial log datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @transcription.destroy\n respond_to do |format|\n format.html { redirect_to transcriptions_url, notice: 'Transcription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end", "def destroy\n @electronic_prescription.destroy\n respond_to do |format|\n format.html { redirect_to electronic_prescriptions_url, notice: 'Electronic prescription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def borrar \n\n fiesta.destroy\n render json: fiesta \n end", "def destroy\n row = UserTrainingStory.find_by_id( params[:id] )\n # Keep in mind that destroy will return the destroyed row if it successful:\n is_ok = ( row && row.destroy ? true : false )\n render( status: (is_ok ? :ok : 422), json: { success: is_ok } )\n end", "def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @trial_document.destroy\n respond_to do |format|\n format.html { redirect_to trial_documents_url, notice: 'Trial document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @congestion = Congestion.find(params[:id])\n @congestion.destroy\n\n respond_to do |format|\n format.html { redirect_to congestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\");\nend", "def destroy\n @batch.destroy\n render json: @batch, status: :ok\n end", "def destroy\n set_t_correcteddatum\n @t_correcteddatum.destroy\n respond_to do |format|\n format.html { redirect_to t_correcteddata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requisition = Requisition.find(params[:id])\n @requisition.destroy\n\n respond_to do |format|\n format.html { redirect_to requisitions_url }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end", "def delete\n DB.exec(\"DELETE FROM line WHERE id = #{self.id};\")\n end", "def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end", "def delete()\n db = PG.connect({ dbname: 'Music_Collection', host: 'localhost'})\n sql = \n \"\n DELETE FROM Music_Collection where id = #{@id};\n \"\n db.exec(sql)\n db.close()\nend", "def delete\n \n end", "def test_delete_table_row\n remote_file_name = 'TestDeleteTableRow.docx'\n\n upload_file File.join(local_test_folder, local_file), remote_data_folder + '/' + remote_file_name\n\n request = DeleteTableRowRequest.new(name: remote_file_name, table_path: 'tables/1', index: 0, folder: remote_data_folder)\n\n @words_api.delete_table_row(request)\n end", "def destroy\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n @unsigned_columns_test.destroy\n\n respond_to do |format|\n format.html { redirect_to unsigned_columns_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @translations_versions_test.destroy\n respond_to do |format|\n format.html { redirect_to translations_versions_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_transaction = ClientTransaction.find(params[:id])\n @client_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to client_transactions_url }\n format.json { head :ok }\n end\n end", "def delete(id)\n @conn.exec(\"DELETE FROM students WHERE id = '#{id}';\")\nend", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @prescription_medicine.destroy\n respond_to do |format|\n format.html { redirect_to prescription_medicines_url, notice: 'Prescription medicine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invent_journal_line = InventJournalLine.find(params[:id])\n @invent_journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to invent_journal_lines_url }\n format.json { head :no_content }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete\n binding.pry\n DATABASE.execute(\"DELETE FROM contents WHERE id = #{id}\")\n end", "def delete() # EXTENSION\n sql = \"DELETE FROM films WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def delete_row(row)\n puts \"---------------------------\"\n puts \"| Delete Row |\"\n puts \"---------------------------\"\n @file.delete('row')\n puts @file\n puts \"\\n\"\n end", "def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum.destroy\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def test_delete_invoice_resource\n resource = :invoice\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end", "def delete\n @client.delete_document(@path)\n end", "def destroy\n @rower.destroy\n respond_to do |format|\n format.html { redirect_to rowers_url, notice: 'Rower was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end" ]
[ "0.71572876", "0.69639033", "0.67276305", "0.6638447", "0.66364783", "0.64451736", "0.6415882", "0.63976604", "0.63940984", "0.637693", "0.63256764", "0.63192636", "0.6314287", "0.6287831", "0.6281609", "0.6280975", "0.623191", "0.6223048", "0.62212116", "0.61885625", "0.617761", "0.616657", "0.61547285", "0.615415", "0.6152539", "0.61483485", "0.6148241", "0.6141501", "0.6132468", "0.6126098", "0.6118459", "0.61095136", "0.6104158", "0.6104056", "0.6098769", "0.609779", "0.6095595", "0.6093669", "0.60923016", "0.6091182", "0.60908616", "0.6083341", "0.60791475", "0.6075454", "0.60750365", "0.6070437", "0.6066824", "0.6056493", "0.6056018", "0.60529906", "0.60525286", "0.6046212", "0.6045603", "0.6025573", "0.6021311", "0.6018013", "0.60047925", "0.6001182", "0.60010105", "0.60003984", "0.5996328", "0.59899974", "0.59891635", "0.59878343", "0.5970339", "0.59685016", "0.59675974", "0.59661347", "0.5966066", "0.59622836", "0.59599715", "0.5959717", "0.595759", "0.5957405", "0.5955241", "0.5954612", "0.5954364", "0.59513146", "0.59497166", "0.59479135", "0.59455895", "0.594314", "0.5941668", "0.5941112", "0.59339637", "0.59337", "0.59334695", "0.59333766", "0.5931714", "0.5930841", "0.5926119", "0.59207124", "0.591937", "0.59173375", "0.591607", "0.59133273", "0.5912821", "0.59121794", "0.59121674", "0.59118843" ]
0.74570113
0
Use callbacks to share common setup or constraints between actions.
def set_prescription_row @prescription_row = PrescriptionRow.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 prescription_row_params params.require(:prescription_row).permit(:id_prescription, :id_product, :dose_per_ha) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Holds errors Helper functions Print installation errors
def print_errors puts " #{"== #{"Ruby 2D Installation Errors".error} =======================================\n"} #{$errors.join("\n ")}\n #{"======================================================================"}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error\n %i[error fatal]\n end", "def print_error\n puts @error_text if @error_text\n print_usage\n end", "def error!\n # Unhandled exception\n if @exception\n exception_message\n exit 2\n # Some checksums did not match?\n elsif !(invalid_packages.empty? && invalid_metadata_files.empty?)\n error_message\n exit 2\n # We don't have checksums for some packages?\n elsif unverifiable_package_count != 0\n unverifiable_packages_message\n exit 2\n else\n success_message\n exit 0\n end\n end", "def error_message\n if nagios_mode?\n puts \"CRIT: #{invalid_metadata_files.size} metadata files and #{invalid_packages.size} packages with invalid checksums\"\n else\n invalid_metadata_files.each do |metadata|\n msg metadata.explain_error\n end\n invalid_packages.each do |pkg|\n msg pkg.explain_error\n end\n end\n end", "def initialize_error_handlers\n #When an error occurrs, write nothing to stdout. We'll handle the errors ourselves\n Cspice_wrapper.errprt_c('SET', 0, 'NONE')\n\n #When an error happens, return from the erroring function, but do not abort the whole process\n Cspice_wrapper.erract_c('SET', 0, 'RETURN')\n end", "def gem_error(server)\n if(!server.command_available?)\n puts \"ERROR: The #{server.server} gem does not appear to be installed\"\n exit(1)\n end\n end", "def seriously_all_of_the_errors\n messages = errors.full_messages.reject { |e| e == \"#{I18n.t('nouns.extension').capitalize} version is invalid\" }\n\n extension_versions.each do |version|\n almost_everything = version.errors.full_messages.reject { |x| x =~ /Tarball can not be/ }\n messages += almost_everything\n end\n\n messages\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def stderr; end", "def stderr; end", "def stderr; end", "def stderr; end", "def errors(errors)\n output \"Errors Loading Players\"\n output \"======================\"\n \n errors.each do |error|\n output \"* #{error}\"\n end\n output \"* No errors to report :o)\" if errors.empty?\n \n blank_line\n end", "def shell_error_string ( e )\n if e > 32\n return nil\n else\n return case e\n when 0 then \"Out of memory or resources\"\n #define ERROR_FILE_NOT_FOUND 2L\n #define SE_ERR_FNF 2\n when 2 then \"File not found\"\n #define ERROR_PATH_NOT_FOUND 3L\n #define SE_ERR_PNF 3\n when 3 then \"Path not found\"\n #define SE_ERR_ACCESSDENIED 5\n when 5 then \"Access denied\"\n #define SE_ERR_OOM 8\n when 8 then \"Not enough memory\"\n #define ERROR_BAD_FORMAT 11L\n when 11 then \"Invalid exe\"\n #define SE_ERR_SHARE 26\n when 26 then \"Sharing violation\"\n #define SE_ERR_ASSOCINCOMPLETE 27\n when 27 then \"Invalid file association\"\n #define SE_ERR_DDETIMEOUT 28\n when 28 then \"DDE timeout\"\n #define SE_ERR_DDEFAIL 29\n when 29 then \"DDE fail\"\n #define SE_ERR_DDEBUSY 30\n when 30 then \"DDE busy\"\n #define SE_ERR_NOASSOC 31\n when 31 then \"No file association\"\n #define SE_ERR_DLLNOTFOUND 32\n when 32 then \"DLL not found\"\n else \"Unspecified error\"\n end # case\n end # else\nend", "def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend", "def errors_handling(err_code)\n\n\t\terr_code = err_code.to_i + 32000\n\n\t\t# PJL File System Errors (32xxx)\n\t\tfs_errors = {\n\t\t\t'32000' => 'General error',\n\t\t\t'32001' => 'Volume not available',\n\t\t\t'32002' => 'Disk full',\n\t\t\t'32003' => 'File not found',\n\t\t\t'32004' => 'No free file descriptors',\n\t\t\t'32005' => 'Invalid number of bytes',\n\t\t\t'32006' => 'File already exists',\n\t\t\t'32007' => 'Illegal name',\n\t\t\t'32008' => 'Can\\'t delete root',\n\t\t\t'32009' => 'File operation attempted on a directory',\n\t\t\t'32010' => 'Directory operation attempted on a file',\n\t\t\t'32011' => 'Not same volume',\n\t\t\t'32012' => 'Read only',\n\t\t\t'32013' => 'Directory full',\n\t\t\t'32014' => 'Directory not empty',\n\t\t\t'32015' => 'Bad disk',\n\t\t\t'32016' => 'No label',\n\t\t\t'32017' => 'Invalid parameter',\n\t\t\t'32018' => 'No contiguous space',\n\t\t\t'32019' => 'Can\\'t change root',\n\t\t\t'32020' => 'File Descriptor obsolete',\n\t\t\t'32021' => 'Deleted',\n\t\t\t'32022' => 'No block device',\n\t\t\t'32023' => 'Bad seek',\n\t\t\t'32024' => 'Internal error',\n\t\t\t'32025' => 'Write only',\n\t\t\t'32026' => 'Write protected',\n\t\t\t'32027' => 'No filename',\n\t\t\t'32051' => 'End of directory',\n\t\t\t'32052' => 'No file system',\n\t\t\t'32053' => 'No memory',\n\t\t\t'32054' => 'Vol name out of range',\n\t\t\t'32055' => 'Bad FS',\n\t\t\t'32056' => 'Hardware failure'\n\t\t}\n\n\t\tif (fs_errors.has_key?(err_code.to_s))\n\t\t\treturn fs_errors[err_code.to_s]\n\t\telse\n\t\t\treturn 'Bad command or error'\n\t\tend\n\tend", "def loose_errors\n err = []\n err << title\n err << authors\n err << s3_error_uploads\n err << url_error_validating\n\n err.flatten\n end", "def write_fatal_error message\n puts \"Error: #{message}. See spritemaster -h for usage\"\n exit\n end", "def check_error\n if @errors.empty?\n false\n else\n @log.error(@taskname) { \"--- Configuration for #{@taskname} ---\" }\n @doc.each do |doc|\n @log.error(@taskname) { \"#{doc}\" }\n end\n @log.error(@taskname) { \"--- Errors found for #{@taskname} ---\" }\n @errors.each do |error|\n @log.error(@taskname) { \" #{error}\" }\n end\n @log.fatal(@taskname) { 'terminated' }; exit\n end\n end", "def report_errors\n yield\n rescue Exception => e\n puts \"Exception occured while running sketch #{File.basename SKETCH_PATH}:\"\n puts e.to_s\n puts e.backtrace.join(\"\\n\")\n end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def printerr *s\n s.each do |_|\n Lib.g_application_command_line_printerr self.ffi_pointer, _.to_s+\"\\n\"\n end\n end", "def fatal; end", "def errors\n errors = []\n\n if repo_url\n begin\n uri = URI(repo_url)\n errors << \"Invalid repository URL. Only SSH supported at the moment. Expected format: ssh://host/path/to/repo.git\" \\\n unless uri.scheme == 'ssh'\n rescue URI::InvalidURIError\n errors << \"Invalid repository URL. Expected format: ssh://host/path/to/repo.git\"\n end\n end\n\n unless [ssh_private_file, ssh_public_file].select { |v| v } .empty?\n errors << \"Missing SSH user.\" unless ssh_user\n errors << \"Missing private SSH key.\" unless ssh_private_file\n errors << \"Missing public SSH key.\" unless ssh_public_file\n end\n\n unless [docker_user, docker_password, docker_email].select { |v| v } .empty?\n errors << \"Missing Docker user.\" unless docker_user\n errors << \"Missing Docker password.\" unless docker_password\n errors << \"Missing Docker email.\" unless docker_email\n end\n\n if ping_url\n begin\n uri = URI(ping_url)\n errors << \"Invalid ping URL. Only HTTP / HTTPS supported at the moment. Expected format: https://domain.tld/api/notify\" \\\n unless uri.scheme == 'http' || uri.scheme == 'https'\n rescue URI::InvalidURIError\n errors << \"Invalid ping URL. Expected format: https://domain.tld/api/notify\"\n end\n end\n\n errors\n end", "def error(ex) [:error, ex]; end", "def output_terminal_errors\n errors.each { |error| plain_output(error.to_s, 'red') }\n plain_output(\"\\nPlease go to https://rails-bestpractices.com to see more useful Rails Best Practices.\", 'green')\n if errors.empty?\n plain_output(\"\\nNo warning found. Cool!\", 'green')\n else\n plain_output(\"\\nFound #{errors.size} warnings.\", 'red')\n end\n end", "def error_messages; end", "def usage_error\n $stderr.printf(\"%s\\n\", usage)\n exit(-1)\n end", "def error(msg) $stderr.puts(\"Error: #{msg}\") end", "def check_errors;\n end", "def external_errors\n @external_errors ||= {}\n end", "def error\n end", "def error\n end", "def write_error_info\n end", "def error_email(miner, errors)\n @miner = miner\n @errors = errors\n mail subject: \"[#{ENV['INSTALLATION_TYPE']}][MINER #{miner.name}] Mining Errors\", to: '[email protected]'\n end", "def run\n before_install\n run_steps\n return true\n rescue Abort\n puts\n return false\n rescue SignalException, SystemExit\n raise\n rescue PlatformInfo::RuntimeError => e\n new_screen\n puts \"<red>An error occurred</red>\"\n puts\n puts e.message\n exit 1\n rescue Exception => e\n show_support_options_for_installer_bug(e)\n exit 2\n ensure\n after_install\n end", "def errorhandling\n end", "def show_error(text)\n puts Header % ['No', text]\n puts Footer % Version\nend", "def error_list(strict=false)\n errors = []\n \n if @new_user && !@user_over_13\n errors << \"Users must be 13 or older to register on this system\"\n return errors\n end\n\n if @data_object.user_affiliate == Affiliate::NONE.to_s\n errors << \"Please specify an affiliate\"\n end\n\n errors.concat contact.error_list(strict || contact.con_email.empty?)\n end", "def contact_errors\n error \"name\"\n error \"age\"\n error \"homepage\"\n end", "def errors\n err = []\n err << article_id\n err << title\n err << authors\n err << research_domain\n err << funder\n err << abstract\n err << subjects\n\n err << s3_error_uploads\n err << url_error_validating\n err << over_file_count\n err << over_files_size\n err << data_required\n\n err.flatten\n end", "def error_messages\n {\n TPL_SECTION_NOT_FOUND_ERROR => 'The requested section was not found.',\n TPL_NO_SECTION_SELECTED_ERROR => 'No section has been selected.',\n TPL_SYNTAX_ERROR => 'A syntax error was detected.',\n TPL_NOT_FOUND_ERROR => 'The requested object was not found.',\n TPL_READ_ERROR => 'An error occurred while reading.',\n TPL_WRITE_ERROR => 'An error occurred while writing.',\n TPL_OPEN_ERROR => 'An error occurred while opening the stream.'\n }\n end", "def chef_error(e)\n if e.is_a?(::RightScale::Exceptions::Exec)\n msg = \"External command error: \"\n if match = /RightScale::Exceptions::Exec: (.*)/.match(e.message)\n cmd_output = match[1]\n else\n cmd_output = e.message\n end\n msg += cmd_output\n msg += \"\\nThe command was run from \\\"#{e.path}\\\"\" if e.path\n elsif e.is_a?(::Chef::Exceptions::ValidationFailed) && (e.message =~ /Option action must be equal to one of:/)\n msg = \"[chef] recipe references an action that does not exist. #{e.message}\"\n elsif e.is_a?(::NoMethodError) && (missing_action_match = /undefined method .action_(\\S*)' for #<\\S*:\\S*>/.match(e.message)) && missing_action_match[1]\n msg = \"[chef] recipe references the action <#{missing_action_match[1]}> which is missing an implementation\"\n else\n msg = \"Execution error:\\n\"\n msg += e.message\n file, line, meth = e.backtrace[0].scan(BACKTRACE_LINE_REGEXP).flatten\n line_number = line.to_i\n if file && line && (line_number.to_s == line)\n dir = AgentConfig.cookbook_download_dir\n if file[0..dir.size - 1] == dir\n path = \"[COOKBOOKS]/\" + file[dir.size..file.size]\n else\n path = file\n end\n msg += \"\\n\\nThe error occurred line #{line} of #{path}\"\n msg += \" in method '#{meth}'\" if meth\n context = \"\"\n if File.readable?(file)\n File.open(file, 'r') do |f|\n lines = f.readlines\n lines_count = lines.size\n if lines_count >= line_number\n upper = [lines_count, line_number + 2].max\n padding = upper.to_s.size\n context += context_line(lines, line_number - 2, padding)\n context += context_line(lines, line_number - 1, padding)\n context += context_line(lines, line_number, padding, '*')\n context += context_line(lines, line_number + 1, padding)\n context += context_line(lines, line_number + 2, padding)\n end\n end\n end\n msg += \" while executing:\\n\\n#{context}\" unless context.empty?\n end\n end\n msg\n end", "def error( text )\n puts \"Script #{@name} #{version} - Error: #{text}\"\n exit 1\n end", "def errors=(_); end", "def errors\n errors = []\n unless @method_name.present?\n errors << \"method_name is not set\"\n end\n unless @service_name.present?\n errors << \"service_name is not set\"\n end\n unless @server_address.present?\n errors << \"server_address is not set\"\n end\n errors\n end", "def print_error(msg='')\n end", "def rpt_error(error_list)\n file_name = @dir + \"rpt_error_list.txt\"\n printf(\"@I:generate %s\\n\",file_name)\n f = open(\"#{file_name}\",\"w\")\n comment = \"Error attribute list refferd from Synplify Rpt file\" \n Common.print_file_header(f,\"#{comment}\",$TOOL,$VERSION,\"##\") \n print_synplify_rpt(f,error_list)\n f.close\n end", "def error_log\n end", "def error_log\n end", "def error_log\n end", "def output_error(cmd)\n puts \"La commande '#{cmd}' n'existe pas ou a été mal formulée.\".red\n end", "def error?; end", "def error?; end", "def error?; end", "def fatalerror( err_msg )\n# Display a fatal error and quit. -----------------------------------\n if ($gTest_params[\"logfile\"])\n $fLOG.write(\"\\nsubstitute-h2k.rb -> Fatal error: \\n\")\n $fLOG.write(\"#{err_msg}\\n\")\n end\n print \"\\n=========================================================\\n\"\n print \"substitute-h2k.rb -> Fatal error: \\n\\n\"\n print \" #{err_msg}\\n\"\n print \"\\n\\n\"\n print \"substitute-h2k.rb -> Other Error or warning messages:\\n\\n\"\n print \"#{$ErrorBuffer}\\n\"\n exit() # Run stopped\nend", "def error\n\t\tputs \"*********************\"\n\t\tputs \"<ERROR> Invalid input\"\n\t\tputs \"*********************\"\n\tend", "def print_error(msg)\n interface.errmsg(msg)\n interface.puts(option_parser.help)\n end", "def error\n\tyield\n\tif @changedConfigDir or @changedConfigFile\n\t\tif @opts[:stealth]\n\t\t\tstealth\n\t\telse\n\t\t\tLog.warn \"Permanent changes to the servers configuration have been made, these will have to be undone to stay hidden\"\n\t\tend\n\tend\n\texit 1\nend", "def trace_errors\n getErrors.each { |e|\n puts \"(#{e.object || ''}): #{e.error}\"\n }\n end", "def exit_error\n puts \"An error occured during the packer run.\\nSee the above output for more details.\".to_red\n exit!\n end", "def error_message; end", "def error_namespace; \"vagrant.errors\"; end", "def setup_failed(ant)\n end", "def check_sanity\n errors = []\n [:site, :uri, :user, :password, :confdir].each do |sym|\n if @config[sym].nil?# or @config[sym].empty?\n errors << \"Option '#{sym}' is required\"\n end\n end\n unless errors.empty?\n $stderr.puts 'ERROR: The following problems were detected:'\n errors.map { |e| $stderr.puts \" * #{e}\" }\n $stderr.puts \"\\nConfiguration options:\\n\"\n ap @config\n exit 1\n end\n end", "def config_error(path, error); end", "def format_error_report(errors)\n return if errors.empty?\n errors.map { |error| \"* #{error}\" }.join(\"\\n\")\n end", "def error(*args); end", "def error_version_help\n if @parsed_options.show_version then\n $stdout.puts \"#{@parser.program_name}: version #{HALog::VERSION}\"\n exit 0\n elsif @parsed_options.show_help then\n $stdout.puts @parser.to_s\n exit 0\n elsif @error_message then\n $stderr.puts @error_message\n exit 1\n end\n end", "def show_error_encountered(error)\n print \"\\033[31mError encountered:\\033[0m\\n\"\n print error.inspect\n end", "def error(exception) nil ; end", "def check_errors;\n end", "def error\n nil\n end", "def set_errors\n @auth_errors = {\n missing_email: \"Error: you must provide an email address.\", \n missing_password: \"Error: you must provide a password.\", \n bad_credentials: \"Error: the provided email address and password do not match.\", \n nonexistent_user: \"Error: the user you are trying to authenticate doesn't exist.\",\n }\n end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors\n @errors || (@env && (@errors = @env['rack.errors'])) || STDERR\n end", "def puts_error(msg)\n warn \"\\e[31m[ERROR] #{msg}\\e[0m\" if Calamum::Config[:debug]\n exit(1)\nend", "def script_error(path, error); end", "def error\n\tputs \" - Dis donc #{@name}, tu vois pas que c'est pas possible ?!? Allez rejoue ! \"\n\tputs \" \"\n end", "def error_and_exit(dup)\n return if dup == \"none\"\n Chef::Log.info \"#########################\"\n Chef::Log.info \"ERROR: #{dup} is mounted twice!!!\"\n Chef::Log.info \"#########################\"\n exit 1\n end", "def error_and_exit(msg = nil)\n CE.fg(:yellow)\n puts 'Invalid command error.'\n CE.fg(:red)\n puts \" [Error] #{msg}\" if msg\n CE.fg(:yellow)\n puts \" your command : bucky #{ARGV.join(' ')}\"\n puts ' Please input some commands.'\n puts \" e.g. bucky #{NEW_COMMAND.join(' ')}\"\n puts \" bucky #{RUN_COMMAND.join(' ')}\"\n puts \" bucky #{MAKE_SERVICE_COMMAND.join(' ')}\"\n puts \" bucky #{MAKE_PAGE_COMMAND.join(' ')}\"\n puts \" bucky #{RERUN_COMMAND.join(' ')}\"\n puts \" bucky #{LINT_COMMAND.join(' ')}\"\n exit\nend", "def error\n []\n end" ]
[ "0.6542539", "0.6495752", "0.6468784", "0.634068", "0.63373524", "0.6313754", "0.62557095", "0.6193081", "0.6193081", "0.6193081", "0.6193081", "0.6193081", "0.6193081", "0.6193081", "0.6193081", "0.6193081", "0.61435694", "0.61435694", "0.61435694", "0.61435694", "0.6118537", "0.6090499", "0.6074777", "0.6074777", "0.6000883", "0.59678984", "0.59667796", "0.59245974", "0.5919113", "0.5919113", "0.5919113", "0.5919113", "0.5919113", "0.5919113", "0.5919113", "0.5900597", "0.5892523", "0.5885325", "0.58731216", "0.585404", "0.58071256", "0.5799425", "0.57943016", "0.5780295", "0.5779024", "0.5777256", "0.57625544", "0.57466483", "0.5746181", "0.5739585", "0.5736688", "0.5731737", "0.57277244", "0.57131207", "0.5697179", "0.5690073", "0.5688543", "0.5682686", "0.56632966", "0.5657012", "0.5651052", "0.56474143", "0.56405145", "0.56405145", "0.56405145", "0.5626159", "0.5618256", "0.5618256", "0.5618256", "0.560753", "0.55948865", "0.55921876", "0.55776304", "0.5575764", "0.55743635", "0.5566568", "0.5565091", "0.5557872", "0.5555327", "0.55454415", "0.55452543", "0.5541616", "0.553828", "0.55337286", "0.5530864", "0.55295837", "0.55251884", "0.5524956", "0.5513876", "0.5513876", "0.5513876", "0.5513876", "0.5508726", "0.55069906", "0.5496261", "0.54859215", "0.5484049", "0.5483685", "0.5483286" ]
0.7611388
0
Add compiler and linker flags
def add_flags(type, flags) case type when :c $CFLAGS << " #{flags} " when :ld $LDFLAGS << " #{flags} " end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_codethink_compiler_flags(platform, env = {}, opts = {})\n env = with_standard_compiler_flags(env = env, opts = opts)\n\n compiler_flags =\n {\n \"LDFLAGS\" => \"-Wl,-rpath,#{install_dir}/lib -L#{install_dir}/lib\",\n \"CFLAGS\" => \"-I#{install_dir}/include -O2\",\n }\n\n return env.merge(compiler_flags).\n merge(\"CXXFLAGS\" => compiler_flags[\"CFLAGS\"]).\n merge(\"CPPFLAGS\" => compiler_flags[\"CFLAGS\"])\nend", "def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend", "def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend", "def addCFlags(flags) @CFLAGS = ensureArray(flags) + @CFLAGS end", "def add_compile_flags(*flags)\n @flags.push(*flags)\n end", "def append_ld_flags(flags)\n flags = [flags] unless flags.is_a?(Array)\n with_ldflags(\"#{$LDFLAGS} #{flags.join(' ')}\") { true }\nend", "def add_cxxflags(flags)\n @flags << flags\n end", "def add_cxxflags(flags)\n @flags << flags\n end", "def flags\n input = @flags.clone\n tok = []\n\n # Set the output path\n throw 'Output pathname is required' if @output.nil?\n if Platform.is_windows?\n tok.push \"/OUT:\\\"#{@output}\\\"\"\n tok.push '/DLL' if @output =~ /\\.dll/i\n else\n tok.push '-o', @output\n end\n\n # Enable shared library output\n if @shared_library\n if Platform.is_windows?\n tok.push '/DLL'\n else\n tok.push '-shared'\n tok.push '-fPIC'\n end\n end\n\n # Assume that we want to link with shared libraries\n # built within this project\n unless Platform.is_windows?\n tok.push '-L', '.'\n end\n\n # Override the normal search path for the dynamic linker\n unless @rpath.nil?\n if Platform.is_solaris?\n input.push ['R', @rpath]\n elsif Platform.is_linux?\n input.push ['-rpath', @rpath]\n elsif Platform.is_windows?\n # XXX-FIXME Windows does not support the rpath concept\n else\n throw 'Unsupported OS'\n end\n input.push ['-L', @rpath]\n end\n\n input.each do |f|\n if @gcc_flags == true\n if f.kind_of?(Array)\n if f[0] == '-L'\n tok.push f.join(' ')\n else\n tok.push '-Wl,' + f[0] + ',' + f[1]\n end\n else\n tok.push '-Wl,' + f\n end\n else\n if f.kind_of?(Array)\n tok.push f.flatten.join(' ')\n else\n tok.push f\n end\n end\n end\n\n res = ' ' + tok.join(' ')\n return res\n end", "def add_link_flags(*flags)\n @libs.push(*flags)\n end", "def with_standard_compiler_flags(env = {}, opts = {})\n env ||= {}\n opts ||= {}\n compiler_flags =\n case Ohai[\"platform\"]\n when \"aix\"\n {\n \"CC\" => \"xlc_r -q64\",\n \"CXX\" => \"xlC_r -q64\",\n \"CFLAGS\" => \"-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O\",\n \"LDFLAGS\" => \"-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib\",\n \"LD\" => \"ld -b64\",\n \"OBJECT_MODE\" => \"64\",\n \"ARFLAGS\" => \"-X64 cru\",\n }\n when \"solaris2\"\n {\n \"CC\" => \"gcc -m64 -static-libgcc\",\n \"LDFLAGS\" => \"-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc\",\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include -O2\",\n }\n when \"freebsd\"\n {\n \"CC\" => \"clang\",\n \"CXX\" => \"clang++\",\n \"LDFLAGS\" => \"-L#{install_dir}/embedded/lib -Wl,-rpath,#{install_dir}/embedded/lib\",\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector\",\n }\n when \"windows\"\n arch_flag = windows_arch_i386? ? \"-m32\" : \"-m64\"\n opt_flag = windows_arch_i386? ? \"-march=i686\" : \"-march=x86-64\"\n {\n \"LDFLAGS\" => \"-L#{install_dir}/embedded/lib #{arch_flag} -fno-lto\",\n # We do not wish to enable SSE even though we target i686 because\n # of a stack alignment issue with some libraries. We have not\n # exactly ascertained the cause but some compiled library/binary\n # violates gcc's assumption that the stack is going to be 16-byte\n # aligned which is just fine as long as one is pushing 32-bit\n # values from general purpose registers but stuff hits the fan as\n # soon as gcc emits aligned SSE xmm register spills which generate\n # GPEs and terminate the application very rudely with very little\n # to debug with.\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include #{arch_flag} -O3 #{opt_flag}\",\n }\n else\n {\n \"LDFLAGS\" => \"-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib\",\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector\",\n }\n end\n\n # merge LD_RUN_PATH into the environment. most unix distros will fall\n # back to this if there is no LDFLAGS passed to the linker that sets\n # the rpath. the LDFLAGS -R or -Wl,-rpath will override this, but in\n # some cases software may drop our LDFLAGS or think it knows better\n # and edit them, and we *really* want the rpath setting and do know\n # better. in that case LD_RUN_PATH will probably survive whatever\n # edits the configure script does\n extra_linker_flags = {\n \"LD_RUN_PATH\" => \"#{install_dir}/embedded/lib\",\n }\n\n if solaris2?\n ld_options = \"-R#{install_dir}/embedded/lib\"\n\n if platform_version.satisfies?(\"<= 5.10\")\n # in order to provide compatibility for earlier versions of libc on solaris 10,\n # we need to specify a mapfile that restricts the version of system libraries\n # used. See http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter5-1.html\n # for more information\n # use the mapfile if it exists, otherwise ignore it\n mapfile_path = File.expand_path(Config.solaris_linker_mapfile, Config.project_root)\n ld_options << \" -M #{mapfile_path}\" if File.exist?(mapfile_path)\n end\n\n # solaris linker can also use LD_OPTIONS, so we throw the kitchen sink against\n # the linker, to find every way to make it use our rpath. This is also required\n # to use the aforementioned mapfile.\n extra_linker_flags[\"LD_OPTIONS\"] = ld_options\n end\n\n env.merge(compiler_flags)\n .merge(extra_linker_flags).\n # always want to favor pkg-config from embedded location to not hose\n # configure scripts which try to be too clever and ignore our explicit\n # CFLAGS and LDFLAGS in favor of pkg-config info\n merge({ \"PKG_CONFIG_PATH\" => \"#{install_dir}/embedded/lib/pkgconfig\" }).\n # Set default values for CXXFLAGS and CPPFLAGS.\n merge(\"CXXFLAGS\" => compiler_flags[\"CFLAGS\"])\n .merge(\"CPPFLAGS\" => compiler_flags[\"CFLAGS\"])\n .merge(\"OMNIBUS_INSTALL_DIR\" => install_dir)\n end", "def set_rpi_flags\n if $platform == :linux_rpi\n add_flags(:c, '-I/opt/vc/include')\n add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')\n end\nend", "def set_rpi_flags\n if $platform == :linux_rpi\n add_flags(:c, '-I/opt/vc/include')\n add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')\n end\nend", "def setCFlags(flags) @CFLAGS = ensureArray(flags) end", "def exported_linker_flags\n (filter_targets(@targets, 'apple_library') + filter_targets(@targets, 'prebuilt_cxx_library')).map { |json| json[LINKER_FLAGS] }.compact.flatten\n end", "def cflags(cc_path)\n res = []\n if cc_path =~ /clang/\n res.push '-gcc-toolchain', @ndk_path + '/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86'\n res.push '-isystem', @ndk_path + '/toolchains/llvm-3.1/prebuilt/linux-x86/lib/clang/3.1/include'\n res.push %w{ -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -target armv7-none-linux-androideabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -I. -DANDROID -fblocks -D_GNU_SOURCE -D__BLOCKS__ -Wa,--noexecstack -O0 -g }\n res.push \"-I#{@ndk_path}/platforms/android-14/arch-arm/usr/include\"\n end\n res.flatten\n end", "def ld_flags(app)\n flags = []\n flags << '-ObjC'\n flags += app.frameworks.collect{|f| \"-framework #{f}\"}\n flags.join(\" \")\n end", "def link exe, objects\n sh \"gcc #{objects.join ' '} -o #{exe} #{L_FLAGS.join ' '}\"\nend", "def default_flags\n ldflags = []\n\n # GCC on Solaris 10 produces 32-bit code by default, so add -m64\n # when running in 64-bit mode.\n if Platform.is_solaris? and Platform.word_size == 64\n ldflags.push '-m64'\n ldflags.push '-R/usr/sfw/lib/amd64' if Platform.is_x86?\n end\n\n ldflags\n end", "def linker_options component,system_config\n config=system_config.platform_config(component.platform)\n options= config.fetch('linker_options','').split(' ')\n options<< \"#{config['linker_out']}\\\"#{executable(component,system_config)}\\\"\"\n objects=component.sources.map{|src| object_file(src,component,system_config)}\n component.dependencies.each{|dep| objects+=dep.sources.map{|src| object_file(src,dep,system_config)}}\n objects.uniq!\n options+= prefixed_objects(objects,config[\"linker_in\"])\n shared_libs=component.shared_dependencies.map{|dep| library(dep,system_config)}\n options+= prefixed_objects(shared_libs,config[\"linker_shared\"]) \n options+= prefixed_objects(component.external_libraries,config[\"linker_lib\"])\n end", "def folly_flags()\n return NewArchitectureHelper.folly_compiler_flags\nend", "def compiler_options\n options = {}\n options['tmp_dir'] = @tmp_dir if @tmp_dir\n options['lib_dir'] = @lib_dir if @lib_dir\n options['config_script'] = @config_script if @config_script\n options['config_options'] = @config_options if @config_options\n #options['cross_config_options'] = @cross_config_options\n options\n end", "def build_flags_cross\n # Unclear if we need config_site CONFIG_SITE=/etc/dpkg-cross/cross-config.i386\n [] << '-a' << cross_arch\n end", "def linker_options(component, system_config)\n config = system_config.platform_config(component.platform)\n options = config.fetch(\"linker_options\", \"\").split(\" \")\n options << \"#{config[\"linker_out\"]}\\\"#{executable(component, system_config)}\\\"\"\n objects = component.sources.map { |src| object_file(src, component, system_config) }\n component.dependencies.each { |dep| objects += dep.sources.map { |src| object_file(src, dep, system_config) } }\n objects.uniq!\n options += prefixed_objects(objects, config[\"linker_in\"])\n shared_libs = component.shared_dependencies.map { |dep| library(dep, system_config) }\n options += prefixed_objects(shared_libs, config[\"linker_shared\"])\n options += prefixed_objects(component.external_libraries, config[\"linker_lib\"])\n end", "def collect_build_args\n build_flags = []\n\n build_flags << \"--HEAD\" if HEAD?\n build_flags << \"--universal\" if build_universal?\n build_flags << \"--build-bottle\" if build_bottle?\n build_flags << \"--build-from-source\" if build_from_source?\n\n build_flags\n end", "def make_deps t\n sh \"gcc -MM -MF #{t.name} #{$C_FLAGS.join ' '} -c #{t.source}\"\nend", "def compile\n LIBRARIES.each do |library|\n system \"gcc -march=x86_64 -Wall -bundle -bundle_loader /usr/local/mysql/bin/mysqld -o #{library}.so `/usr/local/mysql/bin/mysql_config –cflags` #{library}.c\"\n end\nend", "def compile obj, src\n sh \"gcc #{$C_FLAGS.join ' '} -c #{src} -o #{obj}\"\nend", "def translate_ldadd(ldadd)\n static_libs = []\n # TODO: shared libs\n ldadd.each do |item|\n if item =~ /\\.a$/ \n if provides?(item) or item =~ /^obj\\/local\\//\n static_libs.push File.basename(item).sub(/\\.a$/, '-static')\n else\n static_libs.push File.basename(item).sub(/\\.a$/, '-prebuilt')\n end\n end\n end\n \n buf = ''\n buf += 'LOCAL_STATIC_LIBRARIES := ' + static_libs.join(' ') if static_libs\n buf\n end", "def rule\n [ '$(CC)', '-DHAVE_CONFIG_H', '-I.', flags, '$(CFLAGS)', '-c', @sources ].flatten.join(' ')\n end", "def set_platform_opts\n\n # Expand any embedded variables (like '$(CC)')\n CONFIG[\"CC\"] = RbConfig::CONFIG[\"CC\"]\n CONFIG[\"LDSHARED\"] = RbConfig::CONFIG[\"LDSHARED\"]\n\n # Make sure we have a CXX value (sometimes there isn't one)\n CONFIG[\"CXX\"] = CONFIG[\"CC\"] unless CONFIG.has_key?(\"CXX\")\n\n # O/S specific oddities\n\n case p4osname\n when /DARWIN/\n CONFIG['CC'] = 'xcrun c++'\n CONFIG['CXX'] = 'xcrun c++'\n CONFIG['LDSHARED'] = CONFIG['CXX'] + ' -bundle'\n when /FREEBSD/, /LINUX/\n # FreeBSD 6 and some Linuxes use 'cc' for linking by default. The\n # gcc detection patterns above won't catch that, so for these\n # platforms, we specifically convert cc to c++.\n CONFIG['LDSHARED'].sub!(/^cc/, 'c++')\n when /MINGW32/\n # When building with MinGW we need to statically link libgcc\n # and make sure we're linking with gcc and not g++. On older\n # Rubies, they use LDSHARED; newer ones (>=1.9) use LDSHAREDXX\n CONFIG['LDSHARED'].sub!(/g\\+\\+/, 'gcc')\n CONFIG['LDSHAREDXX'].sub!(/g\\+\\+/, 'gcc')\n CONFIG['LDSHARED'] = CONFIG['LDSHARED'] + ' -static-libgcc'\n CONFIG['LDSHAREDXX'] = CONFIG['LDSHARED'] + ' -static-libgcc'\n end\nend", "def compile_native\n\n # Get include directories\n incl_dir_ruby2d = \"#{Ruby2D.gem_dir}/ext/ruby2d/\"\n incl_dir_deps = \"#{Ruby2D.assets}/include/\"\n\n # Add compiler flags for each platform\n case $RUBY2D_PLATFORM\n\n when :macos\n ld_dir = \"#{Ruby2D.assets}/macos/universal/lib\"\n\n c_flags = '-arch arm64 -arch x86_64'\n\n ld_flags = ''\n ['mruby', 'SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf',\n 'jpeg', 'jxl', 'avif', 'png', 'tiff', 'webp',\n 'mpg123', 'ogg', 'FLAC', 'vorbis', 'vorbisfile', 'modplug',\n 'freetype', 'harfbuzz', 'graphite2'].each do |name|\n add_ld_flags(ld_flags, name, :archive, ld_dir)\n end\n\n ld_flags << \"-lz -lbz2 -liconv -lstdc++ \"\n ['Cocoa', 'Carbon', 'CoreVideo', 'OpenGL', 'Metal', 'CoreAudio', 'AudioToolbox',\n 'IOKit', 'GameController', 'ForceFeedback', 'CoreHaptics'].each do |name|\n add_ld_flags(ld_flags, name, :framework)\n end\n\n when :linux, :linux_rpi, :bsd\n # TODO: implement this\n # ld_flags = '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm -lGL'\n\n when :windows\n\n if RUBY_PLATFORM =~ /ucrt/\n ld_dir = \"#{Ruby2D.assets}/windows/mingw-w64-ucrt-x86_64/lib\"\n else\n ld_dir = \"#{Ruby2D.assets}/windows/mingw-w64-x86_64/lib\"\n end\n\n ld_flags = '-static -Wl,--start-group '\n ['mruby',\n 'SDL2',\n 'SDL2_image', 'jpeg', 'png', 'tiff', 'webp', 'jxl', 'hwy', 'jbig', 'deflate', 'lzma', 'zstd', 'Lerc',\n 'SDL2_mixer', 'mpg123', 'FLAC', 'vorbis', 'vorbisfile', 'ogg', 'modplug', 'opus', 'opusfile', 'sndfile',\n 'SDL2_ttf', 'freetype', 'harfbuzz', 'graphite2', 'bz2', 'brotlicommon', 'brotlidec',\n 'glew32', 'stdc++', 'z', 'ssp'\n ].each do |name|\n add_ld_flags(ld_flags, name, :archive, ld_dir)\n end\n ld_flags << '-lmingw32 -lopengl32 -lole32 -loleaut32 -limm32 -lversion -lwinmm -lrpcrt4 -mwindows -lsetupapi -ldwrite '\\\n '-lws2_32 -lshlwapi '\n ld_flags << '-Wl,--end-group'\n end\n\n # Compile the app\n run_cmd \"cc #{c_flags} -I#{incl_dir_ruby2d} -I#{incl_dir_deps} build/app.c #{ld_flags} -o build/app\"\n\n create_macos_bundle if $RUBY2D_PLATFORM == :macos\nend", "def initialize(params)\n\t\t@CC = params[:cc] || params[:gcc]\n\t\t@CXX = params[:cxx] || params[:gcc]\n\t\t@FCC = params[:fcc] || params[:gcc]\n\t\t@LD = params[:ld] || params[:gcc]\n\t\t@CFLAGS = params[:cflags] || []\n\t\t@CXXFLAGS = params[:cxxflags] || []\n\t\t@FFLAGS = params[:fflags] || []\n\t\t@LDFLAGS = params[:ldflags] || []\n\t\t@INCDIRS = params[:incdirs] || []\n\t\t\n\t\t#find a directory we can scratch in\n\t\t@tmpdir = BuildEnv::buildTreeRoot().join('tmp');\n\t\t`mkdir -p #{@tmpdir}`;\n\tend", "def command\n log.debug self.pretty_inspect\n\n throw 'Invalid linker' unless @ld.is_a?(Linker)\n throw 'One or more source files are required' unless @sources.length > 0\n# cflags = default_flags\n# cflags.concat @flags\n# end\n# throw cflags\n\n# topdir = h[:topdir] || ''\n# ld = @ld\n# ldadd = h[:ldadd]\n# ld.flags = h[:ldflags]\n# ld.output = Platform.pathspec(h[:output])\n# ld.rpath = h[:rpath] if h[:rpath].length > 0\n\n# inputs = h[:sources]\n# inputs = [ inputs ] if inputs.is_a? String\n# inputs = inputs.map { |x| Platform.pathspec(topdir + x) }\n# throw 'One or more sources are required' unless inputs.count\n\n#TODO:if @combine\n# return [ @path, cflags, '-combine', ldflags, inputs, ldadd ].flatten.join(' ')\n#\n \n cmd = [ @path, '-DHAVE_CONFIG_H', '-I.', @platform_cflags, flags, '-c', @sources ].flatten.join(' ')\n\n cmd += Platform.dev_null if @quiet\n\n log.debug \"Compiler command: #{cmd}\"\n\n cmd\n end", "def add(compiler)\n @compilers ||= []\n @compilers |= [compiler]\n end", "def use_usr_libs\n # Add flags\n set_rpi_flags\n add_flags(:c, '-I/usr/local/include')\nend", "def compileCXX(params)\n\t\tsrc = requireParam(params, :src)\n\t\ttarget = requireParam(params, :target)\n\t\totherOptions = params[:opts] || []\n\t\t\n\t\tprintAndCall(\"#{compileCmd(src)} #{otherOptions.join(' ')} #{@INCDIRS.map {|dirpath| \"-I#{dirpath}\"}.join(' ')} -o #{target} -c #{src}\")\n\tend", "def command_compiler_options\n command_options.merge(use: command_plugins.keys, plugins_options: command_plugins)\n end", "def install\n system \"./configure\", \"--disable-dependency-tracking\", \"--enable-shared\",\n \"--prefix=#{prefix}\"\n system \"rm\", \"src/bits.o\", \"src/c_dd.o\", \"src/c_qd.o\", \"src/dd_const.o\", \"src/dd_real.o\", \"src/fpu.o\", \"src/qd_const.o\", \"src/qd_real.o\", \"src/util.o\"\n system \"rm\", \"src/bits.lo\", \"src/c_dd.lo\", \"src/c_qd.lo\", \"src/dd_const.lo\", \"src/dd_real.lo\", \"src/fpu.lo\", \"src/qd_const.lo\", \"src/qd_real.lo\", \"src/util.lo\"\n system \"make\"\n system \"make\", \"install\"\n end", "def options\n [['--with-debug', 'Build debug and release libraries.']]\n end", "def flag_args(ci_gcc_config)\n return [] if ci_gcc_config[:flags].nil?\n\n ci_gcc_config[:flags]\n end", "def set_linux_bsd_flags\n check_sdl\n set_rpi_flags\n add_flags(:ld, \"-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm\")\n if $RUBY2D_PLATFORM == :linux then add_flags(:ld, '-lGL') end\nend", "def scalac_args #:nodoc:\n args = []\n args << '-nowarn' unless options[:warnings]\n args << '-verbose' if trace?(:scalac)\n if !!options[:debug]\n args << (Scala.version?(2.7, 2.8) ? '-g' : '-g:vars')\n elsif options[:debug]\n args << \"-g:#{options[:debug]}\"\n end\n args << '-deprecation' if options[:deprecation]\n args << '-optimise' if options[:optimise]\n args << '-target:jvm-' + options[:target].to_s if options[:target]\n args += Array(options[:other])\n if zinc?\n args.map { |arg| '-S' + arg } + Array(options[:zinc_options])\n else\n args\n end\n end", "def final_options(library, paths); end", "def get_cflags(cc)\n cflags=\"-g -O2 -fpic -Wall -Werror -std=c99 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I./include -Isrc/common\".split(/ /) \n\n if Platform.is_solaris?\n cflags.push \"-D__EXTENSIONS__\"\n end\n cflags\nend", "def assembler_options(src, component, system_config)\n config = system_config.platform_config(component.platform)\n output = object_file(src, component, system_config)\n opts = config[\"assembler_options\"].split(\" \")\n opts << \"#{config[\"assembler_out\"]}#{output}\"\n opts += prefixed_objects(component.include_paths, config[\"assembler_include\"])\n opts << src\n end", "def test_args(aux_libraries, ci_gcc_config)\n # TODO: something with libraries?\n ret = include_args(aux_libraries)\n unless ci_gcc_config.nil?\n cgc = ci_gcc_config\n ret = feature_args(cgc) + warning_args(cgc) + define_args(cgc) + flag_args(cgc) + ret\n end\n ret\n end", "def compile_c\n puts \"Compilando archivos fuentes:\"\n objs = @objs + [@main]\n objs.each do |obj|\n command = \"#{@cc} #{@debug} -c -o #{obj} #{obj[0..-2] + \"c\"} #{@cflags}\"\n puts \"\\t\"+ command\n exit (0) if not((system(command)))\n end\n command = \"#{@cc} #{@debug} -o #{@main[0..-3]} #{objs.join(\" \")}\" +\n \" #{@cflags}\"\n puts \"\\t\"+ command\n puts \"No compilo de forma correcta\" if not(system(command))\nend", "def initialize_compiler\n self.compile_tasks = [:multi, :test, :check_manifest]\n end", "def install\n ENV.append \"CXXFLAGS\", \"-std=gnu++17\" # poppler uses std::optional\n ENV.append \"CXXFLAGS\", \"-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR=1\" if ENV.compiler == :clang\n system \"./configure\", \"--prefix=#{prefix}\"\n system \"make\", \"djvulibre_bindir=#{Formula[\"djvulibre\"].opt_bin}\"\n system \"make\", \"install\"\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def init_compile_config\n end", "def set_up\n @compiler = VishCompiler.new('')\n @compiler.default_optimizers[:constant_folder] = true\n end", "def assembler_options src,component,system_config\n config=system_config.platform_config(component.platform)\n output=object_file(src,component,system_config)\n opts= config['assembler_options'].split(' ')\n opts<< \"#{config['assembler_out']}#{output}\"\n opts+= prefixed_objects(component.include_paths,config['assembler_include'])\n opts<< src\n end", "def init_compile_config\n # TODO\n end", "def init_compile_config\n # TODO\n end", "def build_core\n code = ''\n\n code += File.read(RUNTIME_PATH)\n code += build_stdlib('core.rb', 'core/*.rb')\n code += \"opal.require('core');\"\n\n code\n end", "def compileFortran(params)\n\t\tsrc = requireParam(params, :src)\n\t\ttarget = requireParam(params, :target)\n\t\totherOptions = params[:opts] || []\n\t\t\n\t\tprintAndCall(\"#{compileCmd(src)} #{otherOptions.join(' ')} #{@INCDIRS.map {|dirpath| \"-I#{dirpath}\"}.join(' ')} -o #{target} -c #{src}\")\n\tend", "def use_usr_libs\n case $RUBY2D_PLATFORM\n when :macos\n add_flags(:c, `sdl2-config --cflags`)\n add_flags(:c, '-I/opt/homebrew/include')\n add_flags(:ld, `sdl2-config --libs`)\n add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')\n add_flags(:ld, '-Wl,-framework,OpenGL')\n when :windows\n add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')\n add_flags(:ld, '-lopengl32 -lglew32')\n when :linux_rpi\n set_linux_bsd_flags\n end\nend", "def default_flags\n cflags = []\n\n # GCC on Solaris 10 produces 32-bit code by default, so add -m64\n # when running in 64-bit mode.\n if Platform.is_solaris? and Platform.word_size == 64\n cflags.push '-m64'\n end\n\n cflags\n end", "def install\n # ENV.deparallelize # if your formula fails when building in parallel\n system \"make\", \"CC=clang\"\n bin.install 'lz4mt'\n end", "def install\n ENV.append \"CFLAGS\", \"-D__GMP_BITS_PER_MP_LIMB=GMP_NUMB_BITS\"\n ENV.append \"CXXFLAGS\", \"-D__GMP_BITS_PER_MP_LIMB=GMP_NUMB_BITS\"\n args = [\"--prefix=#{prefix}\",\n \"--with-gmp=#{Formula.factory('gmp').prefix}\",\n \"--with-mpfr=#{Formula.factory('mpfr').prefix}\",\n \"--enable-optimization=sspeed\"]\n args << \"--enable-arch=x86-64\" if Hardware.is_64_bit? and MACOS_VERSION >= 10.6\n\n system './configure', *args\n system \"make\"\n system \"make install\"\n end", "def compile\n read_yml if File.exists?(@project)\n\n default_options = {}\n other_options = {}\n\n @compile_options.each do |k,v| \n if /default/.match(k)\n default_options[k] = v\n else\n other_options[k] = v\n end\n end\n\n command = \"#{@flex_sdk_bin}#{@compiler}\"\n other_options.each { |k,v| command += \" -#{k}=\\\"#{[v].flatten.join ','}\\\"\" }\n default_options.each { |k,v| command += \" -#{k}=\\\"#{[v].flatten.join ','}\\\"\" }\n command += \" #{@document_class}.as\"\n\n# puts command\n# TextMate.exit_show_html\n\n @command = command\n#TextMate.exit_show_html\n if process_output command\n# load_debugger\n display_web_player #unless ARGV[0] = \"--display\"\n# display_player\n end\nend", "def install\n args = %W[\n --prefix=#{prefix}\n --enable-experimental\n --disable-debug\n --disable-dependency-tracking\n --enable-v4l2-probe=yes\n --enable-orc=#{build.with?('orc') ? 'yes' : 'no'}\n ]\n\n if build.head?\n ENV['NOCONFIGURE'] = 'yes'\n system './autogen.sh'\n end\n\n system './configure', *args\n system 'make'\n system 'make', 'install'\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def initialize_racc\n self.racc_tasks = [:multi, :test, :check_manifest]\n\n # -v = verbose\n # -l = no-line-convert (they don't ever line up anyhow)\n self.racc_flags ||= \"-v -l\"\n self.rex_flags ||= \"--independent\"\n end", "def define_rules\n verify_swig_version\n super\n Rake::Task.create_rule(\n /#{env[:swig_cppext]}$/ => [proc {|t| t.sub /#{env[:swig_cppext]}$/, '.'+env[:swigext] }]\n ) do |r|\n sh_cmd :swig, :swig_flags, {'-I' => :swig_includedirs}, {'-I' => :includedirs},\n '-o', r.name, r.sources\n end\n end", "def enable_bitcode_for_prebuilt_frameworks!\n DSL.bitcode_enabled = true\n end", "def set_platform_libs\n\n case p4osname\n when 'SOLARIS'\n osver = `uname -r`\n osver.gsub!(/5\\./, '2')\n if (osver == '25')\n $LDFLAGS += '/usr/ucblib/libucb.a '\n end\n have_library('nsl')\n have_library('socket')\n when 'NT'\n have_library('advapi32')\n have_library('wsock32')\n have_library('kernel32')\n have_library('oldnames')\n when 'CYGWIN'\n # Clear out 'bogus' libs on cygwin\n CONFIG['LIBS'] = ''\n when 'DARWIN'\n if p4osver.to_i >= 8\n # Only build for 64 bit if we have more than one arch defined in CFLAGS\n $LDFLAGS.slice!('-arch i386')\n $LDFLAGS.slice!('-arch ppc')\n $LDFLAGS += ' -framework CoreFoundation -framework Foundation'\n end\n when 'LINUX', 'MINGW32'\n $LDFLAGS += ' -Wl,--allow-multiple-definition'\n have_library('supc++')\n end\nend", "def install\n ENV.append_to_cflags \"-I#{Formula[\"glm\"].opt_include}\"\n ENV.append_to_cflags \"-I#{Formula[\"physfs\"].opt_include}\"\n system \"cmake\", \"-S\", \".\", \"-B\", \"build\", *std_cmake_args,\n \"-DCMAKE_INSTALL_RPATH=#{rpath}\",\n \"-DSOLARUS_ARCH=#{Hardware::CPU.arch}\",\n \"-DSOLARUS_GUI=OFF\",\n \"-DSOLARUS_TESTS=OFF\",\n \"-DVORBISFILE_INCLUDE_DIR=#{Formula[\"libvorbis\"].opt_include}\",\n \"-DOGG_INCLUDE_DIR=#{Formula[\"libogg\"].opt_include}\"\n system \"cmake\", \"--build\", \"build\"\n system \"cmake\", \"--install\", \"build\"\n end", "def cpp_libraries\n if RbConfig::CONFIG['LIBS']\n RbConfig::CONFIG['LIBS'] + RbConfig::CONFIG['LIBRUBYARG']\n else\n '-lrt -ldl -lcrypt -lm'\n end\n end", "def install\n system \"./configure\", \"--prefix=#{prefix}\",\n \"--target=i386-jos-elf\",\n \"--disable-multilib\",\n \"--disable-nls\",\n \"--disable-werror\"\n system \"make\"\n system \"make\", \"install\"\n end", "def compiler cmdfile,config\n cc=config['compiler']\n raise GaudiConfigurationError,\"Missing 'compiler' setting\" unless cc\n return command_line(cc,cmdfile,config.fetch('compiler_commandfile_prefix',\"\"))\n end", "def install\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\" \n end", "def rule\n ['$(LD)', flags, '$(LDFLAGS)', @objects, sorted_ldadd, '$(LDADD)'].flatten.join(' ')\n end", "def install\n ENV.deparallelize\n ENV.no_optimization\n\n system \"./configure\", \"--prefix=#{prefix}\", \"--with-telescope=carma\"\n system \"make\"\n system \"make\", \"install\"\n end", "def install\n system \"autoreconf\", \"-fiv\" if build.head?\n system \"./configure\", \"--disable-debug\",\n \"--disable-dependency-tracking\",\n \"--disable-silent-rules\",\n \"--prefix=#{prefix}\"\n system \"make\", \"install\"\n end", "def _validate_compiler_flags(flags)\n if flags.join(' ').split(' ').any? { |flag| flag.start_with?('-Wno') }\n results.add_warning('compiler_flags', 'Warnings must not be disabled' \\\n '(`-Wno compiler` flags).')\n end\n end", "def compile(sources, cflags)\n outputs = []\n for s in sources\n ext = File.extname(s)\n\n case ext\n when '.c'\n cc = 'cc'\n lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'\n when '.cpp', '.cc'\n cc = 'cxx'\n lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'\n else\n raise \"Unknown extension #{ext}\"\n end\n\n output = s + '.o'\n outputs << output\n puts \"build #{output}: #{cc} #{s}\\n cflags = #{lang_flags} #{cflags}\"\n end\n\n return outputs\nend", "def linker cmdfile,config\n li=config['linker']\n raise GaudiConfigurationError,\"Missing 'linker' setting\" unless li\n return command_line(li,cmdfile,config.fetch('linker_commandfile_prefix',\"\"))\n end", "def compile\n puts \"Compilando archivos fuentes:\"\n @objs.each do |obj|\n command = \"#{@cc} -fpic -c -o #{obj} #{obj[0..-2] + \"c\"} #{@cflags}\"\n puts \"\\t\"+ command\n exit (0) if not((system(command)))\n end\n \n puts \"Convirtiendo a bibliotecas dinamicas\"\n system(\"mkdir lib\")\n @shared.each do |obj|\n library = obj.split('/').last\n compiled_libraries = `ls #{@lib_dir}`.split(\" \")\n \n libs = compiled_libraries.inject(\"\") {\n |string,lib|\n string += \"-l#{lib[3...-3]} \"\n }\n \n if (@so == \"linux\")\n command = \"#{@cc} -shared -o lib/lib#{library} #{obj[0..-3] + \"o\"}\" +\n \" -L#{@lib_dir} #{libs}\"\n elsif (@so == \"mac\")\n command = \"#{@cc} -shared -o lib/lib#{library} #{obj[0..-3] + \"o\"}\" +\n \" -L#{@lib_dir} #{libs}\" \n end\n puts \"\\t\" + command\n puts \"No compilo de forma correcta\" if not((system(command)))\n end\nend", "def install\n clang_version = '10.0.0'\n\n include.install Dir['include/c++'] unless File.directory? \"#{include}/c++\"\n \"#{include}/c++\".install Dir['include/c++/v1'] unless File.directory? \"#{include}/c++/v1\"\n lib.install Dir['lib/clang'] unless File.directory? \"#{lib}/clang\"\n \"#{lib}/clang\".install Dir['lib/clang/#{clang_version}'] unless File.directory? \"#{lib}/clang/#{clang_version}\"\n lib.install Dir['lib/oclint']\n bin.install Dir['bin/*']\n\n end", "def ld65_libraries(*more_libs)\n fail \"Sequence error: ld65_libraries\" unless [:create, :link].include?(@phase)\n append_option(:libraries, more_libs)\n @phase = :link\n end", "def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development\n\n gem \"rake-compiler\", \"~> 1.0\"\n rescue LoadError\n warn \"Couldn't load rake-compiler. Skipping. Run `rake newb` to fix.\"\n end", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def install\n system \"./configure\", \"--prefix=#{prefix}\", \"--disable-debug\", \"--disable-dependency-tracking\"\n# system \"cmake . #{cmake_std_parameters}\"\n system \"make install\"\n end", "def add_build_options(c)\n c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'\n c.option 'future', '--future', 'Publishes posts with a future date'\n c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'\n c.option 'watch', '-w', '--watch', 'Watch for changes and rebuild'\n c.option 'force_polling', '--force_polling', 'Force watch to use polling'\n c.option 'lsi', '--lsi', 'Use LSI for improved related posts'\n c.option 'show_drafts', '-D', '--drafts', 'Render posts in the _drafts folder'\n c.option 'unpublished', '--unpublished', 'Render posts that were marked as unpublished'\n c.option 'quiet', '-q', '--quiet', 'Silence output.'\n c.option 'verbose', '-V', '--verbose', 'Print verbose output.'\n end", "def configure(mode, compiler, path)\n # @config controls the compilation of a C Program\n @config = {\n # Use which compiler to compile the program\n generator: compiler,\n # Store the binary file to where\n path: path\n }\n\n # @mode can be :default, :quiet, :verbose, :help, :compile_only\n @mode = mode\n end", "def install\n # ENV.deparallelize # if your formula fails when building in parallel\n # Remove unrecognized options if warned by configure\n system \"./configure\", \"--target=x86_64-pc-linux-gnu\",\n \"--prefix=#{prefix}\",\n \"--with-python=yes\",\n \"--enable-tui\",\n \"--with-curses\",\n \"--disable-nls\",\n \"--disable-werror\",\n \"--disable-gas\",\n \"--disable-binutils\",\n \"--disable-ld\",\n \"--disable-gprof\"\n system \"make\"\n system \"make\", \"install\"\n system \"cp\", \"rust-x86_64-elf-gdb\", \"#{prefix}/bin/rust-x86_64-elf-gdb\"\n system \"chmod\", \"+x\", \"#{prefix}/bin/rust-x86_64-elf-gdb\"\n end", "def define_args(ci_gcc_config)\n return [] if ci_gcc_config[:defines].nil?\n\n ci_gcc_config[:defines].map { |d| \"-D#{d}\" }\n end", "def install\n args = [\"--prefix=#{prefix}\"]\n\n inreplace \"autogen.sh\", \"libtoolize\", \"glibtoolize\"\n ENV[\"NOCONFIGURE\"] = \"yes\"\n system \"./autogen.sh\"\n system \"./configure\", *args\n system \"make\", \"install\"\n\n end", "def install\n\t\tsystem 'make'\n\t\tlibexec.install 'waifu2x_glsl'\n\t\tlibexec.install 'models'\n\t\tlibexec.install 'vgg_7'\n\t\tbin.install_symlink libexec/\"waifu2x_glsl\"\n\tend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def add_debug_symbols(options)\n debug = options[:debug]\n return unless debug\n\n @linker.assemblers.each do |asm|\n meth = asm.callable\n asm.instructions.each do |label|\n next unless label.is_a?(Risc::Label)\n add_symbol \"#{meth.self_type.name}_#{meth.name}:Label=#{label.name}\" , Risc::Position.get(label).at\n end\n meth.binary.each_block do |code|\n label = \"BinaryCode_#{meth.name}\"\n add_symbol label , Risc::Position.get(code).at\n end\n end\n @linker.object_positions.each do |slot , position|\n next if slot.is_a?(Parfait::BinaryCode)\n next if slot.class.name.include?(\"Arm\")\n if( slot.respond_to? :rxf_reference_name )\n label = \"#{slot.rxf_reference_name}\"\n else\n label = \"#{slot.class.name}::#{Risc::Position.get(slot)}\"\n end\n label += \"=#{slot}\" if slot.is_a?(Symbol) or slot.is_a?(String)\n add_symbol label , Risc::Position.get(slot).at\n end\n end", "def install\n mktemp do\n File.open(\"make.sh\", \"w\") { |f| f.write \"\\#!/bin/sh\\nmake \\\"$@\\\"\\nexit 0\\n\" }\n arm = Utils.safe_popen_read(\"/usr/local/bin/brew\", \"--prefix\",\n \"cesarvandevelde/formulae/arm-none-eabi-gcc\").chomp\n # path = Utils.popen_read(\"/usr/bin/find\",\"#{arm}/\",\"-name\",\"stddef.h\",\"-print`\")\n # inc = path[0..-10]\n ENV[\"TARGET\"] = \"arm-none-eabi\"\n ENV[\"PREFIX\"] = \"#{arm}/gcc\"\n ENV[\"PATH\"] = \"#{ENV[\"PATH\"]}:#{arm}/gcc/bin\"\n system \"#{buildpath}/configure\",\n \"--target=arm-none-eabi\",\n \"--prefix=#{prefix}\",\n \"--with-as=#{arm}/bin/arm-none-eabi-as\", \"--with-ld=#{arm}/bin/arm-none-eabi-ld\",\n \"--disable-nls\",\n \"--disable-bootstrap\",\n \"--enable-checking=tree,rtl,assert,types\",\n \"--no-create\", \"--no-recursion\",\n \"--with-arch=armv7-a\", \"--with-fpu=vfp\", \"--with-float=hard\",\n \"CFLAGS=-g3 -O0\",\n \"--enable-languages=c,lto\",\n \"--disable-multilib\",\n \"--disable-werror\",\n \"--disable-libssp\", \"--disable-libstdcxx-pch\", \"--disable-libmudflap\",\n \"--with-newlib\",\n \"--enable-interwork\",\n \"--with-headers=yes\"\n # \"--with-headers=#{arm}/gcc/arm-none-eabi/include,#{inc}\"\n system \"sh\", \"config.status\"\n system \"sh\", \"make.sh\", \"-k\", \"-j\", \"20\" # for firefly\n system \"sh\", \"make.sh\", \"-k\", \"install\"\n # raise\n end\n end", "def install\n system \"./waf\", \"configure\", \"--prefix=#{prefix}\", \"--no-plugins\", \"--lv2dir=#{lib}\"\n system \"./waf\", \"build\"\n system \"./waf\", \"install\"\n end", "def run(options)\n if @command\n finalize_command_with_depfile\n else\n if @sources.find {|s| s.end_with?(*@env.expand_varref(\"${CXXSUFFIX}\", @vars))}\n pp_cc = \"${CXX}\"\n depgen = \"${CXXDEPGEN}\"\n else\n pp_cc = \"${CC}\"\n depgen = \"${CCDEPGEN}\"\n end\n @vars[\"_PREPROCESS_CC\"] = pp_cc\n @vars[\"_PREPROCESS_DEPGEN\"] = depgen\n @vars[\"_TARGET\"] = @target\n @vars[\"_SOURCES\"] = @sources\n @vars[\"_DEPFILE\"] = \"#{target}#{env.expand_varref(\"${DEPFILESUFFIX}\", vars)}\"\n command = @env.build_command(\"${CPP_CMD}\", @vars)\n self.produces(@vars[\"_DEPFILE\"])\n standard_command(\"Preprocessing <source>#{Util.short_format_paths(@sources)}<reset> => <target>#{@target}<reset>\", command)\n end\n end" ]
[ "0.7464435", "0.7435028", "0.7435028", "0.74102515", "0.7306684", "0.7043461", "0.6994468", "0.6994468", "0.6927209", "0.69249994", "0.68824506", "0.681252", "0.681252", "0.66168875", "0.6523334", "0.6417647", "0.6320798", "0.625107", "0.6206574", "0.6126276", "0.61206603", "0.6115303", "0.60840786", "0.606704", "0.6042124", "0.59863305", "0.5870142", "0.5861906", "0.5850084", "0.58499837", "0.584974", "0.5823756", "0.5801705", "0.5784207", "0.5781369", "0.56909114", "0.5659537", "0.5643498", "0.55991685", "0.55801386", "0.5578681", "0.5574723", "0.55583036", "0.55562276", "0.5544716", "0.5474523", "0.54469115", "0.54455113", "0.54379106", "0.5425483", "0.5407961", "0.53896713", "0.53896064", "0.5356915", "0.5353475", "0.5353475", "0.53507507", "0.53421754", "0.5336181", "0.5332863", "0.53216106", "0.531795", "0.53047156", "0.5295281", "0.5284385", "0.5282484", "0.5282211", "0.52626586", "0.5244143", "0.5233706", "0.5227205", "0.52264065", "0.5225686", "0.5216853", "0.52141315", "0.5192499", "0.5190837", "0.51847744", "0.5183386", "0.51820725", "0.5179402", "0.51677096", "0.5164428", "0.5153513", "0.5148759", "0.5148759", "0.5148323", "0.51441985", "0.5135403", "0.5129193", "0.51288927", "0.5118912", "0.51080096", "0.51075226", "0.51075226", "0.50882745", "0.5084764", "0.50789976", "0.507103" ]
0.78256524
0
Check for SDL libraries
def check_sdl unless have_library('SDL2') && have_library('SDL2_image') && have_library('SDL2_mixer') && have_library('SDL2_ttf') $errors << "Couldn't find packages needed by Ruby 2D." case $platform when :linux, :linux_rpi # Fedora and CentOS if system('which yum') $errors << "Install the following packages using `yum` (or `dnf`) and try again:\n" << " SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel".bold # Arch elsif system('which pacman') $errors << "Install the following packages using `pacman` and try again:\n" << " sdl2 sdl2_image sdl2_mixer sdl2_ttf".bold # openSUSE elsif system('which zypper') $errors << "Install the following packages using `zypper` and try again:\n" << " libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel".bold # Ubuntu, Debian, and Mint # `apt` must be last because openSUSE has it aliased to `zypper` elsif system('which apt') $errors << "Install the following packages using `apt` and try again:\n" << " libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev".bold end when :bsd $errors << "Install the following packages using `pkg` and try again:\n" << " sdl2 sdl2_image sdl2_mixer sdl2_ttf".bold end $errors << "" << "See #{"ruby2d.com".bold} for additional help." print_errors; exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sdl_linux\n unless have_library('SDL2') && have_library('SDL2_image') && have_library('SDL2_mixer') && have_library('SDL2_ttf')\n\n $errors << \"Couldn't find packages needed by Ruby 2D.\"\n\n # Fedora and CentOS\n if system('which yum')\n $errors << \"Install the following packages using `yum` (or `dnf`) and try again:\\n\" <<\n \" SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel\".bold\n\n # Arch\n elsif system('which pacman')\n $errors << \"Install the following packages using `pacman` and try again:\\n\" <<\n \" sdl2 sdl2_image sdl2_mixer sdl2_ttf\".bold\n\n # openSUSE\n elsif system('which zypper')\n $errors << \"Install the following packages using `zypper` and try again:\\n\" <<\n \" libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel\".bold\n\n # Ubuntu, Debian, and Mint\n # `apt` must be last because openSUSE has it aliased to `zypper`\n elsif system('which apt')\n $errors << \"Install the following packages using `apt` and try again:\\n\" <<\n \" libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev\".bold\n end\n\n $errors << \"\" << \"See #{\"ruby2d.com\".bold} for additional help.\"\n print_errors; exit\n end\nend", "def check_for_libraries; end", "def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end", "def dependencies_installed?(builder)\n warn_if_gif2webp_missing builder\n cwebp_installed? builder\n end", "def library_present?(library_name)\n library_path(library_name).exist?\n end", "def _validate_libraries(libs)\n libs.each do |lib|\n lib = lib.downcase\n if lib.end_with?('.a') || lib.end_with?('.dylib')\n results.add_error('libraries', 'Libraries should not include the' \\\n ' extension ' \\\n \"(`#{lib}`)\")\n end\n\n if lib.start_with?('lib')\n results.add_error('libraries', 'Libraries should omit the `lib`' \\\n ' prefix ' \\\n \" (`#{lib}`)\")\n end\n\n if lib.include?(',')\n results.add_error('libraries', 'Libraries should not include comas ' \\\n \"(`#{lib}`)\")\n end\n end\n end", "def library_available?(library)\n begin\n require library\n rescue LoadError\n begin\n require \"rubygems\"\n require library\n rescue LoadError\n error(\"Failed to load library\", \"Could not load #{library}\")\n return false\n end\n end\n true\n end", "def check_dependencies\n if %x[which vorbiscomment] == ''\n raise TagsOggEngine::NoBinaryFound, \"Unable to find `vorbiscomment` executable\", \"\"\n end\n end", "def link_libraries\n if RbConfig::CONFIG[\"THREAD_MODEL\"] == \"pthread\"\n # Link gem extension against pthread library\n have_library \"pthread\"\n have_required_function \"pthread\", \"pthread_create\"\n end\n\n # Links gem extension against the `dl` library. This is needed when Ruby is\n # not linked against `dl` itself, so link it on the gem extension.\n have_library \"dl\"\n # Check if functions are available now from the linked library\n %w[dlopen dlclose dlsym].each do |func|\n have_required_function \"dl\", func\n end\nend", "def set_linux_bsd_flags\n check_sdl\n set_rpi_flags\n add_flags(:ld, \"-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm\")\n if $RUBY2D_PLATFORM == :linux then add_flags(:ld, '-lGL') end\nend", "def warnings?\n !gem?(\"shelly-dependencies\") || gem?(\"shelly\")\n end", "def check_gem # --- CHECK FOR MISSING GEMS\n begin\n\t gem 'em-websocket'\n rescue Gem::LoadError\n\t puts \"IT APPEARS YOU ARE MISSING THE SOCKET GEM\"\n puts \"TO INSTALL IT TYPE 'gem install em-websocket'\"\n\telse\n\t\t#donothing\n\tend\n\n\tbegin\n\t\tgem 'net-ping', '>=1.7.8'\n\trescue Gem::LoadError\n\t\tputs \"IT APPEARS THAT YOU ARE MISSING THE NET-PING GEM\"\n puts \"TO INSTALL IT TYPE 'gem install net-ping'\"\n\telse\n\t\t#donothing\n\tend\nend", "def use_usr_libs\n case $RUBY2D_PLATFORM\n when :macos\n add_flags(:c, `sdl2-config --cflags`)\n add_flags(:c, '-I/opt/homebrew/include')\n add_flags(:ld, `sdl2-config --libs`)\n add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')\n add_flags(:ld, '-Wl,-framework,OpenGL')\n when :windows\n add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')\n add_flags(:ld, '-lopengl32 -lglew32')\n when :linux_rpi\n set_linux_bsd_flags\n end\nend", "def dll?\n library?\n end", "def warnings?\n !gem?(\"shelly-dependencies\")\n end", "def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nend", "def vendorized?\n File.directory?(normalize(:lib)) && normalize(:lib)\n end", "def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n puts \"[*] - esearchy requires #{name}.\"\n if RUBY_PLATFORM =~ /mingw|mswin/\n \tsystem \"gem install #{name}\"\n else\n \tsystem \"sudo gem install #{name}\"\n end\nend", "def mdspell_installed?\n `which mdspell`.strip.empty? == false\n end", "def load_libs; end", "def check_dependencies!(dep)\n depend_on(dep)\n depend_on_asset(dep)\n rescue Sprockets::FileNotFound\n end", "def installable_platform?\n Gem::Platform.match_spec? spec\n end", "def check_for_dockutil\n\tif !File.exist?(\"/usr/local/bin/dockutil\")\n\t\tabort \"Dockutil is not installed\"\n\tend\nend", "def check_dvd_env\n [\"#{@dvd_src}/isolinux\",\"#{@dvd_src}/ks\"].each do |dir|\n File.directory?(dir) or raise \"Environment not suitable: Unable to find directory '#{dir}'\"\n end\n end", "def library_loaded?(library_name)\n @loaded_libraries[library_name.to_sym]\n end", "def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nrescue\n Gem.available?(name) #for backwards compatibility\nend", "def available\n return unless Node.source.eql?(:asset)\n\n errors.add(:dependency_not_found, name) unless TTY::Which.exist?(name)\n end", "def _reload_libs?\n defined? RELOAD_LIBS\n end", "def check_utils\n\tif not File.exists?(\"/usr/bin/avahi-browse\")\n\t\tprint_error(\"Avahi Utils are not installed: run `apt-get install avahi-utils` to install them.\")\n\t\texit\n\tend\nend", "def libs; end", "def if_missing_dependencies\n #TODO: Test on Linux\n missing = []\n [['ffmpeg','-version'], ['mp3splt', '-v'], ['mp3wrap']].each do |cmdline|\n begin\n out, err, status = Open3.capture3(*cmdline)\n rescue\n missing.push(cmdline.first)\n end #begin\n end #...].each do |cmdline|\n yield(missing) unless missing.empty?\n end", "def library?\n sort == ::LIBRARY\n end", "def _reload_libs?\n defined? RELOAD_LIBS\n end", "def have_library_no_append(lib, func=\"main\")\n printf \"checking for %s() in -l%s... \", func, lib\n STDOUT.flush\n\n if func && func != \"\"\n libs = append_library($libs, lib)\n if /mswin32|mingw/ =~ RUBY_PLATFORM\n r = try_link(<<\"SRC\", libs)\n#include <windows.h>\n#include <winsock.h>\nint main() { return 0; }\nint t() { #{func}(); return 0; }\nSRC\n unless r\n r = try_link(<<\"SRC\", libs)\n#include <windows.h>\n#include <winsock.h>\nint main() { return 0; }\nint t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }\nSRC\n end\n else\n r = try_link(<<\"SRC\", libs)\nint main() { return 0; }\nint t() { #{func}(); return 0; }\nSRC\n end\n unless r\n print \"no\\n\"\n return false\n end\n else\n libs = append_library($libs, lib)\n end\n\n # $libs = libs\n print \"yes\\n\"\n return true\nend", "def clientHasGraphLibraries\r\n begin\r\n require 'rubygems'\r\n begin\r\n require 'RMagick' unless Object.constants.grep(/Magick/).length > 0\r\n rescue LoadError\r\n require 'RMagick'\r\n end\r\n require 'gruff'\r\n rescue LoadError\r\n return false\r\n end\r\n return true\r\nend", "def library_defined?( klass )\n library_handler.defined?(klass)\n end", "def lib_root?\n false\n end", "def gem_only_available?()\n return !determine_common_folder() && is_dtk_common_core_gem_installed?\nend", "def library?\n @library.nil? ? false : @library\n end", "def checkTools()\n\n\tif (PATH_CLANG_FORMAT.empty?)\n\t\tabort(\"Unable to find clang-format!\");\n\tend\n\n\tif (PATH_UNCRUSTIFY.empty?)\n\t\tabort(\"Unable to find uncrustify!\");\n\tend\n\nend", "def verify_library_exists(selected)\n\twhile Library.find_by_id(selected).nil?\n\t\tputs \"\\nNo libraries identified as entered\\n\"\n\t\tshow_all_libraries\n\t\tselected = make_selection.to_i\n\tend\n\tselected\nend", "def system_load_ok?\n true\n end", "def try_require(name)\n require(\"sketchdown/renderer/#{name.downcase}\")\n true\n rescue LoadError\n true\n end", "def check_binaries\n all_installed = true\n BINARIES.each do |bin|\n if `which #{bin}`.empty?\n all_installed = false\n puts \"#{bin} \"+'[NOT FOUND]'.red\n else\n puts \"#{bin} \"+'[OK]'.green\n end\n end\n\n unless all_installed\n puts 'Install appropriate programs before'\n raise SystemExit\n end\n\nend", "def external_frame?(f)\n !!(f =~ %r{bundle/gems})\n end", "def require_lib(*libs); end", "def check_system_python\n @candidate_pythons = lookup_local_pythons\n return 0 != @candidate_pythons.length\n end", "def have_gem? name\n Gem::Specification.find_by_name name.to_s\n rescue Gem::LoadError\n false\n end", "def is_libname?(); @type == GRT_LIBNAME; end", "def require_libs(*libs); end", "def load_libraries()\n @cookbook_loader.each do |cookbook|\n cookbook.load_libraries\n end\n true\n end", "def installed?\n secrets = @stage.get('secrets').map(&:name)\n secrets.any? { |s| s.match(/\\Ash\\.helm\\.release\\.v\\d+\\.#{Regexp.escape(name)}\\./) }\n end", "def missing_extensions?\n return false if extensions.empty?\n return false if default_gem?\n return false if File.exist? gem_build_complete_path\n\n true\n end", "def frameworks_invalid?(frameworks)\n frameworks.any? do |framework|\n framework_regex = /[^\\w\\-\\+]/\n framework =~ framework_regex\n end\n end", "def load_dependencies\n begin\n require 'cairo'\n rescue LoadError\n require 'rubygems'\n begin\n require 'cairo'\n rescue LoadError\n puts \"Compass::Canvas\\n_______________\\n\\n\"\n puts \"Unable to load Cairo backend. Please install it with the following command:\\n\\n\"\n puts \" gem install cairo\\n\\n\"\n puts \"For more information, please visit https://github.com/rcairo/rcairo\"\n raise\n end\n end\n end", "def has_assets?\n assets.none?\n end", "def installable?\n uninstallable_reasons.empty?\n end", "def require_if_available(name)\n require name\nrescue LoadError\n false\nend", "def puppet_lib?\n File.exists?(puppet_lib)\n end", "def _validate_weak_frameworks(frameworks)\n if frameworks_invalid?(frameworks)\n results.add_error('weak_frameworks', 'A weak framework should only be' \\\n ' specified by its name')\n end\n end", "def current_library?\n !current_library.nil?\n end", "def _validate_frameworks(frameworks)\n if frameworks_invalid?(frameworks)\n results.add_error('frameworks', 'A framework should only be' \\\n ' specified by its name')\n end\n end", "def check_binary_linkage(binary, library)\n binary.dynamically_linked_libraries.any? do |dll|\n next false unless dll.start_with?(HOMEBREW_PREFIX.to_s)\n\n File.realpath(dll) == File.realpath(library)\n end\n end", "def bsd?\n kind_of? BSD::Platform rescue false\n end", "def _exists?(loop_name)\n `losetup -a`.include? loop_name\n end", "def precheck\n if !BinarySolo.dir_valid?\n puts \"this is not a binary_solo directoy => better run $ binarysolo init\".colorize(:red)\n false\n elsif !BinarySolo.config_valid?\n puts \"your config is invalid - but I dont have any details for you (yet)\".colorize(:red)\n false\n else\n true\n end\nend", "def driver_check_mysql\n\t\trequire 'mysql'\n\tend", "def check_idl_dependencies\n recipes.each { |rcp| rcp.check_idl_dependencies }\n end", "def extension_loaded?\n !!extension_loaded\n end", "def extension_loaded?\n !!extension_loaded\n end", "def have_fftw3?\n begin\n response = require('fftw3')\n true\n rescue\n begin\n Kernel.const_get('FFTW3')\n rescue\n false\n end\n end\nend", "def onload_function?\n [email protected]?\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def check_for_installed_software_only\n check_all_installed @options\n end", "def check_requirements!\n return unless Command.up?\n\n matomo_js = File.join(@config.get('source'), 'piwik.js')\n\n error_source_missing(@config.get('source')) unless File.exist?(matomo_js)\n end", "def headless?\n # The GRASS GUI is based on WxPython.\n build.without? \"gui\"\n end", "def check_for_gems\n\n OPTIONAL_GEMS.each do |gem_name|\n method_name = \"has_#{gem_name.underline}?\".to_sym\n\n (class << self; self; end).class_eval do\n instance_variable_name = \"@has_#{gem_name.underline}\".to_sym\n\n define_method method_name do\n if instance_variable_get(instance_variable_name).nil?\n gem_installed = SystemChecks.gem_available?(gem_name)\n instance_variable_set(instance_variable_name, gem_installed)\n end\n instance_variable_get(instance_variable_name)\n end # define_method\n\n end # class_eval\n\n end # OPTIONAL_GEMS\n end", "def candidates_exist_for_all_uninstalled?\n packages_missing_candidates.empty?\n end", "def detect_program_path\n # We first try to detect path using `which` command.\n # If that does not work, we simply ask the user for this path.\n @path = `which youtube-dl`.strip\n @path = Ydl::CONFIG[:youtube_dl_path] if !@path || @path.empty?\n\n mess = 'youtube-dl was not found in your PATH or the specified location.'\n raise RuntimeError, mess if !@path || @path.empty?\n\n @path\n end", "def conficts_when_loaded_with?(list_of_specs) # :nodoc:\n result = list_of_specs.any? do |spec|\n spec.dependencies.any? {|dep| dep.runtime? && (dep.name == name) && !satisfies_requirement?(dep) }\n end\n result\n end", "def module_loaded? mod\n Bot::Modules.include? mod\n end", "def check_parallels_is_installed(options)\n options['status'] = \"no\"\n app_dir = \"/Applications/Parallels Desktop.app\"\n if File.directory?(app_dir)\n options['status'] = \"yes\"\n if !File.symlink?(\"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth\")\n if !File.exist?(\"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth\")\n install_brew_pkg(options,\"parallels-virtualization-sdk\")\n else\n command = \"ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth\"\n message = \"Information:\\tSymlinking Parallels SDK Library\"\n execute_command(options,message,command)\n end\n end\n end\n return options['status']\nend", "def select_local_platforms(specs) # :nodoc:\n specs.select do |spec|\n Gem::Platform.installable? spec\n end\n end", "def ok?\n @specs.all? { |spec|\n\tspec.dependencies.all? { |dep|\n\t @specs.find { |s| s.satisfies_requirement?(dep) }\n\t}\n }\n end", "def driver_check_sqlite3\n\t\trequire 'sqlite3'\n\tend", "def ok?\n @specs.all? do |spec|\n spec.runtime_dependencies.all? do |dep|\n @specs.find { |s| s.satisfies_requirement? dep }\n end\n end\n end", "def should_load?\n test_framework? || trace_observer_configured?\n end", "def validate_dependencies_are_present!\n if @podfile_dependency_cache.target_definition_list.all?(&:empty?)\n add_warning 'The Podfile does not contain any dependencies.'\n end\n end", "def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end", "def gem_is_available?\n @thor.say(\"Check if #{@name} is available as a gem name.\", :yellow)\n uri = URI.parse(\"https://rubygems.org/api/v1/gems/#{@name}.json\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n\n return response.code == '404'\n rescue SocketError => e\n # rubygems is down, skip check\n return true\n end", "def gem_is_available?\n @thor.say(\"Check if #{@name} is available as a gem name.\", :yellow)\n uri = URI.parse(\"https://rubygems.org/api/v1/gems/#{@name}.json\")\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n\n return response.code == '404'\n rescue SocketError => e\n # rubygems is down, skip check\n return true\n end", "def ensure_new_header_loaded\n $tracer.trace(\"GameStopSearchFunctions: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n gamestop_logo_link.should_exist\n xbox_360_menu.exists\n ps3_menu.exists\n pc_menu.exists\n wii_menu.exists\n _3ds_menu.exists\n #psvita_menu.exists\n find_a_store_link.should_exist\n weekly_ad_link.should_exist\n gift_cards_link.should_exist\n my_cart_button.should_exist\n search_field.should_exist\n search_button.should_exist\n end", "def python?\n exist? 'requirements.txt'\n end", "def test_framework_runtimes\n find_duplicates :frameworks\n end", "def installed?\n File.exist?(swiftlint_path)\n end", "def library_loaded(lib)\n @lib_hooks[lib.to_s].each{ |hook| hook.call }\n end", "def conscientious_require\n require_theme_deps if site.theme\n require_plugin_files\n require_gems\n deprecation_checks\n end", "def check(options)\n errors = []\n [\n [\"/usr/bin/iostat\", \"sysstat\"]\n ].each do |filename, package|\n errors << \"Cannot find `#{filename}`. Please run `apt-get install #{package}` to resolve this.\" if !File.exists?(filename)\n end\n\n if errors.empty?\n puts \"Everything seems to be in place. You're good to go.\"\n else\n errors.each { |error| puts errors }\n exit(1)\n end\n end", "def verify_haml_existence\n begin\n require 'haml'\n rescue LoadError\n say \"HAML is not installed, or it is not specified in your Gemfile.\"\n exit\n end\n end", "def request_libraries\n raise StandardError, 'Unsupported, fix this'\n end" ]
[ "0.75101244", "0.6577883", "0.59941566", "0.5817426", "0.5780352", "0.5749494", "0.5727793", "0.5706594", "0.56945014", "0.5687077", "0.56557924", "0.5634598", "0.56057364", "0.5604998", "0.56046486", "0.5551067", "0.55303794", "0.55233276", "0.5504533", "0.5498461", "0.5474594", "0.5462135", "0.544938", "0.54008967", "0.5396122", "0.53899276", "0.53706396", "0.53651726", "0.53461874", "0.532518", "0.52985746", "0.5255896", "0.5254209", "0.52535105", "0.5251895", "0.52408975", "0.5236614", "0.5231349", "0.5216497", "0.520022", "0.5185893", "0.51715744", "0.5171145", "0.516873", "0.5167801", "0.5151215", "0.5141194", "0.5125344", "0.51108426", "0.51075", "0.5076532", "0.5072247", "0.5064038", "0.5058372", "0.50553143", "0.50515103", "0.5046854", "0.5045314", "0.50435895", "0.5040895", "0.5036785", "0.5026459", "0.50250876", "0.50196123", "0.5005177", "0.49622193", "0.49604782", "0.49505314", "0.49407074", "0.49407074", "0.49362668", "0.49309105", "0.49247587", "0.49222776", "0.49187458", "0.49155033", "0.49064577", "0.49033672", "0.48983413", "0.4896253", "0.48950526", "0.4892277", "0.4890485", "0.4887005", "0.48845017", "0.48812005", "0.48791015", "0.4875161", "0.48662797", "0.4865838", "0.4865838", "0.4865564", "0.4851947", "0.4835422", "0.48350474", "0.48327485", "0.48201272", "0.48198867", "0.48196885", "0.48138368" ]
0.75856405
0
Set Raspberry Pi flags
def set_rpi_flags if $platform == :linux_rpi add_flags(:c, '-I/opt/vc/include') add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gpioinit yabm\n yabm.gpiosetdat(1 << 3 | 1 << 4)\nend", "def flags=(flags)\n if FFI::Libmagic.magic_setflags(_cookie, flags) < 0\n raise(FlagError, lasterror())\n end\n end", "def gpioinit yabm\n yabm.gpiosetdir(1 << 3)\n\n yabm.gpiosetdat(1 << 3)\nend", "def gpioinit yabm\n yabm.gpiosetdat(1 << 6)\nend", "def flags=(val)\n @val = val\n end", "def set_flags(flags)\n @modifiers = flags & (MK_SHIFT | MK_CONTROL | MK_ALT | MK_COMMAND)\n self.show_prompt\nend", "def set(pin)\n Native.gpio_set(pin)\n end", "def set_pin(val)\n @on = val\n end", "def set_call_flags\n <<-CODE\n next_int;\n c->call_flags = _int;\n CODE\n end", "def use_usr_libs\n # Add flags\n set_rpi_flags\n add_flags(:c, '-I/usr/local/include')\nend", "def init_pin(pin_num, direction)\n system(\"gpio -g mode #{pin_num} #{direction}\")\n end", "def turn_on\n unless on?\n set_attribute('PIO', 1)\n end\n end", "def set_flag(symbol)\n @flags.add(symbol)\n end", "def ndp_set_flags=(bits)\n case bits\n when \"000\"\n self.ndp_reserved = 0x00000000\n when \"001\"\n self.ndp_reserved = 0x20000000\n when \"010\"\n self.ndp_reserved = 0x40000000\n when \"011\"\n self.ndp_reserved = 0x60000000\n when \"100\"\n self.ndp_reserved = 0x80000000\n when \"101\"\n self.ndp_reserved = 0xa0000000\n when \"110\"\n self.ndp_reserved = 0xc0000000\n when \"111\"\n self.ndp_reserved = 0xe0000000\n end\n end", "def flags=(value)\n if value == @defaults['flags']\n @values.delete 'flags' if @values.key? 'flags'\n else\n @values['flags'] = value\n end\n end", "def set_flags( *flag_symbols )\n\t\t\tflag_symbols.flatten!\n\t\t\tflag_symbols.compact!\n\n\t\t\tself.log.debug \"Setting flags for symbols: %p\" % [ flag_symbols ]\n\n\t\t\tflag_symbols.each do |flag|\n\t\t\t\tcase flag\n\t\t\t\twhen :fin, :rsv1, :rsv2, :rsv3\n\t\t\t\t\tself.__send__( \"#{flag}=\", true )\n\t\t\t\twhen :continuation, :text, :binary, :close, :ping, :pong\n\t\t\t\t\tself.opcode = flag\n\t\t\t\twhen Integer\n\t\t\t\t\tself.log.debug \" setting Integer flags directly: %#08b\" % [ flag ]\n\t\t\t\t\tself.flags |= flag\n\t\t\t\twhen /\\A0x\\h{2}\\z/\n\t\t\t\t\tval = Integer( flag )\n\t\t\t\t\tself.log.debug \" setting (stringified) Integer flags directly: %#08b\" % [ val ]\n\t\t\t\t\tself.flags = val\n\t\t\t\telse\n\t\t\t\t\traise ArgumentError, \"Don't know what the %p flag is.\" % [ flag ]\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def set_pin_mode()\n\n # set the pins for motor control to output\n @board.set_pin_mode(pin_enb, Firmata::Board::OUTPUT)\n @board.set_pin_mode(pin_dir, Firmata::Board::OUTPUT)\n @board.set_pin_mode(pin_stp, Firmata::Board::OUTPUT)\n\n # set the pins for end stops to input\n @board.set_pin_mode(pin_min, Firmata::Board::INPUT)\n @board.set_pin_mode(pin_max, Firmata::Board::INPUT)\n\n # disable motors\n @board.digital_write(pin_enb, Firmata::Board::HIGH)\n\n # start reading end stops\n @board.toggle_pin_reporting(pin_min)\n @board.toggle_pin_reporting(pin_max)\n \n end", "def gp_flags; end", "def set_pin(val)\n\n @pwm.duty_cycle = val ? @duty_cycle : 0 \n super(val)\n \n end", "def gp_flags=(_arg0); end", "def flags; end", "def set_mode pin, mode\n reg = pin / 10\n shift = (pin % 10) * 3\n new_value = (get_int_at(reg) & ~(7 << shift)) | (mode << shift)\n set_int_at(reg, new_value)\n end", "def set_gpio\n @gpio = Gpio.find(params[:id])\n end", "def reset_flags\n @flags = { :zero => false , :plus => false ,\n :minus => false , :overflow => false }\n end", "def server_flags; end", "def flags \n @flags ||= {}\n end", "def set_flag\n path = path_to_flag\n return nil unless path\n begin\n img = File.open(path, 'rb'){|f| f.readlines}.join\n File.open(File.join([Rails.root, 'public', \"flag_for_campaign_#{self.id}.png\"]), 'wb'){|f| f.write(img)}\n \"/flag_for_campaign_#{self.id}.png\"\n rescue\n nil\n end\n end", "def set_flags(file, flags); @actions << Action::ExecAction.new(file, flags); end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def set_mode(mode)\n @mode = mode\n\n if mode == 'w'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_WRITE) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/value\", \"w\")\n elsif mode =='r'\n File.open(\"#{ GPIO_PATH }/gpio#{ pin_num }/direction\", \"w\") { |f| f.write(GPIO_DIRECTION_READ) }\n @pin_file = File.open(\"#{ GPIO_PATH }/gpio#{pin_num}/value\", \"r\")\n end\n end", "def notifyflags=(notify_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setnotifyflags {#{@id}} #{notify_flags}`\r\n\t\tend", "def flags=(flags)\n self.flag_attr = flags.map{|flag| flag.to_s}.join(\", \");\n end", "def use_camera=(setting)\n end", "def startup_only\n# ESP32\n#\tpass1 0x40000400\n# ESP8266\n\tpass1 0x400000a4\n end", "def flag=(value)\n @flag = value\n end", "def set_wait_flags(*flags)\n a = (flags.include?(:a) || flags.include?(:a)) ? '1' : 'X'\n b = (flags.include?(:b) || flags.include?(:b)) ? '1' : 'X'\n c = (flags.include?(:c) || flags.include?(:c)) ? '1' : 'X'\n d = (flags.include?(:d) || flags.include?(:d)) ? '1' : 'X'\n self.wait_flags = d + c + b + a\n self\n end", "def write pin, value\n if value == 0\n set_int_at(GPCLR0 + PI_BANK(pin), PI_BIT(pin))\n else\n set_int_at(GPSET0 + PI_BANK(pin), PI_BIT(pin))\n end\n end", "def flags=(values)\n val = 0\n FRAME_FLAGS_MAP.values_at(*values).each { |c|\n val |= c if c\n }\n @flags_value = val\n end", "def set_ResponseFlags(value)\n set_input(\"ResponseFlags\", value)\n end", "def set_ResponseFlags(value)\n set_input(\"ResponseFlags\", value)\n end", "def _initGpio() \n ( fwrite(GPIO_EXPORT,@gpio) rescue _freeGpio() ) if @getted==0\n @getted+=1\n end", "def set?(flag)\n (@status_register & flag == 0) ? false : true\n end", "def run_set_bool(args, default=true)\n set_val = args.size < 2 ? 'on' : args[1]\n setting = @name.gsub(/^(set|show)/,'')\n begin\n settings[setting.to_sym] = @proc.get_onoff(set_val)\n run_show_bool(string_in_show)\n rescue NameError, TypeError\n end\n end", "def add_flags_from(token)\n token.flags.each do |f|\n set_flag f\n end\n end", "def load_flags\n @flags ||= {}\n @flags[:state?] = true\n @flags[:region?] = true\n @flags[:teleport?] = true\n end", "def pin_std_set_mode(pin, mode)\n @ramps_arduino.execute_command(\"F43 P#{pin} M#{mode}\", false, @status_debug_msg)\n end", "def setCFlags(flags) @CFLAGS = ensureArray(flags) end", "def flag(*names)\n names = [names].flatten\n verify_unused(names,flags,switches,\"in global options\")\n flag = Flag.new(names,@@next_desc,@@next_arg_name,@@next_default_value,@@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end", "def command(val)\n # record the valve's command state in the db\n update(cmd: val)\n mode = \"gpio -g mode #{gpio_pin} out\"\n system(mode)\n mode_set = 1\n write = \"gpio -g write #{gpio_pin} #{val}\"\n system(write)\n end", "def flags #:nodoc:\n @flags ||= {}\n end", "def set(state)\n case state\n when false then @mplab_pin.set_low\n when true then @mplab_pin.set_high\n when Numeric then @mplab_pin.set_analog(state)\n else raise ArgumentError, \"Invalid pin state: #{state.inspect}.\"\n end\n end", "def flags=(val)\n self.offset_flags = (offset_flags & 0xffffffffffff0000) | val\n end", "def flags\n @flags\n end", "def flags\n @flags\n end", "def switch_light_off\n puts \"*** switch_light_off\"\n true\nend", "def turn_airplane_mode value\n toggle_airplane_mode if value == \"on\"\n set_network_connection(6) if value == \"off\"\n end", "def setFlag(flag)\r\n\t\t\t\t\t@flag = flag\r\n\t\t\t\tend", "def set_pin(p, v)\n return if borked?\n cmd = \"#{p.upcase}=#{v}\\r\\n\"\n @sp.write cmd\n end", "def shiny=(shiny)\n @code = (@code & 0xFFFF0000) | (shiny ? 0 : 0xFFFF)\n end", "def pin_std_set_mode(pin, mode)\n start_command(\"F43 P#{pin} M#{mode}\", false, @status_debug_msg)\n end", "def pin_std_set_mode(pin, mode)\n execute_command(\"F43 P#{pin} M#{mode}\", false, @status_debug_msg)\n end", "def set_power(port, state)\n\t\tstate = state ? 1 : 0\n\t\t\n\t\tdo_send(\"\\eP#{port}*#{state}DCPP\")\n\t\t# Response: DcppP_port*portstatus 0 == off, 1== on\n\tend", "def switch_light_on\n puts \"*** switch_light_on\"\n true\nend", "def switch_flag\n\t\t@flag = !@flag\n\tend", "def reset_flags\n @flags[:chat?] = false\n @flags[:graphic?] = false\n @flags[:animation?] = false\n #@flags[:state?] = false\n @flags[:region?] = false\n @flags[:forced_chat?] = false\n @flags[:teleport?] = false\n @flags[:moved?] = false\n end", "def general_purpose_flags\n 0b0000000000000001\n end", "def init\n \tself.mode = \"Manual\"\n \tself.status = \"Off\"\n end", "def flags; changeset.flags(@path); end", "def robots=(enabled); end", "def set_pins(motor, mode = :stop)\n pwm, forward, backward = nil, nil, nil\n if motor.port == :a\n pwm = @port_a_pwm\n forward = @pins[:in1]\n backward = @pins[:in2]\n elsif motor.port == :b\n pwm = @port_b_pwm\n forward = @pins[:in3]\n backward = @pins[:in4]\n end\n\n case mode\n when :stop\n pwm.duty_cycle = 0\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_low(backward)\n when :forward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_high(forward)\n RPi::GPIO.set_low(backward)\n when :backward\n pwm.duty_cycle = motor.pwm_speed\n RPi::GPIO.set_low(forward)\n RPi::GPIO.set_high(backward)\n end\n # log(\"Motor #{motor.port}: POWER: #{motor.power}, PWM: #{pwm.duty_cycle}, forward: #{RPi::GPIO.high?(forward)}, backward: #{RPi::GPIO.high?(backward)}\")\n end", "def clear_flags\n @flags = 0\n write\n end", "def turn_off\n if on?\n set_attribute('PIO', 0)\n end\n end", "def aclflags=(acl_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setaclflags {#{@id}} #{acl_flags}`\r\n\t\tend", "def port_mode_set(idx, mode)\n port = $ts.dut.port_list[$idx_tx]\n conf = $ts.dut.call(\"mesa_qos_port_conf_get\", port)\n conf[\"key_type\"] = (\"MESA_VCAP_KEY_TYPE_\" + (mode[0] == \"N\" ? \"NORMAL\" : mode))\n conf[\"dmac_dip\"] = (mode == \"NORMAL_DST\" ? true : false)\n $ts.dut.call(\"mesa_qos_port_conf_set\", port, conf)\nend", "def set_pin_mode(pin, mode)\n pins[pin].mode = mode\n write(PIN_MODE, pin, mode)\n end", "def mode=(mode)\n super(040000 | (mode & 07777))\n end", "def switch(bool)\n $game_switches[Yuki::Sw::Nuzlocke_ENA] = bool\n end", "def set_fan\n fan = CeilingFan.new(\"Living Room\")\n fan_medium = CeilingFanMediumCommand.new(fan)\n fan_high = CeilingFanHighCommand.new(fan)\n fan_off = CeilingFanOffCommand.new(fan)\n @rc.set_command(1, fan_medium, fan_off)\n @rc.set_command(2, fan_high, fan_off)\n end", "def set_linux_bsd_flags\n check_sdl\n set_rpi_flags\n add_flags(:ld, \"-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm\")\n if $RUBY2D_PLATFORM == :linux then add_flags(:ld, '-lGL') end\nend", "def tv_set_brightness _n, _abs=0\n send_cmd(\"tv_set_brightness #{_n} #{_abs}\")\n end", "def initialize(whichPin, direction)\n @pin=RPi_GPIO_Pin.canonicalizePin(whichPin)\n \n RPi_GPIO_Pin.export(@pin)\n ObjectSpace.define_finalizer(self, RPi_GPIO_Pin.create_finalizer(@pin))\n RPi_GPIO_Pin.setDirection(@pin,direction) \n end", "def flags_clear!()\n @flags = 0\n end", "def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end", "def on\n GPIO.write \"gpio#{@number}/value\", \"1\"\n end", "def set_pin(val)\n\n super(val)\n @parent.on_ledchange\n \n end", "def mode=(mode)\n #Can be Rufirmata::INPUT, OUTPUT, ANALOG, PWM or UNAVAILABLE\n return if @mode == mode #Nothing is changing, so nothing to do\n\n raise \"#{to_s} does not have PWM capabilities\" if mode == Rufirmata::PWM and !pwm\n raise \"#{to_s} cannot be used through Firmata\" if @mode == Rufirmata::UNAVAILABLE\n\n changing :pin_mode_changed, :changes=>{ :from=>@mode, :to=>mode } do\n @mode = mode\n unless mode == Rufirmata::UNAVAILABLE\n board.write_command(Rufirmata::SET_PIN_MODE, pin_number, mode)\n enable_reporting if mode == Rufirmata::INPUT\n end\n end\n\n end", "def set_flag\n @flag = Flag.find(params[:id])\n end", "def setFlag(flg)\r\n if (flg.class == Array)\r\n flg.each do |f|\r\n case f\r\n when '-v'\r\n @verbose = true\r\n end\r\n end # flg.each\r\n\r\n return\r\n end # if flg\r\n\r\n case flg\r\n when '-v'\r\n @verbose = true\r\n end\r\n\r\n end", "def manage_buttons\n bootup\n @@pin=PiPiper::Pin.new(:pin => 23, :pull => :up)\n @@led=PiPiper::Pin.new(:pin => 18, :direction => :out)\n @@led.on\n @@t=Time.now\n PiPiper.watch :pin => 23,:trigger => :falling , :pull => :up do\n #puts \"Button pressed changed from #{last_value} to #{value}\"\n #puts \".\"\n @@t=Time.now\n end\n PiPiper.watch :pin => 23,:trigger => :rising , :pull => :up do\n delta = Time.now.to_f - @@t.to_f\n @@t = Time.now\n EstormLottoGem::Button.led_mgr(EstormLottoGem::Button.tap()) if 0.03 <= delta and delta < 0.7\n EstormLottoGem::Button.led_mgr(EstormLottoGem::Button.held()) if 2 < delta and delta < 20\n #puts \"debounce\" if 0.1 > delta\n end\n sleep 5\n \n @@led.off\n @@t=Time.now\n PiPiper.wait\n end", "def flags=(flag)\n @captured_in = zone_id | (flag & 0xFFFF_0000)\n end", "def set_setting\n end", "def set(value)\n if (value == 0) || (value == 1)\n IO.write(VALUE % @pin, \"%d\" % value)\n else\n raise \"invalid value #{value.inspect}\"\n end\n end", "def add(*flags)\r\n flags.each do |flag|\r\n if flag.class == String\r\n flag = lookup(flag)\r\n end\r\n @access |= flag\r\n end\r\n end", "def init_vars\n FLAGS.each do |position, flag|\n flag_set = ((@bits >> position) & 0x1) == 1\n instance_variable_set \"@#{flag}\", flag_set\n end\n end", "def generate_cli_flags\n @flags.map{|pair| pair.join(' ')}.join(' ').gsub(' true','')\n end", "def set_logical_flags_from(actual_value, size)\n\t\[email protected]_bit_at(OVERFLOW_FLAG, 0)\n\t\[email protected]_bit_at(CARRY_FLAG, 0)\n\t\tset_zero_flag_from actual_value\n\t\tset_sign_flag_from actual_value, size - 1\n\t\tset_parity_flag_from actual_value, size\n\tend", "def update!(**args)\n @is_enabled = args[:is_enabled] if args.key?(:is_enabled)\n @ringtone_label = args[:ringtone_label] if args.key?(:ringtone_label)\n end", "def debug_mode=(flag)\r\n self.conf[:debug] = flag\r\n end", "def stability_flags=(stability_flags)\n alias_of.stability_flags(stability_flags)\n end" ]
[ "0.6221178", "0.6176925", "0.61387813", "0.607874", "0.6037413", "0.5983555", "0.59487313", "0.5934318", "0.5931134", "0.5824487", "0.581541", "0.5718183", "0.57058525", "0.5688689", "0.56842667", "0.56607956", "0.56399626", "0.5625288", "0.5603252", "0.5586855", "0.55577344", "0.5539441", "0.55270606", "0.5522251", "0.55097306", "0.55089116", "0.5493684", "0.5486491", "0.5474003", "0.5465245", "0.5455401", "0.54545236", "0.5429116", "0.54211724", "0.5413838", "0.5374724", "0.5364712", "0.53622174", "0.53294957", "0.53294957", "0.5324812", "0.53151244", "0.53023285", "0.5297911", "0.5294593", "0.5275454", "0.5267392", "0.5261745", "0.5258645", "0.5250565", "0.52455634", "0.52340025", "0.5232459", "0.5232459", "0.52281046", "0.52182376", "0.5214328", "0.5198663", "0.518619", "0.51812065", "0.51805294", "0.5174319", "0.51734173", "0.51665646", "0.51647717", "0.5157808", "0.5155528", "0.5152729", "0.5137184", "0.5134113", "0.5126554", "0.51249325", "0.51215184", "0.5114979", "0.5114623", "0.51079464", "0.5101725", "0.5098573", "0.5090314", "0.5084176", "0.50834227", "0.50762284", "0.50753456", "0.5071969", "0.50680465", "0.5064076", "0.5055721", "0.5055144", "0.50543785", "0.5052062", "0.50517416", "0.50446814", "0.5042257", "0.50405127", "0.5038081", "0.5028506", "0.5015458", "0.49977845", "0.49970758" ]
0.6792887
0
Set flags for Linux and BSD
def set_linux_bsd_flags check_sdl set_rpi_flags add_flags(:ld, "-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm") if $RUBY2D_PLATFORM == :linux then add_flags(:ld, '-lGL') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flags=(flags)\n if FFI::Libmagic.magic_setflags(_cookie, flags) < 0\n raise(FlagError, lasterror())\n end\n end", "def setCFlags(flags) @CFLAGS = ensureArray(flags) end", "def default_flags\n cflags = []\n\n # GCC on Solaris 10 produces 32-bit code by default, so add -m64\n # when running in 64-bit mode.\n if Platform.is_solaris? and Platform.word_size == 64\n cflags.push '-m64'\n end\n\n cflags\n end", "def add_flags(type, flags)\n case type\n when :c\n $CFLAGS << \" #{flags} \"\n when :ld\n $LDFLAGS << \" #{flags} \"\n end\nend", "def add_flags(type, flags)\n case type\n when :c\n $CFLAGS << \" #{flags} \"\n when :ld\n $LDFLAGS << \" #{flags} \"\n end\nend", "def set_rpi_flags\n if $platform == :linux_rpi\n add_flags(:c, '-I/opt/vc/include')\n add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')\n end\nend", "def set_rpi_flags\n if $platform == :linux_rpi\n add_flags(:c, '-I/opt/vc/include')\n add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')\n end\nend", "def default_flags\n ldflags = []\n\n # GCC on Solaris 10 produces 32-bit code by default, so add -m64\n # when running in 64-bit mode.\n if Platform.is_solaris? and Platform.word_size == 64\n ldflags.push '-m64'\n ldflags.push '-R/usr/sfw/lib/amd64' if Platform.is_x86?\n end\n\n ldflags\n end", "def set_flags(flags)\n @modifiers = flags & (MK_SHIFT | MK_CONTROL | MK_ALT | MK_COMMAND)\n self.show_prompt\nend", "def normalize_open_flags(flags)\n if String === flags\n case flags.tr(\"b\", \"\")\n when \"r\" then IO::RDONLY\n when \"r+\" then IO::RDWR\n when \"w\" then IO::WRONLY | IO::TRUNC | IO::CREAT\n when \"w+\" then IO::RDWR | IO::TRUNC | IO::CREAT\n when \"a\" then IO::APPEND | IO::CREAT | IO::WRONLY\n when \"a+\" then IO::APPEND | IO::CREAT | IO::RDWR\n else raise ArgumentError, \"unsupported flags: #{flags.inspect}\"\n end\n else\n flags.to_i\n end\n end", "def set_flags( *flag_symbols )\n\t\t\tflag_symbols.flatten!\n\t\t\tflag_symbols.compact!\n\n\t\t\tself.log.debug \"Setting flags for symbols: %p\" % [ flag_symbols ]\n\n\t\t\tflag_symbols.each do |flag|\n\t\t\t\tcase flag\n\t\t\t\twhen :fin, :rsv1, :rsv2, :rsv3\n\t\t\t\t\tself.__send__( \"#{flag}=\", true )\n\t\t\t\twhen :continuation, :text, :binary, :close, :ping, :pong\n\t\t\t\t\tself.opcode = flag\n\t\t\t\twhen Integer\n\t\t\t\t\tself.log.debug \" setting Integer flags directly: %#08b\" % [ flag ]\n\t\t\t\t\tself.flags |= flag\n\t\t\t\twhen /\\A0x\\h{2}\\z/\n\t\t\t\t\tval = Integer( flag )\n\t\t\t\t\tself.log.debug \" setting (stringified) Integer flags directly: %#08b\" % [ val ]\n\t\t\t\t\tself.flags = val\n\t\t\t\telse\n\t\t\t\t\traise ArgumentError, \"Don't know what the %p flag is.\" % [ flag ]\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def with_standard_compiler_flags(env = {}, opts = {})\n env ||= {}\n opts ||= {}\n compiler_flags =\n case Ohai[\"platform\"]\n when \"aix\"\n {\n \"CC\" => \"xlc_r -q64\",\n \"CXX\" => \"xlC_r -q64\",\n \"CFLAGS\" => \"-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O\",\n \"LDFLAGS\" => \"-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib\",\n \"LD\" => \"ld -b64\",\n \"OBJECT_MODE\" => \"64\",\n \"ARFLAGS\" => \"-X64 cru\",\n }\n when \"solaris2\"\n {\n \"CC\" => \"gcc -m64 -static-libgcc\",\n \"LDFLAGS\" => \"-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc\",\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include -O2\",\n }\n when \"freebsd\"\n {\n \"CC\" => \"clang\",\n \"CXX\" => \"clang++\",\n \"LDFLAGS\" => \"-L#{install_dir}/embedded/lib -Wl,-rpath,#{install_dir}/embedded/lib\",\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector\",\n }\n when \"windows\"\n arch_flag = windows_arch_i386? ? \"-m32\" : \"-m64\"\n opt_flag = windows_arch_i386? ? \"-march=i686\" : \"-march=x86-64\"\n {\n \"LDFLAGS\" => \"-L#{install_dir}/embedded/lib #{arch_flag} -fno-lto\",\n # We do not wish to enable SSE even though we target i686 because\n # of a stack alignment issue with some libraries. We have not\n # exactly ascertained the cause but some compiled library/binary\n # violates gcc's assumption that the stack is going to be 16-byte\n # aligned which is just fine as long as one is pushing 32-bit\n # values from general purpose registers but stuff hits the fan as\n # soon as gcc emits aligned SSE xmm register spills which generate\n # GPEs and terminate the application very rudely with very little\n # to debug with.\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include #{arch_flag} -O3 #{opt_flag}\",\n }\n else\n {\n \"LDFLAGS\" => \"-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib\",\n \"CFLAGS\" => \"-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector\",\n }\n end\n\n # merge LD_RUN_PATH into the environment. most unix distros will fall\n # back to this if there is no LDFLAGS passed to the linker that sets\n # the rpath. the LDFLAGS -R or -Wl,-rpath will override this, but in\n # some cases software may drop our LDFLAGS or think it knows better\n # and edit them, and we *really* want the rpath setting and do know\n # better. in that case LD_RUN_PATH will probably survive whatever\n # edits the configure script does\n extra_linker_flags = {\n \"LD_RUN_PATH\" => \"#{install_dir}/embedded/lib\",\n }\n\n if solaris2?\n ld_options = \"-R#{install_dir}/embedded/lib\"\n\n if platform_version.satisfies?(\"<= 5.10\")\n # in order to provide compatibility for earlier versions of libc on solaris 10,\n # we need to specify a mapfile that restricts the version of system libraries\n # used. See http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter5-1.html\n # for more information\n # use the mapfile if it exists, otherwise ignore it\n mapfile_path = File.expand_path(Config.solaris_linker_mapfile, Config.project_root)\n ld_options << \" -M #{mapfile_path}\" if File.exist?(mapfile_path)\n end\n\n # solaris linker can also use LD_OPTIONS, so we throw the kitchen sink against\n # the linker, to find every way to make it use our rpath. This is also required\n # to use the aforementioned mapfile.\n extra_linker_flags[\"LD_OPTIONS\"] = ld_options\n end\n\n env.merge(compiler_flags)\n .merge(extra_linker_flags).\n # always want to favor pkg-config from embedded location to not hose\n # configure scripts which try to be too clever and ignore our explicit\n # CFLAGS and LDFLAGS in favor of pkg-config info\n merge({ \"PKG_CONFIG_PATH\" => \"#{install_dir}/embedded/lib/pkgconfig\" }).\n # Set default values for CXXFLAGS and CPPFLAGS.\n merge(\"CXXFLAGS\" => compiler_flags[\"CFLAGS\"])\n .merge(\"CPPFLAGS\" => compiler_flags[\"CFLAGS\"])\n .merge(\"OMNIBUS_INSTALL_DIR\" => install_dir)\n end", "def set_flag(symbol)\n @flags.add(symbol)\n end", "def server_flags; end", "def addCFlags(flags) @CFLAGS = ensureArray(flags) + @CFLAGS end", "def add_flags_from(token)\n token.flags.each do |f|\n set_flag f\n end\n end", "def stability_flags=(stability_flags)\n alias_of.stability_flags(stability_flags)\n end", "def gp_flags=(_arg0); end", "def with_codethink_compiler_flags(platform, env = {}, opts = {})\n env = with_standard_compiler_flags(env = env, opts = opts)\n\n compiler_flags =\n {\n \"LDFLAGS\" => \"-Wl,-rpath,#{install_dir}/lib -L#{install_dir}/lib\",\n \"CFLAGS\" => \"-I#{install_dir}/include -O2\",\n }\n\n return env.merge(compiler_flags).\n merge(\"CXXFLAGS\" => compiler_flags[\"CFLAGS\"]).\n merge(\"CPPFLAGS\" => compiler_flags[\"CFLAGS\"])\nend", "def test_setup\n flags = %w(-s -f 500 -u 100 -g 200 -l foo.log) + [\"-p\", @prefix, @default_filename]\n IO.popen([@binary] + flags, \"r+\") {|f| f.close_write; f.close_read}\n assert_equal(0, $?.exitstatus, \"#{@binary} exited non-zero when testing flags\")\n end", "def flags; changeset.flags(@path); end", "def build_flags_cross\n # Unclear if we need config_site CONFIG_SITE=/etc/dpkg-cross/cross-config.i386\n [] << '-a' << cross_arch\n end", "def add_cxxflags(flags)\n @flags << flags\n end", "def add_cxxflags(flags)\n @flags << flags\n end", "def setsockopt(*) end", "def umask(mask)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:umask]}=#{mask}\"\n self\n end", "def flags=(flags)\n self.flag_attr = flags.map{|flag| flag.to_s}.join(\", \");\n end", "def flag(*names)\n names = [names].flatten\n verify_unused(names,flags,switches,\"in global options\")\n flag = Flag.new(names,@@next_desc,@@next_arg_name,@@next_default_value,@@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end", "def set_platform_opts\n\n # Expand any embedded variables (like '$(CC)')\n CONFIG[\"CC\"] = RbConfig::CONFIG[\"CC\"]\n CONFIG[\"LDSHARED\"] = RbConfig::CONFIG[\"LDSHARED\"]\n\n # Make sure we have a CXX value (sometimes there isn't one)\n CONFIG[\"CXX\"] = CONFIG[\"CC\"] unless CONFIG.has_key?(\"CXX\")\n\n # O/S specific oddities\n\n case p4osname\n when /DARWIN/\n CONFIG['CC'] = 'xcrun c++'\n CONFIG['CXX'] = 'xcrun c++'\n CONFIG['LDSHARED'] = CONFIG['CXX'] + ' -bundle'\n when /FREEBSD/, /LINUX/\n # FreeBSD 6 and some Linuxes use 'cc' for linking by default. The\n # gcc detection patterns above won't catch that, so for these\n # platforms, we specifically convert cc to c++.\n CONFIG['LDSHARED'].sub!(/^cc/, 'c++')\n when /MINGW32/\n # When building with MinGW we need to statically link libgcc\n # and make sure we're linking with gcc and not g++. On older\n # Rubies, they use LDSHARED; newer ones (>=1.9) use LDSHAREDXX\n CONFIG['LDSHARED'].sub!(/g\\+\\+/, 'gcc')\n CONFIG['LDSHAREDXX'].sub!(/g\\+\\+/, 'gcc')\n CONFIG['LDSHARED'] = CONFIG['LDSHARED'] + ' -static-libgcc'\n CONFIG['LDSHAREDXX'] = CONFIG['LDSHARED'] + ' -static-libgcc'\n end\nend", "def flags=(value)\n if value == @defaults['flags']\n @values.delete 'flags' if @values.key? 'flags'\n else\n @values['flags'] = value\n end\n end", "def use_usr_libs\n # Add flags\n set_rpi_flags\n add_flags(:c, '-I/usr/local/include')\nend", "def set_call_flags\n <<-CODE\n next_int;\n c->call_flags = _int;\n CODE\n end", "def aclflags=(acl_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setaclflags {#{@id}} #{acl_flags}`\r\n\t\tend", "def set_log_level(flags)\n options = %w{none basic triggers trigger_summary entries exits closures}.map(&:to_sym)\n flags = Array.wrap(flags)\n unless flags.all? { |flag| options.member? flag }\n flags.each do |flag|\n unless options.member? flag\n raise ArgumentError, \"log level :#{flag} is not one of the support options: #{options.join(', ')}\"\n end\n end\n end\n @log_flags = flags\n end", "def gp_flags; end", "def flags=(val)\n @val = val\n end", "def parse_flags(obj, opt, args)\n x = opt.sub(/^-/, '')\n #c = 0\n x.split(//).each do |k|\n #if obj.respond_to?(\"#{k}=\")\n obj.send(\"#{k}=\", true)\n #else\n # obj.option_missing(x, true)\n #end\n end\n end", "def generate_flags overrides = {}\n { '-s' => 'dir',\n '-t' => 'rpm',\n '--name' => @spec.title,\n '--description' => @spec.description,\n '--url' => @spec.uri,\n '--category' => @spec.category,\n '--version' => @spec.version,\n '--epoch' => 1,\n '--license' => @spec.license,\n '-C' => @spec.dir_path,\n '--depends' => 'mono',\n '--rpm-digest' => 'sha256',\n '--package' => @out\n }.merge(overrides).reject { |_, v| v.nil? }\n end", "def stow_command_flags\n flags = ''\n flags += \"-t #{stow_target}\" unless stow_target.nil?\n flags += \"-d #{stow_path}\" unless stow_path.nil?\n flags\n end", "def add(*flags)\r\n flags.each do |flag|\r\n if flag.class == String\r\n flag = lookup(flag)\r\n end\r\n @access |= flag\r\n end\r\n end", "def add_link_flags(*flags)\n @libs.push(*flags)\n end", "def flags #:nodoc:\n @flags ||= {}\n end", "def set_flags(file, flags); @actions << Action::ExecAction.new(file, flags); end", "def flags=(val)\n self.offset_flags = (offset_flags & 0xffffffffffff0000) | val\n end", "def generate_cli_flags\n @flags.map{|pair| pair.join(' ')}.join(' ').gsub(' true','')\n end", "def build_flags(*flags)\n _flags = *flags\n\n unless _flags.is_a?(Integer)\n _flags = MAGIC_NONE\n\n flags.flatten.each { |flag|\n if value = flag.is_a?(Integer) ? flag : MAGIC_FLAGS[flag.to_sym]\n _flags |= value\n else\n raise ArgumentError, \"#{value.nil? ? 'no such flag' : 'flag not available'}: #{flag}\"\n end\n }\n end\n\n _flags\n end", "def flags=(lst); dirty!; super; end", "def add_compile_flags(*flags)\n @flags.push(*flags)\n end", "def initialize(*all)\n @posix = false\n @style_types = 0x00\n\n raise(MissingPropertyError,\n \"No properties specified for new #{self.class}.\") if all.empty?\n\n until Hash === all[0]\n case (prop = all.shift)\n when :flag then @flag = true\n when :posix then @posix = true\n else \n raise(InvalidPropertyError, \"Unknown option setting '#{prop}'.\")\n end\n end\n\n # Checking for valid properties\n unknown_keys = all[0].keys.find_all { |k| \n !PROPERTIES.include?(k) && /^use?r_/ !~ \"#{k}\" }\n raise(InvalidPropertyError, \n \"The key #{unknown_keys.inspect} is not known and is not a user key.\") unless \n unknown_keys.empty?\n \n #@flag = nil unless defined?(@flag)\n type = @flag.nil? ? :default : :flag\n #merge_hash = \n # case type\n # when :flag then FLAG_BASE_OPTS\n # when :default then DEFAULT_OPTS\n # else raise(InvalidConstructionError, \n # \"Invalid arguments to Option.new. Must be a property hash with \"+\n # \"keys [:names, :arity, :opt_description, :arg_description, \"+\n # \":opt_found, :opt_not_found] or \"+\n # \"an option type [:flag, :default].\")\n # end\n merge_hash = @flag.nil? ? DEFAULT_OPTS : FLAG_BASE_OPTS\n\n @properties = Marshal.load(Marshal.dump(merge_hash))\n all.each { |properties|\n raise(InvalidPropertyError, \n \"Don't understand argument of type '#{properties.class}' => \"+\n \"#{properties.inspect} passed to #{self.class}.new. Looking \"+\n \"for type Hash.\") unless properties.kind_of?(Hash)\n\n @properties.merge!(properties)\n }\n \n @properties[:names] = [@properties[:names]].flatten.compact\n\n arg_arity = @properties[:arity]\n raise \"Invalid value for arity '#{arg_arity}'.\" unless \n arg_arity.kind_of?(Array) || arg_arity.kind_of?(Fixnum)\n\n @properties[:arity] = [arg_arity, arg_arity] unless \n arg_arity.kind_of?(Array)\n\n raise(InvalidArgumentArityError,\n \"Conflicting value given to new option: :flag \"+\n \"and :arity = #{@properties[:arity].inspect}.\") if \n :flag == type && [0,0] != @properties[:arity]\n\n names = @properties[:names]\n raise(MissingOptionNameError, \n \"Attempt to create an Option without :names defined.\") if \n names.nil? || names.empty?\n\n names.each { |name| check_option_name(name) }\n validate_arity @properties[:arity]\n record_option_styles(names)\n\n create_opt_description if type == :flag\n end", "def set_mode\n chmod = command? 'chmod'\n find = command? 'find'\n\n return unless chmod && find\n\n {fmode: 'f', dmode: 'd'}.each do |k, v|\n next if send(k).nil?\n cmd = [find, destination_path, '-type', v, '-exec']\n cmd.concat [chmod, send(k).to_s(8), '{}', '+']\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n end\n end", "def unix_perms=(_arg0); end", "def flag(*names)\n names = [names].flatten\n GLI.verify_unused(names,flags,switches,\"in command #{name}\")\n flag = Flag.new(names,@next_desc,@next_arg_name,@next_default_value,@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end", "def notifyflags=(notify_flags)\r\n\t\t\t`#{BITS::BITSADMIN} /setnotifyflags {#{@id}} #{notify_flags}`\r\n\t\tend", "def set_wait_flags(*flags)\n a = (flags.include?(:a) || flags.include?(:a)) ? '1' : 'X'\n b = (flags.include?(:b) || flags.include?(:b)) ? '1' : 'X'\n c = (flags.include?(:c) || flags.include?(:c)) ? '1' : 'X'\n d = (flags.include?(:d) || flags.include?(:d)) ? '1' : 'X'\n self.wait_flags = d + c + b + a\n self\n end", "def set_platform_libs\n\n case p4osname\n when 'SOLARIS'\n osver = `uname -r`\n osver.gsub!(/5\\./, '2')\n if (osver == '25')\n $LDFLAGS += '/usr/ucblib/libucb.a '\n end\n have_library('nsl')\n have_library('socket')\n when 'NT'\n have_library('advapi32')\n have_library('wsock32')\n have_library('kernel32')\n have_library('oldnames')\n when 'CYGWIN'\n # Clear out 'bogus' libs on cygwin\n CONFIG['LIBS'] = ''\n when 'DARWIN'\n if p4osver.to_i >= 8\n # Only build for 64 bit if we have more than one arch defined in CFLAGS\n $LDFLAGS.slice!('-arch i386')\n $LDFLAGS.slice!('-arch ppc')\n $LDFLAGS += ' -framework CoreFoundation -framework Foundation'\n end\n when 'LINUX', 'MINGW32'\n $LDFLAGS += ' -Wl,--allow-multiple-definition'\n have_library('supc++')\n end\nend", "def flag(*names)\n options = extract_options(names)\n names = [names].flatten\n\n verify_unused(names)\n flag = Flag.new(names,options)\n flags[flag.name] = flag\n\n clear_nexts\n flags_declaration_order << flag\n flag\n end", "def flags; end", "def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend", "def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend", "def flags(*args)\n Boxen::Flags.new *args\n end", "def ndp_set_flags=(bits)\n case bits\n when \"000\"\n self.ndp_reserved = 0x00000000\n when \"001\"\n self.ndp_reserved = 0x20000000\n when \"010\"\n self.ndp_reserved = 0x40000000\n when \"011\"\n self.ndp_reserved = 0x60000000\n when \"100\"\n self.ndp_reserved = 0x80000000\n when \"101\"\n self.ndp_reserved = 0xa0000000\n when \"110\"\n self.ndp_reserved = 0xc0000000\n when \"111\"\n self.ndp_reserved = 0xe0000000\n end\n end", "def flag_options\n return @flag_options unless @flag_options.nil?\n @flag_options = ''\n @flag_options << ' --auto-attach' if new_resource.auto_attach\n @flag_options << ' --force' if new_resource.force\n @flag_options << ' --insecure' if new_resource.insecure\n @flag_options\n end", "def set_logical_flags_from(actual_value, size)\n\t\[email protected]_bit_at(OVERFLOW_FLAG, 0)\n\t\[email protected]_bit_at(CARRY_FLAG, 0)\n\t\tset_zero_flag_from actual_value\n\t\tset_sign_flag_from actual_value, size - 1\n\t\tset_parity_flag_from actual_value, size\n\tend", "def use_usr_libs\n case $RUBY2D_PLATFORM\n when :macos\n add_flags(:c, `sdl2-config --cflags`)\n add_flags(:c, '-I/opt/homebrew/include')\n add_flags(:ld, `sdl2-config --libs`)\n add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')\n add_flags(:ld, '-Wl,-framework,OpenGL')\n when :windows\n add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf')\n add_flags(:ld, '-lopengl32 -lglew32')\n when :linux_rpi\n set_linux_bsd_flags\n end\nend", "def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end", "def flags=(values)\n val = 0\n FRAME_FLAGS_MAP.values_at(*values).each { |c|\n val |= c if c\n }\n @flags_value = val\n end", "def umask=(val='0022')\n @rye_current_umask = val\n self\n end", "def general_purpose_flags\n 0b0000000000000001\n end", "def flags \n @flags ||= {}\n end", "def sysopen(*args)\n args[1] = 0600 unless args[1]\n orig_sysopen(*args)\n end", "def std_flags\n # FIXME: this is bogus\n m = method(:help_text)\n boolean :help, :flag => \"h\", :doc => \"display this help\"\n boolean :verbose, :flag => \"v\", :doc => \"verbose output\"\n boolean :debug, :flag => \"D\", :doc => \"turn on debugging\"\n end", "def setFlag(flg)\r\n if (flg.class == Array)\r\n flg.each do |f|\r\n case f\r\n when '-v'\r\n @verbose = true\r\n end\r\n end # flg.each\r\n\r\n return\r\n end # if flg\r\n\r\n case flg\r\n when '-v'\r\n @verbose = true\r\n end\r\n\r\n end", "def make_flag(options)\n\tflagString=\" \"\n\tif(options.list != nil)\n\t\tflagString+=\" -l\"\n\tend\n\tif(options.all != nil)\n\t\tflagString+= \" -a\"\n\tend\n\treturn flagString\nend", "def initialize(info = {})\n ret = super(info)\n\n register_advanced_options(\n [\n Msf::OptBool.new('PrependSetresuid',\n [\n false,\n \"Prepend a stub that executes the setresuid(0, 0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetreuid',\n [\n false,\n \"Prepend a stub that executes the setreuid(0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetuid',\n [\n false,\n \"Prepend a stub that executes the setuid(0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetresgid',\n [\n false,\n \"Prepend a stub that executes the setresgid(0, 0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetregid',\n [\n false,\n \"Prepend a stub that executes the setregid(0, 0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('PrependSetgid',\n [\n false,\n \"Prepend a stub that executes the setgid(0) system call\",\n false\n ]\n ),\n Msf::OptBool.new('AppendExit',\n [\n false,\n \"Append a stub that executes the exit(0) system call\",\n false\n ]\n ),\n ], Msf::Payload::Bsd)\n\n ret\n end", "def reset_flags\n @flags = { :zero => false , :plus => false ,\n :minus => false , :overflow => false }\n end", "def scm_flags\n @flags.join(\" \")\n end", "def append_ld_flags(flags)\n flags = [flags] unless flags.is_a?(Array)\n with_ldflags(\"#{$LDFLAGS} #{flags.join(' ')}\") { true }\nend", "def unix_perms; end", "def flags\n input = @flags.clone\n tok = []\n\n # Set the output path\n throw 'Output pathname is required' if @output.nil?\n if Platform.is_windows?\n tok.push \"/OUT:\\\"#{@output}\\\"\"\n tok.push '/DLL' if @output =~ /\\.dll/i\n else\n tok.push '-o', @output\n end\n\n # Enable shared library output\n if @shared_library\n if Platform.is_windows?\n tok.push '/DLL'\n else\n tok.push '-shared'\n tok.push '-fPIC'\n end\n end\n\n # Assume that we want to link with shared libraries\n # built within this project\n unless Platform.is_windows?\n tok.push '-L', '.'\n end\n\n # Override the normal search path for the dynamic linker\n unless @rpath.nil?\n if Platform.is_solaris?\n input.push ['R', @rpath]\n elsif Platform.is_linux?\n input.push ['-rpath', @rpath]\n elsif Platform.is_windows?\n # XXX-FIXME Windows does not support the rpath concept\n else\n throw 'Unsupported OS'\n end\n input.push ['-L', @rpath]\n end\n\n input.each do |f|\n if @gcc_flags == true\n if f.kind_of?(Array)\n if f[0] == '-L'\n tok.push f.join(' ')\n else\n tok.push '-Wl,' + f[0] + ',' + f[1]\n end\n else\n tok.push '-Wl,' + f\n end\n else\n if f.kind_of?(Array)\n tok.push f.flatten.join(' ')\n else\n tok.push f\n end\n end\n end\n\n res = ' ' + tok.join(' ')\n return res\n end", "def folly_flags()\n return NewArchitectureHelper.folly_compiler_flags\nend", "def set_port_cap file\n return unless [:ubuntu, :debian].include? DISTRO[0]\n sh \"sudo setcap cap_net_bind_service=+ep #{File.expand_path file}\"\nend", "def xtest_posix\nputs \"*\"*80\nassert_equal(false, true)\n assert_equal(\"\", \"Need way to set posix mode from app!\")\n end", "def load_flags\n @flags ||= {}\n @flags[:state?] = true\n @flags[:region?] = true\n @flags[:teleport?] = true\n end", "def path=(p)\n @path = p\n # TODO: Support non-GNU archivers\n #if `#{@path} --version` =~ /^GNU ar/\n# @gcc_flags = false\n# end\n end", "def stability_flags\n alias_of.stability_flags\n end", "def determine_os\n @os = \"linux\"\n end", "def flag_options\n request('flags/options').auth_required!\n end", "def determine_os\n @os = 'linux'\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 get_cflags(cc)\n cflags=\"-g -O2 -fpic -Wall -Werror -std=c99 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I./include -Isrc/common\".split(/ /) \n\n if Platform.is_solaris?\n cflags.push \"-D__EXTENSIONS__\"\n end\n cflags\nend", "def modifier_flags(include_shift = true)\n modifiers = self.modifiers.dup\n modifiers.delete(\"S\") unless include_shift\n flags = 0\n modifiers.each { |modifier| flags = flags | MODIFIER_MAP[modifier] }\n flags\n end", "def general_purpose_flags\n 0b0000000000000000\n end", "def nfs_opts_setup()\n @folders.each do |k, opts|\n if !opts[:linux__nfs_options]\n opts[:linux__nfs_options] ||= [\"rw\", \"no_subtree_check\", \"all_squash\", \"insecure\"]\n end\n\n # Only automatically set anonuid/anongid if they weren't\n # explicitly set by the user.\n hasgid = false\n hasuid = false\n opts[:linux__nfs_options].each do |opt|\n hasgid = !!(opt =~ /^anongid=/) if !hasgid\n hasuid = !!(opt =~ /^anonuid=/) if !hasuid\n end\n\n opts[:linux__nfs_options] << \"anonuid=#{opts[:map_uid]}\" if !hasuid\n opts[:linux__nfs_options] << \"anongid=#{opts[:map_gid]}\" if !hasgid\n opts[:linux__nfs_options] << \"fsid=#{opts[:uuid]}\"\n\n # Expand the guest path so we can handle things like \"~/vagrant\"\n expanded_guest_path = @machine.guest.capability(\n :shell_expand_guest_path, opts[:guestpath])\n\n # Do the actual creating and mounting\n @machine.communicate.sudo(\"mkdir -p #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chown -R vagrant:vagrant #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chmod u+rw #{expanded_guest_path}\")\n @machine.communicate.sudo(\"chmod g+rws #{expanded_guest_path}\")\n end\n end", "def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end", "def fflags\n set = FFI::MemoryPointer.new :ulong\n clear = FFI::MemoryPointer.new :ulong\n C.archive_entry_fflags(entry, set, clear)\n\n [set.get_ulong(0), clear.get_ulong(0)]\n end", "def flags\n @flags ||= Set.new([])\n end", "def flags\n @flags\n end", "def flags\n @flags\n end", "def variable_define_flags\n flags = Hash.new\n flags['PuppetDescTag'] = describe 'downloads/puppet'\n flags['FacterDescTag'] = describe 'downloads/facter'\n\n # The regular expression with back reference groups for version string\n # parsing. We re-use this against either git-describe on Puppet or on\n # ENV['PE_VERSION_STRING'] which should match the same pattern. NOTE that we\n # can only use numbers in the product version and that product version\n # impacts major upgrades: ProductVersion Property is defined as\n # [0-255].[0-255].[0-65535] See:\n # http://stackoverflow.com/questions/9312221/msi-version-numbers\n # This regular expression focuses on the major numbers and discards things like \"rc1\" in the string\n version_regexps = [\n /(\\d+)[^.]*?\\.(\\d+)[^.]*?\\.(\\d+)[^.]*?-(\\d+)-(.*)/,\n /(\\d+)[^.]*?\\.(\\d+)[^.]*?\\.(\\d+)[^.]*?\\.(\\d+)/,\n /(\\d+)[^.]*?\\.(\\d+)[^.]*?\\.(\\d+)[^.]*?/,\n ]\n\n case ENV['BRANDING']\n when /enterprise/i\n flags['PackageBrand'] = \"enterprise\"\n msg = \"Could not parse PE_VERSION_STRING env variable. Set it with something like PE_VERSION_STRING=2.5.0\"\n # The Package Version components for FOSS\n match_data = nil\n version_regexps.find(lambda { raise ArgumentError, msg }) do |re|\n match_data = ENV['PE_VERSION_STRING'].match re\n end\n flags['MajorVersion'] = match_data[1]\n flags['MinorVersion'] = match_data[2]\n flags['BuildVersion'] = match_data[3]\n flags['Revision'] = match_data[4] || 0\n else\n flags['PackageBrand'] = \"foss\"\n msg = \"Could not parse git-describe annotated tag for Puppet\"\n # The Package Version components for FOSS\n match_data = nil\n version_regexps.find(lambda { raise ArgumentError, msg }) do |re|\n match_data = flags['PuppetDescTag'].match re\n end\n flags['MajorVersion'] = match_data[1]\n flags['MinorVersion'] = match_data[2]\n flags['BuildVersion'] = match_data[3]\n flags['Revision'] = match_data[4] || 0\n end\n\n # Return the string of flags suitable for candle\n flags.inject([]) { |a, (k,v)| a << \"-d#{k}=\\\"#{v}\\\"\" }.join \" \"\nend", "def current_umask; @rye_current_umask; end" ]
[ "0.63164806", "0.6221122", "0.60628366", "0.6018642", "0.6018642", "0.60154915", "0.60154915", "0.6011904", "0.5856891", "0.5809496", "0.5737225", "0.56775504", "0.56628144", "0.55844355", "0.5582342", "0.5576389", "0.55530214", "0.55296576", "0.55072", "0.5481024", "0.5479029", "0.54765326", "0.54673254", "0.54673254", "0.5450301", "0.54486775", "0.5447079", "0.5417007", "0.5412012", "0.5391583", "0.5364732", "0.53600913", "0.53569186", "0.5355725", "0.53523445", "0.535075", "0.53410953", "0.5295397", "0.5293163", "0.52785224", "0.52761763", "0.52669734", "0.52626324", "0.5260241", "0.5249304", "0.5246827", "0.5233667", "0.5224653", "0.5218285", "0.52123374", "0.5211818", "0.52056545", "0.5204815", "0.5203825", "0.52010316", "0.5182214", "0.5162942", "0.51396745", "0.51396745", "0.51378405", "0.5123082", "0.5112872", "0.50933266", "0.50785077", "0.50631654", "0.5055874", "0.50481886", "0.50268704", "0.5017393", "0.4990595", "0.4985151", "0.4980494", "0.49744317", "0.49670744", "0.4966658", "0.4957803", "0.4947772", "0.49461418", "0.49429753", "0.49373022", "0.49340123", "0.4931669", "0.4890465", "0.48816577", "0.48811978", "0.48542595", "0.48403126", "0.48329106", "0.48265195", "0.48262104", "0.48259383", "0.4817517", "0.48057345", "0.4792956", "0.47904077", "0.47758135", "0.47753575", "0.47753575", "0.47675928", "0.4761937" ]
0.6671238
0
Use SDL and other libraries installed by the user (not those bundled with the gem)
def use_usr_libs case $RUBY2D_PLATFORM when :macos add_flags(:c, `sdl2-config --cflags`) add_flags(:c, '-I/opt/homebrew/include') add_flags(:ld, `sdl2-config --libs`) add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf') add_flags(:ld, '-Wl,-framework,OpenGL') when :windows add_flags(:ld, '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf') add_flags(:ld, '-lopengl32 -lglew32') when :linux_rpi set_linux_bsd_flags end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_sdl\n unless have_library('SDL2') && have_library('SDL2_image') && have_library('SDL2_mixer') && have_library('SDL2_ttf')\n\n $errors << \"Couldn't find packages needed by Ruby 2D.\"\n\n case $platform\n when :linux, :linux_rpi\n # Fedora and CentOS\n if system('which yum')\n $errors << \"Install the following packages using `yum` (or `dnf`) and try again:\\n\" <<\n \" SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel\".bold\n\n # Arch\n elsif system('which pacman')\n $errors << \"Install the following packages using `pacman` and try again:\\n\" <<\n \" sdl2 sdl2_image sdl2_mixer sdl2_ttf\".bold\n\n # openSUSE\n elsif system('which zypper')\n $errors << \"Install the following packages using `zypper` and try again:\\n\" <<\n \" libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel\".bold\n\n # Ubuntu, Debian, and Mint\n # `apt` must be last because openSUSE has it aliased to `zypper`\n elsif system('which apt')\n $errors << \"Install the following packages using `apt` and try again:\\n\" <<\n \" libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev\".bold\n end\n when :bsd\n $errors << \"Install the following packages using `pkg` and try again:\\n\" <<\n \" sdl2 sdl2_image sdl2_mixer sdl2_ttf\".bold\n end\n\n $errors << \"\" << \"See #{\"ruby2d.com\".bold} for additional help.\"\n print_errors; exit\n end\nend", "def check_sdl_linux\n unless have_library('SDL2') && have_library('SDL2_image') && have_library('SDL2_mixer') && have_library('SDL2_ttf')\n\n $errors << \"Couldn't find packages needed by Ruby 2D.\"\n\n # Fedora and CentOS\n if system('which yum')\n $errors << \"Install the following packages using `yum` (or `dnf`) and try again:\\n\" <<\n \" SDL2-devel SDL2_image-devel SDL2_mixer-devel SDL2_ttf-devel\".bold\n\n # Arch\n elsif system('which pacman')\n $errors << \"Install the following packages using `pacman` and try again:\\n\" <<\n \" sdl2 sdl2_image sdl2_mixer sdl2_ttf\".bold\n\n # openSUSE\n elsif system('which zypper')\n $errors << \"Install the following packages using `zypper` and try again:\\n\" <<\n \" libSDL2-devel libSDL2_image-devel libSDL2_mixer-devel libSDL2_ttf-devel\".bold\n\n # Ubuntu, Debian, and Mint\n # `apt` must be last because openSUSE has it aliased to `zypper`\n elsif system('which apt')\n $errors << \"Install the following packages using `apt` and try again:\\n\" <<\n \" libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev\".bold\n end\n\n $errors << \"\" << \"See #{\"ruby2d.com\".bold} for additional help.\"\n print_errors; exit\n end\nend", "def set_linux_bsd_flags\n check_sdl\n set_rpi_flags\n add_flags(:ld, \"-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm\")\n if $RUBY2D_PLATFORM == :linux then add_flags(:ld, '-lGL') end\nend", "def load_libs; end", "def require_lib(*libs); end", "def init(*subsystems)\n subsystems.push(:audio, :video) if subsystems.empty?\n flags = subsystems.map{|k| SDL_INIT_FLAGS.fetch(k) }.inject(:|)\n if @ran_init\n raise \"subsystems already initialized and different composition\" unless @ran_init == flags\n return\n end\n raise \"subsystems initialize fault\" if SDL.inited_system(flags) > 0\n @ran_init = flags\n init_events\n SDL.init(flags)\n SDL::Mixer.open if subsystems.include?(:audio)\n SDL::Mixer.allocate_channels(16)\n SDL::TTF.init\n end", "def libs; end", "def require_libs(*libs); end", "def link_libraries\n if RbConfig::CONFIG[\"THREAD_MODEL\"] == \"pthread\"\n # Link gem extension against pthread library\n have_library \"pthread\"\n have_required_function \"pthread\", \"pthread_create\"\n end\n\n # Links gem extension against the `dl` library. This is needed when Ruby is\n # not linked against `dl` itself, so link it on the gem extension.\n have_library \"dl\"\n # Check if functions are available now from the linked library\n %w[dlopen dlclose dlsym].each do |func|\n have_required_function \"dl\", func\n end\nend", "def compile_native\n\n # Get include directories\n incl_dir_ruby2d = \"#{Ruby2D.gem_dir}/ext/ruby2d/\"\n incl_dir_deps = \"#{Ruby2D.assets}/include/\"\n\n # Add compiler flags for each platform\n case $RUBY2D_PLATFORM\n\n when :macos\n ld_dir = \"#{Ruby2D.assets}/macos/universal/lib\"\n\n c_flags = '-arch arm64 -arch x86_64'\n\n ld_flags = ''\n ['mruby', 'SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL2_ttf',\n 'jpeg', 'jxl', 'avif', 'png', 'tiff', 'webp',\n 'mpg123', 'ogg', 'FLAC', 'vorbis', 'vorbisfile', 'modplug',\n 'freetype', 'harfbuzz', 'graphite2'].each do |name|\n add_ld_flags(ld_flags, name, :archive, ld_dir)\n end\n\n ld_flags << \"-lz -lbz2 -liconv -lstdc++ \"\n ['Cocoa', 'Carbon', 'CoreVideo', 'OpenGL', 'Metal', 'CoreAudio', 'AudioToolbox',\n 'IOKit', 'GameController', 'ForceFeedback', 'CoreHaptics'].each do |name|\n add_ld_flags(ld_flags, name, :framework)\n end\n\n when :linux, :linux_rpi, :bsd\n # TODO: implement this\n # ld_flags = '-lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm -lGL'\n\n when :windows\n\n if RUBY_PLATFORM =~ /ucrt/\n ld_dir = \"#{Ruby2D.assets}/windows/mingw-w64-ucrt-x86_64/lib\"\n else\n ld_dir = \"#{Ruby2D.assets}/windows/mingw-w64-x86_64/lib\"\n end\n\n ld_flags = '-static -Wl,--start-group '\n ['mruby',\n 'SDL2',\n 'SDL2_image', 'jpeg', 'png', 'tiff', 'webp', 'jxl', 'hwy', 'jbig', 'deflate', 'lzma', 'zstd', 'Lerc',\n 'SDL2_mixer', 'mpg123', 'FLAC', 'vorbis', 'vorbisfile', 'ogg', 'modplug', 'opus', 'opusfile', 'sndfile',\n 'SDL2_ttf', 'freetype', 'harfbuzz', 'graphite2', 'bz2', 'brotlicommon', 'brotlidec',\n 'glew32', 'stdc++', 'z', 'ssp'\n ].each do |name|\n add_ld_flags(ld_flags, name, :archive, ld_dir)\n end\n ld_flags << '-lmingw32 -lopengl32 -lole32 -loleaut32 -limm32 -lversion -lwinmm -lrpcrt4 -mwindows -lsetupapi -ldwrite '\\\n '-lws2_32 -lshlwapi '\n ld_flags << '-Wl,--end-group'\n end\n\n # Compile the app\n run_cmd \"cc #{c_flags} -I#{incl_dir_ruby2d} -I#{incl_dir_deps} build/app.c #{ld_flags} -o build/app\"\n\n create_macos_bundle if $RUBY2D_PLATFORM == :macos\nend", "def apply_gemspec_defaults s\n s.name = 'gosu'\n s.version = GOSU_VERSION\n s.summary = '2D game development library.'\n s.description = <<EOS\n 2D game development library.\n\n Gosu features easy to use and game-friendly interfaces to 2D graphics\n and text (accelerated by 3D hardware), sound samples and music as well as\n keyboard, mouse and gamepad/joystick input.\n\n Also includes demos for integration with RMagick, Chipmunk and Ruby-OpenGL.\nEOS\n s.authors = ['Julian Raschke', 'Jan Luecker']\n s.date = Time.now.strftime '%Y-%m-%d'\n s.email = '[email protected]'\n s.homepage = 'http://code.google.com/p/gosu/'\n s.require_paths = ['lib']\n s.required_ruby_version = Gem::Requirement.new('>= 1.8.2')\n s.summary = '2D game development library.'\nend", "def load_dependencies\n begin\n require 'cairo'\n rescue LoadError\n require 'rubygems'\n begin\n require 'cairo'\n rescue LoadError\n puts \"Compass::Canvas\\n_______________\\n\\n\"\n puts \"Unable to load Cairo backend. Please install it with the following command:\\n\\n\"\n puts \" gem install cairo\\n\\n\"\n puts \"For more information, please visit https://github.com/rcairo/rcairo\"\n raise\n end\n end\n end", "def initialize w, h, bpp = 0, name = self.class.name, full = false\n SDL.init SDL::INIT_VIDEO\n SDL::TTF.init\n\n full = full ? SDL::FULLSCREEN : 0\n\n self.font = SDL::TTF.open(\"/System/Library/Fonts/Menlo.ttc\", 32, 0)\n\n SDL::WM.set_caption name, name\n\n self.screen = SDL::Screen.open w, h, bpp, SDL::HWSURFACE|SDL::DOUBLEBUF|full\n self.w, self.h = screen.w, screen.h\n\n self.color = {}\n self.rgb = Hash.new { |hash, k| hash[k] = screen.get_rgb(color[k]) }\n\n register_color :black, 0, 0, 0\n register_color :white, 255, 255, 255\n register_color :red, 255, 0, 0\n register_color :green, 0, 255, 0\n register_color :blue, 0, 0, 255\n register_color :gray, 127, 127, 127\n register_color :yellow, 255, 255, 0\n register_color :alpha, 0, 0, 0, 0\n\n (0..99).each do |n|\n m = (255 * (n / 100.0)).to_i\n register_color (\"gray%02d\" % n).to_sym, m, m, m\n register_color (\"red%02d\" % n).to_sym, m, 0, 0\n register_color (\"green%02d\" % n).to_sym, 0, m, 0\n register_color (\"blue%02d\" % n).to_sym, 0, 0, m\n end\n\n self.paused = false\n end", "def apply_gemspec_defaults s\n #### Basic information.\n s.name = 'gosu'\n s.version = GOSU_VERSION\n s.summary = '2D game development library.'\n s.description = <<EOS\n 2D game development library.\n\n Gosu features easy to use and game-friendly interfaces to 2D graphics\n and text (accelerated by 3D hardware), sound samples and music as well as\n keyboard, mouse and gamepad/joystick input.\n\n Also includes demos for integration with RMagick, Chipmunk and Ruby-OpenGL.\nEOS\n s.authors = ['Julian Raschke', 'Jan Luecker']\n s.date = Time.now.strftime '%Y-%m-%d'\n s.email = '[email protected]'\n s.homepage = 'http://code.google.com/p/gosu/'\n s.require_paths = ['lib']\n s.required_ruby_version = Gem::Requirement.new('>= 1.8.2')\n s.summary = '2D game development library.'\nend", "def load_game\n require './game/setup.rb'\n end", "def load_no_focus_lib=(_arg0); end", "def load_lab_app_lib_files\n libFiles = File.dirname(__FILE__) + \"/../lib/*.rb\"\n Dir[libFiles].each do |file|\n fullpath = File.expand_path(file)\n puts \"Loading your file #{fullpath}\"\n require fullpath\n end\n end", "def set_platform_libs\n\n case p4osname\n when 'SOLARIS'\n osver = `uname -r`\n osver.gsub!(/5\\./, '2')\n if (osver == '25')\n $LDFLAGS += '/usr/ucblib/libucb.a '\n end\n have_library('nsl')\n have_library('socket')\n when 'NT'\n have_library('advapi32')\n have_library('wsock32')\n have_library('kernel32')\n have_library('oldnames')\n when 'CYGWIN'\n # Clear out 'bogus' libs on cygwin\n CONFIG['LIBS'] = ''\n when 'DARWIN'\n if p4osver.to_i >= 8\n # Only build for 64 bit if we have more than one arch defined in CFLAGS\n $LDFLAGS.slice!('-arch i386')\n $LDFLAGS.slice!('-arch ppc')\n $LDFLAGS += ' -framework CoreFoundation -framework Foundation'\n end\n when 'LINUX', 'MINGW32'\n $LDFLAGS += ' -Wl,--allow-multiple-definition'\n have_library('supc++')\n end\nend", "def require_libs(*libs)\n libs.each do |lib|\n require \"#{lib_path}/#{lib}\"\n end\n end", "def lib name\n name = name.to_sym\n type = $VHOST.libraries[name][:type]\n libhome = $VHOST.liburi\n if type == :js\n echo \"<script type='text/javascript' src='/#{libhome}/#{name}'></script>\"\n elsif type == :css\n echo \"<link rel='stylesheet' href='/#{libhome}/#{name}'></link>\"\n end\n end", "def use_usr_libs\n # Add flags\n set_rpi_flags\n add_flags(:c, '-I/usr/local/include')\nend", "def require_gems; end", "def do_requires()\n require 'rack'\n require './lib/my_thin.rb'\n require './android_translation_helper.rb'\nend", "def require_faux_gem\n rel_main = \"./#{real_main_file_name}\"\n Dir.chdir( folder_lib ){\n require \"./#{real_main_file_name}\"\n }\n end", "def setup_screen\n rl = ResourceLocator.instance\n if rl.is_gem?('kuiper')\n rl.dirs << Gem.loaded_specs['kuiper'].full_gem_path\n end\n rl.dotfile=\".kuiper\"\n repository = Repository.new()\n rl.storage[:repository] = repository\n rl.storage[:visual_log] = [] # Distinct from the rl.logger; this is on-screen\n optpath = rl.dotpath_for(\"options.yml\")\n if File.exists?(optpath)\n options = Options.from_file(optpath)\n else\n options = Options.new(optpath)\n options.save\n end\n rl.storage[:options] = options\n w,h = options.screen_size\n screen = rl.screen( w, h, options.fullscreen )\n icon = rl.image_for(\"kuicon.png\",false,false)\n screen.icon = icon\n screen.title = \"Kuiper\"\n setup_joystick\n return screen\nend", "def load_library\n\t\t#wget some url\n\tend", "def load_minimal_gems\r\n end", "def _reload_libs\n RELOAD_LIBS.each do |lib|\n require_dependency lib\n end\n end", "def check_for_libraries; end", "def patch_shoes_app_for_gui!\n unless $shoes_app_patched\n Shoes::App.send(:include, Client::ShoesGUIModule)\n $shoes_app_patched = true\n end\nend", "def lib(name)\n\t\tlib = YAML::load(File.open(File.join(\"lib\", \"#{name}.yml\")))\n\tend", "def require_engine\n return if defined? ::Maruku\n require_library 'maruku'\n end", "def add_vendored_libraries\n UI.message '- Adding libraries' do\n add_file_accessors_paths_to_pods_group(:vendored_libraries, :frameworks)\n end\n end", "def abaMusicPods\n #SVProgressHUD\n pod 'SVProgressHUD', '~> 2.2.5'\n \n #Haneke\n pod 'Haneke', '~> 1.0'\nend", "def _reload_libs\n RELOAD_LIBS.each do |lib|\n require_dependency lib\n end\n end", "def pbPlayCursorSE()\n if $data_system && $data_system.respond_to?(\"cursor_se\") &&\n $data_system.cursor_se && $data_system.cursor_se.name!=\"\"\n pbSEPlay($data_system.cursor_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[0] && $data_system.sounds[0].name!=\"\"\n pbSEPlay($data_system.sounds[0])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel cursor\")\n pbSEPlay(\"GUI sel cursor\",80)\n end\nend", "def dynamically_linked_libraries(except: :none)\n # The argument except is unused.\n puts if except == :unused\n metadata.dylibs\n end", "def library pkgname, fail_after=300\n Timeout::timeout(fail_after) do\n install_package pkgname\n e \"library(#{pkgname})\"\n end\n end", "def add_system_library(names)\n Array(names).each do |name|\n path = \"usr/lib/lib#{name}.dylib\"\n unless ref = project.frameworks_group.files.find { |ref| ref.path == path }\n ref = project.frameworks_group.new_file(path, :sdk_root)\n end\n frameworks_build_phase.add_file_reference(ref, true)\n ref\n end\n end", "def library; end", "def library; end", "def require_engine\n return if defined? ::Erector\n require_library 'erector'\n end", "def autoloader; end", "def play\n if (RUBY_PLATFORM == \"java\")\n java_play\n else\n ruby_play\n end\n end", "def fonts\n package 'ttf-freefarsi', :ensure => :installed\n package 'ttf-farsiweb', :ensure => :installed\n end", "def use_frameworks!(flag = true)\n current_target_definition.use_frameworks!(flag)\n end", "def image path\n SDL::Surface.load path\n end", "def image path\n SDL::Surface.load path\n end", "def fake_embedded_bin(name)\n bin = File.join(software.install_dir, 'embedded', 'bin')\n\n FileUtils.mkdir_p(bin)\n FileUtils.ln_s(Bundler.which(name), File.join(bin, name))\n end", "def require_gtk2\n require \"gtk2\"\n \n #For msgbox and translation of windows.\n require \"knj/gtk2\"\n \n #For easy initialization, getting and settings of values on comboboxes.\n require \"knj/gtk2_cb\"\n \n #For easy initialization, getting and settings of values on treeviews.\n require \"knj/gtk2_tv\"\n \n #For easy making status-windows with progressbar.\n require \"knj/gtk2_statuswindow\"\n end", "def load_duomenys\n load_kosmonautai\n load_laivai\n load_centrai\n load_stotys\n start\n end", "def execute_app(app)\n $LOAD_PATH.unshift(Dir.pwd)\n Shoes.configuration.backend = :swt\n load app\n end", "def menu_app_on_dropbox\n Cocos2dxMrubyPlayer.load(\"$DBX/app_root/demo/menu.rb\")\nend", "def install\n\n # --- custom ---\n ENV.prepend_path \"PKG_CONFIG_PATH\", \"/usr/local/lib/pkgconfig/\"\n inreplace \"build/modules.conf.in\", /^codecs/, \"#codecs\"\n\n args = []\n if build.with?(\"freetype\")\n ENV.append_to_cflags \"-I#{Formula[\"freetype\"].opt_include}/freetype2/\"\n else\n args << \"--without-freetype\"\n end\n\n if build.with?(\"lua\")\n ENV.append_to_cflags \"-I#{Formula[\"lua\"].opt_include}/lua/\"\n else\n inreplace \"build/modules.conf.in\", \"languages/mod_lua\",\n \"#languages/mod_lua\"\n end\n\n if build.with?(\"amqp\")\n inreplace \"build/modules.conf.in\", \"#event_handlers/mod_amqp\",\n \"event_handlers/mod_amqp\"\n end\n\n if build.with?(\"shout\")\n inreplace \"build/modules.conf.in\", \"#formats/mod_shout\",\n \"formats/mod_shout\"\n end\n\n if build.with?(\"libyuv\")\n raise \"Building with libyuv is not supported yet\"\n else\n args << \"--disable-libyuv\"\n end\n\n if build.with?(\"libvpx\")\n raise \"Building with libvpx is not supported yet\"\n else\n args << \"--disable-libvpx\"\n end\n\n # --- end of custom ---\n\n ENV[\"ac_cv_lib_lzma_lzma_code\"] = \"no\" # prevent opportunistic linkage to xz\n\n # avoid a dependency on ldns to prevent OpenSSL version conflicts\n inreplace \"build/modules.conf.in\", \"applications/mod_enum\",\n \"#applications/mod_enum\"\n\n system \"./bootstrap.sh\", \"-j\"\n\n # tiff will fail to find OpenGL unless told not to use X\n inreplace \"libs/tiff-4.0.2/configure.gnu\", \"--with-pic\", \"--with-pic --without-x\"\n\n system \"./configure\", \"--disable-dependency-tracking\",\n \"--enable-shared\",\n \"--enable-static\",\n \"--prefix=#{prefix}\",\n \"--exec_prefix=#{prefix}\",\n *args,\n \"LIBS=#{ENV['LIBS']}\",\n \"CFLAGS=#{ENV['CFLAGS']}\",\n \"CXXFLAGS=#{ENV['CFLAGS']}\",\n \"LDFLAGS=#{ENV['LDFLAGS']}\"\n\n system \"make\"\n system \"make\", \"install\", \"all\"\n\n if build.with?(\"moh\")\n # Should be equivalent to: system \"make\", \"cd-moh-install\"\n mkdir_p share/\"freeswitch/sounds/music\"\n [8, 16, 32, 48].each do |n|\n resource(\"sounds-music-#{n}000\").stage do\n cp_r \".\", share/\"freeswitch/sounds/music\"\n end\n end\n end\n\n if build.with?(\"sounds-en\")\n # Should be equivalent to: system \"make\", \"cd-sounds-install\"\n mkdir_p share/\"freeswitch/sounds/en\"\n [8, 16, 32, 48].each do |n|\n resource(\"sounds-en-us-callie-#{n}000\").stage do\n cp_r \".\", share/\"freeswitch/sounds/en\"\n end\n end\n end\n\n if build.with?(\"sounds-fr\")\n # Should be equivalent to: system \"make\", \"cd-sounds-fr-install\"\n mkdir_p share/\"freeswitch/sounds/fr\"\n [8, 16, 32, 48].each do |n|\n resource(\"sounds-fr-ca-june-#{n}000\").stage do\n cp_r \".\", share/\"freeswitch/sounds/fr\"\n end\n end\n end\n\n if build.with?(\"sounds-ru\")\n # Should be equivalent to: system \"make\", \"cd-sounds-ru-install\"\n mkdir_p share/\"freeswitch/sounds/ru\"\n [8, 16, 32, 48].each do |n|\n resource(\"sounds-ru-RU-elena-#{n}000\").stage do\n cp_r \".\", share/\"freeswitch/sounds/ru\"\n end\n end\n end\n end", "def copy_libs\n `mkdir -p #{ @path }/assets/wwww`\n `cp framework/phonegap.jar #{ @path }/libs`\n `cp framework/res/values/strings.xml #{ @path }/res/values/strings.xml`\n `cp framework/res/layout/main.xml #{ @path }/res/layout/main.xml`\n `cp framework/res/layout/preview.xml #{ @path }/res/layout/preview.xml`\n %w(drawable-hdpi drawable-ldpi drawable-mdpi).each do |e|\n `cp framework/res/drawable/icon.png #{ @path }/res/#{ e }/icon.png`\n end \n `cp -R example #{ @path }/assets`\n `mv #{ @path }/assets/example #{ @path }/assets/www`\n end", "def library(lib)\n Dissident::LIBRARIES[self] = lib\n end", "def load_stdapi()\n\t\toriginal = console.disable_output\n\n\t\tconsole.disable_output = true\n\t\tconsole.run_single('use stdapi')\n\t\tconsole.disable_output = original\n\tend", "def load_assets\n AssetManager.include_local_library [:application, :admin_layout_data_table]\n AssetManager.include_css [:application, :admin_layout, :colorbox]\n AssetManager.include_contrib_library [:colorbox]\n end", "def open(name, constraint=nil) #:yield:\n library = library(name, constraint)\n unless library\n raise LoadError, \"no library -- #{name}\"\n end\n yield(library) if block_given?\n library\n end", "def load_console(app = T.unsafe(nil)); end", "def load_console(app = T.unsafe(nil)); end", "def make_lib\n FileUtils.mkdir_p 'build'\n\n lib_dir = \"#{@gem_dir}/lib/ruby2d/\"\n\n lib = \"\"\n @lib_files.each do |f|\n lib << File.read(\"#{lib_dir + f}.rb\") + \"\\n\\n\"\n end\n\n lib << \"\ninclude Ruby2D\nextend Ruby2D::DSL\\n\"\n\n File.write('build/lib.rb', lib)\nend", "def load_library\n raise NotImplementedError, \"loading extension libraries is not implemented\"\n end", "def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n puts \"[*] - esearchy requires #{name}.\"\n if RUBY_PLATFORM =~ /mingw|mswin/\n \tsystem \"gem install #{name}\"\n else\n \tsystem \"sudo gem install #{name}\"\n end\nend", "def use_tool\n @hammer.swing!\n end", "def conscientious_require\n require_theme_deps if site.theme\n require_plugin_files\n require_gems\n deprecation_checks\n end", "def require_lib_files(files)\n case files\n when String\n file_paths = expanded_file_path(files)\n file_paths = Dir.glob(file_paths) if files.include? '*'\n when Array\n file_paths = files.map { |f| expanded_file_path(f) }\n end\n\n Motion::Require.all(file_paths)\nend", "def pre_soft_load(mod); end", "def pod_libksygpulive\n dep_path = ENV['KSYLIVEDEP_DIR']\n demo_path = ENV['KSYLIVEDEMO_DIR']\n \n pod 'GPUImage'\n # pod 'libksygpulive/GPUImage', :path => dep_path\n pod 'libksygpulive/yuv', :path => dep_path\n pod 'libksygpulive/base', :path => dep_path\n pod 'libksygpulive/mediacore_enc_265', :path => dep_path\n \n # pod 'libksygpulive/KSYStreameriOSSDK', :path => demo_path\n pod 'KSYStreameriOSSDK', :path => (dep_path)+'../KSYStreameriOSSDK'\n \n # pod 'libksygpulive/networkAdaptor', :path => demo_path\n pod 'networkAdaptor', :path => (dep_path)+'../networkAdaptor'\n \n# pod 'ksylivekits/KSYStreamerEngine_iOS', :path => demo_path\n pod 'KSYStreamerEngine', :path => (dep_path)+'../KSYStreamerEngine_iOS'\n\n pod 'KSYCommon', :path => (dep_path)+'../KSYCommon'\n pod 'KSYGPUFilter', :path => (dep_path)+'../KSYGPUFilter_iOS'\n pod 'ksylivekits/player', :path => demo_path\n pod 'ksylivekits/kits', :path => demo_path\nend", "def load_gem_plugins; end", "def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"activating #{name}\"\n\n Gem.activate(name, *version)\n require(lib_name)\n\n rescue LoadError\n\n install_gem(name, options)\n Gem.activate(name, *version)\n require(lib_name)\n end", "def load_dependencies\n require 'f5-icontrol'\n end", "def install\n bin.install \"game-of-life\"\n end", "def render_app_dependencies\n use_droplet = app_options[:droplet]\n use_netsim = @level.game == Game.netsim\n use_applab = @level.game == Game.applab\n use_gamelab = @level.game == Game.gamelab\n use_weblab = @level.game == Game.weblab\n use_phaser = @level.game == Game.craft\n use_blockly = !use_droplet && !use_netsim && !use_weblab\n hide_source = app_options[:hideSource]\n render partial: 'levels/apps_dependencies',\n locals: {\n app: app_options[:app],\n use_droplet: use_droplet,\n use_netsim: use_netsim,\n use_blockly: use_blockly,\n use_applab: use_applab,\n use_gamelab: use_gamelab,\n use_weblab: use_weblab,\n use_phaser: use_phaser,\n hide_source: hide_source,\n static_asset_base_path: app_options[:baseUrl]\n }\n end", "def wrap_adept_library(name)\n \n #Store the prefix for the library name, which\n #\n @prefix = name.capitalize\n #Make the adept_library function local, so it can only be used in class defintions.\n #private :wrap_adept_library\n\n #And attach the relevant dynamic library (DLL / SO).\n ffi_lib \"lib#{name}\"\n\n #Attach the function which queries the device runtime's version.\n attach_adept_function :GetVersion, [:pointer]\n\n end", "def framework_import_pods\n \n pod 'MBProgressHUD'\n pod 'Firebase/Analytics'\n pod 'Firebase/Crashlytics'\n pod 'Firebase/Core'\n pod 'Firebase/Auth'\n pod 'Firebase/Analytics'\n pod 'Firebase/Database'\n pod 'Firebase/Storage'\n pod 'Firebase/Firestore'\n pod 'IQKeyboardManagerSwift'\n pod 'DrawerView'\n pod 'SwiftyDraw'\n pod 'ChromaColorPicker'\n pod 'Kingfisher'\n pod 'Hashtags'\n pod 'ImageSlideshow', '~> 1.8.3'\n pod 'ImageSlideshow/Kingfisher'\n \nend", "def pre_hard_load(mod); end", "def install_tools\n # For eventmachine.\n package 'libssl-dev'\n\n # For rmagick (image processing).\n package 'libmagickwand-dev', /^libmagick\\d*-dev$/\n\n # For HTML/XML parsers (nokogiri, hpricot).\n package 'libxml2-dev'\n package 'libxslt1-dev'\n\n # For HTTP fetchers (curb).\n package 'libcurl-dev', 'libcurl-openssl-dev', /^libcurl\\d*-dev$/,\n /^libcurl\\d*-openssl-dev$/\n\n # needed for solr and other java-based services\n package /^openjdk-\\d+-jdk/\n\n # useful to be able to work with compressed data\n package 'zlib-dev', /^zlib[0-9a-z]*-dev$/\n package 'bzip2'\n package 'gzip'\n package 'tar'\n package 'zip'\n end", "def static_setup (solocs)\n srcloc= `pwd`.strip\n puts \"setup: #{srcloc}\"\n=begin \n cp_r \"fonts\", \"#{TGT_DIR}/fonts\"\n mkdir_p \"#{TGT_DIR}/lib/shoes\"\n Dir.chdir \"#{TGT_DIR}/lib/shoes\" do\n Dir[\"#{srcloc}/lib/shoes/*.rb\"].each do |f|\n #puts \"SymLinking #{f}\"\n ln_s f, \".\" unless File.symlink? File.basename(f)\n end\n end\n Dir.chdir \"#{TGT_DIR}/lib\" do\n ln_s \"#{srcloc}/lib/shoes.rb\" , \"shoes.rb\" unless File.symlink? \"shoes.rb\"\n # link to exerb\n ln_s \"#{srcloc}/lib/exerb\", \"exerb\" unless File.symlink? \"exerb\"\n end\n \n #cp_r \"samples\", \"#{TGT_DIR}/samples\"\n mkdir_p \"#{TGT_DIR}/samples\"\n ['simple', 'good', 'expert'].each do |d|\n mkdir_p \"#{TGT_DIR}/samples/#{d}\"\n Dir.chdir \"#{TGT_DIR}/samples/#{d}\" do\n Dir[\"../../../samples/#{d}/*\"].each do |f|\n ln_s f, '.' unless File.symlink? File.basename(f)\n end\n end\n end\n=end\n ln_s \"#{srcloc}/lib\", TGT_DIR\n ln_s \"#{srcloc}/samples\", TGT_DIR\n ln_s \"#{srcloc}/static\", TGT_DIR\n ln_s \"#{srcloc}/fonts\", TGT_DIR\n\n cp \"README.md\", TGT_DIR\n cp \"CHANGELOG\", TGT_DIR\n cp \"COPYING\", TGT_DIR\n end", "def lib(lib)\n send(lib)\n end", "def install\n # Delete config.toml to avoid targeting newer CPU. Remove in the next release.\n # Fixed upstream: https://github.com/ImageOptim/gifski/commit/7e31a4c45def29b9e9c082460ab02a28f0e8730e\n (buildpath/\".cargo/config.toml\").unlink\n\n system \"cargo\", \"install\", \"--features\", \"video\", *std_cargo_args\n end", "def load_backend(name)\n begin\n require \"shoes/#{name.to_s.downcase}\"\n Shoes.const_get(name.to_s.capitalize)\n rescue LoadError => e\n raise LoadError, \"Couldn't load backend Shoes::#{name.capitalize}'. Error: #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end", "def load framework\n framework = framework.downcase\n dir = File.join(@path, framework)\n if Dir.exists? dir\n Dir.glob(File.join(dir, '**/*.rb')).each do |mapping|\n require mapping.chomp! '.rb'\n end\n end\n end", "def test_library\n\tputs \"Library Loaded!\"\nend", "def loadStudioDLL()\n # System\n @@studioDLL.import(\"Studio_System_Create\", \"pl\")\n @@studioDLL.import(\"Studio_System_FlushCommands\", \"l\")\n @@studioDLL.import(\"Studio_System_FlushSampleLoading\", \"l\")\n @@studioDLL.import(\"Studio_System_GetAdvancedSettings\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetBank\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetBankByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetBankCount\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetBankList\", \"lplp\")\n @@studioDLL.import(\"Studio_System_GetBufferUsage\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetBus\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetBusByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetCPUUsage\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetEvent\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetEventByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetListenerAttributes\", \"llp\")\n @@studioDLL.import(\"Studio_System_GetListenerWeight\", \"llp\")\n @@studioDLL.import(\"Studio_System_GetLowLevelSystem\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetNumListeners\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetSoundInfo\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_System_GetVCA\", \"lpp\")\n @@studioDLL.import(\"Studio_System_GetVCAByID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_Initialize\", \"llllp\")\n @@studioDLL.import(\"Studio_System_LoadBankCustom\", \"lplp\")\n @@studioDLL.import(\"Studio_System_LoadBankFile\", \"lplp\")\n @@studioDLL.import(\"Studio_System_LoadBankMemory\", \"lplllp\")\n @@studioDLL.import(\"Studio_System_LoadCommandReplay\", \"lpl\")\n @@studioDLL.import(\"Studio_System_LookupID\", \"lpp\")\n @@studioDLL.import(\"Studio_System_LookupPath\", \"lpplp\")\n @@studioDLL.import(\"Studio_System_RegisterPlugin\", \"lp\")\n @@studioDLL.import(\"Studio_System_Release\", \"l\")\n @@studioDLL.import(\"Studio_System_ResetBufferUsage\", \"l\")\n @@studioDLL.import(\"Studio_System_SetAdvancedSettings\", \"lp\")\n @@studioDLL.import(\"Studio_System_SetCallback\", \"lll\")\n @@studioDLL.import(\"Studio_System_SetListenerAttributes\", \"llp\")\n @@studioDLL.import(\"Studio_System_SetListenerWeight\", \"llp\")\n @@studioDLL.import(\"Studio_System_SetNumListeners\", \"ll\")\n @@studioDLL.import(\"Studio_System_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_System_StartCommandCapture\", \"lpl\")\n @@studioDLL.import(\"Studio_System_StopCommandCapture\", \"l\")\n @@studioDLL.import(\"Studio_System_UnloadAll\", \"l\")\n @@studioDLL.import(\"Studio_System_UnregisterPlugin\", \"lp\")\n @@studioDLL.import(\"Studio_System_Update\", \"l\")\n \n # EventDescription\n @@studioDLL.import(\"Studio_EventDescription_CreateInstance\", \"pp\")\n @@studioDLL.import(\"Studio_EventDescription_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetInstanceCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetInstanceList\", \"lplp\")\n @@studioDLL.import(\"Studio_EventDescription_GetLength\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetMaximumDistance\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetMinimumDistance\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetParameter\", \"lpp\")\n @@studioDLL.import(\"Studio_EventDescription_GetParameterByIndex\", \"llp\")\n @@studioDLL.import(\"Studio_EventDescription_GetParameterCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_EventDescription_GetSampleLoadingState\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetSoundSize\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserProperty\", \"lpp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserPropertyByIndex\", \"llp\")\n @@studioDLL.import(\"Studio_EventDescription_GetUserPropertyCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_HasCue\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_Is3D\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_IsOneshot\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_IsSnapshot\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_IsStream\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_LoadSampleData\", \"l\")\n @@studioDLL.import(\"Studio_EventDescription_ReleaseAllInstances\", \"l\")\n @@studioDLL.import(\"Studio_EventDescription_SetCallback\", \"lll\")\n @@studioDLL.import(\"Studio_EventDescription_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventDescription_UnloadSampleData\", \"l\")\n \n # EventInstance\n @@studioDLL.import(\"Studio_EventInstance_Get3DAttributes\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetChannelGroup\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetDescription\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetListenerMask\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameter\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterByIndex\", \"llp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterCount\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterValue\", \"lppp\")\n @@studioDLL.import(\"Studio_EventInstance_GetParameterValueByIndex\", \"llpp\")\n @@studioDLL.import(\"Studio_EventInstance_GetPaused\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetPitch\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_GetPlaybackState\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetProperty\", \"llp\")\n @@studioDLL.import(\"Studio_EventInstance_GetReverbLevel\", \"llp\")\n @@studioDLL.import(\"Studio_EventInstance_GetTimelinePosition\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_GetVolume\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_IsVirtual\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_Release\", \"l\")\n @@studioDLL.import(\"Studio_EventInstance_Set3DAttributes\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_SetCallback\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetListenerMask\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetParameterValue\", \"lpp\")\n @@studioDLL.import(\"Studio_EventInstance_SetParameterValueByIndex\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetParameterValuesByIndices\",\"lppl\")\n @@studioDLL.import(\"Studio_EventInstance_SetPaused\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetPitch\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetProperty\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetReverbLevel\", \"lll\")\n @@studioDLL.import(\"Studio_EventInstance_SetTimelinePosition\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_EventInstance_SetVolume\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_Start\", \"l\")\n @@studioDLL.import(\"Studio_EventInstance_Stop\", \"ll\")\n @@studioDLL.import(\"Studio_EventInstance_TriggerCue\", \"l\")\n \n # ParameterInstance\n @@studioDLL.import(\"Studio_ParameterInstance_GetDescription\", \"lp\")\n @@studioDLL.import(\"Studio_ParameterInstance_GetValue\", \"lp\")\n @@studioDLL.import(\"Studio_ParameterInstance_SetValue\", \"ll\")\n \n # Bus\n @@studioDLL.import(\"Studio_Bus_GetChannelGroup\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetMute\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_Bus_GetPaused\", \"lp\")\n @@studioDLL.import(\"Studio_Bus_GetVolume\", \"lpp\")\n @@studioDLL.import(\"Studio_Bus_LockChannelGroup\", \"l\")\n @@studioDLL.import(\"Studio_Bus_SetMute\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_SetPaused\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_SetVolume\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_StopAllEvents\", \"ll\")\n @@studioDLL.import(\"Studio_Bus_UnlockChannelGroup\", \"l\")\n \n # VCA\n @@studioDLL.import(\"Studio_VCA_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_VCA_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_VCA_GetVolume\", \"lpp\")\n @@studioDLL.import(\"Studio_VCA_SetVolume\", \"ll\")\n \n # Bank\n @@studioDLL.import(\"Studio_Bank_GetBusCount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetBusList\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_GetEventCount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetEventList\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_GetID\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetLoadingState\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetPath\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_GetSampleLoadingState\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetStringCount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetStringInfo\", \"llpplp\")\n @@studioDLL.import(\"Studio_Bank_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetVCACount\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_GetVCAList\", \"lplp\")\n @@studioDLL.import(\"Studio_Bank_LoadSampleData\", \"l\")\n @@studioDLL.import(\"Studio_Bank_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_Bank_Unload\", \"l\")\n @@studioDLL.import(\"Studio_Bank_UnloadSampleData\", \"l\")\n \n # CommandReplay\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandAtTime\", \"llp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandCount\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandInfo\", \"llp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCommandString\", \"llpl\")\n @@studioDLL.import(\"Studio_CommandReplay_GetCurrentCommand\", \"lpp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetLength\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetPaused\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetPlaybackState\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetSystem\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_GetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_Release\", \"l\")\n @@studioDLL.import(\"Studio_CommandReplay_SeekToCommand\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SeekToTime\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetBankPath\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_SetCreateInstanceCallback\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetFrameCallback\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetLoadBankCallback\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetPaused\", \"ll\")\n @@studioDLL.import(\"Studio_CommandReplay_SetUserData\", \"lp\")\n @@studioDLL.import(\"Studio_CommandReplay_Start\", \"l\")\n @@studioDLL.import(\"Studio_CommandReplay_Stop\", \"l\")\n \n # Debugging Function?\n # @@studioDLL.import(\"Studio_ParseID\", \"\")\n end", "def run\n require_relative File.join(absolute_path, 'main')\n Gamefic::Tty::Engine.run\n end", "def loadScripts\n load \"su2dslib/preferences.rb\"\n load \"su2dslib/exportbase.rb\"\n load \"su2dslib/interface.rb\"\n load \"su2dslib/numeric.rb\"\n load \"su2dslib/material.rb\"\n load \"su2dslib/radiance_entities.rb\"\n load \"su2dslib/radiancescene.rb\"\n load \"su2dslib/location.rb\"\n load \"su2dslib/resultsgrid.rb\"\nend", "def load_sym(name, types)\n if @opengl_lib.nil? || @glGetProcAddress.nil?\n # Platform detection based on code by Thomas Enebo, written for this\n # Stack Overflow answer: http://stackoverflow.com/a/13586108/457812. As\n # such, this particular bit of code is also available under the same\n # terms as content on Stack Overflow unless there's some licensing issue\n # I'm unaware of, in which case I assume it'll eventually be brought to\n # my attention so I can fix things up.\n host = RbConfig::CONFIG['host_os']\n lib_path =\n case host\n when %r[ mac\\sos | darwin ]ix\n '/System/Library/Frameworks/OpenGL.framework/OpenGL'\n when %r[ mswin | msys | mingw | cygwin | bcwin | wince | emc ]ix\n 'opengl32.dll'\n when %r[ linux | solaris | bsd]ix\n 'libGL.so.1'\n else\n raise 'Unrecognized platform'\n end\n\n getProcAddressName =\n case host\n when %r[ mac\\sos | darwin ]ix\n :aglGetProcAddress\n when %r[ mswin | msys | mingw | cygwin | bcwin | wince | emc ]ix\n :wglGetProcAddress\n when %r[ linux | solaris | bsd]ix\n :glXGetProcAddress\n else\n raise 'Unrecognized platform'\n end\n\n @opengl_lib = Fiddle.dlopen(lib_path)\n getProcAddress = @opengl_lib[getProcAddressName.to_s]\n\n\n @glGetProcAddress = Fiddle::Function.new( \n getProcAddress, \n fiddle_typed(GL_COMMAND_TYPES[getProcAddressName][:parameter_types]),\n fiddle_typed(GL_COMMAND_TYPES[getProcAddressName][:return_type])\n )\n end\n\n begin\n sym = @opengl_lib[name.to_s]\n\n Fiddle::Function.new(\n sym,\n fiddle_typed(types[:parameter_types]),\n fiddle_typed(types[:return_type])\n )\n rescue Fiddle::DLError\n nil\n end if @opengl_lib\n end", "def add_gem_paths; end", "def require_engine\n return if defined? ::Erubius\n require_library('erubis')\n end", "def headless?\n # The GRASS GUI is based on WxPython.\n build.without? \"gui\"\n end", "def lookup_library(args)\n library = args[:library]\n paths = args.key?(:paths) ? sanitize_paths(args[:paths]) : []\n matches = packages_providing_library(library, *paths).join(\"\\n\")\n puts \"packages which provide library:\\n#{matches}\".bold.blue\nend", "def lybunt_setup\n end", "def install!\n include_recipe 'apt'\n enable_i386_arch!\n add_repository!\n package('skype') { action :install }\n end", "def initiate_library\n # do nothing if the library is already initiated\n return false if FONTS_LIBRARY.key? :Helvetica\n # font metrics objects to be used\n times_metrics = { \"\\u0000\" => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [130, -9, 238, 676] }, '\"' => { wx: 408, boundingbox: [77, 431, 331, 676] }, '#' => { wx: 500, boundingbox: [5, 0, 496, 662] }, '$' => { wx: 500, boundingbox: [44, -87, 457, 727] }, '%' => { wx: 833, boundingbox: [61, -13, 772, 676] }, '&' => { wx: 778, boundingbox: [42, -13, 750, 676] }, \"'\" => { wx: 333, boundingbox: [79, 433, 218, 676] }, '(' => { wx: 333, boundingbox: [48, -177, 304, 676] }, ')' => { wx: 333, boundingbox: [29, -177, 285, 676] }, '*' => { wx: 500, boundingbox: [69, 265, 432, 676] }, '+' => { wx: 564, boundingbox: [30, 0, 534, 506] }, ',' => { wx: 250, boundingbox: [56, -141, 195, 102] }, '-' => { wx: 333, boundingbox: [39, 194, 285, 257] }, '.' => { wx: 250, boundingbox: [70, -11, 181, 100] }, '/' => { wx: 278, boundingbox: [-9, -14, 287, 676] }, '0' => { wx: 500, boundingbox: [24, -14, 476, 676] }, '1' => { wx: 500, boundingbox: [111, 0, 394, 676] }, '2' => { wx: 500, boundingbox: [30, 0, 475, 676] }, '3' => { wx: 500, boundingbox: [43, -14, 431, 676] }, '4' => { wx: 500, boundingbox: [12, 0, 472, 676] }, '5' => { wx: 500, boundingbox: [32, -14, 438, 688] }, '6' => { wx: 500, boundingbox: [34, -14, 468, 684] }, '7' => { wx: 500, boundingbox: [20, -8, 449, 662] }, '8' => { wx: 500, boundingbox: [56, -14, 445, 676] }, '9' => { wx: 500, boundingbox: [30, -22, 459, 676] }, ':' => { wx: 278, boundingbox: [81, -11, 192, 459] }, ';' => { wx: 278, boundingbox: [80, -141, 219, 459] }, '<' => { wx: 564, boundingbox: [28, -8, 536, 514] }, '=' => { wx: 564, boundingbox: [30, 120, 534, 386] }, '>' => { wx: 564, boundingbox: [28, -8, 536, 514] }, '?' => { wx: 444, boundingbox: [68, -8, 414, 676] }, '@' => { wx: 921, boundingbox: [116, -14, 809, 676] }, 'A' => { wx: 722, boundingbox: [15, 0, 706, 674] }, 'B' => { wx: 667, boundingbox: [17, 0, 593, 662] }, 'C' => { wx: 667, boundingbox: [28, -14, 633, 676] }, 'D' => { wx: 722, boundingbox: [16, 0, 685, 662] }, 'E' => { wx: 611, boundingbox: [12, 0, 597, 662] }, 'F' => { wx: 556, boundingbox: [12, 0, 546, 662] }, 'G' => { wx: 722, boundingbox: [32, -14, 709, 676] }, 'H' => { wx: 722, boundingbox: [19, 0, 702, 662] }, 'I' => { wx: 333, boundingbox: [18, 0, 315, 662] }, 'J' => { wx: 389, boundingbox: [10, -14, 370, 662] }, 'K' => { wx: 722, boundingbox: [34, 0, 723, 662] }, 'L' => { wx: 611, boundingbox: [12, 0, 598, 662] }, 'M' => { wx: 889, boundingbox: [12, 0, 863, 662] }, 'N' => { wx: 722, boundingbox: [12, -11, 707, 662] }, 'O' => { wx: 722, boundingbox: [34, -14, 688, 676] }, 'P' => { wx: 556, boundingbox: [16, 0, 542, 662] }, 'Q' => { wx: 722, boundingbox: [34, -178, 701, 676] }, 'R' => { wx: 667, boundingbox: [17, 0, 659, 662] }, 'S' => { wx: 556, boundingbox: [42, -14, 491, 676] }, 'T' => { wx: 611, boundingbox: [17, 0, 593, 662] }, 'U' => { wx: 722, boundingbox: [14, -14, 705, 662] }, 'V' => { wx: 722, boundingbox: [16, -11, 697, 662] }, 'W' => { wx: 944, boundingbox: [5, -11, 932, 662] }, 'X' => { wx: 722, boundingbox: [10, 0, 704, 662] }, 'Y' => { wx: 722, boundingbox: [22, 0, 703, 662] }, 'Z' => { wx: 611, boundingbox: [9, 0, 597, 662] }, '[' => { wx: 333, boundingbox: [88, -156, 299, 662] }, '\\\\' => { wx: 278, boundingbox: [-9, -14, 287, 676] }, ']' => { wx: 333, boundingbox: [34, -156, 245, 662] }, '^' => { wx: 469, boundingbox: [24, 297, 446, 662] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [115, 433, 254, 676] }, 'a' => { wx: 444, boundingbox: [37, -10, 442, 460] }, 'b' => { wx: 500, boundingbox: [3, -10, 468, 683] }, 'c' => { wx: 444, boundingbox: [25, -10, 412, 460] }, 'd' => { wx: 500, boundingbox: [27, -10, 491, 683] }, 'e' => { wx: 444, boundingbox: [25, -10, 424, 460] }, 'f' => { wx: 333, boundingbox: [20, 0, 383, 683] }, 'g' => { wx: 500, boundingbox: [28, -218, 470, 460] }, 'h' => { wx: 500, boundingbox: [9, 0, 487, 683] }, 'i' => { wx: 278, boundingbox: [16, 0, 253, 683] }, 'j' => { wx: 278, boundingbox: [-70, -218, 194, 683] }, 'k' => { wx: 500, boundingbox: [7, 0, 505, 683] }, 'l' => { wx: 278, boundingbox: [19, 0, 257, 683] }, 'm' => { wx: 778, boundingbox: [16, 0, 775, 460] }, 'n' => { wx: 500, boundingbox: [16, 0, 485, 460] }, 'o' => { wx: 500, boundingbox: [29, -10, 470, 460] }, 'p' => { wx: 500, boundingbox: [5, -217, 470, 460] }, 'q' => { wx: 500, boundingbox: [24, -217, 488, 460] }, 'r' => { wx: 333, boundingbox: [5, 0, 335, 460] }, 's' => { wx: 389, boundingbox: [51, -10, 348, 460] }, 't' => { wx: 278, boundingbox: [13, -10, 279, 579] }, 'u' => { wx: 500, boundingbox: [9, -10, 479, 450] }, 'v' => { wx: 500, boundingbox: [19, -14, 477, 450] }, 'w' => { wx: 722, boundingbox: [21, -14, 694, 450] }, 'x' => { wx: 500, boundingbox: [17, 0, 479, 450] }, 'y' => { wx: 500, boundingbox: [14, -218, 475, 450] }, 'z' => { wx: 444, boundingbox: [27, 0, 418, 450] }, '{' => { wx: 480, boundingbox: [100, -181, 350, 680] }, '|' => { wx: 200, boundingbox: [67, -218, 133, 782] }, '}' => { wx: 480, boundingbox: [130, -181, 380, 680] }, '~' => { wx: 541, boundingbox: [40, 183, 502, 323] }, \"\\u00A1\" => { wx: 333, boundingbox: [97, -218, 205, 467] }, \"\\u00A2\" => { wx: 500, boundingbox: [53, -138, 448, 579] }, \"\\u00A3\" => { wx: 500, boundingbox: [12, -8, 490, 676] }, \"\\u00A4\" => { wx: 167, boundingbox: [-168, -14, 331, 676] }, \"\\u00A5\" => { wx: 500, boundingbox: [-53, 0, 512, 662] }, \"\\u00A6\" => { wx: 500, boundingbox: [7, -189, 490, 676] }, \"\\u00A7\" => { wx: 500, boundingbox: [70, -148, 426, 676] }, \"\\u00A8\" => { wx: 500, boundingbox: [-22, 58, 522, 602] }, \"\\u00A9\" => { wx: 180, boundingbox: [48, 431, 133, 676] }, \"\\u00AA\" => { wx: 444, boundingbox: [43, 433, 414, 676] }, \"\\u00AB\" => { wx: 500, boundingbox: [42, 33, 456, 416] }, \"\\u00AC\" => { wx: 333, boundingbox: [63, 33, 285, 416] }, \"\\u00AD\" => { wx: 333, boundingbox: [48, 33, 270, 416] }, \"\\u00AE\" => { wx: 556, boundingbox: [31, 0, 521, 683] }, \"\\u00AF\" => { wx: 556, boundingbox: [32, 0, 521, 683] }, \"\\u00B1\" => { wx: 500, boundingbox: [0, 201, 500, 250] }, \"\\u00B2\" => { wx: 500, boundingbox: [59, -149, 442, 676] }, \"\\u00B3\" => { wx: 500, boundingbox: [58, -153, 442, 676] }, \"\\u00B4\" => { wx: 250, boundingbox: [70, 199, 181, 310] }, \"\\u00B6\" => { wx: 453, boundingbox: [-22, -154, 450, 662] }, \"\\u00B7\" => { wx: 350, boundingbox: [40, 196, 310, 466] }, \"\\u00B8\" => { wx: 333, boundingbox: [79, -141, 218, 102] }, \"\\u00B9\" => { wx: 444, boundingbox: [45, -141, 416, 102] }, \"\\u00BA\" => { wx: 444, boundingbox: [30, 433, 401, 676] }, \"\\u00BB\" => { wx: 500, boundingbox: [44, 33, 458, 416] }, \"\\u00BC\" => { wx: 1000, boundingbox: [111, -11, 888, 100] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -19, 994, 706] }, \"\\u00BF\" => { wx: 444, boundingbox: [30, -218, 376, 466] }, \"\\u00C1\" => { wx: 333, boundingbox: [19, 507, 242, 678] }, \"\\u00C2\" => { wx: 333, boundingbox: [93, 507, 317, 678] }, \"\\u00C3\" => { wx: 333, boundingbox: [11, 507, 322, 674] }, \"\\u00C4\" => { wx: 333, boundingbox: [1, 532, 331, 638] }, \"\\u00C5\" => { wx: 333, boundingbox: [11, 547, 322, 601] }, \"\\u00C6\" => { wx: 333, boundingbox: [26, 507, 307, 664] }, \"\\u00C7\" => { wx: 333, boundingbox: [118, 581, 216, 681] }, \"\\u00C8\" => { wx: 333, boundingbox: [18, 581, 315, 681] }, \"\\u00CA\" => { wx: 333, boundingbox: [67, 512, 266, 711] }, \"\\u00CB\" => { wx: 333, boundingbox: [52, -215, 261, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [-3, 507, 377, 678] }, \"\\u00CE\" => { wx: 333, boundingbox: [62, -165, 243, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [11, 507, 322, 674] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 201, 1000, 250] }, \"\\u00E1\" => { wx: 889, boundingbox: [0, 0, 863, 662] }, \"\\u00E3\" => { wx: 276, boundingbox: [4, 394, 270, 676] }, \"\\u00E8\" => { wx: 611, boundingbox: [12, 0, 598, 662] }, \"\\u00E9\" => { wx: 722, boundingbox: [34, -80, 688, 734] }, \"\\u00EA\" => { wx: 889, boundingbox: [30, -6, 885, 668] }, \"\\u00EB\" => { wx: 310, boundingbox: [6, 394, 304, 676] }, \"\\u00F1\" => { wx: 667, boundingbox: [38, -10, 632, 460] }, \"\\u00F5\" => { wx: 278, boundingbox: [16, 0, 253, 460] }, \"\\u00F8\" => { wx: 278, boundingbox: [19, 0, 259, 683] }, \"\\u00F9\" => { wx: 500, boundingbox: [29, -112, 470, 551] }, \"\\u00FA\" => { wx: 722, boundingbox: [30, -10, 690, 460] }, \"\\u00FB\" => { wx: 500, boundingbox: [12, -9, 468, 683] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_bold_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [81, -13, 251, 691] }, '\"' => { wx: 555, boundingbox: [83, 404, 472, 691] }, '#' => { wx: 500, boundingbox: [4, 0, 496, 700] }, '$' => { wx: 500, boundingbox: [29, -99, 472, 750] }, '%' => { wx: 1000, boundingbox: [124, -14, 877, 692] }, '&' => { wx: 833, boundingbox: [62, -16, 787, 691] }, \"'\" => { wx: 333, boundingbox: [79, 356, 263, 691] }, '(' => { wx: 333, boundingbox: [46, -168, 306, 694] }, ')' => { wx: 333, boundingbox: [27, -168, 287, 694] }, '*' => { wx: 500, boundingbox: [56, 255, 447, 691] }, '+' => { wx: 570, boundingbox: [33, 0, 537, 506] }, ',' => { wx: 250, boundingbox: [39, -180, 223, 155] }, '-' => { wx: 333, boundingbox: [44, 171, 287, 287] }, '.' => { wx: 250, boundingbox: [41, -13, 210, 156] }, '/' => { wx: 278, boundingbox: [-24, -19, 302, 691] }, '0' => { wx: 500, boundingbox: [24, -13, 476, 688] }, '1' => { wx: 500, boundingbox: [65, 0, 442, 688] }, '2' => { wx: 500, boundingbox: [17, 0, 478, 688] }, '3' => { wx: 500, boundingbox: [16, -14, 468, 688] }, '4' => { wx: 500, boundingbox: [19, 0, 475, 688] }, '5' => { wx: 500, boundingbox: [22, -8, 470, 676] }, '6' => { wx: 500, boundingbox: [28, -13, 475, 688] }, '7' => { wx: 500, boundingbox: [17, 0, 477, 676] }, '8' => { wx: 500, boundingbox: [28, -13, 472, 688] }, '9' => { wx: 500, boundingbox: [26, -13, 473, 688] }, ':' => { wx: 333, boundingbox: [82, -13, 251, 472] }, ';' => { wx: 333, boundingbox: [82, -180, 266, 472] }, '<' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '=' => { wx: 570, boundingbox: [33, 107, 537, 399] }, '>' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '?' => { wx: 500, boundingbox: [57, -13, 445, 689] }, '@' => { wx: 930, boundingbox: [108, -19, 822, 691] }, 'A' => { wx: 722, boundingbox: [9, 0, 689, 690] }, 'B' => { wx: 667, boundingbox: [16, 0, 619, 676] }, 'C' => { wx: 722, boundingbox: [49, -19, 687, 691] }, 'D' => { wx: 722, boundingbox: [14, 0, 690, 676] }, 'E' => { wx: 667, boundingbox: [16, 0, 641, 676] }, 'F' => { wx: 611, boundingbox: [16, 0, 583, 676] }, 'G' => { wx: 778, boundingbox: [37, -19, 755, 691] }, 'H' => { wx: 778, boundingbox: [21, 0, 759, 676] }, 'I' => { wx: 389, boundingbox: [20, 0, 370, 676] }, 'J' => { wx: 500, boundingbox: [3, -96, 479, 676] }, 'K' => { wx: 778, boundingbox: [30, 0, 769, 676] }, 'L' => { wx: 667, boundingbox: [19, 0, 638, 676] }, 'M' => { wx: 944, boundingbox: [14, 0, 921, 676] }, 'N' => { wx: 722, boundingbox: [16, -18, 701, 676] }, 'O' => { wx: 778, boundingbox: [35, -19, 743, 691] }, 'P' => { wx: 611, boundingbox: [16, 0, 600, 676] }, 'Q' => { wx: 778, boundingbox: [35, -176, 743, 691] }, 'R' => { wx: 722, boundingbox: [26, 0, 715, 676] }, 'S' => { wx: 556, boundingbox: [35, -19, 513, 692] }, 'T' => { wx: 667, boundingbox: [31, 0, 636, 676] }, 'U' => { wx: 722, boundingbox: [16, -19, 701, 676] }, 'V' => { wx: 722, boundingbox: [16, -18, 701, 676] }, 'W' => { wx: 1000, boundingbox: [19, -15, 981, 676] }, 'X' => { wx: 722, boundingbox: [16, 0, 699, 676] }, 'Y' => { wx: 722, boundingbox: [15, 0, 699, 676] }, 'Z' => { wx: 667, boundingbox: [28, 0, 634, 676] }, '[' => { wx: 333, boundingbox: [67, -149, 301, 678] }, '\\\\' => { wx: 278, boundingbox: [-25, -19, 303, 691] }, ']' => { wx: 333, boundingbox: [32, -149, 266, 678] }, '^' => { wx: 581, boundingbox: [73, 311, 509, 676] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [70, 356, 254, 691] }, 'a' => { wx: 500, boundingbox: [25, -14, 488, 473] }, 'b' => { wx: 556, boundingbox: [17, -14, 521, 676] }, 'c' => { wx: 444, boundingbox: [25, -14, 430, 473] }, 'd' => { wx: 556, boundingbox: [25, -14, 534, 676] }, 'e' => { wx: 444, boundingbox: [25, -14, 426, 473] }, 'f' => { wx: 333, boundingbox: [14, 0, 389, 691] }, 'g' => { wx: 500, boundingbox: [28, -206, 483, 473] }, 'h' => { wx: 556, boundingbox: [16, 0, 534, 676] }, 'i' => { wx: 278, boundingbox: [16, 0, 255, 691] }, 'j' => { wx: 333, boundingbox: [-57, -203, 263, 691] }, 'k' => { wx: 556, boundingbox: [22, 0, 543, 676] }, 'l' => { wx: 278, boundingbox: [16, 0, 255, 676] }, 'm' => { wx: 833, boundingbox: [16, 0, 814, 473] }, 'n' => { wx: 556, boundingbox: [21, 0, 539, 473] }, 'o' => { wx: 500, boundingbox: [25, -14, 476, 473] }, 'p' => { wx: 556, boundingbox: [19, -205, 524, 473] }, 'q' => { wx: 556, boundingbox: [34, -205, 536, 473] }, 'r' => { wx: 444, boundingbox: [29, 0, 434, 473] }, 's' => { wx: 389, boundingbox: [25, -14, 361, 473] }, 't' => { wx: 333, boundingbox: [20, -12, 332, 630] }, 'u' => { wx: 556, boundingbox: [16, -14, 537, 461] }, 'v' => { wx: 500, boundingbox: [21, -14, 485, 461] }, 'w' => { wx: 722, boundingbox: [23, -14, 707, 461] }, 'x' => { wx: 500, boundingbox: [12, 0, 484, 461] }, 'y' => { wx: 500, boundingbox: [16, -205, 480, 461] }, 'z' => { wx: 444, boundingbox: [21, 0, 420, 461] }, '{' => { wx: 394, boundingbox: [22, -175, 340, 698] }, '|' => { wx: 220, boundingbox: [66, -218, 154, 782] }, '}' => { wx: 394, boundingbox: [54, -175, 372, 698] }, '~' => { wx: 520, boundingbox: [29, 173, 491, 333] }, \"\\u00A1\" => { wx: 333, boundingbox: [82, -203, 252, 501] }, \"\\u00A2\" => { wx: 500, boundingbox: [53, -140, 458, 588] }, \"\\u00A3\" => { wx: 500, boundingbox: [21, -14, 477, 684] }, \"\\u00A4\" => { wx: 167, boundingbox: [-168, -12, 329, 688] }, \"\\u00A5\" => { wx: 500, boundingbox: [-64, 0, 547, 676] }, \"\\u00A6\" => { wx: 500, boundingbox: [0, -155, 498, 706] }, \"\\u00A7\" => { wx: 500, boundingbox: [57, -132, 443, 691] }, \"\\u00A8\" => { wx: 500, boundingbox: [-26, 61, 526, 613] }, \"\\u00A9\" => { wx: 278, boundingbox: [75, 404, 204, 691] }, \"\\u00AA\" => { wx: 500, boundingbox: [32, 356, 486, 691] }, \"\\u00AB\" => { wx: 500, boundingbox: [23, 36, 473, 415] }, \"\\u00AC\" => { wx: 333, boundingbox: [51, 36, 305, 415] }, \"\\u00AD\" => { wx: 333, boundingbox: [28, 36, 282, 415] }, \"\\u00AE\" => { wx: 556, boundingbox: [14, 0, 536, 691] }, \"\\u00AF\" => { wx: 556, boundingbox: [14, 0, 536, 691] }, \"\\u00B1\" => { wx: 500, boundingbox: [0, 181, 500, 271] }, \"\\u00B2\" => { wx: 500, boundingbox: [47, -134, 453, 691] }, \"\\u00B3\" => { wx: 500, boundingbox: [45, -132, 456, 691] }, \"\\u00B4\" => { wx: 250, boundingbox: [41, 248, 210, 417] }, \"\\u00B6\" => { wx: 540, boundingbox: [0, -186, 519, 676] }, \"\\u00B7\" => { wx: 350, boundingbox: [35, 198, 315, 478] }, \"\\u00B8\" => { wx: 333, boundingbox: [79, -180, 263, 155] }, \"\\u00B9\" => { wx: 500, boundingbox: [14, -180, 468, 155] }, \"\\u00BA\" => { wx: 500, boundingbox: [14, 356, 468, 691] }, \"\\u00BB\" => { wx: 500, boundingbox: [27, 36, 477, 415] }, \"\\u00BC\" => { wx: 1000, boundingbox: [82, -13, 917, 156] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -29, 995, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [55, -201, 443, 501] }, \"\\u00C1\" => { wx: 333, boundingbox: [8, 528, 246, 713] }, \"\\u00C2\" => { wx: 333, boundingbox: [86, 528, 324, 713] }, \"\\u00C3\" => { wx: 333, boundingbox: [-2, 528, 335, 704] }, \"\\u00C4\" => { wx: 333, boundingbox: [-16, 547, 349, 674] }, \"\\u00C5\" => { wx: 333, boundingbox: [1, 565, 331, 637] }, \"\\u00C6\" => { wx: 333, boundingbox: [15, 528, 318, 691] }, \"\\u00C7\" => { wx: 333, boundingbox: [103, 536, 258, 691] }, \"\\u00C8\" => { wx: 333, boundingbox: [-2, 537, 335, 667] }, \"\\u00CA\" => { wx: 333, boundingbox: [60, 527, 273, 740] }, \"\\u00CB\" => { wx: 333, boundingbox: [68, -218, 294, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [-13, 528, 425, 713] }, \"\\u00CE\" => { wx: 333, boundingbox: [90, -193, 319, 24] }, \"\\u00CF\" => { wx: 333, boundingbox: [-2, 528, 335, 704] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 181, 1000, 271] }, \"\\u00E1\" => { wx: 1000, boundingbox: [4, 0, 951, 676] }, \"\\u00E3\" => { wx: 300, boundingbox: [-1, 397, 301, 688] }, \"\\u00E8\" => { wx: 667, boundingbox: [19, 0, 638, 676] }, \"\\u00E9\" => { wx: 778, boundingbox: [35, -74, 743, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [22, -5, 981, 684] }, \"\\u00EB\" => { wx: 330, boundingbox: [18, 397, 312, 688] }, \"\\u00F1\" => { wx: 722, boundingbox: [33, -14, 693, 473] }, \"\\u00F5\" => { wx: 278, boundingbox: [16, 0, 255, 461] }, \"\\u00F8\" => { wx: 278, boundingbox: [-22, 0, 303, 676] }, \"\\u00F9\" => { wx: 500, boundingbox: [25, -92, 476, 549] }, \"\\u00FA\" => { wx: 722, boundingbox: [22, -14, 696, 473] }, \"\\u00FB\" => { wx: 556, boundingbox: [19, -12, 517, 691] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_italic_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [39, -11, 302, 667] }, '\"' => { wx: 420, boundingbox: [144, 421, 432, 666] }, '#' => { wx: 500, boundingbox: [2, 0, 540, 676] }, '$' => { wx: 500, boundingbox: [31, -89, 497, 731] }, '%' => { wx: 833, boundingbox: [79, -13, 790, 676] }, '&' => { wx: 778, boundingbox: [76, -18, 723, 666] }, \"'\" => { wx: 333, boundingbox: [151, 436, 290, 666] }, '(' => { wx: 333, boundingbox: [42, -181, 315, 669] }, ')' => { wx: 333, boundingbox: [16, -180, 289, 669] }, '*' => { wx: 500, boundingbox: [128, 255, 492, 666] }, '+' => { wx: 675, boundingbox: [86, 0, 590, 506] }, ',' => { wx: 250, boundingbox: [-4, -129, 135, 101] }, '-' => { wx: 333, boundingbox: [49, 192, 282, 255] }, '.' => { wx: 250, boundingbox: [27, -11, 138, 100] }, '/' => { wx: 278, boundingbox: [-65, -18, 386, 666] }, '0' => { wx: 500, boundingbox: [32, -7, 497, 676] }, '1' => { wx: 500, boundingbox: [49, 0, 409, 676] }, '2' => { wx: 500, boundingbox: [12, 0, 452, 676] }, '3' => { wx: 500, boundingbox: [15, -7, 465, 676] }, '4' => { wx: 500, boundingbox: [1, 0, 479, 676] }, '5' => { wx: 500, boundingbox: [15, -7, 491, 666] }, '6' => { wx: 500, boundingbox: [30, -7, 521, 686] }, '7' => { wx: 500, boundingbox: [75, -8, 537, 666] }, '8' => { wx: 500, boundingbox: [30, -7, 493, 676] }, '9' => { wx: 500, boundingbox: [23, -17, 492, 676] }, ':' => { wx: 333, boundingbox: [50, -11, 261, 441] }, ';' => { wx: 333, boundingbox: [27, -129, 261, 441] }, '<' => { wx: 675, boundingbox: [84, -8, 592, 514] }, '=' => { wx: 675, boundingbox: [86, 120, 590, 386] }, '>' => { wx: 675, boundingbox: [84, -8, 592, 514] }, '?' => { wx: 500, boundingbox: [132, -12, 472, 664] }, '@' => { wx: 920, boundingbox: [118, -18, 806, 666] }, 'A' => { wx: 611, boundingbox: [-51, 0, 564, 668] }, 'B' => { wx: 611, boundingbox: [-8, 0, 588, 653] }, 'C' => { wx: 667, boundingbox: [66, -18, 689, 666] }, 'D' => { wx: 722, boundingbox: [-8, 0, 700, 653] }, 'E' => { wx: 611, boundingbox: [-1, 0, 634, 653] }, 'F' => { wx: 611, boundingbox: [8, 0, 645, 653] }, 'G' => { wx: 722, boundingbox: [52, -18, 722, 666] }, 'H' => { wx: 722, boundingbox: [-8, 0, 767, 653] }, 'I' => { wx: 333, boundingbox: [-8, 0, 384, 653] }, 'J' => { wx: 444, boundingbox: [-6, -18, 491, 653] }, 'K' => { wx: 667, boundingbox: [7, 0, 722, 653] }, 'L' => { wx: 556, boundingbox: [-8, 0, 559, 653] }, 'M' => { wx: 833, boundingbox: [-18, 0, 873, 653] }, 'N' => { wx: 667, boundingbox: [-20, -15, 727, 653] }, 'O' => { wx: 722, boundingbox: [60, -18, 699, 666] }, 'P' => { wx: 611, boundingbox: [0, 0, 605, 653] }, 'Q' => { wx: 722, boundingbox: [59, -182, 699, 666] }, 'R' => { wx: 611, boundingbox: [-13, 0, 588, 653] }, 'S' => { wx: 500, boundingbox: [17, -18, 508, 667] }, 'T' => { wx: 556, boundingbox: [59, 0, 633, 653] }, 'U' => { wx: 722, boundingbox: [102, -18, 765, 653] }, 'V' => { wx: 611, boundingbox: [76, -18, 688, 653] }, 'W' => { wx: 833, boundingbox: [71, -18, 906, 653] }, 'X' => { wx: 611, boundingbox: [-29, 0, 655, 653] }, 'Y' => { wx: 556, boundingbox: [78, 0, 633, 653] }, 'Z' => { wx: 556, boundingbox: [-6, 0, 606, 653] }, '[' => { wx: 389, boundingbox: [21, -153, 391, 663] }, '\\\\' => { wx: 278, boundingbox: [-41, -18, 319, 666] }, ']' => { wx: 389, boundingbox: [12, -153, 382, 663] }, '^' => { wx: 422, boundingbox: [0, 301, 422, 666] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [171, 436, 310, 666] }, 'a' => { wx: 500, boundingbox: [17, -11, 476, 441] }, 'b' => { wx: 500, boundingbox: [23, -11, 473, 683] }, 'c' => { wx: 444, boundingbox: [30, -11, 425, 441] }, 'd' => { wx: 500, boundingbox: [15, -13, 527, 683] }, 'e' => { wx: 444, boundingbox: [31, -11, 412, 441] }, 'f' => { wx: 278, boundingbox: [-147, -207, 424, 678] }, 'g' => { wx: 500, boundingbox: [8, -206, 472, 441] }, 'h' => { wx: 500, boundingbox: [19, -9, 478, 683] }, 'i' => { wx: 278, boundingbox: [49, -11, 264, 654] }, 'j' => { wx: 278, boundingbox: [-124, -207, 276, 654] }, 'k' => { wx: 444, boundingbox: [14, -11, 461, 683] }, 'l' => { wx: 278, boundingbox: [41, -11, 279, 683] }, 'm' => { wx: 722, boundingbox: [12, -9, 704, 441] }, 'n' => { wx: 500, boundingbox: [14, -9, 474, 441] }, 'o' => { wx: 500, boundingbox: [27, -11, 468, 441] }, 'p' => { wx: 500, boundingbox: [-75, -205, 469, 441] }, 'q' => { wx: 500, boundingbox: [25, -209, 483, 441] }, 'r' => { wx: 389, boundingbox: [45, 0, 412, 441] }, 's' => { wx: 389, boundingbox: [16, -13, 366, 442] }, 't' => { wx: 278, boundingbox: [37, -11, 296, 546] }, 'u' => { wx: 500, boundingbox: [42, -11, 475, 441] }, 'v' => { wx: 444, boundingbox: [21, -18, 426, 441] }, 'w' => { wx: 667, boundingbox: [16, -18, 648, 441] }, 'x' => { wx: 444, boundingbox: [-27, -11, 447, 441] }, 'y' => { wx: 444, boundingbox: [-24, -206, 426, 441] }, 'z' => { wx: 389, boundingbox: [-2, -81, 380, 428] }, '{' => { wx: 400, boundingbox: [51, -177, 407, 687] }, '|' => { wx: 275, boundingbox: [105, -217, 171, 783] }, '}' => { wx: 400, boundingbox: [-7, -177, 349, 687] }, '~' => { wx: 541, boundingbox: [40, 183, 502, 323] }, \"\\u00A1\" => { wx: 389, boundingbox: [59, -205, 322, 473] }, \"\\u00A2\" => { wx: 500, boundingbox: [77, -143, 472, 560] }, \"\\u00A3\" => { wx: 500, boundingbox: [10, -6, 517, 670] }, \"\\u00A4\" => { wx: 167, boundingbox: [-169, -10, 337, 676] }, \"\\u00A5\" => { wx: 500, boundingbox: [27, 0, 603, 653] }, \"\\u00A6\" => { wx: 500, boundingbox: [25, -182, 507, 682] }, \"\\u00A7\" => { wx: 500, boundingbox: [53, -162, 461, 666] }, \"\\u00A8\" => { wx: 500, boundingbox: [-22, 53, 522, 597] }, \"\\u00A9\" => { wx: 214, boundingbox: [132, 421, 241, 666] }, \"\\u00AA\" => { wx: 556, boundingbox: [166, 436, 514, 666] }, \"\\u00AB\" => { wx: 500, boundingbox: [53, 37, 445, 403] }, \"\\u00AC\" => { wx: 333, boundingbox: [51, 37, 281, 403] }, \"\\u00AD\" => { wx: 333, boundingbox: [52, 37, 282, 403] }, \"\\u00AE\" => { wx: 500, boundingbox: [-141, -207, 481, 681] }, \"\\u00AF\" => { wx: 500, boundingbox: [-141, -204, 518, 682] }, \"\\u00B1\" => { wx: 500, boundingbox: [-6, 197, 505, 243] }, \"\\u00B2\" => { wx: 500, boundingbox: [101, -159, 488, 666] }, \"\\u00B3\" => { wx: 500, boundingbox: [22, -143, 491, 666] }, \"\\u00B4\" => { wx: 250, boundingbox: [70, 199, 181, 310] }, \"\\u00B6\" => { wx: 523, boundingbox: [55, -123, 616, 653] }, \"\\u00B7\" => { wx: 350, boundingbox: [40, 191, 310, 461] }, \"\\u00B8\" => { wx: 333, boundingbox: [44, -129, 183, 101] }, \"\\u00B9\" => { wx: 556, boundingbox: [57, -129, 405, 101] }, \"\\u00BA\" => { wx: 556, boundingbox: [151, 436, 499, 666] }, \"\\u00BB\" => { wx: 500, boundingbox: [55, 37, 447, 403] }, \"\\u00BC\" => { wx: 889, boundingbox: [57, -11, 762, 100] }, \"\\u00BD\" => { wx: 1000, boundingbox: [25, -19, 1010, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [28, -205, 368, 471] }, \"\\u00C1\" => { wx: 333, boundingbox: [121, 492, 311, 664] }, \"\\u00C2\" => { wx: 333, boundingbox: [180, 494, 403, 664] }, \"\\u00C3\" => { wx: 333, boundingbox: [91, 492, 385, 661] }, \"\\u00C4\" => { wx: 333, boundingbox: [100, 517, 427, 624] }, \"\\u00C5\" => { wx: 333, boundingbox: [99, 532, 411, 583] }, \"\\u00C6\" => { wx: 333, boundingbox: [117, 492, 418, 650] }, \"\\u00C7\" => { wx: 333, boundingbox: [207, 548, 305, 646] }, \"\\u00C8\" => { wx: 333, boundingbox: [107, 548, 405, 646] }, \"\\u00CA\" => { wx: 333, boundingbox: [155, 492, 355, 691] }, \"\\u00CB\" => { wx: 333, boundingbox: [-30, -217, 182, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [93, 494, 486, 664] }, \"\\u00CE\" => { wx: 333, boundingbox: [20, -169, 203, 40] }, \"\\u00CF\" => { wx: 333, boundingbox: [121, 492, 426, 661] }, \"\\u00D0\" => { wx: 889, boundingbox: [-6, 197, 894, 243] }, \"\\u00E1\" => { wx: 889, boundingbox: [-27, 0, 911, 653] }, \"\\u00E3\" => { wx: 276, boundingbox: [42, 406, 352, 676] }, \"\\u00E8\" => { wx: 556, boundingbox: [-8, 0, 559, 653] }, \"\\u00E9\" => { wx: 722, boundingbox: [60, -105, 699, 722] }, \"\\u00EA\" => { wx: 944, boundingbox: [49, -8, 964, 666] }, \"\\u00EB\" => { wx: 310, boundingbox: [67, 406, 362, 676] }, \"\\u00F1\" => { wx: 667, boundingbox: [23, -11, 640, 441] }, \"\\u00F5\" => { wx: 278, boundingbox: [49, -11, 235, 441] }, \"\\u00F8\" => { wx: 278, boundingbox: [41, -11, 312, 683] }, \"\\u00F9\" => { wx: 500, boundingbox: [28, -135, 469, 554] }, \"\\u00FA\" => { wx: 667, boundingbox: [20, -12, 646, 441] }, \"\\u00FB\" => { wx: 500, boundingbox: [-168, -207, 493, 679] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_bolditalic_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 389, boundingbox: [67, -13, 370, 684] }, '\"' => { wx: 555, boundingbox: [136, 398, 536, 685] }, '#' => { wx: 500, boundingbox: [-33, 0, 533, 700] }, '$' => { wx: 500, boundingbox: [-20, -100, 497, 733] }, '%' => { wx: 833, boundingbox: [39, -10, 793, 692] }, '&' => { wx: 778, boundingbox: [5, -19, 699, 682] }, \"'\" => { wx: 333, boundingbox: [98, 369, 302, 685] }, '(' => { wx: 333, boundingbox: [28, -179, 344, 685] }, ')' => { wx: 333, boundingbox: [-44, -179, 271, 685] }, '*' => { wx: 500, boundingbox: [65, 249, 456, 685] }, '+' => { wx: 570, boundingbox: [33, 0, 537, 506] }, ',' => { wx: 250, boundingbox: [-60, -182, 144, 134] }, '-' => { wx: 333, boundingbox: [2, 166, 271, 282] }, '.' => { wx: 250, boundingbox: [-9, -13, 139, 135] }, '/' => { wx: 278, boundingbox: [-64, -18, 342, 685] }, '0' => { wx: 500, boundingbox: [17, -14, 477, 683] }, '1' => { wx: 500, boundingbox: [5, 0, 419, 683] }, '2' => { wx: 500, boundingbox: [-27, 0, 446, 683] }, '3' => { wx: 500, boundingbox: [-15, -13, 450, 683] }, '4' => { wx: 500, boundingbox: [-15, 0, 503, 683] }, '5' => { wx: 500, boundingbox: [-11, -13, 487, 669] }, '6' => { wx: 500, boundingbox: [23, -15, 509, 679] }, '7' => { wx: 500, boundingbox: [52, 0, 525, 669] }, '8' => { wx: 500, boundingbox: [3, -13, 476, 683] }, '9' => { wx: 500, boundingbox: [-12, -10, 475, 683] }, ':' => { wx: 333, boundingbox: [23, -13, 264, 459] }, ';' => { wx: 333, boundingbox: [-25, -183, 264, 459] }, '<' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '=' => { wx: 570, boundingbox: [33, 107, 537, 399] }, '>' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '?' => { wx: 500, boundingbox: [79, -13, 470, 684] }, '@' => { wx: 832, boundingbox: [63, -18, 770, 685] }, 'A' => { wx: 667, boundingbox: [-67, 0, 593, 683] }, 'B' => { wx: 667, boundingbox: [-24, 0, 624, 669] }, 'C' => { wx: 667, boundingbox: [32, -18, 677, 685] }, 'D' => { wx: 722, boundingbox: [-46, 0, 685, 669] }, 'E' => { wx: 667, boundingbox: [-27, 0, 653, 669] }, 'F' => { wx: 667, boundingbox: [-13, 0, 660, 669] }, 'G' => { wx: 722, boundingbox: [21, -18, 706, 685] }, 'H' => { wx: 778, boundingbox: [-24, 0, 799, 669] }, 'I' => { wx: 389, boundingbox: [-32, 0, 406, 669] }, 'J' => { wx: 500, boundingbox: [-46, -99, 524, 669] }, 'K' => { wx: 667, boundingbox: [-21, 0, 702, 669] }, 'L' => { wx: 611, boundingbox: [-22, 0, 590, 669] }, 'M' => { wx: 889, boundingbox: [-29, -12, 917, 669] }, 'N' => { wx: 722, boundingbox: [-27, -15, 748, 669] }, 'O' => { wx: 722, boundingbox: [27, -18, 691, 685] }, 'P' => { wx: 611, boundingbox: [-27, 0, 613, 669] }, 'Q' => { wx: 722, boundingbox: [27, -208, 691, 685] }, 'R' => { wx: 667, boundingbox: [-29, 0, 623, 669] }, 'S' => { wx: 556, boundingbox: [2, -18, 526, 685] }, 'T' => { wx: 611, boundingbox: [50, 0, 650, 669] }, 'U' => { wx: 722, boundingbox: [67, -18, 744, 669] }, 'V' => { wx: 667, boundingbox: [65, -18, 715, 669] }, 'W' => { wx: 889, boundingbox: [65, -18, 940, 669] }, 'X' => { wx: 667, boundingbox: [-24, 0, 694, 669] }, 'Y' => { wx: 611, boundingbox: [73, 0, 659, 669] }, 'Z' => { wx: 611, boundingbox: [-11, 0, 590, 669] }, '[' => { wx: 333, boundingbox: [-37, -159, 362, 674] }, '\\\\' => { wx: 278, boundingbox: [-1, -18, 279, 685] }, ']' => { wx: 333, boundingbox: [-56, -157, 343, 674] }, '^' => { wx: 570, boundingbox: [67, 304, 503, 669] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [128, 369, 332, 685] }, 'a' => { wx: 500, boundingbox: [-21, -14, 455, 462] }, 'b' => { wx: 500, boundingbox: [-14, -13, 444, 699] }, 'c' => { wx: 444, boundingbox: [-5, -13, 392, 462] }, 'd' => { wx: 500, boundingbox: [-21, -13, 517, 699] }, 'e' => { wx: 444, boundingbox: [5, -13, 398, 462] }, 'f' => { wx: 333, boundingbox: [-169, -205, 446, 698] }, 'g' => { wx: 500, boundingbox: [-52, -203, 478, 462] }, 'h' => { wx: 556, boundingbox: [-13, -9, 498, 699] }, 'i' => { wx: 278, boundingbox: [2, -9, 263, 684] }, 'j' => { wx: 278, boundingbox: [-189, -207, 279, 684] }, 'k' => { wx: 500, boundingbox: [-23, -8, 483, 699] }, 'l' => { wx: 278, boundingbox: [2, -9, 290, 699] }, 'm' => { wx: 778, boundingbox: [-14, -9, 722, 462] }, 'n' => { wx: 556, boundingbox: [-6, -9, 493, 462] }, 'o' => { wx: 500, boundingbox: [-3, -13, 441, 462] }, 'p' => { wx: 500, boundingbox: [-120, -205, 446, 462] }, 'q' => { wx: 500, boundingbox: [1, -205, 471, 462] }, 'r' => { wx: 389, boundingbox: [-21, 0, 389, 462] }, 's' => { wx: 389, boundingbox: [-19, -13, 333, 462] }, 't' => { wx: 278, boundingbox: [-11, -9, 281, 594] }, 'u' => { wx: 556, boundingbox: [15, -9, 492, 462] }, 'v' => { wx: 444, boundingbox: [16, -13, 401, 462] }, 'w' => { wx: 667, boundingbox: [16, -13, 614, 462] }, 'x' => { wx: 500, boundingbox: [-46, -13, 469, 462] }, 'y' => { wx: 444, boundingbox: [-94, -205, 392, 462] }, 'z' => { wx: 389, boundingbox: [-43, -78, 368, 449] }, '{' => { wx: 348, boundingbox: [5, -187, 436, 686] }, '|' => { wx: 220, boundingbox: [66, -218, 154, 782] }, '}' => { wx: 348, boundingbox: [-129, -187, 302, 686] }, '~' => { wx: 570, boundingbox: [54, 173, 516, 333] }, \"\\u00A1\" => { wx: 389, boundingbox: [19, -205, 322, 492] }, \"\\u00A2\" => { wx: 500, boundingbox: [42, -143, 439, 576] }, \"\\u00A3\" => { wx: 500, boundingbox: [-32, -12, 510, 683] }, \"\\u00A4\" => { wx: 167, boundingbox: [-169, -14, 324, 683] }, \"\\u00A5\" => { wx: 500, boundingbox: [33, 0, 628, 669] }, \"\\u00A6\" => { wx: 500, boundingbox: [-87, -156, 537, 707] }, \"\\u00A7\" => { wx: 500, boundingbox: [36, -143, 459, 685] }, \"\\u00A8\" => { wx: 500, boundingbox: [-26, 34, 526, 586] }, \"\\u00A9\" => { wx: 278, boundingbox: [128, 398, 268, 685] }, \"\\u00AA\" => { wx: 500, boundingbox: [53, 369, 513, 685] }, \"\\u00AB\" => { wx: 500, boundingbox: [12, 32, 468, 415] }, \"\\u00AC\" => { wx: 333, boundingbox: [32, 32, 303, 415] }, \"\\u00AD\" => { wx: 333, boundingbox: [10, 32, 281, 415] }, \"\\u00AE\" => { wx: 556, boundingbox: [-188, -205, 514, 703] }, \"\\u00AF\" => { wx: 556, boundingbox: [-186, -205, 553, 704] }, \"\\u00B1\" => { wx: 500, boundingbox: [-40, 178, 477, 269] }, \"\\u00B2\" => { wx: 500, boundingbox: [91, -145, 494, 685] }, \"\\u00B3\" => { wx: 500, boundingbox: [10, -139, 493, 685] }, \"\\u00B4\" => { wx: 250, boundingbox: [51, 257, 199, 405] }, \"\\u00B6\" => { wx: 500, boundingbox: [-57, -193, 562, 669] }, \"\\u00B7\" => { wx: 350, boundingbox: [0, 175, 350, 525] }, \"\\u00B8\" => { wx: 333, boundingbox: [-5, -182, 199, 134] }, \"\\u00B9\" => { wx: 500, boundingbox: [-57, -182, 403, 134] }, \"\\u00BA\" => { wx: 500, boundingbox: [53, 369, 513, 685] }, \"\\u00BB\" => { wx: 500, boundingbox: [12, 32, 468, 415] }, \"\\u00BC\" => { wx: 1000, boundingbox: [40, -13, 852, 135] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -29, 996, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [30, -205, 421, 492] }, \"\\u00C1\" => { wx: 333, boundingbox: [85, 516, 297, 697] }, \"\\u00C2\" => { wx: 333, boundingbox: [139, 516, 379, 697] }, \"\\u00C3\" => { wx: 333, boundingbox: [40, 516, 367, 690] }, \"\\u00C4\" => { wx: 333, boundingbox: [48, 536, 407, 655] }, \"\\u00C5\" => { wx: 333, boundingbox: [51, 553, 393, 623] }, \"\\u00C6\" => { wx: 333, boundingbox: [71, 516, 387, 678] }, \"\\u00C7\" => { wx: 333, boundingbox: [163, 550, 298, 684] }, \"\\u00C8\" => { wx: 333, boundingbox: [55, 550, 402, 684] }, \"\\u00CA\" => { wx: 333, boundingbox: [127, 516, 340, 729] }, \"\\u00CB\" => { wx: 333, boundingbox: [-80, -218, 156, 5] }, \"\\u00CD\" => { wx: 333, boundingbox: [69, 516, 498, 697] }, \"\\u00CE\" => { wx: 333, boundingbox: [15, -183, 244, 34] }, \"\\u00CF\" => { wx: 333, boundingbox: [79, 516, 411, 690] }, \"\\u00D0\" => { wx: 1000, boundingbox: [-40, 178, 977, 269] }, \"\\u00E1\" => { wx: 944, boundingbox: [-64, 0, 918, 669] }, \"\\u00E3\" => { wx: 266, boundingbox: [16, 399, 330, 685] }, \"\\u00E8\" => { wx: 611, boundingbox: [-22, 0, 590, 669] }, \"\\u00E9\" => { wx: 722, boundingbox: [27, -125, 691, 764] }, \"\\u00EA\" => { wx: 944, boundingbox: [23, -8, 946, 677] }, \"\\u00EB\" => { wx: 300, boundingbox: [56, 400, 347, 685] }, \"\\u00F1\" => { wx: 722, boundingbox: [-5, -13, 673, 462] }, \"\\u00F5\" => { wx: 278, boundingbox: [2, -9, 238, 462] }, \"\\u00F8\" => { wx: 278, boundingbox: [-7, -9, 307, 699] }, \"\\u00F9\" => { wx: 500, boundingbox: [-3, -119, 441, 560] }, \"\\u00FA\" => { wx: 722, boundingbox: [6, -13, 674, 462] }, \"\\u00FB\" => { wx: 500, boundingbox: [-200, -200, 473, 705] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n helvetica_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 187, 718] }, '\"' => { wx: 355, boundingbox: [70, 463, 285, 718] }, '#' => { wx: 556, boundingbox: [28, 0, 529, 688] }, '$' => { wx: 556, boundingbox: [32, -115, 520, 775] }, '%' => { wx: 889, boundingbox: [39, -19, 850, 703] }, '&' => { wx: 667, boundingbox: [44, -15, 645, 718] }, \"'\" => { wx: 222, boundingbox: [53, 463, 157, 718] }, '(' => { wx: 333, boundingbox: [68, -207, 299, 733] }, ')' => { wx: 333, boundingbox: [34, -207, 265, 733] }, '*' => { wx: 389, boundingbox: [39, 431, 349, 718] }, '+' => { wx: 584, boundingbox: [39, 0, 545, 505] }, ',' => { wx: 278, boundingbox: [87, -147, 191, 106] }, '-' => { wx: 333, boundingbox: [44, 232, 289, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 191, 106] }, '/' => { wx: 278, boundingbox: [-17, -19, 295, 737] }, '0' => { wx: 556, boundingbox: [37, -19, 519, 703] }, '1' => { wx: 556, boundingbox: [101, 0, 359, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 507, 703] }, '3' => { wx: 556, boundingbox: [34, -19, 522, 703] }, '4' => { wx: 556, boundingbox: [25, 0, 523, 703] }, '5' => { wx: 556, boundingbox: [32, -19, 514, 688] }, '6' => { wx: 556, boundingbox: [38, -19, 518, 703] }, '7' => { wx: 556, boundingbox: [37, 0, 523, 688] }, '8' => { wx: 556, boundingbox: [38, -19, 517, 703] }, '9' => { wx: 556, boundingbox: [42, -19, 514, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 191, 516] }, ';' => { wx: 278, boundingbox: [87, -147, 191, 516] }, '<' => { wx: 584, boundingbox: [48, 11, 536, 495] }, '=' => { wx: 584, boundingbox: [39, 115, 545, 390] }, '>' => { wx: 584, boundingbox: [48, 11, 536, 495] }, '?' => { wx: 556, boundingbox: [56, 0, 492, 727] }, '@' => { wx: 1015, boundingbox: [147, -19, 868, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 627, 718] }, 'C' => { wx: 722, boundingbox: [44, -19, 681, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 674, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 616, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 583, 718] }, 'G' => { wx: 778, boundingbox: [48, -19, 704, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 646, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 188, 718] }, 'J' => { wx: 500, boundingbox: [17, -19, 428, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 663, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 537, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 761, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 646, 718] }, 'O' => { wx: 778, boundingbox: [39, -19, 739, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 622, 718] }, 'Q' => { wx: 778, boundingbox: [39, -56, 739, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 684, 718] }, 'S' => { wx: 667, boundingbox: [49, -19, 620, 737] }, 'T' => { wx: 611, boundingbox: [14, 0, 597, 718] }, 'U' => { wx: 722, boundingbox: [79, -19, 644, 718] }, 'V' => { wx: 667, boundingbox: [20, 0, 647, 718] }, 'W' => { wx: 944, boundingbox: [16, 0, 928, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 648, 718] }, 'Y' => { wx: 667, boundingbox: [14, 0, 653, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 588, 718] }, '[' => { wx: 278, boundingbox: [63, -196, 250, 722] }, '\\\\' => { wx: 278, boundingbox: [-17, -19, 295, 737] }, ']' => { wx: 278, boundingbox: [28, -196, 215, 722] }, '^' => { wx: 469, boundingbox: [-14, 264, 483, 688] }, '_' => { wx: 556, boundingbox: [0, -125, 556, -75] }, '`' => { wx: 222, boundingbox: [65, 470, 169, 725] }, 'a' => { wx: 556, boundingbox: [36, -15, 530, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 517, 718] }, 'c' => { wx: 500, boundingbox: [30, -15, 477, 538] }, 'd' => { wx: 556, boundingbox: [35, -15, 499, 718] }, 'e' => { wx: 556, boundingbox: [40, -15, 516, 538] }, 'f' => { wx: 278, boundingbox: [14, 0, 262, 728] }, 'g' => { wx: 556, boundingbox: [40, -220, 499, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 491, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 155, 718] }, 'j' => { wx: 222, boundingbox: [-16, -210, 155, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 501, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 155, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 769, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 491, 538] }, 'o' => { wx: 556, boundingbox: [35, -14, 521, 538] }, 'p' => { wx: 556, boundingbox: [58, -207, 517, 538] }, 'q' => { wx: 556, boundingbox: [35, -207, 494, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 332, 538] }, 's' => { wx: 500, boundingbox: [32, -15, 464, 538] }, 't' => { wx: 278, boundingbox: [14, -7, 257, 669] }, 'u' => { wx: 556, boundingbox: [68, -15, 489, 523] }, 'v' => { wx: 500, boundingbox: [8, 0, 492, 523] }, 'w' => { wx: 722, boundingbox: [14, 0, 709, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 490, 523] }, 'y' => { wx: 500, boundingbox: [11, -214, 489, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 469, 523] }, '{' => { wx: 334, boundingbox: [42, -196, 292, 722] }, '|' => { wx: 260, boundingbox: [94, -225, 167, 775] }, '}' => { wx: 334, boundingbox: [42, -196, 292, 722] }, '~' => { wx: 584, boundingbox: [61, 180, 523, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [118, -195, 215, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [51, -115, 513, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [33, -16, 539, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-166, -19, 333, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [3, 0, 553, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-11, -207, 501, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [43, -191, 512, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [28, 99, 528, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [59, 463, 132, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [38, 470, 307, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [97, 108, 459, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [88, 108, 245, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [88, 108, 245, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [14, 0, 434, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [14, 0, 432, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [0, 240, 556, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [43, -159, 514, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [43, -159, 514, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [77, 190, 202, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [18, -173, 497, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [18, 202, 333, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [53, -149, 157, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [26, -149, 295, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [26, 463, 295, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [97, 108, 459, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 885, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -19, 994, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [91, -201, 527, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [14, 593, 211, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [122, 593, 319, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [21, 593, 312, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [-4, 606, 337, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [10, 627, 323, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [13, 595, 321, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [121, 604, 212, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [40, 604, 293, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [75, 572, 259, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [45, -225, 259, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [31, 593, 409, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [73, -225, 287, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [21, 593, 312, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 240, 1000, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 951, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [24, 405, 346, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [-20, 0, 537, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [39, -19, 740, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [36, -19, 965, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [25, 405, 341, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [36, -15, 847, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 183, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [-20, 0, 242, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [28, -22, 537, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [35, -15, 902, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 571, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_bold_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [90, 0, 244, 718] }, '\"' => { wx: 474, boundingbox: [98, 447, 376, 718] }, '#' => { wx: 556, boundingbox: [18, 0, 538, 698] }, '$' => { wx: 556, boundingbox: [30, -115, 523, 775] }, '%' => { wx: 889, boundingbox: [28, -19, 861, 710] }, '&' => { wx: 722, boundingbox: [54, -19, 701, 718] }, \"'\" => { wx: 278, boundingbox: [69, 445, 209, 718] }, '(' => { wx: 333, boundingbox: [35, -208, 314, 734] }, ')' => { wx: 333, boundingbox: [19, -208, 298, 734] }, '*' => { wx: 389, boundingbox: [27, 387, 362, 718] }, '+' => { wx: 584, boundingbox: [40, 0, 544, 506] }, ',' => { wx: 278, boundingbox: [64, -168, 214, 146] }, '-' => { wx: 333, boundingbox: [27, 215, 306, 345] }, '.' => { wx: 278, boundingbox: [64, 0, 214, 146] }, '/' => { wx: 278, boundingbox: [-33, -19, 311, 737] }, '0' => { wx: 556, boundingbox: [32, -19, 524, 710] }, '1' => { wx: 556, boundingbox: [69, 0, 378, 710] }, '2' => { wx: 556, boundingbox: [26, 0, 511, 710] }, '3' => { wx: 556, boundingbox: [27, -19, 516, 710] }, '4' => { wx: 556, boundingbox: [27, 0, 526, 710] }, '5' => { wx: 556, boundingbox: [27, -19, 516, 698] }, '6' => { wx: 556, boundingbox: [31, -19, 520, 710] }, '7' => { wx: 556, boundingbox: [25, 0, 528, 698] }, '8' => { wx: 556, boundingbox: [32, -19, 524, 710] }, '9' => { wx: 556, boundingbox: [30, -19, 522, 710] }, ':' => { wx: 333, boundingbox: [92, 0, 242, 512] }, ';' => { wx: 333, boundingbox: [92, -168, 242, 512] }, '<' => { wx: 584, boundingbox: [38, -8, 546, 514] }, '=' => { wx: 584, boundingbox: [40, 87, 544, 419] }, '>' => { wx: 584, boundingbox: [38, -8, 546, 514] }, '?' => { wx: 611, boundingbox: [60, 0, 556, 727] }, '@' => { wx: 975, boundingbox: [118, -19, 856, 737] }, 'A' => { wx: 722, boundingbox: [20, 0, 702, 718] }, 'B' => { wx: 722, boundingbox: [76, 0, 669, 718] }, 'C' => { wx: 722, boundingbox: [44, -19, 684, 737] }, 'D' => { wx: 722, boundingbox: [76, 0, 685, 718] }, 'E' => { wx: 667, boundingbox: [76, 0, 621, 718] }, 'F' => { wx: 611, boundingbox: [76, 0, 587, 718] }, 'G' => { wx: 778, boundingbox: [44, -19, 713, 737] }, 'H' => { wx: 722, boundingbox: [71, 0, 651, 718] }, 'I' => { wx: 278, boundingbox: [64, 0, 214, 718] }, 'J' => { wx: 556, boundingbox: [22, -18, 484, 718] }, 'K' => { wx: 722, boundingbox: [87, 0, 722, 718] }, 'L' => { wx: 611, boundingbox: [76, 0, 583, 718] }, 'M' => { wx: 833, boundingbox: [69, 0, 765, 718] }, 'N' => { wx: 722, boundingbox: [69, 0, 654, 718] }, 'O' => { wx: 778, boundingbox: [44, -19, 734, 737] }, 'P' => { wx: 667, boundingbox: [76, 0, 627, 718] }, 'Q' => { wx: 778, boundingbox: [44, -52, 737, 737] }, 'R' => { wx: 722, boundingbox: [76, 0, 677, 718] }, 'S' => { wx: 667, boundingbox: [39, -19, 629, 737] }, 'T' => { wx: 611, boundingbox: [14, 0, 598, 718] }, 'U' => { wx: 722, boundingbox: [72, -19, 651, 718] }, 'V' => { wx: 667, boundingbox: [19, 0, 648, 718] }, 'W' => { wx: 944, boundingbox: [16, 0, 929, 718] }, 'X' => { wx: 667, boundingbox: [14, 0, 653, 718] }, 'Y' => { wx: 667, boundingbox: [15, 0, 653, 718] }, 'Z' => { wx: 611, boundingbox: [25, 0, 586, 718] }, '[' => { wx: 333, boundingbox: [63, -196, 309, 722] }, '\\\\' => { wx: 278, boundingbox: [-33, -19, 311, 737] }, ']' => { wx: 333, boundingbox: [24, -196, 270, 722] }, '^' => { wx: 584, boundingbox: [62, 323, 522, 698] }, '_' => { wx: 556, boundingbox: [0, -125, 556, -75] }, '`' => { wx: 278, boundingbox: [69, 454, 209, 727] }, 'a' => { wx: 556, boundingbox: [29, -14, 527, 546] }, 'b' => { wx: 611, boundingbox: [61, -14, 578, 718] }, 'c' => { wx: 556, boundingbox: [34, -14, 524, 546] }, 'd' => { wx: 611, boundingbox: [34, -14, 551, 718] }, 'e' => { wx: 556, boundingbox: [23, -14, 528, 546] }, 'f' => { wx: 333, boundingbox: [10, 0, 318, 727] }, 'g' => { wx: 611, boundingbox: [40, -217, 553, 546] }, 'h' => { wx: 611, boundingbox: [65, 0, 546, 718] }, 'i' => { wx: 278, boundingbox: [69, 0, 209, 725] }, 'j' => { wx: 278, boundingbox: [3, -214, 209, 725] }, 'k' => { wx: 556, boundingbox: [69, 0, 562, 718] }, 'l' => { wx: 278, boundingbox: [69, 0, 209, 718] }, 'm' => { wx: 889, boundingbox: [64, 0, 826, 546] }, 'n' => { wx: 611, boundingbox: [65, 0, 546, 546] }, 'o' => { wx: 611, boundingbox: [34, -14, 578, 546] }, 'p' => { wx: 611, boundingbox: [62, -207, 578, 546] }, 'q' => { wx: 611, boundingbox: [34, -207, 552, 546] }, 'r' => { wx: 389, boundingbox: [64, 0, 373, 546] }, 's' => { wx: 556, boundingbox: [30, -14, 519, 546] }, 't' => { wx: 333, boundingbox: [10, -6, 309, 676] }, 'u' => { wx: 611, boundingbox: [66, -14, 545, 532] }, 'v' => { wx: 556, boundingbox: [13, 0, 543, 532] }, 'w' => { wx: 778, boundingbox: [10, 0, 769, 532] }, 'x' => { wx: 556, boundingbox: [15, 0, 541, 532] }, 'y' => { wx: 556, boundingbox: [10, -214, 539, 532] }, 'z' => { wx: 500, boundingbox: [20, 0, 480, 532] }, '{' => { wx: 389, boundingbox: [48, -196, 365, 722] }, '|' => { wx: 280, boundingbox: [84, -225, 196, 775] }, '}' => { wx: 389, boundingbox: [24, -196, 341, 722] }, '~' => { wx: 584, boundingbox: [61, 163, 523, 343] }, \"\\u00A1\" => { wx: 333, boundingbox: [90, -186, 244, 532] }, \"\\u00A2\" => { wx: 556, boundingbox: [34, -118, 524, 628] }, \"\\u00A3\" => { wx: 556, boundingbox: [28, -16, 541, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 336, 710] }, \"\\u00A5\" => { wx: 556, boundingbox: [-9, 0, 565, 698] }, \"\\u00A6\" => { wx: 556, boundingbox: [-10, -210, 516, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [34, -184, 522, 727] }, \"\\u00A8\" => { wx: 556, boundingbox: [-3, 76, 559, 636] }, \"\\u00A9\" => { wx: 238, boundingbox: [70, 447, 168, 718] }, \"\\u00AA\" => { wx: 500, boundingbox: [64, 454, 436, 727] }, \"\\u00AB\" => { wx: 556, boundingbox: [88, 76, 468, 484] }, \"\\u00AC\" => { wx: 333, boundingbox: [83, 76, 250, 484] }, \"\\u00AD\" => { wx: 333, boundingbox: [83, 76, 250, 484] }, \"\\u00AE\" => { wx: 611, boundingbox: [10, 0, 542, 727] }, \"\\u00AF\" => { wx: 611, boundingbox: [10, 0, 542, 727] }, \"\\u00B1\" => { wx: 556, boundingbox: [0, 227, 556, 333] }, \"\\u00B2\" => { wx: 556, boundingbox: [36, -171, 520, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [36, -171, 520, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [58, 172, 220, 334] }, \"\\u00B6\" => { wx: 556, boundingbox: [-8, -191, 539, 700] }, \"\\u00B7\" => { wx: 350, boundingbox: [10, 194, 340, 524] }, \"\\u00B8\" => { wx: 278, boundingbox: [69, -146, 209, 127] }, \"\\u00B9\" => { wx: 500, boundingbox: [64, -146, 436, 127] }, \"\\u00BA\" => { wx: 500, boundingbox: [64, 445, 436, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [88, 76, 468, 484] }, \"\\u00BC\" => { wx: 1000, boundingbox: [92, 0, 908, 146] }, \"\\u00BD\" => { wx: 1000, boundingbox: [-3, -19, 1003, 710] }, \"\\u00BF\" => { wx: 611, boundingbox: [55, -195, 551, 532] }, \"\\u00C1\" => { wx: 333, boundingbox: [-23, 604, 225, 750] }, \"\\u00C2\" => { wx: 333, boundingbox: [108, 604, 356, 750] }, \"\\u00C3\" => { wx: 333, boundingbox: [-10, 604, 343, 750] }, \"\\u00C4\" => { wx: 333, boundingbox: [-17, 610, 350, 737] }, \"\\u00C5\" => { wx: 333, boundingbox: [-6, 604, 339, 678] }, \"\\u00C6\" => { wx: 333, boundingbox: [-2, 604, 335, 750] }, \"\\u00C7\" => { wx: 333, boundingbox: [104, 614, 230, 729] }, \"\\u00C8\" => { wx: 333, boundingbox: [6, 614, 327, 729] }, \"\\u00CA\" => { wx: 333, boundingbox: [59, 568, 275, 776] }, \"\\u00CB\" => { wx: 333, boundingbox: [6, -228, 245, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [9, 604, 486, 750] }, \"\\u00CE\" => { wx: 333, boundingbox: [71, -228, 304, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [-10, 604, 343, 750] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 227, 1000, 333] }, \"\\u00E1\" => { wx: 1000, boundingbox: [5, 0, 954, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [22, 401, 347, 737] }, \"\\u00E8\" => { wx: 611, boundingbox: [-20, 0, 583, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [33, -27, 744, 745] }, \"\\u00EA\" => { wx: 1000, boundingbox: [37, -19, 961, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [6, 401, 360, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [29, -14, 858, 546] }, \"\\u00F5\" => { wx: 278, boundingbox: [69, 0, 209, 532] }, \"\\u00F8\" => { wx: 278, boundingbox: [-18, 0, 296, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [22, -29, 589, 560] }, \"\\u00FA\" => { wx: 944, boundingbox: [34, -14, 912, 546] }, \"\\u00FB\" => { wx: 611, boundingbox: [69, -14, 579, 731] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_oblique_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 340, 718] }, '\"' => { wx: 355, boundingbox: [168, 463, 438, 718] }, '#' => { wx: 556, boundingbox: [73, 0, 631, 688] }, '$' => { wx: 556, boundingbox: [69, -115, 617, 775] }, '%' => { wx: 889, boundingbox: [147, -19, 889, 703] }, '&' => { wx: 667, boundingbox: [77, -15, 647, 718] }, \"'\" => { wx: 222, boundingbox: [151, 463, 310, 718] }, '(' => { wx: 333, boundingbox: [108, -207, 454, 733] }, ')' => { wx: 333, boundingbox: [-9, -207, 337, 733] }, '*' => { wx: 389, boundingbox: [165, 431, 475, 718] }, '+' => { wx: 584, boundingbox: [85, 0, 606, 505] }, ',' => { wx: 278, boundingbox: [56, -147, 214, 106] }, '-' => { wx: 333, boundingbox: [93, 232, 357, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 214, 106] }, '/' => { wx: 278, boundingbox: [-21, -19, 452, 737] }, '0' => { wx: 556, boundingbox: [93, -19, 608, 703] }, '1' => { wx: 556, boundingbox: [207, 0, 508, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 617, 703] }, '3' => { wx: 556, boundingbox: [75, -19, 610, 703] }, '4' => { wx: 556, boundingbox: [61, 0, 576, 703] }, '5' => { wx: 556, boundingbox: [68, -19, 621, 688] }, '6' => { wx: 556, boundingbox: [91, -19, 615, 703] }, '7' => { wx: 556, boundingbox: [137, 0, 669, 688] }, '8' => { wx: 556, boundingbox: [74, -19, 607, 703] }, '9' => { wx: 556, boundingbox: [82, -19, 609, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 301, 516] }, ';' => { wx: 278, boundingbox: [56, -147, 301, 516] }, '<' => { wx: 584, boundingbox: [94, 11, 641, 495] }, '=' => { wx: 584, boundingbox: [63, 115, 628, 390] }, '>' => { wx: 584, boundingbox: [50, 11, 597, 495] }, '?' => { wx: 556, boundingbox: [161, 0, 610, 727] }, '@' => { wx: 1015, boundingbox: [215, -19, 965, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 712, 718] }, 'C' => { wx: 722, boundingbox: [108, -19, 782, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 764, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 762, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 736, 718] }, 'G' => { wx: 778, boundingbox: [111, -19, 799, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 799, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 341, 718] }, 'J' => { wx: 500, boundingbox: [47, -19, 581, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 808, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 555, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 914, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 799, 718] }, 'O' => { wx: 778, boundingbox: [105, -19, 826, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 737, 718] }, 'Q' => { wx: 778, boundingbox: [105, -56, 826, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 773, 718] }, 'S' => { wx: 667, boundingbox: [90, -19, 713, 737] }, 'T' => { wx: 611, boundingbox: [148, 0, 750, 718] }, 'U' => { wx: 722, boundingbox: [123, -19, 797, 718] }, 'V' => { wx: 667, boundingbox: [173, 0, 800, 718] }, 'W' => { wx: 944, boundingbox: [169, 0, 1081, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 790, 718] }, 'Y' => { wx: 667, boundingbox: [167, 0, 806, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 741, 718] }, '[' => { wx: 278, boundingbox: [21, -196, 403, 722] }, '\\\\' => { wx: 278, boundingbox: [140, -19, 291, 737] }, ']' => { wx: 278, boundingbox: [-14, -196, 368, 722] }, '^' => { wx: 469, boundingbox: [42, 264, 539, 688] }, '_' => { wx: 556, boundingbox: [-27, -125, 540, -75] }, '`' => { wx: 222, boundingbox: [165, 470, 323, 725] }, 'a' => { wx: 556, boundingbox: [61, -15, 559, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 584, 718] }, 'c' => { wx: 500, boundingbox: [74, -15, 553, 538] }, 'd' => { wx: 556, boundingbox: [84, -15, 652, 718] }, 'e' => { wx: 556, boundingbox: [84, -15, 578, 538] }, 'f' => { wx: 278, boundingbox: [86, 0, 416, 728] }, 'g' => { wx: 556, boundingbox: [42, -220, 610, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 573, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'j' => { wx: 222, boundingbox: [-60, -210, 308, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 600, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 852, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 573, 538] }, 'o' => { wx: 556, boundingbox: [83, -14, 585, 538] }, 'p' => { wx: 556, boundingbox: [14, -207, 584, 538] }, 'q' => { wx: 556, boundingbox: [84, -207, 605, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 446, 538] }, 's' => { wx: 500, boundingbox: [63, -15, 529, 538] }, 't' => { wx: 278, boundingbox: [102, -7, 368, 669] }, 'u' => { wx: 556, boundingbox: [94, -15, 600, 523] }, 'v' => { wx: 500, boundingbox: [119, 0, 603, 523] }, 'w' => { wx: 722, boundingbox: [125, 0, 820, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 594, 523] }, 'y' => { wx: 500, boundingbox: [15, -214, 600, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 571, 523] }, '{' => { wx: 334, boundingbox: [92, -196, 445, 722] }, '|' => { wx: 260, boundingbox: [46, -225, 332, 775] }, '}' => { wx: 334, boundingbox: [0, -196, 354, 722] }, '~' => { wx: 584, boundingbox: [111, 180, 580, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [77, -195, 326, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [95, -115, 584, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [49, -16, 634, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 482, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [81, 0, 699, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-52, -207, 654, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [76, -191, 584, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [60, 99, 646, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [157, 463, 285, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [138, 470, 461, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [146, 108, 554, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [137, 108, 340, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [111, 108, 314, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [86, 0, 587, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [86, 0, 585, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [51, 240, 623, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [135, -159, 622, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [52, -159, 623, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [129, 190, 257, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [126, -173, 650, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [91, 202, 413, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [21, -149, 180, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [-6, -149, 318, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [124, 463, 448, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [120, 108, 528, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 908, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [88, -19, 1029, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [85, -201, 534, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [170, 593, 337, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [248, 593, 475, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [147, 593, 438, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [125, 606, 490, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [143, 627, 468, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [167, 595, 476, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [249, 604, 362, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [168, 604, 443, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [214, 572, 402, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [2, -225, 232, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [157, 593, 565, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [43, -225, 249, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [177, 593, 468, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [51, 240, 1067, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 1097, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [127, 405, 449, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [41, 0, 555, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [43, -19, 890, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [98, -19, 1116, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [141, 405, 468, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [61, -15, 909, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 294, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [41, 0, 347, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [29, -22, 647, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [83, -15, 964, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 658, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_oblique_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 340, 718] }, '\"' => { wx: 355, boundingbox: [168, 463, 438, 718] }, '#' => { wx: 556, boundingbox: [73, 0, 631, 688] }, '$' => { wx: 556, boundingbox: [69, -115, 617, 775] }, '%' => { wx: 889, boundingbox: [147, -19, 889, 703] }, '&' => { wx: 667, boundingbox: [77, -15, 647, 718] }, \"'\" => { wx: 222, boundingbox: [151, 463, 310, 718] }, '(' => { wx: 333, boundingbox: [108, -207, 454, 733] }, ')' => { wx: 333, boundingbox: [-9, -207, 337, 733] }, '*' => { wx: 389, boundingbox: [165, 431, 475, 718] }, '+' => { wx: 584, boundingbox: [85, 0, 606, 505] }, ',' => { wx: 278, boundingbox: [56, -147, 214, 106] }, '-' => { wx: 333, boundingbox: [93, 232, 357, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 214, 106] }, '/' => { wx: 278, boundingbox: [-21, -19, 452, 737] }, '0' => { wx: 556, boundingbox: [93, -19, 608, 703] }, '1' => { wx: 556, boundingbox: [207, 0, 508, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 617, 703] }, '3' => { wx: 556, boundingbox: [75, -19, 610, 703] }, '4' => { wx: 556, boundingbox: [61, 0, 576, 703] }, '5' => { wx: 556, boundingbox: [68, -19, 621, 688] }, '6' => { wx: 556, boundingbox: [91, -19, 615, 703] }, '7' => { wx: 556, boundingbox: [137, 0, 669, 688] }, '8' => { wx: 556, boundingbox: [74, -19, 607, 703] }, '9' => { wx: 556, boundingbox: [82, -19, 609, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 301, 516] }, ';' => { wx: 278, boundingbox: [56, -147, 301, 516] }, '<' => { wx: 584, boundingbox: [94, 11, 641, 495] }, '=' => { wx: 584, boundingbox: [63, 115, 628, 390] }, '>' => { wx: 584, boundingbox: [50, 11, 597, 495] }, '?' => { wx: 556, boundingbox: [161, 0, 610, 727] }, '@' => { wx: 1015, boundingbox: [215, -19, 965, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 712, 718] }, 'C' => { wx: 722, boundingbox: [108, -19, 782, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 764, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 762, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 736, 718] }, 'G' => { wx: 778, boundingbox: [111, -19, 799, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 799, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 341, 718] }, 'J' => { wx: 500, boundingbox: [47, -19, 581, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 808, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 555, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 914, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 799, 718] }, 'O' => { wx: 778, boundingbox: [105, -19, 826, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 737, 718] }, 'Q' => { wx: 778, boundingbox: [105, -56, 826, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 773, 718] }, 'S' => { wx: 667, boundingbox: [90, -19, 713, 737] }, 'T' => { wx: 611, boundingbox: [148, 0, 750, 718] }, 'U' => { wx: 722, boundingbox: [123, -19, 797, 718] }, 'V' => { wx: 667, boundingbox: [173, 0, 800, 718] }, 'W' => { wx: 944, boundingbox: [169, 0, 1081, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 790, 718] }, 'Y' => { wx: 667, boundingbox: [167, 0, 806, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 741, 718] }, '[' => { wx: 278, boundingbox: [21, -196, 403, 722] }, '\\\\' => { wx: 278, boundingbox: [140, -19, 291, 737] }, ']' => { wx: 278, boundingbox: [-14, -196, 368, 722] }, '^' => { wx: 469, boundingbox: [42, 264, 539, 688] }, '_' => { wx: 556, boundingbox: [-27, -125, 540, -75] }, '`' => { wx: 222, boundingbox: [165, 470, 323, 725] }, 'a' => { wx: 556, boundingbox: [61, -15, 559, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 584, 718] }, 'c' => { wx: 500, boundingbox: [74, -15, 553, 538] }, 'd' => { wx: 556, boundingbox: [84, -15, 652, 718] }, 'e' => { wx: 556, boundingbox: [84, -15, 578, 538] }, 'f' => { wx: 278, boundingbox: [86, 0, 416, 728] }, 'g' => { wx: 556, boundingbox: [42, -220, 610, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 573, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'j' => { wx: 222, boundingbox: [-60, -210, 308, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 600, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 852, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 573, 538] }, 'o' => { wx: 556, boundingbox: [83, -14, 585, 538] }, 'p' => { wx: 556, boundingbox: [14, -207, 584, 538] }, 'q' => { wx: 556, boundingbox: [84, -207, 605, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 446, 538] }, 's' => { wx: 500, boundingbox: [63, -15, 529, 538] }, 't' => { wx: 278, boundingbox: [102, -7, 368, 669] }, 'u' => { wx: 556, boundingbox: [94, -15, 600, 523] }, 'v' => { wx: 500, boundingbox: [119, 0, 603, 523] }, 'w' => { wx: 722, boundingbox: [125, 0, 820, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 594, 523] }, 'y' => { wx: 500, boundingbox: [15, -214, 600, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 571, 523] }, '{' => { wx: 334, boundingbox: [92, -196, 445, 722] }, '|' => { wx: 260, boundingbox: [46, -225, 332, 775] }, '}' => { wx: 334, boundingbox: [0, -196, 354, 722] }, '~' => { wx: 584, boundingbox: [111, 180, 580, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [77, -195, 326, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [95, -115, 584, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [49, -16, 634, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 482, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [81, 0, 699, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-52, -207, 654, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [76, -191, 584, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [60, 99, 646, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [157, 463, 285, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [138, 470, 461, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [146, 108, 554, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [137, 108, 340, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [111, 108, 314, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [86, 0, 587, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [86, 0, 585, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [51, 240, 623, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [135, -159, 622, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [52, -159, 623, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [129, 190, 257, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [126, -173, 650, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [91, 202, 413, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [21, -149, 180, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [-6, -149, 318, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [124, 463, 448, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [120, 108, 528, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 908, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [88, -19, 1029, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [85, -201, 534, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [170, 593, 337, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [248, 593, 475, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [147, 593, 438, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [125, 606, 490, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [143, 627, 468, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [167, 595, 476, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [249, 604, 362, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [168, 604, 443, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [214, 572, 402, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [2, -225, 232, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [157, 593, 565, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [43, -225, 249, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [177, 593, 468, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [51, 240, 1067, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 1097, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [127, 405, 449, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [41, 0, 555, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [43, -19, 890, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [98, -19, 1116, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [141, 405, 468, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [61, -15, 909, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 294, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [41, 0, 347, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [29, -22, 647, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [83, -15, 964, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 658, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n courier_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [236, -15, 364, 572] }, '\"' => { wx: 600, boundingbox: [187, 328, 413, 562] }, '#' => { wx: 600, boundingbox: [93, -32, 507, 639] }, '$' => { wx: 600, boundingbox: [105, -126, 496, 662] }, '%' => { wx: 600, boundingbox: [81, -15, 518, 622] }, '&' => { wx: 600, boundingbox: [63, -15, 538, 543] }, \"'\" => { wx: 600, boundingbox: [213, 328, 376, 562] }, '(' => { wx: 600, boundingbox: [269, -108, 440, 622] }, ')' => { wx: 600, boundingbox: [160, -108, 331, 622] }, '*' => { wx: 600, boundingbox: [116, 257, 484, 607] }, '+' => { wx: 600, boundingbox: [80, 44, 520, 470] }, ',' => { wx: 600, boundingbox: [181, -112, 344, 122] }, '-' => { wx: 600, boundingbox: [103, 231, 497, 285] }, '.' => { wx: 600, boundingbox: [229, -15, 371, 109] }, '/' => { wx: 600, boundingbox: [125, -80, 475, 629] }, '0' => { wx: 600, boundingbox: [106, -15, 494, 622] }, '1' => { wx: 600, boundingbox: [96, 0, 505, 622] }, '2' => { wx: 600, boundingbox: [70, 0, 471, 622] }, '3' => { wx: 600, boundingbox: [75, -15, 466, 622] }, '4' => { wx: 600, boundingbox: [78, 0, 500, 622] }, '5' => { wx: 600, boundingbox: [92, -15, 497, 607] }, '6' => { wx: 600, boundingbox: [111, -15, 497, 622] }, '7' => { wx: 600, boundingbox: [82, 0, 483, 607] }, '8' => { wx: 600, boundingbox: [102, -15, 498, 622] }, '9' => { wx: 600, boundingbox: [96, -15, 489, 622] }, ':' => { wx: 600, boundingbox: [229, -15, 371, 385] }, ';' => { wx: 600, boundingbox: [181, -112, 371, 385] }, '<' => { wx: 600, boundingbox: [41, 42, 519, 472] }, '=' => { wx: 600, boundingbox: [80, 138, 520, 376] }, '>' => { wx: 600, boundingbox: [66, 42, 544, 472] }, '?' => { wx: 600, boundingbox: [129, -15, 492, 572] }, '@' => { wx: 600, boundingbox: [77, -15, 533, 622] }, 'A' => { wx: 600, boundingbox: [3, 0, 597, 562] }, 'B' => { wx: 600, boundingbox: [43, 0, 559, 562] }, 'C' => { wx: 600, boundingbox: [41, -18, 540, 580] }, 'D' => { wx: 600, boundingbox: [43, 0, 574, 562] }, 'E' => { wx: 600, boundingbox: [53, 0, 550, 562] }, 'F' => { wx: 600, boundingbox: [53, 0, 545, 562] }, 'G' => { wx: 600, boundingbox: [31, -18, 575, 580] }, 'H' => { wx: 600, boundingbox: [32, 0, 568, 562] }, 'I' => { wx: 600, boundingbox: [96, 0, 504, 562] }, 'J' => { wx: 600, boundingbox: [34, -18, 566, 562] }, 'K' => { wx: 600, boundingbox: [38, 0, 582, 562] }, 'L' => { wx: 600, boundingbox: [47, 0, 554, 562] }, 'M' => { wx: 600, boundingbox: [4, 0, 596, 562] }, 'N' => { wx: 600, boundingbox: [7, -13, 593, 562] }, 'O' => { wx: 600, boundingbox: [43, -18, 557, 580] }, 'P' => { wx: 600, boundingbox: [79, 0, 558, 562] }, 'Q' => { wx: 600, boundingbox: [43, -138, 557, 580] }, 'R' => { wx: 600, boundingbox: [38, 0, 588, 562] }, 'S' => { wx: 600, boundingbox: [72, -20, 529, 580] }, 'T' => { wx: 600, boundingbox: [38, 0, 563, 562] }, 'U' => { wx: 600, boundingbox: [17, -18, 583, 562] }, 'V' => { wx: 600, boundingbox: [-4, -13, 604, 562] }, 'W' => { wx: 600, boundingbox: [-3, -13, 603, 562] }, 'X' => { wx: 600, boundingbox: [23, 0, 577, 562] }, 'Y' => { wx: 600, boundingbox: [24, 0, 576, 562] }, 'Z' => { wx: 600, boundingbox: [86, 0, 514, 562] }, '[' => { wx: 600, boundingbox: [269, -108, 442, 622] }, '\\\\' => { wx: 600, boundingbox: [118, -80, 482, 629] }, ']' => { wx: 600, boundingbox: [158, -108, 331, 622] }, '^' => { wx: 600, boundingbox: [94, 354, 506, 622] }, '_' => { wx: 600, boundingbox: [0, -125, 600, -75] }, '`' => { wx: 600, boundingbox: [224, 328, 387, 562] }, 'a' => { wx: 600, boundingbox: [53, -15, 559, 441] }, 'b' => { wx: 600, boundingbox: [14, -15, 575, 629] }, 'c' => { wx: 600, boundingbox: [66, -15, 529, 441] }, 'd' => { wx: 600, boundingbox: [45, -15, 591, 629] }, 'e' => { wx: 600, boundingbox: [66, -15, 548, 441] }, 'f' => { wx: 600, boundingbox: [114, 0, 531, 629] }, 'g' => { wx: 600, boundingbox: [45, -157, 566, 441] }, 'h' => { wx: 600, boundingbox: [18, 0, 582, 629] }, 'i' => { wx: 600, boundingbox: [95, 0, 505, 657] }, 'j' => { wx: 600, boundingbox: [82, -157, 410, 657] }, 'k' => { wx: 600, boundingbox: [43, 0, 580, 629] }, 'l' => { wx: 600, boundingbox: [95, 0, 505, 629] }, 'm' => { wx: 600, boundingbox: [-5, 0, 605, 441] }, 'n' => { wx: 600, boundingbox: [26, 0, 575, 441] }, 'o' => { wx: 600, boundingbox: [62, -15, 538, 441] }, 'p' => { wx: 600, boundingbox: [9, -157, 555, 441] }, 'q' => { wx: 600, boundingbox: [45, -157, 591, 441] }, 'r' => { wx: 600, boundingbox: [60, 0, 559, 441] }, 's' => { wx: 600, boundingbox: [80, -15, 513, 441] }, 't' => { wx: 600, boundingbox: [87, -15, 530, 561] }, 'u' => { wx: 600, boundingbox: [21, -15, 562, 426] }, 'v' => { wx: 600, boundingbox: [10, -10, 590, 426] }, 'w' => { wx: 600, boundingbox: [-4, -10, 604, 426] }, 'x' => { wx: 600, boundingbox: [20, 0, 580, 426] }, 'y' => { wx: 600, boundingbox: [7, -157, 592, 426] }, 'z' => { wx: 600, boundingbox: [99, 0, 502, 426] }, '{' => { wx: 600, boundingbox: [182, -108, 437, 622] }, '|' => { wx: 600, boundingbox: [275, -250, 326, 750] }, '}' => { wx: 600, boundingbox: [163, -108, 418, 622] }, '~' => { wx: 600, boundingbox: [63, 197, 540, 320] }, \"\\u00A1\" => { wx: 600, boundingbox: [236, -157, 364, 430] }, \"\\u00A2\" => { wx: 600, boundingbox: [96, -49, 500, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [84, -21, 521, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [92, -57, 509, 665] }, \"\\u00A5\" => { wx: 600, boundingbox: [26, 0, 574, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [4, -143, 539, 622] }, \"\\u00A7\" => { wx: 600, boundingbox: [113, -78, 488, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [73, 58, 527, 506] }, \"\\u00A9\" => { wx: 600, boundingbox: [259, 328, 341, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [143, 328, 471, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [37, 70, 563, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [149, 70, 451, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [149, 70, 451, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [3, 0, 597, 629] }, \"\\u00AF\" => { wx: 600, boundingbox: [3, 0, 597, 629] }, \"\\u00B1\" => { wx: 600, boundingbox: [75, 231, 525, 285] }, \"\\u00B2\" => { wx: 600, boundingbox: [141, -78, 459, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [141, -78, 459, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [222, 189, 378, 327] }, \"\\u00B6\" => { wx: 600, boundingbox: [50, -78, 511, 562] }, \"\\u00B7\" => { wx: 600, boundingbox: [172, 130, 428, 383] }, \"\\u00B8\" => { wx: 600, boundingbox: [213, -134, 376, 100] }, \"\\u00B9\" => { wx: 600, boundingbox: [143, -134, 457, 100] }, \"\\u00BA\" => { wx: 600, boundingbox: [143, 328, 457, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [37, 70, 563, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [37, -15, 563, 111] }, \"\\u00BD\" => { wx: 600, boundingbox: [3, -15, 600, 622] }, \"\\u00BF\" => { wx: 600, boundingbox: [108, -157, 471, 430] }, \"\\u00C1\" => { wx: 600, boundingbox: [151, 497, 378, 672] }, \"\\u00C2\" => { wx: 600, boundingbox: [242, 497, 469, 672] }, \"\\u00C3\" => { wx: 600, boundingbox: [124, 477, 476, 654] }, \"\\u00C4\" => { wx: 600, boundingbox: [105, 489, 503, 606] }, \"\\u00C5\" => { wx: 600, boundingbox: [120, 525, 480, 565] }, \"\\u00C6\" => { wx: 600, boundingbox: [153, 501, 447, 609] }, \"\\u00C7\" => { wx: 600, boundingbox: [249, 537, 352, 640] }, \"\\u00C8\" => { wx: 600, boundingbox: [148, 537, 453, 640] }, \"\\u00CA\" => { wx: 600, boundingbox: [218, 463, 382, 627] }, \"\\u00CB\" => { wx: 600, boundingbox: [224, -151, 362, 10] }, \"\\u00CD\" => { wx: 600, boundingbox: [133, 497, 540, 672] }, \"\\u00CE\" => { wx: 600, boundingbox: [211, -172, 407, 4] }, \"\\u00CF\" => { wx: 600, boundingbox: [124, 492, 476, 669] }, \"\\u00D0\" => { wx: 600, boundingbox: [0, 231, 600, 285] }, \"\\u00E1\" => { wx: 600, boundingbox: [3, 0, 550, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [156, 249, 442, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [47, 0, 554, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [43, -80, 557, 629] }, \"\\u00EA\" => { wx: 600, boundingbox: [7, 0, 567, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [157, 249, 443, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [19, -15, 570, 441] }, \"\\u00F5\" => { wx: 600, boundingbox: [95, 0, 505, 426] }, \"\\u00F8\" => { wx: 600, boundingbox: [95, 0, 505, 629] }, \"\\u00F9\" => { wx: 600, boundingbox: [62, -80, 538, 506] }, \"\\u00FA\" => { wx: 600, boundingbox: [19, -15, 559, 441] }, \"\\u00FB\" => { wx: 600, boundingbox: [48, -15, 588, 629] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_bold_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [202, -15, 398, 572] }, '\"' => { wx: 600, boundingbox: [135, 277, 465, 562] }, '#' => { wx: 600, boundingbox: [56, -45, 544, 651] }, '$' => { wx: 600, boundingbox: [82, -126, 519, 666] }, '%' => { wx: 600, boundingbox: [5, -15, 595, 616] }, '&' => { wx: 600, boundingbox: [36, -15, 546, 543] }, \"'\" => { wx: 600, boundingbox: [171, 277, 423, 562] }, '(' => { wx: 600, boundingbox: [219, -102, 461, 616] }, ')' => { wx: 600, boundingbox: [139, -102, 381, 616] }, '*' => { wx: 600, boundingbox: [91, 219, 509, 601] }, '+' => { wx: 600, boundingbox: [71, 39, 529, 478] }, ',' => { wx: 600, boundingbox: [123, -111, 393, 174] }, '-' => { wx: 600, boundingbox: [100, 203, 500, 313] }, '.' => { wx: 600, boundingbox: [192, -15, 408, 171] }, '/' => { wx: 600, boundingbox: [98, -77, 502, 626] }, '0' => { wx: 600, boundingbox: [87, -15, 513, 616] }, '1' => { wx: 600, boundingbox: [81, 0, 539, 616] }, '2' => { wx: 600, boundingbox: [61, 0, 499, 616] }, '3' => { wx: 600, boundingbox: [63, -15, 501, 616] }, '4' => { wx: 600, boundingbox: [53, 0, 507, 616] }, '5' => { wx: 600, boundingbox: [70, -15, 521, 601] }, '6' => { wx: 600, boundingbox: [90, -15, 521, 616] }, '7' => { wx: 600, boundingbox: [55, 0, 494, 601] }, '8' => { wx: 600, boundingbox: [83, -15, 517, 616] }, '9' => { wx: 600, boundingbox: [79, -15, 510, 616] }, ':' => { wx: 600, boundingbox: [191, -15, 407, 425] }, ';' => { wx: 600, boundingbox: [123, -111, 408, 425] }, '<' => { wx: 600, boundingbox: [66, 15, 523, 501] }, '=' => { wx: 600, boundingbox: [71, 118, 529, 398] }, '>' => { wx: 600, boundingbox: [77, 15, 534, 501] }, '?' => { wx: 600, boundingbox: [98, -14, 501, 580] }, '@' => { wx: 600, boundingbox: [16, -15, 584, 616] }, 'A' => { wx: 600, boundingbox: [-9, 0, 609, 562] }, 'B' => { wx: 600, boundingbox: [30, 0, 573, 562] }, 'C' => { wx: 600, boundingbox: [22, -18, 560, 580] }, 'D' => { wx: 600, boundingbox: [30, 0, 594, 562] }, 'E' => { wx: 600, boundingbox: [25, 0, 560, 562] }, 'F' => { wx: 600, boundingbox: [39, 0, 570, 562] }, 'G' => { wx: 600, boundingbox: [22, -18, 594, 580] }, 'H' => { wx: 600, boundingbox: [20, 0, 580, 562] }, 'I' => { wx: 600, boundingbox: [77, 0, 523, 562] }, 'J' => { wx: 600, boundingbox: [37, -18, 601, 562] }, 'K' => { wx: 600, boundingbox: [21, 0, 599, 562] }, 'L' => { wx: 600, boundingbox: [39, 0, 578, 562] }, 'M' => { wx: 600, boundingbox: [-2, 0, 602, 562] }, 'N' => { wx: 600, boundingbox: [8, -12, 610, 562] }, 'O' => { wx: 600, boundingbox: [22, -18, 578, 580] }, 'P' => { wx: 600, boundingbox: [48, 0, 559, 562] }, 'Q' => { wx: 600, boundingbox: [32, -138, 578, 580] }, 'R' => { wx: 600, boundingbox: [24, 0, 599, 562] }, 'S' => { wx: 600, boundingbox: [47, -22, 553, 582] }, 'T' => { wx: 600, boundingbox: [21, 0, 579, 562] }, 'U' => { wx: 600, boundingbox: [4, -18, 596, 562] }, 'V' => { wx: 600, boundingbox: [-13, 0, 613, 562] }, 'W' => { wx: 600, boundingbox: [-18, 0, 618, 562] }, 'X' => { wx: 600, boundingbox: [12, 0, 588, 562] }, 'Y' => { wx: 600, boundingbox: [12, 0, 589, 562] }, 'Z' => { wx: 600, boundingbox: [62, 0, 539, 562] }, '[' => { wx: 600, boundingbox: [245, -102, 475, 616] }, '\\\\' => { wx: 600, boundingbox: [99, -77, 503, 626] }, ']' => { wx: 600, boundingbox: [125, -102, 355, 616] }, '^' => { wx: 600, boundingbox: [108, 250, 492, 616] }, '_' => { wx: 600, boundingbox: [0, -125, 600, -75] }, '`' => { wx: 600, boundingbox: [178, 277, 428, 562] }, 'a' => { wx: 600, boundingbox: [35, -15, 570, 454] }, 'b' => { wx: 600, boundingbox: [0, -15, 584, 626] }, 'c' => { wx: 600, boundingbox: [40, -15, 545, 459] }, 'd' => { wx: 600, boundingbox: [20, -15, 591, 626] }, 'e' => { wx: 600, boundingbox: [40, -15, 563, 454] }, 'f' => { wx: 600, boundingbox: [83, 0, 547, 626] }, 'g' => { wx: 600, boundingbox: [30, -146, 580, 454] }, 'h' => { wx: 600, boundingbox: [5, 0, 592, 626] }, 'i' => { wx: 600, boundingbox: [77, 0, 523, 658] }, 'j' => { wx: 600, boundingbox: [63, -146, 440, 658] }, 'k' => { wx: 600, boundingbox: [20, 0, 585, 626] }, 'l' => { wx: 600, boundingbox: [77, 0, 523, 626] }, 'm' => { wx: 600, boundingbox: [-22, 0, 626, 454] }, 'n' => { wx: 600, boundingbox: [18, 0, 592, 454] }, 'o' => { wx: 600, boundingbox: [30, -15, 570, 454] }, 'p' => { wx: 600, boundingbox: [-1, -142, 570, 454] }, 'q' => { wx: 600, boundingbox: [20, -142, 591, 454] }, 'r' => { wx: 600, boundingbox: [47, 0, 580, 454] }, 's' => { wx: 600, boundingbox: [68, -17, 535, 459] }, 't' => { wx: 600, boundingbox: [47, -15, 532, 562] }, 'u' => { wx: 600, boundingbox: [-1, -15, 569, 439] }, 'v' => { wx: 600, boundingbox: [-1, 0, 601, 439] }, 'w' => { wx: 600, boundingbox: [-18, 0, 618, 439] }, 'x' => { wx: 600, boundingbox: [6, 0, 594, 439] }, 'y' => { wx: 600, boundingbox: [-4, -142, 601, 439] }, 'z' => { wx: 600, boundingbox: [81, 0, 520, 439] }, '{' => { wx: 600, boundingbox: [160, -102, 464, 616] }, '|' => { wx: 600, boundingbox: [255, -250, 345, 750] }, '}' => { wx: 600, boundingbox: [136, -102, 440, 616] }, '~' => { wx: 600, boundingbox: [71, 153, 530, 356] }, \"\\u00A1\" => { wx: 600, boundingbox: [202, -146, 398, 449] }, \"\\u00A2\" => { wx: 600, boundingbox: [66, -49, 518, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [72, -28, 558, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [25, -60, 576, 661] }, \"\\u00A5\" => { wx: 600, boundingbox: [10, 0, 590, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-30, -131, 572, 616] }, \"\\u00A7\" => { wx: 600, boundingbox: [83, -70, 517, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [54, 49, 546, 517] }, \"\\u00A9\" => { wx: 600, boundingbox: [227, 277, 373, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [71, 277, 535, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [8, 70, 553, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [141, 70, 459, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [141, 70, 459, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [12, 0, 593, 626] }, \"\\u00AF\" => { wx: 600, boundingbox: [12, 0, 593, 626] }, \"\\u00B1\" => { wx: 600, boundingbox: [65, 203, 535, 313] }, \"\\u00B2\" => { wx: 600, boundingbox: [106, -70, 494, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [106, -70, 494, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [196, 165, 404, 351] }, \"\\u00B6\" => { wx: 600, boundingbox: [6, -70, 576, 580] }, \"\\u00B7\" => { wx: 600, boundingbox: [140, 132, 460, 430] }, \"\\u00B8\" => { wx: 600, boundingbox: [175, -142, 427, 143] }, \"\\u00B9\" => { wx: 600, boundingbox: [65, -142, 529, 143] }, \"\\u00BA\" => { wx: 600, boundingbox: [61, 277, 525, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [47, 70, 592, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [26, -15, 574, 116] }, \"\\u00BD\" => { wx: 600, boundingbox: [-113, -15, 713, 616] }, \"\\u00BF\" => { wx: 600, boundingbox: [99, -146, 502, 449] }, \"\\u00C1\" => { wx: 600, boundingbox: [132, 508, 395, 661] }, \"\\u00C2\" => { wx: 600, boundingbox: [205, 508, 468, 661] }, \"\\u00C3\" => { wx: 600, boundingbox: [103, 483, 497, 657] }, \"\\u00C4\" => { wx: 600, boundingbox: [89, 493, 512, 636] }, \"\\u00C5\" => { wx: 600, boundingbox: [88, 505, 512, 585] }, \"\\u00C6\" => { wx: 600, boundingbox: [83, 468, 517, 631] }, \"\\u00C7\" => { wx: 600, boundingbox: [230, 498, 370, 638] }, \"\\u00C8\" => { wx: 600, boundingbox: [128, 498, 472, 638] }, \"\\u00CA\" => { wx: 600, boundingbox: [198, 481, 402, 678] }, \"\\u00CB\" => { wx: 600, boundingbox: [205, -206, 387, 0] }, \"\\u00CD\" => { wx: 600, boundingbox: [68, 488, 588, 661] }, \"\\u00CE\" => { wx: 600, boundingbox: [169, -199, 400, 0] }, \"\\u00CF\" => { wx: 600, boundingbox: [103, 493, 497, 667] }, \"\\u00D0\" => { wx: 600, boundingbox: [-10, 203, 610, 313] }, \"\\u00E1\" => { wx: 600, boundingbox: [-29, 0, 602, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [147, 196, 453, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [39, 0, 578, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [22, -22, 578, 584] }, \"\\u00EA\" => { wx: 600, boundingbox: [-25, 0, 595, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [147, 196, 453, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [-4, -15, 601, 454] }, \"\\u00F5\" => { wx: 600, boundingbox: [77, 0, 523, 439] }, \"\\u00F8\" => { wx: 600, boundingbox: [77, 0, 523, 626] }, \"\\u00F9\" => { wx: 600, boundingbox: [30, -24, 570, 463] }, \"\\u00FA\" => { wx: 600, boundingbox: [-18, -15, 611, 454] }, \"\\u00FB\" => { wx: 600, boundingbox: [22, -15, 596, 626] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_oblique_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [243, -15, 464, 572] }, '\"' => { wx: 600, boundingbox: [273, 328, 532, 562] }, '#' => { wx: 600, boundingbox: [133, -32, 596, 639] }, '$' => { wx: 600, boundingbox: [108, -126, 596, 662] }, '%' => { wx: 600, boundingbox: [134, -15, 599, 622] }, '&' => { wx: 600, boundingbox: [87, -15, 580, 543] }, \"'\" => { wx: 600, boundingbox: [283, 328, 495, 562] }, '(' => { wx: 600, boundingbox: [313, -108, 572, 622] }, ')' => { wx: 600, boundingbox: [137, -108, 396, 622] }, '*' => { wx: 600, boundingbox: [212, 257, 580, 607] }, '+' => { wx: 600, boundingbox: [129, 44, 580, 470] }, ',' => { wx: 600, boundingbox: [157, -112, 370, 122] }, '-' => { wx: 600, boundingbox: [152, 231, 558, 285] }, '.' => { wx: 600, boundingbox: [238, -15, 382, 109] }, '/' => { wx: 600, boundingbox: [112, -80, 604, 629] }, '0' => { wx: 600, boundingbox: [154, -15, 575, 622] }, '1' => { wx: 600, boundingbox: [98, 0, 515, 622] }, '2' => { wx: 600, boundingbox: [70, 0, 568, 622] }, '3' => { wx: 600, boundingbox: [82, -15, 538, 622] }, '4' => { wx: 600, boundingbox: [108, 0, 541, 622] }, '5' => { wx: 600, boundingbox: [99, -15, 589, 607] }, '6' => { wx: 600, boundingbox: [155, -15, 629, 622] }, '7' => { wx: 600, boundingbox: [182, 0, 612, 607] }, '8' => { wx: 600, boundingbox: [132, -15, 588, 622] }, '9' => { wx: 600, boundingbox: [93, -15, 574, 622] }, ':' => { wx: 600, boundingbox: [238, -15, 441, 385] }, ';' => { wx: 600, boundingbox: [157, -112, 441, 385] }, '<' => { wx: 600, boundingbox: [96, 42, 610, 472] }, '=' => { wx: 600, boundingbox: [109, 138, 600, 376] }, '>' => { wx: 600, boundingbox: [85, 42, 599, 472] }, '?' => { wx: 600, boundingbox: [222, -15, 583, 572] }, '@' => { wx: 600, boundingbox: [127, -15, 582, 622] }, 'A' => { wx: 600, boundingbox: [3, 0, 607, 562] }, 'B' => { wx: 600, boundingbox: [43, 0, 616, 562] }, 'C' => { wx: 600, boundingbox: [93, -18, 655, 580] }, 'D' => { wx: 600, boundingbox: [43, 0, 645, 562] }, 'E' => { wx: 600, boundingbox: [53, 0, 660, 562] }, 'F' => { wx: 600, boundingbox: [53, 0, 660, 562] }, 'G' => { wx: 600, boundingbox: [83, -18, 645, 580] }, 'H' => { wx: 600, boundingbox: [32, 0, 687, 562] }, 'I' => { wx: 600, boundingbox: [96, 0, 623, 562] }, 'J' => { wx: 600, boundingbox: [52, -18, 685, 562] }, 'K' => { wx: 600, boundingbox: [38, 0, 671, 562] }, 'L' => { wx: 600, boundingbox: [47, 0, 607, 562] }, 'M' => { wx: 600, boundingbox: [4, 0, 715, 562] }, 'N' => { wx: 600, boundingbox: [7, -13, 712, 562] }, 'O' => { wx: 600, boundingbox: [94, -18, 625, 580] }, 'P' => { wx: 600, boundingbox: [79, 0, 644, 562] }, 'Q' => { wx: 600, boundingbox: [95, -138, 625, 580] }, 'R' => { wx: 600, boundingbox: [38, 0, 598, 562] }, 'S' => { wx: 600, boundingbox: [76, -20, 650, 580] }, 'T' => { wx: 600, boundingbox: [108, 0, 665, 562] }, 'U' => { wx: 600, boundingbox: [125, -18, 702, 562] }, 'V' => { wx: 600, boundingbox: [105, -13, 723, 562] }, 'W' => { wx: 600, boundingbox: [106, -13, 722, 562] }, 'X' => { wx: 600, boundingbox: [23, 0, 675, 562] }, 'Y' => { wx: 600, boundingbox: [133, 0, 695, 562] }, 'Z' => { wx: 600, boundingbox: [86, 0, 610, 562] }, '[' => { wx: 600, boundingbox: [246, -108, 574, 622] }, '\\\\' => { wx: 600, boundingbox: [249, -80, 468, 629] }, ']' => { wx: 600, boundingbox: [135, -108, 463, 622] }, '^' => { wx: 600, boundingbox: [175, 354, 587, 622] }, '_' => { wx: 600, boundingbox: [-27, -125, 584, -75] }, '`' => { wx: 600, boundingbox: [343, 328, 457, 562] }, 'a' => { wx: 600, boundingbox: [76, -15, 569, 441] }, 'b' => { wx: 600, boundingbox: [29, -15, 625, 629] }, 'c' => { wx: 600, boundingbox: [106, -15, 608, 441] }, 'd' => { wx: 600, boundingbox: [85, -15, 640, 629] }, 'e' => { wx: 600, boundingbox: [106, -15, 598, 441] }, 'f' => { wx: 600, boundingbox: [114, 0, 662, 629] }, 'g' => { wx: 600, boundingbox: [61, -157, 657, 441] }, 'h' => { wx: 600, boundingbox: [33, 0, 592, 629] }, 'i' => { wx: 600, boundingbox: [95, 0, 515, 657] }, 'j' => { wx: 600, boundingbox: [52, -157, 550, 657] }, 'k' => { wx: 600, boundingbox: [58, 0, 633, 629] }, 'l' => { wx: 600, boundingbox: [95, 0, 515, 629] }, 'm' => { wx: 600, boundingbox: [-5, 0, 615, 441] }, 'n' => { wx: 600, boundingbox: [26, 0, 585, 441] }, 'o' => { wx: 600, boundingbox: [102, -15, 588, 441] }, 'p' => { wx: 600, boundingbox: [-24, -157, 605, 441] }, 'q' => { wx: 600, boundingbox: [85, -157, 682, 441] }, 'r' => { wx: 600, boundingbox: [60, 0, 636, 441] }, 's' => { wx: 600, boundingbox: [78, -15, 584, 441] }, 't' => { wx: 600, boundingbox: [167, -15, 561, 561] }, 'u' => { wx: 600, boundingbox: [101, -15, 572, 426] }, 'v' => { wx: 600, boundingbox: [90, -10, 681, 426] }, 'w' => { wx: 600, boundingbox: [76, -10, 695, 426] }, 'x' => { wx: 600, boundingbox: [20, 0, 655, 426] }, 'y' => { wx: 600, boundingbox: [-4, -157, 683, 426] }, 'z' => { wx: 600, boundingbox: [99, 0, 593, 426] }, '{' => { wx: 600, boundingbox: [233, -108, 569, 622] }, '|' => { wx: 600, boundingbox: [222, -250, 485, 750] }, '}' => { wx: 600, boundingbox: [140, -108, 477, 622] }, '~' => { wx: 600, boundingbox: [116, 197, 600, 320] }, \"\\u00A1\" => { wx: 600, boundingbox: [225, -157, 445, 430] }, \"\\u00A2\" => { wx: 600, boundingbox: [151, -49, 588, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [124, -21, 621, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [84, -57, 646, 665] }, \"\\u00A5\" => { wx: 600, boundingbox: [120, 0, 693, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-26, -143, 671, 622] }, \"\\u00A7\" => { wx: 600, boundingbox: [104, -78, 590, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [94, 58, 628, 506] }, \"\\u00A9\" => { wx: 600, boundingbox: [345, 328, 460, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [262, 328, 541, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [92, 70, 652, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [204, 70, 540, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [170, 70, 506, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [3, 0, 619, 629] }, \"\\u00AF\" => { wx: 600, boundingbox: [3, 0, 619, 629] }, \"\\u00B1\" => { wx: 600, boundingbox: [124, 231, 586, 285] }, \"\\u00B2\" => { wx: 600, boundingbox: [217, -78, 546, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [163, -78, 546, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [275, 189, 434, 327] }, \"\\u00B6\" => { wx: 600, boundingbox: [100, -78, 630, 562] }, \"\\u00B7\" => { wx: 600, boundingbox: [224, 130, 485, 383] }, \"\\u00B8\" => { wx: 600, boundingbox: [185, -134, 397, 100] }, \"\\u00B9\" => { wx: 600, boundingbox: [115, -134, 478, 100] }, \"\\u00BA\" => { wx: 600, boundingbox: [213, 328, 576, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [58, 70, 618, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [46, -15, 575, 111] }, \"\\u00BD\" => { wx: 600, boundingbox: [59, -15, 627, 622] }, \"\\u00BF\" => { wx: 600, boundingbox: [105, -157, 466, 430] }, \"\\u00C1\" => { wx: 600, boundingbox: [294, 497, 484, 672] }, \"\\u00C2\" => { wx: 600, boundingbox: [348, 497, 612, 672] }, \"\\u00C3\" => { wx: 600, boundingbox: [229, 477, 581, 654] }, \"\\u00C4\" => { wx: 600, boundingbox: [212, 489, 629, 606] }, \"\\u00C5\" => { wx: 600, boundingbox: [232, 525, 600, 565] }, \"\\u00C6\" => { wx: 600, boundingbox: [279, 501, 576, 609] }, \"\\u00C7\" => { wx: 600, boundingbox: [373, 537, 478, 640] }, \"\\u00C8\" => { wx: 600, boundingbox: [272, 537, 579, 640] }, \"\\u00CA\" => { wx: 600, boundingbox: [332, 463, 500, 627] }, \"\\u00CB\" => { wx: 600, boundingbox: [197, -151, 344, 10] }, \"\\u00CD\" => { wx: 600, boundingbox: [239, 497, 683, 672] }, \"\\u00CE\" => { wx: 600, boundingbox: [189, -172, 377, 4] }, \"\\u00CF\" => { wx: 600, boundingbox: [262, 492, 614, 669] }, \"\\u00D0\" => { wx: 600, boundingbox: [49, 231, 661, 285] }, \"\\u00E1\" => { wx: 600, boundingbox: [3, 0, 655, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [209, 249, 512, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [47, 0, 607, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [94, -80, 625, 629] }, \"\\u00EA\" => { wx: 600, boundingbox: [59, 0, 672, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [210, 249, 535, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [41, -15, 626, 441] }, \"\\u00F5\" => { wx: 600, boundingbox: [95, 0, 515, 426] }, \"\\u00F8\" => { wx: 600, boundingbox: [95, 0, 587, 629] }, \"\\u00F9\" => { wx: 600, boundingbox: [102, -80, 588, 506] }, \"\\u00FA\" => { wx: 600, boundingbox: [54, -15, 615, 441] }, \"\\u00FB\" => { wx: 600, boundingbox: [48, -15, 617, 629] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_boldoblique_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [215, -15, 495, 572] }, '\"' => { wx: 600, boundingbox: [211, 277, 585, 562] }, '#' => { wx: 600, boundingbox: [88, -45, 641, 651] }, '$' => { wx: 600, boundingbox: [87, -126, 630, 666] }, '%' => { wx: 600, boundingbox: [101, -15, 625, 616] }, '&' => { wx: 600, boundingbox: [61, -15, 595, 543] }, \"'\" => { wx: 600, boundingbox: [229, 277, 543, 562] }, '(' => { wx: 600, boundingbox: [265, -102, 592, 616] }, ')' => { wx: 600, boundingbox: [117, -102, 444, 616] }, '*' => { wx: 600, boundingbox: [179, 219, 598, 601] }, '+' => { wx: 600, boundingbox: [114, 39, 596, 478] }, ',' => { wx: 600, boundingbox: [99, -111, 430, 174] }, '-' => { wx: 600, boundingbox: [143, 203, 567, 313] }, '.' => { wx: 600, boundingbox: [206, -15, 427, 171] }, '/' => { wx: 600, boundingbox: [90, -77, 626, 626] }, '0' => { wx: 600, boundingbox: [135, -15, 593, 616] }, '1' => { wx: 600, boundingbox: [93, 0, 562, 616] }, '2' => { wx: 600, boundingbox: [61, 0, 594, 616] }, '3' => { wx: 600, boundingbox: [71, -15, 571, 616] }, '4' => { wx: 600, boundingbox: [81, 0, 559, 616] }, '5' => { wx: 600, boundingbox: [77, -15, 621, 601] }, '6' => { wx: 600, boundingbox: [135, -15, 652, 616] }, '7' => { wx: 600, boundingbox: [147, 0, 622, 601] }, '8' => { wx: 600, boundingbox: [115, -15, 604, 616] }, '9' => { wx: 600, boundingbox: [75, -15, 592, 616] }, ':' => { wx: 600, boundingbox: [205, -15, 480, 425] }, ';' => { wx: 600, boundingbox: [99, -111, 481, 425] }, '<' => { wx: 600, boundingbox: [120, 15, 613, 501] }, '=' => { wx: 600, boundingbox: [96, 118, 614, 398] }, '>' => { wx: 600, boundingbox: [97, 15, 589, 501] }, '?' => { wx: 600, boundingbox: [183, -14, 592, 580] }, '@' => { wx: 600, boundingbox: [65, -15, 642, 616] }, 'A' => { wx: 600, boundingbox: [-9, 0, 632, 562] }, 'B' => { wx: 600, boundingbox: [30, 0, 630, 562] }, 'C' => { wx: 600, boundingbox: [74, -18, 675, 580] }, 'D' => { wx: 600, boundingbox: [30, 0, 664, 562] }, 'E' => { wx: 600, boundingbox: [25, 0, 670, 562] }, 'F' => { wx: 600, boundingbox: [39, 0, 684, 562] }, 'G' => { wx: 600, boundingbox: [74, -18, 675, 580] }, 'H' => { wx: 600, boundingbox: [20, 0, 700, 562] }, 'I' => { wx: 600, boundingbox: [77, 0, 643, 562] }, 'J' => { wx: 600, boundingbox: [58, -18, 721, 562] }, 'K' => { wx: 600, boundingbox: [21, 0, 692, 562] }, 'L' => { wx: 600, boundingbox: [39, 0, 636, 562] }, 'M' => { wx: 600, boundingbox: [-2, 0, 722, 562] }, 'N' => { wx: 600, boundingbox: [8, -12, 730, 562] }, 'O' => { wx: 600, boundingbox: [74, -18, 645, 580] }, 'P' => { wx: 600, boundingbox: [48, 0, 643, 562] }, 'Q' => { wx: 600, boundingbox: [83, -138, 636, 580] }, 'R' => { wx: 600, boundingbox: [24, 0, 617, 562] }, 'S' => { wx: 600, boundingbox: [54, -22, 673, 582] }, 'T' => { wx: 600, boundingbox: [86, 0, 679, 562] }, 'U' => { wx: 600, boundingbox: [101, -18, 716, 562] }, 'V' => { wx: 600, boundingbox: [84, 0, 733, 562] }, 'W' => { wx: 600, boundingbox: [79, 0, 738, 562] }, 'X' => { wx: 600, boundingbox: [12, 0, 690, 562] }, 'Y' => { wx: 600, boundingbox: [109, 0, 709, 562] }, 'Z' => { wx: 600, boundingbox: [62, 0, 637, 562] }, '[' => { wx: 600, boundingbox: [223, -102, 606, 616] }, '\\\\' => { wx: 600, boundingbox: [222, -77, 496, 626] }, ']' => { wx: 600, boundingbox: [103, -102, 486, 616] }, '^' => { wx: 600, boundingbox: [171, 250, 556, 616] }, '_' => { wx: 600, boundingbox: [-27, -125, 585, -75] }, '`' => { wx: 600, boundingbox: [297, 277, 487, 562] }, 'a' => { wx: 600, boundingbox: [61, -15, 593, 454] }, 'b' => { wx: 600, boundingbox: [13, -15, 636, 626] }, 'c' => { wx: 600, boundingbox: [81, -15, 631, 459] }, 'd' => { wx: 600, boundingbox: [60, -15, 645, 626] }, 'e' => { wx: 600, boundingbox: [81, -15, 605, 454] }, 'f' => { wx: 600, boundingbox: [83, 0, 677, 626] }, 'g' => { wx: 600, boundingbox: [40, -146, 674, 454] }, 'h' => { wx: 600, boundingbox: [18, 0, 615, 626] }, 'i' => { wx: 600, boundingbox: [77, 0, 546, 658] }, 'j' => { wx: 600, boundingbox: [36, -146, 580, 658] }, 'k' => { wx: 600, boundingbox: [33, 0, 643, 626] }, 'l' => { wx: 600, boundingbox: [77, 0, 546, 626] }, 'm' => { wx: 600, boundingbox: [-22, 0, 649, 454] }, 'n' => { wx: 600, boundingbox: [18, 0, 615, 454] }, 'o' => { wx: 600, boundingbox: [71, -15, 622, 454] }, 'p' => { wx: 600, boundingbox: [-32, -142, 622, 454] }, 'q' => { wx: 600, boundingbox: [60, -142, 685, 454] }, 'r' => { wx: 600, boundingbox: [47, 0, 655, 454] }, 's' => { wx: 600, boundingbox: [66, -17, 608, 459] }, 't' => { wx: 600, boundingbox: [118, -15, 567, 562] }, 'u' => { wx: 600, boundingbox: [70, -15, 592, 439] }, 'v' => { wx: 600, boundingbox: [70, 0, 695, 439] }, 'w' => { wx: 600, boundingbox: [53, 0, 712, 439] }, 'x' => { wx: 600, boundingbox: [6, 0, 671, 439] }, 'y' => { wx: 600, boundingbox: [-21, -142, 695, 439] }, 'z' => { wx: 600, boundingbox: [81, 0, 614, 439] }, '{' => { wx: 600, boundingbox: [203, -102, 595, 616] }, '|' => { wx: 600, boundingbox: [201, -250, 505, 750] }, '}' => { wx: 600, boundingbox: [114, -102, 506, 616] }, '~' => { wx: 600, boundingbox: [120, 153, 590, 356] }, \"\\u00A1\" => { wx: 600, boundingbox: [196, -146, 477, 449] }, \"\\u00A2\" => { wx: 600, boundingbox: [121, -49, 605, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [106, -28, 650, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [22, -60, 708, 661] }, \"\\u00A5\" => { wx: 600, boundingbox: [98, 0, 710, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-57, -131, 702, 616] }, \"\\u00A7\" => { wx: 600, boundingbox: [74, -70, 620, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [77, 49, 644, 517] }, \"\\u00A9\" => { wx: 600, boundingbox: [303, 277, 493, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [190, 277, 594, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [62, 70, 639, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [195, 70, 545, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [165, 70, 514, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [12, 0, 644, 626] }, \"\\u00AF\" => { wx: 600, boundingbox: [12, 0, 644, 626] }, \"\\u00B1\" => { wx: 600, boundingbox: [108, 203, 602, 313] }, \"\\u00B2\" => { wx: 600, boundingbox: [175, -70, 586, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [121, -70, 587, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [248, 165, 461, 351] }, \"\\u00B6\" => { wx: 600, boundingbox: [61, -70, 700, 580] }, \"\\u00B7\" => { wx: 600, boundingbox: [196, 132, 523, 430] }, \"\\u00B8\" => { wx: 600, boundingbox: [144, -142, 458, 143] }, \"\\u00B9\" => { wx: 600, boundingbox: [34, -142, 560, 143] }, \"\\u00BA\" => { wx: 600, boundingbox: [119, 277, 645, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [71, 70, 647, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [35, -15, 587, 116] }, \"\\u00BD\" => { wx: 600, boundingbox: [-45, -15, 743, 616] }, \"\\u00BF\" => { wx: 600, boundingbox: [100, -146, 509, 449] }, \"\\u00C1\" => { wx: 600, boundingbox: [272, 508, 503, 661] }, \"\\u00C2\" => { wx: 600, boundingbox: [312, 508, 609, 661] }, \"\\u00C3\" => { wx: 600, boundingbox: [212, 483, 607, 657] }, \"\\u00C4\" => { wx: 600, boundingbox: [199, 493, 643, 636] }, \"\\u00C5\" => { wx: 600, boundingbox: [195, 505, 637, 585] }, \"\\u00C6\" => { wx: 600, boundingbox: [217, 468, 652, 631] }, \"\\u00C7\" => { wx: 600, boundingbox: [348, 498, 493, 638] }, \"\\u00C8\" => { wx: 600, boundingbox: [246, 498, 595, 638] }, \"\\u00CA\" => { wx: 600, boundingbox: [319, 481, 528, 678] }, \"\\u00CB\" => { wx: 600, boundingbox: [168, -206, 368, 0] }, \"\\u00CD\" => { wx: 600, boundingbox: [171, 488, 729, 661] }, \"\\u00CE\" => { wx: 600, boundingbox: [143, -199, 367, 0] }, \"\\u00CF\" => { wx: 600, boundingbox: [238, 493, 633, 667] }, \"\\u00D0\" => { wx: 600, boundingbox: [33, 203, 677, 313] }, \"\\u00E1\" => { wx: 600, boundingbox: [-29, 0, 708, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [188, 196, 526, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [39, 0, 636, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [48, -22, 673, 584] }, \"\\u00EA\" => { wx: 600, boundingbox: [26, 0, 701, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [188, 196, 543, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [21, -15, 652, 454] }, \"\\u00F5\" => { wx: 600, boundingbox: [77, 0, 546, 439] }, \"\\u00F8\" => { wx: 600, boundingbox: [77, 0, 587, 626] }, \"\\u00F9\" => { wx: 600, boundingbox: [54, -24, 638, 463] }, \"\\u00FA\" => { wx: 600, boundingbox: [18, -15, 662, 454] }, \"\\u00FB\" => { wx: 600, boundingbox: [22, -15, 629, 626] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n symbol_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [128, -17, 240, 672] }, '\"' => { wx: 713, boundingbox: [31, 0, 681, 705] }, '#' => { wx: 500, boundingbox: [20, -16, 481, 673] }, '$' => { wx: 549, boundingbox: [25, 0, 478, 707] }, '%' => { wx: 833, boundingbox: [63, -36, 771, 655] }, '&' => { wx: 778, boundingbox: [41, -18, 750, 661] }, \"'\" => { wx: 439, boundingbox: [48, -17, 414, 500] }, '(' => { wx: 333, boundingbox: [53, -191, 300, 673] }, ')' => { wx: 333, boundingbox: [30, -191, 277, 673] }, '*' => { wx: 500, boundingbox: [65, 134, 427, 551] }, '+' => { wx: 549, boundingbox: [10, 0, 539, 533] }, ',' => { wx: 250, boundingbox: [56, -152, 194, 104] }, '-' => { wx: 549, boundingbox: [11, 233, 535, 288] }, '.' => { wx: 250, boundingbox: [69, -17, 181, 95] }, '/' => { wx: 278, boundingbox: [0, -18, 254, 646] }, '0' => { wx: 500, boundingbox: [24, -14, 476, 685] }, '1' => { wx: 500, boundingbox: [117, 0, 390, 673] }, '2' => { wx: 500, boundingbox: [25, 0, 475, 685] }, '3' => { wx: 500, boundingbox: [43, -14, 435, 685] }, '4' => { wx: 500, boundingbox: [15, 0, 469, 685] }, '5' => { wx: 500, boundingbox: [32, -14, 445, 690] }, '6' => { wx: 500, boundingbox: [34, -14, 468, 685] }, '7' => { wx: 500, boundingbox: [24, -16, 448, 673] }, '8' => { wx: 500, boundingbox: [56, -14, 445, 685] }, '9' => { wx: 500, boundingbox: [30, -18, 459, 685] }, ':' => { wx: 278, boundingbox: [81, -17, 193, 460] }, ';' => { wx: 278, boundingbox: [83, -152, 221, 460] }, '<' => { wx: 549, boundingbox: [26, 0, 523, 522] }, '=' => { wx: 549, boundingbox: [11, 141, 537, 390] }, '>' => { wx: 549, boundingbox: [26, 0, 523, 522] }, '?' => { wx: 444, boundingbox: [70, -17, 412, 686] }, '@' => { wx: 549, boundingbox: [11, 0, 537, 475] }, 'A' => { wx: 722, boundingbox: [4, 0, 684, 673] }, 'B' => { wx: 667, boundingbox: [29, 0, 592, 673] }, 'C' => { wx: 722, boundingbox: [-9, 0, 704, 673] }, 'D' => { wx: 612, boundingbox: [6, 0, 608, 688] }, 'E' => { wx: 611, boundingbox: [32, 0, 617, 673] }, 'F' => { wx: 763, boundingbox: [26, 0, 741, 673] }, 'G' => { wx: 603, boundingbox: [24, 0, 609, 673] }, 'H' => { wx: 722, boundingbox: [39, 0, 729, 673] }, 'I' => { wx: 333, boundingbox: [32, 0, 316, 673] }, 'J' => { wx: 631, boundingbox: [18, -18, 623, 689] }, 'K' => { wx: 722, boundingbox: [35, 0, 722, 673] }, 'L' => { wx: 686, boundingbox: [6, 0, 680, 688] }, 'M' => { wx: 889, boundingbox: [28, 0, 887, 673] }, 'N' => { wx: 722, boundingbox: [29, -8, 720, 673] }, 'O' => { wx: 722, boundingbox: [41, -17, 715, 685] }, 'P' => { wx: 768, boundingbox: [25, 0, 745, 673] }, 'Q' => { wx: 741, boundingbox: [41, -17, 715, 685] }, 'R' => { wx: 556, boundingbox: [28, 0, 563, 673] }, 'S' => { wx: 592, boundingbox: [5, 0, 589, 673] }, 'T' => { wx: 611, boundingbox: [33, 0, 607, 673] }, 'U' => { wx: 690, boundingbox: [-8, 0, 694, 673] }, 'V' => { wx: 439, boundingbox: [40, -233, 436, 500] }, 'W' => { wx: 768, boundingbox: [34, 0, 736, 688] }, 'X' => { wx: 645, boundingbox: [40, 0, 599, 673] }, 'Y' => { wx: 795, boundingbox: [15, 0, 781, 684] }, 'Z' => { wx: 611, boundingbox: [44, 0, 636, 673] }, '[' => { wx: 333, boundingbox: [86, -155, 299, 674] }, '\\\\' => { wx: 863, boundingbox: [163, 0, 701, 487] }, ']' => { wx: 333, boundingbox: [33, -155, 246, 674] }, '^' => { wx: 658, boundingbox: [15, 0, 652, 674] }, '_' => { wx: 500, boundingbox: [-2, -125, 502, -75] }, '`' => { wx: 500, boundingbox: [480, 881, 1090, 917] }, 'a' => { wx: 631, boundingbox: [41, -18, 622, 500] }, 'b' => { wx: 549, boundingbox: [61, -223, 515, 741] }, 'c' => { wx: 549, boundingbox: [12, -231, 522, 499] }, 'd' => { wx: 494, boundingbox: [40, -19, 481, 740] }, 'e' => { wx: 439, boundingbox: [22, -19, 427, 502] }, 'f' => { wx: 521, boundingbox: [28, -224, 492, 673] }, 'g' => { wx: 411, boundingbox: [5, -225, 484, 499] }, 'h' => { wx: 603, boundingbox: [0, -202, 527, 514] }, 'i' => { wx: 329, boundingbox: [0, -17, 301, 503] }, 'j' => { wx: 603, boundingbox: [36, -224, 587, 499] }, 'k' => { wx: 549, boundingbox: [33, 0, 558, 501] }, 'l' => { wx: 549, boundingbox: [24, -17, 548, 739] }, 'm' => { wx: 576, boundingbox: [33, -223, 567, 500] }, 'n' => { wx: 521, boundingbox: [-9, -16, 475, 507] }, 'o' => { wx: 549, boundingbox: [35, -19, 501, 499] }, 'p' => { wx: 549, boundingbox: [10, -19, 530, 487] }, 'q' => { wx: 521, boundingbox: [43, -17, 485, 690] }, 'r' => { wx: 549, boundingbox: [50, -230, 490, 499] }, 's' => { wx: 603, boundingbox: [30, -21, 588, 500] }, 't' => { wx: 439, boundingbox: [10, -19, 418, 500] }, 'u' => { wx: 576, boundingbox: [7, -18, 535, 507] }, 'v' => { wx: 713, boundingbox: [12, -18, 671, 583] }, 'w' => { wx: 686, boundingbox: [42, -17, 684, 500] }, 'x' => { wx: 493, boundingbox: [27, -224, 469, 766] }, 'y' => { wx: 686, boundingbox: [12, -228, 701, 500] }, 'z' => { wx: 494, boundingbox: [60, -225, 467, 756] }, '{' => { wx: 480, boundingbox: [58, -183, 397, 673] }, '|' => { wx: 200, boundingbox: [65, -293, 135, 707] }, '}' => { wx: 480, boundingbox: [79, -183, 418, 673] }, '~' => { wx: 549, boundingbox: [17, 203, 529, 307] }, \"\\u00A0\" => { wx: 750, boundingbox: [20, -12, 714, 685] }, \"\\u00A1\" => { wx: 620, boundingbox: [-2, 0, 610, 685] }, \"\\u00A2\" => { wx: 247, boundingbox: [27, 459, 228, 735] }, \"\\u00A3\" => { wx: 549, boundingbox: [29, 0, 526, 639] }, \"\\u00A4\" => { wx: 167, boundingbox: [-180, -12, 340, 677] }, \"\\u00A5\" => { wx: 713, boundingbox: [26, 124, 688, 404] }, \"\\u00A6\" => { wx: 500, boundingbox: [2, -193, 494, 686] }, \"\\u00A7\" => { wx: 753, boundingbox: [86, -26, 660, 533] }, \"\\u00A8\" => { wx: 753, boundingbox: [142, -36, 600, 550] }, \"\\u00A9\" => { wx: 753, boundingbox: [117, -33, 631, 532] }, \"\\u00AA\" => { wx: 753, boundingbox: [113, -36, 629, 548] }, \"\\u00AB\" => { wx: 1042, boundingbox: [24, -15, 1024, 511] }, \"\\u00AC\" => { wx: 987, boundingbox: [32, -15, 942, 511] }, \"\\u00AD\" => { wx: 603, boundingbox: [45, 0, 571, 910] }, \"\\u00AE\" => { wx: 987, boundingbox: [49, -15, 959, 511] }, \"\\u00AF\" => { wx: 603, boundingbox: [45, -22, 571, 888] }, \"\\u00B0\" => { wx: 400, boundingbox: [50, 385, 350, 685] }, \"\\u00B1\" => { wx: 549, boundingbox: [10, 0, 539, 645] }, \"\\u00B2\" => { wx: 411, boundingbox: [20, 459, 413, 737] }, \"\\u00B3\" => { wx: 549, boundingbox: [29, 0, 526, 639] }, \"\\u00B4\" => { wx: 549, boundingbox: [17, 8, 533, 524] }, \"\\u00B5\" => { wx: 713, boundingbox: [27, 123, 639, 404] }, \"\\u00B6\" => { wx: 494, boundingbox: [26, -20, 462, 746] }, \"\\u00B7\" => { wx: 460, boundingbox: [50, 113, 410, 473] }, \"\\u00B8\" => { wx: 549, boundingbox: [10, 71, 536, 456] }, \"\\u00B9\" => { wx: 549, boundingbox: [15, -25, 540, 549] }, \"\\u00BA\" => { wx: 549, boundingbox: [14, 82, 538, 443] }, \"\\u00BB\" => { wx: 549, boundingbox: [14, 135, 527, 394] }, \"\\u00BC\" => { wx: 1000, boundingbox: [111, -17, 889, 95] }, \"\\u00BD\" => { wx: 603, boundingbox: [280, -120, 336, 1010] }, \"\\u00BE\" => { wx: 1000, boundingbox: [-60, 220, 1050, 276] }, \"\\u00BF\" => { wx: 658, boundingbox: [15, -16, 602, 629] }, \"\\u00C0\" => { wx: 823, boundingbox: [175, -18, 661, 658] }, \"\\u00C1\" => { wx: 686, boundingbox: [10, -53, 578, 740] }, \"\\u00C2\" => { wx: 795, boundingbox: [26, -15, 759, 734] }, \"\\u00C3\" => { wx: 987, boundingbox: [159, -211, 870, 573] }, \"\\u00C4\" => { wx: 768, boundingbox: [43, -17, 733, 673] }, \"\\u00C5\" => { wx: 768, boundingbox: [43, -15, 733, 675] }, \"\\u00C6\" => { wx: 823, boundingbox: [39, -24, 781, 719] }, \"\\u00C7\" => { wx: 768, boundingbox: [40, 0, 732, 509] }, \"\\u00C8\" => { wx: 768, boundingbox: [40, -17, 732, 492] }, \"\\u00C9\" => { wx: 713, boundingbox: [20, 0, 673, 470] }, \"\\u00CA\" => { wx: 713, boundingbox: [20, -125, 673, 470] }, \"\\u00CB\" => { wx: 713, boundingbox: [36, -70, 690, 540] }, \"\\u00CC\" => { wx: 713, boundingbox: [37, 0, 690, 470] }, \"\\u00CD\" => { wx: 713, boundingbox: [37, -125, 690, 470] }, \"\\u00CE\" => { wx: 713, boundingbox: [45, 0, 505, 468] }, \"\\u00CF\" => { wx: 713, boundingbox: [45, -58, 505, 555] }, \"\\u00D0\" => { wx: 768, boundingbox: [26, 0, 738, 673] }, \"\\u00D1\" => { wx: 713, boundingbox: [36, -19, 681, 718] }, \"\\u00D2\" => { wx: 790, boundingbox: [50, -17, 740, 673] }, \"\\u00D3\" => { wx: 790, boundingbox: [51, -15, 741, 675] }, \"\\u00D4\" => { wx: 890, boundingbox: [18, 293, 855, 673] }, \"\\u00D5\" => { wx: 823, boundingbox: [25, -101, 803, 751] }, \"\\u00D6\" => { wx: 549, boundingbox: [10, -38, 515, 917] }, \"\\u00D7\" => { wx: 250, boundingbox: [69, 210, 169, 310] }, \"\\u00D8\" => { wx: 713, boundingbox: [15, 0, 680, 288] }, \"\\u00D9\" => { wx: 603, boundingbox: [23, 0, 583, 454] }, \"\\u00DA\" => { wx: 603, boundingbox: [30, 0, 578, 477] }, \"\\u00DB\" => { wx: 1042, boundingbox: [27, -20, 1023, 510] }, \"\\u00DC\" => { wx: 987, boundingbox: [30, -15, 939, 513] }, \"\\u00DD\" => { wx: 603, boundingbox: [39, 2, 567, 911] }, \"\\u00DE\" => { wx: 987, boundingbox: [45, -20, 954, 508] }, \"\\u00DF\" => { wx: 603, boundingbox: [44, -19, 572, 890] }, \"\\u00E0\" => { wx: 494, boundingbox: [18, 0, 466, 745] }, \"\\u00E1\" => { wx: 329, boundingbox: [25, -198, 306, 746] }, \"\\u00E2\" => { wx: 790, boundingbox: [50, -20, 740, 670] }, \"\\u00E3\" => { wx: 790, boundingbox: [49, -15, 739, 675] }, \"\\u00E4\" => { wx: 786, boundingbox: [5, 293, 725, 673] }, \"\\u00E5\" => { wx: 713, boundingbox: [14, -108, 695, 752] }, \"\\u00E6\" => { wx: 384, boundingbox: [24, -293, 436, 926] }, \"\\u00E7\" => { wx: 384, boundingbox: [24, -85, 108, 925] }, \"\\u00E8\" => { wx: 384, boundingbox: [24, -293, 436, 926] }, \"\\u00E9\" => { wx: 384, boundingbox: [0, -80, 349, 926] }, \"\\u00EA\" => { wx: 384, boundingbox: [0, -79, 77, 925] }, \"\\u00EB\" => { wx: 384, boundingbox: [0, -80, 349, 926] }, \"\\u00EC\" => { wx: 494, boundingbox: [209, -85, 445, 925] }, \"\\u00ED\" => { wx: 494, boundingbox: [20, -85, 284, 935] }, \"\\u00EE\" => { wx: 494, boundingbox: [209, -75, 445, 935] }, \"\\u00EF\" => { wx: 494, boundingbox: [209, -85, 284, 935] }, \"\\u00F1\" => { wx: 329, boundingbox: [21, -198, 302, 746] }, \"\\u00F2\" => { wx: 274, boundingbox: [2, -107, 291, 916] }, \"\\u00F3\" => { wx: 686, boundingbox: [308, -88, 675, 920] }, \"\\u00F4\" => { wx: 686, boundingbox: [308, -88, 378, 975] }, \"\\u00F5\" => { wx: 686, boundingbox: [11, -87, 378, 921] }, \"\\u00F6\" => { wx: 384, boundingbox: [54, -293, 466, 926] }, \"\\u00F7\" => { wx: 384, boundingbox: [382, -85, 466, 925] }, \"\\u00F8\" => { wx: 384, boundingbox: [54, -293, 466, 926] }, \"\\u00F9\" => { wx: 384, boundingbox: [22, -80, 371, 926] }, \"\\u00FA\" => { wx: 384, boundingbox: [294, -79, 371, 925] }, \"\\u00FB\" => { wx: 384, boundingbox: [22, -80, 371, 926] }, \"\\u00FC\" => { wx: 494, boundingbox: [48, -85, 284, 925] }, \"\\u00FD\" => { wx: 494, boundingbox: [209, -85, 473, 935] }, \"\\u00FE\" => { wx: 494, boundingbox: [48, -75, 284, 935] }, \"\\xFF\" => { wx: 790, boundingbox: [56, -3, 733, 808] } }\n zapfdingbats_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 974, boundingbox: [35, 72, 939, 621] }, '\"' => { wx: 961, boundingbox: [35, 81, 927, 611] }, '#' => { wx: 974, boundingbox: [35, 72, 939, 621] }, '$' => { wx: 980, boundingbox: [35, 0, 945, 692] }, '%' => { wx: 719, boundingbox: [34, 139, 685, 566] }, '&' => { wx: 789, boundingbox: [35, -14, 755, 705] }, \"'\" => { wx: 790, boundingbox: [35, -14, 755, 705] }, '(' => { wx: 791, boundingbox: [35, -13, 761, 705] }, ')' => { wx: 690, boundingbox: [34, 138, 655, 553] }, '*' => { wx: 960, boundingbox: [35, 123, 925, 568] }, '+' => { wx: 939, boundingbox: [35, 134, 904, 559] }, ',' => { wx: 549, boundingbox: [29, -11, 516, 705] }, '-' => { wx: 855, boundingbox: [34, 59, 820, 632] }, '.' => { wx: 911, boundingbox: [35, 50, 876, 642] }, '/' => { wx: 933, boundingbox: [35, 139, 899, 550] }, '0' => { wx: 911, boundingbox: [35, 50, 876, 642] }, '1' => { wx: 945, boundingbox: [35, 139, 909, 553] }, '2' => { wx: 974, boundingbox: [35, 104, 938, 587] }, '3' => { wx: 755, boundingbox: [34, -13, 721, 705] }, '4' => { wx: 846, boundingbox: [36, -14, 811, 705] }, '5' => { wx: 762, boundingbox: [35, 0, 727, 692] }, '6' => { wx: 761, boundingbox: [35, 0, 727, 692] }, '7' => { wx: 571, boundingbox: [-1, -68, 571, 661] }, '8' => { wx: 677, boundingbox: [36, -13, 642, 705] }, '9' => { wx: 763, boundingbox: [35, 0, 728, 692] }, ':' => { wx: 760, boundingbox: [35, 0, 726, 692] }, ';' => { wx: 759, boundingbox: [35, 0, 725, 692] }, '<' => { wx: 754, boundingbox: [35, 0, 720, 692] }, '=' => { wx: 494, boundingbox: [35, 0, 460, 692] }, '>' => { wx: 552, boundingbox: [35, 0, 517, 692] }, '?' => { wx: 537, boundingbox: [35, 0, 503, 692] }, '@' => { wx: 577, boundingbox: [35, 96, 542, 596] }, 'A' => { wx: 692, boundingbox: [35, -14, 657, 705] }, 'B' => { wx: 786, boundingbox: [35, -14, 751, 705] }, 'C' => { wx: 788, boundingbox: [35, -14, 752, 705] }, 'D' => { wx: 788, boundingbox: [35, -14, 753, 705] }, 'E' => { wx: 790, boundingbox: [35, -14, 756, 705] }, 'F' => { wx: 793, boundingbox: [35, -13, 759, 705] }, 'G' => { wx: 794, boundingbox: [35, -13, 759, 705] }, 'H' => { wx: 816, boundingbox: [35, -14, 782, 705] }, 'I' => { wx: 823, boundingbox: [35, -14, 787, 705] }, 'J' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'K' => { wx: 841, boundingbox: [35, -14, 807, 705] }, 'L' => { wx: 823, boundingbox: [35, -14, 789, 705] }, 'M' => { wx: 833, boundingbox: [35, -14, 798, 705] }, 'N' => { wx: 816, boundingbox: [35, -13, 782, 705] }, 'O' => { wx: 831, boundingbox: [35, -14, 796, 705] }, 'P' => { wx: 923, boundingbox: [35, -14, 888, 705] }, 'Q' => { wx: 744, boundingbox: [35, 0, 710, 692] }, 'R' => { wx: 723, boundingbox: [35, 0, 688, 692] }, 'S' => { wx: 749, boundingbox: [35, 0, 714, 692] }, 'T' => { wx: 790, boundingbox: [34, -14, 756, 705] }, 'U' => { wx: 792, boundingbox: [35, -14, 758, 705] }, 'V' => { wx: 695, boundingbox: [35, -14, 661, 706] }, 'W' => { wx: 776, boundingbox: [35, -6, 741, 699] }, 'X' => { wx: 768, boundingbox: [35, -7, 734, 699] }, 'Y' => { wx: 792, boundingbox: [35, -14, 757, 705] }, 'Z' => { wx: 759, boundingbox: [35, 0, 725, 692] }, '[' => { wx: 707, boundingbox: [35, -13, 672, 704] }, '\\\\' => { wx: 708, boundingbox: [35, -14, 672, 705] }, ']' => { wx: 682, boundingbox: [35, -14, 647, 705] }, '^' => { wx: 701, boundingbox: [35, -14, 666, 705] }, '_' => { wx: 826, boundingbox: [35, -14, 791, 705] }, '`' => { wx: 815, boundingbox: [35, -14, 780, 705] }, 'a' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'b' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'c' => { wx: 707, boundingbox: [34, -14, 673, 705] }, 'd' => { wx: 687, boundingbox: [36, 0, 651, 692] }, 'e' => { wx: 696, boundingbox: [35, 0, 661, 691] }, 'f' => { wx: 689, boundingbox: [35, 0, 655, 692] }, 'g' => { wx: 786, boundingbox: [34, -14, 751, 705] }, 'h' => { wx: 787, boundingbox: [35, -14, 752, 705] }, 'i' => { wx: 713, boundingbox: [35, -14, 678, 705] }, 'j' => { wx: 791, boundingbox: [35, -14, 756, 705] }, 'k' => { wx: 785, boundingbox: [36, -14, 751, 705] }, 'l' => { wx: 791, boundingbox: [35, -14, 757, 705] }, 'm' => { wx: 873, boundingbox: [35, -14, 838, 705] }, 'n' => { wx: 761, boundingbox: [35, 0, 726, 692] }, 'o' => { wx: 762, boundingbox: [35, 0, 727, 692] }, 'p' => { wx: 762, boundingbox: [35, 0, 727, 692] }, 'q' => { wx: 759, boundingbox: [35, 0, 725, 692] }, 'r' => { wx: 759, boundingbox: [35, 0, 725, 692] }, 's' => { wx: 892, boundingbox: [35, 0, 858, 705] }, 't' => { wx: 892, boundingbox: [35, -14, 858, 692] }, 'u' => { wx: 788, boundingbox: [35, -14, 754, 705] }, 'v' => { wx: 784, boundingbox: [35, -14, 749, 705] }, 'w' => { wx: 438, boundingbox: [35, -14, 403, 705] }, 'x' => { wx: 138, boundingbox: [35, 0, 104, 692] }, 'y' => { wx: 277, boundingbox: [35, 0, 242, 692] }, 'z' => { wx: 415, boundingbox: [35, 0, 380, 692] }, '{' => { wx: 392, boundingbox: [35, 263, 357, 705] }, '|' => { wx: 392, boundingbox: [34, 263, 357, 705] }, '}' => { wx: 668, boundingbox: [35, 263, 633, 705] }, '~' => { wx: 668, boundingbox: [36, 263, 634, 705] }, \"\\u0080\" => { wx: 390, boundingbox: [35, -14, 356, 705] }, \"\\u0081\" => { wx: 390, boundingbox: [35, -14, 355, 705] }, \"\\u0082\" => { wx: 317, boundingbox: [35, 0, 283, 692] }, \"\\u0083\" => { wx: 317, boundingbox: [35, 0, 283, 692] }, \"\\u0084\" => { wx: 276, boundingbox: [35, 0, 242, 692] }, \"\\u0085\" => { wx: 276, boundingbox: [35, 0, 242, 692] }, \"\\u0086\" => { wx: 509, boundingbox: [35, 0, 475, 692] }, \"\\u0087\" => { wx: 509, boundingbox: [35, 0, 475, 692] }, \"\\u0088\" => { wx: 410, boundingbox: [35, 0, 375, 692] }, \"\\u0089\" => { wx: 410, boundingbox: [35, 0, 375, 692] }, \"\\u008A\" => { wx: 234, boundingbox: [35, -14, 199, 705] }, \"\\u008B\" => { wx: 234, boundingbox: [35, -14, 199, 705] }, \"\\u008C\" => { wx: 334, boundingbox: [35, 0, 299, 692] }, \"\\u008D\" => { wx: 334, boundingbox: [35, 0, 299, 692] }, \"\\u00A1\" => { wx: 732, boundingbox: [35, -143, 697, 806] }, \"\\u00A2\" => { wx: 544, boundingbox: [56, -14, 488, 706] }, \"\\u00A3\" => { wx: 544, boundingbox: [34, -14, 508, 705] }, \"\\u00A4\" => { wx: 910, boundingbox: [35, 40, 875, 651] }, \"\\u00A5\" => { wx: 667, boundingbox: [35, -14, 633, 705] }, \"\\u00A6\" => { wx: 760, boundingbox: [35, -14, 726, 705] }, \"\\u00A7\" => { wx: 760, boundingbox: [0, 121, 758, 569] }, \"\\u00A8\" => { wx: 776, boundingbox: [35, 0, 741, 705] }, \"\\u00A9\" => { wx: 595, boundingbox: [34, -14, 560, 705] }, \"\\u00AA\" => { wx: 694, boundingbox: [35, -14, 659, 705] }, \"\\u00AB\" => { wx: 626, boundingbox: [34, 0, 591, 705] }, \"\\u00AC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B4\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B5\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B6\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B7\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B8\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B9\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BA\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BB\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C4\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C5\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C6\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C7\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C8\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C9\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CA\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CB\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D4\" => { wx: 894, boundingbox: [35, 58, 860, 634] }, \"\\u00D5\" => { wx: 838, boundingbox: [35, 152, 803, 540] }, \"\\u00D6\" => { wx: 1016, boundingbox: [34, 152, 981, 540] }, \"\\u00D7\" => { wx: 458, boundingbox: [35, -127, 422, 820] }, \"\\u00D8\" => { wx: 748, boundingbox: [35, 94, 698, 597] }, \"\\u00D9\" => { wx: 924, boundingbox: [35, 140, 890, 552] }, \"\\u00DA\" => { wx: 748, boundingbox: [35, 94, 698, 597] }, \"\\u00DB\" => { wx: 918, boundingbox: [35, 166, 884, 526] }, \"\\u00DC\" => { wx: 927, boundingbox: [35, 32, 892, 660] }, \"\\u00DD\" => { wx: 928, boundingbox: [35, 129, 891, 562] }, \"\\u00DE\" => { wx: 928, boundingbox: [35, 128, 893, 563] }, \"\\u00DF\" => { wx: 834, boundingbox: [35, 155, 799, 537] }, \"\\u00E0\" => { wx: 873, boundingbox: [35, 93, 838, 599] }, \"\\u00E1\" => { wx: 828, boundingbox: [35, 104, 791, 588] }, \"\\u00E2\" => { wx: 924, boundingbox: [35, 98, 889, 594] }, \"\\u00E3\" => { wx: 924, boundingbox: [35, 98, 889, 594] }, \"\\u00E4\" => { wx: 917, boundingbox: [35, 0, 882, 692] }, \"\\u00E5\" => { wx: 930, boundingbox: [35, 84, 896, 608] }, \"\\u00E6\" => { wx: 931, boundingbox: [35, 84, 896, 608] }, \"\\u00E7\" => { wx: 463, boundingbox: [35, -99, 429, 791] }, \"\\u00E8\" => { wx: 883, boundingbox: [35, 71, 848, 623] }, \"\\u00E9\" => { wx: 836, boundingbox: [35, 44, 802, 648] }, \"\\u00EA\" => { wx: 836, boundingbox: [35, 44, 802, 648] }, \"\\u00EB\" => { wx: 867, boundingbox: [35, 101, 832, 591] }, \"\\u00EC\" => { wx: 867, boundingbox: [35, 101, 832, 591] }, \"\\u00ED\" => { wx: 696, boundingbox: [35, 44, 661, 648] }, \"\\u00EE\" => { wx: 696, boundingbox: [35, 44, 661, 648] }, \"\\u00EF\" => { wx: 874, boundingbox: [35, 77, 840, 619] }, \"\\u00F1\" => { wx: 874, boundingbox: [35, 73, 840, 615] }, \"\\u00F2\" => { wx: 760, boundingbox: [35, 0, 725, 692] }, \"\\u00F3\" => { wx: 946, boundingbox: [35, 160, 911, 533] }, \"\\u00F4\" => { wx: 771, boundingbox: [34, 37, 736, 655] }, \"\\u00F5\" => { wx: 865, boundingbox: [35, 207, 830, 481] }, \"\\u00F6\" => { wx: 771, boundingbox: [34, 37, 736, 655] }, \"\\u00F7\" => { wx: 888, boundingbox: [34, -19, 853, 712] }, \"\\u00F8\" => { wx: 967, boundingbox: [35, 124, 932, 568] }, \"\\u00F9\" => { wx: 888, boundingbox: [34, -19, 853, 712] }, \"\\u00FA\" => { wx: 831, boundingbox: [35, 113, 796, 579] }, \"\\u00FB\" => { wx: 873, boundingbox: [36, 118, 838, 578] }, \"\\u00FC\" => { wx: 927, boundingbox: [35, 150, 891, 542] }, \"\\u00FD\" => { wx: 970, boundingbox: [35, 76, 931, 616] }, \"\\u00FE\" => { wx: 918, boundingbox: [34, 99, 884, 593] } }\n # make two correlating arrays (indexes reffer to the same data), one for font names and the other for the fonts matrics.\n fonts_metrics_array = [times_metrics, times_bold_metrics, times_italic_metrics, times_bolditalic_metrics,\n helvetica_metrics, helvetica_bold_metrics, helvetica_oblique_metrics, helvetica_oblique_metrics,\n courier_metrics, courier_bold_metrics, courier_oblique_metrics, courier_boldoblique_metrics,\n symbol_metrics, zapfdingbats_metrics]\n fonts_names_array = [:\"Times-Roman\",\n :\"Times-Bold\",\n :\"Times-Italic\",\n :\"Times-BoldItalic\",\n :Helvetica,\n :\"Helvetica-Bold\",\n :\"Helvetica-BoldOblique\",\n :\"Helvetica-Oblique\",\n :Courier,\n :\"Courier-Bold\",\n :\"Courier-Oblique\",\n :\"Courier-BoldOblique\",\n :Symbol,\n :ZapfDingbats]\n\n # create the font object and register the font for each one of the 14 fonts\n fonts_names_array.each_index do |i|\n CombinePDF::Fonts.register_font fonts_names_array[i], fonts_metrics_array[i], Type: :Font, Subtype: :Type1, BaseFont: fonts_names_array[i]\n end\n end", "def require_engine\n return if defined?(::RDoc::Markup)\n require 'rubygems' # hack\n gem 'rdoc', '> 3'\n require_library 'rdoc'\n #require_library 'rdoc/markup'\n #require_library 'rdoc/markup/to_html'\n end", "def ld(lib)\n load lib.to_s + '.rb'\n end", "def boot(options={})\n Jets::Booter.boot!(options)\n end", "def use_jquerytools\n #use_jquery # required for ie bug?\n javascript_place :js_libs, 'jQuery/jquerytools-1.1.2.min', 'application_jquery'\n #@@jquery_loaded = true\n end", "def app_pods\n\t# Add pods from embedded frameworks to resolve dependency errors like: dyld Library not loaded, image not found\n shared_pods\n customViews_pods\n serverWorker_pods\n commons_pods\n\n\t# Automatically creates type-safe constants for localized text, colors, etc.\n\t# https://github.com/mac-cain13/R.swift\n # License: MIT\n\tpod 'R.swift'\n\n\t# A strong typed folder path structure to replace NSSearchPathForDirectoriesInDomains.\n\t# https://github.com/dreymonde/AppFolder\n # License: MIT\n\tpod 'AppFolder'\n\n\t# A collection of operators and utilities that simplify iOS layout code. Used to create view constraints in code.\n\t# https://github.com/Raizlabs/Anchorage\n # License: MIT\n\tpod 'Anchorage'\n\n\t# Reactive programming in swift and cocoa.\n\t# https://github.com/ReactiveX/RxSwift\n # License: MIT\n\tpod 'RxSwift'\n\tpod 'RxCocoa'\nend" ]
[ "0.72636074", "0.7177546", "0.65676486", "0.5915895", "0.5732897", "0.5659674", "0.55819476", "0.5578892", "0.5544047", "0.5476818", "0.5441917", "0.5438415", "0.53864264", "0.532199", "0.5143635", "0.5131231", "0.511447", "0.5024887", "0.49879977", "0.49680218", "0.4966454", "0.49547473", "0.49537194", "0.49467835", "0.49370953", "0.49345836", "0.4932852", "0.49275136", "0.49273106", "0.48733988", "0.48540738", "0.4838706", "0.48340112", "0.48159644", "0.47850925", "0.47747725", "0.47605455", "0.4736456", "0.4727553", "0.4724117", "0.4724117", "0.47203076", "0.47158542", "0.47107303", "0.47105324", "0.46985337", "0.46324745", "0.46324745", "0.46302778", "0.46292612", "0.4623186", "0.46164057", "0.46162984", "0.46082708", "0.46080646", "0.4605759", "0.46048573", "0.45993167", "0.45975578", "0.45758414", "0.45758414", "0.45724103", "0.45625383", "0.45544446", "0.45522165", "0.45485735", "0.4546579", "0.4543932", "0.45350173", "0.45276675", "0.45139518", "0.45115772", "0.44991508", "0.44959798", "0.4492502", "0.4492246", "0.448875", "0.4482665", "0.44805554", "0.4472816", "0.44606808", "0.44595337", "0.44564712", "0.44530886", "0.4449377", "0.44440928", "0.44419065", "0.44403344", "0.44391075", "0.44331744", "0.4429495", "0.4412664", "0.44126108", "0.44065505", "0.44050974", "0.44046414", "0.440162", "0.44009545", "0.43996787", "0.43922877" ]
0.717555
2
Convert hex to base64
def challenge1(s) Utils::Base64.encode(s.dup.extend(Utils::HexString).to_ascii) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_to_base64(s)\n [[s].pack(\"H*\")].pack('m*')\nend", "def hex_to_bin_to_base64(hex_encoded_string)\n bin = Lib.hex_to_bin(hex_encoded_string)\n Lib.bin_to_base64([bin])\nend", "def hex_to_64(str)\n decoded_hex = hex_to_ascii(str) \n Base64.strict_encode64 decoded_hex\n end", "def hex_base64_convert(s)\n [[s].pack(\"H*\")].pack(\"M*\")\nend", "def conversion(inhex)\n hex = inhex\n binary = hex.scan(/../).map { |x| x.hex.chr }.join\n b64 = [binary].pack(\"m0\")\n b64.delete '=' #Trim padding for standard\nend", "def my_convert_hex_to_b64\n Hex.new(INPUT_C1).to(B64) == EXPECTED_OUTPUT_C1\nend", "def to_base64\n base64 = [to_s].pack('m').delete(\"\\n\")\n base64.gsub!('/', '~')\n base64.gsub!('+', '-')\n base64\n end", "def bin_to_base64(bin)\nreturn bin.scan(/....../).map { |x| $BASE64[x.to_i(2)] }.join\nend", "def base64digest\n DigestUtils.pack_base64digest(digest)\n end", "def pack_base64digest(bin)\n [bin].pack('m0')\n end", "def pack_base64digest(bin)\n [bin].pack('m0')\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end", "def encode64(bin)\n [bin].pack(\"m\")\n end", "def encode64(bin)\n [bin].pack(\"m\")\n end", "def base64(digits)\n string(BASE64_DIGITS, digits)\n end", "def base64(stuff)\n Base64.encode64(stuff).delete(\"\\n\")\n end", "def convert_to_base64(csv)\n Base64.encode64(csv)\n end", "def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # deallocate string\n result\n end", "def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end", "def raw_to_base_64(byte_array)\n return \"\" if byte_array == []\n ((3 - (byte_array.length % 3)) % 3).times { byte_array << 0 }\n c1 = BASE_64_CHARS[byte_array[0] >> 2]\n c2 = BASE_64_CHARS[(byte_array[0] % 4) * 16 + (byte_array[1] >> 4)]\n c3 = BASE_64_CHARS[(byte_array[1] % 16) * 4 + (byte_array[2] >> 6)]\n c4 = BASE_64_CHARS[byte_array[2] % 64]\n c1 + c2 + c3 + c4 + raw_to_base_64(byte_array[3..-1])\nend", "def to_base64\n Base64.strict_encode64 to_escp\n end", "def urlsafe_encode64(bin)\n strict_encode64(bin).tr(\"+/\", \"-_\")\n end", "def base64_encode\n [self].pack('m').chop\n end", "def b64_e(data)\n Base64.encode64(data).chomp\n end", "def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end", "def pack_urlsafe_base64digest(bin)\n str = pack_base64digest(bin)\n str.tr!('+/'.freeze, '-_'.freeze)\n str.tr!('='.freeze, ''.freeze)\n str\n end", "def to_hexstr\n Common.unpackbytes(to_s)\n end", "def encode_base64(text)\n Base64.strict_encode64(text).strip\n end", "def to_base64\n [self].pack(\"m\")\n end", "def base64(text, charset=\"iso-2022-jp\", convert=true)\n if convert\n if charset == \"iso-2022-jp\"\n text = NKF.nkf('-j -m0', text)\n end\n end\n text = [text].pack('m').delete(\"\\r\\n\")\n \"=?#{charset}?B?#{text}?=\"\n end", "def base64(value)\n {\"Fn::Base64\" => value}\n end", "def hex2str(hex)\n [hex].pack('H*')\n end", "def from_hex(str)\n str.to_s.hex\nend", "def encode_base64\n [self].pack(\"m*\")\n end", "def encode_hex_to_nsdata(hex)\n ascii = convert_hex_to_ascii(hex)\n data = NSData.alloc.initWithBytes_length_(ascii, ascii.length) \n end", "def b64encode(bin, len = 60)\n encode64(bin).scan(/.{1,#{len}}/o) do\n print $&, \"\\n\"\n end\n end", "def hex_to_chars(hex_string)\n hex_to_bytes(hex_string).map(&:chr).join\nend", "def strict_encode64(bin)\n return Base64.strict_encode64(bin) if Base64.respond_to? :strict_encode64\n Base64.encode64(bin).tr(\"\\n\",'')\n end", "def strict_encode64(bin)\n [bin].pack(\"m0\")\n end", "def asciihex(data)\n data.chop! if data[-1,1] == \">\"\n data = data[1,data.size] if data[0,1] == \"<\"\n data.gsub!(/[^A-Fa-f0-9]/,\"\")\n data << \"0\" if data.size % 2 == 1\n data.scan(/.{2}/).map { |s| s.hex.chr }.join(\"\")\n rescue Exception => e\n # Oops, there was a problem decoding the stream\n raise MalformedPDFError, \"Error occured while decoding an ASCIIHex stream (#{e.class.to_s}: #{e.to_s})\"\n end", "def base58_encode(hex)\n @chars = %w[\n 1 2 3 4 5 6 7 8 9\n A B C D E F G H J K L M N P Q R S T U V W X Y Z\n a b c d e f g h i j k m n o p q r s t u v w x y z\n]\n @base = @chars.length\n\n i = hex.to_i(16)\n buffer = String.new\n\n while i > 0\n remainder = i % @base\n i = i / @base\n buffer = @chars[remainder] + buffer\n end\n\n #! Is it just the 00, or does 05 get converted to 3, etc.\n # add '1's to the start based on number of leading bytes of zeros\n leading_zero_bytes = (hex.match(/^([0]+)/) ? $1 : '').size / 2\n\n (\"1\"*leading_zero_bytes) + buffer\n end", "def encode64\n Base64.strict_encode64(compress)\n end", "def b64d(input)\n if input\n return helpers.base64Decode(input)\n end\n return \"\".to_java_bytes\n end", "def hex_to_string(hex)\n \ttemp = hex.gsub(\"\\s\", \"\");\n ret = []\n (0...temp.size()/2).each{|index| ret[index] = [temp[index*2, 2]].pack(\"H2\")}\n file = String.new\n ret.each { |x| file << x}\n file \n end", "def encode(str)\n @base64 = Base64.encode64(str)\n end", "def hex_encode(bin_str)\n bin_str.reverse.scan(/.{1,4}/).map{ |chunk|\n chunk.reverse.to_i(2).to_s(16)\n }.reverse.join.scan(/.{8}|.{4}|.{2}/).map{ |hex|\n hex.prepend('0x')\n }\n end", "def hex(string)\n Digest::SHA1.hexdigest(string)\n end", "def encode_str(str)\n require \"base64\"\n encoded_str=Base64.encode64(str)\n return encoded_str\nend", "def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend", "def hex_to_bin(hex)\nreturn hex.hex.to_s(2).rjust(hex.length * 4, '0')\nend", "def checksum64(io)\n Base64.encode64([checksum(io)].pack(\"H*\")).strip\n end", "def base64\n content = storage.read(id)\n base64 = Base64.encode64(content)\n base64.chomp\n end", "def base64_encode\n Base64.encode64(file_contents)\n end", "def bin2hex(string)\n string.unpack(\"H*\").join\nend", "def hex() end", "def encode\n ::Base64.encode64(@string)\n end", "def encode(value)\n Base64.encode64 value\n end", "def base64_decode\n unpack('m').first\n end", "def b64_encode(string)\n Base64.encode64(string).tr(\"\\n=\",'')\n end", "def as_hex\n raise NotImplementedError\n end", "def hex2string(str)\n i = 0; res = \"\"\n while i < str.length do\n res.concat(str.slice(i,2).hex.chr)\n i+=2\n end\n res\n end", "def encode_bytes(raw_bytes)\n Base64.urlsafe_encode64(raw_bytes)\n end", "def to_hexified_s\n to_binary_s.scan(/../).join(\" \")\n end", "def to_base64\n\t\treturn Base64.encode64(self)\n\tend", "def sha1_base64\n str = Base64.encode64(Digest::SHA1.digest(salted_name)).strip\n str.tr('+/', '-_').gsub(/=/,'')\n end", "def coda(x=@s)\n xb = Base64\n # => module\n enc = xb.encode64(x)\n # descodeia\n plain = xb.decode64(enc)\n # retorna\n return plain\n end", "def strhex(str)\n hex_chars = \"0123456789ABCDEF\"\n msg_size = str.size\n\n result = \"\"\n str.each_byte do |num|\n i1 = num >> 4\n i2 = num & 15\n result << hex_chars[i1]\n result << hex_chars[i2]\n end\n result\n end", "def e64(s)\n return unless s\n CGI.escape Base64.encode64(s)\n end", "def ascii_s(hex_s)\n [hex_s].pack('H*')\nend", "def encode64( png )\n return Base64.encode64(png)\n end", "def strhex(str)\n hex_chars = \"0123456789ABCDEF\"\n msg_size = str.size\n\n result = \"\"\n str.each_byte do |num|\n i1 = num >> 4\n i2 = num & 15\n result << hex_chars[i1]\n result << hex_chars[i2]\n end\n result\n end", "def to_binary(input)\n binary = []\n input.each_char do |char|\n result = char.hex.to_s(2).rjust(char.size*4, '0')\n binary << result\n end\n binary.join()\nend", "def decode_hex(hexewkb)\r\n result=\"\"\r\n num_bytes = (hexewkb.size + 1) / 2\r\n 0.upto(num_bytes-1) do |i|\r\n result << hexewkb[i*2,2].hex\r\n end\r\n result\r\n end", "def in_hex\n Bases.val(self).in_hex\n end", "def to_binary\n res = \"\"\n temp = self.gsub(/[^[:xdigit:]]/, \"\")\n temp.scan(/../).each {|blk| res << blk.hex.chr }\n return res\n end", "def six_bits_to_b64(bits)\n b64=\"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\n b64[bits.reverse.to_i(2)]\n end", "def postgres_base64_data(data)\n [data].pack(\"m*\").gsub(/\\r?\\n/,\"\")\n end", "def encoding(id, secret)\n #chercher a quoi correspond la methode .strict\n #.strict_encode64 sert a crypter les données dans un type particulier\n #appelé Base64\n #mettre un 'Basic espace' a l'interieur de la string\n return \"Basic \" + (Base64.strict_encode64(\"#{id}:#{secret}\"))\nend", "def safe_string(str)\n b64str = Base64.strict_encode64(str)\n \"echo #{b64str} | base64 --decode\"\n end", "def hexhash\n hash.to_s(16)\n end", "def base64_encode(string)\n SSL.base64_encode(string)\n end", "def base64_encode(string)\n SSL.base64_encode(string)\n end", "def decoded\n Base64.decode64(@base64 || \"\")\n end", "def bin_to_hex(s)\r\n s.each_byte.map { |b| b.to_s(16) }.join\r\n #puts s.bin_to_hex\r\nend", "def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # it will only decode base64 where the lines are in multiples of 4, this is\n # contrary to RFC2045 which says that all characters other than the 65 used\n # are to be ignored. Currently we remove all the other characters but it \n # might be better to use it's advice to only remove line breaks and white\n # space\n self.tr(\"^A-Za-z0-9+/=\", \"\").unpack(\"m*\").first\n end", "def hexToASCII(hexStr)\n asciiOutput = \"\"\n \n i = 0\n begin\n #2-digit hix -> 1 byte of binary -> decimal -> ASCII character\n convertedChar = binToDec(hexToBin(hexStr[i..(i+1)].rjust(8, '0'))).chr\n \n asciiOutput.concat(convertedChar)\n \n i = i + 2\n end until i > hexStr.length - 1\n \n return asciiOutput\nend", "def password_encode(password)\n result = \"\"\n password = \"\\\"\" + password + \"\\\"\"\n password.length.times { |i| result+= \"#{password[i..i]}\\000\" }\n return result\n end", "def to_s\n to_hex\n end", "def binary_to_hex\n raise RuntimeError, \"Data is not valid Binary: #{self}\" unless self.is_bitstring?\n\n decimal = self.binary_to_decimal\n hex = decimal.to_s(base=16).upcase\n\n # Pad to preserve leading zeroes in bitstring.\n if self.length % 4 == 0\n hex = hex.rjust((self.length / 4), \"0\")\n end\n\n hex\n end", "def hex_digest(data)\n OpenSSL::Digest::SHA512.hexdigest(data)\n end", "def decode(value)\n Base64.decode64 value\n end", "def hexdigest\n @authenticator.unpack(\"H*\").last\n end", "def hex_str\n \"##{hex_val}\"\n end", "def bytes_to_hex(bytes)\n bytes.map { |x| \"%02X\" % x }.join\n end", "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def unpack_hexdigest(hex)\n [hex].pack('H*')\n end", "def unpack_hexdigest(hex)\n [hex].pack('H*')\n end", "def raw_encode()\n return Base64.encode64(File.read @file_path).delete(\"\\n\") if RUBY_VERSION < \"1.9.0\"\n Base64.strict_encode64(File.read @file_path)\n end", "def encode(digest)\n seed = 1\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"y\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"k\", \"l\", \"m\", \"n\", \"p\", \"r\", \"s\", \"t\", \"v\", \"z\", \"x\"]\n digest = digest.to_s.bytes.to_a\n digest_len = digest.length\n result = \"\"\n\n i = j = 0\n result[j] = \"x\";\n j += 1\n\n while true\n if i >= digest_len\n result[j] = vowels[seed % 6]\n j += 1\n result[j] = consonants[16]\n j += 1\n result[j] = vowels[seed / 6]\n j += 1\n break\n end\n\n byte1 = digest[i]\n i += 1\n result[j] = vowels[(((byte1 >> 6) & 3) + seed) % 6]\n j += 1\n result[j] = consonants[(byte1 >> 2) & 15]\n j += 1\n result[j] = vowels[((byte1 & 3) + (seed / 6)) % 6]\n j += 1\n\n if i >= digest_len\n break\n end\n\n byte2 = digest[i]\n i += 1\n result[j] = consonants[(byte2 >> 4) & 15]\n j += 1\n result[j] = \"-\"\n j += 1\n result[j] = consonants[byte2 & 15]\n j += 1\n\n seed = (seed * 5 + byte1 * 7 + byte2) % 36\n end\n\n result[j] = \"x\"\n result\n end", "def file_to_base64 (photo)\n\t\tputs [photo].pack('m0')\n\t\t#Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista\n\t\treturn [photo].pack('m0')\n\tend" ]
[ "0.7892829", "0.77233034", "0.7678519", "0.7380503", "0.72973937", "0.6983626", "0.6915366", "0.6901798", "0.68894464", "0.65773594", "0.65773594", "0.65570974", "0.6552694", "0.6552694", "0.65489215", "0.6521358", "0.65151256", "0.650481", "0.64614403", "0.64484346", "0.6448023", "0.6392208", "0.63783973", "0.63483167", "0.63234437", "0.63234437", "0.62614805", "0.6196173", "0.6174785", "0.61735016", "0.6159232", "0.61291003", "0.6126391", "0.6101606", "0.608789", "0.6082443", "0.6045137", "0.60402715", "0.60288596", "0.60208917", "0.6012745", "0.5980731", "0.5962727", "0.59610075", "0.5960731", "0.59403855", "0.5926653", "0.59249765", "0.5921446", "0.59181637", "0.5907588", "0.59050536", "0.58937496", "0.5891003", "0.587224", "0.58486265", "0.58270407", "0.5819622", "0.58078516", "0.5797702", "0.579054", "0.57880193", "0.57722044", "0.575669", "0.5739716", "0.5734009", "0.5729455", "0.57276636", "0.5725566", "0.57203317", "0.57079154", "0.57029253", "0.5702634", "0.5695337", "0.5676589", "0.5675973", "0.56709296", "0.566124", "0.5642803", "0.5630631", "0.5628869", "0.5628869", "0.5625652", "0.5625003", "0.5616255", "0.5594274", "0.55728036", "0.55686206", "0.55651706", "0.5559797", "0.5553118", "0.55507976", "0.55506045", "0.5548636", "0.554052", "0.5538888", "0.5538888", "0.55278695", "0.5521684", "0.551451" ]
0.5980409
42
Detect singlecharacter XOR (input file is comprised of hexstrings)
def challenge4(file) file.each_line.map(&:chomp).map(&method(:challenge3)).min_by(&Cryptanalysis::Frequency.method(:english_score)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookForXOR(fileName)\n cryptoLines = IO.readlines(fileName)\n \n cryptoLines.each do |c|\n breakXORCipher c.strip\n end\nend", "def singleByteXOR(hexStr, keyChar)\n #ASCII character -> 1 byte of binary (8 bit) -> 2-digit hex\n hexKeyChar = binToHex(decToBin(keyChar.ord).rjust(8, '0'))\n \n #XOR output (hex)\n xorOutput = \"\"\n \n i = 0\n begin\n #Take 2 characters of hex from input stream\n hexStrChunk = hexStr[i..(i+1)]\n \n xorOutput.concat(hex_XOR(hexStrChunk, hexKeyChar))\n \n i = i + 2\n end until i > hexStr.length - 1\n \n return xorOutput\nend", "def potential_strings_from_single_char_xor(encoded_string)\n # for all bytes...\n (0..255).map do |decoded_char|\n # Create a hex string equal in length to the target\n decoding_string = bytes_to_hex([decoded_char] * encoded_string.length)\n\n DecodedString.new(\n decoded_char,\n xor_hex(encoded_string, decoding_string)\n )\n end\nend", "def xor_cypher(str)\n # try rewrite using Array#pack 'H*' or String#unpack\n str_byte_arr = str.scan(/../).map { |h| h.to_i(16) }\n processed_buffers = []\n \n #instead of taking two arrays, take in 1\n string_xor_ascii(processed_buffers, str_byte_arr)\n find_plaintext(processed_buffers)\n end", "def xor_c\n end", "def XOR(str1,str2)\n ret =\"\"\n str1.split(//).each_with_index do |c, i|\n ret[i] = (str1[i].ord ^ str2[i].ord).chr\n end\n return ret\nend", "def breakXORCipher(cipherText)\n scoredTexts = Hash.new\n \n #Try all ASCII keys from \n for i in 32..126 do\n keyChar = i.chr\n \n possiblePlaintext = hexToASCII(singleByteXOR(cipherText.upcase, keyChar))\n scoredTexts[keyChar] = scorePlaintext(possiblePlaintext)\n \n if(scoredTexts[keyChar] == possiblePlaintext.length)\n puts cipherText\n puts possiblePlaintext \n puts keyChar + \" scored \" + scoredTexts[keyChar].to_s\n end\n end\nend", "def repeat_key_xor(text, key)\n\thex_text = text.unpack('H*').join\n\t#Unpack the key into its individual letters\n\tkey_array = key.unpack('H2H2H2')\n\tout = hex_text.scan(/../).map.with_index { |a, i| fixed_xor(a, key_array[i.modulo(3)]) }.join\nend", "def op_xor(t_sym, f_sym, num)\n chars = num.split('')\n num_of_trues = 0\n chars.each do |c|\n if c == \"1\"\n num_of_trues += 1\n end\n end\n\n if num_of_trues.to_i.even?\n return f_sym\n else\n return t_sym\n end\nend", "def hex_XOR(hex1, hex2)\n bin1 = hexToBin(hex1)\n bin2 = hexToBin(hex2)\n \n #XOR result in binary\n xorBin = \"\"\n \n for i in 0..bin1.length-1 do\n xorBitResult = bin1[i].to_i ^ bin2[i].to_i\n xorBin.concat(xorBitResult.to_s)\n end\n \n return binToHex(xorBin)\nend", "def xor(codes, string)\n Array.new([codes.size, string.size].min) { |i| codes[i] ^ string[i].ord }.map(&:chr).join\nend", "def xor_strings(str1, str2)\n decoded_and_xor = str1.hex ^ str2.hex\n decoded_and_xor.to_s(16)\n end", "def xor_hex(a, b)\n raise \"Unequal buffers passed.\" if a.length != b.length\n (a.hex ^ b.hex).to_s(16)\nend", "def xor(input)\n key = 128\n output = input.split(//).collect {|e| [e.unpack('C').first ^ (key & 0xFF)].pack('C') }.join\n output = output.split(//).collect {|e| [e.unpack('C').first ^ (key - 27 & 0xFF)].pack('C') }.join\n Base64.strict_encode64(output)\nend", "def xor_e\n end", "def is_hexword(s)\n s.match(/^[0-9a-fA-F]{8}$/) != nil\nend", "def test_odd_chars\n file = Chisel.new\n a = file.odd_chars\n assert a[2].include?(\"&amp;\")\n end", "def char_with_odd_ascii(input)\n input.select do |c|\n c.ord.odd?\n end\nend", "def xor_hex(hex1, hex2)\n s1b = hex_to_bytes(hex1)\n s2b = hex_to_bytes(hex2)\n xor_bytes(s1b, s2b)\nend", "def calculate_doublepulsar_xor_key(s)\n x = (2 * s ^ (((s & 0xff00 | (s << 16)) << 8) | (((s >> 16) | s & 0xff0000) >> 8)))\n x & 0xffffffff # this line was added just to truncate to 32 bits\n end", "def bit_xor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n return_value = BitXorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal238 = nil\n bit_and237 = nil\n bit_and239 = nil\n\n tree_for_char_literal238 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 593:5: bit_and ( '^' bit_and )*\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3918 )\n bit_and237 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and237.tree )\n end\n # at line 593:13: ( '^' bit_and )*\n while true # decision 55\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == HAT )\n alt_55 = 1\n\n end\n case alt_55\n when 1\n # at line 593:16: '^' bit_and\n char_literal238 = match( HAT, TOKENS_FOLLOWING_HAT_IN_bit_xor_3923 )\n if @state.backtracking == 0\n\n tree_for_char_literal238 = @adaptor.create_with_payload( char_literal238 )\n root_0 = @adaptor.become_root( tree_for_char_literal238, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3927 )\n bit_and239 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and239.tree )\n end\n\n else\n break # out of loop for decision 55\n end\n end # loop for decision 55\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n end\n \n return return_value\n end", "def xor_string key, str\n\tarr = str.unpack(\"C*\").each_with_index.map do |ch, i| ch^(key[i%key.length]) end\n\tarr.pack(\"C*\")\nend", "def repeating_key_xor(string, key)\n counter = 0\n encrypted = []\n string.bytes.each do |byte|\n encrypted << (byte ^ key.bytes[counter])\n \n counter = counter == 2 ? 0 : counter += 1\n end\n # binding.pry\n encrypted.map{ |i| sprintf(\"%02x\", i) }.join.strip\n end", "def xor(first, second)\n first.bytes.zip(second.bytes).map{ |(a,b)| (a ^ b).chr }.join('')\n end", "def xor_bytes(bytes1, bytes2)\n results_in_bytes = (0...bytes1.length).map { |i| bytes1[i] ^ bytes2[i] }\n bytes_to_hex(results_in_bytes)\nend", "def xor_hl\n end", "def find_hex_ciphertext_fast(possible_hex_ciphertexts)\n ciphertexts = possible_hex_ciphertexts.map do |hex_ciphertext|\n ciphertext_score = score_ciphertext_histogram(hex_to_raw(hex_ciphertext))\n Struct.new(:hex, :ciphertext_score, :plaintext)[hex_ciphertext, ciphertext_score]\n end\n\n # Searching in ciphertext_score order, return the first fully printable string\n ciphertexts.sort_by(&:ciphertext_score).reverse_each do |ciphertext|\n key = find_key(hex_to_raw(ciphertext.hex))\n ciphertext.plaintext = hex_to_raw(decrypt(ciphertext.hex, hex_key: raw_to_hex(key)))\n return ciphertext.hex if all_printable_characters?(ciphertext.plaintext)\n end\nend", "def xor_decrypt(bytes, password)\r\n decrypt = \"\"\r\n pw_index = 0 #keeps track of index to cycle password\r\n\r\n bytes.each do |i|\r\n decrypt += (i ^ password[pw_index]).to_s + \",\" #run xor operation\r\n pw_index += 1\r\n #loop over the password if it reaches its limit\r\n if pw_index > password.length - 1\r\n pw_index = 0\r\n end\r\n end\r\n #returns as a string of ascii values\r\n decrypt\r\nend", "def fixedXOR(a = 0x1c0111001f010100061a024b53535009181c, b = 0x686974207468652062756c6c277320657965)\n if a.to_s(16).length == b.to_s(16).length\n res = a ^ b\n else\n # TODO: raise error\n res = 0\n puts \"error: diff size arguments\"\n end\n res\nend", "def xor_strings(s1, s2)\r\n s1.unpack('C*').zip(s2.unpack('C*')).map { |a, b| a ^ b }.pack('C*')\r\n end", "def xor_byte_strings(s1, s2) # :doc:\n s2 = s2.dup\n size = s1.bytesize\n i = 0\n while i < size\n s2.setbyte(i, s1.getbyte(i) ^ s2.getbyte(i))\n i += 1\n end\n s2\nend", "def str_xor(s1, s2)\n if s1.length != s2.length:\n minlen = [s1, s2].map(&:length).min\n s1 = s1[0...minlen]\n s2 = s2[0...minlen]\n end\n s1.bytes.zip(s2.bytes).map{ |b1, b2| b1 ^ b2 }.map(&:chr).join\nend", "def __xor_byte(o)\n\t\treturn Buffer.__new__(@bytes.map { |b| b ^ o })\n\tend", "def hex?(c)\n return false if c.nil?\n c =~ /[a-fA-F0-9]/\n end", "def XO(str)\n if str.scan(/[xX]/).count == str.scan(/[oO]/).count\n true\n elsif str.scan(/[xXoO]/).count == 0\n true\n else\n false\n end\nend", "def decrypt_next_byte(column)\n solution = MatasanoLib::XOR.brute(column, 'ETAOIN SHRDLU,.')\n solution[:key]\nend", "def xordecrypt\n return match(@payload,@prefix,@keys,@keywords)\n end", "def addEncoded(char1, char2)\n char1 ^ char2\n end", "def xor_d8\n end", "def xor_b\n end", "def xor_a\n end", "def xor(bytes1, bytes2)\n bytes1.zip(bytes2).map { |b1, b2| b1 ^ b2 }\nend", "def xor_l\n end", "def test_exotic_char\n CheckFile @writer, @ioservice, @adlers, \n \"J'espère que ça va marcher\", \n \"J'espère que ça va marcher\".bytes.each_slice(@chunkSize).to_a.map{|a| a.pack('C*')} \n end", "def inv_xor(str1, str2)\n #result = ''\n #for i in 0..(str1.size - 1) do\n # result += mod_sub(str1[i].chr, str2[i].chr)\n #end\n #result\n\n # Probably slower than above:\n str1.split(//).zip(str2.split(//)).inject('') do |acc, ch| \n acc += mod_sub(ch.first, ch.last) \n end\n end", "def crack_xor\n key_size = (2..40).to_a\n data = Tools.get_data6\n binding.pry\n \n end", "def xor(a, b)\n\tm = \"\"\n\tif a.length > b.length\n\t\tbig = a\n\t\tsmall = b\n\telse\n\t\tbig = b\n\t\tsmall = a\n\tend\n\t#a = a.to_i(16).to_s(2) # convert to binary\n\t#b = b.to_i(16).to_s(2) # convert to binary\n\t# xor each byte individually\n\tfor i in 0...(small.length)\n\t\tm << (a[i,1].to_i(16)^b[i,1].to_i(16)).to_s(16) # append to msg string in hex\n\tend\n\t# append the rest of the bigger string\n\t#for i in small.length...big.length\n\t#\tm << big[i].chr\n\t#end\n\treturn m\nend", "def test_SimpleXor\n puts \"SUITE: test_SimpleXor\"\n\n puts \" TEST: (hex) CD enter, AB enter, xor\"\n click(\"buttonC\")\n click(\"buttonD\")\n click(\"buttonEnter\")\n click(\"buttonA\")\n click(\"buttonB\")\n click(\"buttonEnter\")\n click(\"buttonXor\")\n assertResultVal(\"line0\", (0xCD ^ 0xAB))\n\n click(\"buttonClrAll\")\n assertResultEmp(\"line0\")\n\n puts \" TEST: (hex) CD enter, AB, xor\"\n click(\"buttonC\")\n click(\"buttonD\")\n click(\"buttonEnter\")\n click(\"buttonA\")\n click(\"buttonB\")\n click(\"buttonXor\")\n assertResultVal(\"line0\", (0xCD ^ 0xAB))\n\n click(\"buttonClrAll\")\n assertResultEmp(\"line0\")\nend", "def xor_n\n value = next_byte\n xor_to_a value\n @clock += 2\n end", "def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\nend", "def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\tputs l.class\n\n res = 0\n b.each_byte do |byte| \n\t k = l.shift\n\t res |= byte ^ k\n\t puts \"#{byte}-#{k}-#{res}\"\n\tend\n\tputs res\n res == 0\n end", "def challenge8(file)\n file.each_line.map(&:chomp).to_a.max_by do |line|\n ciphertext = line.extend(Utils::HexString).to_ascii\n blocks = (0...ciphertext.length).map { |i| ciphertext[i, 16] }\n blocks.map { |s| blocks.count(s) }.max\n end\n end", "def repeats(s_hex, bytes=16)\n #puts \"Find #{bytes} byte repeats in #{s_hex}\"\n hex_digits = bytes * 2\n raw = s_hex\n (0..raw.length-(2*hex_digits-1)).step(2).each do |offset|\n (offset+hex_digits..raw.length-(2*hex_digits-1)).step(2).each do |offset2|\n #puts \"Compare #{offset}..#{offset+hex_digits-1} vs #{offset2}..#{offset2+hex_digits-1}\"\n #puts \"#{raw[offset..offset+hex_digits-1]} vs #{raw[offset+hex_digits..offset+(2*hex_digits-1)]}\"\n if raw[offset..offset+hex_digits-1] == raw[offset2..offset2+hex_digits-1]\n puts \"#{bytes} bytes match starting at offset #{offset}: #{raw[offset..offset+hex_digits-1]}\"\n return true\n end\n end\n end\n return false\nend", "def test_xor\n assert_false F ^ F, 'F ^ F'\n assert_maybe F ^ M, 'F ^ M'\n assert_true F ^ T, 'F ^ T'\n\n assert_maybe M ^ F, 'M ^ F'\n assert_maybe M ^ M, 'M ^ M'\n assert_maybe M ^ T, 'M ^ T'\n\n assert_true T ^ F, 'T ^ F'\n assert_maybe T ^ M, 'T ^ M'\n assert_false T ^ T, 'T ^ T'\n end", "def checksum\n @crc ^ @xor_mask\n end", "def decoded_string_from_hex(encoded_string)\n vals = potential_strings_from_single_char_xor(encoded_string).sort_by do |val|\n -1 * sentence_score(val.decoded_string)\n end\n\n hex_to_chars(vals[0].decoded_string)\nend", "def test_icvc13_pass_A_returns_false\r\n\t\tassert_equal(false, isbn13_checksum_valid_character?(\"A\"))\r\n\tend", "def ecb_encrypted?(cipher)\n line_parts = cipher.scan(/.{16}/)\n line_parts.detect { |e| line_parts.count(e) > 1 } ? true : false\nend", "def xor_h\n end", "def xor_d\n end", "def xor(x, y)\n\nend", "def test_check_hex_true\r\n assert_equal true, @g.check_hex('01ef')\r\n end", "def test_icvc_pass_A_returns_false\r\n\t\tassert_equal(false, isbn10_checksum_valid_character?(\"A\"))\r\n\tend", "def read_ascii_file_flat_topped_odd( file_path )\n File.open( file_path ) do |file|\n\n odd = 0\n base_q = 0\n line_q = 0\n\n file.each_line do |line|\n elements = line.split\n elements.each_with_index do |element, index|\n # puts \"element = %c, index = %d || q = %d, r = %d\" % [element, index, index*2 + odd, base_q - index]\n # cset( index*2 + odd, base_q - index, color: element.to_sym, border: nil )\n q = index*2 + odd\n r = base_q - index\n @hexes[ [ q, r ] ] = AxialHex.new( q, r, data: { color: element.to_sym } )\n end\n\n odd = ( odd.odd? ? 0 : 1 )\n\n line_q += 1\n if line_q >= 2\n line_q = 0\n base_q += 1\n end\n\n end\n end\n end", "def match_hex(line)\n\tline.scan(/\\w\\:[\\s\\w]*(#[a-f0-9]{6}|#[a-f0-9]{3})+/i)\nend", "def bit_xor(x, bits)\n bits.map{|b| x[b]}.reduce(:^)\n end", "def xor(b)\n r = []\n zip_bytes(b) { |i,j| r << (i ^ j) }\n Id.new r.length, false, r\n end", "def challenge25(ciphertext, edit_proc)\n CryptUtil.xor(ciphertext, edit_proc.call(0, \"\\x00\" * ciphertext.bytesize))\n end", "def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def xor (keynum, pt, key)\n # get the individual key from the key schedule\n k = key[keynum,4]\n if $decrypt\n # reverse the reversed key to correct it\n k = k.reverse\n # run the key through the permputation if we are in the correct step\n if $permute\n k = permute(k, $perm)\n end\n end\n # xor the key and hex\n ret = k.hex ^ pt.hex\n # turn the number back into hex\n ret = ret.to_s(16)\n # pad the number with leading 0's\n while (ret.length < 4)\n ret.prepend(\"0\")\n end\n return ret\nend", "def to_hex(s); s && s.unpack('H*').first; end", "def secure_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def find_difference(s, t)\n c = t[t.size - 1].ord\n for i in 0...t.size - 1 do \n c ^= s[i].ord\n c ^= t[i].ord\n end\n c.chr\nend", "def xor?(arg1, arg2)\r\n\r\nend", "def test_non_canonical\n verify(\n 'f8f681900001000200030005076578616d706c6503636f6d0000010001c00c0001000100014f0c00045db8d822c00c002e000100014f0c00a20001080200015180580ec93f57f38df906a8076578616d706c6503636f6d006ae1882b1536a15c44f5813671af57bf9cae0366cff2ec085d6dedfddff0c469fa827ceec953de7cc1eee634f4cf695dc2caa2074f95199a5582e51e63b336d8f091d18c0c1a307ae3f5508ec650c4085a95e54e2c2451d9fc9ae04b4e62f3d1a1689e9507c3692fb84817a70afd3e9cdf066f73cc4ac11ed080a30d2af31510b457b5c04b0002000100014f0c001401620c69616e612d73657276657273036e657400c04b0002000100014f0c00040161c0e9c04b002e000100014f0c00a2000208020001518058109f4c57f56c1906a8076578616d706c6503636f6d006d8dd0fdbd0a0b0bfe7e4306a4a001bb7a13df2faedb1702a329243c326b915191335e99e16a236de99360547efa96ec6ee547a6dcfab94b57de6f7891bcaf99a2ef5d3c72d5bc18d1bf05ff4473f527bd8f2e6621489ab531dfb6a973e37e0f0be52740a362599058b204097a04c96492e527bfca6a22338eb865b51156c2ab0e6940c10700010001000004940004c72b8735c107001c00010001e209001020010500008f00000000000000000053c0e700010001000004940004c72b8535c0e7001c00010001e209001020010500008d000000000000000000530000291000000080000000')\n end", "def file_to_hex(f)\n f.unpack('H*').first\n end", "def xor(e1, e2)\n eval_ex(e1) ^ eval_ex(e2)\n end", "def xor(a,b)\n (a | b) - (a & b)\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C#{a.bytesize}\")\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C*\")\n\n r, i = 0, -1\n b.each_byte { |v| r |= v ^ l[i+=1] }\n r == 0\n end", "def secure_compare(a, b)\n return false if a.nil? || b.nil? || a.empty? || b.empty? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def hexadecimal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 4)\n\n type = HEXADECIMAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 21:5: ( '-' )? '0x' ( 'a' .. 'f' | 'A' .. 'F' | '0' .. '9' )+\n # at line 21:5: ( '-' )?\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == ?-) \n alt_7 = 1\n end\n case alt_7\n when 1\n # at line 21:5: '-'\n match(?-)\n\n end\n match(\"0x\")\n # at file 21:15: ( 'a' .. 'f' | 'A' .. 'F' | '0' .. '9' )+\n match_count_8 = 0\n loop do\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0.between?(?0, ?9) || look_8_0.between?(?A, ?F) || look_8_0.between?(?a, ?f)) \n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line \n if @input.peek(1).between?(?0, ?9) || @input.peek(1).between?(?A, ?F) || @input.peek(1).between?(?a, ?f)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n match_count_8 > 0 and break\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 4)\n\n end", "def xor?(one, two)\n if one && two\n false\n elsif one || two\n true\n else\n false\n end\nend", "def odd_duplicates(array)\n xor = array.reduce(0, :^)\nend", "def is_isogram(string)\n #your code here\n string.downcase.chars.uniq == string.downcase.chars\nend", "def x_xor_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = x[i] ^ y[i] }\n\n @z.content = z\n end", "def first_char_with_odd_ascii_gr8ter_80(input)\n input.find do |c|\n c.ord.odd? && c.ord > 80\n end\n end", "def bitwise_not(a)\n\tresult = ''\n\ta.each_char do |val|\n\t\tif val == '1' \n\t\t\tresult.concat '0'\n\t\telse\n\t\t\tresult.concat '1'\n\t\tend\n\tend\n\treturn result\nend", "def check_password(check_char, pos_1, pos_2, password)\n (password.chars[pos_1 -1] == check_char) ^ (password.chars[pos_2 -1] == check_char) \nend", "def hex() end", "def XO(str)\n p = str.downcase\n g = p.count(\"x\")\n h = p.count(\"o\")\n (g == h ? true : false)\nend", "def secure_token_compare(a, b)\n return false if a.blank? || b.blank? || a.bytesize != b.bytesize\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack(\"C#{a.bytesize}\")\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def secure_compare(a, b)\n return false unless a.bytesize == b.bytesize\n\n l = a.unpack \"C#{a.bytesize}\"\n\n res = 0\n b.each_byte { |byte| res |= byte ^ l.shift }\n res == 0\n end", "def correct_parity?(byte)\n byte.ord.to_s(2).count('1').odd?\n end", "def complement!\n raise RuntimeError, \"Data is not valid Binary: #{self}\" unless self.is_bitstring?\n complement = \"\"\n\n self.each_byte do |char|\n complement << ((char.chr == \"0\") ? \"1\" : \"0\")\n end\n\n self.replace(complement)\n end", "def xorobfuscation(io)\n key, verification_bytes = io.read(4).unpack('vv')\n\n {\n key: key, # key (2 bytes): An unsigned integer that specifies the obfuscation key. See [MS-OFFCRYPTO], 2.3.6.2 section, the first step of initializing XOR array where it describes the generation of 16-bit XorKey value.\n verificationBytes: verification_bytes # verificationBytes (2 bytes): An unsigned integer that specifies the password verification identifier. See Password Verifier Algorithm.\n }\n end", "def break_repeat_key_xor_data(data, key_size)\n blocks = transpose_blocks(data, key_size)\n\n # Solve each block as if it was single-character XOR. For each block, the\n # single-byte XOR key that produces the best looking histogram is the\n # repeating-key XOR key byte for that block. Put them together and you have\n # the key.\n key = blocks.map do |idx, block|\n best_result = single_byte_xor_cipher(encode_hex(block))[0]\n key_part = best_result[0]\n [idx, key_part]\n end.\n sort_by{ |i| i[0] }.\n map{ |i| i[1].chr }.\n join(\"\")\n\n puts \"Probable key: '#{key}'\"\n key\nend" ]
[ "0.74655145", "0.71622455", "0.7069354", "0.6729107", "0.64458436", "0.6351249", "0.63330376", "0.6314325", "0.62621135", "0.6259225", "0.6197536", "0.61805004", "0.61482364", "0.6147524", "0.60609925", "0.59599817", "0.5952924", "0.59441954", "0.59263295", "0.59152", "0.5906394", "0.5905513", "0.5889839", "0.5886477", "0.58544827", "0.5852518", "0.5824088", "0.57972515", "0.576535", "0.57529616", "0.5733246", "0.56879413", "0.5686219", "0.56712925", "0.56171775", "0.5600071", "0.55812144", "0.55714464", "0.5548451", "0.5545816", "0.55401486", "0.5522468", "0.551011", "0.55095166", "0.5489723", "0.54838175", "0.54753125", "0.54637426", "0.54495394", "0.5444008", "0.5442429", "0.54384625", "0.5432456", "0.5427608", "0.54037267", "0.5394784", "0.53679305", "0.53599274", "0.53533953", "0.5350511", "0.5347889", "0.5328202", "0.5327987", "0.5320356", "0.531609", "0.5314646", "0.5305991", "0.5299544", "0.52748054", "0.52742547", "0.5272685", "0.52502257", "0.52434415", "0.5238145", "0.52260363", "0.5224975", "0.5219864", "0.5216893", "0.52146894", "0.5211482", "0.519142", "0.5190373", "0.51844823", "0.5175358", "0.5173797", "0.5163933", "0.5153197", "0.5150812", "0.5149809", "0.51438385", "0.51358455", "0.51346475", "0.5134266", "0.51322955", "0.51318586", "0.51248974", "0.5124477", "0.5111999", "0.51089", "0.51024073", "0.5094422" ]
0.0
-1
Implement repeatingkey XOR (input is ASCII and output is a hexstring)
def challenge5(s, k) Utils::HexString.from_bytes(CryptUtil.xor(s.bytes, k)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat_key_xor(text, key)\n\thex_text = text.unpack('H*').join\n\t#Unpack the key into its individual letters\n\tkey_array = key.unpack('H2H2H2')\n\tout = hex_text.scan(/../).map.with_index { |a, i| fixed_xor(a, key_array[i.modulo(3)]) }.join\nend", "def repeating_key_xor(string, key)\n counter = 0\n encrypted = []\n string.bytes.each do |byte|\n encrypted << (byte ^ key.bytes[counter])\n \n counter = counter == 2 ? 0 : counter += 1\n end\n # binding.pry\n encrypted.map{ |i| sprintf(\"%02x\", i) }.join.strip\n end", "def singleByteXOR(hexStr, keyChar)\n #ASCII character -> 1 byte of binary (8 bit) -> 2-digit hex\n hexKeyChar = binToHex(decToBin(keyChar.ord).rjust(8, '0'))\n \n #XOR output (hex)\n xorOutput = \"\"\n \n i = 0\n begin\n #Take 2 characters of hex from input stream\n hexStrChunk = hexStr[i..(i+1)]\n \n xorOutput.concat(hex_XOR(hexStrChunk, hexKeyChar))\n \n i = i + 2\n end until i > hexStr.length - 1\n \n return xorOutput\nend", "def xor(input)\n key = 128\n output = input.split(//).collect {|e| [e.unpack('C').first ^ (key & 0xFF)].pack('C') }.join\n output = output.split(//).collect {|e| [e.unpack('C').first ^ (key - 27 & 0xFF)].pack('C') }.join\n Base64.strict_encode64(output)\nend", "def xor_string key, str\n\tarr = str.unpack(\"C*\").each_with_index.map do |ch, i| ch^(key[i%key.length]) end\n\tarr.pack(\"C*\")\nend", "def xor_c\n end", "def xor_hex(a, b)\n raise \"Unequal buffers passed.\" if a.length != b.length\n (a.hex ^ b.hex).to_s(16)\nend", "def xor (keynum, pt, key)\n # get the individual key from the key schedule\n k = key[keynum,4]\n if $decrypt\n # reverse the reversed key to correct it\n k = k.reverse\n # run the key through the permputation if we are in the correct step\n if $permute\n k = permute(k, $perm)\n end\n end\n # xor the key and hex\n ret = k.hex ^ pt.hex\n # turn the number back into hex\n ret = ret.to_s(16)\n # pad the number with leading 0's\n while (ret.length < 4)\n ret.prepend(\"0\")\n end\n return ret\nend", "def xor_cypher(str)\n # try rewrite using Array#pack 'H*' or String#unpack\n str_byte_arr = str.scan(/../).map { |h| h.to_i(16) }\n processed_buffers = []\n \n #instead of taking two arrays, take in 1\n string_xor_ascii(processed_buffers, str_byte_arr)\n find_plaintext(processed_buffers)\n end", "def xor(first, second)\n first.bytes.zip(second.bytes).map{ |(a,b)| (a ^ b).chr }.join('')\n end", "def xor(codes, string)\n Array.new([codes.size, string.size].min) { |i| codes[i] ^ string[i].ord }.map(&:chr).join\nend", "def potential_strings_from_single_char_xor(encoded_string)\n # for all bytes...\n (0..255).map do |decoded_char|\n # Create a hex string equal in length to the target\n decoding_string = bytes_to_hex([decoded_char] * encoded_string.length)\n\n DecodedString.new(\n decoded_char,\n xor_hex(encoded_string, decoding_string)\n )\n end\nend", "def xor_h\n end", "def calculate_doublepulsar_xor_key(s)\n x = (2 * s ^ (((s & 0xff00 | (s << 16)) << 8) | (((s >> 16) | s & 0xff0000) >> 8)))\n x & 0xffffffff # this line was added just to truncate to 32 bits\n end", "def hex_XOR(hex1, hex2)\n bin1 = hexToBin(hex1)\n bin2 = hexToBin(hex2)\n \n #XOR result in binary\n xorBin = \"\"\n \n for i in 0..bin1.length-1 do\n xorBitResult = bin1[i].to_i ^ bin2[i].to_i\n xorBin.concat(xorBitResult.to_s)\n end\n \n return binToHex(xorBin)\nend", "def XOR(str1,str2)\n ret =\"\"\n str1.split(//).each_with_index do |c, i|\n ret[i] = (str1[i].ord ^ str2[i].ord).chr\n end\n return ret\nend", "def breakXORCipher(cipherText)\n scoredTexts = Hash.new\n \n #Try all ASCII keys from \n for i in 32..126 do\n keyChar = i.chr\n \n possiblePlaintext = hexToASCII(singleByteXOR(cipherText.upcase, keyChar))\n scoredTexts[keyChar] = scorePlaintext(possiblePlaintext)\n \n if(scoredTexts[keyChar] == possiblePlaintext.length)\n puts cipherText\n puts possiblePlaintext \n puts keyChar + \" scored \" + scoredTexts[keyChar].to_s\n end\n end\nend", "def xor_strings(str1, str2)\n decoded_and_xor = str1.hex ^ str2.hex\n decoded_and_xor.to_s(16)\n end", "def xor_hex(hex1, hex2)\n s1b = hex_to_bytes(hex1)\n s2b = hex_to_bytes(hex2)\n xor_bytes(s1b, s2b)\nend", "def xor(a, b)\n\tm = \"\"\n\tif a.length > b.length\n\t\tbig = a\n\t\tsmall = b\n\telse\n\t\tbig = b\n\t\tsmall = a\n\tend\n\t#a = a.to_i(16).to_s(2) # convert to binary\n\t#b = b.to_i(16).to_s(2) # convert to binary\n\t# xor each byte individually\n\tfor i in 0...(small.length)\n\t\tm << (a[i,1].to_i(16)^b[i,1].to_i(16)).to_s(16) # append to msg string in hex\n\tend\n\t# append the rest of the bigger string\n\t#for i in small.length...big.length\n\t#\tm << big[i].chr\n\t#end\n\treturn m\nend", "def xor_a\n end", "def xor_e\n end", "def xor_d\n end", "def xor(x, y)\n\nend", "def xor_b\n end", "def xor_n\n value = next_byte\n xor_to_a value\n @clock += 2\n end", "def xor_hl\n end", "def xor_bytes(bytes1, bytes2)\n results_in_bytes = (0...bytes1.length).map { |i| bytes1[i] ^ bytes2[i] }\n bytes_to_hex(results_in_bytes)\nend", "def crack_xor\n key_size = (2..40).to_a\n data = Tools.get_data6\n binding.pry\n \n end", "def str_xor(s1, s2)\n if s1.length != s2.length:\n minlen = [s1, s2].map(&:length).min\n s1 = s1[0...minlen]\n s2 = s2[0...minlen]\n end\n s1.bytes.zip(s2.bytes).map{ |b1, b2| b1 ^ b2 }.map(&:chr).join\nend", "def xor_d8\n end", "def xor_l\n end", "def xor_decrypt(bytes, password)\r\n decrypt = \"\"\r\n pw_index = 0 #keeps track of index to cycle password\r\n\r\n bytes.each do |i|\r\n decrypt += (i ^ password[pw_index]).to_s + \",\" #run xor operation\r\n pw_index += 1\r\n #loop over the password if it reaches its limit\r\n if pw_index > password.length - 1\r\n pw_index = 0\r\n end\r\n end\r\n #returns as a string of ascii values\r\n decrypt\r\nend", "def xor_strings(s1, s2)\r\n s1.unpack('C*').zip(s2.unpack('C*')).map { |a, b| a ^ b }.pack('C*')\r\n end", "def inv_xor(str1, str2)\n #result = ''\n #for i in 0..(str1.size - 1) do\n # result += mod_sub(str1[i].chr, str2[i].chr)\n #end\n #result\n\n # Probably slower than above:\n str1.split(//).zip(str2.split(//)).inject('') do |acc, ch| \n acc += mod_sub(ch.first, ch.last) \n end\n end", "def xor_byte_strings(s1, s2) # :doc:\n s2 = s2.dup\n size = s1.bytesize\n i = 0\n while i < size\n s2.setbyte(i, s1.getbyte(i) ^ s2.getbyte(i))\n i += 1\n end\n s2\nend", "def rot(n = 1)\n mask = n.chr * (self.len / 2)\n mask = Plaintext.new(mask).hexc\n res = fixedXOR(self.hex, mask.hex)\n Hex.new(res)\n end", "def xordecrypt\n return match(@payload,@prefix,@keys,@keywords)\n end", "def encode(s)\n len = s.length\n key_repeats = len / @keylen\n extended_key = @key * key_repeats\n if len % @keylen > 0\n partial_key = len % @keylen\n extended_key += @key[0..partial_key-1]\n end\n\n return XorEncryptor.xor_hex(s, extended_key)\n # xored = s.to_i(16) ^ extended_key.to_i(16)\n # decrypt = xored.to_s(16)\n # decrypt = \"0#{decrypt}\" if decrypt.length % 2 > 0 # hacky...\n # decrypt\n end", "def fixedXOR(a = 0x1c0111001f010100061a024b53535009181c, b = 0x686974207468652062756c6c277320657965)\n if a.to_s(16).length == b.to_s(16).length\n res = a ^ b\n else\n # TODO: raise error\n res = 0\n puts \"error: diff size arguments\"\n end\n res\nend", "def op_xor(t_sym, f_sym, num)\n chars = num.split('')\n num_of_trues = 0\n chars.each do |c|\n if c == \"1\"\n num_of_trues += 1\n end\n end\n\n if num_of_trues.to_i.even?\n return f_sym\n else\n return t_sym\n end\nend", "def test_SimpleXor\n puts \"SUITE: test_SimpleXor\"\n\n puts \" TEST: (hex) CD enter, AB enter, xor\"\n click(\"buttonC\")\n click(\"buttonD\")\n click(\"buttonEnter\")\n click(\"buttonA\")\n click(\"buttonB\")\n click(\"buttonEnter\")\n click(\"buttonXor\")\n assertResultVal(\"line0\", (0xCD ^ 0xAB))\n\n click(\"buttonClrAll\")\n assertResultEmp(\"line0\")\n\n puts \" TEST: (hex) CD enter, AB, xor\"\n click(\"buttonC\")\n click(\"buttonD\")\n click(\"buttonEnter\")\n click(\"buttonA\")\n click(\"buttonB\")\n click(\"buttonXor\")\n assertResultVal(\"line0\", (0xCD ^ 0xAB))\n\n click(\"buttonClrAll\")\n assertResultEmp(\"line0\")\nend", "def challenge25(ciphertext, edit_proc)\n CryptUtil.xor(ciphertext, edit_proc.call(0, \"\\x00\" * ciphertext.bytesize))\n end", "def __xor_byte(o)\n\t\treturn Buffer.__new__(@bytes.map { |b| b ^ o })\n\tend", "def crypt(plaintext, key)\n ciphertext = String.new\n\n plaintext.chars.each_with_index do |c, i|\n ciphertext << \"%02x\" % (c.bytes[0] ^ key[i % key.length].bytes[0])\n end\n\n ciphertext\n end", "def crypt(message, key)\n repeated_key = key * ((message.length+2) / key.length)\n\n #puts message.length\n #puts repeated_key.length\n \n (0..message.length-1).map{|i|\n message[i] ^ repeated_key[i]\n }\n\nend", "def xor(bytes1, bytes2)\n bytes1.zip(bytes2).map { |b1, b2| b1 ^ b2 }\nend", "def xor(b)\n r = []\n zip_bytes(b) { |i,j| r << (i ^ j) }\n Id.new r.length, false, r\n end", "def otp(plaintext, key)\n results = pad_key normalize(plaintext), normalize(key)\n xor results.first, results.last\n end", "def xor(e1, e2)\n eval_ex(e1) ^ eval_ex(e2)\n end", "def crypt(text,key,operator = :+)\n index = 0\n text.upcase.each_byte.reduce(\"\") do |res, c|\n res << (65 + (c.send(operator, key[index % key.length].ord)) % 26).chr\n index += 1\n res\n end\nend", "def xor(a,b)\n (a | b) - (a & b)\n end", "def caesar_cipher (user_input_logic, shift_num)\n user_input_logic.pack(\"c*\")\nend", "def addEncoded(char1, char2)\n char1 ^ char2\n end", "def to_uncryp(key)\n src = self\n\n key_len = key.size\n key = 'Think Space' if key_len == 0\n key_pos = 0\n\n offset = sprintf(\"%d\", '0x' + src[0,2]).to_i\n src_pos = 2\n dest = ''\n\n begin\n src_asc = sprintf(\"%d\", '0x' + src[src_pos,2]).to_i\n tmp_src_asc = src_asc ^ key[key_pos].ord\n tmp_src_asc = tmp_src_asc <= offset ? 255 + tmp_src_asc - offset : tmp_src_asc - offset\n dest = dest + tmp_src_asc.chr\n offset = src_asc\n key_pos = key_pos < key_len - 1 ? key_pos + 1 : 0\n src_pos = src_pos + 2\n end until src_pos >= src.size\n \n dest\n end", "def xor(*args)\n args.inject(self, :^)\n end", "def break_repeat_key_xor_data(data, key_size)\n blocks = transpose_blocks(data, key_size)\n\n # Solve each block as if it was single-character XOR. For each block, the\n # single-byte XOR key that produces the best looking histogram is the\n # repeating-key XOR key byte for that block. Put them together and you have\n # the key.\n key = blocks.map do |idx, block|\n best_result = single_byte_xor_cipher(encode_hex(block))[0]\n key_part = best_result[0]\n [idx, key_part]\n end.\n sort_by{ |i| i[0] }.\n map{ |i| i[1].chr }.\n join(\"\")\n\n puts \"Probable key: '#{key}'\"\n key\nend", "def decode(numbers, key)\n result = \"\"\n numbers.each_with_index do |n, i|\n result += (n ^ key[i % 3].ord).chr\n end\n result\nend", "def x_xor_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = x[i] ^ y[i] }\n\n @z.content = z\n end", "def ctr(text, key, nonce)\n text.\n bytes.\n each_slice(16).\n map.\n with_index do |block, block_index|\n keystream = _ecb_encrypt([nonce, block_index].pack(\"QQ\"), key)\n\n block.map.with_index do |byte, byte_index|\n byte ^ keystream[byte_index].ord\n end\n end.flatten.pack(\"C*\")\n end", "def xor(left, right)\n res = Array.new\n 0.upto(3) do |i|\n temp = left[i] ^ right[i]\n res << temp\n end\n res\n end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^ other\n (self.to_s ^ other).to_sym\n end", "def bit_xor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n return_value = BitXorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal238 = nil\n bit_and237 = nil\n bit_and239 = nil\n\n tree_for_char_literal238 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 593:5: bit_and ( '^' bit_and )*\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3918 )\n bit_and237 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and237.tree )\n end\n # at line 593:13: ( '^' bit_and )*\n while true # decision 55\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == HAT )\n alt_55 = 1\n\n end\n case alt_55\n when 1\n # at line 593:16: '^' bit_and\n char_literal238 = match( HAT, TOKENS_FOLLOWING_HAT_IN_bit_xor_3923 )\n if @state.backtracking == 0\n\n tree_for_char_literal238 = @adaptor.create_with_payload( char_literal238 )\n root_0 = @adaptor.become_root( tree_for_char_literal238, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3927 )\n bit_and239 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and239.tree )\n end\n\n else\n break # out of loop for decision 55\n end\n end # loop for decision 55\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 52 )\n\n end\n \n return return_value\n end", "def xor(other)\n @bits ^ bits_from_object(other)\n end", "def caesar_cipher(str, shift)\n\nend", "def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend", "def caesar_cipher(string, shift)\nend", "def bphash( key, len=key.length )\n state = 0\n \n len.times{ |i|\n state = state << 7 ^ key[i]\n }\n return state\nend", "def vigenere_cipher(string, key_sequence)\n result = \"\"\n string.each_char.with_index do |c, idx|\n key_idx = idx % key_sequence.length\n key = key_sequence[key_idx]\n result << shift(c, key)\n end\n result\nend", "def bit_xor(x, bits)\n bits.map{|b| x[b]}.reduce(:^)\n end", "def output()\n a = 0xff & @s[0xff & (@j + @s[0xff & (@i + @s[0xff & (@z + @k)])])]\n b = 0xff & @s[0xff & (N - 1 - @i)]\n @z = a ^ b\n return @z\n end", "def encode(plaintext, key)\n cipher = key.chars.uniq + (('a'..'z').to_a - key.chars)\n ciphertext_chars = plaintext.chars.map do |char|\n (65 + cipher.find_index(char)).chr\n end\n puts ciphertext_chars.join\nend", "def bitwise_xor(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 | num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b|& = \" + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)\nend", "def decrypt_next_byte(column)\n solution = MatasanoLib::XOR.brute(column, 'ETAOIN SHRDLU,.')\n solution[:key]\nend", "def xor?(arg1, arg2)\r\n\r\nend", "def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\t\tset_logical_flags_from destination.value, destination.size\n\tend", "def crypt(p0) end", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n cycle = 0\n result = \"\"\n\n message.each_char do |char|\n result += alphabet[(alphabet.index(char) + keys[cycle % keys.length]) % alphabet.length]\n cycle += 1\n end\n\n return result\nend", "def decrypt(ciphertext, key)\n plaintext = []\n i = 0\n ciphertext.each_byte do |c|\n p = c ^ key[i % 3][0]\n i += 1\n plaintext << p.chr\n end\n return plaintext.join\nend", "def ^(obj)\n bytes1 = @value.bytes\n bytes2 = bytes(obj)\n\n bytes1, bytes2 = bytes2, bytes1 if bytes1.length < bytes2.length\n\n res = Array.new(bytes1.length) { |i| bytes1[i] ^ bytes2[i % bytes2.length] }\n res = str(res)\n res.to_raw\n end", "def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def solve_cipher(input, shift)\n\toutput = String.new\n i = 0\n while i<input.length\n \tif input[i].ord == 32\n \t\toutput[i] = input[i]\n \telse\n \tnum = input[i].ord + shift\n \toutput[i] = num.chr\n \tend\n \ti+=1\n end\n return output\nend", "def deofuscate_key\n string_source = StringDec.new(generate_shine_key)\n hex_source = HexDec.new(dark_key)\n code_decimal = []\n hex_source.array.size.times do |index|\n code_decimal << (hex_source.array[index] ^ string_source.array[index]).chr\n end\n return code_decimal.to_s\n end", "def generate_key\n begin\n multipliers = eval(self.software.multipliers)\n key = []\n self.challenge.split(\"-\").each_with_index do |word,i|\n word = word.to_i(16) # convert hex to dec\n word *= (word[0].even?) ? multipliers[i][:even] : multipliers[i][:odd]\n key << word.to_s(16).reverse[0,8].reverse # convert dec to hex, keep only 8 rightmost hex characters\n end\n self.activation_key = key.join(\"-\").upcase\n rescue\n self.activation_key = \"error!\"\n end\n end", "def xor_to_a(to_xor)\n @a ^= to_xor\n @f = 0x00\n @f |= Z_FLAG if @a == 0x00\n end", "def vigenere(key, txt)\n shift_array = key.get_shift\n count = 0\n\n txt_array = txt.split('')\n ciph=[]\n\n txt_array.each do |a|\n a = a.ord\n shift = shift_array[count % shift_array.size]\n case a\n when (64..90) \n new_char = ((a - 64 + shift) % 26) + 64 \n count += 1\n when (97..122)\n new_char = ((a- 97 + shift) % 26) + 97\n count += 1\n else \n new_char = a \n end\n ciph.push(new_char.chr)\n end\n\n ciph = ciph.join('')\n puts \"#{ciph}\"\nend", "def knot_codes(input, row)\n seed = [ 17, 31, 73, 47, 23 ]\n \"#{input}-#{row}\".each_char.map(&:ord).concat seed\nend", "def xor_mhl\n value = @mmu[hl]\n xor_to_a value\n @clock += 2\n end", "def MUX2X1(x,y) XOR(x,y); end", "def test_xor\n assert_false F ^ F, 'F ^ F'\n assert_maybe F ^ M, 'F ^ M'\n assert_true F ^ T, 'F ^ T'\n\n assert_maybe M ^ F, 'M ^ F'\n assert_maybe M ^ M, 'M ^ M'\n assert_maybe M ^ T, 'M ^ T'\n\n assert_true T ^ F, 'T ^ F'\n assert_maybe T ^ M, 'T ^ M'\n assert_false T ^ T, 'T ^ T'\n end", "def xor_missing_element array1, array2\n return nil if array1.length == 0 && array2.length == 0\n result = 0\n (array1 + array2).each do |number|\n result ^= number\n end\n return result\nend", "def vigenere_cipher(message, key)\n key_index = 0 \n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n message.each_char.with_index do|char,idx|\n new_str += alpha[(alpha.index(char) + key[key_index % key.length])%26]\n key_index += 1\n end\n new_str\nend", "def commonKey()\n\treturn \"\\xEB\\xE4\\x2A\\x22\\x5E\\x85\\x93\\xE4\\x48\\xD9\\xC5\\x45\\x73\\x81\\xAA\\xF7\"\nend", "def p1(x, y, z)\n # x or y\n xor(x, y)\nend", "def ^(o)\n\t\tcase o\n\t\twhen Integer\n\t\t\tBuffer.__assert_range(o)\n\t\t\treturn __xor_byte(o)\n\t\twhen Buffer\n\t\t\treturn __xor_buffer(o)\n\t\telse\n\t\t\traise TypeError.new\n\t\tend\n\tend" ]
[ "0.8466317", "0.81003916", "0.7928955", "0.78872114", "0.76600856", "0.75364554", "0.7451826", "0.7380779", "0.73735905", "0.732157", "0.7267711", "0.7228373", "0.7209144", "0.7194506", "0.7117138", "0.70786875", "0.70493245", "0.7047851", "0.7013655", "0.7006161", "0.6996673", "0.6970798", "0.6938351", "0.69357556", "0.68562806", "0.6840107", "0.68386596", "0.68221587", "0.6821206", "0.6773511", "0.6761104", "0.67537594", "0.6739991", "0.6735337", "0.6653164", "0.6616186", "0.6591615", "0.6575586", "0.6560322", "0.654108", "0.64791155", "0.6468813", "0.6439921", "0.64014536", "0.64008987", "0.6399563", "0.63869613", "0.6367718", "0.63479453", "0.6333784", "0.6319073", "0.62934035", "0.62665766", "0.62416774", "0.62321407", "0.62290514", "0.62227994", "0.6190632", "0.6184739", "0.61823004", "0.61706954", "0.61517656", "0.61517656", "0.61517656", "0.61517656", "0.61517656", "0.6074217", "0.6071925", "0.60718864", "0.6060193", "0.60454625", "0.60277605", "0.602306", "0.601887", "0.601118", "0.5980764", "0.59723896", "0.5967867", "0.5967292", "0.5961077", "0.5941066", "0.5939444", "0.5924803", "0.5894267", "0.58938783", "0.5887689", "0.5882454", "0.5864835", "0.5777679", "0.5773061", "0.57585585", "0.57396084", "0.5722935", "0.57139677", "0.5711078", "0.57059926", "0.5701993", "0.56988627", "0.5696407", "0.56963795" ]
0.6012667
74
AES in ECB mode (input is Base64 encoded)
def challenge7(file, key) CryptUtil.aes_128_ecb(Utils::Base64.decode(file.read), key, :decrypt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aes_ecb_internal(mode, buffer, key)\n raise 'Buffer must be composed of 16-byte chunks' unless (buffer.size % 16).zero?\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.send(mode)\n cipher.key = key.pack('C*')\n cipher.padding = 0 # decryption will otherwise fail\n result = cipher.update(buffer.pack('C*')) + cipher.final\n result.unpack('C*')\nend", "def encrypt_aes_ecb(key)\n key_str = str(key)\n msg = self.pad(16).value\n\n _encrypt_aes_ecb(msg, key_str)\n end", "def aes_encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, \"randomString\", 1024, aes.key_len)\n aes.iv = iv if iv != nil\n aes.update(data.to_s) + aes.final \n end", "def encrypt_ecb_nofinal(msg, key)\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.encrypt\n cipher.key = key\n return cipher.update(msg)\nend", "def aes_ecb_encrypt(data, key, params: {})\n key_arr = key.unpack(\"C*\")\n\n data = pad_data(data, 16)\n encrypted_data = data.unpack(\"C*\").each_slice(16).map do |slice|\n state = array_to_matrix(slice)\n encrypted_state = aes_encrypt_block(state, key_arr)\n matrix_to_array(encrypted_state).pack(\"C*\")\n end\n\n # return base64 encoded data\n [encrypted_data.join].pack(\"m\")\n end", "def do_aes(key_binary_p, iv_binary_p, input_binary_p, output_binary_p,\n response_length_p, status_p, decrypt: false)\n key = Binary.from_pointer(key_binary_p).to_s\n iv = Binary.from_pointer(iv_binary_p).to_s\n input = Binary.from_pointer(input_binary_p).to_s\n\n write_binary_string_and_set_status(output_binary_p, status_p) do\n output = Hooks.aes(key, iv, input, decrypt: decrypt)\n response_length_p.write_int(output.bytesize)\n\n output\n end\n end", "def decode_aes(str)\n unpacked_data = Base64.decode64(str).unpack(ENCODING_FORMAT)\n # Splat the data array apart\n # nonce, auth_tag, encrypted_data = unpacked_data\n CipherParams.new(*unpacked_data)\n end", "def aes_encrypt(plain_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n cipher.encrypt\n\n key = cipher.random_key\n\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n encrypted_data = cipher.update(plain_string) + cipher.final\n\n {:key => key, :data => encrypted_data}\n end", "def aes_encrypt(plain_string)\n cipher = OpenSSL::Cipher.new(ssl_cipher)\n cipher.encrypt\n\n key = cipher.random_key\n\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n encrypted_data = cipher.update(plain_string) + cipher.final\n\n {:key => key, :data => encrypted_data}\n end", "def cipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.encrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def encrypt(data)\n cipher = OpenSSL::Cipher.new(\"AES-256-CBC\")\n cipher.encrypt\n cipher.iv = @enc_iv\n cipher.key = @enc_key\n encrypted = cipher.update(data) + cipher.final\n enc = Base64.strict_encode64(encrypted)\nend", "def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend", "def encrypt_after_append(plain_text, str_64)\n str = str_64.unpack(\"m\")[0]\n aes = AES.new\n aes.aes_ecb_encrypt(plain_text + str, KEY)\nend", "def decode_aes(str)\n unpacked_data = str.unpack1(\"m\").unpack(ENCODING_FORMAT)\n # Splat the data array apart\n # nonce, auth_tag, encrypted_data = unpacked_data\n CipherParams.new(*unpacked_data)\n end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def encryption_oracle\n # From an early-on AES-128-ECB exercise. 'YELLOW SUBMARINE' is the 128-bit key.\n ciphertext = URL::decode64('http://cryptopals.com/static/challenge-data/25.txt')\n plaintext = AES_128.decrypt(ciphertext, 'YELLOW SUBMARINE', :mode => :ECB)\n\n AES_128.encrypt(plaintext, AES_KEY, :mode => :CTR)\nend", "def encode_aes(params)\n encoded = params.values.pack(ENCODING_FORMAT)\n # encode base64 and get rid of trailing newline and unnecessary =\n Base64.encode64(encoded).chomp.tr(\"=\", \"\")\n end", "def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end", "def _decode_aes256 cipher, iv, data\n aes = OpenSSL::Cipher::Cipher.new \"aes-256-#{cipher}\"\n aes.decrypt\n aes.key = @encryption_key\n aes.iv = iv\n aes.update(data) + aes.final\n end", "def encrypt_aes_cbc(key, iv)\n key_str = str(key)\n iv_str = str(iv)\n msg = self.pad(16).value\n\n _encrypt_aes_cbc(msg, key_str, iv_str)\n end", "def decryptAES128ECBblock(inputblock, keybytes)\n\tinput, key = bytearraytostring(inputblock), bytearraytostring(keybytes)\n\tdecipher = OpenSSL::Cipher::AES.new(128, 'ECB')\n\tdecipher.decrypt\n\tdecipher.key = key\n\tdecipher.padding = 0\n\treturn stringtobytearray(decipher.update(input) + decipher.final)\nend", "def encode_aes(params)\n encoded = params.values.pack(ENCODING_FORMAT)\n # encode base64 and get rid of unnecessary '=' padding\n [encoded].pack(\"m0\").tr(\"=\", \"\")\n end", "def encrypt(str)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n iv = aes.random_iv\n iv64 = Base64.urlsafe_encode64(iv)\n\n aes.encrypt\n aes.key = $key\n aes.iv = iv\n\n cipher = aes.update(str) + aes.final\n\n { :cipher => Base64.urlsafe_encode64(cipher),\n :iv => iv64 }\nend", "def aes_cts_hmac_sha1_96(algorithm, raw_secret, salt)\n iterations = 4096\n cipher = OpenSSL::Cipher::AES.new(algorithm)\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(raw_secret, salt, iterations, cipher.key_len)\n plaintext = \"kerberos\\x7B\\x9B\\x5B\\x2B\\x93\\x13\\x2B\\x93\".b\n result = ''.b\n loop do\n cipher.reset\n cipher.encrypt\n cipher.iv = \"\\x00\".b * 16\n cipher.key = key\n ciphertext = cipher.update(plaintext)\n result += ciphertext\n break unless result.size < cipher.key_len\n\n plaintext = ciphertext\n end\n result\n end", "def encrypt_value\n cipher = OpenSSL::Cipher.new(\"AES256\")\n cipher.encrypt\n cipher.key = @secret\n cipher.update(@value) + cipher.final\n end", "def encrypt(text, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.encrypt\n cipher.key = @secret[0..@cipher_block_size]\n if iv != \"\"\n cipher.iv = iv\n end\n cipher_text = cipher.update(text)\n cipher_text << cipher.final\n return Base64.encode64(cipher_text) #output in base64\n else\n return text\n end\n end", "def encrypt(\n data, key, salt, iter, iv = SecureRandom.random_bytes(16), key_length = 32\n )\n cipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n cipher.encrypt\n cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n cipher.iv = iv\n {\n data: cipher.update(data) + cipher.final,\n iv: iv\n }\n end", "def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend", "def decipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.decrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def perform(input, method)\n aes = OpenSSL::Cipher.new('AES-128-CBC')\n aes.public_send(method)\n aes.iv = @iv\n aes.key = @key\n aes.padding = 16 #PKCS7 padding\n aes.update(input) + aes.final\n end", "def build_cipher(args={})\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n args[:decrypt] ? cipher.decrypt : cipher.encrypt\n iv = args[:iv]\n until(iv.length > 65)\n iv = iv * 2\n end\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n args[:key], CRYPT_SALT, CRYPT_ITER, CRYPT_KEY_LENGTH\n )\n cipher.iv = iv\n cipher.key = key\n cipher\n end", "def aes_cbc_encrypt(buffer, key, iv)\n blocks = buffer.each_slice(key.size)\n previous_ciphertext_block = iv\n\n blocks.flat_map do |block|\n previous_ciphertext_block = aes_ecb_encrypt(\n xor_bytes(previous_ciphertext_block, block),\n key\n )\n\n previous_ciphertext_block\n end\nend", "def cipher\n aes = OpenSSL::Cipher::Cipher.new(\"aes-#{@key_size}-cbc\")\n\n case @mode\n when :encrypt\n aes.encrypt\n when :decrypt\n aes.decrypt\n else\n raise(InvalidMode,\"invalid mode #{@mode}\")\n end\n\n aes.key = @key\n aes.iv = @iv\n\n yield aes if block_given?\n return aes\n end", "def initialize(key,iv)\n \t\t\t\t@key = key\n \t\t\t\t@iv = iv\n \t\t\t\t@aes = OpenSSL::Cipher::Cipher.new('aes-256-cbc')\n \t\t\t\[email protected] = key\n \t\t\t\[email protected] = iv\n \t\t\t\[email protected]\n \t\t\t\t@block = @aes.update(iv) << @aes.final\n \t\t\t\t@index = 0\n \t\t\tend", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end", "def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend", "def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n cipher.update(crypt_string) + cipher.final\n end", "def encrypt(string)\r\n aes = cipher\r\n encrypted = aes.update(string) + aes.final\r\n Base64.encode64(encrypted)\r\n end", "def encrypt(data)\n cipher = OpenSSL::Cipher.new 'AES-256-CBC'\n cipher.encrypt\n cipher.key, cipher.iv = @password, @iv\n data.nil? ? '' : (cipher.update(data) + cipher.final).unpack('H*')[0]\n end", "def aes_decrypt(key, crypt_string)\n cipher = OpenSSL::Cipher::Cipher.new(ssl_cipher)\n\n cipher.decrypt\n cipher.key = key\n cipher.pkcs5_keyivgen(key)\n decrypted_data = cipher.update(crypt_string) + cipher.final\n end", "def decode_aes256_cbc_plain data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, data[1, 16], data[17..-1]\n end\n end", "def vigenere_cipher(string, key_sequence)\n\nend", "def aes_key_core(k, i)\n t = 0\n 0.upto(3) do |j|\n t = aes_set_byte(t, (j-1) % 4, AES_SBOX[aes_get_byte(k, j)])\n end\n aes_set_byte(t, 0, aes_get_byte(t,0) ^ AES_RCON[i])\n end", "def decode_aes256 data\n length = data.length\n length16 = length % 16\n length64 = length % 64\n\n if length == 0\n ''\n elsif length16 == 0\n decode_aes256_ecb_plain data\n elsif length64 == 0 || length64 == 24 || length64 == 44\n decode_aes256_ecb_base64 data\n elsif length16 == 1\n decode_aes256_cbc_plain data\n elsif length64 == 6 || length64 == 26 || length64 == 50\n decode_aes256_cbc_base64 data\n else\n raise RuntimeError, \"'#{data.inspect}' doesn't seem to be AES-256 encrypted\"\n end\n end", "def encrypt64(str)\n enc = ''\n while str.length > self.encrypt_block_size\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n str = str[self.encrypt_block_size+1..-1] if str.length > self.encrypt_block_size\n end\n if str.length != 0 then\n enc += self.public_encrypt(str[0..self.encrypt_block_size])\n end\n Base64.encode64(enc)\n end", "def encryption_oracle(buffer)\n prefix_padding = rand(5..10).times.map { rand(0..255) }\n suffix_padding = rand(5..10).times.map { rand(0..255) }\n padded_buffer = pkcs7_pad(prefix_padding + buffer + suffix_padding, 16)\n key = 16.times.map { rand(0..255) }\n\n if rand(2).zero?\n puts 'Encrypting with ECB...'\n aes_ecb_encrypt(padded_buffer, key)\n else\n puts 'Encrypting with CBC...'\n iv = 16.times.map { rand(0..255) }\n aes_cbc_encrypt(padded_buffer, key, iv)\n end\nend", "def cage(payload)\n Base64.encode64(encrypt(payload)).strip! + \"-\" + @request[:iv]\n end", "def decrypt_aes_ecb(key, padding: false)\n key_str = str(key)\n data = self.pad(16).value\n\n _decrypt_aes_ecb(data, key_str)\n end", "def encrypt(str)\n return str unless str.is_a?(String) && @derived_key\n return \"\" if str == \"\"\n\n cipher = OpenSSL::Cipher.new(CIPHER).encrypt\n\n # Technically, this is a \"bad\" way to do things since we could theoretically\n # get a repeat nonce, compromising the algorithm. That said, it should be safe\n # from repeats as long as we don't use this key for more than 2^32 encryptions\n # so... rotate your keys/salt ever 4 billion encryption calls\n nonce = cipher.random_iv\n cipher.key = @derived_key\n cipher.auth_data = \"\"\n\n # Make sure the string is encoded as UTF-8. JSON/YAML only support string types\n # anyways, so if you passed in binary data, it was gonna fail anyways. This ensures\n # that we can easily decode the string later. If you have UTF-16 or something, deal with it.\n utf8_str = str.encode(Encoding::UTF_8)\n encrypted_data = cipher.update(utf8_str) + cipher.final\n auth_tag = cipher.auth_tag\n\n params = CipherParams.new(nonce, auth_tag, encrypted_data)\n\n encode_aes(params).prepend(ENCRYPTED_PREFIX)\n end", "def encrypt; end", "def encrypt(plaintext, passwd, options = {})\n cipher = new_cipher(:encrypt, passwd, options)\n cipher.iv = iv = cipher.random_iv\n ciphertext = cipher.update(plaintext)\n ciphertext << cipher.final\n Base64.encode64(combine_iv_and_ciphertext(iv, ciphertext))\n end", "def encrypt_message(message)\n aes = OpenSSL::Cipher.new(@cipher).encrypt\n aes.key = @encryption_key\n iv = aes.random_iv\n aes.iv = iv\n iv + (aes.update(message) << aes.final)\n end", "def encrypt(str)\n return str unless str.is_a?(String)\n return \"\" if str == \"\"\n\n cipher = OpenSSL::Cipher.new(CIPHER).encrypt\n\n # Technically, this is a \"bad\" way to do things since we could theoretically\n # get a repeat nonce, compromising the algorithm. That said, it should be safe\n # from repeats as long as we don't use this key for more than 2^32 encryptions\n # so... rotate your keys/salt ever 4 billion encryption calls\n nonce = cipher.random_iv\n cipher.key = @derived_key\n cipher.auth_data = \"\"\n\n # Make sure the string is encoded as UTF-8. JSON/YAML only support string types\n # anyways, so if you passed in binary data, it was gonna fail anyways. This ensures\n # that we can easily decode the string later. If you have UTF-16 or something, deal with it.\n utf8_str = str.encode(Encoding::UTF_8)\n encrypted_data = cipher.update(utf8_str) + cipher.final\n auth_tag = cipher.auth_tag\n\n params = CipherParams.new(nonce, auth_tag, encrypted_data)\n\n encode_aes(params).prepend(ENCRYPTED_PREFIX)\n end", "def decrypt(bin64, iv64)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n aes.decrypt\n aes.key = $key\n aes.iv = Base64.urlsafe_decode64(iv64)\n aes.update(Base64.urlsafe_decode64(bin64)) + aes.final\nend", "def encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def decrypt(base64_encrypted_data,key,base64_init_vector,ciper='aes-128-cbc')\n SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(:key => key,:iv => Base64.urlsafe_decode64(base64_init_vector), :cipher => ciper )\n SymmetricEncryption.decrypt(Base64.urlsafe_decode64(base64_encrypted_data))\n end", "def AES256_ctr key, iv\n cipher = OpenSSL::Cipher::AES.new(256, :ECB)\n cipher.encrypt\n cipher.padding = 0\n cipher.key = key[..31].map(&:chr).join\n\n counter = iv[..15]\n f = Fiber.new do\n loop do\n enc = cipher.update(counter.map(&:chr).join)\n enc.bytes.each {|b| Fiber.yield b}\n counter.increment\n end\n end\n\n Enumerator.produce {f.resume}\nend", "def encrypt_data(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def decrypt data, key, salt, iter, iv, key_length = 32\n decipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n decipher.decrypt\n decipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n decipher.iv = iv\n decipher.update(data) + decipher.final\n end", "def encrypt(value)\n Base64.encode64 escape_and_execute_sql(\n [\"SELECT AES_ENCRYPT(?, ?)\", value, key]).first\n end", "def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end", "def encrypt_prepend_append(plain_txt, target_bytes64)\n AES.new.aes_ecb_encrypt(\n RANDOM_PLAIN_TXT + plain_txt + target_bytes64.unpack(\"m\")[0],\n KEY\n )\nend", "def decryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_ret = \"\"\r\n\t\t([email protected]()/2).each{|index| _ret += [@data[index*2, 2]].pack(\"H2\")}\t\t\r\n\t\t_rt = Encryptor.decrypt(_ret)\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def encrypt(msg, key)\n Rails.logger.debug \"AesEncryptDecrypt::encrypt::BEGIN\"\n begin\n cipher = OpenSSL::Cipher.new(ALGORITHM)\n cipher.encrypt()\n cipher.padding = 1\n cipher.key = key\n crypt = cipher.update(msg) + cipher.final\n return (Base64.encode64(crypt))\n rescue Exception => exc\n Rails.logger.error (\"Error when encrypting message #{msg} is #{exc.message}\")\n raise exc\n end\n end", "def decrypt(base64_string)\r\n encrypted = Base64.decode64(base64_string)\r\n aes = decipher\r\n aes.update(encrypted) + aes.final\r\n end", "def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'aes256')\n when \"Blowfish\" then key =EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'blowfish')\n when 'Plaintext' then return string\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256') \n end\n encrypted_text = key.encrypt64(string)\n rescue => e\n p e.message\n end\n return encrypted_text\n \n end", "def encryption_oracle(message)\n rand_key = SecureRandom.random_bytes(16)\n rand_iv = SecureRandom.random_bytes(16)\n front_bytes = SecureRandom.random_bytes(rand(5..10))\n end_bytes = SecureRandom.random_bytes(rand(5..10))\n\n padded_message = front_bytes + message + end_bytes\n\n (rand(1..2) == 1) ? encrypt_ecb(message, rand_key) : encrypt_cbc(message, rand_key, rand_iv)\nend", "def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend", "def static_key_ecb(message)\n unknown = \"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK\"\n udecoded = Base64.decode64(unknown)\n\n message_appended = message + udecoded\n message_appended = pkcs7_pad(message_appended, 16)\n\n cipher = encrypt_ecb(message_appended, STATIC_KEY)\nend", "def combine_iv_ciphertext(iv, message)\n message.force_encoding('BINARY') if message.respond_to?(:force_encoding)\n iv.force_encoding('BINARY') if iv.respond_to?(:force_encoding)\n iv + message\n end", "def encrypt_string(plaintext, key, iv, auth_data = '')\n cipher = OpenSSL::Cipher.new(CIPHER_TYPE)\n cipher.encrypt\n cipher.key = key\n cipher.iv = iv[0, IV_LENGTH]\n cipher.auth_data = auth_data\n\n encrypted = cipher.update(plaintext) + cipher.final\n [encrypted, cipher.auth_tag]\n end", "def urlsafe_base64_symmetric_encrypt(data, key, iv)\n raise 'Initialization Vector must have 16 hexadecimal characters.' unless iv.length == 16\n raise 'Key must have 16 hexadecimal characters.' unless key.length == 16\n\n bin_iv = [iv].pack('H*')\n raise 'Initialization Vector is not valid, must contain only hexadecimal characters.' if bin_iv.empty?\n\n # Appends first 8 Bytes to Key\n key += key.byteslice(0,8)\n\n # Create Cipher\n cipher = OpenSSL::Cipher.new(CIPHER_ALGORITHM)\n # Initialize cipher mode\n cipher.encrypt\n # Set initialization vector\n cipher.iv = bin_iv\n # Set key\n cipher.key = key\n\n # Encrypt data\n encrypted_data = cipher.update(data) + cipher.final\n # Encode data\n custom_base64_urlsafe_encode(encrypted_data)\n end", "def decrypt encrypted_data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final \n end", "def decrypt(str)\n str = str.unpack('m0').first\n aes = OpenSSL::Cipher::Cipher.new('aes-128-cbc').decrypt\n aes.key = @secret\n iv = str[0, aes.iv_len]\n aes.iv = iv\n crypted_text = str[aes.iv_len..-1]\n return nil if crypted_text.nil? || iv.nil?\n aes.update(crypted_text) << aes.final\n rescue\n nil\n end", "def aes_ecb?(duplicate_count: 2)\n guess_ecb(@value, duplicate_count: duplicate_count)\n end", "def combine_iv_and_ciphertext(iv, message)\n message.force_encoding('BINARY') if message.respond_to?(:force_encoding)\n iv.force_encoding('BINARY') if iv.respond_to?(:force_encoding)\n iv + message\n end", "def get_cipher\n OpenSSL::Cipher::Cipher.new('AES-256-CBC')\n end", "def base_encrypt(plaintext)\n simple_box = RbNaCl::SimpleBox.from_secret_key(key)\n simple_box.encrypt(plaintext)\n end", "def decrypt(text64, iv)\n if @cipher\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-#{@cipher}-cbc\")\n cipher.decrypt\n cipher.key = @secret[0..cipher_block_size]\n if iv != \"\"\n cipher.iv = Base64.decode64(iv)\n end\n decrypted_text = cipher.update(Base64.decode64(text64))\n decrypted_text << cipher.final\n return decrypted_text\n else\n return text64\n end\n end", "def encryptCBC(plaintext, key, iv, padding: false)\r\n\t\t## split the text into chunks of block size\r\n\t\tblock_size = 16\r\n\t\tblocks = plaintext.chars.each_slice(block_size).to_a.map{|v| v.join.to_s}\r\n\r\n\r\n\t\tciphertext = String.new\r\n\t\tvector = iv\r\n\t\tblocks.each do |block|\r\n\t\t\txor = block^vector\r\n\t\t\tvector = encryptECB(xor, key, padding: false)\r\n\t\t\tciphertext += vector\r\n\t\tend\r\n\r\n\t\tciphertext\r\n\tend", "def decrypt; end", "def iv(format=:plain)\n iv = ::AES::AES.new(\"\").random_iv\n case format\n when :base_64\n Base64.encode64(iv).chomp\n else\n iv\n end \n end", "def ez_encrypt64(worker = :default)\n _ez_encrypt64(self, worker)\n end", "def encode(string: String)\n\n salt = SecureRandom.random_bytes(8)\n\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n cipher.encrypt\n cipher.pkcs5_keyivgen(@password, salt, 1, \"MD5\")\n data = \"Salted__\" + salt + cipher.update(string) + cipher.final\n\n Base64.encode64(data)\n end", "def cipher(cipher_mode, data)\n expect! cipher_mode => [ :decrypt, :encrypt ]\n\n case cipher_mode\n when :decrypt\n expect! data => /^envy:/\n cipher_op(:decrypt, data: Base64.decode64(data[5..-1]))\n when :encrypt\n \"envy:\" + Base64.strict_encode64(cipher_op(:encrypt, data: data))\n end\n end", "def encrypt(x)\n @aes_key.encrypt(x)\n end", "def encrypt_string(clear_text)\n enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n enc.encrypt(RAM_SALT)\n data = enc.update(clear_text)\n Base64.encode64(data << enc.final)\n end", "def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end", "def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end", "def base_encrypt(plaintext)\n RbNaCl::SimpleBox\n .from_secret_key(key)\n .encrypt(plaintext)\n end", "def encript(text_to_encript)\n require 'base64'\n Base64.encode64(text_to_encript)\n\nend", "def aes_ctr_ciphers\n data = File.readlines(\"./data/19-data.txt\").map{ |line| line.unpack(\"m\")[0]}\n aes = AES.new\n key = random_str(16)\n\n data.map do |line|\n aes.aes_ctr_encrypt(line, key)\n end\nend", "def encrypt(key, state)\n raise unless key.size == 16\n raise unless state.size == 16\n\n key = expand_key(key)\n\n round_key = key[0, 16]\n state = AES.add_round_key(state, round_key)\n\n (1..9).each do |i|\n round_key = key[16*i, 16]\n state = AES.sub_bytes(state)\n state = AES.shift_rows(state)\n state = AES.mix_columns(state)\n state = AES.add_round_key(state, round_key)\n end\n\n round_key = key[16*10, 16]\n state = AES.sub_bytes(state)\n state = AES.shift_rows(state)\n state = AES.add_round_key(state, round_key)\n end", "def decrypt( string, pass, salt)\n key, iv = derive_key_iv( pass, salt)\n \n decipher = OpenSSL::Cipher::AES.new(256, :CBC)\n decipher.decrypt\n decipher.key = key\n decipher.iv = iv\n\n decipher.update( string) + decipher.final\n end", "def decrypt_aes_cbc(key, iv, padding: false)\n key_str = str(key)\n iv_str = str(iv)\n data = self.pad(16).value\n\n _decrypt_aes_cbc(data, key_str, iv_str)\n end", "def base_decrypt(ciphertext)\n RbNaCl::SimpleBox\n .from_secret_key(key)\n .decrypt(ciphertext)\n .force_encoding(Encoding::UTF_8)\n end", "def initialize\n @edit_distance = 3\n @cipher_spec = \"AES-256-CBC\"\n @padding_byte_size = 32\n end", "def to_encrypted\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.encrypt\n cipher.key = @passphrase\n cipher.iv = @iv\n encrypted = cipher.update(to_expiring_json)\n encrypted << cipher.final\n encrypted\n end", "def encryption_oracle(data)\n # prepend and append some random chars to the data\n # (why are we doing this?)\n pre = rand(6)+5\n post = rand(6)+5\n plain_text = data\n plain_text.prepend( (1..pre).map {rand(256).chr}.join )\n plain_text.concat( (1..post).map {rand(256).chr}.join )\n plain_text = CBCEncryptor.pad(plain_text, KEYSIZE)\n\n key = (1..16).map {rand(256).chr}.join\n\n if rand(2) > 0\n puts \"[Oracle using ECB]\"\n ecb = ECBEncryptor.new(key)\n ecb.encrypt(plain_text)\n else\n puts \"[Oracle using CBC]\"\n iv = (1..16).map {rand(256).chr}.join\n cbc = CBCEncryptor.new(key)\n cbc.encrypt(plain_text, iv)\n end\nend" ]
[ "0.77014667", "0.71870446", "0.70953625", "0.7003191", "0.69431645", "0.6899073", "0.67459005", "0.6734289", "0.6719244", "0.6707872", "0.66260886", "0.6619251", "0.6618523", "0.66005147", "0.6530729", "0.65197456", "0.6417432", "0.6412459", "0.6406471", "0.6399043", "0.6353556", "0.63526803", "0.6350958", "0.6310036", "0.6302601", "0.62816447", "0.62802804", "0.6275602", "0.6273535", "0.6266518", "0.62222445", "0.621946", "0.6203188", "0.61909497", "0.6161114", "0.61487764", "0.61248225", "0.611793", "0.61129946", "0.6073489", "0.6036059", "0.6029533", "0.6022375", "0.6005449", "0.6003947", "0.59955114", "0.59777105", "0.5973954", "0.5971948", "0.5963716", "0.5958328", "0.59392285", "0.5937004", "0.59328824", "0.5930563", "0.59298515", "0.5918136", "0.5914058", "0.59123194", "0.58998185", "0.5883495", "0.58814514", "0.5878563", "0.5848752", "0.58286005", "0.5828418", "0.58259207", "0.58174515", "0.5812447", "0.5800081", "0.57980376", "0.5793724", "0.57768065", "0.5768802", "0.57604164", "0.5759793", "0.5753063", "0.57456636", "0.5742283", "0.5740193", "0.57113206", "0.57105434", "0.57006955", "0.567937", "0.56536317", "0.5641277", "0.5640458", "0.563382", "0.5627358", "0.562577", "0.562577", "0.56239045", "0.56173825", "0.5613008", "0.5608551", "0.5602801", "0.56021", "0.5597642", "0.55937606", "0.55876434", "0.55829644" ]
0.0
-1
Detect AES in ECB mode (ECB is stateless, so can be sussed out by noticing repeated blocks)
def challenge8(file) file.each_line.map(&:chomp).to_a.max_by do |line| ciphertext = line.extend(Utils::HexString).to_ascii blocks = (0...ciphertext.length).map { |i| ciphertext[i, 16] } blocks.map { |s| blocks.count(s) }.max end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ecb_encrypted?(cipher)\n line_parts = cipher.scan(/.{16}/)\n line_parts.detect { |e| line_parts.count(e) > 1 } ? true : false\nend", "def detect_ecb_or_cbc(black_box)\n plain = \"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz\"\n ecb_encrypted?(black_box.call(plain)) ? \"ecb\" : \"cbc\"\nend", "def aes_ecb?(duplicate_count: 2)\n guess_ecb(@value, duplicate_count: duplicate_count)\n end", "def aes_ecb_internal(mode, buffer, key)\n raise 'Buffer must be composed of 16-byte chunks' unless (buffer.size % 16).zero?\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.send(mode)\n cipher.key = key.pack('C*')\n cipher.padding = 0 # decryption will otherwise fail\n result = cipher.update(buffer.pack('C*')) + cipher.final\n result.unpack('C*')\nend", "def ece?\n Capp::TCP_ECE == flags & Capp::TCP_ECE\n end", "def aes_ctr_ciphers\n data = File.readlines(\"./data/19-data.txt\").map{ |line| line.unpack(\"m\")[0]}\n aes = AES.new\n key = random_str(16)\n\n data.map do |line|\n aes.aes_ctr_encrypt(line, key)\n end\nend", "def decryptAES128ECBblock(inputblock, keybytes)\n\tinput, key = bytearraytostring(inputblock), bytearraytostring(keybytes)\n\tdecipher = OpenSSL::Cipher::AES.new(128, 'ECB')\n\tdecipher.decrypt\n\tdecipher.key = key\n\tdecipher.padding = 0\n\treturn stringtobytearray(decipher.update(input) + decipher.final)\nend", "def supported?\n each_accepted_cipher_suite.any?\n end", "def encrypt_ecb_nofinal(msg, key)\n cipher = OpenSSL::Cipher.new('AES-128-ECB')\n cipher.encrypt\n cipher.key = key\n return cipher.update(msg)\nend", "def cipher_block_size()\n case @cipher\n when \"256\"\n return 32\n when \"192\"\n return 24\n else\n return 16\n end\n end", "def can_decrypt?\n false\n end", "def valid?\r\n @bytes.same_bytes_as?(CAFE_BABE)\r\n end", "def encryption_oracle(buffer)\n prefix_padding = rand(5..10).times.map { rand(0..255) }\n suffix_padding = rand(5..10).times.map { rand(0..255) }\n padded_buffer = pkcs7_pad(prefix_padding + buffer + suffix_padding, 16)\n key = 16.times.map { rand(0..255) }\n\n if rand(2).zero?\n puts 'Encrypting with ECB...'\n aes_ecb_encrypt(padded_buffer, key)\n else\n puts 'Encrypting with CBC...'\n iv = 16.times.map { rand(0..255) }\n aes_cbc_encrypt(padded_buffer, key, iv)\n end\nend", "def valid?(iv, block)\n stdin.write(iv)\n stdin.write(block)\n stdin.flush\n\n stdout.read(1) == \"\\x00\"\n end", "def cipher\n aes = OpenSSL::Cipher::Cipher.new(\"aes-#{@key_size}-cbc\")\n\n case @mode\n when :encrypt\n aes.encrypt\n when :decrypt\n aes.decrypt\n else\n raise(InvalidMode,\"invalid mode #{@mode}\")\n end\n\n aes.key = @key\n aes.iv = @iv\n\n yield aes if block_given?\n return aes\n end", "def decipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.decrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def encryption_oracle\n # From an early-on AES-128-ECB exercise. 'YELLOW SUBMARINE' is the 128-bit key.\n ciphertext = URL::decode64('http://cryptopals.com/static/challenge-data/25.txt')\n plaintext = AES_128.decrypt(ciphertext, 'YELLOW SUBMARINE', :mode => :ECB)\n\n AES_128.encrypt(plaintext, AES_KEY, :mode => :CTR)\nend", "def get_cipher\n OpenSSL::Cipher::Cipher.new('AES-256-CBC')\n end", "def cipher\r\n aes = OpenSSL::Cipher::AES.new(128, :CBC)\r\n aes.encrypt\r\n aes.key = key\r\n aes.iv = iv\r\n return aes\r\n end", "def aes_sbox_bytes(k)\n r = 0\n 0.upto(3) do |j|\n r = aes_set_byte(r, j, AES_SBOX[aes_get_byte(k,j)])\n end\n r\n end", "def find_cipher(*args)\n fail ArgumentError, 'Unknown algorithm ' + algorithm unless args[0] == 'http://www.w3.org/2001/04/xmlenc#aes256-cbc'\n\n cipher = ::OpenSSL::Cipher.new('AES-256-CBC')\n cipher.decrypt\n cipher.padding = 0\n cipher.key = find_cipher_key(cipher, *args[1..4])\n cipher.iv = args[5]\n\n cipher\n end", "def scan(buffer, source_offset)\n\n blen = buffer.length\n entropic(buffer, AES_KEYBLOCK_MIN, ENTROPIC_MIN) do |i|\n\n # Exit if we dont have at least 240 bytes left\n return if (i + 240) > blen\n\n # Create a byte map to work in both little and big endian formats\n #[\"V\", \"N\"].each do |endian|\n\n [\"V\"].each do |endian|\n bmap = buffer[i, 240].unpack(\"#{endian}*\")\n\n # Check distance from 256-bit AES key\n xor_count_256 = 0\n 1.upto(7) do |row|\n 0.upto(7) do |column|\n break if (row == 7 and column == 4)\n case column\n when 0\n xor_count_256 += aes_popcount( aes_key_core( bmap[8*row-1], row) ^ bmap[8*(row-1)] ^ bmap[8*row] )\n when 4\n xor_count_256 += aes_popcount( aes_sbox_bytes( bmap[8*row+3]) ^ bmap[8*(row-1)+4] ^ bmap[8*row+4])\n else\n xor_count_256 += aes_popcount( bmap[8*row+column-1] ^ bmap[8*(row-1)+column] ^ bmap[8*row + column])\n end\n end\n end\n\n # We found a possible AES-256 key\n unless xor_count_256 > AES_XOR_LIMIT\n report_hit(:type => \"Key(AES-256)\", :data => bmap[0, 256/32].pack(\"#{endian}*\").unpack(\"C*\").map{|x| \"%.2x\" % x }.join, :offset => source_offset + i)\n next\n end\n\n # Check distance from 128-bit AES key\n xor_count_128 = 0\n 1.upto(10) do |row|\n 0.upto(3) do |column|\n before_count = xor_count_128\n case column\n when 0 \n xor_count_128 += aes_popcount( aes_key_core( bmap[4*row-1],row) ^ bmap[4*(row-1)] ^ bmap[4*row])\n else\n xor_count_128 += aes_popcount( (bmap[4*row + column-1] ^ bmap[4*(row-1)+column]) ^ bmap[4*row + column])\n end\n end\n end\n\n # We found a possible AES-128 key\n unless xor_count_128 > AES_XOR_LIMIT\n report_hit(:type => \"Key(AES-128)\", :data => bmap[0, 128/32].pack(\"#{endian}*\").unpack(\"C*\").map{|x| \"%.2x\" % x }.join, :offset => source_offset + i)\n end\n end\n end\n\n end", "def encrypt_aes_ecb(key)\n key_str = str(key)\n msg = self.pad(16).value\n\n _encrypt_aes_ecb(msg, key_str)\n end", "def aes_cbc_encrypt(buffer, key, iv)\n blocks = buffer.each_slice(key.size)\n previous_ciphertext_block = iv\n\n blocks.flat_map do |block|\n previous_ciphertext_block = aes_ecb_encrypt(\n xor_bytes(previous_ciphertext_block, block),\n key\n )\n\n previous_ciphertext_block\n end\nend", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def initialize_cipher_for(mode)\n @cipher.send mode\n @cipher.key = @config['key']\n @cipher.iv = @config['iv']\n end", "def cooked_mode?\n mode == :cooked\n end", "def valid_mode?(mode)\n [:cooked, :fake, :raw].include?(mode)\n end", "def cooked_mode?\n mode == :cooked\n end", "def aes_encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, \"randomString\", 1024, aes.key_len)\n aes.iv = iv if iv != nil\n aes.update(data.to_s) + aes.final \n end", "def aes_key_core(k, i)\n t = 0\n 0.upto(3) do |j|\n t = aes_set_byte(t, (j-1) % 4, AES_SBOX[aes_get_byte(k, j)])\n end\n aes_set_byte(t, 0, aes_get_byte(t,0) ^ AES_RCON[i])\n end", "def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end", "def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end", "def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end", "def verify\n if (buffer.offset + @_model.fbe_offset - 4) > buffer.size\n return false\n end\n\n fbe_full_size = read_uint32(@_model.fbe_offset - 4)\n if fbe_full_size < @_model.fbe_size\n return false\n end\n\n @_model.verify\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def verify\n if (buffer.offset + @_model.fbe_offset) > buffer.size\n return false\n end\n\n fbe_struct_size = read_uint32(@_model.fbe_offset - 8)\n fbe_struct_type = read_uint32(@_model.fbe_offset - 4)\n if (fbe_struct_size <= 0) or (fbe_struct_type != fbe_type)\n return false\n end\n\n (8 + @_model.verify) == fbe_struct_size\n end", "def cipher(cipher_mode, data)\n expect! cipher_mode => [ :decrypt, :encrypt ]\n\n case cipher_mode\n when :decrypt\n expect! data => /^envy:/\n cipher_op(:decrypt, data: Base64.decode64(data[5..-1]))\n when :encrypt\n \"envy:\" + Base64.strict_encode64(cipher_op(:encrypt, data: data))\n end\n end", "def detect_block_size\n print \"Detecting block size: \"\n block_size = 0\n block2_start = 0\n block2_end = 0\n n_target_bytes = 0\n # Find out when 2 repeating blocks are found\n (4..RANDOM_PLAIN_TXT_MAX_LENGTH + 50).each do |i|\n aaa = i.times.map{|ii| \"A\"}.join\n cipher_aaa = encrypt_prepend_append(aaa, \"something\").unpack(\"m\")[0]\n\n # Scan cipher text in windows of 2..i/2 to search for repeating blocks\n (2..i/2).each do |win_size|\n # puts \"Checking win_size: #{win_size}\"\n start_i = 0\n (0..cipher_aaa.length - 2*win_size).each do |start_i|\n block_1 = cipher_aaa[start_i..start_i + win_size-1]\n\n block_2 = cipher_aaa[start_i + win_size..start_i +(2*win_size - 1)]\n if block_1 == block_2\n n_target_bytes = i\n block_size = win_size\n block2_start = start_i + win_size\n block2_end = start_i+(2*win_size-1)\n puts \"\\n2nd block idx: #{block2_start} - #{block2_end}\"\n break\n end\n end\n end\n if block_size > 0\n puts \"Found block size: #{block_size}\"\n return [n_target_bytes, block_size, block2_start, block2_end]\n end\n print \".\"\n end\n\n raise \"Block size not detected\"\nend", "def AES256_ctr key, iv\n cipher = OpenSSL::Cipher::AES.new(256, :ECB)\n cipher.encrypt\n cipher.padding = 0\n cipher.key = key[..31].map(&:chr).join\n\n counter = iv[..15]\n f = Fiber.new do\n loop do\n enc = cipher.update(counter.map(&:chr).join)\n enc.bytes.each {|b| Fiber.yield b}\n counter.increment\n end\n end\n\n Enumerator.produce {f.resume}\nend", "def decode_aes256 data\n length = data.length\n length16 = length % 16\n length64 = length % 64\n\n if length == 0\n ''\n elsif length16 == 0\n decode_aes256_ecb_plain data\n elsif length64 == 0 || length64 == 24 || length64 == 44\n decode_aes256_ecb_base64 data\n elsif length16 == 1\n decode_aes256_cbc_plain data\n elsif length64 == 6 || length64 == 26 || length64 == 50\n decode_aes256_cbc_base64 data\n else\n raise RuntimeError, \"'#{data.inspect}' doesn't seem to be AES-256 encrypted\"\n end\n end", "def ec?\n @spki.public_key.kind_of?(OpenSSL::PKey::EC)\n end", "def fips_mode?\n if self.file_exist?('/proc/sys/crypto/fips_enabled')\n begin\n execute(\"cat /proc/sys/crypto/fips_enabled\") == \"1\"\n rescue Beaker::Host::CommandFailure\n false\n end\n else\n false\n end\n end", "def initialize\n @edit_distance = 3\n @cipher_spec = \"AES-256-CBC\"\n @padding_byte_size = 32\n end", "def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend", "def test_eob_front_is_false\n @buffer = Buffer.new 'hello world'\n assert_false @buffer.eob?\n end", "def aes_ecb_encrypt(data, key, params: {})\n key_arr = key.unpack(\"C*\")\n\n data = pad_data(data, 16)\n encrypted_data = data.unpack(\"C*\").each_slice(16).map do |slice|\n state = array_to_matrix(slice)\n encrypted_state = aes_encrypt_block(state, key_arr)\n matrix_to_array(encrypted_state).pack(\"C*\")\n end\n\n # return base64 encoded data\n [encrypted_data.join].pack(\"m\")\n end", "def encryption_required?\n super\n end", "def decode_aes(str)\n unpacked_data = str.unpack1(\"m\").unpack(ENCODING_FORMAT)\n # Splat the data array apart\n # nonce, auth_tag, encrypted_data = unpacked_data\n CipherParams.new(*unpacked_data)\n end", "def detect_block_size(pm)\n print \"Detecting block size: \"\n block_size = 0\n # Find out when 2 repeating blocks are found\n (4..50).each do |i|\n aaa = i.times.map{|ii| \"A\"}.join\n cipher_aaa = pm.encrypt_profile(aaa).unpack(\"m\")[0]\n\n # Scan cipher text in windows of 2..i/2 to search for repeating blocks\n (2..i/2).each do |win_size|\n # puts \"Checking win_size: #{win_size}\"\n start_i = 0\n (0..cipher_aaa.length - 2*win_size).each do |start_i|\n block_1 = cipher_aaa[start_i..start_i + win_size-1]\n block_2 = cipher_aaa[start_i + win_size..start_i +(2*win_size - 1)]\n if block_1 == block_2\n block_size = win_size\n break\n end\n end\n end\n if block_size > 0\n puts \"*\"\n puts \"Found block size: #{block_size}\"\n return block_size\n end\n print \".\"\n end\n\n raise \"Block size not detected\"\nend", "def initialize(key,iv)\n \t\t\t\t@key = key\n \t\t\t\t@iv = iv\n \t\t\t\t@aes = OpenSSL::Cipher::Cipher.new('aes-256-cbc')\n \t\t\t\[email protected] = key\n \t\t\t\[email protected] = iv\n \t\t\t\[email protected]\n \t\t\t\t@block = @aes.update(iv) << @aes.final\n \t\t\t\t@index = 0\n \t\t\tend", "def decode_aes(str)\n unpacked_data = Base64.decode64(str).unpack(ENCODING_FORMAT)\n # Splat the data array apart\n # nonce, auth_tag, encrypted_data = unpacked_data\n CipherParams.new(*unpacked_data)\n end", "def is_elb?\n type.downcase == \"elb\"\n end", "def decode_aes256_cbc_plain data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, data[1, 16], data[17..-1]\n end\n end", "def position\n get_cipher_position * 64\n end", "def do_aes(key_binary_p, iv_binary_p, input_binary_p, output_binary_p,\n response_length_p, status_p, decrypt: false)\n key = Binary.from_pointer(key_binary_p).to_s\n iv = Binary.from_pointer(iv_binary_p).to_s\n input = Binary.from_pointer(input_binary_p).to_s\n\n write_binary_string_and_set_status(output_binary_p, status_p) do\n output = Hooks.aes(key, iv, input, decrypt: decrypt)\n response_length_p.write_int(output.bytesize)\n\n output\n end\n end", "def aes_cts_hmac_sha1_96(algorithm, raw_secret, salt)\n iterations = 4096\n cipher = OpenSSL::Cipher::AES.new(algorithm)\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(raw_secret, salt, iterations, cipher.key_len)\n plaintext = \"kerberos\\x7B\\x9B\\x5B\\x2B\\x93\\x13\\x2B\\x93\".b\n result = ''.b\n loop do\n cipher.reset\n cipher.encrypt\n cipher.iv = \"\\x00\".b * 16\n cipher.key = key\n ciphertext = cipher.update(plaintext)\n result += ciphertext\n break unless result.size < cipher.key_len\n\n plaintext = ciphertext\n end\n result\n end", "def build_cipher(args={})\n cipher = OpenSSL::Cipher.new('AES-256-CBC')\n args[:decrypt] ? cipher.decrypt : cipher.encrypt\n iv = args[:iv]\n until(iv.length > 65)\n iv = iv * 2\n end\n key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(\n args[:key], CRYPT_SALT, CRYPT_ITER, CRYPT_KEY_LENGTH\n )\n cipher.iv = iv\n cipher.key = key\n cipher\n end", "def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend", "def decrypt_aes_ecb(key, padding: false)\n key_str = str(key)\n data = self.pad(16).value\n\n _decrypt_aes_ecb(data, key_str)\n end", "def decrypt_byte(iv, block, known)\n c = BLOCK_SIZE.times.map { rand(0..255) }\n p = known.length + 1\n\n # During encryption we:\n # 1. XOR (block, iv)\n # 2. Encrypt the value above ending with an \"encrypted value\"\n #\n # During decryption we do:\n # 1. decrypted_value = aes_cbc_decrypt(encrypted_value, KEY)\n # 2. XOR(decrypted_value, iv)\n # 3. We now have our plaintext\n #\n # So let's deconstruct what \"c[byte_pos] = x ^ p ^ iv[byte_pos]\" means.\n #\n # 1. We know \"x\" is part of our \"zeroing IV\", meaning:\n # * XOR(decrypted_value[pos], x) == 0\n # 2. p is the amount of zeroing bytes we already know\n # 3. iv[byte_pos] is our IV\n #\n # By doing c[byte_pos] = x ^ p ^ iv[byte_pos]\n #\n # We know that doing XOR(XOR(decrypted_block, iv), iv) will return decrypted_block\n # Following with XOR(decrypted_block[pos], x) will return 0 since x is equal the block\n # byte.\n # Followed by XOR(0, p) will return p, setting the byte to the padding value we want\n\n known.each_with_index do |x, i|\n byte_pos = BLOCK_SIZE - i - 1\n c[byte_pos] = x ^ p ^ iv[byte_pos]\n end\n\n i = 0\n\n loop do\n c[BLOCK_SIZE - p] = i\n break if check_credentials(c, block)\n raise \"Couldn't guess byte\" if i > 256\n i += 1\n end\n\n # So here we know c[BLOCK_SIZE - p] = i generated a value that\n # when XORed creates a valid padding for that specific byte.\n # Now we need to find the value for the \"zeroing IV\".\n #\n # We know that \"iv[BLOCK_SIZE - p] ^ i\" generates a number for a valid padding\n # when XORing it with our decrypted_value\n # and \"p\" represents that number for the current iteration. So XORing\n # \"iv[BLOCK_SIZE - p] ^ i\" with \"p\" will generate a number that when XORed\n # with the decrypted block will zero it.\n\n iv[BLOCK_SIZE - p] ^ i ^ p\nend", "def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def cipher_mode=(cipher_type)\n if cipher_type == \"ecb\"\n @cipher_type_des = \"des-ecb\"\n @cipher_type_tdes = \"des-ede\"\n else\n @cipher_type_des = \"des-cbc\"\n @cipher_type_tdes = \"des-ede-cbc\"\n end\n end", "def initialize\n self.cipher = AesCipher.new\n end", "def encrypt?\n !@options[:bypass_auto_encryption]\n end", "def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end", "def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend", "def encryptCBC(plaintext, key, iv, padding: false)\r\n\t\t## split the text into chunks of block size\r\n\t\tblock_size = 16\r\n\t\tblocks = plaintext.chars.each_slice(block_size).to_a.map{|v| v.join.to_s}\r\n\r\n\r\n\t\tciphertext = String.new\r\n\t\tvector = iv\r\n\t\tblocks.each do |block|\r\n\t\t\txor = block^vector\r\n\t\t\tvector = encryptECB(xor, key, padding: false)\r\n\t\t\tciphertext += vector\r\n\t\tend\r\n\r\n\t\tciphertext\r\n\tend", "def data_bag_encrypted?\n if(node[node_key][:config_bag].respond_to?(:has_key?))\n !!node[node_key][:config_bag][:encrypted]\n else\n false\n end\n end", "def vigenere_cipher(string, key_sequence)\n\nend", "def decrypt_block_size\n (size/8)-1\n end", "def decrypt(prefix_count, so_far, block_num)\n r = 'a'*prefix_count\n # puts \"Decrypt; prefix_count: #{prefix_count} (#{r.length}) so_far: #{so_far} (#{so_far.length}) block_num: #{block_num}\"\n #raise unless (r.length + so_far.length) % 16 == 15\n short = encryption_oracle(r)[block_num*16..block_num*16+15] # ciphertext with start of unknown\n # ^ pulling the right byte, but need to include 15 bytes of of padding...\n\n (0..255).each do |ch|\n if block_num == 0\n t = r + so_far + ch.chr # padding + known unknown chars + test char in last position\n else\n t = so_far + ch.chr # no padding since we are in scan mode Now\n end\n test = encryption_oracle(t)[0..15]\n if short == test\n return ch\n end\n end\n nil\nend", "def _decode_aes256 cipher, iv, data\n aes = OpenSSL::Cipher::Cipher.new \"aes-256-#{cipher}\"\n aes.decrypt\n aes.key = @encryption_key\n aes.iv = iv\n aes.update(data) + aes.final\n end", "def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def decode_aes256_cbc_base64 data\n if data.empty?\n ''\n else\n # TODO: Check for input validity!\n _decode_aes256 :cbc, decode_base64(data[1, 24]), decode_base64(data[26..-1])\n end\n end", "def encryption_oracle(message)\n rand_key = SecureRandom.random_bytes(16)\n rand_iv = SecureRandom.random_bytes(16)\n front_bytes = SecureRandom.random_bytes(rand(5..10))\n end_bytes = SecureRandom.random_bytes(rand(5..10))\n\n padded_message = front_bytes + message + end_bytes\n\n (rand(1..2) == 1) ? encrypt_ecb(message, rand_key) : encrypt_cbc(message, rand_key, rand_iv)\nend", "def FT_IS_CID_KEYED(face)\n face.face_flags & FaceFlag[:CID_KEYED]\n end", "def test_eob_after_fin_is_true\n @buffer = Buffer.new 'hello world'\n @buffer.fin\n assert @buffer.eob?\n end", "def binary?\n @encoding == 'base64'\n end", "def ciphertext_only(ciphertext)\n for i in [email protected]\n c = Caesar.new(i, @alphabet)\n print c.decrypt(ciphertext) + \"\\n\"\n end \n end", "def decrypt data, key, salt, iter, iv, key_length = 32\n decipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n decipher.decrypt\n decipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n decipher.iv = iv\n decipher.update(data) + decipher.final\n end", "def encryption_oracle(data)\n # prepend and append some random chars to the data\n # (why are we doing this?)\n pre = rand(6)+5\n post = rand(6)+5\n plain_text = data\n plain_text.prepend( (1..pre).map {rand(256).chr}.join )\n plain_text.concat( (1..post).map {rand(256).chr}.join )\n plain_text = CBCEncryptor.pad(plain_text, KEYSIZE)\n\n key = (1..16).map {rand(256).chr}.join\n\n if rand(2) > 0\n puts \"[Oracle using ECB]\"\n ecb = ECBEncryptor.new(key)\n ecb.encrypt(plain_text)\n else\n puts \"[Oracle using CBC]\"\n iv = (1..16).map {rand(256).chr}.join\n cbc = CBCEncryptor.new(key)\n cbc.encrypt(plain_text, iv)\n end\nend", "def encryption_info\n @ms_off_crypto.encryption_info\n end", "def test_it_can_decipher\n assert_equal \"the quick brown fox jumps over the lazy dog\", @caesar.cipher_to_eng(\"qeb nrfzh yoltk clu grjmp lsbo qeb ixwv ald\")\nend", "def edid_decode_cta_block ( bytes, offset, sp )\n dtd_offset = bytes[offset+2]\n dtd_count = bytes[offset+3] & (0b1111)\n flags=offset+3 # location of feature flags\n if 0 != (bytes[flags] & (0b10000000))\n puts sp + \"Underscans by default\"\n # Underscan support indicated in byte 3, bits 8\n if $overrides.include? NO_CTA_UNDERSCAN\n puts \"PATCH[#{flags}]: Clearing underscan flag\"\n bytes[flags] &= ~(0b10000000)\n $patchset.push ({ :byte=>flags })\n end\n end\n if 0 != (bytes[flags] & (0b01000000))\n puts sp + \"Basic audio support\"\n end\n if 0 != (bytes[flags] & (0b00100000))\n puts sp + \"Supports YCbCr 4:4:4\"\n # YCbCr 4:4:4 support indicated in byte 3, bits 5\n if $overrides.include? NO_CTA_Y444 or $overrides.include? NO_CTA_YCBCR\n puts \"PATCH[#{flags}]: Clearing YCbCr 4:4:4 support\"\n bytes[flags] &= ~(0b00100000)\n $patchset.push ({ :byte=>flags })\n end\n end\n if 0 != (bytes[flags] & (0b00010000))\n puts sp + \"Supports YCbCr 4:2:2\"\n # YCbCr 4:2:2 support indicated in byte 3, bits 4\n if $overrides.include? NO_CTA_Y422 or $overrides.include? NO_CTA_YCBCR\n puts \"PATCH[#{flags}]: Clearing YCbCr 4:2:2 support\"\n bytes[flags] &= ~(0b00010000)\n $patchset.push ({ :byte=>flags })\n end\n end\n\n # DTD BLOCK DECODER\n # DTD blocks begin at dtd_offset\n puts sp + \"Supported Native Detailed Modes: %u\" % dtd_count\n if dtd_offset >= 4\n ptr = offset + dtd_offset\n while ptr < offset + 126\n if (bytes[ptr] + bytes[ptr+1] == 0)\n break\n end\n edid_decode_dtd( bytes, ptr )\n ptr += 18\n end\n end\n\n # DATA BLOCK DECODER\n # data blocks begin at byte 4 through dtd_offset-1\n if dtd_offset > 4\n ptr = offset + 4\n while ptr < offset + dtd_offset\n type = (bytes[ptr] & (0b11100000))>>5\n length = bytes[ptr] & (0b00011111)\n print \"byte #{ptr}: \"\n case type\n when 1\n puts sp + \"Audio data block\"\n when 2\n puts sp + \"Video data block\"\n puts sp + \" Data: %s\" % bytes[ptr..ptr+length].map{|b|\"%02x\"%b}.join(' ')\n when 3 # CTA Vendor-specific data block\n vsd_oui = bytes[ptr+1..ptr+3].reverse.map{|b|\"%02x\"%b}.join\n print sp + \"Vendor-specific data block, OUI %s \" % vsd_oui\n case vsd_oui\n when \"000c03\" # hdmi\n puts \"(HDMI Licensing)\"\n edid_decode_cta_vsd_hdmi( bytes, ptr, length, \" \" )\n when \"c45dd8\" # HDMI Forum\n puts \"(HDMI Forum)\"\n edid_decode_cta_vsd_hdmi_forum( bytes, ptr, length, \" \" )\n else\n puts \"(UNKNOWN)\"\n puts sp + \" Data: %s\" % bytes[ptr..ptr+length].map{|b|\"%02x\"%b}.join(' ')\n end\n when 4\n puts sp + \"Speaker Allocation Block\"\n when 5\n puts sp + \"VESA DTC data block\"\n when 7\n tag_type = bytes[ptr+1]\n print sp + \"Extended tag: \"\n case tag_type\n when 0\n puts \"Video capability data\"\n when 1\n puts \"Vendor-specific video data\"\n when 2\n puts \"VESA video display device data\"\n when 3\n puts \"VESA video timing data\"\n when 4\n puts \"Reserved for HDMI video data\"\n when 5\n puts \"Colorimetry data\"\n when 6\n puts \"HDR static metadata\"\n when 7\n puts \"HDR dynamic metadata\"\n when 0xd\n puts \"Video format preference data\"\n when 0xe\n puts \"YCbCr 4:2:0 video data\"\n when 0xf\n puts \"YCbCr 4:2:0 capability map data\"\n when 0x10\n puts \"Reserved for CTA misc audio fields\"\n when 0x11\n puts \"Vendor-specific audio data\"\n when 0x12\n puts \"HDMI audio data\"\n when 0x13\n puts \"Room configuration data\"\n when 0x14\n puts \"Speaker location data\"\n when 0x20\n puts \"InfoFrame data\"\n when 6..12\n puts \"Reserved for video-related blocks (%02x)\" % tag_type\n when 19..31\n puts \"Reserved for video-related blocks (%02x)\" % tag_type\n else\n puts \"Reserved (%02x)\" % tag_type\n end\n\n else\n puts sp + \"Reserved Data Type %u\" % type\n puts sp + \" Bytes: %s\" % bytes[ptr..ptr+length].map{|b|\"%02x\"%b}.join(' ')\n end\n ptr += length + 1\n end\n end\n\nend" ]
[ "0.6914897", "0.69069684", "0.6795968", "0.66165334", "0.6568053", "0.5842149", "0.57817006", "0.57639927", "0.57294613", "0.56371236", "0.56302017", "0.55807835", "0.54920465", "0.54208106", "0.5408473", "0.5378903", "0.5320392", "0.53027666", "0.52589643", "0.52496934", "0.51893324", "0.51695746", "0.5155436", "0.51138294", "0.51069695", "0.50798315", "0.50561076", "0.50499624", "0.50480825", "0.5039504", "0.5034368", "0.5024935", "0.5024935", "0.5024935", "0.5024935", "0.50047153", "0.50047153", "0.50047153", "0.50047153", "0.4985238", "0.49763092", "0.49677563", "0.49657843", "0.49546495", "0.48997903", "0.48845434", "0.48828048", "0.48732412", "0.48623416", "0.48593894", "0.48408505", "0.48290986", "0.48247355", "0.4822383", "0.48184144", "0.48178768", "0.48113504", "0.4807846", "0.4806937", "0.48003736", "0.4797764", "0.47887072", "0.47867456", "0.4767998", "0.47613823", "0.47571552", "0.47525704", "0.4739141", "0.4731738", "0.47302777", "0.47279352", "0.47278386", "0.4711138", "0.47096562", "0.4705963", "0.4700358", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.46963665", "0.4692728", "0.46921358", "0.46882224", "0.46712166", "0.46693006", "0.4663949", "0.46378732", "0.46243492", "0.4612877", "0.4612869", "0.4605592" ]
0.0
-1
Interpolates the Image_URI with the "multiverse id".
def image_uri_from_id= id self.image_uri = Image_URI % id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_image_uri row\n row./('td[2]/a').first[:href] =~ /multiverseid=(\\d+)/\n $1\n end", "def image_uri\n return \"/image_store/#{id}.#{image_type}\"\n end", "def uri(image)\n image.dig('medium', 'uri')\n end", "def server_image_id(s)\n s.respond_to?('image_id') ? s.image_id : 'no_image'\n end", "def map_image_id(image)\n name, _ = image.name.split(/ \\d/, 2)\n other = image.name.gsub(Regexp.new(\"^#{name} ?\"), '')\n version, extra = other.split(/ +/, 2)\n [name, { version => { :id => image.id, :extra => extra } } ]\n end", "def get_image_id(bibl_uuid, mods_uuid)\n url = \"#{@server_url}/items/#{bibl_uuid}.json?per_page=500\"\n json = self.get_json(url)\n image_id = nil\n \n json[\"nyplAPI\"][\"response\"][\"capture\"].each do | capture|\n if capture[\"uuid\"] == mods_uuid\n image_id = capture[\"imageID\"]\n break\n end #if\n end if json[\"nyplAPI\"][\"response\"][\"numResults\"].to_i > 0\n\n return image_id\n end", "def image_uri\n return \"/image_store/#{id}.#{profile_image}\"\n end", "def image_id\n data[:image_id]\n end", "def giphy_id\n GIPHY_MEDIA_URL.match(@url)['id'] if match?\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 named_image(name)\n card = named(name)\n return card['image_uris']['normal']\n end", "def image_id(val=nil)\n from_setting_or_image_info :image_id, val\n end", "def id(raw = false)\n id = Spotify.image_image_id(@pointer).read_string(20)\n raw ? id : to_hex(id)\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def retrieve_image_id\n name = config['image_name']\n\n img_data = connection.image_list.body[\"DATA\"].find { |i| i[\"LABEL\"] == name }\n if img_data.nil?\n names = connection.image_list.body[\"DATA\"].map { |i| i[\"LABEL\"] }.join(\", \")\n add_error \"There is no image named #{name}. \" \\\n \"Options are: #{names}\"\n else\n id = img_data[\"IMAGEID\"]\n end\n id\n end", "def canonical_image_identifiers(opennebula_image)\n fail 'Image object not provided!' unless opennebula_image\n identifiers = []\n\n identifiers << opennebula_image['TEMPLATE/VMCATCHER_EVENT_AD_MPURI']\n identifiers << opennebula_image['TEMPLATE/VMCATCHER_EVENT_DC_IDENTIFIER']\n identifiers << opennebula_image['NAME']\n identifiers << opennebula_image['ID'].to_s\n identifiers.compact!\n\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Assigning IDs #{identifiers.inspect} \" \\\n \"to image #{opennebula_image['ID'].inspect}\"\n identifiers\n end", "def full_image_uri\n return nil if image.nil?\n return image if image.start_with?('http://')\n return 'http://bookmarket.webhop.org/' + image\n end", "def image_uid\n @dicom_image_uid || @image_uid\n end", "def default_image_id\n region_name = config[:compute_provider][\"#{config[:compute_provider][:name]}_region\".to_sym]\n region_map = images.fetch('regions', {}).fetch(region_name, {})\n image_id = region_map && region_map[instance.platform.name]\n\n if image_id.nil?\n error(\"Could not determine default image_id in #{region_name} region for platform #{instance.platform.name}\")\n end\n\n image_id\n end", "def merge_uri_with! details\n resource_uri = convert_id_to_uri(@resource_id)\n details.merge! :resource_uri => resource_uri\n end", "def get_bibl_uuid(image_id)\n url = \"#{@server_url}/items/local_image_id/#{image_id}.json\" \n json = self.get_json(url)\n bibl_uuid = nil\n if json[\"nyplAPI\"][\"response\"][\"numResults\"].to_i > 0\n bibl_uuid = json[\"nyplAPI\"][\"response\"][\"uuid\"]\n end\n \n return bibl_uuid\n end", "def update_template_with_image_id(template)\n params = template.parameters\n params.each do |key, value|\n update_params_with_image_id(params, key, value)\n end\n end", "def small_photo_uri(photo)\n server = photo.attribute('server')\n id = photo.attribute('id')\n secret = photo.attribute('secret')\n return \"http://static.flickr.com/#{server}/#{id}_#{secret}_m.jpg\"\nend", "def display_img_url(url)\n url.sub(/s90$/, 's360') \n # recipe_response = Faraday.get(\"http://api.yummly.com/v1/api/recipe/#{id}\",\n # _app_id: ENV['YUMMLY_APP_ID'],\n # _app_key: ENV['YUMMLY_APP_KEY'])\n # image = JSON.parse(recipe_response.body)['images'].try(:first)\n # image['hostedLargeUrl'].present? ? image['hostedLargeUrl'] : image['hostedMediumUrl'] if image.present?\n end", "def show_image_number\n @druid=params[:id]\n @image_number=params[:image_number].to_i\n @document = SolrDocument.find(@druid)\n render :partial=>'annotate_image', :locals=>{:image_number=>@image_number}\n end", "def set_loc_image\n @loc_image = LocImage.find(params[:id])\n end", "def illust_id\n return nil if novel_id.present?\n\n parsed_urls.each do |url|\n # http://www.pixiv.net/member_illust.php?mode=medium&illust_id=18557054\n # http://www.pixiv.net/member_illust.php?mode=big&illust_id=18557054\n # http://www.pixiv.net/member_illust.php?mode=manga&illust_id=18557054\n # http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=18557054&page=1\n if url.host == \"www.pixiv.net\" && url.path == \"/member_illust.php\" && url.query_values[\"illust_id\"].present?\n return url.query_values[\"illust_id\"].to_i\n\n # http://www.pixiv.net/en/artworks/46324488\n elsif url.host == \"www.pixiv.net\" && url.path =~ %r{\\A/(?:en/)?artworks/(?<illust_id>\\d+)}i\n return $~[:illust_id].to_i\n\n # http://www.pixiv.net/i/18557054\n elsif url.host == \"www.pixiv.net\" && url.path =~ %r{\\A/i/(?<illust_id>\\d+)\\z}i\n return $~[:illust_id].to_i\n\n # http://img18.pixiv.net/img/evazion/14901720.png\n # http://i2.pixiv.net/img18/img/evazion/14901720.png\n # http://i2.pixiv.net/img18/img/evazion/14901720_m.png\n # http://i2.pixiv.net/img18/img/evazion/14901720_s.png\n # http://i1.pixiv.net/img07/img/pasirism/18557054_p1.png\n # http://i1.pixiv.net/img07/img/pasirism/18557054_big_p1.png\n elsif url.host =~ /\\A(?:i\\d+|img\\d+)\\.pixiv\\.net\\z/i &&\n url.path =~ %r{\\A(?:/img\\d+)?/img/#{MONIKER}/(?<illust_id>\\d+)(?:_\\w+)?\\.(?:jpg|jpeg|png|gif|zip)}i\n return $~[:illust_id].to_i\n\n # http://i1.pixiv.net/img-inf/img/2011/05/01/23/28/04/18557054_64x64.jpg\n # http://i1.pixiv.net/img-inf/img/2011/05/01/23/28/04/18557054_s.png\n # http://i1.pixiv.net/c/600x600/img-master/img/2014/10/02/13/51/23/46304396_p0_master1200.jpg\n # http://i1.pixiv.net/img-original/img/2014/10/02/13/51/23/46304396_p0.png\n # http://i1.pixiv.net/img-zip-ugoira/img/2014/10/03/17/29/16/46323924_ugoira1920x1080.zip\n # https://i.pximg.net/img-original/img/2014/10/03/18/10/20/46324488_p0.png\n # https://i.pximg.net/img-master/img/2014/10/03/18/10/20/46324488_p0_master1200.jpg\n # https://i-f.pximg.net/img-original/img/2020/02/19/00/40/18/79584713_p0.png\n # https://tc-pximg01.techorus-cdn.com/img-original/img/2017/09/18/03/18/24/65015428_p4.png\n #\n # but not:\n #\n # https://i.pximg.net/novel-cover-original/img/2019/01/14/01/15/05/10617324_d84daae89092d96bbe66efafec136e42.jpg\n # https://img-sketch.pixiv.net/uploads/medium/file/4463372/8906921629213362989.jpg\n elsif url.host =~ /\\A(?:[^.]+\\.pximg\\.net|i\\d+\\.pixiv\\.net|tc-pximg01\\.techorus-cdn\\.com)\\z/i &&\n url.path =~ %r{\\A(/c/\\w+)?/img-[a-z-]+/img/#{DATE}/(?<illust_id>\\d+)(?:_\\w+)?\\.(?:jpg|jpeg|png|gif|zip)}i\n return $~[:illust_id].to_i\n end\n end\n\n nil\n end", "def collection_image_url(image_pid, destination_site = %w(commonwealth), target_width = 1100, target_height = 450)\n image_info = get_image_metadata(image_pid)\n output_aspect = target_width.to_f / target_height.to_f\n if image_info[:aspect_ratio] > output_aspect\n top = 0\n height = image_info[:height]\n width = (height * output_aspect).round\n else\n width = (image_info[:width].to_f * 0.90).round # 90% so we don't get borders\n reduction_percent = (target_width.to_f / width.to_f).round(3)\n height = (target_height / reduction_percent).round\n # use the top section if this is a newspaper page, otherwise use the middle\n top = destination_site.include?('newspapers') ? 200 : (image_info[:height] - height) / 2\n end\n left = (image_info[:width] - width) / 2\n region = \"#{left},#{top},#{width},#{height}\"\n size_width = image_info[:width] < target_width ? image_info[:width] : target_width\n iiif_image_url(image_pid, { region: region, size: \"#{size_width},\" })\n end", "def call(params = {})\n return variant.image.url(params) unless processible_image?\n\n \"/#{uid}\"\n end", "def medium_640 #_z\n url.gsub(\"_s.jpg\",\"\") + \"_z.jpg\"\n end", "def image_url\n if image.present?\n image\n else\n \"http://loremflickr.com/320/240/#{CGI.escape name}\"\n end\n end", "def open_lid_image\n image_path(image_name: params[:open_lid_image])\n end", "def image\n [:MANAGED_MAP, :UNMANAGED_MAP].each do |map|\n unless self.class.const_defined?(map)\n raise MapUndefined, \"Const #{map} is undefined; maps appear unbuilt\"\n end\n end\n\n map = @managed ? self.class::MANAGED_MAP : self.class::UNMANAGED_MAP\n distro = @distro.downcase.to_sym\n\n unless map[distro].nil?\n return map[distro][@version] unless map[distro][@version].nil?\n return map[distro][\"*\"] unless map[distro][\"*\"].nil?\n end\n\n nil\n end", "def get_mods_uuid(bibl_uuid, image_id)\n url = \"#{@server_url}/items/#{bibl_uuid}.json?per_page=500\"\n json = self.get_json(url)\n mods_uuid = nil\n \n json[\"nyplAPI\"][\"response\"][\"capture\"].each do | capture|\n if capture[\"imageID\"] == image_id\n mods_uuid = capture[\"uuid\"]\n break\n end #if\n end if json[\"nyplAPI\"][\"response\"][\"numResults\"].to_i > 0\n\n\n return mods_uuid\n end", "def obj_id\n uri.split('/').last\n end", "def obj_id\n uri.split('/').last\n end", "def currentEdition\n img :src => $imgHostURL + \"/\" + $currentImg\n end", "def image_asset_id\n item_code_name_cd&.delete('IMG_').to_i\n end", "def select_image\n compute.images.map { |i| [i.name, i.id] }\n end", "def image_url\n image.url.split('?').first if image\n end", "def image_url\n image.url.split('?').first if image\n end", "def parse_sw_image_ids\n public_xml_doc.xpath('//resource[@type=\"page\" or @type=\"image\" or @type=\"thumb\"]').map do |node|\n node.xpath('./file[@mimetype=\"image/jp2\"]/@id').map do |x|\n \"#{@druid.gsub('druid:', '')}/\" + x\n end << node.xpath('./externalFile[@mimetype=\"image/jp2\"]').map do |y|\n \"#{y.attributes['objectId'].text.split(':').last}\" + '/' + \"#{y.attributes['fileId']}\"\n end\n end.flatten\n end", "def public_id\n # return \"Image/\" + Cloudinary::Utils.random_public_id\n \"Image/#{model.food_key}\"\n end", "def extract_id_uri\n @id_uri = @meta.at_xpath('./a:identification/a:FRBRWork/a:FRBRuri', a: NS)['value']\n empty, @country, @nature, date, @num = @id_uri.split('/')\n\n # yyyy-mm-dd\n @year = date.split('-', 2)[0]\n end", "def id(string)\n return if string.blank?\n\n URI(string)\n .path\n .split(\"/\")\n .last\n .to_i\n end", "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end", "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end", "def image_url\n return \"\" if @path.nil? || @path.empty?\n \"#{images_scheme}://#{images_host}/\" << if m = /^(pv4|pfk|p7s|p6o|p3w|p7s|p)\\/(.*)$/.match(@path)\n \"p/\" << m[2]\n else\n @path\n end\n end", "def load(*args)\n super(*args)\n self.id = self.uri.split('/').last if self.id.nil? and defined? self.uri\n end", "def populate\n response = @connection.csreq( \"GET\", @link.host, @link.path, @link.port, @link.scheme )\n CloudServers::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n data = JSON.parse(response.body)['image']\n populate_from_hash( data )\n @id = data['id']\n @populated = true\n return true\n end", "def get_nodes_imgid(item)\n id = fetch_raw_data \"wikimedia\", \"nodes\", item\n return id\n end", "def image_path\n \"/image_store/#{id}.#{extension}\"\n end", "def reference_image(filename)\n\tpath = \"features/reference/#{iOSVersion}/#{device_str}/#{filename}\"\n\timg = Magick::Image::read(path).first\nend", "def find_normal_image\n return \"Pictures/pcn%04d.png\" % (80 + id)\n end", "def image_url\n Image.find(image_id).url\n end", "def set_maturi\n @maturi = Maturi.find(params[:id])\n end", "def pull_image(value)\n user_hash = pull_records(value)\n id = user_hash[0][\"id\"]\n image_name = user_hash[0][\"image\"]\n image = \"images/uploads/#{id}/#{image_name}\"\nend", "def image_elements(identifier)\n platform.images_for(identifier.clone)\n end", "def set_id\n @image = Image.find(params[:id])\n end", "def image(image = nil)\n if image\n if image.include?('/')\n # pathological case, a ':' may be present which starts the 'port'\n # part of the image name and not a tag. example: 'host:1337/blah'\n # fortunately, tags are only found in the 'basename' part of image\n # so we can split on '/' and rebuild once the tag has been parsed.\n dirname, _, basename = image.rpartition('/')\n r, t = basename.split(':', 2)\n r = [dirname, r].join('/')\n else\n # normal case, the ':' starts the tag part\n r, t = image.split(':', 2)\n end\n repo r\n tag t if t\n end\n \"#{repo}:#{tag}\"\n end", "def primary_image\n if images.length > 0\n images[0].url\n else\n \"https://vollrath.com/ClientCss/images/VollrathImages/No_Image_Available.jpg\"\n end\n end", "def image_format_query(name, return_full = false)\n imgs = ImageFormat.where(name: name)\n img = (imgs.count.eql? 1) ? imgs.first : nil\n return (img and not return_full) ? img.id : img\n end", "def extract_record_id(record)\n url = record.xpath('//tei:facsimile/tei:graphic/@url', NS).map(&:text).first\n url.gsub!('http://cudl.lib.cam.ac.uk/content/images/', '')\n url.gsub!(%r{-\\d+-\\d+_files\\/8\\/0_0.jpg}, '')\n end", "def image(hash={})\n\t\tif hash['id'] =~ /nsys|Hand|Arm|Leg|Eye|back|abdomen|chest|head|neck/o\n\t\t\tStatus.sf_update(hash['id'], hash['name'])\n\t\tend\n\tend", "def feature_img_url(image)\n return image if image.match(/^#{URI.regexp(%w[http https])}$/)\n\n image_url(['homepage', image].join('/'))\n end", "def url\n url = \"http://#{country_imghost}/images/P/#{asin}\"\n url << \".\" << country_imgcode << \".\"\n \n url << \"_\" << @transforms.join(\"_\") << \"_\" << \".jpg\"\n end", "def decode_image_name(image_name)\n client_id, current_message, new_letter = image_name.split('_')\n { client_id: client_id, current_message: current_message, new_letter: new_letter }\n end", "def cms_image_url(img_key)\n cms_host = 'http://local.amaysim2.com.au/' #TODO load from compass.yml\n \"#{cms_host}#{CMS_IMAGES[img_key]}\"\n end", "def image_server\r\n server = config[:image_server]\r\n if server.is_a? String\r\n server = { server: server }\r\n server[:protocol] = \"simplestreams\" if server[:server].split(\":\", 3)[2].nil?\r\n end\r\n server\r\n end", "def configureImages()\n #Fetch the server configuration\n config = fetchServerConfig()\n #Used the gathered configuration information to build a URL for accessing images\n $imageBase = config['images']['base_url']+config['images']['poster_sizes'][5]\nend", "def relative_url_fragment_to_jpg\n return \"/#{IMAGEDB_FOLDER}/#{self.id}.jpg\"\n end", "def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end", "def base_name(image)\n # Remove registry namespace (anything before the final slash)\n # as well as tag.\n if image.include?(\"/\")\n base = image.split('/').last.split(':').first\n else\n base = image.split(':').first\n end\n\n # Strip noise-word suffixes from image name\n base.sub!(NOISE_WORDS, '')\n\n base\n end", "def rewrite_iiif_base_uri(info_original)\n parsed_json = JSON.parse(info_original)\n public_base_uri = \"#{ENV['IIIF_SERVER_URL']}#{trailing_slash_fix}#{identifier}\"\n parsed_json[\"@id\"] = public_base_uri\n JSON.generate(parsed_json)\n end", "def path_for_origin\n string_id = (id.to_s).rjust(9, \"0\")\n \"#{IMG_VIDEO_PATH}#{string_id[0..2]}/#{string_id[3..5]}/#{string_id[6..8]}/#{id}\"\n end", "def get_image_by_uuid\n @command = :get_image_by_uuid\n # the UUID was the last \"previous argument\"\n image_uuid = @prev_args.peek(0)\n # setup the proper URI depending on the options passed in\n uri = URI.parse(@uri_string + '/' + image_uuid)\n # and get the results of the appropriate RESTful request using that URI\n result = hnl_http_get(uri)\n # finally, based on the options selected, print the results\n print_object_array(hash_array_to_obj_array([result]), \"Image:\")\n end", "def image_by_id(image_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking image ID #{image_id.inspect} from pool\"\n images.select { |image| image[:id] == image_id.to_i }.first\n end", "def photo_url\n src = details.at('#img_primary img')['src'] rescue nil\n\n if src =~ /^(http:.+@@)/ || src =~ /^(http:.+?)\\.[^\\/]+$/\n $1 + '.jpg'\n end\n end", "def get_mirror_uri(id, type)\n # The path changes between what's in the catalog RDF and the mirror structure so it needs patching.\n # Note that mobi format is the same as kindle (their naming convention changed on miror)\n base = 'gutenberg.pglaf.org/cache/epub/'\n uri = base + id.to_s + '/'\n case type\n when /kindle.images/\n uri += \"pg#{id}-images.mobi\"\n when /kindle.noimages/\n uri += \"pg#{id}.mobi\"\n when /.txt/\n uri += \"pg#{id}.txt.utf8\"\n when /epub.images/\n uri += \"pg#{id}-images.epub\"\n when /epub.noimages/\n uri += \"pg#{id}.epub\"\n end\n\n # A return is unneeded since it is implied, but let's be explicit\n return uri\nend", "def image(image_id)\n images(:image_ids => [image_id])[0]\n end", "def update_image_source(img)\n @content.gsub!(img, \"/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\")\n end", "def set_imagecollection_imagesource(identifier: nil)\n fail 'The image collection identifier needs to be set.' if identifier.nil?\n @elementHash[:imageidentifier] = identifier\n @elementHash\n end", "def image_filename\n File.join Img_Store, \"#{id}.#{extension}\"\n end", "def image_for(id, size=:source)\n image_tag \"https://spoonacular.com/recipeImages/#{id}-#{IMAGE_SIZES[size]}\"\n end", "def diswimage(image_text)\n image_options = image_text.gsub(/#/, '').gsub(/diswimage:/, '').split(':')\n image_title = image_options[0]\n image_extension = image_options[1]\n option_count = image_options[2]\n image_width = image_options[3]\n return \"!{width: #{image_width}px}http://doitidiot.s3.amazonaws.com/#{image_title}-#{rand(option_count)+1}.#{image_extension}!\"\n end", "def image_ids\n links = @doc.xpath(\"//div[@id='mygallery']//a/@href\").to_ary\n links.map {|link| link.to_s.split(\"/\").last }\n end", "def medium_image_path\n rails_representation_url(image.variant(resize: '500x500'), only_path: true)\n end", "def rebuild_id_uri\n self.id_uri = build_id_uri\n end", "def image_name\n path = \"sets/#{set}/#{dimension}_#{polarity}_#{verbal}\"\n # Rails.application.assets.find_asset(path).nil? ? 'placeholder' : path\n path\n end", "def canonical_image(opennebula_image)\n fail 'Image object not provided!' unless opennebula_image\n {\n id: opennebula_image['ID'].to_i,\n name: opennebula_image['NAME'],\n location: opennebula_image['SOURCE'],\n state: opennebula_image.state_str,\n datastore: opennebula_image['DATASTORE'],\n owner: {\n user: opennebula_image['UNAME'],\n group: opennebula_image['GNAME'],\n },\n identifiers: canonical_image_identifiers(opennebula_image),\n }\n end", "def math_images\n return metadata.math_images = MathImages.new([], id) unless metadata.math_images\n metadata.math_images.model_id = id if id && !metadata.math_images.model_id\n metadata.math_images\n end", "def main_variant_image(color_id)\n variants.main.where(color_id: color_id).first.main_photo&.image || Color.find(color_id).photo\n end", "def idify(*ary)\n \"#{ary[0]}:/#{ary[1]}/#{ary[2]}#{ary[3]}\"\n end", "def glider_image_swap\n image = PropertyImage.find(params[:image_id])\n render :partial => 'glider_image_swap',\n :layout => false,\n :locals => { :image => image }\n end", "def determine_rep (param)\n\n param = param.is_a?(URI) ? read_uri(param) : param\n parse(param)\n end", "def populate_id\n @id = Digest::SHA256.hexdigest(@source_url).slice(0, ID_LENGTH)\n end", "def get_image(id)\n val = @var_table[id]\n raise \"not an image\" if val.nil?\n val\n end", "def uri_id\n raise NotImplementedError.new('You must implement uri_id')\n end", "def get_agent_image_id(image_name = agent_ami_name)\n image = ec2.client.describe_images(\n :filters => [{\n :name => \"name\",\n :values => [image_name]\n }]\n ).flat_map(&:images).first\n raise(\"Unable to find AMI Image #{image_name} to launch Smartstate agent\") if image.nil?\n\n _log.info(\"AMI Image: #{image_name} [#{image.image_id}] is used to launch smartstate agent.\")\n\n image.image_id\n end", "def square_uri\n square_params\n uri\n end" ]
[ "0.6982181", "0.6027198", "0.5883056", "0.5785005", "0.5686432", "0.5496292", "0.54169875", "0.5276519", "0.52235425", "0.5202247", "0.5182692", "0.51750237", "0.516498", "0.51522064", "0.512283", "0.50873554", "0.50715446", "0.50608474", "0.5059086", "0.503886", "0.5034896", "0.5006505", "0.49818003", "0.49786136", "0.49768132", "0.49724096", "0.49639404", "0.49607146", "0.4960285", "0.4948222", "0.49354154", "0.49314576", "0.4930824", "0.49213096", "0.48991838", "0.48991838", "0.489049", "0.4886183", "0.4872877", "0.48719135", "0.48719135", "0.48682296", "0.48682255", "0.4857589", "0.48525894", "0.48501056", "0.48501056", "0.48448792", "0.48438245", "0.48425698", "0.48417526", "0.4836466", "0.48309284", "0.4829325", "0.48217213", "0.48016065", "0.4800516", "0.47976476", "0.47888544", "0.47754222", "0.47705188", "0.47635517", "0.47602528", "0.4753367", "0.47437656", "0.47326675", "0.47281724", "0.47280866", "0.4716962", "0.47168446", "0.47036743", "0.47005817", "0.4696565", "0.46835297", "0.46764404", "0.46743345", "0.46615723", "0.4659982", "0.46486434", "0.46431032", "0.46264574", "0.46259314", "0.46251157", "0.46245113", "0.46236628", "0.46228835", "0.46122354", "0.46088213", "0.4604554", "0.46037704", "0.46018127", "0.4596254", "0.45961598", "0.45904356", "0.45897976", "0.45862278", "0.458583", "0.45846647", "0.4578805", "0.45754918" ]
0.6443549
1
The most recent rarity of this card.
def rarity self.sets.first[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_recent_recipe\n recipe_cards.last\n end", "def most_recent_recipe\n self.recipe_cards.sort do |recipe_card|\n recipe_card.date\n end.first\n end", "def most_recent_recipe\n self.recipecards.max_by{|recipecard| recipecard.date}.recipe\n end", "def most_recent_recipe\n recipe_cards.sort_by { |card| card.date}.reverse.first.recipe\n end", "def most_recent_recipe\n self.user_recipe_cards.sort_by do |card|\n card.date\n end.last\n end", "def most_recent_recipe\n self.find_user_recipe_cards.sort_by{|rcard| rcard.date}[-1]\n end", "def most_recent_recipe\n my_recipes = self.recipe_cards\n my_recipes.sort_by do |rec_card|\n [\n rec_card.date.split(\"/\")[0].to_i,\n rec_card.date.split(\"/\")[1].to_i\n ]\n end[-1]\n end", "def most_recent_recipe\n self.recipe_cards.max_by {|recipecard| recipecard.date}\nend", "def most_recent_recipe\n most_recent_recipe = RecipeCard.all.select {|atr| atr.user.name == self.name}\n most_recent_recipe.sort_by {|atr| atr.date}.reverse[0]\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def rcrt\n arm = Speacial_Status['Armor']\n return arm[@id] != nil && arm[@id]['rcrt'] != nil ? arm[@id]['rcrt'] : 0\n end", "def most_recent_recipe\n self.recipes.last\n end", "def highest_review \n\t\tself.reviews.sort_by{ |review| review.rating }.reverse.first\n\tend", "def highest_review \n\t\tself.reviews.sort_by{|review| review.rating }.reverse.first\n\tend", "def rarity\r\n 6\r\n end", "def highest_rated\n joins(:ratings).group('rateable_id').order('avg(ratings.value) desc').first\n end", "def most_recent_recipe\n recent_recipe_array = get_user_recipes.collect do |recipe_card|\n recipe_card.recipe\n end\n recent_recipe_array[-1]\n end", "def most_recent_recipe\n self.recipes.last\n end", "def most_recent_review\n\t\tself.reviews.sort_by{ |review| review.id }.reverse.first\n\tend", "def most_recent_recipe\n date = \"0000-01-01\"\n binding.pry\n recipe = nil\n self.find_recipe_cards.each do |recipe_card|\n if Date.parse(recipe_card.date) > date\n Date.parse(date) = Date.parse(recipe_card.date)\n recipe = recipe_card\n end\n end\n recipe\n date\n end", "def current_originality_rating\n if self.get_upvotes(:vote_scope => 'rate_originality').size > 0\n self.get_likes(:vote_scope => 'rate_originality').sum(:vote_weight) / self.get_upvotes(:vote_scope => 'rate_originality').size\n else\n \"no ratings yet\"\n end\n end", "def most_recent_recipe\n self.find_recipe_card_by_user.sort_by {|v| v.date}.last.recipe.name\n end", "def high_card\n @cards.sort[-1]\n end", "def get_oldest_rate\n\t\t\treturn CurrencyRateUpdate.get_oldest\n\t\tend", "def most_recent\n self.stats.first\n end", "def randomRarity\n\t\tr = Random.rand\n\t\tfor rarity in RARITIES\n\t\t\tif r < DISTRIBUTION[rarity]\n\t\t\t\treturn rarity\n\t\t\tend\n\t\tend \n\tend", "def rating\n return @rating\n end", "def most_recent_recipe\n\t\trecipes.sort { |recipe| recipe.date }.first\n\tend", "def dust_value(card_rarity)\n\t\tcase card_rarity\n\t\twhen \"Free\"\n\t\t\treturn 0\n\t\twhen \"Common\"\n\t\t\treturn 40\n\t\twhen \"Rare\"\n\t\t\treturn 100\n\t\twhen \"Epic\"\n\t\t\treturn 400\n\t\twhen \"Legendary\"\n\t\t\treturn 1600\n\t\tend\n\tend", "def rating\n cached_rating\n end", "def get_color_rarity\n if self.rating[\"ratingRecommendation\"].include?('Buy')\n self.rating_color = 'greenish'\n elsif self.rating[\"ratingRecommendation\"] == \"Neutral\"\n self.rating[\"ratingRecommendation\"] = \"Hold\"\n self.rating_color = 'yellowish'\n else\n self.rating_color = 'redish'\n end\n end", "def top_card\n return nil if @discard.empty?\n @discard.last.to_s\n end", "def most_popular\n\n # Recipecard.all.select {|rc| rc.recipe ==self}\n # most_popular.map {|rc| rc.users}\n recipe_hash = {}\n RecipeCard.all.each do |recipecard|\n if recipe_hash[recipecard.name]==nil\n recipe_hash[recipecard.name]=1\n else\n recipe_hash[recipecard.name]+= 1\n end\n end\n recipe_hash.max_by{|k,v| v}[0]\n end", "def max_rating\n 10\n end", "def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end", "def most_recent_version\n card_versions.detect { |card_version| card_version.version == latest_version }\n end", "def peek\n @cards.last.value\n end", "def recentreview\n return 'No reviews yet!' if self.reviews.length == 0\n self.reviews.reverse.each {|review| return review.body if review.rating >= 4}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 3}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 2}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 1}\n end", "def highest_rating_comment\n \tcomments.rating_desc.first\n end", "def acquired_value\n @object.most_recent_acquired_by_amount || 0\n end", "def least_favorite_recipe\n recipes_sorted_by_rating[0]\n end", "def rating\n 0\n end", "def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end", "def latest_restorable_time\n data[:latest_restorable_time]\n end", "def latest_restorable_time\n data[:latest_restorable_time]\n end", "def humanized_rating\n\t\tRATINGS.invert[self.rating]\n\tend", "def high_card \n\t\tcards.max\n\tend", "def most_recent_recipe\n recipes.last\n # should return the recipe most recently added to the user's cookbook.\n end", "def rating\n response[\"rating\"]\n end", "def max_rate_value\n options[:stars]\n end", "def review_stars(review)\n {\n active: review.rating,\n blank: Review::RATINGS.last - review.rating\n }\n end", "def last\n self.class.where(id: rid).chronological.last\n end", "def rating_kind\n @ole.ratingKind\n end", "def latest\n scores.last\n end", "def highest_rating_comment\n\n \t\tcomments.rating_desc.first\n\tend", "def media_content_rating_new_zealand\n return @media_content_rating_new_zealand\n end", "def best_candidate\n self.by_quality.first\n end", "def top_three_recipes\n self.find_user_recipe_cards.sort_by{|rcard| rcard.rating}.reverse![0..2]\n end", "def rate\n return @rate\n end", "def top_three_recipes\n self.recipes.sort_by {|info| info.rating}.pop(3)\n end", "def high_card\n high_value = 0\n @grip.each do |card|\n new_value = FACE_VALUES.find_index(card.value)\n if new_value > high_value\n high_value = new_value\n end\n end\n FACE_VALUES[high_value]\n end", "def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end", "def most_popular_show\n Show.highest_rating\nend", "def maximum_heart_rate(ride)\n points = ride.points.reject { |point| point.heart_rate.nil? }\n return nil if points.size == 0\n points.map(&:heart_rate).max\n end", "def rating\n @rating\n end", "def avatax_the_one_rate\n rates = all.to_a\n rates.sort_by(&:id).first\n end", "def most_recent_recipe\n recipes.sort_by do |i| \n i.date\n end.last\n end", "def actual_accommodation\r\n return self.accommodation_histories.last\r\n end", "def high_card\n @hand.max_by{|card| card.point}.point.to_i\n end", "def top_three_recipes\n sorted_recipe_cards = self.recipe_cards.sort do |recipe_card|\n recipe_card.rating end\n if sorted_recipe_cards.length < 3\n sorted_recipe_cards\n else\n sorted_recipe_cards[-3,3]\n end\n end", "def rating\n @ole.Rating\n end", "def rating\n r = Rating.create_from_database(rating_id.to_i)\n r.rating\n end", "def crt\n arm = Speacial_Status['Armor']\n return arm[@id] != nil && arm[@id]['crt'] != nil ? arm[@id]['crt'] : 0\n end", "def top_three_rated_afterthoughts\n self.afterthoughts_by_rating.first(3)\n end", "def sort_by_decending_rating\n self.find_recipe_card_by_user.sort_by {|recipe| recipe.rating}.reverse\n end", "def last_rut; end", "def top_three_recipes\n\t\trecipes.select { |recipe| recipe.rating }.sort_by { |recipe| recipe.rating }.last(3)\n\tend", "def rating\n rating_calculator.rate(raters)\n end", "def media_content_rating_canada\n return @media_content_rating_canada\n end", "def high_card\n [1, values, \"#{best_card}-#{card_names(values)[1]} High Card\"]\n end", "def issue_rating_updated_at\n unless self.issue_ratings.first.nil?\n # Return the updated_at date of the latest rating for this issue.\n return self.issue_ratings.order(updated_at: :desc).first.updated_at\n end\n end", "def current_card\n @deck.cards[count]\n end", "def top_three_recipes\n my_recipes = self.recipe_cards\n my_recipes.sort{|a, b| b.rating <=> a.rating }.slice(0,3)\n end", "def current_value\n @top_card.value\n end", "def last_guessed_card\n current_round.guesses.last.card_id\nend", "def rcrt\n wpn = Speacial_Status['Weapon']\n return wpn[@id] != nil && wpn[@id]['rcrt'] != nil ? wpn[@id]['rcrt'] : 0\n end", "def high_card(hand)\n\t\thand_num = check_num(hand)\n\t\treturn hand_num.max\n\tend", "def last_occurrence_age(item)\n last_occurrence_age_cache[item.representation]\n end", "def max_quarry_discount\n victory_points\n end", "def race\n @race\n end", "def current_card\n @deck.cards[0]\n end", "def randomRare\n\t\tgolden = randomGold(:rare)\n\t\tmakeCard(:rare, golden)\n\tend", "def get_top_order\n cards.maximum('card_order') || 0\n end", "def getRarity(defindex = \"\")\n item = nil\n item = $itemh[\"items_game\"][\"items\"][defindex]\n if(!item.nil?)\n if(!item[\"item_rarity\"].nil?)\n return item[\"item_rarity\"].to_s\n else\n return \"common\"\n end\n else\n return \"common\"\n end\nend", "def reward_rate\n return nil if self.reward_count == 0 || self.reward_count.nil? || self.reward.nil?\n return self.reward / self.reward_count.to_f\n end", "def relevancy\n product_response[\"Classification\"][\"relevancyScore\"].to_i\n end", "def top\n cards.first\n end", "def highest_rating_comment\r\n comments.rating_desc.pluck(:body).first\r\n end", "def rating\n if in_the_future\n return nil\n else\n #TODO replace this with actual rating\n return rand(1..5)\n end\n end", "def size_bonus\n @character.race.size.modifier\n end" ]
[ "0.6986351", "0.65454805", "0.6493216", "0.6412613", "0.6387238", "0.6382523", "0.6264759", "0.6220972", "0.61437535", "0.61038345", "0.6101156", "0.60983294", "0.6033237", "0.6030501", "0.6021791", "0.6008673", "0.6004816", "0.5997525", "0.59605414", "0.5938334", "0.59274685", "0.5921387", "0.59209645", "0.59192145", "0.59017634", "0.58576435", "0.5849999", "0.5831174", "0.5786147", "0.576502", "0.57255185", "0.570984", "0.56917787", "0.5682097", "0.568023", "0.564205", "0.5635181", "0.56133205", "0.56119496", "0.5607001", "0.56014055", "0.5581712", "0.5575507", "0.55640185", "0.55640185", "0.5550488", "0.5549633", "0.55491894", "0.5542792", "0.5537867", "0.55311954", "0.549723", "0.5484934", "0.54822624", "0.54648316", "0.5464357", "0.54345363", "0.5432006", "0.5412638", "0.5411909", "0.5406503", "0.5392673", "0.5378916", "0.53655547", "0.53593665", "0.5351863", "0.53516644", "0.5349585", "0.534353", "0.53308666", "0.53295845", "0.5299103", "0.5282389", "0.52821344", "0.5277493", "0.52738017", "0.526856", "0.5265695", "0.5263833", "0.5260889", "0.52579033", "0.5254541", "0.5249073", "0.5241109", "0.5233021", "0.5232386", "0.52274716", "0.5213821", "0.5206965", "0.5203962", "0.51942766", "0.5193176", "0.51876456", "0.51825583", "0.518009", "0.5180044", "0.51770973", "0.5175463", "0.51732796", "0.51718885" ]
0.6511575
2
The most recent set this card appeared in.
def set self.sets.first[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_set\n match_sets.last\n end", "def last\r\n\t\[email protected]\r\n\tend", "def most_recent_recipe\n recipe_cards.last\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def most_recent\n self.stats.first\n end", "def latest\n self\n end", "def most_recent_recipe\n self.recipe_cards.sort do |recipe_card|\n recipe_card.date\n end.first\n end", "def most_recent_recipe\n recipe_cards.sort_by { |card| card.date}.reverse.first.recipe\n end", "def most_recent_recipe\n recent_recipe_array = get_user_recipes.collect do |recipe_card|\n recipe_card.recipe\n end\n recent_recipe_array[-1]\n end", "def most_recent_recipe\n self.find_user_recipe_cards.sort_by{|rcard| rcard.date}[-1]\n end", "def last\n @history.last\n end", "def most_recent_recipe\n self.recipe_cards.max_by {|recipecard| recipecard.date}\nend", "def last\n self.all.last\n end", "def most_recent_recipe\n self.user_recipe_cards.sort_by do |card|\n card.date\n end.last\n end", "def high_card\n @cards.sort[-1]\n end", "def last\n self.invert_order.all.first\n end", "def most_recent_recipe\n my_recipes = self.recipe_cards\n my_recipes.sort_by do |rec_card|\n [\n rec_card.date.split(\"/\")[0].to_i,\n rec_card.date.split(\"/\")[1].to_i\n ]\n end[-1]\n end", "def last\n items.compact.last\n end", "def initial_entry()\n return sets[0].first\n end", "def initial_entry()\n return sets[0].first\n end", "def latest_cave\n\t\t\tPlayerCave[latest_cave_id]\n\t\tend", "def last\n self.class.where(id: rid).chronological.last\n end", "def last\n @regions.sort.last\n end", "def most_recent_review\n\t\tself.reviews.sort_by{ |review| review.id }.reverse.first\n\tend", "def most_recent_recipe\n self.recipecards.max_by{|recipecard| recipecard.date}.recipe\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def last_share_at\n shares.maximum(:created_at)\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def most_recent_recipe\n most_recent_recipe = RecipeCard.all.select {|atr| atr.user.name == self.name}\n most_recent_recipe.sort_by {|atr| atr.date}.reverse[0]\n end", "def last\n all.last\n end", "def last\n @features.sort.last\n end", "def latest\n scores.last\n end", "def getLatest()\n return Foerdermitglied.get(self.Pnr)\n end", "def top_card\n return nil if @discard.empty?\n @discard.last.to_s\n end", "def latest\n return self.transactions.first(:order => [:date.desc])\n end", "def last\n result ? all.last : limit(1).descending.all.last\n end", "def most_recent_recipe\n\t\trecipes.sort { |recipe| recipe.date }.first\n\tend", "def getLatest()\n return Gesellschafter.get(self.Mnr)\n end", "def last_id\n # hashs are ordered, so just return the latest entry\n @entries.keys.last\n end", "def most_recent_recipe\n self.recipes.last\n end", "def peek\n @cards.last.value\n end", "def last_summary\n\t\t@db[:gold_summary].reverse_order(:summary_date).get(:created_date)\n\tend", "def most_recent_recipe\n self.recipes.last\n end", "def top()\n @store.last\n end", "def last\n @enumerable.last\n end", "def current\n all.last\n end", "def last\n to_a.last\n end", "def last\n @values.last\n end", "def last\n @adapter.last(collection)\n end", "def latest_report\n @report_history.last\n end", "def most_recent_recipe\n self.find_recipe_card_by_user.sort_by {|v| v.date}.last.recipe.name\n end", "def top()\n @a.last\n end", "def last\n all.last\n end", "def last\n asc(:id).last\n end", "def last_index()\n first_empty = sets.find_index(&:empty?)\n index = if first_empty.nil?\n sets.size - 1\n else\n first_empty.zero? ? 0 : first_empty - 1\n end\n\n return index\n end", "def last_index()\n first_empty = sets.find_index(&:empty?)\n index = if first_empty.nil?\n sets.size - 1\n else\n first_empty.zero? ? 0 : first_empty - 1\n end\n\n return index\n end", "def show_most_popular\n @card_sets = CardSet.order(\"impressions_count DESC\")[0..19]\n end", "def last\n @ordered_elements.last\n end", "def current_manifest\n @manifests.last\n end", "def top()\n @data.last\n end", "def last\n @features.last\n end", "def latest\n latest_order.first\n end", "def lastElement\n return @stk[@count]\n end", "def last\n stack.last\n end", "def last\n @locations.last\n end", "def last_event\n history.last\n end", "def last_event\n history.last\n end", "def last_seen_at\n @data[:last_seen_at]\n end", "def last_story_date\n self.stories.select {|story| story.completion_date}.sort_by(&:completion_date).last.completion_date.to_s rescue nil\n end", "def most_recent\n Visit.all.sort_by{|visit| visit.timestamps}.last\n end", "def newest\n @messages.last\n end", "def set_most_recent\n @recent = Resident.order(\"created_at\").last\n end", "def set_most_recent\n @recent = Doctor.order(\"created_at\").last\n end", "def first\r\n\t\[email protected]\r\n\tend", "def total_sets\n Setlist.maximum(:set_id, :conditions => [\"set_id != '9' AND show_id = ?\", id])\n end", "def last\n @collection.size - 1\n end", "def last\n self[-1]\n end", "def most_recent_version\n card_versions.detect { |card_version| card_version.version == latest_version }\n end", "def last_value_set(xs)\n xs.sort_by {|y| [y[:updated_at], y[:id]] }.last[:new_value]\n end", "def last_updated_at\n [ self.calendar_items.accessible.maximum('nodes.created_at'), self.updated_at ].compact.max\n end", "def get_max_updated_at\r\n @summary.max_updated_at\r\n end", "def last\r\n self[-1]\r\n end", "def last\n model.last\n end", "def most_recent_recipe\n date = \"0000-01-01\"\n binding.pry\n recipe = nil\n self.find_recipe_cards.each do |recipe_card|\n if Date.parse(recipe_card.date) > date\n Date.parse(date) = Date.parse(recipe_card.date)\n recipe = recipe_card\n end\n end\n recipe\n date\n end", "def stored_data_last_key\n stored_data.keys.sort.last || nil\n end", "def most_recent_recipe\n recipes.sort_by do |i| \n i.date\n end.last\n end", "def last_fetch\n datetime_from(\"sf:last_fetch\")\n end", "def last\n\t\t\t@last\n\t\tend", "def getLatest()\r\n return EeKonto.get(self.KtoNr)\r\n end", "def last\n all[all.size - 1]\n end", "def last\n @items.last\n end", "def last\n return sync { @last }\n end", "def most_recent_time_stamp\n current_snapshot_person_tweets.maximum(:created_at)\n end", "def first_set\n match_sets.first\n end", "def active_set_history\n ash = []\n end", "def last\n order(:id).reverse.limit(1)\n end" ]
[ "0.7558938", "0.71380925", "0.6808984", "0.676779", "0.65960115", "0.6458018", "0.6437813", "0.6324888", "0.63213724", "0.6307577", "0.62337464", "0.6200927", "0.61918", "0.6189313", "0.61602825", "0.61494035", "0.6147676", "0.6136807", "0.6133241", "0.6133241", "0.6117776", "0.61174315", "0.6112748", "0.61011565", "0.608336", "0.6079808", "0.6079808", "0.60723114", "0.606594", "0.606594", "0.606594", "0.606594", "0.6048107", "0.60416096", "0.60410064", "0.6038546", "0.60188127", "0.5994046", "0.599343", "0.59837323", "0.59698117", "0.5954981", "0.5949317", "0.5935392", "0.5925818", "0.5922232", "0.5918952", "0.59125245", "0.5902362", "0.5890048", "0.5880056", "0.58452886", "0.58386266", "0.58378816", "0.58372194", "0.58345366", "0.58340335", "0.5812847", "0.5798596", "0.5798596", "0.579756", "0.57938224", "0.57839036", "0.5777398", "0.57680655", "0.5761864", "0.5758086", "0.5752856", "0.57429266", "0.57355666", "0.57355666", "0.5731086", "0.57304287", "0.5730074", "0.57279485", "0.57269454", "0.572163", "0.5717274", "0.5714501", "0.57010424", "0.5699297", "0.5694147", "0.5691586", "0.56871444", "0.5683303", "0.56819403", "0.56808895", "0.56774443", "0.5675996", "0.5672824", "0.5666893", "0.5660804", "0.5655504", "0.5652979", "0.564748", "0.5642146", "0.56315506", "0.56297225", "0.5620782", "0.5616145" ]
0.6270748
10
Set the power and toughness from an Array.
def pow_tgh=(pt) return if pt.nil? self.pow = pt[0] self.tgh = pt[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hand=(array)\n @my_hand = array\n end", "def **(power)\n\tself.class.new(@units.inject({}) {|h,(unit,exponent)| h[unit] = power * exponent; h })\n end", "def power_araray(array)\n ## recorrer el arreglo con map\n ## hacer la operatorio con ** 2\n ## map entrega un copia lista\nend", "def value(dendrites_array,num)\n\t\t\tx=activation(dendrites_array,num)\n\t\t\t@value=sigmoidal(x)\n\t\tend", "def value(dendrites_array,num)\n\t\t\tx=activation(dendrites_array,num)\n\t\t\t@value=sigmoidal(x)\n\t\tend", "def **(power)\n return map {|currency, money| money ** power}\n end", "def powerset(arr)\n arr.inject([Set.new].to_set) do |powerset, el|\n new_powerset = Set.new\n powerset.each do |subset|\n new_powerset << subset\n new_powerset << subset + [el]\n end\n new_powerset\n end\n end", "def let_simple_set(arr, variables)\n variables.set_var(arr[1], arr[2])\n arr[2].to_i\n end", "def mutliplied(array)\nend", "def square_array(array) #build square_array method\r\n\r\n new_array = [] #new array of squared numbers\r\n\r\n array.each do |integer|#implement own logic\r\n new_array << integer ** 2 #shovel /push logic into array \r\n end\r\n return new_array #returns array of these squared numbers\r\nend", "def multiply_els(array)\n array.my_inject { |product, power| product * power }\nend", "def create_power(ary)\n keys = [:name]\n create_klass_data(Power, keys, ary)\nend", "def set_power(watts)\n puts \"Setting Watts to #{watts.to_i} watts\" if $verbose\n w='PC'+(('000'+watts.to_i.to_s)[-3..-1])+';'\n puts w if $verbose\n ret=send_cmd(w,'PC;',w,0.25,1.0,3)\n if(ret)\n return(ret.gsub(/^PC/,'').gsub(/;$/,'').to_i)\n else\n return(nil)\n end\nend", "def **(power)\n unless power.is_a?(Integer) && power > 0\n raise ArgumentError, \"Quantities can only be raised to fixed powers (given #{power})\"\n end\n if power == 1\n self\n else\n self * self**(power - 1)\n end\n end", "def set_random_weapon(weapons_array)\n @weapon = weapons_array[Random.new.rand(0..(weapons_array.length-1))]\n end", "def square_array(array)\r\n solution = []\r\n array.each do |number|\r\n solution << number**2\r\n end\r\n solution \r\nend", "def init(array)\n if array.include?(1)\n testPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(2)\n testBetaPowerEfficient\n puts @@SEPARATOR\n end\n \n if array.include?(3)\n testSpaceCity\n puts @@SEPARATOR\n end\n \n if array.include?(4)\n testNumericDamage\n puts @@SEPARATOR\n end\n \n if array.include?(5)\n testSpecificDamage\n puts @@SEPARATOR\n end\n end", "def calculate_doubles(array)\n\tmapped_array = array.map { |num| num * 2 }\nend", "def productify(array)\n\nend", "def square_array(array)\n new_array = []\n array.each { |e| new_array << e ** 2 }\n new_array\nend", "def guess=(guess)\n @guess=guess\n @guess_array<<@guess\n end", "def power\n data.power\n end", "def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end", "def square_array(array)\n squared_array = []\n \n array.each do |number| \n squared_array << number**2 \n end\n \n squared_array\nend", "def square_array(array)\nnew_array = []\n array.length.times do |squared|\n new_array.push(array[squared]**2)\nend\n new_array\nend", "def doubler(array)\n array.map do |num|\n num *= 2\n end\n\nend", "def multiply_els(array)\n\tarray.inject(1) { |num, item| num * item }\n\nend", "def square_array (array)\n\nnewarray = []\n\narray.each do |element|\n newarray.push(element**2) \nend\n\nnewarray\n\nend", "def square_array(array)\n numbers = []\n array.each do |number| numbers << number ** 2\n end\n numbers\nend", "def double_array(array)\n array*2\nend", "def calculate_doubles!(array)\n\t\n\tarray.map! { |num| num * 2}\nend", "def squares(array)\n\t\n\tnew_array = array.map { |num| num * num}\n\tp new_array\nend", "def set_values(array)\n @row = array\n end", "def square_array(array)\n array.each_with_index do | num, index |\n array[index] = num * num\n end\nend", "def double_numbers(array)\n new_array = []\n\n array.each do |number|\n new_array << number *= 2\n end\n return new_array\nend", "def set_power!(state)\n level = case state\n when :on\n 1\n when :off\n 0\n else\n raise ArgumentError.new(\"Must pass in either :on or :off\")\n end\n send_message!(Protocol::Device::SetPower.new(level: level), wait_for: Protocol::Device::StatePower) do |payload|\n if level == 0\n payload.level == 0\n else\n payload.level > 0\n end\n end\n self\n end", "def setmhplowp(effect)\n set_hp_mp_low_param_per(effect[1], effect[2], effect[3].to_i)\n end", "def kesha_maker(array)\n array.each do |kesha|\n kesha[2] = \"$\"\nend\nend", "def multiply_els(_array = false)\n my_inject(:*)\n end", "def multiply (array)\n\tarray.inject(1) do |result, element|\n\t\tresult * element\n\tend\nend", "def coin_array; end", "def initialize array\n @array = array\n end", "def square_array(array)\n squared = []\n array.each do |num|\n num**2\n squared << num**2\n end\n squared\nend", "def productify_easy(arr)\n product = arr.inject(:*)\n new_arr = []\n arr.each do |num|\n new_arr << product / num\n end\n new_arr\nend", "def power=(max)\n return if @power == max;\n @power = [[max, 0].max, 40].min\n for i in 1..40\n sprite = @sprites[i]\n sprite.visible = (i <= @power) if sprite != nil\n if @type == 19\n sprite.bitmap = @bubble_bitmaps[rand(@bubble_bitmaps.size)]\n elsif @type == 20\n sprite.bitmap = @bubble2_bitmaps[rand(@bubble2_bitmaps.size)]\n elsif @type == 3\n r = rand(@snow_bitmaps.size)\n @info[i] = r\n sprite.bitmap = @snow_bitmaps[r]\n end\n end\n end", "def **(exponent)\n end", "def setmhplow(effect)\n set_hp_mp_low_param(effect[1], effect[2], effect[3].to_i)\n end", "def power=(value)\r\n raise ArgumentError, 'Value must be [0..100]' unless (0..100).include?(value)\r\n @access = flags + (value << 26)\r\n end", "def power(num, power)\n num_arr = [num] * power\n\n num_arr.reduce {|product, num| multiply(product, num)}\nend", "def square_array(array)\narray.map { |to_square| to_square**2}\nend", "def gain(array)\n sum = array.inject(0) {|sum,x| sum + x }\n gain = 0.0\n array.each do |num|\n gain += (num.to_f/sum.to_f) * calcLog2(num.to_f/sum.to_f)\n end\n return -gain.round(3)\n end", "def replace( ary )\n closed!\n @leds.length.times do |ii|\n @leds[ii] = Integer(ary[ii])\n end\n self\n end", "def square(array)\n\n\tcoefficient = array[0]\n\texponent = array[1]\n\tvariable = array[2]\n\n\tcoefficient **= 2\n\texponent *= 2\n\n\tif coefficient == 1 && variable == 1\n\t\tterm = \"#{coefficient}\"\n\t\treturn term\n\tend\n\n\tif coefficient == 1\n\t\tterm = \"#{variable}^#{exponent}\"\n\t\treturn term\n\tend\n\n\tif variable == 1\n\t\tterm = \"#{coefficient}\"\n\t\treturn term\n\tend\n\n\tterm = \"#{coefficient}#{variable}^#{exponent}\"\n\n\treturn term\nend", "def buy_fruit(array)\n array.map { |fruit, value| [fruit] * value }.flatten\nend", "def square_array(array)\n squared = []\n array.each { |element| squared << element ** 2 }\n squared\nend", "def square_array(pancakes)\n elephant = []\n pancakes.each do |num|\n elephant << num**2\n end\n return elephant\nend", "def square_array(array)\n\n squared = []\n array.each do |num|\n squared.push(num * num)\n end\n\n squared\n \nend", "def square_array(array)\n\tsquared_nums = []\n\n array.each do |number|\n squared_nums << (number * number)\n end\n squared_nums\nend", "def how_high\n energy * energy\nend", "def softbins=(val)\n softbins.algorithm = val\n end", "def product(array) \n sum = 1\n array.each { |x| \n sum = sum * x\n\n } \n sum \n \n \nend", "def set_power(power, effect, duration)\n cmd = \"{\\\"id\\\":6,\\\"method\\\":\\\"set_power\\\",\\\"params\\\":[\\\"#{power}\\\",\\\"#{effect}\\\",#{duration}]}\\r\\n\"\n request(cmd)\n end", "def square_array(array)\n # your code here\n newArray = []\n array.each do |num|\n number = num**2\n newArray.push(number)\n end\n return newArray\nend", "def letter_set=(array)\n @letter_set = array\n @table, @letter_indices = make_tabula_recta\n end", "def buy_fruit2(array)\n array.map {|fruit, quantity| [fruit] * quantity}.flatten\nend", "def square_array(array)\n new_numbers = []\n numbers = 0\n while array[numbers] do\n new_numbers << array[numbers] ** 2\n numbers += 1\n end\nreturn new_numbers\nend", "def cubed_values (array)\n\n cubed_array = array.map { | number | number ** 3 }\n return cubed_array\n\nend", "def double_numbers(array)\n\tarray.map { |integer| integer * 2 }\t\nend", "def toneAll(val)\n self.tone.red += val\n self.tone.green += val\n self.tone.blue += val\n end", "def double_array(array)\n\tn = [1, 2, 3]\n\tn * 2\nend", "def update!(**args)\n @power = args[:power] if args.key?(:power)\n @unit = args[:unit] if args.key?(:unit)\n @unit_mid = args[:unit_mid] if args.key?(:unit_mid)\n end", "def kesha_maker(array)\n array.each do |a|\n a[2] = \"$\"\n end\nend", "def gain_temp_hp(_amount)\n\t\t@temp_hp = _amount\n\tend", "def multiply_me(array, int)\r\n\r\n arr = [] # empty array created\r\n\r\n i = 0 # iteration starts to multiply each item\r\n while i < array.length\r\n arr << array[i] * int # products collected\r\n i += 1\r\n end\r\n\r\n arr # result\r\nend", "def double_array(input_array)\n \n double_array = []\n \n input_array.each do |number|\n double_array << number *= 2\n end\n return double_array\n\nend", "def buy_fruit(array)\n array.map { |sub_array| [sub_array[0]] * sub_array[1] }.flatten\nend", "def multiply *array\n puts array.inspect\n array.flatten.inject(:*)\n end", "def square_array(array)\n square = []\n \n array.each do |num|\n square << num * num\n end\n square\nend", "def calculate_doubles!(arr)\n arr.map!{|a|a=a*2}\nend", "def square_array(array)\n array.map! { |ele| ele ** 2 }\nend", "def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\"\n end\nend", "def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\"\n end\nend", "def dices=(arr)\n @dices = ((arr + [0,0,0]).sort.reverse)[0..1]\n end", "def update!(**args)\n @strength = args[:strength] if args.key?(:strength)\n @tune = args[:tune] if args.key?(:tune)\n end", "def productify(array)\n prods = [1] * array.length\n current = array[0]\n (1...array.length).each do |i|\n prods[i] *= current\n current *= array[i]\n end\n current = array[-1]\n (array.length - 2).downto(0).each do |i|\n prods[i] *= current\n current *= array[i]\n end\n\n prods\nend", "def mutate_es11(array, probability: 0.2)\n new_array = array.clone\n 0.upto(new_array.length) do |i|\n new_array[i] = inverse(new_array[i]) if rand() < probability\n end\n new_array\nend", "def mult5 array\n array.map do |value| \n value * 5 \n end\nend", "def doubler(numbers)\n # Write your code here\n array=[]\n numbers.each do |num|\n array << num *= 2\n end\n array\nend", "def initialize(array)\n @array = array\n end", "def powerset(array)\n subsets = [[]]\n array.each { |element|\n for i in 0..subsets.length - 1\n current_subset = subsets[i]\n subsets << (current_subset + [element])\n end\n }\n return subsets\nend", "def initialize(array)\n @array = array\n end", "def buy_fruit(array)\n array.map do |sub_arr|\n [sub_arr[0]] * sub_arr[1]\n end.flatten\nend", "def exp=(exp)\n @exp = [[exp, 9999999].min, 0].max\n # Level up\n while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0\n @level += 1\n # Learn skill\n for j in $data_classes[@class_id].learnings\n if j.level == @level\n learn_skill(j.skill_id)\n end\n end\n end\n # Level down\n while @exp < @exp_list[@level]\n @level -= 1\n end\n # Correction if exceeding current max HP and max SP\n @hp = [@hp, self.maxhp].min\n @sp = [@sp, self.maxsp].min\n end", "def buy_fruit(array)\n result = []\n array.each do |value|\n result << [value[0]] * value[1] # again need to place brackets around value[idx] to return an array.\n end\n result.flatten\nend", "def kesha_maker(array)\n array.map do |string|\n string[2] = \"$\"\n end\n array\nend", "def multiply(array,mult)\n array.map{|num| num*mult}\nend", "def get_metals_value(space_units_array, metal, credits)\n\tnumeral = get_numeral_from_space_unit(space_units_array)\n\t@metals_values[metal] = credits.to_i / numeral.to_f\nend", "def pow(power)\n Dimensions.new(self.to_hash).pow!(power)\n end", "def hs=(value); self.state = { :hue => value[0], :sat => value[1] }; end", "def multiply_els(arr)\n\tarr.my_inject(1) do |res, i| \n\t\tres * i \n\tend\nend" ]
[ "0.602114", "0.5796425", "0.5495514", "0.54485124", "0.54485124", "0.5431977", "0.5369213", "0.5281939", "0.5274408", "0.5242032", "0.52373946", "0.52162546", "0.52104753", "0.5205909", "0.51795554", "0.51616263", "0.51427215", "0.51003534", "0.50852215", "0.5081546", "0.50814825", "0.507695", "0.50677884", "0.50532347", "0.5047912", "0.5047402", "0.50438833", "0.5035505", "0.5023385", "0.5015666", "0.5014037", "0.50047565", "0.5001122", "0.49911904", "0.49799505", "0.4978051", "0.4966843", "0.4962664", "0.4961093", "0.49568665", "0.4951909", "0.49456793", "0.49378794", "0.4923669", "0.4914941", "0.49141762", "0.49103022", "0.49036723", "0.48940936", "0.488416", "0.4866622", "0.4860739", "0.48557067", "0.48514542", "0.4849063", "0.4845689", "0.4840388", "0.48399344", "0.48388907", "0.48329827", "0.4832824", "0.4825163", "0.482234", "0.48218548", "0.4808266", "0.48041102", "0.48030427", "0.480247", "0.479738", "0.47898602", "0.47827086", "0.47811022", "0.47806153", "0.47799194", "0.47791648", "0.47706237", "0.4768092", "0.4767482", "0.4766865", "0.47668135", "0.4760318", "0.4760318", "0.4758283", "0.4754671", "0.4753173", "0.4746291", "0.47440547", "0.47427076", "0.473921", "0.47328776", "0.47266132", "0.47152632", "0.47147986", "0.47132546", "0.47071862", "0.47033536", "0.47011518", "0.46993446", "0.46972528", "0.46966094" ]
0.50644916
23
Operator method to determine equality. Does an `==` comparison on each attribute of the Card objects. All must be equal for true.
def == other_card if self.name == other_card.name and self.cost == other_card.cost and self.sets == other_card.sets and self.image_uri == other_card.image_uri and self.multiverse_id == other_card.multiverse_id and self.text == other_card.text and self.flavour_text == other_card.flavour_text and self.types == other_card.types and self.loyalty == other_card.loyalty and self.artist == other_card.artist and self.number == other_card.number return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other_card)\n return false if other_card.nil?\n\n [:suit, :value].all? do |attr|\n self.send(attr) == other_card.send(attr)\n end\n end", "def ==(other)\n other.is_a?(Card) && value == other.value && suit == other.suit\n end", "def eql?(card)\n rank == card.rank && suit == card.suit\n end", "def same(other) \n self.suit == other.suit && self.rank == other.rank\n end", "def eql?(o)\n return false unless o.is_a?(Card)\n o.value == @value && o.suit == @suit\n end", "def ==(another_card)\n\tif(another_card != nil)\n (@rank == another_card.rank and @color == another_card.color)\n\tend\n end", "def ==(other)\n name == other.name &&\n color == other.color &&\n age == other.age\n end", "def ==(other_card)\n self.face == other_card.face \n end", "def ==(other)\n rank == other.rank && suit == other.suit\n end", "def ==(other)\n attributes == other.attributes\n end", "def equals(card)\n\t\tif @suit == card.suit and @rank == card.rank\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n end", "def ==(other_sim)\n other_sim.is_a?(SimCard) and\n code == other_sim.code and\n name == other_sim.name and\n price == other_sim.price\n end", "def eql?(o)\n return false unless o.is_a?(self.class)\n (@cards.eql? o.cards) && (@validator.eql? o.validator) &&\n (@hidden_cards.eql? o.hidden_cards)\n end", "def ==(comp)\n comp.x === x && comp.y === y\n end", "def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end", "def == other\n return false unless other.kind_of? self.class\n attribute_of.all? do |key, val|\n val.get == other.__send__(key)\n end\n end", "def ==(other)\n case other\n when Chair::Row\n @attributes == other.instance_variable_get('@attributes')\n when Array\n @attributes.values == other\n else false\n end\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n airline_data == o.airline_data &&\n amount == o.amount &&\n avs_postcode_policy == o.avs_postcode_policy &&\n bill_to == o.bill_to &&\n card_holder_name == o.card_holder_name &&\n cardnumber == o.cardnumber &&\n csc == o.csc &&\n csc_policy == o.csc_policy &&\n currency == o.currency &&\n duplicate_policy == o.duplicate_policy &&\n expmonth == o.expmonth &&\n expyear == o.expyear &&\n external_mpi == o.external_mpi &&\n identifier == o.identifier &&\n match_avsa == o.match_avsa &&\n mcc6012 == o.mcc6012 &&\n merchantid == o.merchantid &&\n sdk == o.sdk &&\n ship_to == o.ship_to &&\n threedsecure == o.threedsecure &&\n trans_info == o.trans_info &&\n trans_type == o.trans_type\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n merchant_id == o.merchant_id &&\n capacity == o.capacity &&\n area_id == o.area_id &&\n date_time == o.date_time &&\n order_id == o.order_id &&\n extra_info == o.extra_info &&\n promo_code == o.promo_code &&\n credit_card_vault_settings_id == o.credit_card_vault_settings_id &&\n recurring_card_detail_id == o.recurring_card_detail_id &&\n deals == o.deals\n end", "def ==(ct); end", "def ==(ct); end", "def ==(*) end", "def ==(*) end", "def ==(*) end", "def ==(obj)\n if obj.instance_of?(self.class)\n compare_attributes = [\"category_id\", \"combo_item_id\", \"quantity\", \"sequence\"]\n compare_attributes.each do |field|\n if self.send(field) != obj.send(field)\n return false\n end\n end\n return true\n end\n return false\n end", "def same_as?(other_card)\n ##(cc_type == other_card.cc_type) && (last_digits == other_card.last_digits) && (name == other_card.name) && (user_id == other_card.user_id) && (year == other_card.year) && (month == other_card.month)\n card_data == other_card.card_data\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n created_time == o.created_time &&\n last_modified_time == o.last_modified_time &&\n token == o.token &&\n user_token == o.user_token &&\n card_product_token == o.card_product_token &&\n last_four == o.last_four &&\n pan == o.pan &&\n expiration == o.expiration &&\n expiration_time == o.expiration_time &&\n cvv_number == o.cvv_number &&\n chip_cvv_number == o.chip_cvv_number &&\n barcode == o.barcode &&\n pin_is_set == o.pin_is_set &&\n state == o.state &&\n state_reason == o.state_reason &&\n fulfillment_status == o.fulfillment_status &&\n reissue_pan_from_card_token == o.reissue_pan_from_card_token &&\n fulfillment == o.fulfillment &&\n bulk_issuance_token == o.bulk_issuance_token &&\n translate_pin_from_card_token == o.translate_pin_from_card_token &&\n activation_actions == o.activation_actions &&\n instrument_type == o.instrument_type &&\n expedite == o.expedite &&\n metadata == o.metadata &&\n contactless_exemption_counter == o.contactless_exemption_counter &&\n contactless_exemption_total_amount == o.contactless_exemption_total_amount\n end", "def all_equal?\n a = self.first\n all? { |b| a == b }\n end", "def ==(c) \n (@x == c.x) && (@y == c.y)\n end", "def eql?(hand)\n cards.all? { |card| hand.cards.include?(card) }\n end", "def ==(other)\n @players == other.players and @turn == other.turn\n end", "def equal?(other); end", "def ==(other)\n self.class == other.class &&\n attributes == other.attributes\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n account_id == o.account_id &&\n campaign_id == o.campaign_id &&\n csp_id == o.csp_id &&\n reseller_id == o.reseller_id &&\n status == o.status &&\n create_date == o.create_date &&\n auto_renewal == o.auto_renewal &&\n billed_date == o.billed_date &&\n brand_id == o.brand_id &&\n usecase == o.usecase &&\n sub_usecases == o.sub_usecases &&\n description == o.description &&\n embedded_link == o.embedded_link &&\n embedded_phone == o.embedded_phone &&\n affiliate_marketing == o.affiliate_marketing &&\n number_pool == o.number_pool &&\n age_gated == o.age_gated &&\n direct_lending == o.direct_lending &&\n subscriber_optin == o.subscriber_optin &&\n subscriber_optout == o.subscriber_optout &&\n subscriber_help == o.subscriber_help &&\n sample1 == o.sample1 &&\n sample2 == o.sample2 &&\n sample3 == o.sample3 &&\n sample4 == o.sample4 &&\n sample5 == o.sample5 &&\n message_flow == o.message_flow &&\n help_message == o.help_message &&\n reference_id == o.reference_id &&\n mock == o.mock &&\n next_renewal_or_expiration_date == o.next_renewal_or_expiration_date\n end", "def attr_set?(cards, attr)\n array = []\n cards.each do |card|\n # evalutes the string 'attr' and returns the value\n array << card.send(attr)\n end\n\n # only return true if it's all the same or totally different\n return true if array.uniq.count == 1\n return true if array.uniq.count == 3\n return false\n end", "def ==(other)\n @name == other.name && @amount == other.amount\n end", "def ==(other)\n other.present? && self.attributes == other.attributes\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n commseq_postcard_uuid == o.commseq_postcard_uuid &&\n commseq_step_uuid == o.commseq_step_uuid &&\n commseq_uuid == o.commseq_uuid &&\n conversion_dts == o.conversion_dts &&\n cost == o.cost &&\n customer_uuid == o.customer_uuid &&\n delivered_dts == o.delivered_dts &&\n from_address_line1 == o.from_address_line1 &&\n from_address_line2 == o.from_address_line2 &&\n from_city == o.from_city &&\n from_name == o.from_name &&\n from_state == o.from_state &&\n from_zip == o.from_zip &&\n mailed_dts == o.mailed_dts &&\n order_id == o.order_id &&\n postcard_tracking_uuid == o.postcard_tracking_uuid &&\n status == o.status &&\n submit_dts == o.submit_dts &&\n to_address_line1 == o.to_address_line1 &&\n to_address_line2 == o.to_address_line2 &&\n to_city == o.to_city &&\n to_name == o.to_name &&\n to_state == o.to_state &&\n to_zip == o.to_zip &&\n tracking_description == o.tracking_description\n end", "def eql?(other)\n self.suit == other.suit && self.value == other.value\n end", "def eql?(*) end", "def ==(other)\n return false if other.nil? || !other.respond_to?(:attributes)\n attributes == other.attributes\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.send(name) }\n end", "def ==(other)\n self.class == other.class &&\n name == other.name &&\n age == other.age &&\n gender == other.gender &&\n species == other.species &&\n toys == other.toys\n end", "def ==(other)\n if @rank == other.rank && @suit == other.suit\n return true\n else\n return false\n end\n end", "def ==(other)\n result = (other.x == x && other.y == y && other.z == z)\n # puts \"(#{other.x} == #{x} && #{other.y} == #{y} && #{other.z} == #{z}) = #{result.inspect}\"\n result\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n lac == o.lac &&\n cid == o.cid &&\n radio == o.radio &&\n mcc == o.mcc &&\n mnc == o.mnc &&\n signal == o.signal &&\n psc == o.psc &&\n asu == o.asu &&\n ta == o.ta\n end", "def ==(other)\n card_token == other.card_token\n end", "def is_equal?(a)\n @amount == a.amount && @code == a.code\n end", "def ==(other)\n return false unless self.class == other.class\n self.attributes == other.attributes\n end", "def ==(other)\n return false unless other.instance_of? self.class\n attributes == other.attributes\n end", "def ==(*)\n true\n end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other)\n return false unless other.respond_to?(:car)\n\n (car == other.car) && (cdr == other.cdr)\n end", "def ==(other); [TrueClass,FalseClass]; end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n account == o.account &&\n currency == o.currency &&\n risk_limit == o.risk_limit &&\n prev_state == o.prev_state &&\n state == o.state &&\n action == o.action &&\n amount == o.amount &&\n pending_credit == o.pending_credit &&\n pending_debit == o.pending_debit &&\n confirmed_debit == o.confirmed_debit &&\n prev_realised_pnl == o.prev_realised_pnl &&\n prev_unrealised_pnl == o.prev_unrealised_pnl &&\n gross_comm == o.gross_comm &&\n gross_open_cost == o.gross_open_cost &&\n gross_open_premium == o.gross_open_premium &&\n gross_exec_cost == o.gross_exec_cost &&\n gross_mark_value == o.gross_mark_value &&\n risk_value == o.risk_value &&\n taxable_margin == o.taxable_margin &&\n init_margin == o.init_margin &&\n maint_margin == o.maint_margin &&\n session_margin == o.session_margin &&\n target_excess_margin == o.target_excess_margin &&\n var_margin == o.var_margin &&\n realised_pnl == o.realised_pnl &&\n unrealised_pnl == o.unrealised_pnl &&\n indicative_tax == o.indicative_tax &&\n unrealised_profit == o.unrealised_profit &&\n synthetic_margin == o.synthetic_margin &&\n wallet_balance == o.wallet_balance &&\n margin_balance == o.margin_balance &&\n margin_balance_pcnt == o.margin_balance_pcnt &&\n margin_leverage == o.margin_leverage &&\n margin_used_pcnt == o.margin_used_pcnt &&\n excess_margin == o.excess_margin &&\n excess_margin_pcnt == o.excess_margin_pcnt &&\n available_margin == o.available_margin &&\n withdrawable_margin == o.withdrawable_margin &&\n timestamp == o.timestamp &&\n gross_last_value == o.gross_last_value &&\n commission == o.commission\n end", "def eql?(other)\n return true if equal?(other)\n return false unless self == other\n [:id, :fide_id, :rating, :fide_rating, :title, :gender].each do |m|\n return false if self.send(m) && other.send(m) && self.send(m) != other.send(m)\n end\n true\n end", "def ==(other)\n other.is_a?(self.class) &&\n other.rank == @rank &&\n other.suit == @suit\n end", "def ==\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n cardtransaction_id == o.cardtransaction_id &&\n card_id == o.card_id &&\n wallet_id == o.wallet_id &&\n acquirer_id == o.acquirer_id &&\n wallet_currency == o.wallet_currency &&\n merchant_id == o.merchant_id &&\n merchant_name == o.merchant_name &&\n merchant_city == o.merchant_city &&\n merchant_country == o.merchant_country &&\n mcc_code == o.mcc_code &&\n payment_local_time == o.payment_local_time &&\n public_token == o.public_token &&\n payment_amount == o.payment_amount &&\n payment_currency == o.payment_currency &&\n fees == o.fees &&\n payment_country == o.payment_country &&\n payment_id == o.payment_id &&\n payment_status == o.payment_status &&\n payment_local_amount == o.payment_local_amount &&\n pos_cardholder_presence == o.pos_cardholder_presence &&\n pos_postcode == o.pos_postcode &&\n pos_country == o.pos_country &&\n pos_terminal_id == o.pos_terminal_id &&\n pos_card_presence == o.pos_card_presence &&\n pan_entry_method == o.pan_entry_method &&\n authorization_note == o.authorization_note &&\n authorization_response_code == o.authorization_response_code &&\n authorization_issuer_id == o.authorization_issuer_id &&\n authorization_issuer_time == o.authorization_issuer_time &&\n authorization_mti == o.authorization_mti &&\n authorized_balance == o.authorized_balance &&\n limit_atm_year == o.limit_atm_year &&\n limit_atm_month == o.limit_atm_month &&\n limit_atm_week == o.limit_atm_week &&\n limit_atm_day == o.limit_atm_day &&\n limit_atm_all == o.limit_atm_all &&\n limit_payment_year == o.limit_payment_year &&\n limit_payment_month == o.limit_payment_month &&\n limit_payment_week == o.limit_payment_week &&\n limit_payment_day == o.limit_payment_day &&\n limit_payment_all == o.limit_payment_all &&\n total_limit_atm_year == o.total_limit_atm_year &&\n total_limit_atm_month == o.total_limit_atm_month &&\n total_limit_atm_week == o.total_limit_atm_week &&\n total_limit_atm_day == o.total_limit_atm_day &&\n total_limit_atm_all == o.total_limit_atm_all &&\n total_limit_payment_year == o.total_limit_payment_year &&\n total_limit_payment_month == o.total_limit_payment_month &&\n total_limit_payment_week == o.total_limit_payment_week &&\n total_limit_payment_day == o.total_limit_payment_day &&\n total_limit_payment_all == o.total_limit_payment_all &&\n total_rows == o.total_rows\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n return super unless other.is_a?(self.class)\n\n attributes.all? { |name, value| value == other.attributes[name] }\n end", "def ==(other)\n res = true\n ASSIGNABLE_MEMBERS.each do |k|\n l_val = send(\"#{k}\")\n r_val = other.send(\"#{k}\")\n res = false if l_val != r_val\n end\n res\n end", "def eql?(ct); end", "def eql?(ct); end", "def ==(*several_variants)\n #This is a stub, used for indexing\n end", "def ==(other)\n self.class.valid_attrs.each do |attr|\n return false if read(attr) != other.read(attr)\n end\n true\n end", "def compareCards(c1=-1, c2=-1, c3=-1)\n\tif c1==c2 or c1==c3 or c2==c3\n\t\treturn false\n\telsif compareNumber(c1, c2, c3) and compareColor(c1, c2, c3) and compareShape(c1, c2, c3) and compareOpacity(c1, c2, c3)\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n affiliate_rate == o.affiliate_rate &&\n campaign_id == o.campaign_id &&\n category == o.category &&\n client_review == o.client_review &&\n create_date == o.create_date &&\n currency_code == o.currency_code &&\n description == o.description &&\n document_id == o.document_id &&\n fee_amount == o.fee_amount &&\n fee_type == o.fee_type &&\n financial_rate == o.financial_rate &&\n financial_rate_term == o.financial_rate_term &&\n financial_rate_term_unit == o.financial_rate_term_unit &&\n financial_rate_type == o.financial_rate_type &&\n id == o.id &&\n image == o.image &&\n institution_name == o.institution_name &&\n is_active == o.is_active &&\n metadata == o.metadata &&\n minimum_contribution == o.minimum_contribution &&\n minimum_contribution_term == o.minimum_contribution_term &&\n minimum_contribution_term_unit == o.minimum_contribution_term_unit &&\n name == o.name &&\n node_map == o.node_map &&\n offer_link == o.offer_link &&\n offer_term == o.offer_term &&\n offer_term_unit == o.offer_term_unit &&\n prerequisite == o.prerequisite &&\n prerequisite_type == o.prerequisite_type &&\n rating == o.rating &&\n secondary_id == o.secondary_id &&\n subcategory == o.subcategory &&\n update_date == o.update_date\n end", "def ==(other)\n self.attributes == (other.respond(:attributes) || {} )\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n id == o.id &&\n id_account == o.id_account &&\n webid == o.webid &&\n application_date == o.application_date &&\n date == o.date &&\n value == o.value &&\n gross_value == o.gross_value &&\n nature == o.nature &&\n original_wording == o.original_wording &&\n simplified_wording == o.simplified_wording &&\n stemmed_wording == o.stemmed_wording &&\n wording == o.wording &&\n id_category == o.id_category &&\n state == o.state &&\n date_scraped == o.date_scraped &&\n rdate == o.rdate &&\n vdate == o.vdate &&\n bdate == o.bdate &&\n coming == o.coming &&\n active == o.active &&\n id_cluster == o.id_cluster &&\n comment == o.comment &&\n last_update == o.last_update &&\n deleted == o.deleted &&\n original_value == o.original_value &&\n original_gross_value == o.original_gross_value &&\n original_currency == o.original_currency &&\n commission == o.commission &&\n commission_currency == o.commission_currency &&\n country == o.country &&\n counterparty == o.counterparty &&\n card == o.card\n end", "def ==(other)\n # If the classes don't match, they cannot possibly be equal.\n if self.class != other.class\n return false\n end\n\n # If the persisted state doesn't match, they also can never be equal.\n if persisted? != other.persisted?\n return false\n end\n\n # When persisted, check the other's id to see if it's the same,\n # cannot possible be equals if they have different ids.\n if persisted? && id != other.id\n return false\n end\n\n # Finally, compare the attributes hash. If all key/values match,\n # they are considered equal.\n attributes == other.attributes\n end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n currency_code == o.currency_code &&\n memo == o.memo &&\n partial_auth == o.partial_auth &&\n transaction_type == o.transaction_type &&\n description == o.description &&\n transaction_category_id == o.transaction_category_id &&\n use_audit_log == o.use_audit_log &&\n merchant_category_code == o.merchant_category_code &&\n card_id == o.card_id &&\n transaction_category == o.transaction_category &&\n cleanse_data == o.cleanse_data &&\n auth_type == o.auth_type &&\n mid == o.mid &&\n transaction_status_scope == o.transaction_status_scope &&\n location == o.location &&\n merchant == o.merchant &&\n amount == o.amount &&\n date == o.date &&\n merchant_id == o.merchant_id\n end", "def ==(o)\n return true if equal?(0)\n\n begin\n return o.value == @value && o.suit == @suit\n rescue Exception => ex\n return false\n end\n end", "def eql?(other); self == other; end", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n name == o.name &&\n description == o.description &&\n timezone == o.timezone &&\n currency == o.currency &&\n case_sensitivity == o.case_sensitivity &&\n attributes == o.attributes &&\n limits == o.limits &&\n campaign_priority == o.campaign_priority &&\n exclusive_campaigns_strategy == o.exclusive_campaigns_strategy &&\n default_discount_scope == o.default_discount_scope &&\n enable_cascading_discounts == o.enable_cascading_discounts &&\n enable_flattened_cart_items == o.enable_flattened_cart_items &&\n attributes_settings == o.attributes_settings &&\n sandbox == o.sandbox &&\n enable_partial_discounts == o.enable_partial_discounts &&\n default_discount_additional_cost_per_item_scope == o.default_discount_additional_cost_per_item_scope\n end" ]
[ "0.712284", "0.6982151", "0.6844561", "0.67349494", "0.67269784", "0.6657298", "0.66326267", "0.6602563", "0.65976346", "0.65598583", "0.65147555", "0.6502785", "0.63980275", "0.63892823", "0.63845843", "0.636712", "0.6335557", "0.6283563", "0.6281177", "0.6280543", "0.6269043", "0.62635756", "0.62635756", "0.62536633", "0.62536633", "0.62536633", "0.625332", "0.6250366", "0.6246742", "0.6234085", "0.62335426", "0.6224808", "0.62242967", "0.62119687", "0.6207522", "0.62039083", "0.61887836", "0.6177347", "0.6173278", "0.61703944", "0.6167738", "0.6167569", "0.6162307", "0.61542106", "0.6152371", "0.6137984", "0.6123701", "0.6123667", "0.61079645", "0.6105304", "0.60910803", "0.6089081", "0.608881", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60730577", "0.60673463", "0.6064025", "0.6063981", "0.6055877", "0.6044351", "0.6041246", "0.60391057", "0.60380626", "0.60380626", "0.60380626", "0.6023561", "0.6018382", "0.6018382", "0.60131395", "0.6011931", "0.6009729", "0.6003912", "0.60021675", "0.599336", "0.5977167", "0.5969173", "0.5961142", "0.59607774", "0.5951045" ]
0.6859679
2
Calculate and format totals properly
def it_totals qty = params[:qty].to_f / 10000 total = params[:total].to_f / 10000 tbl = params[:tbl] # Format output values qty = number_with_precision(qty.round(4), precision: 4) total = number_with_precision(total.round(4), precision: 4) # Setup JSON hash @json_data = { "qty" => qty.to_s, "tbl" => tbl.to_s, "total" => total.to_s } render json: @json_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total\n apply_rules(subtotal).round\n end", "def total\n '%.2f' % calculate_total\n end", "def overall_total\n puts \"Portfolio Total: $#{sprintf('%.2f', @all_totals)}\"\n end", "def totals_table\n strings = []\n strings << \"#{@labels[:subtotal]}:\"\n strings << @document.subtotal\n strings << \"#{@labels[:tax]}:\"\n strings << @document.tax\n strings << \"#{@labels[:tax2]}:\"\n strings << @document.tax2\n strings << \"#{@labels[:tax3]}:\"\n strings << @document.tax3\n strings << \"#{@labels[:total]}:\"\n strings << @document.total\n strings\n end", "def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end", "def calculate_totals\n subtotal_collector = 0\n active_contracts.each do |active_contract|\n subtotal_collector += active_contract.subtotal\n end\n\n self.subtotal = subtotal_collector\n self.tax = subtotal * 0.09\n self.total = subtotal + tax\n save\n end", "def calculate_totals\n subtotal = 0\n\n carted_products.each do |carted_product|\n subtotal += carted_product.subtotal\n end\n\n tax = subtotal * 0.09\n total = subtotal + tax\n update(subtotal: subtotal, tax: tax, total: total)\n end", "def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend", "def total\n format_money(@total)\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n \n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total + gift_packaging_total\n end", "def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end", "def total\n return (@listOfItem.inject(0){|sum,e| sum += e.total}).round_to(2)\n end", "def total\n subtotal\n # + tax\n end", "def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end", "def order_total(items)\r\n order_total = 0\r\n for item in items\r\n order_total += item.total_cost\r\n end\r\n puts \"Order Total: $#{'%.2f' % order_total}\"\r\n end", "def total\n sum = self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price } +\n self.price_modifiers.inject(BigDecimal('0.0')) { |sum, pm| sum + pm.amount }\n return ApplicationHelper.round_currency(sum)\n end", "def sum_totals\n @total = Lote.where(:programacion_id => @programacion.first).sum(:precio_t)\n @total = Money.new(\"#{@total}00\", \"USD\").format\n @cantidades = Lote.where(:programacion_id => @programacion.first).sum(:cantidad)\n end", "def report_total_hours(all_entries)\n printf \"TOTAL %.2f\\n\", total(all_entries.flatten)\nend", "def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total\n end", "def build_total\n @pdf.move_down(25)\n\n items = []\n\n items << [\n { content: \"#{@labels[:subtotal]}:#{build_sublabel_for_total_table(:subtotal)}\", align: :left },\n { content: @document.subtotal, align: :right }\n ] unless @document.subtotal.empty?\n\n items << [\n { content: \"#{@labels[:tax]}:#{build_sublabel_for_total_table(:tax)}\", align: :left },\n { content: @document.tax, align: :right }\n ] unless @document.tax.empty?\n\n items << [\n { content: \"#{@labels[:tax2]}:#{build_sublabel_for_total_table(:tax2)}\", align: :left },\n { content: @document.tax2, align: :right }\n ] unless @document.tax2.empty?\n\n items << [\n { content: \"#{@labels[:tax3]}:#{build_sublabel_for_total_table(:tax3)}\", align: :left },\n { content: @document.tax3, align: :right }\n ] unless @document.tax3.empty?\n\n items << [\n { content: \"\\n#{@labels[:total]}:#{build_sublabel_for_total_table(:total)}\", align: :left, font_style: :bold, size: 16 },\n { content: \"\\n#{@document.total}\", align: :right, font_style: :bold, size: 16 }\n ] unless @document.total.empty?\n\n options = {\n cell_style: {\n borders: []\n },\n position: :right\n }\n\n @pdf.table(items, options) unless items.empty?\n end", "def wrt_total_sales(purchases, options = {})\n format = options[:format] || 6\n total_sales = 0.0\n purchases.each do |sale|\n total_sales += sale[\"price\"]\n end\n $report_file.puts(\"Total Sales:\" + \"%#{format}s\" % \"$\" + total_sales.to_s)\n total_sales\nend", "def subtotal\n line_items.reduce(BigDecimal(\"0\")) { |result, item| result += item.amount }\n end", "def of_totals\n qty = params[:qty].to_f / 10000\n amount = params[:amount].to_f / 10000\n tax = params[:tax].to_f / 10000\n discount_p = params[:discount_p].to_f / 100\n tbl = params[:tbl]\n # Bonus\n discount = discount_p != 0 ? amount * (discount_p / 100) : 0\n # Taxable\n taxable = amount - discount\n # Taxes\n tax = tax - (tax * (discount_p / 100)) if discount_p != 0\n # Total\n total = taxable + tax\n # Format output values\n qty = number_with_precision(qty.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n discount = number_with_precision(discount.round(4), precision: 4)\n taxable = number_with_precision(taxable.round(4), precision: 4)\n total = number_with_precision(total.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"qty\" => qty.to_s, \"amount\" => amount.to_s, \"tax\" => tax.to_s,\n \"discount\" => discount.to_s, \"taxable\" => taxable.to_s, \"total\" => total.to_s, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "def calculate_total\n self.total = total_money(total_gross)\n end", "def total\n calculate_total\n display_order\n end", "def calculate_total\n order_items.sum(:total)\n end", "def total\n regular_total = sub_total\n if used_promo\n regular_total -= discount_from_promo\n end\n regular_total >= 0 ? (\"%.2f\" % regular_total).to_f : 0.0 \n end", "def calculate_totals\n totals = {}\n if self.amount_due.nil?\n total = 0.00\n order_products.each do |order_product|\n price = order_product.unit_price\n price = order_product.product.price if price.nil?\n total = total + (price * order_product.quantity)\n end\n totals[:product_total] = total\n totals[:tax] = total * 0.055\n totals[:amount_due] = total + totals[:tax]\n else\n totals[:product_total] = self.product_total\n totals[:tax] = self.tax\n totals[:amount_due] = self.amount_due\n end\n return totals\n end", "def total\n total = 0.00\n #accesses the subtotal of each of the order items\n order_items.each do |item|\n total += item.subtotal\n end\n return total.round(2)\n end", "def recalculate_totals\n # Line's total prices (qty * amount)\n single_untaxed_price_after_rebate = BigDecimal.new( (self.single_untaxed_price - self.single_rebate).to_s )\n self.gross_price = BigDecimal.new( (self.quantity * single_untaxed_price_after_rebate).to_s )\n self.gross_price = self.gross_price\n self.taxes = (self.gross_price / BigDecimal.new(\"100.0\")) * self.tax_percentage\n self.taxed_price = (BigDecimal.new( (self.gross_price + self.taxes).to_s )).rounded # Rounded like in document_line.rb\n\n # Line's single prices (for qty 1 * amount)\n single_taxes = ((single_untaxed_price_after_rebate / BigDecimal.new(\"100.0\")) * self.tax_percentage) # like in product.rb\n self.single_price = (single_untaxed_price_after_rebate + single_taxes).rounded # Like in document_line.rb\n\n end", "def pretotal\n total\n end", "def item_total\n line_items.map(&:total).reduce(:+)\n end", "def total\r\n sum = 0\r\n sales_lines.each do |line|\r\n sum += line.line_amount unless line.line_amount.blank?\r\n end\r\n return sum\r\n end", "def total_sales(toy)\n 'Total sales: $' + format('%.2f', calculate_total_sales(toy))\n end", "def update_totals\n update_payment_total\n update_item_total\n update_order_total\n end", "def total_text\n 'Total: %d' % total\n end", "def total\n sub_total\n end", "def update_total\n self.total = self.line_items.reload.map(&:total).inject(:+).to_f\n end", "def total_summary\n\n products = {}\n products.store(:item_cost, item_cost)\n products.store(:extras_cost, extras_cost)\n\n supplements = {}\n supplements.store(:pick_up_place, pickup_place_cost)\n supplements.store(:return_place, return_place_cost)\n supplements.store(:time_from_cost, time_from_cost)\n supplements.store(:time_to_cost, time_to_cost)\n supplements.store(:driver_age_cost, driver_age_cost)\n supplements.store(:category_supplement_1, category_supplement_1_cost)\n supplements.store(:category_supplement_2, category_supplement_2_cost)\n supplements.store(:category_supplement_3, category_supplement_3_cost)\n supplements.store(:supplement_1, supplement_1_cost)\n supplements.store(:supplement_2, supplement_2_cost)\n supplements.store(:supplement_3, supplement_3_cost)\n\n deposit = {}\n deposit.store(:product_deposit_cost, product_deposit_cost)\n\n totals = {}\n totals.store(:total_cost, total_cost)\n totals.store(:total_paid, total_paid)\n totals.store(:total_pending, total_pending)\n\n summary = {products: products,\n supplements: supplements,\n deposit: deposit,\n totals: totals }\n\n end", "def total; end", "def total\n sum = 0\n subtotal = @products.values\n subtotal.each do |price|\n sum += price.to_f\n end\n\n total = (sum * 1.075).round(2)\n return total\n end", "def calculate\n self.total\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n \n self.item_total = order_items.map(&:amount).sum\n self.billing_total = order_items.map(&:cost).sum\n self.customer_total = item_total\n self.full_total = order_items.map(&:full).sum\n end", "def update_totals\n update_payment_total\n update_item_total\n update_shipment_total\n update_adjustment_total\n end", "def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end", "def total\n \tsubtotal\n end", "def total\n (@products.values.sum * 1.075).round(2)\n end", "def total_amount(rows)\n rows.each.map { |row|\n row.amount.round(2)\n }.reduce(0, :+)\n end", "def total_amounts(style=:solo)\n each_with_object([]) do |bill,memo|\n if style==:solo\n memo << [bill.invoice_month.to_s,bill.total_amount]\n else\n memo << [bill.invoice_month.to_s,'total_charges',nil,nil,nil,bill.total_amount]\n end\n end\n end", "def computeTotal\n # get rule for total\n rule = @rules.find{ |obj| obj.getCode == \"total\" } \n # sum item prices\n total = @items.inject(0){|sum, x| sum + x.getPrice} \n # if rule exists and condition is met, apply discount\n if rule && total > rule.getThreshold \n total = rule.getPercent ? total * (1-rule.getValue) : total - rule.getValue\n end\n return total\n end", "def total\n subtotal + tax + shipping\n end", "def total\n @total = items.inject(0.0) { |sum, order_line_item| sum + order_line_item.subtotal }\n end", "def total\n sum(:total)\n end", "def getTotals(page)\n\t\ttotalsRow = page.css(\"table.dbd\")[0].css(\"tr.toprow\").last\n\t\tgames = totalsRow.css(\"td.letter\")[0].text.to_i\n\t\t\n\t\t# From Totals Row\n\t\tab = totalsRow.css(\"td.number\")[1].text.to_i\n\t\truns = totalsRow.css(\"td.number\")[2].text.to_i\n\t\thits = totalsRow.css(\"td.number\")[3].text.to_i\n\t\tdbl = totalsRow.css(\"td.number\")[4].text.to_i\n\t\ttpl = totalsRow.css(\"td.number\")[5].text.to_i\n\t\thr = totalsRow.css(\"td.number\")[6].text.to_i\n\t\trbi = totalsRow.css(\"td.number\")[7].text.to_i\n\t\tbb = totalsRow.css(\"td.number\")[8].text.to_i\n\t\thbp = totalsRow.css(\"td.number\")[10].text.to_i\n\t\tcs = totalsRow.css(\"td.number\")[13].text.to_i\n\t\tsh = totalsRow.css(\"td.number\")[14].text.to_i\n\t\tsf = totalsRow.css(\"td.number\")[15].text.to_i\n\t\tgdp = totalsRow.css(\"td.number\")[16].text.to_i\n\t\t\t\t\n\t\t# From Summary Row\n\t\tba = page.css(\"table.dbd\")[1].css(\"tr\")[1].css(\"td\")[0].text.to_f\n\t\toba = page.css(\"table.dbd\")[1].css(\"tr\")[1].css(\"td\")[1].text.to_f\n\t\tslug = page.css(\"table.dbd\")[1].css(\"tr\")[1].css(\"td\")[2].text.to_f\n\t\tops = oba.to_f + slug.to_f\n\t\t\n\t\tsolution = [games,ab,runs,hits,dbl,tpl,hr,rbi,bb,hbp,cs,sh,sf,gdp,ba,oba,slug,ops]\n\t\tvorp = calcVORP(solution)\n\t\tsolution << vorp\n\t\treturn solution\n\tend", "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 total\n total_cost = 0\n \n # Summing up the product cost\n @products.each do |item, cost|\n total_cost += cost\n end\n \n # Calculate a 7.5% tax\n total_order_cost = total_cost * 1.075\n \n # Rounding the result to two decimal places\n return total_order_cost.round(2)\n end", "def total\n @items_total = []\n self.line_items.each do |item|\n @item = Item.find_by_id(item.item_id)\n @items_total << @item.price.to_f\n end\n cart_total = @items_total.inject(0){|sum, x| sum + x }\n @cart_total = cart_total.round(2)\n @cart_total\n end", "def total\n total = 0\n self.menu_items.each do |item|\n total += item.price\n end\n \"$#{total}\"\n end", "def total\n array = @products.values\n if array != []\n tally = array.reduce(:+)\n tally += (0.075 * tally)\n return tally.round(2)\n else\n return 0\n end\n end", "def adjusted_total\n total = unadjusted_total\n \n for adjustment in adjustments\n total += adjustment.amount\n end\n \n total\n end", "def total\n total = 0\n line_items.each do |line_item|\n total += line_item.item.price * line_item.quantity\n end\n total\n end", "def total\n to_f\n end", "def total\n to_f\n end", "def total\n to_f\n end", "def total\n total = with_product_discounts\n total = with_basket_discounts(total)\n return \"£#{total}\"\n end", "def calculate_total\n sub_total = 0\n\n if size\n sub_total += Config.booths[size][:price]\n end\n\n self.add_ons.each do |add_on|\n sub_total += add_on.total\n end\n sub_total += industries.length * 35000\n sub_total += fees.pluck(:amount).reduce(0, &:+)\n\n self.total = sub_total\n self.balance = total - payments.paid.map(&:amount_paid).reduce(0, &:+)\n self\n end", "def total\n @sum = @products.values.inject(0, :+)\n @total = @sum + (@sum * 0.075).round(2)\n return @total\n end", "def calculate\n=begin\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n=end\n self.total\n end", "def genera_renglon_total\n\t\ttotal = Hash.new\n\t\t@renglones_reporte.each do |renglon|\n\t\t\t\trenglon.columnas.keys.each do |columna|\n\t\t\t\t\tif total[columna].nil?\n\t\t\t\t\t\ttotal[columna] = {:total => renglon.columnas[columna][:total], :promedio => 0}\n\t\t\t\t\telse\n\t\t\t\t\t\ttotal[columna][:total] += renglon.columnas[columna][:total]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\tend\n\t\ttotal_t = total[\"Total\"][:total]\n \ttotal[\"Total\"][:promedio] = 100\n\t\ttotal.keys.each do |key|\n\t\t\tbegin\n\t\t\t\ttotal[key][:promedio] = (total[key][:total]/total_t.to_f*100).round\n\t\t\trescue\n\t\t\t\ttotal[key][:promedio] = 0\n\t\t\tend\n\t\tend\n\t\t@total = total\n\tend", "def total\n currency(@total)\n puts @total\n end", "def total\n sum = 0\n\n @four_result.each do |result|\n sum += result\n end\n @six_result.each do |result|\n sum += result\n end\n @eight_result.each do |result|\n sum += result\n end\n @ten_result.each do |result|\n sum += result\n end\n @twelve_result.each do |result|\n sum += result\n end\n @twenty_result.each do |result|\n sum += result\n end\n @percentile_result.each do |result|\n sum += result\n end\n\n sum\n end", "def total\n if @products.length == 0\n return 0\n else\n total = @products.values.reduce(:+)\n total*= 1.075 #Tax\n total = total.round(2)\n return total\n end\n end", "def total\n # TODO: implement total\n if products.length == 0\n return 0\n end\n ((@products.values.sum)*1.075).round(2)\n end", "def compute_total(type)\n list = capture_amounts(type)\n generate_total(list)\n end", "def total\n\t\tprices = line_items.map {|li| li.price}\n\t\tprices.reduce(0) {|it0, it1| it0+it1}\n\tend", "def update_total\n # Group our items by their name\n grouped_items = @current_items.group_by {|item| item.name }\n\n # Create a variable that we can use to store all of our total prices for each group of items\n grouped_prices = []\n \n # Iterate over each item group and pass each group to calculate_group_by, then store each group total price in grouped_totals \n grouped_items.each_key do |item_group|\n # Calculate our group total and store \n group_total = self.calculate_group_total(grouped_items[item_group]) \n\n # Add to our grouped item prices array\n grouped_prices << group_total \n end unless @current_items.count == 0 # Ensure that we don't iterate over an empty array\n\n # Sum all group item prices\n new_total = grouped_prices.sum\n\n # If the new total is greater than 150 subtract 20 \n new_total = new_total - 20 unless new_total <= 150 \n\n # Update total price\n @total_price = new_total \n end", "def calc_total(prices, shoppingList)\n filtered = shoppingList.split.select { |item| prices.has_key?(item) }\n \"%.2f\" % filtered.inject(0.00) { |total, item| prices[item] + total } \nend", "def totals\n t=['Totaux']\n # bottoms est un arrau de totaux des différents mois de l'exercice\n bottoms = 1.upto(@period.list_months.size).collect do |i| # i va de 1 à 12 par ex\n lines.sum {|l| l[i]} # l[i] car l[0] est nature.name\n end\n t + bottoms + [bottoms.sum {|i| i}]\n end", "def totals\n t=['Totaux']\n # bottoms est un arrau de totaux des différents mois de l'exercice\n bottoms = 1.upto(@period.list_months.size).collect do |i| # i va de 1 à 12 par ex\n lines.sum {|l| l[i]} # l[i] car l[0] est nature.name\n end\n t + bottoms + [bottoms.sum {|i| i}]\n end", "def sub_total\n return ApplicationHelper.round_currency(self.line_items.inject(BigDecimal('0.0')) { |sum, li| sum + li.price })\n end", "def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend", "def get_Total()\n \t return @outputs[\"Total\"]\n \tend", "def total_payment\r\n checks.inject(0.00){|sum, check| sum += check.check_amount.to_f}\r\n end", "def set_total\r\n self.total = self.order_items.collect{ |order_item| order_item.valid? ? (order_item.sub_total) : 0 }.sum.to_d\r\n end", "def addup_total\n\t\tget_total\n\t\tupdate_total = {}\n\t\tupdate_total[\"c_ExpScopingTotal\"] = @total\n\t\tif(@total>0)\n\t\t\trally = @query_result.get_rally_object\n\t\t\tupdate = rally.update(\"portfolioitem\",\"FormattedID|#{@feature_id}\",update_total)\n\t\t\tif(update)\n\t\t\t\[email protected](\"Total for #{@feature_id} is updated to #{@total}\")\n\t\t\telse\n\t\t\t\[email protected](\"Total could not be updated\")\n\t\t\tend\n\t\tend\n\tend", "def total\n total_invoice_items_price(invoice_items)\n end", "def spending_table(hash, total)\n puts \"\".center(80, \"_\")\n hash.each{ |item, value| puts tabled_format(item, value) }\n puts \"\".center(80, \"_\")\n total = hash.values.inject(:+)\n puts tabled_format(\"Total\", total)\n end", "def total\n cart_value = 0\n self.line_items.each do |line_item|\n cart_value += line_item.value\n end\n cart_value\n end", "def order_total_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.span.id(\"/_lblTotal$/\"),\n format_method(__method__))\n end", "def calculate_invoice_total\n res = [ ]\n self.line_items.each do |item|\n res.push(item.qty * item.price)\n end\n # Return the sum of the items\n self.total = res.inject(:+) \n end", "def total\n total_cache(:total) || (sub_total + total_tax)\n end", "def total \n\t\t@Total_bill = @bill_amount + @tip_rate_calc\t\n\t \tputs \"The total bill is £#{@Total_bill}\"\n\tend", "def subtotals\n x = {}\n charges.each do |r|\n x[r.product_code] ||= 0.to_f\n x[r.product_code] += r.total_cost.to_f\n end\n return x\n end", "def totalSimplificado\n @biblioteca.livrosComoLista.map(&:preco).inject(0){|total, preco| total += preco}\n end", "def total\n total = order_items.inject(0) { |sum, p| sum + p.subtotal }\n end", "def total\n total = (@products.values.sum) * 1.075\n return total.round(2)\n end", "def cumulative_total_after_tax\n amount = 0.0\n @products_in_cart.each do |product|\n amount += product.total\n end#each\n return amount\nend", "def subtotal\n order_items.collect{|order_item| order_item.valid? ? order_item.price.to_d * order_item.quantity.to_i : 0}.sum\n end", "def recalc_totals_from_db!\n self.subtotal = self.time_entries.sum(:total_amount) + self.expense_entries.sum(:total_amount)\n self.paid = self.payment_allocates.sum(:amount)\n self.save!\n end", "def total(rows)\n rows.map { |row| row[\"Money we made\"].to_i }.reduce(:+)\nend" ]
[ "0.743445", "0.73362035", "0.7321094", "0.7236359", "0.7170506", "0.7164925", "0.7038644", "0.70297277", "0.700823", "0.7000019", "0.69825894", "0.6971217", "0.6962173", "0.69585896", "0.69493216", "0.69437635", "0.6940885", "0.69122905", "0.68928874", "0.6889542", "0.68886167", "0.688465", "0.6881346", "0.6876764", "0.6865705", "0.6853541", "0.68398845", "0.68374175", "0.68356353", "0.6823317", "0.68113166", "0.67602336", "0.6753722", "0.67511827", "0.6748803", "0.6747897", "0.67456156", "0.67441237", "0.67434657", "0.6739983", "0.67385954", "0.67362165", "0.67298216", "0.67286026", "0.67210037", "0.6716941", "0.67078865", "0.66992164", "0.66936237", "0.66898435", "0.66802543", "0.66783047", "0.6676925", "0.66741854", "0.66711617", "0.6670884", "0.6665378", "0.6655846", "0.66519606", "0.66374385", "0.66355866", "0.66325396", "0.66303957", "0.66303957", "0.66303957", "0.66228473", "0.66188645", "0.66156733", "0.6611908", "0.6611218", "0.66045165", "0.65925604", "0.6588346", "0.6587645", "0.65833193", "0.65749633", "0.6573406", "0.6572912", "0.6567373", "0.6567373", "0.65673053", "0.6563662", "0.65612143", "0.6560929", "0.6560477", "0.65598226", "0.655946", "0.65568614", "0.654784", "0.6539552", "0.6530714", "0.65306365", "0.65264684", "0.6513549", "0.6513408", "0.6512801", "0.65077114", "0.6501257", "0.65006584", "0.6497669", "0.6496566" ]
0.0
-1
Update inventory transfer number at view (generate_code_btn)
def it_generate_no store = params[:store] # Builds no, if possible code = store == '$' ? '$err' : it_next_no(store) @json_data = { "code" => code } render json: @json_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_number\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Set quantity input window to inactive / invisible\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Number Cancel Command\r\n number_cancel_command_input\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Play shop SE\r\n $game_system.se_play($data_system.shop_se)\r\n # Set quantity input window to inactive / invisible\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Number Command Input\r\n number_command_input\r\n return\r\n end\r\n end", "def change_delivery_drink_quantity\n # get data to add/update\n @data = params[:id]\n @data_split = @data.split(\"-\")\n @add_or_subtract = @data_split[0]\n @user_delivery_id = @data_split[1]\n \n # get User Delivery info\n @account = Account.find_by_id(current_user.account_id)\n @user_subscription = UserSubscriptionn.where(account_id: current_user.account_id, currently_active: true).first\n @user_delivery_info = UserDelivery.find_by_id(@user_delivery_id)\n @delivery = Delivery.find_by_id(@user_delivery_info.delivery_id)\n @inventory = Inventory.find_by_id(@user_delivery_info.inventory_id)\n \n # adjust drink quantity, price and inventory\n @original_quantity = @user_delivery_info.quantity\n @drink_price = @user_delivery_info.inventory. + @user_subscription.pricing_model\n @current_inventory_reserved = @inventory.reserved\n if @add_or_subtract == \"add\"\n # set new quantity\n @new_quantity = @original_quantity + 1\n \n #set new price totals\n @original_subtotal = @delivery.subtotal\n @new_subtotal = @original_subtotal + @drink_price\n @new_sales_tax = @new_subtotal * @account.delivery_zone.excise_tax\n @new_total_price = @new_subtotal + @new_sales_tax\n \n # update reserved inventory \n @new_inventory_reserved = @current_inventory_reserved + 1\n @inventory.update(reserved: @new_inventory_reserved)\n\n # update user delivery info\n @user_delivery_info.update(quantity: @new_quantity)\n \n else\n # set new quantity\n @new_quantity = @original_quantity - 1\n \n #set new price totals\n @original_subtotal = @delivery.subtotal\n @new_subtotal = @original_subtotal - @drink_price\n @new_sales_tax = @new_subtotal * @account.delivery_zone.excise_tax\n @new_total_price = @new_subtotal + @new_sales_tax\n \n # update reserved inventory \n @new_inventory_reserved = @current_inventory_reserved - 1\n @inventory.update(reserved: @new_inventory_reserved)\n \n # update user delivery info\n @user_delivery_info.update(quantity: @new_quantity)\n end\n \n # update delivery info and note a confirmation email should be sent\n @delivery.update(subtotal: @new_subtotal, sales_tax: @new_sales_tax, total_drink_price: @new_total_price, delivery_change_confirmation: false)\n \n # add change to the customer_delivery_changes table\n @customer_delivery_change = CustomerDeliveryChange.where(user_delivery_id: @user_delivery_id).first\n if !@customer_delivery_change.blank?\n @customer_delivery_change.update(new_quantity: @new_quantity, change_noted: false)\n else\n @new_customer_delivery_change = CustomerDeliveryChange.new(user_id: current_user.id, \n delivery_id: @user_delivery_info.delivery_id,\n user_delivery_id: @user_delivery_id,\n beer_id: @user_delivery_info.beer_id,\n original_quantity: @original_quantity,\n new_quantity: @new_quantity,\n change_noted: false)\n @new_customer_delivery_change.save!\n end\n \n # set new delivery details and delivery info\n @next_delivery = UserDelivery.where(delivery_id: @user_delivery_info.delivery_id)\n @delivery = Delivery.find_by_id(@user_delivery_info.delivery_id)\n \n # count number of drinks in delivery\n @drink_count = @next_delivery.sum(:quantity)\n # count number of drinks that are new to user\n @next_delivery_cooler = 0\n @next_delivery_cellar = 0\n @next_delivery_small = 0\n @next_delivery_large = 0\n # cycle through next delivery drinks to get delivery counts\n @next_delivery.each do |drink|\n @quantity = drink.quantity\n if drink.cellar == true\n @next_delivery_cellar += (1 * @quantity)\n else\n @next_delivery_cooler += (1 * @quantity)\n end\n if drink.large_format == true\n @next_delivery_large += (1 * @quantity)\n else\n @next_delivery_small += (1 * @quantity)\n end\n end \n \n respond_to do |format|\n format.js\n end # end of redirect to jquery\n end", "def run_palletizing_criteria_setup_fg_product_code_changed\n fg_code = get_selected_combo_value(params)\n session[:run_palletizing_criteria_setup][:fg_code] = fg_code\n puts \"fg from fg combo: \" + fg_code.to_s\n\n @carton_setup_codes = CartonSetup.find_all_by_production_schedule_id_and_fg_product_code(session[:current_closed_schedule].id, fg_code).map { |c| [c.carton_setup_code] }\n @carton_setup_codes.unshift(\"<empty>\")\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t<%= select('run_palletizing_criteria_setup','carton_setup_code',@carton_setup_codes)%>\n <img src = '/images/spinner.gif' style = 'display:none;' id = 'img_run_palletizing_criteria_setup_carton_setup_code'/>\n\t\t<%= observe_field('run_palletizing_criteria_setup_carton_setup_code',:update => 'applet_container',:url => {:action => session[:run_palletizing_criteria_setup][:carton_setup_observer][:remote_method]},:loading => \"show_element('img_run_palletizing_criteria_setup_carton_setup_code');\")%>\n\t\t<script>\n\t\t<%= update_element_function(\n \"target_market_code_cell\", :action => :update,\n :content => \"\") %>\n\n <%= update_element_function(\n \"inventory_code_cell\", :action => :update,\n :content => \"\") %>\n\n\n <%= update_element_function(\n \"mark_code_cell\", :action => :update,\n :content => \"\") %>\n\n\n <%= update_element_function(\n \"sell_by_code_cell\", :action => :update,\n :content => \"\") %>\n\n <%= update_element_function(\n \"farm_code_cell\", :action => :update,\n :content => \"\") %>\n\n <%= update_element_function(\n \"units_per_carton_cell\", :action => :update,\n :content => \"\") %>\n </script>\n\t\t}\n\n\n end", "def update_quant(item, quant)\n\t$grocery_list.store(item, quant)\n\tp \"You updated #{item} number to #{quant}.\"\nend", "def pack_station_fg_product_code_changed\n fg_code = get_selected_combo_value(params)\n @carton_setup_codes = CartonSetup.find_all_by_production_schedule_id_and_fg_product_code_and_active(session[:current_closed_schedule].id, fg_code, true).map { |c| [c.carton_setup_code] }\n @carton_setup_codes.unshift(\"<empty>\")\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t<%= select('pack_station','carton_setup_code',@carton_setup_codes)%>\n <%= observe_field('pack_station_carton_setup_code',:update => 'ajax_distributor_cell',:url => {:action => 'carton_setup_combo_changed'},:loading => \"show_element('img_pack_station_carton_setup_code');\",:complete => session[:pack_station_form][:carton_setup_js])%>\n\n\t<script>\n\t\t <%= update_element_function(\n \"packing_order_cell\", :action => :update,\n :content => \"\") %>\n\n <%= update_element_function(\n \"extended_fg_code_cell\", :action => :update,\n :content => \"\") %>\n\n <%= update_element_function(\n \"inventory_code_cell\", :action => :update,\n :content => \"\") %>\n\n <%= update_element_function(\n \"target_market_cell\", :action => :update,\n :content => \"\")%>\n\n <%= update_element_function(\n \"marking_cell\", :action => :update,\n :content => \"\")%>\n\n <%= update_element_function(\n \"diameter_cell\", :action => :update,\n :content => \"\")%>\n\n <%= update_element_function(\n \"order_no_cell\", :action => :update,\n :content => \"\")%>\n\n <%= update_element_function(\n \"retailer_sell_by_code_cell\", :action => :update,\n :content => \"\")%>\n\n <%= update_element_function(\n \"palletizing_cell\", :action => :update,\n :content => \"\")%>\n\n </script>\n\n\t\t}\n end", "def update_number\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Set quantity input window to inactive / invisible\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Branch by command window cursor position\r\n case @command_window.index\r\n when 0 # buy\r\n # Change windows to buy mode\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n when 1 # sell\r\n # Change windows to sell mode\r\n @sell_window.active = true\r\n @sell_window.visible = true\r\n @status_window.visible = false\r\n end\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Play shop SE\r\n $game_system.se_play($data_system.shop_se)\r\n # Set quantity input window to inactive / invisible\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Branch by command window cursor position\r\n case @command_window.index\r\n when 0 # buy\r\n # Buy process\r\n $game_party.lose_gold(@number_window.number * @item.price)\r\n case @item\r\n when RPG::Item\r\n $game_party.gain_item(@item.id, @number_window.number)\r\n when RPG::Weapon\r\n $game_party.gain_weapon(@item.id, @number_window.number)\r\n when RPG::Armor\r\n $game_party.gain_armor(@item.id, @number_window.number)\r\n end\r\n # Refresh each window\r\n @gold_window.refresh\r\n @buy_window.refresh\r\n @status_window.refresh\r\n # Change windows to buy mode\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n when 1 # sell\r\n # Sell process\r\n $game_party.gain_gold(@number_window.number * (@item.price / 2))\r\n case @item\r\n when RPG::Item\r\n $game_party.lose_item(@item.id, @number_window.number)\r\n when RPG::Weapon\r\n $game_party.lose_weapon(@item.id, @number_window.number)\r\n when RPG::Armor\r\n $game_party.lose_armor(@item.id, @number_window.number)\r\n end\r\n # Refresh each window\r\n @gold_window.refresh\r\n @sell_window.refresh\r\n @status_window.refresh\r\n # Change windows to sell mode\r\n @sell_window.active = true\r\n @sell_window.visible = true\r\n @status_window.visible = false\r\n end\r\n return\r\n end\r\n end", "def update_qty(shopping_list, item, quantity)\r\n\r\n\tadd_item(shopping_list, item, quantity)\r\n\r\nend", "def change_drink_quantity\n # get params\n @order_drink_prep_id = params[:id]\n @customer_drink_quantity = params[:quantity].to_i\n \n # get drink info\n @order_drink_prep = OrderDrinkPrep.find_by_id(@order_drink_prep_id)\n \n # get related order prep entry\n @order_prep = OrderPrep.find_by_id(@order_drink_prep.order_prep_id)\n \n if @customer_drink_quantity != 0\n @order_drink_prep.update(quantity: @customer_drink_quantity)\n else\n @order_drink_prep.destroy!\n end\n\n # find total drink number in cart\n @order_prep_drinks = OrderDrinkPrep.where(order_prep_id: @order_prep.id)\n @total_drink_count = @order_prep_drinks.sum(:quantity)\n # get total amount in cart so far\n @subtotal = @order_prep_drinks.sum( \"drink_price*quantity\" ) \n @sales_tax = @subtotal * 0.101\n @total_drink_price = @subtotal + @sales_tax\n\n # if all drinks have been removed, delete the order prep\n if @total_drink_count.to_i == 0\n @order_prep.destroy!\n \n redirect_to beer_stock_path\n else\n # update Order Prep with cost info\n @order_prep.update(subtotal: @subtotal, sales_tax: @sales_tax, total_drink_price: @total_drink_price)\n \n # set link for next step in checkout\n @proceed_link = standard_delivery_time_options_path\n # continue button text\n @next_button_text = \"Choose delivery time\"\n if @order_prep.subtotal < 20\n @button_disabled = true\n else\n @button_disabled = false\n end\n \n # update page\n respond_to do |format|\n format.js\n end # end of redirect to jquery\n end\n \n end", "def orchard_id_changed\n orchard_id = get_selected_combo_value(params)\n session[:delivery_form][:orchard_id_combo_selection] = orchard_id\n @orchard_description = \"\"\n\n orchard = Orchard.find(orchard_id)\n if (orchard != nil)\n orchard_description = orchard.orchard_description\n @orchard_description = orchard_description\n session[:delivery_form][:orchard_description] = orchard_description\n else\n @orchard_description = \"\"\n end\n\n @rmt_product_codes = [\"select a value from rmt_product_type_code above\"]\n\n render :inline => %{\n <%= @orchard_description_content = @orchard_description %>\n <%= @rmt_product_codes_content = select('delivery','rmt_product_id',@rmt_product_codes,{:sorted=>true})%>\n <script>\n <%= update_element_function(\"orchard_description_cell\", :action => :update,:content => @orchard_description_content) %>\n <%= update_element_function(\"advised_rmt_product_code_cell\", :action => :update,:content => @rmt_product_codes_content) %>\n </script>\n }\n\n end", "def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end", "def add_transaction_code\n unless transaction_code\n number = 15170000 + id\n prefix = (defined? TRANSACTION_CODE_PREFIX) ? TRANSACTION_CODE_PREFIX : ''\n self.transaction_code = \"#{prefix}#{number.to_s}\"\n save!\n end\n end", "def update_bar_codes_after_create\n\t\t q = self.quantity\n\t\t update_bar_codes\n\t\t save if q != self.quantity\n\t\t end", "def update_quantity token, cart_id, product_code, qty = 1\n\tend", "def update_number\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Set quantity input sprite to inactive / invisible\n @number_window.active = false\n @number_window.visible = false\n # Branch by command sprite cursor position\n case @command_window.index\n when 0 # buy\n # Change windows to buy mode\n @buy_window.active = true\n @buy_window.visible = true\n when 1 # sell\n # Change windows to sell mode\n @sell_window.active = true\n @sell_window.visible = true\n @status_window.visible = false\n end\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Play shop SE\n $game_system.se_play($data_system.shop_se)\n # Set quantity input sprite to inactive / invisible\n @number_window.active = false\n @number_window.visible = false\n # Branch by command sprite cursor position\n case @command_window.index\n when 0 # buy\n # Buy process\n $game_party.lose_gold(@number_window.number * @item.price)\n case @item\n when RPG::Item\n $game_party.gain_item(@item.id, @number_window.number)\n when RPG::Weapon\n $game_party.gain_weapon(@item.id, @number_window.number)\n when RPG::Armor\n $game_party.gain_armor(@item.id, @number_window.number)\n end\n # Refresh each sprite\n @gold_window.refresh\n @buy_window.refresh\n @status_window.refresh\n # Change windows to buy mode\n @buy_window.active = true\n @buy_window.visible = true\n when 1 # sell\n # Sell process\n $game_party.gain_gold(@number_window.number * (@item.price / 2))\n case @item\n when RPG::Item\n $game_party.lose_item(@item.id, @number_window.number)\n when RPG::Weapon\n $game_party.lose_weapon(@item.id, @number_window.number)\n when RPG::Armor\n $game_party.lose_armor(@item.id, @number_window.number)\n end\n # Refresh each sprite\n @gold_window.refresh\n @sell_window.refresh\n @status_window.refresh\n # Change windows to sell mode\n @sell_window.active = true\n @sell_window.visible = true\n @status_window.visible = false\n end\n return\n end\n end", "def update\n @breadcrumb = 'update'\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n items_changed = false\n if params[:inventory_transfer][:inventory_transfer_items_attributes]\n params[:inventory_transfer][:inventory_transfer_items_attributes].values.each do |new_item|\n current_item = InventoryTransferItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f)))\n items_changed = true\n break\n end\n end\n end\n master_changed = false\n if ((params[:inventory_transfer][:transfer_date].to_date != @inventory_transfer.transfer_date) ||\n (params[:inventory_transfer][:transfer_no].to_s != @inventory_transfer.transfer_no) ||\n (params[:inventory_transfer][:remarks].to_s != @inventory_transfer.remarks) ||\n (params[:inventory_transfer][:store_id].to_i != @inventory_transfer.store_id.to_i) ||\n (params[:inventory_transfer][:company_id].to_i != @inventory_transfer.company_id.to_i) ||\n (params[:inventory_transfer][:organization_id].to_i != @inventory_transfer.organization_id.to_i))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @inventory_transfer.updated_by = current_user.id if !current_user.nil?\n if @inventory_transfer.update_attributes(params[:inventory_transfer])\n format.html { redirect_to @inventory_transfer,\n notice: (crud_notice('updated', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n @stores = stores_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @inventory_transfer }\n format.json { head :no_content }\n end\n end\n end", "def update_sales_line_qty\r\n sales_line = ERP::SalesLine.find params[:id]\r\n result = sales_line.update_sales_qty( params[:value].to_i )\r\n @store_user.my_account_log(sales_line,\"Update Sales Line Qty: #{sales_line.invent_trans_id} (#{sales_line.item_id}), returns #{result}\")\r\n render :text => result\r\n end", "def update\r\n @hipaa_code = HipaaCode.find(params[:id])\r\n @hipaa_code.hipaa_adjustment_code = params[:hipaa_code][:hipaa_adjustment_code]\r\n @hipaa_code.hipaa_code_description = params[:hipaa_code][:hipaa_code_description]\r\n \r\n if @hipaa_code.save\r\n @hipaa_code.add_to_hipaa_codes_global_variable\r\n flash[:notice] = 'HipaaCode was successfully updated.'\r\n redirect_to :action => 'index'\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @hipaa_code.errors, :status => :unprocessable_entity }\r\n end\r\n \r\n end", "def qty_update_field\n $tracer.trace(__method__)\n #unit_test_no_generate: qty_update_field, input.className(create_ats_regex_string(\"ats-qty\"))\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-qty\")), __method__, self)\n end", "def transfer(num)\n @action.add_element('app').text = 'transfer'\n @action.add_element(@param)\n @param.add_element('destination').text = num\n return @doc.to_s\n end", "def trans(inventory, transfer_id, inventory_type)\n @inventory_log = InventoryLog.create!(inventory_type_id: params[:transfer][:id] )\n @inventory_update = Inventory.find(params[:inventory])\n @inventory_update.transfer.inventory_type.inventories.each do |i|\n if @inventory_update.part_no == i.part_no\n value = i.warehouse_stock_qty\n final = value.to_i - params[:transfer_item].to_i\n # stock = final + i.engineer_stock_qty.to_i\n i.update(warehouse_stock_qty: final) \n tot = final + i.engineer_stock_qty.to_i\n i.update(total_stock_qty: tot)\n end\n end\n @inventory.inventories.each do |f|\n if @inventory_update.part_no == f.part_no\n value = f.warehouse_stock_qty\n final = value.to_i + params[:transfer_item].to_i\n f.update(warehouse_stock_qty: final) \n tot = final + f.engineer_stock_qty.to_i\n f.update(total_stock_qty: tot)\n end\n end\n @inv = Inventory.create!(branch: @inventory_update.branch, part_no: @inventory_update.part_no, description: @inventory_update.description, warehouse_stock_qty: params[:transfer_item].to_i, transfered_stock_qty: params[:transfer_item].to_i, engineer_stock_qty: @inventory_update.engineer_stock_qty,location1: @inventory_update.location1,location2:@inventory_update.location2, location3: @inventory_update.location3,map: @inventory_update.map,total_stock_value: @inventory_update.total_stock_value,status: @inventory_update.status, latest_modify_date: @inventory_update.latest_modify_date,remark: @inventory_update.remark, inventory_type_id: @inventory.id, transfer_id: @transfer.id)\n total_stock_qty1 = @inv.warehouse_stock_qty.to_i + @inv.engineer_stock_qty.to_i\n @inv.update(total_stock_qty: total_stock_qty1 )\n\n end", "def add_voucher_amount_onclick\n return <<-eos\n new Ajax.Updater('shopping-cart', \n '/web_vouchers/ajax_add_voucher/#{@voucher.id}', {\n asynchronous:true, \n evalScripts:true, \n parameters: {\n amount: $F('voucher_#{@voucher.id}_amount')\n }, \n onComplete: function(request) {\n $('shopping-cart').scrollTo()\n }\n }); \n return false;\n eos\n end", "def qty_to_add=(num)\n ### TODO this method needs a history of who did what\n inventory.lock!\n self.inventory.count_on_hand = inventory.count_on_hand.to_i + num.to_i\n inventory.save!\n end", "def command_126(*args, &block)\n old_value = $game_party.marw_item_number_plus_equips($data_items[@params[0]])\n marw_command126_8qu7(*args, &block) # Call Original Method\n # Add to receipt if the possessed number of this item has changed\n new_value = $game_party.marw_item_number_plus_equips($data_items[@params[0]])\n update_item_receipt(:I, @params[0], new_value, old_value)\n end", "def production_run_pack_material_fg_product_code_changed\n fg_code = get_selected_combo_value(params)\n @carton_setup_codes = CartonSetup.find_all_by_production_schedule_id_and_fg_product_code(session[:current_closed_schedule].id, fg_code).map { |c| [c.carton_setup_code, c.id] }\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t<%= select('production_run_pack_material','carton_setup_code',@carton_setup_codes)%>\n\n\t\t}\n end", "def button_up(id); end", "def edit\n\n\t\tloop do\n\t\t\tprint \"\\n\\t\\tEnter product Id: \"\n\t\t\t@choice_edit=gets.to_i\n\t\t\tbreak if @choice_edit>0 and @choice_edit<@count+1\n\t\t\tputs \"\\n\\n\\t\\tInvalid Id!!!...Enter Correct\"\n\t\tend\n\t#fetch recorde from products\n\t\[email protected](\"select * from products where p_id=?\")\n\t\tstatement6.execute(@choice_edit)\n\t\trecordset6=statement6.fetch\n\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter New quantity: \"\n\t\t\t@quantity_new=gets.to_i\n\t\tbreak if @quantity_new>0 and @quantity_new<recordset6[2]+1\n\t\t\tputs \"\\n\\n\\t\\tInvalid Quantity!!!...Enter Correct\"\n\t\tend\n\n\t\tputs \"\\n\\n\\t\\tRecorde successfully updated....\"\n\n\t\trows=[]\n\n\t\ttable=Terminal::Table.new\n\t\ttable.headings=[\"Name\",\"Price\",\"Available Stock\",\"New Quantity\"]\n\n\t\trows<<[recordset6[1],recordset6[3],recordset6[2],@quantity_new]\n\n\t\ttable.rows=rows\n\n\t\tputs \"\\n#{table}\"\n#insert new quantity in shoping card\n\t\[email protected](\"update inline_products set quantity=? where p_id=? and card_no=?\")\n\t\tstatement7.execute(@quantity_new,@choice_edit,@card_no)\n\t\[email protected]\n#call method edit_more\n\t\tedit_more\n\n\tend", "def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\n end", "def decrease_voucher_onclick(amount = 1)\n \"new Ajax.Updater('shopping-cart', '/web_vouchers/ajax_remove_voucher/#{@voucher.id}?amount=#{amount}', {asynchronous:true, evalScripts:true}); return false;\"\n end", "def set_AuctionItemNumber(value)\n set_input(\"AuctionItemNumber\", value)\n end", "def set_code\n service = Service.find(service_id)\n self.code = \"#{service.code}-#{Time.now.strftime('%y%m%d%H%M')}\"\n end", "def update\n reference_set\n\n @product.subsection_ids = params[:product][:subsection_ids]\n puts @quantity = params[:quantity]\n \n no_price_fix\n @checkBoxs = @product.subsection_ids\n @intsallchecks = params[:install_ids]\n #exvatcalc = @price.to_i * 0.14\n #@exvat_pirce = @price.to_i - exvatcalc.to_f\n @count = 0\n\n clone_product_to_lineitem\n render :js => \" $('#testnow').modal('hide')\"\n\n\n end", "def added_to_basket\n select_size\n choose_quantity \n click_add_to_basket\n end", "def item_pack_product_commodity_group_code_changed\n \n\tcommodity_group_code = get_selected_combo_value(params)\n\tsession[:item_pack_product_form][:commodity_group_code_combo_selection] = commodity_group_code\n\t@commodity_codes = ItemPackProduct.commodity_codes_for_commodity_group_code(commodity_group_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('item_pack_product','commodity_code',@commodity_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_item_pack_product_commodity_code'/>\n\t\t<%= observe_field('item_pack_product_commodity_code',:update => 'basic_pack_code_cell',:url => {:action => 'item_pack_product_commodity_code_changed'},:loading => \"show_element('img_item_pack_product_commodity_code');\",:complete => session[:item_pack_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def command_127(*args, &block)\n old_value = $game_party.marw_item_number_plus_equips($data_weapons[@params[0]])\n marw_command127_8qu7(*args, &block) # Call Original Method\n # Add to receipt if the possessed number of this weapon has changed\n new_value = $game_party.marw_item_number_plus_equips($data_weapons[@params[0]])\n update_item_receipt(:W, @params[0], new_value, old_value)\n end", "def buy_product\n products = @seller.show_product_info \n product_buy = @view.buy_product(products)\n @total_price = @seller.save_buy_a_product(product_buy)\n @view.buy_status(@total_price)\n input = @view.menu(\"2\")\n seller_actions(input) \n end", "def command_number_buy\r\n # Buy process\r\n $game_party.lose_gold(@number_window.number * @item.price)\r\n case @item\r\n when RPG::Item\r\n $game_party.gain_item(@item.id, @number_window.number)\r\n when RPG::Weapon\r\n $game_party.gain_weapon(@item.id, @number_window.number)\r\n when RPG::Armor\r\n $game_party.gain_armor(@item.id, @number_window.number)\r\n end\r\n # Refresh each window\r\n @gold_window.refresh\r\n @buy_window.refresh\r\n @status_window.refresh\r\n # Change windows to buy mode\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n end", "def update_quantity(grocery_list, item, quantity)\r\n add_item(grocery_list, item, quantity)\r\n \r\nend", "def item_id\n params['VendorTxCode']\n end", "def increment_quantity\n @quantity += 1\n end", "def display_coins\n end", "def update\n\n #after the admin approve the invitation request\n #an invitation code will be generated and sent to the user\n invitation = Invitation.find(params[:id])\n invitation.generate_code\n redirect_to admin_invitations_path \n end", "def update\r\n # write some gangsta code here\r\n end", "def transfer\n @inventory_type = InventoryType.find_by_id(params[:id])\n @inventory =Inventory.find_by_id(params[:format])\n end", "def farm_code_combo_changed\n farm_code = params[:farm_code]\n @puc_code = Farm.find_by_farm_code(farm_code).remark1_ptlocation\n render :inline => %{\n <%= @puc %>\n }\n end", "def decrement_inventory!\n self.available_inventory = self.available_inventory - 1\n self.save\n end", "def add_money_to_wallet\n puts \"\\n-----------------------\".colorize(:blue)\n puts \"How much more money do you want to add?\".colorize(:red)\n print \"> $\"\n new_money = gets.to_i\n @player.wallet += new_money\n puts \"Your wallet now has: $#{@player.wallet}\".colorize(:blue)\n end", "def increment_quantity\n self.quantity_needed += self.quantity\n save\n end", "def add_to_available_amount\n api_model = AddToAvailableAmount.new(@inventory_item,params[:amount])\n was_operation_successful = api_model.update_db()\n handle_response_for_update_operation(was_operation_successful,api_model)\n end", "def increment_quantity\n self.quantity += 1\n save\n end", "def set_invoice_number\n self.invoice_number = self.id + 777777\n self.save\n end", "def update_in_saas\n\n return success unless @is_sync_in_saas_needed\n\n SaasApi::OnBoarding::EditBt.new.perform(\n name: @client_token[:name],\n symbol: @client_token[:symbol],\n conversion_factor: @conversion_factor,\n client_id: @client_token[:client_id]\n )\n\n end", "def bins_tipped_production_schedule_name_search_combo_changed\n production_schedule_name = get_selected_combo_value(params)\n session[:bins_tipped_search_form][:production_schedule_name_combo_selection] = production_schedule_name\n @production_run_codes = BinsTipped.find_by_sql(\"select distinct production_run_code from production_runs where production_schedule_name = '#{production_schedule_name}'\").map { |p| [p.production_run_code] }\n @production_run_codes.unshift(\"<empty>\")\n query = \"SELECT track_indicator_code FROM public.production_schedules, public.rmt_setups\n WHERE rmt_setups.production_schedule_id = production_schedules.id AND public.production_schedules.production_schedule_name = '#{production_schedule_name}'\"\n @track_indicator_code = Carton.connection.select_one(query)['track_indicator_code']\n puts \"HELLO KK\"\n\n render :inline => %{\n <%= select('bin_tipped','production_run_code',@production_run_codes)%>\n <img src = '/images/spinner.gif' style = 'display:none;' id = 'img_bin_tipped_production_run_code'/>\n\t\t <%= observe_field('bin_tipped_production_run_code',:update => 'line_code_cell',:url => {:action => session[:bins_tipped_search_form][:production_run_code_observer][:remote_method]},:loading => \"show_element('img_bin_tipped_production_run_code');\",:complete => session[:bins_tipped_search_form][:production_run_code_observer][:on_completed_js])%>\n\n <script>\n <%=\n update_element_function(\"track_indicator_code_cell\",\n :action=>:update,\n :content=> @track_indicator_code)\n %>\n </script>\n }\n\n end", "def add_serial_to_vbox_vm(client_name)\n message = \"Adding:\\t\\tSerial Port to \"+client_name\n command = \"VBoxManage modifyvm \\\"#{client_name}\\\" --uart1 0x3F8 4\"\n execute_command(message,command)\n return\nend", "def button_up(id)\n\n end", "def update_invoice_number!\n return unless Spree::PrintInvoice::Config.use_sequential_number?\n return if invoice_number.present?\n\n update_columns(invoice_number: Spree::PrintInvoice::Config.increase_invoice_number)\n end", "def update\n respond_to do |format|\n @repeating_transfer.attributes = repeating_transfer_params_no_amount\n @repeating_transfer.amount = currency_string_to_number(repeating_transfer_params_amount)\n set_repeat_period(@repeating_transfer, params[:repeating_transfer])\n set_end_type(@repeating_transfer, params[:repeating_transfer])\n\n reinitialize_next_occurrence(@repeating_transfer)\n\n if @repeating_transfer.save\n format.html { redirect_to repeating_transfers_path, notice: 'Repeating transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @repeating_transfer }\n else\n set_select_options\n format.html { render :edit }\n format.json { render json: @repeating_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n if @item.purchase_count.nil?\n @item.update_column(:purchase_count, 0)\n end\n @item.update_column(:purchase_count, @item.purchase_count + 1)\n end", "def add_item_cmd\n puts(\"upc: \")\n upc = gets.chomp\n puts(\"number: \")\n number = gets.chomp.to_i\n new_item(upc, number)\n end", "def add_item_cmd\n puts(\"upc: \")\n upc = gets.chomp\n puts(\"number: \")\n number = gets.chomp.to_i\n new_item(upc, number)\n end", "def transfer_command( amount, ship )\n\t\t\t\tTransferCommand.new @interface, amount, ship\n\t\t\tend", "def up_number\n unless number\n if Invoice.count == 0\n self.number = '001'\n else\n last_invoice = Invoice.order(:number).last\n self.number = last_invoice.number.succ\n end\n end\n end", "def update_buy\r\n # Set status window item\r\n @status_window.item = @buy_window.item\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Change windows to initial mode\r\n @command_window.active = true\r\n @dummy_window.visible = true\r\n @buy_window.active = false\r\n @buy_window.visible = false\r\n @status_window.visible = false\r\n @status_window.item = nil\r\n # Erase help text\r\n @help_window.set_text(\"\")\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get item\r\n @item = @buy_window.item\r\n # If item is invalid, or price is higher than money possessed\r\n if @item == nil or @item.price > $game_party.gold\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Get items in possession count\r\n case @item\r\n when RPG::Item\r\n number = $game_party.item_number(@item.id)\r\n when RPG::Weapon\r\n number = $game_party.weapon_number(@item.id)\r\n when RPG::Armor\r\n number = $game_party.armor_number(@item.id)\r\n end\r\n # If 99 items are already in possession\r\n if number == 99\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Calculate maximum amount possible to buy\r\n max = @item.price == 0 ? 99 : $game_party.gold / @item.price\r\n max = [max, 99 - number].min\r\n # Change windows to quantity input mode\r\n @buy_window.active = false\r\n @buy_window.visible = false\r\n @number_window.set(@item, max, @item.price)\r\n @number_window.active = true\r\n @number_window.visible = true\r\n end\r\n end", "def edit\n params[:extrablank].nil? ? @extrablank = 1 : @extrablank = params[:extrablank].to_i\n @items = Item.all\n @recipe = Recipe.find(params[:id])\n @extrablank.times do\n @recipe.quantities.build\n end\n # @ingredients ? @ingredients << Item.new : @ingredients = [Item.new]\n end", "def update_order_item\n \n end", "def pack_material_product_commodity_group_code_changed\n\tcommodity_group_code = get_selected_combo_value(params)\n\tsession[:pack_material_product_form][:commodity_group_code_combo_selection] = commodity_group_code\n\t@commodity_codes = PackMaterialProduct.commodity_codes_for_commodity_group_code(commodity_group_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('pack_material_product','commodity_code',@commodity_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_pack_material_product_commodity_code'/>\n\t\t<%puts observe_field('pack_material_product_commodity_code',:update => 'marketing_variety_code_cell',:url => {:action => session[:pack_material_product_form][:commodity_code_observer][:remote_method]},:loading => \"show_element('img_pack_material_product_commodity_code');\",:complete => session[:pack_material_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t<%= observe_field('pack_material_product_commodity_code',:update => 'marketing_variety_code_cell',:url => {:action => session[:pack_material_product_form][:commodity_code_observer][:remote_method]},:loading => \"show_element('img_pack_material_product_commodity_code');\",:complete => session[:pack_material_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def show\n @buy_ad.views += 1\n @buy_ad.save!\n end", "def increment_views_amount( public_agency )\n views_amount = public_agency.views_amount\n views_amount += 1\n public_agency.update( views_amount: views_amount )\n end", "def index\n @stocks = Stock.all\n\n # 表示用書式に編集\n @stocks.each do |stock|\n stock.code = stock.code.floor\n end\n end", "def code= new_code\n @code = new_code\n end", "def generate_code\n self.code ||= self.create_code(client)\n save && code\n end", "def add_credits(qty)\n update_column(:credits, credits + qty)\n end", "def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend", "def change_inventory\n order_item_obj = OrderItem.last\n product_id = order_item_obj.product_id\n inventory_of_ordered_product = InventoryStock.where(product_id:product_id)\n quantity_in_inventory = inventory_of_ordered_product[0].quantity\n quantity_in_ordered_item = order_item_obj.quantity\n updated_quantity_in_inventory = quantity_in_inventory.to_i-quantity_in_ordered_item.to_i\n InventoryStock.where(product_id:product_id).update(quantity: updated_quantity_in_inventory)\n end", "def edit_transaction_amount\n puts \"Choose the number of the transaction to be edited:\"\n x = gets.chomp.i #should prompt the user to verify the selection before editing\n puts \"Transaction to be edited:\"\n puts @transaction[x] #if incorrect, give option to select again\n puts \"Enter the new amount for the transaction:\"\n new_amount == gets.chomp.f\n\n if @transaction[x]_at_(2) = \"savings\"\n @balance = @balance - @transaction[x]_at_(1) + new_amount\n else\n @balance = @balance + @transaction[x]_at_(1) - new_amount\n end\n\n @transaction[x]_at_(1) = new_amount\n puts \"Edited transaction:\"\n puts @transaction[x]\n end", "def update_value(quantity)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# quantity == crypto value NOT USD\n\t\t# debugger\n\n\t\tif quantity > 0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# BUY \n\t\t\tself.total_value = self.total_value + quantity\t\t\t# increment wallet value by quantity\n\t\telse \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# SELL\n\t\t\tself.total_value = self.total_value + quantity\t\t\t# quantity is Negative!! so adding, will decrement\n\t\tend\n\n\t\tsave!\n\tend", "def loot\r\n\t@@item_number += 1\r\n\tend", "def updated\n @purchase = Purchase.find(params[:number])\n @purchase.updated = true \n @purchase.save \n redirect_to params[:url] \n end", "def update\n @scaleticket = Scaleticket.find(params[:id])\n @original_qty = @scaleticket.pack_qty.to_f\n \n respond_to do |format|\n if @scaleticket.update_attributes(params[:scaleticket])\n \n @update_amount = (@scaleticket.pack_qty - @original_qty)\n \n update_crop_inventory\n \n format.html { redirect_to(\"/scaleticketview\", :notice => 'Scaleticket was successfully updated.') }\n format.xml { head :ok }\n else\n @transaction = \"edit\"\n \n @cropplan = Cropplan.find(@scaleticket.cropplan_id)\n @storage = Storage.find(@scaleticket.storage_id)\n @transaction = \"edit\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scaleticket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def button_up(id)\n end", "def update(list, item, qty)\n add_item(list, item, qty)\nend", "def update\n quantity_increase = item_params[:quantity].to_i\n previous_quantity = @item.quantity\n respond_to do |format|\n if @item.update(item_params)\n @item.quantity = previous_quantity + quantity_increase\n @item.save \n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_usage(served_quantity) \n self.used_quantity += served_quantity \n self.save \n \n self.mark_as_finished\n \n item = self.item \n item.deduct_ready_quantity(served_quantity ) \n \n return self \n end", "def update_usage(served_quantity) \n self.used_quantity += served_quantity \n self.save \n \n self.mark_as_finished\n \n item = self.item \n item.deduct_ready_quantity(served_quantity ) \n \n return self \n end", "def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend", "def update_item_receipt(code, id, new_value, old_value)\n if new_value != old_value && !$game_switches[MARW_CONFIGURATION[:manual_switch]]\n add_to_receipt([code, id, new_value - old_value])\n end\n end", "def inventory_transfer\n puts \"#{params}\".inspect\n @transfer = Transfer.create!(remark: params[:remark], transfer_item: params[:transfer_item], inventory_type_id: params[:transfer][:inventory_type_id]) \n @inventory_trans = Inventory.find(params[:inventory])\n @inventory_trans.update(:transfer_id => @transfer.id)\n @inventory = InventoryType.shod(params[:transfer][:id])\n trans(params[:inventory], params[:transfer][:id], @inventory)\n inventory_transfer2\nend", "def create\n @truck = Truck.new(truck_params)\n @marcas = @truck.get_marcas() \n @modelos = @truck.get_modelos()\n @tipo_unidad = @truck.get_tipos()\n @config = @truck.get_config()\n @clase = @truck.get_clase()\n @color = @truck.get_color()\n @serie = 1\n \n @truck[:code] = @truck.generate_truck_number(@serie) \n \n\n respond_to do |format|\n if @truck.save\n format.html { redirect_to @truck, notice: 'Truck was successfully created.' }\n format.json { render :show, status: :created, location: @truck }\n else\n format.html { render :new }\n format.json { render json: @truck.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n @item.increment(:quantity)\n @item.save!\n\n refresh\n end", "def change_code(company_code, transaction_code, args = {})\n post_for(:changecode, company_code, transaction_code, args)\n end", "def updating_item(list,item,quantity)\r\n\r\n adding_item(list,item, quantity)\r\n\r\nend", "def exchange_code; end", "def update_cost\n\n @ali = ActivityLineItem.where(object_key: params[:ali]).first\n\n render :partial => 'update_cost_modal_form'\n end", "def remove_voucher_onclick\n decrease_voucher_onclick(quantity)\n end", "def run_transfer_of(amount)\n self.balance += amount\n end", "def qty_to_add=(num)\n ### TODO this method needs a history of who did what\n add_count_on_hand(num)\n end", "def card_number=(t)\n self.number = t.to_i\n end", "def update_buy\n # Set status sprite item\n @status_window.item = @buy_window.item\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Change windows to initial mode\n @command_window.active = true\n @dummy_window.visible = true\n @buy_window.active = false\n @buy_window.visible = false\n @status_window.visible = false\n @status_window.item = nil\n # Erase help text\n @help_window.set_text(\"\")\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Get item\n @item = @buy_window.item\n # If item is invalid, or price is higher than money possessed\n if @item == nil or @item.price > $game_party.gold\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Get items in possession count\n case @item\n when RPG::Item\n number = $game_party.item_number(@item.id)\n when RPG::Weapon\n number = $game_party.weapon_number(@item.id)\n when RPG::Armor\n number = $game_party.armor_number(@item.id)\n end\n # If 99 items are already in possession\n if number == 99\n # Play buzzer SE\n $game_system.se_play($data_system.buzzer_se)\n return\n end\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Calculate maximum amount possible to buy\n max = @item.price == 0 ? 99 : $game_party.gold / @item.price\n max = [max, 99 - number].min\n # Change windows to quantity input mode\n @buy_window.active = false\n @buy_window.visible = false\n @number_window.set(@item, max, @item.price)\n @number_window.active = true\n @number_window.visible = true\n end\n end", "def pcb_number(number,\n revision, \n numeric_revision)\n \n if self.pcb_mnemonic != 'bt'\n dash_number = revision + numeric_revision.to_s\n else\n dash_number = numeric_revision.to_s + revision\n end\n self.unloaded_prefix + '-' + number + '-' + dash_number\n \n end", "def save_inventory_adjustment_vend(response, quantity)\n location_id = response['inventory_level']['location_id']\n shopify_inventory = retail_shopify.shopify_inventories.find_by(location: location_id)\n new_inventory = response['inventory_level']['available']\n\n InventoryUpdate.create(\n vend_qty: vend_datum.sf_inventory,\n prior_qty: shopify_inventory.inventory,\n adjustment: quantity,\n product_id: id,\n new_qty: new_inventory\n )\n\n shopify_inventory.update_attribute(:inventory, new_inventory)\n end", "def update_product_qty\n @order = Spree::Order.find_by_id(params[:order_id])\n @line_item = Spree::LineItem.find_by_id(params[:line_item_id])\n request_to_update_qty = params[:quantity].to_i\n # code to find the order_total\n if @order.market_place.present?\n case @order.market_place.code\n when \"qoo10\"\n order_total = @order.market_place_details.present? ? @order.market_place_details[\"total\"] : @order.total\n when \"lazada\", 'zalora'\n order_total = @order.total\n end\n end\n if @line_item.present?\n prev_qty = @line_item.quantity.to_i\n final_qty = prev_qty - request_to_update_qty\n @variant = @line_item.variant\n @product = @variant.product if @variant.present?\n # code to update line item\n @line_item.update_column(:quantity, request_to_update_qty)\n @sellers_market_places_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @product.id).try(:first)\n if @sellers_market_places_product.present?\n @stock_product = Spree::StockProduct.where(\"sellers_market_places_product_id=? AND variant_id=?\", @sellers_market_places_product.id, @variant.id).try(:first)\n if @stock_product.present?\n @stock_product.update_attributes(:count_on_hand=>(@stock_product.count_on_hand + final_qty.to_i) >= 0 ? (@stock_product.count_on_hand + final_qty.to_i) : 0)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity + final_qty.to_i) >= 0 ? (@variant.fba_quantity + final_qty.to_i) : 0) if [email protected]_inflations.present?\n msg = 'Admin/Orders Controller update_product_qty '\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n end\n end\n end\n # code to update order total after creating line item for order\n @order.update_column(:total, order_total)\n @order.reload\n line_items = @order.line_items\n respond_to do |format|\n format.html { render :partial=>\"modify_shipping\", :locals => { :line_items => line_items }}\n end\n end", "def update\n quantidade = params[:transacao][:quantidade]\n params[:transacao][:quantidade] = quantidade.split( ',').join('.') \n \n respond_to do |format|\n if @transacao.update(transacao_params)\n format.html { redirect_to @transacao.produto, notice: 'Operação atualizada com sucesso!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transacao.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.57784945", "0.5753739", "0.56634957", "0.5623948", "0.561712", "0.5562932", "0.55309904", "0.5528236", "0.54995096", "0.5487453", "0.54749745", "0.54643685", "0.5441968", "0.5432359", "0.542775", "0.5415374", "0.54058105", "0.53849757", "0.5382497", "0.5369485", "0.53693336", "0.53541845", "0.53490824", "0.534604", "0.53430563", "0.53415793", "0.53350747", "0.53118545", "0.5311484", "0.5302475", "0.53004277", "0.52893007", "0.5276755", "0.52669823", "0.526549", "0.52494246", "0.52407485", "0.52387524", "0.5223663", "0.5215838", "0.5207897", "0.52064836", "0.5206384", "0.5205425", "0.5203284", "0.5203164", "0.52022254", "0.52014726", "0.51941776", "0.51928824", "0.5189675", "0.51796687", "0.51794213", "0.51746523", "0.517091", "0.51667625", "0.5164553", "0.51642346", "0.51642346", "0.5159412", "0.51552135", "0.5151421", "0.5149786", "0.5149471", "0.51466566", "0.5146373", "0.51423484", "0.5137194", "0.5130495", "0.51191527", "0.51150125", "0.5114457", "0.5108024", "0.5105986", "0.5100249", "0.5093612", "0.5090107", "0.5088185", "0.5086314", "0.5085766", "0.50850743", "0.5073472", "0.5073472", "0.5069067", "0.5066917", "0.5062373", "0.50471276", "0.5044839", "0.5041976", "0.5039844", "0.50387776", "0.5038735", "0.5036396", "0.5030668", "0.5016058", "0.50150204", "0.5014266", "0.5009024", "0.50051564", "0.5003431", "0.49998337" ]
0.0
-1
Update stocks & average price at view from product & store
def it_update_from_product_store product = params[:product] store = params[:store] tbl = params[:tbl] initial_stock = 0 current_stock = 0 # company = nil # product_company_price = nil average_price = 0 if product != '0' && store != '0' stock = Stock.find_by_product_and_store(product, store) # Stocks initial_stock = stock.initial rescue 0 current_stock = stock.current rescue 0 # WAP average_price = product_average_price(product, store) end # Format numbers initial_stock = number_with_precision(initial_stock.round(4), precision: 4) current_stock = number_with_precision(current_stock.round(4), precision: 4) average_price = number_with_precision(average_price.round(4), precision: 4) # Setup JSON hash @json_data = { "initial" => initial_stock.to_s, "stock" => current_stock.to_s, "tbl" => tbl.to_s, "average_price" => average_price.to_s } render json: @json_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def of_update_description_prices_from_product_store\n product = params[:product]\n store = params[:store]\n supplier = params[:supplier]\n tbl = params[:tbl]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n current_stock = 0\n if product != '0'\n @product = Product.find(product)\n @prices = @product.purchase_prices\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n if store != 0\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id, \"stock\" => current_stock.to_s,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "def update_stock\n\t\tincrease_stock unless new_record?\n\t\tyield\n\t\tdecrease_stock\n\tend", "def index\n @stocks = Stock.all \n \n @stocks.each do |x|\n x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only\n x.save\n end \n end", "def si_update_description_prices_from_product_store\n product = params[:product]\n store = params[:store]\n supplier = params[:supplier]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n current_stock = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n if store != 0\n current_stock = Stock.find_by_product_and_store(product, store).current rescue 0\n end\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id, \"stock\" => current_stock.to_s,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code }\n render json: @json_data\n end", "def manage_stock_settings\n smp = Spree::SellerMarketPlace.find(params[:seller_market_place_stock_config_details].keys.first)\n seller = smp.seller\n seller.update_attributes(:stock_config_type => STOCKCONFIG.key(params[:seller][:stock_config_type]).to_i)\n if !params[\"apply_to_all\"].nil? && params[\"apply_to_all\"] == \"true\"\n inf_variant_ids = Spree::QuantityInflation.pluck(:variant_id)\n var_ids = Spree::Variant.where(:id=>inf_variant_ids).pluck(:product_id)\n # products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true AND kit_id IS NULL\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true AND kit_id IS NULL\"))\n products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true\"))\n products.each do |product|\n product.update_column(:stock_config_type, 0)\n end \n end\n \n if params[:seller][:stock_config_type] == \"percentage_quantity\"\n params[:seller_market_place_stock_config_details].each do |key, value|\n smp = Spree::SellerMarketPlace.find(key)\n smp.update_attributes(:stock_config_details=>value)\n if !params[\"apply_to_all\"].nil? && params[\"apply_to_all\"] == \"true\"\n smpps = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=?\", smp.seller_id, smp.market_place_id)\n smpps.update_all(:stock_config_details=>value)\n end\n end\n end\n res = view_context.update_stock_for_seller(seller, false)\n if res == \"fail\"\n redirect_to admin_seller_seller_market_places_path(seller.id), :error => \"Stock can not be updated properly\"\n else\n redirect_to admin_seller_seller_market_places_path(seller.id), :notice => \"Stock setting updated seccessfully\"\n end\n end", "def update_product_cache_stock\n\t\t\tself.state_check_details.each do |scd|\n scd.update_product_cache_stock\n end\n\t\tend", "def updateFoodStoreFields(prams , average)\n food = FoodStore.find(prams[:food_store_id])\n\t if food.curr_sum_ambience == nil\n\t food.update(curr_sum_ambience:0,curr_sum_price:0,curr_sum_service:0,curr_sum_food:0)\n\t end\n food.update(curr_sum:food.curr_sum + average , num_of_rating:food.num_of_rating + 1)\n \n\t food.update(curr_sum_ambience:food.curr_sum_ambience + prams[:ambience])\n food.update(curr_sum_food:food.curr_sum_food + prams[:foodquality] )\n food.update(curr_sum_price:food.curr_sum_price + prams[:pricing] )\n food.update(curr_sum_service:food.curr_sum_service + prams[:service] )\n\n food.update(ambience_average:((food.curr_sum_ambience/food.num_of_rating)*100).floor / 100.0)\n food.update(service_average:((food.curr_sum_service/food.num_of_rating)*100).floor / 100.0)\n food.update(foodquality_average:((food.curr_sum_food/food.num_of_rating)*100).floor / 100.0)\n food.update(pricing_average:((food.curr_sum_price/food.num_of_rating)*100).floor / 100.0)\n\n food.update(sarapp_rating:((food.curr_sum/food.num_of_rating)*100).floor / 100.0)\n end", "def update_stock\n \tproduct = FileOperations.search_by_name(self)\n \tproduct = product[0].split(';')\n \tself.id = product[0]\n \tself.name = product[1]\n \tself.price = product[2]\n \tself.company = product[3]\n \tself.stock = product[4].to_i - 1\n \tFileOperations.update(self)\n end", "def update_stock_for_seller(seller, fetch_fba_qty)\n stock_values = {}\n inf_variant_ids = Spree::QuantityInflation.pluck(:variant_id)\n var_ids = Spree::Variant.where(:id=>inf_variant_ids).pluck(:product_id)\n # products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true AND kit_id IS NULL\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true AND kit_id IS NULL\"))\n products = inf_variant_ids.present? ? (seller.products.where(\"is_approved=true\").where(\"id NOT IN (?)\", var_ids)) : (seller.products.where(\"is_approved=true\"))\n products.each do |product|\n variants = []\n variants << (product.variants.present? ? product.variants : product.master)\n variants = variants.flatten\n type = STOCKCONFIG[product.stock_config_type] == \"default\" ? STOCKCONFIG[seller.stock_config_type] : STOCKCONFIG[product.stock_config_type]\n smps = seller.seller_market_places.where(:is_active=>true)\n mps = seller.market_places.where(\"spree_market_places.id IN (?)\", smps.map(&:market_place_id))\n variants.each do |variant|\n begin\n Spree::Variant.fetch_qty_from_fba(smps.first,variant) if fetch_fba_qty\n variant = variant.reload\n stock_products = variant.stock_products.where(\"sellers_market_places_product_id IN (?)\", product.sellers_market_places_products.where(\"market_place_id IN (?)\",smps.map(&:market_place_id)).map(&:id))\n if stock_products.present?\n case type\n when \"fixed_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.fixed_quantity_setting(stock_products, variant, mps)) if !fetch_fba_qty\n when \"percentage_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.fixed_quantity_setting(stock_products, variant, mps))\n #stock_values.merge!(variant.id=>Spree::StockProduct.percentage_quantity_setting(stock_products, variant, mps))\n when \"flat_quantity\"\n stock_values.merge!(variant.id=>Spree::StockProduct.flat_quantity_setting(stock_products, variant, mps))\n end # end of case\n end\n rescue Exception => e\n end\n end # end of variant loop\n end # end of product loop\n return update_stock_market_places(stock_values)\n end", "def quick_update_stock(filename)\n ThinkingSphinx::Deltas.suspend :supply_item do\n @updates.each do |upd|\n si = @supplier.supply_items.where(:supplier_product_code => upd[0]).first\n unless si.nil?\n if si.update_attributes(:stock => upd[1]) == true\n supplier_logger.info(\"[#{DateTime.now.to_s}] Quick stock update: #{si.to_s} now #{si.stock}\")\n else\n supplier_logger.error(\"[#{DateTime.now.to_s}] Quick stock update failed: #{si.to_s}, errors: #{si.errors.full_messages}\")\n end\n end\n end\n end\n Product.update_price_and_stock # Sync available products to the now changed supply items\n end", "def update_price\n product_cost_master = ProductCostMaster.find(self.id)\n \tm_revenue = (product_cost_master.basic_cost || 0) + (product_cost_master.shipping_handling || 0) \n m_cost = (product_cost_master.product_cost || 0) + (product_cost_master.tel_cost || 0) + (product_cost_master.postage || 0) + (product_cost_master.royalty || 0) + (product_cost_master.cost_of_return || 0) + (product_cost_master.call_centre_commission || 0) + (product_cost_master.packaging_cost || 0)\n\n \tproduct_cost_master.update_columns(cost: m_cost, revenue: m_revenue)\n end", "def update_product_details\n\t\t\ttransferorderpricing = TransferOrderPricing.new\n\t\t\tcorporate = Corporate.find(self.corporate_id)\n\t\t\ttransferorderpricing = wholesale_price(self.product_list_id, corporate.state, corporate.commission_percent)\n\t\t\tself.update(stock_value: transferorderpricing.final_total)\n distributor_stock_ledger = DistributorStockLedger.find(self.id)\n\t\t\t #10001\tAdd Stock to Distributor\n\t\t\t #10002\tRemove Stock from Distributor\n\t if distributor_stock_ledger.product_list_id.present?\n\t #product list details from product master id\n\t product_list = ProductList.find(distributor_stock_ledger.product_list_id) #.joins(:product_variant).where(\"product_variants.activeid = 10000\")\n\t if product_list.present?\n\t #product list details from product master id\n\t #distributor_stock_ledger = DistributorStockLedger.find(self.id)\n\t distributor_stock_ledger.update(product_master_id: product_list.product_master_id,\n\t product_variant_id: product_list.product_variant_id,\n\t prod: product_list.extproductcode)\n\n\t\t\t\t\t\t\t message = update_product_stock_summary(distributor_stock_ledger.id)\n\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger details updated with stock nos #{message}\"\n\t end\n\n\t elsif distributor_stock_ledger.type_id == 10000 #mis additions\n\t message = add_corporate_mis_balance(distributor_stock_ledger.corporate_id, distributor_stock_ledger.stock_value.to_f)\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger #{message}\"\n\t # flash[:error] = \"Ledger details #{distributor_stock_ledger.type_id}\"\n\t\t\t \telsif distributor_stock_ledger.type_id == 10020 #mis removal\n\t\t\t\t message = \" \"\n\t message += remove_corporate_mis_balance(distributor_stock_ledger.corporate_id, distributor_stock_ledger.stock_value.to_f)\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger #{message}\"\n\t end\n \t #end\n end", "def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end", "def show\n @purchased_stock = PurchasedStock.find(params[:id])\n # update purchased_stock's value_in_stocks\n current_value_in_stocks = 0 \n if (@purchased_stock.total_qty > 0)\n new_value = ((YahooStock::Quote.new(:stock_symbols => [@purchased_stock.stock_code]).results(:to_array).output[0][1].to_f) * 100).to_i\n end\n @purchased_stock.value_in_stocks = new_value * @purchased_stock.total_qty\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchased_stock }\n end\n end", "def update_product_qty\n @order = Spree::Order.find_by_id(params[:order_id])\n @line_item = Spree::LineItem.find_by_id(params[:line_item_id])\n request_to_update_qty = params[:quantity].to_i\n # code to find the order_total\n if @order.market_place.present?\n case @order.market_place.code\n when \"qoo10\"\n order_total = @order.market_place_details.present? ? @order.market_place_details[\"total\"] : @order.total\n when \"lazada\", 'zalora'\n order_total = @order.total\n end\n end\n if @line_item.present?\n prev_qty = @line_item.quantity.to_i\n final_qty = prev_qty - request_to_update_qty\n @variant = @line_item.variant\n @product = @variant.product if @variant.present?\n # code to update line item\n @line_item.update_column(:quantity, request_to_update_qty)\n @sellers_market_places_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @product.id).try(:first)\n if @sellers_market_places_product.present?\n @stock_product = Spree::StockProduct.where(\"sellers_market_places_product_id=? AND variant_id=?\", @sellers_market_places_product.id, @variant.id).try(:first)\n if @stock_product.present?\n @stock_product.update_attributes(:count_on_hand=>(@stock_product.count_on_hand + final_qty.to_i) >= 0 ? (@stock_product.count_on_hand + final_qty.to_i) : 0)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity + final_qty.to_i) >= 0 ? (@variant.fba_quantity + final_qty.to_i) : 0) if [email protected]_inflations.present?\n msg = 'Admin/Orders Controller update_product_qty '\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n end\n end\n end\n # code to update order total after creating line item for order\n @order.update_column(:total, order_total)\n @order.reload\n line_items = @order.line_items\n respond_to do |format|\n format.html { render :partial=>\"modify_shipping\", :locals => { :line_items => line_items }}\n end\n end", "def update\n update_item_count\n update_group_state\n update_totals\n if order.completed?\n update_payment_state\n end\n update_order_type\n update_odd_store_id\n update_sale_total # for card deposit\n\n #run_hooks\n persist_totals\n end", "def perform\n update_null = \" or (stock is null and last_stock_reported_centry is not null)\"\n query = \"stock <> last_stock_reported_centry or ((stock is not null and last_stock_reported_centry is null)#{update_null if ENV[\"UPDATE_NULL_STOCK\"] == \"false\"})\"\n\n ::Product.where(query).each do |local_product|\n resp = centry.put('/conexion/v1/variants/sku.json', {}, {\"sku\": local_product[:sku], \"quantity\": local_product[:stock]})\n if (resp.code == \"200\")\n centry_variant_info = JSON.parse(resp.body)\n local_product[:last_stock_reported_centry] = centry_variant_info[\"quantity\"]\n local_product[:id_product_centry] = centry_variant_info[\"product_id\"]\n local_product.save!\n end\n end\n end", "def update_product_amounts\n commits = Commit.where(:product_id => self.product_id)\n price_with_fee = commits.collect(&:sale_amount_with_fees).reduce(:+)\n price = commits.collect(&:sale_amount).reduce(:+)\n if price_with_fee.nil?\n product.current_sales_with_fees = 0\n product.current_sales = 0\n else\n product.current_sales_with_fees = price_with_fee\n product.current_sales = price\n end\n product.save(validate: false)\n end", "def update_price\n self.update(daily_price: new_daily_price)\n end", "def update_product\n if inbound_order? || quantity_adjustment?\n product.update(stock: product.stock + quantity)\n else outbound_order?\n product.update(stock: product.stock - quantity)\n end\n end", "def update\n # Find product by its id\n @product = Product.find(params[:product_id])\n # Find product stock by its id\n @products_stock = ProductsStock.find(params[:id])\n # authorize @products_stock\n if @products_stock.update(products_stock_params)\n # If update successful go to manager home page\n redirect_to partner_side_path\n else\n # If something goes wrong re-render products stock edit page\n render :edit\n end\n end", "def set_stock\n if params[:id]\n @stock = Stock.find(params[:id])\n elsif params[:ticker_symbol]\n @stock = Stock.find_by_ticker_symbol(params[:ticker_symbol])\n end\n @stock.update_price if @stock and Time.now - @stock.updated_at > 1.minute \n end", "def update_prices( card )\n #更新 order 价格做为新的支付价格\n order.line_items.each{|item|\n discount = card.get_discount_percent( item.product )\n item.update_discount_percent( discount )\n }\n update_totals\n persist_totals\n end", "def index\n @stocks = Stock.all\n @totalrevenue = Trade.where(:action => \"SELL\").sum('shares*price')\n @totalcost = Trade.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n\n end", "def edit\n # Find product by its id\n @product = Product.find(params[:product_id])\n # Find product stock by its id\n @products_stock = ProductsStock.find(params[:id])\n end", "def update_stock_on_update\n # What has changed?\n product_has_changed = product_changed? rescue false\n store_has_changed = store_changed? rescue false\n quantity_has_changed = quantity_changed? rescue false\n # Previous values\n product_prev = product_was rescue product\n store_prev = store_was rescue store\n quantity_prev = quantity_was rescue quantity\n # Stock\n if product_has_changed || store_has_changed\n # Current Stock\n if !update_stock(product, store, quantity, true)\n return false\n end\n # Roll back Previous Stock\n if !update_stock(product_prev, store_prev, quantity_prev, false)\n return false\n end\n elsif quantity_has_changed\n # Current Stock\n if !update_stock(product, store, quantity - quantity_prev, true)\n return false\n end\n end\n true\n end", "def update_stock_market_places(product_stocks)\n messages = []\n lazada_stock_hash = {}\n zalora_stock_hash = {}\n product_stocks.each do |key, value|\n variant = Spree::Variant.find(key)\n begin\n value.each do |sp_key, stock_count|\n stock_product = Spree::StockProduct.find(sp_key)\n smpp = stock_product.sellers_market_places_product\n market_place = smpp.market_place\n user_market_place = Spree::SellerMarketPlace.where(\"seller_id=? AND market_place_id=?\", smpp.seller_id, market_place.id)\n case market_place.code\n when \"qoo10\"\n res = Spree::StockMovement.stock_update_qoo10(variant.product, market_place.id, stock_count, stock_product, user_market_place.first, smpp, stock_count)\n when \"lazada\"\n if lazada_stock_hash[user_market_place.first.id.to_s].present?\n lazada_stock_hash[user_market_place.first.id.to_s].first.merge!(variant.sku.to_s=>stock_count)\n else\n lazada_stock_hash.merge!(user_market_place.first.id.to_s=>[{variant.sku.to_s=>stock_count}])\n end\n when \"zalora\"\n if zalora_stock_hash[user_market_place.first.id.to_s].present?\n zalora_stock_hash[user_market_place.first.id.to_s].first.merge!(variant.sku.to_s=>stock_count)\n else\n zalora_stock_hash.merge!(user_market_place.first.id.to_s=>[{variant.sku.to_s=>stock_count}])\n end\n end\n messages << (market_place.name+\": \"+ res) if res.present? && res != true\n end\n rescue Exception => e\n messages << e.message\n end\n end # end of stock product loop\n # Update stock for lazada in bulk\n Spree::StockMovement.stock_update_lazada_bulk(lazada_stock_hash) if lazada_stock_hash.present?\n Spree::StockMovement.stock_update_lazada_bulk(zalora_stock_hash) if zalora_stock_hash.present?\n return messages.present? ? \"fail\" : \"success\"\n end", "def set_stock\n @product_stock = ProductStock.find(params[:id])\n end", "def method_name\n Order.find(100).order_items.each do |order_item|\n order_item.update_attributes price: order_item.product.sales_price(9, nil)\n end\n end", "def revert_stock (products, actual_model_name, actual_model_id)\n\n products.each do |product|\n #Find which stock objects were updated by the current model so we can revert them\n @spr = StockProductReduction.where(:actual_model_name => actual_model_name, :actual_model_id => actual_model_id)\n\n @spr.each do |spr|\n @stock_product = StockProduct.find_by_id(spr.stock_product_id)\n @new_package_size = @stock_product.packages_size + spr.packages_size\n @stock_product.update(:packages_size => @new_package_size, :gone => false)\n end\n end\n\n #Remove the reductions\n @spr.destroy_all\n end", "def update\n notice = ''\n @order = Order.find(params[:id])\n unless current_member.admin or ([email protected] and [email protected])\n store_location\n flash[:notice] = \"Too late to edit that one, bro.\"\n redirect_to orders_path\n end\n\n # remove empty items\n params[:order][:order_details_attributes].each{ |k,v|\n if v[:id].nil?\n params[:order][:order_details_attributes].delete(k) if v[:quantity].to_f == 0.0 or v[:quantity].strip == ''\n next\n end\n\n if v[:quantity].to_f == 0.0 or v[:quantity].strip == ''\n OrderDetail.find(v[:id]).destroy\n params[:order][:order_details_attributes].delete(k)\n end\n }\n\n # combine same-stock entries\n stock_quantities = {}\n params[:order][:order_details_attributes].each{ |k,v|\n sid = v[:stock_id].to_i\n q = v[:quantity].to_f\n if stock_quantities[sid].nil?\n stock_quantities[sid] = q\n else\n stock_quantities[sid] += q\n OrderDetail.find(v[:id]).destroy unless v[:id].nil?\n params[:order][:order_details_attributes].delete(k)\n end\n }\n params[:order][:order_details_attributes].each{ |k,v|\n params[:order][:order_details_attributes][k][:quantity] = stock_quantities[v[:stock_id].to_i]\n }\n \n unless current_member.admin\n @order.member = current_member\n end\n\n old_stock_quantities = {}\n @order.order_details.each{ |od|\n next if od.stock.nil?\n old_stock_quantities[od.stock.id] = od.quantity\n } \n\n # first check to make sure there is enough stock available\n stock_quantities.each{ |sid,q|\n s = Stock.find(sid)\n old_stock_quantities[sid] = 0.0 if old_stock_quantities[sid].nil?\n qmax = s.quantity + old_stock_quantities[sid]\n if s.limited and qmax < stock_quantities[sid]\n unless current_member.admin\n @order.errors.add \"Limited Stock Item:\",\"Sorry, there are only #{qmax} #{s.product.units} #{s.name} remaining and you have tried to order #{stock_quantities[sid]}.\"\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n return false\n else\n notice = \"Limited Stock Item: There were only #{qmax} \n #{s.product.units} #{s.name} remaining, \n but I let you do it anyway since you're the boss!\"\n end\n elsif !s.limited and qmax < stock_quantities[sid]\n notice = \"You ordered more #{s.name} than is currently in stock. It may be some delay before this order item is available for pick up.\"\n end\n }\n\n # add back quantity and then subtract it off again\n @order.order_details.each{ |od|\n next if od.stock.nil?\n od.stock.quantity += od.quantity\n od.stock.save\n }\n if [email protected] and params[:order][:paid].to_i == 1\n @order.paid_at = Time.now\n @order.marked_paid_by = current_member\n @order.save\n end\n\n if [email protected] and params[:order][:taken].to_i == 1\n @order.taken_at = Time.now\n @order.archived = true\n @order.save\n end\n\n # delete items before we add back the new ones\n @order.order_details = []\n @order.save \n\n respond_to do |format|\n \n if @order.update_attributes(params[:order])\n @order.order_details.each{ |od|\n next if od.stock.nil?\n od.stock.quantity -= od.quantity\n od.stock.save\n if @order.archived\n od.archived_name = od.stock.name\n od.archived_cost = od.stock.final_cost\n od.archived_supplier = od.stock.supplier\n od.archived_product = od.stock.product\n od.archived_markup_pct = od.stock.markup_pct\n od.archived_markup_const = od.stock.markup_const\n end\n od.save\n }\n format.html { redirect_to(orders_path, :notice => \"Order was successfully updated. #{notice}\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n ProductStock.transaction do\n if @product_stock.update_stock_history(params[:product_stock], params[:description]) &&\n @product_stock.triggered_update_attributes(params[:product_stock])\n format.html { redirect_to product_product_stocks_path(@product_stock.product), :notice => 'Product stock was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end\n end", "def update\n @order.earliest_pickup_date = calculate_earliest_pickup_date(:update)\n # Save off original quantity for order_products\n original_quantities = {}\n @order.order_products.each { |order_product| original_quantities[order_product.id] = order_product.quantity }\n respond_to do |format|\n if @order.update(order_params)\n okay = true\n @order.order_products.each do |order_product|\n new_quantity = order_product.quantity\n original_quantity = original_quantities[order_product.id]\n unless (new_quantity == original_quantity)\n product = order_product.product\n new_quantity_in_stock = (product.quantity_in_stock + original_quantity - new_quantity)\n if new_quantity_in_stock < 0 # Desired quantity no longer available\n okay = false if okay\n # Update the order the best we can and notify user of discrepancy\n new_quantity_in_stock = 0\n # The original quantity was already subtracted from the stock; quantity should never have to decrease below what was previously ordered\n new_quantity = original_quantity + product.quantity_in_stock\n order_product.update_attributes(quantity: new_quantity)\n end\n product.update_attributes(quantity_in_stock: new_quantity_in_stock)\n end\n end\n redirect_to(edit_order_path(@order), notice: t('orders.not_available')) and return if (!okay) # \"One or more of the products you selected is not available in the desired quantity. Please review the updated order.\"\n if session[:showing_user]\n format.html { redirect_to @order.user, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n else\n format.html { redirect_to orders_path, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def item_update_price\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @item = @brief_vendor.items.find_by_id(params[:item_id])\n invalid_op unless @item\n \n @item.price = params[:item][:price]\n @item.save\n\n redirect_to vendor_show_brief_path(@brief)\n\n end", "def on_change_funct(idx, price, cart)\n @all_items_price = total_price(cart)\n \"total_price(#{idx}, #{price}, #{@all_items_price})\"\n end", "def modify_price\n log_action \"Modifying price for actions\"\n redraw_all_order_items = self.modify_price_for_actions\n log_action \"Modifying price for gs1\"\n self.modify_price_for_gs1\n if self.is_buyback\n log_action \"modify_price_for_buyback\"\n self.modify_price_for_buyback \n end\n self.modify_price_for_parts\n if self.behavior == 'gift_card'\n log_action \"modify_price_for_giftcards\"\n self.modify_price_for_giftcards \n end\n self.save!\n return redraw_all_order_items\n end", "def update_product_cache_stock\n\t\t\tself.product.update_cache_stock if self.product.present?\n\t\tend", "def update_quantities!\n @products = products.reduce([]) do |products, product|\n # If product is not published\n if !product.variant.published\n set_error(:item_not_for_sale, item: product.variant.name)\n # If product is not in stock\n elsif !product.variant.in_stock?\n set_error(:item_out_of_stock, item: product.variant.name)\n # If product's available stock is less than required quantity\n elsif !product.variant.available_for(product.quantity)\n set_error(\n :not_enough_stock_for_item,\n item: product.variant.name, stock: product.variant.in_stock\n )\n product.quantity = product.variant.in_stock\n products << product if product.quantity > 0\n # Else, keep product as is in cart\n else product.variant.unlimited_stock || product.variant.in_stock >= product.quantity\n products << product\n end\n\n products\n end\n\n # TODO: Doesn't work, think in something else ...\n if discount_code == false\n set_error(:invalid_discount_code)\n end\n\n reset! if @products.length == 0\n end", "def update_price(product_model, product_html)\n price = product_html.css('.price').text\n .gsub('R$', '').gsub(',', '.')\n .strip.to_f\n\n if product_model.price != price && !price.zero?\n # if it changed, create a new price history and add it to the product\n new_price = PriceHistory.create(old_price: product_model.price,\n current_price: price,\n product: product_model)\n\n product_model.update(price: price)\n puts \"PREÇO ATUALIZADO. #{product_model.name}: #{product_model.price_histories.order(:created_at).last.old_price} -> #{product_model.price_histories.order(:created_at).last.current_price}\"\n end\n end", "def update_discounted_price\n self.price = product.price * (100-discount)/100 \n end", "def update\n @stock = Stock.find(params[:symbol])\n binding.pry\n respond_to do |format|\n if @stock.update_attributes(params[:currentPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:openingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n if @stock.update_attributes(params[:closingPrice])\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end", "def update_products_details; end", "def stocks\n\n end", "def update\n updated_count = 0\n\n products.each do |product|\n woo_product = get_sku(product.tuoteno)\n\n unless woo_product\n logger.info \"Tuotetta #{product.tuoteno} ei ole verkkokaupassa, joten saldoa ei päivitetty\"\n\n next\n end\n\n updated_count += update_stock(woo_product['id'], product)\n end\n\n logger.info \"Päivitettiin #{updated_count} tuotteen saldot\"\n end", "def update!(**args)\n @lower_price = args[:lower_price] if args.key?(:lower_price)\n @product_name = args[:product_name] if args.key?(:product_name)\n @upper_price = args[:upper_price] if args.key?(:upper_price)\n end", "def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n PostLogger.info(\"Change position - Now: #{@stock.quantity} shares of #{@stock.symbol} in #{@stock.portfolio.user.name}'s - #{@stock.portfolio.name} Portfolio\")\n\n format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def of_update_description_prices_from_product\n product = params[:product]\n supplier = params[:supplier]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n @prices = @product.purchase_prices\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code }\n render json: @json_data\n end", "def index\n read_exchange_rate\n @conditions = Array.new\n\n @conditions << \"sold_at BETWEEN '#{Date.new(params[:sold_at][\"sold_at(1i)\"].to_i, params[:sold_at][\"sold_at(2i)\"].to_i, 1)}' AND '#{Date.new(params[:sold_at][\"sold_at(1i)\"].to_i, params[:sold_at][\"sold_at(2i)\"].to_i, -1)}'\" if params[:sold_at]\n @conditions << \"price_original >= #{params[:low_price]}\" unless params[:low_price].blank?\n @conditions << \"price_original <= #{params[:high_price]}\" unless params[:high_price].blank?\n @conditions << \"products.category = '#{params[:category]}'\" unless params[:category].blank?\n\n if params[:manufacturer]\n @conditions << \"products.manufacturer = '#{params[:manufacturer]}'\"\n end\n\n @orders = Order.joins(:product).where(@conditions.join(\" AND \")).order(\"sold_at DESC\").all # .page params[:page]\n @sales = @orders.sum(:price_original)\n @average_exchange_rate = (@orders.sum(:price_yen) / @sales).round(2)\n @cost = @orders.sum(:cost)\n @shipping_cost = @orders.sum(:shipping_cost)\n @ebay_cost = @sales * 0.1\n @paypal_cost = (@sales * 0.039 + 0.3 * @orders.size)\n @profit = @orders.sum(:profit)\n\n @products_hash = Product.where([\"id IN (?)\", @orders.pluck(:product_id)]).inject(Hash.new) {|h, p| h[p.id] = p; h}\n end", "def product_updates\n if params[\"product_id\"] == \"new\"\n @product = Product.new\n @product.florist_id = session[\"found_florist_id\"] \n else\n @product = Product.where(id: params[\"product_id\"]).first\n end\n @product.product_type= params[\"product_type\"]\n @product.name = params[\"product_name\"]\n if params[\"items_per_bunch\"] && params[\"items_per_bunch\"].to_f > 0\n @product.items_per_bunch = params[\"items_per_bunch\"].to_f * 100\n if params[\"cost_per_bunch\"] && params[\"cost_per_bunch\"].to_f > 0\n @product.cost_per_bunch = params[\"cost_per_bunch\"].to_f * 100.round(2)\n numerator = params[\"cost_per_bunch\"].to_f * 100.0.round(2)\n denominator = params[\"items_per_bunch\"].to_f * 100.0.round(2)\n \n @product.cost_for_one = (numerator / denominator).round(2)*100\n end\n end\n if params[\"markup\"] && params[\"markup\"].to_f >= 0 \n @product.markup = params[\"markup\"].to_f * 100\n end\n @product.status = params[\"status\"]\n if params[\"display_name\"] == \"\" || params[\"display_name\"] == nil\n @product.display_name = @product.name\n else\n @product.display_name = params[\"display_name\"]\n end\n @product.updated_by = Employee.where(id: session[\"found_user_id\"]).first.name\n @product.florist_id = session[\"found_florist_id\"]\n if @product.save\n redirect_to \"/product/#{@product.id}\" and return\n else\n render(:product_updates) and return\n end \n end", "def update_totals\n\n\t\tset_sale\n\n\t\[email protected] = 0\n\n\t\tfor line_item in @sale.items\n\t\t\[email protected] += line_item.total_price\n\t\tend\n\n\t\ttotal_amount = @sale.amount\n\n\t\tif @sale.discount.blank?\n\t\t\[email protected]_amount = total_amount\n\t\telse\n\t\t\tdiscount_amount = total_amount * @sale.discount\n\t\t\[email protected]_amount = total_amount - discount_amount\n\t\tend\n\n\t\[email protected]\n\tend", "def set_stock_price\n @stock_price = StockPrice.find(params[:id])\n end", "def update_master_variant()\n @new_product_variant = Spree::Variant.where(\"product_id=?\", @new_product.id).first\n @new_product_variant.update_column(\"sku\", @product_row[:name])\n @new_product_variant.update_column(\"weight\", @product_row[:weight]) if @product_row[:weight].present?\n @new_product_variant.update_column(\"height\", @product_row[:height]) if @product_row[:height].present?\n @new_product_variant.update_column(\"width\", @product_row[:width]) if @product_row[:width].present?\n @new_product_variant.update_column(\"depth\", @product_row[:length]) if @product_row[:length].present?\n @new_product_variant.update_column(\"tax_category_id\", @@auto_tax_category_id)\n @new_product_variant.price = @product_row[:price]\n @new_product_variant.core_price = @product_row[:core]\n @new_product_variant\n end", "def update_stock\n for charge in self.charges\n charge.item.update_attribute(:stock, (charge.item.stock.to_i-1)) \n end\n end", "def update\n respond_to do |format|\n if @store.update(stock_params)\n format.html { redirect_to @store, notice: 'Stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_product\n self.product.mrp = self.mrp\n self.product.rate = self.rate\n self.product.vat = self.vat\n self.product.pack = self.pack\n self.product.save\n end", "def update\n if @price.update!(price_params)\n render partial:'list', locals: {product:@price.product}, layout: nil\n else\n render partial:'form', locals: {price:@price}, layout: nil, status: :unprocessable_entity\n end\n end", "def discount_stock\n if @supplies.nil?\n else\n @supplies.each do |sub_array|\n sub_array.each do |item|\n id_supply = item[0]\n quantity = item[1]\n\n # For history of supplies used in an order\n HasUsedSupply.create(order_id: @order_id, supply_id: id_supply,\n quantity: quantity)\n\n # Update supply with the new stock\n @supply = Supply.find(id_supply)\n new_stock = @supply.stock - Integer(quantity)\n @supply.update(:stock => new_stock)\n end\n end\n end\n end", "def update_catalog(item, *)\n\t\t\t# get catalog\n\t\t\titem_cat = item.model.catalog\n\t\t\t# set total items\n\t\t\titem_cat.total_items = item_cat.items.count\n\t\t\t# set total and average costs\n\t\t\tcost = 0.0\n\t\t\titem_cat.items.each do |i|\n\t\t\t\tcost += i.price\n\t\t\tend\n\t\t\titem_cat.total_cost = cost\n\t\t\titem_cat.avg_cost = cost/item_cat.items.count\n\t\t\titem_cat.save\n\t\tend", "def show\n @trades = @stock.trades\n @totalrevenue = @stock.trades.where(:action => \"SELL\").sum('shares*price')\n @totalcost = @stock.trades.where(:action => \"BUY\").sum('shares*price')\n @overall = @totalrevenue - @totalcost\n \n #Trade.where(:action => \"BUY\", :stock_id => 11).sum(shares*price)\n end", "def update_amount\n self.amount = purchase_entries\n .find_all(&:price?)\n .sum { |journal_entry| journal_entry.price * journal_entry.quantity }\n \n self.vat_amount = purchase_entries\n .find_all(&:vat_amount?)\n .sum { |journal_entry| journal_entry.vat_amount * journal_entry.quantity }\n end", "def update\n respond_to do |format|\n if @stock_price.update(stock_price_params)\n format.html { redirect_to @stock_price, notice: 'Stock price was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_price }\n else\n format.html { render :edit }\n format.json { render json: @stock_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def si_update_description_prices_from_product\n product = params[:product]\n supplier = params[:supplier]\n tbl = params[:tbl]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n # Use purchase price, if any. Otherwise, the reference price\n price, discount_p, code = product_price_to_apply(@product, supplier)\n if discount_p > 0\n discount = price * (discount_p / 100)\n end\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "def change_inventory\n order_item_obj = OrderItem.last\n product_id = order_item_obj.product_id\n inventory_of_ordered_product = InventoryStock.where(product_id:product_id)\n quantity_in_inventory = inventory_of_ordered_product[0].quantity\n quantity_in_ordered_item = order_item_obj.quantity\n updated_quantity_in_inventory = quantity_in_inventory.to_i-quantity_in_ordered_item.to_i\n InventoryStock.where(product_id:product_id).update(quantity: updated_quantity_in_inventory)\n end", "def index\n @stocks = Stock.all\n @webhooks = ShopifyAPI::Webhook.find(:all)\n\n\n # After Authenticate Job / after change in product listings\n if Product.count < 1\n ProductSize.all.each do |size|\n _items = ShopifyAPI::Product.find(:all, params: { collection_id: size.collection_id })\n _items.each do |product|\n prod = Product.create(name: product.title, item_id: product.id, product_size: size)\n product.variants.each do |var|\n prod.variants.create!(quantity: var.inventory_quantity, variant_id: var.id, title: var.title, inventory_item_id: var.inventory_item_id )\n end\n end\n end\n end\n\n\n end", "def update_for_customer\n reviews = Review.find_for_all_product_of_customer(customer.id)\n nb_reviews = reviews.size\n score_reviews = reviews.average(:score)\n customer.nb_reviews = nb_reviews\n customer.score_reviews = score_reviews\n customer.save\n end", "def index\n @stock_prices = StockPrice.all\n end", "def update_price(raw_price)\n model.price = raw_price * 1.10 # our markup is 10%\n model.save!\n end", "def average_price\n populate_price_data unless @average_price\n @average_price\n end", "def show\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n @entries = CartCarry.where(cart_id:@cart.id)\n @TotalPrice = 0\n @entries.each do |item|\n @TotalPrice += Product.find_by(id:item.product_id).currentPrice * item.quantity\n end\n end", "def stock_updates\n my_logger ||= Logger.new(\"#{Rails.root}/log/cron.log\")\n errors = []\n notification_array = []\n if params[\"products\"].present?\n ApiJob.fba_stock_received(params)\n else\n notification_array << ['',\"No Products found\",'',true]\n errors << \"No Products found\" \n end\n Spree::DataImportMailer::stock_update_notification(notification_array).deliver if notification_array.present?\n #view_context.update_stock_market_places(stock_values) if stock_values.present? \n if errors.empty?\n respond_to do |format|\n format.json { render :status => 200, :json => {:success => \"true\", :message => \"Stock updated successfully!\" }}\n end\n else\n respond_to do |format|\n format.json { render :status => 200, :json => {:success => \"false\", :message => errors.join(\"; \") }}\n end\n end\n end", "def calculate_fields!\n m_price_extend = qty * price\n attributes = { :price_extend => m_price_extend }\n self.update_attributes(attributes)\n end", "def update\n respond_to do |format|\n @purchase_order = @valuation.purchase_order\n @purchase_order_items = @purchase_order.purchase_order_items\n @purchase_order_items.each do |item|\n @valuation_item = @valuation.valuation_items.where(purchase_order_item_id: item.id).first\n @valuation_item.update(value: params[:valuation][:valuation_items][item.id.to_s])\n end \n if @valuation.update(valuation_params)\n format.html { redirect_to @valuation, notice: t('valuations.success_update') }\n format.json { render :show, status: :ok, location: @valuation }\n else\n format.html { render :edit }\n format.json { render json: @valuation.errors, status: :unprocessable_entity }\n end\n end\n end", "def adjust_sku_stock\n if Store.positive?(self.adjustment)\n self.stock_total = self.sku.stock + self.adjustment\n self.sku.update_column(:stock, self.sku.stock + self.adjustment)\n else\n self.stock_total = self.sku.stock - self.adjustment.abs\n self.sku.update_column(:stock, self.sku.stock - self.adjustment.abs)\n end\n end", "def update\n @portfolio = Portfolio.find(params[:portfolio_id])\n @trade = @portfolio.trades.find(params[:id])\n\n # @trade = Trade.new(params[:trade])\n @trade.assign_attributes(params[:trade])\n @stock2 = StockQuote::Stock.quote(\"#{params[:trade][:stock]}\")\n @trade.buy_price = @stock2.last\n\n respond_to do |format|\n # if @trade.update_attributes(params[:trade])\n if @trade.save\n format.html { redirect_to [@portfolio, @trade], notice: 'Trade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trade.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:commit] == 'Add'\n current_quantity = params[:product_quantity].to_i + 1\n stock_status = @line_item.product.has_enough_products(current_quantity)\n update_quantity(stock_status, \"add\")\n end\n\n if params[:commit] == 'Reduce'\n if params[:product_quantity].to_i > 1 #at least 1\n current_quantity = params[:product_quantity].to_i - 1\n stock_status = @line_item.product.has_enough_products(current_quantity)\n update_quantity(stock_status, \"reduce\")\n else #1\n @notice = \"Only one in your cart. You can only remove it.\"\n @add_class = \"alert-danger\"\n end\n end\n\n respond_to do |format|\n format.js\n end\n\n # respond_to do |format|\n # if @line_item.update(line_item_params)\n # format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }\n # format.json { render :show, status: :ok, location: @line_item }\n # else\n # format.html { render :edit }\n # format.json { render json: @line_item.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @product_stock = ProductStock.find(params[:id])\n\n respond_to do |format|\n if @product_stock.update_attributes(params[:product_stock])\n format.html { redirect_to @product_stock, notice: 'Estoque atualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product_skus\n @order = Spree::Order.find_by_id(params[:order_id])\n @variant = Spree::Variant.find_by_id(params[:variant_id])\n @product = @variant.product\n requested_qty = params[:quantity]\n is_customer_pickup = @order.market_place_details.present? ? (@order.market_place_details[\"OrderType\"] == \"Pickup\" ? true : false) : false\n # code to find the order_total\n if @order.market_place.present?\n case @order.market_place.code\n when \"qoo10\"\n order_total = @order.market_place_details.present? ? @order.market_place_details[\"total\"] : @order.total\n when \"lazada\",'zalora'\n order_total = @order.total\n end\n end\n # code to create line item\n price = @variant.price.present? ? @variant.price : 0.0 \n @line_item = Spree::LineItem.create!(:variant_id=>@variant.id, :order_id=>@order.id, :quantity=>requested_qty, :price=>price, :currency=>@order.currency, :is_pick_at_store => is_customer_pickup)\n if @line_item.present?\n @sellers_market_places_product = Spree::SellersMarketPlacesProduct.where(\"seller_id=? AND market_place_id=? AND product_id=?\", @order.seller_id, @order.market_place_id, @product.id).try(:first)\n if @sellers_market_places_product.present?\n @stock_product = Spree::StockProduct.where(\"sellers_market_places_product_id=? AND variant_id=?\", @sellers_market_places_product.id, @variant.id).try(:first)\n if @stock_product.present?\n @stock_product.update_attributes(:count_on_hand=>(@stock_product.count_on_hand - requested_qty.to_i) >= 0 ? (@stock_product.count_on_hand - requested_qty.to_i) : 0)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity - requested_qty.to_i) >= 0 ? (@variant.fba_quantity - requested_qty.to_i) : 0) if [email protected]_inflations.present?\n msg = 'Admin/Orders Controller add_product_skus Line 182'\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n else\n @stock_product = Spree::StockProduct.create!(:sellers_market_places_product_id=>@sellers_market_places_product.id, :variant_id=>@variant.id, :count_on_hand=>requested_qty.to_i, :virtual_out_of_stock=>false)\n @variant.update_attributes(:fba_quantity=>(@variant.fba_quantity - requested_qty.to_i) >= 0 ? (@variant.fba_quantity - requested_qty.to_i) : 0) if [email protected]_inflations.present?\n msg = 'Admin/Orders Controller add_product_skus Line 187'\n @variant.add_log_on_update(msg) rescue QTY_LOG.error \"#{Time.zone.now} Error -- #{msg}\"\n end\n end\n end\n # code to update order total after creating line item for order\n @order.update_column(:total, order_total)\n @order.reload\n line_items = @order.line_items\n ActiveSupport::Notifications.instrument('spree.order.contents_changed', {:user => nil, :order => @order})\n respond_to do |format|\n format.html { render :partial=>\"modify_shipping\", :locals => { :line_items => line_items }}\n end\n end", "def update\n respond_to do |format|\n if @contract.daily_premium_prices.push(params[:daily_premium_prices][0])\n @contract.update_attributes(:premium => contract_params[:premium], :count => contract_params[:count])\n @contract.save\n format.html { redirect_to @contract, notice: 'Contract was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract }\n else\n format.html { render :edit }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @basket.set_price\n respond_to do |format|\n if @basket.update(basket_params)\n format.html { redirect_to @basket, notice: 'Basket was successfully updated.' }\n format.json { render :show, status: :ok, location: @basket }\n else\n format.html { render :edit }\n format.json { render json: @basket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n params[:product_attr].to_a.each do |key, attr|\n product = Product.find(key)\n product.update_attributes(attr)\n end\n redirect_to(harman_employee_pricing_admin_products_path, notice: \"Pricing updated successfully.\")\n end", "def update_price(price)\n model.price = price # * 1.10 # our markup is 10%\n model.save!\n end", "def update\n respond_to do |format|\n if @product_sample_stock.update(product_sample_stock_params)\n format.html { redirect_to @product_sample_stock, notice: 'Product sample stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_sample_stock }\n else\n format.html { render :edit }\n format.json { render json: @product_sample_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @total_stock = TotalStock.find(params[:id])\n\n respond_to do |format|\n if @total_stock.update_attributes(params[:total_stock])\n format.html { redirect_to @total_stock, notice: 'Total stock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @total_stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_stock\n @item.stock += params[:stock].to_i\n @item.save\n flash[:success] = \"Stock updated\"\n redirect_back(fallback_location: root_path)\n end", "def update_stock(_product, _store, _quantity, _is_new)\n if _product.product_type.id != 2\n _stock = Stock.find_by_product_and_store(_product, _store)\n if !_stock.nil?\n _stock.current = _is_new ? _stock.current - _quantity : _stock.current + _quantity\n if !_stock.save\n return false\n end\n end\n end\n true\n end", "def recalculate\n product = Product.find_by_id(params[:id])\n @inventories = product.inventories\n if @inventories.empty?\n product.update_balance(0)\n redirect_to inventories_url \n flash[:notice] = \"No entries found.\"\n return \n end\n\n count = 0\n @inventories.each do |i|\n count = count + i.item_in - i.item_out\n end\n \n if product.balance != count\n product.update_balance(count)\n end\n\n flash[:notice] = \"#{count} #{product.name} left.\"\n redirect_to inventories_url\n end", "def update_as_sold\n # Header:\n # Content-Type : application/json\n # request payload example:\n # { \"copies_sold\" : 5 }\n books_in_stock = @shop.distributions.find_by(:book_id => shop_params[:book_id])\n copies_sold = shop_params[:copies_sold]\n if books_in_stock.nil?\n render status: 404, json: {\n message: \"Record not found - cannot find the book in this shop\",\n }\n elsif copies_sold.nil? || copies_sold < 0\n render status: 422, json: {\n message: \"Failed request due to invalid paylod data\",\n }\n else\n # 1. decrement copies_in_stock\n actual_sold = books_in_stock.update_copies_in_stock copies_sold\n # 2. increment total books_sold_count of the shop\n books_in_stock.shop.update_sold_count actual_sold\n render status: 200, json: {\n message: \"Successfully updated #{actual_sold} copies as sold in the shop\",\n shop: @shop\n }\n end\n end", "def normalize_stock\n self.stock = 0 if self.stock.nil?\n end", "def update\n @property.Rate = ((@property.CurrentPrice - @property.Price) / @property.Price) * 100\n @property.ShareValue = @property.CurrentPrice / @property.Shares\n # update share value in individual shares\n @property.shares.update_all(value: @property.ShareValue)\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Please Press edit to verify changes and PRESS UDATE again' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @hotsale.update(params[:hotsale].permit(:price))\n flash[:notice] = \"¡Hotsale Editada!\"\n redirect_to @hotsale\n else\n flash[:notice] = \"¡Error! Este Hotsale no se edito\"\n redirect_to @hotsale\n end\n end", "def reset_values\n if ([\"stock_quantity\", \"available_quantity\"] & changed).present?\n Rails.cache.delete([:stock_cost, product_id, id ])\n\n\n end\n end", "def fetch_fba_quantity\n sellers = Spree::Seller.all\n sellers.each do |seller|\n begin\n @res = view_context.update_stock_for_seller(seller, true)\n rescue Exception => e\n \n end \n end \n redirect_to :back, :notice => \"FBA quantity fetch successfully\" \n end", "def so_update_description_prices_from_product\n product = params[:product]\n tbl = params[:tbl]\n description = \"\"\n qty = 0\n price = 0\n discount_p = 0\n discount = 0\n code = \"\"\n amount = 0\n tax_type_id = 0\n tax_type_tax = 0\n tax = 0\n if product != '0'\n @product = Product.find(product)\n # Assignment\n description = @product.main_description[0,40]\n qty = params[:qty].to_f / 10000\n price = @product.sell_price\n code = @product.product_code\n amount = qty * (price - discount)\n tax_type_id = @product.tax_type.id\n tax_type_tax = @product.tax_type.tax\n tax = amount * (tax_type_tax / 100)\n end\n # Format numbers\n price = number_with_precision(price.round(4), precision: 4)\n tax = number_with_precision(tax.round(4), precision: 4)\n amount = number_with_precision(amount.round(4), precision: 4)\n discount_p = number_with_precision(discount_p.round(2), precision: 2)\n discount = number_with_precision(discount.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"description\" => description, \"price\" => price.to_s, \"amount\" => amount.to_s,\n \"tax\" => tax.to_s, \"type\" => tax_type_id,\n \"discountp\" => discount_p, \"discount\" => discount, \"code\" => code, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "def update\n @stock_price = StockPrice.find(params[:id])\n\n respond_to do |format|\n if @stock_price.update_attributes(params[:stock_price])\n format.html { redirect_to @stock_price, notice: 'Stock price was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def stock_adjustment\n if Store.positive?(self.adjustment)\n self.stock_total = self.sku.stock_adjustments.first.stock_total + self.adjustment\n self.sku.update_column(:stock, self.sku.stock + self.adjustment)\n else\n self.stock_total = self.sku.stock_adjustments.first.stock_total - self.adjustment.abs\n self.sku.update_column(:stock, self.sku.stock - self.adjustment.abs)\n end\n end", "def update\n @prices = Price.all\n @strains = Strain.all\n @regions = Region.all\n respond_to do |format|\n if @price.update(price_params)\n format.html { redirect_to \"/\", notice: 'Price was successfully updated.' }\n format.json { render :show, status: :ok, location: @price }\n else\n format.html { render :edit }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end", "def apply_default_stock_setting\n self.product.update_attributes(:stock_config_type=>0)\n smp = Spree::SellerMarketPlace.where(\"seller_id=? AND market_place_id=?\",self.seller_id, self.market_place_id)\n self.update_attributes(:stock_config_details=>smp.first.stock_config_details) if smp.present?\n end", "def edit\n @listing.price /= 100\n end", "def update\n respond_to do |format|\n if @stock.update(stock_params)\n format.html { redirect_to @stock, notice: 'stock was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock }\n else\n format.html { render :edit }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stockist = Stockist.find(params[:id])\n\n respond_to do |format|\n if @stockist.update_attributes(params[:stockist])\n flash[:notice] = 'Stockist was successfully updated.'\n format.html { redirect_to(admin_stockist_path(@stockist)) }\n format.xml { head :ok }\n else\n assign_lovs\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stockist.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.689524", "0.6801746", "0.6789446", "0.67554986", "0.6738091", "0.66344637", "0.66309196", "0.65732765", "0.65387034", "0.65283996", "0.6526053", "0.6459753", "0.63988125", "0.63988125", "0.6389891", "0.6374579", "0.6365551", "0.63528717", "0.6349857", "0.6305951", "0.6302672", "0.62888044", "0.6266991", "0.62631255", "0.6247476", "0.624691", "0.62273014", "0.6218997", "0.62165177", "0.6212993", "0.6195272", "0.6182205", "0.616783", "0.6165955", "0.6165702", "0.6161551", "0.6152851", "0.6151018", "0.61484396", "0.61370474", "0.61126125", "0.6099053", "0.6092184", "0.6085584", "0.60849446", "0.6083837", "0.6074782", "0.6063259", "0.6039783", "0.6035982", "0.6022481", "0.6020825", "0.60059553", "0.5995144", "0.59849906", "0.59848106", "0.59845495", "0.59806997", "0.597989", "0.5967069", "0.5965172", "0.5951034", "0.5950891", "0.5946924", "0.59458345", "0.5943102", "0.59421915", "0.593515", "0.592968", "0.59245074", "0.59156775", "0.5906634", "0.59056765", "0.590518", "0.5899523", "0.5894052", "0.58933246", "0.58841616", "0.58785546", "0.58688223", "0.5868645", "0.5864135", "0.585294", "0.58498913", "0.58471435", "0.58451545", "0.58401835", "0.5837778", "0.5835361", "0.583413", "0.5830379", "0.58232504", "0.58182615", "0.58176965", "0.5816881", "0.58156115", "0.581306", "0.5813035", "0.58129317", "0.5812858" ]
0.7533274
0
Update product & store selects at view from organization
def it_update_from_organization organization = params[:org] if organization != '0' @organization = Organization.find(organization) @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name) @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code) else @stores = stores_dropdown @products = products_dropdown end # Products array @products_dropdown = products_array(@products) # Setup JSON @json_data = { "store" => @stores, "product" => @products_dropdown } render json: @json_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def of_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def si_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def it_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def so_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def update\n if params[:id].to_i == 0 and ['featured','clearance','whats_new'].include? params[:id]\n @products = Product.send(params[:id])\n @products.each do |product|\n product.send(params[:id] + '_position=', params[params[:id]].index(product.id.to_s))\n product.save\n end\n render :nothing => true and return\n end\n if params.has_key? :product\n @editable_params[:category_ids].uniq! if @editable_params.has_key? :category_ids\n end\n @product.send(params[:event]) if params.has_key? :event\n if params.has_key? :product and @product.update_attributes(@editable_params)\n @product_section = 'overview'\n render :template => 'manage/products/show' and return\n elsif !params.has_key? :product\n @product_section = 'overview'\n render :template => 'manage/products/show' and return\n else\n @product_section = 'info'\n render :template => 'manage/products/edit' and return\n end\n end", "def update_products_details; end", "def update\n \t@breadcrumb = @hqproduct.hqlevel.find_my_direct_parent()\n \tif current_admin.superadmin == 1\n\t \t@Orgs = Organization.with_translations(I18n.locale)\n\t else\n\t \t@Orgs = Organization.with_translations(I18n.locale).where(\"accessLevel = 1\")\n\t end\n \t# force to set org_id to 0 if nil?\n \tif hqproduct_params[:organization_id].empty?\n \t\tparams[:hqproduct][:organization_id] = 0\n \tend\n \t\n respond_to do |format|\n if @hqproduct.update(hqproduct_params) && ( params[ :article ].nil? ^ @hqproduct.article.update( params.require(:article).permit(:content) ) )\n \n format.html { redirect_to admin_hqlevel_path(@hqproduct.hqlevel, locale: I18n.locale), notice: 'Hqproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hqproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product.update(product_params)\n set_products\n end", "def update\n @pagetitle = \"Edit product\"\n \n @product = Product.find(params[:id])\n @company = @product.company\n @suppliers = @company.get_suppliers()\n @marcas = @company.get_marcas()\n @modelos = @company.get_modelos()\n @categories = @company.get_categories() \n @unidades = Unidad.all\n\n respond_to do |format|\n if @product.update_attributes(products_params)\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n @product.attributes = params[:product]\n render_after_save('edit')\n end", "def update\n \n if params[:category_ids].present?\n @product.categories.clear\n params[:category_ids].each do |id| \n @product.categories << Category.find(id)\n end\n end\n \n @product.areas.clear\n if params[:area_ids].present?\n @product.areas.clear\n params[:area_ids].each do |id| \n @product.areas << Area.find(id)\n end\n end\n \n if params[:article_ids].present?\n @product.articles.clear\n params[:article_ids].each do |id| \n @product.articles << Article.find(id)\n end\n end\n \n # update status\n @product.status = nil if params[:product][:status].present?\n @product.status = params[:product][:status].join(\",\") if params[:product][:status].present?\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to edit_admin_product_path(@product.id), notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @stores = Store.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n if params[:update_products].present? \n @products = Product.order(sort_column + \" \" + sort_direction)\n @update_products = true\n end \n end", "def set_product\n \n end", "def update\n unread\n\n @product = Product.find(params[:id])\n @sellers = Seller.all\n @branches = Branch.all\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t@breadcrumb = @brproduct.brlevel.find_my_direct_parent()\n \tif current_admin.superadmin == 1\n\t \t@Orgs = Organization.with_translations(I18n.locale)\n\t else\n\t \t@Orgs = Organization.with_translations(I18n.locale).where(\"accessLevel = 1\")\n\t end\n \t# force to set org_id to 0 if nil?\n \tif brproduct_params[:organization_id].empty?\n \t\tparams[:brproduct][:organization_id] = 0\n \tend\n \t\n respond_to do |format|\n if @brproduct.update(brproduct_params) && ( params[ :article ].nil? ^ @brproduct.article.update( params.require(:article).permit(:content) ) )\n \n format.html { redirect_to admin_brlevel_path(@brproduct.brlevel, locale: I18n.locale), notice: 'Brproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n # dla formularza new, dla metody create\n @categories = Category.find(:all, :conditions => [\"\\\"isDefault\\\" = ? or user_id = ?\", true, current_user.id])\n @units = Unit.find(:all, :conditions => [\"\\\"isDefault\\\" = ? or user_id = ?\", true, current_user.id])\n\n @product = Product.find(params[:id])\n\n # dla tabeli index\n @products = current_user.products.paginate(page: params[:page])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n # format.html { redirect_to @product, notice: 'Produkt pomyślnie zaktualizowano.' }\n format.html { redirect_to products_path, notice: 'Pomyślnie zaktualizowano produkt.' }\n format.json { head :no_content }\n else\n format.html { render action: \"index\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_supplier_product \n redirect_unless_privilege('Proveedores')\n \t@product = Product.find params[:product_id]\n \[email protected] if @product.videos.blank?\n\t @supplier_account = @product.supplier_account\n\t @supplier = @product.supplier_account.supplier\n\t\t@product_types = ProductType.of_supplier @supplier\n\t\t@industry_categories = @supplier_account.industry_categories.where(:industry_category_type_id => 1) if @supplier_account.industry_categories.where(:industry_category_type_id => 1).count > 0\n\t\t@industry_cat_types = @industry_categories.inject({}) do |options, industry_category|\n\t\t (options[industry_category.industry_category_type.name] ||= []) << [industry_category.get_name, industry_category.id]\n \t\toptions\n\t\tend\n # product_faqs = @product.product_faqs.build\n end", "def update\n @product = current_user.user_info.products.find(params[:id])\n @product = Product.find(params[:id]) if current_user.user_info.admin \n respond_to do |format|\n if @product.update_attributes(params[:product])\n Shopify.modify @product\n format.html { redirect_to :action => 'index' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product = Product.find(params[:id])\n\n collect_and_assign_product_weaves\n collect_and_assign_product_fabrics\n collect_and_assign_product_attributes\n collect_and_assign_new_categories\n \n respond_to do |format|\n if @product.update_attributes(params[:product])\n flash[:notice] = 'Product was successfully updated.'\n format.html { redirect_to(admin_product_path(@product)) }\n format.xml { head :ok }\n else\n assign_lovs\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_product\n self.product.mrp = self.mrp\n self.product.rate = self.rate\n self.product.vat = self.vat\n self.product.pack = self.pack\n self.product.save\n end", "def product\n if PRODUCT_UPDATE_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n id = params[\"product_id\"]\n if id == \"new\"\n @product = Product.new\n @product.items_per_bunch = 100\n @product.markup = 100\n else\n @product = Product.where(florist_id: session[\"found_florist_id\"]).where(id: id).first\n end\n render(:product_updates) and return\n else\n redirect_to \"/products\" and return\n end\n end", "def update\n get_product\n @product_detail = @product.details.find(params[:id])\n @product_detail.update_attributes(params[:product_detail])\n end", "def update\n @product_option = ProductOption.find(params[:product_option][:id])\n @product = Product.find(params[:product_id])\n @product_option.update_attributes(params[:product_option])\n \n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def update\n Product.transaction do\n @product.update!(product_params)\n @client = @product.client\n end\n\n respond_to do |format|\n set_products_grid\n format.html { redirect_to @product, notice: 'Product was successfully updated.'}\n format.js\n end\n rescue ActiveRecord::Rollback\n respond_to do |format|\n format.html { render :edit }\n format.js { render :edit }\n end\n end", "def update\n # Se for unidade de produção, é 1, se não, é outro\n @production_unity.scope_type == 1 ? params = scope_product_production_unity_params : params = scope_product_agribusiness_params\n respond_to do |format|\n if @scope_product.update(params)\n SystemLog.create(description: \"Atualizou um produto da unidade de produção: #{@production_unity.name} chamado #{@scope_product.product.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @production_unity, @production_unity_scope], notice: 'Produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @scope_product }\n else\n format.html { render :edit }\n format.json { render json: @scope_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def product_updates\n if params[\"product_id\"] == \"new\"\n @product = Product.new\n @product.florist_id = session[\"found_florist_id\"] \n else\n @product = Product.where(id: params[\"product_id\"]).first\n end\n @product.product_type= params[\"product_type\"]\n @product.name = params[\"product_name\"]\n if params[\"items_per_bunch\"] && params[\"items_per_bunch\"].to_f > 0\n @product.items_per_bunch = params[\"items_per_bunch\"].to_f * 100\n if params[\"cost_per_bunch\"] && params[\"cost_per_bunch\"].to_f > 0\n @product.cost_per_bunch = params[\"cost_per_bunch\"].to_f * 100.round(2)\n numerator = params[\"cost_per_bunch\"].to_f * 100.0.round(2)\n denominator = params[\"items_per_bunch\"].to_f * 100.0.round(2)\n \n @product.cost_for_one = (numerator / denominator).round(2)*100\n end\n end\n if params[\"markup\"] && params[\"markup\"].to_f >= 0 \n @product.markup = params[\"markup\"].to_f * 100\n end\n @product.status = params[\"status\"]\n if params[\"display_name\"] == \"\" || params[\"display_name\"] == nil\n @product.display_name = @product.name\n else\n @product.display_name = params[\"display_name\"]\n end\n @product.updated_by = Employee.where(id: session[\"found_user_id\"]).first.name\n @product.florist_id = session[\"found_florist_id\"]\n if @product.save\n redirect_to \"/product/#{@product.id}\" and return\n else\n render(:product_updates) and return\n end \n end", "def it_update_from_product_store\n product = params[:product]\n store = params[:store]\n tbl = params[:tbl]\n initial_stock = 0\n current_stock = 0\n # company = nil\n # product_company_price = nil\n average_price = 0\n if product != '0' && store != '0'\n stock = Stock.find_by_product_and_store(product, store)\n # Stocks\n initial_stock = stock.initial rescue 0\n current_stock = stock.current rescue 0\n # WAP\n average_price = product_average_price(product, store)\n end\n # Format numbers\n initial_stock = number_with_precision(initial_stock.round(4), precision: 4)\n current_stock = number_with_precision(current_stock.round(4), precision: 4)\n average_price = number_with_precision(average_price.round(4), precision: 4)\n # Setup JSON hash\n @json_data = { \"initial\" => initial_stock.to_s, \"stock\" => current_stock.to_s,\n \"tbl\" => tbl.to_s, \"average_price\" => average_price.to_s }\n render json: @json_data\n end", "def update\n @product = Product.find(params[:id])\n #@product.accessible = :all if admin?\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to quick_list_path, :notice => 'Product was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n stores = []\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n stores << store\n end\n end\n end\n\n unless stores.empty?\n @product.stores = stores\n else\n @product.stores.clear\n end\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_os_product\n @os_product = OsProduct.find(params[:id])\n end", "def update\n\n if (@product.auction != nil)\n redirect_to @product, notice: \"Sorry! You can't update the product details once you started an auction\"\n return \n end\n\n @product.title = \"#{product_params[:year] + \" \" + product_params[:name] +\" \" + product_params[:model]}\"\n @product.user = current_user\n @product.originaluser_id = current_user.id\n\n @product.city = current_user.city if current_user.city.present?\n @product.state = current_user.state if current_user.state.present?\n @product.zipcode = current_user.zip if current_user.zip.present?\n\n respond_to do |format| \n\n\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @order = Order.find(params[:id])\n @season_products = OrderSeasonProduct.where(:order_seasons_id => current_season)\n @products = Product.where(:product_id => @season_products.map(&:products_id)).order(:product_name)\n end", "def update!(**args)\n @product_sets = args[:product_sets] if args.key?(:product_sets)\n end", "def update\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n @product_company_price.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_company_price.update_attributes(params[:product_company_price])\n format.html { redirect_to @product_company_price,\n notice: (crud_notice('updated', @product_company_price) + \"#{undo_link(@product_company_price)}\").html_safe }\n format.json { head :no_content }\n else\n @suppliers = suppliers_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @product_company_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n params[:product_attr].to_a.each do |key, attr|\n product = Product.find(key)\n product.update_attributes(attr)\n end\n redirect_to(harman_employee_pricing_admin_products_path, notice: \"Pricing updated successfully.\")\n end", "def update\n # Find product by its id\n @product = Product.find(params[:product_id])\n # Find product stock by its id\n @products_stock = ProductsStock.find(params[:id])\n # authorize @products_stock\n if @products_stock.update(products_stock_params)\n # If update successful go to manager home page\n redirect_to partner_side_path\n else\n # If something goes wrong re-render products stock edit page\n render :edit\n end\n end", "def apply_option_to_product\n @product = Product.find(params[:product_id])\n \n @product_option = ProductOption.find(params[:product_option][:id])\n @product_option.update_attributes(params[:product_option])\n\n product_option_instance = ProductOptionInstance.new(:product => @product, \n :product_option => @product_option)\n \n product_option_instance.save\n\n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def update\n @order = Order.find(params[:order_id])\n if current_user.role?('manager') and !Manager.find(current_user.manager_id).validity\n redirect_to order_order_items_path(@order), notice: t(:manager_not_valid)\n return \n end \n if @order.exported_at\n redirect_to order_path(@order), notice: t(:not_edit_exported_order) \n end\n \n @order_item = OrderItem.find(params[:id])\n @product_ids = ProductPrice.where(price_list_id: @order.price_list_id).select('product_id').map {|x| x.product_id}\n @products = Product.where(validity: true).where(id: @product_ids)\n @select_unit_of_measure = params[:order_item][:unit_of_measure_id]\n @unit_of_measure_ids = ProductUnitOfMeasure.where(product_id: params[:order_item][:product_id]).select('unit_of_measure_id').map {|x| x.unit_of_measure_id}\n @unit_of_measures = UnitOfMeasure.where(id: @unit_of_measure_ids) \n \n respond_to do |format|\n if @order_item.update_attributes(params[:order_item])\n format.html { redirect_to order_order_item_path(@order, @order_item), notice: t(:order_item_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categories = Category.where(category:product_params[:category])\n @product.categories = @categories\n @product.brand = Brand.find_by(brandName: product_params[:brand])\n respond_to do |format|\n if @product.update(name: product_params[:name],description:product_params[:description],price:product_params[:price])\n if current_user.isAdmin\n format.html { redirect_to admin_products_path, notice: \"Product was successfully updated.\" }\n else\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n end\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end", "def set_admin_product\n @product = Product.find(params[:id])\n end", "def update\n self.class.update_product_by_id(self.id, self)\n end", "def set_sub_product\n @sub_product = if current_manager\n SubProduct.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n SubProduct.find(params[:id])\n end\n end", "def show\n # to add tools to product\n if params[:select].present? \n @new_parent = Product.find(params[:select])\n if @new_parent\n ProductToTool.find_or_create_by_product_id_and_tool_id(@product.id,@new_parent.id)\n end\n end\n @products = Product.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n @product_variants = @product.product_variants\n \n if params[:show_products].present? \n @show_products = true\n end \n end", "def update\r\n @se_use_product = SeUseProduct.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @se_use_product.update_attributes(params[:se_use_product])\r\n format.html { redirect_to(@se_use_product, :notice => 'Se use product was successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @se_use_product.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def bulk_update\n if current_user\n @user = User.find(current_user.id) # TODO: is it necessary to find user? \n @product_details = @user.product_details \n end\n end", "def si_update_product_select_from_order_item\n i = params[:i]\n product_id = 0\n if i != '0'\n @item = PurchaseOrderItem.find(i)\n product_id = @item.blank? ? 0 : @item.product_id\n end\n # Setup JSON\n @json_data = { \"product\" => product_id }\n render json: @json_data\n end", "def update\n @product = Product.eager_loading.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully updated.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(product_params[:site_id])\n @user = @site.user\n\n site_owner?\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to site_path(@site), notice: \"商品#{@product.title}を編集しました\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_product\n @product = Product.includes(:lotteries, :ranking_config_items).find(params[:id])\n end", "def update\n respond_to do |format|\n if @os_product.update(os_product_params)\n format.html { redirect_to @os_product, notice: 'Os product was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_product }\n else\n format.html { render :edit }\n format.json { render json: @os_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @product.update(product_params)\n\n ImpactLineItem.all.each do |impact_line_item|\n product_impact_line_item = @product.product_impact_line_items.find_by_impact_line_item_id(impact_line_item.id)\n\n Category.all.each do |category|\n impact_entry = product_impact_line_item.find_impact_entry(category)\n impact_entry.update( value: params[:impact_entry][impact_line_item.id.to_s][category.id.to_s])\n end\n end\n\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def set_product\n\n # @product = Product.find(params[:id])\n\n end", "def show\n @product_detail = ProductDetail.find(params[:id])\n \n \n # ----------- DEMO of cartographer plugin ------------\n # ref. https://github.com/joshuamiller/cartographer\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n marker1 = Cartographer::Gmarker.new(:name=> \"taj_mahal\", :marker_type => \"Building\",\n :position => [27.173006,78.042086],\n :info_window_url => \"/url_for_info_content\")\n marker2 = Cartographer::Gmarker.new(:name=> \"raj_bhawan\", :marker_type => \"Building\",\n :position => [28.614309,77.201353],\n :info_window_url => \"/url_for_info_content\")\n @map.markers << marker1\n @map.markers << marker2\n # -------------------------------------------------------\n \n # try to edit product's organizations in product show ?\n # Q: is it normal way for editing? what's better way?\n # Q: \n @product_detail.product_detail_organizations.build.build_organization\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_detail }\n end\n end", "def set_orden_product\n @orden_product = OrdenProduct.find(params[:id])\n end", "def update_harman_employee_pricing\n authorize! :update, :harman_employee_pricing\n Array(params[:product_attr].to_unsafe_h).each do |key, attr|\n product = Product.find(key)\n product.update(attr)\n end\n redirect_to(harman_employee_pricing_admin_products_path, notice: \"Pricing updated successfully.\")\n end", "def update\n @season_products = OrderSeasonProduct.where(:order_seasons_id => current_season)\n @products = Product.where(:product_id => @season_products.map(&:products_id)).order(:product_name)\n @order = Order.find(params[:id])\n\n # Update the attributes, redirect with success, show errors\n # on fail\n if @order.update_attributes(order_params)\n # Redirect back to the order list with a success message\n flash[:success] = \"#{@order.cust_fname} #{@order.cust_lname}\\'s order successfully updated!\"\n redirect_to list_orders_path(current_season)\n else\n render 'edit'\n end\n\n end", "def update\n @ordered_product = OrderedProduct.find(params[:id])\n rented_products = params['rented_products'] ? params['rented_products'] : {}\n\n respond_to do |format|\n format.html { redirect_to @ordered_product.complex_triggered_update(params[:ordered_product], rented_products)}\n end\n end", "def update\n @product = Product.find(params[:id])\n @product.update_attributes(params[:product])\n\n if @product.special_price_id.to_i!=0\n @product.sales_price = @product.special_price.try(:price_each_size).to_f * @product.size.to_f\n end\n @product.save\n\n if @product.try(:category).try(:name)==\"SPAREPART\"\n get_sparepart\n else\n get_unit\n end\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n # if @product.try(:category).try(:name)==\"SPAREPART\"\n # format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n # format.json { head :no_content }\n # elsif @product.try(:category).try(:name)==\"UNIT\"\n # format.html { redirect_to unit_show_product_path(@product), notice: 'Product was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { redirect_to @product }\n # format.json { render json: @product.errors, status: :unprocessable_entity }\n # end\n end\n end", "def update \n render partial: theme_presenter.page_template_path('products/accessories/update'), format: [:js]\n end", "def select\n @product = Product.find_by_param!(params[:product_id])\n @product.option_types << OptionType.find(params[:id])\n @product.reload\n @option_types = @product.option_types\n set_available_option_types\n end", "def update\n @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.find(params[:id])\n @requests_devolutions_product = @requests_devolutions_products_detail.requests_devolutions_product;\n @requests_devolutions_products_details = @requests_devolutions_product.details.paginate(:page => params[:page])\n respond_to do |format|\n if @requests_devolutions_products_detail.update_attributes(params[:requests_devolutions_products_detail])\n format.js{ \n @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.new\n render 'update_list_form' \n }\n else\n format.html { \n @notice = \"Error al actualizar el registro\"\n redirect_to :back }\n end\n end\n end", "def update_product_info\n update_info = params[:product]\n market = Market.find(params[:place_id])\n product = market.products.find(update_info[:id])\n if product.update(update_info)\n response = {status: \"OK\", code: 200}\n else\n response = { status: \"Not Ok\", code: 201}\n end\n respond_to do |format|\n format.json{render json: response.to_json }\n end\n end", "def update\n @order = Order.find(params[:id])\n up_ordr = @order.update_attributes(params[:order])\n @order_user = @order.order_user\n up_user = @order_user.update_attributes(params[:order_user])\n @order_account = @order_user.order_account\n up_acct = @order_account.update_attributes(params[:order_account])\n @billing_address = @order.billing_address\n up_bill = @billing_address.update_attributes(params[:billing_address])\n @shipping_address = @order.shipping_address\n up_ship = @shipping_address.update_attributes(params[:shipping_address])\n\n if params[:order_transaction]\n OrderTransaction.update(params[:order_transaction].keys, params[:order_transaction].values) \n end\n\n @store_user = @order.order_user.store_user\n @order.order_user.store_user.update_attributes(params[:store_user]) if @store_user\n\n\n @products = Product.find(:all)\n if (up_ordr && up_user && up_acct && up_bill && up_ship) then\n flash[:notice] = 'Order was successfully updated.'\n redirect_to :action => 'show', :id => @order.id\n else\n flash[:notice] = 'There were problems modifying the order.'\n render :action => 'show'\n end\n end", "def set_product\n @project = Project.find(params[:id])\n end", "def update!(**args)\n @product_source = args[:product_source] if args.key?(:product_source)\n end", "def set_product\n @product = Product.where(id: params[:id], tenant: @tenant).first\n end", "def edit\n #Finds selected image\n @image = Image.find(params[:id])\n #creates an array of all products\n @all_products = Product.all\n #creates an array of all components\n @all_components = Component.all\n #creates an array of all valuefields\n @all_valuefields = Valuefield.all\n #assigns variable associated product\n\n @items_to_select = @image.products + @image.components + @image.valuefields\n\n end", "def update\n #qual é o produto\n #@blog_post = BlogPost.find(params[:blog_post_id])\n #@product_parent = Product.where(id: @products_purposes_relation.product_id)\n @product_parent = Product.find(@products_purposes_relation.product_id)\n\n\n respond_to do |format|\n if @products_purposes_relation.update(products_purposes_relation_params)\n #format.html { redirect_to @products_purposes_relation, notice: t('update_success') }\n format.html { redirect_to @product_parent, notice: t('update_success') }\n format.json { render :show, status: :ok, location: @products_purposes_relation }\n else\n format.html { render :edit }\n format.json { render json: @products_purposes_relation.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_admin_product\n @product = Product.find(params[:id])\n end", "def update\n # Solo el admin puede crear y editar productos, asique no tiene mucho sentido validar estas acciones\n # (se le da poder total al admin, no tiene sentido restringirlo)\n ProductCategory.create(product_id: @product.id, category_id: association_changes[:add_category]).id unless association_changes[:add_category].blank?\n ProductCategory.where(category_id: association_changes[:remove_category], product_id: @product.id).delete_all unless association_changes[:remove_category].blank?\n\n ProductTag.create(product_id: @product.id, tag_id: association_changes[:add_tag]).id unless association_changes[:add_tag].blank?\n ProductTag.where(tag_id: association_changes[:remove_tag], product_id: @product.id).delete_all unless association_changes[:remove_tag].blank?\n\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_own_product\n @own_product = OwnProduct.find(params[:id])\n end", "def update\n @home_searches_product = Home::Searches::Product.find(params[:id])\n\n respond_to do |format|\n if @home_searches_product.update_attributes(params[:home_searches_product])\n format.html { redirect_to @home_searches_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_searches_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def product_update\n\t\tvalues = task_params\n\t\t@task_data = Product.find(params[:id])\n\t\tif !params[:customer_name].blank?\n\t\t\tif @task_data.customer.blank?\n\t\t\t\tcustomer = Customer.create(:customer_name => params[:customer_name])\n\t\t\t\tvalues[:customer_id] = customer.id\n\t\t\telse\n\t\t\t\t@task_data.customer.update(:customer_name =>params[:customer_name])\n\t\t\tend\n\t\tend\n\t\tif !params[:category_name].blank?\n\t\t\tif @task_data.category.blank?\n\t\t\t\tcategory = Category.create(:category_name => params[:category_name])\n\t\t\t\tvalues[:customer_id] = category.id\n\t\t\telse\n\t\t\t\t@task_data.category.update(:category_name => params[:category_name])\n\t\t\tend\n\t\tend\n\t\t@task_data.update(values)\n \t\tredirect_to product_index_path\n\tend", "def set_admin\n @adminproduct = Productcla.find(params[:id])\n end", "def edit\n\t\t@product = Product.find(params[:id]) #record for edit\n\tend", "def update\n @order = Order.find(params[:id])\n @order.assign_attributes(params[:order])\n @order.products_inorder << @products\n @order.user = @products.first.user\n \n respond_to do |format|\n if @order.save\n format.html { redirect_to_relative_path('inorder') and return }\n format.json { head :no_content }\n else\n format.html { render template: \"/admin/products/inorder/action\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_software.update_attributes(product_software_params)\n format.html { redirect_to([:admin, @product_software], notice: 'Product Software was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @product_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @aggregate_rating = args[:aggregate_rating] if args.key?(:aggregate_rating)\n @brand_entity_id = args[:brand_entity_id] if args.key?(:brand_entity_id)\n @catalog_id = args[:catalog_id] if args.key?(:catalog_id)\n @global_product_cluster_id = args[:global_product_cluster_id] if args.key?(:global_product_cluster_id)\n @images = args[:images] if args.key?(:images)\n @locale = args[:locale] if args.key?(:locale)\n @moka_facet = args[:moka_facet] if args.key?(:moka_facet)\n @non_displayable_description = args[:non_displayable_description] if args.key?(:non_displayable_description)\n @non_displayable_title = args[:non_displayable_title] if args.key?(:non_displayable_title)\n @offer = args[:offer] if args.key?(:offer)\n @outlink_domain_relationship = args[:outlink_domain_relationship] if args.key?(:outlink_domain_relationship)\n @pblock = args[:pblock] if args.key?(:pblock)\n @product_browseonomy_ids = args[:product_browseonomy_ids] if args.key?(:product_browseonomy_ids)\n @product_cluster_mid = args[:product_cluster_mid] if args.key?(:product_cluster_mid)\n @product_popularity = args[:product_popularity] if args.key?(:product_popularity)\n @relevance_embedding = args[:relevance_embedding] if args.key?(:relevance_embedding)\n @weak_global_product_cluster_id = args[:weak_global_product_cluster_id] if args.key?(:weak_global_product_cluster_id)\n end", "def update_version_select \n versions = Version.where(:product_id => params[:id]).order(:version) unless params[:id].blank?\n render :partial => \"versions\", :locals => { :versions => versions }\n end", "def update\n respond_to do |format|\n if @product_summary.update(product_summary_params)\n format.html { redirect_to @product_summary, notice: 'Product summary was successfully updated.' }\n format.json { head :no_content }\n # Cập nhật tên của sản phẩm trong bảng Product\n if @product_summary.quality !=0\n # Cập nhật thông tin khi ProductSummary Câp nhật Name vào bảng Product\n @pro = Product.where(\n :product_code => @product_summary.product_code,\n :skull_id => @product_summary.skull_id,\n :warehouse_id => @product_summary.warehouse_id)\n @pro.each do |pro|\n Product.update(pro.id,name:@product_summary.name)\n end\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @product_summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_so_product\n @so_product = SoProduct.find(params[:id])\n end", "def update\n respond_to do |format|\n if @own_product.update(own_product_params)\n format.html { redirect_to @own_product, notice: 'Own product was successfully updated.' }\n format.json { render :show, status: :ok, location: @own_product }\n else\n format.html { render :edit }\n format.json { render json: @own_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @store = Store.find(params[:id])\n\n\n @product = Product.find(params[:product_id]) unless (params[:product_id] == \"zero\" || params[:product_id].blank?)\n @x_c = params[:x_c].to_i\n @y_c = params[:y_c].to_i\n\n if params[:product_id] == \"zero\"\n r = Relation.where(:store_id => @store.id, :x_c => @x_c, :y_c => @y_c)\n r.destroy_all\n end\n\n unless @product.blank?\n r = Relation.where(:store_id => @store.id, :x_c => @x_c, :y_c => @y_c).first\n\n if r\n r.product_id = @product.id\n r.save!\n else\n r = Relation.new(store_id: @store.id, product_id: @product.id, x_c: @x_c, y_c: @y_c)\n r.save!\n end\n end\n\n params.delete(:product_id) if params.has_key?(:product_id)\n params.delete(:x_c) if params.has_key?(:x_c)\n params.delete(:y_c) if params.has_key?(:y_c)\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to \"/admin/stores/\"[email protected]_s(), notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @store_product.update(store_product_params)\n format.html { redirect_to @store_product, notice: 'Store product was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_product }\n else\n format.html { render :edit }\n format.json { render json: @store_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #raise \"Cannot create product application buy, not enough product available.\" if check_if_product_is_available == true \n respond_to do |format|\n if @product_application_buy.update(product_application_buy_params)\n format.html { redirect_to @product_application_buy, notice: 'Product application buy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product_application_buy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @angular = Product.find(params[:id])\n \n @angular.update_attributes(title: params[:products][:title], description: params[:products][:description])\n respond_to do |format|\n if @angular.valid?\n format.html { redirect_to store_index_path, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @angular.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @product , :message => \"Access denied.\"\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_product\n #@product = Product.find params[:id]\n @product = Product.where(id: params[:id]).includes(\n {product_impact_line_items: [:impact_line_item, :impact_entries]}).first\n end", "def set_product_in_storehouse\n @product_in_storehouse = ProductInStorehouse.find(params[:id])\n end", "def update\n @product_auth = ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first\n\n if @product_auth.update(params.permit(:state))\n render json: @product_auth\n else\n render json: @product_auth.errors\n end\n end", "def update!(**args)\n @product_id = args[:product_id] if args.key?(:product_id)\n @unique_id = args[:unique_id] if args.key?(:unique_id)\n @vendor_id = args[:vendor_id] if args.key?(:vendor_id)\n end", "def update\n if ! canedit\n redirect_to :action => 'list'\n end\n @product_type = ProductType.find(params[:id])\n product = Product.find(params[:product_type][:product_id])\n @product_type.product = product\n product.save\n\n respond_to do |format|\n if @product_type.update_attributes(params[:product_type])\n format.html { redirect_to @product_type, :notice => 'Product type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if check_user_permission(@product.project)\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: \"Product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @zorgproduct = Zorgproduct.find(params[:id])\n\n respond_to do |format|\n if @zorgproduct.update_attributes(params[:zorgproduct])\n format.html { redirect_to @zorgproduct, notice: 'Zorgproduct was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zorgproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def si_update_receipt_and_order_select_from_project\n project = params[:order]\n if project != '0'\n @project = Project.find(project)\n @receipt_notes = @project.blank? ? receipts_dropdown : receipts_dropdown_by_project(@project)\n @purchase_orders = @project.blank? ? unbilled_purchase_orders_dropdown : unbilled_purchase_orders_dropdown_by_project(@project)\n else\n @receipt_notes = receipts_dropdown\n @purchase_orders = unbilled_purchase_orders_dropdown\n end\n # Notes array\n @notes_dropdown = notes_array(@receipt_notes)\n # Orders array\n @purchase_orders_dropdown = purchase_orders_array(@purchase_orders)\n # Setup JSON\n @json_data = { \"note\" => @notes_dropdown, \"order\" => @purchase_orders_dropdown }\n render json: @json_data\n end", "def set_product\n @product = current_seller.product.find(params[:id])\n end", "def edit\n @order_season = OrderSeason.find(params[:id]) # Get the order season selected\n @pickup_dates = PickupDate.where(:order_season_id => @order_season.order_season_id) # Get the pickup dates in the order season\n @pickup_date = PickupDate.new # For adding a new pickup date\n @product = OrderSeasonProduct.new # For adding a new product to the season\n\n # Get all the products in the order season\n @order_season_products = OrderSeasonProduct.where(:order_seasons_id => @order_season.order_season_id)\n # Get all the products that weren't added\n @ids = @order_season_products.map{|x| x.products_id} # Map the ids of the added products\n @non_added_products = Product.all.reject {|product| @ids.include? product.product_id}\n\n end", "def update\n \t\t@product = Product.update( product_params )\n \t\tredirect_to '/products/'\n\tend" ]
[ "0.73574847", "0.7326221", "0.7295935", "0.72786015", "0.7248016", "0.71485144", "0.6912485", "0.6815768", "0.6769088", "0.66692615", "0.66400737", "0.6601307", "0.659989", "0.65947556", "0.6519945", "0.6480212", "0.6477955", "0.64766115", "0.646362", "0.64620316", "0.6461407", "0.6459457", "0.6454478", "0.64537007", "0.6443692", "0.6433835", "0.6422674", "0.642226", "0.6395238", "0.6393828", "0.63426524", "0.6327593", "0.63113", "0.63110065", "0.6309064", "0.6308639", "0.6305493", "0.630277", "0.6299542", "0.6285925", "0.62831193", "0.62720084", "0.62712234", "0.6254542", "0.6251687", "0.6250509", "0.62431157", "0.62430483", "0.6226237", "0.62177217", "0.6215849", "0.6205441", "0.61984396", "0.61953974", "0.6174387", "0.61659795", "0.6163344", "0.6161467", "0.61564755", "0.61471206", "0.6146059", "0.6145639", "0.6136683", "0.6126486", "0.6125086", "0.6124037", "0.6122922", "0.61228764", "0.61196274", "0.6109254", "0.61080724", "0.61072856", "0.6101131", "0.6094712", "0.60755384", "0.6071768", "0.60637116", "0.60630137", "0.6061724", "0.6060493", "0.6055795", "0.60517395", "0.6045371", "0.60414183", "0.6040558", "0.6039476", "0.6035961", "0.6033622", "0.6029451", "0.60270524", "0.6025216", "0.6025003", "0.6019097", "0.6018568", "0.6017903", "0.60176915", "0.60169107", "0.6015286", "0.6010365", "0.6010048" ]
0.72082275
5
Update product select at view from organization select
def it_update_product_select_from_organization organization = params[:org] if organization != '0' @organization = Organization.find(organization) @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code) else @products = products_dropdown end # Products array @products_dropdown = products_array(@products) # Setup JSON @json_data = { "product" => @products_dropdown } render json: @json_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def of_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def so_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def si_update_product_select_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"product\" => @products_dropdown }\n render json: @json_data\n end", "def it_update_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @stores = stores_dropdown\n @products = products_dropdown\n end\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"store\" => @stores, \"product\" => @products_dropdown }\n render json: @json_data\n end", "def so_update_selects_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @clients = @organization.blank? ? clients_dropdown : @organization.clients.order(:client_code)\n @projects = @organization.blank? ? projects_dropdown : @organization.projects.order(:project_code)\n @work_orders = @organization.blank? ? work_orders_dropdown : @organization.work_orders.order(:order_no)\n @charge_accounts = @organization.blank? ? charge_accounts_dropdown : @organization.charge_accounts.expenditures\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @payment_methods = @organization.blank? ? payment_methods_dropdown : collection_payment_methods(@organization.id)\n @contracting_requests = @organization.blank? ? contracting_requests_dropdown : projects_contracting_requests(@projects)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @clients = clients_dropdown\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = charge_accounts_dropdown\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @contracting_requests = contracting_requests_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_orders)\n # Products array\n @products_dropdown = products_array(@products)\n # Clients array\n @clients_dropdown = clients_array(@clients)\n # Contracting requests array\n @constracting_requests_dropdown = contracting_requests_array(@contracting_requests)\n # Setup JSON\n @json_data = { \"client\" => @clients_dropdown, \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"contracting_request\" => @constracting_requests_dropdown,\n \"product\" => @products_dropdown }\n render json: @json_data\n end", "def si_update_selects_from_company\n company = params[:org]\n if company != '0'\n @company = Company.find(company)\n @projects = @company.blank? ? projects_dropdown : @company.projects.order(:project_code)\n else\n @projects = projects_dropdown\n end\n # Setup JSON\n @json_data = { \"project\" => @projects }\n render json: @json_data\n end", "def update\n \t@breadcrumb = @hqproduct.hqlevel.find_my_direct_parent()\n \tif current_admin.superadmin == 1\n\t \t@Orgs = Organization.with_translations(I18n.locale)\n\t else\n\t \t@Orgs = Organization.with_translations(I18n.locale).where(\"accessLevel = 1\")\n\t end\n \t# force to set org_id to 0 if nil?\n \tif hqproduct_params[:organization_id].empty?\n \t\tparams[:hqproduct][:organization_id] = 0\n \tend\n \t\n respond_to do |format|\n if @hqproduct.update(hqproduct_params) && ( params[ :article ].nil? ^ @hqproduct.article.update( params.require(:article).permit(:content) ) )\n \n format.html { redirect_to admin_hqlevel_path(@hqproduct.hqlevel, locale: I18n.locale), notice: 'Hqproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hqproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_test_plan_select \n test_plans = TestPlan.where(:product_id => params[:id]).order(:name) unless params[:id].blank?\n\n # Verify user can view this schedule. Must be in his product\n authorize_product!(Product.find(params[:id]))\n \n render :partial => \"test_plans\", :locals => { :test_plans => test_plans }\n end", "def select\n @product = Product.find_by_param!(params[:product_id])\n @product.option_types << OptionType.find(params[:id])\n @product.reload\n @option_types = @product.option_types\n set_available_option_types\n end", "def si_update_product_select_from_order_item\n i = params[:i]\n product_id = 0\n if i != '0'\n @item = PurchaseOrderItem.find(i)\n product_id = @item.blank? ? 0 : @item.product_id\n end\n # Setup JSON\n @json_data = { \"product\" => product_id }\n render json: @json_data\n end", "def update\n @product_option = ProductOption.find(params[:product_option][:id])\n @product = Product.find(params[:product_id])\n @product_option.update_attributes(params[:product_option])\n \n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def update_version_select \n versions = Version.where(:product_id => params[:id]).order(:version) unless params[:id].blank?\n render :partial => \"versions\", :locals => { :versions => versions }\n end", "def tl_update_company_and_office_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @companies = @organization.blank? ? companies_dropdown : @organization.companies.order(:name)\n @offices = @organization.blank? ? offices_dropdown : Office.joins(:company).where(companies: { organization_id: organization }).order(:name)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @companies = companies_dropdown\n @offices = offices_dropdown\n @products = products_dropdown\n end\n @offices_dropdown = []\n @offices.each do |i|\n @offices_dropdown = @offices_dropdown << [i.id, i.name, i.company.name]\n end\n @json_data = { \"companies\" => @companies, \"offices\" => @offices_dropdown, \"products\" => @products }\n render json: @json_data\n end", "def select\n @product = Product.find(params[:product_id])\n @taxon = Taxon.find(params[:id])\n @product.taxons << @taxon\n @product.save\n @product.reload\n set_available\n render :partial => 'table', :layout => false\n end", "def set_sub_product\n @sub_product = if current_manager\n SubProduct.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n SubProduct.find(params[:id])\n end\n end", "def edit_option_selection\n @product = Product.find(params[:product_id])\n @product_option = ProductOption.find(params[:product_option_id])\n @option_selection = ProductOptionSelection.find(params[:id])\n unless params[:product_option_selection].nil?\n @option_selection.name = params[:product_option_selection][:name]\n @option_selection.weight_adjustment = params[:product_option_selection][:weight_adjustment]\n @option_selection.price_adjustment = params[:product_option_selection][:price_adjustment]\n @option_selection.sku_adjustment = params[:product_option_selection][:sku_adjustment]\n @option_selection.save!\n image = ProductOptionSelectionImage.new(params[:product_option_selection][:image])\n @option_selection.images << image\n end\n end", "def update\n if params[:id].to_i == 0 and ['featured','clearance','whats_new'].include? params[:id]\n @products = Product.send(params[:id])\n @products.each do |product|\n product.send(params[:id] + '_position=', params[params[:id]].index(product.id.to_s))\n product.save\n end\n render :nothing => true and return\n end\n if params.has_key? :product\n @editable_params[:category_ids].uniq! if @editable_params.has_key? :category_ids\n end\n @product.send(params[:event]) if params.has_key? :event\n if params.has_key? :product and @product.update_attributes(@editable_params)\n @product_section = 'overview'\n render :template => 'manage/products/show' and return\n elsif !params.has_key? :product\n @product_section = 'overview'\n render :template => 'manage/products/show' and return\n else\n @product_section = 'info'\n render :template => 'manage/products/edit' and return\n end\n end", "def ti_update_office_textfield_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @offices = @organization.blank? ? offices_dropdown : Office.joins(:company).where(companies: { organization_id: organization }).order(:name)\n @technicians = @organization.blank? ? technicians_dropdown : @organization.technicians.order(:name)\n else\n @offices = offices_dropdown\n @technicians = technicians_dropdown\n end\n @offices_dropdown = []\n @offices.each do |i|\n @offices_dropdown = @offices_dropdown << [i.id, i.name, i.company.name]\n end\n @json_data = { \"offices\" => @offices_dropdown, \"technicians\" => @technicians }\n render json: @json_data\n end", "def apply_option_to_product\n @product = Product.find(params[:product_id])\n \n @product_option = ProductOption.find(params[:product_option][:id])\n @product_option.update_attributes(params[:product_option])\n\n product_option_instance = ProductOptionInstance.new(:product => @product, \n :product_option => @product_option)\n \n product_option_instance.save\n\n @available_options = ProductOption.find(:all, :order => 'name')\n end", "def co_update_from_organization\n organization = params[:company]\n if organization != '0'\n @organization = Organization.find(organization)\n @users = @organization.blank? ? users_dropdown : users_dropdown\n #@users = @organization.blank? ? users_dropdown : @organization.users.order(:email)\n else\n @users = users_dropdown\n end\n @json_data = { \"users\" => @users }\n render json: @json_data\n end", "def pack_material_product_pack_material_type_code_search_combo_changed\n\tpack_material_type_code = get_selected_combo_value(params)\n\tsession[:pack_material_product_search_form][:pack_material_type_code_combo_selection] = pack_material_type_code\n\t@pack_material_product_codes = PackMaterialProduct.find_by_sql(\"Select distinct pack_material_product_code from pack_material_products where pack_material_type_code = '#{pack_material_type_code}'\").map{|g|[g.pack_material_product_code]}\n\t@pack_material_product_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('pack_material_product','pack_material_product_code',@pack_material_product_codes)%>\n\n\t\t}\n\nend", "def update\n \t@breadcrumb = @brproduct.brlevel.find_my_direct_parent()\n \tif current_admin.superadmin == 1\n\t \t@Orgs = Organization.with_translations(I18n.locale)\n\t else\n\t \t@Orgs = Organization.with_translations(I18n.locale).where(\"accessLevel = 1\")\n\t end\n \t# force to set org_id to 0 if nil?\n \tif brproduct_params[:organization_id].empty?\n \t\tparams[:brproduct][:organization_id] = 0\n \tend\n \t\n respond_to do |format|\n if @brproduct.update(brproduct_params) && ( params[ :article ].nil? ^ @brproduct.article.update( params.require(:article).permit(:content) ) )\n \n format.html { redirect_to admin_brlevel_path(@brproduct.brlevel, locale: I18n.locale), notice: 'Brproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def si_update_receipt_and_order_select_from_project\n project = params[:order]\n if project != '0'\n @project = Project.find(project)\n @receipt_notes = @project.blank? ? receipts_dropdown : receipts_dropdown_by_project(@project)\n @purchase_orders = @project.blank? ? unbilled_purchase_orders_dropdown : unbilled_purchase_orders_dropdown_by_project(@project)\n else\n @receipt_notes = receipts_dropdown\n @purchase_orders = unbilled_purchase_orders_dropdown\n end\n # Notes array\n @notes_dropdown = notes_array(@receipt_notes)\n # Orders array\n @purchase_orders_dropdown = purchase_orders_array(@purchase_orders)\n # Setup JSON\n @json_data = { \"note\" => @notes_dropdown, \"order\" => @purchase_orders_dropdown }\n render json: @json_data\n end", "def edit\n @product = Product.find(params[:id])\n product_option_id = params[:product_option_id]\n unless product_option_id\n # product option in select drop-down\n product_option_id = params[:product_option][:id]\n end\n @product_option = ProductOption.find(product_option_id)\n end", "def show\n @product_detail = ProductDetail.find(params[:id])\n \n \n # ----------- DEMO of cartographer plugin ------------\n # ref. https://github.com/joshuamiller/cartographer\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n marker1 = Cartographer::Gmarker.new(:name=> \"taj_mahal\", :marker_type => \"Building\",\n :position => [27.173006,78.042086],\n :info_window_url => \"/url_for_info_content\")\n marker2 = Cartographer::Gmarker.new(:name=> \"raj_bhawan\", :marker_type => \"Building\",\n :position => [28.614309,77.201353],\n :info_window_url => \"/url_for_info_content\")\n @map.markers << marker1\n @map.markers << marker2\n # -------------------------------------------------------\n \n # try to edit product's organizations in product show ?\n # Q: is it normal way for editing? what's better way?\n # Q: \n @product_detail.product_detail_organizations.build.build_organization\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product_detail }\n end\n end", "def set_product\n \n end", "def set_product\n @project = Project.find(params[:id])\n end", "def set_os_product\n @os_product = OsProduct.find(params[:id])\n end", "def edit\n @order = Order.find(params[:id])\n @season_products = OrderSeasonProduct.where(:order_seasons_id => current_season)\n @products = Product.where(:product_id => @season_products.map(&:products_id)).order(:product_name)\n end", "def update_products_details; end", "def set_orden_product\n @orden_product = OrdenProduct.find(params[:id])\n end", "def product_product_subtype_code_search_combo_changed\n\tproduct_subtype_code = get_selected_combo_value(params)\n\tsession[:product_search_form][:product_subtype_code_combo_selection] = product_subtype_code\n\t@tag1s = Product.find_by_sql(\"Select distinct tag1 from products where product_subtype_code = '#{product_subtype_code}' and product_type_code = 'PACK_MATERIAL' and is_composite = 'true'\").map{|g|[g.tag1]}\n\[email protected](\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('product','tag1',@tag1s)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_product_tag1'/>\n\t\t<%= observe_field('product_tag1',:update => 'tag2_cell',:url => {:action => session[:product_search_form][:tag1_observer][:remote_method]},:loading => \"show_element('img_product_tag1');\",:complete => session[:product_search_form][:tag1_observer][:on_completed_js])%>\n\t\t}\n\nend", "def so_update_selects_from_order\n order = params[:order]\n projects = projects_dropdown\n charge_account_id = 0\n store_id = 0\n if order != '0'\n @order = WorkOrder.find(order)\n @project = @order.project\n @charge_account = @order.charge_account\n charge_account_id = @charge_account.id rescue 0\n @store = @order.store\n store_id = @store.id rescue 0\n if @charge_account.blank?\n @charge_account = @project.blank? ? projects_charge_accounts(projects) : charge_accounts_dropdown_edit(@project)\n end\n if @store.blank?\n @store = project_stores(@project)\n end\n else\n @charge_account = projects_charge_accounts(projects)\n @store = stores_dropdown\n end\n @json_data = { \"charge_account\" => @charge_account, \"store\" => @store,\n \"charge_account_id\" => charge_account_id, \"store_id\" => store_id }\n render json: @json_data\n end", "def trade_environment_setup_id_search_combo_changed\n\tid = get_selected_combo_value(params)\n\tsession[:trade_environment_setup_search_form][:id_combo_selection] = id\n\t@production_schedule_ids = TradeEnvironmentSetup.find_by_sql(\"Select distinct production_schedule_id from trade_environment_setups where id = '#{id}'\").map{|g|[g.production_schedule_id]}\n\t@production_schedule_ids.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('trade_environment_setup','production_schedule_id',@production_schedule_ids)%>\n\n\t\t}\n\nend", "def update\n @pagetitle = \"Edit product\"\n \n @product = Product.find(params[:id])\n @company = @product.company\n @suppliers = @company.get_suppliers()\n @marcas = @company.get_marcas()\n @modelos = @company.get_modelos()\n @categories = @company.get_categories() \n @unidades = Unidad.all\n\n respond_to do |format|\n if @product.update_attributes(products_params)\n format.html { redirect_to(@product, :notice => 'Product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @product.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_product\n @product = Product.where(id: params[:id], tenant: @tenant).first\n end", "def edit\n #Finds selected image\n @image = Image.find(params[:id])\n #creates an array of all products\n @all_products = Product.all\n #creates an array of all components\n @all_components = Component.all\n #creates an array of all valuefields\n @all_valuefields = Valuefield.all\n #assigns variable associated product\n\n @items_to_select = @image.products + @image.components + @image.valuefields\n\n end", "def set_project_product\n @project_product = ProjectProduct.find(params[:id])\n end", "def si_update_project_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @suppliers = @organization.blank? ? suppliers_dropdown : @organization.suppliers.order(:supplier_code)\n @projects = @organization.blank? ? projects_dropdown : @organization.projects.order(:project_code)\n @work_orders = @organization.blank? ? work_orders_dropdown : @organization.work_orders.order(:order_no)\n @charge_accounts = @organization.blank? ? charge_accounts_dropdown : @organization.charge_accounts.expenditures\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @payment_methods = @organization.blank? ? payment_methods_dropdown : payment_payment_methods(@organization.id)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n @companies = @organization.blank? ? companies_dropdown : companies_dropdown_edit(@organization)\n else\n @suppliers = suppliers_dropdown\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n @companies = companies_dropdown\n end\n # Work orders array\n @orders_dropdown = work_orders_array(@work_orders)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"supplier\" => @suppliers, \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown,\n \"company\" => @companies }\n render json: @json_data\n end", "def update!(**args)\n @select_entity = args[:select_entity] if args.key?(:select_entity)\n @select_time_range_and_feature = args[:select_time_range_and_feature] if args.key?(:select_time_range_and_feature)\n end", "def update!(**args)\n @select_entity = args[:select_entity] if args.key?(:select_entity)\n @select_time_range_and_feature = args[:select_time_range_and_feature] if args.key?(:select_time_range_and_feature)\n end", "def of_update_project_textfields_from_organization\n organization = params[:org]\n if organization != '0'\n @organization = Organization.find(organization)\n @suppliers = @organization.blank? ? suppliers_dropdown : @organization.suppliers.order(:supplier_code)\n @offer_requests = @organization.blank? ? offer_requests_dropdown : @organization.offer_requests.not_approved(@organization.id)\n @projects = @organization.blank? ? projects_dropdown : @organization.projects.order(:project_code)\n @work_orders = @organization.blank? ? work_orders_dropdown : @organization.work_orders.order(:order_no)\n @charge_accounts = @organization.blank? ? charge_accounts_dropdown : @organization.charge_accounts.expenditures\n @stores = @organization.blank? ? stores_dropdown : @organization.stores.order(:name)\n @payment_methods = @organization.blank? ? payment_methods_dropdown : payment_payment_methods(@organization.id)\n @products = @organization.blank? ? products_dropdown : @organization.products.order(:product_code)\n else\n @suppliers = suppliers_dropdown\n @offer_requests = offer_requests_dropdown\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = charge_accounts_dropdown\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_orders)\n # Offer requests array\n @requests_dropdown = offer_requests_array(@offer_requests)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"supplier\" => @suppliers, \"offer_request\" => @requests_dropdown,\n \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown }\n render json: @json_data\n end", "def set_admin_product\n @product = Product.find(params[:id])\n end", "def update_dorm_selection; update_field(\"dorm_selection\"); end", "def update\n @product = Product.find(params[:id])\n @product.attributes = params[:product]\n render_after_save('edit')\n end", "def wot_update_account_select_from_project\n project = params[:project]\n tbl = params[:tbl]\n if project != '0'\n @project = Project.find(project)\n @accounts = @project.blank? ? project_charge_accounts_dropdown(nil) : @project.charge_accounts.expenditures\n else\n @accounts = project_charge_accounts_dropdown(nil)\n end\n # Setup JSON\n @json_data = { \"account\" => @accounts, \"tbl\" => tbl.to_s }\n render json: @json_data\n end", "def so_update_selects_from_project\n project = params[:project]\n projects = projects_dropdown\n if project != '0'\n @project = Project.find(project)\n @contracting_requests = @project.blank? ? projects_contracting_requests(projects) : projects_contracting_requests(@project)\n @work_order = @project.blank? ? work_orders_dropdown : @project.work_orders.order(:order_no)\n @charge_account = @project.blank? ? projects_charge_accounts(projects) : charge_accounts_dropdown_edit(@project)\n @store = project_stores(@project)\n else\n @contracting_requests = projects_contracting_requests(projects)\n @work_order = work_orders_dropdown\n @charge_account = projects_charge_accounts(projects)\n @store = stores_dropdown\n end\n # Work orders array\n @orders_dropdown = orders_array(@work_order)\n # Contracting requests array\n @constracting_requests_dropdown = contracting_requests_array(@contracting_requests)\n # Setup JSON\n @json_data = { \"contracting_request\" => @constracting_requests_dropdown, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_account, \"store\" => @store }\n render json: @json_data\n end", "def set_product\n @product = Product.includes(:lotteries, :ranking_config_items).find(params[:id])\n end", "def set_vendor_product\n @product = current_vendor.vendor_products.find_by_id(params[:id])\n end", "def item_pack_product_commodity_code_search_combo_changed\n\tcommodity_code = get_selected_combo_value(params)\n\tsession[:item_pack_product_search_form][:commodity_code_combo_selection] = commodity_code\n\t@marketing_variety_codes = ItemPackProduct.find_by_sql(\"Select distinct marketing_variety_code from item_pack_products where commodity_code = '#{commodity_code}'\").map{|g|[g.marketing_variety_code]}\n\t@marketing_variety_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('item_pack_product','marketing_variety_code',@marketing_variety_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_item_pack_product_marketing_variety_code'/>\n\t\t<%= observe_field('item_pack_product_marketing_variety_code',:update => 'actual_count_cell',:url => {:action => session[:item_pack_product_search_form][:marketing_variety_code_observer][:remote_method]},:loading => \"show_element('img_item_pack_product_marketing_variety_code');\",:complete => session[:item_pack_product_search_form][:marketing_variety_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def marketing_variety_commodity_group_code_changed\n\tcommodity_group_code = get_selected_combo_value(params)\n\tsession[:marketing_variety_form][:commodity_group_code_combo_selection] = commodity_group_code\n\t@commodity_codes = MarketingVariety.commodity_codes_for_commodity_group_code(commodity_group_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('marketing_variety','commodity_code',@commodity_codes)%>\n\n\t\t}\n\nend", "def set_admin_product\n @product = Product.find(params[:id])\n end", "def set_vendor_product\n @vendor_product = VendorProduct.find(params[:id])\n end", "def update\n # Se for unidade de produção, é 1, se não, é outro\n @production_unity.scope_type == 1 ? params = scope_product_production_unity_params : params = scope_product_agribusiness_params\n respond_to do |format|\n if @scope_product.update(params)\n SystemLog.create(description: \"Atualizou um produto da unidade de produção: #{@production_unity.name} chamado #{@scope_product.product.name}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [@group, @production_unity, @production_unity_scope], notice: 'Produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @scope_product }\n else\n format.html { render :edit }\n format.json { render json: @scope_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_supplier_product \n redirect_unless_privilege('Proveedores')\n \t@product = Product.find params[:product_id]\n \[email protected] if @product.videos.blank?\n\t @supplier_account = @product.supplier_account\n\t @supplier = @product.supplier_account.supplier\n\t\t@product_types = ProductType.of_supplier @supplier\n\t\t@industry_categories = @supplier_account.industry_categories.where(:industry_category_type_id => 1) if @supplier_account.industry_categories.where(:industry_category_type_id => 1).count > 0\n\t\t@industry_cat_types = @industry_categories.inject({}) do |options, industry_category|\n\t\t (options[industry_category.industry_category_type.name] ||= []) << [industry_category.get_name, industry_category.id]\n \t\toptions\n\t\tend\n # product_faqs = @product.product_faqs.build\n end", "def item_pack_product_commodity_group_code_changed\n \n\tcommodity_group_code = get_selected_combo_value(params)\n\tsession[:item_pack_product_form][:commodity_group_code_combo_selection] = commodity_group_code\n\t@commodity_codes = ItemPackProduct.commodity_codes_for_commodity_group_code(commodity_group_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('item_pack_product','commodity_code',@commodity_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_item_pack_product_commodity_code'/>\n\t\t<%= observe_field('item_pack_product_commodity_code',:update => 'basic_pack_code_cell',:url => {:action => 'item_pack_product_commodity_code_changed'},:loading => \"show_element('img_item_pack_product_commodity_code');\",:complete => session[:item_pack_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def set_group_product\n @group_product = GroupProduct.find(params[:id])\n end", "def pack_material_product_commodity_group_code_changed\n\tcommodity_group_code = get_selected_combo_value(params)\n\tsession[:pack_material_product_form][:commodity_group_code_combo_selection] = commodity_group_code\n\t@commodity_codes = PackMaterialProduct.commodity_codes_for_commodity_group_code(commodity_group_code)\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('pack_material_product','commodity_code',@commodity_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_pack_material_product_commodity_code'/>\n\t\t<%puts observe_field('pack_material_product_commodity_code',:update => 'marketing_variety_code_cell',:url => {:action => session[:pack_material_product_form][:commodity_code_observer][:remote_method]},:loading => \"show_element('img_pack_material_product_commodity_code');\",:complete => session[:pack_material_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t<%= observe_field('pack_material_product_commodity_code',:update => 'marketing_variety_code_cell',:url => {:action => session[:pack_material_product_form][:commodity_code_observer][:remote_method]},:loading => \"show_element('img_pack_material_product_commodity_code');\",:complete => session[:pack_material_product_form][:commodity_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def si_update_product_select_from_note_item\n i = params[:i]\n product_id = 0\n if i != '0'\n @item = ReceiptNoteItem.find(i)\n product_id = @item.blank? ? 0 : @item.product_id\n end\n # Setup JSON\n @json_data = { \"product\" => product_id }\n render json: @json_data\n end", "def update \n render partial: theme_presenter.page_template_path('products/accessories/update'), format: [:js]\n end", "def update\n @show_element=\"admin\"\n (l1id,id) = params[:org_id].split(',')\n @org = Org.find([l1id,id])\n @rolesgroups = @org.roles_groups.all(:order=>:blue_groups_name)\n \n respond_to do |format|\n if @org.update_attributes(params[:org])\n flash[:notice] = 'Roles Groups was successfully updated.'\n format.html{redirect_to(:action=>\"edit\",:id=>@org )}\n else\n flash[:notice] =\"There was a problem updating this record.\"\n format.html{ render :action => \"edit\" }\n end\n end\n \n end", "def si_update_selects_from_order\n o = params[:o]\n project_id = 0\n work_order_id = 0\n charge_account_id = 0\n store_id = 0\n payment_method_id = 0\n if o != '0'\n @purchase_order = PurchaseOrder.find(o)\n if @purchase_order.blank?\n @order_items = []\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n else\n @order_items = unbilled_order_items_dropdown(@purchase_order)\n @projects = @purchase_order.project.blank? ? [] : Project.where(id: @purchase_order.project.id)\n @work_orders = @purchase_order.work_order.blank? ? [] : WorkOrder.where(id: @purchase_order.work_order.id)\n @charge_accounts = @purchase_order.charge_account.blank? ? [] : ChargeAccount.where(id: @purchase_order.charge_account.id)\n @stores = @purchase_order.store\n @payment_methods = @purchase_order.payment_method\n end\n if @order_items.blank?\n @products = @purchase_order.blank? ? products_dropdown : @purchase_order.organization.products.order(:product_code)\n else\n @products = @purchase_order.products.group(:product_code)\n end\n project_id = @projects.first.id rescue 0\n work_order_id = @work_orders.first.id rescue 0\n charge_account_id = @charge_accounts.first.id rescue 0\n store_id = @stores.id rescue 0\n payment_method_id = @payment_methods.id rescue 0\n else\n @order_items = []\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @payment_methods = payment_methods_dropdown\n @products = products_dropdown\n end\n # Work orders array\n @orders_dropdown = @work_orders.blank? ? [] : work_orders_array(@work_orders)\n # Purchase order items array\n @order_items_dropdown = order_items_array(@order_items)\n # Products array\n @products_dropdown = products_array(@products)\n # Setup JSON\n @json_data = { \"project\" => @projects, \"work_order\" => @orders_dropdown,\n \"charge_account\" => @charge_accounts, \"store\" => @stores,\n \"payment_method\" => @payment_methods, \"product\" => @products_dropdown,\n \"project_id\" => project_id, \"work_order_id\" => work_order_id,\n \"charge_account_id\" => charge_account_id, \"store_id\" => store_id,\n \"payment_method_id\" => payment_method_id, \"note_item\" => @order_items_dropdown }\n render json: @json_data\n end", "def fg_product_item_pack_product_code_search_combo_changed\n\titem_pack_product_code = get_selected_combo_value(params)\n\tsession[:fg_product_search_form][:item_pack_product_code_combo_selection] = item_pack_product_code\n\t@unit_pack_product_codes = FgProduct.find_by_sql(\"Select distinct unit_pack_product_code from fg_products where item_pack_product_code = '#{item_pack_product_code}'\").map{|g|[g.unit_pack_product_code]}\n\t@unit_pack_product_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('fg_product','unit_pack_product_code',@unit_pack_product_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_fg_product_unit_pack_product_code'/>\n\t\t<%= observe_field('fg_product_unit_pack_product_code',:update => 'carton_pack_product_code_cell',:url => {:action => session[:fg_product_search_form][:unit_pack_product_code_observer][:remote_method]},:loading => \"show_element('img_fg_product_unit_pack_product_code');\",:complete => session[:fg_product_search_form][:unit_pack_product_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def set_vendor_item\n @product = Product.find(params[:product_id])\n @vendor_item = @product.vendor_items.find(params[:id])\n end", "def index\n @tbl_products = TblProduct.all\n @selected =\"Electronics\"\n\n end", "def set_product\n #@product = Product.find params[:id]\n @product = Product.where(id: params[:id]).includes(\n {product_impact_line_items: [:impact_line_item, :impact_entries]}).first\n end", "def orchard_id_changed\n orchard_id = get_selected_combo_value(params)\n session[:delivery_form][:orchard_id_combo_selection] = orchard_id\n @orchard_description = \"\"\n\n orchard = Orchard.find(orchard_id)\n if (orchard != nil)\n orchard_description = orchard.orchard_description\n @orchard_description = orchard_description\n session[:delivery_form][:orchard_description] = orchard_description\n else\n @orchard_description = \"\"\n end\n\n @rmt_product_codes = [\"select a value from rmt_product_type_code above\"]\n\n render :inline => %{\n <%= @orchard_description_content = @orchard_description %>\n <%= @rmt_product_codes_content = select('delivery','rmt_product_id',@rmt_product_codes,{:sorted=>true})%>\n <script>\n <%= update_element_function(\"orchard_description_cell\", :action => :update,:content => @orchard_description_content) %>\n <%= update_element_function(\"advised_rmt_product_code_cell\", :action => :update,:content => @rmt_product_codes_content) %>\n </script>\n }\n\n end", "def update\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n @product_company_price.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @product_company_price.update_attributes(params[:product_company_price])\n format.html { redirect_to @product_company_price,\n notice: (crud_notice('updated', @product_company_price) + \"#{undo_link(@product_company_price)}\").html_safe }\n format.json { head :no_content }\n else\n @suppliers = suppliers_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @product_company_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_hqproduct\n @hqproduct = Hqproduct.find(params[:id])\n end", "def update\n @product.update(product_params)\n set_products\n end", "def set_product_product_group\n @product_product_group = ProductProductGroup.find(params[:id])\n end", "def show\n # to add tools to product\n if params[:select].present? \n @new_parent = Product.find(params[:select])\n if @new_parent\n ProductToTool.find_or_create_by_product_id_and_tool_id(@product.id,@new_parent.id)\n end\n end\n @products = Product.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n @product_variants = @product.product_variants\n \n if params[:show_products].present? \n @show_products = true\n end \n end", "def edit\n #Finds selected datafile\n @data_file = DataFile.find(params[:id])\n #creates an array of all products\n @all_products = Product.all\n #creates an array of all components\n @all_components = Component.all\n #creates an array of all valuefields\n @all_valuefields = Valuefield.all\n @all_properties = Property.all\n\n @items_to_select = @data_file.products + @data_file.components + @data_file.valuefields\n end", "def set_product\n if !@products\n @products = Product.all\n end\n price_ranges = [ {to: 10 }, {from: 10.01, to: 20 }, {from: 20.01, to: 30 }, {from: 30.01}]\n if !@producss\n @producss = Product.search \"*\", aggs: {price: {ranges: price_ranges}, category_id: {}, condition_id: {}, date: {}}\n end\n if !@producs\n @producs = Product.search(params.fetch(:name, \"*\")).to_a\n end\n end", "def set_admin\n @adminproduct = Productcla.find(params[:id])\n end", "def set_organization\n @organization = Organization.with_deleted.find(params[:id])\n end", "def update_product\n self.product.mrp = self.mrp\n self.product.rate = self.rate\n self.product.vat = self.vat\n self.product.pack = self.pack\n self.product.save\n end", "def set_productor\n @productor = Productor.find(params[:id])\n end", "def set_own_product\n @own_product = OwnProduct.find(params[:id])\n end", "def set_sub_product\n @sub_product = if current_employee\n SubProduct.find_by!(id: params[:id], shop_id: current_employee.shop_id)\n else\n SubProduct.find(params[:id])\n end\n end", "def set_organization\n # @org = Organization.find(params[:id])\n end", "def set_organization\n @organization = Organization.custom_find(params[:id])\n end", "def update\n \n if params[:category_ids].present?\n @product.categories.clear\n params[:category_ids].each do |id| \n @product.categories << Category.find(id)\n end\n end\n \n @product.areas.clear\n if params[:area_ids].present?\n @product.areas.clear\n params[:area_ids].each do |id| \n @product.areas << Area.find(id)\n end\n end\n \n if params[:article_ids].present?\n @product.articles.clear\n params[:article_ids].each do |id| \n @product.articles << Article.find(id)\n end\n end\n \n # update status\n @product.status = nil if params[:product][:status].present?\n @product.status = params[:product][:status].join(\",\") if params[:product][:status].present?\n \n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to edit_admin_product_path(@product.id), notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_product\r\n\t\t\t@product = @application.products.find(params[:id])\r\n\t\tend", "def edit_license\n publisher_id = current_user.id\n @license = PowerChip.where(:id=>params[:id], :publisher_id=>publisher_id).first\n @license.start_date = @license.start_date*1000\n @license.end_date = @license.end_date*1000\n end", "def set_product_option_value\n @product_option_value = ProductOptionValue.find(params[:id])\n end", "def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :location => admin_organizations_path)\n end", "def edit_supplier_service\n redirect_unless_privilege('Proveedores')\n \t@not_deliverable_services_ids = IndustryCategory.joins(:countries).where(\"countries.id = ?\", session[:country].id).where(industry_category_type_id:2).map(&:id) \n \t@service = Service.find params[:service_id]\n \[email protected] if @service.videos.blank?\n \t@supplier_account = @service.supplier_account\n \t@supplier = @service.supplier_account.supplier\n @color_types = ColorType.all\n\t\t@industry_categories = @industry_categories = @supplier_account.industry_categories.where(\"industry_category_type_id = 3 OR industry_category_type_id = 2\")\n\t\t#DZF here I make the dynamic grouped_options_for_select options\n\t\t@industry_cat_types = @industry_categories.inject({}) do |options, industry_category|\n\t\t (options[industry_category.industry_category_type.name] ||= []) << [industry_category.get_name, industry_category.id]\n \t\toptions\n\t\tend\n end", "def set_admin_product\n @admin_product = Admin::Product.find(params[:id])\n end", "def select_package_account\n # updates projects based on the account selected\n projects = Project.all(:account_id => params[:account_id])\n\n # map to id for use in options_for_select\n @projects = projects.map{|a| a.id}\n end", "def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end", "def set_product(product_name)\n if can_select_product?(product_name)\n @selection = product_from_name(product_name)\n else\n get_selection_error(product_name)\n end\n end", "def production_run_pack_material_fg_product_code_changed\n fg_code = get_selected_combo_value(params)\n @carton_setup_codes = CartonSetup.find_all_by_production_schedule_id_and_fg_product_code(session[:current_closed_schedule].id, fg_code).map { |c| [c.carton_setup_code, c.id] }\n#\trender (inline) the html to replace the contents of the td that contains the dropdown\n render :inline => %{\n\t\t<%= select('production_run_pack_material','carton_setup_code',@carton_setup_codes)%>\n\n\t\t}\n end", "def set_product\n @product = Product.unscoped.find(params[:id])\n end", "def co_update_office_select_from_bank\n bank = params[:bank]\n if bank != '0'\n @bank = Bank.find(bank)\n @offices = @bank.blank? ? bank_offices_dropdown : @bank.bank_offices.order(:bank_id, :code)\n else\n @offices = bank_offices_dropdown\n end\n # Offers array\n @offices_dropdown = bank_offices_array(@offices)\n # Setup JSON\n @json_data = { \"office\" => @offices_dropdown }\n render json: @json_data\n end", "def update\n @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.find(params[:id])\n @requests_devolutions_product = @requests_devolutions_products_detail.requests_devolutions_product;\n @requests_devolutions_products_details = @requests_devolutions_product.details.paginate(:page => params[:page])\n respond_to do |format|\n if @requests_devolutions_products_detail.update_attributes(params[:requests_devolutions_products_detail])\n format.js{ \n @requests_devolutions_products_detail = Requests::Devolutions::Products::Detail.new\n render 'update_list_form' \n }\n else\n format.html { \n @notice = \"Error al actualizar el registro\"\n redirect_to :back }\n end\n end\n end", "def carton_pack_product_type_code_search_combo_changed\n\ttype_code = get_selected_combo_value(params)\n\tsession[:carton_pack_product_search_form][:type_code_combo_selection] = type_code\n\t@basic_pack_codes = CartonPackProduct.find_by_sql(\"Select distinct basic_pack_code from carton_pack_products where type_code = '#{type_code}'\").map{|g|[g.basic_pack_code]}\n\t@basic_pack_codes.unshift(\"<empty>\")\n\n#\trender (inline) the html to replace the contents of the td that contains the dropdown \n\trender :inline => %{\n\t\t<%= select('carton_pack_product','basic_pack_code',@basic_pack_codes)%>\n\t\t<img src = '/images/spinner.gif' style = 'display:none;' id = 'img_carton_pack_product_basic_pack_code'/>\n\t\t<%= observe_field('carton_pack_product_basic_pack_code',:update => 'carton_pack_style_code_cell',:url => {:action => session[:carton_pack_product_search_form][:basic_pack_code_observer][:remote_method]},:loading => \"show_element('img_carton_pack_product_basic_pack_code');\",:complete => session[:carton_pack_product_search_form][:basic_pack_code_observer][:on_completed_js])%>\n\t\t}\n\nend", "def update\n @breadcrumb = 'update'\n @tool = Tool.find(params[:id])\n @tool.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @tool.update_attributes(params[:tool])\n format.html { redirect_to @tool,\n notice: (crud_notice('updated', @tool) + \"#{undo_link(@tool)}\").html_safe }\n format.json { head :no_content }\n else\n @companies = @tool.organization.blank? ? companies_dropdown : companies_dropdown_edit(@tool.organization)\n @offices = @tool.organization.blank? ? offices_dropdown : offices_dropdown_edit(@tool.organization_id)\n @products = @tool.organization.blank? ? products_dropdown : @tool.organization.products(:product_code)\n format.html { render action: \"edit\" }\n format.json { render json: @tool.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_ordered_product\n @ordered_product =OrderedProduct.find_by(product_id: params[:product_id])\n end", "def update\n result = Organization::Editor.perform(organization: current_organization, options: update_organization_params.to_h)\n\n respond_to do |format|\n format.html do\n if result.success?\n flash[:success] = \"Successfully updated \\\"#{current_organization.title}\\\"!\"\n redirect_to current_organization\n else\n current_organization.reload\n render :edit\n end\n end\n format.js do\n set_filter_options\n set_filtered_organizations\n render \"organizations/archive.js.erb\", format: :js\n end\n end\n end" ]
[ "0.8060184", "0.7999927", "0.79585665", "0.7221268", "0.64361227", "0.6406823", "0.6406236", "0.6206396", "0.6206323", "0.6147343", "0.61380434", "0.61150837", "0.60537827", "0.6042138", "0.60393804", "0.59883505", "0.59611905", "0.5950808", "0.5942775", "0.5939708", "0.59297687", "0.5928561", "0.5927158", "0.5924478", "0.5922523", "0.5919785", "0.58920974", "0.5877005", "0.58367145", "0.5835851", "0.5828401", "0.58154935", "0.5812101", "0.5797437", "0.5772815", "0.57656974", "0.5762098", "0.57558674", "0.5754094", "0.57365596", "0.57365596", "0.5734378", "0.573384", "0.57233053", "0.5716953", "0.57147765", "0.570672", "0.5694821", "0.5675736", "0.56678694", "0.56667584", "0.5664073", "0.5646739", "0.56324804", "0.56203085", "0.56131583", "0.558595", "0.55779094", "0.55741173", "0.5572953", "0.5572725", "0.5563528", "0.55488724", "0.55439323", "0.5527951", "0.552757", "0.55214506", "0.551721", "0.5515126", "0.55122244", "0.5511272", "0.5510423", "0.55099314", "0.5505285", "0.55048615", "0.549945", "0.5487538", "0.5485593", "0.5483085", "0.5482587", "0.5476984", "0.54612124", "0.54585826", "0.5456156", "0.54484063", "0.54416823", "0.5433234", "0.5431745", "0.5431544", "0.54289985", "0.5415254", "0.54074067", "0.5403219", "0.5403204", "0.54020834", "0.539996", "0.5394867", "0.53919196", "0.53888094", "0.53881377" ]
0.79976434
2
Default Methods GET /inventory_transfers GET /inventory_transfers.json
def index manage_filter_state no = params[:No] store = params[:Store] # OCO init_oco if !session[:organization] # Initialize select_tags @stores = stores_dropdown if @stores.nil? # Arrays for search current_stores = @stores.blank? ? [0] : current_stores_for_index(@stores) # If inverse no search is required no = !no.blank? && no[0] == '%' ? inverse_no_search(no) : no @search = InventoryTransfer.search do with :outbound_store_id, current_stores fulltext params[:search] if session[:organization] != '0' with :organization_id, session[:organization] end if !no.blank? if no.class == Array with :count_no, no else with(:count_no).starting_with(no) end end if !store.blank? with :outbound_store_id, store end data_accessor_for(InventoryTransfer).include = [:store] order_by :sort_no, :desc paginate :page => params[:page] || 1, :per_page => per_page end @inventory_transfers = @search.results respond_to do |format| format.html # index.html.erb format.json { render json: @inventory_transfers } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "def index\n @transfers = Transfer.all\n render json: @transfers\n end", "def index\n @transfers = Transfer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfers }\n end\n end", "def transfers\r\n @transfers ||= TransfersController.new(configuration: @configuration)\r\n end", "def index\n @transfers = @bank_account.transfers.all\n end", "def get_transfers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfers ...'\n end\n # resource path\n local_var_path = '/transfers'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'transferId'] = opts[:'transfer_id'] if !opts[:'transfer_id'].nil?\n query_params[:'transferTag'] = opts[:'transfer_tag'] if !opts[:'transfer_tag'].nil?\n query_params[:'transferStatus'] = opts[:'transfer_status'] if !opts[:'transfer_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'beneficiaryWalletId'] = opts[:'beneficiary_wallet_id'] if !opts[:'beneficiary_wallet_id'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'beneficiaryUserId'] = opts[:'beneficiary_user_id'] if !opts[:'beneficiary_user_id'].nil?\n query_params[:'transferDate'] = opts[:'transfer_date'] if !opts[:'transfer_date'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'transferTypeId'] = opts[:'transfer_type_id'] if !opts[:'transfer_type_id'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].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 = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transfers\n self.ListTransfers.first.map { |t| map_transfer(t) }\n end", "def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def transfer\n @inventory_type = InventoryType.find_by_id(params[:id])\n @inventory =Inventory.find_by_id(params[:format])\n end", "def get_transfers_in\n run_command :get_transfers_in, :domain, {\n :key => 'attributes'\n }\n end", "def transfers\n @transfers = TransferHelper.transfers_for_user(user:current_user)\n\n render :partial => 'home/transfers'\n end", "def get_transfers(opts = {})\n data, _status_code, _headers = get_transfers_with_http_info(opts)\n data\n end", "def index\n @transfers = Transfer.where user: @user\n end", "def get_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.get_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/transfer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#get_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @transfers = []\n if current_user.admin?\n @transfers = Transfer.all\n else\n @transfers = Transfer.where(from: current_accounts.collect{|x| x.acct_number}) + Transfer.where(to: current_accounts.collect{|x| x.acct_number}) \n end\n end", "def index\n @cartridge_transfers = CartridgeTransfer.all\n end", "def index\n @breadcrumbs = [['Transfers']]\n @transfers = @transfers.includes(:from_warehouse, :to_warehouse, :batch)\n transfers = TransferDecorator.decorate_collection(@transfers.order('id DESC'))\n @transfers = Kaminari.paginate_array(transfers).page(params[:page])\n end", "def show\n render json: @transfer\n end", "def transfer(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/%i' % [id])\n end", "def index\n @page = params[\"page\"]\n @transfers = Transfer.order(\"created_at desc\").all.paginate(:page => @page)\n end", "def show\n @breadcrumb = 'read'\n @inventory_transfer = InventoryTransfer.find(params[:id])\n @items = @inventory_transfer.inventory_transfer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n # Approvers\n @is_approver = company_approver(@inventory_transfer, @inventory_transfer.store.company, current_user.id) ||\n office_approver(@inventory_transfer, @inventory_transfer.store.office, current_user.id) ||\n (current_user.has_role? :Approver)\n # If current user is not approver up to here, maybe it's a multioffice store...\n if !@is_approver\n @is_approver = multioffice_store_approver(@inventory_transfer, current_user.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_transfer }\n end\n end", "def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end", "def index\n render json: serializer_class.new(paginate(ecf_transfers), params: { cpd_lead_provider: current_user }).serializable_hash.to_json\n end", "def query_status(params, path_url = 'transfers', class_type = 'Transfer')\n super\n end", "def index\n @account_transfers = AccountTransfer.all\n @appoint_responsible = AppointResponsible.new\n end", "def payment_transfers\n authorize :report\n\n @transfers = company.transfers(start_param, end_param)\n # @transfers = company.transfers(300.days.ago.to_s, Date.current.to_s)\n\n respond_to do |format|\n format.json\n format.pdf { render '/companies/report' }\n end\n end", "def index\n @shop_stripe_transfers = Shop::StripeTransfer.all\n end", "def get_transfers_away\n run_command :get_transfers_away, :domain, {\n :key => 'attributes'\n }\n end", "def create\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new(params[:inventory_transfer])\n @inventory_transfer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @inventory_transfer.save\n format.html { redirect_to @inventory_transfer, notice: crud_notice('created', @inventory_transfer) }\n format.json { render json: @inventory_transfer, status: :created, location: @inventory_transfer }\n else\n @stores = stores_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_transfer\n @transfer = current_user.transfers.find(params[:id])\n end", "def find_transfer\n @transfer = Transfer.find(params[:id])\n end", "def index\r\n @stock_transfers = StockTransfer.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @stock_transfers }\r\n end\r\n end", "def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end", "def getTransactions\n\t\t\n\tend", "def get_transfer_all_using_get(opts = {})\n data, _status_code, _headers = get_transfer_all_using_get_with_http_info(opts)\n data\n end", "def get_transactions(service)\n\t\treturn @transport.get_path(\"transactions\",service)\n\tend", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def set_transfer\n @transfer = current_user.transactions.find(params[:id])\n end", "def transfers_count\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/count').count\n end", "def trades\n Client.current.get(\"#{resource_url}/trades\")\n end", "def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_token_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenTransferApi.get_token_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/token_transfer'\n\n # query parameters\n query_params = {}\n query_params[:'wallet_id'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageTokenTransferResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenTransferApi#get_token_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def new\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new\n @stores = stores_dropdown\n @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_transfer }\n end\n end", "def inventory_transfer\n puts \"#{params}\".inspect\n @transfer = Transfer.create!(remark: params[:remark], transfer_item: params[:transfer_item], inventory_type_id: params[:transfer][:inventory_type_id]) \n @inventory_trans = Inventory.find(params[:inventory])\n @inventory_trans.update(:transfer_id => @transfer.id)\n @inventory = InventoryType.shod(params[:transfer][:id])\n trans(params[:inventory], params[:transfer][:id], @inventory)\n inventory_transfer2\nend", "def index\n @transfers = Transfer.all.limit(5)\n \n end", "def transfers\n Transfer.where('sender_id = ? OR receiver_id = ?', id, id)\n end", "def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end", "def transfer client\n if @options[:verbose]\n error = \"Rock Trading does not have a 'transfer' API.\\n\"\n error << \"You must transfer bitcoin manually.\"\n\t @options[:logger].info error\n\tend\n end", "def transfer(options = {})\n @operations << options.merge(type: :transfer, from: account_name)\n \n self\n end", "def transfer(options = {})\n @operations << options.merge(type: :transfer, from: account_name)\n \n self\n end", "def transfer_unit\n if !params[:ic_number].nil?\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end", "def transaction\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@transc_merchant.first_name}\", epsadmin_merchant_path(@transc_merchant.merchant_uniq_id)\n @epsadmin_transaction_list = @transc_merchant.transactions.order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epsadmin_transaction_list }\n end\n end", "def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transactions ...\"\n end\n # resource path\n local_var_path = \"/transactions\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_invoice'] = opts[:'filter_invoice'] if !opts[:'filter_invoice'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceTransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @student_hour_transfers = StudentHourTransfer.all\n end", "def find_organization_transfers_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferRequestsApi.find_organization_transfers ...'\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 TransferRequestsApi.find_organization_transfers\"\n end\n # resource path\n local_var_path = '/organizations/{id}/transfers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TransferRequestList'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"TransferRequestsApi.find_organization_transfers\",\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: TransferRequestsApi#find_organization_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @transfer = current_user.transfers.build(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def deposit\n request_params = params.permit(:source_account_id, :destination_account_id, :amount)\n\n bank ||= Actions.new.deposit(\n request_params['source_account_id'], \n request_params['destination_account_id'], \n request_params['amount']\n )\n\n return render status: bank[0], json: bank[1]\n end", "def all_transactions\n json_response(Transaction.all)\n end", "def update\n @breadcrumb = 'update'\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n items_changed = false\n if params[:inventory_transfer][:inventory_transfer_items_attributes]\n params[:inventory_transfer][:inventory_transfer_items_attributes].values.each do |new_item|\n current_item = InventoryTransferItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f)))\n items_changed = true\n break\n end\n end\n end\n master_changed = false\n if ((params[:inventory_transfer][:transfer_date].to_date != @inventory_transfer.transfer_date) ||\n (params[:inventory_transfer][:transfer_no].to_s != @inventory_transfer.transfer_no) ||\n (params[:inventory_transfer][:remarks].to_s != @inventory_transfer.remarks) ||\n (params[:inventory_transfer][:store_id].to_i != @inventory_transfer.store_id.to_i) ||\n (params[:inventory_transfer][:company_id].to_i != @inventory_transfer.company_id.to_i) ||\n (params[:inventory_transfer][:organization_id].to_i != @inventory_transfer.organization_id.to_i))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @inventory_transfer.updated_by = current_user.id if !current_user.nil?\n if @inventory_transfer.update_attributes(params[:inventory_transfer])\n format.html { redirect_to @inventory_transfer,\n notice: (crud_notice('updated', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n @stores = stores_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @inventory_transfer }\n format.json { head :no_content }\n end\n end\n end", "def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transfer }\n end\n end", "def transfer(tx)\n pay_id = get_payment_id(tx.id)\n puts \" the transaction will be transferred here ... for payment id : \" , get_payment_id(tx.id) , \" the listing author is : \" , tx.listing_author_id\n seller_account = razorpay_accounts_api.get(person_id: tx.listing_author_id, community_id: tx.community_id).data\n if seller_account && seller_account[:verification_status] == \"activated\"\n razorpay_api.direct_transfer(community: tx.community_id, payment_id: pay_id, amount: order_total(tx).cents - order_commission(tx).cents, razorpay_account_id: seller_account[:razorpay_account_id])\n else \n raise \"The Seller Account is not verified\"\n end \n payment = {}\n Result::Success.new(payment)\n rescue => exception\n Result::Error.new(exception.message)\n end", "def index\n @transactions = Transaction.all\n render json: @transactions\n end", "def my_transactions\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def transactions\n @transactions ||= ArkEcosystem::Client::API::Transactions.new(@client) # rubocop:disable Metrics/LineLength\n end", "def index\n @transferencias = Transferencia.all\n end", "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def update\n if @transfer.update(transfer_params)\n render :show, status: :ok, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end", "def show\n @transfer = @branch.transfers.find(params[:id])\n @transfered_product = @transfer.transfered_products.build\n @product = Product.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transfer }\n end\n end", "def get_transfer_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfer ...'\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 TransferApi.get_transfer\"\n end\n # resource path\n local_var_path = '/transfers/{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 = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transactions_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_get ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].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', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \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: DefaultApi#transactions_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def inventory_transfer2\n flash[:success] = \"Successfully Transfered\"\n redirect_to inventories_path\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def index\n if @account\n @transactions = @account.transactions\n else\n @transactions = Transaction.all\n end\n render json: @transactions\n end", "def destroy\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n respond_to do |format|\n if @inventory_transfer.destroy\n format.html { redirect_to inventory_transfers_url,\n notice: (crud_notice('destroyed', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to inventory_transfers_url, alert: \"#{@inventory_transfer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def index\r\n @transferencias = Transferencia.all\r\n end", "def trades(options)\n request :public, :get, :trades, options\n end", "def transfer(to, amount, options={})\n options = {:limits => [\n PiggyBankAccount::MIN_AMOUNT_TO_TRANSFER_IN_CENTS,\n PiggyBankAccount::MAX_AMOUNT_TO_TRANSFER_IN_CENTS\n ]}.symbolize_keys.merge(options)\n\n amount = amount.abs\n min_amount = if options[:limits].is_a?(Array) && options[:limits].first.is_a?(Money)\n Money.new(1, amount.currency) + options[:limits].first - Money.new(1, amount.currency)\n else\n Money.new((options[:limits] || [0, 0]).first || 0, amount.currency)\n end\n max_amount = if options[:limits].is_a?(Array) && options[:limits].last.is_a?(Money)\n Money.new(1, amount.currency) + options[:limits].last - Money.new(1, amount.currency)\n else\n Money.new((options[:limits] || [0, 0]).last || 0, amount.currency)\n end\n\n return Response.new(false, amount, :transfer, :description => I18n.t('activerecord.errors.messages.transfer_greater_or_equal_to') % {\n :count => min_amount.format\n }) if options[:limits] && amount < min_amount\n return Response.new(false, amount, :transfer, :description => I18n.t('activerecord.errors.messages.transfer_less_or_equal_to') % {\n :count => max_amount.format\n }) if options[:limits] && amount > max_amount\n return Response.new(false, amount, :transfer, :description => I18n.t('activerecord.errors.messages.transfer_destination_invalid')) unless to.is_a?(PiggyBankAccount)\n return Response.new(false, amount, :transfer, :description => I18n.t('activerecord.errors.messages.transfer_self_exclusion')) if to == self\n \n options.delete(:limits)\n result = nil\n transaction do\n I18n.switch_locale(self.owners_locale) do\n result = self.withdraw(amount, options.merge(\n :fee => false,\n :description => TRANSFER_MESSAGE.t % {\n :from_type => self.owner.class.human_name, :from_name => self.owners_name,\n :to_type => to.owner.class.human_name, :to_name => to.owners_name,\n :amount => amount.convert_to(self.currency).format, :original => amount.format}))\n end\n if result.success?\n I18n.switch_locale(to.owners_locale) do\n result = to.deposit(amount, options.merge(:description => TRANSFER_MESSAGE.t % {\n :from_type => self.owner.class.human_name, :from_name => self.owners_name,\n :to_type => to.owner.class.human_name, :to_name => to.owners_name, \n :amount => amount.convert_to(to.currency).format, :original => amount.format}))\n end\n end\n end\n if result.success?\n Response.new(true, amount, :transfer, :description => result.message)\n else\n result\n end\n end", "def index\n @transfer_groups = TransferGroup.all\n end", "def list_item_transactions_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ItemsApi.list_item_transactions ...'\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 ItemsApi.list_item_transactions\"\n end\n # resource path\n local_var_path = '/items/{id}/transactions'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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] || 'Transactions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth', 'oAuth2ClientCredentials']\n\n new_options = opts.merge(\n :operation => :\"ItemsApi.list_item_transactions\",\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: ItemsApi#list_item_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def qbd_stock_transfer_to_transfer_inventory_xml(xml, stock_transfer_hash, match = nil, step)\n if match\n xml.TxnID match.fetch(:sync_id)\n xml.EditSequence match.fetch(:sync_alt_id)\n end\n\n xml.TxnDate stock_transfer_hash.fetch(:created_at).to_date.to_s\n if stock_transfer_hash.fetch(:number)\n xml.RefNumber stock_transfer_hash.fetch(:number)\n end\n xml.FromInventorySiteRef do\n source_location_hash = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: stock_transfer_hash.fetch(:source_location_id), integration_syncable_type: 'Spree::StockLocation')\n xml.ListID source_location_hash.try(:sync_id)\n end\n xml.ToInventorySiteRef do\n destination_location_hash = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: stock_transfer_hash.fetch(:destination_location_id), integration_syncable_type: 'Spree::StockLocation')\n xml.ListID destination_location_hash.try(:sync_id)\n end\n unless qbd_stock_memo(stock_transfer_hash).blank?\n xml.Memo qbd_stock_memo(stock_transfer_hash)\n end\n\n stock_transfer_hash.fetch(:destination_items, []).each do |line_item|\n variant_match = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: line_item.fetch(:variant_id), integration_syncable_type: 'Spree::Variant')\n xml.TransferInventoryLineAdd do\n xml.ItemRef do\n xml.ListID variant_match.try(:sync_id)\n end\n # As of March 4, 2017 we cannot support sending row/bin locations\n xml.FromInventorySiteLocationRef do\n xml.ListID\n end\n xml.ToInventorySiteLocationRef do\n xml.ListID\n end\n xml.QuantityToTransfer line_item.fetch(:quantity)\n end\n end\n end", "def transfer_params\n params.require(:transfer).permit(:transferable_id, :transferable_type, :from_location_id, :to_location_id, :transfer_date, :transferee_id)\n end", "def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end", "def get_transfer(id, opts = {})\n data, _status_code, _headers = get_transfer_with_http_info(id, opts)\n data\n end", "def get_transactions\n @transactions\n end", "def transfer_funds\n Dialog::space\n @acct_list = bank.account_list(@man_name, @man_pin)\n @account_id_array = Display::account_info(@acct_list)\n from = Dialog::transfer_acct_1\n to = Dialog::transfer_acct_2\n how_much = Dialog::transfer_ammount\n bank.money_transfer(from, to, how_much)\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end" ]
[ "0.74772704", "0.68863165", "0.68863165", "0.68863165", "0.68863165", "0.6858125", "0.6840665", "0.6758058", "0.6742206", "0.6694599", "0.6618191", "0.65992063", "0.65295506", "0.64710164", "0.6464923", "0.6380194", "0.63447124", "0.6317432", "0.6214609", "0.61991495", "0.6188012", "0.615118", "0.61490345", "0.610014", "0.60763204", "0.59426725", "0.59224844", "0.587341", "0.5867409", "0.58282036", "0.5821796", "0.5795936", "0.57853293", "0.5785076", "0.57778484", "0.5771838", "0.5765549", "0.57573295", "0.5737378", "0.57154036", "0.5699018", "0.5698769", "0.5687397", "0.5669422", "0.5646929", "0.56374973", "0.5610552", "0.56022525", "0.55951697", "0.55903405", "0.55868995", "0.5583357", "0.5562929", "0.55450845", "0.5517871", "0.5517871", "0.5513481", "0.55083644", "0.5503747", "0.549145", "0.54863536", "0.5471546", "0.5464018", "0.5454169", "0.5450991", "0.54442257", "0.5418608", "0.54128975", "0.54095936", "0.5403301", "0.5379806", "0.5377222", "0.53703785", "0.53618383", "0.53588367", "0.53478694", "0.5340777", "0.5340339", "0.5330603", "0.533001", "0.533001", "0.533001", "0.53275126", "0.5322094", "0.5317621", "0.53111786", "0.53082675", "0.53054625", "0.5305461", "0.5293931", "0.5289898", "0.5288517", "0.5287453", "0.5255879", "0.5247644", "0.52471364", "0.5238932", "0.5232513", "0.5232513", "0.5232513" ]
0.6009678
25
GET /inventory_transfers/1 GET /inventory_transfers/1.json
def show @breadcrumb = 'read' @inventory_transfer = InventoryTransfer.find(params[:id]) @items = @inventory_transfer.inventory_transfer_items.paginate(:page => params[:page], :per_page => per_page).order('id') # Approvers @is_approver = company_approver(@inventory_transfer, @inventory_transfer.store.company, current_user.id) || office_approver(@inventory_transfer, @inventory_transfer.store.office, current_user.id) || (current_user.has_role? :Approver) # If current user is not approver up to here, maybe it's a multioffice store... if !@is_approver @is_approver = multioffice_store_approver(@inventory_transfer, current_user.id) end respond_to do |format| format.html # show.html.erb format.json { render json: @inventory_transfer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def index\n @transfers = Transfer.all\n render json: @transfers\n end", "def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end", "def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end", "def index\n @transfers = Transfer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfers }\n end\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def get_transfers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfers ...'\n end\n # resource path\n local_var_path = '/transfers'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'transferId'] = opts[:'transfer_id'] if !opts[:'transfer_id'].nil?\n query_params[:'transferTag'] = opts[:'transfer_tag'] if !opts[:'transfer_tag'].nil?\n query_params[:'transferStatus'] = opts[:'transfer_status'] if !opts[:'transfer_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'beneficiaryWalletId'] = opts[:'beneficiary_wallet_id'] if !opts[:'beneficiary_wallet_id'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'beneficiaryUserId'] = opts[:'beneficiary_user_id'] if !opts[:'beneficiary_user_id'].nil?\n query_params[:'transferDate'] = opts[:'transfer_date'] if !opts[:'transfer_date'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'transferTypeId'] = opts[:'transfer_type_id'] if !opts[:'transfer_type_id'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].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 = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transfer\n @inventory_type = InventoryType.find_by_id(params[:id])\n @inventory =Inventory.find_by_id(params[:format])\n end", "def show\n render json: @transfer\n end", "def transfer(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/%i' % [id])\n end", "def index\n @transfers = @bank_account.transfers.all\n end", "def find_transfer\n @transfer = Transfer.find(params[:id])\n end", "def get_transfers_in\n run_command :get_transfers_in, :domain, {\n :key => 'attributes'\n }\n end", "def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transfer }\n end\n end", "def get_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.get_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/transfer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#get_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @transfers = Transfer.where user: @user\n end", "def query_status(params, path_url = 'transfers', class_type = 'Transfer')\n super\n end", "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def index\n @cartridge_transfers = CartridgeTransfer.all\n end", "def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end", "def index\n @page = params[\"page\"]\n @transfers = Transfer.order(\"created_at desc\").all.paginate(:page => @page)\n end", "def transfers\n self.ListTransfers.first.map { |t| map_transfer(t) }\n end", "def new\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new\n @stores = stores_dropdown\n @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_transfer }\n end\n end", "def show\n @transfer = @branch.transfers.find(params[:id])\n @transfered_product = @transfer.transfered_products.build\n @product = Product.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transfer }\n end\n end", "def transfers\r\n @transfers ||= TransfersController.new(configuration: @configuration)\r\n end", "def set_transfer\n @transfer = current_user.transfers.find(params[:id])\n end", "def index\n @breadcrumbs = [['Transfers']]\n @transfers = @transfers.includes(:from_warehouse, :to_warehouse, :batch)\n transfers = TransferDecorator.decorate_collection(@transfers.order('id DESC'))\n @transfers = Kaminari.paginate_array(transfers).page(params[:page])\n end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def transfers\n @transfers = TransferHelper.transfers_for_user(user:current_user)\n\n render :partial => 'home/transfers'\n end", "def trades\n Client.current.get(\"#{resource_url}/trades\")\n end", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end", "def show\n @title = t('view.transfer_products.show_title')\n @transfer_product = TransferProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transfer_product }\n end\n end", "def get_transfer_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfer ...'\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 TransferApi.get_transfer\"\n end\n # resource path\n local_var_path = '/transfers/{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 = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_transfers_away\n run_command :get_transfers_away, :domain, {\n :key => 'attributes'\n }\n end", "def get_transfer_by_path(path)\n obj = @service.object(path)\n .tap(&:introspect)\n Transfer.new(obj.Get(Transfer::INTERFACE, 'Id').first, self)\n end", "def create\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new(params[:inventory_transfer])\n @inventory_transfer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @inventory_transfer.save\n format.html { redirect_to @inventory_transfer, notice: crud_notice('created', @inventory_transfer) }\n format.json { render json: @inventory_transfer, status: :created, location: @inventory_transfer }\n else\n @stores = stores_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end", "def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end", "def inventory_transfer\n puts \"#{params}\".inspect\n @transfer = Transfer.create!(remark: params[:remark], transfer_item: params[:transfer_item], inventory_type_id: params[:transfer][:inventory_type_id]) \n @inventory_trans = Inventory.find(params[:inventory])\n @inventory_trans.update(:transfer_id => @transfer.id)\n @inventory = InventoryType.shod(params[:transfer][:id])\n trans(params[:inventory], params[:transfer][:id], @inventory)\n inventory_transfer2\nend", "def index\r\n @stock_transfers = StockTransfer.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @stock_transfers }\r\n end\r\n end", "def new\n @stock_transfer = StockTransfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transfer }\n end\n end", "def index\n render json: serializer_class.new(paginate(ecf_transfers), params: { cpd_lead_provider: current_user }).serializable_hash.to_json\n end", "def show\n @vendor = Vendor.find(params[:id])\n @transactions = @vendor.transactions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end", "def get_transfers(opts = {})\n data, _status_code, _headers = get_transfers_with_http_info(opts)\n data\n end", "def index\n @transfers = Transfer.all.limit(5)\n \n end", "def show\n @item_transaction = ItemTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_transaction }\n end\n end", "def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def update\n if @transfer.update(transfer_params)\n render :show, status: :ok, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def set_transfer\n @transfer = current_user.transactions.find(params[:id])\n end", "def get_token_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenTransferApi.get_token_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/token_transfer'\n\n # query parameters\n query_params = {}\n query_params[:'wallet_id'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageTokenTransferResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenTransferApi#get_token_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transfer client\n if @options[:verbose]\n error = \"Rock Trading does not have a 'transfer' API.\\n\"\n error << \"You must transfer bitcoin manually.\"\n\t @options[:logger].info error\n\tend\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def index\n @transfers = []\n if current_user.admin?\n @transfers = Transfer.all\n else\n @transfers = Transfer.where(from: current_accounts.collect{|x| x.acct_number}) + Transfer.where(to: current_accounts.collect{|x| x.acct_number}) \n end\n end", "def index\n @account_transfers = AccountTransfer.all\n @appoint_responsible = AppointResponsible.new\n end", "def payment_transfers\n authorize :report\n\n @transfers = company.transfers(start_param, end_param)\n # @transfers = company.transfers(300.days.ago.to_s, Date.current.to_s)\n\n respond_to do |format|\n format.json\n format.pdf { render '/companies/report' }\n end\n end", "def find_organization_transfers_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferRequestsApi.find_organization_transfers ...'\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 TransferRequestsApi.find_organization_transfers\"\n end\n # resource path\n local_var_path = '/organizations/{id}/transfers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TransferRequestList'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"TransferRequestsApi.find_organization_transfers\",\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: TransferRequestsApi#find_organization_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\r\n @stock_transfer = StockTransfer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @stock_transfer }\r\n end\r\n end", "def index\n @shop_stripe_transfers = Shop::StripeTransfer.all\n end", "def destroy\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n respond_to do |format|\n if @inventory_transfer.destroy\n format.html { redirect_to inventory_transfers_url,\n notice: (crud_notice('destroyed', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to inventory_transfers_url, alert: \"#{@inventory_transfer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def transfer_unit\n if !params[:ic_number].nil?\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end", "def show\n @client_transaction = ClientTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_transaction }\n end\n end", "def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end", "def show\n @recent_transaction = RecentTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_transaction }\n end\n end", "def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @transfer = Transfer.find(params[:id])\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", "def transfers_count\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/count').count\n end", "def get_transactions(service)\n\t\treturn @transport.get_path(\"transactions\",service)\n\tend", "def transaction\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@transc_merchant.first_name}\", epsadmin_merchant_path(@transc_merchant.merchant_uniq_id)\n @epsadmin_transaction_list = @transc_merchant.transactions.order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epsadmin_transaction_list }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", "def handle_transfer(resp_body)\n params = {\n id: resp_body[:id],\n from: resp_body[:from],\n to: resp_body[:to],\n by: resp_body[:by],\n from_amount: Amount.new(\n currency: resp_body[:fromAmount][:currency],\n value: resp_body[:fromAmount][:value]\n ),\n to_amount: Amount.new(\n currency: resp_body[:fromAmount][:currency],\n value: resp_body[:fromAmount][:value]\n ),\n banking_id: resp_body[:banking_id],\n memo: resp_body[:memo],\n type: Utils.parse_enum(resp_body[:type]),\n status: Utils.parse_enum(resp_body[:status]),\n refund: Refund.new(resp_body[:refund]),\n created_at: Utils.parse_epoch(resp_body[:created])\n }\n TransferItem.new(@member_account, params)\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @transaction }\n end\n end", "def transfers\n Transfer.where('sender_id = ? OR receiver_id = ?', id, id)\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end", "def get_transfer(id, opts = {})\n data, _status_code, _headers = get_transfer_with_http_info(id, opts)\n data\n end", "def index\n @transactions = Transaction.all\n render json: @transactions\n end" ]
[ "0.71039265", "0.69563454", "0.685632", "0.68320984", "0.68034744", "0.6588655", "0.6588655", "0.6588655", "0.6588655", "0.6515545", "0.65058887", "0.6505851", "0.6389067", "0.6330638", "0.6239513", "0.61622685", "0.61614466", "0.60975146", "0.6082874", "0.6014826", "0.6001933", "0.6000691", "0.596511", "0.58354217", "0.58314544", "0.58098704", "0.5809415", "0.5805773", "0.5794807", "0.57766867", "0.57758814", "0.5739815", "0.57286394", "0.57008815", "0.56971115", "0.5695684", "0.5692875", "0.56884146", "0.5650667", "0.56474876", "0.5623221", "0.56083953", "0.5606756", "0.560608", "0.5596843", "0.55891377", "0.55825365", "0.5576433", "0.55759656", "0.55631083", "0.5530001", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5529644", "0.5517698", "0.551763", "0.5509422", "0.55065054", "0.5483534", "0.5474993", "0.5464384", "0.54623896", "0.5458354", "0.54573804", "0.5454878", "0.54545313", "0.5446493", "0.54446906", "0.54371536", "0.5425926", "0.54150635", "0.54138714", "0.5393954", "0.5379138", "0.53761053", "0.53731567", "0.5371175", "0.53661126", "0.53641605", "0.53641605", "0.53641605", "0.53641605", "0.53641605", "0.5355692", "0.53427166", "0.5335818", "0.5335818", "0.5335818", "0.5334005", "0.53330845", "0.53258836" ]
0.6046088
19
GET /inventory_transfers/new GET /inventory_transfers/new.json
def new @breadcrumb = 'create' @inventory_transfer = InventoryTransfer.new @stores = stores_dropdown @products = products_dropdown respond_to do |format| format.html # new.html.erb format.json { render json: @inventory_transfer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new(params[:inventory_transfer])\n @inventory_transfer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @inventory_transfer.save\n format.html { redirect_to @inventory_transfer, notice: crud_notice('created', @inventory_transfer) }\n format.json { render json: @inventory_transfer, status: :created, location: @inventory_transfer }\n else\n @stores = stores_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stock_transfer = StockTransfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transfer }\n end\n end", "def new\n @title = t('view.transfer_products.new_title')\n @transfer_product = TransferProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer_product }\n end\n end", "def new\n @transfer = @branch.transfers.new\n 1.times {@transfer.transfered_products.build}\n @condicion = 2\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer }\n end\n end", "def create\n @transfer = new_transfer\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to transfers_path, notice: \"#{t(:transfer_transaction)} #{t(:was_successfully_created)}\" }\n # format.json { render action: 'show', status: :created, location: @transfer }\n else\n init\n format.html { render action: 'new' }\n # format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @recent_transaction = RecentTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_transaction }\n end\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def new\n @item_transaction = ItemTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @transaction }\n end\n end", "def new\n @logtransfer = Logtransfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logtransfer }\n end\n end", "def new\n @transfer_slip = TransferSlip.new\n @report = Report.find(params[:report_id]) if params[:report_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer_slip }\n end\n end", "def new\n @inventory_file = InventoryFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @inventory_file }\n end\n end", "def new\n @settlement = Settlement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @settlement }\n end\n end", "def new\r\n @stock_transfer = StockTransfer.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @stock_transfer }\r\n end\r\n end", "def new\n @inventoryitem = Inventoryitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventoryitem }\n end\n end", "def new\n @trip_item = TripItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_item }\n end\n end", "def new\n @destination = Destination.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, location: @transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @inventory_status = InventoryStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_status }\n end\n end", "def new\n @stock_transaction = StockTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transaction }\n end\n end", "def new\n @client_transaction = ClientTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_transaction }\n end\n end", "def new\n @money_transaction = MoneyTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @money_transaction }\n end\n end", "def new\n @destination = Destination.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @destination }\n end\n end", "def new\n @settlement_history = Settlement::History.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @settlement_history }\n end\n end", "def new\n @transaccion = Transaccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaccion }\n end\n end", "def create\n @transfer = current_user.transfers.build(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n \n @order = Order.new\n @order.order_number = 'NEW ORDER'\n \n @customer = Customer.new\n @address = Address.new\n @address.state = 'IL'\n \n # Ledgers\n @deposit_ledger = Ledger.new\n @payment_ledger = Ledger.new\n \n # Remaining balance\n @remaining_balance = 'NEW ORDER'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @stats_money_transaction = Stats::MoneyTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stats_money_transaction }\n end\n end", "def new\n @translantion = Translantion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @translantion }\n end\n end", "def new\n @stock_transfer_voucher = StockTransferVoucher.new_stock_transfer(@company)\n\n @products = Product.where(:company_id => @company.id, :inventory => true)\n @destination_warehouses = @company.warehouses\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stock_transfer_voucher }\n end\n end", "def new\n @mi_transaction = MiTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi_transaction }\n end\n end", "def new\n @stashed_inventory = StashedInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stashed_inventory }\n end\n end", "def new\n @temporary_source = TemporarySource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @temporary_source }\n end\n end", "def new\n @daily_inventory = DailyInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daily_inventory }\n end\n end", "def new\n @trade_item = TradeItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trade_item }\n end\n end", "def create\n @recent_transaction = RecentTransaction.new(params[:recent_transaction])\n\n respond_to do |format|\n if @recent_transaction.save\n format.html { redirect_to @recent_transaction, notice: 'Recent transaction was successfully created.' }\n format.json { render json: @recent_transaction, status: :created, location: @recent_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @inventory_item_type = InventoryItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_item_type }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traffic }\n end\n end", "def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end", "def new\n @di_transaction = DiTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @di_transaction }\n end\n end", "def new\n @transaction_entry = TransactionEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @transaction_entry }\n end\n end", "def new\n @shop_transaction = Shop::Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_transaction }\n end\n end", "def new\n @inventory_entry = InventoryEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_entry }\n end\n end", "def new\n @title = t('view.flows.new_title')\n @flow = Flow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flow }\n end\n end", "def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end", "def new\n @outgoing = Outgoing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outgoing }\n end\n end", "def new\n @trade = Trade.new\n\n render json: @trade\n end", "def new\n @breadcrumb = 'create'\n @tariff_type = TariffType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tariff_type }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end", "def new\n @inventory_template = InventoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @inventory_template }\n end\n end", "def new\n @server_ins_transaction = ServerInsTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server_ins_transaction }\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 new\n @copy_target = CopyTarget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @copy_target }\n end\n end", "def new\n @chain = Chain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chain }\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer, notice: 'Transfer was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end", "def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end", "def new\n @chain = Chain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @chain }\n end\n end", "def new\n @received_item_and_qty = ReceivedItemAndQty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @received_item_and_qty }\n end\n end", "def new\n @breadcrumb = 'create'\n @inventory_count_type = InventoryCountType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_count_type }\n end\n end", "def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end", "def new\n @exchange = Exchange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exchange }\n end\n end", "def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @transfer = Transfer.new(transfer_params)\n @transfer = Transfer.new(transfer_params)\n @transferaccount = @transfer.transferaccounts.build\n @transferaccount.account_id = current_account.id\n \n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def new\n @inventory_report = InventoryReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_report }\n end\n end", "def new\n @title = t('view.banks.new_title')\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n \n end", "def new\n @importer = Importer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importer }\n end\n end", "def new\n @backup_file = BackupFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @backup_file }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account_unit }\n end\n end", "def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end" ]
[ "0.7427209", "0.7287815", "0.71444964", "0.71320796", "0.70536536", "0.68514395", "0.6834122", "0.68336666", "0.6769565", "0.6769565", "0.6769565", "0.6753339", "0.67140967", "0.66713244", "0.6639242", "0.66195375", "0.6590691", "0.65712583", "0.65573925", "0.6516378", "0.6513285", "0.64985764", "0.64902353", "0.6481981", "0.6481711", "0.64777166", "0.64714175", "0.6464928", "0.64608485", "0.64542574", "0.64519656", "0.64473605", "0.64419", "0.6431433", "0.64280736", "0.64263237", "0.642575", "0.6422212", "0.6421141", "0.64140624", "0.6409911", "0.63838035", "0.63833725", "0.6381575", "0.6380847", "0.63804036", "0.6362968", "0.6362491", "0.6361189", "0.63449496", "0.6341994", "0.63268787", "0.63247126", "0.63247126", "0.6324484", "0.6323006", "0.6320791", "0.6319724", "0.63187605", "0.631098", "0.6310635", "0.6310635", "0.6309222", "0.63084054", "0.63084054", "0.6295892", "0.6289324", "0.62740153", "0.6272024", "0.6271531", "0.6268936", "0.626291", "0.62527555", "0.6243535", "0.6225288", "0.6224282", "0.62206286", "0.6212667", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62121516", "0.62105393", "0.61971194" ]
0.77238226
0
POST /inventory_transfers POST /inventory_transfers.json
def create @breadcrumb = 'create' @inventory_transfer = InventoryTransfer.new(params[:inventory_transfer]) @inventory_transfer.created_by = current_user.id if !current_user.nil? respond_to do |format| if @inventory_transfer.save format.html { redirect_to @inventory_transfer, notice: crud_notice('created', @inventory_transfer) } format.json { render json: @inventory_transfer, status: :created, location: @inventory_transfer } else @stores = stores_dropdown format.html { render action: "new" } format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def transfer_inventory(reason)\n packaging.product.transfers.create!(\n :detail => self,\n :happened_at => Time.zone.now,\n :quantity => (-1 * quantity * packaging.size),\n :reason => reason\n )\n end", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, location: @transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def inventory_transfer\n puts \"#{params}\".inspect\n @transfer = Transfer.create!(remark: params[:remark], transfer_item: params[:transfer_item], inventory_type_id: params[:transfer][:inventory_type_id]) \n @inventory_trans = Inventory.find(params[:inventory])\n @inventory_trans.update(:transfer_id => @transfer.id)\n @inventory = InventoryType.shod(params[:transfer][:id])\n trans(params[:inventory], params[:transfer][:id], @inventory)\n inventory_transfer2\nend", "def create\n ActiveRecord::Base.transaction do\n @transfer = Transfer.new(transfer_params)\n @transfer = Transfer.new(transfer_params)\n @transferaccount = @transfer.transferaccounts.build\n @transferaccount.account_id = current_account.id\n \n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @transfer = current_user.transfers.build(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer\n @inventory_type = InventoryType.find_by_id(params[:id])\n @inventory =Inventory.find_by_id(params[:format])\n end", "def create\n @transfer = @bank_account.transfers.new(transfer_params)\n\n begin\n transfer_result = @transfer.initiate_transfer(params[:amount])\n @transfer.status = transfer_result[:status]\n @transfer.stripe_token = transfer_result[:id]\n rescue => e\n @transfer_error = e.message\n end\n\n respond_to do |format|\n if !@transfer_error && @transfer.save\n format.html {\n redirect_to user_bank_account_transfer_path(\n @user, @bank_account, @transfer\n ),\n notice: 'Transfer was successfully created.'\n }\n format.json { render action: 'show', status: :created, location: @transfer }\n else\n format.html { render action: 'new' }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transfer = new_transfer\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to transfers_path, notice: \"#{t(:transfer_transaction)} #{t(:was_successfully_created)}\" }\n # format.json { render action: 'show', status: :created, location: @transfer }\n else\n init\n format.html { render action: 'new' }\n # format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_params\n params.require(:transfer).permit(:date, :concept, :account_id, items: [:id])\n end", "def transfer_funds!\n self.transfer = Stripe::Transfer.create(transfer_params)\n end", "def transfer(amount,to,memo=nil)\n client.post(transaction_url,{:amount=>amount,:to=>to,:memo=>memo}) if client\n end", "def create\n @transfer = Transfer.new(transfer_params)\n @transfer.sender_account = current_user.account\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer.sender_account, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n from_account = Account.find(@transfer.from_account_id)\n to_account = Account.find(@transfer.to_account_id)\n\n if (from_account.id != to_account.id)\n amount = BigDecimal.new(@transfer.amount)\n correlation = Rubybank::Utilities::generate_correlation_code(16)\n if from_account.balance > amount\n add_mutation = Mutation.new(\n account: to_account,\n correlation_code: correlation,\n from_account: from_account,\n comment: @transfer.comment,\n amount: amount\n )\n sub_mutation = Mutation.new(\n account: from_account,\n correlation_code: correlation,\n from_account: to_account,\n comment: @transfer.comment,\n amount: -amount\n )\n\n # Save them in one transaction then redirect\n Mutation.transaction do\n add_mutation.save!\n sub_mutation.save!\n end\n redirect_to from_account, notice: 'Transfer successfully executed.'\n else\n flash.notice = 'Balance is not enough to transfer this amount'\n render action: 'new'\n end\n else\n flash.notice = 'You cannot transfer money to the same account'\n render action: 'new'\n end\n end", "def transfer_params\n params.require(:transfer).permit(:transferable_id, :transferable_type, :from_location_id, :to_location_id, :transfer_date, :transferee_id)\n end", "def transfer_funds(destination, params)\n # Validation\n params = validate_input(params, @exception_array += %w[currency value])\n # The Request Body Parameters\n if destination.blank?\n # Blind Transfer\n transfer_body = {\n amount: {\n currency: params['currency'],\n value: params['value']\n }\n }\n else\n # Targeted Transfer\n transfer_body = {\n amount: {\n currency: params['currency'],\n value: params['value']\n },\n destination: destination\n }\n end\n transfer_hash = K2Transfer.make_hash('transfers', 'POST', @access_token, 'Transfer', transfer_body)\n @threads << Thread.new do\n sleep 0.25\n @location_url = K2Connect.to_connect(transfer_hash)\n end\n @threads.each(&:join)\n end", "def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end", "def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if @transfer.save\n @transfer.transferable.update( branch_id: transfer_params[:to_location_id] )\n if @transfer.transferable_type == \"Employee\"\n @transfer.transferable.devices.update_all( status: \"instock\", status_date: Date.today )\n @transfer.transferable.device_assignments.update_all(unassign_date: @transfer.transfer_date)\n end \n format.html { redirect_to @transfer, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n set_resources\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer(*args)\n commit 'MassPay', build_mass_pay_request(*args)\n end", "def inventory_transfer2\n flash[:success] = \"Successfully Transfered\"\n redirect_to inventories_path\n end", "def create_transfer\n @transaction = Transaction.new(transaction_params)\n @transaction.amount = @transaction.amount * -1\n @transaction.sign = -1\n\n @transaction_to = Transaction.new(transaction_params)\n @transaction_to.account = Account.find params[:transaction][:account_to_id].to_i\n @transaction_to.sign = 1\n\n respond_to do |format|\n success = @transaction.valid? && @transaction_to.valid?\n\n if success\n Transaction.transaction do\n begin\n @transaction.save\n @transaction_to.save\n rescue ActiveRecord::StatementInvalid\n @transaction.errors.add(:base,'Invalid transfer')\n success = false\n end\n end\n end\n\n if success\n format.html { redirect_to @transaction.account, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction.account }\n else\n format.html { render :deposit }\n format.json { render json: @transaction.account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n transfer = Transfer.create(transfer_params)\n if transfer.errors.empty?\n head :no_content\n else\n render status: 400, json: {errors: [{\n code: 400,\n status: Rack::Utils::HTTP_STATUS_CODES[400],\n title: 'error executing transfer',\n detail: transfer.errors.full_messages.to_sentence\n }]}\n end\n end", "def new\n @transfer = @branch.transfers.new\n 1.times {@transfer.transfered_products.build}\n @condicion = 2\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer }\n end\n end", "def create\n @outgoing_transfer = OutgoingTransfer.new(outgoing_transfer_params)\n @outgoing_transfer.account_id = @account.id\n\n if @outgoing_transfer.save\n redirect_to @account, notice: 'Outgoing transfer was successfully created.' \n else\n render :new\n end\n end", "def send_transfer(payload, token = nil)\n url = \"#{PAYMENTS_PATH}/transfers\"\n data = perform_post(url, payload, token)\n data || {}\n end", "def submit(opts = {})\n params = {\n secret: client_secret,\n }\n if opts.key?(:tx_blob)\n params.merge!(opts)\n else\n params.merge!({tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }})\n\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n end\n # puts \"Submit: \" + params.inspect\n post(:submit, params)\n end", "def submit(opts = {})\n params = {\n secret: client_secret,\n }\n if opts.key?(:tx_blob)\n params.merge!(opts)\n else\n params.merge!({tx_json: {\n 'TransactionType' => opts[:transaction_type] || 'Payment',\n 'Account' => client_account,\n 'Destination' => opts[:destination],\n 'Amount' => opts[:amount]\n }})\n\n if opts.key?(:SendMax) and opts.key?(:Paths)\n # Complex IOU send\n params[:tx_json]['SendMax'] = opts[:SendMax]\n params[:tx_json]['Paths'] = opts[:Paths]\n end\n if opts.key?(:DestinationTag)\n params[:tx_json]['DestinationTag'] = opts[:DestinationTag]\n end\n if opts.key?(:InvoiceID)\n params[:tx_json]['InvoiceID'] = opts[:InvoiceID]\n end\n end\n # puts \"Submit: \" + params.inspect\n post(:submit, params)\n end", "def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4050/transactions\", options) # create initial state\n return results\n end", "def handle_transfer(resp_body)\n params = {\n id: resp_body[:id],\n from: resp_body[:from],\n to: resp_body[:to],\n by: resp_body[:by],\n from_amount: Amount.new(\n currency: resp_body[:fromAmount][:currency],\n value: resp_body[:fromAmount][:value]\n ),\n to_amount: Amount.new(\n currency: resp_body[:fromAmount][:currency],\n value: resp_body[:fromAmount][:value]\n ),\n banking_id: resp_body[:banking_id],\n memo: resp_body[:memo],\n type: Utils.parse_enum(resp_body[:type]),\n status: Utils.parse_enum(resp_body[:status]),\n refund: Refund.new(resp_body[:refund]),\n created_at: Utils.parse_epoch(resp_body[:created])\n }\n TransferItem.new(@member_account, params)\n end", "def transfer_params\n params.require(:transfer).permit(:bank_account_id, :stripe_token, :description, :name, :status)\n end", "def create\n @stock_transfer_voucher = StockTransferVoucher.create_stock_transfer(params, @company.id, @current_user, @financial_year.year.name)\n @products = Product.where(:company_id => @company.id, :inventory => true)\n @destination_warehouses = @company.warehouses\n respond_to do |format|\n if @stock_transfer_voucher.save_inventory\n @stock_transfer_voucher.register_user_action(request.remote_ip, 'created')\n format.html { redirect_to @stock_transfer_voucher, :notice => 'Stock transfer voucher was successfully created.' }\n format.json { render :json => @stock_transfer_voucher, :status => :created, :location => @stock_transfer_voucher }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @stock_transfer_voucher.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @account_transfer = AccountTransfer.new(account_transfer_params)\n @account_transfer.user_id = current_user.id\n\n respond_to do |format|\n if @account_transfer.save\n\n format.html { redirect_to root_url, notice: 'Account transfer was successfully created.' }\n format.json { render :show, status: :created, location: @account_transfer }\n else\n format.html { render :new }\n format.json { render json: @account_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_transactions_command(transfer_json_data, customer_id = ENV['CIRCLE_CUSTOMER_ID'], customer_session_token = ENV['CIRCLE_CUSTOMER_SESSION_TOKEN'], circle_bank_account_id = ENV['CIRCLE_BANK_ACCOUNT_ID'])\n btc_transfer_json_data = transfer_json_data.to_json\n content_length = btc_transfer_json_data.length\n\n api_url = \"https://www.circle.com/api/v2/customers/#{customer_id}/accounts/#{circle_bank_account_id}/transactions\"\n\n path_header = \"/api/v2/customers/#{customer_id}/accounts/#{circle_bank_account_id}/transactions\"\n\n curl = Curl::Easy.http_post(api_url, btc_transfer_json_data) do |http|\n http.headers['host'] = 'www.circle.com'\n http.headers['method'] = 'POST'\n http.headers['path'] = path_header\n http.headers['scheme'] = 'https'\n http.headers['version'] = 'HTTP/1.1'\n http.headers['accept'] = 'application/json, text/plain, */*'\n http.headers['accept-encoding'] = 'gzip,deflate'\n http.headers['accept-language'] = 'en-US,en;q=0.8'\n http.headers['content-length'] = content_length\n http.headers['content-type'] = 'application/json;charset=UTF-8'\n http.headers['cookie'] = circle_cookie\n http.headers['origin'] = 'https://www.circle.com'\n http.headers['referer'] = \"https://www.circle.com/send/confirm\"\n http.headers['user-agent'] = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36\"\n http.headers['x-app-id'] = 'angularjs'\n http.headers['x-app-version'] = \"0.0.1\"\n http.headers['x-customer-id'] = customer_id\n http.headers['x-customer-session-token'] = customer_session_token\n end\n\n json_data = ActiveSupport::Gzip.decompress(curl.body_str)\n parsed_json = JSON.parse(json_data)\n\n btc_transfer_response_status = parsed_json\n response_code = btc_transfer_response_status['response']['status']['code']\n if response_code == 0\n # puts 'Successful BTC tansfer!'\n # puts 'Transfer Details:'\n # puts btc_transfer_response_status\n else\n puts '** ERROR ** BTC Transfer Unsuccessful'\n puts 'Transfer Details:'\n puts btc_transfer_response_status\n end\n response_code\n end", "def qbd_stock_transfer_to_transfer_inventory_xml(xml, stock_transfer_hash, match = nil, step)\n if match\n xml.TxnID match.fetch(:sync_id)\n xml.EditSequence match.fetch(:sync_alt_id)\n end\n\n xml.TxnDate stock_transfer_hash.fetch(:created_at).to_date.to_s\n if stock_transfer_hash.fetch(:number)\n xml.RefNumber stock_transfer_hash.fetch(:number)\n end\n xml.FromInventorySiteRef do\n source_location_hash = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: stock_transfer_hash.fetch(:source_location_id), integration_syncable_type: 'Spree::StockLocation')\n xml.ListID source_location_hash.try(:sync_id)\n end\n xml.ToInventorySiteRef do\n destination_location_hash = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: stock_transfer_hash.fetch(:destination_location_id), integration_syncable_type: 'Spree::StockLocation')\n xml.ListID destination_location_hash.try(:sync_id)\n end\n unless qbd_stock_memo(stock_transfer_hash).blank?\n xml.Memo qbd_stock_memo(stock_transfer_hash)\n end\n\n stock_transfer_hash.fetch(:destination_items, []).each do |line_item|\n variant_match = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: line_item.fetch(:variant_id), integration_syncable_type: 'Spree::Variant')\n xml.TransferInventoryLineAdd do\n xml.ItemRef do\n xml.ListID variant_match.try(:sync_id)\n end\n # As of March 4, 2017 we cannot support sending row/bin locations\n xml.FromInventorySiteLocationRef do\n xml.ListID\n end\n xml.ToInventorySiteLocationRef do\n xml.ListID\n end\n xml.QuantityToTransfer line_item.fetch(:quantity)\n end\n end\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer, notice: 'Transfer was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def transfer_funds\n raise \"payment must be paid\" if !payment.paid?\n\n bank_account = PagarMe::BankAccount.new(bank_account_attributes.delete(:bank_account))\n bank_account.create\n raise \"unable to create an bank account\" unless bank_account.id.present?\n\n transfer = PagarMe::Transfer.new({\n bank_account_id: bank_account.id,\n amount: value_for_transaction\n })\n transfer.create\n raise \"unable to create a transfer\" unless transfer.id.present?\n\n #avoid sending notification\n payment.update(state: 'pending_refund')\n payment.payment_transfers.create!({\n user: payment.user,\n transfer_id: transfer.id,\n transfer_data: transfer.to_json\n })\n end", "def push_transfer(params)\n params[:grsp] = params.delete :reseller\n\n run_command :rsp2rsp_push_transfer, nil, params\n end", "def transfer_params\n params.require(:transfer).permit(:from, :to, :amount, :start, :effective)\n end", "def post_peertransfers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PeerTransfersApi.post_peertransfers ...'\n end\n # resource path\n local_var_path = '/peertransfers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'PeerTransferResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"PeerTransfersApi.post_peertransfers\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PeerTransfersApi#post_peertransfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transfer_call(params)\n path = @version + '/Call/Transfer/'\n method = 'POST'\n return request(path, method, params)\n end", "def create\n @cartridge_transfer = CartridgeTransfer.new(cartridge_transfer_params)\n\n respond_to do |format|\n if @cartridge_transfer.save\n format.html { redirect_to @cartridge_transfer, notice: 'Cartridge transfer was successfully created.' }\n format.json { render :show, status: :created, location: @cartridge_transfer }\n else\n format.html { render :new }\n format.json { render json: @cartridge_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer(tx)\n pay_id = get_payment_id(tx.id)\n puts \" the transaction will be transferred here ... for payment id : \" , get_payment_id(tx.id) , \" the listing author is : \" , tx.listing_author_id\n seller_account = razorpay_accounts_api.get(person_id: tx.listing_author_id, community_id: tx.community_id).data\n if seller_account && seller_account[:verification_status] == \"activated\"\n razorpay_api.direct_transfer(community: tx.community_id, payment_id: pay_id, amount: order_total(tx).cents - order_commission(tx).cents, razorpay_account_id: seller_account[:razorpay_account_id])\n else \n raise \"The Seller Account is not verified\"\n end \n payment = {}\n Result::Success.new(payment)\n rescue => exception\n Result::Error.new(exception.message)\n end", "def create\n @item_transaction = ItemTransaction.new(params[:item_transaction])\n\n respond_to do |format|\n if @item_transaction.save\n format.html { redirect_to @item_transaction, notice: 'Item transaction was successfully created.' }\n format.json { render json: @item_transaction, status: :created, location: @item_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @money_transaction = MoneyTransaction.new(params[:money_transaction])\n\n respond_to do |format|\n if @money_transaction.save\n format.html { redirect_to root_url, flash: { success: \"Founds were successfully transfered to #{@money_transaction.to.formatted_uid}\" } }\n format.json { render json: @money_transaction, status: :created, location: @money_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @money_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_params\n params.require(:transfer).permit(:user_id, :price, :date, :from_wallet_id, :to_wallet_id, :commission)\n end", "def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end", "def add_bank_transfer(from, to, amount)\n amount = amount.round(2)\n logger.debug \"Transferring #{amount} from #{from} to #{to}\"\n @api.put('BankTransfers', {\n 'FromBankAccount' => { 'Code' => from },\n 'ToBankAccount' => { 'Code' => to },\n 'Amount' => amount,\n 'Date' => @export.date.strftime('%Y-%m-%d')\n })['BankTransfers'].first\n end", "def transfer_params\n params.require(:transfer).permit(:valor, :taxa, transferaccounts_attributes: [:id, :operacao, :account_id, :_destroy])\n end", "def create_revenue_transfers\n # the share for invested readers before\n amount = total * READER_RATIO\n\n # payment maybe swapped\n revenue_asset_id = payment.swap_order&.fill_asset_id || payment.asset_id\n\n # the present orders\n _orders =\n item.orders\n .where('id < ? and created_at < ?', id, created_at)\n\n # total investment\n sum = _orders.sum(:total)\n\n # create reader transfer\n _distributed_amount = 0\n _orders.each do |_order|\n # ignore if amount is less than minium amout for Mixin Network\n _amount = (amount * _order.total / sum).round(8)\n next if (_amount - MINIMUM_AMOUNT).negative?\n\n transfers.create_with(\n wallet: payment.wallet,\n transfer_type: :reader_revenue,\n opponent_id: _order.buyer.mixin_uuid,\n asset_id: revenue_asset_id,\n amount: _amount.to_f.to_s,\n memo: \"读者收益来自文章《#{item.title}》\".truncate(140)\n ).find_or_create_by!(\n trace_id: PrsdiggBot.api.unique_conversation_id(trace_id, _order.trace_id)\n )\n\n _distributed_amount += _amount\n end\n\n # create prsdigg transfer\n _prsdigg_amount = (total * PRSDIGG_RATIO).round(8)\n if payment.wallet.present?\n transfers.create_with(\n wallet: payment.wallet,\n transfer_type: :prsdigg_revenue,\n opponent_id: PrsdiggBot.api.client_id,\n asset_id: revenue_asset_id,\n amount: _prsdigg_amount.to_f.to_s,\n memo: \"article uuid: #{item.uuid}》\".truncate(140)\n ).find_or_create_by!(\n trace_id: payment.wallet.mixin_api.unique_conversation_id(trace_id, PrsdiggBot.api.client_id)\n )\n end\n\n # create author transfer\n transfers.create_with(\n wallet: payment.wallet,\n transfer_type: :author_revenue,\n opponent_id: item.author.mixin_uuid,\n asset_id: revenue_asset_id,\n amount: (total - _distributed_amount - _prsdigg_amount).round(8),\n memo: \"#{payment.payer.name} #{buy_article? ? '购买' : '赞赏'}了你的文章《#{item.title}》\".truncate(140)\n ).find_or_create_by!(\n trace_id: PrsdiggBot.api.unique_conversation_id(trace_id, item.author.mixin_uuid)\n )\n end", "def create\n\n @repeating_transfer = RepeatingTransfer.new(repeating_transfer_params_no_amount)\n @repeating_transfer.user = current_user\n @repeating_transfer.amount = currency_string_to_number(repeating_transfer_params_amount)\n set_repeat_period(@repeating_transfer, params[:repeating_transfer])\n set_end_type(@repeating_transfer, params[:repeating_transfer])\n\n @repeating_transfer.next_occurrence = @repeating_transfer.repeat_start_date\n\n respond_to do |format|\n if @repeating_transfer.save\n format.html { redirect_to repeating_transfers_path, notice: 'Repeating transfer was successfully created.' }\n format.json { render :show, status: :created, location: @repeating_transfer }\n else\n set_select_options\n format.html { render :new }\n format.json { render json: @repeating_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfers\r\n @transfers ||= TransfersController.new(configuration: @configuration)\r\n end", "def transfer(amount, currency, wallet_from, wallet_to)\n params = {\n amount: amount.to_s,\n currency: currency.upcase,\n walletfrom: wallet_from.downcase,\n walletto: wallet_to.downcase\n }\n authenticated_post(\"transfer\", params: params).body\n end", "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end", "def transfer_params\n params.require(:transfer).permit(:payee, :date, :memo, :amount, :from_account_id, :to_account_id)\n end", "def transfer(amount, *args)\n do_transaction :transfer_out, amount, *args\n end", "def trans(inventory, transfer_id, inventory_type)\n @inventory_log = InventoryLog.create!(inventory_type_id: params[:transfer][:id] )\n @inventory_update = Inventory.find(params[:inventory])\n @inventory_update.transfer.inventory_type.inventories.each do |i|\n if @inventory_update.part_no == i.part_no\n value = i.warehouse_stock_qty\n final = value.to_i - params[:transfer_item].to_i\n # stock = final + i.engineer_stock_qty.to_i\n i.update(warehouse_stock_qty: final) \n tot = final + i.engineer_stock_qty.to_i\n i.update(total_stock_qty: tot)\n end\n end\n @inventory.inventories.each do |f|\n if @inventory_update.part_no == f.part_no\n value = f.warehouse_stock_qty\n final = value.to_i + params[:transfer_item].to_i\n f.update(warehouse_stock_qty: final) \n tot = final + f.engineer_stock_qty.to_i\n f.update(total_stock_qty: tot)\n end\n end\n @inv = Inventory.create!(branch: @inventory_update.branch, part_no: @inventory_update.part_no, description: @inventory_update.description, warehouse_stock_qty: params[:transfer_item].to_i, transfered_stock_qty: params[:transfer_item].to_i, engineer_stock_qty: @inventory_update.engineer_stock_qty,location1: @inventory_update.location1,location2:@inventory_update.location2, location3: @inventory_update.location3,map: @inventory_update.map,total_stock_value: @inventory_update.total_stock_value,status: @inventory_update.status, latest_modify_date: @inventory_update.latest_modify_date,remark: @inventory_update.remark, inventory_type_id: @inventory.id, transfer_id: @transfer.id)\n total_stock_qty1 = @inv.warehouse_stock_qty.to_i + @inv.engineer_stock_qty.to_i\n @inv.update(total_stock_qty: total_stock_qty1 )\n\n end", "def create\n \n\n @product = Product.find(Integer(params[:stock_transfer][:product]))\n @stock_location = StockLocation.find(Integer(params[:stock_transfer][:stock_location]))\n\n params[:stock_transfer][:product] = @product\n params[:stock_transfer][:stock_location] = @stock_location\n\n @stock_transfer = StockTransfer.new(params[:stock_transfer])\n\n respond_to do |format|\n if @stock_transfer.save\n format.html { redirect_to stock_transfers_path, notice: 'Stock transfer was successfully created.' }\n format.json { render json: @stock_transfer, status: :created, location: @stock_transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stock_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @transfers = Transfer.all\n render json: @transfers\n end", "def create\n @take_inventory = TakeInventory.new(take_inventory_params)\n\n respond_to do |format|\n if @take_inventory.save\n format.html { redirect_to @take_inventory, notice: 'Take inventory was successfully created.' }\n format.json { render :show, status: :created, location: @take_inventory }\n else\n format.html { render :new }\n format.json { render json: @take_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_params\n params.require(:transfer).permit(:user_id, :from_game_center_id, :to_game_center_id, :number, :amount, :state)\n end", "def transfer_params\n params.require(:transfer).permit(:receiver_account_id, :amount)\n end", "def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end", "def create\n @transaction = @source.source_transactions.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to polymorphic_path([@source, :transactions]), notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/%i' % [id])\n end", "def create\n @video_adv = current_user.video_advs.create(video_adv_params)\n @video_adv.transactions.create(user_id: @video_adv.user_id, amount: params[:amount], currency: \"USD\", status: \"pending\")\n # base_url = (Rails.env == \"development\") ? 'http://localhost:3000' : 'http://www.etcty.com'\n\n # @response = EXPRESS_GATEWAY.setup_purchase((params[:amount].to_i*100),\n # return_url: base_url+complete_order_video_adv_path(@video_adv, locale: I18n.locale) ,\n # cancel_return_url: base_url,\n # currency: \"USD\"\n # )\n\n # redirect_to EXPRESS_GATEWAY.redirect_url_for(@response.token)\n\n redirect_to complete_order_video_adv_path(@video_adv, locale: I18n.locale)\n\n end", "def create_transfer_using_post_with_http_info(external_account_transfer_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.create_transfer_using_post ...'\n end\n # verify the required parameter 'external_account_transfer_request' is set\n if @api_client.config.client_side_validation && external_account_transfer_request.nil?\n fail ArgumentError, \"Missing the required parameter 'external_account_transfer_request' when calling FundingApi.create_transfer_using_post\"\n end\n # resource path\n local_var_path = '/transfer'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(external_account_transfer_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#create_transfer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transfer; end", "def transfer; end", "def transference_params\n params.permit(:source_account_id, :destination_account_id, :amount)\n end", "def transaction_params\n params.require(:transaction).permit(:amount, :currency_id, :source_id, :destination_id, :destination_type, :date)\n end", "def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend", "def postTransactionInprogress( transaction_id, paypal_setexpresscheckout)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_setexpresscheckout'] = paypal_setexpresscheckout\n return doCurl(\"post\",\"/transaction/inprogress\",params)\n end", "def new\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new\n @stores = stores_dropdown\n @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_transfer }\n end\n end", "def outgoing_transfer_params\n params.require(:outgoing_transfer).permit(:originAcctNumber, :destinationAcctNumber, :routingNumber, :amount, :account_id)\n end", "def deposit\n request_params = params.permit(:source_account_id, :destination_account_id, :amount)\n\n bank ||= Actions.new.deposit(\n request_params['source_account_id'], \n request_params['destination_account_id'], \n request_params['amount']\n )\n\n return render status: bank[0], json: bank[1]\n end", "def transaction_params\n params.require(:transaction).permit(:source_account_id, :destination_account_id, :amount)\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to account_transactions_path(@transaction.account), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { redirect_to account_transactions_path(current_user.accounts.expense_accounts.first), alert: 'Transaction could not be added.' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_job(params={})\n Bitmovin::TransferJob.create(params)\n end", "def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to inventories_path, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n else\n format.html { render :new }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to @inventory, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n else\n format.html { render :new }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to @inventory, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n else\n format.html { render :new }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Wallet.transaction do \n @service = Service.find(params[:account_entry][:service_id]) ##@wallet.account_entries.build(params[:account_entry])\n @account_entry = @wallet.buy_smartbucks(@service)\n respond_to do |format|\n if @account_entry.pending?\n flash[:notice] = 'Transaction queued for processing'\n format.html { redirect_to(profile_wallet_path(@profile)) }\n format.mobile { redirect_to(profile_wallet_path(@profile)) }\n format.xml { render :xml => @account_entry, :status => :created, :location => @account_entry }\n else\n format.html { render :action => \"new\" }\n format.mobile { render :action => \"new\" }\n format.xml { render :xml => @account_entry.reason, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create_transfer(options = {})\n required_params = %i( amount currency)\n required_params_present = required_params.all? { |e| options.keys.include?(e) }\n raise \"Required Argument Error. Must include #{required_params.join(', ')}\" unless required_params_present\n mutually_exclusive_params = %i( merchant pbntag)\n mutually_exclusive_params_present = mutually_exclusive_params.any? { |e| options.keys.include?(e) }\n raise \"Required Argument Error. Must include one of #{mutually_exclusive_params.join(', ')}\" unless required_params_present\n body = {\n cmd: \"create_transfer\",\n amount: options[:amount],\n currency: options[:currency],\n }\n body[:merchant] = options[:merchant] if options[:merchant]\n body[:pbntag] = options[:pbntag] if options[:pbntag]\n body[:auto_confirm] = 1 if options[:auto_confirm]\n post body\n\n end", "def create\n @item_inventory = ItemInventory.new(item_inventory_params)\n\n respond_to do |format|\n if @item_inventory.save\n format.html { redirect_to @item_inventory, notice: 'Item inventory was successfully created.' }\n format.json { render :show, status: :created, location: @item_inventory }\n else\n format.html { render :new }\n format.json { render json: @item_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n attrs = whitelist(params, :create).merge customer: current_user.becomes(Users::Customer)\n dattrs = attrs.delete(:destinations_attributes)\n\n @travel = Travels::Travel.new(attrs)\n\n dattrs.each_key do |key|\n dattr = dattrs[key]\n iattrs = dattr.delete(:items_attributes)\n\n dest = Travels::Places::Destination.new(dattr)\n\n iattrs.each_key do |key|\n @travel.items.build(iattrs[key]).destination = dest\n end if iattrs\n end\n\n # @travel.customer = current_user.becomes(Users::Customer)\n\n respond_to do |format|\n if @travel.save\n format.html { redirect_to status_travel_path(@travel), notice: \"Gracefully created the travel!\" }\n format.json { render json: @travel, status: :created, location: @travel }\n else\n format.html { redirect_to new_travel_path, alert: \"Failed to create the travel! Errors: #{@travel.errors.full_messages}\" }\n format.json { render json: @travel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to @inventory, notice: 'Inventory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inventory }\n else\n format.html { render action: 'new' }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @breadcrumb = 'update'\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n items_changed = false\n if params[:inventory_transfer][:inventory_transfer_items_attributes]\n params[:inventory_transfer][:inventory_transfer_items_attributes].values.each do |new_item|\n current_item = InventoryTransferItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f)))\n items_changed = true\n break\n end\n end\n end\n master_changed = false\n if ((params[:inventory_transfer][:transfer_date].to_date != @inventory_transfer.transfer_date) ||\n (params[:inventory_transfer][:transfer_no].to_s != @inventory_transfer.transfer_no) ||\n (params[:inventory_transfer][:remarks].to_s != @inventory_transfer.remarks) ||\n (params[:inventory_transfer][:store_id].to_i != @inventory_transfer.store_id.to_i) ||\n (params[:inventory_transfer][:company_id].to_i != @inventory_transfer.company_id.to_i) ||\n (params[:inventory_transfer][:organization_id].to_i != @inventory_transfer.organization_id.to_i))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @inventory_transfer.updated_by = current_user.id if !current_user.nil?\n if @inventory_transfer.update_attributes(params[:inventory_transfer])\n format.html { redirect_to @inventory_transfer,\n notice: (crud_notice('updated', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n @stores = stores_dropdown\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @inventory_transfer }\n format.json { head :no_content }\n end\n end\n end", "def move_inventory!(transfer)\n updated_quantities = {}\n item_validator = Errors::InsufficientAllotment.new(\"Transfer items exceeds the available inventory\")\n transfer.line_items.each do |line_item|\n inventory_item = self.inventory_items.find_by(item: line_item.item)\n new_inventory_item = transfer.to.inventory_items.find_or_create_by(item: line_item.item)\n next if inventory_item.nil? || inventory_item.quantity == 0\n if inventory_item.quantity >= line_item.quantity\n updated_quantities[inventory_item.id] = (updated_quantities[inventory_item.id] || inventory_item.quantity) - line_item.quantity\n updated_quantities[new_inventory_item.id] = (updated_quantities[new_inventory_item.id] ||\n new_inventory_item.quantity) + line_item.quantity\n else\n item_validator.add_insufficiency(line_item.item, inventory_item.quantity, line_item.quantity)\n end\n end\n \n raise item_validator unless item_validator.satisfied?\n\n update_inventory_inventory_items(updated_quantities)\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def create\n @inventoryitem = Inventoryitem.new(params[:inventoryitem])\n\n respond_to do |format|\n if @inventoryitem.save\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully created.' }\n format.json { render json: @inventoryitem, status: :created, location: @inventoryitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def index\n @transfers = Transfer.all\n end", "def transfer(options = {})\n @operations << options.merge(type: :transfer, from: account_name)\n \n self\n end", "def transfer(options = {})\n @operations << options.merge(type: :transfer, from: account_name)\n \n self\n end", "def create\n @wallet_transaction = TransactionCreate.perform(transaction_params: wallet_transaction_params,\n user: current_user)\n respond_to do |format|\n if @wallet_transaction.save\n format.html { redirect_to @wallet_transaction, notice: 'Wallet transaction was successfully created.' }\n format.json { render :show, status: :created, location: @wallet_transaction }\n else\n format.html { render :new }\n format.json { render json: @wallet_transaction.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6524708", "0.6476213", "0.6467632", "0.6466285", "0.6404008", "0.63641465", "0.6289076", "0.62709284", "0.6130198", "0.61248016", "0.6024871", "0.60058075", "0.59673405", "0.59650016", "0.59515566", "0.59353155", "0.59302783", "0.59180164", "0.5896658", "0.5883729", "0.5881218", "0.58719057", "0.5868214", "0.5849824", "0.5821195", "0.5811814", "0.5800602", "0.57815206", "0.5774058", "0.5763062", "0.57606715", "0.5756666", "0.5750238", "0.5704838", "0.56866616", "0.568481", "0.5677705", "0.56747645", "0.5663697", "0.56206685", "0.5606941", "0.56069267", "0.5586305", "0.5580656", "0.5580482", "0.55790913", "0.55610174", "0.5558317", "0.5549647", "0.553422", "0.55290246", "0.5521837", "0.5512056", "0.5499984", "0.5497393", "0.5495967", "0.549517", "0.5484636", "0.5480674", "0.5472744", "0.5471742", "0.546034", "0.54391146", "0.5432865", "0.54286236", "0.541749", "0.540857", "0.54056436", "0.5398083", "0.53856933", "0.53856933", "0.5384427", "0.53756946", "0.53745556", "0.53706825", "0.536854", "0.53486556", "0.5343946", "0.5342239", "0.5332112", "0.53233445", "0.53229684", "0.5316647", "0.5316647", "0.53133965", "0.53126943", "0.5308802", "0.53033197", "0.5279089", "0.5262412", "0.525117", "0.5249174", "0.5248616", "0.5248342", "0.5248342", "0.5248342", "0.5248342", "0.52479476", "0.52479476", "0.5242787" ]
0.66746795
0
PUT /inventory_transfers/1 PUT /inventory_transfers/1.json
def update @breadcrumb = 'update' @inventory_transfer = InventoryTransfer.find(params[:id]) items_changed = false if params[:inventory_transfer][:inventory_transfer_items_attributes] params[:inventory_transfer][:inventory_transfer_items_attributes].values.each do |new_item| current_item = InventoryTransferItem.find(new_item[:id]) rescue nil if ((current_item.nil?) || (new_item[:_destroy] != "false") || ((current_item.product_id.to_i != new_item[:product_id].to_i) || (current_item.quantity.to_f != new_item[:quantity].to_f))) items_changed = true break end end end master_changed = false if ((params[:inventory_transfer][:transfer_date].to_date != @inventory_transfer.transfer_date) || (params[:inventory_transfer][:transfer_no].to_s != @inventory_transfer.transfer_no) || (params[:inventory_transfer][:remarks].to_s != @inventory_transfer.remarks) || (params[:inventory_transfer][:store_id].to_i != @inventory_transfer.store_id.to_i) || (params[:inventory_transfer][:company_id].to_i != @inventory_transfer.company_id.to_i) || (params[:inventory_transfer][:organization_id].to_i != @inventory_transfer.organization_id.to_i)) master_changed = true end respond_to do |format| if master_changed || items_changed @inventory_transfer.updated_by = current_user.id if !current_user.nil? if @inventory_transfer.update_attributes(params[:inventory_transfer]) format.html { redirect_to @inventory_transfer, notice: (crud_notice('updated', @inventory_transfer) + "#{undo_link(@inventory_transfer)}").html_safe } format.json { head :no_content } else @stores = stores_dropdown format.html { render action: "edit" } format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity } end else format.html { redirect_to @inventory_transfer } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @transfer.update(transfer_params)\n render :show, status: :ok, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def transfer\n @inventory_type = InventoryType.find_by_id(params[:id])\n @inventory =Inventory.find_by_id(params[:format])\n end", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n format.html { redirect_to @transfer, notice: 'Transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @transfer }\n else\n format.html { render :edit }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n format.html { redirect_to @transfer, notice: 'Transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @transfer }\n else\n format.html { render :edit }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n format.html { redirect_to accounts_path, notice: \"Transfer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @transfer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n format.html { redirect_to @transfer, notice: 'Transfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def inventory_transfer\n puts \"#{params}\".inspect\n @transfer = Transfer.create!(remark: params[:remark], transfer_item: params[:transfer_item], inventory_type_id: params[:transfer][:inventory_type_id]) \n @inventory_trans = Inventory.find(params[:inventory])\n @inventory_trans.update(:transfer_id => @transfer.id)\n @inventory = InventoryType.shod(params[:transfer][:id])\n trans(params[:inventory], params[:transfer][:id], @inventory)\n inventory_transfer2\nend", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n format.html { redirect_to @transfer, notice: 'Transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @transfer }\n else\n format.html { render :edit }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transfer = Transfer.find(params[:id])\n\n respond_to do |format|\n if @transfer.update_attributes(params[:transfer])\n format.html { redirect_to branch_path(@branch)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/%i' % [id])\n end", "def update\n @inventory = Accounting::Entry.take_inventory params[:item_id], @current_user.id, DateTime.parse(params[:date]), params[:amount]\n\n respond_to do |format|\n format.json { render json: @inventory }\n end\n end", "def update\n respond_to do |format|\n if @cartridge_transfer.update(cartridge_transfer_params)\n format.html { redirect_to @cartridge_transfer, notice: 'Cartridge transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @cartridge_transfer }\n else\n format.html { render :edit }\n format.json { render json: @cartridge_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def updateTransaction(state, id)\n parameters={state: state}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4050/transactions/\" + id.to_s , options) # put pending state\n return results\n end", "def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\n end", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n latest_transfer = Transfer.latest_transfer(@transfer.transferable_id, @transfer.transferable_type)\n if @transfer.transferable_type == \"Employee\" && @transfer.from_location != @transfer.transferable.branch\n @transfer.transferable.devices.update_all( status: \"instock\", status_date: Date.today )\n @transfer.transferable.device_assignments.where.not(unassign_date: nil).update_all(unassign_date: @transfer.transfer_date)\n end \n @transfer.transferable.update(branch_id: @transfer.to_location_id) if latest_transfer == @transfer\n format.html { redirect_to @transfer, notice: 'Transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @transfer }\n else\n set_resources\n format.html { render :edit }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @inventory = Inventory.find(params[:id])\n @inventory.subtotal = (params[:inventory][:qty].to_f*@inventory.unit_price) if params[:inventory][:qty].present?\n if @inventory.update_attributes(params[:inventory])\n @inventories = current_company.inventories\n response_message = {:message => \"Item was updated successfully.\", :inventory => @inventory}\n else\n response_message = {:message => \"Please try again\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{ render :json => response_message }\n end\n end", "def set_transfer\n @transfer = current_user.transfers.find(params[:id])\n end", "def update\n\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n @product = Product.find(Integer(params[:stock_transfer][:product]))\n @stock_location = StockLocation.find(Integer(params[:stock_transfer][:stock_location]))\n\n params[:stock_transfer][:product] = @product\n params[:stock_transfer][:stock_location] = @stock_location\n if @stock_transfer.update_attributes(params[:stock_transfer])\n format.html { redirect_to stock_transfers_path, notice: 'Stock transfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stock_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend", "def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def transfer_inventory(reason)\n packaging.product.transfers.create!(\n :detail => self,\n :happened_at => Time.zone.now,\n :quantity => (-1 * quantity * packaging.size),\n :reason => reason\n )\n end", "def transfer_params\n params.require(:transfer).permit(:date, :concept, :account_id, items: [:id])\n end", "def set_transfer\n @transfer = Transfer.find(params[:id])\n end", "def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['basket_total'] = basket_total\n params['basket'] = basket\n params['currency'] = currency\n params['notes'] = notes\n return doCurl(\"put\",\"/transaction\",params)\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def inventory_transfer2\n flash[:success] = \"Successfully Transfered\"\n redirect_to inventories_path\n end", "def update\r\n @stock_transfer = StockTransfer.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @stock_transfer.update_attributes(params[:stock_transfer])\r\n flash[:notice] = 'StockTransfer was successfully updated.'\r\n format.html { redirect_to(@stock_transfer) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @stock_transfer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if @transfer.save\n @transfer.transferable.update( branch_id: transfer_params[:to_location_id] )\n if @transfer.transferable_type == \"Employee\"\n @transfer.transferable.devices.update_all( status: \"instock\", status_date: Date.today )\n @transfer.transferable.device_assignments.update_all(unassign_date: @transfer.transfer_date)\n end \n format.html { redirect_to @transfer, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n set_resources\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @account_transfer.update(account_transfer_params)\n format.html { redirect_to @account_transfer, notice: 'Account transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_transfer }\n else\n format.html { render :edit }\n format.json { render json: @account_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stock_transfer_voucher = StockTransferVoucher.update_stock_transfer(params, @current_user, @financial_year.year.name)\n @products = Product.where(:company_id => @company.id, :inventory => true)\n @destination_warehouses = @company.warehouses\n respond_to do |format|\n if @stock_transfer_voucher.save_and_manage_stock(request.remote_ip)\n # @stock_transfer_voucher.register_user_action(request.remote_ip, 'updated')\n format.html { redirect_to @stock_transfer_voucher, :notice => 'Stock transfer voucher was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stock_transfer_voucher.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @take_inventory.update(take_inventory_params)\n format.html { redirect_to @take_inventory, notice: 'Take inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @take_inventory }\n else\n format.html { render :edit }\n format.json { render json: @take_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def trans(inventory, transfer_id, inventory_type)\n @inventory_log = InventoryLog.create!(inventory_type_id: params[:transfer][:id] )\n @inventory_update = Inventory.find(params[:inventory])\n @inventory_update.transfer.inventory_type.inventories.each do |i|\n if @inventory_update.part_no == i.part_no\n value = i.warehouse_stock_qty\n final = value.to_i - params[:transfer_item].to_i\n # stock = final + i.engineer_stock_qty.to_i\n i.update(warehouse_stock_qty: final) \n tot = final + i.engineer_stock_qty.to_i\n i.update(total_stock_qty: tot)\n end\n end\n @inventory.inventories.each do |f|\n if @inventory_update.part_no == f.part_no\n value = f.warehouse_stock_qty\n final = value.to_i + params[:transfer_item].to_i\n f.update(warehouse_stock_qty: final) \n tot = final + f.engineer_stock_qty.to_i\n f.update(total_stock_qty: tot)\n end\n end\n @inv = Inventory.create!(branch: @inventory_update.branch, part_no: @inventory_update.part_no, description: @inventory_update.description, warehouse_stock_qty: params[:transfer_item].to_i, transfered_stock_qty: params[:transfer_item].to_i, engineer_stock_qty: @inventory_update.engineer_stock_qty,location1: @inventory_update.location1,location2:@inventory_update.location2, location3: @inventory_update.location3,map: @inventory_update.map,total_stock_value: @inventory_update.total_stock_value,status: @inventory_update.status, latest_modify_date: @inventory_update.latest_modify_date,remark: @inventory_update.remark, inventory_type_id: @inventory.id, transfer_id: @transfer.id)\n total_stock_qty1 = @inv.warehouse_stock_qty.to_i + @inv.engineer_stock_qty.to_i\n @inv.update(total_stock_qty: total_stock_qty1 )\n\n end", "def create\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new(params[:inventory_transfer])\n @inventory_transfer.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @inventory_transfer.save\n format.html { redirect_to @inventory_transfer, notice: crud_notice('created', @inventory_transfer) }\n format.json { render json: @inventory_transfer, status: :created, location: @inventory_transfer }\n else\n @stores = stores_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_transfer_using_put_with_http_info(transfer, transfer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.update_transfer_using_put ...'\n end\n # verify the required parameter 'transfer' is set\n if @api_client.config.client_side_validation && transfer.nil?\n fail ArgumentError, \"Missing the required parameter 'transfer' when calling FundingApi.update_transfer_using_put\"\n end\n # verify the required parameter 'transfer_id' is set\n if @api_client.config.client_side_validation && transfer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'transfer_id' when calling FundingApi.update_transfer_using_put\"\n end\n # resource path\n local_var_path = '/transfer/{transfer_id}'.sub('{' + 'transfer_id' + '}', transfer_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(['*/*'])\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(transfer)\n auth_names = ['oauth2']\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 => 'ExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#update_transfer_using_put\\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 @transaction.update(transaction_params)\n format.html { redirect_to polymorphic_path([@source, :transactions]), notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer(amount,to,memo=nil)\n client.post(transaction_url,{:amount=>amount,:to=>to,:memo=>memo}) if client\n end", "def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transfer.update(transfer_params)\n format.html { redirect_to @transfer, notice: 'Transfer was successfully updated.' }\n else\n non_update_wallet params[:id]\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory_own.update(inventory_own_params)\n format.html { redirect_to @inventory_own }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_own.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to inventories_path, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cb = Coin.retrieve_from_api(transaction_params[\"CB_apikey\"])\n cs = Coin.retrieve_from_api(transaction_params[\"CS_apikey\"])\n\n respond_to do |format|\n if @transaction.update_values(transaction_params.merge(wallet_id: current_user.wallet.id, CBought_id: cb, CSold_id: cs))\n format.html { redirect_to @transaction, notice: \"Transaction was successfully updated.\" }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n if @stashed_inventory.update_attributes(params[:stashed_inventory])\n format.html { redirect_to @stashed_inventory, notice: 'Stashed inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stashed_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item_transaction = ItemTransaction.find(params[:id])\n\n respond_to do |format|\n if @item_transaction.update_attributes(params[:item_transaction])\n format.html { redirect_to @item_transaction, notice: 'Item transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def transfer(*args)\n commit 'MassPay', build_mass_pay_request(*args)\n end", "def set_transfer\n @transfer = current_user.transactions.find(params[:id])\n end", "def destroy\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n respond_to do |format|\n if @inventory_transfer.destroy\n format.html { redirect_to inventory_transfers_url,\n notice: (crud_notice('destroyed', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to inventory_transfers_url, alert: \"#{@inventory_transfer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n respond_to do |format|\n if @inventory_file.update_attributes(inventory_file_params)\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.inventory_file'))\n format.html { redirect_to(@inventory_file) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @inventory_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def transfer_params\n params.require(:transfer).permit(:transferable_id, :transferable_type, :from_location_id, :to_location_id, :transfer_date, :transferee_id)\n end", "def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, location: @transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @transfer = Transfer.new(transfer_params)\n @transfer = Transfer.new(transfer_params)\n @transferaccount = @transfer.transferaccounts.build\n @transferaccount.account_id = current_account.id\n \n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory_file.update(inventory_file_params)\n flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.inventory_file'))\n format.html { redirect_to(@inventory_file) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @repeating_transfer.attributes = repeating_transfer_params_no_amount\n @repeating_transfer.amount = currency_string_to_number(repeating_transfer_params_amount)\n set_repeat_period(@repeating_transfer, params[:repeating_transfer])\n set_end_type(@repeating_transfer, params[:repeating_transfer])\n\n reinitialize_next_occurrence(@repeating_transfer)\n\n if @repeating_transfer.save\n format.html { redirect_to repeating_transfers_path, notice: 'Repeating transfer was successfully updated.' }\n format.json { render :show, status: :ok, location: @repeating_transfer }\n else\n set_select_options\n format.html { render :edit }\n format.json { render json: @repeating_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mounted_inventory.update(params[:mounted_inventory])\n format.html { redirect_to @mounted_inventory, notice: 'A mounted inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mounted_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end", "def update\n @transaction = Transaction.find(params[:id])\n @item = Item.find(@transaction_item_id)\n @item.buyer_id=current_user.id\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # puts \"params: #{params.to_hash}\"\n return_order_items = JSON.parse(params[:order][:items]) \n\n # puts \"Params: #{return_order_items}\"\n\n @order = Order.find(params[:id])\n\n\n ActiveRecord::Base.transaction do\n return_order_items.each do |item|\n if params[:order].has_key?(:supplier) \n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.decrement!(:remaining_quantity, item[\"quantity\"].to_i)\n else\n @ordered_item = Item.find_by_id(item[\"id\"].to_i)\n @ordered_item.increment!(:remaining_quantity, item[\"quantity\"].to_i)\n end\n end\n\n @order.return = true\n if @order.save\n @current_user = current_user\n redirect_to :root, notice: 'Return Order was successfully created.'\n else\n render :new\n end\n end\n\n end", "def batch_change_inventory(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/inventory/batch-change'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def update\n respond_to do |format|\n if @item_inventory.update(item_inventory_params)\n format.html { redirect_to @item_inventory, notice: 'Item inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_inventory }\n else\n format.html { render :edit }\n format.json { render json: @item_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_hour_transfer = StudentHourTransfer.new(:student_from_id => params[:student_from_id], :student_to_id => params[:student_to_id], :hours_transferred => params[:student_hour_transfer][:hours_transferred])\n @student_hour_transfer.update_contracts(params[:student_to_id], params[:student_from_id], params[:student_hour_transfer][:hours_transferred].to_i)\n respond_to do |format|\n if @student_hour_transfer.save\n\n\n format.html { redirect_to @student_hour_transfer, notice: 'Student hour transfer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_hour_transfer }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_hour_transfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n @transaction.account.update_transactions\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end", "def update\n respond_to do |format|\n if @inventory_item.update(inventory_item_params)\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_item }\n else\n format.html { render :edit }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inventory_item.update(inventory_item_params)\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_item }\n else\n format.html { render :edit }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def transfer_params\n params.require(:transfer).permit(:bank_account_id, :stripe_token, :description, :name, :status)\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def update\n if !passed_correct_accounts?\n return render :nothing => true, :status => 400 #todo: should return something readable\n end\n if @transaction.update(transaction_params)\n head :no_content\n else\n render json: @transaction.errors, status: :unprocessable_entity\n end\n end", "def qbd_stock_transfer_to_transfer_inventory_xml(xml, stock_transfer_hash, match = nil, step)\n if match\n xml.TxnID match.fetch(:sync_id)\n xml.EditSequence match.fetch(:sync_alt_id)\n end\n\n xml.TxnDate stock_transfer_hash.fetch(:created_at).to_date.to_s\n if stock_transfer_hash.fetch(:number)\n xml.RefNumber stock_transfer_hash.fetch(:number)\n end\n xml.FromInventorySiteRef do\n source_location_hash = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: stock_transfer_hash.fetch(:source_location_id), integration_syncable_type: 'Spree::StockLocation')\n xml.ListID source_location_hash.try(:sync_id)\n end\n xml.ToInventorySiteRef do\n destination_location_hash = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: stock_transfer_hash.fetch(:destination_location_id), integration_syncable_type: 'Spree::StockLocation')\n xml.ListID destination_location_hash.try(:sync_id)\n end\n unless qbd_stock_memo(stock_transfer_hash).blank?\n xml.Memo qbd_stock_memo(stock_transfer_hash)\n end\n\n stock_transfer_hash.fetch(:destination_items, []).each do |line_item|\n variant_match = self.integration_item.integration_sync_matches.find_or_create_by(integration_syncable_id: line_item.fetch(:variant_id), integration_syncable_type: 'Spree::Variant')\n xml.TransferInventoryLineAdd do\n xml.ItemRef do\n xml.ListID variant_match.try(:sync_id)\n end\n # As of March 4, 2017 we cannot support sending row/bin locations\n xml.FromInventorySiteLocationRef do\n xml.ListID\n end\n xml.ToInventorySiteLocationRef do\n xml.ListID\n end\n xml.QuantityToTransfer line_item.fetch(:quantity)\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @reserve_inventory.update(inventory_params)\n format.html { redirect_to @reserve_inventory, notice: 'ReserveInventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserve_inventory }\n else\n format.html { render :edit }\n format.json { render json: @reserve_inventory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n if @inventoryitem.update_attributes(params[:inventoryitem])\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def handle_transfer(resp_body)\n params = {\n id: resp_body[:id],\n from: resp_body[:from],\n to: resp_body[:to],\n by: resp_body[:by],\n from_amount: Amount.new(\n currency: resp_body[:fromAmount][:currency],\n value: resp_body[:fromAmount][:value]\n ),\n to_amount: Amount.new(\n currency: resp_body[:fromAmount][:currency],\n value: resp_body[:fromAmount][:value]\n ),\n banking_id: resp_body[:banking_id],\n memo: resp_body[:memo],\n type: Utils.parse_enum(resp_body[:type]),\n status: Utils.parse_enum(resp_body[:status]),\n refund: Refund.new(resp_body[:refund]),\n created_at: Utils.parse_epoch(resp_body[:created])\n }\n TransferItem.new(@member_account, params)\n end", "def update\n respond_to do |format|\n if @fuel_transaction.update(fuel_transaction_params)\n format.html { redirect_to @fuel_transaction, notice: 'Fuel transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @fuel_transaction }\n else\n format.html { render :edit }\n format.json { render json: @fuel_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_pricing_transit.update(admin_pricing_transit_params)\n format.html { redirect_to admin_pricing_transits_path, notice: mk_notice(@admin_pricing_transit, :id, 'Transit', :update) }\n format.json { render json: @admin_pricing_transit, status: :ok, location: admin_pricing_transits_path }\n else\n format.html { render :edit }\n format.json { render json: @admin_pricing_transit.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6350137", "0.6251312", "0.6052473", "0.6032178", "0.6032178", "0.59995943", "0.598211", "0.59718794", "0.5969915", "0.5962237", "0.5900503", "0.585822", "0.5766852", "0.5763733", "0.57442325", "0.5732476", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5708102", "0.5693898", "0.568914", "0.5675849", "0.56723976", "0.56105274", "0.5600581", "0.5573066", "0.55720216", "0.556609", "0.55630654", "0.55531704", "0.5552584", "0.5550762", "0.5513953", "0.5510372", "0.55040467", "0.54691005", "0.54625857", "0.5445048", "0.544066", "0.54285836", "0.5425401", "0.54213387", "0.53962034", "0.5388529", "0.53790694", "0.5368091", "0.5360084", "0.5357544", "0.5347154", "0.534366", "0.53319806", "0.53297997", "0.53264797", "0.5325096", "0.53234625", "0.5315953", "0.5315639", "0.5315639", "0.5315639", "0.53149694", "0.52985454", "0.5297254", "0.5288969", "0.5279004", "0.5268118", "0.5266672", "0.5262773", "0.5251417", "0.5250063", "0.52489686", "0.52360195", "0.5232483", "0.5232058", "0.5229193", "0.5227706", "0.5226337", "0.52087563", "0.52007115", "0.5184232", "0.5184232", "0.5178954", "0.51763886", "0.5176089", "0.51724374", "0.5168916", "0.51668173", "0.51586884", "0.5153863", "0.5153724", "0.5146609", "0.51440465" ]
0.63090754
1
DELETE /inventory_transfers/1 DELETE /inventory_transfers/1.json
def destroy @inventory_transfer = InventoryTransfer.find(params[:id]) respond_to do |format| if @inventory_transfer.destroy format.html { redirect_to inventory_transfers_url, notice: (crud_notice('destroyed', @inventory_transfer) + "#{undo_link(@inventory_transfer)}").html_safe } format.json { head :no_content } else format.html { redirect_to inventory_transfers_url, alert: "#{@inventory_transfer.errors[:base].to_s}".gsub('["', '').gsub('"]', '') } format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer = Transfer.find(params[:id])\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @repeating_transfer.destroy\n respond_to do |format|\n format.html { redirect_to repeating_transfers_url, notice: 'Repeating transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: \"Transfer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n latest_transfer = Transfer.latest_transfer(@transfer.transferable_id, @transfer.transferable_type)\n @transfer.destroy\n @transfer.transferable.update(branch_id: @transfer.from_location_id) if latest_transfer == @transfer\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock_transfer = StockTransfer.find(params[:id])\n @stock_transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_transfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'transfer was successfully deleted.' }\n # format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @cartridge_transfer.destroy\n respond_to do |format|\n format.html { redirect_to cartridge_transfers_url, notice: 'Cartridge transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer.destroy\n end", "def destroy\n @account_transfer.destroy\n respond_to do |format|\n format.html { redirect_to account_transfers_url, notice: 'Account transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def destroy\n @logtransfer = Logtransfer.find(params[:id])\n @logtransfer.destroy\n\n respond_to do |format|\n format.html { redirect_to logtransfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_transaction = ClientTransaction.find(params[:id])\n @client_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to client_transactions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item_transaction = ItemTransaction.find(params[:id])\n @item_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to item_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transfer_product = TransferProduct.find(params[:id])\n @transfer_product.destroy\n\n respond_to do |format|\n format.html { redirect_to transfer_products_url }\n format.json { head :ok }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @transit.destroy\n respond_to do |format|\n format.html { redirect_to transits_url, notice: 'Transit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventoryitem = Inventoryitem.find(params[:id])\n @inventoryitem.destroy\n\n respond_to do |format|\n format.html { redirect_to inventoryitems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @part_transaction.destroy\n respond_to do |format|\n format.html { redirect_to part_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @daily_inventory = DailyInventory.find(params[:id])\n @daily_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_inventories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backup.destroy\n respond_to do |format|\n format.html { redirect_to backups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @server_ins_transaction = ServerInsTransaction.find(params[:id])\n @server_ins_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to server_ins_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @di_transaction = DiTransaction.find(params[:id])\n @di_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to di_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backup_file = BackupFile.find(params[:id])\n @backup_file.destroy\n\n respond_to do |format|\n format.html { redirect_to backup_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to item_transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @transit_chamber_io = TransitChamberIo.find(params[:id])\n @transit_chamber_io.destroy\n\n respond_to do |format|\n format.html { redirect_to transit_chamber_ios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @student_hour_transfer.destroy\n respond_to do |format|\n format.html { redirect_to student_hour_transfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @stock_transfer = StockTransfer.find(params[:id])\r\n @stock_transfer.destroy\r\n \r\n flash[:notice] = \"Stock Transfer successfully destroyed\"\r\n\r\n respond_to do |format|\r\n format.html { redirect_back_or_default(stock_transfers_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @fuel_transaction.destroy\n respond_to do |format|\n format.html { redirect_to fuel_transactions_url, notice: 'Fuel transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end", "def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory = Inventory.find(params[:id])\n @inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @clienttransaction.destroy\n respond_to do |format|\n format.html { redirect_to clienttransactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # Actually removing it from amazon if left as an exercise for the reader...\n # HINT: Amazon has many libs you can use to do this.\n @upload.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stats_money_transaction = Stats::MoneyTransaction.find(params[:id])\n @stats_money_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_money_transactions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(params[:budget_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @stock_transfer_voucher = @company.stock_transfer_vouchers.find(params[:id])\n @stock_transfer_voucher.destroy\n @stock_transfer_voucher.register_delete_action(request.remote_ip, @current_user, 'deleted')\n respond_to do |format|\n format.html { redirect_to stock_transfer_vouchers_url }\n format.json { head :ok }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @transferencia.destroy\n respond_to do |format|\n format.html { redirect_to transferencias_url, notice: 'Transferencia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rackitem = Rackitem.find(params[:id])\n @rackitem.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Rackitem removed' }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_status = InventoryStatus.find(params[:id])\n @inventory_status.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_statuses_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def destroy\n @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 @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\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 destroy\n @take_inventory.destroy\n respond_to do |format|\n format.html { redirect_to take_inventories_url, notice: 'Take inventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mounted_inventory.destroy\n respond_to do |format|\n format.html { redirect_to mounted_inventories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @received_item_and_qty = ReceivedItemAndQty.find(params[:id])\n @received_item_and_qty.destroy\n\n respond_to do |format|\n format.html { redirect_to received_item_and_qties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relay.destroy\n respond_to do |format|\n format.html { redirect_to relays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_item.destroy\n respond_to do |format|\n format.html { redirect_to backoffice_inventory_list_path, notice: 'Bem de patrimônio deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end" ]
[ "0.73116654", "0.7265549", "0.70849764", "0.706796", "0.70177186", "0.70177186", "0.70177186", "0.7011757", "0.70116967", "0.70042074", "0.7001087", "0.69125235", "0.68209743", "0.68209743", "0.6802214", "0.6794805", "0.67604595", "0.6696511", "0.6694881", "0.66807944", "0.6671871", "0.66456926", "0.6611252", "0.65881854", "0.6581305", "0.65629053", "0.6545434", "0.6524399", "0.652005", "0.6517682", "0.65085804", "0.650766", "0.6506941", "0.6504509", "0.6498884", "0.6495933", "0.64880157", "0.64880157", "0.64880157", "0.64880157", "0.64880157", "0.64880157", "0.64880157", "0.64873797", "0.64755964", "0.64755964", "0.64755964", "0.64755964", "0.64755964", "0.64755964", "0.64755964", "0.64755964", "0.64711654", "0.6469633", "0.6462094", "0.6458772", "0.6457785", "0.6456086", "0.6454772", "0.6453684", "0.6450634", "0.6436922", "0.6413425", "0.64132166", "0.6406001", "0.63988256", "0.63971686", "0.6395219", "0.63910747", "0.6383166", "0.6378803", "0.63781166", "0.6377843", "0.637731", "0.6376332", "0.63718736", "0.63652915", "0.63637733", "0.6362533", "0.63615435", "0.6359644", "0.63593566", "0.6356486", "0.63494563", "0.6348748", "0.6348379", "0.634599", "0.6344535", "0.63442653", "0.63405466", "0.6339357", "0.6336893", "0.6330422", "0.6329657", "0.6324582", "0.6324136", "0.632286", "0.63192284", "0.6318628", "0.63170147" ]
0.71249
2
Can't edit or delete when => User isn't administrator => Order is approved
def cannot_edit(_t) !session[:is_administrator] && !_t.approver_id.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cannot_edit(_order)\n !session[:is_administrator] && _order.id < 6\n end", "def cannot_edit(_order)\n !session[:is_administrator] && _order.id < 5\n end", "def cannot_edit(_order)\n !session[:is_administrator] && _order.id < 5\n end", "def can_he_edit?(order)\n (order.author?(current_user.id) && order.preparation?) ||\n special_access_for_cfo_or_treasurer?(order.state)\n end", "def set_order_and_authorize\n @order = Order.find(params[:id])\n if !(current_user.admin or current_user.is_provider) and current_user != @order.user\n render json: {\"error\":\"You are not authorized for this action\"}, :status => 401 and return\n end\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def admin\n if current_user.role == \"Admin\" || current_user.role == \"Staff\"\n \n else\n redirect_to \"/\"\n end\n @orders = Order.all\n end", "def show\n @order = Order.find(params[:id])\n if session[:user_permission] == 0 and @order.user.id != session[:user_id]\n redirect_to login_url, alert: \"Permission denied. Your are not an administrator.\"\n end\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def correct_user_or_admin\n user = TempOrder.find(params[:id]).user\n unless current_user?(user) || admin_user?\n flash[:danger] = \"Uncorrect user.\"\n redirect_to root_url\n end\n end", "def permit_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see all orders.'\n respond_to do |format| \n format.html {redirect_to(root_url)}\n end\n end\n end", "def edit\n if !(current_user.id == @user.id || is_admin?)\n indicate_illegal_request I18n.t('users.not-your-account')\n end\n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def correct_user_to_edit\n not_allow if (@job.user.id != current_user.id) \n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def can_edit_delete_update_problem\n\t\tunless current_user==Problem.find(params[:id]).creator || current_user.admin?\n\t\t\tflash[:danger] = \"You are not allowed to edit/delete this problem\"\n redirect_to root_path\n\t\tend\t\t\t\n\tend", "def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\n end\n end", "def authorizes_to_edit_user_admin_field?(user, options = {})\n user.admin? && user.id != options[:user_id]\n end", "def editable_by?(user)\n !shipped? && !delivered?\n end", "def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end", "def require_user_admin\n if !current_user.admin?\n flash[:danger] = \"Only admins can only edit brands and products\"\n redirect_to brands_path\n end\n end", "def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end", "def require_admin\n deny_wrong_user if !admin?\n end", "def enforce_is_admin_or_is_current_user\n bounce unless is_admin? or is_current_user?\n end", "def deletable_by?(user)\n resource.orders_count.zero? && (user.is_admin? || is_mill?(user))\n end", "def index\n\n if current_user.superadmin_role? \n @orders = Order.all.order(:id)\n else\n @orders = Order.where(\"user_id = ?\", current_user).or(Order.where(\"owner_id = ?\", current_user))\n end\n\n\n end", "def check_if_admin_of_trip\n trip_permission = Permission.where(user_id: current_user.id, trip_id: @trip.id).first\n admin_permission = Permission_type.find_by(permission: \"admin\").id\n\n redirect_to trips_url, notice: 'You are not admin of this trip!' unless (current_user.super_admin || trip_permission && trip_permission.permission_type_id == admin_permission)\n end", "def show\n authorize @order\n end", "def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end", "def require_same_user\n if current_user.id != @art_plan.user_id\n flash[:danger] = \"You can only edit or delete your own art project plan\"\n redirect_to art_plans_path\n end\n end", "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end", "def enforce_permissions\n bounce unless is_admin?\n end", "def order_owner\n\t\t\t@order = Order.find_by(id: params[:id])\n\t\t\tif !@order\n\t\t\t\tflash[:danger] = \"That page does not exist\"\n\t\t\t\tredirect_to(root_url) and return\n\t\t\tend\n\t\t\t@user = User.find_by(id: @order.user_id)\n\t\t\tif !@user\n\t\t\t\tflash[:danger] = \"That page does not exist\"\n\t\t\t\tredirect_to(root_url) and return\n\t\t\tend\n\n\t\t\tif !(current_user?(@user) || current_user.admin?)\n\t\t\t\tflash[:danger] = \"Must be owner to perform this action.\"\n\t\t\t\tredirect_to(root_url) and return\n\t\t\tend\n\t\tend", "def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end", "def enforce_delete_permissions\n enforce_edit_permissions\n end", "def admin_only\n false\n end", "def can_edit?\n return !@energy_usage.approved? || current_user.manager? \n end", "def user_permitted_to_edit(item)\n item.user == current_user \n end", "def edit\n@order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\nassociate_user\nend", "def can_delete?(user)\n self.user_id == user.id || user.admin?\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def update\n @order = Order.find(params[:id])\n redirect_to :action => \"index\" and return if current_admin.limited_sales_rep && !current_admin.users.include?(@order.user)\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to(admin_orders_url, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end", "def must_be_admin!\n access_denied! unless current_admin?\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def reauthorize\n @order.reauthorize\n end", "def can_edit?(obj)\n return true if obj.user_id == user_id || is_admin?\n false\n end", "def ensure_admin_user!\n redirect_to(item_templates_path, :alert => \"You may not perform this action on items!\") and return unless current_user.admin?\n end", "def require_same_user\n if current_user != @article.user && !current_user.admin\n flash[:alert] = \"You can only edit/delete from your own article listings\"\n redirect_to @article\n end\n end", "def update\n @order = Order.find(params[:id].to_s)\n render :status => 401 and return if not_my_vendor?(@order)\n if @order.paid == 1 and not $User.is_technician? then\n GlobalErrors.append(\"system.errors.cannot_edit_completed_order\",@order)\n end\n respond_to do |format|\n if (not @order.paid == 1 or $User.is_technician?) and @order.update_attributes(params[:order])\n format.html { redirect_to(@order, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_permitted?\n\t\tacting_user.administrator?\n\tend", "def company_edit_permitted?\n acting_user.administrator? || same_company\n end", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def require_admin_or_correct_user\n @user = User.find(params[:id])\n flash[:error] = \"Access Denied\"\n redirect_to(root_url) unless (current_user.id == @user.id || is_admin?)\n end", "def index\n authorize Order\n super\n end", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def is_allowed_to_edit?(person)\n if person.id == item_owner.id && status.eql?(\"pending_owner\")\n return true\n elsif person.id != item_owner.id && status.eql?(\"pending_reserver\")\n return true\n end\n return false \n end", "def show\n #here we find the other by its id.\n @order = Order.find(params[:id])\n #however we need to prevent users to access orders from other users, so we check id the found order\n # belongs to the logged users.\n unless @order.user.id == current_user.id\n #if not we display an error message and redirect to the \"manage account\" for the logged user.\n flash[:error] = 'Authorisation is required to access this content.'\n redirect_to user_path(current_user)\n end\n end", "def reseller_allow_edit(permission)\n return reseller_right(permission) == 2\n end", "def can_edit\n producer.admin?(user) || group_admin?\n end", "def can_edit?(user)\n (self.user == user) || !!(user && user.admin?)\n end", "def prevent_edit\n !can_edit?\n end", "def can_modify_shops?\n return self.admin_user? || self.vendor_user?\n end", "def require_same_user\n if current_user != @article.user && !current_user.admin?\n flash[:alert] = \"You can only edit or delete your own article\"\n redirect_to @article\n end\n end", "def require_permission_edit_or_update\n @project = Project.find(params[:project_id])\n @board = Board.find(params[:id])\n if @board.can_edit_users.where(:id => current_user.id).blank? && current_user.is_admin == false\n redirect_to project_path(@project), flash: { error: \"You do not have permission to do that.\" }\n end\n end", "def edit\n require_user\n end", "def can_edit_admin?\n return false unless is_admin? && !is_last_admin?\n true\n end", "def update?\n user.admin?\n end", "def edit\n @order = current_order(true)\n associate_user\n end", "def edit\n @order = current_order(true)\n associate_user\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end", "def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_admin)\n end", "def check_if_should_be_admin\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def edit\n @order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end", "def edit\n @order = current_order || Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end", "def require_same_user\n if current_user != @article.user && !current_user.admin\n flash[:alert] = \"You can only edit or delete your own article\"\n redirect_to @article\n end\n end", "def admin_required\n session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin\n end", "def can_edit_actuals?\n return false if order_detail.nil?\n complete?\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def edit\n enforce_update_permission(@user)\n end", "def user_can_delete?\n false\n end", "def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end", "def require_admin\n redirect_to(access_denied_path) unless current_user.is_admin_of?(@department)\n end", "def edit\n @order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n associate_user\n end", "def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end", "def canDelete?(user=current_user,owner=nil)\n return false if user.nil?\n #Rails.logger.debug(\"I got owner as #{owner.name} and user as #{user.name}\")\n return true if self.isAdmin?(user)\n false\n end", "def update\n if current_admin_user\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { respond_with_bip(@order) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@order) }\n end\n end\n elsif current_user\n if (@order.user_id) == (current_user.id)\n # only update this quote if it belongs to the signed in user\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { respond_with_bip(@order) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@order) }\n end\n end\n else\n redirect_to root_url, notice: \"The order you tried to edit does not belong to you.\"\n end\n else\n redirect_to root_url, notice: \"Sign in to your account to edit an order.\"\n end\n end", "def appctrl_ensure_is_owner\n model = controller_name.camelize.singularize.constantize # :-)\n @item = model.find( params[ :id ] )\n\n if ( @item.user_id != current_user.id )\n render_optional_error_file( 401 ) unless current_user.is_admin?\n end\n end", "def admin_user\n redirect_to(items_path) unless current_user.admin?\n end", "def authorize_as_admin\n if current_user.nil?\n head :unauthorized\n elsif !current_user.is_admin?\n render json: { status: 200, msg: 'You do not have permission to delete this!!!' }\n end\n end", "def admin_barrier\n unless admin_access? || logged_in? && current_user == @user\n flash[:alert] = \"You must have admin access to do that.\"\n redirect_to :back\n end\n end", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end", "def user_editable\n if current_user.admin?\n @deal = Deal.find_by(id: params[:id])\n flash[:danger] = \"No existe ese deal\" if @deal.nil?\n else\n if not @deal = current_user.deals.find_by(id: params[:id]) || current_user.codeals.find_by(id: params[:id])\n if deal = Deal.find_by(id: params[:id])\n redirect_to deal and return\n end\n end\n end\n redirect_to root_url if @deal.nil?\n end" ]
[ "0.7708062", "0.7638661", "0.7638661", "0.7225274", "0.7162144", "0.69690233", "0.6862006", "0.6835654", "0.6830246", "0.6830246", "0.6830246", "0.68287635", "0.6826739", "0.67889136", "0.67797774", "0.6768428", "0.6711885", "0.6693438", "0.6679539", "0.66417086", "0.66377753", "0.6629809", "0.6616039", "0.6615555", "0.65817434", "0.65788555", "0.656427", "0.6550793", "0.653759", "0.65308213", "0.65280795", "0.65252036", "0.6521313", "0.6500556", "0.6489463", "0.6480349", "0.64686126", "0.64673597", "0.64621645", "0.6461801", "0.6459434", "0.64493203", "0.6449094", "0.6443512", "0.6443339", "0.64431673", "0.6443029", "0.6436296", "0.64343774", "0.6420821", "0.6418552", "0.641747", "0.64113134", "0.6402604", "0.63939756", "0.6390223", "0.63827246", "0.63809484", "0.6377976", "0.6374272", "0.6373098", "0.6367618", "0.6339986", "0.6319805", "0.6317855", "0.63154787", "0.6308861", "0.6304743", "0.6301514", "0.62930596", "0.62928605", "0.6292084", "0.628902", "0.628902", "0.6286827", "0.6285598", "0.62849313", "0.62832576", "0.62774473", "0.6275053", "0.6275053", "0.6271784", "0.62706506", "0.6267398", "0.6265108", "0.6265108", "0.62612784", "0.6257668", "0.62558", "0.6251411", "0.6245187", "0.62446475", "0.62356013", "0.62331283", "0.623268", "0.6225103", "0.6217422", "0.6217218", "0.62158567", "0.621465" ]
0.67904055
13
Returns _array from _ret table/model filled with _id attribute
def ret_array(_array, _ret, _id) if !_ret.nil? _ret.each do |_r| _array = _array << _r.read_attribute(_id) unless _array.include? _r.read_attribute(_id) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_a\n fetch(ids)\n end", "def to_a\n fetch(ids)\n end", "def ids\n pluck(:id)\n end", "def table_array\r\n @table_array\r\n end", "def load_carrier_array\n @carrier_array = Carrier.all.order(carrier_name: :asc).map { |carrier_array| [carrier_array.carrier_name, carrier_array.id]}\nend", "def collection_to_id_array(col)\n ids = Array.new\n col.each do |i|\n ids << i.id\n end\n ids\n end", "def to_a\n #convert to array\n [@id, @name, @address, @city, @county, @state, @zip]\n end", "def index\n @vehicles = Vehicle.all\n\n id = Vehicle.pluck(:api_id) # integer array\n\n \n end", "def id\n if primary_key.is_a?(Array)\n id = Array.new\n primary_key.each do |key|\n sub_id = self.send(key)\n return nil if (id == \"\")\n id << sub_id\n end\n else\n id = self.send(self.class.primary_key)\n return nil if (id == \"\")\n end\n return id\n end", "def fields\n [:id]\n end", "def to_a\n deserialize(find)\n end", "def to_a\n data.all\n end", "def normalize_result(ar_res)\n res = []\n ar_res.each do |r|\n c = []\n columns.each do |col| \n if r.attributes[col[:id]] then\n c << r.send(col[:id].intern)\n else\n c << ''\n end\n end\n res << c\n end\n res\n end", "def trail_users_id_array\n # trail = Trail.find(:id)\n self.users.map do |x| \n x.id \n end \n end", "def get_ids(table)\r\n valid_ids = []\r\n table_info = @db.execute(\"SELECT * FROM #{table}\")\r\n table_info.each do |line|\r\n line_info = []\r\n line.each do |name, value|\r\n if name == 'id'\r\n valid_ids << value\r\n end\r\n end\r\n end\r\n valid_ids\r\n end", "def lasids\n render json: Student.pluck(:local_id)\n end", "def fetch_curr_table\n Array.new\n end", "def id; self['_id']; end", "def rows\n @array\n end", "def marshal_dump()\n\t\treturn [@grid, @id]\n\tend", "def fetch_reference_ids(table, row)\n attributes = {}\n table.reference_columns.each do |c|\n new_id = nil\n if row[c.name.to_s].is_a?(Array)\n new_id = []\n row[c.name.to_s].each do |old_id|\n new_id << no_sql_connection.get_id_using_pre_mongified_id(c.references.to_s, old_id)\n end\n else\n new_id = no_sql_connection.get_id_using_pre_mongified_id(c.references.to_s, row[c.name.to_s])\n end\n attributes.merge!(c.name => new_id) unless new_id.nil?\n end\n attributes\n end", "def index\n @ids = Id.all\n end", "def load_po_array\n @po_array = PurchaseOrder.where(\"remaining_weight_lbs > ?\",100 ).order(po_nbr: :asc).map { |po_array| [po_array.po_nbr, po_array.id] }\nend", "def initial_data\n @query_tracker.results.map.with_index do |data, index|\n data = data.dup\n data['_id'] = data['_id'].to_s\n [index, data]\n end\n end", "def results\n @scope.where(@scope.primary_key => @ids).to_a\n end", "def array_id\n @array_id = @array_id.next\n @array_id\n end", "def fetch_all\n self.to_a\n end", "def getify_array(array_of_records)\n return array_of_records.map{|r| r.get}\n end", "def rows\n Array.new self\n end", "def ids\n primary_key_array = Array(primary_key)\n\n if loaded?\n result = records.map do |record|\n if primary_key_array.one?\n record._read_attribute(primary_key_array.first)\n else\n primary_key_array.map { |column| record._read_attribute(column) }\n end\n end\n return @async ? Promise::Complete.new(result) : result\n end\n\n if has_include?(primary_key)\n relation = apply_join_dependency.group(*primary_key_array)\n return relation.ids\n end\n\n columns = arel_columns(primary_key_array)\n relation = spawn\n relation.select_values = columns\n\n result = if relation.where_clause.contradiction?\n ActiveRecord::Result.empty\n else\n skip_query_cache_if_necessary do\n klass.connection.select_all(relation, \"#{klass.name} Ids\", async: @async)\n end\n end\n\n result.then { |result| type_cast_pluck_values(result, columns) }\n end", "def to_a\n @table.values\n end", "def id\n @attributes[:_id]\n end", "def load(attributes)\n if attributes.is_a?(Array)\n records = attributes.clone\n attributes = {}\n id = nil\n if records.length >= 1\n records.each_with_index do |rec, i|\n # The \"actual\" id is the 1st\n id = rec[\"id\"] if i == 0 && rec[\"id\"].to_i > 0\n attributes.merge!(rec)\n end\n attributes[\"id\"] = id || attributes[\"id\"]\n end\n end\n super(attributes)\n end", "def all_ids\n db.transaction(true) do |db|\n extract_model_ids(db)\n end\n end", "def omim_ids\n @table.keys\n end", "def get_model_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Person.from_hash(element) }\n end", "def to_a\n records\n end", "def id\n return self[:id]\n end", "def extract_id_line model_attributes, line,item,dtypes\n #look if id is mapped to another field\n id_keys = model_attributes.to_hash.keys\n #hotfix..bad performance\n id_keys.map!{|k| k.to_s }\n id_key= id_keys.select{|k| k =~/^(ID|id|iD|Id)$/ }\n if id_key.empty?\n line[:id] = item.id\n else\n line[:id] = eval(\"item.#{model_attributes[id_key[0].to_sym]}\")\n #set the correct datatype for it\n dtypes[\"id\"]= dtypes[id_key[0]]\n #remove the id line\n line.delete id_key[0]\n end\n end", "def libraries_id_array\n staff_member_library_ids = []\n self.library.each do |l|\n staff_member_library_ids << l.id\n end\n staff_member_library_ids\n end", "def to_a\n [@id, @is_tootor, @username, @seo_name, @email, @password,\n @name, @phone, @price, @street, @city, @state,\n @zip, @focus, @description, @picture, @video,\n @created_at, @updated_at, @visited_at]\n end", "def to_a\n return @records if loaded?\n\n load\n end", "def to_ary\n [\"#{id}: #{description}\", @raw_data]\n end", "def results\n Opinion.where(id: super.pluck(:id))\n end", "def initialize\n self.ids = [] # on object creation initialize this to an array\nend", "def initialize\n self.ids = [] # on object creation initialize this to an array\nend", "def normalize_id(a)\n case a\n when Integer\n a\n when Array\n a.map{ |e| normalize_id(e) }\n else\n normalize(a).id\n end\n end", "def to_a\n @table.columns.map { |col| @attributes[col] }\n end", "def ids\n @ids ||= []\n end", "def id\n @data['id']\n end", "def to_h\n {\n id: @id\n }\n end", "def attributes\n {id: id, ids: ids, type: type, owner_id: owner_id}\n end", "def all\n db.transaction(true) do\n ids = extract_model_ids(db)\n ids.map { |key| db[key] }\n end\n end", "def id\n self[:id]\n end", "def id\n attributes[:id] \n end", "def id\n attributes.fetch(:id)\n end", "def id\n attributes.fetch(:id)\n end", "def id\n attributes.fetch(:id)\n end", "def to_r()\n #This is a stub, used for indexing\n end", "def row_for_record\n raise IdMissing.new(\"You must set an ID before save.\") if record.id.blank?\n\n MassiveRecord::Wrapper::Row.new({\n :id => record.id,\n :table => klass.table\n })\n end", "def id\n @attributes[:ID]\n end", "def create_drivers(arr_id)\n result = arr_id.map do |item|\n {id:item, rides:[]}\n end\n return result\nend", "def id\n self['id']\n end", "def id\n self['id']\n end", "def id\n @result['_id']\n end", "def get_patient\n @patient = Patient.pluck(:id,:name)\n render json: @patient\n end", "def to_a\n @rows\n end", "def getId\n @id\n end", "def to_a\n column_names = [@query.klass.primary_key] | connect_by_columns\n column_names.map { |name| @query.table[name] }\n end", "def hash\n\t\t[@id].hash\n\tend", "def extract_ids\n # no-op\n end", "def result\n Valkyrie::ID.new(value[:id])\n end", "def ids_getter(name, metadata)\n ids_method = \"#{name.to_s.singularize}_ids\"\n re_define_method(ids_method) do\n send(name).only(:id).map(&:id)\n end\n self\n end", "def find_books\n sql = \"SELECT * FROM books WHERE source_language_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n books_array = results.map{|book| Book.new(book)}\n return books_array\n end", "def row_for_id(id)\n rows_for_ids(id)\n end", "def id\n data[:id]\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 lasids\n render json: Student.all.pluck(:local_id) # not just active students\n end", "def record_to_array(r, attrs)\n []\n end", "def array\n self.allObjects\n end", "def rows\n @rows\n end", "def load_rail_car_array\n @rail_car_array = RailCar.where(car_empty: false).order(railcar_nbr: :asc) .map { |rail_car_array| [rail_car_array.railcar_nbr]}\nend", "def to_array\n [@name, @college_id]\n end", "def rows \n @r\n end", "def select_arr\n result = []\n result.push \"#{groups.first.parent_table}_0_fk.year\" # Manually add the year of the survey\n # for each group\n groups.each_with_index do |group, idx|\n group_alias = \"#{group.parent_table}_#{idx}\" # Calculate the group alias for this table\n # all questions for this group\n questions = questions_for_group(group).uniq{|question|question.attribute_name}\n questions.each do |question|\n col_name = \"#{group_alias}_fk.#{question.attribute_name}\" #\n result.push col_name\n end\n end\n return result\n end", "def id\n @obj['id']\n end", "def marshal_load(array)\n\t\t@grid, @id = array\n\t\treturn self\n\tend", "def pk\n raise(Error, \"No primary key is associated with this model\") unless key = primary_key\n case key\n when Array\n key.collect{|k| @values[k]}\n else\n @values[key]\n end\n end", "def yale_nd_row_as_array i\n yale_nd_row(i, :array)\n end", "def read(id)\n sql = \"SELECT * FROM #{table_name} WHERE \"\n sql += Database.quote_identifier(@primary_key.name)\n sql += \" = \"\n sql += Database.quote_value(id, @primary_key.type)\n sql += \" LIMIT 1\"\n\n result = Database.execute(sql)\n\n if result.cmd_tuples == 0\n return nil\n else\n new_model = self.new({})\n result[0].each do |key, value|\n new_model.send(key + '=', value, true)\n end\n new_model.attributes.each { |attr| attr.reset }\n new_model\n end\n end", "def id\n @id\n end", "def get_sighting_records(db)\r\n\r\n sighting_records = db.query(\"select * from sighting_details order by id\")\r\n\r\n return sighting_records.to_a\r\n\r\nend", "def get_items\r\n @arr.to_a\r\n end", "def return_ids(id)\n array = Array.new\n array.push(id)\n subprojects = subProjects(id)\n subprojects.each do |project|\n array.push(return_ids(project.id))\n end\n\n return array.inspect.gsub(\"[\",\"\").gsub(\"]\",\"\").gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\")\n end", "def id\n @id\n end", "def id\n @id\n end" ]
[ "0.6833078", "0.6833078", "0.62377036", "0.62372637", "0.61977595", "0.61723673", "0.6119777", "0.6097811", "0.60205245", "0.59768695", "0.59308535", "0.59194744", "0.5903594", "0.58824724", "0.5878954", "0.5869129", "0.5814632", "0.58134425", "0.5813334", "0.5785949", "0.5763582", "0.5759759", "0.57575524", "0.5749272", "0.5746717", "0.5706901", "0.56902504", "0.56763417", "0.5674292", "0.5657372", "0.5654353", "0.5651866", "0.56494236", "0.5637458", "0.56348795", "0.5634598", "0.5622641", "0.5618083", "0.56096756", "0.56087905", "0.559957", "0.55907637", "0.5589596", "0.55851954", "0.558278", "0.558278", "0.5581409", "0.55704224", "0.55551094", "0.55531955", "0.554862", "0.55482227", "0.5534129", "0.5529226", "0.552318", "0.5520705", "0.5520705", "0.5520705", "0.5517134", "0.55140716", "0.55073386", "0.5504905", "0.5504871", "0.5504871", "0.5503547", "0.5503285", "0.5499236", "0.54980534", "0.54971075", "0.5490804", "0.549018", "0.54875845", "0.5474931", "0.5474622", "0.54621637", "0.5457315", "0.5455282", "0.5455282", "0.5451768", "0.5446048", "0.5435121", "0.5434274", "0.54305714", "0.5426136", "0.54219174", "0.5417533", "0.54037505", "0.54027283", "0.54014176", "0.54001975", "0.53987753", "0.53933316", "0.5393082", "0.53886193", "0.5387418", "0.5386877", "0.5386877" ]
0.61435044
8
Check if store is multioffice, and setup approver based on that
def multioffice_store_approver(ivar, current_user_id) is_multioffice_approver = false table = ivar.class.table_name store_offices = StoreOffice.where(store_id: ivar.store_id) if !store_offices.blank? store_offices.each do |o| notifications = o.office.office_notifications.joins(:notification).where('notifications.table = ? AND office_notifications.role = ? AND office_notifications.user_id = ?', table, 1, current_user_id) rescue nil if !notifications.blank? is_multioffice_approver = true break end end end is_multioffice_approver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_approver\n if approver == \"1\"\n document.approver = user\n document.save!\n end\n end", "def need_details?\r\n admin? || purchasing? || popv_admin?\r\n end", "def allow_multi_install\n refresh\n @allow_multi_install\n end", "def provided_store_details?(merchant)\n store = Store.find_by(merchant_id: merchant.id)\n store\n\tend", "def approve_setup_fee_collection( current_user )\n self.is_setup_fee_collection_approved = true \n self.setup_fee_collection_approver_id = current_user.id \n self.save\n \n # create all those payment payable : loan disbursement \n end", "def attach_to_publishers user\n #self.publisher_id\n return nil unless self.user\n\n if user.personal_publishing_status == \"I have an exclusive publisher\" || \n user.personal_publishing_status == \"I own and control my own publishing\"\n self.publisher_id = user.personal_publisher_id\n self.save(validate: false)\n attach_to_publishing_agreement\n else\n ap 'something fancy here'\n end \n end", "def isUserStoreManagerOf(user, store) \n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse \n\t \t\t\t\treturn user.has_role? :storemanager, store\n\t \t\t\tend\n\t \t\tend", "def should_check_user_store(user)\n if !user.store? and user.should_be_store?\n user.update(store: true)\n else\n # noop\n end\n rescue Exception => e\n end", "def can_modify_shops?\n return self.admin_user? || self.vendor_user?\n end", "def set_store\n @store = current_user.stores.find_by_id(params[:id]) ||\n Store.find_by_id_and_organization_id!(\n params[:id],\n current_user.organizations.map(&:id)\n )\n end", "def show?\n user.super_admin? or user.digital_store_admin?\n end", "def decide\n @site = current_account.sites.find_or_initialize_by_url(checkid_request.trust_root)\n @site.persona = current_account.personas.find(params[:persona_id] || :first) if sreg_request || ax_store_request || ax_fetch_request\n end", "def setup_branch_store(store)\n corporate = store.store\n\n store.plan_id = corporate.plan_id\n store.currency = corporate.currency\n store.franchise_id = corporate.franchise_id\n end", "def is_store?(product)\r\n return false unless product\r\n return false if @cobrand.short_name == \"viewpoints\"\r\n store_type = product.get_answer_value('Sears or Kmart')\r\n product.category.name == 'Department Stores' and (store_type == 'Sears' or store_type == 'Kmart')\r\n end", "def canManageStore(user, store)\n\t \t\t\t\n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif isUserStoreManagerOf(user,store) || isUserStoreOwnerOf(user,store) || user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend", "def is_approver?(user)\n\n self.users.include?(user)\n\n end", "def primary_approvers=(value)\n @primary_approvers = value\n end", "def can_approve?(target)\n is_staff? && target && target.active? && !target.approved?\n end", "def approvable?(obj)\n \tif is_pending?(obj.release_status)\n \t\tif is_section_head?\n \t\t\tif obj.uploader_role == 'Normal' && uploader_from_same_section(obj.uploaded_by_section)\n \t\t\t\ttrue\n \t\t\tend\n \t\telsif is_department_head?\n \t\t\tif obj.uploader_role == 'Sectionhead'\n \t\t\t\ttrue\n \t\t\tend\n \t\tend\n \tend\n end", "def initializeApprovalAndLDAP(emailConf, prod)\n @ldap = ldap_storage\n ApprovalEngine.init(@ldap, nil, !prod)\nend", "def create?\n admin.expert? or admin.vip? or admin.root?\n end", "def set_admin_promo\n @admin_promo = Admin::Promo.find(params[:id])\n @admin_promo.update(approval: false) unless @admin_promo.is_expired\n end", "def application_type\n user_is_pro? ? \"store\" : \"user\"\n end", "def user_is_store_owner?\n (user_signed_in? && current_user.is_store_owner?)\n end", "def user_is_pro?\n @user_is_pro ||= (user_is_store_owner? || pro_page?)\n end", "def can_be_officer?\n self.degree.to_sym == :master_mason\n end", "def check_change_principle\n user_has_packages? || user_first_order? ? true : false\n end", "def force_approvers(emails)\n individuals = emails.map do |email|\n user = User.for_email(email)\n user.update!(client_slug: \"ncr\")\n # Reuse existing approvals, if present\n proposal.existing_approval_for(user) || Steps::Approval.new(user: user)\n end\n proposal.root_step = Steps::Serial.new(child_approvals: individuals)\n end", "def store_admin?\n\n\t\tself.has_role? :store_admin\n\n\tend", "def approve_initial_requirements?\n approve_step?('#2')\n end", "def approve_initial_requirements?\n approve_step?('#2')\n end", "def DispatchManager?\n\t\tif KitchenUser.find(session[:kitchen_user_id]).role.name ==\"Dispatch Manager\" \n true\n end\n\tend", "def promo_offer?\n promotional_offer_id.present?\n end", "def set_store\n @store = Store.find(params[:store_id]) if params[:store_id]\n end", "def is_seller?\n self.paypal_id.present? && self.stripe_token.present?\n end", "def multiple_items?\n self.frontend == :shopcart\n end", "def approve_store_app(uid)\n Store.unlock.where(uid: uid)\n end", "def must_carry_mens_or_womens_apparel\n errors.add(:base, \"Store must carry either women's or men's apparel.\") if (!mens_apparel && !womens_apparel)\n end", "def merchant?\n self.user_type == 'Merchant'\n end", "def isStoreManager(user) \t \t\t\t\n\t \t\t\tif user.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\t# returns all stores that this user is a storemanager of\n\t \t\t\t\tstores = Store.with_role(:storemanager, user)\t \t\t\t\t\n\t \t\t\t\t\n\t \t\t\t\tif stores.empty? #returns empty array, not nil\n\t \t\t\t\t\treturn false\n\t \t\t\t\telse \n\t \t\t\t\t\treturn true\n\t \t\t\t\tend\n\t \t\t\tend\n\t \t\tend", "def approve_initial_requirements?\n approve_step?('#3')\n end", "def approve_initial_requirements?\n approve_step?('#3')\n end", "def approve_initial_requirements?\n approve_step?('#3')\n end", "def check_if_approval_is_required\n check_by_families || check_by_supplier || check_by_project ||\n check_by_office || check_by_company || check_by_zone\n end", "def show\n @seller = Seller.find_by(id: @product.seller_id)\n\n if @usertype == \"Admin\" or @usertype == \"Seller\"\n @permission = true\n else\n @permission = false\n end\n\n end", "def set_approver!(_ctx, user:, performer:, **)\n user.update!(approver_id: performer)\n end", "def require_store_number?\n !!(self.registered_download.require_store_number?)\n end", "def is_authorized_to_edit_locations_of store\n store = store.id if store.is_a? Store\n return true if is_authorized_to_create_locations_of(store)\n @a = Authorization.find_by_target_id_and_target_type_and_user_id(store, 'Store', id) && [1,2].include?(@a.authorization_type)\n end", "def sepa\n mandate = @user.mandates.last\n if mandate.present? && mandate.ready?\n redirect_to_for_user_or_admin and return\n end\n redirect_to mandate.slimpay_approval_url and return if mandate && mandate.waiting?\n mandate = Mandate.sign(@user)\n if mandate.present?\n redirect_to mandate.slimpay_approval_url\n else\n redirect_to_for_user_or_admin(true)\n end\n end", "def set_product\n @product = Product.find(params[:id])\n if not current_user.admin and not @product.provider != current_user.provider\n return\n end\n end", "def transfer_applicant?\n appl_type == \"2\" || appl_type == \"4\"\n end", "def primary_approvers\n return @primary_approvers\n end", "def manage_brandreach?\n user.admin? || user.super_admin?\n end", "def store_in_vault\n preferred_paypal_flow == 'vault'\n end", "def check_if_approval_is_required\n !offer_request.blank?\n end", "def set_storepromotion\n @storepromotion = Storepromotion.friendly.find(params[:id])\n end", "def update?\n user.role == \"Manager\" || user.role == \"Newcomer\"\n end", "def chargeable? listing\n listing.seller?(@user) && listing.new? \n end", "def partner_admin?\n admin? && agencies.any? { |a| a.partner? }\n end", "def require_same_organizer\n if current_organizer != @event.organizer and !current_organizer.admin?\n flash[:danger] = \"You can only edit or delete your own events\"\n redirect_to root_path\n end \n end", "def may_edit? (workitem)\n (is_admin? or\n workitem.store_name == self.login or\n self.group_names.include?(workitem.store_name))\n end", "def pending_swap_manager_approval?\n @is_pending_swap_manager_approval\n end", "def correct_customer_or_manager_user\n @customer = Customer.find(params[:id])\n if current_customer && current_customer?(@customer)\n # Do Nothing\n elsif current_user && current_user.manager?\n # Do Nothing\n else\n redirect_to(root_url)\n end\n end", "def partner_staff?\n staff? && agencies.any? { |a| a.partner? }\n end", "def is_admin?\n has_appt? || is_completed?\n end", "def employs?(user)\n employees.include?(user) or (affiliate == user) or user.admin?\n end", "def assign_company_and_set_passenger\n self.type= 'Passenger'\n if self.email\n domain = self.email.split('@')[1]\n company = Company.find_or_initialize_by(domain: domain)\n if company.new_record?\n logger.debug 'creating company with '+domain\n company.name= domain\n company.address= 'unknown'\n end\n self.company = company\n self.default_office = company.offices.first if self.default_office.nil?\n else\n false\n end\n end", "def guest?(store)\n group(store).nil? && !has_cached_role?(:superuser)\n end", "def set_approval\n self.sanctuary? ? self.approved = false : self.approved = true\n end", "def approvable?\n (!current_stage.nil? &&\n current_stage.stage.eql?('verify') &&\n current_stage.status.eql?('passed') &&\n !AutomateSoup.url.nil? &&\n !AutomateSoup.credentials.nil? &&\n !links.nil? &&\n !links['approve'].nil? &&\n !links['approve']['href'].nil?)\n end", "def is_authorized_to_create_locations_of store\n store = store.id if store.is_a? Store\n return true if authorized_to_authorize(Store.find(store))\n Authorization.find_by_authorization_type_and_target_id_and_target_type_and_user_id(1, store, 'Store', id)\n end", "def update?\r\n admin? or own? or invited?\r\n end", "def admin_or_staff?\n admin? || staff?\n end", "def admin?\n self.credentials[:master] or self.credentials[:admin]\n end", "def correct_producer\n redirect_to(root_url) unless current_user?(@producer)\n end", "def escalate_approval\n if !self.user.manager_id.nil?\n if self.manager.manager_id.nil?\n self.auto_approve()\n else\n UserMailer.escalate_approval_email(self).deliver\n self.is_escalated = true\n self.save\n end\n end\n end", "def set_admin_store\n @admin_store = Store.find(params[:id])\n end", "def show?\n user_is_owner_or_admin? || user_is_professional?\n end", "def authorized_to_authorize store_or_location\n if store_or_location.is_a? Store\n id == store_or_location.user_id\n elsif store_or_location.is_a? Location\n id == store_or_location.user_id || id == store_or_location.store.user_id\n else\n raise TypeError\n end\n end", "def has_expertise?\n self.primary_expertise || self.secondary_expertise || self.tertiary_expertise\n end", "def payments?\n user_record? || payment_admin? || super_admin?\n end", "def before_save_goal\n\t\t# \n\t\tif self.current_user_role == 'sm'\n\t\t\traise \"Super Manager don't need goal\"\n\t end\n\tend", "def add_approver\n\n # get the client\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get approvers not already assigned to the contract\n @approvers = @client.unassigned_approvers_for_contract(@contract)\n\n end", "def can_change_tom?\n self.active? or self.provisional?\n end", "def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend", "def show\n # @store_details =StoreDetailPolicy.new(current_user, @store_detail).new?\n # @store_detail = StoreDetail.find(params[:id])\n #authorize @store_detail, :show?\n end", "def set_rules!(params)\n # implement the rules parent has set while manually approving the purchase\n # params should contain a normal hash and for that \n end", "def multi_appointment_receipt_allowed?() # We must validate record existance (for AS security layer):\n return false unless existing_record_check? # (current record instance could be empty or new)\n # Existing records must be checked for this also:\n ( Appointment.find_all_unpayed_for_patient( self.id ).size > 0 )\n end", "def check_if_needs_approval\r\n self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin\r\n end", "def staff?\n admin || moderator\n end", "def isUserStoreOwnerOf(user, store)\n\t \t\t\tif user.nil? || store.nil?\n\t \t\t\t\treturn false\n\t \t\t\telse\n\t \t\t\t\treturn user.has_role? :storeowner, store\n\t \t\t\tend\n\t \t\tend", "def approve?\n return false if user.blank?\n\n role = user.dominant_role\n\n return false unless record.in?(role.donations)\n\n latest_approval = record.approvals.order(:created_at).last\n\n if latest_approval.present?\n case latest_approval.approver\n when NationalFinanceHead then\n false\n when Fellow then\n role.is_a?(NationalFinanceHead)\n when Coach then\n role.class.in?([NationalFinanceHead, Fellow])\n else\n role.class.in?([NationalFinanceHead, Fellow, Coach])\n end\n else\n role.class.in?([NationalFinanceHead, Fellow, Coach])\n end\n end", "def active_for_authentication? \n super && (approved? || self.admin) \n end", "def fallback_primary_approvers=(value)\n @fallback_primary_approvers = value\n end", "def setup_review_requirements(r)\r\n apid = if r.user\r\n if r.user.affiliate_user && r.user.affiliate_user.affiliate_program\r\n # XXX KML TODO : need to determine if this user has completed the program, if so, then nil\r\n r.user.affiliate_user.affiliate_program.id\r\n end\r\n else\r\n cookies[:affiliate_program_id]\r\n end\r\n @review.requirements = ReviewRequirement.find_by_affiliate_program_id apid\r\n end", "def is_manual?\n payment_kind == 'manual'\n end", "def manage?\n admin?\n end", "def deliver_store_owner_order_notification_email?\n store.new_order_notifications_email.present? && !store_owner_notification_delivered?\n end", "def offerer?(person)\n (share_type.is_offer? && author.eql?(person)) || (share_type.is_request? && !author.eql?(person))\n end", "def carry_atleast_men_women_apparel\n if mens_apparel == false && womens_apparel == false\n errors.add(:mens_apparel, \"The store must carry at least one mens/womens apparel.\")\n errors.add(:womens_apparel, \"The store must carry at least one mens/womens apparel.\")\n end\n end" ]
[ "0.5939376", "0.5784085", "0.57209754", "0.5718327", "0.5656137", "0.5634708", "0.5602694", "0.5583373", "0.5530443", "0.5510415", "0.55089", "0.54645497", "0.54561245", "0.54360807", "0.54239315", "0.5413922", "0.54121125", "0.5410141", "0.5396888", "0.5389568", "0.53861254", "0.5380023", "0.5375846", "0.53435457", "0.53053343", "0.5301947", "0.5291747", "0.52860045", "0.5261055", "0.5214957", "0.5214957", "0.5212632", "0.5207465", "0.51755035", "0.51664317", "0.5151598", "0.51500434", "0.5143859", "0.51380694", "0.5135069", "0.5105042", "0.5105042", "0.5105042", "0.51048595", "0.5100488", "0.5094133", "0.5091796", "0.50762504", "0.50681996", "0.5062774", "0.50610626", "0.5060423", "0.50565344", "0.50550264", "0.50541186", "0.5053293", "0.5052117", "0.5048514", "0.50397193", "0.503687", "0.5035514", "0.50238365", "0.5022563", "0.5021097", "0.50186616", "0.5011841", "0.5007827", "0.500341", "0.49938676", "0.49875164", "0.49756724", "0.49755654", "0.49754912", "0.4975288", "0.49752668", "0.49730211", "0.4972082", "0.49710917", "0.49672478", "0.49641466", "0.49636647", "0.49633193", "0.4960787", "0.495807", "0.49550027", "0.4950743", "0.4949404", "0.49476025", "0.49454427", "0.49448395", "0.4933714", "0.49336684", "0.49314234", "0.49307355", "0.49271291", "0.49260557", "0.49260288", "0.49177226", "0.49089515", "0.49065882" ]
0.7243763
0
Contoller to add new Work
def new @work = Work.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully created.' }}\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n \n respond_to do |format|\n if @work.save\n format.html { redirect_to works_path, notice: 'Work item was successfully created!'}\n else\n format.html { render :new }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.work'))\n if @patron\n @patron.works << @work\n end\n format.html { redirect_to @work }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @work = Work.new(work_params)\r\n\r\n respond_to do |format|\r\n if @work.save\r\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\r\n format.json { render action: 'index', status: :created, location: @work }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n\n @work = Work.new(work_params)\n @user = User.find(session[:user_id]) \n \n respond_to do |format|\n if @work.save\n @user.works << @work\n format.html { redirect_to @work, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @works = Work.all\n end", "def create\n\t\t@work = Work.new(params[:work])\n\n\t\trespond_to do |format|\n\t\t\tif @work.save\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully created.' }\n\t\t\t\tformat.json { render json: @work, status: :created, location: @work }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params\n )\n if save_and_flash(@work)\n redirect_to works_path\n else\n render :new, status: :bad_request\n end\n end", "def create\n if not (@current_user.worker? || @current_user.admin? || @current_user.produce? )\n redirect_to @current_user\n else\n @work = Work.new(params[:work])\n @users = User.find(:all)\n @projects = Project.find(:all)\n @job_types = JobType.find(:all)\n @places = Place.find(:all)\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully created.'\n format.html { redirect_to(@work) }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully created.'\n format.html { redirect_to(@work) }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @classwork = Classwork.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classwork }\n end\n end", "def create\n @work.user_id = current_user.id\n\n respond_to do |format|\n if @work.save\n \n if current_user.roles[0].name != \"Administrador\"\n WorkMailer.new_work_alert(@work).deliver\n end\n \n format.html { redirect_to @work, :notice => 'Obra criada com sucesso!' }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @workdetail = Workdetail.new(params[:workdetail])\n @taskid = @workdetail.task_id\n respond_to do |format|\n if @workdetail.save\n format.html { redirect_to :action => \"show\", :id => @taskid, notice: 'Workdetail was successfully created.' }\n format.json { render json: @workdetail, status: :created, location: @workdetail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n process_work_contributors\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render text: \"success\"}\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work].except(:extra_keys, :extra_values))\n @work.extra = process_extra if params[:extra_keys]\n \n current_dataset.works << @work\n \n Work.create_locations(@work) if @work.places\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def create\n @creator.works << Work.where(id: work_ids)\n if @creator.save\n render json: @creator, status: :created, location: @creator\n else\n render json: @creator.errors, status: :unprocessable_entity\n end\n end", "def new\n\t\t@work = Work.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @work }\n\t\tend\n\tend", "def create\n @development_work = DevelopmentWork.new(development_work_params)\n\n respond_to do |format|\n if @development_work.save\n format.html { redirect_to @development_work, notice: 'Development work was successfully created.' }\n format.json { render :show, status: :created, location: @development_work }\n else\n format.html { render :new }\n format.json { render json: @development_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n @work.student_id = @current_student.id\n\n if @work.save\n redirect_to works_url, notice: 'Work was successfully created.'\n else\n format.html { render :new }\n end\n\n end", "def new\n @work = Work.new\n \n @title = \"New work\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def create\n @work = Work.new(user_params)\n if @work.valid?\n @work.save\n flash[:notice] = 'Successfully added new work details'\n redirect_to @work\n else\n render 'new'\n end\n end", "def new\n 1.times { @work.work_documents.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work }\n end\n end", "def create\n @work = Work.new(work_params.merge(depositor: current_user))\n\n respond_to do |format|\n if @work.save\n format.html do\n redirect_to work_version_file_list_path(@work, @work.versions.last),\n notice: 'Work was successfully created.'\n end\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @working_operation = WorkingOperation.new(working_operation_params)\n respond_to do |format|\n if @working_operation.save\n format.html { redirect_to staff_worker_path(@working_operation.staff_worker_id), notice: 'Данные сохранены' }\n format.json { render :show, status: :created, location: @working_operation }\n else\n format.html { render :new }\n format.json { render json: @working_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @howitwork = Howitwork.new(howitwork_params)\n\n respond_to do |format|\n if @howitwork.save\n format.html { redirect_to admin_howitwork_url(@howitwork), notice: 'Howitwork was successfully created.' }\n format.json { render :show, status: :created, location: @howitwork }\n else\n format.html { render :new }\n format.json { render json: @howitwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_order_work_task = WorkOrderWorkTask.new(work_order_work_task_params)\n\n respond_to do |format|\n if @work_order_work_task.save\n format.html { redirect_to @work_order_work_task, notice: 'Work order work task was successfully created.' }\n format.json { render :show, status: :created, location: @work_order_work_task }\n else\n format.html { render :new }\n format.json { render json: @work_order_work_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if request.xhr?\n @work = current_user.works.build(work_params)\n #@work = Work.new(work_params)\n if @work.save\n puts @work.status\n render :json => {:id => @work.id}\n else\n render :json => {:id => 0}\n end\n else\n render :json => {:id => 0}\n end\n end", "def create\n @worklist = Worklist.new(worklist_params)\n\n respond_to do |format|\n if @worklist.save\n format.html { redirect_to @worklist, notice: 'Worklist was successfully created.' }\n format.json { render :show, status: :created, location: @worklist }\n else\n format.html { render :new }\n format.json { render json: @worklist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workobject = Workobject.new(params[:workobject])\n\n respond_to do |format|\n if @workobject.save\n format.html { redirect_to @workobject, notice: 'Workobject was successfully created.' }\n format.json { render json: @workobject, status: :created, location: @workobject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def start\n @work = @user.works.new(start: Time.now, user_id: current_user.id)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to root_path, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end \n end", "def set_work\n @works_item = Work.find(params[:id])\n end", "def new\n @work = Work.new\n @novel = Novel.new\n @title = 'New Work'\n end", "def create\n\n #@workitem = Workitem.new(workitem_params)\n @workitem.user_id = current_user.id\n\n respond_to do |format|\n if @workitem.save\n format.html { redirect_to @workitem, notice: 'Workitem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @workitem }\n else\n format.html { render action: 'new' }\n format.json { render json: @workitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_exp = WorkExp.new(work_exp_params)\n\n respond_to do |format|\n if @work_exp.save\n format.html { redirect_to @work_exp, notice: 'Work exp was successfully created.' }\n format.json { render :show, status: :created, location: @work_exp }\n else\n format.html { render :new }\n format.json { render json: @work_exp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @stages_work = StagesWork.new(params[:stages_work])\r\n\r\n respond_to do |format|\r\n if @stages_work.save\r\n format.html { redirect_to @stages_work, notice: 'Stages work was successfully created.' }\r\n format.json { render json: @stages_work, status: :created, location: @stages_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n if params[:work] && params[:work][:tag_list] && params[:work][:title]\n # Add the work's title to the list of tags\n params[:work][:tag_list].downcase!\n separated_title = params[:work][:title].downcase.split(/\\s+/)\n separated_title.each do |tag|\n unless params[:work][:tag_list].include? tag\n params[:work][:tag_list] = params[:work][:tag_list] + ', ' + tag\n end\n end\n end\n\n @work = Work.new(work_params)\n @work.user = current_user\n\n if !params[:work][:novel_id].blank?\n @work.novel = Novel.find(params[:work][:novel_id])\n else\n @work.novel = nil\n end\n\n if @work.save\n send_new_work_notifications(@work) unless @work.is_private or @work.is_anonymous\n redirect_to @work\n else\n @work_errors = {}\n @work.errors.each do |attr, msg|\n @work_errors[attr] = msg\n end\n render 'new'\n end\n end", "def create\n @work_merge_list = WorkMergeList.new(params[:work_merge_list])\n\n respond_to do |format|\n if @work_merge_list.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.work_merge_list'))\n format.html { redirect_to(@work_merge_list) }\n format.json { render :json => @work_merge_list, :status => :created, :location => @work_merge_list }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @work_merge_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @upwork = Upwork.new(upwork_params)\n\n respond_to do |format|\n if @upwork.save\n format.html { redirect_to @upwork, notice: 'Upwork was successfully created.' }\n format.json { render :show, status: :created, location: @upwork }\n else\n format.html { render :new }\n format.json { render json: @upwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classwork = Classwork.new(classwork_params)\n\n respond_to do |format|\n if @classwork.save\n format.html { redirect_to admin_classwork_path(@classwork), notice: '作业项目创建成功.' }\n format.json { render json: @classwork, status: :created, location: @classwork }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_log = WorkLog.new(params[:work_log])\n\n respond_to do |format|\n if @work_log.save\n format.html { redirect_to @work_log, notice: 'Work log was successfully created.' }\n format.json { render json: @work_log, status: :created, location: @work_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n if @work.start_address == nil\n format.html { redirect_to add_oil_path(@work.id)}\n else\n format.html { redirect_to @work, notice: '新建成功!' }\n format.json { render :show, status: :created, location: @work }\n end\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @scientific_work = ScientificWork.new(params[:scientific_work])\r\n respond_to do |format|\r\n if @scientific_work.save\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully created.' }\r\n format.json { render json: @scientific_work, status: :created, location: @scientific_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\r\n @scientific_work=ScientificWork.find(params[:scientific_work_id])\r\n @second_work = @scientific_work.second_works.new(params[:second_work])\r\n\r\n respond_to do |format|\r\n if @second_work.save\r\n format.html { redirect_to @second_work, notice: 'Second work was successfully created.' }\r\n format.json { render json: @second_work, status: :created, location: @second_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @second_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @workdetail = Workdetail.new\n @taskid = params[:task_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workdetail}\n end\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def new\n logger.debug \"**** WORK NEW ****\"\n @work = Work.new\n @work.login_updated_by = @login\n @popup_title = 'Superwork'\n \n #Reset the in memory array of composers - only do this for new when its not redirected after a failed edit\n session[:composers] = []\n @composers = session[:composers]\n \n prepare_new\n end", "def create\n @my_posted_homework = MyPostedHomework.new(params[:my_posted_homework])\n\n respond_to do |format|\n if @my_posted_homework.save\n format.html { redirect_to @my_posted_homework, notice: 'My posted homework was successfully created.' }\n format.json { render json: @my_posted_homework, status: :created, location: @my_posted_homework }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_posted_homework.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @work_order_labor = WorkOrderLabor.new(params[:work_order_labor])\n @work_order_labor.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_labor.save\n format.html { redirect_to @work_order_labor, notice: crud_notice('created', @work_order_labor) }\n format.json { render json: @work_order_labor, status: :created, location: @work_order_labor }\n else\n @types = work_order_types_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @work_order_labor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @myworkout = Myworkout.new(params[:myworkout])\n\n respond_to do |format|\n if @myworkout.save\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully created.' }\n format.json { render :json => @myworkout, :status => :created, :location => @myworkout }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @myworkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_work_item(data)\n name = @table_name.to_s\n sql = @model.from(name.to_sym).insert_sql(\n description: data[:description],\n guide: data[:guide],\n status: data[:status],\n username: data[:name],\n archived: 0\n )\n sql = _format_sql(sql)\n @logger.info(\"Prepared POST query: #{sql}\")\n response = run_statement(sql, \"post\")\n id = response[0][:long_value]\n @logger.info(\"Successfully created work_item_id: #{id}\")\n id\n end", "def create\n @diploma_work = DiplomaWork.new(diploma_work_params)\n\n respond_to do |format|\n if @diploma_work.save\n format.html { redirect_to @diploma_work, notice: 'Diploma work was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diploma_work }\n else\n format.html { render action: 'new' }\n format.json { render json: @diploma_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @worktype = current_ou.worktypes.new(worktype_params)\n\n respond_to do |format|\n if @worktype.save\n format.html { redirect_to worktypes_path, notice: 'Worktype was successfully created.' }\n format.json { render :show, status: :created, location: @worktype }\n else\n format.html { render :new }\n format.json { render json: @worktype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_order = WorkOrder.new(params[:work_order])\n\n respond_to do |format|\n if @work_order.save\n format.html { redirect_to @work_order, notice: I18n.t('controllers.create_success', name: @work_order.class.model_name.human) }\n format.json { render json: @work_order, status: :created, location: @work_order }\n format.xml { render xml: @work_order, status: :created, location: @work_order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_order.errors, status: :unprocessable_entity }\n format.xml { render xml: @work_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_order = WorkOrder.new(work_order_params)\n\n respond_to do |format|\n if @work_order.save\n format.html { redirect_to @work_order, notice: 'Work order was successfully created.' }\n format.json { render :show, status: :created, location: @work_order }\n else\n format.html { render :new }\n format.json { render json: @work_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workorder = Workorder.new(params[:workorder])\n\n respond_to do |format|\n if @workorder.save\n format.html { redirect_to @workorder, notice: 'Workorder was successfully created.' }\n format.json { render json: @workorder, status: :created, location: @workorder }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workorder.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_item_type = WorkItemType.new(work_item_type_params)\n\n respond_to do |format|\n if @work_item_type.save\n format.html { redirect_to @work_item_type, notice: 'Work item type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @work_item_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @work_item_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @academic_work = AcademicWork.new(params[:academic_work])\r\n\r\n respond_to do |format|\r\n if @academic_work.save\r\n format.html { redirect_to @academic_work, notice: 'Academic work was successfully created.' }\r\n format.json { render json: @academic_work, status: :created, location: @academic_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @academic_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work = Work.new(params[:work])\n \n respond_to do |format|\n if @work.save\n work_salary=WorkSalary.new\n [email protected]\n work_salary.post_salary=params[:post_salary]\n work_salary.probation_salary=params[:probation_salary]\n work_salary.benefit=params[:benefit]\n work_salary.accumulation_fund=params[:accumulation_fund]\n work_salary.save\n format.html { redirect_to(@work, :notice => 'Work was successfully created.') }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @work_process = WorkProcess.new(work_process_params)\n respond_to do |format|\n if @work_process.save\n format.html { redirect_to work_processes_path, notice: I18n.t('commons.successfully_created') }\n format.json { render json: @work_process, status: :created, location: @work_process }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_process.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work_process = WorkProcess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work_process }\n end\n end", "def create\n @addition = Addition.new(params[:addition])\n employment_id = params[:employment_id]\n @addition.employee_id = @addition.employment.employee.id\n\n respond_to do |format|\n if @addition.save\n format.html { redirect_to(@addition, :notice => 'Addition was successfully created.') }\n format.xml { render :xml => @addition, :status => :created, :location => @addition }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @addition.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @work_activity = WorkActivity.new(params[:work_activity])\n\n respond_to do |format|\n if @work_activity.save\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully created.' }\n format.json { render json: @work_activity, status: :created, location: @work_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @works = Work.all\n end", "def index\n @works = Work.all\n end", "def create\n @work_order = WorkOrder.new(work_order_params)\n\n respond_to do |format|\n if @work_order.save\n format.html { redirect_to @work_order, notice: \"Work order was successfully created.\" }\n format.json { render :show, status: :created, location: @work_order }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @work_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work_merge_list = WorkMergeList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work_merge_list }\n end\n end", "def new\n @work = @assignment.works.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @work }\n end\n end", "def create\n @house_work = HouseWork.new(house_work_params)\n\n respond_to do |format|\n if @house_work.save\n format.html { redirect_to @house_work, notice: 'House work was successfully created.' }\n format.json { render :show, status: :created, location: @house_work }\n else\n format.html { render :new }\n format.json { render json: @house_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_plan = WorkPlan.find(params[:work_plan_id])\n @work_step = WorkStep.new(work_step_params)\n @work_step.work_plan=@work_plan\n\n respond_to do |format|\n if @work_step.save\n format.html { redirect_to @work_plan, notice: 'Work step was successfully created.' }\n format.json { render :show, status: :created, location: @work_plan }\n else\n format.html { render :new }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @reduction = Reduction.new(reduction_params)\r\n @workers_create = Worker.where(workshop_id: params[:reduction][:workshop_id])\r\n\r\n respond_to do |format|\r\n if @reduction.save\r\n format.html { redirect_to reductions_path, notice: 'تم خصم المبلغ' }\r\n format.json { render :show, status: :created, location: @reduction }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @reduction.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def create\n @work_order_detail = WorkOrderDetail.new(work_order_detail_params)\n\n respond_to do |format|\n if @work_order_detail.save\n format.html { redirect_to @work_order_detail, notice: 'Work order detail was successfully created.' }\n format.json { render :show, status: :created, location: @work_order_detail }\n else\n format.html { render :new }\n format.json { render json: @work_order_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def index_create\n @workouts = Workout.where(creator_id: current_athlete.id)\n render 'index_create.json.jbuilder', status: :created\n end", "def create\n @workorder = Workorder.new(workorder_params)\n\n respond_to do |format|\n if @workorder.save\n format.html { redirect_to @workorder, notice: 'Workorder was successfully created.' }\n format.json { render :show, status: :created, location: @workorder }\n else\n format.html { render :new }\n format.json { render json: @workorder.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def create\n @workfile = Workfile.new(workfile_params)\n\n respond_to do |format|\n if @workfile.save\n format.html { redirect_to @workfile, notice: 'Workfile was successfully created.' }\n format.json { render :show, status: :created, location: @workfile }\n else\n format.html { render :new }\n format.json { render json: @workfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @casework = Casework.find(params[:casework_id])\n @caseworkline = @casework.caseworklines.create(caseworkline_params)\n #redirect_to actives_path(@active)\n # redirect_to @active\n redirect_to edit_casework_path(@casework)\n end", "def addWorkout\n\n\t\tif params[:trained_on]\n\t\t@start_date = Time.zone.parse(params[:trained_on]).strftime(\"%Y-%m-%d\")\n\t\telse\n\t\t@start_date = Time.zone.now.strftime(\"%Y-%m-%d\")\n\t\tparams[:trained_on]=@start_date\n\t\tend\n\n\t\t#for calories field data\n\t\tif !params[:duration1].nil? && !params[:time_from1].nil? && !params[:duration1].empty? && !params[:time_from1].empty?\n\t\tparams[:duration]=params[:duration1]\n\t\tparams[:time_from]=params[:time_from1]\n\t\tend\n\n\t\tif params[:calories].nil? || params[:calories]==\"\"\n\t\t@workout = Workout.create(:user_id=>params[:userid], :trained_on=>@start_date,:time_from=>params[:time_from])\n\t\t@w=WorkoutItem.create(:workout_id=>@workout.id,:exercise_id=>params[:exercise_id],:duration=>params[:duration].delete(\" \"),:user_id=>params[:userid])\n\n\t\telse\n\t\tparams[:exercise_id]=809\t#this is custom calories execersise id\n\t\t#for activity entry by calories\n\t\t@workout = Workout.create(:user_id=>params[:userid],:trained_on=>@start_date,:time_from=>params[:time_from],:note=>params[:note])\n\t\t@w=WorkoutItem.create(:workout_id=>@workout.id,:exercise_id=>params[:exercise_id],:duration=>params[:duration].delete(\" \"),:calories=>params[:calories],:user_id=>params[:userid])\n\t\tend\n\n\t\tif @workout && @w\n\t\t@status={\"status-msg\"=>\"success\"}\n\t\telse \n\t\t@status={\"status-msg\"=>\"not created\"}\n\t\tend\n\t\trender :json =>@status.to_json\n\t\tend" ]
[ "0.7637736", "0.7483936", "0.739766", "0.7375439", "0.73623115", "0.73587817", "0.73587817", "0.7322821", "0.7278908", "0.72702175", "0.72702175", "0.70476687", "0.701793", "0.7006017", "0.6990536", "0.69820696", "0.6974664", "0.69570184", "0.69456965", "0.69127864", "0.69035405", "0.68666524", "0.68666524", "0.6858622", "0.684386", "0.684358", "0.6788032", "0.67437714", "0.67260516", "0.67191553", "0.6710168", "0.66919965", "0.6685782", "0.6677346", "0.6655755", "0.6647615", "0.66456366", "0.6635343", "0.66326493", "0.66220397", "0.6620619", "0.6607162", "0.65949196", "0.6590815", "0.6584622", "0.6581319", "0.65729314", "0.6569731", "0.655085", "0.6517475", "0.64992476", "0.6479071", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6477065", "0.6473846", "0.6462446", "0.64402133", "0.6434443", "0.6430919", "0.6427506", "0.64143145", "0.64105", "0.6407862", "0.6407841", "0.6404034", "0.63975084", "0.6387226", "0.63869166", "0.63757885", "0.63729507", "0.6370314", "0.6362536", "0.6362536", "0.6362485", "0.63532853", "0.63486654", "0.63409203", "0.6338856", "0.6336935", "0.6334096", "0.6333784", "0.63174206", "0.6317196", "0.6316445", "0.6312687", "0.6307851", "0.63036853" ]
0.6789284
26
Controller to sav new Work
def create @work = Work.new(user_params) if @work.valid? @work.save flash[:notice] = 'Successfully added new work details' redirect_to @work else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @work = Work.new(work_params\n )\n if save_and_flash(@work)\n redirect_to works_path\n else\n render :new, status: :bad_request\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully created.' }}\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @works = Work.all\n end", "def create\r\n @work = Work.new(work_params)\r\n\r\n respond_to do |format|\r\n if @work.save\r\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\r\n format.json { render action: 'index', status: :created, location: @work }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n \n respond_to do |format|\n if @work.save\n format.html { redirect_to works_path, notice: 'Work item was successfully created!'}\n else\n format.html { render :new }\n end\n end\n end", "def create_new_work(params)\n @log.info 'Configuring work attributes'\n\n # set depositor\n depositor = User.find_by_user_key(@config['depositor'])\n raise 'User ' + @config['depositor'] + ' not found.' if depositor.nil?\n\n # set noid\n id = Noid::Rails::Service.new.minter.mint\n\n # set resource type\n resource_type = 'Thesis'\n unless params['resource_type'].first.nil?\n resource_type = params['resource_type'].first\n end\n\n # set visibility\n if params.key?('embargo_release_date')\n params['visibility_after_embargo'] = 'open'\n params['visibility_during_embargo'] = 'authenticated'\n else\n params['visibility'] = 'open'\n end\n\n # set admin set to deposit into\n unless @config['admin_set_id'].nil?\n params['admin_set_id'] = @config['admin_set_id']\n end\n\n # set campus\n params['campus'] = [@config['campus']]\n\n @log.info 'Creating a new ' + resource_type + ' with id:' + id\n\n if @config['type_to_work_map'][resource_type].nil?\n raise 'No mapping for ' + resource_type\n end\n\n model_name = @config['type_to_work_map'][resource_type]\n\n # student research but with a label that is otherwise Publication\n if params['degree_level'] || params['advisor']\n model_name = 'Thesis'\n end\n\n # create the actual work based on the mapped resource type\n model = Kernel.const_get(model_name)\n work = model.new(id: id)\n work.update(params)\n work.apply_depositor_metadata(depositor.user_key)\n work.save\n\n work\nend", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.work'))\n if @patron\n @patron.works << @work\n end\n format.html { redirect_to @work }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def create\n @work = Work.new(params[:work].except(:extra_keys, :extra_values))\n @work.extra = process_extra if params[:extra_keys]\n \n current_dataset.works << @work\n \n Work.create_locations(@work) if @work.places\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n end", "def create\n\t\t@work = Work.new(params[:work])\n\n\t\trespond_to do |format|\n\t\t\tif @work.save\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully created.' }\n\t\t\t\tformat.json { render json: @work, status: :created, location: @work }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully created.'\n format.html { redirect_to(@work) }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if not (@current_user.worker? || @current_user.admin? || @current_user.produce? )\n redirect_to @current_user\n else\n @work = Work.new(params[:work])\n @users = User.find(:all)\n @projects = Project.find(:all)\n @job_types = JobType.find(:all)\n @places = Place.find(:all)\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully created.'\n format.html { redirect_to(@work) }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def new\n logger.debug \"**** WORK NEW ****\"\n @work = Work.new\n @work.login_updated_by = @login\n @popup_title = 'Superwork'\n \n #Reset the in memory array of composers - only do this for new when its not redirected after a failed edit\n session[:composers] = []\n @composers = session[:composers]\n \n prepare_new\n end", "def set_work\n @work = Work.friendly.find(params[:id])\n end", "def set_work\n @work = Work.find(params[:id])\n end", "def set_work\n @works_item = Work.find(params[:id])\n end", "def create\n @work = Work.new(work_params)\n @work.student_id = @current_student.id\n\n if @work.save\n redirect_to works_url, notice: 'Work was successfully created.'\n else\n format.html { render :new }\n end\n\n end", "def create\n\n @work = Work.new(work_params)\n @user = User.find(session[:user_id]) \n \n respond_to do |format|\n if @work.save\n @user.works << @work\n format.html { redirect_to @work, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @work = Work.new(work_params.merge(depositor: current_user))\n\n respond_to do |format|\n if @work.save\n format.html do\n redirect_to work_version_file_list_path(@work, @work.versions.last),\n notice: 'Work was successfully created.'\n end\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def start\n @work = @user.works.new(start: Time.now, user_id: current_user.id)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to root_path, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end \n end", "def new\n @work = Work.new\n @novel = Novel.new\n @title = 'New Work'\n end", "def create(work)\n @work = work\n @method = :create\n end", "def new_from_work\n @expression = Expression.new\n @expression.login_updated_by = @login\n set_default_status(@expression)\n save_expression_instance_in_session\n\t@interval_duration = IntervalDuration.create_from_string(nil)\n \n #Sounz have requested that if you create an expression from a work then you cant change the work\n @show_works_widget = false\n \n begin\n @work = Work.find(params[:work_id])\n @expression.work = @work\n @expression.expression_title = @work.work_title\n @page_title = \"New expression for work '#{@work.work_title}'\"\n @assignedWork=FrbrObject.new(\"work\",Work.find(@work.work_id))\n rescue\n logger.debug \"****** Invalid ID for work: #{params[:work_id]}\"\n @page_title = \"New Expression\"\n end\n \n prepare_new\n render :action => :new\n end", "def create\r\n @scientific_work = ScientificWork.new(params[:scientific_work])\r\n respond_to do |format|\r\n if @scientific_work.save\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully created.' }\r\n format.json { render json: @scientific_work, status: :created, location: @scientific_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work.user_id = current_user.id\n\n respond_to do |format|\n if @work.save\n \n if current_user.roles[0].name != \"Administrador\"\n WorkMailer.new_work_alert(@work).deliver\n end\n \n format.html { redirect_to @work, :notice => 'Obra criada com sucesso!' }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @stages_work = StagesWork.new(params[:stages_work])\r\n\r\n respond_to do |format|\r\n if @stages_work.save\r\n format.html { redirect_to @stages_work, notice: 'Stages work was successfully created.' }\r\n format.json { render json: @stages_work, status: :created, location: @stages_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n \n @title = \"New work\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def create\r\n @scientific_work=ScientificWork.find(params[:scientific_work_id])\r\n @second_work = @scientific_work.second_works.new(params[:second_work])\r\n\r\n respond_to do |format|\r\n if @second_work.save\r\n format.html { redirect_to @second_work, notice: 'Second work was successfully created.' }\r\n format.json { render json: @second_work, status: :created, location: @second_work }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @second_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @work = Work.new(work_params)\n process_work_contributors\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render text: \"success\"}\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_exp = WorkExp.new(work_exp_params)\n\n respond_to do |format|\n if @work_exp.save\n format.html { redirect_to @work_exp, notice: 'Work exp was successfully created.' }\n format.json { render :show, status: :created, location: @work_exp }\n else\n format.html { render :new }\n format.json { render json: @work_exp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @working_operation = WorkingOperation.new(working_operation_params)\n respond_to do |format|\n if @working_operation.save\n format.html { redirect_to staff_worker_path(@working_operation.staff_worker_id), notice: 'Данные сохранены' }\n format.json { render :show, status: :created, location: @working_operation }\n else\n format.html { render :new }\n format.json { render json: @working_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scientific_work = ScientificWork.new(scientific_work_params)\n\n respond_to do |format|\n if @scientific_work.save\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully created.' }\n format.json { render :show, status: :created, location: @scientific_work }\n else\n format.html { render :new }\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workdetail = Workdetail.new(params[:workdetail])\n @taskid = @workdetail.task_id\n respond_to do |format|\n if @workdetail.save\n format.html { redirect_to :action => \"show\", :id => @taskid, notice: 'Workdetail was successfully created.' }\n format.json { render json: @workdetail, status: :created, location: @workdetail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def set_upwork\n @upwork = Upwork.find(params[:id])\n end", "def create\n @development_work = DevelopmentWork.new(development_work_params)\n\n respond_to do |format|\n if @development_work.save\n format.html { redirect_to @development_work, notice: 'Development work was successfully created.' }\n format.json { render :show, status: :created, location: @development_work }\n else\n format.html { render :new }\n format.json { render json: @development_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n if @work.start_address == nil\n format.html { redirect_to add_oil_path(@work.id)}\n else\n format.html { redirect_to @work, notice: '新建成功!' }\n format.json { render :show, status: :created, location: @work }\n end\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_work\n @work = Work.find(params[:id])\n \tauthorize @work\n end", "def set_work\n @work = Work.find_by(id: params[:id])\n rescue Exception => e\n render_default_error e, 401\n end", "def create\n @diploma_work = DiplomaWork.new(diploma_work_params)\n\n respond_to do |format|\n if @diploma_work.save\n format.html { redirect_to @diploma_work, notice: 'Diploma work was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diploma_work }\n else\n format.html { render action: 'new' }\n format.json { render json: @diploma_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @creator.works << Work.where(id: work_ids)\n if @creator.save\n render json: @creator, status: :created, location: @creator\n else\n render json: @creator.errors, status: :unprocessable_entity\n end\n end", "def create\n if request.xhr?\n @work = current_user.works.build(work_params)\n #@work = Work.new(work_params)\n if @work.save\n puts @work.status\n render :json => {:id => @work.id}\n else\n render :json => {:id => 0}\n end\n else\n render :json => {:id => 0}\n end\n end", "def new\n\t\t@work = Work.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @work }\n\t\tend\n\tend", "def set_our_work\n @work = OutWork.find_by(id: params[:id])\n rescue Exception => e\n render_default_error e, 401\n end", "def index\n @works = Work.all\n end", "def index\n @works = Work.all\n end", "def create\n @work = Work.new(params[:work])\n \n respond_to do |format|\n if @work.save\n work_salary=WorkSalary.new\n [email protected]\n work_salary.post_salary=params[:post_salary]\n work_salary.probation_salary=params[:probation_salary]\n work_salary.benefit=params[:benefit]\n work_salary.accumulation_fund=params[:accumulation_fund]\n work_salary.save\n format.html { redirect_to(@work, :notice => 'Work was successfully created.') }\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @work_order_work_task = WorkOrderWorkTask.new(work_order_work_task_params)\n\n respond_to do |format|\n if @work_order_work_task.save\n format.html { redirect_to @work_order_work_task, notice: 'Work order work task was successfully created.' }\n format.json { render :show, status: :created, location: @work_order_work_task }\n else\n format.html { render :new }\n format.json { render json: @work_order_work_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @our_works = OurWork.new(our_work_params)\n if @our_works.plate_has_an_entry?\n render_default_error 'hay un error, Esta placa ya ha sido ingresada', 401\n else\n @our_works.date_arrival = Date.today.to_date\n @our_works.is_parking = true\n if @our_works.save\n render_success_format('Nueva entrada registrada', @our_works, true)\n end\n end\n rescue Exception => e\n render_default_error e, 401\n end", "def create\n# return render :text => \"#{params}\"\n @work_plan = WorkPlan.new(params[:work_plan])\n\n respond_to do |format|\n if @work_plan.save\n format.html { redirect_to @work_plan, notice: 'Work plan was successfully created.' }\n format.json { render json: @work_plan, status: :created, location: @work_plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n #expire_action :index\n #expire_action :show\n\n end", "def new\n @title = 'Add Workout Record'\n @workout_record = WorkoutRecord.new\n @workout_record.workout = Workout.new\n @selected_workout = Workout.find_by_id params[:workout] if params[:workout]\n @selected_workout = Workout.find_by_name 'Generic WOD' if params[:daily_wod]\n @wod = DailyWod.order('created_at DESC').first if params[:show_daily]\n end", "def create\n flash[:notice] = \"\"\n saved = true\n oldest = Time.now + 10.years\n newest = Time.now - 10.years\n \n if !params[:days].blank?\n params[:days].each { |key ,day|\n params[:work][:length] = day[:length].to_i\n params[:work][:time] = day[:time].to_i\n params[:work][:date] = Time.parse(day[:date])\n oldest > Time.parse(day[:date]) ? oldest = Time.parse(day[:date]) : \" \"\n newest < Time.parse(day[:date]) ? newest = Time.parse(day[:date]) : \" \"\n \n \n params[:work][:place_id] = day[:place_id]\n params[:work][:reserved] = day[:reserved]\n @work = Work.new(params[:work])\n if [email protected]\n @work_error = @work\n saved = false\n else\n flash[:notice] +=\"provedeno naplanovani prace na cas: \"+ params[:work][:date].strftime(\"%d.%m.%Y\")+\"<br />\" \n day[:date] = \"\"\n end\n }\n else \n @work = Work.new(params[:work])\n if [email protected]\n @work_error = @work\n saved = false \n end\n end\n\n if !@work_error.blank?\n @work = @work_error\n end \n respond_to do |format|\n if saved == true\n \n flash[:notice] = 'Work was successfully created.'\n if params[:commit] == \"přidat\"\n format.html { redirect_to :controller => \"plans\", :action => \"week\", :job_type=> @work.job_type_id , :newest => newest , :oldest => oldest }\n else \n format.html { redirect_to :controller => \"works\", :action => \"new\" }\n end\n format.xml { render :xml => @work, :status => :created, :location => @work }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def submitted\n @works = Work.submitted\n render :index\n end", "def index\n # if current_student.admin == true\n # @works = Work.all\n # else\n @student = Student.find(current_student.id)\n # end\n @work = Work.new\n end", "def create\n @myworkout = Myworkout.new(params[:myworkout])\n\n respond_to do |format|\n if @myworkout.save\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully created.' }\n format.json { render :json => @myworkout, :status => :created, :location => @myworkout }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @myworkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @work_log = WorkLog.new(params[:work_log])\n\n respond_to do |format|\n if @work_log.save\n format.html { redirect_to @work_log, notice: 'Work log was successfully created.' }\n format.json { render json: @work_log, status: :created, location: @work_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_document\n @ot = Ot.find(params[:ot_id])\n @task = Task.find(@ot.current_task_id)\n\n @frbr_work = FrbrWork.new(params[:frbr_work])\n\n respond_to do |format|\n if @frbr_work.save\n # Associate ot to new manifestation\n @ot.assign_source(@frbr_work.frbr_expressions[0].frbr_manifestations[0])\n\n # Move on\n do_perform_transition(:documentos_elegidos)\n\n format.html { redirect_to root_path, notice: 'El documento Frbr fue creado sin problemas.' }\n else\n format.html { render action: \"eligiendo_documento\" }\n end\n end\n end", "def new_now\n @work = Work.new\n \n if not params[:project_id].blank?\n @work.project_id = params[:project_id]\n end\n\n @now = true\n end", "def create\n @open_source_work = OpenSourceWork.new(open_source_work_params)\n\n respond_to do |format|\n if @open_source_work.save\n format.html { redirect_to @open_source_work, notice: 'Open source work was successfully created.' }\n format.json { render :show, status: :created, location: @open_source_work }\n else\n format.html { render :new }\n format.json { render json: @open_source_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workobject = Workobject.new(params[:workobject])\n\n respond_to do |format|\n if @workobject.save\n format.html { redirect_to @workobject, notice: 'Workobject was successfully created.' }\n format.json { render json: @workobject, status: :created, location: @workobject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @workobject.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(work)\n super\n return persist_work_succeeded if exists?\n\n persist_work_initial\n service.persist_work ? persist_work_succeeded : persist_work_failed\n rescue StandardError => e\n persist_work_failed\n errors(message(e))\n log(\"error while persisting work: #{e.message} : #{e.backtrace}\")\n end", "def current\n Job.generate_work_order\n redirect_to '/'\n end", "def create\n @upwork = Upwork.new(upwork_params)\n\n respond_to do |format|\n if @upwork.save\n format.html { redirect_to @upwork, notice: 'Upwork was successfully created.' }\n format.json { render :show, status: :created, location: @upwork }\n else\n format.html { render :new }\n format.json { render json: @upwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_plan = WorkPlan.find(params[:work_plan_id])\n @work_step = WorkStep.new(work_step_params)\n @work_step.work_plan=@work_plan\n\n respond_to do |format|\n if @work_step.save\n format.html { redirect_to @work_plan, notice: 'Work step was successfully created.' }\n format.json { render :show, status: :created, location: @work_plan }\n else\n format.html { render :new }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n 1.times { @work.work_documents.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work }\n end\n end", "def create\n @work_process = WorkProcess.new(work_process_params)\n respond_to do |format|\n if @work_process.save\n format.html { redirect_to work_processes_path, notice: I18n.t('commons.successfully_created') }\n format.json { render json: @work_process, status: :created, location: @work_process }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_process.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_period = WorkPeriod.new(work_period_params)\n\n if @work_period.save\n redirect_to company_work_periods_path(current_company)\n else\n render :new\n end\n end", "def create\n @work = Work.new(work_params)\n if @work.plate_has_an_entry?\n render_default_error 'hay un error, Esta placa ya ha sido ingresada', 401\n else\n @work.date_arrival = Date.today.to_date\n @work.is_parking = true\n if @work.save\n render_success_format('Nueva entrada registrada', @work, true)\n end\n end\n rescue Exception => e\n render_default_error e, 401\n end", "def new\n @work = Work.new\n \n if not params[:project_id].blank?\n @work.project_id = params[:project_id]\n end\n \n @now = false\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def create\n @house_work = HouseWork.new(house_work_params)\n\n respond_to do |format|\n if @house_work.save\n format.html { redirect_to @house_work, notice: 'House work was successfully created.' }\n format.json { render :show, status: :created, location: @house_work }\n else\n format.html { render :new }\n format.json { render json: @house_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n @time_works = TimeWork.all_by_user_session user_web\n\n if TimeWork.has_any_time_work_on_open? user_web\n @time_work = TimeWork.new\n\n format.html { render action: :index }\n format.json { head :no_content }\n else\n @time_work = TimeWork.new(params[:time_work])\n\n @time_work.user_id = user_web.id\n @time_work.begin_at = Time.zone.now\n\n if @time_work.save\n format.html { redirect_to action: 'contador'}\n format.json { render json: @time_work, status: :created, location: @time_work }\n else\n format.html { render action: :index }\n format.json { render json: @time_work.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def set_work_exp\n @work_exp = WorkExp.find(params[:id])\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work }\n end\n end", "def set_homework\n @homework = Homework.find(params[:id])\n end", "def set_work_log\n @work_log = WorkLog.find(params[:id])\n end", "def new\n @work = @assignment.works.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @work }\n end\n end", "def create\n @workfile = Workfile.new(workfile_params)\n\n respond_to do |format|\n if @workfile.save\n format.html { redirect_to @workfile, notice: 'Workfile was successfully created.' }\n format.json { render :show, status: :created, location: @workfile }\n else\n format.html { render :new }\n format.json { render json: @workfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = @assignment.works.build(allowed_params)\n @work.email.downcase!\n\n respond_to do |format|\n # make this work one with the assignment\n @work.assignment_id = @assignment.id\n \n # try to find the student who this assignment belongs to (based on the submitting email address)\n student = Student.where('email=?', params[:work][:email].downcase).first\n \n if student\n # if a student is found with a matching email address attribute the assignment to them\n @work.enrollment = student.enrollments.where('section_id=?',@section.id).first\n end\n \n # check if a work has already been submitted from this submission address\n prev_works = @assignment.works.where('email=?', params[:work][:email].downcase)\n\n # if the work wasn't previously submitted\n if prev_works.size == 0\n # save the work\n if @work.save\n flash[:notice] = 'Your work was successfully uploaded.'\n \n # send the student an email including the withdrawal link\n @work.send_submitted_email params[:work][:email].downcase\n \n @status = semester_section_assignment_url(@semester,@section,@assignment)\n format.html { redirect_to([@semester,@section,@assignment]) } \n format.xml { render xml: @work, status: :created, location: @work }\n else\n @status = \"failed\"\n format.html { render action: \"new\" }\n format.xml { render xml: @work.errors, status: :unprocessable_entity }\n end\n else\n @work.errors.add :email, 'has already submitted this work. If you want to resubmit, you must first withdraw your previous submission (check your email)'\n \n # send the submitter a reminder including the withdrawal link\n prev_works[0].send_reminder_email # params[:work][:email]\n \n @status = \"failed\"\n format.html { render action: \"new\" }\n format.xml { render xml: @work.errors, status: :unprocessable_entity }\n end\n format.js\n end\n end" ]
[ "0.7218522", "0.718723", "0.71491313", "0.70809096", "0.70403874", "0.70403874", "0.70376086", "0.7031627", "0.7010105", "0.6968101", "0.6968101", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.6953117", "0.693946", "0.6934553", "0.6903921", "0.68758297", "0.68628293", "0.6812508", "0.68022215", "0.6794534", "0.67637753", "0.67498904", "0.67333764", "0.6732567", "0.667564", "0.6648487", "0.66353834", "0.6620387", "0.65734255", "0.6548683", "0.6546151", "0.6509947", "0.64966416", "0.6494668", "0.64943546", "0.6485945", "0.6484664", "0.64566016", "0.6454592", "0.644371", "0.6420498", "0.641798", "0.6410547", "0.6410547", "0.63883775", "0.6358617", "0.6344343", "0.6338837", "0.6318183", "0.63148034", "0.6310597", "0.6281702", "0.6272699", "0.6272699", "0.62717366", "0.62705976", "0.62680614", "0.62514234", "0.6240583", "0.62331206", "0.6226053", "0.62239385", "0.62229735", "0.62176055", "0.6212157", "0.62120545", "0.62002426", "0.61953294", "0.61862105", "0.61802864", "0.6163623", "0.6161299", "0.61532533", "0.61403716", "0.6132767", "0.6129185", "0.6124069", "0.61059785", "0.61035883", "0.61028177", "0.61027765", "0.61002195", "0.6096134", "0.60899174", "0.60887724", "0.606758" ]
0.61588883
86
Get deliverable types by lifecycle phase ID Helper method, not intended to be called from outside
def getDeliverableTypes @projectPhase = ProjectPhase.find(@project_phase_id) @deliverableTypes = DeliverableType.find_all_by_lifecycle_phase_id(@projectPhase.lifecycle_phase_id) @deliverableTypesArray = [] @deliverableTypes.each do |type| @deliverableTypesArray.append([type.name,type.id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDeliverableTypeList(lifecycle_phase)\n return DeliverableType.find_all_by_lifecycle_phase_id(lifecycle_phase)\n end", "def project_phase_deliverables\n project_phase_deliverables = []\n stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n project_phase_deliverables << d\n end\n end\n\n custom_deliverable_types.each do |custom|\n custom.deliverables.each do |d|\n project_phase_deliverables << d\n end\n end\n project_phase_deliverables\n end", "def create_deliverable_type(lifecycle_phase)\n unit_of_measure = UnitOfMeasure.find_by_unit(\"pages\")\n if unit_of_measure.nil?\n temp_unit_of_measure = UnitOfMeasure.new(:unit => \"pages\")\n if (temp_unit_of_measure.save)\n unit_of_measure = temp_unit_of_measure\n else\n return\n end\n end\n type_name = @lifecycle_phase.name+\" deliverable\"\n deliverable_type = DeliverableType.new(:name => type_name,\n :lifecycle_phase_id => lifecycle_phase.id,\n :unit_of_measure_id => unit_of_measure.id)\n\n if deliverable_type.save\n return deliverable_type\n else\n return\n end\n end", "def get_same_stock_deliverable_types\n StockDeliverableType.find_all_by_deliverable_type_id(self.deliverable_type_id)\n end", "def getDeliverableTargets(iTarget)\n rDeliverables = []\n\n # Parse the target\n lTypeName = nil\n lLstID = []\n lVersionName = nil\n lDeliverableName = nil\n iTarget.split('/').each do |iTargetToken|\n if (lTypeName == nil)\n # The first token is the type name\n lTypeName = iTargetToken\n elsif (lVersionName == nil)\n lFirstChar = iTargetToken.getbyte(0)\n if ((lFirstChar >= 48) and\n (lFirstChar <= 57))\n # This token is the version\n lVersionName = iTargetToken\n else\n # This token completes the ID\n lLstID << iTargetToken\n end\n elsif (lDeliverableName == nil)\n # This token is forcefully the deliverable\n lDeliverableName = iTargetToken\n else\n raise RuntimeError.new(\"Invalid target (#{iTarget}): token #{iTargetToken} does not correspond to anything\")\n end\n end\n\n # Get the corresponding objects\n if (lLstID.empty?)\n # All deliverables from all versioned objects from all objects from this type\n @DB.getObjects(lTypeName).each do |iID, iObject|\n iObject.getVersionedObjects.each do |iVersion, iVersionedObject|\n iVersionedObject.getDeliverables.each do |iDeliverableName, iDeliverable|\n rDeliverables << iDeliverable\n end\n end\n end\n elsif (lVersionName == nil)\n # All deliverables from all versioned objects from this object, or any part of it\n # Gather also the list of objects who begin with this object ID (ex.: TestID will return TestID/0.1 and also TestID/SubTestID/0.1)\n lObjects = []\n @DB.getObjects(lTypeName).each do |iID, iObjectInfo|\n if (iID[0..lLstID.size-1] == lLstID)\n lObjects << iObjectInfo\n end\n end\n if (lObjects.empty?)\n raise RuntimeError.new(\"No object could match ID #{lTypeName}/#{lLstID.join('/')}\")\n else\n lObjects.each do |iObjectInfo|\n iObjectInfo.getVersionedObjects.each do |iVersion, iVersionedObject|\n iVersionedObject.getDeliverables.each do |iDeliverableName, iDeliverable|\n rDeliverables << iDeliverable\n end\n end\n end\n end\n elsif (lDeliverableName == nil)\n # All deliverables from this versioned object\n @DB.getDeliverables(lTypeName, lLstID, lVersionName).each do |iDeliverableName, iDeliverable|\n rDeliverables << iDeliverable\n end\n else\n rDeliverables << @DB.getDeliverable(lTypeName, lLstID, lVersionName, lDeliverableName)\n end\n\n return rDeliverables\n end", "def show\n @project_phase = ProjectPhase.find(params[:id])\n @lifecycle_phase = @project_phase.lifecycle_phase\n @project_phase_deliverables = []\n @project_phase.stock_deliverable_types.each do |stock|\n stock.deliverables.each do |d|\n @project_phase_deliverables << d\n end\n end\n\n @project_phase.custom_deliverable_types.each do |custom|\n custom.deliverables.each do |d|\n @project_phase_deliverables << d\n end\n end\n\n respond_to do |format|\n format.json { render :json => { :lifecycle_phase_container => @lifecycle_phase,\n :deliverables_container => @project_phase_deliverables,\n :project_phase_estimated_effort => @project_phase.estimated_effort,\n :project_phase_logged_effort => @project_phase.logged_effort} }\n end\n end", "def getDeliverables(iTypeName, iObjectID, iVersion)\n lVersionedObjects = getVersionedObjects(iTypeName, iObjectID)\n if (lVersionedObjects[iVersion] == nil)\n raise RuntimeError.new(\"Unable to get versioned object #{iTypeName}/#{iObjectID.join('/')}/#{iVersion}\")\n end\n\n return lVersionedObjects[iVersion].getDeliverables\n end", "def deliverables\n return Deliverable.where(project_id: @project.id)\n end", "def get_tasks_for(object)\n tasks_for_type = []\n\n @tasks.each do |task|\n if task.allowed_types.include?(object.class)\n tasks_for_type << task\n end\n end\n\n tasks_for_type\n end", "def get_action_type_identifiers\n @model.actions.to_a.collect { |action| action.type_identifier }\n end", "def getDeliverables\n readDeliverables\n\n return @Deliverables\n end", "def registered_types\n end", "def show\n #get the deliverable id from URL\n @deliverable = Deliverable.find(params[:id])\n #get the deliverable type for the deliverable\n @deliverable_type = DeliverableType.find_by_id(@deliverable.deliverable_type_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deliverable }\n end\n end", "def merchant_types\n MerchantType.find merchant_type_ids\n end", "def get_actions(type=nil)\n res = []\n \n @actions.each do |a|\n if a.is_a?(type) or type.nil?\n res.push a\n end\n end\n \n return res\n end", "def get_applicable_plugins(type)\n PluginManager.get_plugins_by('items', type)\n end", "def deliveries_from_status(klass, status = :all)\n if klass.respond_to?(status.to_sym)\n klass.send(status.to_sym)\n else\n Delivery.all # default\n end\n end", "def flow_types\n return @flow_types\n end", "def consumer_room_types\n result = Array.new\n if self.is_inventory_feeder?\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rtt|\n result << RoomType.find(rtt.room_type_from_id)\n end\n end\n result\n end", "def components_with_type(type)\n array = []\n @components.each_value do |c|\n array << c.proxy.name if c.proxy.respond_to?(:has_type?) &&\n c.proxy.has_type?(type)\n end\n array\n end", "def index\n @phase_types = PhaseType.all\n end", "def target_type\n RssLog.all_types.each do |type|\n return type.to_sym if send(\"#{type}_id\".to_sym)\n end\n nil\n end", "def types\n @callers.keys\n end", "def phases\n lifecycle.phases \n end", "def presentation_unit_types\n [packing_material.presentation_unit_type] + packing_material.presentation_unit_type.presentation_unit_type_conversions.map(& :presentation_unit_type_to)\n end", "def loaded_instances(type)\n @instances[type].keys\n end", "def get_service_types\n if @servicetypes.any?\n @servicetypes.flat_map(&:servicetype).compact\n elsif @servicetype\n [@servicetype]\n else\n []\n end\n end", "def available_plugins(type: :export)\n type = valid_type(type)\n plugins[type].keys.sort\n end", "def service_types\n get_info :service_types\n end", "def streams_from_type(type)\n if type.respond_to?(:name)\n type = type.name\n end\n\n streams.find_all { |s| s.type.name == type }\n end", "def existing_order_types(store)\n order_types.merge(Order.complete).where(orders: {store: store}).distinct\n end", "def get_message_types; end", "def get_message_types; end", "def types\n get_metadata unless @types\n return @types\n end", "def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end", "def find_services(type, scope = '', filter = '')\n arr = []\n\n callback = Proc.new{ |_hslp, url, lifetime, err, _cookie|\n if err == SLP_OK\n arr << {url => lifetime}\n true\n else\n false\n end\n }\n\n begin\n cookie = FFI::MemoryPointer.new(:void)\n result = SLPFindSrvs(@handle, type, scope, filter, callback, cookie)\n raise Error, \"SLPFindSrvs(): #{result}\" if result != :SLP_OK\n ensure\n cookie.free unless cookie.null?\n end\n\n arr\n end", "def by_type\n filter(:type) do |timeline, type|\n timeline.artifact_type.casecmp(type).zero?\n end\n end", "def active_payment_types\n supported = []\n supported << :paypal if PaypalHelper.paypal_active?(self.id)\n supported << :stripe if StripeHelper.stripe_active?(self.id)\n supported << :razorpay if RazorpayHelper.razorpay_active?(self.id)\n supported.size > 1 ? supported : supported.first\n end", "def items_for_type(type)\n all_ids = []\n valid_ids = []\n AllItems.get.each do |item_code, values|\n _item_name, item_type, item_valid = values\n next unless item_type == type\n all_ids << item_code\n valid_ids << item_code if item_valid\n end\n\n [all_ids, valid_ids]\n end", "def load_types\n ObjectSpace.enum_for(:each_object, class << NotificationSystem::Notification; self; end).to_a - [NotificationSystem::Notification]\n end", "def find_service_types(auth = '*', scope = '')\n arr = []\n\n callback = Proc.new{ |_hslp, types, err, _cookie|\n if err == SLP_OK\n arr << types\n true\n else\n false\n end\n }\n\n begin\n cookie = FFI::MemoryPointer.new(:void)\n result = SLPFindSrvTypes(@handle, auth, scope, callback, cookie)\n raise Error, \"SLPFindSrvTypes(): #{result}\" if result != :SLP_OK\n ensure\n cookie.free unless cookie.null?\n end\n\n arr\n end", "def all_deliverables\n deliverables = self.deliverables.order(\"name ASC\")\n result = []\n deliverables.each do |deliverable|\n if deliverable.has_sub_item == true \n result << [ \"#{deliverable.name} -- SubItem: #{deliverable.sub_item_name} \"+\n \"-- Default SubItem Quantity: #{deliverable.sub_item_quantity} \"+\n \"-- Additional Extra SubItem Price: #{deliverable.independent_sub_item_price}\" , \n deliverable.id ]\n else\n result << [ \"#{deliverable.name}\" , \n deliverable.id ]\n end\n \n end\n return result\n end", "def push_job_types_for_targets(targets)\n types = Set.new\n all_policies = Push::Policy.policies.values\n\n Array.wrap(targets).each do |target|\n policies = all_policies.select do |pol|\n next true if target == 'live' && !pol.staging\n next true if target == 'stage' && pol.staging\n pol.push_target.to_s == target\n end\n\n types = types.union policies.map(&:job_klass).map(&:name)\n end\n\n types.to_a\n end", "def service_types_generated \n types = [ ServiceTypeValue[:fulltext], ServiceTypeValue[:holding], ServiceTypeValue[:table_of_contents], ServiceTypeValue[:relevant_link] ]\n \n return types\n end", "def id_types\n identifiers.map(&:type).uniq\n end", "def subtypes_of(message_type)\n unless @listeners[message_type].nil?\n @listeners[message_type].keys.clone.freeze\n else\n []\n end\n end", "def setups\n @setups ||= @types.map { |type| Setup.for(type) }\n end", "def types\n self.singleton_class.const_get(:TYPES)\n end", "def by_target_type(events)\n return events unless Event::TARGET_TYPES[params[:target_type]]\n\n events.where(target_type: Event::TARGET_TYPES[params[:target_type]].name)\n end", "def get_list_service_types\n ServiceType.get_list_service_types\n end", "def needed_types\n self.scan unless @needed_types\n @needed_types\n end", "def types\n trans = ChessMoves::Transformations[@type]\n trans ? [@type, trans.first] : [@type]\n end", "def find_subscribable\n params.each do |name, value|\n return Regex.last_match(1).classify.constantize.find(value) if name =~ /(.+)_id$/\n end\n nil\n end", "def subscribed_types\n subscribable_types - unsubscribed_types\n end", "def getDeliverable(iTypeName, iObjectID, iVersion, iDeliverableName)\n lDeliverables = getDeliverables(iTypeName, iObjectID, iVersion)\n if (lDeliverables[iDeliverableName] == nil)\n raise RuntimeError.new(\"Unable to get deliverable #{iTypeName}/#{iObjectID.join('/')}/#{iVersion}/#{iDeliverableName}\")\n end\n\n return lDeliverables[iDeliverableName]\n end", "def get_by_type(type)\r\n facts2typerule = {:methodcall => [:cant_access, :can_access],\r\n :inheritance => [:cant_extend, :can_extend],\r\n :objcreation => [:cant_create, :can_create]}\r\n\r\n find_all { |x| facts2typerule[type].index(x.type_interaction) != nil }\r\n end", "def return_sub_types\n main_type = type_status\n if main_type\n return self.beer_subtypes.map{|type| {id: type.id, name: type.name}}\n else\n return types_for_subtype\n end\n end", "def direct_types\n (self[\"directTypes\"] || ['*']).map { |t| Registry.get_type(t) }\n end", "def by_type(type)\n processors.values.detect { |v| v.prefix == type&.upcase }\n end", "def publishers\n @plugins.find_all { |p| p.is_a? BasePublish }\n end", "def get_exchange_types\n exchange_types = []\n ExchangeType.where(:selectable => true).each do |et|\n exchange_types.push(et.msgid)\n end\n\n if self.exchange_types.empty? or self.exchange_types.include?('exchangetype.open_for_all_offers')\n return exchange_types\n end\n\n return exchange_types & self.exchange_types\n end", "def edit\n @deliverable = Deliverable.find(params[:id])\n #get the project by project_id, project_id is got from @deliverable's attribute\n @project = Project.find_by_id(@deliverable.project_id)\n #get the lifecycle phase by lifecycle_id, lifecycle_id is got from @deliverable's attribute\n @lifecycle_phase = LifecyclePhase.find_by_id(@project.lifecycle_id)\n #get the deliverable type by deliverable_type_id, deliverable_type_id is got from @deliverable's attribute\n @deliverable_type = DeliverableType.find_by_id(@deliverable.deliverable_type_id)\n end", "def types\n @types ||= []\n end", "def asset_type_ids\n assets.scope.uniq.pluck(:asset_type_id)\n end", "def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend", "def find_phoneable_type\n %w(organization person).each do |type|\n param_name = [type, 'id'].join('_').to_sym\n requested_id = params[param_name]\n return type.to_sym unless requested_id.blank?\n end\n nil\n end", "def fetch_type name\n exercises = []\n data.exercises.each do |exe|\n if exe.target === name\n exercises.push(exe.name)\n end\n end\n exercises\n end", "def proper_types\n Page.distinct(:_type).reject { |type| type.constantize.new.entry? }\n end", "def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end", "def find_emailable_type\n %w(organization person).each do |type|\n param_name = [type, 'id'].join('_').to_sym\n requested_id = params[param_name]\n return type.to_sym unless requested_id.blank?\n end\n nil\n end", "def event_types(pool_type_id)\n if @event_types_by_pool.key?(pool_type_id)\n @event_types_by_pool[pool_type_id].each\n else\n [].each\n end\n end", "def id_mapping_types\n @id_mapping_types ||= extract_classes_with_true(:track_imported_ids, configuration)\n end", "def released_fact_types_dump(o)\n roles = o.all_role\n begin\n progress = false\n roles.map(&:fact_type).uniq.select{|fact_type|\n # The fact type hasn't already been dumped but all its role players have\n !fact_type.ordered_dumped &&\n !fact_type.is_a?(ActiveFacts::Metamodel::LinkFactType) &&\n !fact_type.all_role.detect{|r| !r.object_type.ordered_dumped } &&\n !fact_type.entity_type &&\n derivation_precursors_complete(fact_type)\n # REVISIT: A derived fact type must not be dumped before its dependent fact types have\n }.sort_by{|fact_type|\n fact_type_key(fact_type)\n }.each{|fact_type|\n fact_type_dump_with_dependents(fact_type)\n # Objectified Fact Types may release additional fact types\n roles += fact_type.entity_type.all_role.sort_by{|role| role.ordinal} if fact_type.entity_type\n progress = true\n }\n end while progress\n end", "def dismissal_methods_for(delivery)\n return '' unless delivery.key?('wicket')\n dismissals_for(delivery).map { |dismissal| dismissal['kind'] }.join(', ')\nend", "def index\n authorize_action_for OrderType, at: current_store\n @order_types = current_store.order_types\n end", "def guessed_build_phase_type\n case file_type\n when /\\.h$/\n return 'PBXHeadersBuildPhase'\n when /^sourcecode/\n return 'PBXSourcesBuildPhase'\n when /\\.framework$/, /\\.ar$/\n return 'PBXFrameworksBuildPhase'\n else\n return 'PBXResourcesBuildPhase'\n end\n end", "def find_by_type(types); end", "def find_by_type(types); end", "def flyable_aircraft_types\n licensed_aircraft_type_ids = self.licenses.find(:all, :select => 'DISTINCT aircraft_type_id').collect { |r| r.aircraft_type_id }\n return AircraftType.find(:all, :conditions => ['id IN (?)', licensed_aircraft_type_ids]) || []\n end", "def get_related_event_types(category, id, quantity)\n all_events = KeventerReader.instance.catalog_events()\n\n all_events.select{|e| e.event_type.categories.any?{|c| c == category}}\n .select{|e| e.event_type.id != id}\n .uniq{ |e| e.event_type.id}\n .first(quantity)\nend", "def service_types_generated\n types = [ ServiceTypeValue[:export_citation] ]\n \n return types\n end", "def provisioners(type, env)\n env[:machine].config.vm.provisioners.select do |provisioner|\n # Vagrant 1.7 changes provisioner.name to provisioner.type\n if provisioner.respond_to? :type\n provisioner.type.to_sym == type\n else\n provisioner.name.to_sym == type\n end\n end\n end", "def find_resources(type)\n resource_collection.all_resources.select do |resource|\n resource_name(resource) == type.to_sym\n end\n end", "def available_ids\n %w(bounce deliver drop spam unsubscribe click open).map(&:to_sym)\n end", "def deliverables_for(user)\n (released? || can_edit?(user)) ? deliverables : deliverables.none\n end", "def deliverables_for_user(user)\n deliverables.find(:all, :include => [:users], :conditions => { \"users.id\" => user.id })\n end", "def types\n configuration[:types]\n end", "def find_websiteable_type\n %w(organization person).each do |type|\n param_name = [type, 'id'].join('_').to_sym\n requested_id = params[param_name]\n return type.to_sym unless requested_id.blank?\n end\n nil\n end", "def event_types\n meeting_events.includes(:event_type).map(&:event_type)\n end", "def types_filter\n types_filter = self[:types_filter] || []\n return types_filter if types_filter.any?\n options.fetch 'types_filter', []\n end", "def ingested_ids\n ingested_ids_by_type.flatten\n end", "def ingested_ids\n ingested_ids_by_type.flatten\n end", "def create\n #@lifecycle_phase = Lifecycle.new(params[:lifecycle_phase])\n lifecycle = Lifecycle.find(params[:lifecycle_phase][:lifecycle_id])\n sequence_num = lifecycle.lifecycle_phases.count + 1\n @lifecycle_phase.sequence_number = sequence_num\n respond_to do |format|\n if @lifecycle_phase.save\n deliverable_type = create_deliverable_type(@lifecycle_phase)\n if (!deliverable_type.nil?)\n format.html { redirect_to(@lifecycle_phase.lifecycle, :notice => 'Lifecycle Phase was successfully created.') }\n format.xml { render :xml => @lifecycle_phase, :status => :created, :location => @lifecycle_phase }\n else\n @lifecycle = @lifecycle_phase.lifecycle\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lifecycle_phase.errors, :status => :unprocessable_entity }\n end\n else\n @lifecycle = @lifecycle_phase.lifecycle\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lifecycle_phase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def item_types(refresh: false)\n cname = \"#{name}.item_types\"\n Rails.cache.delete(cname) if refresh\n\n Rails.cache.fetch(cname) do\n list = []\n implementation_classes.each do |imp_class|\n list += imp_class.attribute_names\n .select { |a| Classification::GeneralSelection.use_with_attribute?(a) }\n .map do |a|\n mn = imp_class.model_name.to_s.ns_underscore\n mn = mn.pluralize unless imp_class.respond_to?(:is_activity_log)\n \"#{mn}_#{a}\".to_sym\n end\n end\n\n list\n end\n end", "def installed_adapters_of_type(type)\n (adapters[type] || []).select { |a| a.carrier_demand.positive? }\n end", "def read_service_types()\n types = []\n @client.services.each do |type|\n types << type.label\n end\n\n types\n end", "def index\n @deliverables = Deliverable.all\n end", "def publishing_actions\n\n actions = []\n\n if wf = publishing_workflow\n actions= wf.available_steps(self).map { |step| step.action }\n end\n\n return actions.uniq\n\n end", "def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend" ]
[ "0.75707686", "0.65359443", "0.5847871", "0.58266044", "0.5554971", "0.54890716", "0.5420633", "0.54036546", "0.5343109", "0.5272584", "0.5208869", "0.51857436", "0.51248497", "0.51038873", "0.5099042", "0.5095878", "0.50904363", "0.5066303", "0.50548416", "0.50532", "0.50410265", "0.5012261", "0.4998271", "0.49968222", "0.49745327", "0.49395105", "0.49260396", "0.492295", "0.4908878", "0.49082682", "0.48752397", "0.4852465", "0.4852465", "0.4848917", "0.48217386", "0.48195845", "0.48191488", "0.48117393", "0.48054004", "0.48022616", "0.47940612", "0.4784281", "0.4774395", "0.47615665", "0.47524542", "0.47510102", "0.47482324", "0.47478598", "0.4742219", "0.474117", "0.47266763", "0.47243732", "0.47217727", "0.4720274", "0.47166374", "0.47105175", "0.47006428", "0.4695966", "0.46937996", "0.46934482", "0.46905357", "0.46902934", "0.46717602", "0.46433517", "0.46379527", "0.46373004", "0.46367902", "0.46335328", "0.46303213", "0.46298528", "0.4616971", "0.46024615", "0.45954818", "0.4589656", "0.45894507", "0.45829374", "0.45745966", "0.45629972", "0.45629972", "0.45595723", "0.45594403", "0.45527864", "0.45464075", "0.45405367", "0.45388293", "0.4538771", "0.45309517", "0.45291424", "0.45241293", "0.4519047", "0.45089254", "0.45074898", "0.45074898", "0.45047143", "0.44993776", "0.4499362", "0.4495798", "0.44935012", "0.44903538", "0.4489604" ]
0.7535578
1
GET /env_prefs/1 GET /env_prefs/1.json
def show @env_pref = EnvPref.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @env_pref } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @env_pref = EnvPref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @env_pref }\n end\n end", "def update\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n if @env_pref.update_attributes(params[:env_pref])\n format.html { redirect_to @env_pref, notice: 'Env pref was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @env_pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end", "def destroy\n @env_pref = EnvPref.find(params[:id])\n @env_pref.destroy\n\n respond_to do |format|\n format.html { redirect_to env_prefs_url }\n format.json { head :ok }\n end\n end", "def create\n @env_pref = EnvPref.new(params[:env_pref])\n\n respond_to do |format|\n if @env_pref.save\n format.html { redirect_to @env_pref, notice: 'Env pref was successfully created.' }\n format.json { render json: @env_pref, status: :created, location: @env_pref }\n else\n format.html { render action: \"new\" }\n format.json { render json: @env_pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_prefs(user_id:)\n path = '/users/{userId}/prefs'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Preferences\n )\n end", "def settings\n get('/account/settings.json')\n end", "def get_pref(key)\n data = @prefs_fetched ? @prefs_cache : prefs\n data[key]\n end", "def index\n @prefs = Pref.all\n end", "def settings\n get \"/setup/api/settings\", password_hash\n end", "def get_settings\n request :get, \"_settings\"\n end", "def get_settings\n request :get, \"_settings\"\n end", "def load_all\n parse_json(get(PREFERENCE_URL))['prefs'].each do |p|\n @@greader_preferences[p['id']] = p['value']\n end\n end", "def prefs\n prefs_raw = _prefs_raw unless @prefs_fetched\n return nil if prefs_raw.nil?\n\n @prefs_cache = parse_pref_string(prefs_raw)\n @prefs_cache.clone\n end", "def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end", "def org_preferences\n\n v, mv = version.values\n return { 'status' => 404, 'message' => format( 'folder has been supported in Grafana since version 5. you use version %s', v) } if(mv < 5)\n\n endpoint = '/api/org/preferences'\n @logger.debug(\"Getting current organisation preferences (GET #{endpoint})\") if @debug\n get(endpoint)\n end", "def settings\n CircleCi.request(conf, \"#{base_path}/settings\").get\n end", "def settings\n result = get_parts(\"status\", 1).split(\"\\\\\").reject(&:empty?)\n Hash[*result]\n end", "def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end", "def read_settings(uuid = @uuid)\n vm = json { execute_prlctl('list', uuid, '--info', '--no-header', '--json') }\n vm.last\n end", "def prefs_to_hash prefs\n h = {}\n prefs.each do |pref|\n h[pref['id']] = pref['value']\n end\n h\n end", "def _prefs_raw\n resp = run_and_capture(flag_get_pref)\n fail_msg = \"Arduino binary failed to operate as expected; you will have to troubleshoot it manually\"\n raise ArduinoExecutionError, \"#{fail_msg}. The command was #{@last_msg}\" unless resp[:success]\n\n @prefs_fetched = true\n resp[:out]\n end", "def refresh_feature_cache \n get(\"/globalsettings.json/cache/refresh\")\nend", "def get_preference(prefs_section, pref)\n driver.getPref(prefs_section, pref)\n end", "def settings\n CircleCi.request(@conf, \"/project/#{username}/#{project}/settings\").get\n end", "def show\n @pluto_environment_variable = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @pluto_environment_variable }\n end\n end", "def get_settings(options = {}, request_options = {})\n options['getVersion'] = 2 if !options[:getVersion] && !options['getVersion']\n client.get(Protocol.settings_uri(name, options).to_s, :read, request_options)\n end", "def index\n @user_prefs = UserPref.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_prefs }\n end\n end", "def preferences\n @user = current_user\n @mode = \"general\"\n\n respond_to do |format|\n format.html\n end\n end", "def _prefs_raw\n start = Time.now\n resp = run_and_capture(flag_get_pref)\n @prefs_response_time = Time.now - start\n return nil unless resp[:success]\n resp[:out]\n end", "def list_user_env_variables(vars=[])\n result_io = get_app_dns_gear.list_user_env_vars(vars)\n JSON.parse(result_io.resultIO.string)\n end", "def index\n @pluto_environment_variables = collection\n\n respond_to do |format|\n format.json { render json: @pluto_environment_variables }\n end\n end", "def settings\n @settings ||= get('/settings')['settings']\n end", "def get_prefectures\n server_response = handle_timeouts do\n get '/1/neighborhoods.json?locale=en'\n end\n server_response['response']\n end", "def get_settings\n settings.get\n end", "def settings(key)\n ENV[key.to_s.upcase] || monk_settings(key)\nend", "def environment_credentials\n {\n url: ENV['ONEVIEW_URL'],\n ssl_enabled: ENV['ONEVIEW_SSL_ENABLED'],\n log_level: ENV['ONEVIEW_LOG_LEVEL'] || 'info',\n api_version: ENV['ONEVIEW_API_VERSION'] || 200,\n token: ENV['ONEVIEW_TOKEN'] || nil,\n user: ENV['ONEVIEW_USER'] || nil,\n password: ENV['ONEVIEW_PASSWORD'] || nil,\n hardware_variant: ENV['ONEVIEW_HARDWARE_VARIANT'] || 'C7000'\n }\nend", "def show\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preference }\n end\n end", "def show\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preference }\n end\n end", "def update_prefs(user_id:, prefs:)\n path = '/users/{userId}/prefs'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if prefs.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"prefs\"')\n end\n\n params = {\n prefs: prefs,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Preferences\n )\n end", "def show\n render json: project.project_setting\n end", "def show\n render json: @user.to_json(include: :preferences), status: :ok\n end", "def settings\n request(Resources::RESOURCE_SETTINGS, HTTP_METHOD_POST)\n end", "def get_env(key)\n\n end", "def retrieve_preferences_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PreferencesApi.retrieve_preferences ...'\n end\n # resource path\n local_var_path = '/v1/preferences'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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] || 'PreferenceListResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['bearer_auth']\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: PreferencesApi#retrieve_preferences\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @preference }\n end\n end", "def show\n @envlevel = Envlevel.find(params[:id])\n end", "def show\n @setting = Setting.find(params[:id])\n pref_id = Station.search_pref(current_user)\n @pref = Setting.prefecture_index_show(pref_id)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def show\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cys_env }\n end\n end", "def pref(key)\n if pref = preferences.find_by(key: key)\n pref.value\n else\n Droom.user_default(key)\n end\n end", "def powenv(pow_app)\n powenv_path = \"#{@pow_path}/#{pow_app}/.powenv\"\n powenv = File.open(powenv_path).readlines if File.exists?(powenv_path)\n\n hash = {}\n powenv.each do |line|\n hash[$1.strip.to_sym] = $2.strip if line =~ /\\s?export\\s?(.+)=(.+)/i\n end unless powenv.nil?\n\n return hash.empty? ? nil : hash\n end", "def settings_list\n setting.list\n end", "def [](pref)\n ensure_preferences_loaded\n @@greader_preferences[pref.to_s.gsub('_', '-')]\n end", "def preferences_field\n :preferences\n end", "def settings\n\t\tif setting = params[\"settings\"]\n\t\t\tsetting.each do |k,v|\n\t\t\t\tv = v == \"1\" if v == \"1\" or v == \"0\"\n\t\t\t\tlogger.debug \"Setting #{k} to #{v.inspect}\"\n\t\t\t\tSettings[k] = v\n\t\t\tend\n\t\tend\n\t\thead :ok\n\tend", "def show\n @user_preference = UserPreference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_preference }\n end\n end", "def show\n @user_preference = UserPreference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_preference }\n end\n end", "def index\n @m_prefs = MPref.all\n end", "def retrieve_preferences(opts = {})\n data, _status_code, _headers = retrieve_preferences_with_http_info(opts)\n data\n end", "def show\n @title = t('view.settings.show_title')\n @setting = Setting.find_by_var(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @setting }\n end\n end", "def get_env_data(env)\n config_path = \"#{File.expand_path(\"../../\", __FILE__).gsub('features', '')}config/config.yml\"\n yml = YAML::load(File.read(config_path))\n yml[env.downcase]\nend", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def test_get_preference\n\t\tpreference = $mp.get_preference('ID')\n\t\t\n\t\tassert_equal(\"#{preference['status']}\",\"200\")\n\tend", "def envvar\n CircleCi.request(@conf, \"/project/#{username}/#{project}/envvar\").get\n end", "def get_server_properties\n http_get(:uri=>\"/server/properties\", :fields=>x_cookie)\n end", "def env_key; end", "def prefs_params\n params.require(:preference).permit(:facebook,:twitter,:telephone,:telephone2,:email,:key,:value,:paypal)\n end", "def get_auto_approve_setting\n service_response = ClientManagement::GetAutoApproveSetting.new(params).perform\n render_api_response(service_response)\n end", "def get_settings\n get_uri = @data['uri'] + '/settings'\n response = @client.rest_get(get_uri, {}, @api_version)\n @client.response_handler(response)\n end", "def get_cache_preferences_path\n @driver.getCachePreferencesPath()\n end", "def load_config\n @preferences = \"/Library/Preferences/com.apple.RemoteManagement.plist\"\n config = NSMutableDictionary.dictionaryWithContentsOfFile(@preferences)\n end", "def show\n @settings = current_user.settings\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @settings }\n end\n end", "def server_preference\n @server_preference ||= ServerPreference.get(options[:read] || {})\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def index\n @settings = Setting.all_cached\n respond_to do |format|\n format.html{}\n format.json { render json: @settings }\n end\n end", "def get_api_key_storage_preference\n io.puts \"\"\n io.puts IO::Messages.separator\n io.puts \"\"\n io.puts \"For production/staging would you like to store your Timber API key\"\n io.puts \"in an environment variable? (TIMBER_API_KEY)\"\n io.puts \"\"\n io.puts \"y) Yes, store in TIMBER_API_KEY\", :blue\n io.puts \"n) No, just paste the API key inline\", :blue\n io.puts \"\"\n\n case io.ask_yes_no(\"Enter your choice:\", event_prompt: \"Store API key in env?\")\n when :yes\n io.puts \"\"\n io.puts IO::Messages.http_environment_variables(api.api_key)\n io.puts \"\"\n\n io.ask_to_proceed\n\n :environment\n when :no\n :inline\n end\n end", "def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend", "def cache_preferences_path\n driver.getCachePreferencesPath()\n end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def config_status\n get \"/setup/api/configcheck\", password_hash\n end", "def query_settings(options={})\n path = \"/api/v2/settings\"\n get(path, options)\n end", "def show\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_global_config }\n end\n end", "def show\n @var_conf = VarConf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @var_conf }\n end\n end", "def user_pref(pref, for_user=nil)\n user = for_user || @current_user || User.current_user\n user.preferences[pref] if user\n end", "def index\n @user_preferences = UserPreference.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_preferences }\n end\n end", "def index\n @users = User.all\n\n render json: @users.to_json(include: :preferences), status: :ok\n end", "def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end", "def appl_settings\n @appl_settings\n end", "def get_preferences(key)\n defaults = Pref.default_settings[key.to_sym] || Pref.default_settings[key.to_s]\n\n if self.pref.present?\n existing = self.pref.settings[key.to_s].deep_symbolize_keys\n \n # Check for new preferences \n defaults.keys.each do |grp| \n defaults[grp].keys.each do |pref, v|\n # If the group isn't present in the saved values add all of it's preferences\n existing[grp] = defaults[grp] if existing[grp].nil?\n # If the preference isn't present in the saved values add the default\n existing[grp][pref] = defaults[grp][pref] if existing[grp][pref].nil?\n end\n end\n existing\n else\n defaults\n end\n end", "def read_config\n @config = {}\n begin\n @config = Psych.load_file('config/prefs.yml')\n puts 'preferences loaded'\n rescue => e\n puts e\n puts e.backtrace\n puts 'An error occured while loading the preference file'\n puts 'User will be asked what to do'\n recreate_default_config\n read_config\n end\nend", "def test_should_have_preferences\n u = users(:basic_user)\n assert_nil u.settings['arbitrary']\n u.settings['arbitrary'] = 'the arbitrary setting'\n u.reload\n assert_equal 'the arbitrary setting', u.settings['arbitrary']\n end", "def show\n render json: @org_setting\n end", "def show\n @setting = Setting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @setting }\n end\n end", "def system_preferences\n #TODO remove true from the following line after presentation. Dont want the invitation only session to get bogged up during pres\n if true or session[:system_preferences].blank?\n active_preferences = HashWithIndifferentAccess.new()\n system_preferences = SystemPreference.all(:conditions => ['active = ?', true])\n system_preferences.each do |preference|\n if (preference.start_date.blank? or preference.start_date <= Date.now) and (preference.end_date.blank? or preference.end_date >= Date.now)\n if preference.constraints.blank? or eval(preference.constraints)\n active_preferences[preference.preference_key] = preference.preference_value\n end\n end\n end\n session[:system_preferences] = active_preferences\n return active_preferences\n else\n return session[:system_preferences]\n end\n end", "def set_pref\n @pref = Pref.find(params[:id])\n end", "def index\n get_settings\n end", "def edit\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if user_signed_in?\n format.html # new.html.erb\n format.json { render json: @preference }\n else\n format.html { redirect_to new_user_session_path, notice: 'Please sign in to edit an preference' }\n format.json { render :layout=>false }\n end\n end\n end" ]
[ "0.66328526", "0.6283586", "0.6240689", "0.61550695", "0.6152418", "0.6059325", "0.60422677", "0.5911384", "0.58494335", "0.5810558", "0.5774581", "0.5774581", "0.5703879", "0.56525207", "0.55767614", "0.5566981", "0.55427545", "0.5490205", "0.5481879", "0.5411457", "0.540801", "0.5369424", "0.535945", "0.53454876", "0.5339861", "0.5331152", "0.5280906", "0.5271055", "0.5256953", "0.52440053", "0.523737", "0.52225375", "0.5214261", "0.5208789", "0.52008384", "0.5200782", "0.5193582", "0.51802945", "0.51802945", "0.51754755", "0.5171678", "0.5148454", "0.51405185", "0.5125308", "0.51215327", "0.5114268", "0.51122147", "0.5094973", "0.5089919", "0.5085305", "0.5067742", "0.506553", "0.5044462", "0.50283295", "0.50212735", "0.501245", "0.501245", "0.50116783", "0.5009595", "0.49970025", "0.4996366", "0.49923038", "0.49910644", "0.496823", "0.49619353", "0.4955828", "0.4954659", "0.49465013", "0.49435118", "0.49303457", "0.49296522", "0.49242854", "0.4922345", "0.49108404", "0.4909516", "0.49082288", "0.49059662", "0.4899226", "0.48980266", "0.48980266", "0.48980266", "0.48980266", "0.48979035", "0.48942673", "0.48887005", "0.48838505", "0.4874458", "0.4873736", "0.48725054", "0.48696214", "0.48664528", "0.486475", "0.48628885", "0.4861819", "0.48609266", "0.48581845", "0.48569676", "0.48536256", "0.48487297", "0.4834481" ]
0.733047
0
GET /env_prefs/new GET /env_prefs/new.json
def new @env_pref = EnvPref.new respond_to do |format| format.html # new.html.erb format.json { render json: @env_pref } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @env_pref = EnvPref.new(params[:env_pref])\n\n respond_to do |format|\n if @env_pref.save\n format.html { redirect_to @env_pref, notice: 'Env pref was successfully created.' }\n format.json { render json: @env_pref, status: :created, location: @env_pref }\n else\n format.html { render action: \"new\" }\n format.json { render json: @env_pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @preference = Preference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @preference }\n end\n end", "def show\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @env_pref }\n end\n end", "def new\n @var_conf = VarConf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @var_conf }\n end\n end", "def new\n @preference = Preference.new\n\n respond_to do |format|\n if user_signed_in?\n format.html # new.html.erb\n format.json { render json: @preference }\n else\n format.html { redirect_to new_user_session_path, notice: 'Please sign in to create an preference' }\n format.json { render :layout=>false }\n end\n end\n end", "def new\n @cys_env = CysEnv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cys_env }\n end\n end", "def create\n @pref = Pref.new(pref_params)\n\n respond_to do |format|\n if @pref.save\n format.html { redirect_to @pref, notice: 'Pref was successfully created.' }\n format.json { render :show, status: :created, location: @pref }\n else\n format.html { render :new }\n format.json { render json: @pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user_preference = UserPreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_preference }\n end\n end", "def new\n @setting = Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @setting }\n end\n end", "def new\n @conf = Conf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conf }\n end\n end", "def new\n @fundamental_setting = Fundamental::Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_setting }\n end\n end", "def new\n @preference = Preference.new\n @preference.user_id = current_account.id\n list\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @preference }\n end\n end", "def new\n @setting = Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @setting }\n end\n end", "def new\n @user_pref = UserPref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_pref }\n end\n end", "def new\n @environment = @project.environments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @environment }\n end\n end", "def new\n @pluto_environment_variable = collection.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pluto_environment_variable }\n end\n end", "def new\n @purchase_preference = PurchasePreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_preference }\n end\n end", "def new\n @preference_criterium = PreferenceCriterium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preference_criterium }\n end\n end", "def update\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n if @env_pref.update_attributes(params[:env_pref])\n format.html { redirect_to @env_pref, notice: 'Env pref was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @env_pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @environment = Environment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @environment }\n end\n end", "def new\n @user_preference = UserPreference.new\n @user_preference.user = current_user\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_preference }\n end\n end", "def create\n @preference = Preference.new(params[:preference])\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to preferences_path, notice: 'Preference was successfully created.' }\n format.json { render json: preferences_path, status: :created, location: @preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @env_pref = EnvPref.find(params[:id])\n @env_pref.destroy\n\n respond_to do |format|\n format.html { redirect_to env_prefs_url }\n format.json { head :ok }\n end\n end", "def new\n @app_var = AppVar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app_var }\n end\n end", "def new\n @sysconfig = Sysconfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sysconfig }\n end\n end", "def new\n @operation_setting = OperationSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation_setting }\n end\n end", "def create\n @preference = Preference.new(params[:preference])\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to @preference, :notice => 'Preference was successfully created.' }\n format.json { render :json => @preference, :status => :created, :location => @preference }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @global_config = AppConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_config }\n end\n end", "def new\n @setting = Setting.new\n authorize @setting, :new?\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def new\n @environment_type = EnvironmentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @environment_type }\n end\n end", "def new\n @notify_config = NotifyConfig.new\n\n add_breadcrumb('Create Notification Configuration')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify_config }\n end\n end", "def new\n @preference = Preference.new\n @customer_names = Customer.all(:order => 'last_name ASC')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preference }\n end\n end", "def create\n @preference = Preference.new(params[:preference])\n\n respond_to do |format|\n if @preference.save\n format.html { redirect_to @preference, notice: 'Preference was successfully created.' }\n format.json { render json: @preference, status: :created, location: @preference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @environment = current_user.environments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @environment }\n end\n end", "def new\n @website_setting = WebsiteSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @website_setting }\n end\n end", "def new\n @flag = current_user.flags.build(params[:flag])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flag }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @meal_preference = MealPreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_preference }\n end\n end", "def new\n @environment = Environment.new\n\n respond_to do |format|\n format.js # new.html.erb\n format.json { render json: @environment }\n end\n end", "def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prop }\n end\n end", "def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end", "def new\n @kf_global_config = Kf::GlobalConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_global_config }\n end\n end", "def new\n @global_page_setting = GlobalPageSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @global_page_setting }\n end\n end", "def new\n @setting = current_user.setting || Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end", "def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end", "def create\n @user_pref = UserPref.new(params[:user_pref])\n\n respond_to do |format|\n if @user_pref.save\n format.html { redirect_to(@user_pref, :notice => 'User pref was successfully created.') }\n format.xml { render :xml => @user_pref, :status => :created, :location => @user_pref }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_pref.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @flag = Flag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flag }\n end\n end", "def new\n @red_flag = RedFlag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @red_flag }\n end\n end", "def new\n @proyect = Proyect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proyect }\n end\n end", "def new\n @user_preference = UserPreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_preference }\n end\n end", "def new\n @user_game_preference = UserGamePreference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user_game_preference }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @system_config = SystemConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system_config }\n end\n end", "def new\n @site_config = SiteConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_config }\n end\n end", "def new\n @level = Level.new\n @level.set_defaults\n bingo!(\"create_level_button\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @level }\n end\n end", "def new\n @proef = Proef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proef }\n end\n end", "def new\n\t\t@keyboard_shortcut_profile = current_user.keyboard_shortcut_profiles.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @keyboard_shortcut_profile }\n\t\t\tformat.json { render :json => @keyboard_shortcut_profile }\n\t\t\tformat.yaml { render :text => @keyboard_shortcut_profile.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend", "def new\n @confrence = Confrence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @confrence }\n end\n end", "def new\n @wp_dyna_config = WpDynaConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wp_dyna_config }\n end\n end", "def create\n @var_conf = VarConf.new(params[:var_conf])\n\n respond_to do |format|\n if @var_conf.save\n format.html { redirect_to @var_conf, :notice => 'Var conf was successfully created.' }\n format.json { render :json => @var_conf, :status => :created, :location => @var_conf }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @var_conf.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cfg = Cfg.new(cfg_params)\n\n respond_to do |format|\n if @cfg.save\n format.html { redirect_to @cfg, notice: 'Cfg was successfully created.' }\n format.json { render :show, status: :created, location: @cfg }\n else\n format.html { render :new }\n format.json { render json: @cfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @configtable = Configtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configtable }\n end\n end", "def create\n @pluto_environment_variable = collection.build(params[:pluto_environment_variable])\n\n respond_to do |format|\n if @pluto_environment_variable.save\n format.html do\n flash[:success] = 'Environment variable was successfully created.'\n redirect_to @core_application\n end\n format.json { render json: @pluto_environment_variable, status: :created, location: @pluto_environment_variable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pluto_environment_variable.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @requirement_priority = RequirementPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @requirement_priority }\n end\n end", "def new\n @funding_status_option = FundingStatusOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @funding_status_option }\n end\n end", "def new\n @setting = Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def new\n @setting = Setting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setting }\n end\n end", "def new\n @evaluationstatus = Evaluationstatus.new\n @title = 'New Evaluation Status'\n @description = 'Add a new evaluation status to the system'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluationstatus }\n end\n end", "def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @health_level }\n end\n end", "def new\n @configure = Configure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @configure }\n end\n end", "def new\n @breadcrumb = 'create'\n @ticket_priority = TicketPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ticket_priority }\n end\n end", "def new\n @propose = Propose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @propose }\n end\n end", "def new\n @agent_status = AgentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agent_status }\n end\n end", "def set_whats_new_url(args = {}) \n put(\"/globalsettings.json/news/url\", args)\nend", "def new\n profile_finish?\n\n if current_user && ( current_user.status == \"agent\" || current_user.status == \"admin\" )\n @vacancy = Vacancy.new\n @countries = Country.all\n @states = State.all\n @cities = City.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vacancy }\n end\n else\n root_path\n end\n end", "def new\n @presence = Presence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presence }\n end\n end", "def new\n @approval = Approval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @approval }\n end\n end", "def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n #TODO This needs to be rethought. All requirements for most users should start life as a user_requirement? Unless an admin?\n\n\n @requirement.status = 'Public'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requirement }\n end\n end", "def new\n @kv = Kv.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kv }\n end\n end", "def new\n @api_version = ApiVersion.new\n\n set_tabbed_translation_form_settings('advanced')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @api_version }\n end\n end", "def new\n @flavor = Flavor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @flavor }\n end\n end", "def new\n @key_pair = KeyPair.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key_pair }\n end\n end", "def new\n @inventory_clearance_setting = InventoryClearanceSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_clearance_setting }\n end\n end", "def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end", "def new\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end", "def new\n @preservative = Preservative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preservative }\n end\n end", "def new\n @feature = current_user.features.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "def new\n @preset = Preset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preset }\n end\n end", "def new\n @config_file = ConfigFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @config_file }\n end\n end", "def new\n @admin_level = AdminLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_level }\n end\n end", "def new\n @invite_status = InviteStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invite_status }\n end\n end", "def set_new_form_vars\n @edit = {}\n @edit[:key] = \"sm_edit__new\"\n @edit[:new] = {}\n @edit[:current] = {}\n\n @edit[:new][:name] = nil\n @edit[:sm_types] = StorageManager.storage_manager_types\n @edit[:new][:hostname] = nil\n @edit[:new][:ipaddress] = nil\n @edit[:new][:port] = nil\n @edit[:new][:sm_type] = nil\n # @edit[:new][:agent_type] = nil\n @edit[:new][:zone] = \"default\"\n @edit[:server_zones] = []\n zones = Zone.all\n zones.each do |zone|\n @edit[:server_zones].push(zone.name)\n end\n\n @edit[:new][:userid] = nil\n @edit[:new][:password] = nil\n @edit[:new][:verify] = nil\n\n session[:verify_sm_status] = nil\n set_verify_status\n\n @edit[:current] = @edit[:new].dup\n session[:edit] = @edit\n end", "def new\n @product_setting = ProductSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_setting }\n end\n end" ]
[ "0.7330188", "0.6307571", "0.6088916", "0.5970165", "0.5953812", "0.59233856", "0.5907312", "0.58819664", "0.58267313", "0.5808982", "0.5807139", "0.57815534", "0.5769145", "0.5761105", "0.5757839", "0.5742878", "0.57225716", "0.5646083", "0.5643883", "0.56200016", "0.56089497", "0.5597677", "0.5568675", "0.5545751", "0.55435246", "0.5534738", "0.5534735", "0.55336344", "0.5528036", "0.5504566", "0.550447", "0.550417", "0.54695565", "0.54635394", "0.5445183", "0.54403687", "0.54309726", "0.542668", "0.5388756", "0.5381708", "0.53809834", "0.5377284", "0.53493327", "0.5332645", "0.53315854", "0.53229207", "0.53130066", "0.52994335", "0.52994335", "0.529473", "0.5288349", "0.5276946", "0.5265144", "0.5259276", "0.52588826", "0.5246219", "0.52389795", "0.52377427", "0.52350473", "0.5221639", "0.5220179", "0.5217631", "0.5213591", "0.52124655", "0.5189203", "0.51876664", "0.518524", "0.51814485", "0.51749307", "0.5170009", "0.5170009", "0.51593024", "0.5159026", "0.5156922", "0.5148299", "0.5147421", "0.5140716", "0.5139271", "0.5135387", "0.5134709", "0.51340544", "0.5132221", "0.5131791", "0.5123116", "0.5120738", "0.5119289", "0.5109617", "0.51070976", "0.5099524", "0.5092709", "0.508762", "0.50869864", "0.50763726", "0.50737613", "0.50716764", "0.50711626", "0.5069099", "0.5060784", "0.5058831", "0.5057548" ]
0.8035643
0
POST /env_prefs POST /env_prefs.json
def create @env_pref = EnvPref.new(params[:env_pref]) respond_to do |format| if @env_pref.save format.html { redirect_to @env_pref, notice: 'Env pref was successfully created.' } format.json { render json: @env_pref, status: :created, location: @env_pref } else format.html { render action: "new" } format.json { render json: @env_pref.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @env_pref = EnvPref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @env_pref }\n end\n end", "def update\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n if @env_pref.update_attributes(params[:env_pref])\n format.html { redirect_to @env_pref, notice: 'Env pref was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @env_pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_env\n f = File.new(TddDeploy::Environ::ENV_FNAME, \"w\")\n self.env_types.keys.sort.each do |k|\n v = self.env_hash[k] || ''\n case self.env_types[k]\n when :int then f.write \"#{k}=#{v}\\n\"\n when :string then f.write \"#{k}=#{v}\\n\"\n when :list then\n f.write \"#{k}=#{self.list_to_str(k)}\\n\" unless k == 'hosts'\n when :pseudo then next\n when :capfile then next\n else\n raise ::RuntimeError.new(\"unknown key: #{k}\")\n end\n end\n f.close\n end", "def save_env; end", "def save_settings\n @list_id = env['TRELLO_TARGET_LIST_ID']\n @key = env['TRELLO_APP_KEY']\n @secret = env['TRELLO_SECRET']\n @token = env['TRELLO_USER_TOKEN']\n end", "def destroy\n @env_pref = EnvPref.find(params[:id])\n @env_pref.destroy\n\n respond_to do |format|\n format.html { redirect_to env_prefs_url }\n format.json { head :ok }\n end\n end", "def _save_env\n require 'yaml'\n w_var = @var.dup\n @var[:blacklist_env].each { |b| w_var.delete b } if @var[:blacklist_env]\n _open_sefile('env3.yml', 'w') { |f| YAML.dump(w_var, f) }\nend", "def save_settings\n @list_id = env['TRELLO_TARGET_LIST_ID']\n @key = env['TRELLO_APP_KEY']\n @secret = env['TRELLO_SECRET']\n @token = env['TRELLO_USER_TOKEN']\n @archive_card = env['ARCHIVE_CARD']\n end", "def prefs_params\n params.require(:preference).permit(:facebook,:twitter,:telephone,:telephone2,:email,:key,:value,:paypal)\n end", "def settings\n request(Resources::RESOURCE_SETTINGS, HTTP_METHOD_POST)\n end", "def req_env_post_parse(env); end", "def patch_user_env_variables(vars)\n Application.run_in_application_lock(self) do\n op_group = PendingAppOpGroup.new(op_type: :patch_user_env_vars, args: {\"user_env_vars\" => vars}, user_agent: self.user_agent)\n self.pending_op_groups.push op_group\n result_io = ResultIO.new\n self.run_jobs(result_io)\n result_io\n end\n end", "def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end", "def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end", "def export_dynatrace_app_environment_variables\n profiled_dir = File.join(@app_dir, '.profile.d')\n FileUtils.mkdir_p(profiled_dir)\n\n variables = {}\n variables[RUXIT_APPLICATION_ID] = application_id\n variables[RUXIT_HOST_ID] = host_id\n\n env_file_name = File.join(profiled_dir, '0dynatrace-app-env.sh')\n env_file = File.new(env_file_name, 'w')\n variables.each do |key, value|\n env_file.puts(\"export #{key}=\\\"${#{key}:-#{value}}\\\"\") # \"${VAR1:-default value}\"\n end\n env_file.close\n end", "def add_env_variables(vars, parent_op=nil)\n Application.run_in_application_lock(self) do\n op_group = PendingAppOpGroup.new(op_type: :update_configuration, args: {\"add_env_vars\" => vars}, parent_op: parent_op, user_agent: self.user_agent)\n self.pending_op_groups.push op_group\n result_io = ResultIO.new\n self.run_jobs(result_io)\n result_io\n end\n end", "def req_env_post_parse(env)\n to_delete = nil\n to_add = nil\n\n env.each do |k,v|\n if k.start_with?(\"HTTP_\") && k.include?(\",\") && k != \"HTTP_TRANSFER,ENCODING\"\n if to_delete\n to_delete << k\n else\n to_delete = [k]\n end\n\n unless to_add\n to_add = {}\n end\n\n to_add[k.tr(\",\", \"_\")] = v\n end\n end\n\n if to_delete\n to_delete.each { |k| env.delete(k) }\n env.merge! to_add\n end\n end", "def add_preference(name, value); end", "def add_preference(name, value); end", "def create\n @pluto_environment_variable = collection.build(params[:pluto_environment_variable])\n\n respond_to do |format|\n if @pluto_environment_variable.save\n format.html do\n flash[:success] = 'Environment variable was successfully created.'\n redirect_to @core_application\n end\n format.json { render json: @pluto_environment_variable, status: :created, location: @pluto_environment_variable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pluto_environment_variable.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @env_pref }\n end\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def add_preference(name, value)\n @options[:prefs][name] = value\n end", "def email_notification_preferences=(prefs_attributes)\n prefs = self.email_notification_preferences # init the object if it wasn't there\n prefs_attributes.each{|key, val| prefs.send(\"#{key}=\", val==\"true\")}\n write_attribute(:email_notification_preferences, prefs)\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def preference_params\n params.require(:preference).permit(:status, :user_id, :country_id)\n end", "def update_consul_stack_env_vars\n require 'diplomat'\n require 'json'\n data = {}\n @tf_vars_from_env.each_value { |k| data[k] = ENV[k] }\n\n Diplomat.configure do |config|\n config.url = @consul_url\n end\n\n puts \"Writing stack information to #{@consul_url} at: \"\\\n \"#{@consul_env_vars_prefix}\"\n\n redacted_list = (%w[aws_access_key aws_secret_key] +\n @tf_sensitive_vars)\n sanitized_data = data.clone\n @tf_vars_from_env.each do |k, v|\n # We are trying to determine which ENV var maps\n # to the sensitive terraform variable\n sanitized_data[v] = '(redacted)' if redacted_list.include?(k)\n end\n puts JSON.pretty_generate(sanitized_data)\n raw = JSON.generate(data)\n Diplomat::Kv.put(@consul_env_vars_prefix, raw)\n end", "def test_should_save_settings\n prefs = {\n \"store_name\" => \"Substruct\",\n \"store_handling_fee\" => \"0.00\",\n \"store_use_inventory_control\"=>\"1\"\n }\n assert Preference.save_settings(prefs)\n end", "def save_autoshare_prefs(network, params)\n events = params.select {|k,v| v == '1'}.keys\n rv = preferences.save_autoshare_opt_ins(network, events)\n if rv\n @preferences = rv\n true\n else\n false\n end\n end", "def prefs_params\n params.require(:prefs).permit({ company: %i[vat bank name email phone acc_eur acc_ron address capital contact registration] }, main: [{ paid_by: [] }, { veh_cat: [] }, { vat_rate: [] }, { activities: [] }, { currencies: [] }, :salar_baza, :diurna_baza])\n end", "def settings(key)\n ENV[key.to_s.upcase] || monk_settings(key)\nend", "def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend", "def env(key, value)\n @environment_variables[key] = value \n end", "def set_env(papers, site_host, site_name, nwo)\n ENV['REVIEW_REPOSITORY'] = nwo\n ENV['DOI_PREFIX'] = \"10.21105\"\n ENV['PAPER_REPOSITORY'] = papers\n ENV['JOURNAL_URL'] = site_host\n ENV['JOURNAL_NAME'] = site_name\n end", "def export_env(env = {})\n @env = env\n end", "def encode_env(env)\n env = env.dup\n env.keep_if { |k, v| k =~ /[A-Z]/ }\n env.to_yaml(:Encoding => :Utf8)\n end", "def environment_credentials\n {\n url: ENV['ONEVIEW_URL'],\n ssl_enabled: ENV['ONEVIEW_SSL_ENABLED'],\n log_level: ENV['ONEVIEW_LOG_LEVEL'] || 'info',\n api_version: ENV['ONEVIEW_API_VERSION'] || 200,\n token: ENV['ONEVIEW_TOKEN'] || nil,\n user: ENV['ONEVIEW_USER'] || nil,\n password: ENV['ONEVIEW_PASSWORD'] || nil,\n hardware_variant: ENV['ONEVIEW_HARDWARE_VARIANT'] || 'C7000'\n }\nend", "def install_prefs!\n return false unless File.exists?(prefs_bak)\n\n puts \" preferences: #{prefs_dest.inspect}\"\n FileUtils.cp(prefs_bak, prefs_dest)\n true\n end", "def launcher_env_options(opts)\n if getenv(\"AUTH_TYPE\") == \"RANDOM\"\n ## each day we want to use different auth type ignoring weekends\n time = Time.now\n day_of_year = time.yday\n passed_weeks_of_year = time.strftime('%W').to_i - 1\n opts[:auth_type] = ALTERNATING_AUTH[\n (day_of_year - 2 * passed_weeks_of_year) % ALTERNATING_AUTH.size\n ]\n elsif getenv(\"AUTH_TYPE\")\n opts[:auth_type] = getenv(\"AUTH_TYPE\")\n end\n\n # workaround https://issues.jenkins-ci.org/browse/JENKINS-30719\n # that means to remove extra `\\` chars\n ENV['IMAGE_PRE'] = ENV['IMAGE_PRE'].gsub(/\\\\\\${/,'${') if ENV['IMAGE_PRE']\n\n keys = [:crt_path, :deployment_type,\n :hosts_spec, :auth_type,\n :ssh_key, :ssh_user,\n :app_domain, :host_domain,\n :rhel_base_repo,\n :dns, :set_hostnames,\n :use_rpm_playbook,\n :use_nfs_storage,\n :image_pre,\n :puddle_repo,\n :etcd_num,\n :pre_ansible,\n :ansible_url,\n :customized_ansible_conf,\n :kerberos_docker_base_image,\n :kerberos_kdc, :kerberos_keytab_url,\n :kerberos_docker_base_image,\n :kerberos_admin_server]\n\n keys.each do |key|\n val = getenv(key.to_s.upcase)\n opts[key] = val if val\n end\n\n opts[:use_rpm_playbook] = false unless to_bool(opts[:use_rpm_playbook])\n opts[:use_nfs_storage] = false unless to_bool(opts[:use_nfs_storage])\n end", "def list_user_env_variables(vars=[])\n result_io = get_app_dns_gear.list_user_env_vars(vars)\n JSON.parse(result_io.resultIO.string)\n end", "def prefs_to_hash prefs\n h = {}\n prefs.each do |pref|\n h[pref['id']] = pref['value']\n end\n h\n end", "def update_prefs(user_id:, prefs:)\n path = '/users/{userId}/prefs'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if prefs.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"prefs\"')\n end\n\n params = {\n prefs: prefs,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Preferences\n )\n end", "def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:each)\n end", "def env_key; end", "def set_remote_env(env); end", "def load_envvars\n Pkg::Params::ENV_VARS.each do |v|\n if var = ENV[v[:envvar].to_s]\n case v[:type]\n when :bool\n self.instance_variable_set(\"@#{v[:var]}\", Pkg::Util.boolean_value(var))\n when :array\n self.instance_variable_set(\"@#{v[:var]}\", string_to_array(var))\n else\n self.instance_variable_set(\"@#{v[:var]}\", var)\n end\n end\n end\n end", "def environment_params\n params.require(:environment).permit(:name, :supervisor_name, :supervisor_email,\n :notify_supervisor)\n end", "def add_env_var key, val\n key = key.to_s\n env_file = self[:ssh_env_file]\n escaped_val = Regexp.escape(val).gsub('/', '\\/').gsub(';', '\\;')\n # see if the key/value pair already exists\n if exec(Beaker::Command.new(\"grep ^#{key}=.*#{escaped_val} #{env_file}\"), :accept_all_exit_codes => true).exit_code == 0\n return # nothing to do here, key value pair already exists\n # see if the key already exists\n elsif exec(Beaker::Command.new(\"grep ^#{key}= #{env_file}\"), :accept_all_exit_codes => true).exit_code == 0\n exec(Beaker::SedCommand.new(self['platform'], \"s/^#{key}=/#{key}=#{escaped_val}:/\", env_file))\n else\n exec(Beaker::Command.new(\"echo \\\"#{key}=#{val}\\\" >> #{env_file}\"))\n end\n\n # update the profile.d to current state\n # match it to the contents of ssh_env_file\n mirror_env_to_profile_d(env_file)\n end", "def update_email_preferences\n prefs = preference_params\n authorize User\n pref = current_user.pref\n # does user not have prefs?\n if pref.blank?\n pref = Pref.new\n pref.settings = {}\n pref.user = current_user\n end\n pref.settings['email'] = booleanize_hash(prefs['prefs'])\n pref.save\n\n # Include active tab in redirect path\n redirect_to \"#{edit_user_registration_path}#notification-preferences\",\n notice: success_message(pref, _('saved'))\n end", "def environment=(env_options)\n env_options.each do |key, value|\n ENV[key] = value\n end\n end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def install_prefs\n return false if File.exists?(prefs_dest)\n install_prefs!\n end", "def env_vars\n { \"OS_CLIENT_CONFIG_FILE\" => os_credentials_file }\n end", "def envvar\n CircleCi.request(@conf, \"/project/#{username}/#{project}/envvar\").get\n end", "def environments=(env_params)\n env_params.each do |env_hash|\n next unless env_hash[:features]\n env_hash[:features].each do |feature_hash|\n self.features.build(feature_hash)\n end\n end\n end", "def pref_params\n params.require(:pref).permit(:name)\n end", "def write_preferences(dict, path)\n dict.writeToFile_atomically(path, true)\n end", "def export_dynatrace_connection_environment_variables\n profiled_dir = File.join(@app_dir, '.profile.d')\n FileUtils.mkdir_p(profiled_dir)\n\n if supports_apitoken? && File.file?(File.join(@app_dir, DYNATRACE_HOME_DIR, 'dynatrace-env.sh'))\n # copy dynatrace-env.sh from agent zip to .profile.d for setting DT_CONNECTION_POINT etc\n dynatrace_env_sh = File.join(@app_dir, DYNATRACE_HOME_DIR, 'dynatrace-env.sh')\n FileUtils.cp(dynatrace_env_sh, profiled_dir)\n else\n credentials = @services.find_service(DYNATRACE_SERVICE_NAME)[CREDENTIALS_KEY]\n variables = {}\n variables[DT_TENANT] = tenant(credentials)\n variables[DT_TENANTTOKEN] = tenanttoken(credentials)\n variables[DT_CONNECTION_POINT] = server(credentials)\n\n env_file_name = File.join(profiled_dir, 'dynatrace-env.sh')\n env_file = File.new(env_file_name, 'w')\n variables.each do |key, value|\n env_file.puts(\"export #{key}=\\\"${#{key}:-#{value}}\\\"\") # \"${VAR1:-default value}\"\n end\n env_file.close\n end\n end", "def get_api_key_storage_preference\n io.puts \"\"\n io.puts IO::Messages.separator\n io.puts \"\"\n io.puts \"For production/staging would you like to store your Timber API key\"\n io.puts \"in an environment variable? (TIMBER_API_KEY)\"\n io.puts \"\"\n io.puts \"y) Yes, store in TIMBER_API_KEY\", :blue\n io.puts \"n) No, just paste the API key inline\", :blue\n io.puts \"\"\n\n case io.ask_yes_no(\"Enter your choice:\", event_prompt: \"Store API key in env?\")\n when :yes\n io.puts \"\"\n io.puts IO::Messages.http_environment_variables(api.api_key)\n io.puts \"\"\n\n io.ask_to_proceed\n\n :environment\n when :no\n :inline\n end\n end", "def settings_put\n \n # expected to set ALL values in one put using checkboxes\n # for this reason, missing values are assumed FALSE\n current_user.settings(:ui).refresh = params[:refresh].to_i rescue current_user.settings(:ui).refresh\n current_user.settings(:ui).fast_refresh = params[:fast_refresh].to_i rescue current_user.settings(:ui).fast_refresh\n current_user.settings(:ui).edge = params[:edge].eql?('true') rescue false\n current_user.settings(:ui).test = params[:test].eql?('true') rescue false\n current_user.settings(:ui).debug = params[:debug].eql?('true') rescue false\n current_user.settings(:ui).milestone_roles = params[:milestone_roles].eql?('true') rescue false\n current_user.settings(:errors).expand = params[:expand].eql?('true') rescue false\n current_user.settings(:docs).sources = params[:doc_sources].eql?('true') rescue false\n current_user.save!\n #render :json=>true\n redirect_to :action => :settings\n\n end", "def default_environment=(env); end", "def edit_settings(settings)\n queries = password_hash\n queries[:query][:settings] = \"#{settings.to_json}\"\n put \"/setup/api/settings\", queries\n end", "def update_env_file!\n present_env = ssh_read_file(app_username, \"#{ app_name }/.env\").to_s\n\n env = {\n \"RAILS_ENV\" => \"production\",\n \"PATH\" => \"/home/#{ app_username }/.rvm/wrappers/#{ app_name }:$PATH\",\n \"SECRET_KEY_BASE\" => SecureRandom.hex(64),\n }.merge(\n Dotenv::Parser.call(present_env)\n ).merge(\n options[:env] || {}\n ).map { |k, v|\n \"export #{ k }=#{ v.inspect }\\n\"\n }.join(\"\")\n\n ssh_write_file(app_username, \"#{ app_name }/.env\", env)\n end", "def m_pref_params\n params.require(:m_pref).permit(:pref_name)\n end", "def setenv(n, v)\n debug \"Adding env: #{n}=#{v}\"\n debug \"prev value: #{@rye_getenv[n]}\"\n @rye_getenv[n] = v\n (@rye_current_environment_variables ||= {})[n] = v\n self\n end", "def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend", "def setup_profiled(**args)\n super(**args)\n default_env_vars.each do |key, value|\n set_env_default key, value\n end\n end", "def env_vars\n {\n \"VMWARE_USER\" => auth.userid || \"\",\n \"VMWARE_PASSWORD\" => auth.password || \"\",\n \"VMWARE_HOST\" => auth.host || \"\"\n }\n end", "def setting_params\n params.require(:setting).permit(:var, :value)\n end", "def preference_params\n params.require(:options)\n params.require(:obs)\n params.require(:aux1)\n params.require(:user_id)\n params.permit(:options, :obs, :aux1, :user_id)\n end", "def setting_params\n params.fetch(:setting, {}).permit(:key, :value)\n end", "def env(name, value)\n Stairs.configuration.env_adapter.set name, value\n end", "def normalize_env(env, client); end", "def _prefs_raw\n resp = run_and_capture(flag_get_pref)\n fail_msg = \"Arduino binary failed to operate as expected; you will have to troubleshoot it manually\"\n raise ArduinoExecutionError, \"#{fail_msg}. The command was #{@last_msg}\" unless resp[:success]\n\n @prefs_fetched = true\n resp[:out]\n end", "def setting_params\n params.permit(:setting, :key, :value, :location) #, :key, :value, :location, #:system_node_id )\n end", "def settings\n get \"/setup/api/settings\", password_hash\n end", "def env=(environment); end", "def env=(environment); end", "def ask_pref(preference, prompt)\n prefs[preference] = ask_wizard(prompt)\nend", "def test_should_have_preferences\n u = users(:basic_user)\n assert_nil u.settings['arbitrary']\n u.settings['arbitrary'] = 'the arbitrary setting'\n u.reload\n assert_equal 'the arbitrary setting', u.settings['arbitrary']\n end", "def hacked_env\n @hacked_env ||= {}\n end", "def update(name:, environment_variables:)\n GOCD.logger.info(\"updating environment #{name}\")\n endpoint = sprintf(\"/go/api/admin/environments/%s\", name)\n headers = {\n 'Accept' => 'application/vnd.go.cd.v2+json',\n 'Content-Type' => 'application/json',\n \"If-Match\" => etag(name)\n }\n payload = {\n \"name\" => name,\n \"environment_variables\" => environment_variables,\n }.to_json\n resp = Client.send(method: :put, endpoint: endpoint, payload: payload, headers: headers)\n end", "def setenv( vm, host )\n return unless host.key?('env')\n cmd=\"tee -a \\\"/etc/profile.d/setenv.sh\\\" > \\\"/dev/null\\\" <<ENDHERE\"\n host['env'].each do |key, val|\n cmd=\"#{cmd}\\nexport #{key}=\\\"#{val}\\\"\"\n end\n cmd=\"#{cmd}\\nENDHERE\"\n vm.provision \"shell\", inline: cmd, run: \"always\"\nend", "def cmd_getenv(*args)\n vars = client.sys.config.getenvs(*args)\n\n if vars.length == 0\n print_error(\"None of the specified environment variables were found/set.\")\n else\n table = Rex::Text::Table.new(\n 'Header' => 'Environment Variables',\n 'Indent' => 0,\n 'SortIndex' => 1,\n 'Columns' => [\n 'Variable', 'Value'\n ]\n )\n\n vars.each do |var, val|\n table << [ var, val ]\n end\n\n print_line\n print_line(table.to_s)\n end\n end", "def export_config_to_env\n ENV['TAOBAO_API_KEY'] = config['app_key']\n ENV['TAOBAO_SECRET_KEY'] = config['secret_key']\n ENV['TAOBAO_ENDPOINT'] = config['endpoint']\n ENV['TAOBAO_AUTHORIZE'] = config['authorize']\n ENV['TAOBAO_TOKEN'] = config['token']\n ENV['TAOBAO_AUTHORIZE_REDIRECT_URI'] = config['authorize_redirect_uri']\n ENV['TAOBAO_TOKEN_REDIRECT_URI'] = config['token_redirect_uri']\n end", "def restore_env(env); end", "def remove_env_variables(vars, parent_op=nil)\n Application.run_in_application_lock(self) do\n op_group = PendingAppOpGroup.new(op_type: :update_configuration, args: {\"remove_env_vars\" => vars}, parent_op: parent_op, user_agent: self.user_agent)\n self.pending_op_groups.push op_group\n result_io = ResultIO.new\n self.run_jobs(result_io)\n result_io\n end\n end", "def update\n @pluto_environment_variable = collection.find(params[:id])\n\n respond_to do |format|\n if @pluto_environment_variable.update_attributes(params[:pluto_environment_variable])\n format.html do\n flash[:success] = 'Environment variable was successfully updated.'\n redirect_to @core_application\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pluto_environment_variable.errors, status: :unprocessable_entity }\n end\n end\n end", "def addtoenv(name,w,base)\n if ENV[name[0]] == nil\n ENV[name[0]] = base + \"/\" + w\n elsif ENV[name[0]].index(w) == nil\n ENV[name[0]] += \":\"+base + \"/\"+ w + \"/\"+name[1]\n end\nend", "def environment_params\n params.require(:environment).permit(\n :name, :k8s_master,\n :k8s_username, :k8s_password\n )\n end", "def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end", "def clean_env_vars\n envs = %w(\n REPORT_SERVICE_SELF_URL REPORT_SERVICE_URL REPORT_SERVICE_TOKEN\n )\n envs.each { |e| ENV.delete(e) }\nend", "def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end", "def register_env_var(env_var)\n registered_env_vars[env_var.key] = env_var\n\n # TahiEnv#APP_NAME\n reader_method_name = env_var.key\n define_method(reader_method_name) do\n env_var.raw_value_from_env\n end\n\n # TahiEnv#app_name\n # TahiEnv#orcid_login_enabled? for boolean\n reader_method_name = \"#{env_var.key.downcase}\"\n reader_method_name << \"?\" if env_var.boolean?\n define_method(reader_method_name) do\n env_var.value\n end\n end" ]
[ "0.61411256", "0.59466326", "0.5854163", "0.5849115", "0.58018845", "0.58012104", "0.57107455", "0.5658559", "0.56441", "0.5594682", "0.55498517", "0.54122823", "0.5389822", "0.538783", "0.5383525", "0.533814", "0.5335871", "0.5304771", "0.5304771", "0.53015447", "0.5298862", "0.5298551", "0.52785784", "0.5272814", "0.5240582", "0.5240582", "0.5240582", "0.5240582", "0.52235514", "0.5221218", "0.51942486", "0.5178744", "0.51684755", "0.51338947", "0.5121093", "0.511906", "0.50983846", "0.5079988", "0.50533694", "0.5049111", "0.5040283", "0.5020733", "0.501896", "0.49879616", "0.49817634", "0.497041", "0.49417314", "0.49327937", "0.4929974", "0.4929042", "0.492676", "0.49174318", "0.4915185", "0.49072036", "0.49072036", "0.49072036", "0.49072036", "0.49010524", "0.48963237", "0.4882223", "0.4878461", "0.48763067", "0.48710215", "0.48707995", "0.4859255", "0.48588353", "0.48330787", "0.48192665", "0.48101535", "0.4808853", "0.4793416", "0.4788762", "0.47870782", "0.4775851", "0.47608894", "0.4757161", "0.4756384", "0.4753047", "0.47508126", "0.47426754", "0.47403884", "0.47388154", "0.47348085", "0.47348085", "0.47338948", "0.47275963", "0.47269088", "0.4719474", "0.47180772", "0.47041813", "0.47039643", "0.47028407", "0.4700204", "0.46951413", "0.46909815", "0.4685043", "0.46832162", "0.46814921", "0.467642", "0.46760666" ]
0.7136452
0
PUT /env_prefs/1 PUT /env_prefs/1.json
def update @env_pref = EnvPref.find(params[:id]) respond_to do |format| if @env_pref.update_attributes(params[:env_pref]) format.html { redirect_to @env_pref, notice: 'Env pref was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @env_pref.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @env_pref = EnvPref.new(params[:env_pref])\n\n respond_to do |format|\n if @env_pref.save\n format.html { redirect_to @env_pref, notice: 'Env pref was successfully created.' }\n format.json { render json: @env_pref, status: :created, location: @env_pref }\n else\n format.html { render action: \"new\" }\n format.json { render json: @env_pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_prefs\n current_user.preferences = params[:preferences]\n render plain: \"1\"\n end", "def destroy\n @env_pref = EnvPref.find(params[:id])\n @env_pref.destroy\n\n respond_to do |format|\n format.html { redirect_to env_prefs_url }\n format.json { head :ok }\n end\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def update_prefs(user_id:, prefs:)\n path = '/users/{userId}/prefs'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if prefs.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"prefs\"')\n end\n\n params = {\n prefs: prefs,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Preferences\n )\n end", "def new\n @env_pref = EnvPref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @env_pref }\n end\n end", "def show\n @env_pref = EnvPref.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @env_pref }\n end\n end", "def edit_settings(settings)\n queries = password_hash\n queries[:query][:settings] = \"#{settings.to_json}\"\n put \"/setup/api/settings\", queries\n end", "def update_install_preference\n if current_user.present?\n current_user.update_install_preference(preference_param)\n\n head(200)\n else\n head(404)\n end\n end", "def settings_put\n \n # expected to set ALL values in one put using checkboxes\n # for this reason, missing values are assumed FALSE\n current_user.settings(:ui).refresh = params[:refresh].to_i rescue current_user.settings(:ui).refresh\n current_user.settings(:ui).fast_refresh = params[:fast_refresh].to_i rescue current_user.settings(:ui).fast_refresh\n current_user.settings(:ui).edge = params[:edge].eql?('true') rescue false\n current_user.settings(:ui).test = params[:test].eql?('true') rescue false\n current_user.settings(:ui).debug = params[:debug].eql?('true') rescue false\n current_user.settings(:ui).milestone_roles = params[:milestone_roles].eql?('true') rescue false\n current_user.settings(:errors).expand = params[:expand].eql?('true') rescue false\n current_user.settings(:docs).sources = params[:doc_sources].eql?('true') rescue false\n current_user.save!\n #render :json=>true\n redirect_to :action => :settings\n\n end", "def updateEnvPolicyStatusInDb(env)\n rs = @con.query(\"UPDATE #{$APPENVTABLE} SET policy_status='#{env.policy_status}' WHERE envid='#{env.envid}';\")\n end", "def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend", "def update_pref\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n desktop = Desktop.get_for(@login_user, true)\n\n params[:desktop].delete(:user_id)\n\n desktop.update_attributes(params.require(:desktop).permit(Desktop::PERMIT_BASE))\n\n params.delete(:desktop)\n\n show\n render(:action => 'show')\n end", "def set_pref(key, value)\n preferences.where(key: key).first_or_create.set(value)\n end", "def add_preference(name, value)\n @options[:prefs][name] = value\n end", "def update\n @pluto_environment_variable = collection.find(params[:id])\n\n respond_to do |format|\n if @pluto_environment_variable.update_attributes(params[:pluto_environment_variable])\n format.html do\n flash[:success] = 'Environment variable was successfully updated.'\n redirect_to @core_application\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pluto_environment_variable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_email_preferences\n prefs = preference_params\n authorize User\n pref = current_user.pref\n # does user not have prefs?\n if pref.blank?\n pref = Pref.new\n pref.settings = {}\n pref.user = current_user\n end\n pref.settings['email'] = booleanize_hash(prefs['prefs'])\n pref.save\n\n # Include active tab in redirect path\n redirect_to \"#{edit_user_registration_path}#notification-preferences\",\n notice: success_message(pref, _('saved'))\n end", "def remember_preference settings\n self.preference = Preference.find_or_create_by user_id: self\n self.preference.update settings\n end", "def add_preference(name, value); end", "def add_preference(name, value); end", "def update\n respond_to do |format|\n if @pref.update(pref_params)\n format.html { redirect_to @pref, notice: 'Pref was successfully updated.' }\n format.json { render :show, status: :ok, location: @pref }\n else\n format.html { render :edit }\n format.json { render json: @pref.errors, status: :unprocessable_entity }\n end\n end\n end", "def pref\n raw_config = File.open(\"#{Rails.root}/config/prefs.yml\")\n config = YAML.load(raw_config)\n #$prefs=config.symbolize_keys[:pref]\n config\n end", "def update\n @setting.value = [email protected]\n\n @setting.save\n head 200, content_type: \"text/html\"\n end", "def update(name:, environment_variables:)\n GOCD.logger.info(\"updating environment #{name}\")\n endpoint = sprintf(\"/go/api/admin/environments/%s\", name)\n headers = {\n 'Accept' => 'application/vnd.go.cd.v2+json',\n 'Content-Type' => 'application/json',\n \"If-Match\" => etag(name)\n }\n payload = {\n \"name\" => name,\n \"environment_variables\" => environment_variables,\n }.to_json\n resp = Client.send(method: :put, endpoint: endpoint, payload: payload, headers: headers)\n end", "def update\n @user_pref = UserPref.find(params[:id])\n\n respond_to do |format|\n if @user_pref.update_attributes(params[:user_pref])\n format.html { redirect_to(@user_pref, :notice => 'User pref was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_pref.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_have_preferences\n u = users(:basic_user)\n assert_nil u.settings['arbitrary']\n u.settings['arbitrary'] = 'the arbitrary setting'\n u.reload\n assert_equal 'the arbitrary setting', u.settings['arbitrary']\n end", "def save_env; end", "def set_pref\n @pref = Pref.find(params[:id])\n end", "def prefs_params\n params.require(:preference).permit(:facebook,:twitter,:telephone,:telephone2,:email,:key,:value,:paypal)\n end", "def save_settings\n @list_id = env['TRELLO_TARGET_LIST_ID']\n @key = env['TRELLO_APP_KEY']\n @secret = env['TRELLO_SECRET']\n @token = env['TRELLO_USER_TOKEN']\n end", "def set_hacknu_preference\n @hacknu_preference = HacknuPreference.find(params[:id])\n end", "def update_settings(settings)\n request :put, \"_settings\", nil, settings\n end", "def update_settings(settings)\n request :put, \"_settings\", nil, settings\n end", "def update_settings\n end", "def set_pref(key, value)\n prefs unless @prefs_fetched # update cache first\n success = _set_pref(key, value)\n @prefs_cache[key] = value if success\n success\n end", "def install_prefs!\n return false unless File.exists?(prefs_bak)\n\n puts \" preferences: #{prefs_dest.inspect}\"\n FileUtils.cp(prefs_bak, prefs_dest)\n true\n end", "def update\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to @preference, :notice => 'Preference was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_preference(prefs_section, pref, value)\n driver.setPref(prefs_section, pref, value.to_s)\n end", "def _save_env\n require 'yaml'\n w_var = @var.dup\n @var[:blacklist_env].each { |b| w_var.delete b } if @var[:blacklist_env]\n _open_sefile('env3.yml', 'w') { |f| YAML.dump(w_var, f) }\nend", "def update_env_file!\n present_env = ssh_read_file(app_username, \"#{ app_name }/.env\").to_s\n\n env = {\n \"RAILS_ENV\" => \"production\",\n \"PATH\" => \"/home/#{ app_username }/.rvm/wrappers/#{ app_name }:$PATH\",\n \"SECRET_KEY_BASE\" => SecureRandom.hex(64),\n }.merge(\n Dotenv::Parser.call(present_env)\n ).merge(\n options[:env] || {}\n ).map { |k, v|\n \"export #{ k }=#{ v.inspect }\\n\"\n }.join(\"\")\n\n ssh_write_file(app_username, \"#{ app_name }/.env\", env)\n end", "def update\n respond_to do |format|\n if @app_setting.update(app_setting_params)\n format.html { redirect_to @app_setting, notice: 'App setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_setting }\n else\n format.html { render :edit }\n format.json { render json: @app_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @app_setting.update(app_setting_params)\n format.html { redirect_to edit_app_settings_path, notice: t('.notice') }\n format.json { render :show, status: :ok, location: @app_setting }\n else\n format.html { render :edit }\n format.json { render json: @app_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_autoshare_prefs(network, params)\n events = params.select {|k,v| v == '1'}.keys\n rv = preferences.save_autoshare_opt_ins(network, events)\n if rv\n @preferences = rv\n true\n else\n false\n end\n end", "def disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend", "def update\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to @preference, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preference = Preference.find(params[:id])\n\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to @preference, notice: 'Preference was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preference = Preference.find(params[:id])\n \n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n flash[:notice] = 'Preference was successfully updated.'\n format.html { redirect_to(admin_preference_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end", "def store(prefs)\n prefs.each do |key, value|\n self[key] = value\n end if prefs.respond_to?(:each)\n end", "def update\n authorize! :update, @concerto_config\n params[:concerto_config].each do |k,v|\n ConcertoConfig.set(k,v) #only set this if the config already exists\n end\n redirect_to :action => :index\n end", "def update!(**args)\n @can_reopen = args[:can_reopen] if args.key?(:can_reopen)\n @status = args[:status] if args.key?(:status)\n end", "def save_settings\n @list_id = env['TRELLO_TARGET_LIST_ID']\n @key = env['TRELLO_APP_KEY']\n @secret = env['TRELLO_SECRET']\n @token = env['TRELLO_USER_TOKEN']\n @archive_card = env['ARCHIVE_CARD']\n end", "def update\n @cys_env = CysEnv.find(params[:id])\n\n respond_to do |format|\n if @cys_env.update_attributes(params[:cys_env])\n format.html { redirect_to @cys_env, notice: 'Cys env was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cys_env.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boolean_setting = BooleanSetting.find(params[:id])\n\n boolean_setting = params[:boolean_setting]\n boolean_setting.delete(:key)\n\n respond_to do |format|\n if @boolean_setting.update_attributes( boolean_setting )\n format.html { redirect_to settings_path, notice: 'Setting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boolean_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @setting = Setting.find(params[:oid])\n\n #binding.pry\n\n respond_to do |format|\n if @setting.update_attributes(params)\n format.html { redirect_to \"/settings/#{@setting.id}\", notice: 'Setting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_auto_approve_setting\n service_response = ClientManagement::UpdateAutoApproveSetting.new(params).perform\n render_api_response(service_response)\n end", "def preference_params\n params.require(:preference).permit(:status, :user_id, :country_id)\n end", "def settings\n request(Resources::RESOURCE_SETTINGS, HTTP_METHOD_POST)\n end", "def write_preferences(dict, path)\n dict.writeToFile_atomically(path, true)\n end", "def update\n if @setting.update(setting_params)\n head :no_content\n else\n render json: @setting.errors, status: :unprocessable_entity\n end\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def sync(name=nil)\n env = env(name)\n env.sync\n env.save\n end", "def update_consul_stack_env_vars\n require 'diplomat'\n require 'json'\n data = {}\n @tf_vars_from_env.each_value { |k| data[k] = ENV[k] }\n\n Diplomat.configure do |config|\n config.url = @consul_url\n end\n\n puts \"Writing stack information to #{@consul_url} at: \"\\\n \"#{@consul_env_vars_prefix}\"\n\n redacted_list = (%w[aws_access_key aws_secret_key] +\n @tf_sensitive_vars)\n sanitized_data = data.clone\n @tf_vars_from_env.each do |k, v|\n # We are trying to determine which ENV var maps\n # to the sensitive terraform variable\n sanitized_data[v] = '(redacted)' if redacted_list.include?(k)\n end\n puts JSON.pretty_generate(sanitized_data)\n raw = JSON.generate(data)\n Diplomat::Kv.put(@consul_env_vars_prefix, raw)\n end", "def install_prefs\n return false if File.exists?(prefs_dest)\n install_prefs!\n end", "def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update(env=:all)\n []\n end", "def settings(key)\n ENV[key.to_s.upcase] || monk_settings(key)\nend", "def update\n if @org_setting.update(update_params)\n render json: @org_setting.to_json(include: :tracker)\n else\n render json: @org_setting.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @required_capabilities = args[:required_capabilities] if args.key?(:required_capabilities)\n end", "def update_install_preference(preference)\n if ALLOWED_INSTALL_PREFERENCES.include?(preference)\n self.install_preference = preference\n save\n else\n false\n end\n end", "def update\n preferences_update = false\n \n if params[:id] == \"article_preferences\" then\n eval(\"Settings.\" + params[\"settings\"].to_a.first[0] + \"=\\\"\" + (params[\"settings\"].to_a.first[1]).html_safe() +\"\\\"\" )\n preferences_update = true\n else\n \n @article = Article.find(params[:id])\n successfull = @article.update_attributes(article_params)\n end\n \n respond_to do |format|\n if preferences_update then\n format.html {render nothing: true}\n format.json { render :json=> {:notice => 'Preferences were successfully updated.'} }\n \n else\n if successfull then\n format.html { redirect_to action: \"edit\", notice: \"Article was successfully updated.\"}\n format.json { render :json=> {:notice => 'Article was successfully updated.'} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: \"unprocessable_entry\" }\n end\n end\n end\n end", "def update\n @user_preference = UserPreference.find(params[:id])\n\n respond_to do |format|\n if @user_preference.update_attributes(params[:user_preference])\n format.html { redirect_to @user_preference, notice: 'User preference was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_preferences\n params[:columns].each do |k,v|\n col = @grid.get_column(params[:field])\n\n if col\n #RailsPowergrid::Preference.update(get_current_user, self, params[:field], v)\n end\n\n end\n render json: {}\n end", "def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def store_secret_envs\n sudo_password = ENV['sudo_password']\n # If the sudo_password is set, store it in the secrets hash\n if sudo_password\n # Set a new secret\n secrets.set('sudo_password', sudo_password)\n # Save the updated secrets store to disk\n secrets.save(File.expand_path(AutomateCluster::Config.secrets_store_file))\n end\n end", "def update\n @default_check_out_duration = params[:default_check_out_duration].to_i || Settings.defaults[:default_check_out_duration]\n @clients_can_see_equipment_outside_their_groups = (params[:clients_can_see_equipment_outside_their_groups] == 'true')\n @attendants_can_self_check_out = (params[:attendants_can_self_check_out] == 'true')\n\n saved = true\n\n obj = Settings.object('default_check_out_duration')\n obj.value = @default_check_out_duration\n saved &&= obj.save\n\n obj = Settings.object('clients_can_see_equipment_outside_their_groups')\n obj.value = @clients_can_see_equipment_outside_their_groups\n saved &&= obj.save\n\n obj = Settings.object('attendants_can_self_check_out')\n obj.value = @attendants_can_self_check_out\n saved &&= obj.save\n\n respond_to do |format|\n if saved\n format.html { redirect_to settings_path, notice: 'Settings were successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @settings.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_user_env_variables(vars)\n Application.run_in_application_lock(self) do\n op_group = PendingAppOpGroup.new(op_type: :patch_user_env_vars, args: {\"user_env_vars\" => vars}, user_agent: self.user_agent)\n self.pending_op_groups.push op_group\n result_io = ResultIO.new\n self.run_jobs(result_io)\n result_io\n end\n end", "def test_should_save_settings\n prefs = {\n \"store_name\" => \"Substruct\",\n \"store_handling_fee\" => \"0.00\",\n \"store_use_inventory_control\"=>\"1\"\n }\n assert Preference.save_settings(prefs)\n end", "def update\n @var_conf = VarConf.find(params[:id])\n\n respond_to do |format|\n if @var_conf.update_attributes(params[:var_conf])\n format.html { redirect_to @var_conf, :notice => 'Var conf was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @var_conf.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @use_in_app_default = args[:use_in_app_default] if args.key?(:use_in_app_default)\n @value = args[:value] if args.key?(:value)\n end", "def update\n resource = client.post_preferences(params.permit(:email_address, :frequency))\n render json: resource,\n serializer: MessagingPreferenceSerializer\n end", "def ask_pref(preference, prompt)\n prefs[preference] = ask_wizard(prompt)\nend", "def env(name, value)\n Stairs.configuration.env_adapter.set name, value\n end", "def add_env_var key, val\n key = key.to_s\n env_file = self[:ssh_env_file]\n escaped_val = Regexp.escape(val).gsub('/', '\\/').gsub(';', '\\;')\n # see if the key/value pair already exists\n if exec(Beaker::Command.new(\"grep ^#{key}=.*#{escaped_val} #{env_file}\"), :accept_all_exit_codes => true).exit_code == 0\n return # nothing to do here, key value pair already exists\n # see if the key already exists\n elsif exec(Beaker::Command.new(\"grep ^#{key}= #{env_file}\"), :accept_all_exit_codes => true).exit_code == 0\n exec(Beaker::SedCommand.new(self['platform'], \"s/^#{key}=/#{key}=#{escaped_val}:/\", env_file))\n else\n exec(Beaker::Command.new(\"echo \\\"#{key}=#{val}\\\" >> #{env_file}\"))\n end\n\n # update the profile.d to current state\n # match it to the contents of ssh_env_file\n mirror_env_to_profile_d(env_file)\n end", "def update!(**args)\n @apple_sign_in_config = args[:apple_sign_in_config] if args.key?(:apple_sign_in_config)\n @client_id = args[:client_id] if args.key?(:client_id)\n @client_secret = args[:client_secret] if args.key?(:client_secret)\n @enabled = args[:enabled] if args.key?(:enabled)\n @name = args[:name] if args.key?(:name)\n end", "def set_preference\n @preference = @user.preferences.find(params[:id])\n end", "def pref_params\n params.require(:pref).permit(:name)\n end", "def update\n save_setting('program_name', Setting::NAME_CURR_PROGRAM_NAME)\n save_setting('timelapse_mode', Setting::NAME_TIMELAPSE_MODE)\n save_setting('interval', Setting::NAME_INTERVAL)\n save_setting_with('sensor_proximity', Setting::NAME_SENSOR_PROXIMITY, params['sensor_proximity'].include?('active') ? \"1\" : \"0\") if params['sensor_proximity']\n save_setting_with('sensor_vibration', Setting::NAME_SENSOR_VIBRATION, params['sensor_vibration'].include?('active') ? \"1\" : \"0\") if params['sensor_vibration']\n save_setting('sensor_time_between_photos', Setting::NAME_SENSOR_TIME_BETWEEN_PHOTOS)\n\n head :ok\n end", "def email_notification_preferences=(prefs_attributes)\n prefs = self.email_notification_preferences # init the object if it wasn't there\n prefs_attributes.each{|key, val| prefs.send(\"#{key}=\", val==\"true\")}\n write_attribute(:email_notification_preferences, prefs)\n end", "def update\n respond_to do |format|\n if @preference.update(preference_params)\n format.html { redirect_to @preference, notice: 'Preference was successfully updated.' }\n format.json { render :show, status: :ok, location: @preference }\n else\n format.html { render :edit }\n format.json { render json: @preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preference = Preference.find(params[:id])\n list\n respond_to do |format|\n if @preference.update_attributes(params[:preference])\n format.html { redirect_to(@preference, :notice => 'Preference was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @preference.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @environments = args[:environments] if args.key?(:environments)\n end", "def save_env\n f = File.new(TddDeploy::Environ::ENV_FNAME, \"w\")\n self.env_types.keys.sort.each do |k|\n v = self.env_hash[k] || ''\n case self.env_types[k]\n when :int then f.write \"#{k}=#{v}\\n\"\n when :string then f.write \"#{k}=#{v}\\n\"\n when :list then\n f.write \"#{k}=#{self.list_to_str(k)}\\n\" unless k == 'hosts'\n when :pseudo then next\n when :capfile then next\n else\n raise ::RuntimeError.new(\"unknown key: #{k}\")\n end\n end\n f.close\n end", "def update\n respond_to do |format|\n if @auxillary_preference.update(auxillary_preference_params)\n format.html { redirect_to @auxillary_preference, notice: 'Auxillary preference was successfully updated.' }\n format.json { render :show, status: :ok, location: @auxillary_preference }\n else\n format.html { render :edit }\n format.json { render json: @auxillary_preference.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @outcome.update(outcome_params)\n redirect_to settings_path\n end", "def update!(**args)\n @app_capabilities = args[:app_capabilities] if args.key?(:app_capabilities)\n @app_capabilities_delta = args[:app_capabilities_delta] if args.key?(:app_capabilities_delta)\n @app_integrations_settings = args[:app_integrations_settings] if args.key?(:app_integrations_settings)\n @car_assistant_capabilities = args[:car_assistant_capabilities] if args.key?(:car_assistant_capabilities)\n @clock_capabilities = args[:clock_capabilities] if args.key?(:clock_capabilities)\n @conversation_version = args[:conversation_version] if args.key?(:conversation_version)\n @cross_device_execution_capabilities = args[:cross_device_execution_capabilities] if args.key?(:cross_device_execution_capabilities)\n @gacs_capabilities = args[:gacs_capabilities] if args.key?(:gacs_capabilities)\n @gcm_capabilities = args[:gcm_capabilities] if args.key?(:gcm_capabilities)\n @home_app_capabilities = args[:home_app_capabilities] if args.key?(:home_app_capabilities)\n @live_tv_channel_capabilities = args[:live_tv_channel_capabilities] if args.key?(:live_tv_channel_capabilities)\n @oem_capabilities = args[:oem_capabilities] if args.key?(:oem_capabilities)\n @on_device_assistant_capabilities = args[:on_device_assistant_capabilities] if args.key?(:on_device_assistant_capabilities)\n @on_device_smart_home_capabilities = args[:on_device_smart_home_capabilities] if args.key?(:on_device_smart_home_capabilities)\n @on_device_storage_capabilities = args[:on_device_storage_capabilities] if args.key?(:on_device_storage_capabilities)\n @operating_system = args[:operating_system] if args.key?(:operating_system)\n @ordered_live_tv_providers = args[:ordered_live_tv_providers] if args.key?(:ordered_live_tv_providers)\n @selina_capabilities = args[:selina_capabilities] if args.key?(:selina_capabilities)\n @settings_app_capabilities = args[:settings_app_capabilities] if args.key?(:settings_app_capabilities)\n @supported_client_op = args[:supported_client_op] if args.key?(:supported_client_op)\n @supported_features = args[:supported_features] if args.key?(:supported_features)\n @supported_msg_version = args[:supported_msg_version] if args.key?(:supported_msg_version)\n @supported_provider_types = args[:supported_provider_types] if args.key?(:supported_provider_types)\n @surface_properties = args[:surface_properties] if args.key?(:surface_properties)\n end" ]
[ "0.6464932", "0.63783634", "0.62679964", "0.60783887", "0.5949688", "0.580463", "0.5782033", "0.5775958", "0.57487935", "0.5683018", "0.55604875", "0.5554317", "0.5527177", "0.5509002", "0.54904646", "0.5479065", "0.54733175", "0.54419583", "0.5422173", "0.5422173", "0.541988", "0.54060084", "0.53278726", "0.532584", "0.5312685", "0.52490914", "0.5220249", "0.52135026", "0.51760584", "0.5167973", "0.5165708", "0.5164375", "0.5164375", "0.5159609", "0.5156657", "0.51382995", "0.51314926", "0.5118353", "0.5115971", "0.5100847", "0.50900376", "0.50760174", "0.5075322", "0.5066048", "0.50645643", "0.50645643", "0.50621605", "0.5061692", "0.5047614", "0.50444424", "0.50419706", "0.5024231", "0.50148803", "0.50140446", "0.5009278", "0.5006672", "0.49971652", "0.4991239", "0.49899048", "0.4980968", "0.4977925", "0.49757603", "0.49729234", "0.4969459", "0.4962617", "0.49497116", "0.49495205", "0.49466145", "0.49463508", "0.49330753", "0.49261582", "0.4923896", "0.49198896", "0.49124572", "0.49108133", "0.49021047", "0.49021047", "0.49021047", "0.49021047", "0.4899994", "0.489647", "0.48934934", "0.48909673", "0.48755985", "0.48746783", "0.48662838", "0.4848045", "0.4846289", "0.48414722", "0.48393103", "0.48386508", "0.48373413", "0.48348454", "0.48346242", "0.4826607", "0.48231784", "0.48195022", "0.48184744", "0.48182774", "0.48168448" ]
0.72722274
0
DELETE /env_prefs/1 DELETE /env_prefs/1.json
def destroy @env_pref = EnvPref.find(params[:id]) @env_pref.destroy respond_to do |format| format.html { redirect_to env_prefs_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n conf.delete 'dashboard'\n end", "def destroy\n @user_pref = UserPref.find(params[:id])\n @user_pref.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_prefs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pref.destroy\n respond_to do |format|\n format.html { redirect_to prefs_url, notice: 'Pref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'api'\n end", "def delete_profile\n driver.deleteOperaPrefs\n end", "def destroy\n @app_setting.destroy\n respond_to do |format|\n format.html { redirect_to app_settings_url, notice: 'App setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundamental_setting = Fundamental::Setting.find(params[:id])\n @fundamental_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_settings_url }\n format.json { head :ok }\n end\n end", "def delete_cookie name, path\r\n command 'deleteCookie', name, path\r\n end", "def destroy\n @org_setting.destroy\n\n head :no_content\n end", "def destroy\n @m_pref.destroy\n respond_to do |format|\n format.html { redirect_to m_prefs_url, notice: 'M pref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_envvar(envvar)\n CircleCi.request(conf, \"#{base_path}/envvar/#{envvar}\").delete\n end", "def destroy\n @var_conf = VarConf.find(params[:id])\n @var_conf.destroy\n\n respond_to do |format|\n format.html { redirect_to var_confs_url }\n format.json { head :ok }\n end\n end", "def delete *args; Setting.unscoped{ super } end", "def destroy\n @acc_setting.destroy\n respond_to do |format|\n format.html { redirect_to acc_settings_url, notice: 'Acc setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting = Setting.find(params[:id])\n @setting.destroy\n\n respond_to do |format|\n format.html { redirect_to settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting = Setting.find(params[:id])\n @setting.destroy\n\n respond_to do |format|\n format.html { redirect_to settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auxillary_preference.destroy\n respond_to do |format|\n format.html { redirect_to auxillary_preferences_url, notice: 'Auxillary preference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def delete_env_var key, val\n key = key.to_s\n env_file = self[:ssh_env_file]\n val = Regexp.escape(val).gsub('/', '\\/').gsub(';', '\\;')\n # if the key only has that single value remove the entire line\n exec(Beaker::SedCommand.new(self['platform'], \"/#{key}=#{val}$/d\", env_file))\n # value in middle of list\n exec(Beaker::SedCommand.new(self['platform'], \"s/#{key}=\\\\(.*\\\\)[;:]#{val}/#{key}=\\\\1/\", env_file))\n # value in start of list\n exec(Beaker::SedCommand.new(self['platform'], \"s/#{key}=#{val}[;:]/#{key}=/\", env_file))\n # update the profile.d to current state\n # match it to the contents of ssh_env_file\n mirror_env_to_profile_d(env_file)\n end", "def destroy\n @pluto_environment_variable = collection.find(params[:id])\n @pluto_environment_variable.destroy\n\n respond_to do |format|\n format.html { redirect_to @core_application }\n format.json { head :ok }\n end\n end", "def destroy\n @preference = Preference.find(params[:id])\n @preference.destroy\n\n respond_to do |format|\n format.html { redirect_to preferences_url }\n format.json { head :ok }\n end\n end", "def destroy\n set_global_setting\n @global_setting.destroy\n respond_to do |format|\n format.html { redirect_to admin_global_settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @preference = Preference.find(params[:id])\n @preference.destroy\n\n respond_to do |format|\n format.html { redirect_to preferences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting = Setting.find_cached(params[:id])\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_setting.destroy\n respond_to do |format|\n format.html { redirect_to admin_api_settings_path, notice: 'Api setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cys_env = CysEnv.find(params[:id])\n @cys_env.destroy\n\n respond_to do |format|\n format.html { redirect_to cys_envs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @operation_setting = OperationSetting.find(params[:id])\n @operation_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to operation_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_setting.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @preference = Preference.find(params[:id])\n user = User.find(current_user.id)\n user.pref_id = \"\"\n user.save\n @preference.destroy\n respond_to do |format|\n format.html { redirect_to preferences_url, notice: 'Preference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url, notice: 'Configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @password_setting.destroy\n respond_to do |format|\n format.html { redirect_to password_settings_url }\n format.json { head :no_content }\n end\n end", "def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end", "def destroy\n @system_setting.destroy\n respond_to do |format|\n format.html { redirect_to system_settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unset\n requires_preauth\n if args.empty?\n error(\"Usage: heroku config:unset KEY1 [KEY2 ...]\\nMust specify KEY to unset.\")\n end\n\n args.each do |key|\n action(\"Unsetting #{key} and restarting #{app}\") do\n api.delete_config_var(app, key)\n\n @status = begin\n if release = api.get_release(app, 'current').body\n release['name']\n end\n rescue Heroku::API::Errors::RequestFailed\n end\n end\n end\n end", "def destroy\n @demo_host_setting = Demo::HostSetting.find(params[:id])\n @demo_host_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(demo_host_settings_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @preference = Preference.find(params[:id])\n @preference.destroy\n\n respond_to do |format|\n format.html { redirect_to(preferences_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cleaners_preference.destroy\n respond_to do |format|\n format.html { redirect_to cleaners_preferences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @global_page_setting = GlobalPageSetting.find(params[:id])\n @global_page_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to global_page_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_setting.destroy\n respond_to do |format|\n format.html { redirect_to admin_settings_url, notice: 'Admin setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to settings_url, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @project_setting.destroy\n respond_to do |format|\n format.html { redirect_to project_settings_url, notice: 'Project setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @global_config = AppConfig.find(params[:id])\n @global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to global_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting = Setting.find(params[:id])\n @setting.destroy\n\n respond_to do |format|\n format.html { redirect_to settings_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_preference = UserPreference.find(params[:id])\n @user_preference.destroy\n\n respond_to do |format|\n format.html { redirect_to user_preferences_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_preference.destroy\n respond_to do |format|\n format.html { redirect_to user_preferences_url, notice: 'User preference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_setting.destroy\n respond_to do |format|\n format.html { redirect_to exam_settings_url, notice: 'Exam setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_setting.destroy\n respond_to do |format|\n format.html { redirect_to user_settings_url, notice: 'User setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_preference.destroy\n respond_to do |format|\n format.html { redirect_to email_preferences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_preference = UserPreference.find(params[:id])\n @user_preference.destroy\n\n respond_to do |format|\n format.html { redirect_to user_preferences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting = Setting.find(params[:id])\n authorize @setting, :destroy?\n @setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(settings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to admin_settings_path, notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @website_setting = WebsiteSetting.find(params[:id])\n @website_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to website_settings_url }\n format.json { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @cfg.destroy\n respond_to do |format|\n format.html { redirect_to cfgs_url, notice: 'Cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @global_account_setting = GlobalAccountSetting.find(params[:id])\n @global_account_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(global_account_settings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_page_setting.destroy\n end", "def destroy\n @purchase_preference = PurchasePreference.find(params[:id])\n @purchase_preference.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_preferences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_var = AppVar.find(params[:id])\n @app_var.destroy\n\n respond_to do |format|\n format.html { redirect_to app_vars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conf.destroy\n respond_to do |format|\n format.html { redirect_to confs_url, notice: 'Conf was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_all\n destroy_user_preferences!\n render json: { code: params[:code] }, status: :ok, serializer: DeleteAllUserPreferencesSerializer\n end", "def destroy\n @configattribincl.destroy\n respond_to do |format|\n format.html { redirect_to configattribs_path, notice: 'Configattribincl Threshold is reset to default.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @setting = Setting.find(params[:id])\n @setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(escola_ano_letivo_settings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inventory_clearance_setting = InventoryClearanceSetting.get(params[:id])\n @inventory_clearance_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_clearance_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n system_node_id = @setting.system_node_id\n @setting.destroy\n respond_to do |format|\n format.html { redirect_to edit_system_node_path(system_node_id), notice: 'Setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @premium_reward_setting.destroy\n respond_to do |format|\n format.html { redirect_to premium_reward_settings_url, notice: 'Premium reward setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @application_setting.destroy\n respond_to do |format|\n format.html { redirect_to application_settings_url, notice: 'Application setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @preference = Preference.find(params[:id])\n @preference.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @environment_variable.destroy!\n head :ok\n end", "def destroy\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n @wp_dyna_config.destroy\n\n respond_to do |format|\n format.html { redirect_to wp_dyna_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @configuration_key.destroy\n respond_to do |format|\n format.html { redirect_to configuration_keys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dietary_preference.destroy\n respond_to do |format|\n format.html { redirect_to dietary_preferences_url, notice: 'Dietary preference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @systemsetting.destroy\n respond_to do |format|\n format.html { redirect_to systemsettings_url, notice: 'Systemsetting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(_url)\n # do nothing since we can't find the key by url\n end", "def destroy\n @dict_config.destroy\n respond_to do |format|\n format.html { redirect_to dict_configs_url, notice: 'Dict config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete_launch_configuration(resource_options)\n nil\n end", "def destroy\n @user_game_preference = UserGamePreference.find(params[:id])\n @user_game_preference.destroy\n\n respond_to do |format|\n format.html { redirect_to user_game_preferences_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @config_set_value.destroy\n respond_to do |format|\n format.html { redirect_to config_set_values_url, notice: 'Config set value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @editor_setting.destroy\n respond_to do |format|\n format.html { redirect_to editor_settings_url, notice: 'Editor setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kf_global_config = Kf::GlobalConfig.find(params[:id])\n @kf_global_config.destroy\n\n respond_to do |format|\n format.html { redirect_to kf_global_configs_url({:page => params[:page]}) }\n format.json { head :no_content }\n end\n end", "def destroy\n @outcome.destroy\n redirect_to settings_path\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def delete( )\n File.delete(@configFileDNE)\n self.clear\n self\n end", "def destroy\n @jenkins_app_config.destroy\n respond_to do |format|\n format.html { redirect_to jenkins_app_configs_url, notice: 'Jenkins app config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @zillow_pref.destroy\n respond_to do |format|\n format.html { redirect_to home_path, notice: 'Zillow pref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gpu_conf.destroy\n respond_to do |format|\n format.html { redirect_to gpu_confs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to app_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete(key)\n @config.delete(key.to_s)\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def clear_env_var key\n key = key.to_s\n env_file = self[:ssh_env_file]\n # remove entire line\n exec(Beaker::SedCommand.new(self['platform'], \"/^#{key}=.*$/d\", env_file))\n # update the profile.d to current state\n # match it to the contents of ssh_env_file\n mirror_env_to_profile_d(env_file)\n end" ]
[ "0.6420471", "0.6366115", "0.6347137", "0.62673736", "0.6235688", "0.6164056", "0.6141857", "0.6094408", "0.606788", "0.60486317", "0.60306364", "0.6017379", "0.5992011", "0.5981826", "0.5932899", "0.5932899", "0.5927974", "0.5927974", "0.5927974", "0.5919517", "0.5910536", "0.5908812", "0.58915246", "0.5881646", "0.5866012", "0.58555686", "0.5844741", "0.581787", "0.5816112", "0.5802596", "0.5798216", "0.5784865", "0.57733965", "0.576988", "0.5764208", "0.5754314", "0.57390577", "0.57304394", "0.5729836", "0.5723501", "0.57096595", "0.57031167", "0.5688245", "0.5686812", "0.56784546", "0.56784546", "0.56784546", "0.5670057", "0.56672055", "0.56644803", "0.56625897", "0.5653966", "0.5648017", "0.5646507", "0.5645839", "0.56414795", "0.56354964", "0.5633142", "0.5628764", "0.56268024", "0.5622854", "0.56099045", "0.5608724", "0.5600518", "0.559854", "0.5598515", "0.5598515", "0.55955297", "0.55879533", "0.5587196", "0.5586124", "0.55830926", "0.5582205", "0.55620325", "0.5560815", "0.55562884", "0.55554855", "0.55504835", "0.5545347", "0.5544968", "0.5527806", "0.5508755", "0.549605", "0.5491926", "0.548813", "0.548646", "0.54836106", "0.5482017", "0.54801846", "0.5470114", "0.5460108", "0.5449653", "0.54482985", "0.544825", "0.54439884", "0.54417443", "0.54412836", "0.54401416", "0.54383856", "0.54371524" ]
0.7919139
0
This method define summary methods. If nothing 'HogeSummary' elements, create and set empty Course::Price instance. result: Coursefare Coursecharge Courseteiki1 ...
def define_summary_method %w[fare charge teiki1 teiki3 teiki6 teiki12].each do |summary_type| self.define_singleton_method(summary_type) { price_summary(summary_type) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_summary\n\n products = {}\n products.store(:item_cost, item_cost)\n products.store(:extras_cost, extras_cost)\n\n supplements = {}\n supplements.store(:pick_up_place, pickup_place_cost)\n supplements.store(:return_place, return_place_cost)\n supplements.store(:time_from_cost, time_from_cost)\n supplements.store(:time_to_cost, time_to_cost)\n supplements.store(:driver_age_cost, driver_age_cost)\n supplements.store(:category_supplement_1, category_supplement_1_cost)\n supplements.store(:category_supplement_2, category_supplement_2_cost)\n supplements.store(:category_supplement_3, category_supplement_3_cost)\n supplements.store(:supplement_1, supplement_1_cost)\n supplements.store(:supplement_2, supplement_2_cost)\n supplements.store(:supplement_3, supplement_3_cost)\n\n deposit = {}\n deposit.store(:product_deposit_cost, product_deposit_cost)\n\n totals = {}\n totals.store(:total_cost, total_cost)\n totals.store(:total_paid, total_paid)\n totals.store(:total_pending, total_pending)\n\n summary = {products: products,\n supplements: supplements,\n deposit: deposit,\n totals: totals }\n\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def summary\n \n end", "def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end", "def summary\n end", "def summary\n end", "def summary\n # TODO\n end", "def describe_price\r\n\t\ta = []\r\n\t\ta << sprintf('$%.2f per item', per_item) unless per_item.zero?\r\n\t\ta << sprintf('$%.2f per kg', per_kg) unless per_kg.zero?\r\n\t\ta << sprintf('$%.2f', flat_rate) unless flat_rate.zero?\r\n\t\tif formula and !formula.empty?\r\n\t\t\tif formula_description and !formula_description.empty?\r\n\t\t\t\ta << formula_description\r\n\t\t\telse\r\n\t\t\t\ta << formula.gsub('I', \"'number of items'\").gsub('W', \"'total weight'\").gsub('V', \"'total value'\")\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\ta.empty? ? ((name == '[ to be advised ]') ? nil : 'no charge') : a.join(' + ')\r\n\tend", "def show\n @inform = @study.inform\n @all_cups_price = 0\n @inform.studies.each do |study|\n @all_cups_price += study.price * study.factor\n end\n end", "def summary\n {}\n end", "def price\n \n end", "def price\n \n end", "def products_billing_summary_by_stock(year)\n\n current_year = DateTime.now.year\n\n # Build the result holder\n total_cost = 0\n stock_items = if current_year == year\n ::Yito::Model::Booking::BookingItem.all(conditions: {active: true},\n fields: [:reference, :cost],\n order: [:category_code, :reference])\n else\n BookingDataSystem::Booking.historic_stock(year).map do |item|\n OpenStruct.new({reference: item.item_reference, cost: 0})\n end\n end\n\n summary = stock_items.inject({}) do |result, item|\n data_holder = {}\n (1..12).each { |item| data_holder.store(item, 0) }\n data_holder.store(:total, 0)\n data_holder.store(:cost, item.cost || 0)\n data_holder.store(:percentage, 0)\n total_cost = total_cost + item.cost unless item.cost.nil?\n result.store(item.reference, data_holder)\n result\n end\n data_holder = {}\n (1..12).each { |item| data_holder.store(item, 0) }\n data_holder.store(:total, 0)\n data_holder.store(:cost, 0)\n data_holder.store(:percentage, 0)\n summary.store(:TOTAL, data_holder)\n # Fill the data\n data = query_strategy.products_billing_summary_by_stock(year)\n data.each do |data_item|\n if summary.has_key?(data_item.reference)\n # stock\n summary[data_item.reference][data_item.period.to_i] = data_item.total_item_cost\n summary[data_item.reference][:total] += data_item.total_item_cost\n if summary[data_item.reference][:cost] and summary[data_item.reference][:cost] > 0\n summary[data_item.reference][:percentage] = summary[data_item.reference][:total] /\n summary[data_item.reference][:cost] * 100\n end\n # total\n summary[:TOTAL][data_item.period.to_i] += data_item.total_item_cost\n summary[:TOTAL][:total] += data_item.total_item_cost\n summary[:TOTAL][:cost] = total_cost\n if summary[:TOTAL][:cost] and summary[:TOTAL][:cost] > 0\n summary[:TOTAL][:percentage] = summary[:TOTAL][:total] /\n summary[:TOTAL][:cost] * 100\n end\n end\n end\n\n return summary\n end", "def full_price\n price + tax_evaluation\n end", "def calculate_price\n logger.info(\"calculate_price ======================\" )\n logger.info(\"calculate_price price_usage=\" + self.price_usage.price.to_s)\n logger.info(\"calculate_price price_media=\" + self.price_media.price.to_s)\n # price = image.basePrice | image.stockBasePrice\n price = 0 # self.image_shell.stock_base_price\n sumPerc = 0\n self.price_options.each do |o|\n sumPerc += (o.percentage)\n logger.info(\"calculate_price price_opton=\" + (o.percentage).to_s + \"%\") \n end\n \n # add countries\n worldwide = self.use_territory.include? \"Worldwide\"\n north_america = self.use_territory.include? \"North America\"\n south_america = self.use_territory.include? \"South America\"\n asia = self.use_territory.include? \"Asia\"\n europe = self.use_territory.include? \"Europe\"\n australia = self.use_territory.include? \"Australia\"\n africa = self.use_territory.include? \"Africa\"\n \n \n logger.info(\"worldwide \" + worldwide.to_s )\n logger.info(\"north_america \" + north_america.to_s)\n logger.info(\"south_america \" + south_america.to_s)\n logger.info(\"asia \" + asia.to_s )\n logger.info(\"europe \" + europe.to_s )\n logger.info(\"australia \" + australia.to_s )\n logger.info(\"africa \" + africa.to_s )\n \n \n if worldwide\n \n price += self.price_usage.price + 0.15\n \n elsif north_america || south_america || asia || europe || australia || africa\n \n sumPerc += 0.10 if north_america\n sumPerc += 0.10 if south_america\n sumPerc += 0.10 if asia\n sumPerc += 0.10 if europe\n sumPerc += 0.10 if australia\n sumPerc += 0.10 if africa\n \n else\n \n self.use_territory.each do |t|\n sumPerc += 0.03\n end\n \n end\n \n price += self.price_usage.price + self.price_media.price\n price += (sumPerc/100.0)*price\n \n logger.info(\"price \" + price.to_s )\n logger.info(\"sumPerc \" + sumPerc.to_s )\n logger.info(\"sumPerc \" + ( sumPerc/100.0 ).to_s )\n logger.info(\"(sumPerc/100)*price \" + ( (sumPerc/100.0)*price ).to_s ) \n logger.info(\"calculate_price total \" + price.to_s)\n logger.info(\"calculate_price ======================\" ) \n price\n end", "def summary\n {\n length: @length,\n width: @width,\n perimeter: @perimeter,\n area: @ area\n }\nend", "def hoo_summary(model, runner, standard)\n hoo_summary_hash = {}\n hoo_summary_hash[:zero_hoo] = []\n hoo_summary_hash[:final_hoo_start_range] = []\n hoo_summary_hash[:final_hoo_dur_range] = []\n model.getSpaces.sort.each do |space|\n default_sch_type = OpenStudio::Model::DefaultScheduleType.new('HoursofOperationSchedule')\n hours_of_operation = space.getDefaultSchedule(default_sch_type)\n if !hours_of_operation.is_initialized\n runner.registerWarning(\"Hours of Operation Schedule is not set for #{space.name}.\")\n next\n end\n hours_of_operation_hash = standard.space_hours_of_operation(space)\n hours_of_operation_hash.each do |hoo_key, val|\n if val[:hoo_hours] == 0.0\n hoo_summary_hash[:zero_hoo] << val[:hoo_hours]\n else\n hoo_summary_hash[:final_hoo_dur_range] << val[:hoo_hours]\n hoo_summary_hash[:final_hoo_start_range] << val[:hoo_start]\n end\n end\n end\n\n return hoo_summary_hash\n end", "def desc() summary; end", "def product_summary\n cell(CardProduct::Cell::Summary, card_product)\n end", "def calculate\n=begin\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n=end\n self.total\n end", "def aow_price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.parent(\"p\").span, format_method(__method__))\n end", "def summary\n comment = @policy.describe(@grades)\n if (comment)\n comment = \" (#{comment})\"\n else\n comment = \"\"\n end\n mygrade = grade\n if mygrade\n mygrade = \"#{mygrade.round(1)}\"\n else\n mygrade = \"[No grades available]\"\n end\n if ((0 == @percent) || (100 == @percent) || (-100 == @percent)) \n dots = @@dots[@type.length + 1 .. -1]\n puts \"#{@type} #{dots}: #{mygrade}#{comment}\"\n else\n dots = @@dots[@type.length + 9 .. -1]\n percentText = \"#{@percent.round(1)}\"\n if (@percent < 10) \n percentText = \" #{percentText}\"\n end\n puts \"#{@type} #{dots} (#{percentText}%): #{mygrade}#{comment}\"\n end\n end", "def price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.child(\"h3\"), format_method(__method__)).inner_text\n end", "def summary_information\n @summary_information ||= create_summary_information\n end", "def calculate\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n self.tax_rate = nil\n self.total\n end", "def calculate\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n self.tax_rate = nil\n self.total\n end", "def summary(args)\n summary_cache_key = args[:period].to_pretty_s\n thesummary = lookup_cached_summary(summary_cache_key)\n return thesummary if !thesummary.nil?\n \n mapping = Xbrlware::ValueMapping.new\n mapping.policy[:debit] = :flip\n\n thesummary = super(:period => args[:period], :mapping => mapping) # FIXME: flip_total should == true!\n if !lookup_cached_classifications(BASE_FILENAME, thesummary.rows)\n lookahead = [4, thesummary.rows.length-1].min\n classify_rows(ALL_STATES, NEXT_STATES, thesummary.rows, FinModeling::IncomeStatementItem, lookahead)\n save_cached_classifications(BASE_FILENAME, thesummary.rows)\n end\n\n save_cached_summary(summary_cache_key, thesummary)\n\n return thesummary\n end", "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "def set_price\n course = Course.find(self.course_id)\n self.price = course.price\n end", "def calorie_info\n return \"#{self.name} $#{self.price} (#{self.calorie}kcal)\"\n end", "def detail_cost\n detail_material +\n detail_cutting * (cut.consumable_cost + cut_material.consumption) +\n (detail[:holes_count] + 1) * cut_material.pierce_price\n # Added: +1 to detail[:holes_count] for initial cut\n end", "def default_sum(listing, vat=0)\n self.sum = listing.price\n end", "def get_summary_score\n\t\t(self.taste_score + self.value_score + self.on_time_score)/3\n\tend", "def summary=(summary)\n self.attributes.occi!.core!.summary = summary\n end", "def summary\n return @summary\n end", "def summary\n return @summary\n end", "def summary\n return @summary\n end", "def compute_actual\n line[1] = @ho_form.line['sqft']\n line[2] = @ho_form.line['total_sqft']\n line[3] = (line[1] * 100.0 / line[2]).round(2)\n\n line['4/gross_inc'] = gross_income\n\n # We make a simplifying assumption that (1) every Home Office Expense\n # applies to every Home Office form, and (2) all expenses are indirect.\n categorize_records('Home Office Expense')\n #\n # We assume that the home office using the actual method is being rented and\n # thus there are no mortgage payments or such on it.\n #\n #fill_for_categories(self, '5b', 'Casualty_Losses')\n #fill_for_categories(self, '6b', 'Mortgage_Interest')\n #fill_for_categories(self, '7b', 'Real_Estate_Taxes')\n\n line['8b'] = sum_lines('5b', '6b', '7b')\n line[9] = (line['8b'] * line[3] / 100.0).round\n line[10] = line[9]\n\n line[11] = other_business_expenses\n\n line[12] = sum_lines(10, 11)\n line['13/ho_max_ded'] = line[4] - line[12]\n\n fill_for_categories(self, '16b', 'Insurance')\n fill_for_categories(self, '17b', 'Rent')\n fill_for_categories(self, '18b', 'Repairs')\n fill_for_categories(self, '19b', 'Utilities')\n fill_other_categories(\n self, '20b', continuation: 'Other Home Office Expenses'\n )\n line['21b'] = sum_lines(*%w(14b 15b 16b 17b 18b 19b 20b))\n line[22] = (line['21b'] * line[3] / 100.0).round\n\n # Assume no carryover for line 23\n line['24/ho_ded'] = sum_lines('21a', 22, 23)\n line[25] = [ line[13], line[24] ].min\n line[26] = line[13] - line[25]\n\n # Assume no casualty losses or depreciation for lines 27-29 and 33\n line[30] = sum_lines(27, 28, 29)\n line[31] = [ line[26], line[30] ].min\n line[32] = sum_lines(10, 25, 31)\n\n line[33] = BlankZero\n line['34/ho_expenses'] = line[32] - line[33]\n\n end", "def summary\r\n \r\n @ph_product = PhProduct.find(params[:ph_result_id])\r\n @product = @ph_product.product\r\n @step = 1 \r\n if @ph_product.ph_intermediate_result \r\n if !@ph_product.ph_result\r\n ph_result = PhResult.new \r\n ph_result.ph_product_id = @ph_product.id\r\n ph_result.save\r\n @ph_product.ph_result = ph_result\r\n end\r\n @ph_result = @ph_product.ph_result\r\n if !@ph_product.ph_maintenance_result \r\n ph_maintenance_result = PhMaintenanceResult.new \r\n ph_maintenance_result.ph_product_id = @ph_product.id\r\n ph_maintenance_result.save\r\n @ph_product.ph_maintenance_result = ph_maintenance_result \r\n end\r\n @ph_maintenance_result = @ph_product.ph_maintenance_result \r\n if !@ph_product.ph_embedded_result \r\n ph_embedded_result = PhEmbeddedResult.new \r\n ph_embedded_result.ph_product_id = @ph_product.id\r\n ph_embedded_result.save\r\n @ph_product.ph_embedded_result = ph_embedded_result \r\n end\r\n @ph_embedded_result = @ph_product.ph_embedded_result \r\n \r\n\r\n @ph_embedded_result.temperature_induced = 0\r\n temp = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n temp = -0.13\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n temp = -0.4465\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n temp = -0.402545\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n temp = -0.25 \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n temp = -0.43666\r\n end \r\n \r\n # =(Assumptions!$I$11-25)*IF(Assumptions!G19=Menues!A2,Menues!A122,IF(Assumptions!G19=Menues!A3,Menues!B122,IF(Assumptions!G19=Menues!A4,Menues!C122,IF(Assumptions!G19=Menues!A5,Menues!D122,IF(Assumptions!G19=Menues!A6,Menues!E122,0))))) \r\n \r\n @ph_embedded_result.temperature_induced = temp * (@ph_product.ph_basic_information.temperature - 25) \r\n calcul_efficiency = @ph_product.ph_specified.efficiency * (1 + (@ph_embedded_result.temperature_induced / 100))\r\n \r\n ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n ph_database_material_values.each do |ph_database_material_value|\r\n ph_database_material_value.delete\r\n end \r\n \r\n\r\n @ph_database_materials = PhDatabaseMaterial.all \r\n @ph_database_materials.each do |ph_database_material|\r\n if ph_database_material.default_value_co2 == 0\r\n calculate_co2 ph_database_material, @ph_product\r\n end\r\n if ph_database_material.default_value_pe == 0\r\n calculate_pe ph_database_material, @ph_product\r\n end \r\n end\r\n @ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n \r\n n49 = 0\r\n if @ph_product.ph_specified.area_unit\r\n n49 = @ph_product.ph_specified.area * @ph_product.ph_specified.area_unit.conversion_factor\r\n end \r\n # ph_result lifetime\r\n \r\n if @ph_product.ph_basic_information.known == 'both' || @ph_product.ph_basic_information.known == 'power_demand'\r\n #Menues!N56*Assumptions!F39\r\n @ph_result.lifetime = 0\r\n n56 = 0\r\n #=IF($Assumptions.G19=$Menues.A7;0;\r\n if @ph_product.ph_specified.ph_module_type.name != 'Not specified'\r\n if @ph_product.ph_specified.power_unit.conversion_factor == -1 \r\n # Peak Power [kWp]\r\n conversion_factor = @ph_product.ph_basic_information.radiation * @ph_product.ph_basic_information.performance_ratio\r\n n56 = @ph_product.ph_specified.power * conversion_factor\r\n else \r\n n56 = @ph_product.ph_specified.power * @ph_product.ph_specified.power_unit.conversion_factor\r\n end \r\n @ph_result.lifetime = n56 * @ph_product.ph_specified.lifetime\r\n end\r\n else \r\n #Menues!N49*(Assumptions!F38/100)*Assumptions!I15*Assumptions!I9*Assumptions!F39 \r\n @ph_result.lifetime = n49 * (calcul_efficiency / 100) * @ph_product.ph_basic_information.performance_ratio * @ph_product.ph_basic_information.radiation * @ph_product.ph_specified.lifetime\r\n \r\n end\r\n \r\n \r\n #IF($Assumptions.E35=$Menues.G41;$Assumptions.D35*$Menues.E60;IF($Assumptions.E35=$Menues.G42;$Assumptions.D35;IF($Assumptions.E35=G43;$Menues.E59*$Assumptions.D35;IF($Assumptions.E35=$Menues.G44;$Menues.E58*$Assumptions.D35;IF($Assumptions.E35=$Menues.G45;$Menues.E61*$Assumptions.D35;0)))));0))\r\n @ph_result.cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n\r\n @ph_result.cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n\r\n # ph_result module\r\n @ph_result.module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_co2 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_co2 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_co2 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_result.module = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n # =(IF(Assumptions!$G$19=Menues!$A$5,'Database Materials'!B$2,IF(Assumptions!$G$19=Menues!$A$2,'Database Materials'!B$17,IF(Assumptions!$G$19=Menues!$A$3,'Database Materials'!B$15,IF(Assumptions!$G$19=Menues!$A$4,'Database Materials'!B$8,IF(Assumptions!$G$19=Menues!$A$6,'Database Materials'!B$19,0))))))*Assumptions!$I$68 \r\n \r\n # ph_result framing\r\n @ph_result.framing = 0 \r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_co2 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_co2 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_co2 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_co2 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_result.framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n # ph_result mounting\r\n @ph_result.mounting = 0 \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_co2 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_result.mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n # ph_result inverter\r\n @ph_result.inverter = 0 \r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n # ph_result batteries\r\n @ph_result.batteries = 0 \r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_result.batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n \r\n # ph_result maintenance\r\n @ph_result.maintenance = 0 \r\n \r\n \r\n @ph_result.co2_total = @ph_result.cabling + @ph_result.module + @ph_result.framing + @ph_result.mounting + @ph_result.inverter + @ph_result.batteries\r\n \r\n \r\n ###########\r\n ### MAINTENANCE\r\n #########\r\n \r\n @ph_maintenance_result.years_included = 0\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_5'\r\n @ph_maintenance_result.years_included = 5\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_10'\r\n @ph_maintenance_result.years_included = 10\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_15'\r\n @ph_maintenance_result.years_included = 15\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_20'\r\n @ph_maintenance_result.years_included = 20\r\n end\r\n \r\n # boolean\r\n @ph_maintenance_result.inverter_replacement = 0\r\n if @ph_maintenance_result.years_included != 0\r\n if @ph_product.ph_maintenance.replacement_inverters == 'yes'\r\n @ph_maintenance_result.inverter_replacement = 1 \r\n end \r\n end\r\n\r\n # boolean\r\n @ph_maintenance_result.batteries_replacement = 0\r\n if @ph_product.ph_maintenance.replacement_batteries == 'yes'\r\n @ph_maintenance_result.batteries_replacement = 1 \r\n end \r\n \r\n @ph_maintenance_result.tap_water_l = 0\r\n if @ph_product.ph_maintenance.cleaning_modules == 'yes'\r\n @ph_maintenance_result.tap_water_l = 3.25\r\n end\r\n \r\n @ph_maintenance_result.tap_water_co2 = 0\r\n #b38\r\n temp = get_database_material_result_co2 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_co2 = temp * @ph_maintenance_result.tap_water_l\r\n \r\n @ph_maintenance_result.tap_water_pe = 0\r\n #c38\r\n temp = get_database_material_result_pe 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_pe = temp * @ph_maintenance_result.tap_water_l\r\n \r\n \r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n if @ph_product.ph_electric_component.inverter_size_1 != 0 && @ph_product.ph_electric_component.quantity_1 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_1 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_1) - 1\r\n if @ph_maintenance_result.needed_cycles_1 < 0\r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_1 = @ph_maintenance_result.needed_cycles_1.ceil \r\n end\r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_1 = @ph_maintenance_result.needed_cycles_1 * @ph_product.ph_electric_component.quantity_1\r\n \r\n @ph_maintenance_result.embodied_co2_1 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_co2_1 = temp * @ph_maintenance_result.needed_replacements_1 \r\n @ph_maintenance_result.embodied_pe_1 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_pe_1 = temp * @ph_maintenance_result.needed_replacements_1\r\n\r\n \r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n if @ph_product.ph_electric_component.inverter_size_2 != 0 && @ph_product.ph_electric_component.quantity_2 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_2 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_2) - 1\r\n if @ph_maintenance_result.needed_cycles_2 < 0\r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_2 = @ph_maintenance_result.needed_cycles_2.ceil\r\n end \r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_2 = @ph_maintenance_result.needed_cycles_2 * @ph_product.ph_electric_component.quantity_2\r\n \r\n @ph_maintenance_result.embodied_co2_2 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_co2_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n @ph_maintenance_result.embodied_pe_2 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_pe_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n \r\n \r\n @ph_maintenance_result.driven_maintenance = 2 * @ph_product.ph_maintenance.distance\r\n @ph_maintenance_result.driven_year = @ph_maintenance_result.driven_maintenance * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.driven_contract = @ph_maintenance_result.driven_year * @ph_maintenance_result.years_included\r\n \r\n @ph_maintenance_result.embodied_co2_transport = 0 \r\n #B35\r\n temp = get_database_material_result_co2 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_co2_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_pe_transport = 0\r\n #C35\r\n temp = get_database_material_result_pe 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_pe_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_co2_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_co2\r\n @ph_maintenance_result.embodied_pe_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_pe\r\n @ph_maintenance_result.total_embodied_co2_cleaning = @ph_maintenance_result.embodied_co2_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.total_embodied_pe_cleaning = @ph_maintenance_result.embodied_pe_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n \r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n if @ph_maintenance_result.batteries_replacement == 1\r\n @ph_maintenance_result.needed_cycles_batteries = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.battery_lifetime) - 1\r\n if @ph_maintenance_result.needed_cycles_batteries < 0\r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_batteries = @ph_maintenance_result.needed_cycles_batteries.ceil\r\n end \r\n end\r\n \r\n @ph_maintenance_result.needed_replacements_batteries = @ph_maintenance_result.needed_cycles_batteries * @ph_product.ph_electric_component.separated_battery\r\n \r\n @ph_maintenance_result.embodied_co2_batteries = 0\r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #B32 \r\n temp_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_maintenance_result.embodied_co2_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n \r\n @ph_maintenance_result.embodied_pe_batteries = 0 \r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #C32 \r\n temp_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_maintenance_result.embodied_pe_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n \r\n @ph_maintenance_result.embodied_carbon_dioxide = 0\r\n @ph_maintenance_result.embodied_primary_energy = 0\r\n if @ph_product.ph_maintenance.maintenance_needs != 'no'\r\n @ph_maintenance_result.embodied_carbon_dioxide = @ph_maintenance_result.embodied_co2_1 + @ph_maintenance_result.embodied_co2_2 + @ph_maintenance_result.embodied_co2_transport + @ph_maintenance_result.total_embodied_co2_cleaning + @ph_maintenance_result.embodied_co2_batteries\r\n @ph_maintenance_result.embodied_primary_energy = @ph_maintenance_result.embodied_pe_1 + @ph_maintenance_result.embodied_pe_2 + @ph_maintenance_result.embodied_pe_transport + @ph_maintenance_result.total_embodied_pe_cleaning + @ph_maintenance_result.embodied_pe_batteries \r\n end\r\n @ph_result.maintenance = @ph_maintenance_result.embodied_carbon_dioxide\r\n @ph_embedded_result.pe_maintenance = @ph_maintenance_result.embodied_primary_energy\r\n ##########\r\n ### EMBEDDED\r\n ##########\r\n\r\n @ph_embedded_result.lifetime_saved = @ph_result.lifetime * 3.6 / @ph_product.ph_basic_information.conversion_factor\r\n \r\n @ph_embedded_result.pe_pv_cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #C22\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #C21\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #C23\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n @ph_embedded_result.pe_pv_module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_pe 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_pe 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_pe 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_embedded_result.pe_pv_module = temp * @ph_product.ph_intermediate_result.module_area \r\n \r\n @ph_embedded_result.pe_pv_framing = 0\r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_pe 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_pe 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_pe 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_pe 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_embedded_result.pe_pv_framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n @ph_embedded_result.pe_pv_mounting = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_pe 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n @ph_embedded_result.pe_inverter = 0\r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n @ph_embedded_result.pe_batteries = 0\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_embedded_result.pe_batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n \r\n \r\n \r\n @ph_embedded_result.embedded_energy_total = @ph_embedded_result.pe_pv_cabling + @ph_embedded_result.pe_pv_module + @ph_embedded_result.pe_pv_framing + @ph_embedded_result.pe_pv_mounting + @ph_embedded_result.pe_inverter + @ph_embedded_result.pe_batteries + @ph_embedded_result.pe_maintenance \r\n \r\n \r\n @ph_embedded_result.peak_power = @ph_product.ph_intermediate_result.module_area * calcul_efficiency / 100\r\n @ph_embedded_result.lifetime_production = @ph_result.lifetime\r\n @ph_embedded_result.averaged_power = @ph_embedded_result.lifetime_production / @ph_product.ph_specified.lifetime\r\n @ph_embedded_result.averaged_consumption = @ph_embedded_result.averaged_power * 3.6 / @ph_product.ph_basic_information.conversion_factor \r\n @ph_embedded_result.system_emb = @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.energy_payback = @ph_embedded_result.embedded_energy_total / @ph_embedded_result.averaged_consumption\r\n @ph_embedded_result.energy_yield = @ph_embedded_result.lifetime_saved / @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.emb_co2 = @ph_result.cabling + @ph_result.inverter + @ph_result.batteries \r\n# @ph_embedded_result.estim_co2 = 1000 * @ph_result.co2_total / @ph_embedded_result.lifetime_production\r\n \r\n\r\n\r\n \r\n \r\n \r\n @ph_result.co2_total += @ph_result.maintenance\r\n @ph_embedded_result.estim_co2 = 1000 * @ph_result.co2_total / @ph_result.lifetime\r\n @ph_embedded_result.net_saved_co2 = @ph_embedded_result.lifetime_production * (@ph_product.ph_basic_information.co2_factor - @ph_embedded_result.estim_co2) / 1000 \r\n \r\n @ph_product.ph_result.save\r\n @ph_product.ph_embedded_result.save\r\n @ph_product.ph_maintenance_result.save\r\n end \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml\r\n end\r\n end", "def summary\r\n \r\n @ph_product = PhProduct.find(params[:ph_result_id])\r\n @product = @ph_product.product\r\n @step = 1 \r\n if @ph_product.ph_intermediate_result \r\n if !@ph_product.ph_result\r\n ph_result = PhResult.new \r\n ph_result.ph_product_id = @ph_product.id\r\n ph_result.save\r\n @ph_product.ph_result = ph_result\r\n end\r\n @ph_result = @ph_product.ph_result\r\n if !@ph_product.ph_maintenance_result \r\n ph_maintenance_result = PhMaintenanceResult.new \r\n ph_maintenance_result.ph_product_id = @ph_product.id\r\n ph_maintenance_result.save\r\n @ph_product.ph_maintenance_result = ph_maintenance_result \r\n end\r\n @ph_maintenance_result = @ph_product.ph_maintenance_result \r\n if !@ph_product.ph_embedded_result \r\n ph_embedded_result = PhEmbeddedResult.new \r\n ph_embedded_result.ph_product_id = @ph_product.id\r\n ph_embedded_result.save\r\n @ph_product.ph_embedded_result = ph_embedded_result \r\n end\r\n @ph_embedded_result = @ph_product.ph_embedded_result \r\n \r\n\r\n @ph_embedded_result.temperature_induced = 0\r\n temp = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n temp = -0.13\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n temp = -0.4465\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n temp = -0.402545\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n temp = -0.25 \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n temp = -0.43666\r\n end \r\n \r\n # =(Assumptions!$I$11-25)*IF(Assumptions!G19=Menues!A2,Menues!A122,IF(Assumptions!G19=Menues!A3,Menues!B122,IF(Assumptions!G19=Menues!A4,Menues!C122,IF(Assumptions!G19=Menues!A5,Menues!D122,IF(Assumptions!G19=Menues!A6,Menues!E122,0))))) \r\n \r\n @ph_embedded_result.temperature_induced = temp * (@ph_product.ph_basic_information.temperature - 25) \r\n calcul_efficiency = @ph_product.ph_specified.efficiency * (1 + (@ph_embedded_result.temperature_induced / 100))\r\n \r\n ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n ph_database_material_values.each do |ph_database_material_value|\r\n ph_database_material_value.delete\r\n end \r\n \r\n\r\n @ph_database_materials = PhDatabaseMaterial.all \r\n @ph_database_materials.each do |ph_database_material|\r\n if ph_database_material.default_value_co2 == 0\r\n calculate_co2 ph_database_material, @ph_product\r\n end\r\n if ph_database_material.default_value_pe == 0\r\n calculate_pe ph_database_material, @ph_product\r\n end \r\n end\r\n @ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n \r\n n49 = 0\r\n if @ph_product.ph_specified.area_unit\r\n n49 = @ph_product.ph_specified.area * @ph_product.ph_specified.area_unit.conversion_factor\r\n end\r\n \r\n if @ph_product.ph_basic_information.known == 'both' || @ph_product.ph_basic_information.known == 'power_demand'\r\n #Menues!N56*Assumptions!F39\r\n @ph_result.lifetime = 0\r\n n56 = 0\r\n #=IF($Assumptions.G19=$Menues.A7;0;\r\n if @ph_product.ph_specified.ph_module_type.name != 'Not specified'\r\n if @ph_product.ph_specified.power_unit.conversion_factor == -1 \r\n # Peak Power [kWp]\r\n conversion_factor = @ph_product.ph_basic_information.radiation * @ph_product.ph_basic_information.performance_ratio\r\n n56 = @ph_product.ph_specified.power * conversion_factor\r\n else \r\n n56 = @ph_product.ph_specified.power * @ph_product.ph_specified.power_unit.conversion_factor\r\n end \r\n @ph_result.lifetime = n56 * @ph_product.ph_specified.lifetime\r\n end\r\n else \r\n #Menues!N49*(Assumptions!F38/100)*Assumptions!I15*Assumptions!I9*Assumptions!F39 \r\n @ph_result.lifetime = n49 * (calcul_efficiency / 100) * @ph_product.ph_basic_information.performance_ratio * @ph_product.ph_basic_information.radiation * @ph_product.ph_specified.lifetime\r\n \r\n end\r\n \r\n \r\n #IF($Assumptions.E35=$Menues.G41;$Assumptions.D35*$Menues.E60;IF($Assumptions.E35=$Menues.G42;$Assumptions.D35;IF($Assumptions.E35=G43;$Menues.E59*$Assumptions.D35;IF($Assumptions.E35=$Menues.G44;$Menues.E58*$Assumptions.D35;IF($Assumptions.E35=$Menues.G45;$Menues.E61*$Assumptions.D35;0)))));0))\r\n \r\n # ph_result cabling\r\n @ph_result.cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n\r\n @ph_result.cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n\r\n @ph_result.module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_co2 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_co2 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_co2 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_result.module = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n # =(IF(Assumptions!$G$19=Menues!$A$5,'Database Materials'!B$2,IF(Assumptions!$G$19=Menues!$A$2,'Database Materials'!B$17,IF(Assumptions!$G$19=Menues!$A$3,'Database Materials'!B$15,IF(Assumptions!$G$19=Menues!$A$4,'Database Materials'!B$8,IF(Assumptions!$G$19=Menues!$A$6,'Database Materials'!B$19,0))))))*Assumptions!$I$68 \r\n\r\n @ph_result.framing = 0 \r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_co2 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_co2 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_co2 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_co2 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_result.framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n # ph_result mounting\r\n @ph_result.mounting = 0 \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_co2 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_result.mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n # ph_result inverter\r\n @ph_result.inverter = 0 \r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n # ph_result batteries\r\n @ph_result.batteries = 0 \r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_result.batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n \r\n # ph_result maintenance\r\n @ph_result.maintenance = 0 \r\n \r\n \r\n @ph_result.co2_total = @ph_result.cabling + @ph_result.module + @ph_result.framing + @ph_result.mounting + @ph_result.inverter + @ph_result.batteries\r\n \r\n \r\n ###########\r\n ### MAINTENANCE\r\n #########\r\n \r\n @ph_maintenance_result.years_included = 0\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_5'\r\n @ph_maintenance_result.years_included = 5\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_10'\r\n @ph_maintenance_result.years_included = 10\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_15'\r\n @ph_maintenance_result.years_included = 15\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_20'\r\n @ph_maintenance_result.years_included = 20\r\n end\r\n \r\n # boolean\r\n @ph_maintenance_result.inverter_replacement = 0\r\n if @ph_maintenance_result.years_included != 0\r\n if @ph_product.ph_maintenance.replacement_inverters == 'yes'\r\n @ph_maintenance_result.inverter_replacement = 1 \r\n end \r\n end\r\n\r\n # boolean\r\n @ph_maintenance_result.batteries_replacement = 0\r\n if @ph_product.ph_maintenance.replacement_batteries == 'yes'\r\n @ph_maintenance_result.batteries_replacement = 1 \r\n end \r\n \r\n @ph_maintenance_result.tap_water_l = 0\r\n if @ph_product.ph_maintenance.cleaning_modules == 'yes'\r\n @ph_maintenance_result.tap_water_l = 3.25\r\n end\r\n \r\n @ph_maintenance_result.tap_water_co2 = 0\r\n #b38\r\n temp = get_database_material_result_co2 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_co2 = temp * @ph_maintenance_result.tap_water_l\r\n \r\n @ph_maintenance_result.tap_water_pe = 0\r\n #c38\r\n temp = get_database_material_result_pe 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_pe = temp * @ph_maintenance_result.tap_water_l\r\n \r\n \r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n if @ph_product.ph_electric_component.inverter_size_1 != 0 && @ph_product.ph_electric_component.quantity_1 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_1 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_1) - 1\r\n if @ph_maintenance_result.needed_cycles_1 < 0\r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_1 = @ph_maintenance_result.needed_cycles_1.ceil \r\n end\r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_1 = @ph_maintenance_result.needed_cycles_1 * @ph_product.ph_electric_component.quantity_1\r\n \r\n @ph_maintenance_result.embodied_co2_1 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_co2_1 = temp * @ph_maintenance_result.needed_replacements_1 \r\n @ph_maintenance_result.embodied_pe_1 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_pe_1 = temp * @ph_maintenance_result.needed_replacements_1\r\n\r\n \r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n if @ph_product.ph_electric_component.inverter_size_2 != 0 && @ph_product.ph_electric_component.quantity_2 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_2 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_2) - 1\r\n if @ph_maintenance_result.needed_cycles_2 < 0\r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_2 = @ph_maintenance_result.needed_cycles_2.ceil\r\n end \r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_2 = @ph_maintenance_result.needed_cycles_2 * @ph_product.ph_electric_component.quantity_2\r\n \r\n @ph_maintenance_result.embodied_co2_2 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_co2_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n @ph_maintenance_result.embodied_pe_2 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_pe_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n \r\n \r\n @ph_maintenance_result.driven_maintenance = 2 * @ph_product.ph_maintenance.distance\r\n @ph_maintenance_result.driven_year = @ph_maintenance_result.driven_maintenance * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.driven_contract = @ph_maintenance_result.driven_year * @ph_maintenance_result.years_included\r\n \r\n @ph_maintenance_result.embodied_co2_transport = 0 \r\n #B35\r\n temp = get_database_material_result_co2 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_co2_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_pe_transport = 0\r\n #C35\r\n temp = get_database_material_result_pe 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_pe_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_co2_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_co2\r\n @ph_maintenance_result.embodied_pe_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_pe\r\n @ph_maintenance_result.total_embodied_co2_cleaning = @ph_maintenance_result.embodied_co2_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.total_embodied_pe_cleaning = @ph_maintenance_result.embodied_pe_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n \r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n if @ph_maintenance_result.batteries_replacement == 1\r\n @ph_maintenance_result.needed_cycles_batteries = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.battery_lifetime) - 1\r\n if @ph_maintenance_result.needed_cycles_batteries < 0\r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_batteries = @ph_maintenance_result.needed_cycles_batteries.ceil\r\n end \r\n end\r\n \r\n @ph_maintenance_result.needed_replacements_batteries = @ph_maintenance_result.needed_cycles_batteries * @ph_product.ph_electric_component.separated_battery\r\n \r\n @ph_maintenance_result.embodied_co2_batteries = 0\r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #B32 \r\n temp_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_maintenance_result.embodied_co2_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n \r\n @ph_maintenance_result.embodied_pe_batteries = 0 \r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #C32 \r\n temp_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_maintenance_result.embodied_pe_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n \r\n @ph_maintenance_result.embodied_carbon_dioxide = 0\r\n @ph_maintenance_result.embodied_primary_energy = 0\r\n if @ph_product.ph_maintenance.maintenance_needs != 'no'\r\n @ph_maintenance_result.embodied_carbon_dioxide = @ph_maintenance_result.embodied_co2_1 + @ph_maintenance_result.embodied_co2_2 + @ph_maintenance_result.embodied_co2_transport + @ph_maintenance_result.total_embodied_co2_cleaning + @ph_maintenance_result.embodied_co2_batteries\r\n @ph_maintenance_result.embodied_primary_energy = @ph_maintenance_result.embodied_pe_1 + @ph_maintenance_result.embodied_pe_2 + @ph_maintenance_result.embodied_pe_transport + @ph_maintenance_result.total_embodied_pe_cleaning + @ph_maintenance_result.embodied_pe_batteries \r\n end\r\n @ph_result.maintenance = @ph_maintenance_result.embodied_carbon_dioxide\r\n @ph_embedded_result.pe_maintenance = @ph_maintenance_result.embodied_primary_energy\r\n ##########\r\n ### EMBEDDED\r\n ##########\r\n\r\n @ph_embedded_result.lifetime_saved = @ph_result.lifetime * 3.6 / @ph_product.ph_basic_information.conversion_factor\r\n \r\n @ph_embedded_result.pe_pv_cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #C22\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #C21\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #C23\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n @ph_embedded_result.pe_pv_module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_pe 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_pe 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_pe 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_embedded_result.pe_pv_module = temp * @ph_product.ph_intermediate_result.module_area \r\n \r\n @ph_embedded_result.pe_pv_framing = 0\r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_pe 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_pe 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_pe 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_pe 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_embedded_result.pe_pv_framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n @ph_embedded_result.pe_pv_mounting = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_pe 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n @ph_embedded_result.pe_inverter = 0\r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n @ph_embedded_result.pe_batteries = 0\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n @ph_embedded_result.pe_batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n \r\n \r\n \r\n @ph_embedded_result.embedded_energy_total = @ph_embedded_result.pe_pv_cabling + @ph_embedded_result.pe_pv_module + @ph_embedded_result.pe_pv_framing + @ph_embedded_result.pe_pv_mounting + @ph_embedded_result.pe_inverter + @ph_embedded_result.pe_batteries + @ph_embedded_result.pe_maintenance \r\n \r\n \r\n @ph_embedded_result.peak_power = @ph_product.ph_intermediate_result.module_area * calcul_efficiency / 100\r\n @ph_embedded_result.lifetime_production = @ph_result.lifetime\r\n @ph_embedded_result.averaged_power = @ph_embedded_result.lifetime_production / @ph_product.ph_specified.lifetime\r\n @ph_embedded_result.averaged_consumption = @ph_embedded_result.averaged_power * 3.6 / @ph_product.ph_basic_information.conversion_factor \r\n @ph_embedded_result.system_emb = @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.energy_payback = @ph_embedded_result.embedded_energy_total / @ph_embedded_result.averaged_consumption\r\n @ph_embedded_result.energy_yield = @ph_embedded_result.lifetime_saved / @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.emb_co2 = @ph_result.cabling + @ph_result.inverter + @ph_result.batteries \r\n# @ph_embedded_result.estim_co2 = 1000 * @ph_result.co2_total / @ph_embedded_result.lifetime_production\r\n \r\n\r\n\r\n \r\n \r\n \r\n @ph_result.co2_total += @ph_result.maintenance\r\n @ph_embedded_result.estim_co2 = 1000 * @ph_result.co2_total / @ph_result.lifetime\r\n @ph_embedded_result.net_saved_co2 = @ph_embedded_result.lifetime_production * (@ph_product.ph_basic_information.co2_factor - @ph_embedded_result.estim_co2) / 1000 \r\n \r\n @ph_product.ph_result.save\r\n @ph_product.ph_embedded_result.save\r\n @ph_product.ph_maintenance_result.save\r\n end \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml\r\n end\r\n end", "def summary\r\n \r\n @ph_product = PhProduct.find(params[:ph_result_id])\r\n @product = @ph_product.product\r\n @step = 1 \r\n if @ph_product.ph_intermediate_result \r\n if !@ph_product.ph_result\r\n ph_result = PhResult.new \r\n ph_result.ph_product_id = @ph_product.id\r\n ph_result.save\r\n @ph_product.ph_result = ph_result\r\n end\r\n @ph_result = @ph_product.ph_result\r\n if !@ph_product.ph_maintenance_result \r\n ph_maintenance_result = PhMaintenanceResult.new \r\n ph_maintenance_result.ph_product_id = @ph_product.id\r\n ph_maintenance_result.save\r\n @ph_product.ph_maintenance_result = ph_maintenance_result \r\n end\r\n @ph_maintenance_result = @ph_product.ph_maintenance_result \r\n if !@ph_product.ph_embedded_result \r\n ph_embedded_result = PhEmbeddedResult.new \r\n ph_embedded_result.ph_product_id = @ph_product.id\r\n ph_embedded_result.save\r\n @ph_product.ph_embedded_result = ph_embedded_result \r\n end\r\n @ph_embedded_result = @ph_product.ph_embedded_result \r\n \r\n\r\n @ph_embedded_result.temperature_induced = 0\r\n temp = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n temp = -0.13\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n temp = -0.4465\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n temp = -0.402545\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n temp = -0.25 \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n temp = -0.43666\r\n end \r\n \r\n # =(Assumptions!$I$11-25)*IF(Assumptions!G19=Menues!A2,Menues!A122,IF(Assumptions!G19=Menues!A3,Menues!B122,IF(Assumptions!G19=Menues!A4,Menues!C122,IF(Assumptions!G19=Menues!A5,Menues!D122,IF(Assumptions!G19=Menues!A6,Menues!E122,0))))) \r\n \r\n @ph_embedded_result.temperature_induced = temp * (@ph_product.ph_basic_information.temperature - 25) \r\n calcul_efficiency = @ph_product.ph_specified.efficiency * (1 + (@ph_embedded_result.temperature_induced / 100))\r\n \r\n ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n ph_database_material_values.each do |ph_database_material_value|\r\n ph_database_material_value.delete\r\n end \r\n\r\n @ph_database_materials = PhDatabaseMaterial.all \r\n @ph_database_materials.each do |ph_database_material|\r\n if ph_database_material.default_value_co2 == 0\r\n calculate_co2 ph_database_material, @ph_product\r\n end\r\n if ph_database_material.default_value_pe == 0\r\n calculate_pe ph_database_material, @ph_product\r\n end \r\n end\r\n @ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n \r\n n49 = 0\r\n if @ph_product.ph_specified.area_unit\r\n n49 = @ph_product.ph_specified.area * @ph_product.ph_specified.area_unit.conversion_factor\r\n end\r\n \r\n if @ph_product.ph_basic_information.known == 'both' || @ph_product.ph_basic_information.known == 'power_demand'\r\n #Menues!N56*Assumptions!F39\r\n @ph_result.lifetime = 0\r\n n56 = 0\r\n #=IF($Assumptions.G19=$Menues.A7;0;\r\n if @ph_product.ph_specified.ph_module_type.name != 'Not specified'\r\n if @ph_product.ph_specified.power_unit.conversion_factor == -1 \r\n # Peak Power [kWp]\r\n conversion_factor = @ph_product.ph_basic_information.radiation * @ph_product.ph_basic_information.performance_ratio\r\n n56 = @ph_product.ph_specified.power * conversion_factor\r\n else \r\n n56 = @ph_product.ph_specified.power * @ph_product.ph_specified.power_unit.conversion_factor\r\n end \r\n @ph_result.lifetime = n56 * @ph_product.ph_specified.lifetime\r\n # @ph_result.lifetime = @ph_product.ph_specified.power * @ph_product.ph_specified.power_unit.conversion_factor\r\n end\r\n else \r\n #Menues!N49*(Assumptions!F38/100)*Assumptions!I15*Assumptions!I9*Assumptions!F39 \r\n @ph_result.lifetime = n49 * (calcul_efficiency / 100) * @ph_product.ph_basic_information.performance_ratio * @ph_product.ph_basic_information.radiation * @ph_product.ph_specified.lifetime\r\n \r\n end\r\n # New requirement\r\n if @ph_product.ph_basic_information.working == 'yes' && @ph_product.ph_basic_information.know_power == 'yes' \r\n @ph_result.lifetime = @ph_product.ph_basic_information.user_power * @ph_product.ph_specified.lifetime\r\n end \r\n\r\n \r\n #IF($Assumptions.E35=$Menues.G41;$Assumptions.D35*$Menues.E60;IF($Assumptions.E35=$Menues.G42;$Assumptions.D35;IF($Assumptions.E35=G43;$Menues.E59*$Assumptions.D35;IF($Assumptions.E35=$Menues.G44;$Menues.E58*$Assumptions.D35;IF($Assumptions.E35=$Menues.G45;$Menues.E61*$Assumptions.D35;0)))));0))\r\n\r\n @ph_result.cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n @ph_result.cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n\r\n # ph_result module\r\n @ph_result.module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_co2 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_co2 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_co2 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_result.module = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n # =(IF(Assumptions!$G$19=Menues!$A$5,'Database Materials'!B$2,IF(Assumptions!$G$19=Menues!$A$2,'Database Materials'!B$17,IF(Assumptions!$G$19=Menues!$A$3,'Database Materials'!B$15,IF(Assumptions!$G$19=Menues!$A$4,'Database Materials'!B$8,IF(Assumptions!$G$19=Menues!$A$6,'Database Materials'!B$19,0))))))*Assumptions!$I$68 \r\n\r\n @ph_result.framing = 0 \r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_co2 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_co2 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_co2 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_co2 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_result.framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n\r\n @ph_result.mounting = 0 \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_co2 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_result.mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n # ph_result inverter\r\n @ph_result.inverter = 0 \r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n # ph_result batteries\r\n @ph_result.batteries = 0 \r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid'\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product \r\n end \r\n @ph_result.batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n \r\n # ph_result maintenance\r\n @ph_result.maintenance = 0 \r\n \r\n \r\n @ph_result.co2_total = @ph_result.cabling + @ph_result.module + @ph_result.framing + @ph_result.mounting + @ph_result.inverter + @ph_result.batteries\r\n \r\n \r\n ###########\r\n ### MAINTENANCE\r\n #########\r\n \r\n @ph_maintenance_result.years_included = 0\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_5'\r\n @ph_maintenance_result.years_included = 5\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_10'\r\n @ph_maintenance_result.years_included = 10\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_15'\r\n @ph_maintenance_result.years_included = 15\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_20'\r\n @ph_maintenance_result.years_included = 20\r\n end\r\n \r\n # boolean\r\n @ph_maintenance_result.inverter_replacement = 0\r\n if @ph_maintenance_result.years_included != 0\r\n if @ph_product.ph_maintenance.replacement_inverters == 'yes'\r\n @ph_maintenance_result.inverter_replacement = 1 \r\n end \r\n end\r\n\r\n # boolean\r\n @ph_maintenance_result.batteries_replacement = 0\r\n if @ph_product.ph_maintenance.replacement_batteries == 'yes'\r\n @ph_maintenance_result.batteries_replacement = 1 \r\n end \r\n \r\n @ph_maintenance_result.tap_water_l = 0\r\n if @ph_product.ph_maintenance.cleaning_modules == 'yes'\r\n @ph_maintenance_result.tap_water_l = 3.25\r\n end\r\n \r\n @ph_maintenance_result.tap_water_co2 = 0\r\n #b38\r\n temp = get_database_material_result_co2 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_co2 = temp * @ph_maintenance_result.tap_water_l\r\n \r\n @ph_maintenance_result.tap_water_pe = 0\r\n #c38\r\n temp = get_database_material_result_pe 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_pe = temp * @ph_maintenance_result.tap_water_l\r\n \r\n \r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n if @ph_product.ph_electric_component.inverter_size_1 != 0 && @ph_product.ph_electric_component.quantity_1 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_1 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_1) - 1\r\n if @ph_maintenance_result.needed_cycles_1 < 0\r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_1 = @ph_maintenance_result.needed_cycles_1.ceil \r\n end\r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_1 = @ph_maintenance_result.needed_cycles_1 * @ph_product.ph_electric_component.quantity_1\r\n \r\n @ph_maintenance_result.embodied_co2_1 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_co2_1 = temp * @ph_maintenance_result.needed_replacements_1 \r\n @ph_maintenance_result.embodied_pe_1 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_pe_1 = temp * @ph_maintenance_result.needed_replacements_1\r\n\r\n \r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n if @ph_product.ph_electric_component.inverter_size_2 != 0 && @ph_product.ph_electric_component.quantity_2 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_2 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_2) - 1\r\n if @ph_maintenance_result.needed_cycles_2 < 0\r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_2 = @ph_maintenance_result.needed_cycles_2.ceil\r\n end \r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_2 = @ph_maintenance_result.needed_cycles_2 * @ph_product.ph_electric_component.quantity_2\r\n \r\n @ph_maintenance_result.embodied_co2_2 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_co2_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n @ph_maintenance_result.embodied_pe_2 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_pe_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n \r\n \r\n @ph_maintenance_result.driven_maintenance = 2 * @ph_product.ph_maintenance.distance\r\n @ph_maintenance_result.driven_year = @ph_maintenance_result.driven_maintenance * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.driven_contract = @ph_maintenance_result.driven_year * @ph_maintenance_result.years_included\r\n \r\n @ph_maintenance_result.embodied_co2_transport = 0 \r\n #B35\r\n temp = get_database_material_result_co2 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_co2_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_pe_transport = 0\r\n #C35\r\n temp = get_database_material_result_pe 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_pe_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_co2_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_co2\r\n @ph_maintenance_result.embodied_pe_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_pe\r\n @ph_maintenance_result.total_embodied_co2_cleaning = @ph_maintenance_result.embodied_co2_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.total_embodied_pe_cleaning = @ph_maintenance_result.embodied_pe_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n \r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n if @ph_maintenance_result.batteries_replacement == 1\r\n @ph_maintenance_result.needed_cycles_batteries = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.battery_lifetime) - 1\r\n if @ph_maintenance_result.needed_cycles_batteries < 0\r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_batteries = @ph_maintenance_result.needed_cycles_batteries.ceil\r\n end \r\n end\r\n \r\n @ph_maintenance_result.needed_replacements_batteries = @ph_maintenance_result.needed_cycles_batteries * @ph_product.ph_electric_component.separated_battery\r\n \r\n @ph_maintenance_result.embodied_co2_batteries = 0\r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid'\r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #B32 \r\n temp_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n #B33\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n #B34 \r\n temp_2 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product\r\n end \r\n @ph_maintenance_result.embodied_co2_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n \r\n @ph_maintenance_result.embodied_pe_batteries = 0 \r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid' \r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #C32 \r\n temp_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n #C32 \r\n temp_2 = get_database_material_result_pe 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product \r\n end \r\n @ph_maintenance_result.embodied_pe_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n \r\n @ph_maintenance_result.embodied_carbon_dioxide = 0\r\n @ph_maintenance_result.embodied_primary_energy = 0\r\n if @ph_product.ph_maintenance.maintenance_needs != 'no'\r\n @ph_maintenance_result.embodied_carbon_dioxide = @ph_maintenance_result.embodied_co2_1 + @ph_maintenance_result.embodied_co2_2 + @ph_maintenance_result.embodied_co2_transport + @ph_maintenance_result.total_embodied_co2_cleaning + @ph_maintenance_result.embodied_co2_batteries\r\n @ph_maintenance_result.embodied_primary_energy = @ph_maintenance_result.embodied_pe_1 + @ph_maintenance_result.embodied_pe_2 + @ph_maintenance_result.embodied_pe_transport + @ph_maintenance_result.total_embodied_pe_cleaning + @ph_maintenance_result.embodied_pe_batteries \r\n end\r\n @ph_result.maintenance = @ph_maintenance_result.embodied_carbon_dioxide\r\n @ph_embedded_result.pe_maintenance = @ph_maintenance_result.embodied_primary_energy\r\n ##########\r\n ### EMBEDDED\r\n ##########\r\n\r\n @ph_embedded_result.lifetime_saved = @ph_result.lifetime * 3.6 / @ph_product.ph_basic_information.conversion_factor\r\n \r\n @ph_embedded_result.pe_pv_cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #C22\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #C21\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #C23\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n @ph_embedded_result.pe_pv_module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_pe 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_pe 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_pe 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_embedded_result.pe_pv_module = temp * @ph_product.ph_intermediate_result.module_area \r\n \r\n @ph_embedded_result.pe_pv_framing = 0\r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_pe 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_pe 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_pe 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_pe 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_embedded_result.pe_pv_framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n @ph_embedded_result.pe_pv_mounting = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_pe 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n @ph_embedded_result.pe_inverter = 0\r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n @ph_embedded_result.pe_batteries = 0\r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid' \r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_pe 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product \r\n end \r\n @ph_embedded_result.pe_batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n \r\n \r\n \r\n @ph_embedded_result.embedded_energy_total = @ph_embedded_result.pe_pv_cabling + @ph_embedded_result.pe_pv_module + @ph_embedded_result.pe_pv_framing + @ph_embedded_result.pe_pv_mounting + @ph_embedded_result.pe_inverter + @ph_embedded_result.pe_batteries + @ph_embedded_result.pe_maintenance \r\n \r\n \r\n @ph_embedded_result.peak_power = @ph_product.ph_intermediate_result.module_area * calcul_efficiency / 100\r\n @ph_embedded_result.lifetime_production = @ph_result.lifetime\r\n \r\n \r\n if @ph_product.ph_basic_information.working == 'yes' && @ph_product.ph_basic_information.know_power == 'yes' && @ph_product.ph_basic_information.user_power\r\n @ph_embedded_result.averaged_power = @ph_product.ph_basic_information.user_power\r\n else \r\n @ph_embedded_result.averaged_power = @ph_embedded_result.lifetime_production / @ph_product.ph_specified.lifetime \r\n end\r\n \r\n \r\n \r\n \r\n @ph_embedded_result.averaged_consumption = @ph_embedded_result.averaged_power * 3.6 / @ph_product.ph_basic_information.conversion_factor \r\n @ph_embedded_result.system_emb = @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.energy_payback = @ph_embedded_result.embedded_energy_total / @ph_embedded_result.averaged_consumption\r\n @ph_embedded_result.energy_yield = @ph_embedded_result.lifetime_saved / @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.emb_co2 = @ph_result.cabling + @ph_result.inverter + @ph_result.batteries \r\n\r\n @ph_result.co2_total += @ph_result.maintenance\r\n @ph_embedded_result.estim_co2 = 1000 * @ph_result.co2_total / @ph_result.lifetime\r\n @ph_embedded_result.net_saved_co2 = @ph_embedded_result.lifetime_production * (@ph_product.ph_basic_information.co2_factor - @ph_embedded_result.estim_co2) / 1000 \r\n \r\n @ph_product.ph_result.save\r\n @ph_product.ph_embedded_result.save\r\n @ph_product.ph_maintenance_result.save\r\n end \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml\r\n end\r\n end", "def summary\n\t\tobject.summary || \"\"\n\tend", "def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end", "def finalize \n \tself[:unit_price] = self.product.sale_price\n \tself[:total] = self.quantity * self[:unit_price]\n end", "def compute_total_price\n self.total_price_ati = computed_total_price_ati\n end", "def price\n @longboard.price + @custom_print.price\n end", "def print_summary\n puts \"\\n\\nScore : # Instances\\n\" << (\"=\" * 19)\n @summary_totals.each_with_index { |value, index| puts \" %5d:%8d\\n\" % [index, value] unless value.nil? }\n puts \"\\n** End of Report\"\n end", "def summary\n description_section.first\n end", "def final_price\n base_markup_price + add_markup_person + add_markup_materials\n end", "def descriptions\n return @detail + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end", "def define_summary(name, opts = {}, &block)\n define_metric(:summary, name, opts, &block)\n end", "def price\n total\n end", "def summary(param)\n extract_values_from_cart_summary[param]\n end", "def mark_up()\n return @retail_price-@buying_cost\n end", "def conveyance_values\n wizard_step(:returns_lbtt_summary) do\n { cache_index: LbttController, after_merge: :update_tax_calculations }\n end\n end", "def compute_total_and_print()\n @total_price=0\n $final_price_list.each do |element| \n @total_price = @total_price + element\n end\n @total_sales_tax=0\n $sales_tax_list.each do |element|\n @total_sales_tax = @total_sales_tax + element\n end\n puts \"Sales Tax : #{@total_sales_tax.round(2)}\"\n puts \"Total : #{@total_price.round(2)}\"\nend", "def total\n # Calculo el total sin descuentos\n self.total_prize = @products.map {|p| p.prize }.inject :+\n\n # Aplico todos los descuentos dinamicamente\n @discounts.each do |discount|\n discount.call self\n end\n\n self.total_prize # Retorno el precio final\n end", "def details\n return @description + \"; \" + @manufacturer + \"; \" + @color + \": \" + \"#{@cost}\"\n end", "def new\n get_data\n @sale_detail = @sale.details.new\n @sale_detail.quantity = \"\"\n @sale_detail.price = \"\"\n @sale_detail.discount = \"\"\n end", "def calculation_methods\n out = {\n :demand => {\n :demand => {},\n :preset_demand => {},\n :demand_of_sustainable => {},\n :weighted_carrier_cost_per_mj => {},\n :weighted_carrier_co2_per_mj => {},\n :sustainability_share => {},\n :final_demand => {},\n :primary_demand => {},\n :primary_demand_of_fossil => {},\n :primary_demand_of_sustainable => {}\n },\n :technical => {\n :input_capacity => {},\n :electric_based_input_capacity => {label: '', unit: 'MWinput'},\n :heat_based_input_capacity => {label: '', unit: 'MWinput'},\n :cooling_based_input_capacity => {label: '', unit: 'MWinput'},\n :number_of_units => {}\n },\n :costs_per_plant => {\n 'total_costs_per(:plant)' => {label: 'Total costs per plant', unit: 'euro / plant'},\n 'fixed_costs_per(:plant)' => {},\n 'cost_of_capital_per(:plant)' => {},\n 'depreciation_costs_per(:plant)' => {},\n 'variable_costs_per(:plant)' => {},\n 'fuel_costs_per(:plant)' => {},\n 'co2_emissions_costs_per(:plant)' => {},\n 'fixed_operation_and_maintenance_costs_per(:plant)' => {},\n 'variable_operation_and_maintenance_costs_per(:plant)' => {},\n 'total_initial_investment_per(:plant)' => {},\n },\n :costs_per_node => {\n 'total_costs_per(:node)' => {},\n 'fixed_costs_per(:node)' => {},\n 'cost_of_capital_per(:node)' => {},\n 'depreciation_costs_per(:node)' => {},\n 'variable_costs_per(:node)' => {},\n 'fuel_costs_per(:node)' => {},\n 'co2_emissions_costs_per(:node)' => {},\n 'fixed_operation_and_maintenance_costs_per(:node)' => {},\n 'variable_operation_and_maintenance_costs_per(:node)' => {},\n 'total_initial_investment_per(:node)' => {},\n },\n :costs_per_mw_electricity => {\n 'total_costs_per(:mw_electricity)' => {},\n 'fixed_costs_per(:mw_electricity)' => {},\n 'cost_of_capital_per(:mw_electricity)' => {},\n 'depreciation_costs_per(:mw_electricity)' => {},\n 'variable_costs_per(:mw_electricity)' => {},\n 'fuel_costs_per(:mw_electricity)' => {},\n 'co2_emissions_costs_per(:mw_electricity)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mw_electricity)' => {},\n 'variable_operation_and_maintenance_costs_per(:mw_electricity)' => {},\n 'total_initial_investment_per(:mw_electricity)' => {},\n },\n :costs_per_mwh_electricity => {\n 'total_costs_per(:mwh_electricity)' => {},\n 'fixed_costs_per(:mwh_electricity)' => {},\n 'cost_of_capital_per(:mwh_electricity)' => {},\n 'depreciation_costs_per(:mwh_electricity)' => {},\n 'variable_costs_per(:mwh_electricity)' => {},\n 'fuel_costs_per(:mwh_electricity)' => {},\n 'co2_emissions_costs_per(:mwh_electricity)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mwh_electricity)' => {},\n 'variable_operation_and_maintenance_costs_per(:mwh_electricity)' => {},\n 'total_initial_investment_per(:mwh_electricity)' => {},\n },\n :costs_per_mw_heat => {\n 'total_costs_per(:mw_heat)' => {},\n 'fixed_costs_per(:mw_heat)' => {},\n 'cost_of_capital_per(:mw_heat)' => {},\n 'depreciation_costs_per(:mw_heat)' => {},\n 'variable_costs_per(:mw_heat)' => {},\n 'fuel_costs_per(:mw_heat)' => {},\n 'co2_emissions_costs_per(:mw_heat)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mw_heat)' => {},\n 'variable_operation_and_maintenance_costs_per(:mw_heat)' => {},\n 'total_initial_investment_per(:mw_heat)' => {},\n },\n :costs_per_mwh_heat => {\n 'total_costs_per(:mwh_heat)' => {},\n 'fixed_costs_per(:mwh_heat)' => {},\n 'cost_of_capital_per(:mwh_heat)' => {},\n 'depreciation_costs_per(:mwh_heat)' => {},\n 'variable_costs_per(:mwh_heat)' => {},\n 'fuel_costs_per(:mwh_heat)' => {},\n 'co2_emissions_costs_per(:mwh_heat)' => {},\n 'fixed_operation_and_maintenance_costs_per(:mwh_heat)' => {},\n 'variable_operation_and_maintenance_costs_per(:mwh_heat)' => {},\n 'total_initial_investment_per(:mwh_heat)' => {},\n }\n }\n graph.carriers.each do |c|\n method_name = \"primary_demand_of_#{c.key}\".to_sym\n out[:demand][method_name] = {hide_if_zero: true}\n end\n out\n end", "def parse_from_summary(data)\n {} # nothing for college\n end", "def nonprofit\n end", "def index\n # @lot_votes = Lot.find_with_reputation(:votes, :all, order: \"votes desc\")\n @all_lots = Lot.latest.sum('appraised_value') #all.sum(&:appraised_value)\n @commericial_appeal = Lot.latest.all_commericial_appeal.sum(&:full_appeal)\n @commericial_appraised = Lot.latest.all_commericial_appraised.sum(&:appraised_value)\n @commericial_digest = Lot.latest.commercial_property.sum(&:appraised_value)\n @commericial_taxable = (@commericial_appeal + @commericial_appraised)\n @residential_taxable = (@all_lots - @commericial_taxable)\n @commericial_city_taxes_collected = (@commericial_taxable * 0.01642)\n @commericial_school_taxes_collected = (@commericial_taxable * 0.0209)\n @commericial_lost_to_appeal = (@commericial_digest - @commericial_taxable)\n @city_commericial_tax_lost_to_appeal = (@commericial_lost_to_appeal * 0.01642)\n @school_commericial_tax_lost_to_appeal = (@commericial_lost_to_appeal * 0.0209)\n @total_commericial_tax_lost_to_appeal = (@city_commericial_tax_lost_to_appeal + @school_commericial_tax_lost_to_appeal)\n if user_signed_in?\n @search = Lot.latest.search(params[:q])\n else\n @search = Lot.latest.commercial_property.search(params[:q])\n end\n @lots = @search.result.page(params[:page]).per(20)\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n @properties = @lots.order('appraised_value desc')\n organizations = Organization.all.map(&:id) # preload cache\n @properties_for_workflow = current_user ? @search.result.select { |l|\n organizations.include?(l.organization_id) && l.organization_id == current_user.organization_id\n } : []\n\n @json = @lots.all.to_gmaps4rails do |lot, marker|\n marker.title \"#{lot.owner}\"\n marker.json({ :id => lot.id })\n end\n\n @taxes_lost_chart = Highcharts.new do |chart|\n chart.chart(renderTo: 'graph')\n chart.title('Commercial Taxes Suspended during Appeal')\n chart.xAxis(categories: ['City Taxes lost on appeal', 'School Taxes lost on appeal', 'Total Taxes lost on appeal'])\n chart.yAxis(title: 'Dollars', min: 0)\n chart.series(name: 'Dollars', yAxis: 0, type: 'bar', data: [@city_commericial_tax_lost_to_appeal, @school_commericial_tax_lost_to_appeal, @total_commericial_tax_lost_to_appeal])\n chart.legend(enabled: false, align: 'left', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0)\n chart.credits(0)\n end\n\n @taxes_by_zoning = Highcharts.new do |chart|\n chart.chart(renderTo: 'graph2')\n chart.title('Commercial Taxes Paid to...')\n chart.xAxis(categories: ['City Taxes', 'School Taxes'])\n chart.yAxis(title: 'Dollars', min: 0)\n chart.series(name: 'Dollars', yAxis: 0, type: 'bar', data: [@city_commericial_tax_lost_to_appeal, @commericial_school_taxes_collected])\n chart.legend(enabled: false, verticalAlign: 'top', x: -10, y: 100, borderWidth: 0)\n chart.credits(0)\n end\n\n @taxes_by_type = Highcharts.new do |chart|\n chart.chart(renderTo: 'graph3')\n chart.title('Taxes by property type')\n chart.series(name: 'Dollars', yAxis: 0, type: 'pie', data: [['Commercial', @commericial_taxable], ['Residential', @residential_taxable]])\n chart.legend(enabled: false, verticalAlign: 'top', x: -10, y: 100, borderWidth: 0, format: '<b>{chart.name}</b>: {chart.percentage:.1f} %')\n chart.credits(0)\n end\n\n @properties_value_trend = Highcharts.new do |chart|\n chart.chart(renderTo: 'graph31')\n chart.title('Properties Value Trend')\n chart.yAxis(title: 'Dollars', min: 0)\n stats = {}\n Lot.select('DISTINCT tax_year').map(&:tax_year).each { |year|\n stats[year] = {\n :land_value => Lot.year(year).sum(:land_value),\n :building_value => Lot.year(year).sum(:building_value),\n :appraised_value => Lot.year(year).sum(:appraised_value)\n }\n }\n chart.xAxis(categories: stats.keys)\n chart.series([{ name: 'Land Value', type: 'line', data: stats.values.map { |s| s[:land_value] } },\n { name: 'Building Value', type: 'line', data: stats.values.map { |s| s[:building_value] } },\n { name: 'Appraised Value', type: 'line', data: stats.values.map { |s| s[:appraised_value] } }])\n chart.credits(0)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lots }\n end\n end", "def details\n return @description + \" Extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end", "def human_price\n #return self.price.to_s + '元' + '(待审)' if self.type_id !='团购价' or self.is_valid.nil?# and self.reviews.sum(:status) < STATUS_LOW\n self.price == 0.0 ? \"免费\" :\"#{\"%0.2f\" %self.price}元\"\n end", "def details\r\n return @description + \"; \" + @firm + \": \" + \"#{@cost}\"\r\n end", "def water_footprint_calculation\n unless self.compositions.any? { |composition| composition.percentage.nil? } || category.nil?\n self.water_footprint = self.compositions.inject(0) do |total, c|\n total + c.percentage.to_f / 100 * category.weight * c.material.water_foot_print_per_kilo\n end\n end\n end", "def cost \n return @extra_cost + @basic_booking.cost\n end", "def cost \n return @extra_cost + @basic_booking.cost\n end", "def check_price\n @num_cookbooks = (params[:num_cookbooks] && params[:num_cookbooks].to_i > 3) ? params[:num_cookbooks].to_i : 4\n ccc = CookbookCostCalculator.new(\n num_bw_pages: current_cookbook.num_bw_pages, \n num_color_pages: current_cookbook.num_color_pages, \n num_books: @num_cookbooks, \n binding: current_cookbook.book_binding.to_sym\n )\n @cookbook = current_cookbook\n @printing_cost = ccc.printing_cost || \"Unknown\"\n @cost_per_book = (@printing_cost != \"Unknown\") ? (@printing_cost.to_f / @num_cookbooks).round(2) : \"Unknown\"\n end", "def details\n return @description + \"; \" + @firm + \"; \" + @age + \": \" + \"#{@cost}\"\n end", "def render_summary\n summary = nil\n\n end", "def summary(include_item_specifics = false)\n string = []\n string << title.ljust(80)\n string << \"[#{status.to_s}]\".capitalize.rjust(15)\n\n if has_variations?\n string << \"\\n #{variations.count} Variations:\"\n variations.each do |variation|\n string << \"\\n #{variation[:sku]}: \"\n string << \"#{variation[:quantity_available].to_s.rjust(3)} @ #{(variation[:current_price].symbol + variation[:current_price].to_s).rjust(6)}\"\n string << \" #{variation[:quantity_listed].to_s.rjust(2)} listed, #{variation[:quantity_sold].to_s.rjust(2)} sold\"\n end\n else\n string << \"\\n \"\n string << \"#{quantity_available.to_s} @ \"\n string << \"#{current_price.symbol}#{current_price.to_s}\"\n if best_offer? # Cannot have best offer on variations\n string << ' with Best Offer'\n string << \" #{best_offer_auto_accept_price.symbol}#{best_offer_auto_accept_price}\" if best_offer_auto_accept_price\n string << \" | #{best_offer_minimum_accept_price.symbol}#{best_offer_minimum_accept_price}\" if best_offer_minimum_accept_price\n end\n end\n\n if promotional_sale?\n details = promotional_sale\n starts = details[:start_time]\n ends = details[:end_time]\n original_price = promotional_sale[:original_price]\n string << \"\\n \"\n string << 'ON SALE NOW!' if on_sale_now?\n string << 'was on sale' if Time.now.utc > ends\n string << 'sale scheduled' if Time.now.utc < starts\n string << \" original price #{original_price.symbol}#{original_price.to_s}\"\n string << \" #{starts.strftime('%H:%M %A')}\"\n string << \" until #{ends.strftime('%H:%M %A')}\"\n end\n string << \"\\n\"\n\n string << \"#{quantity_sold.to_s.rjust(4)} sold\"\n if quantity_sold > 0 && status == :completed\n days = (end_time - start_time).round.to_i\n if days > 1\n string << \" in #{days} days\"\n else\n hours = ((end_time.to_time - start_time.to_time) / 1.hour).round\n string << \" in #{hours} hours\"\n end\n end\n\n string << \", #{watch_count} watchers, #{hit_count} page views.\"\n string << \"\\n\"\n\n string << \" SKU: #{sku} Photos: #{photo_urls.count} eBay ID: \"\n string << \"#{relist_parent_id} <= \" unless relist_parent_id.nil?\n string << \"#{ebay_item_id}\"\n string << \" => #{relist_child_id}\" unless relist_child_id.nil?\n\n string << \"\\n \"\n if gtc?\n date_time = (Time.now.utc < end_time) ? Time.now.utc : end_time\n days = (date_time - start_time).round.to_i\n if days > 1\n string << \"GTC [#{days} days]\"\n else\n hours = ((date_time.to_time - start_time.to_time) / 1.hour).round\n string << \"GTC [#{hours} hours]\"\n end\n\n else\n string << \"#{duration} Day\"\n end\n string << \" #{category_1_path.join(' -> ')}\"\n\n string << \"\\n \"\n string << \"#{start_time.strftime('%l:%H%P %A %-d %b').strip} until #{end_time.strftime('%l:%H%P %A %-d %b').strip}\"\n\n if include_item_specifics\n item_specifics.each_pair do |key, value|\n string << \"\\n#{key.rjust(30)} : #{value}\"\n end\n end\n\n string.join\n end", "def details\n return @description + \" extra cost: \" + \"#{@extra_cost}\" + \". \" + @basic_booking.details\n end", "def disc_amount\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.tr.className(\"/^discount$/\").td.className(\"/^right$/\"), format_method(__method__))\n end", "def price\n @price\n end", "def price\n @price\n end", "def details\n return \"#{@description} : #{@extra_cost}, #{@basic_booking.details}\"\n end", "def call\n @top_nodes_summary.call(\n @destination_node_type,\n @commodity_production_attribute\n ).merge(\n legend_title: @commodity_production_chart_attribute.legend_name\n )\n end", "def details\n return @description + \": \" + \"#{@extra_cost}\" + \". \" + @basic_cycle.details\n end", "def pur_pro_price\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.id(\"/purProPriceDiv/\"), format_method(__method__), @spec)\n end", "def initialize(discount = 0) #new optionally takes an employee discount on initialization\n @total = 0 #SETS AN INSTANCE VARIABLE @TOTAL ON INITIALIZATION TO ZERO\n @discount = discount # CashRegister ::new optionally takes an employee discount on initialization\n @items = [] #returns an array containing all items that have been added\n end", "def price\n haul == \"Medium\" ? AssignmentParameters.spill_medium : AssignmentParameters.spill_short\n end", "def summary\r\n \r\n @ph_product = PhProduct.find(params[:ph_result_id])\r\n \r\n add_breadcrumb _(\"My products\").html_safe, :products_url\r\n add_breadcrumb @ph_product.product.name, edit_product_url(@ph_product.product)\r\n add_breadcrumb _(\"Environmental Assessment\").html_safe, ph_production_init_path(@ph_product)\r\n add_breadcrumb _(\"Results\").html_safe, ph_result_summary_path(@ph_product)\r\n \r\n @product = @ph_product.product\r\n @step = 1 \r\n if @ph_product.ph_intermediate_result \r\n if !@ph_product.ph_result\r\n ph_result = PhResult.new \r\n ph_result.ph_product_id = @ph_product.id\r\n ph_result.save\r\n @ph_product.ph_result = ph_result\r\n end\r\n @ph_result = @ph_product.ph_result\r\n if !@ph_product.ph_maintenance_result \r\n ph_maintenance_result = PhMaintenanceResult.new \r\n ph_maintenance_result.ph_product_id = @ph_product.id\r\n ph_maintenance_result.save\r\n @ph_product.ph_maintenance_result = ph_maintenance_result \r\n end\r\n @ph_maintenance_result = @ph_product.ph_maintenance_result \r\n if !@ph_product.ph_embedded_result \r\n ph_embedded_result = PhEmbeddedResult.new \r\n ph_embedded_result.ph_product_id = @ph_product.id\r\n ph_embedded_result.save\r\n @ph_product.ph_embedded_result = ph_embedded_result \r\n end\r\n @ph_embedded_result = @ph_product.ph_embedded_result \r\n \r\n\r\n @ph_embedded_result.temperature_induced = 0\r\n temp = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n temp = -0.13\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n temp = -0.4465\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n temp = -0.402545\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n temp = -0.25 \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n temp = -0.43666\r\n end \r\n \r\n # =(Assumptions!$I$11-25)*IF(Assumptions!G19=Menues!A2,Menues!A122,IF(Assumptions!G19=Menues!A3,Menues!B122,IF(Assumptions!G19=Menues!A4,Menues!C122,IF(Assumptions!G19=Menues!A5,Menues!D122,IF(Assumptions!G19=Menues!A6,Menues!E122,0))))) \r\n \r\n @ph_embedded_result.temperature_induced = temp * (@ph_product.ph_basic_information.temperature - 25) \r\n calcul_efficiency = @ph_product.ph_specified.efficiency * (1 + (@ph_embedded_result.temperature_induced / 100))\r\n \r\n ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n ph_database_material_values.each do |ph_database_material_value|\r\n ph_database_material_value.delete\r\n end \r\n \r\n\r\n @ph_database_materials = PhDatabaseMaterial.all \r\n @ph_database_materials.each do |ph_database_material|\r\n if ph_database_material.default_value_co2 == 0\r\n calculate_co2 ph_database_material, @ph_product\r\n end\r\n if ph_database_material.default_value_pe == 0\r\n calculate_pe ph_database_material, @ph_product\r\n end \r\n end\r\n @ph_database_material_values = PhDatabaseMaterialValue.find(:all, :conditions => [\"ph_product_id = ?\", @ph_product.id])\r\n \r\n n49 = 0\r\n if @ph_product.ph_specified.area_unit\r\n n49 = @ph_product.ph_specified.area * @ph_product.ph_specified.area_unit.conversion_factor\r\n end \r\n # ph_result lifetime\r\n \r\n if @ph_product.ph_basic_information.known == 'both' || @ph_product.ph_basic_information.known == 'power_demand'\r\n #Menues!N56*Assumptions!F39\r\n @ph_result.lifetime = 0\r\n n56 = 0\r\n #=IF($Assumptions.G19=$Menues.A7;0;\r\n if @ph_product.ph_specified.ph_module_type.name != 'Not specified'\r\n if @ph_product.ph_specified.power_unit.conversion_factor == -1 \r\n # Peak Power [kWp]\r\n conversion_factor = @ph_product.ph_basic_information.radiation * @ph_product.ph_basic_information.performance_ratio\r\n n56 = @ph_product.ph_specified.power * conversion_factor\r\n else \r\n n56 = @ph_product.ph_specified.power * @ph_product.ph_specified.power_unit.conversion_factor\r\n end \r\n @ph_result.lifetime = n56 * @ph_product.ph_specified.lifetime\r\n end\r\n else \r\n #Menues!N49*(Assumptions!F38/100)*Assumptions!I15*Assumptions!I9*Assumptions!F39 \r\n @ph_result.lifetime = n49 * (calcul_efficiency / 100) * @ph_product.ph_basic_information.performance_ratio * @ph_product.ph_basic_information.radiation * @ph_product.ph_specified.lifetime\r\n end\r\n # New requirement\r\n if @ph_product.ph_basic_information.working == 'yes' && @ph_product.ph_basic_information.know_power == 'yes' \r\n @ph_result.lifetime = @ph_product.ph_basic_information.user_power * @ph_product.ph_specified.lifetime\r\n end \r\n\r\n \r\n #IF($Assumptions.E35=$Menues.G41;$Assumptions.D35*$Menues.E60;IF($Assumptions.E35=$Menues.G42;$Assumptions.D35;IF($Assumptions.E35=G43;$Menues.E59*$Assumptions.D35;IF($Assumptions.E35=$Menues.G44;$Menues.E58*$Assumptions.D35;IF($Assumptions.E35=$Menues.G45;$Menues.E61*$Assumptions.D35;0)))));0))\r\n \r\n\r\n @ph_result.cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n temp = get_database_material_result_co2 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end\r\n\r\n @ph_result.cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n\r\n @ph_result.module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_co2 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_co2 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_co2 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_result.module = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n # =(IF(Assumptions!$G$19=Menues!$A$5,'Database Materials'!B$2,IF(Assumptions!$G$19=Menues!$A$2,'Database Materials'!B$17,IF(Assumptions!$G$19=Menues!$A$3,'Database Materials'!B$15,IF(Assumptions!$G$19=Menues!$A$4,'Database Materials'!B$8,IF(Assumptions!$G$19=Menues!$A$6,'Database Materials'!B$19,0))))))*Assumptions!$I$68 \r\n\r\n @ph_result.framing = 0\r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_co2 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_co2 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_co2 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_co2 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_co2 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end\r\n @ph_result.framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n # ph_result mounting\r\n @ph_result.mounting = 0 \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_co2 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_co2 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_co2 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_result.mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n # ph_result inverter\r\n @ph_result.inverter = 0 \r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_result.inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n # ph_result batteries\r\n @ph_result.batteries = 0\r\n if @ph_product.ph_electric_component.include_batteries == 'yes'\r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid'\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product\r\n end\r\n if @ph_product.ph_electric_component.separated_battery\r\n @ph_result.batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n end\r\n end\r\n # ph_result maintenance\r\n @ph_result.maintenance = 0\r\n \r\n \r\n @ph_result.co2_total = @ph_result.cabling + @ph_result.module + @ph_result.framing + @ph_result.mounting + @ph_result.inverter + @ph_result.batteries\r\n \r\n \r\n ###########\r\n ### MAINTENANCE\r\n #########\r\n \r\n @ph_maintenance_result.years_included = 0\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_5'\r\n @ph_maintenance_result.years_included = 5\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_10'\r\n @ph_maintenance_result.years_included = 10\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_15'\r\n @ph_maintenance_result.years_included = 15\r\n end\r\n if @ph_product.ph_maintenance.maintenance_needs == 'yes_20'\r\n @ph_maintenance_result.years_included = 20\r\n end\r\n \r\n # boolean\r\n @ph_maintenance_result.inverter_replacement = 0\r\n if @ph_maintenance_result.years_included != 0\r\n if @ph_product.ph_maintenance.replacement_inverters == 'yes'\r\n @ph_maintenance_result.inverter_replacement = 1 \r\n end \r\n end\r\n\r\n # boolean\r\n @ph_maintenance_result.batteries_replacement = 0\r\n if @ph_product.ph_maintenance.replacement_batteries == 'yes'\r\n @ph_maintenance_result.batteries_replacement = 1 \r\n end \r\n \r\n @ph_maintenance_result.tap_water_l = 0\r\n if @ph_product.ph_maintenance.cleaning_modules == 'yes'\r\n @ph_maintenance_result.tap_water_l = 3.25\r\n end\r\n \r\n @ph_maintenance_result.tap_water_co2 = 0\r\n #b38\r\n temp = get_database_material_result_co2 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_co2 = temp * @ph_maintenance_result.tap_water_l\r\n \r\n @ph_maintenance_result.tap_water_pe = 0\r\n #c38\r\n temp = get_database_material_result_pe 'Maintenance', 'Tap Water', @ph_product\r\n @ph_maintenance_result.tap_water_pe = temp * @ph_maintenance_result.tap_water_l\r\n \r\n \r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n if @ph_product.ph_electric_component.inverter_size_1 != 0 && @ph_product.ph_electric_component.quantity_1 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_1 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_1) - 1\r\n if @ph_maintenance_result.needed_cycles_1 < 0\r\n @ph_maintenance_result.needed_cycles_1 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_1 = @ph_maintenance_result.needed_cycles_1.ceil \r\n end\r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_1 = @ph_maintenance_result.needed_cycles_1 * @ph_product.ph_electric_component.quantity_1\r\n \r\n @ph_maintenance_result.embodied_co2_1 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_co2_1 = temp * @ph_maintenance_result.needed_replacements_1 \r\n @ph_maintenance_result.embodied_pe_1 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_maintenance_result.embodied_pe_1 = temp * @ph_maintenance_result.needed_replacements_1\r\n\r\n \r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n if @ph_product.ph_electric_component.inverter_size_2 != 0 && @ph_product.ph_electric_component.quantity_2 != 0 \r\n if @ph_maintenance_result.inverter_replacement == 1 \r\n @ph_maintenance_result.needed_cycles_2 = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.lifetime_2) - 1\r\n if @ph_maintenance_result.needed_cycles_2 < 0\r\n @ph_maintenance_result.needed_cycles_2 = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_2 = @ph_maintenance_result.needed_cycles_2.ceil\r\n end \r\n end\r\n end\r\n @ph_maintenance_result.needed_replacements_2 = @ph_maintenance_result.needed_cycles_2 * @ph_product.ph_electric_component.quantity_2\r\n \r\n @ph_maintenance_result.embodied_co2_2 = 0\r\n # B29\r\n temp = get_database_material_result_co2 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_co2_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n @ph_maintenance_result.embodied_pe_2 = 0\r\n # C29\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_maintenance_result.embodied_pe_2 = temp * @ph_maintenance_result.needed_replacements_2\r\n \r\n \r\n if @ph_product.ph_maintenance.distance\r\n @ph_maintenance_result.driven_maintenance = 2 * @ph_product.ph_maintenance.distance\r\n else\r\n @ph_maintenance_result.driven_maintenance = 0\r\n end\r\n\r\n @ph_maintenance_result.driven_year = 0\r\n if @ph_product.ph_maintenance.yearly_frequency && @ph_maintenance_result.driven_maintenance\r\n @ph_maintenance_result.driven_year = @ph_maintenance_result.driven_maintenance * @ph_product.ph_maintenance.yearly_frequency\r\n end\r\n @ph_maintenance_result.driven_contract = @ph_maintenance_result.driven_year * @ph_maintenance_result.years_included\r\n \r\n @ph_maintenance_result.embodied_co2_transport = 0 \r\n #B35\r\n temp = get_database_material_result_co2 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_co2_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_pe_transport = 0\r\n #C35\r\n temp = get_database_material_result_pe 'Maintenance', 'Average Car Driving', @ph_product\r\n @ph_maintenance_result.embodied_pe_transport = @ph_maintenance_result.driven_contract * temp\r\n \r\n @ph_maintenance_result.embodied_co2_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_co2\r\n @ph_maintenance_result.embodied_pe_cleaning = @ph_product.ph_intermediate_result.module_area * @ph_maintenance_result.tap_water_pe\r\n\r\n if @ph_product.ph_maintenance.yearly_frequency && @ph_maintenance_result.years_included\r\n @ph_maintenance_result.total_embodied_co2_cleaning = @ph_maintenance_result.embodied_co2_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n @ph_maintenance_result.total_embodied_pe_cleaning = @ph_maintenance_result.embodied_pe_cleaning * @ph_maintenance_result.years_included * @ph_product.ph_maintenance.yearly_frequency\r\n end\r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n if @ph_maintenance_result.batteries_replacement == 1\r\n if @ph_maintenance_result.years_included && @ph_product.ph_electric_component.battery_lifetime\r\n @ph_maintenance_result.needed_cycles_batteries = (@ph_maintenance_result.years_included / @ph_product.ph_electric_component.battery_lifetime) - 1\r\n if @ph_maintenance_result.needed_cycles_batteries < 0\r\n @ph_maintenance_result.needed_cycles_batteries = 0\r\n else \r\n @ph_maintenance_result.needed_cycles_batteries = @ph_maintenance_result.needed_cycles_batteries.ceil\r\n end\r\n end\r\n end\r\n\r\n\r\n @ph_maintenance_result.needed_replacements_batteries = 0\r\n if @ph_product.ph_electric_component.separated_battery\r\n @ph_maintenance_result.needed_replacements_batteries = @ph_maintenance_result.needed_cycles_batteries * @ph_product.ph_electric_component.separated_battery\r\n end\r\n\r\n @ph_maintenance_result.embodied_co2_batteries = 0\r\n if @ph_product.ph_electric_component.include_batteries == 'yes'\r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid'\r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #B32 \r\n temp_2 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n #B33\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n #B34 \r\n temp_2 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product\r\n end \r\n @ph_maintenance_result.embodied_co2_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n end\r\n\r\n\r\n @ph_maintenance_result.embodied_pe_batteries = 0\r\n if @ph_product.ph_electric_component.include_batteries == 'yes'\r\n\r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid' \r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n #C32 \r\n temp_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n #B31\r\n temp = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n #C32 \r\n temp_2 = get_database_material_result_pe 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product \r\n end \r\n @ph_maintenance_result.embodied_pe_batteries = @ph_maintenance_result.needed_replacements_batteries * temp * temp_2\r\n end\r\n\r\n\r\n @ph_maintenance_result.embodied_carbon_dioxide = 0\r\n @ph_maintenance_result.embodied_primary_energy = 0\r\n if @ph_product.ph_maintenance.maintenance_needs != 'no'\r\n begin\r\n @ph_maintenance_result.embodied_carbon_dioxide = @ph_maintenance_result.embodied_co2_1 + @ph_maintenance_result.embodied_co2_2 + @ph_maintenance_result.embodied_co2_transport + @ph_maintenance_result.total_embodied_co2_cleaning + @ph_maintenance_result.embodied_co2_batteries\r\n @ph_maintenance_result.embodied_primary_energy = @ph_maintenance_result.embodied_pe_1 + @ph_maintenance_result.embodied_pe_2 + @ph_maintenance_result.embodied_pe_transport + @ph_maintenance_result.total_embodied_pe_cleaning + @ph_maintenance_result.embodied_pe_batteries\r\n rescue\r\n end\r\n end\r\n @ph_result.maintenance = @ph_maintenance_result.embodied_carbon_dioxide\r\n @ph_embedded_result.pe_maintenance = @ph_maintenance_result.embodied_primary_energy\r\n ##########\r\n ### EMBEDDED\r\n ##########\r\n\r\n @ph_embedded_result.lifetime_saved = @ph_result.lifetime * 3.6 / @ph_product.ph_basic_information.conversion_factor\r\n \r\n @ph_embedded_result.pe_pv_cabling = 0\r\n temp = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted' || @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #C22\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Roof Mounted System', @ph_product \r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated' || @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #C21\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Facade Mounted System', @ph_product\r\n end \r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #C23\r\n temp = get_database_material_result_pe 'Electrical Cabling', 'Ground Mounted System', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_cabling = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n \r\n @ph_embedded_result.pe_pv_module = 0\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B17\r\n temp = get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B15\r\n temp = get_database_material_result_pe 'p-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B8\r\n temp = get_database_material_result_pe 'm-Si', 'Total Module Laminate', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = get_database_material_result_pe 'CdTe', 'Thinfilm', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B19\r\n temp = get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product \r\n end\r\n @ph_embedded_result.pe_pv_module = temp * @ph_product.ph_intermediate_result.module_area \r\n \r\n @ph_embedded_result.pe_pv_framing = 0\r\n if @ph_product.ph_basic_information.framed == 'yes'\r\n if @ph_product.ph_specified.ph_module_type.name == 'amorphous Silicon'\r\n # B18 - B17\r\n temp = (get_database_material_result_pe 'a-Si', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'a-Si', 'Module Laminate', @ph_product)\r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'polycrystalline Silicon'\r\n # B14\r\n temp = get_database_material_result_pe 'p-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'monocrystalline Silicon'\r\n # B7\r\n temp = get_database_material_result_pe 'm-Si', 'Module/Framed Panel', @ph_product \r\n end\r\n if @ph_product.ph_specified.ph_module_type.name == 'CIS/CIGS Thinfilm'\r\n # B20 - B19\r\n temp = (get_database_material_result_pe 'CIS/CIGS', 'Module Framed Panel', @ph_product) - (get_database_material_result_pe 'CIS/CIGS', 'Module Laminate', @ph_product) \r\n end \r\n if @ph_product.ph_specified.ph_module_type.name == 'CdTe Thinfilm'\r\n # B2\r\n temp = 0 \r\n end \r\n @ph_embedded_result.pe_pv_framing = temp * @ph_product.ph_intermediate_result.module_area\r\n end\r\n \r\n @ph_embedded_result.pe_pv_mounting = 0\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Mounted'\r\n #B24\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Mounted Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'On Roof - Integrated'\r\n #B25\r\n temp = get_database_material_result_pe 'Mounting', 'Roof Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Mounted'\r\n #B27\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Mounted Structures', @ph_product \r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Facade - Integrated'\r\n #B28\r\n temp = get_database_material_result_pe 'Mounting', 'Facade Integrated Structures', @ph_product\r\n end\r\n if @ph_product.ph_basic_information.ph_mounting_type.name == 'Open Ground'\r\n #B26\r\n temp = get_database_material_result_pe 'Mounting', 'Open Ground Structures', @ph_product\r\n end \r\n @ph_embedded_result.pe_pv_mounting = temp * @ph_product.ph_intermediate_result.module_area\r\n \r\n @ph_embedded_result.pe_inverter = 0\r\n if @ph_product.ph_electric_component.quantity_1 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 1', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_1\r\n end\r\n if @ph_product.ph_electric_component.quantity_2 != 0\r\n temp = get_database_material_result_pe 'Electrics', '1x Inverter Type 2', @ph_product\r\n @ph_embedded_result.pe_inverter += temp * @ph_product.ph_electric_component.quantity_2\r\n end\r\n \r\n \r\n @ph_embedded_result.pe_batteries = 0\r\n if @ph_product.ph_electric_component.include_batteries == 'yes'\r\n if @ph_product.ph_electric_component.ph_battery_type.name == 'Lead Acid'\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lead Acid [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_pe 'Electrics Battery', 'Lead Acid [per kg]', @ph_product\r\n else\r\n pes_1 = get_database_material_result_co2 'Electrics Battery', 'Lithium Ion [kg / pc.]', @ph_product\r\n pes_2 = get_database_material_result_pe 'Electrics Battery', 'Lithium Ion [per kg]', @ph_product\r\n end\r\n if @ph_product.ph_electric_component.separated_battery\r\n @ph_embedded_result.pe_batteries = @ph_product.ph_electric_component.separated_battery * pes_1 * pes_2\r\n end\r\n end\r\n \r\n \r\n @ph_embedded_result.embedded_energy_total = @ph_embedded_result.pe_pv_cabling + @ph_embedded_result.pe_pv_module + @ph_embedded_result.pe_pv_framing + @ph_embedded_result.pe_pv_mounting + @ph_embedded_result.pe_inverter + @ph_embedded_result.pe_batteries + @ph_embedded_result.pe_maintenance \r\n \r\n \r\n @ph_embedded_result.peak_power = @ph_product.ph_intermediate_result.module_area * calcul_efficiency / 100\r\n @ph_embedded_result.lifetime_production = @ph_result.lifetime\r\n \r\n \r\n if @ph_product.ph_basic_information.working == 'yes' && @ph_product.ph_basic_information.know_power == 'yes' && @ph_product.ph_basic_information.user_power\r\n @ph_embedded_result.averaged_power = @ph_product.ph_basic_information.user_power\r\n else \r\n @ph_embedded_result.averaged_power = @ph_embedded_result.lifetime_production / @ph_product.ph_specified.lifetime \r\n end\r\n\r\n @ph_embedded_result.averaged_consumption = @ph_embedded_result.averaged_power * 3.6 / @ph_product.ph_basic_information.conversion_factor \r\n @ph_embedded_result.system_emb = @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.energy_payback = @ph_embedded_result.embedded_energy_total / @ph_embedded_result.averaged_consumption\r\n @ph_embedded_result.energy_yield = @ph_embedded_result.lifetime_saved / @ph_embedded_result.embedded_energy_total\r\n @ph_embedded_result.emb_co2 = @ph_result.cabling + @ph_result.inverter + @ph_result.batteries \r\n\r\n @ph_result.co2_total += @ph_result.maintenance\r\n @ph_embedded_result.estim_co2 = 1000 * @ph_result.co2_total / @ph_result.lifetime\r\n @ph_embedded_result.net_saved_co2 = @ph_embedded_result.lifetime_production * (@ph_product.ph_basic_information.co2_factor - @ph_embedded_result.estim_co2) / 1000 \r\n \r\n @ph_product.ph_result.save\r\n @ph_product.ph_embedded_result.save\r\n @ph_product.ph_maintenance_result.save\r\n end \r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml\r\n end\r\n end", "def price\n case category \n when 'book'\n unit_cost * 1.10\n when 'audiobook'\n unit_cost * 1.20\n when 'magazine'\n unit_cost * 1.15\n end\n end", "def special_prices\n prices\n end", "def primo_summary\n \n return @primo_summary if @primo_summary\n collection = @primo_response.collect {|pr| Parking.primo_summary(pr, self.heading)}\n collection.reject! { |h| h[1].blank?} # remove any without direction\n @primo_summary = collection.inject({}) do |collector, item|\n direction = item[1]\n if collector[direction].blank? || collector[direction][:distance] > item[2][:distance]\n collector[direction] = item[2] if item[2][:street].match(geocoded_street_regex)\n end\n collector\n end\n @primo_summary[:left] = {:until=>\"Mon&nbsp;8:00am\", :section=>\"Gloucester St-Fairfield St\", :limit=>\"19h 20m\", :street=>\"Massachusetts Ave\", :distance=>1056.0, :meter=>true, :side=>\"N\"} if(self.address.match(/massachusetts/i))\n @primo_summary\n end", "def full_price\n\t\t\t\t@aftertax = @baseprice * @taxrate\n\t\tend", "def make_summaries\n if @data.key?(\"Global\") && @data.key?(\"Countries\") && @data.key?(\"Date\")\n global_data = @data[\"Global\"]\n global_data[\"Date\"] = @data[\"Date\"]\n global_data[\"Country\"] = \"Global\"\n\n # Clean up global_data with the parser method\n global_hash = parser(global_data)\n\n # Create the Summary object for global info\n CovidTracking::Summary.new(global_hash)\n\n @data[\"Countries\"].each {|ctry_info| CovidTracking::CountrySummary.new(parser(ctry_info))}\n else\n raise DataError\n end\n\n end", "def summary=(value)\n @summary = value\n end", "def summary=(value)\n @summary = value\n end", "def summary=(value)\n @summary = value\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def total_tuition_cost\n tuition_cost = courses.inject(0) {|sum, c| sum + c.cost}\n tuition_cost = sprintf( \"%0.02f\", tuition_cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\n puts \"\\nTotal tuition paid: $#{tuition_cost}\n \\n\"\n\n # puts tp self.courses,:subject,:cost\n tp self.courses,:subject, {\"Course Coste\" => {:display_method => lambda{|x| \"$\" + \"#{sprintf( \"%0.02f\", x.cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse}\"}}}\n\n end", "def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end", "def info\n return \"#{self.name} $#{self.price} (#{self.calorie}kcal)\"\n end" ]
[ "0.6077154", "0.5981359", "0.5981359", "0.5981359", "0.5981359", "0.58317417", "0.5804441", "0.58023834", "0.58023834", "0.57445705", "0.5719932", "0.5715706", "0.5708237", "0.56669694", "0.5637782", "0.55703855", "0.55170155", "0.54754543", "0.5441314", "0.54308385", "0.54305303", "0.54224813", "0.5384918", "0.5374783", "0.5356127", "0.5349431", "0.53093535", "0.5307498", "0.5307498", "0.52907157", "0.52416646", "0.5219027", "0.52058846", "0.5201841", "0.51973647", "0.5177594", "0.51708734", "0.51659673", "0.51659673", "0.51659673", "0.51636523", "0.51591206", "0.51591206", "0.51591206", "0.51550937", "0.5145473", "0.514462", "0.51394504", "0.5139013", "0.513357", "0.51198316", "0.51149964", "0.51030505", "0.509487", "0.50895983", "0.50743526", "0.50742686", "0.50658625", "0.5057161", "0.5055664", "0.5041478", "0.5034905", "0.50338566", "0.50234336", "0.5010767", "0.50098234", "0.50075483", "0.4997374", "0.49902686", "0.49898776", "0.49888426", "0.49888426", "0.49887818", "0.49870276", "0.49791443", "0.49789307", "0.49774206", "0.49767518", "0.4973185", "0.4973185", "0.4972996", "0.49641722", "0.49637392", "0.4961825", "0.49601868", "0.49557674", "0.49515697", "0.49497283", "0.49451524", "0.4943546", "0.49431255", "0.49425012", "0.49410105", "0.49410105", "0.49410105", "0.4937402", "0.4937402", "0.49326172", "0.49300823", "0.49288115" ]
0.7059254
0
This method relate Course::Route::Line instance to Course::Price instance. If even without those associated with Line, return Price instance. Ex. Course::Route::Linefare Course::Route::Linecharge Course::Route::Lineteiki1 etc...
def relate_line_to_price @route_list[0].line_list.each do |line| line.fare = find_price(line, :fare) line.charge = find_price(line, :charge) line.teiki1 = find_price(line, :teiki1) line.teiki3 = find_price(line, :teiki3) line.teiki6 = find_price(line, :teiki6) line.teiki12 = find_price(line, :teiki12) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relate_price_to_line\n @price_list.each do |price|\n next unless price.respond_to?(:from_line_index)\n\n price_range = (price.from_line_index.to_i..price.to_line_index.to_i)\n price.line_list = @route_list[0].line_list.select { |line| price_range.include?(line.index.to_i) }\n end\n end", "def price_from_line_item(line_item)\n line_item.variant.price_for(price_list)\n end", "def price_as_price\n @price_as_price ||= Price.new(price, price_includes_tax?, tax_rate)\n end", "def price_curve\n @price_curve ||= PriceCurve.new(self, fallback_price)\n end", "def flow_line_item_price line_item, total=false\n result = unless flow_order\n Flow.format_default_price(line_item.price * (total ? line_item.quantity : 1))\n else\n id = line_item.variant.id.to_s\n\n lines = flow_order.lines || []\n item = lines.select{ |el| el['item_number'] == id }.first\n\n return Flow.price_not_found unless item\n\n total ? item['total']['label'] : item['price']['label']\n end\n\n # add line item promo\n # promo_total, adjustment_total\n result += ' (%s)' % Flow.format_default_price(line_item.promo_total) if line_item.promo_total > 0\n\n result\n end", "def update_line_item_price!(line_item)\n price = price_from_line_item(line_item)\n\n if price\n line_item.update_attributes!(price_list_id: price.price_list_id, price: price.amount)\n else\n raise RuntimeError, \"no #{price_list.name} list price found for #{line_item.product.name} (#{line_item.variant.sku})\"\n end\n end", "def set_price\n course = Course.find(self.course_id)\n self.price = course.price\n end", "def cart_line_item(product, quantity = 1, line_options = {})\n raise \"No price column available for '#{product.class.name}'\" unless product.respond_to?(:price)\n # we need to set currency explicitly here for correct money conversion of the cart_line_item\n MerchantSidekick::ShoppingCart::LineItem.new do |line_item|\n line_item.options = self.options.merge(line_options)\n line_item.currency = self.currency\n line_item.quantity = quantity\n line_item.product = product\n line_item\n end\n end", "def relate_price_and_pass_status\n price_list.each do |price|\n next unless price.kind.match?(/^Teiki\\d{1}$/)\n\n pass_status = find_pass_status(price)\n # Price to PassStatus\n price.pass_status = pass_status\n # PassStatus to Price\n pass_status.price_list << price\n end\n end", "def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def create_price \n Price.create_from_item(self)\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def line_total\n (@quantity * @price + line_item_sales_tax_total).round(2)\n end", "def price\n @longboard.price + @custom_print.price\n end", "def price_with_tax\n price_as_price.with_tax\n end", "def total_price\n self.line_items.each.sum {|li| li.total_price}\n end", "def get_total_price\n self.line_items.sum { |item| item.get_subtotal }\n end", "def to_order_line\n OrderLine.new(\n product_id: 0,\n product_sku: SKU,\n product_name: name,\n product_price: price_adjustment,\n vat_amount: tax_adjustment\n )\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def price\n (read_attribute(:sale_price) if on_sale?) || read_attribute(:price)\n end", "def get_adjustment_line\n prd = Product.get_adjustment_product\n raise \"Missing adjustment product: please add using Maintain/Products function\" unless prd\n @lines.find {|li| li.li_prd_id == prd.prd_id }\n end", "def set_price\n @price = Price.find(params[:id])\n @prices = Price.order('position Asc')\n #@price.strain_id = Strain.find(params[:id]).id\n #@price.region_id = Region.find(params[:id]).id\n end", "def price(type)\n if type ==1\n cost = @product.price * @quantity\n elsif type == 2\n cost = @product.special_price * @quantity\n elsif type == 3\n cost = @product.member_price * @quantity\n end\n @product.cost = cost\n @product.save\n cost\n end", "def create\n @line_item = LineItem.new(params[:line_item])\n @line_item.price = @line_item.catalog_item.unit_price\n \n respond_to do |format|\n if @line_item.save\n \n flash[:notice] = 'LineItem was successfully created.'\n format.html { redirect_to(@line_item) }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def to_order_line\n OrderLine.new(\n product_id: product.id,\n product_sku: sku,\n product_name: product.name,\n product_brand: product.brand,\n product_rrp: product.rrp,\n product_price: product_price_ex_vat,\n product_weight: product_weight,\n vat_amount: vat_amount,\n quantity: quantity,\n feature_descriptions: feature_descriptions\n )\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def price_document\n self.carrier_product_price.try(:price_document)\n end", "def line_items_price_calculations(line_items)\n total_price = 0.0\n line_items.each do |li|\n total_price += (li.quantity * li.price.to_f)\n end\n return total_price\n end", "def add_booking_line(item_id, quantity)\n\n # Check if the booking includes the item_id\n product_lines = self.booking_lines.select do |booking_line|\n booking_line.item_id == item_id\n end\n\n if product_lines.empty?\n if product = ::Yito::Model::Booking::BookingCategory.get(item_id)\n product_customer_translation = product.translate(customer_language)\n product_unit_cost = product_item_cost_base = product.unit_price(self.date_from, self.days, nil, self.sales_channel_code).round(0)\n product_deposit_cost = product.deposit\n ## Apply promotion code and offers\n rates_promotion_code = if !self.promotion_code.nil? and !self.promotion.code.empty?\n ::Yito::Model::Rates::PromotionCode.first(promotion_code: self.promotion_code)\n else\n nil\n end\n discount = ::Yito::Model::Booking::BookingCategory.discount(product_unit_cost, item_id, self.date_from, self.date_to, rates_promotion_code) || 0\n product_unit_cost = (product_unit_cost - discount).round(0) if discount > 0\n ## End apply offers\n ## Category supplements\n product_supplement_1_unit_cost = product.category_supplement_1_cost || 0\n product_supplement_2_unit_cost = product.category_supplement_2_cost || 0\n product_supplement_3_unit_cost = product.category_supplement_3_cost || 0 \n if sales_channel_code\n if bcsc = Yito::Model::Booking::BookingCategoriesSalesChannel.first(conditions: {'sales_channel.code': sales_channel_code, booking_category_code: product.code })\n product_supplement_1_unit_cost = bcsc.category_supplement_1_cost || 0\n product_supplement_2_unit_cost = bcsc.category_supplement_2_cost || 0\n product_supplement_3_unit_cost = bcsc.category_supplement_3_cost || 0\n end \n end \n ## End of category supplements\n\n transaction do\n # Create booking line\n booking_line = BookingDataSystem::BookingLine.new\n booking_line.booking = self\n booking_line.item_id = item_id\n booking_line.item_description = product.name\n booking_line.item_description_customer_translation = (product_customer_translation.nil? ? product.name : product_customer_translation.name)\n booking_line.item_unit_cost_base = product_item_cost_base\n booking_line.item_unit_cost = product_unit_cost\n booking_line.item_cost = product_unit_cost * quantity\n booking_line.quantity = quantity\n booking_line.product_deposit_unit_cost = product_deposit_cost\n booking_line.product_deposit_cost = product_deposit_cost * quantity\n booking_line.category_supplement_1_unit_cost = product_supplement_1_unit_cost\n booking_line.category_supplement_1_cost = product_supplement_1_unit_cost * quantity\n booking_line.category_supplement_2_unit_cost = product_supplement_2_unit_cost\n booking_line.category_supplement_2_cost = product_supplement_2_unit_cost * quantity\n booking_line.category_supplement_3_unit_cost = product_supplement_3_unit_cost\n booking_line.category_supplement_3_cost = product_supplement_3_unit_cost * quantity\n booking_line.save\n # Create booking line resources\n (1..quantity).each do |resource_number|\n booking_line_resource = BookingDataSystem::BookingLineResource.new\n booking_line_resource.booking_line = booking_line\n booking_line_resource.save\n end\n # Update booking cost\n self.item_cost += (product_unit_cost * quantity)\n self.product_deposit_cost += (product_deposit_cost * quantity)\n self.category_supplement_1_cost += (product_supplement_1_unit_cost * quantity)\n self.category_supplement_2_cost += (product_supplement_2_unit_cost * quantity)\n self.category_supplement_3_cost += (product_supplement_3_unit_cost * quantity) \n self.calculate_cost(false, false)\n self.save\n # Assign available stock\n if status == :pending_confirmation \n if created_by_manager \n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_backoffice_request').to_bool\n else\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_web_request').to_bool\n end\n elsif status == :confirmed \n if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n assign_available_stock\n end\n end \n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'add_booking_line',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.created_booking_line(item_id, quantity),\n attributes_updated: {item_id: item_id, quantity: quantity}.merge({booking: newsfeed_summary}).to_json)\n end\n self.reload\n end\n end\n\n end", "def original_price\n self.read_attribute(:price)\n end", "def total_price\n line_items.to_a.sum {|item| item.total_price}\n end", "def line\n @line ||= Line.get(@attrs['Line'])\n end", "def get_price(hours)\n if hours < 24\n price = (self.class.price_hr*hours)+self.class.price_base\n else\n days = hours/24\n price = (self.class.price_day*days)+self.class.price_base\n end\n\n return price\n end", "def price\n self.payin_rules.find(&:required_rule?).payin_amount\n end", "def total_price\n\t\tline_items.to_a.sum { |item| item.total_price }\n\tend", "def referenced_carrier_product_price\n parent = self.carrier_product\n until parent.nil?\n return parent.carrier_product_price if parent.carrier_product_price.try('successful?')\n parent = parent.carrier_product\n end\n return nil\n end", "def price\n return eval_shop_condition(@price_formula) unless @price_formula.empty?\n return item.price if @price_type == 0\n return @price\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price}\n end", "def total_price\n\t\tline_items.to_a.sum{|item| item.total_price}\n\tend", "def price_in(currency)\n get_price_in(currency) || prices.first || Spree::Price.new(:variant_id => self.id, :currency => currency)\n end", "def line_item(item)\n {\n Name: item.product.name,\n Number: item.variant.sku,\n Quantity: item.quantity,\n Amount: {\n currencyID: item.order.currency,\n value: item.price\n },\n ItemCategory: 'Physical'\n }\n end", "def line_two\n @line_two\n end", "def original_price\n @price || item.price\n end", "def process_line(line) \n array = line.split(\" \")\n price = array.last\n item = array[0..-3].join(\" \")\n @item_hash[item] = price\n self.calculate_tax(item, price)\n end", "def original_price\n read_attribute(:price)\n end", "def set_line\n @line = Line.find(params[:id])\n end", "def set_line\n @line = Line.find(params[:id])\n end", "def set_line\n @line = Line.find(params[:id])\n end", "def recalculate_totals\n # Line's total prices (qty * amount)\n single_untaxed_price_after_rebate = BigDecimal.new( (self.single_untaxed_price - self.single_rebate).to_s )\n self.gross_price = BigDecimal.new( (self.quantity * single_untaxed_price_after_rebate).to_s )\n self.gross_price = self.gross_price\n self.taxes = (self.gross_price / BigDecimal.new(\"100.0\")) * self.tax_percentage\n self.taxed_price = (BigDecimal.new( (self.gross_price + self.taxes).to_s )).rounded # Rounded like in document_line.rb\n\n # Line's single prices (for qty 1 * amount)\n single_taxes = ((single_untaxed_price_after_rebate / BigDecimal.new(\"100.0\")) * self.tax_percentage) # like in product.rb\n self.single_price = (single_untaxed_price_after_rebate + single_taxes).rounded # Like in document_line.rb\n\n end", "def find_vehicle_by_price(vehicle_type, price)\n vehicle = @list_vehicles[vehicle_type] ||= @list_vehicles[SMALLEST_VEHICLE]\n while( price > vehicle.price_limit)\n vehicle = @list_vehicles[vehicle.next_vehicle]\n end\n return vehicle\n end", "def parse_line(line)\n price = 0\n symbol = '---'\n line.children.each do |element|\n if element['class'].include? '__price'\n price = element.text\n elsif element['class'].include? '__symbol'\n symbol = element.text\n end\n end\n result = Hash.new\n result[symbol] = parse_price(price)\n return result\nend", "def set_pln_invoice\n @pln_invoice = PlnInvoice.find(params[:id])\n @pln_invoice_items = @pln_invoice.pln_invoice_items\n @prices = @pln_invoice_items.where.not(price_netto: nil).first\n end", "def parse_line(line)\n line_array = line.split\n if line_array.length < 2\n nil\n elsif line_array[0] == 'Driver'\n driver = Driver.new(line_array[1])\n @drivers[driver.driver_hash[:name]] = driver\n elsif line_array[0] == 'Trip'\n driver = @drivers[line_array[1]]\n begin\n driver.add_trip(Trip.new(line_array))\n rescue => e\n p e\n end\n end\n end", "def price\n on_sale? ? sale_price : original_price\n end", "def get_price\n item_prc_1\n end", "def set_line\r\n @line = Line.find_by_id(params[:id])\r\n end", "def import_line(line)\n line_array = line.split(\"\\t\") #? name\n\n # destructuring\n @name, @cuisine, @price = line_array\n\n return self # returns the OBJECT\n end", "def my_airline\n airlines.first\n end", "def set_price\n self.product = Product.find(orderable_id)\n self.unit_price = product.price\n end", "def set_line_liver\n @line_liver = LineLiver.find(params[:id])\n end", "def set_line\n @cart = Cart.find(params[:cart_id])\n @cart_line = @cart.cart_lines.find_by_id(params[:id])\n end", "def line_items_for_compute(order, options={})\n if calculable.is_a?(Spree::Promotion)\n line_items = if calculable.product\n order.line_items.joins(:variant).where(:variants => {product_id: calculable.product})\n elsif calculable.store\n order.line_items.where(:store_id => calculable.store)\n else\n order.line_items\n end\n \n if self.is_a?(Spree::Calculator::FreeShipping)\n puts \"free shipping\"\n line_items\n else\n puts \"not free shipping\"\n line_items.order('spree_line_items.price DESC').not_on_sale\n end\n else\n puts \"all line items\"\n order.line_items\n end\n end", "def flat_rate_by_base_rate(line_items)\n price = self.base_price\n per_item = self.cost_per_item\n line_items.each do |line_item|\n price += per_item * line_item.quantity\n end\n price -= per_item # compensate for first item\n end", "def line(&block)\n attributes[:lines] << Line.build(&block)\n end", "def new\n @product = Product.find(params[:product_id])\n @line_item = LineItem.new(:product_id => @product.id)\n end", "def update\n @line_item = LineItem.find(params[:id])\n @line_item.price = @line_item.catalog_item.unit_price\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n flash[:notice] = 'LineItem was successfully updated.'\n format.html { redirect_to(@line_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def calculate_price(start_time, end_time)\n days = days_between(start_time, end_time)\n\n if days == 0\n hourlyrates(start_time, end_time)\n else\n daily_charge = (days - 1) * @parking_space[:price][:daily]\n\n start_day_hours = 24 - Time.parse(start_time).hour\n start_day_charge = cost_for_hours(start_day_hours)\n\n end_day_hours = Time.parse(end_time).hour\n if Time.parse(end_time).min > 0\n end_day_hours += 1\n end\n end_day_charge = cost_for_hours(end_day_hours)\n\n daily_charge + start_day_charge + end_day_charge\n end\nend", "def polyline(x, y, linewidth = nil, line_z = nil)\n # GR.jl - Multiple dispatch\n n = equal_length(x, y)\n if linewidth.nil? && line_z.nil?\n super(n, x, y)\n else\n linewidth ||= GR.inqlinewidth\n linewidth = if linewidth.is_a?(Numeric)\n Array.new(n, linewidth * 100)\n else\n raise ArgumentError if n != linewidth.length\n\n linewidth.map { |i| (100 * i).round }\n end\n line_z ||= GR.inqcolor(989) # FIXME\n color = if line_z.is_a?(Numeric)\n Array.new(n, line_z)\n else\n raise ArgumentError if n != line_z.length\n\n to_rgb_color(line_z)\n end\n z = linewidth.to_a.zip(color).flatten # to_a : NArray\n gdp(x, y, GDP_DRAW_LINES, z)\n end\n end", "def set_line_detail\n @line_detail = LineDetail.find(params[:id])\n end", "def price\n total_price = price_method(\"Principal\")\n individual_price = (total_price / quantity).to_f\n end", "def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end", "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "def my_price\n envisage_to_my_price\n end", "def calculate_custom_price\n return nil if @selected_rule.nil? || @product.nil?\n\n public_send(@selected_rule[:pricing_method])\n end", "def price\n return 0 unless self.persisted?\n\n return product.master.price if with_master_price?\n\n default_price.price\n end", "def price\n \n end", "def copy_price(options={})\n if object = options[:dependent]\n result = self.price(options[:currency_code])\n dependent_price = object.price if object.respond_to?(:price)\n if self.price_percentage(options[:currency_code]) && self.price_percentage(options[:currency_code]).to_f > 0.0\n result += dependent_price * (self.price_percentage(options[:currency_code]) / 100)\n end\n result\n else\n self.price(options[:currency_code])\n end\n end", "def price\n self.default_variant ? self.default_variant.price : read_attribute(:price)\n end", "def prices\n Excursion.all.each do |excursion|\n excursion.price \n end\n end", "def price_curve\n load_curve('price.csv')\n end", "def set_flight_price\n @flight_price = FlightPrice.find(params[:id])\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end", "def set_area_price\n @area_price = AreaPrice.find(params[:id])\n end", "def set_line_item\n @line_item = LineItem.find(params[:id])\nend", "def line_params\n params.require(:line).permit(:buyer, :description, :unit_price, :quantity, :total, :address, :supplier, :attchment_id)\n params[\"line\"][\"total\"] = (params[\"line\"][\"unit_price\"].to_f * params[\"line\"][\"quantity\"].to_f).to_s\n params.require(:line).permit(:buyer, :description, :unit_price, :quantity, :total, :address, :supplier, :attchment_id)\n end", "def set_line_item\n @line_item = order.line_items.find(params[:id])\n end", "def currency(recalculate=false)\n (!recalculate && super()) || line_items.first.try(:currency)\n end", "def price # getter for rent in cents\n\t\tread_attribute(:price_in_cents)\n\tend", "def sell(*arguments)\n sellables = []\n options = default_sell_options\n\n # distinguish between options and attributes\n arguments = arguments.flatten\n arguments.each do |argument|\n case argument.class.name\n when 'Hash'\n options.merge! argument\n else\n sellables << argument\n end\n end\n \n raise ArgumentError.new(\"No sellable (e.g. product) model provided\") if sellables.empty?\n raise ArgumentError.new(\"Sellable models must have a :price\") unless sellables.all? {|sellable| sellable.respond_to? :price}\n \n returning self.sales_orders.build do |so|\n so.buyer = options[:buyer]\n so.build_addresses\n \n sellables.each do |sellable|\n if sellable && sellable.respond_to?(:before_add_to_order)\n sellable.send(:before_add_to_order, self)\n sellable.reload unless sellable.new_record?\n end\n li = LineItem.new(:sellable => sellable, :order => so)\n so.line_items.push(li)\n sellable.send(:after_add_to_order, self) if sellable && sellable.respond_to?(:after_add_to_order)\n end\n \n end\n end", "def calculate_price\n self.price = product.price\n self.total_price = price * quantity \n end", "def set_price\n @price = Price.find(params[:id])\n end", "def price\n return base_price - quantity_discount + shipping\nend", "def set_price\n @price = Price.find(params[:id])\n end" ]
[ "0.74227226", "0.6234293", "0.61065114", "0.57543975", "0.5747408", "0.564146", "0.55553097", "0.5442238", "0.5440147", "0.5414473", "0.53995353", "0.5394653", "0.5384877", "0.5384117", "0.53760713", "0.5341847", "0.5270257", "0.5268172", "0.52602315", "0.5257885", "0.52337", "0.519647", "0.519647", "0.519279", "0.5191864", "0.51833475", "0.51683825", "0.5166606", "0.5165073", "0.51572686", "0.51572686", "0.51572686", "0.51572686", "0.51512575", "0.51421034", "0.5139594", "0.51297706", "0.5129714", "0.51207364", "0.5109724", "0.5105272", "0.50937694", "0.50855404", "0.5085002", "0.5083386", "0.5072064", "0.50608146", "0.504393", "0.50365394", "0.503341", "0.5032747", "0.5031287", "0.50290376", "0.50290376", "0.50290376", "0.5027779", "0.50236267", "0.50173515", "0.5017254", "0.50148773", "0.5012129", "0.5002229", "0.49997768", "0.4999765", "0.4998386", "0.49975848", "0.4991929", "0.49809906", "0.4977616", "0.49725065", "0.4965654", "0.49641278", "0.49608332", "0.49576187", "0.49572957", "0.4952217", "0.49487418", "0.49469596", "0.49405926", "0.4936025", "0.49340975", "0.49337193", "0.4928329", "0.49242055", "0.49143556", "0.49069712", "0.4905115", "0.48978877", "0.4895128", "0.48924989", "0.48896542", "0.48870322", "0.48869377", "0.48861513", "0.48843175", "0.48795128", "0.48778155", "0.48755187", "0.48707724", "0.486669" ]
0.80381364
0
This method relate Course::Price instance to Course::Route::Line instance. It's judged based on to Pricefrom_line_index and Pricefrom_line_index. result: Course::Priceline_list
def relate_price_to_line @price_list.each do |price| next unless price.respond_to?(:from_line_index) price_range = (price.from_line_index.to_i..price.to_line_index.to_i) price.line_list = @route_list[0].line_list.select { |line| price_range.include?(line.index.to_i) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relate_line_to_price\n @route_list[0].line_list.each do |line|\n line.fare = find_price(line, :fare)\n line.charge = find_price(line, :charge)\n line.teiki1 = find_price(line, :teiki1)\n line.teiki3 = find_price(line, :teiki3)\n line.teiki6 = find_price(line, :teiki6)\n line.teiki12 = find_price(line, :teiki12)\n end\n end", "def price_from_line_item(line_item)\n line_item.variant.price_for(price_list)\n end", "def update_line_item_price!(line_item)\n price = price_from_line_item(line_item)\n\n if price\n line_item.update_attributes!(price_list_id: price.price_list_id, price: price.amount)\n else\n raise RuntimeError, \"no #{price_list.name} list price found for #{line_item.product.name} (#{line_item.variant.sku})\"\n end\n end", "def update_line_item_price_lists!\n line_items.where('price_list_id != ?', price_list_id).each do |line_item|\n update_line_item_price!(line_item)\n end\n end", "def to_order_line\n OrderLine.new(\n product_id: 0,\n product_sku: SKU,\n product_name: name,\n product_price: price_adjustment,\n vat_amount: tax_adjustment\n )\n end", "def cart_line_item(product, quantity = 1, line_options = {})\n raise \"No price column available for '#{product.class.name}'\" unless product.respond_to?(:price)\n # we need to set currency explicitly here for correct money conversion of the cart_line_item\n MerchantSidekick::ShoppingCart::LineItem.new do |line_item|\n line_item.options = self.options.merge(line_options)\n line_item.currency = self.currency\n line_item.quantity = quantity\n line_item.product = product\n line_item\n end\n end", "def relate_price_and_pass_status\n price_list.each do |price|\n next unless price.kind.match?(/^Teiki\\d{1}$/)\n\n pass_status = find_pass_status(price)\n # Price to PassStatus\n price.pass_status = pass_status\n # PassStatus to Price\n pass_status.price_list << price\n end\n end", "def to_order_line\n OrderLine.new(\n product_id: product.id,\n product_sku: sku,\n product_name: product.name,\n product_brand: product.brand,\n product_rrp: product.rrp,\n product_price: product_price_ex_vat,\n product_weight: product_weight,\n vat_amount: vat_amount,\n quantity: quantity,\n feature_descriptions: feature_descriptions\n )\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def get_product_prices(product)\n product_prices = []\n\n count = product[:product_prices][:total_elements].to_i\n\n (0..count - 1).each do|i|\n product_price = product[:product_prices][:productprices][i]\n\n product_prices << {\n productPrice: {\n attributes: {\n fromDate: product_price[:from_date],\n priceOverride: product_price[:price_override],\n type: product_price[:type],\n recurringPaymentRequired: product_price[:recurring_payment_required],\n eid: product_price[:eid]\n },\n priceRanges: {\n attributes: get_page_info(product_price[:price_ranges]),\n priceRanges: get_price_ranges(product_price)\n }\n }\n }\n end\n\n product_prices\n end", "def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def two_points_to_line(x1,y1,x2,y2)\n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def get_adjustment_line\n prd = Product.get_adjustment_product\n raise \"Missing adjustment product: please add using Maintain/Products function\" unless prd\n @lines.find {|li| li.li_prd_id == prd.prd_id }\n end", "def find_routes_for_from_and_to(from_city,to_city)\n\n # Finding all the line color routes where a souce city belongs\n line_route_ids = CityRoute.where(city_id: from_city).distinct.pluck(:line_color_route_id)\n \n @line_id = [] #For holding the line color route id after filtering\n \n line_route_ids.each do |a|\n\n if LineColorRoute.find_by(id: a).is_active\n\n # checking whether destination exits on that particular line route or not\n var_to = LineColorRoute.find(a).city_routes.where(city_id: to_city)\n if var_to.present? \n var_from = LineColorRoute.find(a).city_routes.where(city_id: from_city)\n\n\n #checking the allowed direction of travel and saving the valid result in @line_id\n if (var_to.last.id - var_from.first.id) > 0\n # p \"------There is a route(#{LineColorRoute.find(a).name})--------------\"\n @line_id << a\n end \n else\n # p \"-------error----------\"\n end\n\n end\n\n end\n end", "def flow_line_item_price line_item, total=false\n result = unless flow_order\n Flow.format_default_price(line_item.price * (total ? line_item.quantity : 1))\n else\n id = line_item.variant.id.to_s\n\n lines = flow_order.lines || []\n item = lines.select{ |el| el['item_number'] == id }.first\n\n return Flow.price_not_found unless item\n\n total ? item['total']['label'] : item['price']['label']\n end\n\n # add line item promo\n # promo_total, adjustment_total\n result += ' (%s)' % Flow.format_default_price(line_item.promo_total) if line_item.promo_total > 0\n\n result\n end", "def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end", "def lines\n points.each_cons(2).map {|a,b| Line.new a, b}\n end", "def set_pln_invoice\n @pln_invoice = PlnInvoice.find(params[:id])\n @pln_invoice_items = @pln_invoice.pln_invoice_items\n @prices = @pln_invoice_items.where.not(price_netto: nil).first\n end", "def line_item_products\n self.line_items.map(&:sellable).map {|s| s.respond_to?(:product) ? s.product : s}.compact.reject {|p| !p.is_a?(Product)}\n end", "def line_items_price_calculations(line_items)\n total_price = 0.0\n line_items.each do |li|\n total_price += (li.quantity * li.price.to_f)\n end\n return total_price\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end", "def add_booking_line(item_id, quantity)\n\n # Check if the booking includes the item_id\n product_lines = self.booking_lines.select do |booking_line|\n booking_line.item_id == item_id\n end\n\n if product_lines.empty?\n if product = ::Yito::Model::Booking::BookingCategory.get(item_id)\n product_customer_translation = product.translate(customer_language)\n product_unit_cost = product_item_cost_base = product.unit_price(self.date_from, self.days, nil, self.sales_channel_code).round(0)\n product_deposit_cost = product.deposit\n ## Apply promotion code and offers\n rates_promotion_code = if !self.promotion_code.nil? and !self.promotion.code.empty?\n ::Yito::Model::Rates::PromotionCode.first(promotion_code: self.promotion_code)\n else\n nil\n end\n discount = ::Yito::Model::Booking::BookingCategory.discount(product_unit_cost, item_id, self.date_from, self.date_to, rates_promotion_code) || 0\n product_unit_cost = (product_unit_cost - discount).round(0) if discount > 0\n ## End apply offers\n ## Category supplements\n product_supplement_1_unit_cost = product.category_supplement_1_cost || 0\n product_supplement_2_unit_cost = product.category_supplement_2_cost || 0\n product_supplement_3_unit_cost = product.category_supplement_3_cost || 0 \n if sales_channel_code\n if bcsc = Yito::Model::Booking::BookingCategoriesSalesChannel.first(conditions: {'sales_channel.code': sales_channel_code, booking_category_code: product.code })\n product_supplement_1_unit_cost = bcsc.category_supplement_1_cost || 0\n product_supplement_2_unit_cost = bcsc.category_supplement_2_cost || 0\n product_supplement_3_unit_cost = bcsc.category_supplement_3_cost || 0\n end \n end \n ## End of category supplements\n\n transaction do\n # Create booking line\n booking_line = BookingDataSystem::BookingLine.new\n booking_line.booking = self\n booking_line.item_id = item_id\n booking_line.item_description = product.name\n booking_line.item_description_customer_translation = (product_customer_translation.nil? ? product.name : product_customer_translation.name)\n booking_line.item_unit_cost_base = product_item_cost_base\n booking_line.item_unit_cost = product_unit_cost\n booking_line.item_cost = product_unit_cost * quantity\n booking_line.quantity = quantity\n booking_line.product_deposit_unit_cost = product_deposit_cost\n booking_line.product_deposit_cost = product_deposit_cost * quantity\n booking_line.category_supplement_1_unit_cost = product_supplement_1_unit_cost\n booking_line.category_supplement_1_cost = product_supplement_1_unit_cost * quantity\n booking_line.category_supplement_2_unit_cost = product_supplement_2_unit_cost\n booking_line.category_supplement_2_cost = product_supplement_2_unit_cost * quantity\n booking_line.category_supplement_3_unit_cost = product_supplement_3_unit_cost\n booking_line.category_supplement_3_cost = product_supplement_3_unit_cost * quantity\n booking_line.save\n # Create booking line resources\n (1..quantity).each do |resource_number|\n booking_line_resource = BookingDataSystem::BookingLineResource.new\n booking_line_resource.booking_line = booking_line\n booking_line_resource.save\n end\n # Update booking cost\n self.item_cost += (product_unit_cost * quantity)\n self.product_deposit_cost += (product_deposit_cost * quantity)\n self.category_supplement_1_cost += (product_supplement_1_unit_cost * quantity)\n self.category_supplement_2_cost += (product_supplement_2_unit_cost * quantity)\n self.category_supplement_3_cost += (product_supplement_3_unit_cost * quantity) \n self.calculate_cost(false, false)\n self.save\n # Assign available stock\n if status == :pending_confirmation \n if created_by_manager \n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_backoffice_request').to_bool\n else\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation_on_web_request').to_bool\n end\n elsif status == :confirmed \n if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n assign_available_stock\n end\n end \n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'add_booking_line',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.created_booking_line(item_id, quantity),\n attributes_updated: {item_id: item_id, quantity: quantity}.merge({booking: newsfeed_summary}).to_json)\n end\n self.reload\n end\n end\n\n end", "def load_parcel(lines, start_index)\n plan_lot_start = false\n\n if is_plan_number_line?(line = lines[start_index])\n plan_number = line.strip\n\n line = lines[start_index += 1] #next line\n plan_lot_start = true\n end\n\n if is_parcel_lot_or_section_line?(line)\n lot_lines = line.strip\n while is_lot_number_continue?(lot_lines) do #check the next time is still lot line\n lot_lines += lines[start_index += 1].strip\n end\n\n line = lines[start_index += 1]\n plan_lot_start = true\n end\n\n # puts \"plan_number = #{plan_number} and lot_number = #{lot_lines}\"\n return start_index unless plan_lot_start\n\n add_parcel(lot_lines, plan_number)\n #linkage_lines\n while is_linkages_detail_line?(line) do\n add_linkage_to_parcels(line)\n line = lines[start_index += 1].strip\n end\n\n return start_index-1\nend", "def set_line_liver\n @line_liver = LineLiver.find(params[:id])\n end", "def set_line\n @cart = Cart.find(params[:cart_id])\n @cart_line = @cart.cart_lines.find_by_id(params[:id])\n end", "def calculate_points(lines)\n points = lines.map do |line|\n if line.p1.x == line.p2.x\n ys = Range.new(*[line.p1.y, line.p2.y].sort).to_a\n xs = [line.p1.x] * ys.size\n elsif line.p1.y == line.p2.y\n xs = Range.new(*[line.p1.x, line.p2.x].sort).to_a\n ys = [line.p1.y] * xs.size\n else\n # Diagonal line\n # Sort by x axis\n p1, p2 = [line.p1, line.p2].sort_by(&:x)\n xs = Range.new(*[p1.x, p2.x]).to_a\n if p1.y > p2.y \n # negative slope (reverse so we can still use range)\n ys = Range.new(*[p2.y, p1.y]).to_a.reverse\n else\n # positive slope\n ys = Range.new(*[p1.y, p2.y]).to_a\n end\n end\n xs.zip(ys).map { |c| Point.new(*c) }\n end\nend", "def lineitem\n if @lineitem.nil?\n @lineitem = {}\n lineitems.each { |li| @lineitem[li.lineitem_id] = li }\n @lineitem.freeze\n end\n return @lineitem\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def list_lines\n RailLine.list_lines\n end", "def cart_line_items(products)\n products.map {|p| self.cart_line_item(p)}\n end", "def divide_line_into_points(lat1, lon1, lat2, lon2, distance)\n # puts \"in line #{lat1}, #{lon1}, #{lat2}, #{lon2}, #{distance}\"\n points = []\n\n num_points = (RoadRollerHelper.get_line_length(lat1, lon1, lat2, lon2)/distance).to_i\n\n i = 1\n #puts \"#{RoadRollerHelper.get_line_length(lat1, lon1, lat2, lon2)} #{distance}\"\n while (i <= num_points)\n #puts \"#{i} #{num_points}\"\n lat, lon = get_new_point(lat1, lon1, lat2, lon2, distance*i)\n #puts \"lat, lon => #{lat} #{lon}\"\n points.push([lat, lon])\n i=i+1\n end\n puts \"num_points = #{num_points} #{points.length}\"\n return points\n end", "def polyline\n @polyline ||= Automatic::Client::Polyline.new(self.path)\n end", "def set_price\n @price = Price.find(params[:id])\n @prices = Price.order('position Asc')\n #@price.strain_id = Strain.find(params[:id]).id\n #@price.region_id = Region.find(params[:id]).id\n end", "def distance_from_line(point_a,point_b)\n \n # Define the line as the vector between two points\n line_vector = point_b - point_a\n\n # Define a second vector representing the distance between self and the line start\n point_vector = self - point_a\n\n # The magnitude of the cross product is equal to the area of the parallelogram described\n # by the two vectors. Dividing by the line length gives the perpendicular distance.\n (line_vector.cross(point_vector).magnitude / line_vector.magnitude).abs\n end", "def create\n @line_item = LineItem.new(params[:line_item])\n @line_item.price = @line_item.catalog_item.unit_price\n \n respond_to do |format|\n if @line_item.save\n \n flash[:notice] = 'LineItem was successfully created.'\n format.html { redirect_to(@line_item) }\n format.xml { render :xml => @line_item, :status => :created, :location => @line_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @line_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_line(point1, point2)\n end", "def parallel_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n Line.new(point, point + self.direction.to_point)\n end", "def line_items\n if line_items_downloaded?\n @line_items\n\n # There is an credit_note_is so we can assume this record was loaded from Xero.\n # attempt to download the line_item records.\n elsif credit_note_id =~ GUID_REGEX\n raise NoGatewayError unless @gateway\n\n response = @gateway.get_credit_note(credit_note_id)\n raise CreditNoteNotFoundError, \"CreditNote with ID #{credit_note_id} not found in Xero.\" unless response.success? && response.credit_note.is_a?(XeroGateway::CreditNote)\n\n @line_items = response.credit_note.line_items\n @line_items_downloaded = true\n\n @line_items\n\n # Otherwise, this is a new credit_note, so return the line_items reference.\n else\n @line_items\n end\n end", "def segment_to_line(x1, y1, x2, y2)\n raise 'Need two distinct points to define a segment' if x1 == x2 && y1 == y2\n\n # Vertical/horizontal/oblique lines\n if y1 == y2\n [0.0, 1.0, y1]\n elsif x1 == x2\n [1.0, 0.0, x1]\n else\n [y1 - y2, x2 - x1, x2 * y1 - x1 * y2]\n end\n end", "def set_line_detail\n @line_detail = LineDetail.find(params[:id])\n end", "def total_price\n self.line_items.each.sum {|li| li.total_price}\n end", "def polyline\n\t\tPolylines::Encoder.encode_points(self.polyline_points)\n\tend", "def create_or_update_history_price(row, index)\n category = Category.find_by(name: row[0])\n product = category.products.find_by(name: row[1])\n\n price = product.history_prices.find_or_initialize_by(record_date: row[4], service: @service)\n\n price.amount = row[2]\n price.seller_name = row[3]\n\n unless price.save\n price.errors.messages.each do |key, message|\n @errors << {\n line: index + 1,\n message: message.join(','),\n attribute: format('%<category_name>s-%<product_name>s(%<attribute_name>s)', category_name: row[0], product_name: row[1], attribute_name: Price.human_attribute_name(key))\n }\n end\n end\n\n nil\n end", "def polyline(x, y)\n n = equal_length(x, y)\n super(n, x, y)\n end", "def set_line_item_product\n @line_item_product = LineItemProduct.find(params[:id])\n end", "def get_price_ranges(product_price)\n price_ranges = []\n\n count = product_price[:price_ranges][:total_elements].to_i\n\n (0..count - 1).each do|i|\n price_range = product_price[:price_ranges][:priceranges][i]\n\n price_ranges << {\n priceRange: {\n quantityBeginRange: price_range[:quantity_begin_range],\n price: price_range[:price],\n level: price_range[:level],\n eid: price_range[:eid]\n }\n }\n end\n\n price_ranges\n end", "def product_price_list\n $tracer.trace(__method__)\n #unit_test_no_generate: product_price_list, section.with.className(\"product_buy\").find.tr; GameStopMobileProductDetailPriceList\n return GameStopMobileProductDetailPriceList.new(\n ToolTag.new(section.with.className(\"product_buy\").find.tr, __method__, self), self)\n end", "def polyline(x, y, linewidth = nil, line_z = nil)\n # GR.jl - Multiple dispatch\n n = equal_length(x, y)\n if linewidth.nil? && line_z.nil?\n super(n, x, y)\n else\n linewidth ||= GR.inqlinewidth\n linewidth = if linewidth.is_a?(Numeric)\n Array.new(n, linewidth * 100)\n else\n raise ArgumentError if n != linewidth.length\n\n linewidth.map { |i| (100 * i).round }\n end\n line_z ||= GR.inqcolor(989) # FIXME\n color = if line_z.is_a?(Numeric)\n Array.new(n, line_z)\n else\n raise ArgumentError if n != line_z.length\n\n to_rgb_color(line_z)\n end\n z = linewidth.to_a.zip(color).flatten # to_a : NArray\n gdp(x, y, GDP_DRAW_LINES, z)\n end\n end", "def divide_linestring_into_points(road, distance)\n points = road.points\n\n i = 0\n linestring_points = []\n while( i < points.length - 1)\n start_point = points[i]\n end_point = points[i+1]\n distance_degrees = RoadRollerHelper.meters_to_degrees(distance, start_point.y)\n #puts \"%%%% #{RoadRollerHelper.get_line_length(start_point.y, start_point.x, end_point.y, end_point.x)} + #{distance_degrees}\"\n linestring_points = linestring_points + divide_line_into_points(start_point.y, start_point.x, end_point.y, end_point.x, distance_degrees)\n i=i+1\n end\n\n puts \"linestring_points = #{linestring_points.length}\"\n return linestring_points\n end", "def link_line_item(line_item)\n self.spree_line_item_id = line_item.id\n self.save!\n end", "def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end", "def line(&block)\n attributes[:lines] << Line.build(&block)\n end", "def set_line\n @line = Line.find(params[:id])\n end", "def set_line\n @line = Line.find(params[:id])\n end", "def set_line\n @line = Line.find(params[:id])\n end", "def set_line_item\n @line_items = LineItem.find(params[:id])\n end", "def line!(x_coordinates, y_coordinates, line_width: :default,\n line_color: :default, line_type: :default,\n marker_size: :default, marker_color: :default,\n marker_type: :default)\n @active_subplot.x_range[0] = x_coordinates.min if @active_subplot.x_range[0].nil?\n @active_subplot.x_range[1] = x_coordinates.max if @active_subplot.x_range[1].nil?\n @active_subplot.x_range[0] = x_coordinates.min if x_coordinates.min < @active_subplot.x_range[0]\n @active_subplot.x_range[1] = x_coordinates.max if x_coordinates.max > @active_subplot.x_range[1]\n\n @active_subplot.y_range[0] = y_coordinates.min if @active_subplot.y_range[0].nil?\n @active_subplot.y_range[1] = y_coordinates.max if @active_subplot.y_range[1].nil?\n @active_subplot.y_range[0] = y_coordinates.min if y_coordinates.min < @active_subplot.y_range[0]\n @active_subplot.y_range[1] = y_coordinates.max if y_coordinates.max > @active_subplot.y_range[1]\n\n @active_subplot.tasks.push(Line.new(x_coordinates, y_coordinates,\n line_width: line_width, line_color: line_color,\n line_type: line_type, marker_size: marker_size,\n marker_color: marker_color,\n marker_type: marker_type))\n end", "def index #index defines line_items then query all the line items then pass it to it\n @line_items = LineItem.all\n end", "def split_order\n # Lineas de productos identificadas por taxonomias\n @taxonomias = Spree::Taxon.where(parent_id: [1])\n # Creamos el hash de array donde almacenaremos las lineas de productos por taxonomias.\n @productos_por_taxonomias = Hash.new\n # LLenamos el hash\n @taxonomias.each do |taxonomia|\n @productos_por_taxonomias[taxonomia.name] = []\n end\n @order.line_items.each do |item|\n item.variant.product.taxons.each do |taxon|\n if @productos_por_taxonomias[taxon.parent.name]\n @productos_por_taxonomias[taxon.parent.name].append(item)\n end\n end\n end\n end", "def _line_items(order)\n params.require(:orders).each do |variant_id, info|\n count = info.require(:count)\n price = info.require(:price)\n variant = Variant.find variant_id\n LineItem.create(variant_id: variant_id, order: order, quantity: count,\n price: price).ready_to_pay!\n end\n end", "def list_price\n support_product_number = type == 'hw' ? 'HA104A' : 'HA107A'\n year1 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 1, :option_number => option_number)\n year3 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 3, :option_number => option_number)\n year4 = PricingDbHpPrice.option_price(:product_number => support_product_number, :year => 4, :option_number => option_number)\n @list_price = [(year4 - year3)/BigDecimal(\"12.0\"), (year3 - year1)/BigDecimal(\"24.0\")].max\n end", "def get_polyline_across_edges(p_hash)\n # initialize with the given hash\n hcl = p_hash [\"hexagone_depart\"].split(';')\n hexagon = hn_from_hcl(hcl.first.to_i, hcl.last.to_i) \n directions = Service.uncompressed_directions(p_hash [\"liste_directions\"])\n # provide the beginning of the polyline\n polyline_points = \"#{x_center(hexagon)},#{y_center(hexagon)} \"\n # for each direction, find the new hexagon then provide the next set of coordinates\n directions.split(',').each do |direction|\n hexagon = adjacent(hexagon, direction.swapcase.intern) \n polyline_points << \"#{x_center(hexagon)},#{y_center(hexagon)} \"\n end\n # and return the string of coordinates\n return polyline_points.chop\n end", "def create_line_item_premium_per_person_charge_2 event_vendor, inventory_item\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => inventory_item.sku, :name => \"Premium Charge\", :quantity => 1,\n :unit_price_expense => inventory_item.premium_price,\n :tax_rate_expense => 0,\n :payable_party => inventory_item.vendor,\n :include_price_in_expense => true,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => inventory_item.sku, :name => \"Premium Charge\", :quantity => 1,\n :unit_price_revenue => calculate_sell_price_using_account_pricing_tier(inventory_item.premium_price),\n :billable_party => account,\n :include_price_in_revenue => true,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end", "def lines_to_tryton\n result = []\n\n order_items.each do |order_item|\n\n \tif tryton_product = ::ExternalIntegration::Data.first(source_system: 'mybooking',\n \t source_entity: 'product',\n \t\t source_id: \"#{order_item.item_id}-#{order_item.item_price_type}\",\n destination_system: 'tryton',\n destination_entity: 'product.template')\n result << {\n \"product\" => tryton_product.destination_id.to_i,\n \"description\" => \"#{order_item.item_description} (#{order_item.item_price_description})\",\n \"gross_unit_price_w_tax\" => {\n \"__class__\" => \"Decimal\",\n \"decimal\" => \"%.2f\" % order_item.item_unit_cost\n },\n \"quantity\" => order_item.quantity\n \t }\n end\n\n end\t\n return result\n end", "def create\n if current_user.current_order\n @order = current_user.current_order\n else\n last_order = Order.last\n order_no = \"\"\n if last_order\n order_no = last_order.order_no\n order_no = \"A#{\"#{(order_no[/\\d+/].to_i + 1)}\".rjust(5,'0')}\"\n else\n order_no = \"A#{\"1\".rjust(5,'0')}\"\n end\n\n @order = current_user.orders.build(order_no: order_no, date: Time.now, closed: false)\n end\n product = Product.where(id: order_line_params[:product_id]).first\n merged = order_line_params.merge({:unit_price => product.price, :total_price => product.price * order_line_params[:qty].to_i})\n @order.order_lines.build(merged)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to products_path, notice: 'Order line was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def get_line(x0,x1,y0,y1)\n \t\tpoints = []\n\t\tsteep = ((y1-y0).abs) > ((x1-x0).abs)\n\t\tif steep then\n\t\t\tx0,y0 = y0,x0\n\t\t\tx1,y1 = y1,x1\n\t\tend\n\t\tif x0 > x1\n\t\t\tx0,x1 = x1,x0\n\t\t\ty0,y1 = y1,y0\n\t\tend\n\t\tdeltax = x1-x0\n\t\tdeltay = (y1-y0).abs\n\t\terror = (deltax / 2).to_i\n\t\ty = y0\n\t\tystep = nil\n\t\tif y0 < y1 then\n\t\t\tystep = 1\n\t\telse\n\t\t\tystep = -1\n\t\tend\n\t\tfor x in x0..x1\n\t\t\tif steep then\n\t\t\t\tpoints << {:x => y, :y => x}\n\t\t\telse\n\t\t\t\tpoints << {:x => x, :y => y}\n\t\t\tend\n\t\t\terror -= deltay\n\t\t\tif error < 0 then\n\t\t\t\ty += ystep\n\t\t\t\terror += deltax\n\t\t\tend\n\t\tend\n\t\treturn points\n\tend", "def polyline points, options, &block\n \n # build a line\n line = Line.new options[:name]\n \n # build up a points float buffer\n pbuf = BufferUtils.createVector3Buffer(points.length / 2)\n puts \"arrived\"\n c = 0\n points.each do |v|\n pbuf.put v\n c += 1\n pbuf.put 0 if c % 2 == 0\n end\n \n # set the width\n if options.has_key? :line_width\n line.set_line_width(options[:line_width])\n end\n \n # set up the colors\n if options.has_key? :colors\n line.set_color_buffer(BufferUtils.create_float_buffer(options[:colors].to_java ColorRGBA))\n elsif options.has_key? :color\n line.set_default_color(options[:color])\n end\n \n #textures\n if options.has_key? :texture_points\n buffer = BufferUtils.createVector2Buffer options[:texture_points].length\n buffer.put options[:texture_points]\n line.set_texture_coords(TexCoords.new(buffer))\n end\n \n # index buffer\n ibuf = BufferUtils.createIntBuffer((0..(points.length / 2) - 1).to_a.to_java :int)\n \n # finish building the quad\n line.reconstruct(pbuf, nil, line.get_color_buffer, line.get_texture_coords[0])\n line.set_index_buffer ibuf\n \n # block invoke\n line.instance_eval(&block) if block\n \n line\n end", "def set_price\n course = Course.find(self.course_id)\n self.price = course.price\n end", "def line(canvas, p1, p2, color)\n canvas.line(\n clamp(p1[0].round, 0, canvas.width-1),\n clamp(p1[1].round, 0, canvas.height-1),\n clamp(p2[0].round, 0, canvas.width-1),\n clamp(p2[1].round, 0, canvas.height-1),\n color)\n end", "def price_rules \n # puts \"The start datetime: #{start_datetime}\"\n \n local_datetime = start_datetime.in_time_zone(\"Jakarta\") \n server_datetime = start_datetime\n # puts \"Jakarta_datetime: #{local_datetime} \"\n result_array = []\n current_calendar_id = self.calendar_id\n \n # how can we get the available price rules?\n # 1. get all \n \n # for each booked hour, get the associated price rule \n (1..number_of_hours).each do |x|\n datetime = local_datetime + (x-1).hours \n actual_booking_datetime = start_datetime + (x-1).hours \n server_booking_datetime = server_datetime + (x-1).hours\n \n book_hour_start = datetime.hour\n booking_creation_datetime = self.created_at \n \n \n current_calendar_id = self.calendar_id \n \n \n holiday_price_rule = PriceRule.where{\n # to ensure that we are using the old price at the time of creation\n (\n calendar_id.eq current_calendar_id\n ) & \n (\n is_holiday.eq true \n ) & \n (\n # is still active, and created before the booking creation \n (\n ( is_active.eq true) & \n (created_at.lte booking_creation_datetime)\n ) | \n # is not active, and created before the booking creation\n # and deactivated after the booking creation => \n # Hence, the rule is still in place\n (\n ( is_active.eq false) & \n ( created_at.lte booking_creation_datetime) & \n ( deactivated_at.gt booking_creation_datetime)\n )\n ) & \n\n # 0 - 23 \n (\n ( holiday_date.lte server_booking_datetime ) & \n ( finish_holiday_date.gt (server_booking_datetime + 1.hours - 1.seconds) )\n )\n }.order(\" id DESC\").first\n \n \n \n if not holiday_price_rule.nil?\n result_array << holiday_price_rule.id\n else\n \n price_rules = PriceRule.where{\n # to ensure that we are using the old price at the time of creation\n (\n calendar_id.eq current_calendar_id\n ) & \n\n\n (\n # is still active, and created before the booking creation \n (\n ( is_active.eq true) & \n (created_at.lte booking_creation_datetime)\n ) | \n # is not active, and created before the booking creation\n # and deactivated after the booking creation => \n # Hence, the rule is still in place\n (\n ( is_active.eq false) & \n ( created_at.lte booking_creation_datetime) & \n ( deactivated_at.gt booking_creation_datetime)\n )\n ) & \n\n # 0 - 23 \n (\n ( hour_start.lte datetime.hour ) & \n ( hour_end.gte datetime.hour )\n )\n }.order(\"id ASC, rule_case DESC\") # rule_case 2 == holiday, 1== specific, rule case 0= catch_all\n\n # puts \"Total price rule: #{price_rule.count}\"\n\n final_price_rule = []\n\n\n price_rules.each do |x|\n if x.is_sunday? and datetime.sunday?\n final_price_rule << x \n elsif x.is_monday? and datetime.monday?\n final_price_rule << x \n elsif x.is_tuesday? and datetime.tuesday?\n final_price_rule << x \n elsif x.is_wednesday? and datetime.wednesday?\n final_price_rule << x \n elsif x.is_thursday? and datetime.thursday?\n final_price_rule << x \n elsif x.is_friday? and datetime.friday?\n final_price_rule << x \n elsif x.is_saturday? and datetime.saturday? \n final_price_rule << x \n end\n end\n\n\n price_rule = final_price_rule.sort_by {|x| x.id }.last\n\n result_array << price_rule.id\n\n # corner case:\n # rule 1 : 1300-1300\n # rule 2 : 1300-1400 \n # booking time: 13.30 .. which rule will be selected? \n # we have the ordering by id, ASC\n # in this case: rule2 is created later.. rule2 will be selected. \n\n # corner case\n # rule1 : 2300-2300 \n # it means it will only affect the time from 2300-2400 \n\n\n \n end\n \n\n end\n \n return result_array\n end", "def line_item(item)\n {\n Name: item.product.name,\n Number: item.variant.sku,\n Quantity: item.quantity,\n Amount: {\n currencyID: item.order.currency,\n value: item.price\n },\n ItemCategory: 'Physical'\n }\n end", "def new\n @product = Product.find(params[:product_id])\n @line_item = LineItem.new(:product_id => @product.id)\n end", "def create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end", "def set_line_property\n @line_property = LineProperty.find(params[:id])\n end", "def create\n @order = current_user.orders.create! order_params\n params[:line_item].each do |li|\n menu_product = MenuProduct.find custom_line_item_params(li)['menu_product_id']\n # Slowly change it to menu_product.price...as that is the price that gets recorded\n new_params = custom_line_item_params(li).merge({price: menu_product.product.price})\n @order.line_items.create!(new_params)\n end\n\n\n # Refactor delivery_fee logic to a method\n if order_params[:category]=='lunch'\n @menu = Menu.current_lunch\n\n if @menu.menu_date == Date.today\n if Time.now < Menu.today.lunch_start_time\n delivery_fee = 5\n else\n delivery_fee = 15\n end\n else\n # It is after 3:30 and he is seeing next day menu..so only 5 rs delivery\n delivery_fee = 5\n end\n else\n delivery_fee = 10\n end\n @order.update_attributes(delivery_fee: delivery_fee)\n\n @order.start_process!\n render json: @order\n rescue Exception=>e\n HealthyLunchUtils.log_error e.message,e\n @order.destroy if @order\n render status: :error\n end", "def show\n @line_item_products = LineItemProduct.all\n end", "def line(x, y)\n [x.value, y.value]\n end", "def create\n @order = Order.new(:customer_id => order_params[:customer_id])\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.new(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def lines\n invoice_lines\n end", "def create_line_item_from_inventory_item inventory_item, qty, payable_party, billable_party, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Item\",\n :sku => inventory_item.sku, :name => inventory_item.name_vendor, :quantity => qty,\n :unit_price_expense => inventory_item.cogs,\n :tax_rate_expense => 0,\n :payable_party => payable_party,\n :include_price_in_expense => include_price_in_expense,\n :inventory_item => inventory_item, :notes => notes, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Item\",\n :sku => inventory_item.sku, :name => inventory_item.name_public, :quantity => qty,\n :unit_price_revenue => calculate_sell_price_from_inventory_item(inventory_item),\n :billable_party => billable_party,\n :include_price_in_revenue => include_price_in_revenue,\n :inventory_item => inventory_item, :notes => notes, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n\n [l1, l2]\n end", "def locate_restro_with_price\n @restro.each do |restaurant, menu|\n @restaurants.concat optimal_price_restaurant(menu, restaurant)\n end\n @restaurants.sort! do |x,y|\n x[:price] <=> y[:price]\n end\n end", "def set_line_item\n @line_item = order.line_items.find(params[:id])\n end", "def total_price\n line_items.map { |line_item| line_item.item.price * line_item.quantity }.sum\n end", "def lines\n @lines ||= build_lines\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price }\n end", "def get_pricing_rule_for_product(product_code)\n @rules.find { |r| r[:product_code] == product_code }\n end", "def parse _line, _next_lines\n raise NotImplementedError, self\n end", "def initialize_properties_with_values_from_owner(invoice_line)\n invoice_line.invoice = owner\n invoice_line\n end", "def total_price\n line_items.to_a.sum { |item| item.total_price}\n end", "def set_line\r\n @line = Line.find_by_id(params[:id])\r\n end", "def create\n @quantity = params[:quantity]\n @product = Product.new(product_params)\n @product.subsection_ids = params[:product][:subsection_ids]\n @lineitem = Lineitem.create(image:@product.image, title: @product.title, sku: @product.sku, catagory: @product.catagory, price: @product.price, description: @product.description, quantity: @quantity , inclvat: @product.price,subsection_id:@checkBoxs[@count], exvat_price: @product.exvat_price,umren: @product.umren,umrez: @product.umrez, buom:@product.buom, suom:@product.suom)\n\n save_route_back(@product)\n\n end", "def line_line_intersect(pt_intersect, new_list, seg, new_seg)\n\n new_list << LineSeg.new(seg.pt1, pt_intersect)\n new_list << LineSeg.new(pt_intersect, seg.pt2)\n\n return [LineSeg.new(new_seg.pt1, pt_intersect), LineSeg.new(pt_intersect, new_seg.pt2)]\n\n end", "def index\n @line_items = LineItem.all\n end", "def vline(x, y1, y2, c)\n x, y1, y2 = x.to_i, y1.to_i, y2.to_i\n\n unless self.bounds?(x, y1) && self.bounds?(x, y2)\n puts \"ERR: Coordinates out of bounds\"\n return\n end\n\n (y1..y2).each {|y| self[y, x] = c}\n end", "def index\n @line_items = LineItem.all\n end" ]
[ "0.79370177", "0.5991469", "0.57467395", "0.56801605", "0.55621946", "0.55380714", "0.548398", "0.54731184", "0.5422908", "0.53979284", "0.5368188", "0.5346791", "0.53339463", "0.5309887", "0.52949786", "0.52005816", "0.51959795", "0.5192406", "0.5192406", "0.5134198", "0.5126704", "0.5121328", "0.5116143", "0.5105043", "0.50838614", "0.50734097", "0.5071738", "0.50640285", "0.50477904", "0.50275064", "0.49988008", "0.49804923", "0.49786574", "0.4978614", "0.49595192", "0.4953242", "0.49426907", "0.4941638", "0.49275756", "0.49226075", "0.49217606", "0.49146226", "0.49092025", "0.49050647", "0.4885585", "0.4879976", "0.4879623", "0.4877174", "0.4871621", "0.4863212", "0.4862385", "0.48426616", "0.48409158", "0.48339137", "0.48220545", "0.48220545", "0.48220545", "0.4813222", "0.4808436", "0.48068357", "0.48021644", "0.48014766", "0.47984776", "0.479449", "0.47920117", "0.47885665", "0.47809446", "0.47759038", "0.4765999", "0.47658232", "0.47650036", "0.4764995", "0.47571108", "0.4755507", "0.4755447", "0.47546646", "0.47515514", "0.4751441", "0.47476918", "0.4747561", "0.47444665", "0.4739651", "0.47393522", "0.47391322", "0.47383764", "0.47271183", "0.4726875", "0.4726875", "0.4726875", "0.4726875", "0.47266734", "0.47260273", "0.47175923", "0.47146705", "0.47145283", "0.47132227", "0.4713203", "0.47108305", "0.4710367", "0.47086895" ]
0.8618166
0
This method relate Course::Price instance and Course::PassStatus instance. It's judged based on to Pricepass_class_index. result: Course::Pricepass_status
def relate_price_and_pass_status price_list.each do |price| next unless price.kind.match?(/^Teiki\d{1}$/) pass_status = find_pass_status(price) # Price to PassStatus price.pass_status = pass_status # PassStatus to Price pass_status.price_list << price end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @bar = Bar.find(params[:bar_id])\n @pass_set = PassSet.find(params[:id])\n\t @used_passes = @pass_set.passes.order(\"name DESC\").where('redeemed = ?', true).order('passes.reservation_time ASC').paginate(:page => params[:used_passes_page], :per_page => 5)\n\t @unused_passes = @pass_set.passes.order(\"name DESC\").where('redeemed = ?', false).order('passes.reservation_time ASC').paginate(:page => params[:unused_passes_page], :per_page => 5)\n\t if @pass_set.reservation_time_periods == true && @pass_set.selling_passes == false\n\t @available_times = @pass_set.time_periods.first\n\t @reservations_times = Array.new\n time_columns = @available_times.attributes.values\n # Remove fields that aren't times\n 3.times do\n time_columns.delete_at(time_columns.length-1)\n end\n time_columns.delete_at(0)\n\t for x in 0..TimePeriod::TIME_LIST.length-1\n\t if time_columns[x*2]\n\t @reservations_times.push(TimePeriod::TIME_LIST[x].first)\n\t end\n\t end\n\t end\n @purchase = Purchase.new\n logger.error \"#{@pass_set.inspect}\"\n if @pass_set.single_price_level == true\n @price = @pass_set.price\n elsif @pass_set.double_price_level == true\n if @pass_set.double_price_less_than <= @pass_set.unsold_passes\n @price = @pass_set.price\n else\n @price = @pass_set.double_price_value\n end\n elsif @pass_set.triple_price_level == true\n if @pass_set.double_price_less_than <= @pass_set.unsold_passes\n @price = @pass_set.price\n elsif @pass_set.triple_price_less_than <= @pass_set.unsold_passes\n @price = @pass_set.double_price_value\n else\n @price = @pass_set.triple_price_value\n end\n end\n if current_user.stripe_customer_token != nil\n @customer_card = Stripe::Customer.retrieve(current_user.stripe_customer_token)\n if @customer_card.active_card != nil\n @last_four = @customer_card.active_card.last4\n @end_month = @customer_card.active_card.exp_month\n @end_year = @customer_card.active_card.exp_year\n end\n end\n @full_bar_path = \"http://#{request.host}\" + (bar_path @pass_set.bar).to_s\n @open_graph = false\n if flash[:notice] == 'Purchase created'\n @open_graph = true\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pass_set }\n end\n end", "def set_price\n course = Course.find(self.course_id)\n self.price = course.price\n end", "def index\n # if(current_user.email.eql? \"[email protected]\")\n # @invoiced_trips = InvoicedTrip.all\n @search = TransactionSearch.new(params[:search])\n\n @activities = Activity.all\n\n @invoiced_trips = @search.scope_invoiced_trips_index(false)\n\n @total_loss = @invoiced_trips.sum(&:km) - @invoiced_trips.sum(&:km_evogps) \n @total_km_invoiced = @invoiced_trips.sum(&:km) \n @total_amount_invoiced = @invoiced_trips.sum(&:total_amount)\n\n @total_loss_percentage = 0\n if @invoiced_trips.sum(&:km_evogps) >0\n @total_loss_percentage = (@total_loss*100)/@invoiced_trips.sum(&:km_evogps)\n end\n\n@invoiced_trips.each_with_index do |invoiced_trip, j|\n\n @pricing = Pricing.find_by_sql([\"SELECT * FROM pricings where pricings.client_id = ? \n and pricings.DATETIME <= ? order by pricings.DATETIME desc\", invoiced_trip.client_id, invoiced_trip.StartDate ]) \n\n#invoiced_trip.price_per_km = @pricing[0].price_per_km \n#invoiced_trip.surcharge = @pricing[0].surcharge\n\nif @pricing[0] != nil and @pricing[0].price_per_km != nil\n invoiced_trip.update_attribute(:price_per_km, @pricing[0].price_per_km)\nend\n\nif @pricing[0] != nil and @pricing[0].surcharge != nil\n invoiced_trip.update_attribute(:surcharge, @pricing[0].surcharge)\nend\n\nend\n\n\n\n #@invoiced_trips = InvoicedTrip.find_by_sql(['SELECT * FROM invoiced_trips ORDER BY invoiced_trips.date DESC'])\n \n\n @invoices = Invoice.all\n @trucks = Truck.all\n @clients = Client.all\n @drivers = Driver.all\n respond_to do |format|\n format.html\n format.csv { send_data @invoiced_trips.to_csv, filename: \"invoiced_trips-#{Time.now.strftime('s%S/m%M/h%H/')+Date.today.strftime('d%d/m%m/y%Y')}.csv\" } \n format.xls #{ send_data @trucks.to_csv(col_sep: \"\\t\") }\n end\n # else\n # redirect_to root_path\n # end\n end", "def update\n\n if params[:type] == \"approve_parking\" # by staff\n parking_request = ParkingRequest.find_by_req_no(params[:id])\n the_lease = get_user_lease(parking_request.sid);\n\n # set up variables\n the_lot = nil\n the_fee = nil\n the_spot = nil\n\n if (parking_request.pref_nearby == true)\n\n #find nearby housing first\n\n building_no = the_lease.unit_no\n\n ParkingLot.all.each do |t|\n if t.nearby_housing == building_no\n the_lot = t.lot_no\n end\n break if !the_lot.nil?\n end\n\n if (parking_request.is_disabled) # disabled?\n ParkingSpot.where(:lot_no => the_lot, :occupant => nil).each do |t|\n if t.class_id == 4\n the_spot = t\n the_fee = ParkingClass.find_by_class_id(t.class_id).fee\n end\n break if !the_spot.nil?\n end\n\n else # not disabled!\n\n ParkingSpot.where(:lot_no => the_lot, :occupant => nil).each do |t|\n if t.class_id == parking_request.vehicle_type\n the_spot = t\n the_fee = ParkingClass.find_by_class_id(t.class_id).fee\n end\n break if !the_spot.nil?\n end\n\n end\n\n elsif is_guest? #only general parking is allowed\n\n ParkingSpot.where(:lot_no => 7, :occupant => nil).each do |t|\n if t.class_id == parking_request.vehicle_type\n the_spot = t\n the_fee = ParkingClass.find_by_class_id(t.class_id).fee\n end\n break if !the_spot.nil?\n end\n\n else # any parking is fine\n\n ParkingSpot.where(:occupant => nil).each do |p|\n if (parking_request.is_disabled && p.class_id == 4)\n the_spot = p\n the_fee = ParkingClass.find_by_class_id(p.class_id).fee\n elsif (parking_request.vehicle_type == p.class_id)\n the_spot = p\n the_fee = ParkingClass.find_by_class_id(p.class_id).fee\n end\n break if !the_spot.nil?\n end\n\n end\n\n if the_spot.nil?\n # error message! no parking spot available\n redirect_to parking_request\n return\n end\n # update to signed lease\n\n if SignedLease.update(the_lease.lease_no, :parking_spot => the_spot.spot_no, :parking_fee => the_fee)\n\n the_spot.occupant = parking_request.sid\n the_spot.save\n\n parking_request.app_status = 2\n parking_request.save\n\n redirect_to parking_requests_url\n return\n else\n # something is wrong!!!!\n end\n\n elsif (params[:type] == \"cancel_parking\") # cancel parking\n\n end\n\n #respond_to do |format|\n # if @signed_lease.update(signed_lease_params)\n # format.html { redirect_to @signed_lease, notice: 'Signed lease was successfully updated.' }\n # format.json { render :show, status: :ok, location: @signed_lease }\n # else\n # format.html { render :edit }\n # format.json { render json: @signed_lease.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def get_status\n if criteria_type == Constants::CRITERIA_TYPE_PASS_FAIL\n temp_status = status\n else\n temp_status = point.zero? ? Constants::CRITERIA_STATUS_FAILED : Constants::CRITERIA_STATUS_PASSED\n end\n temp_status\n end", "def course_payment\n\n session[:payment_completed]=nil\n @user = current_user\n @course = Course.find(params[:id]) \n @price_detail = CoursePricing.find_by_course_id(@course.id)\n if @price_detail==nil || @price_detail.price==0\n @price=0.0\n @discount=0.0\n @subtotal=0.0\n @tax = Course.tax_calculation(@course,@price)\n #enroll_student(@course, current_user)\n #path=\"/payments/confirm_course_payment?id=\"[email protected]_s\n #redirect_to path\n redirect_to :action=>\"confirm_course_payment\",:id=>@course.id\n else\n @price=@price_detail.price\n @tax = Course.tax_calculation(@course,@price)\n end\n end", "def current_status\n @user = User.find(params[:data])\n @competencies = Competency.order(\"id\")\n @other_subject_assesses = @user.other_subject_assesses.order(\"id\")\n\n @c_hash = calculate_ranking_of_competency(@user.id)[0]\n\n if @user.current_title.rank_id\n @current_title = Rank.find(@user.current_title.rank_id).title.name\n else\n @current_title = \"N/A\"\n end\n\n\n if @user.departments.length > 0 || current_user.is_bod || current_user.is_hr\n @scoring_scale = @user.departments.first.cds_template.scoring_scale\n else\n sign_out @user \n flash[:alert] = \"Your Account currently is not in any Department. Please contact your Admin to resolve.\"\n redirect_to new_user_session_path \n end\n \n @slot_assesses = @user.slot_assesses.order(\"id\")\n @passed_slots = @user.slot_assesses.where(status: \"Passed\")\n\n @hash = {}\n @competencies.each do |c|\n @hash[\"#{c.name}\"] = {}\n count = 0\n @passed_slots.each do |ps|\n if ps.competency_name.eql?(c.name)\n count += 1\n end\n end\n @hash[\"#{c.name}\"][\"count\"] = count\n count_slot = 0\n c.levels.each do |l|\n count_slot += l.slots.count\n end\n @hash[\"#{c.name}\"][\"count_slots\"] = count_slot\n end\n \n render :layout => false\n end", "def valify_cert_status\n return self unless idinfo_crawled # if the idinfo -cert was not crawld\n if cert\n blank_size = cert.attributes.keys.inject(0) do |sum, item|\n cert[item].present? ? sum : (sum + 1)\n end\n company_crawled_status = blank_size >= 3 ? :warning : :success #found some good or bad cert info\n else\n company_crawled_status = :important # can not found any cert\n end\n update_blank_attributes_from_cert\n update_attributes({idinfo_status: company_crawled_status})\n end", "def query_status(params, path_url = 'payments', class_type = 'PAY')\n super\n end", "def update_product_details\n\t\t\ttransferorderpricing = TransferOrderPricing.new\n\t\t\tcorporate = Corporate.find(self.corporate_id)\n\t\t\ttransferorderpricing = wholesale_price(self.product_list_id, corporate.state, corporate.commission_percent)\n\t\t\tself.update(stock_value: transferorderpricing.final_total)\n distributor_stock_ledger = DistributorStockLedger.find(self.id)\n\t\t\t #10001\tAdd Stock to Distributor\n\t\t\t #10002\tRemove Stock from Distributor\n\t if distributor_stock_ledger.product_list_id.present?\n\t #product list details from product master id\n\t product_list = ProductList.find(distributor_stock_ledger.product_list_id) #.joins(:product_variant).where(\"product_variants.activeid = 10000\")\n\t if product_list.present?\n\t #product list details from product master id\n\t #distributor_stock_ledger = DistributorStockLedger.find(self.id)\n\t distributor_stock_ledger.update(product_master_id: product_list.product_master_id,\n\t product_variant_id: product_list.product_variant_id,\n\t prod: product_list.extproductcode)\n\n\t\t\t\t\t\t\t message = update_product_stock_summary(distributor_stock_ledger.id)\n\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger details updated with stock nos #{message}\"\n\t end\n\n\t elsif distributor_stock_ledger.type_id == 10000 #mis additions\n\t message = add_corporate_mis_balance(distributor_stock_ledger.corporate_id, distributor_stock_ledger.stock_value.to_f)\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger #{message}\"\n\t # flash[:error] = \"Ledger details #{distributor_stock_ledger.type_id}\"\n\t\t\t \telsif distributor_stock_ledger.type_id == 10020 #mis removal\n\t\t\t\t message = \" \"\n\t message += remove_corporate_mis_balance(distributor_stock_ledger.corporate_id, distributor_stock_ledger.stock_value.to_f)\n\t\t\t\t\t\t\tself.flash_notice = \"Ledger #{message}\"\n\t end\n \t #end\n end", "def active_prices\n prices.where('active = 1')\n end", "def price(type)\n if type ==1\n cost = @product.price * @quantity\n elsif type == 2\n cost = @product.special_price * @quantity\n elsif type == 3\n cost = @product.member_price * @quantity\n end\n @product.cost = cost\n @product.save\n cost\n end", "def delete \n @product_licence_detail = ProductLicenceDetail.find_by_product_licence_id(params[:id], :conditions => {:status => 1})\n @product_licence = ProductLicence.find(params[:id])\n @product_licence.update_attributes(:disabled_at => Time.zone.now, :status => 0) unless @product_licence.nil?\n @product_licence_detail.update_attributes(:disabled_at => Time.zone.now, :status => 0) unless @product_licence_detail.nil?\n @subproduct_licence = SubproductAssignment.find_all_by_product_licence_id(params[:id])\n @subproduct_licence.each do |sub|\n sub.update_attributes(:status => 0)\n end\n respond_to do |format|\n format.html { redirect_to(new_product_licence_path) }\n format.xml { head :ok }\n end\n end", "def pass_student(student, test_name)\n\n # if BoatingTest.all.select {|bt|bt.test_name == test_name} && BoatingTest.all.select {|bt|bt.student == student}\n # status = \"passed\"\n # else\n # BoatingTest.new(student, test_name, status = \"passed\", instructor = nil)\n # end\n\n arr = BoatingTest.all.select {|bt|bt.student == student}\n\n matched = arr.find {|bt| bt.test_name == test_name}\n\n if matched\n matched.status = 'passed'\n else\n BoatingTest.new(student,test_name,'passed',self) \n end \n\n def fail_student(student, test_name)\n\n # if BoatingTest.all.select {|bt|bt.test_name == test_name} && BoatingTest.all.select {|bt|bt.student == student}\n # status = \"passed\"\n # else\n # BoatingTest.new(student, test_name, status = \"passed\", instructor = nil)\n # end\n \n arr = BoatingTest.all.select {|bt|bt.student == student}\n \n matched = arr.find {|bt| bt.test_name == test_name}\n \n if matched\n matched.status = 'failed'\n else\n BoatingTest.new(student,test_name,'failed',self) \n end\n end\n\n\n\nend", "def active_for_sale_price product, sale_price\n product.current_sale_in(Spree::Config[:currency]) == sale_price\n end", "def pay_status_paypal\n\n end", "def categories_payment_enabled(from, to)\n\n if SystemConfiguration::Variable.get_value('booking.payment', 'false').to_bool\n ::Yito::Model::Booking::BookingCategory.all.map { |item| item.code }\n else\n\n payment_enabled = ::Yito::Model::Calendar::EventType.first(:name => 'payment_enabled')\n\n condition = Conditions::JoinComparison.new('$and',\n [Conditions::Comparison.new('event_type', '$eq', payment_enabled),\n Conditions::Comparison.new('from', '$lte', from),\n Conditions::Comparison.new('to', '$gte', to)])\n\n cat_payment_available = Set.new(condition.build_datamapper(Yito::Model::Calendar::Event).all.map {|item| item.calendar.name}).to_a\n\n end\n\n end", "def check_price\n end", "def status_pass!()\n @status = TAC_PLUS_AUTHEN_STATUS_PASS\n end", "def pay\n\t\t\tcheck = session[:ticket]\n\t\t\tif session[:pay] == \"card\"#card\n\t\t\t\ttotal = ticket.total + session[:gratuity]\n\t\t\t\t\n\t\t\telse #cash\n\t\t\t\t\n\n\t\t\tend\n\t\t\tif ticket.total - total == 0\n\t\t\t\tcheck.tstatus = 9\n\t\t\tend\n\t\tend", "def relate_line_to_price\n @route_list[0].line_list.each do |line|\n line.fare = find_price(line, :fare)\n line.charge = find_price(line, :charge)\n line.teiki1 = find_price(line, :teiki1)\n line.teiki3 = find_price(line, :teiki3)\n line.teiki6 = find_price(line, :teiki6)\n line.teiki12 = find_price(line, :teiki12)\n end\n end", "def create\n @course_booking = CourseBooking.new(course_booking_params)\n if @course_booking.user.nil?\n @course_booking.user = current_user\n end\n @course_intake = @course_booking.course_intake\n @course_booking.price = @course_intake.price.to_d\n respond_to do |format|\n if @course_booking.save\n current_user.add_role :student\n if @course_booking.price > 0 and @course_booking.price < 1000.0\n format.html { redirect_to payments_path(booking: @course_booking.guid), notice: 'Your course booking was successfully created.' }\n elsif @course_booking.price >= 1000.0\n format.html { redirect_to choose_payments_path(booking: @course_booking.guid)}\n else\n BookingMailerJob.new.async.perform(@course_booking.id)\n format.html { redirect_to thanks_path(booking: @course_booking.id), notice: 'Your course booking was successfully created.' }\n end\n else\n format.html { render :new }\n format.json { render json: @course_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def hash\n [class_id, object_type, active_admin, days_left, end_time, enforce_mode, error_desc, evaluation_period, extra_evaluation, license_count, license_state, license_type, start_time, trial_admin, account_license_data].hash\n end", "def user_return_status\n rtb = @rtb = ResourceTransportationBooking.find(params[:id])\n user = User.find(rtb.requester_id)\n if (user.is_super_admin? || user.roles.first.name == \"Resource Manager\")\n rtb.update_attributes(:resource_returned_from_user=>true,:status=>\"Returned\")\n agency_store = AgencyStore.find(rtb.agency_store_id)\n agency_store.update_attribute(:booked,false)\n disable_the_sub_category_when_that_sub_category_is_fully_reserved(agency_store.sub_category_id)\n else\n rtb.update_attribute(:resource_returned_from_user,true)\n end\n render :layout => false\n end", "def confirm_course_payment\n\n\n tx_id = 123456789 # default tax_id we need to changes after latter\n @course = Course.find(params[:id])\n\n @price_detail = CoursePricing.find_by_course_id(@course.id)\n if @price_detail!=nil\n @price =@price_detail.price\n else\n @price=0.0\n end\n @discount=session[:coupon_price].to_f\n @subtotal=@price - @discount\n @tax = Course.tax_calculation(@course,@subtotal)\n @user = current_user\n if session[:payment_completed] ==nil\n if params[:coupon_code].present?\n @coupon = Coupon.find_coupon(params[:coupon_code], user_id = current_user.id, [email protected])\n Coupon.redeem(params[:coupon_code], @user.id, tx_id, @coupon.metadata)\n end\n\n enroll_student(@course, current_user)\n invoice = invoices_data(@course, params)\n invoice_generate_pdf(@course, params)\t\t\t\n session[:payment_completed]=true\n end\n end", "def change_status\n\t\tauthorize ShopProfile\n \t\t@shop = ShopProfile.find(params[:shop_profile_id])\n \t \n \t #Calling method approve_shop from Model\n \t ShopProfile.approve_shop(@shop, flash)\n \t redirect_to request.referrer || root_path\n \tend", "def create\n @spot = Spot.find(params[:spot_id])\n @booking = Booking.new(booking_params)\n @booking.spot = @spot\n @booking.user = current_user\n @booking.status = \"Pending confirmation\"\n if @booking.time_arrive && @booking.time_leave\n @booking.price = (@booking.time_leave - @booking.time_arrive).to_f * @booking.spot.price.to_f\n else @booking.value = 0\n end\n if @booking.save\n flash[:notice] = \"Thank your for booking. It has been forwarded to the owner\"\n\n redirect_to spot_path(@spot)\n else\n flash[:alert] = @booking.errors.full_messages\n\n redirect_to spot_path(@spot)\n\n end\n end", "def fetch_price_points\n\n return error_with_go_to(\n 'tm_b_4',\n 'aux_chain_id_not_found',\n GlobalConstant::GoTo.token_setup\n ) unless @token[:aux_chain_id].present?\n aux_chain_id = @token[:aux_chain_id]\n\n price_points = KitSaasSharedCacheManagement::OstPricePoints.new([aux_chain_id]).fetch\n @api_response_data[:price_points] = price_points[aux_chain_id]\n success\n\n end", "def switchAvailability\n #Flips the availability\n @bike = Bike.find(params[:id])\n #flash[:newAvailability] = @bike.availability\n @newAvailability = [email protected]\n \n #Stores hash for updating/creating new ticket upon check in/out\n attributes = Hash.new\n\n if @bike.availability #Checks bike out\n #Creates new ticket from the given data\n #attributes[:ticket] = 'TN123'\n attributes[:renterID] = current_user.renterID\n attributes[:renterName] = session[:renter_name]\n attributes[:email] = current_user.email\n attributes[:bikeid] = @bike.bikeid\n #attributes[:cCN] = current_user.cCN\n attributes[:serialnumber] = @bike.serialnumber\n attributes[:checkout] = DateTime.now\n #attributes[:checkin] = null\n attributes[:location] = @bike.location\n attributes[:fare] = @bike.fare\n attributes[:active] = true\n @ticket = Ticket.new(attributes)\n @ticket.save!\n \n #Updates availability and pushes flash message\n flash[:success] = \"Bike sucessfully checked out!\"\n @bike.update_attribute(:availability, @newAvailability)\n \n redirect_to :controller => 'tickets', :action => 'show', :id => @ticket.id\n else #Checkin bike\n #Checkin the bike and updates ticket to complete\n # session[:checkin] = DateTime.now\n # session[:active] = false\n @ticket = Ticket.find_by(renterID: current_user.renterID, bikeid: @bike.bikeid, active: true)\n if @ticket\n #Updates ticket values if found\n session[:amount] = @ticket.totalFare\n session[:bikeid] = @bike.bikeid\n # @ticket.update(attributes)\n # flash[:success] = \"Bike successfully checked in!\"\n # @bike.update_attribute(:availability, @newAvailability)\n redirect_to :controller => 'payments', :action => 'new'\n else\n #Returns warning if you are trying to check in a bike you did not check out\n flash[:warning] = \"You did not check out this bike!\"\n if @ticket\n redirect_to :controller => 'tickets', :action => 'show', :id => @ticket.id\n else\n redirect_to bikes_path\n end\n end\n \n \n end\n\n end", "def lcr_provider_change_status\n prov_id = params[:prov]\n\n if @lcr.sms_provider_active(prov_id)\n value = 0\n flash[:status] = _('Provider_disabled')\n else\n value = 1\n flash[:status] = _('Provider_enabled')\n end\n\n sql = \"UPDATE sms_lcrproviders SET active = #{value} WHERE sms_lcr_id = #{@lcr.id} AND sms_provider_id = #{prov_id}\"\n res = ActiveRecord::Base.connection.update(sql)\n\n redirect_to :action => 'lcr_providers', :id => @lcr.id\n end", "def recalculate_price!\n self.total_price = service_type_reservations.where(paid: false).inject(0.0){|sum, service_type_reservation| sum += service_type_reservation.price }\n save!\n end", "def bus_booking\n # checking whether user is logged in or not\n if current_user\n \n if (pass_booking = PassBooking.where(\"user_id = ? AND default_pass =?\", params[:bus][:user_id], true))\n if pass_booking.present?\n pass_catg = pass_booking.first.category\n\n if pass_catg == \"Open\"\n # p \"---------Open Pass is selected#{pass_booking.first.route}---------\"\n route_exist = false\n MainRoute.find_by('lower(name) = ? ', pass_booking.first.route.downcase).line_color_routes.pluck(:name).each do |r|\n\n if r == params[:bus][:route]\n route_exist = true\n end\n end\n \n if route_exist\n bus_booking_create(pass_booking)\n else\n redirect_to :back\n flash[:warning] = \"Please select a pass for this route.\"\n end\n\n\n elsif pass_catg == \"Closed\"\n \n if pass_booking.first.route == params[:bus][:route]\n bus_booking_create(pass_booking) \n else\n redirect_to :back\n flash[:warning] = \"Please select a pass for this route.\"\n end \n end\n\n else\n redirect_to :back\n flash[:warning] = \"Please select a pass for this route.Buy a Pass\"\n end\n\n else\n redirect_to :back\n flash[:warning] = \"Please select a pass for this route.\"\n end\n\n else\n redirect_to :back\n flash[:warning] = \"Please login first to book buses\"\n end\n\n end", "def price_is_right(bids, actual_retail_price)\n \nend", "def relate_price_to_line\n @price_list.each do |price|\n next unless price.respond_to?(:from_line_index)\n\n price_range = (price.from_line_index.to_i..price.to_line_index.to_i)\n price.line_list = @route_list[0].line_list.select { |line| price_range.include?(line.index.to_i) }\n end\n end", "def create\n @pass_set = PassSet.new(params[:pass_set])\n @time_period = TimePeriod.new(params[:time_period])\n @pass_set.reservation_time_periods = false\n @pass_set.selling_passes = true\n if @pass_set.reservation_time_periods == true && @pass_set.selling_passes == false\n @pass_set.total_released_passes = 0\n @available_times = @pass_set.time_periods.first\n time_columns = @available_times.attributes.values\n # Remove fields that aren't times\n 3.times do\n time_columns.delete_at(time_columns.length-1)\n end\n time_columns.delete_at(0)\n logger.error \"#{time_columns}\"\n\t for x in 0..time_columns.length-1\n\t if x%2 == 1\n\t if time_columns[x] != nil\n\t @pass_set.total_released_passes += time_columns[x]\n\t end\n\t end\n\t end\n\t @pass_set.sold_passes = 0\n \t @pass_set.unsold_passes = @pass_set.total_released_passes\n\t else\n\t @pass_set.sold_passes = 0\n \t @pass_set.unsold_passes = @pass_set.total_released_passes\n\t end\n @bar = Bar.find(params[:bar_id])\n @pass_set.bar = @bar\n @time_period.pass_set = @pass_set\n\t @existing_set = @bar.pass_sets.where(\"date = ?\", @pass_set.date).first\n respond_to do |format|\n\t\tif @pass_set.date < Date.today\n\t\tflash[:notice] = 'Error: You are trying to create a pass for a date that has already passed!'\n format.html { render action: \"new\" }\n format.json { render json: @pass_set.errors, status: :unprocessable_entity }\n\telsif @existing_set\n\t\t\t\tflash[:notice] = 'Error: Please use edit to change existing passes'\n\t\t\t\tformat.html { redirect_to edit_user_bar_pass_set_path(@bar.user, @bar, @existing_set) }\n\t\t\t\tformat.json { render json: @pass_set.errors, status: :unprocessable_entity }\n elsif @pass_set.save\n format.html { redirect_to [@bar.user, @bar], notice: 'Pass set was successfully created.' }\n format.json { render json: @pass_set, status: :created, location: @pass_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pass_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def status\n @parcel.status\nend", "def current_price; self['CurrentPrice'].to_i; end", "def active_course\n course_id = params[:course_id]\n user_id = params[:user_id]\n user = User.find(user_id)\n\n owned_course = user.courses.where(course_id: course_id).first\n owned_course.payment_status = Constants::PaymentStatus::SUCCESS\n\n if user.save\n render json: {message: \"Thành công!\"}\n return\n else\n render json: {message: \"Thất bại!\"}\n return\n end\n end", "def course_booking_params\n params.require(:course_booking).permit(:gst, :course_intake_id, :user_id, :price, :promo_code, :paid, :completed)\n end", "def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end", "def index\n @crypto = Holding.where(\"holding_type = 'CRYPTO'\")\n end", "def calculate_commissions\n # We take 30% of the final price\n commission = (self.price * 0.3).round\n\n # We split this commission into fees\n # Half goes to the insurance\n self.insurance_fee = (commission * 0.5).round\n # 1€/day goes to the roadside assistance.\n self.assistance_fee = self.duration * 100\n # The rest goes to us\n self.drivy_fee = commission - self.insurance_fee - self.assistance_fee\n end", "def activate!\n self.update_attributes(status: ACTIVE)\n #self.line_items.update_attributes(status: LineItem::SOLD)\n end", "def royalty_pay_to_company\n @royalty_details = CompanyRoyaltyDetail.where(royalty_type: true)\n @installment_details = InstallmentDetail.all.group_by(&:franchisee_id)\n end", "def save_pricing\n\tif !(Time.current.beginning_of_day..Time.current.end_of_day).include?(@aws_offer_code.offer_code_update_statuses.last.try(:for_date))\n\t\toffer_code_update_statuses = @aws_offer_code.offer_code_update_statuses.create(for_date: Time.current)\n\t\t@json_res[\"terms\"][\"OnDemand\"].each do |k,v|\n\t\t\tprice_json = v.to_a\n\t\t\tget_final_json = price_json[0][1]\n\t\t\tprice_dimension_json = get_final_json[\"priceDimensions\"].to_a[0][1]\n\t\t\tcurrency_json = price_dimension_json[\"pricePerUnit\"].to_a[0]\n\t\t\tcurrency_id = MasterCurrency.get_id(currency_json[0])\n\t\t\tprice_per_unit = currency_json[1]\n\t\t\tif get_final_json.present?\n\t\t\t\taws_price_params = {\n\t\t\t\t\tsku: get_final_json[\"sku\"],\n\t\t\t\t\teffective_date: get_final_json[\"effectiveDate\"],\n\t\t\t\t\tcurrency_id: currency_id,\n\t\t\t\t\tdescription: price_dimension_json[\"description\"],\n\t\t\t\t\tbegin_range: price_dimension_json[\"beginRange\"],\n\t\t\t\t\tend_range: price_dimension_json[\"endRange\"],\n\t\t\t\t\tunit: price_dimension_json[\"unit\"],\n\t\t\t\t\tprice_per_unit: price_per_unit\n\t\t\t\t}\n\t\t\t\tputs \"#{get_final_json[\"sku\"]} saved\"\n\t\t\t\toffer_code_update_statuses.aws_offer_code_prices.create(aws_price_params)\n\t\t\tend\n\t\tend\n\telse\n\t\tputs \"Price can be update once in a day\"\n\tend\nend", "def dod_paygrade; end", "def index\n @users = User.all\n @courselist = Course.where(:lecturer => 'ABC')\n @courses_ta = Hash.new \n internal_courses_ta = Hash.new # internal usage\n @ta_status = Hash.new\n @courselist.each do |course|\n tadata_matching = AppCourseMatching.where(course_id: course.id)\n tadata_ids = Array.new\n tadata_status = Hash.new \n tadata_matching.each do |matching|\n tadata_ids << matching.student_application_id\n tadata_status[matching.student_application_id] = {'status' => matching.status, 'position' => matching.position}\n end\n tadata = StudentApplication.where(id: tadata_ids) # This will return one list\n @courses_ta[course.id] = tadata\n @ta_status[course.id] = tadata_status\n @suggestion = course.suggestion\n end\n end", "def check_status\n @booking = Booking.find(params[:booking_id])\n @transfer_id = @booking.stripe_transfer_id\n tr = Stripe::Transfer.retrieve(@booking.stripe_transfer_id)\n if tr[:status] == \"paid\"\n transfer_payment = @booking.update_columns(status: tr[:status])\n redirect_to payement_transfers_path\n flash[:notice] = \"Payment was Transfered.\"\n else\n flash[:notice] = \"Payment Transfer is Pending.\"\n redirect_to payement_transfers_path\n end\n\n end", "def update_core(indexer, ids, score, status)\n return if ids.empty?\n good_ids = grab_none_rejects(indexer.dropped_ids, ids)\n cores = Core.where(sfdc_id: good_ids).where(acct_merge_sts: [nil, \"Drop\", \"Ready\"])\n\n cores.each do |core|\n if compare_score(core.match_score, score)\n new_values = {\n staff_pf_sts: indexer.stf_status,\n loc_pf_sts: indexer.loc_status,\n staff_link: indexer.staff_url,\n staff_text: indexer.staff_text,\n location_link: indexer.location_url,\n location_text: indexer.location_text,\n staffer_sts: indexer.stf_status,\n template: indexer.template,\n who_sts: indexer.who_status,\n match_score: score,\n # acct_match_sts: compare_core_indexer(core.sfdc_acct, indexer.acct_name),\n acct_match_sts: compare_acct_downcase(core.sfdc_acct, indexer.acct_name),\n ph_match_sts: compare_core_indexer(core.sfdc_ph, indexer.phone),\n pin_match_sts: compare_core_indexer(core.crm_acct_pin, indexer.acct_pin),\n url_match_sts: compare_core_indexer(core.sfdc_clean_url, indexer.clean_url),\n alt_acct_pin: indexer.acct_pin,\n alt_acct: indexer.acct_name,\n alt_street: indexer.street,\n alt_city: indexer.city,\n alt_state: indexer.state,\n alt_zip: indexer.zip,\n alt_ph: indexer.phone,\n alt_url: indexer.clean_url,\n alt_source: \"Web\",\n alt_address: indexer.full_addr,\n alt_template: indexer.template,\n acct_merge_sts: status,\n web_staff_count: indexer.web_staff_count\n }\n\n puts \"\\n\\n#{'='*15}\\n#{new_values.inspect}\\n#{'='*15}\\n\\n\"\n core.update_attributes(new_values)\n end\n end\n end", "def update_status_paid()\n if stock_available?\n # Reduce stock once paid to prevent someone creating lots of unpaid orders which would stop others making purchases.\n # This should really be in a transaction but unlikely to have problems due to race condition.\n update!(status: PAID)\n ScriptLog.info(\"order_id #{id} is now PAID #{btc_address.address}:#{payment_received}\")\n reduce_product_stock()\n ScriptLog.info(\"order_id #{id} product_id #{product.id} stock reduced to #{product.stock}\")\n else\n update!(status: PAID_NO_STOCK)\n ScriptLog.info(\"order_id #{id} is now PAID_NO_STOCK #{btc_address.address}:#{payment_received}\")\n end\n end", "def update_advance_fee_status\n if self.wallet_amount_applied\n student = Student.find_by_id(self.payee_id)\n advance_fee_wallet = student.advance_fee_wallet\n effective_amount = advance_fee_wallet.amount - self.wallet_amount\n if advance_fee_wallet.update_attributes(:amount => effective_amount)\n advance_fee_deduction = AdvanceFeeDeduction.new(:amount => self.wallet_amount,\n :deduction_date => Date.today,\n :student_id => student.id,\n :finance_transaction_id => self.id)\n # transaction_ledger = self.transaction_ledger\n # transaction_ledger.amount = self.amount.to_f\n # transaction_ledger.save\n if advance_fee_deduction.save\n return true\n else\n return false\n end\n end\n end\n end", "def update\n respond_to do |format|\n\n if @expense_report.update(expense_report_params)\n @expense_report.update_attributes(:estimate2 =>(@expense_report.Flight + @expense_report.Hotel + @expense_report.Transportation + @expense_report.Other))\n @travel_forms = TravelForm.all\n @expense_reports = ExpenseReport.all\n @expense_reports.each do |expense_report|\n @travel_forms.each do |travel_form|\n @travel_form = @travel_forms.find(@expense_report.travel_forms_id)\n if @expense_report.estimate2 > @travel_form.estimate\n @expense_report.update_attributes(:status => \"Denied\")\n else\n @expense_report.update_attributes(:status => \"pending\")\n end\n end\n end\n format.html { redirect_to employee_path(current_account.accountable_id), notice: 'Expense report was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_report }\n else\n format.html { render :edit }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def status\n case item_hash.deep_find [:selling_status, :listing_status]\n when 'Active' then :active\n when 'Completed' then :completed\n when 'Ended' then :ended\n else\n raise EbayTraderError.new('Invalid item status')\n end\n end", "def create\n @account = current_account\n @expense_report = ExpenseReport.new(expense_report_params)\n @expense_report.account_id = @account.id\n @expense_report.estimate2 =(@expense_report.Flight + @expense_report.Hotel + @expense_report.Transportation + @expense_report.Other)\n \n @travel_forms = TravelForm.all\n @expense_reports = ExpenseReport.all\n @expense_reports.each do |expense_report|\n @travel_forms.each do |travel_form|\n @travel_form = @travel_forms.find(@expense_report.travel_forms_id)\n if @expense_report.estimate2 > @travel_form.estimate\n @expense_report.update_attributes(:status => \"Denied\")\n end\n end\n end\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to employee_path(current_account.accountable_id), notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n hotel = current_user.hotel\n if hotel.pricing\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.where(hotel_id: hotel.id).first\n price = Hash.new\n price = pricing.price\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n\n\n\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n else\n if hotel.id == Roomtype.find_by_id(params[:roomtype_id]).hotel_id\n pricing = Pricing.new\n pricing.hotel_id = hotel.id\n price = Hash.new\n room = params[:roomtype_id].to_i\n price[room] = []\n price[room].push({price: params[:price],start: Date.today,end: Date.today+36524})\n pricing.price = {}\n pricing.price = price\n pricing.save\n if request.xhr?\n render :json=>{\n :success=> 'true'\n }\n end\n return\n end\n end\n \n \n end", "def update_price\n product_cost_master = ProductCostMaster.find(self.id)\n \tm_revenue = (product_cost_master.basic_cost || 0) + (product_cost_master.shipping_handling || 0) \n m_cost = (product_cost_master.product_cost || 0) + (product_cost_master.tel_cost || 0) + (product_cost_master.postage || 0) + (product_cost_master.royalty || 0) + (product_cost_master.cost_of_return || 0) + (product_cost_master.call_centre_commission || 0) + (product_cost_master.packaging_cost || 0)\n\n \tproduct_cost_master.update_columns(cost: m_cost, revenue: m_revenue)\n end", "def create\n @court = Court.new(params[:court])\n # format_court_period_price @court\n\n for period_price in PeriodPrice.search_order\n #设置所有时间段可用\n @court.court_period_prices << CourtPeriodPrice.new(:period_price_id => period_price.id,\n :court_price => period_price.price,\n :catena_id => session[:catena_id])\n end\n\n respond_to do |format|\n if @court.save\n format.html { redirect_to(@court, :notice => '场地信息添加成功!') }\n format.xml { render :xml => @court, :status => :created, :location => @court }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @court.errors, :status => :unprocessable_entity }\n end\n end\n end", "def passing_products\n return self.products.select do |product|\n product.passing?\n end\n end", "def updateStatus\n result = Hash.new\n result['status'] = true\n begin # try\n result['status'] = RegistCoursesHlp.updateStatus(params[:id],params[:status])\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n # byebug\n render json: result\n end\n end", "def update\n course_id = params[:course_id].to_s\n\n if @point_source.course_point_update_needed?(course_id) == false\n render json: { data: \"Points of course #{course_id} not updated because data isn't too old yet\" }, status: 200 # Ok\n return\n end\n\n update_attempt = @point_source.update_course_points(course_id, @token)\n\n if update_attempt[:success]\n render json: { data: \"OK, updated points of course #{course_id}\" }, status: 200\n else\n errors = update_attempt[:errors]\n errors.push(\n title: \"Unable to update points of course #{course_id}\",\n detail: 'The update failed at the point source.'\n )\n render json: { errors: errors }, status: 500 # Server error\n end\n end", "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "def index\n update_session\n @company_id = current_user.company_id \n @company = Company.find(@company_id, :include => :product_licences)\n @users = User.find(:all,:include=>[:company,:employee,:role,{:product_licence_details=>{:product_licence=>:product}}],:conditions=>['company_id=?',@company.id]) if @company.users_not_client\n @employees = @company.employees.size\n @totalusers = @users.size\n @activeusers = SubproductAssignment.all(:select => [\"distinct user_id\"], :conditions => [\"company_id = ? AND employee_user_id IS NULL\", @company_id]).size\n @activepermlicence = 0\n @activetemplicence = 0\n @remainpermlicence = 0\n @remaintemplicence = 0\n @duration_setting = @company.duration_setting\n @company.product_licences.each do |pl|\n @activepermlicence += 1 if (pl.licence_type == 0 and pl.status == 1)\n @activetemplicence += 1 if (pl.licence_type == 1 and pl.status == 1)\n @remainpermlicence += 1 if (pl.licence_type == 0 and pl.status == 0)\n @remaintemplicence += 1 if (pl.licence_type == 1 and pl.status == 0)\n end\n params[:company_id]=current_user.company_id\n if params[:company_id].present?\n @company ||= Company.find(params[:company_id])\n @tne_setting = @company.tne_invoice_setting.id if @company.tne_invoice_setting.present?\n end\n respond_to do |format|\n format.html #index.html.erb\n format.xml { render :xml => @users }\n authorize!(:index,current_user) unless current_user.role?:lawfirm_admin\n end\n end", "def cost \n return @extra_cost + @basic_booking.cost\n end", "def cost \n return @extra_cost + @basic_booking.cost\n end", "def review_assigned_stock\n\n automatic_assignation = SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n\n # Search availability\n product_search = ::Yito::Model::Booking::BookingCategory.search(self.rental_location_code,\n self.date_from,\n self.time_from,\n self.date_to,\n self.time_to,\n self.days,\n {\n locale: self.customer_language,\n full_information: true,\n product_code: nil,\n web_public: false,\n sales_channel_code: self.sales_channel_code,\n apply_promotion_code: self.promotion_code.nil? ? false : true,\n promotion_code: self.promotion_code,\n include_stock: true,\n ignore_urge: {origin: 'booking', id: self.id}\n })\n free_resources = product_search.inject([]) do |result, item|\n result.concat(item.resources)\n end\n\n p \"free_resources: #{free_resources}\"\n\n self.booking_line_resources.each do |booking_line_resource|\n\n if !booking_line_resource.booking_item_reference.nil? # Assigned resource\n if free_resources.index(booking_line_resource.booking_item_reference).nil? # Not found\n if product = product_search.select { |item| item.code == booking_line_resource.booking_line.item_id }.first\n if product.availability and product.resources.size > 0\n if automatic_assignation\n p \"booking : #{self.id} reassigned #{product.resources.first} instead of #{booking_line_resource.booking_item_reference}\"\n booking_line_resource.assign_resource(product.resources.first)\n product.resources.delete_at(0)\n end\n else\n booking_line_resource.clear_assignation\n p \"booking : #{self.id} clear assignation #{booking_line_resource.booking_item_reference} -- not free resources\"\n end\n else\n p \"booking : #{self.id} #{booking_line_resource.booking_item_reference} product #{booking_line_resource.booking_line.item_id} not found\"\n end\n else\n p \"booking: #{self.id} kept: #{booking_line_resource.booking_item_reference}\"\n end\n else # Not assigned resource\n if automatic_assignation\n if product = product_search.select { |item| item.code == booking_line_resource.booking_line.item_id }.first\n if product.availability and product.resources.size > 0\n p \"booking : #{self.id} assigned #{product.resources.first}\"\n booking_line_resource.assign_resource(product.resources.first)\n product.resources.delete_at(0)\n end\n end\n end\n end\n end\n end", "def check_price\n @num_cookbooks = (params[:num_cookbooks] && params[:num_cookbooks].to_i > 3) ? params[:num_cookbooks].to_i : 4\n ccc = CookbookCostCalculator.new(\n num_bw_pages: current_cookbook.num_bw_pages, \n num_color_pages: current_cookbook.num_color_pages, \n num_books: @num_cookbooks, \n binding: current_cookbook.book_binding.to_sym\n )\n @cookbook = current_cookbook\n @printing_cost = ccc.printing_cost || \"Unknown\"\n @cost_per_book = (@printing_cost != \"Unknown\") ? (@printing_cost.to_f / @num_cookbooks).round(2) : \"Unknown\"\n end", "def calculate_costs\n self.amount = self.transaction.shipping_cost + self.transaction.value\n self.shipping_cost = self.transaction.shipping_cost\n self.commission_rate = self.buyer.account.commission_rate || SiteVariable.get(\"global_commission_rate\").to_f # Calculate commission rate, if neither exist commission is set to 0\n self.commission = Money.new((commission_rate * self.transaction.value.cents).ceil) # Calculate commision as commission_rate * item value (without shipping), round up to nearest cent\n end", "def index\n @course=Course.where(teacher_id: current_user) if teacher_logged_in?\n @course=current_user.courses if student_logged_in?\n @course = Course.where(status: [$CourseReview,$CourseArrange]) if admin_logged_in?\n end", "def activate\n @company = Company.find( params[:company_id])\n @training = @company.trainings.find( params[:training_id])\n course = Course.find( params[:id])\n if course.state == 0\n course.update_attribute :state, 1\n end\n \n redirect_to training_courses_manage_path(@company,@training)\n end", "def location_rule_change_status\n if @rule.enabled == 0\n @rule.enabled = 1; st =_('Rule_enabled')\n else\n @rule.enabled = 0; st = _('Rule_disabled')\n end\n @rule.save ? flash[:status] = st : flash[:notice] = _('Update_Failed')\n redirect_to :action => 'location_rules', :id => @rule.location_id\n end", "def compute_price\n \n # set the initial state of an order\n self.status = Order.possible_status[:wait_payment]\n \n # use the visitor pattern to traverse the product and its upgrades\n visitor = VisitorPrice.new\n visitor.visit_product product\n upgrades.each do |upgrade|\n visitor.visit_upgrade upgrade\n end\n self.price = visitor.price\n \n end", "def other_game_status\n status = []\n\n unless @game.offering.empty?\n status << h(:h3, 'Offering')\n comps = @game.offering.map do |company|\n h(Company, company: company)\n end\n status << h(:div, comps)\n end\n\n status << h(:h3, 'Remaining Deck')\n if @game.company_deck.empty?\n status << h(:div, '(Empty)')\n else\n deck = @game.company_deck.reverse.map do |company|\n deck_item_style = {\n display: 'inline-block',\n backgroundColor: @game.company_colors(company)[0],\n padding: '4px',\n border: '1px solid black',\n height: '20px',\n margin: '4px',\n }\n h(:div, { style: deck_item_style })\n end\n status << h(:div, deck)\n end\n\n table_props = {\n style: {\n backgroundColor: 'white',\n color: 'black',\n margin: '0',\n border: '1px solid',\n borderCollapse: 'collapse',\n },\n }\n tr_props = {\n style: {\n border: '1px solid black',\n },\n }\n th_props = {\n style: {\n border: '1px solid black',\n },\n }\n\n status << h(:h3, 'Current Cost of Ownership')\n\n cost_card_props = {\n style: {\n display: 'inline-block',\n backgroundColor: @game.class::STAR_COLORS[@game.cost_level]&.[](0) || 'white',\n color: 'black',\n padding: '20px 60px 20px 60px',\n border: '1px solid',\n borderRadius: '10px',\n },\n }\n\n cost_rows = [h(:tr, tr_props, [h(:th, th_props, 'Level'), h(:th, th_props, 'Cost')])]\n @game.cost_table[@game.cost_level].each_with_index do |cost, idx|\n level_props = {\n style: {\n backgroundColor: @game.class::STAR_COLORS[idx + 1][0],\n border: '1px solid',\n },\n }\n td_props = {\n style: {\n border: '1px solid',\n },\n }\n cost_rows << h(:tr, tr_props, [\n h(:td, level_props, @game.level_symbol(idx + 1)),\n h(:td, td_props, @game.format_currency(cost)),\n ])\n end\n status << h(:div, cost_card_props, [\n h(:table, table_props, [\n h(:tbody, cost_rows),\n ]),\n ])\n\n # show target book/stars for each share price\n status << h(:h3, @game.share_card_description)\n sorted_prices = @game.prices.keys.sort\n share_cards = sorted_prices.map { |p| share_card(@game.prices[p]) }\n status << h(:div, share_cards)\n\n status\n end", "def cost\n return @extra_cost + @basic_booking.cost\n end", "def active=(active)\n @active = active\n @ucStat.active = active\n @ucCompareStat.active = active\n end", "def create\n @check_product = ProductPrice.find_by(product_description_id: params[:product_description_id], zone_id: params[:zone_id])\n if !@check_product\n @product_description = ProductDescription.find(params[:product_discription_id])\n @zone = Zone.find(params[:zone_id])\n @product_price = ProductPrice.new(user_id: current_user.user_id,product_description_id: params[:product_discription_id], productprice_month_id: params[:month_id], zone_id: params[:zone_id], productprice_price: params[:productprice_price],productdescription_product: @product_description.productdescription_product,productprice_zone_class: @zone.zone_description)\n\n respond_to do |format|\n if @product_price.save\n @uid = @product_price.update(uid: 'pp_' + @product_price.id.to_s)\n @description = @product_price.productprice_month_id.to_s + '$' + @product_price.productprice_zone_class.to_s + '$' + @product_price.productdescription_product.to_s + '$' + @product_price.productprice_price.to_s\n Log.create!(user_id: current_user.user_id,description:@description, username: current_user.name, uid: 'pp_' + @product_price.id.to_s)\n format.html { redirect_to product_prices_url, notice: 'Product price was successfully created.' }\n format.json { render :show, status: :created, location: @product_price }\n else\n format.html { render :new }\n format.json { render json: @product_price.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n @product_description = ProductDescription.find(params[:product_discription_id])\n @zone = Zone.find(params[:zone_id])\n \n if @check_product.update(product_description_id: params[:product_discription_id], productprice_month_id: params[:month_id], zone_id: params[:zone_id], productprice_price: params[:productprice_price],productdescription_product: @product_description.productdescription_product,productprice_zone_class: @zone.zone_description)\n @description = params[:month_id] + '$' + @zone.zone_description + '$' + @product_description.productdescription_product.to_s + '$' + params[:productprice_price].to_s\n Log.create!(description:@description, username: current_user.name, uid: @check_product.uid,user_id: current_user.user_id)\n @product_price1 = ProductPrice.find(@check_product.id)\n @supplier_price = SPayMProductPrice.where(product_price_id: @check_product.id)\n @customer_price = CPayMProductPrice.where(product_price_id: @check_product.id)\n \n if @supplier_price.present?\n @supplier_price.each do | supplier |\n supplier.update(net_price: @product_price1.productprice_price + supplier.product_rebate,product_price_price: @product_price1.productprice_price)\n @net = @product_price1.productprice_price + supplier.product_rebate\n @s_pay_m_product_price1 = SPayMProductPrice.find(supplier.id)\n @description = @s_pay_m_product_price1.updated_at.strftime(\"%Y-%m-%d %H:%M:%S\").to_s + \"$\" + @s_pay_m_product_price1.product_pescription_product.to_s + \"$\" + @s_pay_m_product_price1.product_price_price.to_s + \"$\" + @s_pay_m_product_price1.product_rebate.to_s + \"$\"+ @s_pay_m_product_price1.claw_margin.to_s + \"$\" + @s_pay_m_product_price1.net_price.to_s\n Log.create!(user_id: current_user.user_id,description: @description, username: current_user.name, uid: supplier.uid.to_s)\n end\n end\n\n if @customer_price.present?\n @customer_price.each do | customer |\n @supp_price = SPayMProductPrice.find(customer.s_pay_m_product_price_id)\n @gross = (@product_price1.productprice_price + customer.product_rebate) - @supp_price.net_price\n customer.update(s_net_price: @supp_price.net_price,gross_price: @gross,net_price: @product_price1.productprice_price + customer.product_rebate,product_price_price: @product_price1.productprice_price)\n @customer_rebate = CPayMProductPrice.find(customer.id)\n @description1 = @customer_rebate.updated_at.strftime(\"%Y-%m-%d %H:%M:%S\").to_s + \"$\" + @customer_rebate.product_pescription_product.to_s + \"$\" + @customer_rebate.product_price_price.to_s+ \"$\" + @customer_rebate.product_rebate.to_s + \"$\" + @customer_rebate.claw_margin.to_s + \"$\" + @customer_rebate.net_price.to_s + \"$\" + @customer_rebate.s_name.to_s + \"$\" + @customer_rebate.s_net_price.to_s + \"$\" + @customer_rebate.gross_price.to_s\n Log.create!(user_id: current_user.user_id,description: @description1, username: current_user.name, uid: customer.uid.to_s)\n end\n end\n format.html { redirect_to product_prices_url, notice: 'Product price was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_price }\n else\n format.html { render :edit }\n format.json { render json: @product_price.errors, status: :unprocessable_entity }\n end\n end\n redirect_to product_prices_url\n end\n end", "def set_product_status\r\n\t\t\tproject = nil\r\n\r\n\t\t\tcase params[:product_type]\r\n\t\t\twhen 'real_estate'\r\n\t\t\t\tproject = Project.joins(blocks: :real_estates).where(\"real_estates.id = #{params[:product_id]}\").first\r\n\t\t\twhen 'floor_real_estate'\r\n\t\t\t\tproject = Project.joins(blocks: { real_estates: :in_floors }).where(\"floor_real_estates.id = #{params[:product_id]}\").first\r\n\t\t\tend\r\n\r\n\t\t\treturn render json: { status: 1 } if project.blank?\r\n\r\n\t\t\t# Author\r\n\t\t\tauthorize! :edit, project\r\n\r\n\t\t\tresult = Project.set_product_status project.id, params[:product_type], params[:product_id], params[:product_status]\r\n\r\n\t\t\trender json: result\r\n\t\tend", "def show\n @course = Course.find(params[:id])\n @course_enrollments = @course.enrollments.where(:status => nil)\n @completed_course_enrollments = @course.enrollments.where(:status => \"completed\")\n end", "def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\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 view_liability\n @liabilities = Liability.find(:all, :conditions => 'is_deleted = 0')\n @currency_type = currency\n end", "def check_progress\n self.increment_count\n begin\n self.send(\"check_progress_#{self.type}\")\n rescue\n self.update_attributes(:status =>'not yet available')\n end\n end", "def save_beginning_status user_id\n self.payment_status = PTE::PaymentStatus.processing\n self.user_id = user_id\n self.transaction_time = Time.now\n self.save\n end", "def set_status\n @current_product.aasm_state = params[:status]\n\n if @current_product.save\n @product_status = @current_product.aasm_state\n else\n @object = \"Product\"\n render \"api/v1/errors/404\", status: 404\n end\n end", "def check_price\n self.price = self.price.to_f\n end", "def availability\n STATUS_TO_AVAILABILITY[self.status]\n end", "def update\n @course_status = CourseStatus.find(params[:id])\n\n respond_to do |format|\n if @course_status.update_attributes(params[:course_status])\n format.html { redirect_to @course_status, :notice => 'Estado de Curso atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course_status.errors, :status => :unprocessable_entity }\n end\n end\n end", "def calculate_price\n logger.info(\"calculate_price ======================\" )\n logger.info(\"calculate_price price_usage=\" + self.price_usage.price.to_s)\n logger.info(\"calculate_price price_media=\" + self.price_media.price.to_s)\n # price = image.basePrice | image.stockBasePrice\n price = 0 # self.image_shell.stock_base_price\n sumPerc = 0\n self.price_options.each do |o|\n sumPerc += (o.percentage)\n logger.info(\"calculate_price price_opton=\" + (o.percentage).to_s + \"%\") \n end\n \n # add countries\n worldwide = self.use_territory.include? \"Worldwide\"\n north_america = self.use_territory.include? \"North America\"\n south_america = self.use_territory.include? \"South America\"\n asia = self.use_territory.include? \"Asia\"\n europe = self.use_territory.include? \"Europe\"\n australia = self.use_territory.include? \"Australia\"\n africa = self.use_territory.include? \"Africa\"\n \n \n logger.info(\"worldwide \" + worldwide.to_s )\n logger.info(\"north_america \" + north_america.to_s)\n logger.info(\"south_america \" + south_america.to_s)\n logger.info(\"asia \" + asia.to_s )\n logger.info(\"europe \" + europe.to_s )\n logger.info(\"australia \" + australia.to_s )\n logger.info(\"africa \" + africa.to_s )\n \n \n if worldwide\n \n price += self.price_usage.price + 0.15\n \n elsif north_america || south_america || asia || europe || australia || africa\n \n sumPerc += 0.10 if north_america\n sumPerc += 0.10 if south_america\n sumPerc += 0.10 if asia\n sumPerc += 0.10 if europe\n sumPerc += 0.10 if australia\n sumPerc += 0.10 if africa\n \n else\n \n self.use_territory.each do |t|\n sumPerc += 0.03\n end\n \n end\n \n price += self.price_usage.price + self.price_media.price\n price += (sumPerc/100.0)*price\n \n logger.info(\"price \" + price.to_s )\n logger.info(\"sumPerc \" + sumPerc.to_s )\n logger.info(\"sumPerc \" + ( sumPerc/100.0 ).to_s )\n logger.info(\"(sumPerc/100)*price \" + ( (sumPerc/100.0)*price ).to_s ) \n logger.info(\"calculate_price total \" + price.to_s)\n logger.info(\"calculate_price ======================\" ) \n price\n end", "def price\n { 'price' => success ? '0.03' : '0.00' }\n end", "def active_pricing\n if ENV['DELAYED_JOB_ENABLE'] == 'true'\n Product.delay.active_pricing\n else\n Product.active_pricing\n end\n\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n end\n end", "def offenses_to_check; end", "def price\n \n end", "def price_validate\n\t\tif (self.pay_mode == \"free\") || (self.pay_mode == \"FREE\") || (self.pay_mode == \"Free\")\n\t\t\tunless self.price == nil \n\t\t\t\t errors.add(:price, \"price should be nil\")\n\t\t\tend\t\n\t\telsif (self.pay_mode == \"paid\") || (self.pay_mode == \"PAID\") || (self.pay_mode == \"Paid\")\n\t\t\tunless self.price > 0 \n\t\t\t\t errors.add(:price, \"price should have a value not either nil nor 0\")\n\t\t\tend\n\t\telsif (self.pay_mode == \"donation\") || (self.pay_mode == \"DONATION\") || (self.pay_mode == \"Donation\")\n\t\t\tunless self.price == nil \n\t\t\t\t errors.add(:price, \"price should be nil\")\n\t\t\tend\t\t\t\t\t\t\t\n\t\tend\n\tend", "def set_price\n @price = Price.find(params[:id])\n @prices = Price.order('position Asc')\n #@price.strain_id = Strain.find(params[:id]).id\n #@price.region_id = Region.find(params[:id]).id\n end", "def call_status\n job = Job.find(params[:job_id])\n if !job.expert_id.blank? or !job.expert_id.nil?\n render :json=> {:success => false }\n else\n if params[:accept]\n job.update_attributes(:status => \"completed\", :expert_id => params[:expert_id])\n elsif params[:end]\n job.update_attributes(:status => \"active\")\n end\n end\n end", "def index\n session[:ppage] = (params[:per_page].to_i rescue 25) if (params[:per_page] && (not params[:per_page.blank?] ) )\n @per_page = session[:ppage].to_s\n params[:ppage] = session[:ppage]\n\n if (params[:status].present? && CollectionPoint.collection_points_status.include?(params[:status].to_sym) )\n @active = params[:status].to_sym\n @collection_points = CollectionPoint.where(status: params[:status]).order(:name)\n else\n @collection_points = CollectionPoint.order(:name)\n @active = \"all\"\n end\n @collection_points = @collection_points.page(params[:page]).per(session[:ppage])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collection_points }\n end\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def price\n raise 'Redefine this method in your billing model.'\n end", "def class_params\n params.require(:course).permit(:name, :description, :status, :capacity, :start_date, :end_date)\n end", "def update\n @company_price = current_user.company_prices.find(params[:id])\n\n if @company_price.update_attributes(params[:company_price])\n redirect_to company_prices_path, notice: '报价信息更新成功'\n else\n render action: \"edit\" \n end\n end", "def update_partner_statuses\n contacts.where(status: nil).joins(:donor_accounts).each do |contact|\n # If they have a donor account id, they are at least a special donor\n # If they have given the same amount for the past 3 months, we'll assume they are\n # a monthly donor.\n gifts = donations.where(donor_account_id: contact.donor_account_ids,\n designation_account_id: designation_account_ids)\n .order('donation_date desc')\n latest_donation = gifts[0]\n\n next unless latest_donation\n\n pledge_frequency = contact.pledge_frequency\n pledge_amount = contact.pledge_amount\n\n if latest_donation.donation_date.to_time > 2.months.ago && latest_donation.channel == 'Recurring'\n status = 'Partner - Financial'\n pledge_frequency = 1 unless contact.pledge_frequency\n pledge_amount = latest_donation.amount unless contact.pledge_amount.to_i > 0\n else\n status = 'Partner - Special'\n end\n\n # Re-query the contact to make it not read-only from the join\n # (there are other ways to handle that, but this one was easy)\n Contact.find(contact.id).update_attributes(status: status, pledge_frequency: pledge_frequency, pledge_amount: pledge_amount)\n end\n end" ]
[ "0.5139498", "0.49951208", "0.49346662", "0.49056712", "0.48232698", "0.47848597", "0.47768036", "0.47175533", "0.47169578", "0.46846825", "0.46771947", "0.46010172", "0.45770875", "0.45541218", "0.45434603", "0.4530057", "0.45252088", "0.4499203", "0.44837517", "0.44807866", "0.44491705", "0.44479293", "0.4447383", "0.4439944", "0.44386286", "0.4428177", "0.4419693", "0.4414348", "0.44137692", "0.44113812", "0.43980628", "0.43857896", "0.43775004", "0.4376564", "0.43736127", "0.43719473", "0.43532974", "0.4351802", "0.43494964", "0.43485796", "0.43472964", "0.43439156", "0.43330464", "0.4321014", "0.4319274", "0.43089354", "0.4308252", "0.43020028", "0.4298194", "0.42956755", "0.4290276", "0.42855012", "0.42777437", "0.4273953", "0.4272105", "0.42713574", "0.4271155", "0.42683592", "0.42632243", "0.42610693", "0.42609307", "0.42555994", "0.4252433", "0.4252433", "0.42517906", "0.4238414", "0.42351785", "0.42342734", "0.4234227", "0.42298508", "0.4221382", "0.42202875", "0.42164466", "0.4215075", "0.42118043", "0.42108023", "0.42070624", "0.41934842", "0.4193228", "0.4190795", "0.41906035", "0.418739", "0.418576", "0.41856793", "0.41821584", "0.41819638", "0.41817722", "0.41809365", "0.4180264", "0.417756", "0.4176508", "0.41755182", "0.41689286", "0.4168601", "0.4163979", "0.4160269", "0.4160269", "0.41562802", "0.41554627", "0.41532812" ]
0.74869955
0
change this to :devel to see most messages here (anything without a loglevel as the second arg)
def log(msg, level = :devel) Log4r::NDC.push("jack_tube") Log.__send__(level, msg) Log4r::NDC.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(message = \"\", level = 5)\n if $config[:global][:verboselevel] and $config[:global][:verboselevel] >= level\n puts message \n\t\t#logger.info(message)\n Syslog.info(message)\n end\nend", "def verbose_logging; end", "def setup_logging( level=:fatal )\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tlogarray = []\n\t\t\tThread.current['logger-output'] = logarray\n\t\t\tLoggability.output_to( logarray )\n\t\t\tLoggability.format_as( :html )\n\t\t\tLoggability.level = :debug\n\t\telse\n\t\t\tLoggability.level = level\n\t\tend\n\tend", "def verbose_logging=(_arg0); end", "def check_global();puts $log_level;end", "def log_level; end", "def log_level; end", "def default_level\n ENV.key?(ENV_FLAG) ? ::Logger::DEBUG : ::Logger::WARN\n end", "def increase_verbosity\n if severity > -1 then\n self.severity -= 1\n if trace? then\n $DEBUG = true\n end\n end\n end", "def log(msg)\n puts msg if $verbose\nend", "def debug_out(debmsg)\n if $gDebug \n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend", "def debug_out(debmsg)\n if $gDebug\n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend", "def dlog(*args)\n if development?\n $stdout.puts \"\\n================================================\\n\"\n for arg in args\n $stdout.puts arg\n $stdout.puts \"================================================\\n\"\n end\n end\n end", "def enable_logging(opts); end", "def default_log_level\n\t\t\tif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE\n\t\t\t\tLogger::INFO\n\t\t\telse\n\t\t\t\tLogger::WARN\n\t\t\tend\n\t\tend", "def log_level=(_arg0); end", "def log_level=(_arg0); end", "def configure_logger!\n if config[:debug] || !ENV[\"DEBUG\"].to_s.empty?\n Bogo::Logger.logger.level = :debug\n else\n Bogo::Logger.logger.level = config.fetch(:log, :fatal)\n end\n end", "def warn_out(debmsg)\n if $gWarn \n puts debmsg\n end\n if ($gTest_params[\"logfile\"])\n $fLOG.write(debmsg)\n end\nend", "def debug message; write DEBUG, message, caller[0] unless level > @level end", "def log_level\n @log_level ||= :debug\n end", "def log_level\n @log_level ||= :debug\n end", "def colorize_logging=(_arg0); end", "def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend", "def dbg(msg, msgLevel = 1)\n\tif $options['debug'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend", "def demonstrating_log_levels\n # Disabled by default\n LOGGER.trace( \"TRACE logs are NOT captured by default\" ) if LOGGER.trace? \n LOGGER.debug( \"DEBUG logs are NOT captured by default\" ) if LOGGER.debug?\n LOGGER.info( \"INFO logs are NOT captured by default\" ) if LOGGER.info?\n\n # Enabled by default\n LOGGER.notice( \"NOTICE logs are captured by default\" )\n LOGGER.warn( \"WARN logs are captured by default\" ) \n LOGGER.error( \"ERROR logs are captured by default\" )\n LOGGER.severe( \"SEVERE logs are captured by default\" )\n LOGGER.fatal( \"FATAL logs are captured by default\" )\n end", "def setup\n set_debug_level(0)\n end", "def debug!\n self.severity = :DEBUG\n end", "def log(msg)\n print \" \" if $trace && $verbose\n puts msg if $verbose\n end", "def debug_msg msg\n puts msg if @options[:debug]\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif Mongrel2::Logging::LOG_LEVELS.key?( level.to_s )\n\t\t\tlevel = Mongrel2::Logging::LOG_LEVELS[ level.to_s ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tMongrel2.logger = logger\n\t\tMongrel2.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tMongrel2.logger = Logger.new( logdevice )\n\t\t\t# Mongrel2.logger.level = level\n\t\t\tMongrel2.logger.formatter = Mongrel2::Logging::HtmlFormatter.new( logger )\n\t\tend\n\tend", "def log(msg)\n puts msg if @verbose\n end", "def log(msg)\n puts msg if @verbose\n end", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif RoninShell::Loggable::LEVEL.key?( level )\n\t\t\tlevel = RoninShell::Loggable::LEVEL[ level ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tRoninShell.logger = logger\n\t\tRoninShell.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tRoninShell.logger = Logger.new( logdevice )\n\t\t\t# RoninShell.logger.level = level\n\t\t\tRoninShell.logger.formatter = RoninShell::HtmlLogFormatter.new( logger )\n\t\tend\n\tend", "def colorize_logging; end", "def debug?; @loggers.first.level <= DEBUG; end", "def log(message)\n puts message unless ENV['RUBY_ENV'] == 'test'\n end", "def log( *messages )\n\t$stderr.puts( messages.join ) unless Rake.application.options.quiet\nend", "def log(msg)\n STDERR.puts msg if $verbose\nend", "def log(msg)\n STDERR.puts msg if $verbose\nend", "def debug_msg(msg)\n if(@options[:debug])\n @log.puts(msg)\n puts msg\n end\nend", "def setup_logging( level=Logger::FATAL )\n\n\t\t# Turn symbol-style level config into Logger's expected Fixnum level\n\t\tif Treequel::LOG_LEVELS.key?( level.to_s )\n\t\t\tlevel = Treequel::LOG_LEVELS[ level.to_s ]\n\t\tend\n\n\t\tlogger = Logger.new( $stderr )\n\t\tTreequel.logger = logger\n\t\tTreequel.logger.level = level\n\n\t\t# Only do this when executing from a spec in TextMate\n\t\tif ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\\.rb/)\n\t\t\tThread.current['logger-output'] = []\n\t\t\tlogdevice = ArrayLogger.new( Thread.current['logger-output'] )\n\t\t\tTreequel.logger = Logger.new( logdevice )\n\t\t\t# Treequel.logger.level = level\n\t\t\tTreequel.logger.formatter = Treequel::HtmlLogFormatter.new( logger )\n\t\tend\n\tend", "def log(msg)\n puts msg unless ENV['TEST']\n end", "def warn message\n super message if @verbosity > 1\n end", "def normal\n %i[debug info warn]\n end", "def log(msg)\n if ENV['LAUNCHY_DEBUG'] == 'true' then\n $stderr.puts \"LAUNCHY_DEBUG: #{msg}\"\n end\n end", "def log(msg)\n puts(msg) if @info_values['enable_debug_logging'] == \"Yes\"\n end", "def log(level, msg)\n puts \"#{level}, #{@org} Customization: #{msg}\"\n end", "def log!(message)\n log message if very_verbose\n end", "def log!(message)\n log message if very_verbose\n end", "def log(msg)\n print \" \" if $trace && $verbose\n $stderr.puts msg if $verbose\n end", "def debug(msg) log(7, msg); end", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def debug(msg)\n $stderr.puts(\"DEBUG: #{msg}\") if $options['verbose']\nend", "def log level, message; write level, message, caller[0] unless level > @level end", "def trace( *msg )\n\t\treturn unless $VERBOSE\n\t\t$stderr.puts( *msg )\n\tend", "def do_logging\n Log.debug \"debugging\"\n Log.info \"a piece of info\"\n Log.warn \"Danger, Will Robinson, danger!\"\n Log.error \"I dropped my Wookie! :(\"\n Log.fatal \"kaboom!\"\nend", "def do_logging\n Log.debug \"debugging\"\n Log.info \"a piece of info\"\n Log.warn \"Danger, Will Robinson, danger!\"\n Log.error \"I dropped my Wookie! :(\"\n Log.fatal \"kaboom!\"\nend", "def log(msg, flag = false)\r\n puts msg if flag\r\nend", "def iniDbg(msg, msgLevel = 1)\n\tif $options['ini_dbg'] >= msgLevel then\n\t\tputs \"#{msg}\"\n\tend\nend", "def default_log_level(env = ENV)\n\t\t\tif level = env['CONSOLE_LOG_LEVEL']\n\t\t\t\tLEVELS[level] || Logger.warn\n\t\t\telsif $DEBUG\n\t\t\t\tLogger::DEBUG\n\t\t\telsif $VERBOSE.nil?\n\t\t\t\tLogger::WARN\n\t\t\telse\n\t\t\t\tLogger::INFO\n\t\t\tend\n\t\tend", "def INFO(msg)\n if DEBUG\n puts \"INFO: \" + msg\n end\nend", "def parse(arguments)\n super\n\n level = :info\n level = :debug if debug?\n level = :error if quiet?\n Kubetruth::Logging.setup_logging(level: level, color: color?)\n end", "def debug(message) ; @log.debug(message) ; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log(message)\n puts \"[ dev/rails ] #{message}\"\nend", "def debug?; @level <= DEBUG; end", "def debug?; @level <= DEBUG; end", "def logger_level; end", "def log_level=(level); end", "def debug(msg = \"\")\n puts \"\\n\\n\\n\"\n puts \" DEBUGGING \".white.on_red\n puts msg\n puts \"\\n\\n\\n\"\n exit\n end", "def debug(msg); @logger.debug(msg); end", "def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend", "def debug_msg( *msg )\n\t\treturn unless $DEBUG\n\t\t$stderr.puts( *msg )\n\tend", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end" ]
[ "0.67370135", "0.6651266", "0.6552499", "0.64157575", "0.6387351", "0.6386957", "0.6386957", "0.6144701", "0.61362046", "0.61084306", "0.6070469", "0.6059245", "0.6055979", "0.6046676", "0.6011606", "0.6006446", "0.6006446", "0.5962687", "0.5923468", "0.5913254", "0.5889674", "0.5889674", "0.58511287", "0.58428794", "0.58428794", "0.5838424", "0.5838395", "0.582917", "0.58263355", "0.58229095", "0.58173615", "0.58156353", "0.58156353", "0.5814179", "0.57936066", "0.5785413", "0.578349", "0.577936", "0.57726777", "0.57726777", "0.57709754", "0.57671475", "0.5751352", "0.5747285", "0.5745383", "0.57313186", "0.57213944", "0.57036436", "0.57016754", "0.57016754", "0.56970924", "0.5686969", "0.5681372", "0.5681372", "0.5681372", "0.5677415", "0.56582874", "0.5653788", "0.5653788", "0.56520593", "0.56482214", "0.5647923", "0.56475675", "0.5641763", "0.56410754", "0.5635308", "0.5635308", "0.5635308", "0.5635308", "0.5635308", "0.5635308", "0.5635308", "0.5635308", "0.5630761", "0.56138134", "0.56138134", "0.5574145", "0.5563954", "0.5563309", "0.5561592", "0.55528617", "0.55528617", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535", "0.55485535" ]
0.5725147
46
GET /drivers returns all drivers
def index respond_with Driver.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_drivers\n return return_all_drivers\n end", "def get_drivers\n drivers\n end", "def index\n @drivers = Driver.all\n end", "def index\n @drivers = Driver.all\n end", "def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end", "def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end", "def index\n @driverslists = Driverslist.all\n end", "def index\n redirect_to search_drivers_path unless current_user and current_user.is_admin\n @drivers = Driver.all\n end", "def index\n admin_check\n @drivers = Driver.all\n end", "def index\n respond_with ApidDriver.all\n end", "def drivers\n send :adapters\n end", "def index\n # Show all records\n @drivers = Driver.search(params[:search], params[:column]).order(sort_column(Driver, 'name') + ' ' + sort_direction).page(params[:page]).per(10)\n \n get_params()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end", "def index\n @drivers_licesnses = DriversLicesnse.all\n end", "def index\n\n @enterprise = current_user\n @drivers = @enterprise.drivers\n\n #logeando vista drivers con autos desde enterprise\n @cars = @enterprise.cars\n # @drivers = Driver.all\n end", "def index\n @driver_applications = DriverApplication.all\n end", "def index\n @ride_drivers = RideDriver.all\n end", "def return_all_drivers\n return @trips.map{ |trip| trip.driver }\n end", "def index\n @devices = Device.all.includes(:browsers)\n json_response(@devices, :ok, [:browsers])\n end", "def index\n @references_vehicle_drivers = ReferencesVehicleDriver.all\n end", "def drivers()\n self.rides().map { | ride | ride.driver }\n end", "def nearby_drivers(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:nearby_drivers),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end", "def hired\n authorize current_company, :index?\n @drivers = current_company.hired_drivers.distinct\n @drivers = @drivers.page(params[:page]).per(10)\n end", "def show\n\t\t\t\trespond_with Driver.find(params[:id])\n\t\t\tend", "def drivers\n rides.map { |ride| ride.driver }\n end", "def pending_drivers\n users = User.needing_driver_verification\n render :json => users, each_serializer: SlimPendingDriverSerializer, root: false, status: 200\n end", "def set_driverslist\n @driverslist = Driverslist.find(params[:id])\n end", "def show\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end", "def show\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end", "def get_driver_details\n @resource = Resource.find(params[:id])\n @driver = Driver.find(AgencyStore.find_by_resource_id(params[:id]).driver_id)\n render :layout => false\n end", "def all\n api_get(path)\n end", "def index\n @q = apply_scopes(Device).all.search(params[:q])\n @devices = @q.result(distinct: true).page(params[:page])\n\n respond_with(@devices)\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @vendors = Vendor.all\n end", "def index\n @driver_divisions = DriverDivision.all\n end", "def drivers\n @drivers ||= ActiveSupport::HashWithIndifferentAccess.new\n end", "def devices(params={})\n res = @client.get(\"#{path}/devices\", params)\n\n res.json[\"devices\"].map{ |atts| ::M2X::Client::Device.new(@client, atts) } if res.success?\n end", "def index\n @driver_profiles = DriverProfile.all\n end", "def index\n @devices = Device.all\n end", "def index\n @devices = Device.all\n end", "def index\n @devices = Device.all\n end", "def index\n @devices = Device.all\n end", "def index\n @devices = Device.all\n end", "def index\n @catalog_devices = Catalog::Device.all\n end", "def index\n @driver_logs = DriverLog.all\n end", "def index\n @tech_servs = TechServ.page(params[:page]).per(10)\n end", "def index\n @vendors = Vendor.all.page(params[:page]).per(5)\n end", "def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end", "def index\n json_response(@device.browsers)\n end", "def index\n @apis = Api.all\n end", "def get_synthetics_devices\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/browser/devices\", nil, nil, false)\n end", "def drivers\n rides.map {|ride| ride.driver}.uniq\n end", "def get_drvies_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DrivesApi.get_drvies ...'\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DrivesApi.get_drvies\"\n end\n # resource path\n local_var_path = '/drives'\n\n # query parameters\n query_params = {}\n query_params[:'year'] = year\n query_params[:'seasonType'] = opts[:'season_type'] if !opts[:'season_type'].nil?\n query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?\n query_params[:'team'] = opts[:'team'] if !opts[:'team'].nil?\n query_params[:'offense'] = opts[:'offense'] if !opts[:'offense'].nil?\n query_params[:'defense'] = opts[:'defense'] if !opts[:'defense'].nil?\n query_params[:'conference'] = opts[:'conference'] if !opts[:'conference'].nil?\n query_params[:'offenseConference'] = opts[:'offense_conference'] if !opts[:'offense_conference'].nil?\n query_params[:'defenseConference'] = opts[:'defense_conference'] if !opts[:'defense_conference'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Drive>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DrivesApi#get_drvies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @adapters = Adapter.all\n end", "def list(&block)\n @driver.list(&block)\n end", "def list\n get('/')\n end", "def all_drivers\n if all_trips.class != String\n drivers = all_trips.map{|h| h[:driver_id]}\n return drivers.map {|driver| Rideshare::Driver.find(driver)}.uniq\n else\n return \"No Match\"\n end\n end", "def show\n # Show one record\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end", "def index\n @providers = Provider.all\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def index\n @hardware = Hardware.all\n end", "def names(params = {})\n Iterable.request(conf, '/catalogs', params).get\n end", "def device_list\n @devices = Device.all\n end", "def get_drvies(year, opts = {})\n data, _status_code, _headers = get_drvies_with_http_info(year, opts)\n data\n end", "def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end", "def getVendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def providers\n driver(current_driver).providers\n end", "def models\n make = params[:make]\n @models = Databag.find(\"printers/#{make}\").value.keys.reject{ |k| k == \"id\" }.sort\n render :layout => false\n end", "def index\n @q = DeviceManufacturer.search(params[:q])\n @device_manufacturers = @q.result(distinct: true).page(params[:page])\n\n respond_with(@device_manufacturers)\n end", "def drivers\n full_attributes.map(&:driver).uniq.reject(&:nil?)\n end", "def payers(params = {})\n scope 'default'\n get('payers/', params)\n end", "def driver_info\n return Rideshare::Driver.find(@driver_id)\n end", "def index\n @wireless_routers = WirelessRouter.all\n end", "def index\n @service_providers = ServiceProvider.all\n end", "def index\n Rails.logger.info('👻 Disraptor: Showing available routes.')\n\n routes = Disraptor::Route.find_all()\n\n render json: { 'disraptor/routes': routes }\n end", "def index\n @technologies = Technology.all\n end", "def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end", "def index\n @registry_therapy_types = Registry::TherapyType.paginate(:page => params[:page])\n end", "def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end", "def list\n all.each { |device| puts(device.pretty_name) }\n end", "def index\n @users = User.all\n binding.pry\n require 'net/http'\n result = Net::HTTP.get('makesys.net', '/')\n p result\n end", "def devices\n response = get('/listDevices')\n devices = []\n response.body['devices'].each do |d|\n devices << Device.from_json(d, @token, @logger)\n end\n devices\n end", "def get_all(options = {})\n custom_params = options[:dc] ? use_named_parameter('dc', options[:dc]) : nil\n ret = send_get_request(@conn, ['/v1/catalog/services'], options, custom_params)\n OpenStruct.new JSON.parse(ret.body)\n end", "def index\n @sw_devs = SwDev.all\n end", "def index\n @car_specific_specs = CarSpecificSpec.all\n end", "def index\n @device_models = DeviceModel.all\n end", "def drivers\n drivers = (trips.map { |trip| RideShare::Driver.find(trip.driver_id) }).compact\n return drivers.uniq { |driver| driver.id }\n end", "def index\n @devices = Device.all\n render json: @devices\n end", "def index\n# @devices = Device.all\n end", "def initialize\n @drivers = []\n end", "def show\n @driver_record = DriverRecord.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver_record }\n end\n end", "def users\n get('get_users')\n end", "def index\n @providerservices = Providerservice.all\n end", "def vendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end", "def index\n @car_manufacturers = CarManufacturer.all\n end", "def doors\n sample(fetch_all('vehicle.doors'))\n end", "def index\n respond_with Serial.all\n end", "def index\n @vehicles = Vehicle.available\n .not_from_current_user(current_user)\n .eager_load(images_attachments: :blob)\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "def get_all_uuids\n ble_uuids = Hardware.all_ble_uuids.map { |hw| hw.identifier }\n \n render :status => 200, :json => { :uuids => ble_uuids }\n end" ]
[ "0.806816", "0.7644135", "0.7608629", "0.7608629", "0.7310645", "0.7310645", "0.6930903", "0.68031263", "0.6726312", "0.66509604", "0.66329265", "0.66294885", "0.6587495", "0.647506", "0.6416417", "0.6406127", "0.63996077", "0.6201205", "0.6196208", "0.61698735", "0.609954", "0.60657567", "0.605806", "0.6056653", "0.605349", "0.60508245", "0.59962845", "0.59962845", "0.59797525", "0.5883654", "0.5869402", "0.58509564", "0.58509564", "0.58509564", "0.5801633", "0.5799187", "0.5793521", "0.57931435", "0.5744266", "0.5744266", "0.5744266", "0.5744266", "0.5744266", "0.57357824", "0.57094014", "0.57088184", "0.5686974", "0.5684744", "0.56794167", "0.5677089", "0.5656817", "0.5633846", "0.5620861", "0.5614054", "0.5613676", "0.56051683", "0.5595945", "0.5586614", "0.5582923", "0.55751854", "0.55729336", "0.5561854", "0.556072", "0.55390096", "0.55339164", "0.55337644", "0.552712", "0.5523276", "0.5512007", "0.55108666", "0.5510152", "0.54977685", "0.54942673", "0.5476757", "0.5475721", "0.5475404", "0.54533464", "0.5446197", "0.5443032", "0.54369533", "0.543", "0.5425674", "0.54169303", "0.54120576", "0.5410922", "0.5408548", "0.54078263", "0.53989977", "0.53844196", "0.5378426", "0.53697133", "0.5368659", "0.5367465", "0.5357076", "0.5354858", "0.5350105", "0.53427196", "0.5336597", "0.53357947", "0.53343403" ]
0.73684937
4
GET /drivers/:id return's a drivers' json representation
def show respond_with Driver.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end", "def show\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end", "def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end", "def index\n @drivers = Driver.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end", "def show\n # Show one record\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver }\n end\n end", "def get_driver_details\n @resource = Resource.find(params[:id])\n @driver = Driver.find(AgencyStore.find_by_resource_id(params[:id]).driver_id)\n render :layout => false\n end", "def driver(driver_id)\n from_resource(\n :driver,\n connection.get(api_uri(\"drivers/#{driver_id}\"))\n )\n end", "def show\n @driver_record = DriverRecord.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver_record }\n end\n end", "def get_drivers\n return return_all_drivers\n end", "def get_drivers\n drivers\n end", "def find_driver(id)\n return find_by_id(@drivers, id)\n end", "def index\n @drivers = Driver.all\n end", "def index\n @drivers = Driver.all\n end", "def show\n @driver_license_type = (DriverLicenseType.find_by_sql 'SELECT * FROM driver_license_type WHERE id = ' + params[:id])[0]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @driver_license_type }\n end\n end", "def index\n\t\t\t\trespond_with Driver.all\n\t\t\tend", "def driver_info\n return Rideshare::Driver.find(@driver_id)\n end", "def index\n # Show all records\n @drivers = Driver.search(params[:search], params[:column]).order(sort_column(Driver, 'name') + ' ' + sort_direction).page(params[:page]).per(10)\n \n get_params()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drivers }\n end\n end", "def details\n options = {}\n # include=driver\n # fields[driver]=average_rating\n if params[:fields]\n driver_fields = params[:fields].permit(:driver).to_h.\n inject({}) { |h, (k,v)| h[k.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: driver_fields)\n end\n\n # multiple associated resources are comma-separated\n if params[:include]\n options[:include] = params[:include].split(\",\").map(&:to_sym)\n end\n\n @trip = Trip.includes(:driver).find_by(id: params[:id])\n\n render json: TripSerializer.new(@trip, options).serializable_hash\n end", "def get_with_http_info(policy_activity_id, driver_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DriversApi.get ...'\n end\n # verify the required parameter 'policy_activity_id' is set\n if @api_client.config.client_side_validation && policy_activity_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_activity_id' when calling DriversApi.get\"\n end\n # verify the required parameter 'driver_id' is set\n if @api_client.config.client_side_validation && driver_id.nil?\n fail ArgumentError, \"Missing the required parameter 'driver_id' when calling DriversApi.get\"\n end\n # resource path\n local_var_path = '/v1/policy_activities/{policyActivityId}/drivers/{driverId}'.sub('{' + 'policyActivityId' + '}', policy_activity_id.to_s).sub('{' + 'driverId' + '}', driver_id.to_s)\n\n # query parameters\n 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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Bearer']\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 => 'Driver')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DriversApi#get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_driverslist\n @driverslist = Driverslist.find(params[:id])\n end", "def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end", "def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end", "def get_drvies_with_http_info(year, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DrivesApi.get_drvies ...'\n end\n # verify the required parameter 'year' is set\n if @api_client.config.client_side_validation && year.nil?\n fail ArgumentError, \"Missing the required parameter 'year' when calling DrivesApi.get_drvies\"\n end\n # resource path\n local_var_path = '/drives'\n\n # query parameters\n query_params = {}\n query_params[:'year'] = year\n query_params[:'seasonType'] = opts[:'season_type'] if !opts[:'season_type'].nil?\n query_params[:'week'] = opts[:'week'] if !opts[:'week'].nil?\n query_params[:'team'] = opts[:'team'] if !opts[:'team'].nil?\n query_params[:'offense'] = opts[:'offense'] if !opts[:'offense'].nil?\n query_params[:'defense'] = opts[:'defense'] if !opts[:'defense'].nil?\n query_params[:'conference'] = opts[:'conference'] if !opts[:'conference'].nil?\n query_params[:'offenseConference'] = opts[:'offense_conference'] if !opts[:'offense_conference'].nil?\n query_params[:'defenseConference'] = opts[:'defense_conference'] if !opts[:'defense_conference'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Drive>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DrivesApi#get_drvies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(vendor_id)\n @client.get(\"/#{@model}/#{vendor_id}\")\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end", "def pending_drivers\n users = User.needing_driver_verification\n render :json => users, each_serializer: SlimPendingDriverSerializer, root: false, status: 200\n end", "def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end", "def drivers()\n self.rides().map { | ride | ride.driver }\n end", "def trip_get_driver(driver_id)\n RideShare::Driver.find(driver_id)\n end", "def show\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_driver }\n end\n end", "def index\n @driverslists = Driverslist.all\n end", "def drivers\n rides.map { |ride| ride.driver }\n end", "def index\n hardware = Hardware.all\n render json: hardware.to_json(:except => [:id])\n end", "def create\n\t\t\t\trespond_with Driver.create(params[:driver])\n\t\t\tend", "def driver\n @data[\"driver\"]\n end", "def drivers\n @drivers ||= ActiveSupport::HashWithIndifferentAccess.new\n end", "def get_all_with_http_info(policy_activity_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DriversApi.get_all ...'\n end\n # verify the required parameter 'policy_activity_id' is set\n if @api_client.config.client_side_validation && policy_activity_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_activity_id' when calling DriversApi.get_all\"\n end\n # resource path\n local_var_path = '/v1/policy_activities/{policyActivityId}/drivers'.sub('{' + 'policyActivityId' + '}', policy_activity_id.to_s)\n\n # query parameters\n 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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<DriverSummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DriversApi#get_all\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end", "def show\n\t\t@river = River.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @river }\n\t\tend\n\tend", "def find_asset_json\n res = Asset.find(@params['id'])\n render :string => res.to_json, :content_type => \"application/json\", :layout => false\n end", "def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end", "def drivers\n send :adapters\n end", "def driver_params\n json_api_params(Driver,[:first_name,:last_name,:phone_no,:plant_id, :user_id,:enabled]).fetch(:attributes, {})\n end", "def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end", "def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end", "def index\n respond_with ApidDriver.all\n end", "def show\n respond_with ApidDriver.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n respond_with nil\n end", "def show\n @route = Route.find(params[:id])\n @driver = Hitchhiker.find(@route.hitchhiker_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\n end\n end", "def create\n @driver = Driver.new(driver_params)\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render action: 'show', status: :created, location: @driver }\n else\n format.html { render action: 'new' }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def show\n render json: @vehicle\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def show\n @bluetooth = Bluetooth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bluetooth }\n end\n end", "def new\n @driver_record = DriverRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @driver_record }\n end\n end", "def index\n @drivers_licesnses = DriversLicesnse.all\n end", "def set_driver\n cities = City.find(params[:city_id])\n @drivers = cities.drivers.find(params[:id])\n end", "def list_inventors\n json_out(Inventor.all)\n end", "def list_inventors\n json_out(Inventor.all)\n end", "def return_all_drivers\n return @trips.map{ |trip| trip.driver }\n end", "def new\n @driver = Driver.new(:event_id => params[:event_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @driver }\n end\n end", "def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end", "def index\n redirect_to search_drivers_path unless current_user and current_user.is_admin\n @drivers = Driver.all\n end", "def drink\n @drinks = Item.select {|k,v| k.product_type_id == 4 }\n \n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @drinks, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end", "def getDriver\n @driver\n end", "def getDriver\n @driver\n end", "def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end", "def show\n @distro = Distro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @distro }\n end\n end", "def get(id)\n record = @dao.read(id)\n record_to_vehicle(record)\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end", "def index\n @devices = Device.all.includes(:browsers)\n json_response(@devices, :ok, [:browsers])\n end", "def hired\n authorize current_company, :index?\n @drivers = current_company.hired_drivers.distinct\n @drivers = @drivers.page(params[:page]).per(10)\n end", "def get_info(id)\n url = \"http://www.omdbapi.com/?i=#{id}&y=&plot=short&r=json\"\n return_result(url)\n end", "def update\n\t\t\t\trespond_with Driver.update(params[:id],params[:driver])\n\t\t\tend", "def index\n @ride_drivers = RideDriver.all\n end", "def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end", "def list_inventors\n \tjson_out(Inventor.all)\n\tend", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end", "def show\n render json: @car\n end", "def index\n @cars = Car.all\n render json: @cars\n end", "def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end", "def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end", "def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end", "def add_drivers params\n @driver_hash = JSON.parse(params)\n\n @driver_hash['drivers'].each do |driver|\n add_driver(driver[\"id\"],driver[\"location\"])\n end\n true\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def index\n @references_vehicle_drivers = ReferencesVehicleDriver.all\n end", "def destroy\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def create\n # Logic to create a driver and submit to DB\n @driver = Driver.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_all_0_with_http_info(policy_activity_id, status, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DriversApi.get_all_0 ...'\n end\n # verify the required parameter 'policy_activity_id' is set\n if @api_client.config.client_side_validation && policy_activity_id.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_activity_id' when calling DriversApi.get_all_0\"\n end\n # verify the required parameter 'status' is set\n if @api_client.config.client_side_validation && status.nil?\n fail ArgumentError, \"Missing the required parameter 'status' when calling DriversApi.get_all_0\"\n end\n # resource path\n local_var_path = '/v1/policy_activities/{policyActivityId}/drivers/{status}'.sub('{' + 'policyActivityId' + '}', policy_activity_id.to_s).sub('{' + 'status' + '}', status.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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Bearer']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<DriverSummary>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DriversApi#get_all_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def display_driver\n { name: (driver.user.name rescue driver_id), balance: participants[driver_id][:balance].round(1) }\n end", "def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end" ]
[ "0.72570795", "0.72570795", "0.7071967", "0.7071967", "0.6829991", "0.67943954", "0.6768278", "0.67272097", "0.66713405", "0.6607007", "0.64849", "0.62655693", "0.62655693", "0.6240598", "0.61354756", "0.6119288", "0.61132914", "0.5988234", "0.5903166", "0.5859592", "0.5840956", "0.58131814", "0.5792331", "0.5785534", "0.5785426", "0.57848907", "0.5774813", "0.568467", "0.5679343", "0.56712776", "0.5666208", "0.5652975", "0.56449616", "0.5630074", "0.56229573", "0.56082505", "0.5588595", "0.55780643", "0.55752707", "0.55601484", "0.554839", "0.55429333", "0.55265915", "0.54690105", "0.5455328", "0.54513305", "0.5447604", "0.54176795", "0.5407799", "0.53955966", "0.53955966", "0.53955966", "0.53955966", "0.53928834", "0.5390963", "0.5390963", "0.5389182", "0.5385998", "0.5383856", "0.5381724", "0.5359043", "0.53586763", "0.53446126", "0.53446126", "0.53275496", "0.53160685", "0.5310423", "0.53095794", "0.53037", "0.5302993", "0.5302993", "0.52964586", "0.52964586", "0.52894765", "0.52731067", "0.5266085", "0.5265249", "0.52603096", "0.525785", "0.52384096", "0.5232537", "0.52314526", "0.52194977", "0.5214576", "0.5210363", "0.5206852", "0.52002615", "0.5199676", "0.5196359", "0.5195569", "0.5194742", "0.5191194", "0.5185381", "0.5180214", "0.51779145", "0.5177051", "0.5176324", "0.5175653", "0.51738095", "0.5167875" ]
0.6789124
6
POST /drivers creates a new driver
def create respond_with Driver.create(params[:driver]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # Logic to create a driver and submit to DB\n @driver = Driver.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver = Driver.new(driver_params)\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render action: 'show', status: :created, location: @driver }\n else\n format.html { render action: 'new' }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver = Driver.create(driver_params)\n @user = current_user\n @driver.set_user!(current_user)\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver = Driver.new(driver_params)\n respond_to do |format|\n if @driver.save\n login_driver @driver\n format.html { redirect_to @driver, notice: \"Welcome #{@driver.name.upcase}. Your account was successfully created\" }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @car = Car.find(params[:car_id])\n @driver = @car.drivers.create(params[:driver])\n redirect_to car_path(@car)\n end", "def create\n @driver_record = DriverRecord.new(params[:driver_record])\n respond_to do |format|\n if @driver_record.save\n format.html { redirect_to @driver_record, notice: 'Driver record was successfully created.' }\n format.json { render json: @driver_record, status: :created, location: @driver_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if current_user\n @driver = Driver.new(driver_params)\n @driver.role = 1\n @driver.enterprise = current_user\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to enterprise_drivers_path, notice: 'Driver was successfully created.' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to enterprise_drivers_path, alert: 'Debes completar tu perfil antes de crear Conductores!'\n end\n end", "def create_driver name\n\t\tdriver = Driver.new name\n\t\t@drivers[driver.name] = driver\n\t\tdriver\t\t\n\tend", "def driver_params\n params.require(:driver).permit(:driver_name, :driver_id, :driver_dob, :driver_address, :email, :phone_number, :trailer_capacity, :image)\n end", "def create\n @driver = @event.drivers.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n\n for i in [email protected] do\n @waitlistrider = @event.riders.find_by_waitlist(true)\n @waitlistrider.update_driver(@driver.id) if @waitlistrider\n @waitlistrider.update_waitlist if @waitlistrider\n end\n\n @driver.update_full\n\n format.html { redirect_to [@event, @driver], notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:name, :email, :phone, :location, :service_type, :password, :password_confirmation)\n end", "def driver_params\n params.require(:driver).permit(:name, :tel, :car_number)\n end", "def create\n @references_vehicle_driver = ReferencesVehicleDriver.new(references_vehicle_driver_params)\n\n respond_to do |format|\n if @references_vehicle_driver.save\n @dato = ReferencesVehicleDriver.last\n @dato.token = @dato.driver_id.to_s + @dato.VehiclePerUsuario_id.to_s + @dato.driver.identityCard.to_s\n @dato.save\n format.html { redirect_to profile_index_path, notice: 'References vehicle driver was successfully created.' }\n format.json { render :show, status: :created, location: @references_vehicle_driver }\n else\n format.html { render :new }\n format.json { render json: @references_vehicle_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_with :api,:v1, ApidDriver.create_or_update(params[:apid_driver])\n end", "def driver_params\n params.require(:driver).permit(:name, :age, :city_id, :company_id)\n end", "def create\n\t\t\t\tcurrent_driver.create_car(car_params)\n\t\t\tend", "def new_driver\n address = params[:newdriveraddress]\n\n coordinates = GoogleAPIGeocoder.do_geocode(address)\n\n if coordinates.nil?\n render json: {success: false, travellers: session[:travellers].to_json, msg: 'Unable to find the location of the given address for the new driver. Please check that it is correct.'}\n else\n driver = Driver.create(name: params[:newdrivername],\n email: params[:newdriveremail],\n address: address,\n number_of_passengers: params[:newdrivernumber_of_passengers],\n latitude: coordinates[0],\n longitude: coordinates[1])\n\n unless session[:travellers].nil?\n session[:travellers] << driver\n else\n travellers = []\n travellers << driver\n session[:travellers] = travellers\n end\n\n if current_user.nil? && !session[:trip].nil?\n session[:trip].travellers << driver\n end\n\n render json: session[:travellers].to_json\n end\n end", "def create\n @driver_profile = DriverProfile.new(driver_profile_params)\n\n respond_to do |format|\n if @driver_profile.save\n format.html { redirect_to @driver_profile, notice: 'Driver profile was successfully created.' }\n format.json { render :show, status: :created, location: @driver_profile }\n post_request\n else\n flash[:error] = \"#{@driver_profile.errors.full_messages.to_sentence}\"\n format.html { render :new }\n format.json { render json: @driver_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:user_id, :registration_number, :car_info)\n end", "def create\n @driver_log = DriverLog.new(driver_log_params)\n\n respond_to do |format|\n if @driver_log.save\n format.html { redirect_to @driver_log, notice: 'Driver log was successfully created.' }\n format.json { render :show, status: :created, location: @driver_log }\n else\n format.html { render :new }\n format.json { render json: @driver_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:badge, :name)\n end", "def create\n @trip_driver = TripDriver.new(trip_driver_params)\n\n respond_to do |format|\n if @trip_driver.save\n format.html { redirect_to @trip_driver, notice: 'Trip driver was successfully created.' }\n format.json { render json: @trip_driver, status: :created, location: @trip_driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:CNP, :FIRSTNAME, :SECONDNAME, :StartDate, :EndDate, :INFO, :DESCRIPTION, :active, images: [])\n end", "def create\n @driver_division = DriverDivision.new(driver_division_params)\n\n respond_to do |format|\n if @driver_division.save\n format.html { redirect_to @driver_division, notice: 'Driver division was successfully created.' }\n format.json { render action: 'show', status: :created, location: @driver_division }\n else\n format.html { render action: 'new' }\n format.json { render json: @driver_division.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver = Driver.new(driver_params)\n @driver.user_id = current_user.id\n\n url = \"https://dvlasearch.appspot.com/DvlaSearch?apikey=#{Rails.application.credentials.dvla[:dvla_api_key]}&licencePlate=#{@driver.registration_number}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n @hash = JSON.parse(response)\n\n if @hash.key?(\"make\")\n @driver.car_info = @hash[\"colour\"] + \" \" + @hash[\"make\"] + \" \" + @hash[\"model\"]\n else\n @driver.car_info = \"Registration number not linked to vehicle!!!\"\n end\n\n @driver.registration_number.upcase!\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Car information registered successfully!' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n event = Event.find(params[:event_id])\n @driver = @current_user.drivers.build(params[:driver])\n @driver.event = event\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to event_url(@driver.event),\n notice: 'Driver was successfully allocated.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n expire_fragment \"event-#{@driver.event.id}\"\n end", "def create\n @driverslist = Driverslist.new(driverslist_params)\n\n respond_to do |format|\n if @driverslist.save\n format.html { redirect_to @driverslist, notice: 'Driverslist was successfully created.' }\n format.json { render :show, status: :created, location: @driverslist }\n else\n format.html { render :new }\n format.json { render json: @driverslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver_license_type = DriverLicenseType.new(params[:driver_license_type])\n\n respond_to do |format|\n if @driver_license_type.save\n format.html { redirect_to @driver_license_type, notice: 'Driver license type was successfully created.' }\n format.json { render json: @driver_license_type, status: :created, location: @driver_license_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver_license_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drivers_licesnse = DriversLicesnse.new(drivers_licesnse_params)\n\n respond_to do |format|\n if @drivers_licesnse.save\n format.html { redirect_to @drivers_licesnse, notice: 'Drivers licesnse was successfully created.' }\n format.json { render :show, status: :created, location: @drivers_licesnse }\n else\n format.html { render :new }\n format.json { render json: @drivers_licesnse.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:license_plate_number)\n end", "def driver_params\n params.fetch(:driver).permit(:image, :rut, :password, :email, :name, :lastname, :surname,:address, :commune, :state, :city, :country, :phone, :school, :work_child, :type_driver_license, :info_emergency, :enterprise_id)\n end", "def create_trip trip, driver_name\n\t\tif @drivers.has_key? driver_name\t\t\t\n\t\t\t@drivers[driver_name].add_trip trip\n\t\telse\n\t\t\tputs \"No driver #{driver_name} registered, created a new driver\"\n\t\t\tdriver = self.create_driver driver_name\n\t\t\tdriver.add_trip trip\n\t\tend\t\n\tend", "def create\n @driver = Driver.new(driver_params)\n\n if @driver.images.count>0\n @driver.images.attach(params[:driver][:images])\n end\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Driver was successfully created.' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @driver = Driver.new(:event_id => params[:event_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @driver }\n end\n end", "def driver_params\n params.require(:driver).permit(:name,:last_name,:user,:password, :password_confirmation,:email,:city_id, :picture)\n end", "def create\n @driver_application = DriverApplication.new(driver_application_params)\n \n # Always get the current time to save\n @driver_application.created_at = DateTime.current\n\n respond_to do |format|\n if @driver_application.save\n format.html { redirect_to @driver_application, notice: 'Driver application was successfully created.' }\n format.json { render :show, status: :created, location: @driver_application }\n else\n format.html { render :new }\n format.json { render json: @driver_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @route = Route.new(route_params)\n @route.driver_id = @driver.id\n respond_to do |format|\n if @route.save\n format.html { redirect_to driver_path(@route.driver_id ), notice: 'Route was successfully created.' }\n format.json { render :show, status: :created, location: @route }\n else\n format.html { render :new }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @driver_record = DriverRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @driver_record }\n end\n end", "def set_driver\n id = params[:driver_id] || params[:id]\n @driver = Driver.find_by(id: id)\n end", "def create\n @driver_journey = DriverJourney.new(driver_journey_params)\n\n respond_to do |format|\n if @driver_journey.save\n format.html { redirect_to journeys_path, notice: 'Driver journey was successfully created.' }\n format.json { render action: 'show', status: :created, location: @driver_journey }\n else\n format.html { render action: 'new' }\n format.json { render json: @driver_journey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n HTTParty.post(create_url, :options => { :headers => HEADERS })\n end", "def add_drivers params\n @driver_hash = JSON.parse(params)\n\n @driver_hash['drivers'].each do |driver|\n add_driver(driver[\"id\"],driver[\"location\"])\n end\n true\n end", "def create\n @device.browsers.create!(browser_params)\n json_response(@device, :created)\n end", "def new\n @driver = User.new\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def driverslist_params\n params.require(:driverslist).permit(:name)\n end", "def create\n @driver_trip_seat = DriverTripSeat.new(driver_trip_seat_params)\n\n respond_to do |format|\n if @driver_trip_seat.save\n format.html { redirect_to @driver_trip_seat, notice: 'Driver trip seat was successfully created.' }\n format.json { render :show, status: :created, location: @driver_trip_seat }\n else\n format.html { render :new }\n format.json { render json: @driver_trip_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts \"ORDERPARAMS\"\n @order = Order.new(order_params)\n puts \"ORDER\"\n puts \"#{@order}\"\n @order.driver = Driver.new(:stock_cheap => 2,\n :stock_classy => 3,\n :phone => 8675309)\n respond_to do |format|\n if @order.save\n if @order.member.nil?\n format.html { redirect_to new_member_registration_path, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order } \n else\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order } \n end\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_firmware_driver_distributable_with_http_info(firmware_driver_distributable, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FirmwareApi.create_firmware_driver_distributable ...'\n end\n # verify the required parameter 'firmware_driver_distributable' is set\n if @api_client.config.client_side_validation && firmware_driver_distributable.nil?\n fail ArgumentError, \"Missing the required parameter 'firmware_driver_distributable' when calling FirmwareApi.create_firmware_driver_distributable\"\n end\n # resource path\n local_var_path = '/api/v1/firmware/DriverDistributables'\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'])\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 header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_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(firmware_driver_distributable)\n\n # return_type\n return_type = opts[:debug_return_type] || 'FirmwareDriverDistributable'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"FirmwareApi.create_firmware_driver_distributable\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FirmwareApi#create_firmware_driver_distributable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @ride = Ride.new(driver_ride_params.merge(\n driver: current_user,\n created_by: current_user,\n notification_subscriptions: [RideNotificationSubscription.new(\n user: current_user,\n app: :driver\n )],\n ))\n\n respond_to do |format|\n if @ride.save\n format.html { redirect_to driver_ride_path(@ride),\n notice: 'Ride was successfully created.' }\n format.json { render :show, status: :created, location: @ride }\n else\n format.html { render :new }\n format.json { render json: @ride.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render json: @vendor, status: :created, location: @vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t\t\t@review = DriverReview.new(create_driver_review_params)\n\t\t\t\[email protected]_id = @request.driver_id\n\t\t\t\t# render_invalid_action(@review) unless @review.save\n\t\t\t\[email protected]!\n\t\t\t\tlogger.debug @review.errors.messages\t\t\t\t\n\t\t\tend", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def create\n @firmware = Firmware.new(firmware_params)\n\n respond_to do |format|\n if @firmware.save\n format.json { render json: {\n status: \"ok\"\n },\n status: :ok\n }\n else\n format.html { render :new }\n format.json { render json: @firmware.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @device = Device.create!(device_params)\n json_response(@device, :created)\n end", "def create\n @software = Software.new(software_params)\n\n respond_to do |format|\n if @software.save\n format.html { redirect_to @software, notice: 'Software was successfully created.' }\n format.json { render :show, status: :created, location: @software }\n else\n format.html { render :new }\n format.json { render json: @software.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @drive_system = DriveSystem.new(params[:drive_system])\n @drive_system.truck_id = @drive_system.driver.truck_id\n respond_to do |format|\n if @drive_system.save\n format.html { redirect_to @drive_system, notice: 'Drive system was successfully created.' }\n format.json { render json: @drive_system, status: :created, location: @drive_system }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drive_system.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shipment = Shipment.new(shipment_params)\n @shipment.purchase_order = PurchaseOrder.new(grand_total: 0, shipping: 0, sub_total: 0)\n @driver = nil\n if !(params[:shipment][:drivers].nil?)\n params[:shipment][:drivers].each do |d|\n @driver = Employee.find_by(id: d.to_i)\n @shipment.drivers << @driver\n end\n end\n respond_to do |format|\n if @shipment.save\n format.html { redirect_to @shipment, notice: 'Shipment was successfully created.' }\n format.json { render :show, status: :created, location: @shipment }\n else\n format.html { render :new }\n format.json { render json: @shipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_device(serial)\n res = @client.post(\"#{path}/devices\", nil, { serial: serial }, \"Content-Type\" => \"application/json\")\n Device.new(@client, res.json) if res.success?\n end", "def driver_params\n params.permit(:school_id, :username, :password, :vehicle_id)\n end", "def create(params = {})\n submit(base_url, :post, params)\n end", "def handle_driver_command input_params\n\t\tunless input_params[1].nil?\n\t\t\tdriver_name = input_params[1]\n\t\t\tself.create_driver driver_name\t\t\t\n\t\telse \n\t\t\traise ArgumentError, \"Driver command requires a driver name\" \n\t\tend\n\tend", "def create\n @gymnasium = Gymnasium.new(params[:gymnasium])\n\n respond_to do |format|\n if @gymnasium.save\n format.html { redirect_to @gymnasium, notice: 'Gymnasium was successfully created.' }\n format.json { render json: @gymnasium, status: :created, location: @gymnasium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gymnasium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_driver(name)\n path = File.expand_path(DIR + '/' + WSDL_PATHS[name])\n wsdl = SOAP::WSDLDriverFactory.new(path)\n driver = wsdl.create_rpc_driver\n # /s+(1000|0|9c9|fcc)\\s+/ => \"\"\n driver.wiredump_dev = STDOUT if @debug\n \n driver\n end", "def create\n @major = Major.new(params[:major])\n\n respond_to do |format|\n if @major.save\n format.html { redirect_to @major, notice: 'Major was successfully created.' }\n format.json { render json: @major, status: :created, location: @major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor = Vendor.new(vendor_params)\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render :show, status: :created, location: @vendor }\n else\n format.html { render :new }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wireless_router = WirelessRouter.new(wireless_router_params)\n\n respond_to do |format|\n if @wireless_router.save\n format.html { redirect_to @wireless_router, notice: 'Wireless router was successfully created.' }\n format.json { render :show, status: :created, location: @wireless_router }\n else\n format.html { render :new }\n format.json { render json: @wireless_router.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_driver(_conf = APPLICATION_DEFAULT_CONFIG, _tag = 'test')\n _undefined\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def driver(driver_id)\n from_resource(\n :driver,\n connection.get(api_uri(\"drivers/#{driver_id}\"))\n )\n end", "def create\n make_create_request\n end", "def references_vehicle_driver_params\n params.require(:references_vehicle_driver).permit(:driver_id, :usuario_id, :VehiclePerUsuario_id, :fechaInicio, :fechaFin, :commission, :token, :description)\n end", "def create\n @scanner = Scanner.new(params[:scanner])\n\n respond_to do |format|\n if @scanner.save\n format.html { redirect_to @scanner, notice: 'Scanner was successfully created.' }\n format.json { render json: @scanner, status: :created, location: @scanner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scanner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @device = Device.new(device_params)\n\n # write device to database\n if @device.save\n redirect_to devices_path, :notice => 'Gerät erfolgreich erstellt.'\n else\n render 'new'\n end\n end", "def create\n @hardware = Hardware.new(permitted_params[:hardware])\n params[:hardware]\n\n respond_to do |format|\n if @hardware.save\n format.html { redirect_to @hardware, notice: 'Hardware was successfully created.' }\n format.json { render :show, status: :created, location: @hardware }\n else\n format.html { render :new }\n format.json { render json: @hardware.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @major = Major.new(major_params)\n\n respond_to do |format|\n if @major.save\n format.html { redirect_to @major, notice: 'Major was successfully created.' }\n format.json { render :show, status: :created, location: @major }\n else\n format.html { render :new }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params = {})\n rest_request(:post, \"#{self.class.base_url}api/v2/devices\", payload: query_params.merge(params))\n true\n end", "def create\n @software_test = SoftwareTest.new(params[:software_test])\n\n respond_to do |format|\n if @software_test.save\n format.html { redirect_to @software_test, notice: 'Software test was successfully created.' }\n format.json { render json: @software_test, status: :created, location: @software_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @software_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ethers, new_ethers = process_ethers(params[:asset])\n @asset = WirelessDevice.new(params[:asset])\n asset_create('wireless_item', wireless_url, ethers, new_ethers)\n end", "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def driver_division_params\n params.require(:driver_division).permit(:name)\n end", "def create\n @device_type = DeviceType.new(device_type_params)\n\n respond_to do |format|\n if @device_type.save\n format.html { redirect_to browse_url(protocol: redirect_protocol), notice: 'Device type was successfully created.' }\n format.json { render :show, status: :created, location: @device_type }\n else\n format.html { render :new }\n format.json { render json: @device_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bluetooth = Bluetooth.new(params[:bluetooth])\n\n respond_to do |format|\n if @bluetooth.save\n format.html { redirect_to @bluetooth, :notice => 'Bluetooth was successfully created.' }\n format.json { render :json => @bluetooth, :status => :created, :location => @bluetooth }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @bluetooth.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @drives = Drives.new(params[:drives])\n\n respond_to do |format|\n if @drives.save\n flash[:notice] = 'Drives was successfully created.'\n format.html { redirect_to(@drives) }\n format.xml { render :xml => @drives, :status => :created, :location => @drives }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @drives.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @specie = Specie.new(params[:specie])\n\n respond_to do |format|\n if @specie.save\n format.html { redirect_to @specie, notice: 'Specie was successfully created.' }\n format.json { render json: @specie, status: :created, location: @specie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle_class = VehicleClass.new(params[:vehicle_class])\n\n respond_to do |format|\n if @vehicle_class.save\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully created.' }\n format.json { render json: @vehicle_class, status: :created, location: @vehicle_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tracker = Tracker.new(tracker_params)\n\n if @tracker.save\n render json: @tracker, status: :created, location: @tracker\n else\n render json: @tracker.errors, status: :unprocessable_entity\n end\n end", "def create(params = {})\n http_helper.send_post_request(\"#{@url_prefix}/create\", params)\n end", "def destroy\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def create\n @hardware = Hardware.new(params[:hardware])\n\n respond_to do |format|\n if @hardware.save\n format.html { redirect_to @hardware, :notice => 'Hardware was successfully created.' }\n format.json { render :json => @hardware, :status => :created, :location => @hardware }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @hardware.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @hydraulic_system = HydraulicSystem.new(params[:hydraulic_system])\n @hydraulic_system.truck_id = @hydraulic_system.driver.truck_id\n respond_to do |format|\n if @hydraulic_system.save\n format.html { redirect_to @hydraulic_system, notice: 'Hydraulic system was successfully created.' }\n format.json { render json: @hydraulic_system, status: :created, location: @hydraulic_system }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hydraulic_system.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scanner = Scanner.new(scanner_params)\n\n respond_to do |format|\n if @scanner.save\n\n format.html { redirect_to @scanner, notice: 'Scanner was successfully created.' }\n format.json { render :show, status: :created, location: @scanner }\n else\n format.html { render :new }\n format.json { render json: @scanner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @major = Major.new(major_params)\n\n respond_to do |format|\n if @major.save\n format.html { redirect_to @major, notice: 'Major was successfully created.' }\n format.json { render action: 'show', status: :created, location: @major }\n else\n format.html { render action: 'new' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @wireless.save\n format.html { redirect_to wirelesses_path, notice: 'Rede Wireless criada com sucesso.' }\n format.json { render :index, status: :created, location: @wireless }\n else\n format.html { render :new }\n format.json { render json: @wireless.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(params = {})\n wrapped_params = { carrier_account: params }\n\n # For UPS and FedEx the endpoint is different\n create_url = if CUSTOM_WORKFLOW_CARRIER_TYPES.include?(params[:type])\n 'carrier_accounts/register'\n else\n 'carrier_accounts'\n end\n\n @client.make_request(:post, create_url, MODEL_CLASS, wrapped_params)\n end" ]
[ "0.80963695", "0.7903493", "0.745262", "0.71485156", "0.7124628", "0.68511593", "0.6764259", "0.6659659", "0.66482055", "0.6624501", "0.65894634", "0.6589225", "0.6576972", "0.647909", "0.6477127", "0.64479893", "0.6404491", "0.6393748", "0.6335406", "0.62975055", "0.6273164", "0.6266037", "0.62561834", "0.6254651", "0.6161834", "0.6160702", "0.61564445", "0.6151995", "0.61278415", "0.6095552", "0.6017732", "0.5976668", "0.59412336", "0.5917269", "0.5915678", "0.5893612", "0.58332473", "0.5820945", "0.58100677", "0.57722586", "0.5763761", "0.57610095", "0.57419467", "0.5656076", "0.5608734", "0.5608734", "0.56050956", "0.56050956", "0.56050956", "0.56050956", "0.5600048", "0.55854917", "0.55819273", "0.5548256", "0.5528089", "0.5528044", "0.5526049", "0.551227", "0.5509007", "0.55000246", "0.5480897", "0.54772085", "0.5472312", "0.54374665", "0.5437087", "0.54161197", "0.5415282", "0.5406293", "0.5353849", "0.53367054", "0.53342885", "0.53244394", "0.53228486", "0.5304206", "0.5298557", "0.52980274", "0.5292333", "0.52755463", "0.52754736", "0.52716935", "0.52703166", "0.526653", "0.52580273", "0.52548033", "0.52505255", "0.52425104", "0.5237753", "0.5235745", "0.523414", "0.5234124", "0.52301633", "0.52297306", "0.52289885", "0.52223194", "0.5221234", "0.5213621", "0.5212939", "0.52122283", "0.5207081", "0.5199243" ]
0.8011972
1
PUT /drivers/:id updates the driver with the specified id
def update respond_with Driver.update(params[:id],params[:driver]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # Logic to edit a driver and submit to DB\n @driver = Driver.find(params[:id])\n\n respond_to do |format|\n if @driver.update_attributes(params[:driver])\n format.html { redirect_to @driver, notice: 'Driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@driver = Driver.find(params[:id])\n @driver = @event.drivers.find(params[:id])\n\n respond_to do |format|\n if @driver.update_attributes(params[:driver])\n format.html { redirect_to [@event, @driver], notice: 'Driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @driver.update(driver_params)\n format.html { redirect_to @driver, notice: 'Driver was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver }\n else\n format.html { render :edit }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @driver.update(driver_params)\n format.html { redirect_to @driver, notice: 'Driver was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver }\n else\n format.html { render :edit }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @driver.update(driver_params)\n format.html { redirect_to @driver, notice: 'Driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with ApidDrive.update(params[:id], params[:apid_driver])\n rescue ActiveRecord::RecordNotFound\n respond_with ApidDrive::StateChangeError\n end", "def set_driver\n id = params[:driver_id] || params[:id]\n @driver = Driver.find_by(id: id)\n end", "def update\n @driver_record = DriverRecord.find(params[:id])\n\n respond_to do |format|\n if @driver_record.update_attributes(params[:driver_record])\n format.html { redirect_to @driver_record, notice: 'Driver record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @driver_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def update\n respond_to do |format|\n if @ride_driver.update(ride_driver_params)\n format.html { redirect_to @ride_driver, notice: 'Ride driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ride_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def set_driver\n @driver = Driver.find(params[:id])\n end", "def update\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n if @trip_driver.update_attributes(trip_driver_params)\n format.html { redirect_to @trip_driver, notice: 'Trip driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @driver = Driver.find(params[:id])\n @driver.user = @current_user\n\n respond_to do |format|\n if @driver.update_attributes(params[:driver])\n format.html { redirect_to event_url(@driver.event),\n notice: 'Driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n expire_fragment \"event-#{@driver.event.id}\"\n end", "def set_driver\n cities = City.find(params[:city_id])\n @drivers = cities.drivers.find(params[:id])\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @driver.update(driver_params)\n # @driver.set_location_goride(params[:location])\n format.html { redirect_to @driver, notice: 'Driver was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver }\n else\n format.html { render :edit }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @driverslist.update(driverslist_params)\n format.html { redirect_to @driverslist, notice: 'Driverslist was successfully updated.' }\n format.json { render :show, status: :ok, location: @driverslist }\n else\n format.html { render :edit }\n format.json { render json: @driverslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_driver_details \n\t\tcurrent_user.license_plate = user_params[:license_plate]\n\t\tcurrent_user.car_model = user_params[:car_model]\n\t\tcurrent_user.save!\n\t\trender json: {\n\t\t\tstatus: 'succeess',\n\t\t\tmessage: 'Driver Details Updated!'\n\t\t}, status: 200\n\tend", "def update(attrs)\n attrs.each do |meth, value|\n send(\"#{meth}=\", value)\n end\n @driver.save\n end", "def update(attrs)\n attrs.each do |meth, value|\n send(\"#{meth}=\", value)\n end\n @driver.save\n end", "def update\n @driver_license_type = DriverLicenseType.find(params[:id])\n\n respond_to do |format|\n if @driver_license_type.update_attributes(params[:driver_license_type])\n format.html { redirect_to @driver_license_type, notice: 'Driver license type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @driver_license_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @references_vehicle_driver.update(references_vehicle_driver_params)\n format.html { redirect_to @references_vehicle_driver, notice: 'References vehicle driver was successfully updated.' }\n format.json { render :show, status: :ok, location: @references_vehicle_driver }\n else\n format.html { render :edit }\n format.json { render json: @references_vehicle_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(project_id, id, options)\n @_client.put(\"#{resource_root(project_id)}/#{id}\", options)\n end", "def edit(vendor_id, edit_vendor_params)\n @client.put(\"/#{@model}/#{vendor_id}\", edit_vendor_params)\n end", "def update(id, params = {})\n wrapped_params = { carrier_account: params }\n @client.make_request(:put, \"carrier_accounts/#{id}\", MODEL_CLASS, wrapped_params)\n end", "def update\n car = Car.find params[:id]\n car.update(\n manufacturer: params[:manufacturer],\n model: params[:model],\n engine: params[:engine],\n car_class: params[:car_class],\n image: params[:image]\n )\n\n redirect_to car_path(car.id)\n end", "def update\n if (params[:driver][:password].blank? && params[:driver][:password_confirmation].blank?)\n params[:driver].delete(\"password\")\n params[:driver].delete(\"password_confirmation\")\n end\n respond_to do |format|\n if @driver.update(driver_params)\n format.html { redirect_to enterprise_drivers_path, notice: 'Driver was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver }\n else\n format.html { render :edit }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver(driver_id)\n from_resource(\n :driver,\n connection.get(api_uri(\"drivers/#{driver_id}\"))\n )\n end", "def driver_params\n params.require(:driver).permit(:name, :age, :city_id, :company_id)\n end", "def update(id, details)\n response = fetch({:method => :put, :key => id, :body => details})\n new(response.parsed_response)\n end", "def save_driver\n authorize current_company\n current_company.update_attribute(:saved_drivers_ids, current_company.saved_drivers_ids + [params[:id].to_i])\n flash[:notice] = \"Driver added to saved for later.\"\n redirect_back fallback_location: root_path\n end", "def add_driver id, location\n #return false unless null == @drivers[id]\n\n @drivers.merge!Hash[id, Integer(location)]\n puts(\"Added Driver #{id}, #{location}\")\n true\n end", "def update\n respond_to do |format|\n if @driver.update(driver_params)\n\n url = \"https://dvlasearch.appspot.com/DvlaSearch?apikey=#{Rails.application.credentials.dvla[:dvla_api_key]}&licencePlate=#{@driver.registration_number}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n @hash = JSON.parse(response)\n\n if @hash.key?(\"make\")\n @driver.car_info = @hash[\"colour\"] + \" \" + @hash[\"make\"] + \" \" + @hash[\"model\"]\n else\n @driver.car_info = \"Registration number not linked to vehicle.\"\n end\n\n @driver.registration_number.upcase!\n\n @driver.save!\n\n format.html { redirect_to @driver, notice: 'Details updated successfully.' }\n format.json { render :show, status: :ok, location: @driver }\n else\n format.html { render :edit }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\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\t\t@river = River.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @river.update_attributes(params[:river])\n\t\t\t\tformat.html { redirect_to @river, notice: 'River was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @river.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @driver_division.update(driver_division_params)\n format.html { redirect_to @driver_division, notice: 'Driver division was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @driver_division.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ethers, new_ethers = process_ethers(params[:asset])\n @asset = WirelessDevice.find(params[:id])\n asset_update(params[:asset], wireless_url, ethers, new_ethers)\n end", "def update_service(id, options={})\n self.class.put(\"/services/#{id}.json?apikey=#{apikey}\", :query => {:service => options}, :body => {})\n end", "def set_driverslist\n @driverslist = Driverslist.find(params[:id])\n end", "def set_ride_driver\n @ride_driver = RideDriver.find(params[:id])\n end", "def update\n respond_to do |format|\n if @driver_log.update(driver_log_params)\n format.html { redirect_to @driver_log, notice: 'Driver log was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver_log }\n else\n format.html { render :edit }\n format.json { render json: @driver_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authenticate_request!\n\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "def update_nexus(companyId, id, model)\n path = \"/api/v2/companies/#{companyId}/nexus/#{id}\"\n put(path, model)\n end", "def update\n respond_to do |format|\n if @drivers_licesnse.update(drivers_licesnse_params)\n format.html { redirect_to @drivers_licesnse, notice: 'Drivers licesnse was successfully updated.' }\n format.json { render :show, status: :ok, location: @drivers_licesnse }\n else\n format.html { render :edit }\n format.json { render json: @drivers_licesnse.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_driver(id)\n return find_by_id(@drivers, id)\n end", "def update(model, id, opts = {})\n name = model_name(model)\n do_restful_action(\"update\", name) do\n self.nagyo[\"#{name}/#{URI.encode(id)}/edit\"].put(:format => :js, name => opts)\n end\n end", "def update\n @drives = Drives.find(params[:id])\n\n respond_to do |format|\n if @drives.update_attributes(params[:drives])\n flash[:notice] = 'Drives was successfully updated.'\n format.html { redirect_to(@drives) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @drives.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_card(id, params)\n card = find_card(id)\n if card\n card.update(params)\n save\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n if @vendor.update_attributes(params[:vendor])\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_references_vehicle_driver\n @references_vehicle_driver = ReferencesVehicleDriver.find(params[:id])\n end", "def update\n \n #Always get the current time to update\n @driver_application.updated_at = DateTime.current\n \n respond_to do |format|\n if @driver_application.update(driver_application_params)\n format.html { redirect_to @driver_application, notice: 'Driver application was successfully updated.' }\n format.json { render :show, status: :ok, location: @driver_application }\n else\n format.html { render :edit }\n format.json { render json: @driver_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver = @event.drivers.new(params[:driver])\n\n respond_to do |format|\n if @driver.save\n\n for i in [email protected] do\n @waitlistrider = @event.riders.find_by_waitlist(true)\n @waitlistrider.update_driver(@driver.id) if @waitlistrider\n @waitlistrider.update_waitlist if @waitlistrider\n end\n\n @driver.update_full\n\n format.html { redirect_to [@event, @driver], notice: 'Driver was successfully created.' }\n format.json { render json: @driver, status: :created, location: @driver }\n else\n format.html { render action: \"new\" }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @driver_journey.update(driver_journey_params)\n format.html { redirect_to journeys_path, notice: 'Driver journey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @driver_journey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def set_vehicle(id)\n @vehicle = Vehicle.find(id)\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 @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end", "def update\n\t\t@car = Car.find( params[:id] )\n\t\tif @car.update_attributes( car_params )\n\t\t\tredirect_to car_path( params[:id] )\n\t\tend\n\tend", "def update(id: nil, body: nil)\n perform(:put, \"#{@resource_type}/#{id}\", body)\n end", "def update_deal(id, params)\n put(\"deals/#{id}\", deal: params)\n end", "def update\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "def update\n Rails.logger.debug(\"method=#{request.method}\")\n #replace the Race in the db with supplied values\n race = Race.find(params[:id])\n # # DEBUG: do not chain!! update returns true/false\n race.update(race_params)\n render json: race, status: :ok\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:name, :tel, :car_number)\n end", "def update(entity_id, options)\n API::request(:patch, \"entities/#{entity_id}\", options)\n end", "def set_driver\n return if params[:id] == 'submit_query'\n @driver = Driver.find(params[:id])\n end", "def update_field(id, params = {})\n put(\"/fields/#{id}\", params)\n end", "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def update\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n if @rider.update_attributes(params[:rider])\n format.html { redirect_to @rider, notice: 'Rider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @scanner = Scanner.find(params[:id])\n\n respond_to do |format|\n if @scanner.update_attributes(params[:scanner])\n format.html { redirect_to @scanner, notice: 'Scanner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scanner.errors, status: :unprocessable_entity }\n end\n end\n end", "def driver_params\n params.require(:driver).permit(:driver_name, :driver_id, :driver_dob, :driver_address, :email, :phone_number, :trailer_capacity, :image)\n end", "def update(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :patch, params)\n end", "def set_driver_license\n @driver_license = DriverLicense.find(params[:id])\n end", "def update\n @software = Software.find(params[:id])\n\n respond_to do |format|\n if @software.update_attributes(params[:software])\n format.html { redirect_to(@software, :notice => 'Software was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_driver_profile\n @driver_profile = DriverProfile.find(params[:id])\n end", "def update\n @drive_system = DriveSystem.find(params[:id])\n\n respond_to do |format|\n if @drive_system.update_attributes(params[:drive_system])\n format.html { redirect_to @drive_system, notice: 'Drive system was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @drive_system.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def update(id, params)\n http.put(\"/nfse/#{id}\", { body: params }) do |response|\n respond_with_entity(response)\n end\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update_card_resource(card_id, resource, *paths)\n paths, options = extract_options(camp(resource), *paths)\n put card_path(card_id, *paths), options\n end", "def update id, rssi, status, battery\n unless @sensors[id]\n @sensors[id] = Sensor.new(id)\n end\n @sensors[id].rssi = rssi\n @sensors[id].name = \"GSS_13M_??\"\n @sensors[id].group = \"GSS_13M\"\n @sensors[id].updated_time = Time.now\n @sensors[id].last_press_time = Time.now if status == 1\n @sensors[id].battery = battery\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @ideium = Ideium.find(params[:id])\n\n respond_to do |format|\n if @ideium.update_attributes(params[:ideium])\n format.html { redirect_to @ideium, notice: 'Ideium was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ideium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @software = Software.find(params[:id])\n\n respond_to do |format|\n if @software.update_attributes(params[:software])\n flash[:notice] = 'Software was successfully updated.'\n format.html { redirect_to(@software) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @software.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_vehicle(id, params)\n fleet[id] = RoutificApi::Vehicle.new(id, params)\n end", "def update\n @tech_id = TechId.find(params[:id])\n\n respond_to do |format|\n if @tech_id.update_attributes(params[:tech_id])\n format.html { redirect_to @tech_id, notice: 'Tech was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tech_id.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rate_watcher = RateWatcher.find(params[:id])\n\n respond_to do |format|\n if @rate_watcher.update_attributes(params[:rate_watcher])\n format.html { redirect_to @rate_watcher, notice: 'Rate watcher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rate_watcher.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7231757", "0.7055115", "0.70047665", "0.70047665", "0.6876922", "0.68129957", "0.6519599", "0.6505081", "0.63068277", "0.63068277", "0.63068277", "0.63068277", "0.62743074", "0.625858", "0.61862403", "0.61862403", "0.6139333", "0.60568583", "0.60373247", "0.6037138", "0.5988711", "0.58465934", "0.58234817", "0.5796683", "0.5796683", "0.5738493", "0.57148427", "0.56950927", "0.566457", "0.5658262", "0.56507266", "0.5642026", "0.5617515", "0.5591281", "0.5586476", "0.5580211", "0.55710435", "0.5518085", "0.54889697", "0.54876125", "0.54821736", "0.54499334", "0.54499334", "0.5419371", "0.5414805", "0.53925294", "0.53586316", "0.53566736", "0.53557026", "0.53548926", "0.5354709", "0.5354297", "0.5340095", "0.5339466", "0.5330216", "0.52790195", "0.5263854", "0.5250408", "0.5250408", "0.52466995", "0.52430284", "0.5227339", "0.52066445", "0.5205302", "0.51990646", "0.5185511", "0.51610506", "0.5157929", "0.51528054", "0.5152222", "0.51483184", "0.51467067", "0.5146651", "0.51442605", "0.51442605", "0.51430535", "0.5131168", "0.51250863", "0.5122772", "0.51179343", "0.5114087", "0.51082295", "0.5099669", "0.50978106", "0.5088937", "0.50889206", "0.5087848", "0.5083598", "0.50781006", "0.50671303", "0.50613195", "0.50603646", "0.50571316", "0.50567853", "0.50521624", "0.5050469", "0.5047024", "0.5045706", "0.50426114", "0.5038993" ]
0.7577013
0
DELETE /drivers/:id deletes the driver with the specified id
def destroy respond_with Driver.destroy(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # Logic to delete a record\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url, notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url, notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to drivers_url, notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver_record = DriverRecord.find(params[:id])\n @driver_record.destroy\n\n respond_to do |format|\n format.html { redirect_to driver_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to enterprise_drivers_path(current_user), notice: 'Driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip_driver = TripDriver.find(params[:id])\n @trip_driver.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_drivers_url }\n format.json { head :no_content }\n end\n end", "def delete(vendor_id)\n @client.delete(\"/#{@model}/#{vendor_id}\")\n end", "def destroy\n @driverslist.destroy\n respond_to do |format|\n format.html { redirect_to driverslists_url, notice: 'Driverslist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n call(:delete, path(id))\n end", "def delete_device(id)\n delete(\"/devices/#{id}\")\n end", "def destroy\n @driver_log.destroy\n respond_to do |format|\n format.html { redirect_to driver_logs_url, notice: 'Driver log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @driver = Driver.find(params[:id])\n @driver.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n expire_fragment \"event-#{@driver.event.id}\"\n end", "def destroy\n @references_vehicle_driver.destroy\n respond_to do |format|\n format.html { redirect_to references_vehicle_drivers_url, notice: 'References vehicle driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ride_driver.destroy\n respond_to do |format|\n format.html { redirect_to @root }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @drivers_licesnse.destroy\n respond_to do |format|\n format.html { redirect_to drivers_licesnses_url, notice: 'Drivers licesnse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n @service.delete(id)\n end", "def destroy\n @drives = Drives.find(params[:id])\n @drives.destroy\n\n respond_to do |format|\n format.html { redirect_to(drives_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n self.find(id).delete_\n end", "def destroy\n @driver_division.destroy\n respond_to do |format|\n format.html { redirect_to driver_divisions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @driver_license_type = DriverLicenseType.find(params[:id])\n @driver_license_type.destroy\n\n respond_to do |format|\n format.html { redirect_to driver_license_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset = WirelessDevice.find(params[:id])\n asset_destroy(wireless_url)\n end", "def delete_team_with(id)\n visit teams_path\n click_button 'Delete'\n click_button 'OK'\n end", "def delete(id)\n @conn.execute(*@builder.delete(id))\n end", "def destroy\n authenticate_request!\n\n @car = Car.find(params[:id])\n @car.destroy\n\n head :no_content\n end", "def delete(id)\n path(id).delete\n clean(id) if clean?\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def delete(id)\n path = path(id)\n path.delete\n clean(path) if clean?\n rescue Errno::ENOENT\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @driver_application.destroy\n respond_to do |format|\n format.html { redirect_to driver_applications_url, notice: 'Driver application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @route.destroy\n respond_to do |format|\n format.html { redirect_to driver_path(@route.driver_id ), notice: 'Route was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n begin\n Vehicle.find_by_id(params[:id]).destroy\n flash[:notice] = \"Vehicle deleted successfully\"\n redirect_to action: :index\n rescue \n render_404\n end\n end", "def delete(id)\n # TODO: Implement this for Stripe webhooks\n end", "def destroy\n begin\n Vehicle.find_by_id(params[:id]).destroy\n flash[:notice] = \"Vehicle deleted successfully\"\n redirect_to action: :index\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end", "def delete_by_id(id)\n delete_product_by_id(id)\n end", "def delete(id)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\"\n return HTTParty.delete(url, :timeout => 4)\n end\n end", "def delete(params: {}, headers: {})\n self.class.delete(id, params: params, headers: headers)\n true\n end", "def destroy\n respond_with ApidDrive.find(params[:id])\n end", "def delete\n sql = \"DELETE FROM tickets WHERE id = $1\"\n values = [id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @driver_profile.destroy\n respond_to do |format|\n format.html { redirect_to driver_profiles_url, notice: 'Driver profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_listing(db, id)\n\tdb.execute(\"DELETE FROM cars WHERE id=?\", [id])\nend", "def destroy(id)\n Ribs.with_handle(self.database) do |h|\n h.delete(get(id))\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def destroy\n fail \"No id; can't delete #{self.inspect}!\" unless id\n Connection.delete(create_route(:delete))\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @driver_trip_seat.destroy\n respond_to do |format|\n format.html { redirect_to driver_trip_seats_url, notice: 'Driver trip seat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dteor = Dteor.find(params[:id])\n @dteor.destroy\n\n respond_to do |format|\n format.html { redirect_to dteors_url }\n format.json { head :no_content }\n end\n end", "def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end", "def destroy(table, id)\n self.post(\"/#{table}/destroy/#{id}\")\n end", "def delete(id)\n results = connection.exec_params('DELETE FROM contacts WHERE id=$1;', [id]) \n end", "def delete(type, id)\n http_delete @target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\", @auth_header, @zone\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n self.class.delete(id)\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n src = Tagaly3::SRC\n # Code to connect with API\n @uri = URI.parse(src)\n http = Net::HTTP.start(@uri.host,@uri.port)\n request = Net::HTTP::Delete.new(\"/adexchange/advertiser/advertisement/#{id}\")\n response = http.request(request)\n http.finish\n redirect_to '/ads/'\n end", "def destroy\n @core_termo_vistorium = Core::TermoVistorium.find(params[:id])\n @core_termo_vistorium.destroy\n\n respond_to do |format|\n format.html { redirect_to core_termo_vistoria_url }\n format.json { head :no_content }\n end\n end", "def destroy(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :delete)\n end", "def delete( id )\n lib.tcidbout( @db, id ) || raise_error\n end", "def destroy\n @services_charger = ServicesCharger.find(params[:id])\n @services_charger.destroy\n\n respond_to do |format|\n format.html { redirect_to(services_chargers_url) }\n format.xml { head :ok }\n end\n end", "def delete(record_id)\n CONNECTION.execute(\"DELETE FROM #{get_table_name} WHERE id = #{record_id}\")\n end", "def delete(id)\n record = find(id)\n return unless record\n\n delete_from_file(@file, record)\n @records = read_file(@file)\n end", "def delete\n\t\t\t\"delete called - deleting object #{params[:id]}\"\n\t\tend", "def destroy(klass, id = nil, options = {})\n options = { resource: klass, id: id, format: @default_format }.merge options\n reply = delete resource_url(options), fhir_headers\n reply.resource_class = klass\n reply\n end", "def delete(id)\n @client.make_request(:delete, \"carrier_accounts/#{id}\")\n\n # Return true if succeeds, an error will be thrown if it fails\n true\n end", "def destroy\n @car = Car.find(params[:car_id])\n @bid = @car.bids.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to cars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@car = Car.find( params[:id] )\n\t\[email protected]\n\t\tredirect_to(root_url)\n\tend", "def destroy\n beer = Beer.find_by(id: params[:id])\n beer.destroy\n end", "def delete_importer(id)\n return @client.raw(\"delete\", \"/config/importers/#{id}\")\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n @cervejarium = Cervejarium.find(params[:id])\n @cervejarium.destroy\n\n respond_to do |format|\n format.html { redirect_to cervejaria_url }\n format.json { head :no_content }\n end\n end", "def destroy(id)\n\nend", "def destroy(klass, id)\n options = { resource: klass, id: id, format: nil }\n reply = delete resource_url(options), fhir_headers(options)\n reply.resource_class = klass\n reply\n end", "def destroy\n @vendor = Vendor.find(params[:id])\n @vendor.destroy\n\n respond_to do |format|\n format.html { redirect_to vendors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vendor = Vendor.find(params[:id])\n @vendor.destroy\n\n respond_to do |format|\n format.html { redirect_to vendors_url }\n format.json { head :no_content }\n end\n end", "def delete!(id:)\n client.delete_list(id: id)\n end", "def destroy\n @advertisement = Advertisement.find(params[:id])\n #if File.exists?(\"#{Rails.root}/#{@advertisement.filename}\")\n #File.delete(\"#{@advertisement.filename}\")\n #end\n @advertisement.destroy\n\n respond_to do |format|\n format.html { redirect_to advertisements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @car.destroy\n\n head :no_content\n end", "def delete_patient_by_id(patient_id)\n patient = Patient.find(patient_id)\n patient.destroy\nend", "def destroy\n @bluetooth = Bluetooth.find(params[:id])\n @bluetooth.destroy\n\n respond_to do |format|\n format.html { redirect_to bluetooths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end", "def delete_all\n\t\t\t@@driver.delete_all\n\t\tend", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def find_driver(id)\n return find_by_id(@drivers, id)\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete(project_id, id)\n @_client.delete(\"#{resource_root(project_id)}/#{id}\")\n end", "def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end", "def delete_deal(id)\n delete(\"deals/#{id}\")\n end", "def delete_model dataset_id, model_id\n execute { service.delete_model @project, dataset_id, model_id }\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete()\n sql = \"DELETE FROM tickets WHERE id=#{@id};\"\n SqlRunner.run(sql)\n end", "def delete_bridge_model(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Bridge Model.\")\n delete(\"#{@api_url}/models/#{encode(name)}\", headers)\n end", "def destroy\n\t\t@river = River.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to rivers_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend" ]
[ "0.79082227", "0.76823056", "0.74744827", "0.74000967", "0.74000967", "0.74000967", "0.72188294", "0.7193105", "0.68836105", "0.6753138", "0.6604842", "0.644768", "0.6425124", "0.63896936", "0.637714", "0.63718873", "0.63359296", "0.62877774", "0.6229822", "0.6192193", "0.6150229", "0.6140193", "0.6115529", "0.6110651", "0.6092501", "0.60818386", "0.6062595", "0.6032466", "0.59984344", "0.59766924", "0.59401864", "0.5933379", "0.5931303", "0.59270793", "0.5922441", "0.59181005", "0.5890796", "0.587806", "0.58753264", "0.5871534", "0.5857248", "0.5857046", "0.5822197", "0.58203995", "0.5810414", "0.57916194", "0.57891065", "0.57805693", "0.577485", "0.57687914", "0.5764512", "0.5752552", "0.5750141", "0.57396847", "0.5733084", "0.57313895", "0.57305056", "0.57241255", "0.5723728", "0.5723728", "0.57150805", "0.57106805", "0.56945", "0.56871635", "0.56816775", "0.56793535", "0.5676038", "0.56730694", "0.5669845", "0.56675047", "0.5663463", "0.56595", "0.5657952", "0.5644174", "0.5643599", "0.56429726", "0.56414163", "0.56366223", "0.56343484", "0.56339085", "0.56339085", "0.56249535", "0.56242996", "0.5622119", "0.56212837", "0.5621276", "0.5620791", "0.5620791", "0.5611103", "0.5609034", "0.56076324", "0.5587542", "0.55873966", "0.5577205", "0.55755633", "0.5573419", "0.5572531", "0.5572057", "0.5571142", "0.5567903" ]
0.7797962
1
GET /drivers/:id/companies get the companies of a driver
def companies companies = Driver.find(params[:id]).company if companies.size == 0 companies = Array.new end respond_with companies rescue ActiveRecord::RecordNotFound respond_with ActiveRecord::RecordNotFound end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def companies\n\t\tEmpresa.all\n\tend", "def companies\n signed_get(COMPANIES_PATH)\n end", "def index\n @companies = ClientCompany.all\n end", "def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n end", "def companies\n company_ids = company_affiliations.with_access.map(&:company_id)\n Company.where(:id.in => company_ids)\n end", "def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def company\n response = JSON.parse(@client.get(\"users/#{send(:id)}/companies\").body)\n Promisepay::Company.new(@client, response['companies'])\n rescue Promisepay::NotFound\n nil\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n\n end", "def index\n\t\t@companies = Company.all\n\tend", "def index\n\t\t@companies = Company.all\n\tend", "def index\n @account_companies = Account::Company.all\n end", "def advisor_companies\n companies.where(_type: AdvisorCompany)\n end", "def index\n @companions = Companion.all\n end", "def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end", "def show\n @companies = Company.all\n end", "def companies\n private_companies + major_companies\n end", "def index\n @business_companies = Business::Company.all\n end", "def index\n @companies = NasdaqCompany.all_companies\n respond_with(@companies)\n end", "def index\n @customer_companies = CustomerCompany.all\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def index\n \tif params[:search]\n \t\t@companies = Company.search(params[:search]).order(\"name asc\")\n \telsif params[:sort] == \"drivers.length\"\n \t\tif sort_direction == \"asc\"\n \t\t\t@companies = Company.joins(:drivers).group(\"drivers.company_id\").order(\"count(drivers.company_id) asc\")\n \t\telse\n \t\t\t@companies = Company.joins(:drivers).group(\"drivers.company_id\").order(\"count(drivers.company_id) desc\")\n \t\tend\n \telse\n\t @companies = params[:sort] == nil ? Company.all : Company.order(sort_column + \" \" + sort_direction)\n\tend\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def companies\n return [] unless basecamp\n @companies ||= basecamp.companies\n end", "def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end", "def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end", "def index\n @companies = Company.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n end", "def index\n @credit_companies = CreditCompany.all.page(params[:page]).per(10)\n end", "def index\n if request.format.to_sym == :html\n @companies = Company.page(params[:page]).order(\"LOWER(name)\")\n else\n @companies = Company.all\n end\n respond_with(@companies)\n end", "def hired\n authorize current_company, :index?\n @drivers = current_company.hired_drivers.distinct\n @drivers = @drivers.page(params[:page]).per(10)\n end", "def index\n @visit_companies = VisitCompany.all\n end", "def major_companies\n @major_companies ||= init_companies('major', MajorCompanyConfig)\n end", "def index\n @invoced_companies = InvocedCompany.all\n end", "def index\r\n @company = Company.find_by(params[:id])\r\n @services = Service.where(company_id: params[:id])\r\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def advisor_companies\n Company.where(:id.in => advisor_company_ids)\n end", "def index\n @hiring_companies = HiringCompany.all\n end", "def index\n @contact_companies = ContactCompany.all\n end", "def list_contacts_by_company(companyId, options={}) path = \"/api/v2/companies/#{companyId}/contacts\"\n get(path, options, AvaTax::VERSION) end", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def index\n @employees = Employee.all.order(created_at: :desc).group(\"employees.company_id, id\").paginate(page: params[:page], per_page: 15)\n @companies = Company.where(id: @employees.pluck(:company_id).uniq.sort)\n end", "def index\n @companies = Company.all.page params[:page]\n end", "def index\n @companies = Company.alphabetical.all\n end", "def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end", "def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end", "def get_company\n @company = Company.find(params[:company_id])\n end", "def company_information(params)\n get('company-information',params)\n end", "def index\n @main_companies = MainCompany.all\n end", "def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end", "def index\n @companies = NewCompany.where(user: current_user)\n end", "def index\n @companies_info = Company.display_information\n end", "def list_portfolio_companies\n self.companies.map do |company_instance|\n company_instance.name\n end\n end", "def index\n @gas_companies = GasCompany.all\n end", "def index\n @rail_companies = RailCompany.all\n end", "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n\t\t@companies = []\n if params[:query].nil?\n @products = []\n else\n @products = Product.search params[:query]\n @products.each do |product|\n product.companies.each do |company|\n if [email protected]? company\n @companies << company\n end\n end\n end\n end\n\tend", "def company_search(options = {})\n path = \"/company-search:(companies:(id,name,universal-name,website-url,logo-url,square_logo_url))?keywords=#{CGI.escape(options[:keyword])}&sort=relevance\"\n # binding.pry\n results = get(path, options)\n # binding.pry\n end", "def index\n @group_companies = GroupCompany.all\n end", "def company\n @company ||= Company.find(params[:id])\n end", "def index\n @compania = Companium.all\n end", "def index\n @production_companies = ProductionCompany.all\n end", "def get_Company(name=nil)\n\n getElement_text(\"cust_vendors\").click\n\n getElement_text(\"Customers\").click\n\n if(name!=nil)\n getElement_text_direct(name).click\n else\n getElement_text(\"company_name_data\").click\n end\n end", "def index\n # current_user.companies.\n @incidents = Incident.all\n end", "def new\n # Form to create a new company\n @driver = Driver.new\n # Companies the driver might be associated with, populate drop down list\n @driver_companies = Company.where(:company_type => 'driver')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @driver }\n end\n end", "def index\n @movie_companies = MovieCompany.all\n end", "def index\n @supporting_companies = SupportingCompany.all\n end", "def find_company\n Company.find(params[:company_id].to_i)\n end", "def index\n @company_owners = CompanyOwner.all\n end", "def find_company\n @company = Company.exists?(params[:id])\n if @company\n @company = Company.find(params[:id])\n else\n render json: { description: \"Company not found\", code: 404 }\n end\n end", "def index\n @companies = Company.all.first(50000)\n end", "def index\n @travel_companions = TravelCompanion.all\n end", "def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end", "def index\n\t\tif current_user.user_role.code == 'admin'\n\t\t\t@companies = Company.all\n\t\telse\n\t\t\t@companies = current_user.created_companies\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @companies }\n\t\tend\n\tend", "def index\n @company = Company.all\n end", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @companies = current_user.account.companies || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @producer_companies = ProducerCompany.all\n end", "def index\n @guarantee_companies = GuaranteeCompany.all\n end", "def index\n @references_vehicle_drivers = ReferencesVehicleDriver.all\n end", "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def index\r\n # Get all companies alphabetized\r\n #@companies = Company.order(\"LOWER(name)\")\r\n @companies = Company.order(\"LOWER(name)\").paginate(:page =>params[:page], :per_page =>10)\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @companies }\r\n end\r\n end", "def return_company_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/company'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Company.from_hash(decoded)\n end", "def show\n @company = Company.find(params[:id])\n @clients = @company.clients\n @employees = @company.employees\n @drivers = @company.drivers\n @shipments = @company.shipments\n end", "def index\n @pagetitle = \"compros\"\n \n @companies = Company.where(user_id: current_user.id).order(\"name\")\n @path = 'compros'\n end", "def find_company(company_id)\n company = Company.find_by_id(company_id)\n halt 404 unless company\n\n company\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def index\n @companies = Company.all\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def advised_companies\n Company.where(:id.in => advised_company_ids)\n end" ]
[ "0.6808417", "0.6758394", "0.67520106", "0.6723108", "0.6638172", "0.65025073", "0.64868593", "0.6482579", "0.64729744", "0.64729744", "0.64729744", "0.64729744", "0.64729744", "0.64729744", "0.6419115", "0.64051986", "0.64051986", "0.6369127", "0.63570654", "0.634533", "0.63400644", "0.6315045", "0.6311343", "0.630536", "0.62915057", "0.62867224", "0.62732023", "0.6268168", "0.62568957", "0.62218636", "0.6201347", "0.6193195", "0.6192977", "0.6187868", "0.61808366", "0.6171231", "0.6166905", "0.61608726", "0.61463183", "0.6142957", "0.61332464", "0.6124747", "0.6124747", "0.6124747", "0.6124747", "0.6116268", "0.6115104", "0.6107375", "0.6093815", "0.6089478", "0.60883695", "0.6049187", "0.60374975", "0.6028693", "0.60201776", "0.601329", "0.60088545", "0.5994593", "0.5990564", "0.5990329", "0.5988438", "0.5987814", "0.5980865", "0.59808075", "0.5980653", "0.5979557", "0.5970241", "0.59541273", "0.5938955", "0.5928652", "0.5925435", "0.59020895", "0.5901811", "0.59007454", "0.58968365", "0.5893039", "0.5883554", "0.58831877", "0.587958", "0.5870264", "0.5864739", "0.58560085", "0.58505774", "0.58155394", "0.5815533", "0.5797403", "0.5793773", "0.5792775", "0.57828176", "0.5777622", "0.5774264", "0.5773988", "0.5770767", "0.57663417", "0.5762429", "0.57618374", "0.57618374", "0.57618374", "0.5739108", "0.57256675" ]
0.78416586
0
call Logs all outbound request / responses to VAMF api gateway as :info when success and :warn when fail Semantic logging tags: jti: The "jti" (JWT ID) claim provides a unique identifier for the JWT. status: The HTTP status returned from upstream. duration: The amount of time it took between request being made and response being received in seconds. url: The HTTP Method and URL invoked in the request.
def call(env) statsd_increment("#{STATSD_KEY_PREFIX}.total", env) start_time = Time.current @app.call(env).on_complete do |response_env| if response_env.status.between?(200, 299) log(:info, 'VAOS service call succeeded!', log_tags(env, start_time, response_env)) elsif response_env.status == 400 # 400 error resp at times contain PII/PHI so we don't want the err msg logged statsd_increment("#{STATSD_KEY_PREFIX}.fail", env) log(:warn, 'VAOS service call failed!', log_tags(env, start_time, response_env)) else statsd_increment("#{STATSD_KEY_PREFIX}.fail", env) log(:warn, 'VAOS service call failed!', log_error_tags(env, start_time, response_env)) end end rescue Timeout::Error, Faraday::TimeoutError, Faraday::ConnectionFailed => e statsd_increment("#{STATSD_KEY_PREFIX}.fail", env, e) log(:warn, "VAOS service call failed - #{e.message}", log_tags(env, start_time)) raise end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def log_http_call(payload)\n logger.info \"Request[#{payload[:method]}]: #{payload[:uri].to_s}\"\n start_time = Time.now\n response = yield\n logger.info sprintf(\"Response[%s]: %s, Duration: %.3fs\", response.code,\n response.message, Time.now - start_time)\n response\n end", "def request_log(request); end", "def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end", "def log_request_info(env, req_id)\n query_string = \"?#{env.url.query}\" if env.url.query\n size = env.body.respond_to?(:size) ? env.body.size : env.request_headers['Content-Length']\n info { \"{#{req_id}} [OUT] #{env.method} #{env.url.path}#{query_string} (#{size || 0})\" }\n end", "def log(env, status, response_headers, began_at, body)\n data = {\n :method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query_string => env[\"QUERY_STRING\"],\n :host => Socket.gethostname,\n :status => status.to_i,\n :duration => (Time.now - began_at),\n :remote_addr => env['REMOTE_ADDR'],\n :request => request_line(env),\n :\"X-Forwarded-For\" => response_headers['X-Forwarded-For']\n\n }\n\n # Added calling for the proc and merge the data if it exists\n\n if @proc\n begin\n new_hash = @proc.call(env)\n data = data.merge new_hash if new_hash.class == Hash\n rescue Exception => e\n STDERR.puts \"Exception in your proc : #{e.message}.\"\n end\n end\n\n # This just works for all body types (magic?)... see http://www.rubydoc.info/github/rack/rack/Rack/BodyProxy\n body.each{|x| data[:body] = x[0..@options[:body_len]] }\n @options[:request_headers].each { |header, log_key| env_key = \"HTTP_#{header.upcase.gsub('-', '_')}\" ; data[log_key] = env[env_key] if env[env_key]} if !@options[:request_headers].nil?\n @options[:response_headers].each { |header, log_key| data[log_key] = response_headers[header] if response_headers[header] } if !@options[:response_headers].nil?\n\n data[:error_msg] = env[\"sinatra.error\"] if env.has_key?(\"sinatra.error\")\n\n\n\n @options[:body_regex].each { |k,v| data[k] = data[:body].to_s.match(/#{v}/).captures[0].gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\") rescue data[k]= \"\" } if !@options[:body_regex].nil?\n\n severity = \"DEBUG\"\n case status\n when 300..399 then severity = \"WARN\"\n when 400..599 then severity = \"ERROR\"\n end\n event = {:severity => severity}.merge data\n # TODO to include this lines\n begin\n device.puts( event.to_json )\n rescue Exception => e\n STDERR.puts \"Error : Failed to write log to : #{@options[:url]}, #{e.message}.\"\n @device = nil\n end\n end", "def log_request(url, headers, body)\n logger = @api.logger\n logger.debug(\"Report request to: '%s'\" % url)\n logger.debug('HTTP headers: [%s]' %\n (headers.map { |k, v| [k, v].join(': ') }.join(', ')))\n logger.debug(body)\n end", "def log_response_info(env, resp, req_id)\n info { \"{#{req_id}} [IN] #{resp.status} #{env.url.path} (#{resp.body&.size || 0})\" }\n end", "def call(env)\n if WialonApi.log_requests?\n @logger.debug \"#{env[:method].to_s.upcase} #{env[:url]}\"\n @logger.debug \"body: #{env[:body].inspect}\" unless env[:method] == :get\n end\n\n super\n end", "def request(event)\n log_action_summary(event)\n log_request_details(event)\n log_response_details(event)\n end", "def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end", "def log_request\n result = super\n push_outstanding_request\n result\n end", "def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end", "def call(env)\n @env = env\n start = Time.now\n\n app.call(env).tap do |status, *|\n elapsed = (Time.now - start).to_f\n\n request_logger.log(\n http_method: http_method,\n status: status,\n path: request_path,\n query: query_string,\n time: elapsed,\n request_body: request_body\n )\n end\n end", "def log_request(request, response)\n puts \"\\nRequest Headers\"\n request.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Headers\"\n response.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Body\"\n puts response.body\n puts \"\\nResponse Type\"\n puts \"#{response.class} (#{response.code})\"\nend", "def on_request(env)\n logger.tagged(*tags) do\n logger.info { formatter.request(env) }\n logger.debug { formatter.request_body(env) }\n end\n end", "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "def call(params)\n log_email(params[:logger], \"RESPONSE\", params[:response])\n end", "def log(request, response)\n time = Time.new.strftime(\"%Y-%m-%d %H-%M-%S\")\n http_request = \"#{request.http_method} #{request.uri}\"\n http_response = \"#{response.code}\"\n @log_file.puts \"#{++@log_no} -- [#{time}] #{http_request} #{http_response}\"\n end", "def trace_api_call(path, params, opts = {})\n if Tml.config.logger[:secure]\n [:access_token].each do |param|\n params = params.merge(param => \"##filtered##\") if params[param]\n end\n end\n\n path = \"#{path[0] == '/' ? '' : '/'}#{path}\"\n\n if opts[:method] == :post\n Tml.logger.debug(\"post: #{opts[:host]}#{path}\")\n else\n if params.any?\n Tml.logger.debug(\"get: #{opts[:host]}#{path}?#{to_query(params)}\")\n else\n Tml.logger.debug(\"get: #{opts[:host]}#{path}\")\n end\n end\n\n t0 = Time.now\n if block_given?\n ret = yield\n end\n t1 = Time.now\n\n Tml.logger.debug(\"call took #{t1 - t0} seconds\")\n ret\n end", "def __trace(method, path, params, body, url, response, json, took, duration)\n trace_url = \"http://localhost:9200/#{path}?pretty\" +\n ( params.empty? ? '' : \"&#{::Faraday::Utils::ParamsHash[params].to_query}\" )\n trace_body = body ? \" -d '#{__convert_to_json(body, :pretty => true)}'\" : ''\n tracer.info \"curl -X #{method.to_s.upcase} '#{trace_url}'#{trace_body}\\n\"\n tracer.debug \"# #{Time.now.iso8601} [#{response.status}] (#{format('%.3f', duration)}s)\\n#\"\n tracer.debug json ? serializer.dump(json, :pretty => true).gsub(/^/, '# ').sub(/\\}$/, \"\\n# }\")+\"\\n\" : \"# #{response.body}\\n\"\n end", "def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n end", "def log_response_details(event)\n env = event.payload\n\n if env.response.nil?\n return error do\n \"[#{req_id(env)}] #{req_dest(env)} < #{res_result(env)}\"\n end\n end\n\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} < \" \\\n \"#{env.response_headers.sort.to_h.to_json}\"\n end\n end", "def logger_info\n {\n :url => url,\n :body => body.inspect\n }\n end", "def log_request_details(event)\n env = event.payload\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} > \" \\\n \"#{env.request_headers.sort.to_h.to_json}\"\n end\n end", "def log_request_end(logger, status, headers, began_at)\n duration = (Time.now - began_at) * 1000\n\n content_length = if headers['Content-Length']\n headers['Content-Length'].to_s\n else\n '-'\n end\n\n params = [\n duration,\n status,\n content_length,\n ]\n\n logger.info %Q{Completed in %dms | %d | %s bytes} % params\n end", "def log_action_summary(event)\n env = event.payload\n info do\n \"[#{req_id(env)}] #{req_origin(env)} -> #{res_result(env)} \" \\\n \"(#{event.duration.round(1)}ms)\"\n end\n end", "def update_activity_logs\n request_number = request.number\n req_link = \"<a href = 'requests/#{request_number}'>#{request_number}</a>\"\n app = request.app_name.size > 1 ? \"Applications\" : \"Application\"\n # Log activity is not supported in Rails3\n #User.current_user.log_activity(:context => \"#{req_link} has been #{request.aasm_state} for #{app} #{request.app_name.to_sentence}\") do\n #end\n end", "def verbosity(conn, method, *args)\n return unless noop || verbose\n log format('uri: %s %s', method.upcase, conn.url_prefix)\n\n return unless args.last && !args.last.empty?\n\n log method == :get ? \"params: #{args.last}\" : \"body: #{args.last}\"\n end", "def call!(env)\n log \"===== Received request =====\"\n Rack::Request.new(env).tap do |request|\n log \" Method: #{request.request_method.inspect}\"\n log \" Path: #{request.path.inspect}\"\n end\n env['deas.logging'] = Proc.new{ |msg| log(msg) }\n status, headers, body = super(env)\n log \" Redir: #{headers['Location']}\" if headers.key?('Location')\n log \"===== Completed in #{env['deas.time_taken']}ms (#{response_display(status)}) =====\"\n [status, headers, body]\n end", "def log_http_request(request)\n log :info, \"Starting request: #{request.method} #{request.path}\"\n\n return unless log_debug?\n\n log :debug, \" body : #{request.body}\"\n log :debug, \" headers :\"\n request.each_header do |name, value|\n log :debug, \" #{name}: #{value}\"\n end\n end", "def api_call_log(resource, page)\n log.log(\"Lever API #{resource} page=#{page}\") if log.verbose? && !resource.nil?\n result = yield\n log_if_api_error(result)\n result\n end", "def log_request(req)\n message = [req.remote_ip, req.command, req.args.join(' ')].join(' ')\n log.info(message)\n end", "def logs\n\n end", "def log_http(response)\n resp_template = '[http] Response: %s (%s bytes in %s seconds)'\n log_status = (response.status || 0)\n log_total_time = response.total_time.truncate(3)\n\n Wgit.logger.debug(\"[http] Request: #{response.url}\")\n Wgit.logger.debug(\n format(resp_template, log_status, response.size, log_total_time)\n )\n end", "def log_with_benchmark(request, action)\n msg = [ ]\n msg << \"#{request.env['REQUEST_METHOD']} #{request.env['PATH_INFO']}\"\n msg << \"Params: #{request.params.inspect}\"\n msg << \"Action: #{action.to_s.upcase}\"\n \n logger.info \"[sinatras-hat] \" + msg.join(' | ')\n \n result = nil\n \n t = Benchmark.realtime { result = yield }\n \n logger.info \" Request finished in #{t} sec.\"\n \n result\n end", "def log_response\n log \"SOAP response (status #{@response.code}):\"\n log @response.body\n end", "def log_request(request, type, current_user, logger = Gitlab::AuthLogger)\n request_information = {\n message: 'Application_Rate_Limiter_Request',\n env: type,\n remote_ip: request.ip,\n request_method: request.request_method,\n path: request.fullpath\n }\n\n if current_user\n request_information.merge!({\n user_id: current_user.id,\n username: current_user.username\n })\n end\n\n logger.error(request_information)\n end", "def telemetry(url)\n get_request(URI(url), true, false)\n end", "def send_request_info_to_dashboard(app_id, timestamp, request_rate)\n Djinn.log_debug(\"Sending a log with request rate #{app_id}, timestamp \" +\n \"#{timestamp}, request rate #{request_rate}\")\n encoded_request_info = JSON.dump({\n 'timestamp' => timestamp,\n 'request_rate' => request_rate\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/apps/json/#{app_id}\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_request_info,\n {'Content-Type'=>'application/json'})\n return true\n rescue OpenSSL::SSL::SSLError, NotImplementedError, Errno::EPIPE,\n Errno::ECONNRESET\n retry\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the request info - just inform the caller that we couldn't send it.\n Djinn.log_info(\"Couldn't send request info for app #{app_id} to #{url}\")\n return false\n end\n end", "def trace!\n request! :trace\n end", "def log_requests(which = T.unsafe(nil)); end", "def advanced\n __log_activity(anonymous: true)\n __debug_route\n end", "def logs\n end", "def log_request\n log \"SOAP request: #{@soap.endpoint}\"\n log soap_headers.merge(headers).map { |key, value| \"#{key}: #{value}\" }.join(\", \")\n log @soap.to_xml\n end", "def logme\n\t\tlogger.debug \"============Main ApplicationController get calls at #{Time.now}\"\n\tend", "def append_info_to_payload(payload)\n super\n request_logging_context_data.each do |key, value|\n payload[key] = BlackSquareLoggingRails.format_value(value)\n end\n\n # Add request parameters to lograge output when the logger is in DEBUG mode\n if BlackSquareLoggingRails.enable_request_parameter_logging\n parameters = request.filtered_parameters.except(*ActionController::LogSubscriber::INTERNAL_PARAMS)\n payload[:request_params] = BlackSquareLoggingRails.format_value(parameters) if parameters.any?\n end\n end", "def log\n end", "def log(env, status, header, began_at)\n now = Time.now\n length = extract_content_length(header)\n\n data =\n {\n :remote_ip => env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"?\",\n :remote_user => env[\"REMOTE_USER\"] || \"\",\n :http_method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query => env[\"QUERY_STRING\"].empty? ? \"\" : \"?\"+env[\"QUERY_STRING\"],\n :http_version => env[\"HTTP_VERSION\"],\n :http_status => status.to_s[0..3],\n :content_length => length,\n :duration => now - began_at\n }\n\n logger = @logger || env['rack.errors']\n #logger.write data\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def log_request_debug(env, req_id)\n debug { \"{#{req_id}} [OUT] #{env.body}\" }\n end", "def call(env)\n request_id = id_generator.call\n logger.info formatter.message_from_request_body(env, request_id)\n app.call(env).on_complete do |env|\n logger.info formatter.message_from_response_body(env, request_id)\n end\n end", "def make_verbose(request)\n request.options[:verbose] = true\n\n request.on_complete do |response|\n puts\n puts 'Request body:'\n puts request.options[:body]\n puts\n puts 'Response body:'\n puts response.body\n puts\n end\n end", "def _roda_after_90__common_logger(result)\n return unless result && result[0] && result[1]\n\n env = @_request.env\n\n qs = env[\"QUERY_STRING\"]\n query_string = \"?#{ qs }\" unless qs.empty?\n\n length = result[1][\"Content-Length\"]\n length = \"\" if length == \"0\"\n\n LOGGER.request \"#{ env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] || '-' } - \\\"#{ env['REQUEST_METHOD'] } #{ env['SCRIPT_NAME'] }#{ env['PATH_INFO'] }#{ query_string } #{ env['HTTP_VERSION'] }\\\" #{ result[0] } #{ length }\\n\"\n end", "def call(env)\n start = Time.now\n status, headers, @response = @app.call(env)\n stop = Time.now\n elapsed_ms = (stop - start) * 1000\n @log.debug(\"type=measure.response.elapsed \\\nmethod=#{env['REQUEST_METHOD']} \\\npath=#{env['PATH_INFO']} \\\nstatus=#{status} \\\nelapsed=#{elapsed_ms}ms\")\n headers['x-response-time'] = \"#{elapsed_ms}ms\" if !headers.include? 'x-response-time'\n [status, headers, self]\n end", "def grid_rest_log(method, url, rparams = {}, emsg = \"\")\n if current_namespace\n return unless GridRest.grid_config.namespaces[current_namespace]['logging']\n else\n return unless GridRest.grid_config['logging']\n end\n grid_rest_log_message(rparams.any? ? \"#{Time.now.to_s(:db)} #{method.to_s.upcase} #{url} with #{rparams.inspect} #{emsg}\" : \"#{Time.now.to_s(:db)} #{method.to_s.upcase} #{url} #{emsg}\")\n end", "def record_request(status, env)\n now = Time.now\n diff = (now - @start)\n if $statsd\n $statsd.timing(\"response_time\", diff * 1000)\n if VALID_METHODS.include?(env[REQUEST_METHOD])\n stat = \"response_time.#{env[REQUEST_METHOD].downcase}\"\n $statsd.timing(stat, diff * 1000)\n end\n\n if suffix = status_suffix(status)\n $statsd.increment \"status_code.#{status_suffix(status)}\"\n end\n\n api = env[\"API\"]\n if api\n $statsd.timing(\"response_time.#{api}\", diff * 1000)\n $statsd.increment \"status_code.#{status_suffix(status)}.#{api}\"\n end\n\n if @track_gc && GC.time > 0\n $statsd.timing \"gc.time\", GC.time / 1000\n $statsd.count \"gc.collections\", GC.collections\n end\n end\n\n rescue => boom\n warn \"Statsd::Rack#record_request failed: #{boom}\"\n end", "def get_webhook_log_with_http_info(webhook_oid, request_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_log ...'\n end\n # verify the required parameter 'webhook_oid' is set\n if @api_client.config.client_side_validation && webhook_oid.nil?\n fail ArgumentError, \"Missing the required parameter 'webhook_oid' when calling WebhookApi.get_webhook_log\"\n end\n # verify the required parameter 'request_id' is set\n if @api_client.config.client_side_validation && request_id.nil?\n fail ArgumentError, \"Missing the required parameter 'request_id' when calling WebhookApi.get_webhook_log\"\n end\n # resource path\n local_var_path = '/webhook/webhooks/{webhookOid}/logs/{requestId}'.sub('{' + 'webhookOid' + '}', webhook_oid.to_s).sub('{' + 'requestId' + '}', request_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()\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 = ['ultraCartOauth', 'ultraCartSimpleApiKey']\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 => 'WebhookLogResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: WebhookApi#get_webhook_log\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def logs\n ret = @uri.logs\n render plain: ret[:message], status: ret[:status]\n end", "def internal_send_request(request, options)\n log_method = request == 'append_error' ? :error : :info\n log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]\n log_text.chomp.split(\"\\n\").each { |l| RightLinkLog.__send__(log_method, l) }\n options[:audit_id] = @audit_id\n RightScale::RequestForwarder.push(\"/auditor/#{request}\", options)\n true\n end", "def log_request\n ServerRequestLog.create! default_log_hash\n end", "def log(status_info = {})\n status_info[:authority_name] = authority_name\n status_info[:validation_type] = scenario_validation_type\n status_info[:subauth] = subauthority_name\n status_info[:service] = service\n status_info[:action] = action\n status_info[:url] = url\n status_info[:request_data] = request_data\n status_log.add(status_info)\n end", "def call env\n began = Time.now\n s, h, b = @app.call env\n b = BodyProxy.new(b) { log(env, s, h, began, b) } if @options[:statuses].include? s.to_i\n [s, h, b]\n end", "def logVisit record=nil, rateable=false\n return if !valid_browser?(request.user_agent) or valid_robot?(request.user_agent)\n\n user_id = user_signed_in? ? current_user.id : nil\n record_class = record_id = nil\n record_class = record.class.to_s unless record.nil?\n record_id = record.id unless record.nil?\n LogVisitWorker.perform_async(request.user_agent, request.remote_ip, user_id, Time.now, record_class, record_id, rateable)\n \n# Thread.new do\n# #Wait 10 seconds to allow the request to be returned before starting. This saves the request some time.\n# #On development using Webrick, if we wait too long and another thread gets created this one gets killed.\n# #Should be good on production.\n# sleep 10\n\n# ip_address = logIpAddress #First log IpAddress\n \n# record.register_visit_by(ip_address)\n\n# return unless rateable\n# #If the user is not the author then record statistics about how much they viewed the record\n# if user_signed_in? && record.user != current_user\n#\trecord.register_view_by(current_user)\n# end\n# end\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def get_webhook_activation_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_webhook_activation_logs ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_webhook_activation_logs, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_webhook_activation_logs, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/v1/webhook_activation_logs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'integrationRequestUuid'] = opts[:'integration_request_uuid'] if !opts[:'integration_request_uuid'].nil?\n query_params[:'webhookId'] = opts[:'webhook_id'] if !opts[:'webhook_id'].nil?\n query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?\n query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?\n query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?\n query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20034' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_webhook_activation_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_webhook_logs_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_webhook_logs ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_webhook_logs, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling ManagementApi.get_webhook_logs, must be greater than or equal to 1.'\n end\n\n allowable_values = [\"success\", \"error\"]\n if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])\n fail ArgumentError, \"invalid value for \\\"status\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/v1/webhook_logs'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'webhookId'] = opts[:'webhook_id'] if !opts[:'webhook_id'].nil?\n query_params[:'applicationId'] = opts[:'application_id'] if !opts[:'application_id'].nil?\n query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?\n query_params[:'requestUuid'] = opts[:'request_uuid'] if !opts[:'request_uuid'].nil?\n query_params[:'createdBefore'] = opts[:'created_before'] if !opts[:'created_before'].nil?\n query_params[:'createdAfter'] = opts[:'created_after'] if !opts[:'created_after'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse20035' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\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: ManagementApi#get_webhook_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def call(env)\n # Set the trace context (e.g. distributed tracing)\n if configuration[:distributed_tracing] && tracer.provider.context.trace_id.nil?\n context = HTTPPropagator.extract(env)\n tracer.provider.context = context if context.trace_id\n end\n\n tracer.trace(\n Ext::SPAN_REQUEST,\n service: configuration[:service_name],\n span_type: Datadog::Ext::HTTP::TYPE_INBOUND,\n # this is kept nil until we set a correct one (either in the route or with a fallback in the ensure below)\n # the nil signals that there's no good one yet and is also seen by profiler, when sampling the resource\n resource: nil,\n ) do |span|\n begin\n Sinatra::Env.set_datadog_span(env, @app_instance, span)\n\n response = @app.call(env)\n ensure\n Sinatra::Env.request_header_tags(env, configuration[:headers][:request]).each do |name, value|\n span.set_tag(name, value) if span.get_tag(name).nil?\n end\n\n request = ::Sinatra::Request.new(env)\n span.set_tag(Datadog::Ext::HTTP::URL, request.path)\n span.set_tag(Datadog::Ext::HTTP::METHOD, request.request_method)\n span.set_tag(Ext::TAG_SCRIPT_NAME, request.script_name) if request.script_name && !request.script_name.empty?\n\n span.set_tag(Ext::TAG_APP_NAME, @app_instance.settings.name)\n\n # If this app handled the request, then Contrib::Sinatra::Tracer OR Contrib::Sinatra::Base set the\n # resource; if no resource was set, let's use a fallback\n span.resource = env['REQUEST_METHOD'] if span.resource.nil?\n\n # TODO: This backfills the non-matching Sinatra app with a \"#{method} #{path}\"\n # TODO: resource name. This shouldn't be the case, as that app has never handled\n # TODO: the response with that resource.\n # TODO: We should replace this backfill code with a clear `resource` that signals\n # TODO: that this Sinatra span was *not* responsible for processing the current request.\n rack_request_span = env[Datadog::Contrib::Rack::TraceMiddleware::RACK_REQUEST_SPAN]\n span.resource = rack_request_span.resource if rack_request_span && rack_request_span.resource\n\n if response\n if (status = response[0])\n sinatra_response = ::Sinatra::Response.new([], status) # Build object to use status code helpers\n\n span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, sinatra_response.status)\n span.set_error(env['sinatra.error']) if sinatra_response.server_error?\n end\n\n if (headers = response[1])\n Sinatra::Headers.response_header_tags(headers, configuration[:headers][:response]).each do |name, value|\n span.set_tag(name, value) if span.get_tag(name).nil?\n end\n end\n end\n\n # Set analytics sample rate\n Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?\n\n # Measure service stats\n Contrib::Analytics.set_measured(span)\n end\n end\n end", "def call(url, request, xml = '', *args)\n # Alma throttles for both overall\n # requests per day as well as per second\n #\n # These are PER INSTITUTION, not per conncoection / api key\n # so even if our throttling is working we might get warnings\n # about exceeding either threshold.\n #\n # If it's the daily , we'll want to do a warning\n # and sleep for the rest of the day...\n #\n # if it's the per_second threshold, we should\n # just wait a second (and issue a warning)\n\n \n throttled_result = true\n response = nil\n while throttled_result do\n \n #header neeeds to be Authorization: apikey {APIKEY}\n request['Authorization'] = 'apikey ' + @config['api_key']\n \n response = Net::HTTP.start(url.hostname,\n url.port,\n :use_ssl => true) { | http |\n http.request( request )\n }\n \n raw_xml = response.body\n \n xml = Nokogiri::XML( raw_xml ) \n\n # see daily_threshold.xml for an example of what is returend\n # when we hit the daily threshold (not clear what http code\n # this is relative to midnight GMT\n # see concurrent_threshold.xml (also called per_second_threshold in docs) for example of taht\n # this will be returned w/ a code of 429\n\n\n # will need to investigate to see if namespace is actually returned in errors unlike some of the other stuff...\n \n # daily_threshold_xpath = '\n daily_threshold_xpath = '//ae:web_service_result'\n\n\n # since results are normally not namespaced, we may be better off just doing xml.remove_namespaces!\n # rather than trusting the docs that these are actually namespaced\n \n # check for daily limit, sleep til midnight GMT if found\n if !xml.xpath( '/ae:web_service_result/ae:errorList/ae:error/ae:errorCode[contains(text(),\"DAILY_THRESHOLD\")]',\n { 'ae' => \"http://com/exlibris/urm/general/xmlbeans\"} ).empty?\n puts \"Warning - reached daily limit for API, going to sleep\"\n sleep_till_midnight()\n \n # check for second limit, sleep till next second if found. Don't need to check body, docs say this always returns 429 if it is triggered\n elsif response.code == '429'\n puts \"Warning - reached per-second threshold, going to sleep and try again\"\n sleep(1)\n \n else\n throttled_result = false\n end\n end\n \n # for now returning response, api only cares about throttle, not errors, etc atm\n # puts \"Ok, got a response that wasn't throttled, going to return that\"\n response\n end", "def debug_info(address, body, response)\n puts \"Request: #{address}\"\n puts \"Body: #{body}\"\n puts \"Response: #{response.body}\"\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def log(service, level, summary, details: nil, host: nil, payload: {}, valid_for_secs: nil)\n service ||= @service\n if not service\n raise 'log: service must be passed, or set previously with set_service'\n end\n host ||= get_hostname\n post_body = {\n 'service' => service,\n 'datetime' => get_datetime(),\n 'host' => host,\n 'level' => level,\n 'summary' => summary,\n 'details' => details,\n 'payload' => payload,\n 'valid_for_secs' => valid_for_secs\n }\n \n url = \"https://#{@server_hostname}/api/log\"\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n vlog(0, \"url is #{url} host #{uri.host} port #{uri.port}\")\n http.use_ssl = true\n http.read_timeout = 20\n\n request = Net::HTTP::Post.new(url)\n request.content_type = \"application/json\" \n request.body = post_body.to_json\n\n vlog(0, \"request.body #{request.body}\")\n\n begin\n response = http.request(request)\n\n if response.code != '200'\n $stderr.puts \"POST to #{url} failed with status code #{response.code} and response #{response.body}\"\n return\n end\n rescue StandardError => error\n $stderr.puts \"POST to #{url} failed: #{error}\"\n end\n end", "def capture_request_response_cycle_error_info\n capture_request_response_cycle_end_info(capture_error: true)\n end", "def log_output()\n prefix = @global_opts[:prefix] ? (@global_opts[:prefix] + \"-\") : \"\"\n t = Time.now.strftime(\"%Y%m%d%H%M%S\")\n\n # Check for any returned records\n if (@successes > 0 and not [\"set\", \"unset\", \"check\"].include?(@cmd))\n any_records = true\n else\n any_records = false\n end\n\n # Data\n if any_records\n data_filename = prefix + \"wc-\" + @cmd + \"-\" + t + \".xml\"\n data = File.new(data_filename, \"w+:UTF-8\")\n data.write(@response_data)\n data.close\n end\n\n status_extension = @global_opts[:csv] ? \".csv\" : \".txt\"\n status_filename = prefix + \"wc-\" + @cmd + \"-\" + t + \"-log\" + status_extension\n\n # Summary\n summary = \"\"\n summary << <<~SUMMARY\n OCLC WorldCat Metadata API: #{@cmd.capitalize} operation\n #{PAST_TENSE[@cmd].capitalize} #{@successes.to_s} #{@successes != 1 ? \"records\" : \"record\"} and #{@failures.to_s} failed\n #{\"Records written to \" + data_filename if any_records}\n Log written to #{status_filename}\n SUMMARY\n\n # Status log\n status = File.new(status_filename, \"w+:UTF-8\")\n status.write(@debug_info) if @global_opts[:debug]\n status.write(summary + \"\\n\")\n status.write(@response_status)\n status.close\n\n puts summary\n end", "def http_call(payload); end", "def access_info(req, res, rule)\n info = {\n all: base64_encoded_request(req),\n client_ip: req.env[\"HTTP_X_FORWARDED_FOR\"] || req.env[\"REMOTE_ADDR\"],\n hostname: req.host_with_port,\n request_line: request_line(req),\n rule_id: rule ? rule.id : 0,\n status_code: res.status,\n type: \"sleep-warm-access\",\n user_agent: req.user_agent,\n version: req.env[\"HTTP_VERSION\"],\n }\n info[:message] = \"#{info[:client_ip]} #{info[:hostname]} \\\"#{info[:request_line]} #{info[:version]}\\\" #{info[:status_code]} #{info[:rule_id]}\"\n\n info\n end", "def capture_request(tid, total = nil)\n capture_request = Cielo::CaptureRequest.new\n response = send_request(capture_request.serialize(tid, total = nil, @affiliation, @affiliation_key))\n end", "def log_request(request)\n access = Access.new\n access.host = request.ip\n access.referrer = request.referer\n access.timestamp = DateTime.now\n\n access.method = request.request_method\n \n (request.get? ? request.GET : request.POST).each_pair do |key, value|\n pair = FormDataPair.new\n pair.name = key\n pair.value = value\n access.form_data_pairs << pair\n end\n\n access.save\n\n status 404\n 'No one here but us chickens.'\nend", "def api_reporting_v1_team_team_oncall_log_get_with_http_info(x_vo_api_id, x_vo_api_key, team, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportingApi.api_reporting_v1_team_team_oncall_log_get ...'\n end\n # verify the required parameter 'x_vo_api_id' is set\n if @api_client.config.client_side_validation && x_vo_api_id.nil?\n fail ArgumentError, \"Missing the required parameter 'x_vo_api_id' when calling ReportingApi.api_reporting_v1_team_team_oncall_log_get\"\n end\n # verify the required parameter 'x_vo_api_key' is set\n if @api_client.config.client_side_validation && x_vo_api_key.nil?\n fail ArgumentError, \"Missing the required parameter 'x_vo_api_key' when calling ReportingApi.api_reporting_v1_team_team_oncall_log_get\"\n end\n # verify the required parameter 'team' is set\n if @api_client.config.client_side_validation && team.nil?\n fail ArgumentError, \"Missing the required parameter 'team' when calling ReportingApi.api_reporting_v1_team_team_oncall_log_get\"\n end\n # resource path\n local_var_path = '/api-reporting/v1/team/{team}/oncall/log'.sub('{' + 'team' + '}', team.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?\n query_params[:'userName'] = opts[:'user_name'] if !opts[:'user_name'].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-VO-Api-Id'] = x_vo_api_id\n header_params[:'X-VO-Api-Key'] = x_vo_api_key\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OnCallLog')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportingApi#api_reporting_v1_team_team_oncall_log_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def do_GET(request, _response)\n log_request(request)\n end", "def append_info_to_payload(payload)\n super\n\n # Use the request ID generated by the aamzon ALB, if available\n payload[:request_id] = request.headers.fetch(\"X-Amzn-Trace-Id\", request.request_id)\n payload[:remote_ip] = request.remote_ip\n payload[:user_agent] = request.user_agent\n end", "def getinfo\n request :getinfo\n end", "def log_response_debug(_env, resp, req_id)\n debug { \"{#{req_id}} [IN] #{resp.body}\" }\n end", "def global_request_logging\n http_request_header_keys = request.headers.env.keys.select { |header_name| header_name.match('^HTTP.*') }\n http_request_headers = request.headers.select { |header_name, header_value| http_request_header_keys.index(header_name) }\n\n logger.debug \"[ApplicationController] Processing with params #{params.inspect}\"\n if request.body.respond_to?(:string)\n logger.debug \"[ApplicationController] Processing with body #{request.body.string.inspect}\" unless request.body.string.blank?\n elsif request.body.respond_to?(:read) && request.body.respond_to?(:rewind)\n request.body.rewind\n logger.debug \"[ApplicationController] Processing with body #{request.body.read.inspect}\"\n end\n\n # Run Warden if not already done, to avoid incomplete log entries after authN fail\n authenticate!\n\n begin\n yield\n ensure\n logger.debug \"[ApplicationController] Responding with headers #{response.headers.inspect}\"\n logger.debug \"[ApplicationController] Responding with body #{response.body.inspect}\" unless response.body.blank?\n end\n end", "def call\n return nil unless scope_layer\n return nil unless context.config.value('timeline_traces')\n\n # Since this request is being stored, update the needed counters\n context.slow_request_policy.stored!(request)\n\n # record the change in memory usage\n mem_delta = ScoutApm::Instruments::Process::ProcessMemory.new(context).rss_to_mb(@request.capture_mem_delta!)\n\n transaction_id = request.transaction_id\n revision = context.environment.git_revision.sha\n start_instant = request.root_layer.start_time\n stop_instant = request.root_layer.stop_time\n type = if request.web?\n \"Web\"\n elsif request.job?\n \"Job\"\n else\n \"Unknown\"\n end\n\n # Create request tags\n #\n tags = {\n :allocations => request.root_layer.total_allocations,\n :mem_delta => mem_delta,\n }.merge(request.context.to_flat_hash)\n\n host = context.environment.hostname\n path = request.annotations[:uri] || \"\"\n code = \"\" # User#index for instance\n\n spans = create_spans(request.root_layer)\n if limited?\n tags[:\"scout.reached_span_cap\"] = true\n end\n\n DetailedTrace.new(\n transaction_id,\n revision,\n host,\n start_instant,\n stop_instant,\n type,\n\n path,\n code,\n\n spans,\n tags\n\n # total_score = 0,\n # percentile_score = 0,\n # age_score = 0,\n # memory_delta_score = 0,\n # memory_allocations_score = 0\n )\n end", "def do_it(http_method, url:, **options)\n err = nil\n timing = {}\n timing[:start] = Time.now\n begin\n faraday_init = {url: url}\n faraday_init[:ssl] = {verify: false} if options[:https_allow_unverified]\n faraday_init[:request] = {timeout: options[:timeout]} if options[:timeout]\n conn = Faraday.new(faraday_init) do |faraday|\n # Request encoders are relatively safe, as they have built-in checks for suitability.\n # faraday.request(:multipart) # multipart first, takes priority over url_encoded.\n faraday.request(:url_encoded)\n # faraday.response(:logger, nil, bodies: {response: true}) if Rails.env.development?\n faraday.proxy = options[:proxy] if options[:proxy]\n faraday.adapter(Faraday.default_adapter) # must be after middlewares\n faraday.basic_auth(options[:basic_auth][:username], options[:basic_auth][:password]) if options[:basic_auth]\n end\n timing[:start] = Time.now\n response = conn.run_request(http_method, nil, options[:body], options[:headers])\n rescue => e\n err = e\n end\n timing[:end] = Time.now\n timing[:duration] = timing[:end] - timing[:start]\n log_url = options[:log_url] || url\n if err\n Rails.logger.error(http_method.to_s.upcase+\" #{log_url} ERROR (#{(timing[:duration]*1000).round}ms): #{err.class}: #{err.message}\")\n raise err.class, err.message, caller(2)\n else\n Rails.logger.info(http_method.to_s.upcase+\" #{log_url} response (#{(timing[:duration]*1000).round}ms): #{response.status} \"+response.body.inspect.truncate(350, omission: \"... (#{response.body.to_s.length} total)\\\"\")) #\"\n end\n unless options[:return_failed_response] || response.success?\n err = ResponseError.new_from_response(response)\n err.set_backtrace(caller(2))\n raise err\n end\n {success: response.success?, status: response.status, body: response.body, headers: response.headers.to_h, timing: timing}\n end", "def logs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.logs_get ...'\n end\n # resource path\n local_var_path = '/logs'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'min_date'] = opts[:'min_date'] if !opts[:'min_date'].nil?\n query_params[:'max_date'] = opts[:'max_date'] if !opts[:'max_date'].nil?\n query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?\n query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?\n query_params[:'id_user'] = opts[:'id_user'] if !opts[:'id_user'].nil?\n query_params[:'id_connection'] = opts[:'id_connection'] if !opts[:'id_connection'].nil?\n query_params[:'id_connector'] = opts[:'id_connector'] if !opts[:'id_connector'].nil?\n query_params[:'charged'] = opts[:'charged'] if !opts[:'charged'].nil?\n query_params[:'id_source'] = opts[:'id_source'] if !opts[:'id_source'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#logs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def annotate(request)\n\t\t\t\ttask = Async::Task.current\n\t\t\t\taddress = request.remote_address\n\t\t\t\t\n\t\t\t\[email protected](request) {\"Headers: #{request.headers.to_h} from #{address.inspect}\"}\n\t\t\t\t\n\t\t\t\ttask.annotate(\"#{request.method} #{request.path} from #{address.inspect}\")\n\t\t\tend", "def check_aws_logs_lambda_async_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSLogsIntegrationAPI.check_aws_logs_lambda_async ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AWSLogsIntegrationAPI.check_aws_logs_lambda_async\"\n end\n # resource path\n local_var_path = '/api/v1/integration/aws/logs/check_async'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'AWSLogsAsyncResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :check_aws_logs_lambda_async,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AWSLogsIntegrationAPI#check_aws_logs_lambda_async\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end", "def audit_log_all\n\n if params[:controller] && params[:action]\n desc = params[:controller] + \"|\" + params[:action]\n desc << \"|id:#{params[:id]}\" if params[:id]\n\n ## log user email for now\n ## TODO: change to larger requester info set\n if current_user\n if desc =~ /sessions\\|destroy/\n desc << \"|LOGOUT\"\n end\n\n AuditLog.create(requester_info: current_user.email, event: \"USER_ACTION\", description: desc)\n else\n AuditLog.create(requester_info: \"NONE\", event: \"USER_ACTION\", description: desc)\n end\n\n end\n\n end" ]
[ "0.72085714", "0.68570197", "0.68570197", "0.67325497", "0.65774626", "0.6466217", "0.6344893", "0.6299345", "0.6184078", "0.6176159", "0.61657166", "0.6140161", "0.6089401", "0.6065165", "0.6021518", "0.5937793", "0.59206843", "0.5906571", "0.5866953", "0.586544", "0.5851109", "0.5813595", "0.5795004", "0.57737684", "0.568567", "0.56385374", "0.56123924", "0.56115234", "0.56007427", "0.5596915", "0.5582095", "0.5575779", "0.55637187", "0.55413854", "0.55253583", "0.5523678", "0.5503308", "0.5494535", "0.5489831", "0.54738164", "0.54589605", "0.54504716", "0.54445297", "0.54164714", "0.5415966", "0.5401825", "0.53801316", "0.5379219", "0.53729504", "0.5370138", "0.5369081", "0.53661937", "0.53612983", "0.5357611", "0.5356825", "0.53559667", "0.53433096", "0.5328385", "0.53275436", "0.53125995", "0.53071004", "0.529028", "0.528964", "0.52819604", "0.52793634", "0.5277656", "0.5267904", "0.5258271", "0.5258271", "0.5258271", "0.5258271", "0.5258271", "0.5258271", "0.5258271", "0.5258271", "0.5247566", "0.5246895", "0.5239565", "0.52386403", "0.52273315", "0.52210647", "0.5203626", "0.5194932", "0.51948184", "0.51943576", "0.51924205", "0.5187899", "0.51748127", "0.5173473", "0.51611364", "0.5159913", "0.51597977", "0.51569164", "0.51437527", "0.5139296", "0.5136934", "0.5120119", "0.512004", "0.5116863", "0.5114664", "0.5114664" ]
0.0
-1
log invokes the Rails.logger
def log(type, message, tags) Rails.logger.send(type, message, **tags) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log\n end", "def logger ; @log end", "def log()\n @log\n end", "def log\n @log\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log\n Engine.logger\n end", "def logs\n end", "def do_log( msg )\n log( msg )\n end", "def log\n LOGGER\n end", "def log(log)\n post(formatter.call(log, self), log.time.strftime(@logging_path))\n end", "def log(message); logger.info(message); end", "def log=(logger); end", "def logs\n\n end", "def log(msg)\n Rails::logger.debug msg\n end", "def log\n Lita.logger\n end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def log(*args); end", "def log\n @logger ||= Logger.new(nil)\n @logger\n end", "def log\n Engines.log\n end", "def log\n @log ||= Logging.logger[self]\n end", "def log \n @log #||= Log.create\n end", "def log(*_args)\n end", "def log(log_)\n raise NotImplementedError.new(\"Logging Appender must implement #log(log)\")\n end", "def log\n Logger.instance\n end", "def log=(log); end", "def log\n ::Deployable::Log.log\n end", "def log\n self.class.log\n end", "def logger\n @log\n end", "def logger\n @log\n end", "def log\n @log ||= Logger.new(STDOUT)\n end", "def log(*args)\n\t\t\trouter.log(*args)\n\t\tend", "def log(msg)\n @logger.write(msg) if @logger\n end", "def log(msg)\n puts msg\n end", "def log message\n @logs << message\n end", "def log(message)\n puts \"[ dev/rails ] #{message}\"\nend", "def log(message)\n @logger.info message\n end", "def log(msg)\n logger.info(\"#{tag} #{msg}\")\n end", "def log\n advanced[:log]\n end", "def log(message)\n puts message\n end", "def log(message)\n logger.send log_level, message if log?\n end", "def log (msg, **kwargs) Log.write(msg, :info, kwargs) end", "def log\n @log ||= Logging.logger[File.basename($0)]\n end", "def log()\n return @log unless @log.nil?\n lg = find_task(:log)\n return lg unless lg.nil?\n @env.log\n end", "def log\n @log ||= Logger.new($stdout)\n end", "def log(msg)\n return if logger.nil?\n logger.debug(msg)\n end", "def log\n math :log\n end", "def log(msg)\n $logger << msg + \"\\n\"\nend", "def log \n\t\t\tArrow::Logger[ self.class ]\n\t\tend", "def log\n @@log ||= Logger.new($stdout)\n end", "def log\n return if @logger.nil?\n\n @logger.debug(\"Counter\") { \"attempt #{self}\" }\n end", "def log= logger\n @log = logger\n end", "def log= logger\n @log = logger\n end", "def log_message(message)\r\n @log.log_message(message)\r\n end", "def log(msg)\n\t\tSyslog.info(msg) if @verbose\n\tend", "def log(log)\n # Since only one appender thread will be writing to the file at a time\n # it is not necessary to protect access to the file with a semaphore\n # Allow this logger to filter out log levels lower than it's own\n @log.write(@formatter.call(log) << \"\\n\") if level_index <= (log.level_index || 0)\n end", "def log(*args)\nend", "def log(log)\n raise NotImplementedError\n end", "def log\n @log ||= RainbowifyLogger.new\n end", "def run_log(opts = {})\n Grably.run_log(self, opts)\n end", "def log(message)\n logger.send(log_level, message) if log?\n end", "def log(message)\n logger.send(log_level, message) if log?\n end", "def method_missing(m, *args, &block)\n \tRails.logger.send m, *args, &block\n end", "def log(*data)\n hash = log_data_as_hash(*data)\n Log.log(prepend_log_context(hash))\n end", "def log\n unless self.class._slflogger\n self.class.createlogger\n end\n return self.class._slflogger\n end", "def log()\n return @log unless @log.nil?\n @flow.log()\n end", "def log(*args)\n puts *args\n end", "def logger\n LOGGER\n end", "def log_e\n log\n exit\n end", "def log(msg)\n puts msg if @verbose\n end", "def log(msg)\n puts msg if @verbose\n end", "def logger; LOGGER; end", "def log(msg)\n STDERR.puts msg\n end", "def log(message, severity = :info) \n @rake_log ||= ActiveSupport::BufferedLogger.new(ImportProductSettings::LOGFILE)\n message = \"[#{Time.now.to_s(:db)}] [#{severity.to_s.capitalize}] #{message}\\n\"\n @rake_log.send severity, message\n puts message\n end", "def log(message, severity = :info) \n @rake_log ||= ActiveSupport::BufferedLogger.new(ImportProductSettings::LOGFILE)\n message = \"[#{Time.now.to_s(:db)}] [#{severity.to_s.capitalize}] #{message}\\n\"\n @rake_log.send severity, message\n puts message\n end", "def trace_log!\n Merb.logger.auto_flush = true\n end", "def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end" ]
[ "0.7998339", "0.7937285", "0.7868499", "0.7839531", "0.7692226", "0.7692226", "0.7692226", "0.7692226", "0.7692226", "0.7692226", "0.7692226", "0.7692226", "0.76788193", "0.76698565", "0.7667216", "0.7635921", "0.7609944", "0.7591768", "0.75241673", "0.7494665", "0.7466214", "0.74496406", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7371658", "0.7356015", "0.7339802", "0.733539", "0.7321474", "0.7297293", "0.72928756", "0.7286935", "0.72443986", "0.72361445", "0.71915704", "0.7190843", "0.7176592", "0.7176592", "0.71754175", "0.71590424", "0.7158704", "0.7120467", "0.71129185", "0.7073091", "0.7064324", "0.7063789", "0.705608", "0.70297784", "0.702894", "0.7022288", "0.7017567", "0.6996373", "0.69943523", "0.6992105", "0.6982341", "0.6978544", "0.6977616", "0.69732094", "0.69720834", "0.69620246", "0.69620246", "0.69583684", "0.6955487", "0.6950848", "0.69421685", "0.6941272", "0.69401276", "0.6929612", "0.69266343", "0.69266343", "0.6905283", "0.68984306", "0.6860059", "0.68581647", "0.68478435", "0.6847784", "0.6845268", "0.68423206", "0.68423206", "0.6841649", "0.6812237", "0.679869", "0.679869", "0.67928076", "0.6792714" ]
0.0
-1
decode_jwt_no_sig_check decodes the JWT token received in the response without signature verification
def decode_jwt_no_sig_check(token) JWT.decode(token, nil, false).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_jwt(jwt)\n #check the headers in post for jwt\n # byebug\n # if auth_header \n # token = cookies.signed[:jwt]\n # auth_header.split(' ')[1]\n begin\n # decode the token, return the decoded part\n JWT.decode(jwt, Rails.application.secrets.secret_key_base, true, algorithm: 'HS256')[0]\n rescue JWT::DecodeError \n # byebug \n # render json: {message: \"NOPE!!!! Really no!\"}, status: :unauthorized\n\n nil\n end\n # end\n end", "def jwt_decode(token)\n JWT.decode(token, Config.jwt_decode_key, true, { algorithm: Config.jwt_algorithm, exp_leeway: Config.jwt_lifetime_leeway })[0]\n rescue JWT::DecodeError\n {}\n end", "def decoded_jwt\n JwtWrapper.decode(\n Base64.decode64(\n Oj.load(\n Base64.decode64(params[\"token\"].split(\"--\").first)\n )[\"_rails\"][\"message\"]\n ).delete_prefix('\"').delete_suffix('\"')\n )[\"value\"]\n rescue\n nil\n end", "def decoded_token\n if token\n begin\n JWT.decode(token, secret, true, {algorithm: algorithm})\n rescue JWT::DecodeError\n return [{}]\n end\n else\n [{}]\n end\n end", "def decode(token)\n JWT.decode(token, private_key.public_key, true, { algorithm: ALGORITHM })\n rescue JWT::VerificationError => e\n # TODO: handle bad token\n rescue JWT::ExpiredSignature => e\n # TODO: handle expired token\n rescue\n nil\n end", "def decode(token)\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end", "def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS512\"})[0]\n end", "def decode_token(token, pub_key)\n begin\n decoded_payload, decoded_header = JWT.decode token, pub_key, true, { :algorithm => 'RS256' }\n return true\n rescue JWT::DecodeError\n puts 'Decode token: DecodeError'\n return false\n rescue JWT::ExpiredSignature\n puts 'Decode token: ExpiredSignature'\n return false\n rescue JWT::InvalidIssuerError\n puts 'Decode token: InvalidIssuerError'\n return false\n rescue JWT::InvalidIatError\n puts 'Decode token: InvalidIatError'\n return false\n end\nend", "def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: 'HS256'})[0]\n end", "def decode(token)\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end", "def decode(token)\n JWT.decode(token, secret_key, true, {algorithm: \"HS256\"})[0]\n end", "def decoded\n public_key = OpenSSL::PKey::RSA.new(options.public_key.to_s.gsub('\\n', \"\\n\"))\n @decoded ||= (JWT.decode request.params['jwt'], public_key, true, { :algorithm => 'RS256' }).first\n\n # check whether token has expiration time and is not expired\n raise ClaimInvalid.new(\"Token has expired.\") unless Time.now.to_i < @decoded.fetch('exp', 0)\n\n # check whether token contains unique identifier\n raise ClaimInvalid.new(\"Missing required jti claim.\") unless @decoded.key?('jti')\n\n # check for required claims\n (options.required_claims || []).each do |field|\n raise ClaimInvalid.new(\"Missing required '#{field}' claim.\") unless @decoded.key?(field.to_s)\n end\n\n @decoded\n end", "def decode_auth_token\n return nil unless verify_header\n\n JsonWebToken.decode_token(verify_header)\n end", "def decode(token)\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n \n #check expiration time and return if still fresh\n if payload[0][\"expires\"] >= Time.now.to_i\n payload[0]\n \n #old token\n else\n false\n end\n \n #couldn't decode token\n rescue\n false\n end", "def decode(token)\n JWT.decode(token, HMAC_SECRET)\n end", "def decoded_token\n if token_from_cookie\n token= token_from_cookie\n # byebug\n begin\n JWT.decode(token, Rails.application.credentials.jwt_token, true, algorithm: \"HS256\")\n # JWT.decode => [{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def decodeJWT(token)\n# puts token\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n# puts payload\n if payload[0]['exp'] >= Time.now.to_i\n payload\n else\n puts 'time expired on login'\n false\n end\n# catch the error if token is wrong\n rescue => error\n puts error\n nil\n end", "def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n token = JWT.decode token, Rails.application.credentials.jwt_secret,\n true,\n { algorithm: 'HS256' }\n token&.first['jti']\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n JWT.decode(token, 'yourSecret', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def decodeJWT(token)\n # puts token\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n # puts payload\n if payload[0][\"exp\"] >= Time.now.to_i\n payload\n else\n puts \"Timeout\"\n false\n end\n # catch the error if token is wrong\n rescue => error\n puts error\n nil\n end", "def decode_token\n #token in header\n if auth_header\n #JWT as a string \n token = auth_header.split(' ')[1]\n #header: { 'Authorization': 'Bearer <token>' }\n #begin/rescue allows us to rescue out of an exception in Ruby \n begin\n #JWT as a string, app secret, and hashing algorithm\n JWT.decode(token, 'my_s3cr3t', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def jwt_decoded_payload\n @jwt_decoded_payload ||= jwt_decode(jwt_from_header)\n end", "def decode_token(token_input)\n JWT.decode(token_input, ENV[\"JWT_SECRET\"], true)\n rescue\n render json: {message: \"Unauthorized\"}, status: 401\n end", "def decoded_token\n bearer, token = request.authorization.to_s.split\n\n if bearer == \"Bearer\"\n JWT.decode(token, Rails.application.secrets.secret_key_base, true, { algorithm: 'HS256' }).first\n else\n {}\n end\n end", "def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end", "def decoded_token\n if auth_header\n # Removed token = auth_header.split(' ')[1] here\n begin\n JWT.decode(auth_header, ENV[\"SECRET\"], true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def decode(token)\n body = JWT.decode(\n token,\n Rails.application.secrets.secret_key_base,\n true,\n algorithm: 'HS256'\n )[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end", "def decode(encrypted_token)\n secret = 'my$ecretK3y'\n JWT.decode(encrypted_token, secret, true, {algorithm: 'HS256' })\n end", "def decrypt_jwt\n begin\n decoded_token_data = JWT.decode(\n params[:token],\n GlobalConstant::PublicOpsApi.secret_key,\n true,\n {:algorithm => 'HS256'}\n )[0][\"data\"]\n\n params[:decoded_token_data] = HashWithIndifferentAccess.new(decoded_token_data)\n rescue => e\n # decoding failed\n ApplicationMailer.notify(\n body: {exception: {message: e.message, backtrace: e.backtrace}},\n data: {\n 'decoded_token_data' => params[:decoded_token_data],\n 'token' => params[:token]\n },\n subject: 'Exception in decrypt_jwt'\n ).deliver\n\n render_api_response(\n Result::Base.error({\n error: 'c_oc_1',\n error_message: 'Token Invalid or Expired.',\n http_code: GlobalConstant::ErrorCode.not_found\n })\n )\n end\n end", "def decode(token)\n #return which user is this token???\n JWT.decode(token, secret_key, true, { algorithm: 'HS256' })[0]\n end", "def call(token)\n decode(token, decoding_secret)\n rescue JWT::VerificationError\n decode(token, rotation_secret)\n end", "def decode(token)\n return nil if token.nil?\n\n decoded = JWT.decode(token, SECRET_KEY)[0]\n HashWithIndifferentAccess.new(decoded)\n rescue JWT::ExpiredSignature => e\n reset_auth_token(token)\n raise_expired_signature_exception(e)\n rescue JWT::DecodeError => e\n raise_decode_error_exception(e)\n rescue JWT::VerificationError => e\n raise_verification_error_exception(e)\n end", "def decode(token)\n body = JWT.decode(token, Rails.application.secrets.secret_key_base)[0]\n HashWithIndifferentAccess.new body\n rescue\n nil\n end", "def decodeJWT(token)\n payload = JWT.decode(token, Rails.application.secrets.secret_key_base, \"HS512\")\n #Kontrollerar tiden på token\n if payload[0][\"exp\"] >= Time.now.to_i\n payload\n else\n puts \"The token has expired, please log in again to get a new one\"\n false\n end\n #Fångar felet om token var fel\n rescue => error\n puts error\n nil\n end", "def decode\n Result.new(*JWT.decode(token, configuration.secret, verification?, headers))\n end", "def decoded_token\n if auth_header\n # label token from the header of the request, the first word will be Bearer by convention\n # If you send in JUST the token as your Authorization you won't need the split\n token = auth_header.split(' ')[1]\n begin\n # decode the token with your secret password/phrase\n # This sequence is important to have the true and, for now, this algorithm\n # You can look into what they mean on your own, but just know they help JWT stuff work.\n JWT.decode(token, \"put your secret password here\", true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def decode(token)\n\t\t\tbody = JWT.decode(token, Rails.application.secrets.secret_key_base)\n\t\t\t#HashWithIndifferentAcesss.new body\n\t\tend", "def enhanced_jwt_decode(tkn, secret = ENV['JWT_SECRET'], validation = true, options = {})\n\t\tbegin\n\t\t\tpayload, header = JWT.decode tkn, secret, validation, options\n\n\t\t# https://philsturgeon.uk/http/2015/09/23/http-status-codes-are-not-enough/\n\t\t# we just need to optimize this a bit\n\t\trescue JWT::ExpiredSignature\n\t\t\treturn { err: true, code: TOKEN_EXPIRED, title: 'The token has expired.' }\n\t\trescue JWT::InvalidIssuerError\n\t\t\treturn { err: true, code: TOKEN_INVALID, title: 'The token does not have a valid issuer.' }\n\t\trescue JWT::InvalidIatError\n\t\t\treturn { err: true, code: TOKEN_INVALID, title: 'The token does not have a valid \"issued at\" time.' }\n\t\trescue JWT::DecodeError => e\n\t\t\treturn { err: true, code: TOKEN_CORRUPT, title: 'A token must be passed.' }\n\t\tend\n\n\t\treturn payload, header\n\tend", "def decode_id_token(id_token)\n decoded = JSON::JWT.decode(id_token, :skip_verification)\n algorithm = decoded.algorithm.to_sym\n\n validate_client_algorithm!(algorithm)\n\n keyset =\n case algorithm\n when :HS256, :HS384, :HS512\n secret\n else\n public_key\n end\n\n decoded.verify!(keyset)\n ::OpenIDConnect::ResponseObject::IdToken.new(decoded)\n rescue JSON::JWK::Set::KidNotFound\n # If the JWT has a key ID (kid), then we know that the set of\n # keys supplied doesn't contain the one we want, and we're\n # done. However, if there is no kid, then we try each key\n # individually to see if one works:\n # https://github.com/nov/json-jwt/pull/92#issuecomment-824654949\n raise if decoded&.header&.key?('kid')\n\n decoded = decode_with_each_key!(id_token, keyset)\n\n raise unless decoded\n\n decoded\n end", "def token\n @token ||= JWT.decode(jwt_string, secret_key, true, verify_expiration: false)\n end", "def decoded_auth_token\n @decoded_auth_token ||= JsonWebToken.decode(http_auth_header)\n end", "def validate\n token = jwt\n return unless token\n token.validate\n end", "def decoded_auth_token\r\n result = Token::Decode.call(token: auth_token)\r\n add_error!(result.errors) if result.failure?\r\n result.decoded.first.deep_symbolize_keys\r\n end", "def jwt_payload\n jwt_token.match(/\\.(\\w+\\.\\w+)/)[1]\n end", "def jwt_from_header\n @jwt_from_header ||= request.headers[Config.jwt_header].to_s.sub(TOKEN_REGEX, '')\n end", "def parse(token)\n jwt = JSON::JWT.decode(token, :skip_verification)\n @header = jwt.header\n @payload = jwt.to_h\n @signature = jwt.signature\n @alg = @header[\"alg\"]\n @typ = @header[\"typ\"]\n @cty = @header[\"cty\"]\n @kid = @header[\"kid\"]\n @jku = @header[\"jku\"]\n @iat = @payload[\"iat\"]\n self\n rescue JSON::JWT::InvalidFormat => e\n print_error e.message\n puts token\n exit!\n rescue Exception => e\n puts e.full_message\n end", "def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end", "def auth_bypass_token\n JWT.encode(\n {\n \"sub\" => auth_bypass_id,\n \"content_id\" => content_id,\n \"iat\" => Time.zone.now.to_i,\n \"exp\" => 1.month.from_now.to_i,\n },\n Rails.application.secrets.jwt_auth_secret,\n \"HS256\",\n )\n end", "def auth_bypass_token\n JWT.encode(\n {\n \"sub\" => auth_bypass_id,\n \"content_id\" => content_id,\n \"iat\" => Time.zone.now.to_i,\n \"exp\" => 1.month.from_now.to_i,\n },\n Rails.application.secrets.jwt_auth_secret,\n \"HS256\",\n )\n end", "def verify_jwt_token\n begin\n if request.format.json?\n token = request.headers['Authorization'].split(' ').last\n decoded_token = JWT.decode token, nil, false\n @current_user = User.find(decoded_token[0][\"user_id\"])\n head :unauthorized if request.headers['Authorization'].nil? || !AuthToken.valid?(token)\n else\n authenticate_user!\n end\n rescue => exception\n head :unauthorized \n end\n end", "def decode_link data\n link = data.sub('_', '.')\n JWT.decode link, nil, false\n end", "def verify(token, is_emulator: false)\n payload = decode(token, is_emulator).first\n sub = payload[\"sub\"]\n raise JWT::InvalidSubError, \"Invalid subject.\" unless sub.is_a?(String) && !sub.empty?\n payload[\"uid\"] = sub\n payload\n rescue JWT::ExpiredSignature => e\n raise expired_error, e.message\n rescue JWT::DecodeError => e\n raise invalid_error, e.message\n end", "def token\n @token ||= HashWithIndifferentAccess.new(\n JWT.decode(authentication_token, secret, true, decode_options).first\n )\n rescue JWT::DecodeError, JWT::ExpiredSignature, JWT::InvalidIatError\n nil\n end", "def token_head(jwt)\n jwt_parts = jwt.split('.')\n return {} if blank?(jwt_parts) || blank?(jwt_parts[0])\n\n json_parse(Base64.decode64(jwt_parts[0]))\n end", "def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token)\n end", "def verify_jwt_token\n head :unauthorized if request.headers['Authorization'].nil? ||\n !AuthToken.valid?(request.headers['Authorization'].split(' ').last)\n end", "def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end", "def claims\n JWT.decode(jwt_token_from_request, Rails.application.secrets.secret_key_base, true)\n rescue\n nil\n end", "def verify(bearer_token)\n JWT.decode(bearer_token, config.secret)\n rescue JWT::VerificationError, JWT::DecodeError\n false\n end", "def jwt\n return nil if params.format_version.zero?\n SimpleJWT.new(jwt_data, :mac => mac, :key => key, :key_id => key_id)\n end", "def to_token_payload\n payload = {}\n # std jwt claims\n payload['sub'] = id.to_s\n payload['iat'] = Time.now.utc.to_i\n payload['iss'] = Rails.application.secrets.jwt_issuer\n # sombra claims\n payload['role'] = role\n payload['name'] = name\n payload\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JwtTokenLib.decode(token)\n rescue StandardError => _\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def without_jwt_private_key\n orig_key = JwtWriter.private_key\n JwtWriter.private_key = nil\n yield\n ensure\n JwtWriter.private_key = orig_key\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue StandardError\n nil\n end", "def decoded_id_token public_key = nil, options = {}, &keyfinder\n options[:algorithm] ||= signing_algorithm\n verify = !public_key.nil? || block_given?\n payload, _header = JWT.decode(id_token, public_key, verify, options, &keyfinder)\n raise Signet::UnsafeOperationError, \"No ID token audience declared.\" unless payload.key? \"aud\"\n unless Array(payload[\"aud\"]).include?(client_id)\n raise Signet::UnsafeOperationError,\n \"ID token audience did not match Client ID.\"\n end\n payload\n end", "def decode(token)\n \n end", "def payload\n JsonWebToken.decode(token)\n rescue StandardError\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil \n end", "def jwt_not_authenticated\n head :unauthorized\n end", "def jwt_token_authen!\n data = jwt_verify(headers[\"Token\"])\n return error!('401 Unauthorized', 401) if data.nil?\n end", "def http_get_token\n #verifico che stia arrivando un jwt con formato valido,altrimenti ritorno false\n if params['jwt'].present? && !(params['jwt'] =~ /^[A-Za-z0-9\\-_=]+\\.[A-Za-z0-9\\-_=]+\\.?[A-Za-z0-9\\-_.+=]*$/).nil?\n @http_get_token ||= params['jwt']\n else\n false\n end\n \n end", "def decoded_auth_token\n @decoded_auth_token ||= AuthToken.decode(http_auth_token, key_field: :admin_secret_key_base)\n end", "def call(token)\n payload = TokenDecoder.new.call(token)\n scope = payload['scp'].to_sym\n user = PayloadUserHelper.find_user(payload)\n revocation_strategies[scope].revoke_jwt(payload, user)\n # rubocop:disable Lint/SuppressedException\n rescue JWT::ExpiredSignature\n end", "def verification_token\n JWT.encode({ iat: Time.now.to_i }, config.secret, JWT_ALG)\n end", "def token_validation_response\n serialize_self\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.gsub('Bearer','').strip.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def signed_jwt\n # We're using the Ruby JWT library.\n # There are very well supported libraries in nearly every language here: https://jwt.io/\n JWT.encode(jwt_payload, median_api_key)\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last if auth_header\n JsonWebToken.decode(token)\n end", "def original_request_jwt\n env['grape_jwt_auth.original_token']\n end", "def token\n JWT.encode(claims, rsa_key, 'RS512')\n end", "def token_validation\n return errors.add(:base, I18n.t('token.invalid')) if jwt_string.blank? || token.all?(&:blank?)\n\n current_time = Time.current\n iat_time = Time.at(read('iat'))\n exp_time = Time.at(read('exp'))\n if exp_time < current_time\n errors.add(:base, I18n.t('token.expired'))\n elsif iat_time >= current_time && iat_time > exp_time\n errors.add(:base, I18n.t('token.invalid'))\n end\n rescue JWT::DecodeError\n errors.add(:base, I18n.t('token.invalid'))\n end", "def parse_token\n binary_token = get_element('//t:RequestSecurityTokenResponse/t:RequestedSecurityToken/wsse:BinarySecurityToken')\n @validation_errors << \"No binary token exists.\" and return if binary_token.nil?\n \n decoded_token = Base64.decode64(binary_token)\n name_values={}\n decoded_token.split('&').each do |entry|\n puts entry\n pair=entry.split('=') \n name_values[CGI.unescape(pair[0]).chomp] = CGI.unescape(pair[1]).chomp\n end\n puts \"expires on\"\n puts name_values[\"ExpiresOn\"]\n @validation_errors << \"Response token is expired.\" if Time.now.to_i > name_values[\"ExpiresOn\"].to_i\n @validation_errors << \"Invalid token issuer.\" unless name_values[\"Issuer\"]==\"#{self.class.issuer}\"\n @validation_errors << \"Invalid audience.\" unless name_values[\"Audience\"] ==\"#{self.class.realm}\"\n \n # is HMAC valid?\n token_hmac = decoded_token.split(\"&HMACSHA256=\")\n swt=token_hmac[0]\n puts \"====\"\n puts \"incoming hmac is\"\n puts name_values['HMACSHA256']\n puts \"calculated hmac is\"\n puts Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'),Base64.decode64(self.class.token_key),swt)).chomp\n puts \"====\"\n \n @validation_errors << \"HMAC does not match computed value.\" unless name_values['HMACSHA256'] == Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'),Base64.decode64(self.class.token_key),swt)).chomp\n \n # remove non-claims from collection and make claims available\n\n @claims = name_values.reject {|key, value| !key.include? '/claims/'}\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue StandardError\n nil\n end", "def parse_signed_payload\n signed_payload = params[:signed_payload]\n message_parts = signed_payload.split('.')\n\n encoded_json_payload = message_parts[0]\n encoded_hmac_signature = message_parts[1]\n\n payload = Base64.decode64(encoded_json_payload)\n provided_signature = Base64.decode64(encoded_hmac_signature)\n\n expected_signature = sign_payload(bc_client_secret, payload)\n\n if secure_compare(expected_signature, provided_signature)\n return JSON.parse(payload, symbolize_names: true)\n end\n\n nil\nend", "def authenticate_user\n jwt=cookies.signed[:jwt]\n decode_jwt(jwt) \n end", "def jwt_subject\n auth0_id_string\n end", "def validate_and_parse_id_token(id_token)\n # The second parameter is the public key to verify the signature.\n # However, that key is overridden by the value of the executed block\n # if one is present.\n #\n # If you're thinking that this looks ugly with the raw nil and boolean,\n # see https://github.com/jwt/ruby-jwt/issues/59.\n jwt_claims, jwt_header =\n JWT.decode(id_token, nil, false, verify_options) do |header|\n # There should always be one key from the discovery endpoint that\n # matches the id in the JWT header.\n x5c = (signing_keys.find do |key|\n key['kid'] == header['kid']\n end || {})['x5c']\n if x5c.nil? || x5c.empty?\n fail JWT::VerificationError,\n 'No keys from key endpoint match the id token'\n end\n # The key also contains other fields, such as n and e, that are\n # redundant. x5c is sufficient to verify the id token.\n OpenSSL::X509::Certificate.new(JWT.base64url_decode(x5c.first)).public_key\n end\n return jwt_claims, jwt_header if jwt_claims['nonce'] == read_nonce\n fail JWT::DecodeError, 'Returned nonce did not match.'\n end", "def decoded_auth_token\n @decoded_auth_token ||= Authentication::AuthToken.decode(http_auth_header_content)\n end", "def generate_token\n begin\n @header = JSON.parse(@header) unless @header.is_a?(Hash)\n @payload = JSON.parse(@payload) unless @payload.is_a?(Hash)\n @alg = @header['alg'] if @alg.nil? # if algorithm not forced, take if from the header\n\n header_encoded = encode(@header.to_json)\n payload_encoded = encode(@payload.to_json)\n data = \"#{header_encoded}.#{payload_encoded}\"\n signature_encoded = encode(generate_sig(data, @alg, @key).signature)\n token = [header_encoded, payload_encoded, signature_encoded].join('.')\n\n set_hash_and_json\n token\n rescue JSON::ParserError => e\n puts '[x] '.red + \"Invalid JSON: #{e.message}\"\n puts \"[!] \".yellow + \"Make sure you've single quoted your input: eg. --header #{\"'\".bold}{\\\"type\\\":\\\"JWT\\\",\\\"alg\\\":\\\"HS256\\\"}#{\"'\".bold}\"\n exit!\n rescue Exception => e\n puts \"[x] \".red + \"Unknown Exception: generate_sig\"\n puts '[!] '.yellow + 'Please report the issue at: https://github.com/KINGSABRI/jwtear/issues'.underline\n puts e\n puts e.backtrace\n end\n end", "def payload\n @payload ||= JsonWebToken.decode(http_auth_header)\n end" ]
[ "0.7797421", "0.76241046", "0.7612161", "0.75176126", "0.7504962", "0.7480768", "0.74780345", "0.74521583", "0.7397127", "0.7390224", "0.7388958", "0.73093706", "0.7287289", "0.72850204", "0.7252011", "0.72235364", "0.71958894", "0.7190589", "0.71817976", "0.7143333", "0.71204877", "0.711916", "0.7060136", "0.7046908", "0.70225185", "0.69965965", "0.69638896", "0.6950877", "0.69053614", "0.6900694", "0.6892614", "0.6834018", "0.6789518", "0.67715913", "0.67377007", "0.67176306", "0.6716697", "0.6669769", "0.66659737", "0.6661414", "0.64822155", "0.6346886", "0.6280399", "0.6264456", "0.62559664", "0.624732", "0.62337834", "0.62139845", "0.62139845", "0.6202683", "0.61954916", "0.61834276", "0.61669177", "0.6148005", "0.61358345", "0.6099135", "0.60821754", "0.6060788", "0.60379636", "0.6034282", "0.6029279", "0.59905225", "0.5980609", "0.5980609", "0.5980609", "0.5980609", "0.5980609", "0.5980609", "0.5980609", "0.5980609", "0.5967349", "0.5964332", "0.5955036", "0.5950587", "0.59394926", "0.58902985", "0.58848876", "0.58688927", "0.58362675", "0.5811555", "0.5804829", "0.57916707", "0.57879037", "0.57226825", "0.5718158", "0.57101476", "0.57044756", "0.56979746", "0.5683218", "0.56571096", "0.5655986", "0.56394106", "0.56388134", "0.5637909", "0.5632827", "0.56324196", "0.5632005", "0.5629795", "0.56243706", "0.56190276" ]
0.86317235
0
user_session_request? determines if current request is a user session request
def user_session_request?(env) env.url.to_s.include?('users/v2/session?processRules=true') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session?\n\t\treturn @session || self.request.session?\n\tend", "def current_user?\n return session[:user_id] != nil\n end", "def session?\n session[:user_id]\n end", "def is_session_user?\n id_or_username = params[:user_id]\n case id_or_username\n # if the id/username is for the current user, or the id is not provided then use the current user\n when session_user_id, nil\n true\n else\n false\n end\n end", "def user_logged_in?\n session[:user]\n end", "def session_loaded?\n\t\treturn @session || self.request.session_loaded?\n\tend", "def has_session?\n session\n end", "def user?\n session.key? 'user'\nend", "def logged_in?\n session_user != nil\nend", "def user_logged_in?\n session[:user_id].present?\n end", "def user_authenticated?\n !session[:user_id].nil?\n end", "def temporary_session?\n session[:user_id]\n end", "def user_logged?\n !session[:user_id].nil?\n end", "def user_signed_in?\n session.has_key? :user_id\n end", "def logged_in?\n session.has_key? :user\n end", "def is_logged_in?(session)\n !!session[:user_id]\n end", "def user_signed_in?\n session[:userinfo].present?\n end", "def user_signed_in?\n session[:userinfo].present?\n end", "def is_logged_in_user?\n session[:user_authenticated]\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n session[:user]\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n !!session[:user]\nend", "def user_signed_in?\n session[:user_id].present?\n end", "def user_signed_in?\n session[:user_id] != nil\n end", "def user_signed_in?\n session[:user_id] != nil\n end", "def current_user\n if session[:user]\n session[:user][0]\n else\n false\n end\n end", "def is_logged_in\n #since these are also marked as helper methods, they are availalble in not just all ctronollers (cuz they inherit from appc ontroler) but also avialble to views\n\n (session[:user_id] && session[:user_id].present? ) ? true : false\n end", "def session?\n [email protected]?\n end", "def is_not_authenticated?\n session[:user].nil?\nend", "def is_logged_in?\n session[:user_id].present?\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n \t!current_user.nil? && session[:user_id]\n\tend", "def logged_in?\n session[:user_id] != nil\nend", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n return session['current_user']\n end", "def user_signed_in?\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n if Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).nil?\n return false\n else\n return true\n end\n else\n return false\n end\n end", "def user_signed_in?\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n if Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).nil?\n return false\n else\n return true\n end\n else\n return false\n end\n end", "def logged_in?\n return session[:user_id].present?\n end", "def current_user\n if session[:user] != nil\n # return the user id\n return session[:user]\n else\n return false\n end\nend", "def current_user\n !session[:uid].nil?\n end", "def user_signed_in?\n !!session[:user_id]\n end", "def logged_in?\n session[:user_id]\n end", "def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend", "def session?\n !! session['sinatra.session']\n end", "def _is_login\n p session[:user]\n session[:user] ? true : false\n end", "def comment_in_session?\n session[:comment_request_params].present? && session[:comment_path_params].present?\n end", "def is_logged_in? \n !session[:user_id].nil?\n end", "def logged_in?\n session[:user_id]\n end", "def logged_in?\n not session[:user_id].nil?\n end", "def logged_in?\n not session[:user_id].nil?\n end", "def logged_in?\n not session[:user_id].nil?\n end", "def logged_in?\n if @current_user.is_a?(User)\n # Check that the session user is still the same user as the one we have cached\n @current_user = false unless @current_user.id == session[:user]\n else\n # if there is no one logged in, try to log in a user from session\n @current_user ||= session[:user] ? User.find_by_id(session[:user]) : false\n end \n @current_user.is_a?(User)\n end", "def appHelper_ifUserLogged\n if session[:user_name] \n return true\n end\n return false\n end", "def logged_in?\n\t !session[:user_id].nil?\n\tend", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def session_updatable?\n !devise_controller? && !request_xhr?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def request_user\n # request_valid? is called first which creates a @session instance\n # variable which acts like the global session object of a normal request.\n @request_user ||= User.find(@session[:user_id]) if request_valid?\n end", "def logged_in?\n !!session[:user_id]\n # !!@current_user\n end", "def user?\n get_mode == :user\n end", "def logged_in?\n if session[:user_id]\n true\n else\n false\n end\nend", "def logged_in?\n !session[:user_id].nil?\n end", "def current_user?(user)\n logged_in? and user == current_user\n end", "def is_not_authenticated?\n # if yes, it is not nil.. else false\n session[:user].nil?\nend", "def user_logged_in?\n current_user.present?\n end", "def user_logged_in?\n current_user.present?\n end", "def logged_in?\n !!session[:user_id]\n end", "def logged_in?\n !!session[:user_id]\n end", "def authenticated?\n !!session[:user]\n end", "def user_signed_in?\n session[:user_id].present? && User.find_by(id: session[:user_id])\n end", "def logged_in?\nnot session[:user_id].nil?\nend", "def is_current_user(user)\n logged_in? && @current_user.id == user.id\n end", "def is_valid_session?\n session && session.include?(\"_csrf_token\") && (current_user && session.include?(\"user_credentials\"))\n end" ]
[ "0.76622695", "0.7621638", "0.7544766", "0.7415758", "0.7398147", "0.73174095", "0.72944", "0.7283349", "0.727607", "0.72613263", "0.72273624", "0.72168034", "0.7145939", "0.7131392", "0.71289206", "0.71202534", "0.7119067", "0.7119067", "0.7118152", "0.71030986", "0.7078434", "0.70728815", "0.7045852", "0.7036721", "0.70294225", "0.70181006", "0.70181006", "0.7015595", "0.70127124", "0.69999367", "0.6994735", "0.6983777", "0.6983777", "0.6983777", "0.6983206", "0.6979322", "0.69764787", "0.6964794", "0.695801", "0.695801", "0.6923758", "0.6920688", "0.69066155", "0.6899875", "0.6888131", "0.6887199", "0.6887024", "0.68751925", "0.685803", "0.6852328", "0.6849218", "0.68474036", "0.68474036", "0.68474036", "0.6842707", "0.68425095", "0.68403333", "0.68389696", "0.68389696", "0.68389696", "0.68389696", "0.6835689", "0.68353164", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68343204", "0.68336576", "0.6830665", "0.6820297", "0.68176925", "0.68135643", "0.6812056", "0.67983705", "0.67951155", "0.67951155", "0.6791871", "0.6791871", "0.6780989", "0.677084", "0.6767883", "0.675454", "0.6744347" ]
0.7875037
0
jti is the value from the JWT key value pair in the response and needed for logging and audit purposes
def jti(env) if user_session_request?(env) decode_jwt_no_sig_check(env.body)['jti'] else decode_jwt_no_sig_check(x_vamf_headers(env.request_headers))['jti'] end rescue 'unknown jti' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jwt_subject\n auth0_id_string\n end", "def payload(id, username)\n {\n exp: (Time.now + 30.minutes).to_i,\n iat: Time.now.to_i,\n iss: ENV['JWT_ISSUER'],\n user: {\n id: id,\n username: username\n }\n }\n end", "def payload(id, username)\n {\n exp: (Time.now + 30.minutes).to_i,\n iat: Time.now.to_i,\n iss: ENV['JWT_ISSUER'],\n user: {\n id: id,\n username: username\n }\n }\n end", "def auth_token \n JWT.encode({id: self.id}, \"9885ea7895518eaf88c4a8a2e8f62c82\")\n end", "def auth_token\n JWT.encode({ id: self.id }, '65bc368fbc69306')\n end", "def verify_jti; end", "def verify_jti; end", "def to_token_payload\n payload = {}\n # std jwt claims\n payload['sub'] = id.to_s\n payload['iat'] = Time.now.utc.to_i\n payload['iss'] = Rails.application.secrets.jwt_issuer\n # sombra claims\n payload['role'] = role\n payload['name'] = name\n payload\n end", "def new_jwt\n Knock::AuthToken.new(payload: { sub: current_user.id }).token\n end", "def verification_token\n JWT.encode({ iat: Time.now.to_i }, config.secret, JWT_ALG)\n end", "def original_request_jwt\n env['grape_jwt_auth.original_token']\n end", "def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n token = JWT.decode token, Rails.application.credentials.jwt_secret,\n true,\n { algorithm: 'HS256' }\n token&.first['jti']\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def dev_jwt_token\n JWT.encode(\n {user_id: id},\n Rails.application.secrets.json_web_token_key,\n 'HS256'\n )\n end", "def jwt_payload\n jwt_token.match(/\\.(\\w+\\.\\w+)/)[1]\n end", "def jwt_key\n 'ec6a8b69ae22049f900af9bd9f14ffb4dc6937f69575ab49b4df2d28364055b8'\n end", "def jwt_auth_token( secret )\n\n # expire in 5 minutes\n exp = Time.now.to_i + 5 * 60\n\n # just a standard claim\n exp_payload = { exp: exp }\n\n return JWT.encode exp_payload, secret, 'HS256'\n\n end", "def get_jwt_token\n payload = { data: {user: {id: self.id, email: self.email}} }\n payload[:exp] = (Time.now + Settings.jwt_token_expiry.days).to_i\n\n JWT.encode payload, ENV[\"HMAC_SECRET\"], 'HS256'\n end", "def verify_iat; end", "def verify_iat; end", "def generate_json_web_token(time)\n JWT.encode(\n {\n sub: key_info['oxtrust_client_id'],\n iss: key_info['oxtrust_client_id'],\n exp: time.to_i + 86_400,\n iat: time.to_i,\n jti: SecureRandom.hex(10),\n aud: 'https://localhost/oxauth/restv1/token'\n },\n load_auth_key,\n 'RS256',\n jwt_headers,\n )\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JwtTokenLib.decode(token)\n rescue StandardError => _\n nil\n end", "def user_id\n payload = authenticate!(via: :jwt)\n return payload[\"user\"]\n end", "def jwt_payload\n @jwt_payload ||= request.env['JWT_PAYLOAD']\n end", "def get_customer_id_from_token(jwt_token)\n signed_data = JWT.decode(jwt_token, bc_client_secret, true)\n signed_data[0]['customer']['id'].to_s\nend", "def signed_token(**payload)\n payload = {\n iss: 'The Identity Provider',\n iat: Time.now.to_i,\n exp: 1.hour.from_now.to_i,\n aud: ['example-api', 'user-api', 'calendar-api']\n }.merge(payload)\n private_key = OpenSSL::PKey::RSA.new(file_fixture('rsa1').read)\n JWT.encode(payload.to_h, private_key, 'RS256')\nend", "def wtk\n MnoEnterprise.jwt(user_id: current_user.uid)\n end", "def authenticate_user\n jwt=cookies.signed[:jwt]\n decode_jwt(jwt) \n end", "def auth_bypass_token\n JWT.encode(\n {\n \"sub\" => auth_bypass_id,\n \"content_id\" => content_id,\n \"iat\" => Time.zone.now.to_i,\n \"exp\" => 1.month.from_now.to_i,\n },\n Rails.application.secrets.jwt_auth_secret,\n \"HS256\",\n )\n end", "def auth_bypass_token\n JWT.encode(\n {\n \"sub\" => auth_bypass_id,\n \"content_id\" => content_id,\n \"iat\" => Time.zone.now.to_i,\n \"exp\" => 1.month.from_now.to_i,\n },\n Rails.application.secrets.jwt_auth_secret,\n \"HS256\",\n )\n end", "def render_authentication_payload(user)\n cookies[:cmm_jwt] = create_jwt_cookie(user.id)\n render json: { user: UserSerializer.new(user) }, status: :ok\n end", "def generate_jwt(user)\n now = Time.current.to_i\n\n payload = { sub: user.id,\n iat: now,\n exp: now + Config.jwt_lifetime }\n\n payload.merge!(user.public_send(Config.jwt_additional_user_payload_action)) if Config.jwt_additional_user_payload_action\n\n { token: jwt_encode(payload),\n payload: payload }\n end", "def aud; Settings.jwt.aud end", "def encode_token(payload, exp = 24.hours.from_now)\n payload[:exp] = exp.to_i\n JWT.encode(payload, SECRET_KEY) \n end", "def generate_jwt\n JWT.encode({\n id: id, \n exp: 60.days.from_now.to_i\n }, \n Rails.application.secrets.secret_key_base\n )\n end", "def user_id\n decoded_token.first['user_id']\n end", "def generate_jwt\n JWT.encode({ id: id,\n exp: 60.days.from_now.to_i },\n Rails.application.secrets.secret_key_base)\n end", "def encode_token(payload)\n # I expect something like payload => { userid: int }\n JWT.encode(payload, Rails.application.secrets.secret_key_base)\n end", "def secret_key\n jwt_config['secret_key']\n end", "def signed_jwt\n # We're using the Ruby JWT library.\n # There are very well supported libraries in nearly every language here: https://jwt.io/\n JWT.encode(jwt_payload, median_api_key)\n end", "def payload(user)\n\t\treturn nil unless user and user.id\n\t\t{\n\t\t\tauth_token: JsonWebToken.encode({user_id: user.id, login: user.login}),\n\t\t\tuser: {login: user.login, fio: user.fio}\n\t\t}\n\tend", "def jwt_headers\n {\n typ: 'JWT',\n alg: key_info['alg'],\n kid: key_info['kid']\n }\n end", "def jwt\n return nil if params.format_version.zero?\n SimpleJWT.new(jwt_data, :mac => mac, :key => key, :key_id => key_id)\n end", "def as_jwt_payload\n options = SolidusJwt::Config.jwt_options\n claims = { sub: id }\n\n as_json(options)\n .merge(claims)\n .as_json\n end", "def logged_in_user_id\n token = request.headers[\"Authorization\"]\n # something which might raise an exception\n begin \n decoded_payload = JWT.decode(token, hmac_secret, true, { algorithm: 'HS256' })\n return decoded_payload.first[\"user_id\"].to_i\n # code that deals with some exception\n rescue\n return nil\n end\n end", "def new_jwt_token\n payload = {\n iat: Time.now.to_i, # Issued at time.\n exp: (10 * 60) + Time.now.to_i, # JWT expiration time.\n iss: APP_ID # Integration's GitHub identifier.\n }\n JWT.encode(payload, PRIVATE_KEY, 'RS256')\n end", "def make_jwt\n token_payload = {\n 'tmcusr' => @username,\n 'tmctok' => @tmc_token,\n 'tmcuid' => @tmc_user_id,\n 'tmcadm' => @is_tmc_admin,\n 'exp' => @expires.to_i\n }\n jwt_string = JWT.encode(token_payload, @@jwt_secret, JWT_HASH_ALGO)\n jwt_string\n end", "def client_key_authentication\n if request.headers['JWT'].present?\n auth_header = request.headers['JWT'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n if @token_payload\n @creators_id = @token_payload[0]['creators_id']\n else\n selected_format({ error: 'The provided token wasn´t correct' },:bad_request)\n end\n else\n selected_format({ error: 'Need to include the Authorization header JWT with correct key' },:forbidden)\n end\n end", "def token\n JWT.encode(claims, rsa_key, 'RS512')\n end", "def show\n print(\"@jwt_payload = \" + @jwt_payload['seq'].to_s)\n render json: {'abc':'abc'}, status: :ok\n end", "def current_jwt_context\n @jwt_context ||= session[:jwt_context]\n end", "def token\n HVCrypto::JWT.encode(self[:token], audience)\n end", "def token_user_id\n decoded_token.first['id']\n end", "def call\n JsonWebToken.encode(user_id: user.id) if user\n end", "def call\n JsonWebToken.encode(user_id: user.id) if user\n end", "def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end", "def get_keys(jwt)\n\t\tp 'Setting the keys'\n\t\t@decodedJWT = JWT.decode(jwt.to_s,nil,settings.appSig)\n\t\t@jwtJSON = JSON.parse(@decodedJWT.to_json) \n\t\tsettings.oauthToken = @jwtJSON[\"request\"][\"user\"][\"oauthToken\"]\n\t\tsettings.internalOauthToken = @jwtJSON[\"request\"][\"user\"][\"internalOauthToken\"]\n\t\tsettings.refreshToken = @jwtJSON[\"request\"][\"user\"][\"refreshToken\"]\n\t\tsettings.jwt = jwt\n\t\tsettings.exp = @jwtJSON[\"exp\"]\nend", "def jwt_payload\n super.merge('user' => { name: name, email: email })\n end", "def login_from_jwt_header\n @current_user = if jwt_decoded_payload['sub']\n user_class.sorcery_adapter.find_by_id(jwt_decoded_payload['sub'])\n end\n end", "def decoded_jwt\n JwtWrapper.decode(\n Base64.decode64(\n Oj.load(\n Base64.decode64(params[\"token\"].split(\"--\").first)\n )[\"_rails\"][\"message\"]\n ).delete_prefix('\"').delete_suffix('\"')\n )[\"value\"]\n rescue\n nil\n end", "def encode_token(payload) #encodes your username\n JWT.encode(payload, ENV['SECRET'])\n end", "def get_user_info_from_id_token id_token\n token_parts = id_token.split(\".\")\n encoded_token = token_parts[1]\n leftovers = token_parts[1].length.modulo(4)\n if leftovers == 2\n encoded_token << \"==\"\n elsif leftovers == 3\n encoded_token << \"=\"\n end\n decoded_token = Base64.urlsafe_decode64(encoded_token)\n jwt = JSON.parse decoded_token\n {email: jwt[\"unique_name\"], name: jwt[\"name\"]}\n end", "def meta\n { iss: 'issuer_name', aud: 'user' }\n end", "def token_head(jwt)\n jwt_parts = jwt.split('.')\n return {} if blank?(jwt_parts) || blank?(jwt_parts[0])\n\n json_parse(Base64.decode64(jwt_parts[0]))\n end", "def generate_token(_user)\n JsonWebToken.encode(login_payload, 3.days.from_now)\n end", "def encode(creator)\n #data to be saved in JSON\n payload = { id: creator.id, userName: creator.userName, expires: 2.hours.from_now.to_i}\n \n #very much safe\n JWT.encode( payload, Rails.application.secrets.secret_key_base, \"HS512\")\n end", "def token\n @token ||= JWT.decode(jwt_string, secret_key, true, verify_expiration: false)\n end", "def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end", "def payload(user_id, exp, type, start_time = Time.now)\n\t\tconfig = {\n\t\t\texp: start_time.to_i + exp.to_i,\n\t\t\tiat: start_time.to_i,\n\t\t\tiss: ENV['JWT_ISSUER'],\n\t\t\tuser: {\n\t\t\t\tuser_id: user_id\n\t\t\t},\n\t\t\ttype: type\n\t\t}\n\n\t\treturn config\n\tend", "def generate_token(user)\n payload = {user_id: user.id}\n JWT.encode(payload, ENV[\"SEC_KEY\"] , 'HS256')\n end", "def to_token_payload\n {\n user_id: id,\n sub: id,\n authorization: %w[admin user],\n type: 'account',\n exp: Knock.token_lifetime.from_now.to_i\n }\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil \n end", "def to_token_payload\n {\n sub: id,\n email: email,\n user_name: user_name\n }\n end", "def create\n payload = {\n user: {\n name: Faker::Name.name,\n email: Faker::Internet.email\n }\n }\n\n jwt = Auth.issue(payload)\n\n render json: { jwt: jwt }\n end", "def encode_token(payload)\n #PAYLOAD => {salad: 'tomatoes'}\n JWT.encode(payload, ENV[\"JWT_SECRET\"])\n #jwt string: 'hdjgjdkgjgjsetc...'\n end", "def json_token(cmatch, tstamp, expiration)\n token_url = create_token_url(cmatch, tstamp)\n token_expires = tstamp + expiration\n json :auth => cmatch,\n :timestamp => tstamp,\n :expires => token_expires,\n :token_url => token_url\nend", "def call\n\t\tJsonWebToken.encode(user_id: user.id) if user\t\n\tend", "def jwt_headers_for(user)\n json_headers = { \n 'Content-Type': 'application/json', \n 'Accept': 'application/json' \n }\n Devise::JWT::TestHelpers.auth_headers(json_headers, user) \n end", "def current_jwt_token\n @jwt_auth ||= session[:jwt_auth] ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end", "def encode_token(payload) \n # this method takes in a payload (a hash of key/values you want to save in the token) and signs a token using a secret key. (in production this should an ENV variable.)\n JWT.encode(payload, 'yourSecret') \n end", "def current_user_id\n if request.headers && request.headers['Authorization']\n token = request.headers['Authorization'].split(' ')[1] #[Bearer <token>]\n begin\n decoded_token = JWT.decode(token, 'this should be in .env', true, algorithm: 'HS256')\n if decoded_token\n user_id = decoded_token[0]['user_id'] #[{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n end\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def decode_jwt(jwt)\n #check the headers in post for jwt\n # byebug\n # if auth_header \n # token = cookies.signed[:jwt]\n # auth_header.split(' ')[1]\n begin\n # decode the token, return the decoded part\n JWT.decode(jwt, Rails.application.secrets.secret_key_base, true, algorithm: 'HS256')[0]\n rescue JWT::DecodeError \n # byebug \n # render json: {message: \"NOPE!!!! Really no!\"}, status: :unauthorized\n\n nil\n end\n # end\n end", "def auth_token(payload = nil)\n if payload.nil?\n payload = {data: {authenticated: true, user: current_user_data}}\n end\n\n EchoCommon::Services::Jwt.encode payload\n end", "def call\n JsonWebToken.encode(user_id: api_user.id) if api_user\n end", "def token\n @token ||= HashWithIndifferentAccess.new(\n JWT.decode(authentication_token, secret, true, decode_options).first\n )\n rescue JWT::DecodeError, JWT::ExpiredSignature, JWT::InvalidIatError\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def token\n identity = Faker::Internet.user_name.gsub(/[^0-9a-z_]/i, '')\n\n capability = Twilio::Util::Capability.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # The Twilio \n capability.allow_client_outgoing ENV['TWILIO_TWIML_APP_SID']\n capability.allow_client_incoming identity\n token = capability.generate\n\n render json: {identity: identity, token: token}\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def claims\n JWT.decode(jwt_token_from_request, Rails.application.secrets.secret_key_base, true)\n rescue\n nil\n end", "def encode_token(payload) # arg is data identifying user — e.g., DB id and username\n \n JWT.encode(payload, secret,algorithm)\n end", "def encode_token(payload)\n JWT.encode(payload, 'yourSecret')\n end", "def decoded_token\n if token_from_cookie\n token= token_from_cookie\n # byebug\n begin\n JWT.decode(token, Rails.application.credentials.jwt_token, true, algorithm: \"HS256\")\n # JWT.decode => [{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def auth_token\n self.auth_response[:auth_token]\n end", "def encodeJWT(creator, exp=2.hours.from_now)\n # add the expire to the payload, as an integer\n payload = { creator_id: creator.id }\n payload[:exp] = exp.to_i\n\n # Encode the payload whit the application secret, and a more advanced hash method (creates header with JWT gem)\n JWT.encode( payload, Rails.application.secrets.secret_key_base, \"HS512\")\n\n end" ]
[ "0.6744525", "0.65849125", "0.65849125", "0.65814745", "0.64421386", "0.6348845", "0.6348845", "0.63441765", "0.628879", "0.6273029", "0.6111902", "0.6102883", "0.6085786", "0.60713667", "0.6035578", "0.60196286", "0.60168153", "0.6002532", "0.6002532", "0.595924", "0.59444314", "0.59231037", "0.59208363", "0.59185606", "0.59118295", "0.5911131", "0.5901908", "0.5891255", "0.5891255", "0.58822215", "0.5879394", "0.586395", "0.5861752", "0.58362764", "0.583466", "0.5816831", "0.5811964", "0.58043224", "0.57832927", "0.5780843", "0.5777963", "0.57574326", "0.5755035", "0.5719941", "0.5709033", "0.57063085", "0.57037574", "0.5690723", "0.56889176", "0.5682566", "0.5676629", "0.5675265", "0.56632406", "0.56632406", "0.5659774", "0.56558126", "0.5650235", "0.5649511", "0.56487995", "0.56354725", "0.56146365", "0.5612849", "0.561034", "0.5609174", "0.5607642", "0.56075484", "0.55995333", "0.5596121", "0.5593666", "0.55922866", "0.558545", "0.5584093", "0.5583325", "0.55803925", "0.5579187", "0.5576993", "0.55748016", "0.554783", "0.5545358", "0.5541352", "0.55318874", "0.5528578", "0.55232793", "0.55112827", "0.5508836", "0.5508836", "0.5508836", "0.5508836", "0.5508836", "0.5508836", "0.5508836", "0.5508836", "0.55017215", "0.54830074", "0.5482826", "0.5475181", "0.54738295", "0.5463847", "0.54504484", "0.5449821" ]
0.7777161
0
x_vamf_headers identifies which XVamfHeader was set and returns the appropriate header value
def x_vamf_headers(request_headers) request_headers['X-Vamf-Jwt'] || request_headers['X-VAMF-JWT'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_value\n return @header_value\n end", "def headerlist; return ['X-MXL-NoteHash', 'X-MXL-Hash', 'X-MX-Bounce']; end", "def header name\n headers.each_pair do |header_name, header_value|\n if header_name.downcase == name.to_s.downcase\n return header_value.is_a?(Array) ? header_value.first : header_value\n end\n end\n nil\n end", "def getHeader() @header1 end", "def header_value\n @pairs.fetch(\"value\")\n end", "def extract_header_value(response, key)\n response.headers[key].class == Array ? response.headers[key].first.to_i : response.headers[key].to_i \n end", "def extract_header_value(response, key)\n response.headers[key].class == Array ? response.headers[key].first.to_i : response.headers[key].to_i \n end", "def headerlist; return ['X-ZohoMail']; end", "def header(name)\n @responseheaders[name.downcase]\n end", "def header(name)\n @response[name]\n end", "def header(name)\n @env.response_headers[name]\n end", "def parse_atx_header; end", "def get_header(name)\n headers.each do |key,value|\n if key.casecmp(name) == 0\n return value\n end\n end\n nil\n end", "def [](v)\n headers[v]\n end", "def header\n @result['_header']\n end", "def get_header name\n request_object.headers[name]\n end", "def header(key)\n return false unless headers.key?(key)\n\n headers.fetch(key).first.to_s\n end", "def header?(key)\n\t\t\[email protected]{|h| h[:id] == key}[0] rescue nil\n\t\tend", "def header; message[:header]; end", "def parse_header\n header.each do |field, value|\n self.instance_variable_set(\"@#{field}\", value) if HEADER_FIELDS.include? field\n end\n end", "def get_headers_\n hin = ATS::Headers_in.new\n hin.all.reduce({}) do |memo, pair| \n memo[pair.first.downcase] = pair[1]; memo\n end\n end", "def headers\n @attributes[:headers]\n end", "def read_headers\n @app_environment = request.headers[\"x-vendor-appEnvironment\"]\n @app_version = request.headers[\"x-vendor-appVersion\"]\n end", "def header(name)\n rack_header = \"http-#{name}\".upcase!.tr('-', '_')\n\n hdr = @env[rack_header]\n\n # Only return the value if it is not an empty string\n hdr if hdr != ''\n end", "def headers=(_arg0); end", "def headers=(_arg0); end", "def headers=(_arg0); end", "def headers=(_arg0); end", "def get_response_header(response)\n raise \"REST response was nil\" if response == nil\n raise \"REST response had no attached header\" if response.headers == nil\n begin\n header = response.headers # already in Ruby Hash format\n set_all_defaults(body)\n rescue JSON::ParserError => e\n puts \"rescued : ParserError\"\n puts e\n header = response.headers\n end\n header\n end", "def parse_header_contents; end", "def getSecondHeader() @header2 end", "def match_header(key)\n @env[key.upcase.tr(\"-\",\"_\")]\n end", "def parsed_content_type_header; end", "def header_value=(value)\n @header_value = value\n end", "def headers\n @attachment_as_ruby.first\n end", "def headers\n\t\t\thdr = @curb.header_str\n\t\t\tself.class.recode(log?, @curb.content_type, hdr) ?\n\t\t\t\tself.class.parse_headers(hdr) :\n\t\t\t\tself.class.parse_headers(@curb.header_str) # recode failed\n\t\tend", "def header_contains\n return @header_contains\n end", "def header\n return @header\n end", "def get_soap_header\n return { \"ins0:SessionHeader\" => { \"ins0:sessionId\" => self.sid } } \n end", "def get_headers\n @headers = headers\n @headers\n end", "def headers\n if self.middleware.to_sym == :reso_api\n reso_headers\n else\n spark_headers\n end\n end", "def parse_header(line)\n case line\n when /^#%checkm/\n match = /^#%checkm_(\\d+)\\.(\\d+)/.match line\n @version = \"#{match[1]}.#{match[2]}\" if match\n when /^#%eof/\n @eof = true\n when /^#%fields/\n list = line.split('|')\n list.shift\n @fields = list.map { |v| v.strip.downcase }\n when /^#%prefix/, /^#%profile/\n # do nothing\n end\n end", "def headers\n {\n 'X-EBAY-API-COMPATIBILITY-LEVEL' => @compatability_level.to_s,\n 'X-EBAY-API-DEV-NAME' => dev_id.to_s,\n 'X-EBAY-API-APP-NAME' => app_id.to_s,\n 'X-EBAY-API-CERT-NAME' => cert_id.to_s,\n 'X-EBAY-API-CALL-NAME' => @command.to_s,\n 'X-EBAY-API-SITEID' => @site_id.to_s,\n 'Content-Type' => 'text/xml'\n }\n end", "def getHeaderFieldNames\n\t\tend", "def request_headers\n @attributes[:request_headers]\n end", "def request_headers; end", "def request_headers; end", "def headers\n # units and source have to go last, so if we push in a new header, these go\n # at end\n @headers+['units','source']\n end", "def get_header(*params); raise('Stub or mock required.') end", "def headers\n end", "def header_fields\n header.fields\n end", "def headercheck(raw)\n decode(raw)[0...Payload::HEADER.length] == Payload::HEADER\n end", "def processed_headers; end", "def headers\n @headers ||= message.header_fields\n end", "def header(name, value)\n name = name.upcase\n name.tr!('-', '_')\n name = \"HTTP_#{name}\" unless name == 'CONTENT_TYPE' || name == 'CONTENT_LENGTH'\n env(name, value)\n end", "def header(key)\n return false unless @args.fetch(:headers).key?(key)\n @args.fetch(:headers).fetch(key).first.to_s\n end", "def response_headers! http_status_code = 200, http_with_version = 'HTTP 1.1', header_hash\n errors = header_hash.each_with_object [] do |(key, val), errors|\n key = key.to_s; val = val.to_s\n rv = Wrapper.msc_add_n_response_header txn_ptr, (strptr key), key.bytesize, (strptr val), val.bytesize\n rv == 1 or errors << \"msc_add_n_response_header failed adding #{[key,val].inspect}\"\n end\n\n raise Error, errors if errors.any?\n\n rv = Wrapper.msc_process_response_headers txn_ptr, (Integer http_status_code), (strptr http_with_version)\n rv == 1 or raise \"msc_process_response_headers failed\"\n\n intervention!\n end", "def header?(key)\n key.is_a?(Numeric) || @headers.nil? || @headers.include?(key)\n end", "def header(haders, name)\n headers[name]\n end", "def header\n @message.header\n end", "def get_headers\n request_object.headers\n end", "def [](k) @headers[translate_header_to_sym(k)] end", "def headers\n @headers ||= rack_environment.select{|k,v| k.start_with? 'HTTP_'}\n end", "def soap_headers\n { \"Content-Type\" => ContentType[@soap.version], \"SOAPAction\" => @soap.action }\n end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers; end", "def headers\n msg['headers']||{}\n end", "def header(nheaders,hname)\n\t\t\tnheaders.each_line do |lh|\n\t\t\t\tn,v = lh.split(\": \")\n\t\t\t\tif n == hname\n\t\t\t\t\treturn v\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn hstr\n\t\tend", "def catch_pm_headers(headers)\n return {} unless Array === headers\n caught = {}\n headers.each do |h|\n case h[:name]\n when 'X-Spam-Status'\n caught[:spam_status] = h[:value].downcase.start_with?('yes')\n when 'X-Spam-Score'\n caught[:spam_score] = h[:value].to_f\n when 'Received-SPF'\n caught[:received_spf_status] = (h[:value].split)[0].downcase\n end\n end\n return caught\n end", "def translate_header(header, value)\n value\n end", "def local_header_offset; end", "def parse_header(line)\n if (match = line.match(/^(.+?):\\s*(.+)#{@nl}$/))\n key = match[1].downcase\n set_header_special_values(key, match[2])\n parse_normal_header(line, key, match[1], match[2])\n elsif (match = line.match(/^HTTP\\/([\\d\\.]+)\\s+(\\d+)\\s+(.+)$/))\n @response.code = match[2]\n @response.http_version = match[1]\n @http2.on_content_call(@args, line)\n else\n raise \"Could not understand header string: '#{line}'.\"\n end\n end", "def headers\n @headers ||= response ? Hash[response.headers.map{ |k,v| [k.downcase,v] }] : {}\n end", "def get_rec_header!\n if @abca\n return [nil, nil] unless get_byte.between?(0x80, 0xbf)\n if @ofs == 0x11 or @data[@ofs-1].ord & 0x20 != 0\n get_node_type_and_version\n else\n get_node_type_and_version_abca\n end\n else\n return [nil, nil] unless get_byte == 0x80\n get_node_type_and_version\n end\n end", "def extract_header_token(env)\n BEARER_TOKEN_REGEX.match(env['HTTP_AUTHORIZATION'])&.[](1)\n end", "def response_headers\n @headers\n end", "def header(name)\n req = request\n return nil unless req\n req.env[name]\n end", "def header\n return @message.header\n end", "def vary_headers=(_arg0); end", "def headers\n @headers ||= begin\n @mail.header.fields.inject({}) do |memo, field|\n name = field.name.downcase.to_s\n next memo if self.class.skipped_headers.include?(name)\n\n header = unquoted_header(name)\n memo.update(name => self.class.unescape(header))\n end\n end\n end", "def headers=(v)\n check_headers(v)\n set_headers(v)\n v\n end", "def header\n @raw.split(\"--\" + boundary)[0]\n end", "def headers\n @headers ||= HeaderHash.new(@http_response.to_hash)\n end", "def check_headers(v)\n return true unless v\n return true if v.size == 0\n if HEADER_REGEXP !~ v\n raise InvalidComponentError,\n \"bad component(expected opaque component): #{v}\"\n end\n\n true\n end", "def raw_headers; end", "def header(key, val)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n _httpsession.resp.header(key, val)\n return nil\n end", "def header_fields\n @csv.headers\n end", "def header_length() 3 end", "def extract_header_data(response)\n header_type = get_full_type_signature(:SoapResponseHeader)\n headers = response.header[:response_header].dup\n process_attributes(headers, false)\n result = headers.inject({}) do |result, (key, v)|\n normalize_output_field(headers, header_type[:fields], key)\n result[key] = headers[key]\n result\n end\n return result\n end", "def verify_header\n # normal header like sample ==> Authorization 'ddd$$%gggrghHFDSS.HHJHTTGGR'\n if headers['Authorization'].present?\n headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Token')\n nil\n end\n end", "def parse_setext_header; end", "def header(name)\n name = name.gsub(/-/, \"_\").upcase\n return request.env[name] if request.env.key?(name)\n request.env[\"HTTP_#{name}\"]\n end" ]
[ "0.6520394", "0.6366538", "0.6266593", "0.62323165", "0.61974835", "0.60926694", "0.60926694", "0.60916203", "0.6074853", "0.60645974", "0.60324836", "0.5988682", "0.59624296", "0.59298015", "0.586516", "0.5808034", "0.5728491", "0.5712383", "0.5707322", "0.56599647", "0.564814", "0.564668", "0.5625537", "0.5624636", "0.5620298", "0.5620298", "0.5620298", "0.5620298", "0.5595845", "0.5594519", "0.55799645", "0.5579212", "0.5571342", "0.5567393", "0.5563832", "0.5507737", "0.5506261", "0.54986507", "0.5487144", "0.547637", "0.5475768", "0.546058", "0.54473627", "0.54451704", "0.54357773", "0.5423983", "0.5423983", "0.54135007", "0.541327", "0.5407823", "0.5403361", "0.54021466", "0.53965557", "0.5387322", "0.537476", "0.5374001", "0.53737795", "0.5367658", "0.53653014", "0.53597903", "0.53532344", "0.53470194", "0.5334107", "0.53340757", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5328218", "0.5327089", "0.5309947", "0.5309782", "0.53097147", "0.5308908", "0.53084326", "0.53080475", "0.5301479", "0.5295183", "0.5292549", "0.5291917", "0.5291796", "0.5289359", "0.52820283", "0.5280009", "0.52716494", "0.5259682", "0.52548337", "0.5254344", "0.5254173", "0.52541584", "0.5252393", "0.5242158", "0.5241977", "0.5237899", "0.52347326" ]
0.7667094
0
grabs info about a particular host from PuppetDB
def query_pdb_host(certname, port) require 'json' require 'uri' require 'net/http' # TODO move to ssl uri = URI("http://localhost:#{port}/pdb/query/v4/nodes/#{certname}") @logger.debug("Running PDB query: #{uri}") begin data = JSON.parse(Net::HTTP.get(uri), :symbolize_names => true) rescue Exception => e err_msg = "#{e}\n" + " Please make sure PuppetDB is running, this script is being run from\n" + " the PuppetDB host, and the port is correct" @logger.error err_msg end if data.keys.include? :error err_msg = "Could not retrieve node data for #{certname}" + " Server Said: #{data}" @logger.error err_msg end @logger.debug("Received Response: #{data}") data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def host_info\n @host_info\n end", "def info_host(host)\n validate_list([[\"Host\", host, :presence]])\n options = {\"Host\" => host}\n\n connection = Connection.new\n connection.post(\"Domain/Host/Info\", options)\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def host_detail(scan_id, host_id)\n res = http_get(:uri=>\"/scans/#{scan_id}/hosts/#{host_id}\", :fields=>x_cookie)\n end", "def host\n attributes['host']\n end", "def info(session, id)\n read_task('rvpe.host.info', session) do\n call_one_xmlrpc('one.host.info', session, id)\n end\n end", "def get_facts(host)\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes/#{host}/facts\")\n curl.get\n result = JSON.parse(curl.body_str)\n warn \"Error #{host} not found in puppetdb\" if result.empty?\n result\n end", "def report_host(opts)\n\n return if !active\n addr = opts.delete(:host) || return\n\n # Sometimes a host setup through a pivot will see the address as \"Remote Pipe\"\n if addr.eql? \"Remote Pipe\"\n return\n end\n\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts = opts.clone\n opts.delete(:workspace)\n\n begin\n retry_attempts ||= 0\n if !addr.kind_of? ::Mdm::Host\n addr = Msf::Util::Host.normalize_host(addr)\n\n unless ipv46_validator(addr)\n raise ::ArgumentError, \"Invalid IP address in report_host(): #{addr}\"\n end\n\n conditions = {address: addr}\n conditions[:comm] = opts[:comm] if !opts[:comm].nil? && opts[:comm].length > 0\n host = wspace.hosts.where(conditions).first_or_initialize\n else\n host = addr\n end\n\n ostate = host.state\n\n # Truncate the info field at the maximum field length\n if opts[:info]\n opts[:info] = opts[:info][0,65535]\n end\n\n # Truncate the name field at the maximum field length\n if opts[:name]\n opts[:name] = opts[:name][0,255]\n end\n\n if opts[:os_name]\n os_name, os_flavor = split_windows_os_name(opts[:os_name])\n opts[:os_name] = os_name if os_name.present?\n if opts[:os_flavor].present?\n if os_flavor.present? # only prepend if there is a value that needs it\n opts[:os_flavor] = os_flavor + opts[:os_flavor]\n end\n else\n opts[:os_flavor] = os_flavor\n end\n end\n\n opts.each do |k,v|\n if host.attribute_names.include?(k.to_s)\n unless host.attribute_locked?(k.to_s)\n host[k] = v.to_s.gsub(/[\\x00-\\x1f]/n, '')\n end\n elsif !v.blank?\n dlog(\"Unknown attribute for ::Mdm::Host: #{k}\")\n end\n end\n host.info = host.info[0,::Mdm::Host.columns_hash[\"info\"].limit] if host.info\n\n # Set default fields if needed\n host.state = Msf::HostState::Alive if host.state.nil? || host.state.empty?\n host.comm = '' unless host.comm\n host.workspace = wspace unless host.workspace\n\n begin\n framework.events.on_db_host(host) if host.new_record?\n rescue => e\n wlog(\"Exception in on_db_host event handler: #{e.class}: #{e}\")\n wlog(\"Call Stack\\n#{e.backtrace.join(\"\\n\")}\")\n end\n\n host_state_changed(host, ostate) if host.state != ostate\n\n if host.changed?\n msf_import_timestamps(opts, host)\n host.save!\n end\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid\n # two concurrent report requests for a new host could result in a RecordNotUnique or\n # RecordInvalid exception, simply retry the report once more as an optimistic approach\n retry if (retry_attempts+=1) <= 1\n raise\n end\n\n if opts[:task]\n Mdm::TaskHost.create(\n :task => opts[:task],\n :host => host\n )\n end\n\n host\n }\n end", "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "def host\n @config.db_hostname\n end", "def get_host\n @host\n end", "def query_pdb_hosts(port)\n require 'json'\n require 'uri'\n require 'net/http'\n\n # TODO move to ssl\n uri = URI(\"http://localhost:#{port}/pdb/query/v4/nodes\")\n\n @logger.debug(\"Running PDB query: #{uri}\")\n\n begin\n data = JSON.parse(Net::HTTP.get(uri), :symbolize_names => true)\n rescue Exception => e\n err_msg = \"#{e}\\n\" +\n \" Please make sure PuppetDB is running, this script is being run from\\n\" +\n \" the PuppetDB host, and the port is correct\"\n @logger.error err_msg\n end\n\n @logger.debug(\"Received Response: #{data}\")\n\n data\n end", "def check\n\t\tres = Host.find(:first)\n\tend", "def get_connect_info(host, host_id)\n conn_opts = {}\n client = OpenNebula::Client.new\n\n if host.is_a?(String)\n if !host_id\n pool = OpenNebula::HostPool.new(client)\n pool.info\n objects = pool.select {|object| object.name==host }\n host_id = objects.first.id\n @host_id = host_id\n end\n else\n host_id = host['ID']\n end\n\n xmlhost = OpenNebula::Host.new_with_id(host_id, client)\n xmlhost.info(true)\n\n if xmlhost[\"TEMPLATE/PROVISION\"]\n @tmplBase = 'TEMPLATE/PROVISION'\n else\n @tmplBase = 'TEMPLATE'\n end\n\n if xmlhost[\"TEMPLATE/PM_MAD\"]\n @provision_type = :host\n else\n @provision_type = :vm\n end\n\n conn_opts = {\n :access => xmlhost[\"#{@tmplBase}/EC2_ACCESS\"],\n :secret => xmlhost[\"#{@tmplBase}/EC2_SECRET\"],\n :region => xmlhost[\"#{@tmplBase}/REGION_NAME\"]\n }\n\n return conn_opts\n end", "def get_host( name )\n @hosts[ name ]\n end", "def hostinfo\n return self.host.to_s + (self.port ? ':' + self.port.to_s : '')\n end", "def host\n @host\n end", "def host\n @host\n end", "def on_db_host(host)\n\tend", "def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end", "def get_host(opts)\n if opts.kind_of? ::Mdm::Host\n return opts\n elsif opts.kind_of? String\n raise RuntimeError, \"This invocation of get_host is no longer supported: #{caller}\"\n else\n address = opts[:addr] || opts[:address] || opts[:host] || return\n return address if address.kind_of? ::Mdm::Host\n end\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n\n address = Msf::Util::Host.normalize_host(address)\n return wspace.hosts.find_by_address(address)\n }\n end", "def host\n @host\n end", "def get_puppetdb_hosts\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes\")\n curl.get\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['name'] }\n @puppetdb_hosts = servers_array\n end", "def get_host_template_conn(host)\n conn = {}\n\n # TODO: some nice / generic way (even for configuration?)\n tmpl = host.to_hash['HOST']['TEMPLATE']['PROVISION_CONNECTION']\n tmpl ||= {}\n tmpl.each_pair do |key, value|\n conn[key.downcase] = value\n end\n\n conn\n end", "def get_host_template_conn(host)\n conn = {}\n\n # TODO: some nice / generic way (even for configuration?)\n tmpl = host.to_hash['HOST']['TEMPLATE']['PROVISION_CONNECTION']\n tmpl ||= {}\n tmpl.each_pair do |key, value|\n conn[key.downcase] = value\n end\n\n conn\n end", "def get_host_details\n @host = find_host_by_spoof || find_host_by_token || find_host_by_ip_or_mac\n unless @host\n logger.info \"#{controller_name}: unable to find a host that matches the request from #{request.env['REMOTE_ADDR']}\"\n head(:not_found) and return\n end\n unless @host.operatingsystem\n logger.error \"#{controller_name}: #{@host.name}'s operating system is missing!\"\n head(:conflict) and return\n end\n unless @host.operatingsystem.family\n # Then, for some reason, the OS has not been specialized into a Redhat or Debian class\n logger.error \"#{controller_name}: #{@host.name}'s operating system [#{@host.operatingsystem.fullname}] has no OS family!\"\n head(:conflict) and return\n end\n logger.info \"Found #{@host}\"\n end", "def get_host_by_displayname(displayname)\n host = nil\n host_json = rpc(\"getHost\", {\"displayName\" => URI::encode(displayname)})\n host_resp = JSON.parse(host_json)\n# p host_resp\n if host_resp[\"status\"] == 200\n host = host_resp[\"data\"]\n# puts(\"Found host matching #{displayname}\")\n end\n host\nend", "def get_host( host_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetHost.new,\n :path => \"/api/1.1/hosts/#{host_id}.xml\"\n )\n end", "def on_db_host(context, host)\n\tend", "def report_host(opts)\n\t\treturn if not db\n\t\taddr = opts[:host] || return\n\t\tframework.db.report_host_state(self, addr, Msf::HostState::Alive)\n\n\t\topts.delete(:host)\n\t\tif (opts.length > 0) \n\t\t\tframework.db.report_host(self, addr, opts)\n\t\tend\n\tend", "def first_db_host\n @db_host ||= find_servers(:roles => :db).map(&:to_s).first\nend", "def get_mysql_hostname \n @mysql_hostname = @sequel[\"SELECT @@hostname;\"].first[:@@hostname]\n end", "def get_mysql_hostname \n @mysql_hostname = @sequel[\"SELECT @@hostname;\"].first[:@@hostname]\n end", "def info(database)\n command 'SHOW INFO', database do\n response 112\n text\n end\n end", "def host\n return @host\n end", "def host\n return @host\n end", "def show\n @host = Host.find_by(id: current_host.id)\n end", "def host(node)\n serial_number = node.serialNumber\n Host.find_by(:service_tag => serial_number) ||\n Host.joins(:hardware).find_by('hardwares.serial_number' => serial_number)\n end", "def srvhost\n datastore['SRVHOST']\n end", "def get_host_by_hostname(hostname, collector)\n host = nil\n if collector\n hosts_json = rpc(\"getHosts\", {\"hostGroupId\" => 1})\n hosts_resp = JSON.parse(hosts_json)\n# p hosts_resp\n collector_resp = JSON.parse(rpc(\"getAgents\", {}))\n if hosts_resp[\"status\"] == 200\n hosts_resp[\"data\"][\"hosts\"].each do |h|\n if h[\"hostName\"].eql?(hostname)\n # puts(\"Found host with matching hostname: #{resource[:hostname]}\")\n # puts(\"Checking agent match\")\n if collector_resp[\"status\"] == 200\n collector_resp[\"data\"].each do |c|\n if c[\"description\"].eql?(collector)\n host = h\n end\n end\n else\n puts(\"Unable to retrieve collector list from server\")\n end\n end\n end\n else\n puts(\"Unable to retrieve host list from server\" )\n end\n end\n host\nend", "def monitor_hosts_and_vms\n totalmemory = 0\n totalcpu = 0\n\n host_info = \"HYPERVISOR=opennebula\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host['hostname']}\\\"\\n\"\n case @host['host_mon']['type']\n when 'fixed'\n host_info << \"TOTALMEMORY=#{@host['host_mon']['memory']}\\n\"\n host_info << \"TOTALCPU=#{@host['host_mon']['cpu']}\\n\"\n when 'instance_based'\n @host['capacity'].each { |name, size|\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * size.to_i\n totalcpu += cpu * size.to_i\n }\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n when 'dynamic'\n host_info << get_remote_quotas\n end\n\n usedcpu = 0\n usedmemory = 0\n\n vms_info = get_all_vms_poll_info\n puts host_info\n puts vms_info\n end", "def info(decrypt = false)\n super(HOST_METHODS[:info], 'HOST', decrypt)\n end", "def local_host_2_ip (host)\n\t\tputs \"DNS lookup from the local host repository\" if @verbose\n\t\thost=host.strip unless host.nil?\n\t\tif @known_hosts.key?(host)\n\t\t\treturn @known_hosts[host]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def get_host(host)\n\t\t\tif host == 'gateway'\n\t\t\t\tif @prod_env\n\t\t\t\t\t@gateway_prod\n\t\t\t\telse\n\t\t\t\t\t@gateway_dev\n\t\t\t\tend\n\t\t\telsif host == 'panel'\n\t\t\t\tif @prod_env\n\t\t\t\t\t@panel_prod\n\t\t\t\telse\n\t\t\t\t\t@panel_dev\n\t\t\t\tend\n\t\t\telsif host == 'minhaconta'\n\t\t\t\tif @prod_env\n\t\t\t\t\t@minhaconta_prod\n\t\t\t\telse\n\t\t\t\t\t@minhaconta_dev\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def [](hostname)\n return nil if @hosts[hostname].nil?\n @hosts[hostname][:host]\n end", "def get_host(context, address, comm='')\n\t\thost = Host.find(:first, :conditions => [ \"address = ? and comm = ?\", address, comm])\n\t\tif (not host)\n\t\t\thost = Host.create(:address => address, :comm => comm, :state => HostState::Unknown, :created => Time.now)\n\t\t\thost.save\n\t\t\tframework.events.on_db_host(context, host)\n\t\tend\n\n\t\treturn host\n\tend", "def report_get_host(report_id,host)\r\n\t\tpost= { \"token\" => @token, \"report\" => report_id } \r\n\t\tdocxml=nessus_request('report/hosts', post)\r\n\t\tdocxml.root.elements['contents'].elements['hostList'].each_element('//host') { |host| \r\n\t\t\tif host.elements['hostname'].text == host\r\n\t\t\t\tretval={}\r\n\t\t\t\tretval[:severity] = host.elements['severity'].text\r\n\t\t\t\tretval[:current] = host.elements['scanProgressCurrent'].text\r\n\t\t\t\tretval[:total] = host.elements['scanProgressTotal'].text\r\n\t\t\t\treturn retval\r\n\t\t\tend\r\n\t\t}\r\n\tend", "def query_puppetdb(pql)\n require 'puppet/util/puppetdb'\n return Puppet::Util::Puppetdb.query_puppetdb(pql)\n rescue Puppet::Error\n return nil\n end", "def print_host(host)\n\t\tputs \"Local host store entry for #{host}\"\n\t\thost.strip!\n\t\traise \"Invalid input: #{host}\" unless is_fqdn?(host)\n\t\tif @known_hosts.key?(host)\n\t\t\tvalue=@known_hosts[host]\n\t\t\tputs \"#{host}\\t#{value}\"\n\t\telse\n\t\t\tputs \"Unknown host in the local store: #{host}\"\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def get_host(fqdn)\n foreman('GET', \"/api/hosts/#{fqdn}\")\n end", "def host\n self.host\n end", "def get_host(host_id = self.current_host_id)\n if host_id\n self.is_guest_of_what.find {|host| host.id == host_id}\n else\n self.is_guest_of_what.first\n end\n end", "def host\n @host = self.hostuser\n end", "def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend", "def host\n @manager.primary_pool.host\n end", "def run_host(ip)\n\t\tuser = datastore['USERNAME']\n\t\tpass = postgres_password\n\t\tdo_fingerprint(user,pass,datastore['DATABASE'],datastore['VERBOSE'])\n\tend", "def report_get_host(report_id,hostname)\n\t\t\tpost= { \"token\" => @token, \"report\" => report_id }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/hosts', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tdocxml.elements.each('/reply/contents/hostList/host') do |host|\n\t\t\t\tif host.elements['hostname'].text == hostname\n\t\t\t\t\tseverity = host.elements['severity'].text\n\t\t\t\t\tcurrent = host.elements['scanProgressCurrent'].text\n\t\t\t\t\ttotal = host.elements['scanProgressTotal'].text\n\t\t\t\t\treturn severity, current, total\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def name\n \"#{self[:host]}\"\n end", "def search_host\n begin\n if @host_search\n @host = Resolv.getname self.ip.to_s\n else\n @host = nil\n end\n rescue Resolv::ResolvError\n @host = nil\n end\n end", "def pqdb(planet)\n log_if_missing(planet, 'pqdb')\n\n server = find_server(planet)\n value = server.connection(:ssh)\n\n errors = Logger.instance.errors(server.id)\n log(planet.id, errors) if errors.any?\n\n \"#{planet['pqdb']&.split('@')&.last}:#{value}\"\n end", "def getHostConfig(host=nil)\n host=@hostname if host.nil?\n hc=self[host.to_sym]\n raise \"HostConfig not found for #{host}\" if hc.nil?\n HostConfig.new(:hc=>hc, :logger=>@log)\n end", "def host\n @host ||= Chimps.config[:catalog][:host]\n end", "def db_host(app_id, database_id)\n all_addons = heroku_client.addon.list_by_app(app_id)\n database_json = all_addons.find do |addon|\n [addon['id'], addon['addon_service']['id']].include?(database_id)\n end\n return STARTER_HOST if database_json.nil?\n\n host_for(database_json)\n end", "def report_host(opts)\n\t\treturn if not active\n\t\taddr = opts.delete(:host) || return\n\n\t\t# Ensure the host field updated_at is changed on each report_host()\n\t\tif addr.kind_of? Host\n\t\t\tqueue( Proc.new { addr.updated_at = addr.created_at; addr.save! } )\n\t\t\treturn addr\n\t\tend\n\n\t\twait = opts.delete(:wait)\n\t\twspace = opts.delete(:workspace) || workspace\n\n\t\tif opts[:host_mac]\n\t\t\topts[:mac] = opts.delete(:host_mac)\n\t\tend\n\n\t\tunless ipv4_validator(addr)\n\t\t\traise ::ArgumentError, \"Invalid IP address in report_host(): #{addr}\"\n\t\tend\n\n\t\tret = {}\n\t\ttask = queue( Proc.new {\n\t\t\tif opts[:comm] and opts[:comm].length > 0\n\t\t\t\thost = wspace.hosts.find_or_initialize_by_address_and_comm(addr, opts[:comm])\n\t\t\telse\n\t\t\t\thost = wspace.hosts.find_or_initialize_by_address(addr)\n\t\t\tend\n\n\t\t\topts.each { |k,v|\n\t\t\t\tif (host.attribute_names.include?(k.to_s))\n\t\t\t\t\thost[k] = v\n\t\t\t\telse\n\t\t\t\t\tdlog(\"Unknown attribute for Host: #{k}\")\n\t\t\t\tend\n\t\t\t}\n\t\t\thost.info = host.info[0,Host.columns_hash[\"info\"].limit] if host.info\n\n\t\t\t# Set default fields if needed\n\t\t\thost.state = HostState::Alive if not host.state\n\t\t\thost.comm = '' if not host.comm\n\t\t\thost.workspace = wspace if not host.workspace\n\n\t\t\t# Always save the host, helps track updates\n\t\t\tmsfe_import_timestamps(opts,host)\n\t\t\thost.save!\n\n\t\t\tret[:host] = host\n\t\t} )\n\t\tif wait\n\t\t\treturn nil if task.wait != :done\n\t\t\treturn ret[:host]\n\t\tend\n\t\treturn task\n\tend", "def get_kvm_hostinfo\n guests = {}\n begin\n result = `virsh list --all`\n result.split(\"\\n\").each do |line|\n if line =~ /(\\d+)\\s+(\\S+)\\s+(\\S+)/\n guest_hostname = $2\n guests[guest_hostname] = get_kvm_guest_info(guest_hostname)\n end\n end\n rescue\n warn \"Failed to run/parse virsh command\"\n end\n return guests\n end", "def host_id\n\t\t\t\"#{host}:#{port}\"\n\t\tend", "def db2_probe(timeout=5)\n disconnect if self.sock\n connect\n\n probe_packet = Rex::Proto::DRDA::Utils.client_probe(datastore['DATABASE'])\n sock.put probe_packet\n resp = sock.get_once\n\n return {} if not resp\n return {} if resp.length == 0\n pkt = Rex::Proto::DRDA::SERVER_PACKET.new.read(resp)\n return Rex::Proto::DRDA::Utils.server_packet_info(pkt)\n end", "def system_host\n monitor_str = cluster_info\n monitor_str += hosts_info\n monitor_str += customizations_info\n monitor_str += datastore_info\n monitor_str += vms_info('wild')\n monitor_str += nsx_info_vcenter\n monitor_str += nsx_info\n\n monitor_str\n end", "def host\n @connection.host\n end", "def host\n @host ||= Babushka::SystemProfile.for_host\n end", "def get_host\n host=%x(/usr/sbin/dsconfigad -show | /usr/bin/awk '/Computer Account/ {print $4}').chomp\n return host\n raise Error, \"this machine must not be bound to AD.\\n try again.\" if host == nil\nend", "def get_host\n host=%x(/usr/sbin/dsconfigad -show | /usr/bin/awk '/Computer Account/ {print $4}').chomp\n return host\n raise Error, \"this machine must not be bound to AD.\\n try again.\" if host == nil\nend", "def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end", "def host\n nodes[0][0]\n end", "def get_host(opts)\n\t\tif opts.kind_of? Host\n\t\t\treturn opts\n\t\telsif opts.kind_of? String\n\t\t\traise RuntimeError, \"This invokation of get_host is no longer supported: #{caller}\"\n\t\telse\n\t\t\taddress = opts[:addr] || opts[:address] || opts[:host] || return\n\t\t\treturn address if address.kind_of? Host\n\t\tend\n\t\twspace = opts.delete(:workspace) || workspace\n\t\thost = wspace.hosts.find_by_address(address)\n\t\treturn host\n\tend", "def host_id; 'localhost' end", "def xe_get_host_uuid(name) \n xe_open(\"xe host-list name-label=#{name}\").each do |line|\n if line =~ /uuid.*:\\s(.*)$/\n return $1\n end\n end\nend", "def canonical_instance_host(opennebula_instance)\n fail 'Instance object not provided!' unless opennebula_instance\n hosts = []\n\n opennebula_instance.each('HISTORY_RECORDS/HISTORY') { |history| hosts << history['HOSTNAME'] }\n hosts.compact!\n\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Assigning hosts #{hosts.inspect} \" \\\n \"to #{opennebula_instance['ID'].inspect}\"\n hosts.last\n end", "def host; config[:host]; end", "def hosts_entry\n \"#{@ip} #{name}\"\n end", "def hostname\n @options[:host][:name] if @options[:host]\n end", "def get_host(name)\n # create a host object to work with\n host_obj = Com::Vmware::Vcenter::Host.new(vapi_config)\n\n if name.nil?\n host = host_obj.list\n else\n filter = Com::Vmware::Vcenter::Host::FilterSpec.new(names: Set.new([name]))\n host = host_obj.list(filter)\n end\n\n raise format(\"Unable to find target host: %s\", name) if host.empty?\n\n host[0]\n end", "def find_tenant_by_host(host)\n where { lower(self.host) == lower(host) }.take\n end", "def remote_database_config( db )\n remote_config = capture(\"cat #{shared_path}/config/database.yml\")\n database = YAML::load( remote_config )\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end", "def host_2_ip (hostname)\n\t\tputs \"Perform DNS query on host: #{hostname}\" if @verbose\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tputs \"No change - same IP is returned. \" if @verbose\n\t\t\t\treturn hostname.strip\n\t\t\telse\n\t\t\t\tips=Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tputs \"IP found: #{ips.first}\" if @verbose\n\t\t\t\t\treturn ips.first.strip\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ip for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def report_host(opts)\n return if not db\n opts = {\n :workspace => myworkspace,\n :task => mytask\n }.merge(opts)\n framework.db.report_host(opts)\n end", "def get_domain domain\n\n # Connect to the database\n conn = PG.connect( dbname: DB_DATABASE_NAME, user: DB_USER, password: DB_PASSWORD )\n\n # Get the info on the domain from the DB\n res = conn.exec \"SELECT * FROM #{DB_DOMAINS_TABLE} WHERE domain = '#{domain}'\"\n\n # Close the connection\n conn.close\n\n # The query resulted in nothing?!\n unless res.ntuples > 0\n puts \"Kunde inte hitta domänen '#{domain}'!\".red\n exit\n end\n\n return res[0]\nend", "def host_search(debug,name,passwd)\n hammer_cmd = \"hammer --output yaml\"\n if debug == true\n hammer_cmd = hammer_cmd + \" --debug\"\n end\n if passwd !=nil\n hammer_cmd = hammer_cmd + \" --password #{passwd}\"\n end\n hammer_cmd = hammer_cmd + \" host list --search #{name}\"\n\n list = YAML.load(`#{hammer_cmd}`)\n if list == []\n return true\n else\n return false\n end\nend", "def calculate_dbhost\n owncloud_cookbook_config['dbhost'] =\n [\n owncloud_cookbook_config['dbhost'], owncloud_cookbook_config['dbport']\n ].join(':')\n end", "def pdb_get_facts(node_ip_hostname)\n keyed_facts = {}\n\n if test_env\n response = \"[{\\\"certname\\\":\\\"host-name-01.domain.com\\\",\\\"name\\\":\\\"trusted\\\",\\\"value\\\":{\\\"authenticated\\\":\\\"remote\\\",\\\"certname\\\":\\\"host-name-01.domain.com\\\",\\\"domain\\\":\\\"domain.com\\\",\\\"extensions\\\":{\\\"company_trusted_swimlane\\\":\\\"n/a\\\",\\\"pp_datacenter\\\":\\\"mtv\\\",\\\"pp_environment\\\":\\\"qa\\\",\\\"pp_product\\\":\\\"test\\\",\\\"pp_role\\\":\\\"rabbit_mq\\\"},\\\"hostname\\\":\\\"host-name-01\\\"},\\\"environment\\\":\\\"tier2\\\"},{\\\"certname\\\":\\\"puppet.upguard.org\\\",\\\"environment\\\":\\\"production\\\",\\\"name\\\":\\\"virtual\\\",\\\"value\\\":\\\"#{TEST_OS_VIRT_PLATFORM}\\\"},{\\\"certname\\\":\\\"puppet.upguard.org\\\",\\\"environment\\\":\\\"production\\\",\\\"name\\\":\\\"operatingsystemmajrelease\\\",\\\"value\\\":\\\"#{TEST_OS_MAJOR_RELEASE}\\\"},{\\\"certname\\\":\\\"puppet.upguard.org\\\",\\\"environment\\\":\\\"production\\\",\\\"name\\\":\\\"operatingsystem\\\",\\\"value\\\":\\\"#{TEST_OS}\\\"}]\"\n else\n response = `curl -X GET #{PUPPETDB_URL}/pdb/query/v4/nodes/#{node_ip_hostname}/facts -d 'query=[\"or\", [\"=\",\"name\",\"trusted\"], [\"=\",\"name\",\"virtual\"], [\"=\",\"name\",\"operatingsystem\"], [\"=\",\"name\",\"operatingsystemmajrelease\"]]' --tlsv1 --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem --cert /etc/puppetlabs/puppet/ssl/certs/#{COMPILE_MASTER_PEM} --key /etc/puppetlabs/puppet/ssl/private_keys/#{COMPILE_MASTER_PEM}`\n Puppet.info(\"#{log_prefix} trusted facts for #{node_ip_hostname} is: response=#{response}\")\n end\n\n if response.nil?\n return nil\n end\n facts = JSON.load(response)\n if !facts.is_a?(Array) && !facts.any?\n return nil\n end\n facts.each do |fact|\n keyed_facts[fact['name']] = fact\n end\n keyed_facts\n end", "def host\r\n return for_context(nil, false) { |c| c.host }\r\n end", "def host_list()\n host_list = [\n {\"ip\"=>\"192.168.110.207\", \"host\"=>\"zabbix-server\", \"roles\"=>[\"zabbix-server\", \"csgw\"], \"deployment\"=>\"vm\", \"status\"=>1},\n {\"ip\"=>\"192.168.110.210\", \"host\"=>\"test-01\", \"roles\"=>[\"test\"], \"deployment\"=>\"test\", \"status\"=>1}\n ]\n return host_list\n end", "def postgresql_primary_server\n raise \"FIXME please implement to return a hash with :hostname, :ip, and :internal_ip of primary server\"\n end", "def host\n conf['dashboard']['host']\n end", "def rhost\n\t\tdatastore['RHOST']\n\tend", "def rhost\n datastore['RHOST']\n end", "def episode_host \n @nk.css('div.act#credits div.host>h4').text\n end", "def run_host(ip)\t\n\t\tbegin\n\n\t\t\tids = dcerpc_endpoint_list()\n\t\t\treturn if not ids\n\t\t\tids.each do |id|\n\t\t\t\tnext if not id[:prot]\n\t\t\t\tline = \"#{id[:uuid]} v#{id[:vers]} \"\n\t\t\t\tline << \"#{id[:prot].upcase} \"\n\t\t\t\tline << \"(#{id[:port]}) \" if id[:port]\n\t\t\t\tline << \"(#{id[:pipe]}) \" if id[:pipe]\n\t\t\t\tline << \"#{id[:host]} \" if id[:host]\n\t\t\t\tline << \"[#{id[:note]}]\" if id[:note]\n\t\t\t\tprint_status(line)\t\t\t\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error: #{e.to_s}\")\n\t\tend\n\tend", "def remote_database_config(db)\n remote_config = capture(\"cat #{shared_path}/config/#{fetch(:db_file, 'mongoid.yml')}\")\n database = YAML::load(remote_config)\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end", "def report_host(mod, addr, opts = {}, context = nil)\n\n\t\treport_host_state(mod, addr, opts[:state] || Msf::HostState::Alive)\n\t\topts.delete(:state)\n\t\t\n\t\thost = get_host(context, addr, '')\n\t\t\n\t\topts.each { |k,v|\n\t\t\tif (host.attribute_names.include?(k.to_s))\n\t\t\t\thost[k] = v\n\t\t\tend\n\t\t}\n\n\t\thost.save \n\t\t\n\t\treturn host\n\tend" ]
[ "0.71584475", "0.6903869", "0.6807556", "0.6788305", "0.6779182", "0.6728388", "0.6660252", "0.6635586", "0.6595495", "0.6592397", "0.65791863", "0.6530544", "0.65098006", "0.65021914", "0.64845306", "0.6412515", "0.64074063", "0.64074063", "0.6381596", "0.6335051", "0.6314829", "0.63104385", "0.63087595", "0.6308604", "0.6308604", "0.63016707", "0.6243305", "0.6225853", "0.62007135", "0.6195181", "0.6193368", "0.61932427", "0.61932427", "0.61772937", "0.6165947", "0.6165947", "0.61539507", "0.61500025", "0.61482084", "0.61474454", "0.61296195", "0.61197764", "0.61136335", "0.6102646", "0.6089396", "0.6085325", "0.6083418", "0.6041363", "0.602049", "0.59967166", "0.59774673", "0.5973602", "0.59722793", "0.59497017", "0.594494", "0.5940252", "0.5920386", "0.59107053", "0.5903617", "0.59025574", "0.5901932", "0.58994573", "0.5899217", "0.5885226", "0.58762944", "0.5866947", "0.58660936", "0.58640873", "0.5845834", "0.58274794", "0.5825692", "0.5825692", "0.5824673", "0.5818244", "0.58016413", "0.5791625", "0.5790881", "0.5790842", "0.57889193", "0.5772979", "0.5765703", "0.5752879", "0.57249874", "0.5724466", "0.571984", "0.5701132", "0.5693082", "0.56909037", "0.5690768", "0.5686563", "0.568079", "0.5671155", "0.5670961", "0.5664071", "0.5660089", "0.5658832", "0.5650375", "0.5642575", "0.5634677", "0.56342185" ]
0.66199803
8
grabs info about all hosts in PuppetDB
def query_pdb_hosts(port) require 'json' require 'uri' require 'net/http' # TODO move to ssl uri = URI("http://localhost:#{port}/pdb/query/v4/nodes") @logger.debug("Running PDB query: #{uri}") begin data = JSON.parse(Net::HTTP.get(uri), :symbolize_names => true) rescue Exception => e err_msg = "#{e}\n" + " Please make sure PuppetDB is running, this script is being run from\n" + " the PuppetDB host, and the port is correct" @logger.error err_msg end @logger.debug("Received Response: #{data}") data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_puppetdb_hosts\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes\")\n curl.get\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['name'] }\n @puppetdb_hosts = servers_array\n end", "def hosts\n\t\tHost.find(:all)\n\tend", "def hosts\n @hosts.values\n end", "def get_all_hosts()\n results = @zabbix.host.get({\"output\" => [\"name\"], \"sortfield\" => \"name\",})\n host_names = []\n results.each { |result| host_names << result['name'] }\n return host_names\n end", "def hosts; end", "def hosts; end", "def hosts; end", "def monitor_hosts_and_vms\n totalmemory = 0\n totalcpu = 0\n\n host_info = \"HYPERVISOR=opennebula\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host['hostname']}\\\"\\n\"\n case @host['host_mon']['type']\n when 'fixed'\n host_info << \"TOTALMEMORY=#{@host['host_mon']['memory']}\\n\"\n host_info << \"TOTALCPU=#{@host['host_mon']['cpu']}\\n\"\n when 'instance_based'\n @host['capacity'].each { |name, size|\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * size.to_i\n totalcpu += cpu * size.to_i\n }\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n when 'dynamic'\n host_info << get_remote_quotas\n end\n\n usedcpu = 0\n usedmemory = 0\n\n vms_info = get_all_vms_poll_info\n puts host_info\n puts vms_info\n end", "def host_list()\n host_list = [\n {\"ip\"=>\"192.168.110.207\", \"host\"=>\"zabbix-server\", \"roles\"=>[\"zabbix-server\", \"csgw\"], \"deployment\"=>\"vm\", \"status\"=>1},\n {\"ip\"=>\"192.168.110.210\", \"host\"=>\"test-01\", \"roles\"=>[\"test\"], \"deployment\"=>\"test\", \"status\"=>1}\n ]\n return host_list\n end", "def collectHosts(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"Hosts\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"h\")\n\t\tdc.hostFolder.childEntity.each do |cluster|\n\t\t\tcluster.host.each do |host|\n\t\t\t\tdb.select(2)\n\t\t\t\tdb.hset(\"#{host.name}\", \"Status\", \"#{host.summary.overallStatus}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"PowerStatus\", \"#{host.summary.runtime.powerState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"Connection\", \"#{host.summary.runtime.connectionState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallCpu\", \"#{host.summary.quickStats.overallCpuUsage}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallMem\", \"#{host.summary.quickStats.overallMemoryUsage}\") \n\t\t\t\t#db.hset(\"#{host.name}\", \"SystemSensor\", \"#{host.summary.runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo.name}\")\n\t\t\t\tprogressbar.increment\n\t\t\tend\n\t\tend\n\tend\nend", "def hosts\n @hosts ||= []\n end", "def hosts\n `#{cmk} --list-hosts`.split(/\\n/).sort\n end", "def get_hosts\n\t\t#all_hosts={}\n\t\t#config=self.load_config\n\t\t#config['hosts'].each do |section|\n\t\t#\tsection.each do |host_section, host_values|\n\t\t#\t\thost_values.each do |host|\n\t\t#\t\t\tall_hosts[host['title']] = host['sshparams'] unless host['sshparams'].nil?\n\t\t#\t\tend\n\t\t#\tend\n\t\t#end\n\t\t#return all_hosts\n all_hosts={}\n config=self.load_config\n\t\tbegin \n config['hosts'].each do |section|\n section.each do |host_section, host_values|\n all_hosts[host_section] = host_values unless host_section.nil?\n end\n end\n\t\trescue Exception => e\n\t\t\tputs \"Your hosts.yml file is empty?: #{e}\"\n\t\t\texit\n\t\tend\n return all_hosts\n\tend", "def print_known_hosts\n\t\tputs \"\\nSummary of local hosts Table:\"\n\t\tputs \"Total entries: #{@known_hosts.size}\"\n\t\t(@known_hosts.keys.sort-[\"\",nil]).each do |key|\n\t\t\tvalue=@known_hosts[key]\n\t\t\tputs \"#{key}\\t#{value}\" if is_fqdn?(key)\n\t\tend\n\t\tputs \"End of the summary\"\n\tend", "def index\n @hostnames = current_user.hostnames.all\n end", "def hosts\n out = []\n out << \"group {\"\n out << ' filename \"deezy\";'\n Host.find_all_by_enabled(true).each do |host|\n out << [\n \" host #{host.hostname} { hardware ethernet #{host.mac}; \",\n \"#{\"fixed-address #{host.ip};\" unless host.ip.blank?}\",\n \"}\"\n ].join\n end\n out << \"}\"\n out << ''\n end", "def all_server_hosts\n [server_host]\n end", "def hosts\n @hosts ||= begin\n r, h, u = [], (config[:hosts] rescue nil), (config[:user] rescue nil)\n h.each {|host| r << Host.new(host, u) } if h && u; r\n end\n end", "def list_of_hosts\n super\n end", "def get_facts(host)\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes/#{host}/facts\")\n curl.get\n result = JSON.parse(curl.body_str)\n warn \"Error #{host} not found in puppetdb\" if result.empty?\n result\n end", "def index\n @host_addresses = HostAddress.all\n end", "def host_info\n @host_info\n end", "def get_foreman_hosts(per_page = 10000)\n curl = setup_curl(\"#{@foreman_url}/api/hosts?per_page=#{per_page}\", true)\n curl.perform\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['host']['name'] }\n @foreman_hosts = servers_array\n end", "def hosts\n Put.warn \"\\nStarted configuring ansible hosts.......\\n\"\n @ansible.groups.each do |group|\n Put.info \"Adding group [#{group['name']}]\"\n\n response = Rest::SubutaiConsole.command(\"echo [#{group['name']}] >> /etc/ansible/hosts\", @environment.ansible_host_id, \"/root\",\"1000\", @url, @token)\n status(response)\n\n group['hostnames'].each do |hostname|\n container = find(hostname)\n Put.info \"Adding hosts #{container.containerName} to group [#{group['name']}]\"\n\n if group.key?('python-interpreter')\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip} ansible_python_interpreter=#{group['python-interpreter']}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\n \"360000\",\n @url, @token)\n status(response)\n else\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\"360000\",\n @url, @token)\n status(response)\n end\n end\n end\n end", "def sync_host_table\n uri = foreman_uri('/hosts?per_page=9999999')\n debug \"Loading hosts from #{uri}\"\n json = RestClient.get uri\n debug \"Got JSON: #{json}\"\n JSON.parse(json)['results'].each do |rec|\n @db.execute \"insert into host (id,name) values ( ?, ? )\",\n rec['id'], rec['name']\n end\n end", "def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end", "def doozer_hosts\n hosts = []\n walk('/ctl/node/*/addr') do |path, value, revision|\n hosts << value unless hosts.include? value\n end\n hosts\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def hosts(key)\n unless @@vendors[key].nil?\n @@vendors[key][:hosts].collect { |id| @@hosts[id] }\n else\n []\n end\n end", "def hosts(wspace = workspace, only_up = false, addresses = nil)\n\t\tconditions = {}\n\t\tconditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if only_up\n\t\tconditions[:address] = addresses if addresses\n\t\twspace.hosts.all(:conditions => conditions, :order => :address)\n\tend", "def list\n unless hosts.empty?\n format hosts\n else\n \"No custom hosts found.\\nYou can add some using:\\n\\thoust add [alias] [address]\\n\"\n end\n end", "def hosts(touchAndPrune=false)\n hosts=@vp_lock.synchronize{@hostname2vp.keys}\n if touchAndPrune\n check_up_hosts(hosts)\n else\n hosts\n end\n end", "def index_hosts\n load_service\n return if (@service.blank?)\n\n # Preload hosts\n @hosts = Host.where(:_id.in => @service.host_ids)\n\n respond_to do |format|\n format.html\n end\n end", "def read_hosts(file)\n hosts = Array.new\n File.open(file,'r') do |f|\n f.each_line do |line|\n if line[0] != \"#\" and line!=\"\"\n parts = line.split()\n if parts.size==4\n hosts << {:host => parts[0], :ps => parts[1].to_i, :user => parts[3]}\n end\n end\n end\n end\n hosts\n end", "def hosts=(_arg0); end", "def hosts=(_arg0); end", "def hosts(opts)\n ::ApplicationRecord.connection_pool.with_connection {\n # If we have the ID, there is no point in creating a complex query.\n if opts[:id] && !opts[:id].to_s.empty?\n return Array.wrap(Mdm::Host.find(opts[:id]))\n end\n\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n\n conditions = {}\n conditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if opts[:non_dead]\n conditions[:address] = opts[:address] if opts[:address] && !opts[:address].empty?\n\n if opts[:search_term] && !opts[:search_term].empty?\n column_search_conditions = Msf::Util::DBManager.create_all_column_search_conditions(Mdm::Host, opts[:search_term])\n tag_conditions = Arel::Nodes::Regexp.new(Mdm::Tag.arel_table[:name], Arel::Nodes.build_quoted(\"(?mi)#{opts[:search_term]}\"))\n search_conditions = column_search_conditions.or(tag_conditions)\n wspace.hosts.where(conditions).where(search_conditions).includes(:tags).references(:tags).order(:address)\n else\n wspace.hosts.where(conditions).order(:address)\n end\n }\n end", "def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end", "def all_host_statistics\n super\n end", "def available_hosts\n @available_hosts ||= []\n end", "def hosts_entry\n \"#{@ip} #{name}\"\n end", "def mongo_hosts\n @mongo_hosts\n end", "def hosts\n (self.web_hosts.to_a + self.db_hosts.to_a + self.balance_hosts.to_a + self.app_hosts.to_a).uniq.sort\n end", "def host_list\n return @host_list if defined?(@host_list)\n\n if !self.hosts.blank?\n @host_list = self.hosts.split(/[,\\s]+/).compact\n else\n @host_list = []\n end\n\n @host_list\n end", "def index\n @scanhosts = Scanhost.all\n end", "def list_hosts(folder = '')\n rows = JSON.parse(http_request(@uri + '/view.py', {\n wato_folder: folder,\n\tsearch: 'Search',\n\tfilled_in: 'filter',\n\thost_address_prefix: 'yes',\n\tview_name: 'searchhost',\n\toutput_format: 'json',\n\t}))\n rows.shift # skip the header\n rows.map { |r| r[1] }\n end", "def hosts(args = nil)\n if args and args[:server]\n args[:server].split(';').collect { |server| $hosts[server] ||\n Config.warn_fail(\"#{server} is not a known host\") }\n else\n $hosts.values\n end\nend", "def get_kvm_hostinfo\n guests = {}\n begin\n result = `virsh list --all`\n result.split(\"\\n\").each do |line|\n if line =~ /(\\d+)\\s+(\\S+)\\s+(\\S+)/\n guest_hostname = $2\n guests[guest_hostname] = get_kvm_guest_info(guest_hostname)\n end\n end\n rescue\n warn \"Failed to run/parse virsh command\"\n end\n return guests\n end", "def each_host(wspace=framework.db.workspace, &block)\n ::ApplicationRecord.connection_pool.with_connection {\n wspace.hosts.each do |host|\n block.call(host)\n end\n }\n end", "def configured_hosts\n\t\troutes = self.configured_routes\n\t\treturn Mongrel2::Config::Host.where( id: routes.select(:host_id) )\n\tend", "def index\n @event_hosts = EventHost.where(event_id: @event.id)\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def report_hosts(report_id)\r\n\t\tpost= { \"token\" => @token, \"report\" => report_id } \r\n\t\tdocxml=nessus_request('report/hosts', post)\r\n\t\tlist = Array.new\r\n\t\tdocxml.root.elements['contents'].elements['hostList'].each_element('//host') { |host| \r\n\t\t\tlist.push host.elements['hostname'].text\r\n\t\t}\r\n\t\treturn list\r\n\tend", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def list_hosts( zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::ListHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml\"\n )\n end", "def baculized_hosts\n hosts.in_bacula.pluck(:name)\n end", "def hosts\n # prevent original array from being changed\n @hosts.dup\n end", "def turbo_hosts\n deep_values(\"turbo_hosts\")\n end", "def info(session, id)\n read_task('rvpe.host.info', session) do\n call_one_xmlrpc('one.host.info', session, id)\n end\n end", "def all_hosts_in(group)\n inventory.all_hosts_in(group).map { |i| server(i.to_sym) }\nend", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def list_instances_detail()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances/detail\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def index\n @host_states = HostState.all\n end", "def host_list( query=nil, username=nil, prefer_ip=nil )\n file = Tempfile.new('ck')\n\n client.get('nodes', query).each do |node|\n target = prefer_ip ? node.ipaddress : node.name \n file.puts sprintf \"%s %s\", target, username\n end\n\n file.flush\n \n return file\n end", "def format_hosts\n all_hosts.inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def server_structs\n array = []\n if @struct.hosts\n @struct.hosts.count.times do |i|\n array << Lib.memcached_select_server_at(@struct, i)\n end\n end\n array\n end", "def refresh_all\n\t\tputs \"Refresh all the entries in the local host repository in one shot.\"\n\t\tchanges=Hash.new\n\t\thosts=@known_hosts.keys\n\t\t@known_hosts=Hash.new\n\t\tchanges=bulk_add(hosts)\n\t\t@known_hosts.merge!(changes)\n\t\t#@known_hosts.keys.map do |key|\n\t\t#\tunless is_ip?(key)\n\t\t#\t\thost=refresh(key)\n\t\t#\t\tchanges.push(host) unless host.nil?\n\t\t#\tend\n\t\t#end\n\t\tputs \"\\n#{changes.size} Entries Refreshed:\" if changes.size>0\n\t\t#changes.map { |x| puts x }\n\t\tputs \"Done refreshing the local hosts.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def report_host(opts)\n\n return if !active\n addr = opts.delete(:host) || return\n\n # Sometimes a host setup through a pivot will see the address as \"Remote Pipe\"\n if addr.eql? \"Remote Pipe\"\n return\n end\n\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts = opts.clone\n opts.delete(:workspace)\n\n begin\n retry_attempts ||= 0\n if !addr.kind_of? ::Mdm::Host\n addr = Msf::Util::Host.normalize_host(addr)\n\n unless ipv46_validator(addr)\n raise ::ArgumentError, \"Invalid IP address in report_host(): #{addr}\"\n end\n\n conditions = {address: addr}\n conditions[:comm] = opts[:comm] if !opts[:comm].nil? && opts[:comm].length > 0\n host = wspace.hosts.where(conditions).first_or_initialize\n else\n host = addr\n end\n\n ostate = host.state\n\n # Truncate the info field at the maximum field length\n if opts[:info]\n opts[:info] = opts[:info][0,65535]\n end\n\n # Truncate the name field at the maximum field length\n if opts[:name]\n opts[:name] = opts[:name][0,255]\n end\n\n if opts[:os_name]\n os_name, os_flavor = split_windows_os_name(opts[:os_name])\n opts[:os_name] = os_name if os_name.present?\n if opts[:os_flavor].present?\n if os_flavor.present? # only prepend if there is a value that needs it\n opts[:os_flavor] = os_flavor + opts[:os_flavor]\n end\n else\n opts[:os_flavor] = os_flavor\n end\n end\n\n opts.each do |k,v|\n if host.attribute_names.include?(k.to_s)\n unless host.attribute_locked?(k.to_s)\n host[k] = v.to_s.gsub(/[\\x00-\\x1f]/n, '')\n end\n elsif !v.blank?\n dlog(\"Unknown attribute for ::Mdm::Host: #{k}\")\n end\n end\n host.info = host.info[0,::Mdm::Host.columns_hash[\"info\"].limit] if host.info\n\n # Set default fields if needed\n host.state = Msf::HostState::Alive if host.state.nil? || host.state.empty?\n host.comm = '' unless host.comm\n host.workspace = wspace unless host.workspace\n\n begin\n framework.events.on_db_host(host) if host.new_record?\n rescue => e\n wlog(\"Exception in on_db_host event handler: #{e.class}: #{e}\")\n wlog(\"Call Stack\\n#{e.backtrace.join(\"\\n\")}\")\n end\n\n host_state_changed(host, ostate) if host.state != ostate\n\n if host.changed?\n msf_import_timestamps(opts, host)\n host.save!\n end\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid\n # two concurrent report requests for a new host could result in a RecordNotUnique or\n # RecordInvalid exception, simply retry the report once more as an optimistic approach\n retry if (retry_attempts+=1) <= 1\n raise\n end\n\n if opts[:task]\n Mdm::TaskHost.create(\n :task => opts[:task],\n :host => host\n )\n end\n\n host\n }\n end", "def get_a2a_hosts\n abs_initialize\n mom =\n { 'role': \"mom\",\n 'size': @mom_size,\n 'volume_size': @mom_volume_size }\n\n metrics =\n { 'role': \"metrics\",\n 'size': @metrics_size,\n 'volume_size': @metrics_volume_size }\n\n hosts = [mom, metrics]\n\n return hosts\n end", "def query_files_hosts(hostlist, hosts)\n report_dir = get_report_dir\n\n existing_nodes = hostlist.map{|x| x[:certname]}\n\n local_host_template = {\n :deactivated=>false,\n :latest_report_hash=>nil,\n :facts_environment=>nil,\n :cached_catalog_status=>\"not_used\",\n :report_environment=>nil,\n :latest_report_corrective_change=>nil,\n :catalog_environment=>nil,\n :facts_timestamp=>nil,\n :latest_report_noop=>nil,\n :expired=>false,\n :latest_report_noop_pending=>nil,\n :report_timestamp=>nil,\n :certname=>nil,\n :catalog_timestamp=>nil,\n :latest_report_job_id=>nil,\n :latest_report_status=>nil\n }.freeze\n\n local_host_reports = []\n\n if File.directory?(report_dir)\n @logger.debug(\"Processing Report Directory: #{report_dir}\")\n\n Dir.glob(\"#{report_dir}/*\").each do |node_dir|\n @logger.debug(\"Processing Node Directory: #{node_dir}\")\n\n latest_report = Dir.glob(\"#{node_dir}/*.yaml\").sort.last\n if latest_report\n @logger.debug(\"Processing YAML Report: #{latest_report}\")\n\n begin\n require 'puppet'\n\n transaction_report = YAML.load_file(latest_report)\n\n unless (hosts.empty? || hosts.include?(transaction_report.host))\n @logger.debug(\"Skipping #{transaction_report.host} since it is not in the host list\")\n next\n end\n\n if existing_nodes.include?(transaction_report.host)\n @logger.debug(\"Skipping #{transaction_report.host} since it already exists\")\n next\n end\n\n local_host_data = Marshal.load(Marshal.dump(local_host_template))\n local_host_data[:latest_report_hash] = transaction_report.catalog_uuid\n local_host_data[:facts_environment] = transaction_report.environment\n local_host_data[:report_environment] = transaction_report.environment\n local_host_data[:latest_report_corrective_change] = transaction_report.corrective_change\n local_host_data[:catalog_environment] = transaction_report.environment\n local_host_data[:facts_timestamp] = transaction_report.time.to_s\n local_host_data[:latest_report_noop] = transaction_report.noop\n local_host_data[:latest_report_noop_pending] = transaction_report.noop_pending\n local_host_data[:report_timestamp] = transaction_report.time.to_s\n local_host_data[:certname] = transaction_report.host\n local_host_data[:catalog_timestamp] = transaction_report.time.to_s\n local_host_data[:latest_report_job_id] = transaction_report.catalog_uuid\n local_host_data[:latest_report_status] = transaction_report.status\n\n hostlist << local_host_data\n\n @logger.debug(\"Processed Host Report: #{local_host_data}\")\n rescue => e\n @logger.warn \"Error processing report at '#{latest_report}': #{e}\"\n end\n else\n @logger.debug \"Could not find latest report in '#{node_dir}'\"\n end\n end\n else\n @logger.debug \"Could not find report directory at '#{report_dir}'\"\n end\n end", "def get_all(source=nil)\n extra_params = {}\n if source\n extra_params['source'] = source\n end\n\n request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts', extra_params, nil, false)\n end", "def host_templates\n @host_templates ||= ZerigoDNS::HostTemplate.all(zone_template_id: id)\n end", "def ip_list\n\t\t\t\t\tips = Array.new\n\t\t\t\t\thosts = Host.where(\"ip is not NULL\").order(\"ip\").to_a\n\n\t\t\t\t\thosts.each do |host|\n\t\t\t\t\t\tips << host.ip if host.ip != nil\n\t\t\t\t\tend\n\n\t\t\t\t\tips.join(\"\\n\")\n\t\t\t\tend", "def collect\n parse_process_list(multiline('top -n 1 -b'), split_tokens: 9) do |tokens| \n [tokens[0], tokens.last, hostname, tokens[4].to_i]\n end\n end", "def all_hosts_in(file)\n servers = []\n file.each do |line|\n if line.include?('Host ')\n servers << line.sub('Host ', '').strip\n end\n end\n servers\n end", "def index\n @hosts = Host.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hosts }\n end\n end", "def canonical_instance_host(opennebula_instance)\n fail 'Instance object not provided!' unless opennebula_instance\n hosts = []\n\n opennebula_instance.each('HISTORY_RECORDS/HISTORY') { |history| hosts << history['HOSTNAME'] }\n hosts.compact!\n\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Assigning hosts #{hosts.inspect} \" \\\n \"to #{opennebula_instance['ID'].inspect}\"\n hosts.last\n end", "def cmd_resolve_hosts argv\n setup argv\n name = @hash['name']\n response = @api.resolve_hosts(name)\n msg response\n return response\n end", "def all_servers\n if is_zz?\n return app_config[:all_servers]\n end\n\n return @all_servers if @all_servers != nil\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_servers = []\n instances.each do |instance|\n @all_servers << instance['private_hostname']\n end\n # add ourselves if we have no info, running on dev box\n @all_servers << this_host_name if @all_servers.empty?\n\n @all_servers\n end", "def get_host_by_hostname(hostname, collector)\n host = nil\n if collector\n hosts_json = rpc(\"getHosts\", {\"hostGroupId\" => 1})\n hosts_resp = JSON.parse(hosts_json)\n# p hosts_resp\n collector_resp = JSON.parse(rpc(\"getAgents\", {}))\n if hosts_resp[\"status\"] == 200\n hosts_resp[\"data\"][\"hosts\"].each do |h|\n if h[\"hostName\"].eql?(hostname)\n # puts(\"Found host with matching hostname: #{resource[:hostname]}\")\n # puts(\"Checking agent match\")\n if collector_resp[\"status\"] == 200\n collector_resp[\"data\"].each do |c|\n if c[\"description\"].eql?(collector)\n host = h\n end\n end\n else\n puts(\"Unable to retrieve collector list from server\")\n end\n end\n end\n else\n puts(\"Unable to retrieve host list from server\" )\n end\n end\n host\nend", "def get_hostgroups()\n groups = @zabbix.hostgroup.get({\"output\" => \"extend\", \"sortfield\" => \"name\",})\n host_groups_names = []\n groups.each { |group| host_groups_names << group['name'] }\n return host_groups_names\n end", "def ssh_hostnames\n ssh_configs.map { |c| c.hostname }.compact.uniq.sort\n end", "def by_ssh_host\n by_ssh_host = {}\n self.class.list_map.each_pair do |role,list|\n self.send(list).each do |host_instance|\n if not by_ssh_host.has_key?(host_instance.ssh_host)\n by_ssh_host[host_instance.ssh_host] = []\n end\n by_ssh_host[host_instance.ssh_host] << host_instance\n end\n end\n by_ssh_host\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def collect\n parse_process_list(multiline('top -l 1 -o mem -stats pid,mem,command'), split_tokens: 3) do |tokens| \n [tokens.first, tokens.last, hostname, plain_memory_value(tokens[1])]\n end\n end", "def outdated_hosts\n hosts = []\n scanned_hosts = self.date_severity_count\n scanned_hosts.each do |sh|\n sh.hosts.split(\", \").each do |host|\n hosts << host.gsub(/\\s+/, \"\")\n end\n end\n return hosts.uniq.sort\n end", "def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend", "def hosts\n @hosts ||= Array(Hansolo.target).map { |target| URI.parse(target) }\n end", "def hostnames\n @machines.each_with_index.map do |_, number|\n \"#{::Chef.node.run_state['fragments']['cluster']['name']}-#{number}\"\n end\n end", "def hosts_count\r\n return @hosts.length\r\n end", "def print_perf_info\n @perf_end_timestamp = Time.now\n @hosts.map { |h| get_perf_data(h, @perf_timestamp, @perf_end_timestamp) }\n end", "def hosts\n @job = Job.find(params[:id])\n host_array = []\n @job.nodes.each do |node|\n host_array << \"#{node.private_dns_name} #{node.private_dns_name.split('.')[0]}\"\n end\n send_data host_array.join(\"\\n\"), :type => 'text/html; charset=utf-8'\n end", "def services_for(node)\n # This info is taken from our JSON inventory file\n [JSON.parse(File.read(\"#{repository_path}/hosts.json\"))[\"#{node}.hpc_tutorial.org\"]]\n end", "def info_host(host)\n validate_list([[\"Host\", host, :presence]])\n options = {\"Host\" => host}\n\n connection = Connection.new\n connection.post(\"Domain/Host/Info\", options)\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def report_hosts(report_id)\n\t\t\tpost= { \"token\" => @token, \"report\" => report_id }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/hosts', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\thosts=Array.new\n\t\t\tdocxml.elements.each('/reply/contents/hostList/host') do |host|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['hostname'] = host.elements['hostname'].text if host.elements['hostname']\n\t\t\t\tentry['severity'] = host.elements['severity'].text if host.elements['severity']\n\t\t\t\tsevs=Array.new\n\t\t\t\thost.elements.each('severityCount/item') do |item|\n\t\t\t\t\tsevs.push item.elements['count'].text if item.elements['count']\n\t\t\t\tend\n\t\t\t\tentry['sev0'] = sevs[0] if sevs[0]\n\t\t\t\tentry['sev1'] = sevs[1] if sevs[1]\n\t\t\t\tentry['sev2'] = sevs[2] if sevs[2]\n\t\t\t\tentry['sev3'] = sevs[3] if sevs[3]\n\t\t\t\tentry['current'] = host.elements['scanProgressCurrent'].text if host.elements['scanProgressCurrent']\n\t\t\t\tentry['total'] = host.elements['scanProgressTotal'].text if host.elements['scanProgressTotal']\n\t\t\t\thosts.push(entry)\n\t\t\tend\n\t\t\treturn hosts\n\t\tend", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end" ]
[ "0.76432306", "0.7234037", "0.7156418", "0.71213675", "0.70130295", "0.70130295", "0.70130295", "0.693774", "0.68816054", "0.6880734", "0.6878883", "0.67713785", "0.6723216", "0.66350704", "0.6625218", "0.6579706", "0.6552434", "0.6513989", "0.6509409", "0.64914787", "0.64849234", "0.64838326", "0.64565593", "0.6451674", "0.6436339", "0.6420447", "0.6418746", "0.64047056", "0.6336622", "0.63232034", "0.63037217", "0.62999105", "0.6294169", "0.62883615", "0.6278413", "0.6278413", "0.6273266", "0.62730706", "0.6272148", "0.6262901", "0.6249904", "0.6233012", "0.62224144", "0.62202674", "0.6208708", "0.620581", "0.6192697", "0.61818033", "0.6173748", "0.61700606", "0.6165135", "0.6159981", "0.61564964", "0.6128077", "0.61260647", "0.61034167", "0.6100441", "0.6090284", "0.60623306", "0.6061368", "0.60505295", "0.60505295", "0.603971", "0.60186404", "0.6013956", "0.6007249", "0.59991103", "0.59855074", "0.59753525", "0.5954253", "0.5949712", "0.59492326", "0.59409857", "0.5940829", "0.5929405", "0.59210134", "0.59204745", "0.591781", "0.5902782", "0.5898226", "0.58966583", "0.5890283", "0.5887674", "0.58780587", "0.5877364", "0.5865772", "0.58471966", "0.5846581", "0.58397996", "0.5838761", "0.5838699", "0.5836672", "0.5836201", "0.583178", "0.5827166", "0.58235633", "0.5820749", "0.5819571", "0.5815889", "0.58032125" ]
0.65868914
15
Update the passed hostlist with the values for the passed hosts. Updates with all data if hosts is empty
def query_files_hosts(hostlist, hosts) report_dir = get_report_dir existing_nodes = hostlist.map{|x| x[:certname]} local_host_template = { :deactivated=>false, :latest_report_hash=>nil, :facts_environment=>nil, :cached_catalog_status=>"not_used", :report_environment=>nil, :latest_report_corrective_change=>nil, :catalog_environment=>nil, :facts_timestamp=>nil, :latest_report_noop=>nil, :expired=>false, :latest_report_noop_pending=>nil, :report_timestamp=>nil, :certname=>nil, :catalog_timestamp=>nil, :latest_report_job_id=>nil, :latest_report_status=>nil }.freeze local_host_reports = [] if File.directory?(report_dir) @logger.debug("Processing Report Directory: #{report_dir}") Dir.glob("#{report_dir}/*").each do |node_dir| @logger.debug("Processing Node Directory: #{node_dir}") latest_report = Dir.glob("#{node_dir}/*.yaml").sort.last if latest_report @logger.debug("Processing YAML Report: #{latest_report}") begin require 'puppet' transaction_report = YAML.load_file(latest_report) unless (hosts.empty? || hosts.include?(transaction_report.host)) @logger.debug("Skipping #{transaction_report.host} since it is not in the host list") next end if existing_nodes.include?(transaction_report.host) @logger.debug("Skipping #{transaction_report.host} since it already exists") next end local_host_data = Marshal.load(Marshal.dump(local_host_template)) local_host_data[:latest_report_hash] = transaction_report.catalog_uuid local_host_data[:facts_environment] = transaction_report.environment local_host_data[:report_environment] = transaction_report.environment local_host_data[:latest_report_corrective_change] = transaction_report.corrective_change local_host_data[:catalog_environment] = transaction_report.environment local_host_data[:facts_timestamp] = transaction_report.time.to_s local_host_data[:latest_report_noop] = transaction_report.noop local_host_data[:latest_report_noop_pending] = transaction_report.noop_pending local_host_data[:report_timestamp] = transaction_report.time.to_s local_host_data[:certname] = transaction_report.host local_host_data[:catalog_timestamp] = transaction_report.time.to_s local_host_data[:latest_report_job_id] = transaction_report.catalog_uuid local_host_data[:latest_report_status] = transaction_report.status hostlist << local_host_data @logger.debug("Processed Host Report: #{local_host_data}") rescue => e @logger.warn "Error processing report at '#{latest_report}': #{e}" end else @logger.debug "Could not find latest report in '#{node_dir}'" end end else @logger.debug "Could not find report directory at '#{report_dir}'" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_host(host, ip_list)\n validate_list([[\"Host\", host, :presence], [\"IP_List\", ip_list, :presence]])\n options = {\"Host\" => host, \"IP_List\" => ip_list}\n\n connection = Connection.new\n connection.post(\"Domain/Host/Update\", options)\n end", "def hosts=(hosts)\n @host = nil\n @hosts = hosts\n end", "def host(hash)\n @hosts.update(hash)\n end", "def update_hosts\n Host.where(event: @event).delete_all\n unless lunch_host_ids[:hosts].blank?\n lunch_host_ids[:hosts].each do |host_id|\n Host.create(event: @event, user: User.find(host_id))\n end\n end\n end", "def update!(**args)\n @hosts = args[:hosts] if args.key?(:hosts)\n @http_header_match = args[:http_header_match] if args.key?(:http_header_match)\n @methods_prop = args[:methods_prop] if args.key?(:methods_prop)\n @ports = args[:ports] if args.key?(:ports)\n end", "def reload_hosts_list\n self.hosts = self.storage_servers\n write_hosts_to_file\n end", "def update_host(host, args = {})\n modify_host(host, args, 'update')\n end", "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end", "def update!(**args)\n @host_name = args[:host_name] if args.key?(:host_name)\n @host_owner = args[:host_owner] if args.key?(:host_owner)\n end", "def update!(**args)\n @hostname = args[:hostname] if args.key?(:hostname)\n @ip = args[:ip] if args.key?(:ip)\n end", "def update_hosts\n return unless File.exist?(hosts_path)\n return if File.readlines(hosts_path)\n .grep(/#{new_fqdn} #{new_hostname}/)\n .any?\n hosts_body = File.read(hosts_path).gsub(\n /^127\\.0\\.0\\.1.*/,\n \"127\\.0\\.0\\.1 #{new_fqdn} #{new_hostname} localhost\"\n )\n puts \"Adding \\\"#{new_fqdn}\\\" to #{hosts_path}...\"\n write_file(hosts_path, hosts_body)\n end", "def add_hosts(hosts:)\n @hosts = @hosts.+ Array hosts\n\n self\n end", "def update\n @host = Host.find_by(hostname: params[:id]) ||\n Host.create(host_params.merge({hostname: params[:id]}))\n\n if @host.update(host_params)\n head :no_content\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end", "def bulk_add(list, num=@max_parallel)\n\t\tputs \"Add entries to the local host repository: #{list}\"\n\t\tresults=Hash.new\n\t\tif list.size > 0\n\t\t\tputs \"Start parallel host update processing on:\\n #{list}\" if @verbose\n\t\t\tParallel.map(list, :in_processes => num) { |target|\n\t\t\t\tadd(target)\n\t\t\t}.each do |process|\n\t\t\t\tif process.nil?\n\t\t\t\t\tnext\n\t\t\t\telsif process.empty?\n\t\t\t\t\t#do nothing\n\t\t\t\telse\n\t\t\t\t\tresults.merge!(process)\n\t\t\t\tend\n\t\t\tend\n\t\t\t@known_hosts.merge!(results)\n\t\t\tputs \"Done loading host entries.\"\n\t\t\treturn results\n\t\telse\n\t\t\tputs \"Error: empty list - no entry is loaded. Please check your input list and try again.\"\n\t\tend\n\t\treturn results\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def update(options = {})\n if entry = find_entry_by_ip_address(options[:ip_address])\n entry.hostname = options[:hostname]\n entry.aliases = options[:aliases]\n entry.comment = options[:comment]\n entry.priority = options[:priority]\n\n remove_existing_hostnames(entry) if options[:unique]\n end\n end", "def update!(**args)\n @dns_search_domains = args[:dns_search_domains] if args.key?(:dns_search_domains)\n @dns_servers = args[:dns_servers] if args.key?(:dns_servers)\n @ntp_servers = args[:ntp_servers] if args.key?(:ntp_servers)\n end", "def update!(**args)\n @host_match = args[:host_match] if args.key?(:host_match)\n end", "def bulk_delete(list)\n\t\tputs \"Delete entries to the local host repository from:\\n #{list}\"\n\t\thosts=list\n\t\tchanges=Array.new\n\t\tif hosts.size > 0\n\t\t\thosts.map do |x|\n\t\t\t\thost=delete(x)\n\t\t\t\tchanges.push(host) unless host.nil?\n\t\t\tend\n\t\t\tputs \"Done deleting hosts.\"\n\t\t\treturn changes\n\t\telse\n\t\t\tputs \"Error: empty list - no entry is loaded. Please check your list and try again.\"\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def check_up_hosts(hostlisthash, settings={ :retry => true, :maxalert => NO_EMAIL, :timeout => 30})\n if hostlisthash.class==Array\n hostlisthash=hostlisthash.to_h(true)\n end\n if not settings.include?(:timeout)\n settings[:timeout]=30\n end\n if not settings.include?(:retry)\n settings[:retry]=true\n end\n if not settings.include?(:maxalert)\n settings[:maxalert]=NO_EMAIL\n end\n results, unsuccessful_hosts=issue_command_on_hosts(hostlisthash,settings){|h,p| h.backtic(\"hostname --fqdn\").chomp(\"\\n\").strip.downcase}\n uphosts=[]\n results.each{|vp|\n uphosts << ($rename_vp.has_key?(vp.at(0)) ? $rename_vp[vp.at(0)] : vp.at(0))\n if vp.at(0) != vp.at(1)\n log { \"check_up_hosts(): vp.at(0) != vp.at(1): #{vp.join(\" \")}\" }\n end\n }\n # if prune\n # unsuccessful_hosts.each{|h|\n # self.unregister_host(h)\n # }\n # end\n return uphosts\n end", "def refresh_all\n\t\tputs \"Refresh all the entries in the local host repository in one shot.\"\n\t\tchanges=Hash.new\n\t\thosts=@known_hosts.keys\n\t\t@known_hosts=Hash.new\n\t\tchanges=bulk_add(hosts)\n\t\t@known_hosts.merge!(changes)\n\t\t#@known_hosts.keys.map do |key|\n\t\t#\tunless is_ip?(key)\n\t\t#\t\thost=refresh(key)\n\t\t#\t\tchanges.push(host) unless host.nil?\n\t\t#\tend\n\t\t#end\n\t\tputs \"\\n#{changes.size} Entries Refreshed:\" if changes.size>0\n\t\t#changes.map { |x| puts x }\n\t\tputs \"Done refreshing the local hosts.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\tend", "def update!(**args)\n @fetch_host_count = args[:fetch_host_count] if args.key?(:fetch_host_count)\n end", "def update!(**args)\n @threat_lists = args[:threat_lists] if args.key?(:threat_lists)\n end", "def host=(host)\n @hosts = nil\n @host = host\n end", "def update_hosts_info()\n all_nodes = \"\"\n @nodes.each_with_index { |node, index|\n all_nodes << \"#{HelperFunctions.convert_fqdn_to_ip(node.private_ip)} appscale-image#{index}\\n\"\n }\n \n new_etc_hosts = <<HOSTS\n127.0.0.1 localhost.localdomain localhost\n127.0.1.1 localhost\n::1 ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 ip6-allhosts\n#{all_nodes}\nHOSTS\n\n etc_hosts = \"/etc/hosts\"\n File.open(etc_hosts, \"w+\") { |file| file.write(new_etc_hosts) } \n\n etc_hostname = \"/etc/hostname\"\n my_hostname = \"appscale-image#{@my_index}\"\n File.open(etc_hostname, \"w+\") { |file| file.write(my_hostname) }\n\n Djinn.log_run(\"/bin/hostname #{my_hostname}\")\n end", "def update\n load_alert\n return if (@alert.blank?)\n\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first if (!parameters[:service_id].blank?)\n\n if (!parameters[:host_ids].blank?)\n # Remove removed hosts\n @alert.hosts.select{|h| parameters[:host_ids].include?(h.id.to_s) == false}.each{|h| @alert.hosts.delete(h)}\n\n # Add the new hosts\n host_ids_add = parameters[:host_ids].select{|h| @alert.host_ids.include?(h) == false}\n Host.where(:_id.in => host_ids_add, :service_ids => parameters[:service_id]).to_a.each do |h|\n @alert.hosts << h\n end\n else\n # Empty the hosts array\n parameters[:hosts] = []\n end\n\n respond_to do|format|\n format.html{\n # The alert can be updated?\n if (@alert.update_attributes(parameters))\n flash[:notice] = t(\"alerts.notice.updated\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again\n render :action => :edit\n end\n return\n }\n end\n end", "def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @port = args[:port] if args.key?(:port)\n end", "def update!(**args)\n @addresses = args[:addresses] if args.key?(:addresses)\n @avoid_buggy_ips = args[:avoid_buggy_ips] if args.key?(:avoid_buggy_ips)\n @manual_assign = args[:manual_assign] if args.key?(:manual_assign)\n @pool = args[:pool] if args.key?(:pool)\n end", "def update!(**args)\n @addresses = args[:addresses] if args.key?(:addresses)\n @avoid_buggy_ips = args[:avoid_buggy_ips] if args.key?(:avoid_buggy_ips)\n @manual_assign = args[:manual_assign] if args.key?(:manual_assign)\n @pool = args[:pool] if args.key?(:pool)\n end", "def update!(**args)\n @datastore = args[:datastore] if args.key?(:datastore)\n @host_groups = args[:host_groups] if args.key?(:host_groups)\n @tags = args[:tags] if args.key?(:tags)\n end", "def upgrade_vps(hosts=nil)\n\n log { \"Upgrading vps\" }\n if hosts\n if hosts.is_a?(Array)\n hosts=hosts.to_h(true)\n end\n issue_command_on_hosts(hosts,{ :retry => true, :maxalert => EMAIL, :timeout => 30}){|vp| vp.check_for_update}\n else\n probe_from_all_w_opt_retry(30,true){|vp| vp.check_for_update}\n end\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @node_id = args[:node_id] if args.key?(:node_id)\n @parameters = args[:parameters] if args.key?(:parameters)\n @port = args[:port] if args.key?(:port)\n @state = args[:state] if args.key?(:state)\n @zone = args[:zone] if args.key?(:zone)\n end", "def update\n respond_to do |format|\n if @host.update(host_params)\n format.html { redirect_to data_source_hosts_path(@host.data_source_id), notice: 'Host was successfully updated.' }\n format.json { render :show, status: :ok, location: @host }\n else\n format.html { render :edit }\n format.json { render json: @host.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def update!(**args)\n @host = args[:host] if args.key?(:host)\n @instance = args[:instance] if args.key?(:instance)\n @service = args[:service] if args.key?(:service)\n @version = args[:version] if args.key?(:version)\n end", "def reload_hosts\n send_simple_request('reload hosts', {}) { |response| response['msg'] }\n end", "def bulk_refresh(list,num=@max_parallel)\n\t\tputs \"Refresh entries in the site store from list:\\n #{list}\" if @verbose\n\t\tresults=Hash.new\n\t\tif list.size > 0\n\t\t\tputs \"Start parallel refreshing on the sites:\\n #{list}\"\n\t\t\tParallel.map(list, :in_processes => num) { |target|\n\t\t\t\trefresh(target)\n\t\t\t}.each do |process|\n\t\t\t\tif process.nil?\n\t\t\t\t\tnext\n\t\t\t\telsif process.empty?\n\t\t\t\t\t#do nothing\n\t\t\t\telse\n\t\t\t\t\tresults[process['url']]=Hash.new\n\t\t\t\t\tresults[process['url']]=process\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Clean up old entries, by Y.L. 03/30/2015\n\t\t\tlist.map {|x| @known_sites.delete(x)}\n\t\t\t# Add back fresh entries\n\t\t\t@known_sites.merge!(results)\n\t\t\tputs \"Done refresh sites.\"\n\t\telse\n\t\t\tputs \"Error: no entry is loaded. Please check your list and try again.\"\n\t\tend\n\t\treturn results\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend", "def update!(**args)\n @dhcp_ip_config = args[:dhcp_ip_config] if args.key?(:dhcp_ip_config)\n @ha_control_plane_config = args[:ha_control_plane_config] if args.key?(:ha_control_plane_config)\n @host_config = args[:host_config] if args.key?(:host_config)\n @pod_address_cidr_blocks = args[:pod_address_cidr_blocks] if args.key?(:pod_address_cidr_blocks)\n @service_address_cidr_blocks = args[:service_address_cidr_blocks] if args.key?(:service_address_cidr_blocks)\n @static_ip_config = args[:static_ip_config] if args.key?(:static_ip_config)\n @vcenter_network = args[:vcenter_network] if args.key?(:vcenter_network)\n end", "def bulk_vhost_update(dbcheck, tenant_array)\n #tenant_status['vhost_updated'] = false\n command = \"chef-client -o prom-classfront::classflow-conf\"\n\n # list of environments that require vhost updates\n tenvs = [] \n tenant_array.each do |tenant|\n tenant_config = tenant[0]\n tenant_status = tenant[1]\n tenvs << tenant_config['env']\n end\n tenant_envlist = tenvs.uniq\n tenant_envlist.each do |tenant_env|\n front_end = dbcheck.lookup_frontend_servers(tenant_env)\n front_end.each do |instance|\n logger.info \"Updating vhost through chef-client run on #{instance}.\"\n begin\n run_ssh_command(instance, command)\n \n # Provides error details on connection failure\n rescue SocketError => e\n logger.error \"Unable to update vhost on instance #{instance}\"\n logger.error \"#{e}\"\n end\n end\n end\n \n # Mark each tenant as updated\n tenant_array.each do |tenant|\n tenant_status = tenant[1]\n tenant_status['vhost_updated'] = true\n end\n end", "def update!(**args)\n @allocated_connections = args[:allocated_connections] if args.key?(:allocated_connections)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @host_type = args[:host_type] if args.key?(:host_type)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n @type = args[:type] if args.key?(:type)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @address_pools = args[:address_pools] if args.key?(:address_pools)\n end", "def upload_all_facts(hosts = @puppetdb_hosts)\n hosts.each do |host|\n raw_facts = get_facts(host)\n host_json = squash_facts(host, raw_facts)\n upload_facts(host_json)\n end\n end", "def flush\n if @hosttemplate_json\n @updated_json = @hosttemplate_json.dup\n else\n @updated_json = default_hosttemplate\n end\n \n # Update the hosttemplate's JSON values based on any new params. Sadly due to the\n # structure of the JSON vs the flat nature of the puppet properties, this\n # is a bit of a manual task.\n @updated_json[\"name\"] = @resource[:name]\n @updated_json[\"description\"] = @property_hash[:description]\n @updated_json[\"servicechecks\"] = []\n if not @property_hash[:servicechecks].empty?\n @property_hash[:servicechecks].each do |sc_hash|\n @updated_json[\"servicechecks\"] << {:name => sc_hash[\"name\"], :event_handler => sc_hash[\"event_handler\"],\n\t\t\t\t\t\t:exception => sc_hash[\"exception\"]\n }\n end\n end\n\n # If managementurls are set in the manifest update the JSON content for the\n # managementurls object with a list of hashes where each hash has a \"name\"\n # and an \"url\" key.\n @updated_json[\"managementurls\"] = []\n if not @property_hash[:managementurls].empty?\n @property_hash[:managementurls].each do |mu|\n @updated_json[\"managementurls\"] << { \"name\" => mu[\"name\"], \"url\" => mu[\"url\"] }\n end\n end\n \n # Flush changes:\n put @updated_json.to_json\n\n if defined? @resource[:reload_opsview]\n if @resource[:reload_opsview].to_s == \"true\"\n Puppet.notice \"Configured to reload opsview\"\n do_reload_opsview\n else\n Puppet.notice \"Configured NOT to reload opsview\"\n end\n end\n\n @property_hash.clear\n @hosttemplate_properties.clear\n\n false\n end", "def update\n @host = Host.find(params[:id])\n\n if @host.update(params[:host])\n head :no_content\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end", "def hosts(touchAndPrune=false)\n hosts=@vp_lock.synchronize{@hostname2vp.keys}\n if touchAndPrune\n check_up_hosts(hosts)\n else\n hosts\n end\n end", "def update_from_host_store!\n\t\tputs \"Invoke internal procedures to update the sub-domain list from the host store.\"\n\t\t# Step 1 - obtain the latest sub-domains\n\t\tmy_tracker = Wmap::HostTracker.instance\n\t\tmy_tracker.data_dir = @data_dir\n\t\tmy_tracker.hosts_file = my_tracker.data_dir + \"/\" + \"hosts\"\n\t\tmy_tracker.load_known_hosts_from_file(my_tracker.hosts_file)\n\t\tsubs = my_tracker.dump_sub_domains - [nil,\"\"]\n\t\tmy_tracker = nil\n\t\t# Step 2 - update the sub-domain list\n\t\tunless subs.empty?\n\t\t\t#subs.map { |x| self.add(x) unless domain_known?(x) }\n\t\t\tself.bulk_add(subs,@max_parallel)\n\t\tend\n\t\tputs \"Update discovered sub-domains into the store: #{@known_internet_sub_domains}\"\n\t\tself.save!(file_domains=@file_sub_domains, domains=@known_internet_sub_domains)\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend", "def update_etc_hosts\n comm = machine.communicate\n network_with_hostname = machine.config.vm.networks.map {|_, c| c if c[:hostname] }.compact[0]\n if network_with_hostname\n replace_host(comm, new_hostname, network_with_hostname[:ip])\n else\n add_hostname_to_loopback_interface(comm, new_hostname)\n end\n end", "def update!(**args)\n @counter = args[:counter] if args.key?(:counter)\n @host = args[:host] if args.key?(:host)\n @num = args[:num] if args.key?(:num)\n end", "def update(id:, hosts:)\n id_check(:id, id)\n non_empty_array_check(:hosts, hosts) unless hosts.nil?\n\n data = {hosts: hosts}\n\n cf_patch(path: \"/zones/#{zone_id}/ssl/certificate_packs/#{id}\", data: data)\n end", "def update\n respond_to do |format|\n if @host.update(host_params)\n format.html { redirect_to @host, notice: 'Host was successfully updated.' }\n format.json { render :show, status: :ok, location: @host }\n else\n format.html { render :edit }\n format.json { render json: @host.errors, status: :unprocessable_entity }\n end\n end\n end", "def network_objects_add_host(rule_name,data)\n \n host_list = data.split(',')\n self.msg(rule_name, :debug, 'network_objects_add_host', \"host_list\" +host_list.to_s)\n host_list.each do |host|\n self.msg(rule_name, :debug, 'network_objects_add_host', \"processing host\" +host.to_s)\n \n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('8')\n \n if host.size > 0\n self.msg(rule_name, :debug, 'network_objects_add_host', \"set host\" +host)\n @ff.text_field(:name, 'hostname').set(host.strip)\n @ff.link(:text, 'Apply').click\n end\n \n end\n \n end", "def update!(**args)\n @list_options = args[:list_options] if args.key?(:list_options)\n end", "def resolve_ip_sites\n\t\tputs \"Resolve sites that contain an IP address. Update the site cache table once a hostname is found in the local host table.\" if @verbose\n\t\tupdates=Array.new\n\t\tsites=get_ip_sites\n\t\thost_tracker=Wmap::HostTracker.instance\n\t\thost_tracker.data_dir=@data_dir\n\t\thost_tracker.hosts_file = host_tracker.data_dir + \"/\" + \"hosts\"\n\t\thost_tracker.load_known_hosts_from_file\n\t\tsites.map do |site|\n\t\t\tputs \"Work on resolve the IP site: #{site}\" if @verbose\n\t\t\tip=url_2_host(site)\n\t\t\thostname=host_tracker.local_ip_2_host(ip)\n\t\t\tif hostname.nil?\n\t\t\t\tputs \"Can't resolve #{ip} from the local host store. Skip #{site}\" if @verbose\n\t\t\telse\n\t\t\t\tputs \"Host-name found for IP #{ip}: #{hostname}\" if @verbose\n\t\t\t\tupdates.push(site)\n\t\t\t\trefresh(site)\n\t\t\tend\n\t\tend\n\t\tupdates.sort!\n\t\tputs \"The following sites are now refreshed: #{updates}\" if @verbose\n\t\thost_tracker=nil\n\t\treturn updates\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend", "def update!(**args)\n @location_list = args[:location_list] if args.key?(:location_list)\n end", "def update!(**args)\n @list = args[:list] if args.key?(:list)\n @text = args[:text] if args.key?(:text)\n end", "def update_dns()\n #\n # Handle each host in the config file at a time\n #\n @config['hosts'].each {|h|\n #\n # Skip update if current public IP matches the IP for the host in the cache file\n #\n if @cache[h['host']] && @myip.eql?(@cache[h['host']]['ip'])\n @logger.info \"Skipping #{h['host']} - Already pointing to #{@myip}\"\n else\n url = \"https://domains.google.com/nic/update?hostname=#{h['host']}&myip=#{@myip}\"\n @logger.info \"Updating host [#{h['host']}] - #{url}\"\n\n #\n # Access Google Domains API to update IP\n #\n open(url,\n :http_basic_authentication => [h['username'],h['password']],\n \"User-Agent\" => \"#{@options[:user_agent]}\") {|r|\n if r.status[0] == \"200\"\n r.each_line {|line|\n if (/(?<sts>(good|nochg))\\s+(?<ip>(\\d+\\.\\d+\\.\\d+\\.\\d+)?)/ =~ line)\n #\n # Cache if API call was successful\n #\n @cache[h['host']] = {'ip' => ip}\n @logger.debug \"[#{@responses[sts][0]}][#{sts}] : [#{@responses[sts][1]}]\"\n else\n @logger.warn \"[#{@responses[line][0]}][#{line}] : [#{@responses[line][1]}]\"\n end\n }\n else\n @logger.error \"Error status returned #{r.status.inspect}\"\n end\n }\n write_cache_file\n end\n }\n end", "def update!(**args)\n @all = args[:all] if args.key?(:all)\n @group_labels = args[:group_labels] if args.key?(:group_labels)\n @instance_name_prefixes = args[:instance_name_prefixes] if args.key?(:instance_name_prefixes)\n @instances = args[:instances] if args.key?(:instances)\n @zones = args[:zones] if args.key?(:zones)\n end", "def update_list(list, update_key, update_value)\r\n add_to_list(list, update_key, update_value)\r\n list\r\nend", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @vmware_clusters = args[:vmware_clusters] if args.key?(:vmware_clusters)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @vmware_node_pools = args[:vmware_node_pools] if args.key?(:vmware_node_pools)\n end", "def update!(**args)\n @target_sites = args[:target_sites] if args.key?(:target_sites)\n end", "def mass_update(data)\n result = @client.api_request(\n :method => \"template.massUpdate\",\n :params => {\n :hosts => data[:hosts_id].map { |t| {:hostid => t} },\n :templates => data[:templates_id].map { |t| {:templateid => t} }\n }\n )\n result.empty? ? false : true\n end", "def sync_host_table\n uri = foreman_uri('/hosts?per_page=9999999')\n debug \"Loading hosts from #{uri}\"\n json = RestClient.get uri\n debug \"Got JSON: #{json}\"\n JSON.parse(json)['results'].each do |rec|\n @db.execute \"insert into host (id,name) values ( ?, ? )\",\n rec['id'], rec['name']\n end\n end", "def hosts=(_arg0); end", "def hosts=(_arg0); end", "def initialize(hostList)\n @changePXE = 1\n @ReadyForWakeUp = 2\n @isWake = 3\n @wakeSSH = 4\n @shutDown = 5\n @isDown = 6\n @pingError = 7\n @sshError = 8\n @list = hostList\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @vmware_admin_clusters = args[:vmware_admin_clusters] if args.key?(:vmware_admin_clusters)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @url_lists = args[:url_lists] if args.key?(:url_lists)\n end", "def update!(**args)\n @price_list = args[:price_list] if args.key?(:price_list)\n @price_list_url = args[:price_list_url] if args.key?(:price_list_url)\n @status = args[:status] if args.key?(:status)\n end", "def update!(**args)\n @contact_centers = args[:contact_centers] if args.key?(:contact_centers)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @enable_ha = args[:enable_ha] if args.key?(:enable_ha)\n @group = args[:group] if args.key?(:group)\n @ip_blocks = args[:ip_blocks] if args.key?(:ip_blocks)\n @master_ip = args[:master_ip] if args.key?(:master_ip)\n @stackdriver_name = args[:stackdriver_name] if args.key?(:stackdriver_name)\n @vms = args[:vms] if args.key?(:vms)\n end", "def update!(**args)\n @enable_ha = args[:enable_ha] if args.key?(:enable_ha)\n @group = args[:group] if args.key?(:group)\n @ip_blocks = args[:ip_blocks] if args.key?(:ip_blocks)\n @master_ip = args[:master_ip] if args.key?(:master_ip)\n @stackdriver_name = args[:stackdriver_name] if args.key?(:stackdriver_name)\n @vms = args[:vms] if args.key?(:vms)\n end", "def update\n \n # Create integer copy of IP address\n params[:host][:ip_int] = Host.ip_as_int params[:host][:ip]\n\n @search = Host.search params[:search]\n @host = Host.find(params[:id])\n\n respond_to do |format|\n if @host.update_attributes(params[:host])\n flash[:notice] = 'Host was successfully updated.'\n format.html { redirect_to(@host) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @host.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end", "def known_host_hash?(hostlist, entries); end", "def execute_with(host_list, options = {}, &block)\n host_list.each { |host| @connections[host] ||= LazyConnection.new(host, @net_ssh_options) }\n args = options[:args] || []\n num_threads = options[:num_threads] || DEFAULT_THREAD_POOL_SIZE\n if options[:serial]\n host_list.each { |host| @connections[host].self_eval args, &block }\n elsif options[:batch_by]\n num_threads = options[:batch_by] if num_threads == :unlimited\n host_list.each_slice(options[:batch_by]) do |batch|\n Weave.with_thread_pool(batch, num_threads) do |host, mutex|\n @connections[host].self_eval args, mutex, &block\n end\n end\n else\n num_threads = host_list.size if num_threads == :unlimited\n Weave.with_thread_pool(host_list, num_threads) do |host, mutex|\n @connections[host].self_eval args, mutex, &block\n end\n end\n end", "def mongo_hosts=(h)\n @mongo_hosts = h.to_a\n end", "def update!(**args)\n @firewall_endpoints = args[:firewall_endpoints] if args.key?(:firewall_endpoints)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def host_list\n return @host_list if defined?(@host_list)\n\n if !self.hosts.blank?\n @host_list = self.hosts.split(/[,\\s]+/).compact\n else\n @host_list = []\n end\n\n @host_list\n end", "def update!(**args)\n @user_list = args[:user_list] if args.key?(:user_list)\n end", "def ddns_update(ip)\n ddns_update_he(HEuser, HEpw, HEtid, ip)\n {\n \"canishe.com\" => [ \"mail\", \"www\", \"@\", \"*\" ],\n \"gaelan.me\" => [ \"www\", \"@\" ],\n \"psd-chinese.net\" => [ \"www\", \"@\" ],\n }.each do |zone, hosts|\n hosts.each do |host|\n ddns_update_iwmn(host, zone, ip, IWMNuser, IWMNpw)\n end\n end\n\t{\n \"marimbaboise.com\" => [ \"www\", \"@\" ],\n }.each do |zone, hosts|\n hosts.each do |host|\n ddns_update_enom(host, zone, ip, BRpw)\n end\n end\nend", "def update!(**args)\n @control_plane_v2_config = args[:control_plane_v2_config] if args.key?(:control_plane_v2_config)\n @dhcp_ip_config = args[:dhcp_ip_config] if args.key?(:dhcp_ip_config)\n @host_config = args[:host_config] if args.key?(:host_config)\n @pod_address_cidr_blocks = args[:pod_address_cidr_blocks] if args.key?(:pod_address_cidr_blocks)\n @service_address_cidr_blocks = args[:service_address_cidr_blocks] if args.key?(:service_address_cidr_blocks)\n @static_ip_config = args[:static_ip_config] if args.key?(:static_ip_config)\n @vcenter_network = args[:vcenter_network] if args.key?(:vcenter_network)\n end", "def update\n @host = Host.find(params[:id])\n\n respond_to do |format|\n if @host.update_attributes(params[:host])\n format.html { redirect_to @host, notice: 'Host was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @host.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @ip_addresses = args[:ip_addresses] if args.key?(:ip_addresses)\n @modes = args[:modes] if args.key?(:modes)\n @network = args[:network] if args.key?(:network)\n @reserved_ip_range = args[:reserved_ip_range] if args.key?(:reserved_ip_range)\n end", "def update_groups list #hash or array\n updated=false\n if list.is_a? Array\n list.each do |grp|\n next if check_group grp\n @@groups[grp]=grp.to_s\n updated=true\n end\n else\n list.each_pair do |grp,name|\n next if check_group grp\n @@groups[grp]=name\n updated=true\n end\n end\n save if updated\n end", "def update!(**args)\n @field_metadata_list = args[:field_metadata_list] if args.key?(:field_metadata_list)\n end", "def update!(**args)\n @ip_blocks = args[:ip_blocks] if args.key?(:ip_blocks)\n @principals = args[:principals] if args.key?(:principals)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n @workstation_clusters = args[:workstation_clusters] if args.key?(:workstation_clusters)\n end", "def configure(hosts, force = nil)\n configured = ''\n\n hosts.each do |host|\n host.info\n\n status = host['TEMPLATE/PROVISION_CONFIGURATION_STATUS']\n\n host = Host.new(host['ID'])\n host.check\n\n if status == 'configured' && !force\n configured &&= true\n else\n configured &&= false\n end\n end\n\n if configured && !force\n Utils.fail('Hosts are already configured')\n end\n\n Driver.retry_loop 'Failed to configure hosts' do\n configure_all(hosts)\n end\n end", "def update!(**args)\n @client_traffic_fraction = args[:client_traffic_fraction] if args.key?(:client_traffic_fraction)\n @client_weight_fraction = args[:client_weight_fraction] if args.key?(:client_weight_fraction)\n @current_active_connections = args[:current_active_connections] if args.key?(:current_active_connections)\n @is_full = args[:is_full] if args.key?(:is_full)\n @last_schedule_interval_ms = args[:last_schedule_interval_ms] if args.key?(:last_schedule_interval_ms)\n @max_active_connections = args[:max_active_connections] if args.key?(:max_active_connections)\n @medium_term_load = args[:medium_term_load] if args.key?(:medium_term_load)\n @min_inter_request_secs = args[:min_inter_request_secs] if args.key?(:min_inter_request_secs)\n @non_full_interval_ms = args[:non_full_interval_ms] if args.key?(:non_full_interval_ms)\n @total_capacity_qps = args[:total_capacity_qps] if args.key?(:total_capacity_qps)\n @total_used_qps = args[:total_used_qps] if args.key?(:total_used_qps)\n @urllist = args[:urllist] if args.key?(:urllist)\n end", "def change_host\n @parameters[:hosts] = @parameters[:hosts].sort_by { rand } if @parameters[:randomize]\n\n # Set first as master and send it to the end of array\n current_host = @parameters[:hosts].shift\n @parameters[:hosts] << current_host\n\n @ssl = current_host[:ssl]\n @host = current_host[:host]\n @port = current_host[:port] || Connection::default_port(@ssl)\n @login = current_host[:login] || \"\"\n @passcode = current_host[:passcode] || \"\"\n end", "def update!(**args)\n @ip_blocks = args[:ip_blocks] if args.key?(:ip_blocks)\n end", "def update!(**args)\n @host_app_name = args[:host_app_name] if args.key?(:host_app_name)\n end", "def update!(**args)\n @cluster_ipv4_cidr_block = args[:cluster_ipv4_cidr_block] if args.key?(:cluster_ipv4_cidr_block)\n @cluster_secondary_range_name = args[:cluster_secondary_range_name] if args.key?(:cluster_secondary_range_name)\n @services_ipv4_cidr_block = args[:services_ipv4_cidr_block] if args.key?(:services_ipv4_cidr_block)\n @services_secondary_range_name = args[:services_secondary_range_name] if args.key?(:services_secondary_range_name)\n @use_ip_aliases = args[:use_ip_aliases] if args.key?(:use_ip_aliases)\n end", "def update!(**args)\n @host_public_key = args[:host_public_key] if args.key?(:host_public_key)\n @user_private_key_secret_version = args[:user_private_key_secret_version] if args.key?(:user_private_key_secret_version)\n end", "def update!(**args)\n @bare_metal_clusters = args[:bare_metal_clusters] if args.key?(:bare_metal_clusters)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def load_host_data\n JSON.parse(this_payload(@flag)).each do |h|\n execute_sql_statement(\n \"INSERT INTO hosts \\n\" \\\n \"(hostname, short_name, ip_address, host_group) \\n\" \\\n \"values \\n\" \\\n \"('#{h['hostname']}', '#{h['short_name']}', \" \\\n \"'#{h['ip_address']}', '#{h['host_group']}');\"\n )\n end\n end", "def update!(**args)\n @bare_metal_node_pools = args[:bare_metal_node_pools] if args.key?(:bare_metal_node_pools)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @external_ip = args[:external_ip] if args.key?(:external_ip)\n @internal_ip = args[:internal_ip] if args.key?(:internal_ip)\n @network_uri = args[:network_uri] if args.key?(:network_uri)\n @region = args[:region] if args.key?(:region)\n @uri = args[:uri] if args.key?(:uri)\n end", "def update!(**args)\n @primary_host_device_id = args[:primary_host_device_id] if args.key?(:primary_host_device_id)\n end" ]
[ "0.7520346", "0.6585109", "0.65630496", "0.6439962", "0.6412815", "0.6406071", "0.63059604", "0.62790745", "0.62790745", "0.6248175", "0.62462497", "0.6141535", "0.60170156", "0.5994991", "0.59805655", "0.5972963", "0.597183", "0.59278744", "0.5853054", "0.5848717", "0.5834424", "0.58153987", "0.58124375", "0.5803961", "0.5783797", "0.5764543", "0.5708582", "0.57085025", "0.57085025", "0.5696261", "0.5664726", "0.56337816", "0.56311774", "0.560735", "0.560735", "0.5597674", "0.5589344", "0.5556743", "0.5552163", "0.5545275", "0.5532757", "0.5530042", "0.55252224", "0.55178654", "0.55126154", "0.5510186", "0.5509009", "0.550251", "0.54935455", "0.5484136", "0.54729223", "0.5427536", "0.5426526", "0.5398041", "0.53967893", "0.53923965", "0.5391039", "0.5390732", "0.5387413", "0.5385426", "0.53713036", "0.53707093", "0.536383", "0.53574216", "0.53574216", "0.5354827", "0.5341111", "0.53365177", "0.5331033", "0.5321407", "0.5321241", "0.5321241", "0.52965313", "0.5296433", "0.52905464", "0.52882457", "0.5287408", "0.52710485", "0.5250004", "0.5242625", "0.523566", "0.52350926", "0.52317816", "0.52269137", "0.52265656", "0.52260584", "0.52236724", "0.5219455", "0.5219029", "0.521677", "0.5212591", "0.52120996", "0.52071315", "0.52056223", "0.52012557", "0.5195836", "0.5191999", "0.5179735", "0.5171166", "0.5167622" ]
0.5620037
33
take the PuppetDB scehema and transform it into useful info for us
def transform_hosts(hosts) require 'time' node_data = [] hosts.each do |host| if host[:report_timestamp].nil? # This can happen in weird cases. Mark as an expired node, so # the expired logic doesn't try to do math on a nil timestamp. last_checkin = nil formatted_checkin = 'N/A' host[:expired] = nil else last_checkin = Time.now - Time.parse(host[:report_timestamp]) formatted_checkin = sprintf("%#{@options.round_to}f",(last_checkin * @options.divisor).abs) end node_data << { :last_checkin => last_checkin, :expired => host[:expired].nil? ? false : host[:expired], :certname => host[:certname], :environment => host[:report_environment].nil? ? 'N/A' : host[:report_environment], :status => host[:latest_report_status].nil? ? 'N/A' : host[:latest_report_status], :formatted_checkin => formatted_checkin } end unless @options.environments.empty? node_data.delete_if {|node| not @options.environments.include? node[:environment] } end unless @options.statuses.empty? node_data.delete_if {|node| not @options.statuses.include? node[:status] } end node_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema\n @_format.schema\n end", "def schema(table, opts={})\n hero = execute(\"DESCRIBE #{table}\")\n hero.map do |h|\n [\n h[:col_name].strip.to_sym,\n { :db_type => h[:data_type].strip , :comment => h[:comment].strip }\n ]\n end\n end", "def resource_schema\n schemated = {}\n resource.columns_hash.each { |key, value| schemated[key] = value.type }\n schemated\n end", "def inspect\n \"#<Heroics::Schema description=\\\"#{@schema['description']}\\\">\"\n end", "def type_cast_for_schema(value)\n cast(value).value.inspect\n end", "def type_cast_for_schema(value) # :nodoc:\n value.inspect\n end", "def process_postgres(target)\n {\n :schema => 'iglu:com.snowplowanalytics.snowplow.storage/postgresql_config/jsonschema/1-0-0',\n :data => {\n :name => target['name'],\n :host => target['host'],\n :database => target['database'],\n :port => target['port'],\n :sslMode => target['ssl_mode'].upcase,\n :schema => target['table'].split('.')[0],\n :username => target['username'],\n :password => target['password'],\n :purpose => 'ENRICHED_EVENTS'\n }\n }\nend", "def schema(table, opts={})\n hero = execute(\"DESCRIBE #{table}\")\n hero.map do |h|\n [ h[:col_name].to_sym, { :db_type => h[:data_type] , :comment => h[:comment] } ]\n end\n end", "def type_cast_for_schema(value) # :nodoc:\n value.inspect\n end", "def format_model_schema(klass)\n hsh = klass.columns_hash.map { |column_name,column| [column_name, column.type] }.to_h\n format_schema_helper(hsh)\n end", "def schema_data\n dev_schema\n rescue\n VetsJsonSchema::SCHEMAS[@schema_name]\n end", "def schema\n {\n 'AM'\t=> 'Segment Identification',\n 'EY'\t=> 'Provider ID Qualifier',\n 'E9'\t=> 'Provider ID' }\n end", "def format_schema_helper(hsh)\n hsh = map_data_types(hsh)\n hsh.map { |column_name,column_type| [\"#{column_type}\".to_sym,\"#{column_name}\"] }\n end", "def schema_meta_data\n schema = []\n # not sure if there needs to be a header element with the number of columns in it\n # would look sort of like this\n # header = SchemaElement.new\n # header.name = @csv.rows.first.first\n # header.num_children = num_rows\n # schema << header\n @csv.headers.each do |header|\n schema << Configurator.schema_element_with_defaults({\n name: header\n })\n end\n\n schema\n end", "def parse_schema(fio)\n data_system.parse(fio)\n end", "def _schema_ds\n @_schema_ds ||= begin\n ds = metadata_dataset.select{[\n pg_attribute[:attname].as(:name),\n SQL::Cast.new(pg_attribute[:atttypid], :integer).as(:oid),\n SQL::Cast.new(basetype[:oid], :integer).as(:base_oid),\n SQL::Function.new(:format_type, basetype[:oid], pg_type[:typtypmod]).as(:db_base_type),\n SQL::Function.new(:format_type, pg_type[:oid], pg_attribute[:atttypmod]).as(:db_type),\n SQL::Function.new(:pg_get_expr, pg_attrdef[:adbin], pg_class[:oid]).as(:default),\n SQL::BooleanExpression.new(:NOT, pg_attribute[:attnotnull]).as(:allow_null),\n SQL::Function.new(:COALESCE, SQL::BooleanExpression.from_value_pairs(pg_attribute[:attnum] => SQL::Function.new(:ANY, pg_index[:indkey])), false).as(:primary_key),\n Sequel[:pg_type][:typtype],\n (~Sequel[Sequel[:elementtype][:oid]=>nil]).as(:is_array),\n ]}.\n from(:pg_class).\n join(:pg_attribute, :attrelid=>:oid).\n join(:pg_type, :oid=>:atttypid).\n left_outer_join(Sequel[:pg_type].as(:basetype), :oid=>:typbasetype).\n left_outer_join(Sequel[:pg_type].as(:elementtype), :typarray=>Sequel[:pg_type][:oid]).\n left_outer_join(:pg_attrdef, :adrelid=>Sequel[:pg_class][:oid], :adnum=>Sequel[:pg_attribute][:attnum]).\n left_outer_join(:pg_index, :indrelid=>Sequel[:pg_class][:oid], :indisprimary=>true).\n where{{pg_attribute[:attisdropped]=>false}}.\n where{pg_attribute[:attnum] > 0}.\n order{pg_attribute[:attnum]}\n\n # :nocov:\n if server_version > 100000\n # :nocov:\n ds = ds.select_append{pg_attribute[:attidentity]}\n\n # :nocov:\n if server_version > 120000\n # :nocov:\n ds = ds.select_append{Sequel.~(pg_attribute[:attgenerated]=>'').as(:generated)}\n end\n end\n\n ds\n end\n end", "def schema_definition\n of.schema_definition \n end", "def schema_parse_rows(rows)\n schema = []\n rows.each do |row| \n row[:allow_null] = row[:allow_null] == 'YES' ? true : false\n row[:default] = nil if row[:default].blank?\n row[:type] = schema_column_type(row[:db_type])\n schema << [row.delete(:column).to_sym, row]\n end\n schema\n end", "def type_cast_for_schema(value)\n cast_value(value).to_sym.inspect\n end", "def schema\n jiak.data.schema\n end", "def get_schema_struct(table_name)\n dbres = do_sql_command(\"DESC #{table_name};\")\n\n dbstruct = []\n\n if(dbres) then\n dbres.each_hash do | row |\n dbstruct_hash = {}\n row.each {|key, val|\n dbstruct_hash[key.downcase.to_sym] = val \n }\n dbstruct << dbstruct_hash\n end \n end\n\n dbstruct\nend", "def clean\n @schema = Hash[@schema.map { |key, value| [key.downcase.to_sym, value] }]\n end", "def schema\n return @schema\n end", "def chooseSchema\n @metadata.chooseSchema\n end", "def schema_from_hash schema\n json = schema.to_json.to_java(:string) # !\n \n rs = (ObjectMapper.new()).readValue(json, ResourceSchema.java_class);\n Util.translateSchema(Schema.getPigSchema(rs))\n end", "def schema\n execute(<<-eosql).collect { |row| row[0] }.collect { |t| table_schema(t) }\nSELECT rdb$relation_name FROM rdb$relations WHERE rdb$system_flag != 1\neosql\n end", "def schema(obj)\n y(obj.send(\"column_names\"))\nend", "def schema=(value); end", "def extract_meta\n end", "def schema\n hyper_schema_link.schema\n end", "def dump_schema_information_with_plugins\n begin\n sm_table = Goldberg::Migrator.schema_migrations_table_name\n migrated = select_all(\"SELECT version FROM #{sm_table}\")\n migrated.map do |v|\n \"INSERT INTO #{sm_table} (plugin_name, version) VALUES ('#{v['plugin_name']}', '#{v['version']}');\"\n end.join(\"\\n\\n\")\n rescue ActiveRecord::StatementInvalid \n # No Schema Info\n ''\n end\n end", "def schema\n @schema ||= metadata.ancestors('Schema').first\n end", "def schema\n raise NotImplementedError\n end", "def transform_descriptor(desc, type_of_desc='vnfd', platform ='osm')\n desc = JSON.parse(desc.to_json)\n case platform\n when 'osm'\n header = desc.delete('header')\n content = desc.delete(type_of_desc)\n desc[type_of_desc] = { header[0] => { header[1] => content } }\n when 'onap'\n fields = %w[name version invariant_id release_date_time]\n content = desc.delete('header')\n desc[type_of_desc]['metadata'] = {}\n fields.each do |item|\n content.each do |field|\n if !field.index(/#{item}/i).nil?\n desc[type_of_desc]['metadata'][field] = desc[type_of_desc][item]\n desc[type_of_desc].delete(item)\n break\n end\n end\n end\n desc[type_of_desc]['metadata']['nsd_designer'] = desc[type_of_desc]['vendor']\n desc[type_of_desc].delete('vendor')\n end\n desc\n end", "def schema_contents\n Committee.warn_deprecated(\"Committee: we'll remove schema_contents method in committee 3.0;\" \\\n \"please use committee_options.\")\n JSON.parse(File.read(schema_path))\n end", "def migrate_desc_metadata(ds_name, ds_object)\n from = FromDescMetadata.new(rubydora_object, ds_name)\n to = PersonMetadataDatastream.new(build_unsaved_digital_object, ds_name)\n begin\n to.name = from.display_name if from.display_name.present?\n to.email = from.preferred_email if from.preferred_email.present?\n to.alternate_email = from.alternate_email if from.alternate_email.present?\n to.save\n rescue Nokogiri::XML::XPath::SyntaxError\n # already converted\n true\n end\n end", "def schema_contents\n File.read(schema_path)\n end", "def schema\n self.class.schema\n end", "def extract_schema(records)\n (records || []).inject({}) do |memo, record|\n key = (record['rel'] || 'unknown').split('#').last.to_sym\n value = cleanse_gdata(record.except('rel'))\n value[:primary] = true if value[:primary] == 'true' # cast to a boolean for primary entries\n value[:protocol] = value[:protocol].split('#').last if value[:protocol] && value[:protocol].present? # clean namespace from handle protocols\n value = value[:$t] if value[:$t].present? # flatten out entries with keys of '$t'\n value = value[:href] if value.is_a?(Hash) && value.keys == [:href] # flatten out entries with keys of 'href'\n memo[key] = value\n memo\n end\n end", "def fields(table_name)\n f_arr = connection.select_all(\"SHOW FIELDS FROM #{table_name}\").\\\n map{|f| f['Field']}\n f_arr.sort!\n puts f_arr.to_yaml\nend", "def schema_parse_table(table, opts={})\n ds = dataset\n ds.identifier_output_method = :downcase\n schema_and_table = \"#{\"#{quote_identifier(opts[:schema])}.\" if opts[:schema]}#{quote_identifier(table)}\"\n table_schema = []\n metadata = transaction(opts){|conn| conn.describe_table(schema_and_table)}\n metadata.columns.each do |column|\n table_schema << [\n column.name.downcase.to_sym,\n {\n :type => column.data_type,\n :db_type => column.type_string.split(' ')[0],\n :type_string => column.type_string,\n :charset_form => column.charset_form,\n :char_used => column.char_used?,\n :char_size => column.char_size,\n :data_size => column.data_size,\n :precision => column.precision,\n :scale => column.scale,\n :fsprecision => column.fsprecision,\n :lfprecision => column.lfprecision,\n :allow_null => column.nullable?\n }\n ]\n end\n table_schema.instance_variable_set :@features, {\n :owner => :\"#{metadata.obj_schema.downcase}\",\n :clustered => (metadata.clustered? rescue nil),\n :temporary => (metadata.is_temporary? rescue nil),\n :partitioning => (metadata.partitioned? rescue nil),\n :typed => (metadata.is_typed? rescue nil),\n :index_only => (metadata.index_only? rescue nil)\n }\n table_schema\n end", "def probe\n name_pad = columns.map { |c| c.name.length }.max + 1\n type_pad = columns.map { |c| c.type.length }.max + 2\n sql_type_pad = columns.map { |c| c.sql_type.length }.max + 1\n\n columns.sort { |a, b| a.name <=> b.name }.map do |column|\n name = column.name\n name = \"* #{name}\" if primary_key_column?(column)\n print yellow(name.to_s.rjust(name_pad))\n print \" \"\n print blue(column.type.to_s.ljust(type_pad, \".\"))\n print magenta(column.sql_type.to_s.ljust(sql_type_pad))\n column.null ? print(red(\"NULL\")) : print(\" \")\n print \" [#{column.default}]\" if column.default\n print \" #{gray column.comment}\" if column.comment\n puts\n end\n nil\n end", "def to_s\n\t\tparts = [ \"Schema:\" ]\n\t\tparts << self.ivar_descriptions.collect {|desc| ' ' + desc }\n\t\treturn parts.join( $/ )\n\tend", "def get_schema_info(klass, options)\n info = []\n klass.columns.each do |col|\n attrs = []\n attrs << \"default(#{quote(col.default)})\" unless col.default.nil?\n attrs << \"not null\" unless col.null\n attrs << \"primary key\" if col.name == klass.primary_key\n\n col_type = col.type.to_s\n if col_type == \"decimal\"\n col_type << \"(#{col.precision}, #{col.scale})\"\n else\n col_type << \"(#{col.limit})\" if col.limit\n end\n\n # Check out if we got a geometric column\n # and print the type and SRID\n if col.respond_to?(:geometry_type)\n attrs << \"#{col.geometry_type}, #{col.srid}\"\n end\n\n # Check if the column has indices and print \"indexed\" if true\n # If the indice include another colum, print it too.\n if options[:simple_indexes] # Check out if this column is indexed\n indices = klass.connection.indexes(klass.table_name)\n if indices = indices.select { |ind| ind.columns.include? col.name }\n indices.each do |ind|\n ind = ind.columns.reject! { |i| i == col.name }\n attrs << (ind.length == 0 ? \"indexed\" : \"indexed => [#{ind.join(\", \")}]\")\n end\n end\n end\n info << { :name => col.name, :type => col_type, :attrs => attrs.join(\", \"), :human_name => klass.respond_to?(:human_attribute_name) ? klass.human_attribute_name(col.name) : col.name }\n end\n info\n end", "def schema_parse_table(table_name, opts)\n m = output_identifier_meth(opts[:dataset])\n\n _schema_ds.where_all(Sequel[:pg_class][:oid]=>regclass_oid(table_name, opts)).map do |row|\n row[:default] = nil if blank_object?(row[:default])\n if row[:base_oid]\n row[:domain_oid] = row[:oid]\n row[:oid] = row.delete(:base_oid)\n row[:db_domain_type] = row[:db_type]\n row[:db_type] = row.delete(:db_base_type)\n else\n row.delete(:base_oid)\n row.delete(:db_base_type)\n end\n\n db_type = row[:db_type]\n row[:type] = if row.delete(:is_array)\n schema_array_type(db_type)\n else\n send(TYPTYPE_METHOD_MAP[row.delete(:typtype)], db_type)\n end\n identity = row.delete(:attidentity)\n if row[:primary_key]\n row[:auto_increment] = !!(row[:default] =~ /\\A(?:nextval)/i) || identity == 'a' || identity == 'd'\n end\n\n # :nocov:\n if server_version >= 90600\n # :nocov:\n case row[:oid]\n when 1082\n row[:min_value] = MIN_DATE\n row[:max_value] = MAX_DATE\n when 1184, 1114\n if Sequel.datetime_class == Time\n row[:min_value] = MIN_TIMESTAMP\n row[:max_value] = MAX_TIMESTAMP\n end\n end\n end\n\n [m.call(row.delete(:name)), row]\n end\n end", "def schema\n absolutize(@schema)\n end", "def schema\n absolutize(@schema)\n end", "def schema\n adapter.schema\n end", "def basic_stack_data_format(info)\n info = info.to_smash\n Smash.new(\n :id => info[:id],\n :created => Time.parse(info[:insertTime]),\n :updated => Time.parse(info.fetch(:operation, :endTime, info.fetch(:operation, :startTime, info[:insertTime]))),\n :description => info[:description],\n :name => info[:name],\n :state => determine_state(info.fetch(:operation, {})),\n :status => determine_state(info.fetch(:operation, {})).to_s.split('_').map(&:capitalize).join(' '),\n :custom => info\n )\n end", "def get_schema_info(klass, header, options = T.unsafe(nil)); end", "def manipulate_schema_info( schema_info )\n \n schema_info = schema_info_to_array( schema_info )\n \n schema_info.each do |info|\n \n info.update({:model_type=>name.to_s})\n ext_attr_obj = ExtendedAttributesSchema.find_by_model_type_and_attr_name( name.to_s, info[:attr_name] )\n if ext_attr_obj\n if info.collect{|key,value| ext_attr_obj.send(key) == value }.include?(false) \n ext_attr_obj.update_attributes(info)\n end \n else\n ExtendedAttributesSchema.create(info) \n end\n end\n end", "def table_schema(tbl)\n column_sql = <<-eosql\nSELECT rf.rdb$field_name AS \"name\",\n field.rdb$field_type AS \"type_code\",\n field.rdb$field_sub_type AS \"subtype_code\",\n-- -- -- field.rdb$field_length AS \"length\", -- -- --\n field.rdb$field_precision AS \"precision\",\n field.rdb$field_scale AS \"scale\",\n CASE\n WHEN rf.rdb$null_flag > 0\n THEN 'NO'\n ELSE 'YES'\n END AS \"nullable\",\n CASE\n WHEN iseg.rdb$index_name IS NOT NULL\n THEN 'YES'\n ELSE 'NO'\n END AS \"primary_key\"\nFROM rdb$relation_fields rf\nJOIN rdb$fields field ON rf.rdb$field_source = field.rdb$field_name\nLEFT JOIN rdb$relation_constraints c\n ON c.rdb$relation_name = rf.rdb$relation_name\n AND\n c.rdb$constraint_type = 'PRIMARY KEY'\nLEFT JOIN rdb$index_segments iseg\n ON iseg.rdb$index_name = c.rdb$index_name\n AND\n iseg.rdb$field_name = rf.rdb$field_name\nWHERE rf.rdb$relation_name = ?\nORDER BY rf.rdb$field_position, rf.rdb$field_name\neosql\n\n info = RDBI::Schema.new([], [])\n res = execute(column_sql, tbl.to_s.upcase)\n res.as(:Struct)\n while row = res.fetch[0]\n type = RDBI::Driver::Rubyfb::Types::field_type_to_rubyfb(row[:type_code], row[:subtype_code])\n info.columns << RDBI::Column.new(\n row[:name].to_sym,\n type,\n RDBI::Driver::Rubyfb::Types::rubyfb_to_rdbi(type, row[:scale]),\n row[:precision],\n row[:scale],\n row[:nullable] == 'YES',\n #nil, # metadata\n #nil, # default\n #nil, # table\n )\n (info.columns[-1].primary_key = row[:primary_key] == 'YES') rescue nil # pk > rdbi 0.9.1\n end\n return unless info.columns.length > 0\n info.tables << tbl\n info\n end", "def transform_active_resource_erros_to_database(active_resource,database)\n # this hash, maps aws errors to specific agi database fields \n errors_map = {\n \"DBInstanceAlreadyExists\" => :name,\n \"DBInstanceIdentifier\" => :name,\n \"DBSecurityGroupName\" => :security_group_name,\n \"availability zone\" => :availability_zone,\n \"boolean must follow\" => :multi_az,\n \"master_username\" => :username,\n \"master user name\" => :username,\n \"password\" => :password,\n \"MasterUserPassword\" => :password,\n \"DBName\" => :db_name,\n \"DB engine\" => :db_type,\n \"Cannot find version\" => :engine_version,\n \"storage size\" => :instance_storage,\n \"DB instance\" => :instance_class,\n \"DBParameterGroup\" => :parameter_group,\n \"DBSecurityGroup\" => :security_group_name\n }\n active_resource.errors.messages.each_value do |aws_raw_error|\n field_message = errors_map.select { |aws_error_pattern,db_field| aws_raw_error.join =~ /#{aws_error_pattern}/ }\n if field_message.blank?\n database.errors.add(:base,aws_raw_error)\n else\n field_message.each_value { |db_field| database.errors.add(db_field,aws_raw_error) }\n end\n end\n end", "def property_schema_hash(property, model)\n schema = super\n schema.delete(:default) if schema[:primitive] == 'TEXT'\n schema\n end", "def data_attributes\n @schema.schema.select {|k,_| k.to_s.start_with?('data_') or k.to_s.start_with?('data-')}.inject({}) {|col,(k,v)| col[k[5..-1].to_sym]=v;col}\n end", "def dissect_to_record_hashes\n end", "def print_schema(schema)\n print_filtered_schema(schema, method(:is_defined_type))\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def fields\n schema.fields\n end", "def metadata_schema\n resource_class.metadata_schema\n end", "def metadata_for(node)\n (json_for(node)['normal'] || {}).transform_keys(&:to_sym)\n end", "def print_introspection_schema\n query_root = ObjectType.define do\n name \"Query\"\n end\n schema = Schema.new(query: query_root)\n print_filtered_schema(schema, method(:is_introspection_type))\n end", "def normalize(row)\n purchaser = Purchaser.find_by_name(row.fields[0])\n purchaser = Purchaser.create!({ name: row.fields[0] }) unless purchaser\n\n item = Item.find_by_description(row.fields[1])\n item = Item.create!({ description: row.fields[1], price: row.fields[2] }) unless item\n\n purchase = Purchase.new({ purchaser_id: purchaser.id, item_id: item.id, quantity: row.fields[3] })\n purchase.save!\n\n merchant = Merchant.find_by_name(row.fields[5])\n merchant = Merchant.create!({ name: row.fields[5], address: row.fields[4] }) unless merchant\n\n sale = Sale.new({ item_id: item.id, merchant_id: merchant.id})\n sale.save!\n end", "def get_schema(schema)\n # These are in a separately conditional ladder so that we only show the\n # user one warning.\n if schema.is_a?(String)\n warn_string_deprecated\n elsif schema.is_a?(Hash)\n warn_hash_deprecated\n elsif schema.is_a?(JsonSchema::Schema)\n warn_json_schema_deprecated\n end\n\n if schema.is_a?(String)\n schema = JSON.parse(schema)\n end\n\n if schema.is_a?(Hash) || schema.is_a?(JsonSchema::Schema)\n driver = Committee::Drivers::HyperSchema.new\n\n # The driver itself has its own special cases to be able to parse\n # either a hash or JsonSchema::Schema object.\n schema = driver.parse(schema)\n end\n\n # Expect the type we want by now. If we don't have it, the user passed\n # something else non-standard in.\n if !schema.is_a?(Committee::Drivers::Schema)\n raise ArgumentError, \"Committee: schema expected to be a hash or \" \\\n \"an instance of Committee::Drivers::Schema.\"\n end\n\n schema\n end", "def index_format_info(solr_doc)\n Solrizer.insert_field(solr_doc, 'object_type', object.human_readable_type, :facetable)\n\n\n #Solrizer.insert_field(solr_doc, 'object_type', model_s, :facetable) if model_s\n #Solrizer.insert_field(solr_doc, 'object_type', model_s, :symbol) if model_s\n\n\n # At this point primary classification is complete but there are some outlier cases where we want to\n # Attribute two classifications to one object, now's the time to do that\n ##,\"info:fedora/cm:Audio.OralHistory\",\"info:fedora/afmodel:TuftsAudioText\" -> needs text\n ##,\"info:fedora/cm:Image.HTML\" -->needs text\n #if [\"info:fedora/cm:Audio\",\"info:fedora/afmodel:TuftsAudio\",\"info:fedora/afmodel:TuftsVideo\"].include? model\n # unless self.datastreams['ARCHIVAL_XML'].dsLocation.nil?\n # Solrizer.insert_field(solr_doc, 'object_type', 'Text', :facetable)\n # Solrizer.insert_field(solr_doc, 'object_type', 'Text', :symbol)\n # end\n #end\n end", "def schema_and_table(result)\n :\"#{result.schema}__#{self.implicit_table_name}\"\n end", "def to_schema(data, plugin = false)\n return data unless data.is_a?(Hash)\n\n # Creates JSON references\n if data.key?(:_ref)\n data[\"$ref\"] = \"#/definitions/#{data.delete(:_ref)}\"\n end\n\n # Pull out all metadata since we don't want this in the schema.\n metadata, data = data.partition do |key, _|\n key.to_s.start_with?('_')\n end.map(&:to_h)\n\n # Flip plugin to true if the definition allows a plugin reference.\n # This will allow plugin references for all sub-options and items.\n plugin = metadata[:_plugin] if metadata.key?(:_plugin)\n\n # Recurse through some properties, as each can have their own defintions.\n %i[items additionalProperties].each do |key|\n next unless data.key?(key)\n data[key] = to_schema(data[key], plugin)\n end\n\n %i[properties definitions].each do |key|\n next unless data.key?(key)\n data[key] = data[key].transform_values { |opt| to_schema(opt, plugin) }\n end\n\n # Turn Ruby types into JSON types.\n data[:type] = to_json_types(data[:type]) if data.key?(:type)\n\n # Add a plugin definition if supported by the option.\n data = plugin ? add_plugin_reference(data) : data\n\n # Stringify keys\n data.transform_keys(&:to_s)\nend", "def derive_metadata\n primary_jsons = derive_rnp_jsons.reject { |j| j[\"primary key grip\"] }\n secret_json, public_json = %w[secret public].map do |k|\n primary_jsons.detect { |j| j[\"#{k} key\"][\"present\"] }\n end\n\n json = merge_public_secret_jsons(\n secret_json: secret_json,\n public_json: public_json,\n )\n\n update_column(:metadata, json)\n end", "def alter_schemata\n end", "def alter_schemata\n end", "def schema_parse_table(table_name, opts)\n m = output_identifier_meth(opts[:dataset])\n\n table = if opts[:schema]\n Sequel.qualify(opts[:schema], table_name)\n else\n Sequel.identifier(table_name)\n end\n\n describe(table, opts).map do |row|\n row[:db_type] = row[:type]\n row[:type] = schema_column_type(row[:db_type])\n row[:default] = nil\n row[:primary_key] = false\n [m.call(row.delete(:name)), row]\n end\n end", "def pretty(error)\n data, data_pointer, type, schema = error.values_at('data', 'data_pointer', 'type', 'schema')\n location = data_pointer.empty? ? 'root' : data_pointer\n\n case type\n when 'required'\n keys = error.fetch('details').fetch('missing_keys').join(', ')\n _(\"%{location} is missing required keys: %{keys}\") % { location: location, keys: keys }\n when 'null', 'string', 'boolean', 'integer', 'number', 'array', 'object'\n _(\"'%{data}' at %{location} is not of type: %{type}\") % { data: data, location: location, type: type }\n when 'pattern'\n _(\"'%{data}' at %{location} does not match pattern: %{pattern}\") % { data: data, location: location, pattern: schema.fetch('pattern') }\n when 'format'\n _(\"'%{data}' at %{location} does not match format: %{format}\") % { data: data, location: location, format: schema.fetch('format') }\n when 'const'\n _(\"'%{data}' at %{location} is not: %{const}\") % { data: data, location: location, const: schema.fetch('const').inspect }\n when 'enum'\n _(\"'%{data}' at %{location} is not one of: %{enum}\") % { data: data, location: location, enum: schema.fetch('enum') }\n else\n _(\"'%{data}' at %{location} is invalid: error_type=%{type}\") % { data: data, location: location, type: type }\n end\n end", "def ctype\n select_value(\n \"SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end", "def schema\n connection.schema\n end", "def normalize(column, value)\n column = column.to_s\n value = value.to_s\n\n if column.ends_with?('?') # Boolean\n truthy?(value)\n elsif column.ends_with?('_at') # DateTime\n parse_datetime(column, value)\n elsif column.ends_with?('_on') # Date\n parse_datetime(column, value).beginning_of_day\n elsif column.ends_with?('_to_i')\n value.to_i\n elsif column.ends_with?('_to_f')\n value.to_f\n elsif column.ends_with?('_to_s')\n value.to_s\n elsif column.ends_with?('_to_a')\n if ['[]', '{}'].include?(value)\n []\n elsif value.starts_with?('{') && value.ends_with?('}')\n YAML::load(value).keys.select { |str| str.to_s.present? }\n else\n YAML::load(value).to_a.select { |str| str.to_s.present? }\n end\n elsif column == 'id' || column.ends_with?('_id')\n value.present? ? value.to_i : nil\n else\n value.presence\n end\n end", "def fields\n schema.fields\n end", "def parse_result(result)\n genus = nil\n spec = nil\n infra_sp = nil\n infra_g = nil\n authorships = []\n uni = nil\n attributes = {}\n warns = nil\n quality = 0\n norm = nil\n if result.key?('details')\n result['details'].each do |hash|\n hash.each do |k, v|\n next if v.nil? # specific_epithet seems to do this occassionally and I don't know why. :|\n k = k.underscore.downcase # Looks like the format changed from this_style to thisStyle; change it back!\n next if k == 'annotation_identification'\n next if k == 'ignored'\n if k == 'infraspecific_epithets'\n attributes['infraspecific_epithet'] = v.map { |i| i['value'] }.join(' ; ')\n v.each do |i|\n add_authorship(authorships, i)\n end\n else\n begin\n attributes[k] = v['value']\n rescue => e\n @process.warn(\"ERROR: no '#{k}' value for attributes: #{v.inspect}\")\n raise e\n end\n add_authorship(authorships, v)\n end\n end\n end\n end\n if result.key?('canonicalName')\n canonical = result['canonicalName']\n canon =\n if canonical.is_a?(String)\n canonical\n elsif canonical.is_a?(Hash)\n if canonical.key?('valueRanked')\n canonical['valueRanked']\n elsif canonical.key?('value')\n canonical['value']\n elsif canonical.key?('extended')\n canonical['extended']\n elsif canonical.key?('simple')\n canonical['simple']\n elsif canonical.key?('full')\n canonical['full']\n end\n end\n end\n if result['parsed']\n warns = if result.key?('qualityWarnings')\n result['qualityWarnings'].map { |a| a[1] }.join('; ')\n end\n quality = result['quality'] ? result['quality'].to_i : 0\n norm = result['normalized'] ? result['normalized'] : nil\n else\n warns = 'UNPARSED'\n quality = 0\n canon = result['verbatim']\n end\n norm = result['verbatim'] if norm.blank?\n if norm.size > 250\n norm = canon\n authorships.each do |authorship|\n norm += \" #{authorship[:first]}, et. al\"\n norm += \" #{authorship[:year]}\" if authorship[:year]\n end\n norm = norm[0..249] if norm.size > 250 # Forced to simply truncate it if we couldn't parse it.\n end\n norm = result['verbatim'] if norm.blank?\n\n attributes.merge(\n normalized: norm,\n canonical: canon,\n authorship: authorships.flat_map { |a| a[:authors].blank? ? [] : a[:authors].map { |n| n&.tr(';', '|') } }.join('; '),\n warnings: warns,\n parse_quality: quality,\n year: authorships.map { |a| a[:year] }.compact.sort.first # Yeeesh! We take the earliest year (we only get one!)\n )\n end", "def csharp_type_for_schema_definition( schema )\n types = {\n ::Respect::ArraySchema => \"List<string>\",\n ::Respect::BooleanSchema => \"bool#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::FloatSchema => \"float#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::HashSchema => \"Dictionary<string, object>\",\n ::Respect::IntegerSchema => \"long#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::StringSchema => \"string\",\n ::Respect::AnySchema => \"object\",\n ::Respect::GeoPointSchema => \"global::#{ base_api_namespace() }.Fields.GeoPoint\",\n ::Respect::AttachmentSchema => \"global::#{ base_api_namespace() }.Fields.Attachment\"\n }\n\n types = if options[:use_noda_time] == \"true\" || options[:use_noda_time] == \"1\"\n types.merge({\n ::Respect::DatetimeSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"NodaTime.LocalDate#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n else\n types.merge({\n ::Respect::DatetimeSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n end\n\n type = types[ schema.class ]\n\n custom = nil\n collection = false\n\n schema_item = schema.instance_variable_get(:@item)\n if type == \"List<string>\" && schema_item && schema_item.is_a?(::Respect::AnySchema)\n type = \"List<object>\"\n end\n\n if schema.is_a?(Respect::HasOneSchema)\n type = sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of )\n custom = type\n collection = false\n end\n\n if schema.is_a?(Respect::EnumSchema)\n type = sanitize_model_namespace( schema.values_module ) + \".\" + sanitize_model_class( schema.values_module )\n custom = type\n collection = false\n\n emit_enum!( schema.values_module )\n end\n\n if schema.is_a?(Respect::HasManySchema)\n type = \"List<\" + sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of ) + \">\"\n custom = type\n collection = true\n end\n\n return type, custom, collection\n end", "def sanitize_metadata\n return unless metadata_changed?\n sanitizers = {\n 'title' => [:html_entities],\n 'notes' => [:html, :css],\n 'endnotes' => [:html, :css],\n 'summary' => [:html]\n }\n sanitizers.each do |field, sanitizers|\n value = metadata[field]\n next if value.blank?\n self.metadata[field] = sanitized_value(value, sanitizers)\n end\n sanitize_associations\n end", "def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end", "def parse_details(details)\n return details unless self.class.sql?\n\n relation_columns = details.select { |key, value| key =~ /.*_id$/ }\n relation_columns.each do |k, v|\n if relation_klass = get_relation_klass(k)\n begin\n if Array === v\n relation_columns[k] = v.map{|x| x ? relation_klass.find(x).send(human_relation_column(relation_klass)) : nil }\n else\n relation_columns[k] = v ? relation_klass.find(v).send(human_relation_column(relation_klass)) : nil\n end\n # rescue ActiveRecord::RecordNotFound\n rescue # Handle all error\n relation_columns[k] = v\n end\n end\n end\n relation_columns\n end", "def extract_metadata\n raise ArgumentError, \"MIME type unspecified or not configured\" if schema.blank?\n fn = \"extract_#{schema.downcase}_metadata\"\n raise ArgumentError, \"Unsupported metadata standard: #{schema}\" unless respond_to?(fn.to_sym)\n send(fn, metadata_xml)\n end", "def info\n if @filtered_rset.empty?\n @columns = {}\n return\n end\n\n query = @filtered_rset.to_sql\n\n @columns = @filtered_rset.first.attributes.each_with_object({}) do |c, m|\n m[c[0].to_sym] = nil\n m\n end\n\n tables = ActiveRecord::Base.connection.tables.select do |t|\n Regexp.new('\\b' + t + '\\b') =~ query\n end\n\n tables.each do |t|\n ActiveRecord::Base.connection.columns(t).each do |c|\n @columns[c.name.to_sym] = c.type if @columns.key?(c.name.to_sym)\n end\n end\n\n unless (extra = @columns.values.reject(&:present?)).empty?\n msg = extra.join(', ') + 'have missing types, perhaps these are aliased?'\n raise KilterError, msg\n end\n end", "def schema_meta_structure\n CreateVersionsTableQuery.new.to_cql\n end", "def apply_schema_transformations\n # replace_exclusive_indicators_by_discriminators\n end", "def load_schemas\n\t\t\tschema_instructions = []\n\t\t\tschema_pi = self.find_all { |i| i.is_a? REXML::Instruction and i.target == 'xml:schema' }\n\t\t\tschema_pi.each do |i|\n\t\t\t\tif i.attributes.has_key?('url')\n i.attributes['source'] = i.attributes['url']\n elsif i.attributes.has_key?('source')\n i.attributes['url'] = i.attributes['source']\n else\n raise \"parse error schema instruction missing required url attribute\"\n end\n if i.attributes.has_key?('uri')\n i.attributes['space'] = i.attributes['uri']\n elsif i.attributes.has_key?('space')\n i.attributes['uri'] = i.attributes['space']\n else\n raise \"parse error schema instruction missing required type attribute\"\n end\n schema_instructions << i\n\t\t\tend\n\t\t\treturn schema_instructions\n\t\tend", "def convert_yaml(servers)\n serverdata = {}\n servers.each do |server|\n hostname = server.hostname\n\n # Initialize our root fields so that there won't be any surprises from\n # hosts that don't have data.\n serverdata[hostname] = {}\n fields = %w(general netdb puppetfacts puppetstatus advisories\n vmware upgrades managed)\n fields.each do |root|\n serverdata[hostname][root] = {}\n end\n\n server.details.each do |detail|\n category = detail.category\n field = detail.name\n value = format_value(category, field, detail.value)\n serverdata[hostname][category][field] = value\n end\n end\n serverdata\n end", "def import_msfe_xml(args={}, &block)\n\t\tdata = args[:data]\n\t\twspace = args[:wspace] || workspace\n\t\tbl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []\n\n\t\tallow_yaml = false\n\n\t\tdoc = rexmlify(data)\n\t\tif doc.elements[\"MetasploitExpressV1\"]\n\t\t\tm_ver = 1\n\t\t\tallow_yaml = true\n\t\telsif doc.elements[\"MetasploitExpressV2\"]\n\t\t\tm_ver = 2\n\t\t\tallow_yaml = true\n\t\telsif doc.elements[\"MetasploitExpressV3\"]\n\t\t\tm_ver = 3\n\t\telse\n\t\t\tm_ver = nil\n\t\tend\n\t\tunless m_ver\n\t\t\traise DBImportError.new(\"Unknown verion for MetasploitExpress XML document\")\n\t\tend\n\n\t\tdoc.elements.each(\"/MetasploitExpressV#{m_ver}/hosts/host\") do |host|\n\t\t\thost_data = {}\n\t\t\thost_data[:workspace] = wspace\n\t\t\thost_data[:host] = host.elements[\"address\"].text.to_s.strip\n\t\t\tif bl.include? host_data[:host]\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\tyield(:address,host_data[:host]) if block\n\t\t\tend\n\t\t\thost_data[:host_mac] = host.elements[\"mac\"].text.to_s.strip\n\t\t\tif host.elements[\"comm\"].text\n\t\t\t\thost_data[:comm] = host.elements[\"comm\"].text.to_s.strip\n\t\t\tend\n\t\t\t%w{created-at updated-at name state os-flavor os-lang os-name os-sp purpose}.each { |datum|\n\t\t\t\tif host.elements[datum].text\n\t\t\t\t\thost_data[datum.gsub('-','_')] = host.elements[datum].text.to_s.strip\n\t\t\t\tend\n\t\t\t}\n\t\t\thost_address = host_data[:host].dup # Preserve after report_host() deletes\n\t\t\treport_host(host_data)\n\t\t\thost.elements.each('services/service') do |service|\n\t\t\t\tservice_data = {}\n\t\t\t\tservice_data[:workspace] = wspace\n\t\t\t\tservice_data[:host] = host_address\n\t\t\t\tservice_data[:port] = service.elements[\"port\"].text.to_i\n\t\t\t\tservice_data[:proto] = service.elements[\"proto\"].text.to_s.strip\n\t\t\t\t%w{created-at updated-at name state info}.each { |datum|\n\t\t\t\t\tif service.elements[datum].text\n\t\t\t\t\t\tif datum == \"info\"\n\t\t\t\t\t\t\tservice_data[\"info\"] = unserialize_object(service.elements[datum].text.to_s.strip, false)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tservice_data[datum.gsub(\"-\",\"_\")] = service.elements[datum].text.to_s.strip\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\treport_service(service_data)\n\t\t\tend\n\t\t\thost.elements.each('notes/note') do |note|\n\t\t\t\tnote_data = {}\n\t\t\t\tnote_data[:workspace] = wspace\n\t\t\t\tnote_data[:host] = host_address\n\t\t\t\tnote_data[:type] = note.elements[\"ntype\"].text.to_s.strip\n\t\t\t\tnote_data[:data] = unserialize_object(note.elements[\"data\"].text.to_s.strip, allow_yaml)\n\n\t\t\t\tif note.elements[\"critical\"].text\n\t\t\t\t\tnote_data[:critical] = true\n\t\t\t\tend\n\t\t\t\tif note.elements[\"seen\"].text\n\t\t\t\t\tnote_data[:seen] = true\n\t\t\t\tend\n\t\t\t\t%w{created-at updated-at}.each { |datum|\n\t\t\t\t\tif note.elements[datum].text\n\t\t\t\t\t\tnote_data[datum.gsub(\"-\",\"_\")] = note.elements[datum].text.to_s.strip\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\treport_note(note_data)\n\t\t\tend\n\t\t\thost.elements.each('vulns/vuln') do |vuln|\n\t\t\t\tvuln_data = {}\n\t\t\t\tvuln_data[:workspace] = wspace\n\t\t\t\tvuln_data[:host] = host_address\n\t\t\t\tif vuln.elements[\"info\"].text\n\t\t\t\t\tvuln_data[:info] = YAML.load(vuln.elements[\"info\"].text.to_s.strip)\n\t\t\t\tend\n\t\t\t\tvuln_data[:name] = vuln.elements[\"name\"].text.to_s.strip\n\t\t\t\t%w{created-at updated-at}.each { |datum|\n\t\t\t\t\tif vuln.elements[datum].text\n\t\t\t\t\t\tvuln_data[datum.gsub(\"-\",\"_\")] = vuln.elements[datum].text.to_s.strip\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\treport_vuln(vuln_data)\n\t\t\tend\n\t\tend\n\tend", "def get_schematron_processor\n raise \"Implement me damn it\"\n end", "def get_schematron_processor\n raise \"Implement me damn it\"\n end", "def refresh_schema\n GraphQL::Client.dump_schema(HTTP, SCHEMA_PATH)\n end", "def type_schema\n steps.type_schema\n end", "def load_database_yaml; end", "def load_database_yaml; end", "def property_schema_hash(repository, property)\n schema = super\n\n if property.serial?\n schema.delete(:default) # the sequence will be the default\n schema[:sequence_name] = sequence_name(repository, property)\n end\n\n # TODO: see if TypeMap can be updated to set specific attributes to nil\n # for different adapters. precision/scale are perfect examples for\n # Postgres floats\n\n # Postgres does not support precision and scale for Float\n if property.primitive == Float\n schema.delete(:precision)\n schema.delete(:scale)\n end\n\n schema\n end", "def schema\n @schema ||= get_parser(options)\n end", "def schema\n self\n end", "def structure_dump() end", "def parse_resource_description(resource_descr, type_to_create)\n resource_descr.each do |key, value|\n debug \"checking prop: '#{key}': '#{value}': '#{type_to_create}'\"\n if value.kind_of? Array\n value.each_with_index do |v, i|\n if v.kind_of? Hash\n # debug \"Array: #{v.inspect}\"\n begin\n k = eval(\"OMF::SFA::Model::#{key.to_s.singularize.capitalize}\").first(v)\n raise NameError if k.nil?\n resource_descr[key][i] = k\n rescue NameError => nex\n model = eval(\"OMF::SFA::Model::#{type_to_create}.get_oprops[key][:__type__]\")\n resource_descr[key][i] = (k = eval(\"OMF::SFA::Model::#{model}\").first(v)) ? k : v\n end\n end\n end\n elsif value.kind_of? Hash\n debug \"Hash: #{key.inspect}: #{value.inspect}\"\n begin\n k = eval(\"OMF::SFA::Model::#{key.to_s.singularize.capitalize}\").first(value)\n raise NameError if k.nil?\n resource_descr[key] = k\n rescue NameError => nex\n model = eval(\"OMF::SFA::Model::#{type_to_create}.get_oprops[key][:__type__]\")\n resource_descr[key] = (k = eval(\"OMF::SFA::Model::#{model}\").first(value)) ? k : value\n end\n end\n end\n resource_descr\n end", "def sanitize_row(record)\n cleaned_record = {}\n record.each_pair do |k, v| # this might remove too much info...\n cleaned_record.store(k,\n v.to_s.gsub(/\\//i, '-').gsub(/[^ [:word:]\\-\\. ]/i, ''))\n # first exchanges \\ for - then removes everything not[^ ] :word or - or . or space\n # put sql problem chars here only.gsub(/\\W+/, \"\"))\n end\n cleaned_record\n end" ]
[ "0.5806624", "0.5683235", "0.56606895", "0.5633703", "0.55633426", "0.55521137", "0.5543703", "0.54960537", "0.54793173", "0.53696424", "0.5359551", "0.5351858", "0.53385216", "0.530446", "0.5254253", "0.5247635", "0.52411675", "0.52299196", "0.52043563", "0.51771283", "0.5167013", "0.51545954", "0.513316", "0.5128694", "0.5122375", "0.51045513", "0.510298", "0.50995594", "0.5097837", "0.50786465", "0.50645036", "0.5062393", "0.50590765", "0.5051933", "0.50508356", "0.50507194", "0.5036989", "0.50274014", "0.50209785", "0.50137055", "0.50036776", "0.5000673", "0.498244", "0.49801856", "0.49601123", "0.49466586", "0.49466586", "0.4937919", "0.4933659", "0.49243402", "0.49212924", "0.49178353", "0.48960087", "0.48696992", "0.48624197", "0.48620194", "0.48579237", "0.48448396", "0.48448396", "0.48448396", "0.48439413", "0.48349652", "0.4830409", "0.48278666", "0.4821168", "0.4818892", "0.4814693", "0.48130792", "0.4811297", "0.48090798", "0.48090798", "0.48046225", "0.48007792", "0.47990882", "0.4795788", "0.47952494", "0.47860944", "0.4778629", "0.47610748", "0.4755139", "0.4753186", "0.47348398", "0.47299063", "0.47173995", "0.471532", "0.47145653", "0.4700333", "0.46989274", "0.46981314", "0.46925232", "0.46925232", "0.46912166", "0.46898", "0.4689502", "0.4689502", "0.46891868", "0.4687231", "0.46871018", "0.46811154", "0.46718597", "0.46718356" ]
0.0
-1
sort hosts list according to the option
def sort_hosts(hosts,sort_by) case sort_by when :certname return hosts.sort{ |a,b| a[:certname] <=> b[:certname] } when :time return hosts.sort{ |a,b| if a[:last_checkin].nil? and !b[:last_checkin].nil? 1 elsif !a[:last_checkin].nil? and b[:last_checkin].nil? -1 else a[:last_checkin] <=> b[:last_checkin] end } when :status return hosts.sort{ |a,b| a[:status].downcase <=> b[:status].downcase } when :environment return hosts.sort{ |a,b| a[:environment] <=> b[:environment] } else return hosts end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_host_grid\n assert_privileges(\"miq_request_edit\")\n return unless load_edit(\"prov_edit__#{params[:id]}\", \"show_list\")\n\n sort_grid('host', @edit[:wf].get_field(:placement_host_name, :environment)[:values])\n end", "def sorted_ip(hosts_hash)\n hosts_hash.keys.sort_by { |ip|\n a,b,c,d = ip.split('.');\n [a.to_i, b.to_i, c.to_i, d.to_i]\n }\nend", "def groups\n @groups_hosts.keys.sort\n end", "def hosts\n `#{cmk} --list-hosts`.split(/\\n/).sort\n end", "def list_of_hosts\n super\n end", "def test_sorting\n # Make sure declarations with no length sort first.\n host_exact = Declaration.new(:allow, \"host.com\")\n host_range = Declaration.new(:allow, \"*.host.com\")\n\n ip_exact = Declaration.new(:allow, \"192.168.0.1\")\n ip_range = Declaration.new(:allow, \"192.168.0.*\")\n\n\n assert_equal(\n -1, host_exact <=> host_range,\n\n \"exact name match did not sort first\")\n\n\n assert_equal(\n -1, ip_exact <=> ip_range,\n\n \"exact ip match did not sort first\")\n\n # Next make sure we sort by length\n ip_long = Declaration.new(:allow, \"192.168.*\")\n assert_equal(-1, ip_range <=> ip_long, \"/16 sorted before /24 in ip\")\n\n # Now try it using masks\n ip24 = Declaration.new(:allow, \"192.168.0.0/24\")\n ip16 = Declaration.new(:allow, \"192.168.0.0/16\")\n\n assert_equal(-1, ip24 <=> ip16, \"/16 sorted before /24 in ip with masks\")\n\n # Make sure ip checks sort before host checks\n assert_equal(-1, ip_exact <=> host_exact, \"IP exact did not sort before host exact\")\n\n\n assert_equal(\n -1, ip_range <=> host_range,\n\n \"IP range did not sort before host range\")\n\n host_long = Declaration.new(:allow, \"*.domain.host.com\")\n\n assert_equal(-1, host_long <=> host_range, \"did not sort by domain length\")\n\n # Now make sure denies sort before allows, for equivalent\n # declarations.\n host_deny = Declaration.new(:deny, \"host.com\")\n assert_equal(-1, host_deny <=> host_exact, \"deny did not sort before allow when exact\")\n\n host_range_deny = Declaration.new(:deny, \"*.host.com\")\n assert_equal(-1, host_range_deny <=> host_range, \"deny did not sort before allow when ranged\")\n\n ip_allow = Declaration.new(:allow, \"192.168.0.0/16\")\n ip_deny = Declaration.new(:deny, \"192.168.0.0/16\")\n\n\n assert_equal(\n -1, ip_deny <=> ip_allow,\n\n \"deny did not sort before allow in ip range\")\n\n %w{host.com *.domain.com 192.168.0.1 192.168.0.1/24}.each do |decl|\n assert_equal(0, Declaration.new(:allow, decl) <=>\n Declaration.new(:allow, decl),\n \"Equivalent declarations for #{decl} were considered different\"\n )\n end\n end", "def ssh_hostnames\n ssh_configs.map { |c| c.hostname }.compact.uniq.sort\n end", "def hosts\n (self.web_hosts.to_a + self.db_hosts.to_a + self.balance_hosts.to_a + self.app_hosts.to_a).uniq.sort\n end", "def hosts(touchAndPrune=false)\n hosts=@vp_lock.synchronize{@hostname2vp.keys}\n if touchAndPrune\n check_up_hosts(hosts)\n else\n hosts\n end\n end", "def topology_sort\n topology = []\n permanently_visited = Set.new\n temporary_visited = []\n loop do\n next_task = each_task.find do |task|\n not (permanently_visited.include? task or temporary_visited.include? task)\n end\n return topology unless next_task\n visit(next_task, permanently_visited, temporary_visited).each do |task|\n topology.insert 0, task\n end\n end\n topology\n end", "def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end", "def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end", "def sort_ips (ips)\n\t\tbegin\n\t\t\t\"Sort the list of IP address in the ascendant order: #{ips}\" if @verbose\n\t\t\treturn NetAddr.sort(ips)\n\t\trescue => ee\n\t\t\tputs \"Exception on method sort_ips for IPs #{ips}: #{ee}\" # if @verbose\n\t\tend\n\tend", "def sort(opts = {})\n return [] if not distkey\n \n opts[:by] = sortables[opts[:by]] if opts[:by]\n\n if opts[:start] && opts[:limit]\n opts[:limit] = [opts[:start], opts[:limit]]\n end\n\n objects(distkey.sort(opts))\n end", "def sort_opts!(&block)\n block ||= lambda {|option| (option.long || option.short).to_s.sub(/^-+/, '') }\n\n splits = []\n current = []\n\n options = self.options.values.uniq\n registry.each do |option|\n if options.include?(option)\n current << option\n else\n splits << current\n splits << option\n current = []\n end\n end\n\n splits << current\n @registry = splits.collect {|split| split.kind_of?(Array) ? split.sort_by(&block) : split }\n @registry.flatten!\n\n self\n end", "def sort_IPv6(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv6(list)\n\t\treturn Util.quick_sort(filtered)\n\tend", "def find_hosts!(host_spec)\n if self.groups[host_spec]\n return self.groups[host_spec].host_list.map { |m| self.hosts[m] }\n elsif self.hosts[host_spec]\n return [self.hosts[host_spec]]\n else\n say \"No inventory matching: '#{host_spec}' found. \"\n say ([\"Available hosts:\"] + self.hosts.keys).join(\"\\n\\t\")\n say ([\"Available groups:\"] + self.groups.keys).join(\"\\n\\t\")\n exit\n end\n end", "def sort_by_options(opts)\n opts.map { |by| by.split('.').second }.reject { |by| by == 'kind' }\n end", "def sort_by_site_range!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites}]\n self\n end", "def sort_by_sites!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites.size}]\n self\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def hosts; end", "def hosts; end", "def hosts; end", "def host_list\n return @host_list if defined?(@host_list)\n\n if !self.hosts.blank?\n @host_list = self.hosts.split(/[,\\s]+/).compact\n else\n @host_list = []\n end\n\n @host_list\n end", "def list_servers(data, group)\n groups = group.split(',')\n servers = []\n groups.each { |g| servers.push(data[g.to_sym]) }\n puts servers.uniq.sort.join(\" \")\nend", "def check_up_hosts(hostlisthash, settings={ :retry => true, :maxalert => NO_EMAIL, :timeout => 30})\n if hostlisthash.class==Array\n hostlisthash=hostlisthash.to_h(true)\n end\n if not settings.include?(:timeout)\n settings[:timeout]=30\n end\n if not settings.include?(:retry)\n settings[:retry]=true\n end\n if not settings.include?(:maxalert)\n settings[:maxalert]=NO_EMAIL\n end\n results, unsuccessful_hosts=issue_command_on_hosts(hostlisthash,settings){|h,p| h.backtic(\"hostname --fqdn\").chomp(\"\\n\").strip.downcase}\n uphosts=[]\n results.each{|vp|\n uphosts << ($rename_vp.has_key?(vp.at(0)) ? $rename_vp[vp.at(0)] : vp.at(0))\n if vp.at(0) != vp.at(1)\n log { \"check_up_hosts(): vp.at(0) != vp.at(1): #{vp.join(\" \")}\" }\n end\n }\n # if prune\n # unsuccessful_hosts.each{|h|\n # self.unregister_host(h)\n # }\n # end\n return uphosts\n end", "def preferred_hosts\n deep_values(\"preferred_hosts\")\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def sort_option\n ['Best match', 'Level', 'Provider(s)']\n end", "def sort_IPv4(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv4(list)\n\t\treturn Util.quick_sort(filtered)\n\tend", "def initialize_host_groups\n self.host_groups = settings['host_groups'].split(',').flatten.compact.map(&:strip).uniq.map { |group_name | HostGroup.find_or_create(:name => group_name.strip) }\n end", "def unique_scanned_hosts\n hosts = []\n scanned_hosts = self.show_scanned_hosts\n scanned_hosts.each do |sh|\n sh.hosts.split(\", \").each do |host|\n if host.scan(\"0/24\").empty?\n hosts << host.gsub(/\\s+/, \"\")\n else\n host = host.gsub(/\\s+/, \"\").gsub(\"0/24\", \"\")\n (0..255).each do |last_digit|\n tmp_host = \"#{host}#{last_digit}\" \n hosts << tmp_host\n end\n end\n end\n end\n return hosts.uniq.sort\n end", "def select_all\n @groups_hosts.values.flatten.delete_if{|v| v == nil}.sort\n end", "def top_hostname (num)\n\t\tputs \"Sort the host store for the most common hostname. \" if @verbose\n\t\th=Hash.new\n\t\thost_store=Hash.new\n\t\ttop=Array.new\n\t\t# Build a host table from the host file\n\t\tf=File.open(@hosts_file, 'r')\n\t\tf.each do |line|\n\t\t\tnext unless line =~ /\\d+\\.\\d+\\.\\d+\\.\\d+/\n\t\t\t# skip the domain roots in the host list\n\t\t\tnext if is_domain_root?(line.chomp)\n\t\t\tentry=line.chomp.split(%r{\\t+|\\s+|\\,})\n\t\t\tkey=entry[0].downcase\n\t\t\tvalue=entry[1]\n\t\t\tputs \"Loading key value pair: #{key} - #{value}\" if @verbose\n\t\t\thost_store[key] = Hash.new unless known_hosts.key?(key)\n\t\t\thost_store[key]= value\n\t\tend\n\t\tf.close\n\t\thost_store.keys.map do |key|\n\t\t\thost=key.split('.')\n\t\t\tif h.key?(host[0])\n\t\t\t\th[host[0]]+=1\n\t\t\telse\n\t\t\t\th[host[0]]=1\n\t\t\tend\n\t\tend\n\t\tresult = h.keys.sort { |a,b| h[b] <=> h[a] } # Sort by value descendantly\n\t\tnum = result.size if result.size < num\n\t\tfor i in 0...num\n\t\t\ttop.push(result[i])\n\t\tend\n\t\treturn top\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def routes_hostnames(output, options)\n fail NoRoutesError unless output\n lines = output.split(\"\\n\")[1..-1]\n hostnames = []\n lines.each do |line|\n if options[:all]\n hostnames << line.split[2]\n else\n hostnames << line.split[1]\n end\n end\n fail NoRoutesError if hostnames.empty?\n hostnames\n end", "def outdated_hosts\n hosts = []\n scanned_hosts = self.date_severity_count\n scanned_hosts.each do |sh|\n sh.hosts.split(\", \").each do |host|\n hosts << host.gsub(/\\s+/, \"\")\n end\n end\n return hosts.uniq.sort\n end", "def by_ssh_host\n by_ssh_host = {}\n self.class.list_map.each_pair do |role,list|\n self.send(list).each do |host_instance|\n if not by_ssh_host.has_key?(host_instance.ssh_host)\n by_ssh_host[host_instance.ssh_host] = []\n end\n by_ssh_host[host_instance.ssh_host] << host_instance\n end\n end\n by_ssh_host\n end", "def hosts=(_arg0); end", "def hosts=(_arg0); end", "def hosts\n @hosts ||= []\n end", "def cmd_resolve_hosts argv\n setup argv\n name = @hash['name']\n response = @api.resolve_hosts(name)\n msg response\n return response\n end", "def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end", "def sort_IPv4Net(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv4Net(list)\n\t\treturn Util.quick_sort(filtered)\n\tend", "def sortIPs(ips, localip)\n localip_i = IPAddr.new(localip).to_i\n\n # Near as I can tell Resolv::IPv4 doesn't have a .to_i or equivalent\n return ips.sort_by { |ip| (IPAddr.new(ip.to_s).to_i - localip_i).abs }\nend", "def sort_IPv6Net(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv6Net(list)\n\t\treturn Util.quick_sort(filtered)\n\tend", "def reload_hosts_list\n self.hosts = self.storage_servers\n write_hosts_to_file\n end", "def build_hosts_list(env_vms)\n\n int_id = 10\n\n first = true\n env_vms.each do |vm, vmconfig|\n vmconfig[\"networks\"].each do |name, netcfg|\n if netcfg[\"type\"] == \"private\" then\n if netcfg['ip'].nil? then\n netcfg['ip'] = \"192.168.50.\" + int_id.to_s\n #add the default IP to the environment definnition\n env_vms[vm][\"networks\"][name][\"ip\"] = \"192.168.50.\" + int_id.to_s\n int_id += 1\n end\n if first then\n $base_vars = \"vms_hosts={\"\n $base_vars << \"\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n first = false\n elsif\n $base_vars << \",\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n end\n end\n end if vmconfig[\"networks\"]\n end\n $base_vars << \"}\" if $base_vars\nend", "def unique_entries\n entries = Hash[*@entries.map { |entry| [entry.ip_address, entry] }.flatten].values\n entries.sort_by { |e| [-e.priority.to_i, e.hostname.to_s] }\n end", "def sort_entries; end", "def hosts\n Put.warn \"\\nStarted configuring ansible hosts.......\\n\"\n @ansible.groups.each do |group|\n Put.info \"Adding group [#{group['name']}]\"\n\n response = Rest::SubutaiConsole.command(\"echo [#{group['name']}] >> /etc/ansible/hosts\", @environment.ansible_host_id, \"/root\",\"1000\", @url, @token)\n status(response)\n\n group['hostnames'].each do |hostname|\n container = find(hostname)\n Put.info \"Adding hosts #{container.containerName} to group [#{group['name']}]\"\n\n if group.key?('python-interpreter')\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip} ansible_python_interpreter=#{group['python-interpreter']}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\n \"360000\",\n @url, @token)\n status(response)\n else\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\"360000\",\n @url, @token)\n status(response)\n end\n end\n end\n end", "def hosts\n # prevent original array from being changed\n @hosts.dup\n end", "def doozer_hosts\n hosts = []\n walk('/ctl/node/*/addr') do |path, value, revision|\n hosts << value unless hosts.include? value\n end\n hosts\n end", "def hosts(args = nil)\n if args and args[:server]\n args[:server].split(';').collect { |server| $hosts[server] ||\n Config.warn_fail(\"#{server} is not a known host\") }\n else\n $hosts.values\n end\nend", "def sock_sort(socks, final_sort = [])\n\n paired_socks = []\n\n if socks.length > 0\n socks.each_with_index do |sock, index|\n first_sock = socks.first\n if sock == first_sock\n paired_socks << [sock, first_sock]\n socks.delete(sock)\n end\n end\n final_sort << paired_socks\n else\n return final_sort\n end\n\n print sock_sort(socks,final_sort)\nend", "def host_list()\n host_list = [\n {\"ip\"=>\"192.168.110.207\", \"host\"=>\"zabbix-server\", \"roles\"=>[\"zabbix-server\", \"csgw\"], \"deployment\"=>\"vm\", \"status\"=>1},\n {\"ip\"=>\"192.168.110.210\", \"host\"=>\"test-01\", \"roles\"=>[\"test\"], \"deployment\"=>\"test\", \"status\"=>1}\n ]\n return host_list\n end", "def setup_sort_options(options)\n options[:sort] = options[:sort] ? options[:sort].dup : []\n end", "def list\n unless hosts.empty?\n format hosts\n else\n \"No custom hosts found.\\nYou can add some using:\\n\\thoust add [alias] [address]\\n\"\n end\n end", "def sort_options\n\t\t[\n\t\t\t['name', 'name', 'Name'], # Will be passed to #order\n\t\t\t['businesses', lambda { |tag| -1 * tag.active_businesses_in_city(@city).length }, 'Number of Businesses']\n\t\t]\n\tend", "def index_hosts\n load_service\n return if (@service.blank?)\n\n # Preload hosts\n @hosts = Host.where(:_id.in => @service.host_ids)\n\n respond_to do |format|\n format.html\n end\n end", "def list(options)\n file = File.open(FILE_PATH, \"r\")\n servers = []\n file.each do |line|\n if line.include?(\"Host \")\n servers << line.sub('Host', '')\n end\n end\n file.close\n if servers.empty?\n PRINTER.print \"No aliases added\"\n else\n PRINTER.print \"Listing aliases:\"\n servers.each{|x| PRINTER.print \"\\t- #{x}\"}\n end\n finish_exec\n end", "def server_hosts\n return [:default] if @resource[:server_hosts] &&\n @resource[:server_hosts][0] == :default &&\n @property_hash[:server_hosts] ==\n @aaa_group.default_servers\n @property_hash[:server_hosts]\n end", "def build_hostname_list(unique, hosts)\n hostnames = []\n if $stdin.tty?\n # reading hostnames from command line\n hosts.each do |hostname|\n hostnames.push(ServerData.to_hostname(hostname))\n end\n else\n # reading hostnames from a pipe\n STDIN.each do |hostname|\n if hostname != \"\\n\"\n hostname.chomp!\n hostnames.push(ServerData.to_hostname(hostname))\n end\n end\n end\n\n # remove duplicate hostnames\n if unique\n hostnames.uniq!\n end\n hostnames\n end", "def perform\n kahn_sorting if @sorted_list.empty?\n\n @sorted_list\n end", "def sorted(tasks)\r\n tasks.sort_by {|task| task[\"priority\"]}\r\nend", "def tem_ports\n @proxy_ports.values.sort\n end", "def sorted(tasks)\n tasks.sort_by {|task| task[:priority]}\nend", "def stub_hosts(ip_spec)\n stub_hosts_on(default, ip_spec)\n end", "def transform_hosts(hosts)\n require 'time'\n\n node_data = []\n\n hosts.each do |host|\n if host[:report_timestamp].nil?\n # This can happen in weird cases. Mark as an expired node, so\n # the expired logic doesn't try to do math on a nil timestamp.\n last_checkin = nil\n formatted_checkin = 'N/A'\n host[:expired] = nil\n else\n last_checkin = Time.now - Time.parse(host[:report_timestamp])\n formatted_checkin = sprintf(\"%#{@options.round_to}f\",(last_checkin * @options.divisor).abs)\n end\n node_data << {\n :last_checkin => last_checkin,\n :expired => host[:expired].nil? ? false : host[:expired],\n :certname => host[:certname],\n :environment => host[:report_environment].nil? ? 'N/A' : host[:report_environment],\n :status => host[:latest_report_status].nil? ? 'N/A' : host[:latest_report_status],\n :formatted_checkin => formatted_checkin\n }\n end\n\n unless @options.environments.empty?\n node_data.delete_if {|node| not @options.environments.include? node[:environment] }\n end\n unless @options.statuses.empty?\n node_data.delete_if {|node| not @options.statuses.include? node[:status] }\n end\n\n node_data\n end", "def priority_sort(result_list, free_bandwidth)\n priority_list = result_list.sort\n new_results = []\n priority_index = 0\n priority_list.each_index do |i|\n result = \"PASSED\"\n priority_index = priority_list[i].slice!(/^\\d+/).to_i\n bc = priority_list[i].split(\"|\")[0].unpack(\"a2a2a2\")\n if bc[2] == \"BF\"\n # fails if minimum failed and it's the top priority stream\n result = \"FAILED\" if bc[0] == \"YM\" && i == 0\n # fails if minimum failed and there was free bandwidth\n result = \"FAILED\" if bc[0] == \"YM\" && free_bandwidth > 0\n # fails if the bandwidth is over maximum specified\n result = \"FAILED\" if bc[1] == \"YN\"\n end\n new_results << priority_list[i].split(\"|\")[1].insert(0, \"[#{priority_index >= 0 ? sprintf(\"%d\", priority_index) : \"NONE\"}] [#{result}] \")\n end\n return new_results\nend", "def vulnerable_unique_hosts\n hosts = []\n scanned_hosts = self.severity_count\n scanned_hosts.each do |host|\n hosts << host.gsub(/\\s+/, \"\")\n end\n return hosts.uniq.sort\n end", "def select_hosts(hosts)\n title = \"Select host(s) to run cloudera-scm-agent:\\n\".red\n table = build_host_table(hosts)\n fzfopt = \"--header='#{title}'\"\n\n selected = Utils.fzf(list: table, opt: fzfopt)\n Utils.exit_if_empty(selected, 'No items selected')\n selected.map(&:split)\n end", "def hosts\n out = []\n out << \"group {\"\n out << ' filename \"deezy\";'\n Host.find_all_by_enabled(true).each do |host|\n out << [\n \" host #{host.hostname} { hardware ethernet #{host.mac}; \",\n \"#{\"fixed-address #{host.ip};\" unless host.ip.blank?}\",\n \"}\"\n ].join\n end\n out << \"}\"\n out << ''\n end", "def sort(pickup_option_ids)\n body = pickup_option_ids.map { |id| \"#{@session.api_url}/pickup-options/#{id}\" }\n response, status = BeyondApi::Request.put(@session, \"/pickup-options\", body)\n\n handle_response(response, status, respond_with_true: true)\n end", "def vlan_hosts\n @vlan_detail = VlanDetail.find(params[:id])\n @assets = @vlan_detail.assets.sort{|a,b| a.name <=> b.name}\n @assets = @assets.uniq{|x| x.name}\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @assets }\n end\n end", "def sort_links\n resource_service.sortable_fields.collect do |key,value|\n \tlink_to key, params.dup.update(:sort => key), :class => ((params[:sort].to_s==key.to_s) ? 'current' : '')\n end.join(' | ')\n end", "def sort_groups!\n dashboard[:panel_groups] = dashboard[:panel_groups].sort_by { |group| -group[:priority].to_i }\n end", "def challenge_order_for_select\n Challenge.not_status(Challenge::STATUS_ARCHIVED).all.map { |ch| [ch.name, ch.id] }\n end", "def actionlist_sort(action, list)\n list\n end", "def list_hosts(domain, compact_list_optional)\n validate_list([[\"Domain\", domain, :domain_format]])\n options = {\"Domain\" => domain}\n optional_fields = [ [\"compact_list_optional\", compact_list_optional] ]\n options = set_optional_fields(optional_fields, options)\n\n connection = Connection.new\n connection.post(\"Domain/Host/List\", options)\n end", "def available_hosts\n @available_hosts ||= []\n end", "def sort_if_needed\n @rules.sort! unless @sorted\n @sorted = true\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def puppetsort(hash)\n # TODO(sissel): Implement sorting that follows the puppet style guide\n # Such as, 'ensure' goes first, etc.\n return hash.to_a\n end", "def ListView_SortGroups(hwnd, _pfnGroupCompate, _plv)\n send_listview_message(hwnd, :SORTGROUPS, wparam: _pfnGroupCompate, lparam: _plv)\n end", "def managed_purls\n all.select(&:managed_purl?).sort_by { |x| [x.sort.present? ? 0 : 1, x.sort, x.text.present? ? 0 : 1, x.text] }\n end", "def parse_host\n args = ENV['host'].split(',')\n hosts = []\n args.each do |arg|\n if XP5K::Role.listnames.include? arg\n hosts << roles(arg)\n else\n hosts << arg\n end\n end\n hosts.flatten\nend", "def sorts_with_links\n [\n [search_merge(sort: 'best_match', order: 'desc', page: '1'), 'Relevancy'],\n\n [search_merge(sort: 'date', order: 'asc', page: '1'), 'Published Earliest'],\n [search_merge(sort: 'date', order: 'desc', page: '1'), 'Published Latest'],\n\n [search_merge(sort: 'title', order: 'asc', page: '1'), 'Title A-Z'],\n [search_merge(sort: 'title', order: 'desc', page: '1'), 'Title Z-A']\n ]\n end", "def simplify_hosts(element)\n name = element[\"name\"]\n hosts = element[\"hosts\"]\n [name, hosts]\nend", "def list(options)\n file = File.open(FILE_PATH, 'a+')\n servers = all_hosts_in(file)\n file.close\n if servers.empty?\n PRINTER.print 'No aliases added'\n else\n PRINTER.print 'Listing aliases:'\n servers.each{|x| PRINTER.print \"\\t- #{x}\"}\n end\n finish_exec\n end", "def all_hosts_in(group)\n inventory.all_hosts_in(group).map { |i| server(i.to_sym) }\nend", "def format_hosts\n all_hosts.inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def other_server_hosts\n @other_server_hosts ||= all_server_hosts.reject {|x| x == server_host}\n end", "def stable_sort_by(list); end", "def tie_breaking_sort\n { \"content_id\" => { order: \"asc\" } }\n end", "def sort(key, **options); end", "def get_foreman_hosts(per_page = 10000)\n curl = setup_curl(\"#{@foreman_url}/api/hosts?per_page=#{per_page}\", true)\n curl.perform\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['host']['name'] }\n @foreman_hosts = servers_array\n end", "def sort_by(options)\n self.sort = options\n end", "def all_hosts_in(file)\n servers = []\n file.each do |line|\n if line.include?('Host ')\n servers << line.sub('Host ', '').strip\n end\n end\n servers\n end" ]
[ "0.6581939", "0.63798106", "0.6134357", "0.6128738", "0.61221254", "0.6107028", "0.6080425", "0.5969106", "0.58336735", "0.57799315", "0.57559264", "0.5731035", "0.5712979", "0.5697514", "0.5691836", "0.5663905", "0.5662628", "0.56309354", "0.5595657", "0.5592202", "0.5579932", "0.55761135", "0.55761135", "0.55761135", "0.5566685", "0.55642456", "0.5563431", "0.5562272", "0.5555093", "0.5551649", "0.55481917", "0.5541542", "0.5528437", "0.5497668", "0.5496362", "0.5491233", "0.5489186", "0.5467192", "0.54631245", "0.54631245", "0.5461031", "0.5460249", "0.54482883", "0.54401445", "0.5438343", "0.54282606", "0.5425546", "0.53918666", "0.5385041", "0.53847134", "0.5380307", "0.53751004", "0.53730035", "0.535585", "0.5353082", "0.53464", "0.53414786", "0.53382844", "0.53209496", "0.530995", "0.5303813", "0.52966917", "0.52902085", "0.52896225", "0.5288446", "0.52813435", "0.5276107", "0.5275692", "0.5261701", "0.525778", "0.52468336", "0.5234176", "0.5226447", "0.5216282", "0.51948315", "0.51816237", "0.5176937", "0.5176898", "0.51636326", "0.51598877", "0.5153917", "0.51294506", "0.51276773", "0.51276773", "0.5123231", "0.51186043", "0.51133555", "0.5111512", "0.510889", "0.51015264", "0.50959057", "0.50916743", "0.5082647", "0.5080716", "0.50801516", "0.50764847", "0.5057851", "0.5057337", "0.5056656", "0.5055771" ]
0.7173006
0
find max length of element and return it
def find_longest(sorted_data, key) keys = sorted_data.map { |h| h[key].to_s } return keys.max_by(&:length).length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findMax(a)\n\ta.length\nend", "def max_length(attribute)\n return 0 if items.empty?\n items.map(&attribute.to_sym).max_by(&:length).size\n end", "def max\n @max ||= map {|a| a[0].length}.max\n end", "def length\n @length.kind_of?(Range) ? @length.max : @length\n end", "def longest_string ar\n return ar.max_by(&:length)\nend", "def longest_string ar\n\tar.max_by(&:length)\nend", "def max_length\n return @max_length\n end", "def max_node_value_length\n max_length = 0\n all_node_values_with_nil.each do |value|\n value_length = value.to_s.length\n max_length = value_length if value_length > max_length\n end\n return max_length\n end", "def maximal_length\n if !self.value.blank? && self.maxLength\n errors.add(:value, 'is too long!') if self.value.length > self.maxLength\n end\n end", "def longest_string array\n array.max_by(&:length)\nend", "def limit_value\n length\n end", "def max_word_length(words)\n max_length = 0\n words.each do |word|\n word_length = word.entry.length\n max_length = word_length if max_length < word_length\n end\n max_length\nend", "def find_longest_field\n\t\t\tcurrent_longest = nil\n\t\t\t@api_model.schema.each do |field|\n\t\t\t\tif current_longest == nil || field[0].length > current_longest\n\t\t\t\t\tcurrent_longest = field[0].length\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn current_longest\n\t\tend", "def longest_string array\n\tarray.max_by(&:length)\nend", "def longest_string(array)\n\tarray.max_by(&:length)\nend", "def longest_entry(words)\n return words.max_by(&:length)\n end", "def max_length\n MAX_LENGTH\n end", "def item_max\n return @enumeration.length\n end", "def length\n [default&.length, max_content_length].compact.max\n end", "def find_longest(arr)\n arr.max_by { |x| x.to_s.length }\nend", "def max\n array.length - 1\n end", "def longest_string list\n # longest = ''\n # list.each do |str|\n # if str.length > longest.length\n # longest = str\n # end\n # end\n # longest\n list.max_by{|i| i.length}\n # list.max_by(&:length)\nend", "def suggestedNumber\r\n return self.maxLength\r\n end", "def longest str\n\tstr.max_by(&:length)\nend", "def max_element\n self.to_a.max\n end", "def longest_string_length\n longest_string.size\n end", "def max_element(s)\n (return s[0]) if s.length==1\n maxRest = max_element(s[1..-1])\n s[0]>maxRest ? (return s[0]) : (maxRest)\nend", "def clever_octopus(array)\n max = nil\n array.each_with_index do |el, i|\n if max == nil || max.length < el.length\n max = el\n end\n end\n max\nend", "def find_longest_word(string)\n array = string.split(\" \")\n p array\n array.max_by(&:length) \nend", "def longest_string(string_array)\n string_array.max_by(&:length)\nend", "def longest_string string \n\tar = ['One','Two','Three','Four','Five']\n\tar.max_by(&:length)\nend", "def item_max\r\n @list.size\r\n end", "def longest(stringArray)\n return stringArray.max_by(&:length)\nend", "def longest(array)\n return array.max\nend", "def max_position\n @words.first[1].length\n end", "def max_len_column(j)\n column_collect(j) {|x| x.to_s.length}.max\n end", "def max_field_length\n if fields.is_a? Array\n fields.map { |f| f.to_s.length }.max\n else\n fields.to_s.length\n end\n end", "def longest_word(sen)\n tmp_arr = sen.split(\" \")\n tmp_longest = 0\n tmp_arr.each do |i|\n tmp_longest = i.size if i.size > tmp_longest\n end\n\n tmp_arr.select { |i| i.size == tmp_longest }.first\nend", "def length(root)\n max = 0\n traverse(root,0) {|n, l| max = l if l > max }\n max\n end", "def size\n @max\n end", "def item_max\n return 0 unless @data\n @data.size\n end", "def longest (arr)\n arr.max_by {|str| str.length}\nend", "def item_max\n return @data.size\n end", "def item_max\n return @data.size\n end", "def item_max; @data ? @data.size : 0; end", "def item_max\n @data ? @data.size : 1;\n end", "def item_max\n @data ? @data.size : 1\n end", "def item_max\n @data ? @data.size : 1\n end", "def item_max\n @data ? @data.size : 1\n end", "def item_max\n @data ? @data.size : 1\n end", "def item_max\n @data ? @data.size : 1\n end", "def item_max\n @data ? @data.size : 1\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\n @data ? @data.size : 0\n end", "def item_max\r\r\n @data ? @data.size : 1\r\r\n end", "def max\n\t w=0\n\t for i in(0..@n_elem-1)\n\t if(w < @elem[i])\n\t w = @elem[i]\n\t end\n\t end\n\t w\n\tend", "def length\n (lines.max_by(&:length) || '').size\n end", "def longest_string(array_of_strings)\n answer=array_of_strings.max_by(&:length)\n return answer\nend", "def max_length(max_size=0, options={}, &block)\n return length_between(0, max_size, options, &block)\n rescue Exception => e\n validation_error(\"#{e.message}\")\n end", "def length_of_longest_key\n keys = @hash.keys\n unless keys.empty?\n max_word = keys.max { |a, b| a.length <=> b.length }\n return max_word.length\n end\n end", "def player_with_longest_name\n longestName.max_by(&:length)\nend", "def longest(string)\n sliced = string.chars.slice_when {|a,b| a > b}.to_a\n longest = sliced.max_by {|sub_arr| sub_arr.length}.join\nend", "def longest\n @strings.max { |a,b| a.length <=> b.length}\n end", "def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end", "def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end", "def longest2(collection)\n collection.max { |a, b| a.length <=> b.length }\nend", "def item_max\r\n \t@data ? @data.size : 1\r\n end", "def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n # max = list_of_words[i]\n # end\n # end\n # end\n #\n # return max\nend", "def longest_string(arr)\n arr.max_by { |word| word.length }\nend", "def longest_string(list_of_words)\n # length = list_of_words.length\n if list_of_words == []\n return nil\n else\n return list_of_words.max_by { |x| x.length }\n end\nend", "def item_max\n return @data.nil? ? 0 : @data.size\n end", "def longest_length(validwords)\n validwords = validwords.sort_by(&:length).reverse\n validwords[0].length\nend", "def item_max\n @data.nil? ? 0 : @data.size\n end", "def find_longest(arr)\n arr.detect { |i| i.to_s.length == arr.max.to_s.length }\nend", "def get_longest_peptide_member \n answer = nil\n raise \"Member is not a gene!\" unless self.source_name == \"ENSEMBLGENE\" \n self.get_all_peptide_members.each do |peptide|\n \tnext unless peptide.sequence\n answer = peptide if answer.nil? or answer.seq.length <= peptide.seq.length \n end \n return answer \n end", "def item_max() @item_max end", "def linear_longest_word(arr)\n max_length=0\n max_str=arr[0]\n arr.each do |str| \n curr_length=str.length\n if curr_length>max_length\n max_length=curr_length\n max_str=str\n end\n end\n max_str\nend", "def item_max; 64; end", "def longest_integer_length\n longest_integer.to_s.size\n end", "def longest_word(sentence)\n words = sentence.split(\"\\s\")\n \n max_word = nil\n for word in words do\n if max_word == nil \n max_word = word\n elsif word.length > max_word.length \n max_word = word\n end\n end\n \n return max_word\nend", "def max_digits size\n (1..size).map{|x| x.to_s.size}.max\n end", "def val_element_length(element, exp_size)\n\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n exp_len_str = (0...exp_size).map { o[rand(o.length)] }.join\n puts \"generate random string => #{exp_len_str}\"\n\n act_len_str = \"#{exp_len_str}extra\"\n\n if element.attribute_value('maxlength').to_i != nil\n if element.attribute_value('maxlength').to_i == exp_size.to_i\n element.send_keys act_len_str\n end\n end\n\n if element.value == \"\"\n element.send_keys act_len_str\n end\n\n #### comparing the Value with maxlength\n if element.attribute_value('maxlength').to_i != nil\n ele_max_len = element.attribute_value('maxlength').to_i\n if ele_max_len != exp_size\n puts (\"Actual Element Maxlength: #{ele_max_len} != Expected Element Maxlength: #{exp_size}\")\n\n end\n end\n\n run_time_str =element.value\n if run_time_str.size == exp_size\n if run_time_str != exp_len_str\n fail(\"Actual Element Value #{run_time_str} != Expected Element Value #{exp_len_str}\")\n end\n else\n fail(\"Actual Element Value Count: #{run_time_str.size} != Expected Element Value Count: #{exp_size}\")\n end\nend", "def find_largest(array, length)\n largest = nil\n length.times do |index|\n largest = array[index] if !largest || array[index] > largest\n end\n return largest\nend", "def find_longest(arr)\n arr.map(&:to_s).sort_by(&:length).find { |num| num.length == arr.map(&:to_s).sort_by(&:length).last.length }.to_i\nend", "def find_largest(array, length)\n raise NotImplementedError\nend", "def find_max_length(a)\n\tmax = 0\t\n\tfor i in 0..a.size-2 do\n\t\tcount_0 = 0\n\t\tcount_1 = 0\n\t\tcurrent_max = 0\n\t\tfor j in i..a.size-1 do\n\t\t\tif a[j] == 0\n\t\t\t\tcount_0 = count_0+1\n\t\t\telsif a[j] == 1\n\t\t\t\tcount_1 = count_1+1\n\t\t\tend\n\t\t\tif count_0 == count_1\n\t\t\t\tcurrent_max = count_0+count_1\n\t\t\tend\n\t\tend\n\t\tif current_max > max\n\t\t\tmax = current_max\n\t\tend\n\tend\n\tmax\nend", "def max \n if max_element.kind_of? Array\n max_element.first\n else\n max_element\n end\n end", "def longest_string(list_of_words)\n if list_of_words.size != 0\n longest_str = list_of_words.max_by{|a| a.size}\n return longest_str\n else\n end\nend", "def longest_string(list_of_words)\n list_of_words.max { |a,b| a.size <=> b.size }\n\nend", "def item_max\n @dataConsumable ? @dataConsumable.size : 1\n end", "def length() end", "def length() end", "def length() end", "def length() end", "def get_longest_string\n current_longest = {@data[0] => @data[0].length}\n longest_value = @data[0] # BUG should read @data[0].length\n @data.each do |word|\n if word.length > longest_value\n current_longest = {word => word.length}\n longest_value = word.length\n end\n end\n current_longest\n end" ]
[ "0.7791119", "0.7575048", "0.75554734", "0.7484935", "0.7452516", "0.7399513", "0.7360989", "0.7326958", "0.7322258", "0.72244537", "0.72239935", "0.7193844", "0.71816087", "0.71717197", "0.7136517", "0.71068954", "0.70877457", "0.7082403", "0.70776325", "0.70618033", "0.70403165", "0.70254874", "0.7022558", "0.7006235", "0.69946754", "0.6988496", "0.69856167", "0.6975005", "0.69745594", "0.6965554", "0.6959718", "0.6936701", "0.69280094", "0.69159704", "0.6906203", "0.689296", "0.6880758", "0.68633974", "0.6844143", "0.6825584", "0.6813833", "0.68097", "0.6806634", "0.6806634", "0.67995757", "0.67940855", "0.67749923", "0.67749923", "0.67749923", "0.67749923", "0.67749923", "0.67749923", "0.67656463", "0.67656463", "0.67656463", "0.67656463", "0.67656463", "0.67656463", "0.67656463", "0.67603654", "0.6751937", "0.6738093", "0.6724974", "0.67220044", "0.6686914", "0.66820145", "0.6674114", "0.66684633", "0.666617", "0.666617", "0.66628754", "0.6662125", "0.6651342", "0.6648691", "0.6628512", "0.6626407", "0.6623963", "0.6622042", "0.66117245", "0.6593865", "0.65816855", "0.658152", "0.65752804", "0.657101", "0.6567801", "0.65624887", "0.6543226", "0.6535931", "0.6530665", "0.65201414", "0.6509081", "0.6505994", "0.6501155", "0.64911425", "0.6478116", "0.64752865", "0.64752865", "0.64752865", "0.64752865", "0.6470769" ]
0.66657096
70
Push a connection on the queue.
def push(connection) synchronize do @queue.push(connection) @cond.signal end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(conn)\n # No need to cache if the connection has already been closed.\n return if closed?(conn)\n\n connections.synchronize do\n connections.push([Time.now + idle_timeout, conn])\n end\n end", "def push_connection(conn_key, spec, th = nil)\n conns = tconf(th).connections\n n_conn = new_conn(conn_key, spec)\n conns.push(n_conn)\n tconf(th).stack_size += 1\n conns.last\n end", "def checkin_connection(conn)\n @queue.push(conn)\n conn\n end", "def push(packet)\n socket.queue_packet(packet)\n process_waiting\n end", "def put_connection(conn)\n conn.close if !active?\n @connections.offer(conn)\n end", "def push(message)\n @queue.push(message)\n end", "def push(obj)\n @queue.put(obj)\n end", "def _publish\n puts(\"pushing message: #{self.to_json} to queue #{@queue}\")\n AMQPCli.instance.push(self.to_json, @queue)\n end", "def push(x)\n @queue << x\n end", "def push(x) \n @queue.insert(x)\n self\n end", "def push(message, options = {})\n queue_connection.post build_push_message(message, options)\n end", "def push_to_amqp\n\n AMQP.start(APP_CONFIG['amqp']) do |connection|\n\n channel = AMQP::Channel.new(connection)\n\n channel.on_connection_interruption do |ch|\n puts \"--> Channel #{ch.id} detected connection interruption\"\n EventMachine.stop\n end\n\n exchange = channel.fanout(APP_CONFIG['amqp_channel'], :durable => true)\n exchange.on_connection_interruption do |ex|\n puts \"--> Exchange #{ex.name} detected connection interruption\"\n EventMachine.stop\n end \n\n exchange.publish(attributes.to_json.gsub('\\r\\n', '\\n'), :persistent => true) do\n connection.close { EventMachine.stop }\n end\n end\n\n return true\n end", "def push(x)\n @queue.push(x)\n nil\n end", "def push(x)\n @push_queue.push(x)\n pipe()\n swap()\n end", "def push(entry)\n exchange.publish(Marshal.dump(entry), :key => queue_name)\n end", "def add(name, connection)\n @connections.store(name, connection)\n end", "def push\n cfm.send_to_remote if do_push?\n end", "def fill_queue\n if @queue.num_waiting > 0\n Thread.new do\n while @queue.num_waiting > 0 && (conn = try_make_new)\n @queue.push(conn)\n end\n end\n end\n end", "def push(x)\n @size += 1\n @queue_in.push(x)\n end", "def connect\n rabbit.transaction_short do\n choose_queue\n yield\n end\n end", "def push(obj)\n @q << obj\n @mutex.synchronize { @cv.signal }\n end", "def <<(anObject)\n queue << anObject\n if queue.size >= max_queue_size()\n client << queue.pop()\n end\n end", "def push(x)\n @size += 1\n @queue_in.push(x)\n end", "def push(context)\n @queue << context\n true\n end", "def push(event:)\n super\n\n @queue << event\n end", "def add_connection(connection)\n self.connections[connection.id] = connection\n end", "def push\n end", "def push\n end", "def add(channel_name, stream_name, connection)\n @mutex.synchronize do\n subscribers[channel_name][stream_name].push(connection)\n connection\n end\n end", "def push( message )\n context.push(message)\n self\n end", "def push(x)\n @q1.push x\n end", "def push(reference)\n if reference\n @lock.synchronize do\n @queue.push(reference)\n end\n end\n end", "def push(x)\n @q << x \n end", "def push msg\n end", "def push(packet); end", "def push_event event\n @event_queue << event\n end", "def push(obj)\n handle_interrupt do\n @mutex.synchronize do\n @que.push obj\n @cond.signal\n end\n end\n end", "def direct_connect\n debug \"Connection will be established via direct connection #{host}:#{port}\"\n connection = build_connection(host, port, queue)\n if(register(connection))\n info \"Registered new connection #{connection}\"\n distribution.redistribute!\n else\n abort Error::ConnectionFailure.new(\"Failed to establish subscription at provided end point (#{host}:#{port}\")\n end\n connection\n end", "def push(c)\n @push = c\n end", "def push(klass, *args)\n Resque.enqueue klass, args\n end", "def apush\n socket = EM::Synchrony::TCPSocket.new('localhost', 22195)\n socket.write(to_bytes)\n socket.close\n end", "def preconnect(concurrent = false)\n if concurrent\n if times = sync{@max_size > (size = @size[0]) ? @max_size - size : false}\n times.times.map{Thread.new{if conn = try_make_new; @queue.push(conn) end}}.map(&:value)\n end\n else\n while conn = try_make_new\n @queue.push(conn)\n end\n end\n\n nil\n end", "def push(obj)\n @mutex.synchronize{\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end", "def publish(object)\n @channel << object\n end", "def publish_channel\n @publish_channel ||= ::AMQP::Channel.new(connection)\n end", "def enqueue(ele)\n @push_stack.push(ele)\n end", "def add_connection(uri) #:nodoc:\n publisher = SlaveProxy.new(@caller_id, uri)\n begin\n protocol, host, port = publisher.request_topic(@topic_name, [[\"TCPROS\"]])\n if protocol == \"TCPROS\"\n connection = TCPROS::Client.new(host, port, @caller_id, @topic_name, @topic_type, uri, @tcp_no_delay)\n connection.start\n else\n puts \"not support protocol: #{protocol}\"\n raise \"not support protocol: #{protocol}\"\n end\n connection.id = \"#{@topic_name}_in_#{@connection_id_number}\"\n @connection_id_number += 1\n @connections.push(connection)\n return connection\n rescue\n#\tputs \"request to #{uri} fail\"\n return false\n end\n end", "def push(obj)\n @mutex.synchronize{\n while true\n break if @que.length < @max\n @queue_wait.push Thread.current\n @mutex.sleep\n end\n\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end", "def connect opts={}\n unless EM.reactor_running?\n Thread.new { EventMachine.run }\n sleep 0.5\n end\n @connection = AMQP.connect(opts)\n end", "def push(message)\n @redis.lpush @name, message\n end", "def push(item)\n conn.rpush key, item\n self\n end", "def push(message)\n FastlyNsq.manager.pool.post(priority) do\n processor.call(message)\n rescue => ex\n FastlyNsq.logger.error ex\n FastlyNsq.tracer.notice_error ex\n raise ex\n end\n end", "def push(x)\n q = @queue1.empty? ? @queue2 : @queue1\n q.push x\n end", "def connect\n connection = Bunny.new(connection_attributes.\n merge(:pass => connection_attributes[:password]))\n connection.start\n \n # NOTE: This is a super undocumented feature that you will probably know\n # about only from reading AMQP specs. If we want to subscribe, but abort\n # subscription before all messages are read, we need to turn this on,\n # otherwise the server will go on and deliver all remaining messages in\n # turn. See also the :ack => true flag in ServerTransport... 23Dez09, ksc\n connection.qos\n\n connection\n end", "def add(link)\n @queue.add link\n end", "def push(obj)\n @mutex.synchronize do\n @queue.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n end", "def write(s)\n @queue << s\n self\n end", "def publish(connection)\n #\t4. Communication session\n channel = connection.create_channel\n # 5 Declare queue\n channel.queue(DELAYED_QUEUE, arguments: { \"x-dead-letter-exchange\" => \"\", \"x-dead-letter-routing-key\" => DESTINATION_QUEUE, \"x-message-ttl\" => 300000})\n\n # 6. Publish a message\n channel.default_exchange.publish \"message content\", routing_key:\n DELAYED_QUEUE\n puts \"#{Time.now}: Published the message\"\n channel.close\nend", "def push(obj)\n if @blocked\n raise \"Nothing can be added to queue. Queue is blocked.\"\n else\n super(obj)\n end\n end", "def publish message\n return if @push.nil?\n response = @push.send_string message #block until there's a connection\n Communicator::get_logger.info \"Error sending message, code #{response}\" if error?(response)\n end", "def push(item, options = {})\n async.sync_push(item, options)\n end", "def push &put\n #Thread.pass while self.full?\n sleep 0.01 while self.full?\n self.push! &put\n end", "def push(x)\n @queue.push(x)\n i = 0 \n while i < @size\n @queue.push(@queue.shift)\n i += 1\n end\n \n @size += 1\n return\n end", "def enqueue(payload)\n @queue.publish(JSON.generate(payload), :routing_key => @queue.name)\n end", "def push(x)\n @q1 << x\n @count += 1\n end", "def enqueue(payload)\n @queue.publish(payload.encode, :persistent => true)\n end", "def push_subscription(object)\n local_server.subscribe(object)\n synchro_point\n end", "def queue_in\n @channel.queue('dns-in', durable: true)\n end", "def publish(payload)\n @provider_queue.publish(payload)\n end", "def push(a_msg)\n encoded_message = YAML::dump(a_msg)\n @queue.push(a_msg)\n end", "def checkin_connection(conn)\n @available_connections << conn\n conn\n end", "def push(item, options={})\n async.sync_push(item, options)\n end", "def connect\n # backwards compatible code\n @host ||= ::Ragnar::Config.host\n @port ||= ::Ragnar::Config.port\n @connection = ::AMQP.connect({:host => @host, :port => @port})\n end", "def push( destination=nil, **options )\n\t\tself.server.run( :push, destination, **options )\n\t\treturn true\n\tend", "def enqueue_message(message)\n socket.enqueue_packet(message)\n end", "def push(city, distance)\n tuple = OpenStruct.new\n tuple.city = city\n tuple.distance = distance\n @queue << tuple\n end", "def timberline_push(content, metadata = {})\n if @timberline_queue.nil?\n raise \"You must specify a queue name using .timberline_queue first\"\n end\n @timberline_queue.push(content, metadata)\n end", "def enqueue(item)\n\t\t@queue << item\n\tend", "def queue(&b)\n @queue << b\n end", "def establish_connection(conn_key, spec, th = nil, &block)\n # either uses a stack, or change the thread specific connection\n if block_given?\n push_connection(conn_key, spec, th)\n ret = yield\n pop_connection(th)\n ret\n elsif in_stack?\n raise \"Can not modify thread-based connection when in stack\"\n else\n use_connection(conn_key, spec, th)\n end\n end", "def push(item)\n @client.lpush(@key, item) if item\n end", "def publish(data)\n @consumer_channel.push data\n end", "def push(item = nil)\n @mutex.synchronize do\n raise ClosedQueueError if closed?\n @items.push(item)\n @waiter.resume_next\n end\n self\n end", "def push(queue, value, args)\n if !defined?(value.queue)\n value.class_eval do \n @queue = queue\n end\n end\n Resque.enqueue value, args\n end", "def enqueue! data\n @q << data\n self\n end", "def deliver\n @queue << self\n end", "def push(element)\t\t\n\t\twhile [email protected]? do\n\t\t\[email protected](@q1.pop) # Dequeue element from queue q1 and enque the same to q2\n\t\tend\n\t\[email protected](element)\n\t\twhile [email protected]? do\n\t\t\[email protected](@q2.pop) # Dequeue element from queue q2 and enque the same to q1\n\t\tend\t\n\tend", "def op_push(arg)\n push arg\n end", "def push(message, timeout = nil)\n pushed_op = @Mutex.synchronize do\n return timeout ? true : self if ns_try_push(message)\n\n pushed = Promises.resolvable_future\n # TODO (pitr-ch 06-Jan-2019): clear timed out pushes in @PendingPush, null messages\n @PendingPush.push message, pushed\n pushed\n end\n\n result = pushed_op.wait!(timeout, [true, self, nil])\n result == pushed_op ? self : result\n end", "def add_to_queue!(user)\n $redis.lpush(self.class.redis_key_for_user(user), to_redis_object)\n end", "def push\n begin\n write_data\n rescue LockMethod::Locked\n sleep 0.5\n push\n end\n end", "def join(c)\n connections << c\n end", "def push(x)\n p = @stack.unshift(x)\n @q.insert(p)\n self\n end", "def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend", "def push(value, args)\n if !defined?(value.queue)\n value.class_eval do \n @queue = :default\n end\n end\n Resque.enqueue value, args\n end", "def push object\n raise QueueDestroyed if destroyed?\n\n begin\n encoded_object = encode(object)\n rescue Resque::EncodeException => e\n Resque.logger.error \"Invalid UTF-8 character in job: #{e.message}\"\n return\n end\n\n synchronize do\n @redis.rpush @redis_name, encoded_object\n end\n end", "def subscribe_queue(name, opts = {})\n # TBD: here and analogously; only push in self and dynamically call native_client?(:mq)\n R8QueueMQ.new(self, name, opts)\n end", "def add_connection(pin, wire)\n @jcell.add_wire_conn(pin, wire.name)\n end", "def enqueue_message(obj)\n output_queue << obj\n end", "def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend" ]
[ "0.70210874", "0.6863105", "0.66766065", "0.6586564", "0.6550053", "0.647847", "0.6452492", "0.64172006", "0.63637966", "0.6192346", "0.6131038", "0.61185247", "0.61083037", "0.6082668", "0.60824645", "0.6065117", "0.605857", "0.60523844", "0.59896946", "0.59708583", "0.59624904", "0.59410816", "0.5941032", "0.5935135", "0.5934122", "0.58948123", "0.58831924", "0.5882483", "0.5862623", "0.5848912", "0.5847206", "0.5815923", "0.5815822", "0.58012694", "0.57900333", "0.57896894", "0.5773497", "0.57701385", "0.57562876", "0.5754038", "0.5742347", "0.5733217", "0.5723238", "0.572212", "0.5720703", "0.57138604", "0.5701232", "0.5691527", "0.5688575", "0.5681797", "0.5678038", "0.56702477", "0.5648454", "0.5645421", "0.56421757", "0.564017", "0.5618368", "0.5603308", "0.5566707", "0.55545324", "0.5523836", "0.55098987", "0.5509894", "0.5503859", "0.5495926", "0.54943144", "0.5485594", "0.5480853", "0.5476927", "0.54728687", "0.54669106", "0.5464168", "0.54532206", "0.545055", "0.5448055", "0.5434874", "0.54332775", "0.54322517", "0.5428913", "0.5421011", "0.5419259", "0.54187495", "0.5398977", "0.53941965", "0.5383326", "0.5377373", "0.53657615", "0.5360405", "0.535751", "0.5355108", "0.5354812", "0.5353507", "0.53462285", "0.53442734", "0.5337603", "0.53350276", "0.5331023", "0.5328755", "0.5327535", "0.53249586" ]
0.77880883
0
Pop the next connection off the queue.
def shift deadline = Time.now + @timeout synchronize do loop do return @queue.shift unless @queue.empty? wait = deadline - Time.now raise Timeout::Error, "Waited for #{@timeout} seconds for connection but none was pushed." if wait <= 0 @cond.wait(wait) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop\n connections.synchronize do\n evict\n _, connection = connections.pop\n connection\n end\n end", "def pop()\n res = @pop_queue.shift()\n return res\n end", "def pop()\n @queue.shift\n end", "def pop!\n @mutex.synchronize do\n loop do\n if @queue.empty?\n raise ThreadError, \"Empty Channel\"\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end", "def pop\n @lock.synchronize do\n @queue.pop\n end\n end", "def dequeue; @queue.pop end", "def pop()\n @size -= 1 \n @queue.shift\n end", "def pop\n @queue.pop(true)\n rescue ThreadError\n if closed?\n raise ClosedQueue if @raise_exception.true?\n return nil\n else\n sleep\n retry\n end\n end", "def disconnect(opts=OPTS)\n while conn = @queue.pop(timeout: 0)\n disconnect_connection(conn)\n end\n fill_queue\n nil\n end", "def pop()\n new_queue = Queue.new\n until @queue.size == 1\n new_queue << @queue.pop\n end\n last = @queue.pop\n @queue = new_queue\n last\n end", "def pop\n if @q.empty?\n raise QueueEmptyError, \"tried to pop empty queue in #{@component.inspect}\"\n end\n obj = @q.shift\n @component.dec_queue_ready_count if @q.empty?\n obj\n end", "def pop()\n @q.shift\n end", "def dequeue\n @queue.shift\n end", "def pop_connection(th = nil)\n conns = tconf(th).connections\n prev_conn = conns.pop\n close_conn(prev_conn) unless prev_conn.nil?\n tconf(th).stack_size -= 1 if tconf(th).stack_size > 0\n conns.last\n end", "def dequeue\n @q.shift\n end", "def message_from_queue\n if msg = @connection.pop\n message = msg.body.delete(\"\\n\")\n msg.finish\n message\n end\n end", "def dequeue\n\t\[email protected]\n\tend", "def remove\n @queue.shift\n end", "def remove\n @queue.shift\n end", "def pop\n while true\n message = @queue.pop\n return YAML::load(message.to_s) unless message.nil?\n sleep 5\n end\n end", "def pop\n @mutex.synchronize do\n loop do\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end", "def pop()\n if @queue_out.size == 0 \n if @queue_in.size == 0 \n return \n end\n \n while @queue_in.size > 0 \n @queue_out.push(@queue_in.pop)\n end\n end\n \n @size -= 1\n return @queue_out.pop\n end", "def pop()\n if @queue_out.size == 0\n if @queue_in.size == 0\n return\n end\n\n while @queue_in.size > 0\n @queue_out.push(@queue_in.pop)\n end\n end\n\n @size -= 1\n return @queue_out.pop\n end", "def remove\n @queue.shift\n end", "def next_available\n case @connection_handling\n when :stack\n @available_connections.pop\n else\n @available_connections.shift\n end\n end", "def next_available\n case @connection_handling\n when :stack\n @available_connections.pop\n else\n @available_connections.shift\n end\n end", "def peek; @queue[-1] end", "def pop\n if @queue.empty?\n nil\n else\n tempArr = []\n while @queue.size > 1\n tempArr.push(@queue.remove)\n end\n tempItem = @queue.remove\n while !tempArr.empty?\n @queue.insert(tempArr.pop)\n end\n tempItem\n end\n end", "def dequeue\n loop do\n return nil if @stop\n message = receive_message\n if message\n if message.valid?\n return message\n else\n delete_message(message)\n end\n end\n end\n end", "def next\n @mutex.synchronize do\n until @close_now\n a = @queue.shift\n @logger.debug(\"#{@name}'s queue shifted to: #{a}\")\n if !a.nil?\n @full.broadcast\n @empty.broadcast\n return a\n else\n @logger.debug(\"#{@name}'s queue is currently closed?: #{closed?}\")\n return nil if closed?\n\n @empty.wait(@mutex)\n end\n end\n end\n end", "def dequeue\n if @push_ptr\n if @pop_ptr\n object_ = @buffer[@pop_ptr]\n @buffer[@pop_ptr] = nil\n @pop_ptr += 1\n @pop_ptr = 0 if @pop_ptr == @buffer.size\n @pop_ptr = nil if @pop_ptr == @push_ptr\n object_\n else\n nil\n end\n else\n @buffer.shift\n end\n end", "def remove\n @queue.pop\n end", "def dequeue\n @data.shift\n end", "def next_event\n @queue.pop\n end", "def dequeue\n\t\t\tself.pop\n\t\tend", "def pull_queue_pull\n return nil if self.pull_queue_names.length == 0\n \n puts \"pulling from queues #{self.pull_queue_names.join ', '}\"\n \n elt = nil\n elt = @redis.brpop(self.pull_queue_names, self.queue_wait_seconds) while elt == nil\n \n key = elt[0]\n val = elt[1]\n self.debug_out \"got data from pull queue #{key}\"\n Marshal.load val\n end", "def dequeue\n @items.shift\n end", "def pop\n return nil if empty?\n @que.pop\n end", "def last_pop\n @api_adapter.last_pop_from_queue(self.name)\n end", "def pop\n alarm = (Time.now + @wait_timeout)\n clnt = nil\n dirty = false\n while !@shutdown\n raise_alarm if (Time.now > alarm)\n @mutex.synchronize do\n begin\n if clnt = @_pool.pop\n dirty = true\n else\n clnt = _fetch_new(&@client_block)\n end\n ensure\n if clnt\n _checkout(clnt)\n @cond.signal\n else\n @reaper.wakeup if @reaper && _dead_clients?\n @cond.wait(@mutex,@wait_timeout)\n end\n end\n end\n break if clnt\n end\n clean_client(clnt) if dirty && clnt\n clnt\n end", "def pop_notification\n notification_queue.shift\n end", "def pop(options = {})\n @api_adapter.pop_from_queue(self.name, options)\n end", "def pop\n if empty?\n nil\n else\n @q.remove\n @stack.shift\n end\n end", "def pop &use\n #Thread.pass while self.empty?\n sleep 0.01 while self.empty?\n self.pop! &use\n end", "def dequeue\n @mutex.synchronize do\n # Check if the queue is empty.\n if @head == @tail # not using empty? to avoid extra synchronize block\n return nil\n end\n\n # Remove next object.\n object = @queue[@head]\n @queue[@head] = nil\n\n @head = (@head + 1) & @max_mask\n return object\n end\n end", "def pop()\n head_index = get_document(@head_index_key)\n tail_index = get_document(@tail_index_key)\n if tail_index > head_index # if there is an item in the queue\n increase_atomic_count(@head_index_key) #incremented new_head_index is ignored, but we are incrementing and popping value\n return get_document(\"#{@key}::#{head_index + 1}\")\n else # \n nil\n end\n end", "def pop\r\n ret = peek\r\n @buffer = nil\r\n ret\r\n end", "def pop_exception\n exception_queue.shift\n end", "def get_next\n while next_item = @queue.peek\n if next_item.cancelled?\n @queue.shift\n else\n return next_item\n end\n end\n\n return nil\n end", "def dequeue\n last_el = self.queue_var[-1]\n self.queue_var = self.queue_var[0...-1]\n last_el \n end", "def pop\n conn.rpop key\n end", "def peek()\n if @queue_out.size == 0 \n if @queue_in.size == 0 \n return \n end\n \n while @queue_in.size > 0 \n @queue_out.push(@queue_in.pop)\n end\n end\n \n return @queue_out.last\n end", "def pop\n node_count = self.size\n\n @tail = self.at(node_count-2) #-2 because of how size works\n @tail.next_node = nil\n end", "def pop\n entry = queue.pop[:payload]\n if (entry != :queue_empty)\n Marshal.load(entry)\n else\n nil\n end\n end", "def pop() end", "def pop\n _exchange\n end", "def pop\n until @queue_1.size == 1\n @queue_2 << @queue_1.shift\n end\n\n # popped_element = @queue_1.shift\n # @queue_1 = @queue_2\n # @queue_2 = []\n # popped_element\n\n # ..is the same as..\n\n # q1 has 1 el, q2 has the rest. we want q2 empty, q1 full - last\n @queue_1, @queue_2 = @queue_2, @queue_1\n @queue_2.shift\n end", "def peek \n self.queue_var[-1]\n end", "def peek()\n @queue.first\n end", "def pop(*args)\n retval = super\n @mutex.synchronize {\n if @que.length < @max\n begin\n t = @queue_wait.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n }\n retval\n end", "def pop(*args)\n retval = super\n @mutex.synchronize {\n if @que.length < @max\n begin\n t = @queue_wait.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n }\n retval\n end", "def pop\n\t\treturn nil if @q1.empty?\n\t\[email protected] # Dequeue element from queue and return the same \n\tend", "def peek()\n if @queue_out.size == 0\n if @queue_in.size == 0\n return\n end\n\n while @queue_in.size > 0\n @queue_out.push(@queue_in.pop)\n end\n end\n\n return @queue_out.last\n end", "def pop\n raise \"Abstract queue cannot return objects\"\n end", "def pop()\n @stack.shift\n end", "def dequeue\n while valid_messages.empty?\n return nil if @stop\n messages = receive_messages\n messages = reject_invalid_messages(messages)\n valid_messages.concat(messages)\n end\n\n valid_messages.shift.tap do |message|\n delete_message(message)\n end\n end", "def pop_non_blocking\n yield pop(timeout: 0)\n rescue TimeoutError\n nil\n end", "def pop\n raise \"No cursors to pop\" unless @stack.size > 1\n\n @stack.pop\n\n self\n end", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.shift\n end\n end\n }\n end", "def pop\n peek\n\n @out.pop\n end", "def deq\n @queued = false\n nil\n end", "def dequeue\n if !empty?\n @queue.delete_at(@queue.length-1)\n end\n @tail = @queue.last\n @head = @queue.first\n end", "def dequeue\n remove_elements_to_stack if @out.empty?\n @out.pop\n end", "def dequeue\n @store.shift\n end", "def pop()\n @stack.pop \n end", "def pop\n last = size\n at(last - 2).next_node = nil\n end", "def dequeue\n raise 'Queue is empty' if self.empty?\n\n el = @queue[@head]\n\n if @head == @length - 1\n @head = 0\n else\n @head += 1\n end\n\n if @head == @tail\n self.reset\n end\n\n return el\n end", "def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end", "def unpop obj\n was_empty = @q.empty?\n case obj\n when SimultaneousQueueEntries\n case obj.size\n when 0\n was_empty = false # just to prevent the inc\n when 1\n @q.unshift obj.first\n else\n @q.unshift obj\n end\n else\n @q.unshift obj\n end\n @component.inc_queue_ready_count if was_empty\n end", "def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend", "def pop\n return nil unless @tail\n\n popped = @tail\n @tail = @tail.head # remove tail\n @size -= 1\n\n popped.data\n end", "def pop()\n @stack.pop\n end", "def pop()\n @stack.pop\n end", "def peek\n\t\[email protected]\n\tend", "def dequeue\n @store.pop\n end", "def pop()\n @stack.pop\n end", "def pop\n delete_at(0)\n end", "def dequeue\n return nil if self.empty?\n return @dequeue_stack.pop if !@dequeue_stack.empty?\n until @enqueue_stack.empty?\n @dequeue_stack.push(@enqueue_stack.pop)\n end\n @dequeue_stack.pop\n end", "def dequeue\n return nil if self.empty?\n return @dequeue_stack.pop if !@dequeue_stack.empty?\n until @enqueue_stack.empty?\n @dequeue_stack.push(@enqueue_stack.pop)\n end\n @dequeue_stack.pop\n end", "def stop\n return if @stopped\n\n @stopped = true\n conn = @connq.pop\n conn.close\n nil\n end", "def pop(non_block=false)\n @mutex.synchronize{\n while true\n if @que.empty?\n raise ThreadError, \"queue empty\" if non_block\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @que.pop[0]\n end\n end\n }\n end", "def dequeue\n synchronize do\n @cond.wait_until{ @array.size > 0 }\n @array.shift\n end\n end", "def pop\n val = []\n @queue_mutex.synchronize do\n val = @memory_queue.pop\n end\n val\n end", "def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end", "def dequeue\n # check if queue is empty \n raise ArgumentError, \"Queue is empty\" if self.empty? \n \n element = @store[@front]\n \n # check last element removed\n if (@front == @back)\n @front = @back = -1 \n elsif @front + 1 == MAX_BUFFER\n @front = 0\n # nominal case\n else\n @front += 1\n end\n\n return element\n end", "def process_queue\n while [email protected]? and [email protected]?\n fiber = @queue.shift\n # What is really happening here?\n # we are resuming a fiber from within\n # another, should we call transfer instead?\n fiber.resume @connections.shift\n end\n end", "def dequeue\n @items.delete_at(0)\n end", "def pop(non_block=false)\n handle_interrupt do\n @mutex.synchronize do\n while true\n if @que.empty?\n if non_block\n raise ThreadError, \"queue empty\"\n else\n begin\n @num_waiting += 1\n @cond.wait @mutex\n ensure\n @num_waiting -= 1\n end\n end\n else\n return @que.shift\n end\n end\n end\n end\n end", "def pop\n each_with_index do |node, index|\n if index == self.size - 2\n @tail = node\n @tail.next_node = nil\n end\n end\n end", "def top()\n return @pop_queue.first\n end" ]
[ "0.755293", "0.7543232", "0.7536304", "0.7465208", "0.74468035", "0.7322853", "0.73086166", "0.71670985", "0.7107164", "0.7096955", "0.7094762", "0.7064289", "0.705689", "0.70327145", "0.69294906", "0.6911418", "0.69001603", "0.68991876", "0.6886852", "0.6872747", "0.6844513", "0.6843416", "0.678839", "0.676855", "0.66782826", "0.66782826", "0.667012", "0.6627936", "0.6627708", "0.66164637", "0.6604861", "0.66000634", "0.6597449", "0.65802705", "0.6575521", "0.65514076", "0.654465", "0.653329", "0.6529051", "0.65153784", "0.6507096", "0.64659554", "0.64412904", "0.64250493", "0.6421634", "0.64117026", "0.64021796", "0.6395779", "0.6391369", "0.63460785", "0.63262683", "0.63203466", "0.63081104", "0.6307029", "0.629526", "0.6293853", "0.629301", "0.628166", "0.6268343", "0.62641585", "0.62641585", "0.62534356", "0.62379295", "0.6233467", "0.62266994", "0.6207469", "0.62031907", "0.6190674", "0.6171015", "0.6166179", "0.614469", "0.613026", "0.6128825", "0.61275184", "0.612706", "0.61260295", "0.6123596", "0.6119077", "0.6109156", "0.6107245", "0.6102401", "0.6096138", "0.6095175", "0.6092682", "0.60817176", "0.6078093", "0.6073277", "0.60606277", "0.60606277", "0.6059079", "0.60587", "0.60556704", "0.6052055", "0.6041708", "0.60312086", "0.6021466", "0.6011941", "0.60111797", "0.60108405", "0.6004998" ]
0.6176637
68
Is the queue empty?
def empty? @queue.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty()\n @queue.size == 0\n end", "def is_empty()\n @queue.count { _1 } == 0\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n\t\[email protected]?\n\tend", "def empty?\n self.queue_size == 0\n end", "def empty()\n @queue.empty?\n end", "def empty()\n @queue.size == 0\n end", "def empty?\n @queued.empty?\n end", "def empty?\n # @head and @tail are equal to what they were when the Queue was created\n @head == -1 and @tail == 0\n end", "def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end", "def is_full()\n @queue.count { _1 } == @queue.size\n end", "def empty?\n @que.empty?\n end", "def empty?\n @que.empty?\n end", "def empty?\n @que.empty?\n end", "def empty?\n @que.empty?\n end", "def empty()\n @push_queue.empty? and @pop_queue.empty?\n end", "def is_full()\n @queue.size == @size\n end", "def queue_full?\n free_slots == 0\n end", "def any?\n [email protected]?\n end", "def empty?\n @q.empty?\n end", "def empty?\n @q.empty?\n end", "def any?\n [email protected]?\n end", "def empty()\n @q.empty?\n end", "def any?\n [email protected]?\n end", "def isEmpty()\n if @head == nil\n puts \"This Queue is empty.\"\n else\n puts \"This Queue has data.\"\n end\n end", "def size?\n @queue.length\n end", "def full?\n # absolute value of @tail is equal to the number of slots in the queue (@size)\n @tail.abs == (@size)\n end", "def busy?\n\n @queue.size > 0\n end", "def test_isEmptyOnEmptyQueue\n assert_equal( true , @queue.empty? )\n end", "def empty?(name = '.+')\n queues_matching(name).all?(&:empty?)\n end", "def test_isEmptyOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( false , @queue.empty? )\n end", "def clear\n @queue.clear\n true\n end", "def empty\n @queue1.empty? && @queue2.empty?\n end", "def empty?\n @lock.synchronize { @used.size == 0 && @available.size == 0 }\n end", "def empty?\n return @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def should_flush?\n (!queue.blank? && count >= size)\n end", "def empty?\n size == 0\n end", "def eof?; queue.closed? && queue.empty? end", "def empty?\n self.count == 0\n end", "def empty?\n self.count == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n\t\t\tsize == 0\n\t\tend", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def in_queue?\n !send(queue_position_column).nil?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def pending_data?\n !pending_queues.empty?\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n count == 0\n end", "def empty?\n count == 0\n end", "def is_empty?\n size == 0\n end", "def empty?\n count == 0\n end", "def empty?\n @heap.empty?\n end", "def empty?\n count <= 0\n end", "def empty?\n @buffers.values.all?(&:empty?)\n end", "def sleeping?\n @msg_queue.empty?\n end", "def empty?\n\t\treturn size.zero?\n\tend", "def empty?\n @size.zero?\n end", "def inQueue\n return @bodyStart < 0\n end", "def empty?\n # index of the last item in @store is equal to -1 (what it's equal to when Stack is created)\n @top == -1\n end", "def empty?\n @items.count == 0\n end", "def empty()\n @q1.empty?\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def is_full()\n if @q.count == @length\n true\n else\n false\n end\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @count == 0\n end", "def empty?\n @head.nil?\n end", "def empty?\n @mutex.synchronize do\n return @head == @tail\n end\n end", "def is_empty()\n @head == nil\n end", "def is_empty()\n @stack == []\n end", "def empty?\n return @stack.empty?\n end", "def empty?\n @buffer.empty? && stream_is_done?\n end", "def is_empty?\n self.size == 0\n end", "def empty?\r\n @head.nil?\r\n end", "def empty()\n return @head == nil\n end", "def last_in_queue?\n return false unless in_queue?\n self.send(queue_position_column) == bottom_queue_position_in_queue\n end", "def empty()\n return true if @head.nil?\n false\n end", "def empty?\n \n @head == nil\n end", "def empty?\n self[:head] == 0\n end", "def empty?\n\t\t\[email protected] == 0\n\t\tend" ]
[ "0.9379387", "0.9364612", "0.93427914", "0.93427914", "0.93427914", "0.93405193", "0.9294838", "0.92472124", "0.9171745", "0.9006615", "0.8962932", "0.8851832", "0.87521917", "0.86120766", "0.8583436", "0.8579887", "0.8481455", "0.8481455", "0.8481455", "0.84505105", "0.8410132", "0.8406505", "0.84003675", "0.83889663", "0.83827686", "0.83553016", "0.83108914", "0.8289452", "0.8184509", "0.8019193", "0.80190295", "0.7986478", "0.7906222", "0.782486", "0.78219694", "0.77687097", "0.77554834", "0.77418286", "0.77126", "0.76937747", "0.76937747", "0.76788104", "0.76788104", "0.76788104", "0.76592535", "0.76592535", "0.7656363", "0.76482093", "0.7647221", "0.76465094", "0.76465094", "0.7627792", "0.7627792", "0.75938207", "0.7591028", "0.75868934", "0.7584518", "0.757821", "0.757821", "0.757821", "0.757821", "0.7575533", "0.7575477", "0.7575477", "0.75579834", "0.75579834", "0.7540783", "0.7539063", "0.7519929", "0.7519572", "0.74964416", "0.74795127", "0.74648035", "0.74612856", "0.74492234", "0.7415932", "0.74151456", "0.73861367", "0.73860043", "0.73860043", "0.73860043", "0.7380983", "0.73709416", "0.73709416", "0.73709416", "0.73709416", "0.73604834", "0.7360454", "0.7354507", "0.7351432", "0.7339288", "0.7331185", "0.7329321", "0.7324583", "0.73207104", "0.7316996", "0.73125577", "0.730333", "0.7302595", "0.72926396" ]
0.92711985
7
Get the current size of the queue.
def size @queue.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n\n @queue.size\n end", "def size\n @queue.size\n end", "def queue_size\n _get(\"/system/queue-size\") { |json| json }\n end", "def size\n @queue.size\n end", "def size\n @queue.size\n end", "def size\n @mutex.synchronize { @queue.size }\n end", "def size\n self.queued.inject(0) { |result, data| result + data.last.size }\n end", "def queue_size\n @redis.llen(\"xque:queue:#{@queue_name}\")\n end", "def length\n @queue.length\n end", "def queue_length\n @executor.getQueue.size\n end", "def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end", "def length\n @queue.length\n end", "def queue_count()\n @queue.length\n end", "def size\n\t\t\[email protected] + @queue.size\n\t\tend", "def size\n # This is a a bit racy - we don't update these two queues atomically\n @queue.size + @active.size\n end", "def queue_size(queue)\n Resque.size(queue)\n end", "def queue_length\n @job_queue.length\n end", "def work_queue_size()\n @work_queue.size\n end", "def queue_length\n request_queue.length\n end", "def queue_length\n if system.empty?\n 0\n else\n system.length - 1\n end\n end", "def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end", "def queue_length\n @queues.inject(0) do |length, (_, queue)|\n length + queue.length\n end\n end", "def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end", "def size\n @q.size\n end", "def get_size\n\t\treturn @size\n\tend", "def size\n return instance_get(:size)\n end", "def size\n raise_if_closed!\n\n @lock.synchronize do\n unsynchronized_size\n end\n end", "def size\n @size.size\n end", "def z_queue_size(queue)\n handle_pipeline(@redis.zcount(redis_key_for_queue(queue), 0, Float::INFINITY), &:to_i)\n end", "def size\n return @size\n end", "def size\n return @size\n end", "def current_size\n @data.size\n end", "def size\n if @push_ptr\n if @pop_ptr\n value_ = @push_ptr - @pop_ptr\n value_ > 0 ? value_ : value_ + @buffer.size\n else\n 0\n end\n else\n @buffer.size\n end\n end", "def gevent_queue_size\r\n return @proc_queue.size\r\n end", "def queue_count\n @queues.length\n end", "def size\n @mutex.synchronize{_size}\n end", "def size\n sync{@size[0]}\n end", "def count\n\t\[email protected]\n\tend", "def size\n @semaphore.synchronize do\n return @hashed_storage.size\n end\n end", "def size\n @que.size\n end", "def size\n\t\t\treturn @m.capacity\n\t\tend", "def cache_current_size\n\n @cache.size\n end", "def queue_count()\n @work_queue.size + super()\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size ||= @buffer.size\n end", "def size\n return @size\n end", "def size\n return @size\n end", "def waitlist_size\n @queue.size\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def size\n @buffer.size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def queued_messages\n @queue.length\n end", "def size\n @size ||= @request[FSIZE].to_i\n end", "def backlog\n @queue.size\n end", "def size?\n @queue.length\n end", "def size\n\t\treturn @m.capacity\n\tend", "def size\n get.size\n end", "def size\n\t\treturn @storage.size\n\tend", "def queue_size(paypal_id)\n queue = @queue_map[paypal_id]\n if(queue.nil?)\n 0\n else\n queue.size\n end\n end", "def queue_size(queue)\n prioritized?(queue) ? z_queue_size(queue) : super\n end", "def remaining_capacity\n @max_queue == 0 ? -1 : @executor.getQueue.remainingCapacity\n end", "def size\n self[:size]\n end", "def size\n instance_read(:file_size) || (@queued_for_write[:original] && @queued_for_write[:original].size)\n end", "def size\n return @buffer.count\n end", "def remaining_capacity\n mutex.synchronize { @max_queue == 0 ? -1 : @max_queue - @queue.length }\n end", "def queued_messages\n @queue.length\n end", "def size\n @size \n end", "def size\n @size \n end", "def size\n @size\n end", "def _size\n @allocated.length + @available_connections.length\n end", "def queue\n @queue ||= SizedQueue.new @queue_size\n end", "def get_size\n\t\tend", "def total_size\n self._total_size(self, 0)\n end" ]
[ "0.8483858", "0.8455337", "0.8451002", "0.8446962", "0.83948755", "0.8367717", "0.80201346", "0.7864384", "0.7850798", "0.78053844", "0.7785047", "0.77693117", "0.7716137", "0.77120304", "0.76998174", "0.76656735", "0.7604601", "0.757399", "0.74067473", "0.73887783", "0.73851824", "0.73375463", "0.73144746", "0.72893584", "0.7253298", "0.7249085", "0.7242707", "0.72366333", "0.7217665", "0.7190997", "0.7190997", "0.71763307", "0.71585166", "0.7152873", "0.7140797", "0.71398014", "0.7116813", "0.71119875", "0.7072808", "0.70597845", "0.70557064", "0.7051608", "0.7031164", "0.7027696", "0.7027696", "0.7027696", "0.7024898", "0.70246875", "0.70246875", "0.69912785", "0.69903713", "0.69903713", "0.69903713", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.6980628", "0.69691616", "0.69527924", "0.69383764", "0.6919919", "0.6912592", "0.6904108", "0.6882704", "0.6881663", "0.6876579", "0.68750453", "0.6873811", "0.6869095", "0.6854708", "0.6843531", "0.6835958", "0.6825025", "0.6822467", "0.6822467", "0.67935246", "0.67782986", "0.6772494", "0.67717755", "0.67708766" ]
0.8433791
4
GET /lists GET /lists.json
def index @lists = current_user.lists.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end", "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def lists\n client.get_lists\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def lists\n response = get 'lists'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end", "def index\n json_response(@board.lists)\n end", "def lists(params = {})\n @api.get(\"#{@api.path}/User/Lists\", params: params)\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def list\n get('/')\n end", "def index\n\t\tu = User.find_by(:id => session[:user_id]) \n\t\tif u \n\t\t\t@lists = u.lists.order('id asc')\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'index'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @lists, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def list(id)\n get(\"lists/#{id}\").list\n end", "def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n\n # Set Filter defaults\n\n if params[ :my_lists ].nil? &&\n params[ :public_lists ].nil? then\n\n params[ :my_lists ] = true\n\n end\n\n if params[ :lang ].nil?\n\n params[ :lang ] = Hash[ Language.all.map { |l| [l.id.to_s, \"1\"] } ]\n\n end\n\n if params[ :sortBy ].nil?\n\n params[ :sortBy ] = 'name'\n params[ :dir ] = 'asc'\n\n end\n\n @lists = List.filter( params, current_user ).page( params[:page] || 1 )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def index\n @lists = List.inactive.paginate(page: params[:page], per_page: PER_PAGE)\n\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, items: @lists } }\n end\n end", "def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "def list\n get()\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def index\n @lists = @user.lists\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def get_lists()\n lists = api_request(\"list\")\n return lists.split(\"\\n\")\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @lists = current_user.lists\n end", "def index\n @lists = current_user.lists\n end", "def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end", "def index\n @lists = List.all\n\n end", "def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end", "def lists(options = { :filter => :open })\n return @lists if @lists\n @lists = Client.get(\"/boards/#{id}/lists\", options).json_into(List)\n end", "def get_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_lists ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ListsApi.get_lists, must be smaller than or equal to 50.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/contacts/lists'\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[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/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 = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetLists')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end", "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "def index\n @lists = List.find(:all)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @lists }\n end\n end", "def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "def index\n @lists = current.user.list\n end", "def lists(uid, params={})\n response = @client.get \"#{@path}/#{uid}/lists\", params\n PaginateResource.new \"#{@path}\", @client, response, Textmagic::REST::List\n end", "def list\n call(:get, path)\n end", "def show\n\t\t@list = List.find_by(id: params[:id])\n\t\t@locations = Location.where(list_id: params[:id]).order('id asc')\n\t\tsession[:list_id]= params[:id]\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'show'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @list, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def show\n @list = List.find(params[:id])\n respond_with(@list)\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def index\n lists = if params[:filter]\n filter_type = params[:filter]\n case filter_type\n when \"promoted\"\n lists = List.where(promoted: true).recent.page params[:page]\n end\n elsif params[:query]\n List.search(params)\n end\n\n render :json => lists\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def list\n render json: User.all\n end", "def index\n @menu_lists = MenuList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menu_lists }\n end\n end", "def get_lists(options={})\n visibility = options[:visibility]\n list_type = options[:list_type]\n folder_id = options[:folder_id]\n include_all_lists = options[:include_all_lists]\n include_tags = options[:include_tags]\n\n raise ArgumentError, \"visibility option is required\" unless visibility\n raise ArgumentError, \"list_type option is required\" unless list_type\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetLists do\n xml.VISIBILITY visibility\n xml.LIST_TYPE list_type\n xml.FOLDER_ID folder_id if folder_id.present?\n xml.INCLUDE_ALL_LISTS 'true' if include_all_lists.present?\n xml.INCLUDE_TAGS 'true' if include_tags.present?\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['LIST']\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end", "def lists\n @lists = response[\"lists\"]\n if @lists and @lists[\"groups\"]\n @lists[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::List.new(client, item)}\n end\n end\n @lists\n end", "def index(list_name, site_path = '', fields = [])\n url = computed_web_api_url(site_path)\n url = \"#{url}lists/GetByTitle('#{odata_escape_single_quote(list_name)}')/items\"\n url += \"?$select=#{fields.join(\",\")}\" if fields\n\n process_url( uri_escape(url), fields )\n end", "def get_list(id)\n record \"/todos/list/#{id}\"\n end", "def index\n # @playlists = Playlist.all\n # @playlists = @playlists.page(params[:page] || 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { playlists: @playlists } }\n end\n end", "def index\n paginate json: @user.playlists.all\n end", "def get_all_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ListsApi.get_all_lists ...\"\n end\n # resource path\n local_var_path = \"/lists/\"\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/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_all_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @lists = @organization.lists.all\n end", "def index\n @stopword_lists = StopwordList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopword_lists }\n end\n end", "def index\n @watch_lists = WatchList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_lists }\n end\n end", "def index\n @todos = @list.todos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "def index\n @list_items = @list.list_items\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def getPlaylists\n\t\tuserid = current_user.uid\n\t\tplaylists = GetPlaylistMetadataFromSpotify.build.call(session[\"devise.spotify_data\"])\n\t\tPlaylist.sync_playlists(playlists, userid)\n\t\trender json: playlists\n\tend", "def lists\n load_user_lists\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def index\n @lists = @board.lists\n render json: @lists.as_json(include: [cards: {methods: [:user_ids]}])\n end", "def lists\n Resources::Lists.new(self)\n end", "def index\n @purchase_lists = PurchaseList.all\n render json: @purchase_lists\n end", "def index\n @task_lists = @project.task_lists.all\n\n respond_with @task_lists\n end", "def lists_get(opts = {})\n data, _status_code, _headers = lists_get_with_http_info(opts)\n data\n end", "def json_respond(list) \n respond_to do |format|\n format.json{ render :json => list }\n end\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def show\n render json: @list_item\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n\t\t@list = current_user.lists.find(params[:list_id])\n @todos = @list.todos\n end", "def get_list(list_name)\n @lib.get_list(list_name)\n end", "def lists(client_id)\n response = Client_GetLists(\"ClientID\" => client_id)\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"List\"].collect{|l| List.new(l[\"ListID\"].to_i, l[\"Name\"])}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end", "def index\n @gift_lists = GiftList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gift_lists }\n end\n end" ]
[ "0.80919707", "0.7942851", "0.78779286", "0.7858385", "0.7814817", "0.77347493", "0.7703373", "0.7641295", "0.76274574", "0.74937147", "0.7423371", "0.7332808", "0.72778344", "0.7242392", "0.7241362", "0.72268915", "0.7203747", "0.72001815", "0.71932775", "0.7186917", "0.7130836", "0.71253383", "0.70629144", "0.70447356", "0.7025918", "0.70195216", "0.6973325", "0.6973325", "0.69357663", "0.6904329", "0.68711054", "0.684713", "0.684713", "0.68437874", "0.68437874", "0.68437874", "0.68437874", "0.6835432", "0.6815128", "0.6815128", "0.6815128", "0.6815128", "0.67745984", "0.67745984", "0.6760982", "0.6759822", "0.67532444", "0.6747614", "0.67241824", "0.67086494", "0.6693621", "0.6681883", "0.6678214", "0.6670427", "0.6645213", "0.6644987", "0.66361666", "0.6616846", "0.660567", "0.65950716", "0.6591903", "0.6591125", "0.6581196", "0.6575769", "0.6567372", "0.6565359", "0.6560058", "0.6555089", "0.65296566", "0.65271676", "0.6526771", "0.6519607", "0.65128195", "0.65090376", "0.65075266", "0.6504224", "0.6496956", "0.64953285", "0.64920837", "0.64793426", "0.647624", "0.6468003", "0.64583284", "0.64366126", "0.64300245", "0.6419721", "0.64189875", "0.6413323", "0.6411056", "0.63979554", "0.63953817", "0.639378", "0.6384926", "0.638284", "0.6374929", "0.6373842", "0.6367347", "0.63644445", "0.63492745", "0.6335372" ]
0.6679688
52
GET /lists/1 GET /lists/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end", "def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "def list(id)\n get(\"lists/#{id}\").list\n end", "def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end", "def show\n @list = List.find(params[:id])\n respond_with(@list)\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def index\n json_response(@board.lists)\n end", "def show\n\t\t@list = List.find_by(id: params[:id])\n\t\t@locations = Location.where(list_id: params[:id]).order('id asc')\n\t\tsession[:list_id]= params[:id]\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'show'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @list, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def get_list(id)\n record \"/todos/list/#{id}\"\n end", "def list\n get('/')\n end", "def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n end", "def list\n get()\n end", "def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = @user.lists\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n\n if [email protected] && @list.user != current_user\n\n format.html { redirect_to lists_url, alert: \"You cannot view that list\" }\n format.json { head :no_content, status: :unauthorized }\n\n else\n format.html # show.html.erb\n format.json { render json: @list }\n end\n\n end\n end", "def show\n @list = List.find(params[:id])\n end", "def show\n @list = List.find(params[:id])\n end", "def lists\n client.get_lists\n end", "def index\n\t\tu = User.find_by(:id => session[:user_id]) \n\t\tif u \n\t\t\t@lists = u.lists.order('id asc')\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'index'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @lists, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def index\n @list_items = @list.list_items\n end", "def index\n @lists = List.inactive.paginate(page: params[:page], per_page: PER_PAGE)\n\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, items: @lists } }\n end\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "def index\n @lists = List.all\n\n end", "def index(list_name, site_path = '', fields = [])\n url = computed_web_api_url(site_path)\n url = \"#{url}lists/GetByTitle('#{odata_escape_single_quote(list_name)}')/items\"\n url += \"?$select=#{fields.join(\",\")}\" if fields\n\n process_url( uri_escape(url), fields )\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n\n # Set Filter defaults\n\n if params[ :my_lists ].nil? &&\n params[ :public_lists ].nil? then\n\n params[ :my_lists ] = true\n\n end\n\n if params[ :lang ].nil?\n\n params[ :lang ] = Hash[ Language.all.map { |l| [l.id.to_s, \"1\"] } ]\n\n end\n\n if params[ :sortBy ].nil?\n\n params[ :sortBy ] = 'name'\n params[ :dir ] = 'asc'\n\n end\n\n @lists = List.filter( params, current_user ).page( params[:page] || 1 )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def set_list\n @list = @lists.find(params[:id])\n end", "def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end", "def show\n render json: @list_item\n end", "def find_list\n @list = List.find(params[:id])\n end", "def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end", "def show\n @lista = Lista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lista }\n end\n end", "def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@todo_list }\n end\n end", "def lists\n response = get 'lists'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_list }\n end\n end", "def find_list\n @list = current_user.lists.find params[:id]\n end", "def index\n\t\t@list = current_user.lists.find(params[:list_id])\n @todos = @list.todos\n end", "def index\n @lists = List.find(:all)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @lists }\n end\n end", "def index\n @lists = current_user.lists\n end", "def index\n @lists = current_user.lists\n end", "def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def index\n @todos = @list.todos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_item }\n end\n end", "def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end", "def show\n @liste = Liste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liste }\n end\n end", "def show\n @list_to_do = ListToDo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_to_do }\n end\n end", "def index\n @lists = current_user.lists.all\n end", "def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end", "def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end", "def show\n if user_signed_in?\n @list = List.includes( listeds: [:listable] ).find(params[:id])\n render layout: 'layouts/twoColumn'\n else\n respond_to do |format|\n format.html { redirect_to management_lists_path(:user), notice: 'You must have an account to manage lists' }\n format.json { head :no_content }\n end\n end\n end", "def load_list(index)\n list = session[:lists][index] if index && session[:lists][index]\n return list if list\n\n session[:error] = \"The specified list was not found.\"\n redirect \"/lists\"\nend", "def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @api_v1_shopping_lists = ShoppingList.all\n end", "def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def index\n @watch_lists = WatchList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_lists }\n end\n end", "def index\n # @playlists = Playlist.all\n # @playlists = @playlists.page(params[:page] || 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { playlists: @playlists } }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def find_list(id)\n check_token\n response = self.class.get(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n Todoable::List.build_from_response(response.parsed_response)\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def list\n session[:list_type_id] = ListType.find(:first).id if session[:list_type_id] == nil\n @list_items = ListItem.find_all_by_user_id_and_list_type_id(\n session[:user_id], \n session[:list_type_id],\n :order => \"position\") \n if @list_items.size > 0\n @list_item = @list_items.first\n session[:list_item_id] = @list_items.first.id\n else\n session[:list_item_id] = nil\n end\n end", "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "def index\n @lists = current.user.list\n end", "def index\n @list_items = ListItem.all\n end", "def index\n @list_items = ListItem.all\n end", "def index\n @lists = @organization.lists.all\n end", "def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def lists(params = {})\n @api.get(\"#{@api.path}/User/Lists\", params: params)\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def set_list\n @list = List.find(params[:id])\n end", "def set_list\n @list = List.find(params[:id])\n end", "def set_list\n @list = List.find(params[:id])\n end", "def set_list\n @list = List.find(params[:id])\n end", "def get_list_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.get_list\"\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_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 = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetExtendedList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end" ]
[ "0.81000805", "0.7621268", "0.76165867", "0.75238293", "0.73434776", "0.73050016", "0.728771", "0.7281486", "0.72767174", "0.7225843", "0.71916556", "0.71916556", "0.71916556", "0.71916556", "0.71828145", "0.7050341", "0.69989306", "0.696094", "0.690982", "0.6844573", "0.68435", "0.67950827", "0.6791639", "0.6774348", "0.67737734", "0.6734243", "0.664792", "0.6647736", "0.6637602", "0.66295666", "0.6629095", "0.6629095", "0.6629095", "0.6629095", "0.66282076", "0.6625038", "0.66238844", "0.66238844", "0.66220176", "0.66031027", "0.6601947", "0.66010904", "0.6594353", "0.6585524", "0.6582792", "0.6566729", "0.65598524", "0.6557491", "0.65482765", "0.6541447", "0.65375197", "0.6533899", "0.6533553", "0.65304065", "0.6514682", "0.65106326", "0.6504155", "0.650131", "0.64994353", "0.6499263", "0.64721024", "0.64672714", "0.64609766", "0.64609766", "0.64264804", "0.64217263", "0.6402197", "0.63715684", "0.6363054", "0.6361536", "0.63586664", "0.6356971", "0.6341529", "0.6341404", "0.6324016", "0.6323927", "0.6323927", "0.6323927", "0.63120013", "0.6302811", "0.6298612", "0.62863576", "0.628466", "0.6272274", "0.6269852", "0.6253118", "0.62520874", "0.62506324", "0.62437516", "0.6240374", "0.6240374", "0.6240319", "0.62341857", "0.62286764", "0.6228413", "0.62153924", "0.62153924", "0.62153924", "0.62153924", "0.62120765", "0.61881375" ]
0.0
-1
POST /lists POST /lists.json
def create @list = current_user.lists.new(new_list_params) respond_to do |format| if @list.save format.html { redirect_to my_list_path(@list), notice: 'List was successfully created.' } format.json { render :show, status: :created, location: my_list_path(@list) } else format.html { render :new } format.json { render json: @list.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n records = nested.collect do |_, fields| \n\n ListItem.new( { \"list\" => @list }.merge( fields ) ) if !item_blank?( fields )\n\n end.compact\n\n respond_to do |format|\n if @list.save && records.map( &:save ).all?\n\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n\n else\n\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create\n @list = current_user.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = current_user.lists.build(params[:list])\n respond_to do |format|\n format.js\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Nice Work- List Created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n @list.user = current_user\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_post(api_key, access_token, list, body, opts = {})\n list_post_with_http_info(api_key, access_token, list, body, opts)\n return nil\n end", "def create\n @list = current_user.lists.build(params[:list])\n @list.user = current_user\n @user = @list.user\n respond_to do |format|\n if @list.save\n \n format.html { redirect_to root_path, notice: 'List was successfully created!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n @feed_items = []\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end", "def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end", "def create\n @list = @project.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@project, @list], notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @saved_list = SavedList.new(saved_list_params)\n\n respond_to do |format|\n if @saved_list.save\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully created.\" }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Funcionario adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end", "def create\n\n # Create new saved list table entry\n @saved_list = SavedList.new\n\n # Store attributes\n @saved_list.login_id = params[:login_id]\n @saved_list.list_name = params[:list_name]\n @saved_list.saved_user_list = true\n @saved_list.date_saved = params[:date_saved]\n\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @user_ids.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n @lists = List.not_deleted\n format.js\n else\n format.js { render json: @list.errors}\n end\n end\n end", "def create\n @list = current_user.lists.find params[:list_id]\n @item = @list.items.build(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully created.' }\n #format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:title, \n :description, \n :list_type_id, \n :list_type,\n list_items_attributes: [:item, :id, :_destroy]\n )\n end", "def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save(list_params)\n if(cookies[:list].blank?)\n cookies[:list]=\"\"\n end\n cookies[:list]=cookies[:list]+\",#{@list.id}\"\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n \n else\n @lists=set_lists\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\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 list_params\n params.require(:list).permit(:name)\n end", "def create\n @listitem = Listitem.new(listitem_params)\n\n if @todolist.listitems << @listitem\n render :show, status: :created, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def create\n @twitter_list = TwitterList.new(params[:twitter_list])\n\n respond_to do |format|\n if @twitter_list.save\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully created.' }\n format.json { render json: @twitter_list, status: :created, location: @twitter_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = @organization.lists.build(list_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: [@list.organization, @list] }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def create\n @list = List.new(list_params)\n # formatがhtmlで指定されていたら@listにリダイレクト、jsonで指定されていたらshowにリダイレクト?\n # 通常時ではHTML形式(いつもウェブサイト上で見る形)で結果を取得したいけど、明示的にJSON形式やXML形式を指定した場合は\n # JSON形式やXML形式で返すようにするメソッドらしい\n # 今回の運用ではhtmlの方しか使わない\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def create\n ListItem.transaction do\n item = Item.new(item_params)\n item.save\n\n @list_item = ListItem.new(list_item_params)\n @list_item.item_id = item.id\n @list_item.list_id = params[:list_id]\n\n\n if @list_item.save\n render json: @list_item, status: :created\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n @list = List.new(list_params)\n if @list.save\n \t#flash notice on successful creation of a list\n \tflash[:notice] = \"List successfully added!\"\n redirect_to lists_path(@list)\n else\n render :new\n flash[:alert] = \"ERROR :(\"\n end\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def create\n @list = List.new(params[:list])\n if @list.save\n redirect_to @list, :notice =>\"List successfully created.\"\n else\n flash[:error] = \"Your list could not be saved.\"\n render :action => \"new\"\n end\n end", "def list_params\n params.require(:list).permit(:todo)\n end", "def list_params\n params.require(:list).permit(:name, :description)\n end", "def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def new\n @list = List.new\n\n @list.list_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end", "def list_params\n params.require(:list).permit(:title, :description)\n end", "def create\n @list = current_user.lists.build(params[:list])\n location = @list.save ? my_list_url(@list.id) : new_my_list_url\n respond_with(@list, :location => location )\n end", "def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully created.\" }\n format.json { render :json=>@todo_list, :status=>:created, :location=>@todo_list }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@todo_list.errors, :status=>:unprocessable_entry }\n end\n end\n end", "def create\n @list = List.new(params[:list])\n @list.feeds_by_id = ''\n @list.user_id = current_user.id\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to(@list, :notice => 'List was successfully created.') }\n format.xml { render :xml => @list, :status => :created, :location => @list }\n format.js {render :layout => false}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end", "def create\n @task_list = TaskList.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@list = List.new(list_params)\n\t\[email protected]\n\t\t\tredirect_to '/tasks'\n\tend", "def list_params\n params.require(:list).permit(:name,:amount,:body,:status,:group_id, :list )\n end", "def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end", "def create\n\n @list_item = @list.list_items.create!(list_item_params)\n #@list_item = @list.list_items.create!(params[:list_item])\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def create\n @ml_list = Ml::List.new(ml_list_params)\n authorize! :create, @ml_list\n\n respond_to do |format|\n if @ml_list.save\n format.html { redirect_to @ml_list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @ml_list }\n else\n\n format.html { render :new }\n format.json { render json: @ml_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n if @list.save\n respond_successfully(I18n.t('integral.backend.lists.notification.creation_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.creation_failure'), :new)\n end\n end", "def create\n @tags = Tag.all\n @list_item = @list.list_items.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @model_list = ModelList.new(model_list_params)\n\n respond_to do |format|\n if @model_list.save\n format.html { redirect_to @model_list, notice: 'Model list was successfully created.' }\n format.json { render :show, status: :created, location: @model_list }\n else\n format.html { render :new }\n format.json { render json: @model_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(params[:list])\n @list.user = current_user\n if @list.save\n user_session.select_list @list\n flash[:notice] = 'Lista criada com sucesso!'\n redirect_to edit_list_nomes_path\n else\n flash[:notice] = 'Não foi possível uma nova lista!'\n render :action => \"new\"\n end\n end", "def create\n @list = List.new(list_params)\n if @list.save\n return redirect_to list_url(@list)\n else\n flash[:error] = \"U is broken yo\"\n return render :new\n end\n end", "def list_params\n params.require(:list).permit(:title, :category_id, :body)\n end", "def create\n @list = Blog::List.new(list_params)\n\n respond_to do |format|\n if @list.save\n ActionCable.server.broadcast \"board\",\n { commit: 'addList', \n payload: render_to_string(:show, formats: [:json]) }\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def list_params\n params.require(:list).permit(:name, :permalink, :description, :picurl)\n end", "def create\n\n @list = List.find(params[:list_id])\n @comment = Comment.where(list_id: @list.id).new(comment_params)\n @comment.user = @current_user\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n \n end", "def create\n @list = List.new(params[:list])\n Grade.all.each do |g|\n @list.posts.build(gname: g.name, tname: g.teacher_name)\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_list = TaskList.new(params[:task_list])\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_list = Task::List.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def list_params\n params.require(:list).permit(:name, :date, :family_id)\n end", "def create\n @lista = Lista.new(params[:lista])\n\n respond_to do |format|\n if @lista.save\n format.html { redirect_to @lista, notice: 'Lista was successfully created.' }\n format.json { render json: @lista, status: :created, location: @lista }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lista.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:title, :description, :slug)\n end", "def list_params\n params.permit(:list_name)\n end", "def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully created.' }\n format.json { render json: @todo_list, status: :created, location: @todo_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end", "def list_params\n params.require(:list).permit(:user_id, :name, :privacy, :status, :description, \n user:[:name, :id], task:[:id, :list_id, :title, :note, :completed])\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to club_path(@list.club_id), notice: 'List was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end", "def create\n @todoslist = Todoslist.new(todoslist_params)\n\n respond_to do |format|\n if @todoslist.save\n format.html { redirect_to @todoslist, notice: \"Todoslist was successfully created.\" }\n format.json { render :show, status: :created, location: @todoslist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @todoslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@list = List.new(list_params)\n @list = current_user.lists.create(list_params)\n if params[:campsite_id] && @list.listeds.find_by_campsite_id(params[:campsite_id]).blank?\n campsite = Campsite.find(params[:campsite_id])\n @listed = campsite.listeds.create(list:@list.id, user_id:current_user.id)\n #@listed = Listed.new()\n #@listed.list_id = @list.id\n #@listed.user_id = current_user.id\n #@listed.save\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to management_lists_path, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_item }\n end\n end", "def create\n # @task_list = TaskList.new(params[:task_list])\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_list(params)\n MailManager::List.create(params)\n end", "def create\n @list_item = ListItem.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to @list_item, notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:title, :description, :is_deleted)\n end", "def add_post(api_key, access_token, list, body, opts = {})\n data, _status_code, _headers = add_post_with_http_info(api_key, access_token, list, body, opts)\n return data\n end", "def create\n @lista = Lista.new(lista_params)\n\n respond_to do |format|\n if @lista.save\n format.html { redirect_to @lista, notice: 'Lista was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lista }\n else\n format.html { render action: 'new' }\n format.json { render json: @lista.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:name, :user_id, :position)\n end", "def create\n list = current_user.lists.build(params[:list])\n list.current_users << current_user\n\n if list.save\n flash[:notice] = t('messages.list.success.create', title: list.title)\n redirect_to list_experts_url(list)\n else\n flash[:alert] = t('messages.list.errors.create')\n redirect_to lists_url\n end\n end", "def list_params\n params.require(:list).permit(:name, :position)\n end", "def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\n end", "def list_params\n params.require(:list).permit(:title, :position)\n end" ]
[ "0.7744856", "0.7644541", "0.76097417", "0.74585795", "0.72567004", "0.71968704", "0.7191225", "0.7155085", "0.7108538", "0.70642173", "0.7063542", "0.7063542", "0.7013641", "0.69427305", "0.69293773", "0.68952435", "0.68616366", "0.6841231", "0.67964596", "0.679132", "0.67798823", "0.6775282", "0.67568296", "0.6755146", "0.6739162", "0.6724885", "0.670565", "0.669875", "0.66985923", "0.66944593", "0.66586375", "0.66586375", "0.66586375", "0.6654024", "0.6641378", "0.66368884", "0.66308945", "0.6629695", "0.6626051", "0.662361", "0.6621519", "0.662094", "0.66125464", "0.65958536", "0.6580576", "0.65761405", "0.6564436", "0.65635926", "0.6556275", "0.6552358", "0.6551375", "0.6547072", "0.6546383", "0.6538667", "0.6522907", "0.6516226", "0.65112454", "0.6506644", "0.64972687", "0.64915645", "0.6486749", "0.6485955", "0.64855814", "0.6470067", "0.64681727", "0.64635897", "0.64635754", "0.6462675", "0.64536023", "0.644971", "0.64394313", "0.6433141", "0.6426378", "0.642414", "0.64195186", "0.6417403", "0.6412674", "0.6411683", "0.641107", "0.63999176", "0.6394347", "0.63905144", "0.6382425", "0.6372378", "0.6370327", "0.6368802", "0.63609797", "0.63576424", "0.63576204", "0.6348585", "0.63290465", "0.6326838", "0.6315875", "0.63155717", "0.6314002", "0.6292331", "0.6281695", "0.62805134", "0.6278035", "0.62771875" ]
0.7029331
12
PATCH/PUT /lists/1 PATCH/PUT /lists/1.json
def update respond_to do |format| if @list.update(existing_list_params) format.html { redirect_to my_list_path(@list), notice: 'List was successfully updated.' } format.json { render :show, status: :ok, location: my_list_path(@list) } else format.html { render :edit } format.json { render json: @list.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def update_list(list_id:, name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.patch(\n \"/lists/#{list_id}\",\n body: list.post_body,\n headers: headers,\n format: :text\n )\n check_and_raise_errors(response)\n # This endpoint returns a plaintext body: \"<new name> updated\", so\n # while I'd like to return a List with ListItems, that would require\n # first looking up the list which isn't ideal. So we'll return true, ask\n # todoable to fix this endpoint, and make developers keep track of the\n # name change\n true\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @list\n\n if @list.update(list_params)\n json_response(@list.decorate, :ok)\n else\n json_response(@list.errors, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to management_lists_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end", "def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested then\n nested.each do |i, r|\n\n if !r.key?( \"id\" )\n\n new_items << ListItem.new( { \"list\" => @list }.merge( r ) ) if !item_blank?( r )\n\n nested.delete( i )\n\n else\n\n r[ \"_destroy\" ] = \"true\" if item_blank?( r )\n\n end\n\n end\n end\n\n respond_to do |format|\n if @list.update_attributes( params[ :list ] ) && \n @list.update_attributes( list_items_attributes: (nested || {}) ) &&\n new_items.map( &:save ).all? then\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @list.update(_list_params)\n format.html { redirect_to @list, notice: \"List was successfully updated.\" }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = @project.lists.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to [@project, @list], notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'The List was updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: blog_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Changes and Additions Successful.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: [@list.organization, @list] }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n @list.user = current_user\n @user = @list.user\n\n respond_to do |format|\n if @list.update_attributes(params[:todo])\n format.html { redirect_to root_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listed.update(listed_params)\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo_list.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end", "def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"lists/#{self[\"id\"]}\", \"{\\\"list\\\": #{options.to_json}}\").body)\n end", "def update\n @list.update_attributes list_params\n end", "def update\n\t\t@list = List.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @list.update_attributes(params[:list])\n\t\t\t\tformat.html\t{ redirect_to(root_url) }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html\t{ render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @list.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end", "def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n list_attributes = params[:list] || params[:check_list]\n \n if @list.update(list_attributes)\n flash[:notice] = t(:list_saved)\n redirect_to @list\n else\n render :action => 'edit'\n end\n end", "def update\n \t@list = current_user.lists.find params[:list_id]\n @item = @list.items.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully updated.' }\n #format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end", "def update\n respond_to do |format|\n if @todoit_list.update(todoit_list_params)\n format.html { redirect_to @todoit_list, notice: 'Todoit list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todoit_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saved_list.update(saved_list_params)\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully updated.\" }\n format.json { render :show, status: :ok, location: @saved_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n flash[:notice] = '修改成功!'\n format.html { redirect_to action: \"index_admin\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n list = List.find_by_title(params[:task][:list_title])\n task_params = Task.format_params(params[:task][:title], params[:task][:description], list.id)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to lists_url, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @set_list.update(set_list_params)\n format.html { redirect_to @set_list, notice: 'Set list was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_list }\n else\n format.html { render :edit }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_list = TaskList.find(params[:id])\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_list = TaskList.find(params[:id])\n\n if @task_list.update(task_list_params)\n head :no_content\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @todo_list.update(todo_list_params)\n format.html { redirect_to work_todo_list_path, notice: 'Todo list was successfully updated.' }\n format.json { render :show, status: :ok, location: work_todo_list_path }\n else\n format.html { render :edit }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @listitem.update(listitem_params)\n render :show, status: :ok, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def update\n @list_to_do = ListToDo.find(params[:id])\n\n respond_to do |format|\n if @list_to_do.update_attributes(params[:list_to_do])\n format.html { redirect_to new_list_to_do_path, notice: 'List to do was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_to_do.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end", "def update\n respond_to do |format|\n if @todo_list.update(todo_list_params)\n format.html { redirect_to root_path, notice: 'Todo list was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_list }\n else\n format.html { render :edit }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listtodo.update(listtodo_params)\n format.html { redirect_to @listtodo, notice: 'Listtodo was successfully updated.' }\n format.json { render :show, status: :ok, location: @listtodo }\n else\n format.html { render :edit }\n format.json { render json: @listtodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to list_path(@list), notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @model_list.update(model_list_params)\n format.html { redirect_to @model_list, notice: 'Model list was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_list }\n else\n format.html { render :edit }\n format.json { render json: @model_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list, notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_list = JobList.find(params[:id])\n\n respond_to do |format|\n if @job_list.update_attributes(params[:job_list])\n format.html { redirect_to @job_list, notice: 'Job list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to list_todo_path(@list, @todo), notice: 'Todo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todolists.update(todolist_params)\n format.html { redirect_to @todolists, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @todolists }\n else\n format.html { render :edit }\n format.json { render json: @todolists.errors, status: :unprocessable_entity }\n end\n end\nend", "def update\n respond_to do |format|\n if @todolist.update(todolist_params)\n format.html { redirect_to @todolist, notice: 'Todolist was successfully updated.' }\n format.json { render :show, status: :ok, location: @todolist }\n else\n format.html { render :edit }\n format.json { render json: @todolist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_list.update(item_list_params)\n format.html { redirect_to @item_list, notice: 'Item list was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_list }\n else\n format.html { render :edit }\n format.json { render json: @item_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n if @list_item.update_attributes(params[:list_item])\n flash[:success] = \"List item was successfully updated.\"\n redirect_to list_path(@list) \n else\n flash[:errror] = \"Unable to update item.\"\n redirect_to edit_list_list_item_path(@list, @list_item)\n end\n end", "def update\n respond_to do |format|\n if @todoslist.update(todoslist_params)\n format.html { redirect_to @todoslist, notice: \"Todoslist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @todoslist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @todoslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n format.html { redirect_to @task_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list.entity, notice: 'La Liste de propositions pour la semaine ' + @list.date.to_time.strftime(\"%W\") + ' a été modifiée avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n @show_list = true\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { render @list }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @adventure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n @lists = List.not_deleted\n format.js\n else\n format.js { render json: @list.errors }\n end\n end\n end", "def editList\n\t\t@list = List.find(params[:id])\n\tend", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list_item, notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n if @get_restaurant_list.update(params[:get_restaurant_list])\n head :no_content\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end", "def update\n prepare_form\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Os dados do funcionario foram atualizados com sucesso.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @email_list.update(email_list_params)\n format.html { redirect_to @email_list, notice: 'Email list was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_list }\n else\n format.html { render :edit }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing_list = ThingList.find(params[:id])\n\n respond_to do |format|\n if @thing_list.update_attributes(params[:thing_list])\n format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @list.update(list_params)\n respond_successfully(I18n.t('integral.backend.lists.notification.edit_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.edit_failure'), :show)\n end\n end", "def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item.update_attributes(item_params)\n @items = List.find(item_params[:list_id]).items.order(\"id ASC\")\n @list_id = @item.list.id\n end", "def update\n authorize! :update, @ml_list\n respond_to do |format|\n if @ml_list.update(ml_list_params)\n format.html { redirect_to @ml_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @ml_list }\n else\n format.html { render :edit }\n format.json { render json: @ml_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n if @twitter_list.update_attributes(params[:twitter_list])\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_shopping_list.update(api_v1_shopping_list_params)\n format.html { redirect_to @api_v1_shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_shopping_list }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id:, name:)\n list = client.update_list(id: id, name: name)\n\n Todoable::List.new(list)\n end", "def update!(**args)\n @list_options = args[:list_options] if args.key?(:list_options)\n end", "def update\n respond_to do |format|\n if @setlist.update(setlist_params)\n format.html { redirect_to @setlist, notice: \"Setlist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @setlist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @setlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list= List.find(params[:id])\n if @list.update(list_params)\n \tflash[:notice] = \"List successfully updated!\"\n redirect_to list_path(@list)\n else\n render :edit\n flash[:alert] = \"ERROR :(\"\n end\n end", "def rename_list(list_id, name)\n path = \"lists/#{list_id}\"\n params = { list: { name: name }}\n request(path, params, :put )\n \n # output full list again\n show_list(list_id)\n end", "def update\n @task = current_user.lists.find(params[:list_id]).tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.js\n else\n render :js => \"TODO_IT.UI.show_alert('Something went wrong.')\"\n end\n end\n end", "def update\n @lista = Lista.find(params[:id])\n\n respond_to do |format|\n if @lista.update_attributes(params[:lista])\n format.html { redirect_to @lista, notice: 'Lista was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lista.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mylist = Mylist.find(params[:id])\n\n respond_to do |format|\n if @mylist.update_attributes(params[:mylist])\n format.html { redirect_to(@mylist, :notice => 'Mylist was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mylist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list_item, notice: 'List item was successfully updated.' }\n format.json { render json: @list_item, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n flash[:notice] = 'TodoList was successfully updated.'\n format.html { redirect_to(@todo_list) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @todo_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_list.update(recipe_list_params)\n format.html { redirect_to @recipe_list, notice: 'Recipe list was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_list }\n else\n format.html { render :edit }\n format.json { render json: @recipe_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @watch_list = WatchList.find(params[:id])\n\n respond_to do |format|\n if @watch_list.update_attributes(params[:watch_list])\n format.html { redirect_to @watch_list, notice: 'Watch list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watch_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_list.update(service_list_params)\n format.html { redirect_to @service_list, notice: 'Service list was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_list }\n else\n format.html { render :edit }\n format.json { render json: @service_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend", "def list_update_params\n\t\tparams.require(:list).permit(:description, :deadline, :completion_status, :userID)\n\tend", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end" ]
[ "0.76281315", "0.72378355", "0.7139185", "0.7117268", "0.7117268", "0.71083647", "0.7101187", "0.7068508", "0.7049937", "0.7049937", "0.70404303", "0.70156926", "0.7011639", "0.6980567", "0.69750524", "0.69516975", "0.69339174", "0.6919702", "0.6919702", "0.6919702", "0.6919702", "0.6919702", "0.69145536", "0.6912947", "0.68350947", "0.682105", "0.6787094", "0.67824894", "0.6782198", "0.67761636", "0.6768389", "0.67554367", "0.6722699", "0.6709261", "0.67035586", "0.66876274", "0.6686445", "0.6682764", "0.6665839", "0.6616854", "0.6616269", "0.66145897", "0.6600003", "0.6593793", "0.65898263", "0.6579344", "0.65681195", "0.6563026", "0.6559827", "0.6557999", "0.65548444", "0.65478724", "0.6543636", "0.6539148", "0.65262836", "0.6521081", "0.6509826", "0.6506484", "0.64747256", "0.6471821", "0.6465064", "0.64618945", "0.64551103", "0.6454904", "0.6445199", "0.64384425", "0.6435901", "0.6434531", "0.64343756", "0.64220107", "0.64103043", "0.6408725", "0.6406476", "0.63995355", "0.6390548", "0.6387025", "0.6382565", "0.63798577", "0.63774496", "0.6374096", "0.6371348", "0.6366756", "0.6350753", "0.6349005", "0.6325152", "0.6321086", "0.63195467", "0.6318409", "0.63118327", "0.6296469", "0.62911433", "0.6276939", "0.6276125", "0.62527525", "0.62485015", "0.62359875", "0.6234443", "0.6219632", "0.6214435", "0.62101805" ]
0.7041945
10
DELETE /lists/1 DELETE /lists/1.json
def destroy @list.destroy respond_to do |format| format.html { redirect_to my_lists_url, notice: 'List was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end", "def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def delete(list_id)\n Iterable.request(conf, \"/lists/#{list_id}\").delete\n end", "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: \"List was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = @project.lists.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to project_lists_url(@project) }\n format.json { head :no_content }\n end\n end", "def delete_list(id)\n query(\"DELETE FROM todos WHERE list_id = $1\", id)\n query(\"DELETE FROM lists WHERE id = $1\", id)\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to management_lists_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'The List was destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to list_types_url, notice: \"Check ya later list.\" }\n format.json { head :no_content }\n end\n end", "def delete_list(params={})\n @obj.delete('delete', @auth.merge(params))\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'Funcionario deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { render :nothing => true}\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_list.destroy\n respond_to do |format|\n format.html { redirect_to saved_lists_url, notice: \"Saved list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to organization_lists_url(@organization), notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @todo_list = TodoList.find(params[:id])\n @todo_list.destroy\n\n respond_to do |format|\n format.html { redirect_to todo_lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n \t@list = current_user.lists.find params[:list_id]\n @item = @list.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully removed.' }\n #format.json { head :no_content }\n end\n end", "def destroy\n @list = current_user.lists.find(params[:id])\n @list.destroy\n respond_with(@list, :location => my_lists_url)\n end", "def destroy\n @todoit_list.destroy\n respond_to do |format|\n format.html { redirect_to todoit_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @list=List.find(params[:list_id])\n @[email protected]_items.find(params[:id])\n @list_item.destroy\n respond_to do |format|\n format.html { redirect_to @list, notice: 'List item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_list.destroy\n respond_to do |format|\n format.html { redirect_to item_lists_url, notice: 'Item list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mustdo_list.destroy\n respond_to do |format|\n format.html { redirect_to mustdo_lists_url, notice: 'Mustdo list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n authorize! :delete, @ml_list\n @ml_list.destroy\n respond_to do |format|\n format.html { redirect_to ml_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @url_list.destroy\n respond_to do |format|\n format.html { redirect_to url_lists_url, notice: 'Url list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @liste = Liste.find(params[:id])\n @liste.destroy\n\n respond_to do |format|\n format.html { redirect_to listes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lista = Lista.find(params[:id])\n @lista.destroy\n\n respond_to do |format|\n format.html { redirect_to listas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_item.destroy\n respond_to do |format|\n format.html { redirect_to list_path(@list), notice: 'List item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n\n respond_to do |format|\n\n if @list.user == current_user\n\n @list.destroy\n\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n\n else\n\n format.html { redirect_to lists_url, alert: \"You cannot delete that list\" }\n format.json { head :no_content, status: :unauthorized }\n\n end\n\n end\n end", "def destroy\n @twitter_list = TwitterList.find(params[:id])\n @twitter_list.destroy\n\n respond_to do |format|\n format.html { redirect_to twitter_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = current_user.lists.find(list_params)\n @list.destroy\n flash[:success] = \"List deleted\"\n redirect_to current_user\n end", "def destroy\n # @task_list = TaskList.find(params[:id])\n @task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to task_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n flash[:notice] = \"List successfully deleted\"\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n format.html { redirect_to(lists_url) }\n format.xml { head :ok }\n format.js {render :layout => false}\n end\n end", "def delete_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}\"\n request(method: :delete, path: path)\n end", "def destroy\n @todoslist.destroy\n respond_to do |format|\n format.html { redirect_to todoslists_url, notice: \"Todoslist was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = @list.todos.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to list_todos_url(@list) }\n format.json { head :ok }\n end\n end", "def destroy\n @bulk_insert_list.destroy\n respond_to do |format|\n format.html { redirect_to bulk_insert_lists_url, notice: 'Bulk insert list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mylist = Mylist.find(params[:id])\n @mylist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mylists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @task_list.destroy\n respond_to do |format|\n format.html { redirect_to task_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo_list.destroy\n respond_to do |format|\n format.html { redirect_to todo_lists_url, notice: 'Todo list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @list\n @list.destroy\n head :no_content\n end", "def destroy\n @list_item.destroy\n\n head :no_content\n end", "def destroy\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n @list_item.destroy\n\n if @list_item.destroy\n flash[:success] = \"Item deleted\"\n redirect_to list_path(@list)\n else\n flash[:error] = \"Item not deleted\"\n redirect_to list_path(@list)\n end\n end", "def destroy\n @api_v1_shopping_list.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_shopping_lists_url, notice: 'Shopping list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@list = List.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html\t{ redirect_to(root_url) }\n\t\t\tformat.xml\t{ head :ok }\n\t\tend\n\tend", "def destroy\n @thing_list = ThingList.find(params[:id])\n @thing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(thing_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @keylist.destroy\n respond_to do |format|\n format.html { redirect_to keylists_url, notice: 'Keylist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mydo_list.destroy\n respond_to do |format|\n format.html { redirect_to mydo_lists_url, notice: 'Mydo list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invite_list = InviteList.find(params[:id])\n @invite_list.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list_item.destroy\n respond_to do |format|\n format.html { redirect_to list_items_url, notice: 'List item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @toread_list.destroy\n respond_to do |format|\n format.html { redirect_to toread_lists_url, notice: 'Toread list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fwlist = Fwlist.find(params[:id])\n @fwlist.destroy\n\t\n respond_to do |format|\n format.html { redirect_to fwlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_list.destroy\n respond_to do |format|\n format.html { redirect_to model_lists_url, notice: 'Model list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @listed.destroy\n respond_to do |format|\n format.html { redirect_to session[:previous_url] }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_list.destroy\n respond_to do |format|\n format.html { redirect_to email_lists_url, notice: 'Email list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_list.destroy\n respond_to do |format|\n format.html { redirect_to task_lists_url, notice: 'Task list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_list(id:)\n check_token\n response = self.class.delete(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n true\n end", "def destroy\n @mailee_list = Mailee::List.find(params[:id])\n @mailee_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailee_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @list.destroy\n redirect_to lists_url, notice: 'List was successfully destroyed.'\n end", "def destroy\n @todolist.destroy\n respond_to do |format|\n format.html { redirect_to todolists_url, notice: 'Todolist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @coffeeshoplist.destroy\n respond_to do |format|\n format.html { redirect_to coffeeshoplists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sent_list.destroy\n respond_to do |format|\n format.html { redirect_to sent_lists_url, notice: 'Sent list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url, notice: \"Check list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @listtodo.destroy\n respond_to do |format|\n format.html { redirect_to listtodos_url, notice: 'Listtodo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_list = DataList.find(params[:id])\n @data_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @todo_list.destroy\n respond_to do |format|\n format.html { redirect_to todo_lists_url, notice: 'Todo list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applist.destroy\n respond_to do |format|\n format.html { redirect_to applists_url, notice: 'Applist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent_list.destroy\n respond_to do |format|\n format.html { redirect_to agent_lists_url, notice: 'Agent list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n cookies[:list]=cookies[:list].gsub(\",#{@list.id}\",\"\")\n format.html { redirect_to \"/\", notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @watch_list = WatchList.find(params[:id])\n @watch_list.destroy\n\n respond_to do |format|\n format.html { redirect_to watch_lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @service_list.destroy\n respond_to do |format|\n format.html { redirect_to service_lists_url, notice: 'Service list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @set_list.destroy\n respond_to do |format|\n format.html { redirect_to set_lists_url, notice: 'Set list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @doulist.destroy\n respond_to do |format|\n format.html { redirect_to doulists_url, notice: 'Doulist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_list = SearchList.find(params[:id])\n @search_list.destroy\n\n respond_to do |format|\n format.html { redirect_to search_lists_url }\n format.json { head :no_content }\n end\n end", "def delete!(id:)\n client.delete_list(id: id)\n end", "def destroy\n @actionlist.destroy\n respond_to do |format|\n format.html { redirect_to actionlists_url, notice: 'Actionlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @menu_list = MenuList.find(params[:id])\n @menu_list.destroy\n\n respond_to do |format|\n format.html { redirect_to menu_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @list.name == 'Default'\n format.html { redirect_to @user.lists.find_by(name: 'Default'), data: { confirm: 'You can\\'t delete your default list'} }\n else\n @list.destroy\n respond_to do |format|\n format.html { redirect_to @user.lists.find_by(name: 'Default') }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @mebrat_list.destroy\n respond_to do |format|\n format.html { redirect_to mebrat_lists_url, notice: 'Mebrat list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_multiple\n\t @list.delete(params[:id])\n\t redirect_to '/tasks'\n\tend", "def destroy\n @todolists.destroy\n respond_to do |format|\n format.html { redirect_to todolist_url, notice: 'Task was successfully destroyed.' }\n format.json { head :no_content }\n end\nend", "def destroy\n @menu_lists.destroy\n respond_to do |format|\n format.html { redirect_to menu_lists_url, notice: 'Menu list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end" ]
[ "0.7906252", "0.7809346", "0.7779898", "0.77558565", "0.77558565", "0.77558565", "0.7716591", "0.7716591", "0.7716591", "0.7579166", "0.7510371", "0.7500726", "0.7500726", "0.7500726", "0.7500726", "0.7500726", "0.7500726", "0.7500726", "0.7497565", "0.74764705", "0.74714524", "0.74634194", "0.74262434", "0.73586804", "0.7357561", "0.73184127", "0.7307409", "0.7262036", "0.7258986", "0.72557944", "0.7255498", "0.722032", "0.720951", "0.7192157", "0.7173263", "0.71528494", "0.7152085", "0.7146223", "0.7141672", "0.71207786", "0.7117594", "0.7085202", "0.708338", "0.708288", "0.707666", "0.7034761", "0.7032893", "0.70312124", "0.70182973", "0.7013407", "0.7013242", "0.70023954", "0.7001391", "0.7001256", "0.69987077", "0.6996446", "0.69939035", "0.6983326", "0.6978446", "0.6977895", "0.6971292", "0.69640994", "0.6962751", "0.69616365", "0.69589674", "0.69542146", "0.69517636", "0.6929831", "0.6929077", "0.69213736", "0.6921087", "0.69179827", "0.6917698", "0.69164854", "0.6904667", "0.69014347", "0.68963206", "0.6896076", "0.6882603", "0.6865879", "0.68624395", "0.6857302", "0.68518364", "0.68515074", "0.6845852", "0.68433815", "0.683762", "0.6835283", "0.6834579", "0.6829019", "0.6828596", "0.682845", "0.6827887", "0.680746", "0.6806755", "0.6801667", "0.6800555", "0.6796662", "0.6793309", "0.6783792" ]
0.74648166
21
Use callbacks to share common setup or constraints between actions.
def set_list @list = current_user.lists.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 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 revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 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\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\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 init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 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 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 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", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def duas1(action)\n action.call\n action.call\nend", "def _handle_action_missing(*args); end" ]
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865", "0.53135896", "0.52999926", "0.5297309", "0.5296569", "0.5261449", "0.5247048", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52376497", "0.52323204", "0.52310973", "0.523081", "0.5225785", "0.5219039", "0.52136266", "0.5208033", "0.520763", "0.5177365", "0.5175224", "0.5173357", "0.5166104", "0.5162502", "0.51573396", "0.5154547", "0.5153531", "0.51502854", "0.51436496", "0.5142863", "0.51330835", "0.5115634", "0.5115634", "0.511527", "0.5109693", "0.51076853", "0.5093146", "0.5090683", "0.50829846", "0.50819314", "0.50670373", "0.5055505", "0.5053398", "0.50504035", "0.50504035", "0.5037765", "0.5027292", "0.5024484", "0.50150335", "0.5014069", "0.50022113", "0.5001542", "0.49981874", "0.49915564", "0.49915564", "0.49880967", "0.4982312", "0.49787375", "0.49786067", "0.49687737", "0.49676532", "0.49602765", "0.49565676", "0.49550772", "0.495342", "0.49522525", "0.49463704", "0.49447197", "0.49362713", "0.49328062", "0.49280638", "0.49272856", "0.4927058", "0.49221697", "0.4919526", "0.49185994", "0.49184805", "0.49170163", "0.49168405", "0.49167764" ]
0.0
-1
initialize a new fixture instance name the name of the current test to run TODO: 1. Set your device capabilities. 2. Set your Perfecto lab user, password and host.
def initialize(name = nil) super(name) unless name.nil? host = 'LABNAME.perfectomobile.com' @user = 'Your UserName' pass = 'Your PW' # device capabilities: capabilities = { :platformName => 'Android', :model => '', :platformVersion => '', :browserName => 'mobileOS', :browserVersion => '', :deviceName => '', :user => @user, :password => pass } # create a new driver instance @driver = Selenium::WebDriver.for(:remote, :url => 'http://' + host + '/nexperience/perfectomobile/wd/hub', :desired_capabilities => capabilities) # create new reportium client create_reportium_client end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def testFixtureSetup()\n @windows = []\n # setup your objects for the tests (if needed)\n end", "def testFixtureSetup()\n @windows = []\n # setup your objects for the tests (if needed)\n end", "def setup\r\n\t\t@controller = Admin::UserController.new\r\n\t\t@request = ActionController::TestRequest.new\r\n\t\t@response = ActionController::TestResponse.new\r\n\t\t# Retrieve fixtures via their name\r\n\t\t# @first = users(:first)\r\n\t\t@first = User.find_first\r\n\tend", "def setup\n # Retrieve fixtures via their name\n # @first = vr_cc_solicituds(:first)\n end", "def setup\n # Retrieve fixtures via their name\n # @first = volunteer_tasks(:first)\n end", "def setup\n # Retrieve fixtures via their name\n # @first = accounts(:first)\n end", "def setup\n @dataset = $dataset\n @dataset_2 = $dataset_2\n\n refute_nil @dataset, \"You do not have an active dataset to run the tests.\"\n\n super\n end", "def initialize\n \tself.seed_data\n end", "def setup\n # reload the fixtures since each test is NOT wrapped in a transaction\n self.class.fixtures :all\n self.class.open_browser(@@testing_browser)\n end", "def initialize(opts = {})\n if(opts[:fixture_directory])\n raise \"#{opts[:fixture_directory]} isn't a directory!\" unless File.directory? opts[:fixture_directory]\n @fixture_directory = opts[:fixture_directory]\n else\n @fixture_directory = File.join(File.dirname(__FILE__), \"/hydra-fixtures/fixtures\")\n end\n @pid_list = []\n read_fixtures\n ActiveFedora.init unless Thread.current[:repo]\n end", "def initialize(options, &block)\n @templates = options.fetch(:templates)\n @seed = \"#{Process.pid}#{options.fetch(:seed, generate_seed).to_i}\"\n\n @env = (ENV_TEMPLATE % @seed).freeze\n @databases = @templates.inject({}) do|h, t|\n h[t] = \"#{Configuration.test_databases[t]['database']}_#{@seed}\".freeze\n h\n end.freeze\n\n execute(&block) unless block.nil?\n end", "def set_fixture\n @fixture = Fixture.find(params[:id])\n end", "def setup\n # Retrieve fixtures via their name\n # @first = vr_cc_solicitudes(:first)\n end", "def setup\n # Retrieve fixtures via their name\n # @first = contacts(:first)\n end", "def initialize\n self.env_sut=ENV['SUT'].upcase\n end", "def initialize\n self.env_sut=ENV['SUT'].upcase\n end", "def setup\n @automator = ArmAutomator.instance\n create_test_user :login_id_prefix => \"test\", :external_user_id_suffix => \"@gmail.com\", :group => \"training\", :country => \"United States\"\n perform_login\n end", "def do_setup \n config = self.config\n host = config['app']['host']\n port = config['app']['port']\n @url_base = \"http://#{host}:#{port}\"\n puts config.inspect\n @pcap_dir = config.fetch 'pcap_dir'\n @index_dir = config.fetch 'index_dir'\n\n # Extract test pcaps and indexes\n FileUtils.rm_rf '/tmp/pcapr_local_test'\n FileUtils.mkdir_p @pcap_dir\n FileUtils.mkdir_p @index_dir\n\n\n # Recreate test database.\n begin\n couch = config['couch']\n RestClient.delete \"#{couch['uri']}/#{couch['database']}\"\n rescue RestClient::ResourceNotFound\n end\n db = @db = PcaprLocal.get_db(config)\n end", "def fixture(name)\r\n fixture_io(name).read\r\n end", "def setup \n\t\tputs 'setup: ' + @test_name \n\n\t\t#device capabilities goes here:\n\t\tcapabilities = {\n\t\t\t:platformName => 'Android',\n\t\t\t:model => 'Galaxy S6', #Optional \n\t\t\t:platformVersion => '', #Optional \n\t\t\t:browserName => 'mobileOS', #Optional \n\t\t\t:browserVersion => '', #Optional for web\n\t\t\t:deviceName => '' #Optional\n\t\t}\n\n\t\t#your host url\n\t\thost = 'branchtest.perfectomobile.com'\n\n\t\t#Your perfecto lab credentials (using security token is recommended)\n\t\tcapabilities['securityToken'] = 'MY_TOKEN'\n\t\t#capabilities['user'] = 'MY_USER'\n\t\t#capabilities['password'] = 'MY_PASS'\n\n\n\t\t@driver = Selenium::WebDriver.for(:remote, :url => \"http://\" + host + \"/nexperience/perfectomobile/wd/hub\", :desired_capabilities =>capabilities) \n\tend", "def setup\n @bu = BetUnit.new\n end", "def fixture name\n cwd = File.expand_path(File.dirname(__FILE__))\n File.read(File.join(cwd, \"../fixtures/ten_hs_server/#{name}\"))\n end", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def setup\n # Each debugger test has its own debugger instance.\n @debugger = Google::Cloud::Debugger.new\n debugger_credentials = @debugger.service.credentials\n debugger_channel_cred = GRPC::Core::ChannelCredentials.new.compose \\\n GRPC::Core::CallCredentials.new debugger_credentials.client.updater_proc\n @vtk_debugger_client = Google::Cloud::Debugger::V2::Debugger::Client.new do |config|\n config.credentials = debugger_channel_cred\n end\n\n @debugger.start\n\n refute_nil @debugger, \"You do not have an active debugger to run the tests.\"\n refute_nil @vtk_debugger_client, \"You do not have an active debugger vtk client to run the tests.\"\n super\n end", "def setup\n @admin = FactoryBot.create(:admin)\n end", "def initialize(setname, config, custom_prefabs_path, options)\n super\n @vagrant_path = File.expand_path(File.join(RSpec.configuration.system_tmp, 'vagrant_projects', setname))\n\n RSpec.configuration.rspec_storage[:nodes] ||= {}\n end", "def initialize(testing_template = TestingTemplate.new)\n @testing_template = testing_template\n end", "def test_can_initialize_with_single_environment\r\n assert_nothing_raised do\r\n DBGeni::Base.installer_for_environment(helper_sqlite_single_environment_file, 'development')\r\n end\r\n end", "def fixture(name)\n File.read(fixture_location(name))\nend", "def setup\r\n # Retrieve fixtures via their name\r\n # @first = category(:first)\r\n end", "def setup\n config = self.config\n host = config['app']['host']\n port = config['app']['port']\n @url_base = \"http://#{host}:#{port}\"\n\n # Extract test pcaps and indexes\n FileUtils.rm_rf '/tmp/pcapr_local_test'\n test_tar = File.join(File.expand_path(File.dirname(__FILE__)), 'test.tgz')\n if File.exist? test_tar\n puts `tar -C /tmp/ -xzf #{test_tar}`\n end\n\n # Recreate test database.\n begin\n couch = config['couch']\n RestClient.delete \"#{couch['uri']}/#{couch['database']}\"\n rescue RestClient::ResourceNotFound\n end\n db = PcaprLocal.get_db config\n\n # And restore it from datafile.\n if self.datafile\n load_docs self.datafile, db\n end\n\n # Start server.\n config_file = Tempfile.new \"config\"\n config_file.print config.to_json\n config_file.flush\n @pid = fork do \n Process.setpgid $$, $$\n exec \"#{PcaprLocal::ROOT}/bin/startpcapr -f #{config_file.path} -d\" \n end\n\n # And wait for it to be ready.\n wait_for_server host, port\n end", "def setup\n login_as Factory(:user,:person => Factory(:person,:roles_mask=> 0))\n @object = Factory(:sample,:contributor => User.current_user,\n :title=> \"test1\",\n :policy => policies(:policy_for_viewable_data_file))\n end", "def fixture(name)\n File.open(File.expand_path(File.dirname(__FILE__) + \"/fixtures/#{name}\"))\nend", "def initTestCase\n # It is possible to call it several times. Protect it from it.\n if ((!defined?(@AlreadyInit)) or\n (!@AlreadyInit))\n @AlreadyInit = true\n # The possible variables replaced in regression test files (command lines, repositories...)\n # map< Symbol, Object >\n @ContextVars = {}\n # Mute any output except for terminal output.\n set_log_errors_stack([])\n set_log_messages_stack([])\n # Clear variables set in tests\n # map< Symbol, Object >\n $Variables = {}\n # Clear the context that might be used to pilot some regression specific objects\n # map< Symbol, Object >\n $Context = {}\n # list< list< list< String > > >\n $WEACERegression_DummySQLAnswers = nil\n # Initialize instance variables used to identify the Test case\n initTestDetails\n\n begin\n yield\n rescue Exception\n set_log_file(nil)\n @AlreadyInit = false\n raise\n end\n set_log_file(nil)\n @AlreadyInit = false\n else\n yield\n end\n end", "def initialize(config, game)\n @config = config\n @game = game\n auto_test_esp = \"#{@game.path}/Data/AutoTest.esp\"\n # Ordered list of available in-game test suites\n # Array<Symbol>\n @available_tests_suites =\n if File.exist?(auto_test_esp)\n Base64.decode64(\n ElderScrollsPlugin.new(auto_test_esp).\n to_json[:sub_chunks].\n find { |chunk| chunk[:decoded_header][:label] == 'QUST' }[:sub_chunks].\n find do |chunk|\n chunk[:sub_chunks].any? { |sub_chunk| sub_chunk[:name] == 'EDID' && sub_chunk[:data] =~ /AutoTest_ScriptsQuest/ }\n end[:sub_chunks].\n find { |chunk| chunk[:name] == 'VMAD' }[:data]\n ).scan(/AutoTest_Suite_(\\w+)/).flatten.map { |tests_suite| tests_suite.downcase.to_sym }\n else\n log \"[ In-game testing #{@game.name} ] - Missing file #{auto_test_esp}. In-game tests will be disabled. Please install the AutoTest mod.\"\n []\n end\n log \"[ In-game testing #{@game.name} ] - #{@available_tests_suites.size} available in-game tests suites: #{@available_tests_suites.join(', ')}\"\n end", "def setup\r\n @patient = patients(:patient_00001)\r\n end", "def test_basic_functionality\n u = DefaultSettings.create!\n end", "def test_initialize_database\n hook = ForemanHook::HostRename.new\n hook.log_level = Logger::WARN\n hook.database_path = File.dirname(__FILE__) + '/test.db'\n hook.initialize_database\n File.unlink hook.database_path\n end", "def test_initialize\n assert_nothing_raised { Spoonerize::Cli.new(fixtures['default_words']) }\n end", "def setup\n# @api = DDOS_API.new(1000, 'localhost', @@port)\n @api = DDOS_API.new(:failover_timeout=>1000, :local_ip=>'localhost', :local_port=>@@port)\n @@port += 1\n # @api.config_api('testingConfig.txt')\n end", "def setup\n create_vagrantfile()\n\n teardown()\n\n output << bold(color(\"localhost$\", :green)) << \" vagrant up\\n\"\n vagrant(\"up\")\n\n # Establish ssh connectivity\n nodes.each do |k,v|\n output << bold(color(\"localhost$\", :green)) << \" ssh #{k}\\n\"\n chan = Net::SSH.start(k, 'vagrant', :config => ssh_config)\n\n RSpec.configuration.rspec_storage[:nodes][k] = {\n :ssh => chan,\n }\n end\n\n nil\n end", "def setup\n @admin = users(:admin)\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @user4 = users(:user4)\n @user5 = users(:user5) #資料不完整的使用者\n @instance = instances(:instance_teaming)\n end", "def fixtures(name)\n entry = YAML::load_file(File.dirname(__FILE__) + \"/spec/fixtures/#{name}.yaml\")\n klass = begin\n Kernel::const_get(Inflector.classify(Inflector.singularize(name)))\n rescue\n nil\n end\n\n unless klass.nil?\n database.logger.debug { \"AUTOMIGRATE: #{klass}\" }\n klass.auto_migrate!\n\n (entry.kind_of?(Array) ? entry : [entry]).each do |hash|\n if hash['type']\n Object::const_get(hash['type'])::create(hash)\n else\n klass::create(hash)\n end\n end\n else\n table = database.table(name.to_s)\n table.create! true\n table.activate_associations!\n\n #pp database.schema\n\n (entry.kind_of?(Array) ? entry : [entry]).each do |hash|\n table.insert(hash)\n end\n end\nend", "def setup\n @bigquery = $bigquery\n @prefix = $prefix\n @storage = $storage\n @bucket = $bucket\n @samples_bucket = $samples_bucket\n @samples_public_table = $samples_public_table\n @kms_key = $kms_key\n @kms_key_2 = $kms_key_2\n\n refute_nil @bigquery, \"You do not have an active bigquery to run the tests.\"\n refute_nil @prefix, \"You do not have an bigquery prefix to name the datasets and tables with.\"\n refute_nil @storage, \"You do not have an active storage to run the tests.\"\n refute_nil @bucket, \"You do not have a storage bucket to run the tests.\"\n refute_nil @samples_bucket, \"You do not have a bucket with sample data to run the tests.\"\n refute_nil @samples_public_table, \"You do not have a table with sample data to run the tests.\"\n refute_nil @kms_key, \"You do not have a kms key to run the tests.\"\n refute_nil @kms_key_2, \"You do not have a second kms key to run the tests.\"\n\n super\n end", "def setup\n puts \"Starting test\"\n TRConnector.instance.start\n sleep(1)\n end", "def setup\n @spanner = $spanner\n\n refute_nil @spanner, \"You do not have an active spanner to run the tests.\"\n\n @spanner_client = $spanner_client\n\n refute_nil @spanner_client, \"You do not have an active client to run the tests.\"\n\n super\n end", "def setup\r\n @controller = InvoicesController.new\r\n @request = ActionController::TestRequest.new\r\n @response = ActionController::TestResponse.new\r\n\r\n @first = Invoice.find(:first) \r\n @request.user_agent = 'Firefox'\r\n @request.host = \"quentin.#{DOMAIN_NAME}\"\r\n login_as :quentin\r\n end", "def setup\n Capybara.app = App.new\n end", "def setup_before(skel_name, options)\n environment.skeleton(skel_name)\n environment.env['VBOX_USER_HOME'] = environment.homedir.to_s\n assert_execute('vagrant', 'box', 'add', \"vagrantr10kspec\", options[:box])\n end", "def setup\n @survey_other = FactoryGirl.create :survey, access_code: 'other'\n @survey_user_default = FactoryGirl.create :survey, access_code: 'user_default'\n @survey_app_default = FactoryGirl.create :survey, access_code: 'gb'\n end", "def setup\n # Retrieve fixtures via their name\n # @first = gizmo_types(:first)\n end", "def test_create_from_data\n data = @test_record.all_text\n \n creation_test do |record|\n record.create_from_data('', data)\n end\n end", "def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end", "def fixture(name)\r\n File.read \"test/fixtures/#{name}\"\r\n end", "def setup\r\n # Retrieve fixtures via their name\r\n # @first = categories(:first)\r\n end", "def setup_test_1(test_name, epw_path)\n\n co = OpenStudio::Runmanager::ConfigOptions.new(true)\n co.findTools(false, true, false, true)\n\n if !File.exist?(sql_path(test_name))\n puts \"Running EnergyPlus\"\n\n wf = OpenStudio::Runmanager::Workflow.new(\"modeltoidf->energypluspreprocess->energyplus\")\n wf.add(co.getTools())\n job = wf.create(OpenStudio::Path.new(run_dir(test_name)), OpenStudio::Path.new(model_out_path(test_name)), OpenStudio::Path.new(epw_path))\n\n rm = OpenStudio::Runmanager::RunManager.new\n rm.enqueue(job, true)\n rm.waitForFinished\n end\n end", "def setup\n @request = ActionController::TestRequest.new\n @request.env['REQUEST_URI'] = \"http://localhost\"\n @request.env['HTTP_USER_AGENT'] = \"TestUA\"\n TLA_CONFIG['caching'] = false\n TLA_CONFIG['testing'] = true\n end", "def initialize(config, game_info)\n @config = config\n # Set default values here\n @game_info = {\n 'min_launch_time_secs' => 10,\n 'tests_poll_secs' => 5,\n 'timeout_frozen_tests_secs' => 300,\n 'timeout_interrupt_tests_secs' => 10\n }.merge(game_info)\n @name = name\n @pid = nil\n init if respond_to?(:init)\n end", "def new\n @virtualtest = Virtualtest.new\n end", "def initialize(name='test', desc='run tests', &block)\n @name = name || 'test'\n @desc = desc\n\n @config = Test::Config.new\n\n @config.files << default_tests if @config.files.empty?\n @config.loadpath << 'lib' if @config.loadpath.empty?\n\n block.call(@config)\n\n define_task\n end", "def new\n @smoke_test = SmokeTest.new\n # package builders\n @smoke_test.build_nova_package_builder\n @smoke_test.nova_package_builder.merge_trunk = false\n @smoke_test.build_glance_package_builder\n @smoke_test.glance_package_builder.merge_trunk = false\n @smoke_test.build_keystone_package_builder\n @smoke_test.keystone_package_builder.merge_trunk = false\n @smoke_test.build_swift_package_builder\n @smoke_test.swift_package_builder.merge_trunk = false\n @smoke_test.build_cinder_package_builder\n @smoke_test.cinder_package_builder.merge_trunk = false\n @smoke_test.build_neutron_package_builder\n @smoke_test.neutron_package_builder.merge_trunk = false\n @smoke_test.build_ceilometer_package_builder\n @smoke_test.ceilometer_package_builder.merge_trunk = false\n @smoke_test.build_heat_package_builder\n @smoke_test.heat_package_builder.merge_trunk = false\n\n # config modules\n @smoke_test.build_nova_config_module\n @smoke_test.nova_config_module.merge_trunk = false\n @smoke_test.build_glance_config_module\n @smoke_test.glance_config_module.merge_trunk = false\n @smoke_test.build_keystone_config_module\n @smoke_test.keystone_config_module.merge_trunk = false\n @smoke_test.build_swift_config_module\n @smoke_test.swift_config_module.merge_trunk = false\n @smoke_test.build_cinder_config_module\n @smoke_test.cinder_config_module.merge_trunk = false\n @smoke_test.build_neutron_config_module\n @smoke_test.neutron_config_module.merge_trunk = false\n @smoke_test.build_ceilometer_config_module\n @smoke_test.ceilometer_config_module.merge_trunk = false\n @smoke_test.build_heat_config_module\n @smoke_test.heat_config_module.merge_trunk = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @smoke_test }\n format.xml { render :xml => @smoke_test }\n end\n end", "def setup\n # Retrieve fixtures via their name\n # @first = <%= plural_name %>(:first)\n end", "def initialize(env, threaded=false)\n @threaded = threaded\n puts \"Starting up in #{env}!\"\n @tasks = []\n ActiveRecord::Base.connect_to_testbot(env)\n loop\n end", "def suite\n suite_creator = TestSuiteCreator.new(self)\n suite_creator.create\n end", "def initialize(config)\n super\n # stupid, kinda, but wanted to test plugin-specific options\n @seed = config[\"seed\"].to_i # not even using it really\n @unit = \"randoms\"\n end", "def default_setup(*args)\n options = args.last.is_a?(Hash) ? args.last.dup : {}\n args.each { |arg| options[arg] = true if arg.is_a?(Symbol) }\n method_name = \"#{options[:prefix]}setup\".to_sym\n unless options[:without_login]\n load_users_fixture\n define_method(method_name) do\n @controller = self.class.target.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n login options\n end\n else\n define_method(method_name) do\n @controller = self.class.target.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end\n end\n end", "def initialize(setname, config, custom_prefabs_path, options)\n super\n\n # Valid supported ENV variables\n options = [:host, :user, :pass, :dest_dir, :template_dir, :rpool,\n :cluster, :ssh_keys, :datacenter, :node_timeout, :node_tries,\n :node_sleep, :connect_timeout, :connect_tries]\n\n # Devise defaults, use fog configuration from file system if it exists\n defaults = load_fog_config()\n defaults = defaults.merge({\n :node_timeout => 1200,\n :node_tries => 10,\n :node_sleep => 30 + rand(60),\n :connect_timeout => 60,\n :connect_tries => 10,\n })\n\n # Traverse the ENV variables and load them into our config automatically\n @vmconf = defaults\n ENV.each do |k,v|\n next unless k =~/^RS(PEC)?_VSPHERE_/\n var = k.sub(/^RS(PEC)?_VSPHERE_/, '').downcase.to_sym\n unless options.include?(var)\n log.info(\"Ignoring unknown environment variable #{k}\")\n next\n end\n @vmconf[var] = v\n end\n\n # Initialize node storage if not already\n RSpec.configuration.rs_storage[:nodes] ||= {}\n end", "def initialize\n\t\t@enemy = Faker::Name.name\n\tend", "def initialize(slug)\n # convert the slug\n @converted_slug = convert_slug(slug)\n\n # the run string inside the test\n @run_string = \"run bash #{converted_slug}.sh\"\n\n # the name for the test file\n @test_name = \"./exercises/#{slug}/#{@converted_slug}_test.sh\"\n\n # this converts the raw json to a ruby struct\n @data_map = get_canonical(slug)\n\n # this private method gets us to the proper layer in the nested struct\n get_test_map\n end", "def setup\n @story = Story.create( :text => 'Hello world' )\n end", "def initialize(runtime, io, options)\n if %w(BASE_URL USER PASSWORD).map{|e| ENV[\"TESTRAIL_#{e}\"]}.any?{|e| e=='' || !e}\n raise 'You need to setup Testrail environment parameters see https://bbcworldwide.atlassian.net/wiki/display/BAR/Installing+and+Running+Cukerail' \n end\n @testrail_api_client = TestRail::APIClient.new(ENV['TESTRAIL_BASE_URL'],ENV['TESTRAIL_USER'],ENV['TESTRAIL_PASSWORD'],ENV['TESTRAIL_PROXY_URL'],ENV['TESTRAIL_PROXY_PORT'])\n end", "def setup\n# Connection.establish_connection_schema('railstest')\n @controller = CustomerController.new \n @request = ActionController::TestRequest.new \n @response = ActionController::TestRespons e.new\n end", "def new_puppet_testing_environment\n environment_name = 'puppet_agent_testing_' + SecureRandom.hex(10).to_s\n puppet_testing_environment = environment_location(environment_name)\n step '(Master) Create test environment' do\n on(master, \"mkdir -p #{File.join(puppet_testing_environment, 'modules')}\")\n on(master, \"mkdir -p #{File.join(puppet_testing_environment, 'manifests')}\")\n end\n step '(Master) Install puppet_agent to the test environment' do\n install_puppet_agent_module_on(master, environment_name)\n end\n environment_name\n end", "def set_test_instance\n @test_instance = TestInstance.find(params[:id])\n end", "def fixture(name)\n File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', name))\n end", "def fixture(name)\n File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', name))\n end", "def presets\n h = Beaker::Options::OptionsHash.new\n h.merge({\n :project => 'Beaker',\n :department => 'unknown',\n :created_by => ENV['USER'] || ENV['USERNAME'] || 'unknown',\n :host_tags => {},\n :openstack_api_key => ENV.fetch('OS_PASSWORD', nil),\n :openstack_username => ENV.fetch('OS_USERNAME', nil),\n :openstack_auth_url => \"#{ENV.fetch('OS_AUTH_URL', nil)}/tokens\",\n :openstack_tenant => ENV.fetch('OS_TENANT_NAME', nil),\n :openstack_keyname => ENV.fetch('OS_KEYNAME', nil),\n :openstack_network => ENV.fetch('OS_NETWORK', nil),\n :openstack_region => ENV.fetch('OS_REGION', nil),\n :openstack_volume_support => ENV['OS_VOLUME_SUPPORT'] || true,\n :jenkins_build_url => nil,\n :validate => true,\n :configure => true,\n :log_level => 'info',\n :trace_limit => 10,\n :\"master-start-curl-retries\" => 120,\n :masterless => false,\n :options_file => nil,\n :type => 'pe',\n :provision => true,\n :preserve_hosts => 'never',\n :root_keys => false,\n :quiet => false,\n :project_root => File.expand_path(File.join(__dir__, \"../\")),\n :xml_dir => 'junit',\n :xml_file => 'beaker_junit.xml',\n :xml_time => 'beaker_times.xml',\n :xml_time_enabled => false,\n :xml_stylesheet => 'junit.xsl',\n :default_log_prefix => 'beaker_logs',\n :log_dir => 'log',\n :log_sut_event => 'sut.log',\n :color => true,\n :dry_run => false,\n :test_tag_and => '',\n :test_tag_or => '',\n :test_tag_exclude => '',\n :timeout => 900, # 15 minutes\n :fail_mode => 'slow',\n :test_results_file => '',\n :accept_all_exit_codes => false,\n :timesync => false,\n :set_env => true,\n :disable_updates => true,\n :repo_proxy => false,\n :package_proxy => false,\n :add_el_extras => false,\n :consoleport => 443,\n :pe_dir => '/opt/enterprise/dists',\n :pe_version_file => 'LATEST',\n :pe_version_file_win => 'LATEST-win',\n :host_env => {},\n :host_name_prefix => nil,\n :ssh_env_file => '~/.ssh/environment',\n :profile_d_env_file => '/etc/profile.d/beaker_env.sh',\n :dot_fog => File.join(ENV.fetch('HOME', nil), '.fog'),\n :ec2_yaml => 'config/image_templates/ec2.yaml',\n :help => false,\n :collect_perf_data => 'none',\n :puppetdb_port_ssl => 8081,\n :puppetdb_port_nonssl => 8080,\n :puppetserver_port => 8140,\n :nodeclassifier_port => 4433,\n :cache_files_locally => false,\n :aws_keyname_modifier => rand(10**10).to_s.rjust(10, '0'), # 10 digit random number string\n :run_in_parallel => [],\n :use_fog_credentials => true,\n :ssh => {\n :config => false,\n :verify_host_key => false,\n :auth_methods => [\"publickey\"],\n :port => 22,\n :forward_agent => true,\n :keys => [\"#{ENV.fetch('HOME', nil)}/.ssh/id_rsa\"],\n :user_known_hosts_file => \"#{ENV.fetch('HOME', nil)}/.ssh/known_hosts\",\n :keepalive => true,\n },\n })\n end", "def fixture(path)\n File.join(FIXTURES_ROOT, path)\nend", "def startTest(client, dtype, dname, logid, passw, ttype, tcsno, wifis, build)\n\n\t\t#$dname = client.waitForDevice(\"\\\"@name='#{dname}' AND @remote='true'\\\"\", 300000)\n\t\t@dtype = dtype\n\t\t@dname = dname\n\t\t@logid = logid\n\t\t@passw = passw\n\t\t@ttype = ttype\n\t\t@tcsno = tcsno\n\t\t@wifis = wifis\n\t\t@build = build\n\n\t\tif @ttype == \"select\"\n\t\t\tx = @tcsno.split \",\"\n\t\t\tputs \"::MSG::TCs to be EXECUTED : #{x}\"\n\t\t\t$total_tc = x.length\n\t\telse\n\t\t\t$total_tc = 37\n\t\tend\n\n\t\tif @dtype == \"ios\"\n\t\t\t#temp: code for reserving a remote iOS device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices')\n\t\t\treq = Net::HTTP::Get.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\t#Get the device id for the desired device\n\t\t\tapi_result = JSON.parse(res.body)\n\t\t\tdevices_array = api_result[\"data\"]\n\t\t\trequested_device_id = \"\"\n\t\t\t\n\t\t\tdevices_array.each do |device|\n\t\t\t \tif device[\"deviceName\"] == @dname\n\t\t\t\t\trequested_device_id = device[\"id\"]\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\t#And now reserve the device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices/' + requested_device_id + '/reservations/new')\n\t\t\treq = Net::HTTP::Post.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\treq.set_form_data('start' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"), 'end' => '2016-12-30-23-00-00', 'clientCurrentTimestamp' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"))\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\tclient.addDevice(\"c24994f50118a6ae9db6a911da628b477a0ba401\", \"ipadair\")\n\t\t\tclient.setDevice(\"#{\"ios_app:\" + @dname}\")\n\t\t\t#client.setDevice(\"#{@dname}\")\n\t\t\t#temp\n\t\t\tclient.openDevice()\n\t\t\tclient.sleep(2000)\n\t\t\t$obj_utili.andConnectingWifi(client, @dtype, @dname, @wifis)\n\t\t\tclient.sleep(2000)\n\t\t\tif @build == nil\n\t\t\t\tputs \"::MSG:: Apps will be using currently installed build\"\n\t\t\telse\n\t\t\t\tputs ($obj_instl.ios_testInstallApps(client, @build))\n\t\t\tend\n\t\t\tclient.launch(\"jp.unext.mediaplayer\", true, false)\n\t\t\tclient.sleep(5000)\n\t\t\t$obj_slctv.iosSelectiveTests(client, @logid, @passw, @ttype, @tcsno)\n\t\telsif @dtype == \"android\"\t\t\t\t\t\t\n\t\t\t#client.setDevice(\"#{$dname}\")\n\t\t\t#client.waitForDevice(\"\\\"@name='#{$dname}' AND @remote='true'\\\"\", 300000)\n\t\t\t#temp: code for reserving a remote iOS device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices')\n\t\t\treq = Net::HTTP::Get.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\t#Get the device id for the desired device\n\t\t\tapi_result = JSON.parse(res.body)\n\t\t\tdevices_array = api_result[\"data\"]\n\t\t\trequested_device_id = \"\"\n\t\t\t\n\t\t\tdevices_array.each do |device|\n\t\t\t \tif device[\"deviceName\"] == @dname\n\t\t\t\t\trequested_device_id = device[\"id\"]\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\t#And now reserve the device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices/' + requested_device_id + '/reservations/new')\n\t\t\treq = Net::HTTP::Post.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\treq.set_form_data('start' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"), 'end' => '2016-12-30-23-00-00', 'clientCurrentTimestamp' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"))\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\tclient.addDevice(\"CB5A233UKX\", \"401SO\")\n\t\t\tclient.setDevice(\"#{@dname}\")\n\t\t\t#temp\n\n\t\t\tclient.openDevice()\n\t\t\tclient.sleep(2000)\n\t\t\t$obj_utili.andConnectingWifi(client, @dtype, @dname, @wifis)\n\t\t\t#CURRENTLY AUTO BUILD FOR ANDROID IS NOT PREPARED, WHEN JENKINS AUTO BUILD WILL BE DELIVERED, TEST CAN BE RESUMED\n\t\t\t#if @build == nil\n\t\t\t#\tputs \"::MSG:: Apps will be using currently installed build\"\n\t\t\t#else\n\t\t\t#\tputs ($obj_instl.testInstallApps(client, @build))\n\t\t\t#end\n\t\t\tclient.launch(\"jp.unext.mediaplayer/jp.co.unext.unextmobile.MainActivity\", true, false)\n\t\t\tclient.sleep(5000)\t\t\t\n\t\t\t$obj_slctv.andSelectiveTests(client, @logid, @passw, @ttype, @tcsno)\t\t\n\t\telse\n\t\t\tputs \"::MSG:: 該当デバイスが見つかりません「Confirm target test devcie」\"\n\t\tend\t\t\n\tend", "def setup\n @controller = ImpasseTestCaseController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n User.current = nil\n end", "def new_api\n load_config\n require 'extensions/metasploit/extension.rb'\n @api = BeEF::Extension::Metasploit::RpcClient.instance\n @api.unit_test_init()\n end", "def fixture_path\n File.expand_path('../fixtures', __FILE__)\nend", "def initialize_valid_environment\n require_box(\"default\")\n\n assert_execute(\"vagrant\", \"box\", \"add\", \"base\", box_path(\"default\"))\n assert_execute(\"vagrant\", \"init\")\n end", "def setup\n RedmineEvm::TestCase.prepare\n\n @controller = BaselinesController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n User.current = nil\n end", "def initialize(test_path)\n @spec = ::Utils.load_spec_yaml_file(test_path)\n @description = File.basename(test_path)\n @data = @spec['data']\n end", "def setup\n @tracer = $tracer\n @test_id = format \"%032x\", rand(0x100000000000000000000000000000000)\n refute_nil @tracer, \"You do not have an active tracer to run the tests.\"\n super\n end", "def setup_default_fixtures(files = ['sample_actors' , 'users', 'wiki_entries'])\n Fixtures.reset_cache\n files.each do |f|\n Fixtures.create_fixtures( File.dirname(__FILE__) + '/../fixtures' , File.basename( f , '.*'))\n end\nend", "def fixture(name)\n tempfile = Tempfile.new(\"car_store\")\n tempfiles << tempfile\n\n tempfile.write(File.read(fixture_path_for(name)))\n tempfile.close\n\n CarStore.new(tempfile.path)\n end", "def load_fixtures(name)\n data = YAML.load_file File.join(File.dirname(__FILE__), \"#{name}.yml\")\n # hmm, how do I dynamically add instance variables? data.each { |k,v| @`k` = User.new data[k] }\n @user_1 = User.new data['user_1']\n @user_2 = User.new data['user_2']\n end", "def fixture(file)\n File.new(fixture_path + '/' + file)\nend", "def main_variable\r\n super\r\n # Load Database\r\n main_database\r\n # Continue Enabled Test\r\n main_test_continue\r\n end", "def setup\n unless @admin_session.log_in('[email protected]', 'mit')\n unless @admin_session.sign_up('[email protected]', 'mit')\n raise 'Failed to sign up [email protected]'\n end\n unless @admin_session.log_in('[email protected]', 'mit')\n raise 'Failed to log in after signing up [email protected]'\n end\n end\n unless @admin_session.view_course_home(@course)\n unless @admin_session.create_course(@course)\n raise 'Failed to create course'\n end\n end\n\n @staff_session = LoadTestSession.new @root_url\n unless @staff_session.log_in('[email protected]', 'mit')\n unless @staff_session.sign_up('[email protected]', 'mit')\n raise 'Failed to sign up [email protected]'\n end\n unless @staff_session.log_in('[email protected]', 'mit')\n raise 'Failed to log in after signing up [email protected]'\n end\n unless @staff_session.register_staff(@course)\n raise 'Failed to register [email protected] as course staff'\n end\n unless @admin_session.approve_staff_requests(@course) >= 1\n raise 'Failed to approve [email protected] as course staff'\n end\n end\n\n assignment_id = nil\n unless assignments = @staff_session.list_assignments(@course)\n raise 'Failed to list course assignments'\n end\n unless assignment_id = assignments['Load Lab']\n analyzer_path = File.expand_path(\n '../../fixtures/files/analyzer/fib_small.zip', __FILE__)\n unless assignment_id = @staff_session.create_load_test_assignment(\n @course, 'Load Lab', analyzer_path)\n raise 'Failed to create load test assignment'\n end\n unless @staff_session.release_assignment(@course, assignment_id)\n raise 'Failed to release load test assignment'\n end\n end\n\n @assignment_id = assignment_id\n end", "def setup\n @spanner = $spanner\n\n refute_nil @spanner, \"You do not have an active spanner to run the tests.\"\n\n super\n end", "def dup_fixture( name = :all_valid )\n fixture = prospects(:all_valid)\n fixture.directory_id = SecureRandom.hex\n fixture\n end", "def setup\n\t\t\t\tp \"mytest1 setup\"\n\t\tend", "def test_setup\r\n \r\n end", "def load_instance_test_data()\n # todo: cache this , maybe Thread.current for now...\n @id = nil\n\n test_instance_id = ENV['TEST_INSTANCE_ID']\n if test_instance_id\n # use the first container in our test instance\n @instance = client.instances.get(test_instance_id.to_i)['instance']\n # rescue ::RestClient::Exception => e on 404\n assert_not_nil @instance, \"Test instance #{test_instance_id} was not found!\"\n @container = client.containers.get(@instance['containers'].first)['container']\n @id = @instance['id']\n end\n assert_not_nil @id, \"A test instance must be specified to run this test.\\nTry setting environment variable TEST_CONTAINER_ID=42 or TEST_INSTANCE_ID=99\"\n end", "def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end", "def setup(description=\"TBD\")\n TestReport.instance.setDescription(description)\n\n @tStart=Time.now()\n @completed=false\n end" ]
[ "0.65191954", "0.6358325", "0.6358325", "0.6183893", "0.6068099", "0.6045242", "0.60291266", "0.5987103", "0.594738", "0.59457403", "0.59385556", "0.5936135", "0.5900184", "0.5895851", "0.5873116", "0.5852402", "0.5852402", "0.58331805", "0.5822116", "0.58208686", "0.58043283", "0.5792275", "0.5790633", "0.5782286", "0.57543427", "0.5751953", "0.57407886", "0.57404816", "0.57198656", "0.5717815", "0.57116294", "0.56939226", "0.5690606", "0.5688698", "0.5680766", "0.5675656", "0.56748056", "0.5671498", "0.56693614", "0.5669149", "0.5658756", "0.5656545", "0.5653573", "0.5635407", "0.56327784", "0.5629617", "0.56291413", "0.56189185", "0.56164455", "0.5601025", "0.55977803", "0.55919635", "0.55782765", "0.55748796", "0.55705667", "0.55673563", "0.5558785", "0.5551685", "0.55511296", "0.5549698", "0.5539128", "0.5537932", "0.5535123", "0.5533857", "0.55265975", "0.55245245", "0.5508232", "0.550378", "0.5502245", "0.5501605", "0.54992986", "0.54977095", "0.54965", "0.54956394", "0.54952264", "0.54951155", "0.54951155", "0.54791546", "0.5477764", "0.5473234", "0.54682124", "0.5467926", "0.545666", "0.54565275", "0.54550475", "0.54537904", "0.544615", "0.54447633", "0.5433265", "0.54323083", "0.5426463", "0.54216605", "0.54159933", "0.5412593", "0.54023504", "0.5396671", "0.53966665", "0.53932315", "0.5392696", "0.5392686" ]
0.54279715
90
initialize reportium client TODO: (optional) Define a project, job and context tags for one or more tests.
def create_reportium_client cf1 = CustomField.new("test", "sample") cf2 = CustomField.new("tester", @user) perfectoExecutionContext = PerfectoExecutionContext.new( PerfectoExecutionContext::PerfectoExecutionContextBuilder .withProject(Project.new('Reporting SDK Ruby', '1')) # Optional .withJob(Job.new('Ruby Job', 2).withBranch("branch-ruby")) # Optional .withContextTags('Test tag1', 'Test tag2', 'Test tag3') # Optional .withCustomFields(cf1, cf2) # Optional .withWebDriver(@driver) .build) @reportiumClient = PerfectoReportiumClient.new(perfectoExecutionContext) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_reportium_client\n perfectoExecutionContext = PerfectoExecutionContext.new(\n PerfectoExecutionContext::PerfectoExecutionContextBuilder\n .withProject(Project.new('Reporting SDK Ruby', '1')) # Optional\n .withJob(Job.new('Ruby Job', 1)) # Optional\n .withContextTags('Tag1') # Optional\n .withWebDriver(@driver)\n .build)\n\n PerfectoReportiumClient.new(perfectoExecutionContext)\n end", "def initialize(report)\n @report = report\n\n init\n end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def setup\n capabilities = {\n platformName: 'Windows',\n platformVersion: '10',\n browserName: 'Chrome',\n browserVersion: '58',\n resolution: '1280x1024',\n securityToken: @@token\n }\n _url = 'http://' + @@Host + '/nexperience/perfectomobile/wd/hub/fast'\n\n @driver = Selenium::WebDriver.for(:remote, :url => _url, :desired_capabilities => capabilities)\n @reportiumClient = create_reportium_client\n end", "def initialize(income_expense_report)\n init_chart_labels(income_expense_report)\n init_graphs(income_expense_report)\n #do_test()\n end", "def initialize(report)\n @report = report\n end", "def initialize(report:, root:)\n @report = report\n @root = root\n end", "def initialize(xml, client)\n @tags ||= Hash.new\n @metrics ||= Hash.new\n @doc ||= Nokogiri::XML(xml)\n @client = client\n\n init_tags\n init_metrics\n init_custom_metrics\n end", "def initialize(suite)\n @suite = suite\n end", "def initialize()\r\n buildProperties = parse([BUILD_PROPERTIES, LOCAL_PROPERTIES]);\r\n testProperties = parse([TEST_PROPERTIES, LOCAL_PROPERTIES]);\r\n @app_host = testProperties[\"config_appHost\"]\r\n @module_html = buildProperties[\"config_appStartupUrl\"]\r\n @base_url = self.app_host + \"/\" + self.module_html\r\n @admin_user = testProperties[\"config_credentialsAdmin\"]\r\n @normal_user = testProperties[\"config_credentialsUser\"]\r\n @browser = testProperties[\"config_capybaraSeleniumBrowser\"]\r\n @browserPath = testProperties[\"config_capybaraSeleniumBrowserPath\"]\r\n @defaultAjaxWaitTime = testProperties[\"config_defaultAjaxWaitTime\"]\r\n end", "def initialize(browser = :firefox)\n # @server = server\n @browser = browser\n @test_data = get_test_data\n @answer_json=Array.new\n setup\n end", "def initialize(title: 'Testcase', browser: 'ie11', id: nil)\n # call the test case super method\n super(title: title, id: id)\n @browsertype = browser\n @report.driver = @browsertype\n end", "def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @brand = \"\"\n @type = \"\"\n @bank_name = \"\"\n @level = \"\"\n @iin = \"\"\n @last_4_digits = \"\"\n @exp_month = 0\n @exp_year = 0\n @metadata = Hash.new\n @sandbox = false\n @created_at = \"\"\n \n end", "def initialize(project)\n @name = project.at_xpath('name').text\n @type = project.at_xpath('type').text\n @connection = project.at_xpath('connection').text\n\n @tag = 'master'\n tag_element = project.at_xpath('tag')\n @tag = tag_element.text unless tag_element.nil?\n\n webview_url_element = project.at_xpath('webview-url')\n @webview_url = default_webview_url\n @webview_url = webview_url_element.text unless webview_url_element.nil?\n\n @exclude_pattern = []\n project.xpath('exclude-pattern').each do |ep|\n @exclude_pattern.push(ep.text)\n end\n\n @report_diff = nil\n end", "def initialize(project, client)\n @project = project\n @client = client\n end", "def initialize()\n @sel = Capybara::Session.new(:selenium)\n end", "def initialize\n envConfigFile = \"#{$ROOT}/../config/envConfig.yml\"\n @envConfig = loadYAMLFile(envConfigFile)\n stepsFile = \"#{$ROOT}/../config/steps.csv\"\n @steps = loadCSVFile(stepsFile)\n pageObjectsFile = \"#{$ROOT}/../config/pageObjects.csv\"\n @pageObjects = loadCSVFile(pageObjectsFile)\n @reportFolder = generatedReportFolder\n @isProcess = true\n @skipCurrentStep = false\n @report = []\n end", "def initialize project, credentials, timeout: nil, client_config: nil\n @project = project\n @credentials = credentials\n @timeout = timeout\n @client_config = client_config || {}\n end", "def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @g_suite_add_ons_stub = ::Google::Cloud::GSuiteAddOns::V1::GSuiteAddOns::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end", "def initialize(project_name, client)\n @project_name = project_name\n @client = client\n end", "def initialize(driver)\n @driver = driver\n @utills = WebDriverUtils.new(@driver)\n end", "def initialize(credentials)\n self.client ||= FbGraph::Application.new(credentials[:id], secret: credentials[:secret])\n self.test_users = []\n end", "def initialize(project, client: GitlabClient)\n @project = project\n @client = client\n end", "def initialize(*args)\n super\n @logger = Logger.new('automation_client.log')\n @ch = ClientHelper.new(@logger)\n @machine_name = @ch.get_machine_name\n @os_hash = @ch.get_os_information\n @browser_hash = @ch.get_browser_information\n @ip_address = @ch.get_ip_address\n end", "def initialize with_username=nil, and_password=nil, and_project_id=nil\n raise \"Configuration not found\" unless Pv.config.present?\n\n @username = with_username || Pv.config.username\n @password = and_password || Pv.config.password\n @token = PivotalTracker::Client.token(username, password)\n\n @project = begin\n project_id = and_project_id || Pv.config.project_id\n PivotalTracker::Project.all.select { |p| p.id == project_id }.first if @token.present?\n end\n\n raise \"Project ##{and_project_id} not found.\" if @project.nil?\n\n PivotalTracker::Client.use_ssl = true\n end", "def initialize(name = nil)\r\n super(name) unless name.nil?\r\n\r\n host = 'LABNAME.perfectomobile.com'\r\n @user = 'Your UserName'\r\n pass = 'Your PW'\r\n\r\n # device capabilities:\r\n capabilities = {\r\n :platformName => 'Android',\r\n :model => '',\r\n :platformVersion => '',\r\n :browserName => 'mobileOS',\r\n :browserVersion => '',\r\n :deviceName => '',\r\n :user => @user,\r\n :password => pass\r\n }\r\n\r\n # create a new driver instance\r\n @driver = Selenium::WebDriver.for(:remote, :url => 'http://' + host + '/nexperience/perfectomobile/wd/hub', :desired_capabilities => capabilities)\r\n\r\n # create new reportium client\r\n create_reportium_client\r\n end", "def initialize(client, session, server, port)\n url = build_url(API, server || Puppet[:report_server], port || Puppet[:report_port])\n super(client, session, url)\n end", "def initialize(options = {})\n options = { :logger => Jamie.logger }.merge(options)\n validate_options(options)\n logger = options[:logger]\n\n @suite = options[:suite]\n @platform = options[:platform]\n @driver = options[:driver]\n @jr = options[:jr]\n @logger = logger.is_a?(Proc) ? logger.call(name) : logger\n\n @driver.instance = self\n setup_driver_mutex\n end", "def initialize(issue, project, client)\n @issue = issue\n @project = project\n @client = client\n end", "def initialize(report=true, server_wait_time=3)\n @server_wait_time = server_wait_time\n @server_process = nil\n @reporting = report\n end", "def initialize(report)\n @report = report\n @document = Prawn::Document.new(:page_layout => :landscape,\n :top_margin => in2pt(1),\n :bottom_margin => in2pt(1))\n\n @document.float { draw_graphs }\n\n draw_header\n draw_summary_table\n end", "def initialize(context, *args)\n @context = context\n @result = nil\n builder_setup(*args)\n end", "def initialize_exec_report(*src)\n @exec_report = ExecReport.new(*src)\n end", "def initialize(ya_auth,report_info)\n @status_report=report_info[:StatusReport]\n @report_id=report_info[:ReportID]\n @status_report=report_info[:StatusReport]\n @url=report_info[:Url]\n \n @ya_auth=ya_auth\n end", "def initialize(username, password, site)\n # This library uses the gem called 'jira-ruby' which provides the library 'jira'.\n # Not to be confused with the gem called 'jira'. Be careful out there.\n Pkg::Util.require_library_or_fail('jira', 'jira-ruby')\n\n # Construct a jira client\n options = self.class.jira_client_options(username, password, site)\n options[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_PEER\n # only get OpenSSL through the jira library so leave it out of the class method\n @client = JIRA::Client.new(options)\n end", "def initialize_driver\n if ENV['browser'] == \"\"\n browser_sym = @config.browser.downcase.to_sym\n else\n browser_sym = ENV['browser'].downcase.to_sym\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 40 # seconds\n exec_mode = @config.execution_mode.to_s.downcase\n if exec_mode == \"local\"\n Selenium::WebDriver::Chrome.driver_path=\"#{File.dirname(__FILE__)}/drivers/chromedriver.exe\"\n $driver = Selenium::WebDriver.for(browser_sym, :http_client => client)\n elsif exec_mode == \"remote\"\n initializing_remote_web_driver browser_sym, client\n end\n end", "def initialize(username, password, verbose=false, debug=false, abort_license=false)\n @username, @password = username, password\n @verbose = verbose\n @debug = debug\n @current_period = \"Daily\" # default period in reportingitc interface\n @abort_license = abort_license\n end", "def initialize\n # Create an instance of the selenium driver.\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = 60 # default seconds to wait for responses from web requests to the application server\n @driver = Selenium::WebDriver.for(:chrome, :http_client => client, :listener => DemoSeleniumEventListener.new)\n end", "def initialize(driver)\n\t\tsuper\n\n\t\tself.driver = driver\n\tend", "def initialize_with_test_runner\n initialize_without_test_runner\n\n @test_priorities = {}\n @test_filters = Hash.new { |h, k| h[k] = [] }\n end", "def setup(description=\"TBD\")\n TestReport.instance.setDescription(description)\n\n @tStart=Time.now()\n @completed=false\n end", "def initialize\n self.client = Octokit::Client.new(\n login: \"tamouse\",\n password: WatchMyStuff::Configuration.two_fa\n )\n self.client.auto_paginate = true\n end", "def initialize(config:, connection:, logger:, version_requirement:, workspace_name:)\n self.complete_config = config.to_hash.merge upgrade_during_init: true, workspace_name: workspace_name\n self.connection = connection\n self.client_version = ::Gem::Version.new \"0.0.0\"\n self.logger = logger\n self.workspace_name = workspace_name\n self.workspace_new = ::Kitchen::Terraform::Command::WorkspaceNew.new config: complete_config\n self.workspace_select = ::Kitchen::Terraform::Command::WorkspaceSelect.new config: complete_config\n self.verify_version = ::Kitchen::Terraform::VerifyVersion.new(\n config: complete_config,\n logger: logger,\n version_requirement: version_requirement,\n )\n self.version = ::Kitchen::Terraform::Command::Version.new\n end", "def initialize(testing_template = TestingTemplate.new)\n @testing_template = testing_template\n end", "def initialize() \n\t\t@view_id = VIEW_ID\n\t\t@analytics = Google::Apis::AnalyticsreportingV4\n\t\tauth\n\tend", "def initialize_test\n self.multiruby_skip ||= []\n self.testlib ||= :testunit\n self.rspec_dirs ||= %w(spec lib)\n self.rspec_options ||= []\n end", "def initialize(*args)\n # profile, project, experiment\n if args.size == 3\n $PROJECT = args[0]\n $EXPERIMENT = args[1]\n $PROFILE = args[2]\n end\n end", "def initialize(opts)\n unless File.exists?(opts[:project])\n puts \"Cannot access project: #{opts[:project]}\"\n return\n end\n super # inits a gxdb ref from Discovery\n @project = opts[:project]\n @label = opts[:label]\n end", "def initialize(specs, test_specs, platform, requires_frameworks = false)\n @specs = specs\n @test_specs = test_specs\n @platform = platform\n @requires_frameworks = requires_frameworks\n end", "def initialize(opts = {})\n opts[:timeout] = 120 unless opts[:timeout]\n @wait = Selenium::WebDriver::Wait.new(:timeout=>opts[:timeout])\n TelluriumDriver.wait_for_document_ready=true;\n\n opts[:caps] ||= {}\n opts[:caps][:browserName] ||= opts[:browser]\n opts[:caps][:version] ||= opts[:version]\n\n is_local = !opts[:hub_ip] and !opts[:hub_url]\n \n if is_local\n @driver = Selenium::WebDriver.for(opts[:browser].to_sym,:desired_capabilities=>opts[:caps])\n else\n @driver = Selenium::WebDriver.for(:remote,:desired_capabilities=>opts[:caps],:url=> \"http://#{opts[:hub_ip]}:4444/wd/hub\")\n end\n end", "def test_0_before\n\t\t$report = Report.new()\n \t\t$testReport = $report.createReport($REPORT)\n\n\t\t$browser = Watir::Browser.new\n\t\t$current=\"\"\n\tend", "def initialize(runtime, io, options)\n if %w(BASE_URL USER PASSWORD).map{|e| ENV[\"TESTRAIL_#{e}\"]}.any?{|e| e=='' || !e}\n raise 'You need to setup Testrail environment parameters see https://bbcworldwide.atlassian.net/wiki/display/BAR/Installing+and+Running+Cukerail' \n end\n @testrail_api_client = TestRail::APIClient.new(ENV['TESTRAIL_BASE_URL'],ENV['TESTRAIL_USER'],ENV['TESTRAIL_PASSWORD'],ENV['TESTRAIL_PROXY_URL'],ENV['TESTRAIL_PROXY_PORT'])\n end", "def initialize(report)\n @report = report.is_a?(Hash) ? report : JSON.parse(report)\n end", "def initialize(cli, configuration, hooks, environment)\n @cli = cli\n @configuration = configuration\n @hooks = hooks\n @environment = environment\n @perform_hooks = false\n end", "def initialize project, credentials, retries: nil, timeout: nil, host: nil, quota_project: nil\n @project = project\n @credentials = credentials\n @retries = retries\n @timeout = timeout\n @host = host\n @quota_project = quota_project\n end", "def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @url = \"\"\n @name = \"\"\n @amount = \"\"\n @currency = \"\"\n @metadata = Hash.new\n @request_email = false\n @request_shipping = false\n @return_url = \"\"\n @cancel_url = \"\"\n @sandbox = false\n @created_at = \"\"\n \n end", "def initialize(config, game)\n @config = config\n @game = game\n auto_test_esp = \"#{@game.path}/Data/AutoTest.esp\"\n # Ordered list of available in-game test suites\n # Array<Symbol>\n @available_tests_suites =\n if File.exist?(auto_test_esp)\n Base64.decode64(\n ElderScrollsPlugin.new(auto_test_esp).\n to_json[:sub_chunks].\n find { |chunk| chunk[:decoded_header][:label] == 'QUST' }[:sub_chunks].\n find do |chunk|\n chunk[:sub_chunks].any? { |sub_chunk| sub_chunk[:name] == 'EDID' && sub_chunk[:data] =~ /AutoTest_ScriptsQuest/ }\n end[:sub_chunks].\n find { |chunk| chunk[:name] == 'VMAD' }[:data]\n ).scan(/AutoTest_Suite_(\\w+)/).flatten.map { |tests_suite| tests_suite.downcase.to_sym }\n else\n log \"[ In-game testing #{@game.name} ] - Missing file #{auto_test_esp}. In-game tests will be disabled. Please install the AutoTest mod.\"\n []\n end\n log \"[ In-game testing #{@game.name} ] - #{@available_tests_suites.size} available in-game tests suites: #{@available_tests_suites.join(', ')}\"\n end", "def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/ads/googleads/v8/services/campaign_experiment_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @campaign_experiment_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Ads::GoogleAds::V8::Services::CampaignExperimentService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end", "def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/dataproc/v1beta2/jobs_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.endpoint = @config.endpoint\n end\n\n @job_controller_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::Dataproc::V1beta2::JobController::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end", "def initialize( config, logger )\n @config = config\n @logger = logger\n\n @logger.debug \"Requested browser config: #{@config.get :global, :browser }\"\n\n [email protected] :global, :browser, :type\n [email protected] :global, :browser, :browser\n [email protected] :global, :browser, :port\n [email protected]_default false, :global, :browser, :url\n [email protected]_default false, :global, :browser, :extras\n if ! extra_capabilities\n extra_capabilities = Hash.new\n end\n\n if browser =~ %r{^\\s*ie\\s*$} or browser =~ %r{^\\s*internet\\s*_?\\s*explorer\\s*$}\n browser = 'internet explorer'\n end\n\n @logger.debug \"Launching some browser; #{type}, #{port}, #{browser}\"\n\n if type == 'remote'\n @logger.info \"Launching remote browser #{browser} on port #{port}\"\n capabilities = Selenium::WebDriver::Remote::Capabilities.new(\n :browser_name => browser,\n :javascript_enabled=>true,\n :css_selectors_enabled=>true,\n :takes_screenshot=>true,\n )\n # Load in any other stuff the user asked for\n @logger.debug \"Requested extra capabilities: #{extra_capabilities.inspect}\"\n extra_capabilities.each do |key, value|\n @logger.debug \"Adding capability #{key} with value #{value}\"\n capabilities[key] = value\n end\n\n if url\n @logger.debug \"Launching with custom url #{url}\"\n else\n url = \"http://127.0.0.1:#{port}/wd/hub\"\n end\n\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.timeout = config.get_default( 600, :global, :browser, :timeout )\n\n @browser = Watir::Browser.new(:remote, :url => url, :desired_capabilities => capabilities, :http_client => client)\n else\n @logger.info \"Launching local browser #{browser}\"\n @browser = Watir::Browser.new browser\n end\n end", "def initialize(open_report, output_types, output_directory)\n @open_report = open_report\n @output_types = output_types\n @output_directory = output_directory\n end", "def initialize\n @browsers = []\n @selenium_port = 4444\n @selenium_timeout = 4000\n @url = \"http://www.google.com\"\n @hooks = {:before => {}, :after =>{}}\n end", "def initialize(selenium_webdriver: (::Selenium::WebDriver.for DEFAULT_BROWSER, options: default_options))\n require \"selenium-webdriver\"\n @driver = selenium_webdriver\n end", "def initialize(config)\n @executable_path = config.executable_path\n @host = Platform.localhost\n @port = config.port\n @extra_args = config.args\n @io = config.log\n @shutdown_supported = config.shutdown_supported\n\n raise Error::WebDriverError, \"invalid port: #{@port}\" if @port < 1\n end", "def initialize(client)\n configuration = Configuration.new\n\n uri = URI.parse(client.options[:url])\n # base URL\n configuration.scheme = uri.scheme\n configuration.host = uri.to_s\n # SSL\n configuration.verify_ssl = client.options[:use_ssl].nil? ? true : client.options[:use_ssl]\n # Token\n configuration.api_key_prefix['api_key'] = 'Token'\n configuration.api_key['api_key'] = client.options[:token]\n # Debugging\n configuration.debugging = client.options[:debugging]\n configuration.logger = client.options[:logger]\n\n @api_client = ApiClient.new(configuration)\n # User Agent\n @api_client.user_agent = \"influxdb-client-ruby/#{InfluxDB2::VERSION}\"\n end", "def initialize project, credentials\n @connection = Connection.new project, credentials\n end", "def initialize(cfg,log)\n @cfg=cfg\n @log=log\n\n @log.info \"------------------------------------------------------------\"\n @log.info \"This is the test suite for restful API test!\"\n\n puts \"------------------------------------------------------------\"\n puts \"This is the test suite for restful API test!\"\n end", "def initialize(selenium, session)\n @selenium = selenium\n @parsed_selenium = URI.parse @selenium\n @session = session\n @elements = []\n @threads = []\n # defaults\n configure defaults\n end", "def initialize user_name, password, project_id = nil, folder_id = nil\n # setting up savon client, passing the wsdl address\n @client = Savon.client(wsdl: 'http://spirateam.ypg.com/Services/v4_0/ImportExport.svc?wsdl')\n #connecting to the service point\n #the complete list of the functions can be found at spira documentation pages.\n connection = @client.call(:connection_authenticate, message: {user_name: user_name, password: password})\n # saving cookies for further use, to avoid authentication every time\n @cookies = connection.http.cookies\n #retrieving the table which maps test names to the unique test IDs automatically generated by spira (can be found in test URL)\n if project_id != nil and folder_id != nil\n set_test_name_table(project_id, folder_id)\n @project_id = project_id\n end\n end", "def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend", "def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend", "def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n @rc_cfg = Red_Counter::Config.new\n end", "def initialize(config = nil)\n @config = config\n setup\n end", "def initialize(config, game)\n @config = config\n @game = game\n # Parse tests suites\n @tests_suites = Dir.glob(\"#{__dir__}/tests_suites/*.rb\").map do |tests_suite_file|\n tests_suite = File.basename(tests_suite_file, '.rb').to_sym\n require \"#{__dir__}/tests_suites/#{tests_suite}.rb\"\n [\n tests_suite,\n TestsSuites.const_get(tests_suite.to_s.split('_').collect(&:capitalize).join.to_sym).new(tests_suite, @game)\n ]\n end.to_h\n @tests_info_file = \"#{@game.path}/Data/Modsvaskr/Tests/TestsInfo.json\"\n end", "def initialize project, credentials, host: nil, timeout: nil\n @project = project\n @credentials = credentials\n @host = host\n @timeout = timeout\n @client_id = SecureRandom.uuid.freeze\n end", "def initialize(config)\n self.config = config\n fail 'SMTP is disabled.' unless config['report']['send_mail']\n config.verify do\n fail unless self['report']['server'].is_a? String\n fail unless self['report']['port'].is_a? Integer\n fail unless Xenuti::ReportSender.mail_address? self['report']['from']\n # smtp.to can be either mail address or Array of mail addresses\n if self['report']['to'].is_a?(Array)\n self['report']['to'].each do |e|\n fail unless Xenuti::ReportSender.mail_address?(e)\n end\n else\n fail unless Xenuti::ReportSender.mail_address?(self['report']['to'])\n end\n end\n end", "def initialize(*args)\n @entity, @period, @project_id, @with_details, @engine_version, @mocked_data, @simulate_draft = *args\n end", "def initialize(options = {})\n self.browser = options.fetch(:browser, :chrome)\n self.install_dir = options.fetch(:install_dir, './webdrivers/')\n self.locale = options.fetch(:locale, :en)\n self.headless = options.fetch(:headless, false)\n self.window_size = options.fetch(:window_size, '1280,720')\n self.screen_dir = options.fetch(:screen_dir, './screens/')\n self.log_prefix = options.fetch(:log_prefix, ' - ')\n self.verbose = options.fetch(:verbose, false)\n self.silent = options.fetch(:silent, false)\n self.auth_username = options.fetch(:auth_username, '')\n self.auth_password = options.fetch(:auth_password, '')\n self.main_label = caller_locations(2, 1).first.label\n\n initialize_driver\n\n self.timeout = options.fetch(:timeout, 30)\n end", "def initialize(suite, opts=nil)\n @suite = suite\n @inits = []\n @options = opts || {}\n @count = @options[:count] || Hash.new(0)\n @provided = [] # Array's set operations are the fastest\n @include_tags = @options[:include_tags] # nil is ok here\n @exclude_tags = @options[:exclude_tags] # nil is ok here\n include_states = @options[:include_states] # nil is ok here\n exclude_states = @options[:exclude_states] # nil is ok here\n @states = [nil, *BareTest::StatusOrder]\n @skipped = {}\n @last_run_states = {}\n @persistence = @options[:persistence]\n\n if (include_states || exclude_states) && !((include_states && include_states.empty?) && (exclude_states && exclude_states.empty?)) then\n [include_states, exclude_states].compact.each do |states|\n states << nil if states.include?(:new)\n states.push(:error, :skipped, :pending) if states.include?(:failure)\n states.delete(:new)\n if states.include?(:skipped) then\n states.delete(:skipped)\n states.push(:pending, :manually_skipped, :dependency_missing, :library_missing, :component_missing)\n end\n states.uniq!\n end\n @states = (include_states || @states) - (exclude_states || [])\n end\n\n (BareTest.extender+Array(@options[:extender])).each do |extender|\n extend(extender)\n end\n\n # Extend with the output formatter\n format = @options[:format]\n if format.is_a?(String) then\n require \"baretest/run/#{format}\"\n extend(BareTest.format[\"baretest/run/#{format}\"])\n elsif format.is_a?(Module) then\n extend(format)\n end\n\n # Extend with irb dropout code\n extend(BareTest::IRBMode) if @options[:interactive]\n\n # Initialize extenders\n @inits.each { |init| instance_eval(&init) }\n end", "def init_clients(environment=:development)\n env_config = self.config_for(environment)\n self.init_riak_client(env_config)\n end", "def initialize(project, component, version, user_namespace = 'common', threads = DEFAULT_THREADS)\n @repo = JXRepo.new(project, component, version, user_namespace)\n @threads = threads\n end", "def initialize(attrs)\n unless attrs.key?(:client_id) && attrs.key?(:password) && attrs.key?(:ssl_cert) && attrs.key?(:ssl_key)\n raise ArgumentError, 'client_id, password, ssl_cert and ssl_key are required'\n end\n if attrs.delete(:test) == true\n attrs[:server] ||= 'epp.test.smallregistry.net'\n attrs[:port] ||= 2700\n else\n attrs[:server] ||= 'epp.smallregistry.net'\n attrs[:port] ||= 700\n end\n @services = EPPClient::SCHEMAS_URL.values_at('domain', 'contact')\n super(attrs)\n @extensions << EPPClient::SCHEMAS_URL['sr']\n end", "def initialize(client)\n @client = client\n\n @id = \"\"\n @project = nil\n @customer = nil\n @token = nil\n @url = \"\"\n @authorized = false\n @name = \"\"\n @currency = \"\"\n @return_url = \"\"\n @cancel_url = \"\"\n @custom = \"\"\n @sandbox = false\n @created_at = \"\"\n \n end", "def initialize\n self.report = {}\n self.errors = 0\n self.failures = 0\n self.skips = 0\n self.test_count = 0\n self.assertion_count = 0\n self.verbose = false\n self.reporters = []\n\n @_source_cache = {}\n end", "def initialize project, credentials #:nodoc:\n @connection = Connection.new project, credentials\n end", "def initialize project, credentials, timeout: nil, host: nil\n @project = project\n @credentials = credentials\n @timeout = timeout\n @host = host\n end", "def initialize(project)\n @project = project\n end", "def initialize(**options)\n @config = Configuration.new(**options)\n @client = Client.new(config)\n end", "def initialize(driver, api)\n @driver = driver\n @api = api\n end", "def initialize(driver, api)\n @driver = driver\n @api = api\n end", "def initialize(driver, api)\n @driver = driver\n @api = api\n end", "def initialize(driver, api)\n @driver = driver\n @api = api\n end", "def initialize(driver, api)\n @driver = driver\n @api = api\n end", "def initialize(driver, api)\n @driver = driver\n @api = api\n end", "def init()\n @end_reg = /\\*+\\s*End testing\\s*\\*+/\n @start_reg = /\\*+\\s*Start testing\\s*\\*+/\n @test_logger = ::Logger.new(STDOUT)\n @test_logger.formatter = proc {|_severity, _datetime, _progname, msg|\n \"%s\\n\\r\" % [msg]\n }\n @in_tests = false\n @logs = []\n end", "def initialize(args = {})\n super({})\n\n defaults = {\n :title => 'Test Results',\n :erb_template => \"#{File.dirname(__FILE__)}/../templates/index.html.erb\",\n :reports_dir => ENV['MINITEST_HTML_REPORTS_DIR'] || 'test/html_reports',\n :mode => :safe,\n :output_filename => ENV['MINITEST_HTML_REPORTS_FILENAME'] || 'index.html',\n }\n\n settings = defaults.merge(args)\n\n @mode = settings[:mode]\n @title = settings[:title]\n @erb_template = settings[:erb_template]\n @output_filename = settings[:output_filename]\n reports_dir = settings[:reports_dir]\n\n @reports_path = File.absolute_path(reports_dir)\n end", "def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/analytics/data/v1alpha/analytics_data_api_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&\n [email protected](\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @analytics_data_stub = ::Gapic::ServiceStub.new(\n ::Google::Analytics::Data::V1alpha::AlphaAnalyticsData::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end", "def initialize_test\n self.multiruby_skip ||= []\n self.testlib ||= :minitest\n self.test_prelude ||= nil\n self.test_task = nil\n end", "def initialize(opts = {})\r\n opts = {\r\n agent: Mechanize.new,\r\n logger: Scrapers.default_logger,\r\n cache: {}\r\n }.merge!(opts)\r\n\r\n @logger = opts[:logger]\r\n @cache = opts[:cache]\r\n\r\n initialize_agent agent\r\n\r\n end", "def initialize suite, port, browsers, servers = %w[thin mongrel webrick]\n super()\n @suite, @port, @host, @servers = suite, port, 'localhost', servers\n browsers ||= Browser.subclasses.map { |browser| browser.new }\n browsers.map do |browser|\n Thread.new {\n sleep 1\n begin\n if browser.supported?\n browser.setup\n browser.visit uri + '/' + suite\n browser.teardown\n end\n end\n }\n end.push(Thread.new {\n begin\n $stderr.puts 'Started JSpec server at http://%s:%d' % [host, port.to_i]\n detect_rack_handler.run self, {:Host=> host, :Port=>port} do |server|\n trap 'INT' do\n server.respond_to?(:stop!) ? server.stop! : server.stop\n end\n end\n rescue Errno::EADDRINUSE\n raise \"Port #{port} already in use\"\n rescue Errno::EACCES\n raise \"Permission Denied on port #{port}\"\n end\n }).reverse.each { |thread| thread.join }\n end" ]
[ "0.7231719", "0.64077073", "0.62666726", "0.61997914", "0.60334265", "0.5982094", "0.5860028", "0.5849645", "0.57432866", "0.57388556", "0.5738355", "0.5736627", "0.56130695", "0.56057364", "0.55935335", "0.55742604", "0.5567461", "0.55624", "0.55622685", "0.5541658", "0.55393654", "0.55337626", "0.55214775", "0.5520405", "0.5506118", "0.5503403", "0.54985195", "0.54968685", "0.54800326", "0.5442369", "0.542787", "0.54144084", "0.53920513", "0.5380686", "0.5371422", "0.5358447", "0.53466344", "0.53186184", "0.5308873", "0.5299994", "0.529201", "0.5289226", "0.5280993", "0.5280805", "0.5278213", "0.52781284", "0.52767354", "0.5276546", "0.5274278", "0.5269946", "0.5265384", "0.5260483", "0.52574605", "0.52536076", "0.52482915", "0.5246597", "0.5243639", "0.5225478", "0.5220574", "0.5207938", "0.5204295", "0.51991105", "0.518831", "0.5185579", "0.51844585", "0.51836497", "0.5182226", "0.51791424", "0.517468", "0.5167934", "0.5167934", "0.51622397", "0.51583916", "0.515672", "0.5144786", "0.51369727", "0.51366717", "0.51320606", "0.51287323", "0.5117218", "0.51168597", "0.5111655", "0.5109585", "0.5107251", "0.51068157", "0.51064324", "0.5105971", "0.5105833", "0.5101272", "0.5101272", "0.5101272", "0.5101272", "0.5101272", "0.5101272", "0.5099665", "0.50973606", "0.5094533", "0.50927895", "0.5089851", "0.50865436" ]
0.72391236
0
setup method setup method runs before each test and indicate a reporting. add here additional before test settings.
def setup puts 'starting a new test: ' + self.name cfT1 = CustomField.new("testField", "kuku") cfT2 = CustomField.new("tester", "new_tester") @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder .withCustomFields(cfT1, cfT2) .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest') .build())) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n\n # Save the Global variable's original settings so that they can be changed in this\n # test without affecting other test, so long as they are restored by teardown\n @@VERBOSE_ORIG = $VERBOSE\n @@DEBUG_ORIG = $DEBUG\n @@FAST_SPEED_ORIG = $FAST_SPEED\n @@HIDE_IE_ORIG = $HIDE_IE\n\n @@tTestCase_StartTime = Time.now\n\n end", "def setup\n # override this if needed\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def test_setup\r\n \r\n end", "def setup\n\t\t\t\tp \"mytest1 setup\"\n\t\tend", "def setup\n\n end", "def setup\n\n end", "def setup\n # noop\n end", "def setup\n\t\tend", "def setup\n\t\tend", "def setup()\n end", "def setup(&block)\n before(:each, &block)\n end", "def setup\r\n end", "def before_setup\n # do nothing by default\n end", "def setup\n debug 'No custom setup defined'\n end", "def setup; 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 setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def before_setup; end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def before_test\n super\n\n # Need local variables for access within the scoped blocks below.\n logger = @logger\n config_manager = @config_manager\n # Configure RSpec.\n RSpec.configure do |c|\n # Need access to framework methods from within the RSpec examples.\n c.include Automation::Kernel\n # The formatter that will feed RSpec notification to the framework.\n c.add_formatter(Automation::Rspec::Formatter)\n # Before each \"it\"\n c.before(:each) do\n @logger = logger\n @config_manager = config_manager\n end\n end\n end", "def setup\n # override and do something appropriate\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n @tracer = $tracer\n @test_id = format \"%032x\", rand(0x100000000000000000000000000000000)\n refute_nil @tracer, \"You do not have an active tracer to run the tests.\"\n super\n end", "def setup(description=\"TBD\")\n TestReport.instance.setDescription(description)\n\n @tStart=Time.now()\n @completed=false\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\t\t# Do nothing\n\tend", "def setup\n\t\t# Do nothing\n\tend", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n true\n end", "def before_test(test); end", "def before_test(test); end", "def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n @rc_cfg = Red_Counter::Config.new\n end", "def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end", "def pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end", "def setup\n @suite.p \"\\n:: [SETUP]\\n\"\n # -- let's print the description of each test first:\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n @suite.p \"\\n [description] : \" + /^#.*@description(.*$)/.match(file_contents)[0].gsub(/^#.*@description/, '') + \"\\n\\n\" if /#{self.class.name}/.match(file_contents)\n }\n end", "def post_setup\n end", "def setup\n @dataset = $dataset\n @dataset_2 = $dataset_2\n\n refute_nil @dataset, \"You do not have an active dataset to run the tests.\"\n\n super\n end", "def setup(options); end", "def setup(options); end", "def setup\n # no setup\n\tend", "def setup\n # runs before every test\n # wipe and recreate .test directory, switch pwd \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n Dir.mkdir('.test')\n Dir.chdir('.test')\n end", "def setup\n yield self\n self\n end", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def setup(*args) ; end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n @driver = get_driver\n @accept_next_alert = true\n @verification_errors = [] \n end", "def setup\n # Do nothing\n end" ]
[ "0.7665989", "0.7602157", "0.7579282", "0.7579282", "0.7579282", "0.7579282", "0.7579282", "0.75046855", "0.7496106", "0.74456644", "0.74456644", "0.7437333", "0.7412735", "0.7412735", "0.74116755", "0.7382381", "0.7377769", "0.73633325", "0.73255837", "0.7320916", "0.73183095", "0.73183095", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.72952527", "0.728838", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72729784", "0.72434026", "0.7229296", "0.7212663", "0.7212663", "0.7212663", "0.7212663", "0.7212663", "0.7212663", "0.71740305", "0.7154245", "0.7148862", "0.7148862", "0.7148862", "0.7144856", "0.7144856", "0.7129841", "0.7129841", "0.7129841", "0.7129841", "0.7129841", "0.7129841", "0.7129841", "0.7121259", "0.7079533", "0.7079533", "0.7075202", "0.70552516", "0.70545757", "0.69859254", "0.69807065", "0.69498026", "0.6905701", "0.6905701", "0.69014156", "0.6890509", "0.6849326", "0.6822075", "0.6789832", "0.67883575", "0.67883575", "0.67883575", "0.67883575", "0.67883575", "0.67883575", "0.67883575", "0.6770193" ]
0.77399427
0
End test method This method run after each test. If the test succeeded create a successful test report, Otherwise create a failure test report. Closing the current session.
def teardown if self.passed? @reportiumClient.testStop(TestResultFactory.createSuccess) else @reportiumClient.testStop(TestResultFactory.createFailure(@exception.message, @exception)) end puts '========================================================================================================================' puts 'report url: ' + @reportiumClient.getReportUrl puts '========================================================================================================================' @driver.close @driver.quit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_test(test_status)\n # Abstract\n end", "def end_test(test_status)\n # Abstract\n end", "def finish\n\t\t\twrite_log_to_file(@logfile)\n\t\t\twrite_xmlfile(@xmlfile)\n\t\t\tif @errcount > 0 or @warncount > 0 then\n\t\t\t\twrite_log_to_stdout\n\t\t\tend\n\t\t\tputs \"Test run finished (#{@errcount} errors, #{@warncount} warnings).\"\n\t\tend", "def testing_end\n end", "def teardown\n\t\tputs \"Completed unit test execution\"\n\tend", "def teardown\n if self.passed?\n @reportiumClient.testStop(TestResultFactory.createSuccess)\n\n else\n @reportiumClient.testStop(TestResultFactory.createFailure(@exception.message, @exception))\n\n end\n\n @driver.quit\n\n # Retrieve the URL to the DigitalZoom Report (= Reportium Application) for an aggregated view over the execution\n reportURL = @reportiumClient.getReportUrl\n\n # Retrieve the URL to the Execution Summary PDF Report\n reportPdfUrl = @driver.capabilities['reportPdfUrl']\n\n puts 'reportUrl='.concat reportURL\n\n # For detailed documentation on how to export the Execution Summary PDF Report, the Single Test report and other attachments such as\n # video, images, device logs, vitals and network files - see http://developers.perfectomobile.com/display/PD/Exporting+the+Reports\n\n end", "def report_end_test(test_status)\n @run_status.add_test_status(test_status)\n\n @listeners.each do |l|\n l.end_test(test_status)\n end\n end", "def teardown\n @report.close\n end", "def teardown\n\t\tputs 'teardown: '+ @test_name\n\n\t\[email protected]\n\t\[email protected]\n\tend", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def teardown\r\n\r\n # Calculate and record the elapsed time for the current test case\r\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime, true))\r\n\r\n # Check for any Errors\r\n #$browser.recover_from_error()\r\n\r\n # Check if the $browser needs to be closed\r\n # NOTE: RAutomation currently only runs on Windows\r\n if(@@bCloseBrowser == true)\r\n\r\n puts2(\"Attempting to close the current browser...\")\r\n if(($browser.link(:href => \"/logout\").exists?) and ($browser.link(:href => \"/logout\").visible?))\r\n puts2(\"Logging out...\")\r\n $browser.link(:href => \"/logout\").click\r\n sleep($iNetDelay) # Short delay before closing the browser\r\n end\r\n\r\n puts2(\"\\t Attempting to stop: \" + $sDefaultBrowser.downcase.strip)\r\n\r\n # Force any open $browsers to exit\r\n case $sDefaultBrowser.downcase.strip\r\n when /ie/\r\n $browser.exit_browsers(\"ie\")\r\n sleep($iNetDelay)\r\n when /firefox/\r\n $browser.exit_browsers(\"ff\")\r\n sleep($iNetDelay)\r\n when /safari/\r\n $browser.exit_browsers(\"safari\")\r\n sleep($iNetDelay)\r\n end\r\n\r\n if(@@bClearCache == true)\r\n puts2(\"Clear the $browser cache...\")\r\n clear_cache()\r\n\r\n # Turn it off again\r\n @@bClearCache == false\r\n end\r\n\r\n # Turn it off again\r\n @@bCloseBrowser = false\r\n\r\n end # Check if the $browser needs to be closed\r\n\r\n\r\n # Restore the Global variable's original settings\r\n $VERBOSE = @@VERBOSE_ORIG\r\n $DEBUG = @@DEBUG_ORIG\r\n $FAST_SPEED = @@FAST_SPEED_ORIG\r\n $HIDE_IE = @@HIDE_IE_ORIG\r\n\r\n puts2(\"#\"*40)\r\n\r\n end", "def teardown\n\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n\n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n\n # Flag indicating if a browser was started\n $bBrowserStarted = false\n\n end", "def teardown\n @suite.p \"\\n:: [TEARDOWN]\\n\"\n end", "def teardown\r\n\r\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\r\n\r\n # Restore the Global variable's original settings\r\n $VERBOSE = @@VERBOSE_ORIG\r\n $DEBUG = @@DEBUG_ORIG\r\n $FAST_SPEED = @@FAST_SPEED_ORIG\r\n $HIDE_IE = @@HIDE_IE_ORIG\r\n\r\n end", "def finish\n @test_output = @test_output.join.split(\"\\n\")\n @test_description = @test_output.shift\n end", "def teardown\n \n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n \n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n $Dictionary = @@Dictionary\n \n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def teardown\n\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n\n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n\n end", "def teardown\n\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n\n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n\n end", "def teardown\n\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n\n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n\n end", "def teardown\n\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n\n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n\n end", "def teardown\n\n puts2(\"\\nTestcase finished in \" + calc_elapsed_time(@@tTestCase_StartTime) + \" seconds.\")\n\n # Restore the Global variable's original settings\n $VERBOSE = @@VERBOSE_ORIG\n $DEBUG = @@DEBUG_ORIG\n $FAST_SPEED = @@FAST_SPEED_ORIG\n $HIDE_IE = @@HIDE_IE_ORIG\n\n end", "def done\n puts 'Done running tests'\n end", "def te_st_099_WIP\r\n\r\n sTestCase_Name = \"test_099_WIP\"\r\n puts2(\"Starting Testcase: #{sTestCase_Name}\")\r\n\r\n puts2(\"Close the window\")\r\n\r\n # Set the flag to close the $browser after the last test case runs\r\n @@bCloseBrowser = true\r\n\r\nend", "def testStop(testResult)\n\n params = {\n :success => testResult.isSuccessful\n }\n\n if !testResult.isSuccessful\n params['failureDescription'] = testResult.message\n params['failureReason'] = testResult.failureReason\n end\n\n executeScript($END_TEST_COMMAND, params)\n return true\n end", "def clean_exit\n passed = all_by_exit_status(@test_data['test_exit_message_passed'])\n failed = all_by_exit_status(@test_data['test_exit_message_failed'])\n skipped = all_by_exit_status(@test_data['test_exit_message_skipped'])\n @test_data.merge!({'execution_time' => @execution_time, 'passed' => passed, 'failed' => failed, 'skipped' => skipped})\n Publisher.new(@test_data).publish_reports\n puts(\"\\n==> DONE\\n\\n\")\n puts(\" -- execution time : #{@execution_time.to_s} secs\\n\")\n puts(\" -- tests executed : #{@executed_tests.to_s}\\n\")\n puts(\" -- reports prepared: #{@test_data['reports_dir']}\\n\")\n puts(\" -- tests passed : #{passed.length.to_s}\\n\")\n puts(\" -- tests failed : #{failed.length.to_s}\\n\")\n puts(\" -- tests skipped : #{skipped.length.to_s}\\n\")\n if (@test_data['test_retry'] > 0)\n puts(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n end\n if failed.length > 0\n puts(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n exit(1)\n end\n exit(0)\nend", "def teardown\r\n # Do nothing\r\n @driver.quit()\r\n @verification_errors\r\n end", "def test_finished(test_case, test_result)\n endpoint = DrbEndpoint.new(\"localhost:#{TestBase::DRUBY_REPORTER_PORT}\")\n reporter = endpoint.create_client(with_object: nil)\n reporter.report_test_finished(\"#{test_case.class}::test_#{test_result.name}\", test_result)\n end", "def clean_exit\n\ttasks_passed = all_by_exit_status(@task_data['test_exit_status_passed'])\n\ttasks_failed = all_by_exit_status(@task_data['test_exit_status_failed'])\n\ttasks_skipped = all_by_exit_status(@task_data['test_exit_status_skipped'])\n @task_data.merge!({'execution_time' => @chain.execution_time, 'tasks_passed' => tasks_passed, 'tasks_failed' => tasks_failed, 'tasks_skipped' => tasks_skipped})\n \n\tPublisher.new(@task_data).publish_reports\t \n\t\n if tasks_failed.length == 0\n\t\tputs \"[TCRESULT]=SUCCESSFUL\\n\"\n\telse\n\t\tputs \"[TCRESULT]=UNSUCCESSUL\\n\"\n\tend\n\t\n\tputs(\"\\n==> DONE\\n\\n\")\n puts(\"[ :: [SESSION]\\n\")\n puts(\"[TC] -- tests passed : #{tasks_passed.length.to_s}\\n\")\n puts(\"[TC] -- tests failed : #{tasks_failed.length.to_s}\\n\")\n puts(\"[TC] -- tests executed : #{@chain.executed_tasks.to_s}\\n\")\n puts(\"[TC] -- tests skipped : #{tasks_skipped.length.to_s}\\n\") \n puts(\"[TC] -- execution time : #{@chain.execution_time.to_s} secs\\n\")\t\n\tputs(\" -- reports prepared: #{@reports_dir}\\n\")\n puts(\" -- logs prepared : #{@logs_dir}\\n\")\n\t\n\tputs(\"[TC] The test run contained the following tasks :\\n\")\n\[email protected]_tasknames.each do |taskname|\n\t\tputs(\"[TC] -> #{taskname}\\n\")\t\n\tend\n\t\t\n\tif @task_data['test_retry']\n\t\tputs(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n\tend\n\tif tasks_failed.length > 0\n\t\tputs(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n\t\texit(1)\n\tend\n\texit(0)\nend", "def teardown\n #@driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n time = Time.new\n\n if passed?\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.#{__method__.to_s}: PASS\\n\"\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.#{__method__.to_s}: PASS\\n\".green\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.#{__method__.to_s}: \" + \"PASS\\n\".green\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.to_s}.#{__method__.to_s}: PASS\\n\"\n else\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.#{__method__.to_s}: FAIL\\n\"\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.#{__method__.to_s}: FAIL\\n\".red\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.#{__method__.to_s}: \" + \"FAIL\\n\".red\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.to_s}.#{__method__.to_s}: FAIL\\n\"\n\n # take screenshot at end of test, useful for failures/errors\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/Screenshots/' + @method_name + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + self.inspect.to_s + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + __callee__.to_s + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + __method__.to_s + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/Screenshots/' + \"[#{self.class.name}\" + '#' + \"#{__method__.to_s}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/Screenshots/' + \"[#{self.class.to_s}\" + '#' + \"#{__method__.to_s}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #time += 1\n #@@b.screenshot.save(File.dirname(__FILE__) + '/Screenshots/' + \"[#{self.class.name}\" + '#' + \"#{__method__.to_s}]\" + '_' + (Time.new + 1).strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.screenshot.save(File.dirname(__FILE__) + '/Screenshots/' + \"[#{self.class.to_s}\" + '#' + \"#{__method__.to_s}]\" + '_' + (Time.new + 1).strftime('%Y%m%d_%H%M%S') + '.png');\n\n#=begin\n @@b.driver.save_screenshot(File.dirname(__FILE__) + '/Screenshots/' + \"[#{self.class.name}\" + '#' + \"#{method_name}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n #@@b.driver.save_screenshot(File.dirname(__FILE__) + '/Screenshots/' + \"[#{self.class.to_s}\" + '#' + \"#{method_name}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png');\n#=end\n\n #puts File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + \"[#{self.class.name}\" + '#' + \"#{__method__.to_s}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png\\n'\n #puts File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + \"[#{self.class.to_s}\" + '#' + \"#{__method__.to_s}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png\\n'\n puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.name}.teardown: Screenshot saved to \" + File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + \"[#{self.class.name}\" + '#' + \"#{method_name}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png' + \"\\n\"\n #puts \"#{time.strftime('%Y.%m.%d %H:%M:%S')} - #{self.class.to_s}.teardown: Screenshot saved to \" + File.dirname(__FILE__) + '/' + 'Screenshot' + '_' + \"[#{self.class.to_s}\" + '#' + \"#{method_name}]\" + '_' + time.strftime('%Y%m%d_%H%M%S') + '.png' + \"\\n\"\n end\n\n time = Time.new\n File.open(File.dirname(__FILE__) + '/' + 'Results' + '/' + 'results.csv', 'a+'){|f|\n f << time.strftime('%Y%m%d') + \";\"\n f << time.strftime('%H%M%S') + \";\"\n f << \"#{self.class.to_s}\" + '#' + \"#{method_name}\" + \";\"\n f << (passed? ? \";\" : \"#{@message};\")\n f << (passed? ? \"PASS;\" : \"FAIL;\")\n f << \"\\n\"\n }\n end", "def report_end_run\n @run_status.finalize_run\n\n @listeners.each do |l|\n l.end_run(@run_status)\n end\n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def close_browser\n Logbook.step('Stop webdriver. The End of a test:)')\n @browser.quit\n Logbook.publish_results\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def teardown\n @driver.quit\n assert_equal [], @verification_errors\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def on_test_run_finished(event)\n print_cucumber_failures\n end", "def teardown\n signout\n @driver.quit\n assert_equal [], @verification_errors\n end", "def close(_notification)\n require 'rexml/document'\n xml_output = REXML::Document.new\n xml_output.add(REXML::XMLDecl.new)\n\n testsuites = REXML::Element.new('testsuites')\n xml_output.add(testsuites)\n\n @output_hash[:profiles].each do |profile|\n testsuites.add(build_profile_xml(profile))\n end\n\n formatter = REXML::Formatters::Pretty.new\n formatter.compact = true\n output.puts formatter.write(xml_output.xml_decl, '')\n output.puts formatter.write(xml_output.root, '')\n end", "def cleanup_with_test_runner\n cleanup_without_test_runner\n\n if defined? @run_result\n # Any tests that are still \"running\" are marked as complete.\n # Their results are set to \"unknown\" too.\n test_results = @test_database.get_running_test_results(@run_result)\n test_results.each do |test_result|\n test_result.status = Status::Complete\n test_result.result = Result::Unknown\n test_result.save\n end\n end\n end", "def close(_notification)\n # when the profile has no controls or examples it will not have been printed.\n # then we want to ensure we print all the profiles\n print_last_control_with_examples unless last_control_is_anonymous?\n output.puts ''\n print_anonymous_examples_associated_with_last_profile\n print_profiles_without_examples\n print_profile_summary\n print_tests_summary\n end", "def summary_at_exit\n reporter = Speciny::Reporter.new(@description)\n @tests.each do |example, result|\n reporter.print_test_result(example, result)\n end\n end", "def test_03()\n\t\tputs \"Inside test 3\"\n\t\t$browser.stop\n\t\t\n\tend", "def clean_exit\n\ttasks_passed\n tests_passed = all_by_exit_status(@task_config['test_exit_status_passed'])\n tests_failed = all_by_exit_status(@task_config['test_exit_status_failed'])\n tests_skipped = all_by_exit_status(@task_config['test_exit_status_skipped'])\n testcases_total = all_testcase_in_tests\n testcases_passed = all_passing_testcase_in_tests\n verifications = all_verifications_in_tests\n verifications_passed = all_passed_verifications_in_tests\n \n @task_config.merge!({'execution_time' => @execution_time, 'tests_passed' => tests_passed, 'tests_failed' => tests_failed, 'tests_skipped' => tests_skipped, 'testcases_total' => testcases_total, 'testcases_passed' => testcases_passed, 'verifications' => verifications, 'verifications_passed' => verifications_passed})\n \n\t \n\t #Publisher.new(@task_config).publish_reports\n \n\t \n\t \n\t puts(\"\\n==> DONE\\n\\n\")\n puts(\":: [SESSION]\\n\")\n puts(\" -- reports prepared: #{@task_config['reports_dir']}\\n\")\n puts(\" -- execution time : #{@execution_time.to_s} secs\\n\")\n puts(\" -- tests executed : #{@executed_tests.to_s}\\n\")\n puts(\" -- tests passed : #{tests_passed.length.to_s}\\n\")\n puts(\" -- tests failed : #{tests_failed.length.to_s}\\n\")\n puts(\" -- tests skipped : #{tests_skipped.length.to_s}\\n\")\n puts(\" -- cases total : #{testcases_total.to_s}\\n\")\n puts(\" -- cases passed : #{testcases_passed.to_s}\\n\")\n puts(\" -- verifications : #{verifications.to_s}\\n\")\n puts(\" -- verify passed : #{verifications_passed.to_s}\\n\")\n \n if @task_config['test_retry']\n puts(\" -- tests re-tried : #{@tests_retried_counter.to_s}\\n\")\n end\n if tests_failed.length > 0 || verifications_passed != verifications\n puts(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n exit(1)\n end\n exit(0)\nend", "def finish\n close_agent\n end", "def teardown(&block)\n if @test\n @test.teardowns.last << block\n else\n raise \"Cannot teardown: not in a test\"\n end\nend", "def report(test)\n fire_event(:test, Test.new(test))\n test.run(@report)\n fire_event(:pass, PassedTest.new(test))\n rescue Pending => e\n fire_event :pending, PendingTest.new(test, e)\n rescue AssertionFailed => e\n fire_event :failure, FailedTest.new(test, e)\n exit 1 if Protest.fail_early?\n rescue Exception => e\n raise if e.is_a?(Interrupt)\n fire_event :error, ErroredTest.new(test, e)\n exit 1 if Protest.fail_early?\n end", "def test_finished(source, *args)\n test = source.test\n suite_name, test_name = _test_details(test)\n\n @manager.allure_stop_test(suite_name, test_name)\n end", "def test_end_fail\r\n \t@test_prospector.move_count = 1\r\n \tassert_equal false, @test_prospector.end?\r\n end", "def on_test_case_finished(event)\n failure_details = cucumber_model.failure_details(event.result)\n status = ALLURE_STATUS.fetch(event.result.to_sym, Allure::Status::BROKEN)\n lifecycle.update_test_case do |test_case|\n test_case.stage = Allure::Stage::FINISHED\n test_case.status = event.result.failed? ? Allure::ResultUtils.status(event.result&.exception) : status\n test_case.status_details.flaky = event.result.flaky?\n test_case.status_details.message = failure_details[:message]\n test_case.status_details.trace = failure_details[:trace]\n end\n lifecycle.stop_test_case\n lifecycle.stop_test_container\n end", "def after_teardown; end", "def teardown\n puts 'Exit'\n @web_driver.quit\n end", "def teardown\n @driver.quit \n end", "def teardown\n log_useful_data\n @browser.quit\n self.result.record_data('screenshots', @screenshots)\n end", "def after_teardown # I reset sessions here so capybara-screenshot can still make screenshots when tests fail\n super(); Capybara.reset_sessions!\n end", "def teardown\n @driver.quit()\n end", "def teardown\n # Do nothing\n @driver.quit\n @sitePerformance.close\n end", "def teardown\n assertGreaterThan @@assertions, @assertions, 'Test should make assertions'\n end", "def teardown\n @driver.quit\n end", "def on_test_run_finished(_event)\n lifecycle.write_environment\n end", "def after_features(*args)\n @scenarios = failed_and_passed\n JiraInterface.new.report(formatted_scenarios)\n end", "def teardown\r\n # Do nothing\r\n @driver.quit\r\n end", "def stop_test(test)\n puts \"Test was stopped mid execution: #{test.uri}\"\n end", "def teardown\n @driver.close\n @driver.quit\n end", "def end_run(run_status)\n # Abstract\n end", "def end_run(run_status)\n # Abstract\n end", "def write_report!\n notify.critical_error(\"Must run `test!` before writing a report\") if test.status.nil?\n in_test_dir do\n self.writer = GitTest::Writer.new(:path => report_path,\n :name => report_name,\n :report => test.report )\n in_report_branch do\n writer.save!\n commit_to_test_proj!\n end\n end\n end", "def master_done!\n @done = true\n specification! true\n summarize_performance!\n \t\tsummarize_results! @results\n \t\tcleanup!\n \t\t#Notify.completed @experiment\n\n \t\t#sleep 1\n #DRb.stop_service\n end", "def quit()\n $webdriver.quit()\n cleanUp();\n $webdriver = nil;\n TestAttributes.put(\"reuseFixture\", null);\n end", "def flexmock_teardown\n flexmock_verify unless flexmock_test_has_failed?\n ensure\n flexmock_close\n end", "def teardown\n @fox_driver.quit\n end", "def teardown\n end", "def teardown\n end", "def stop_test_case\n return logger.error { \"Could not stop test case, no test case is running\" } unless @current_test_case\n\n logger.debug { \"Stopping test case: #{@current_test_case.name}\" }\n @current_test_case.stop = ResultUtils.timestamp\n @current_test_case.stage = Stage::FINISHED\n file_writer.write_test_result(@current_test_case)\n clear_current_test_case\n clear_step_context\n end", "def after\n end", "def clean_exit\n\ttasks_passed = all_by_exit_status(@task_data['test_exit_status_passed'])\n\ttasks_failed = all_by_exit_status(@task_data['test_exit_status_failed'])\n\ttasks_skipped = all_by_exit_status(@task_data['test_exit_status_skipped'])\n\ttasks_error \t = all_by_exit_status(@task_data['test_exit_status_error'])\n\tnoelement_error\t = all_by_exit_status(@task_data['test_exit_status_noelement'])\n @task_data.merge!({'execution_time' => @taskchain.execution_time, 'tasks_passed' => tasks_passed, 'tasks_failed' => tasks_failed, 'tasks_skipped' => tasks_skipped, 'tasks_error' => tasks_error, 'test_exit_status_noelement' => noelement_error })\n \n\tPublisher.new(@task_data).publish_reports\t \n\t\n\tputs(\"\\n==> DONE\\n\\n\")\n puts(\"[ ::\\n\")\n puts(\"[ :: [SESSION]\\n\")\n\tputs(\"[ ::\\n\")\n\t# Team City Result\n @teamcity_result = tasks_failed.length == 0 && tasks_error.length == 0 && noelement_error.length == 0 ? \"[TCRESULT]=SUCCESSFUL\\n\" : \"[TCRESULT]=UNSUCCESSFUL\\n\"\n\tputs @teamcity_result\n\tputs(\"[ ::\\n\")\n\t\n\tputs(\"[TC] Target BIZ File : [#{@neo_bizfile}]\")\n printf(\"%-27s %s\\n\",\"[TC] -- tests passed:\", tasks_passed.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests failed:\", tasks_failed.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests executed:\",@taskchain.executed_tasks.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests skipped:\", tasks_skipped.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests error:\", tasks_error.length.to_s)\n printf(\"%-27s %s\\n\",\"[TC] -- tests no element:\", noelement_error.length.to_s)\n printf(\"%-27s %.2f %s\\n\",\"[TC] -- execution time:\", @taskchain.execution_time, \"secs\")\n\tprintf(\" -- reports prepared \\t: #{ENV[\"reports\"]}\\n\")\n printf(\" -- logs prepared \\t: #{ENV[\"LOGS\"]}\\n\")\n\t\n\tputs(\"[TC] Tasklist :\\n\")\t\t\n\[email protected]_array.each do |task|\n\t\tputs(\"[TC] \\t{#{task.taskname}}\\n\")\t\t\t\n\t\ttask.examples.each do |ex|\n\t\t\tputs(\"[TC] \\t\\t[#{ex} ]\\n\")\n\t\tend\n\tend\n\n\tif tasks_error.length > 0\n\t\tputs(\"\\n\\n==> STATUS: [ some tests failed - execution failed ]\\n\")\n\t\texit(1)\n\telse\n\t\texit(0)\n\tend\nend", "def finish\r\n #\r\n end", "def test_010\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n #Pu created\n\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n # test master of PJ is not registered\n assert is_text_present(_(\"Details of an analysis task\"))\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n\n click $xpath[\"task\"][\"general_control_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Basic Setting\")) rescue false); sleep 2 }\n sleep 3\n select \"analyze_type\", \"label=#{@individual}\"\n sleep 3\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n\n # click link setup QAC\n assert is_text_present(\"qac\")\n sleep 3\n click $xpath[\"task\"][\"option_setup_link\"]\n # check log in the navigation bar\n assert !60.times{ break if (is_text_present(_(\"It returns to the state before a save.\")) rescue false); sleep 2 }\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def finalize!(result)\n @session.finish(result)\n self.class.instruments.each { |i| i.after(@session) }\n SessionFinalizer.instance.finalize!(self.class.instruments, @session)\n end", "def teardown\n # Do nothing\n @driver.quit()\n end", "def on_test_case_finished(event)\n # save only failed and not tagged with issue_pattern (e.g. @ISSUE-)\n if event.result.failed? && !event.test_case.tags.any? { |tag| tag.name.match?(/ISSUE/) }\n add_failure_to_rerun(event.test_case)\n end\n end", "def teardown\n # Do nothing\n @driver.quit\n end", "def teardown\n # Do nothing\n @driver.quit\n end", "def teardown\r\n # Do nothing\r\n @driver.close\r\n end", "def report_failure\n @report.fail\n end", "def report_failure\n @report.fail\n end", "def finish\n #\n end", "def test_close\n @session.close\n\n refute @connection.closed?\n end", "def teardown\n if File.exist?(modelPath())\n FileUtils.rm(modelPath())\n end\n if File.exist?(reportPath())\n FileUtils.rm(reportPath())\n end \n end" ]
[ "0.739899", "0.739899", "0.7244707", "0.72273386", "0.70306355", "0.70227265", "0.7008613", "0.6897105", "0.68895257", "0.67292297", "0.67292297", "0.67292297", "0.66707146", "0.6659845", "0.6529249", "0.6512932", "0.65051943", "0.6410376", "0.64084476", "0.64046186", "0.64046186", "0.64046186", "0.64046186", "0.64046186", "0.6403573", "0.6389348", "0.63652474", "0.63093245", "0.6298947", "0.62932473", "0.62540686", "0.61991125", "0.61927855", "0.6157438", "0.6131587", "0.61275417", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.6124891", "0.611407", "0.6062821", "0.6055344", "0.6045505", "0.601803", "0.5995571", "0.59735656", "0.5958789", "0.5931938", "0.5929124", "0.5925876", "0.5915572", "0.58906347", "0.587267", "0.5867986", "0.5867965", "0.5851969", "0.5847605", "0.58405036", "0.58336365", "0.5833138", "0.58283806", "0.581346", "0.58100355", "0.5793584", "0.579345", "0.5780624", "0.5768496", "0.5763469", "0.57610375", "0.57610375", "0.57546526", "0.5746839", "0.5740222", "0.5737064", "0.5733645", "0.5732484", "0.5732484", "0.57174337", "0.5713119", "0.57014024", "0.5697889", "0.5684986", "0.5676754", "0.5674053", "0.5665886", "0.5665324", "0.5665324", "0.5651378", "0.56469387", "0.56469387", "0.5645161", "0.5641276", "0.5637668" ]
0.7504587
0
admin only can generate this report
def is_admin if current_user.user_type != 1001 render json: {data: "you must login as admin...!" , meta: {status: false} } , status: 401 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_accessible?\n report || is_admin\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end", "def admin_only\n false\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def correct_or_admin_user\n\n unless current_user.admin?\n @report = current_user.reports.find_by(id: params[:id])\n redirect_to root_url if @report.nil?\n end\n end", "def authorize_reports\n authorize! :read, :report\n end", "def generate_csv?\n user.present? and (user.super_admin? or user.event_admin? or permissions[:per_event_admin] or permissions[:country_admin])\n end", "def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end", "def verify_admin\n unless current_cas_user.admin?\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end\n end", "def must_be_admin!\n access_denied! unless current_admin?\n end", "def admin_only\n deny_access(\"You must be signed in as an admin to access this page.\") unless signed_in_as_admin?\n end", "def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def index\n prevent_non_admin\n end", "def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end", "def admin_required\n current_user.is_admin? || access_denied\n end", "def benchmark_accessible?\n benchmark_report || is_admin\n end", "def check_if_should_be_admin\n end", "def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def can_do_admin?\n true # current_user[:department_name] == 'IT'\n end", "def admin?; false end", "def require_admin\n unless env['warden'].user.advisor? || env['warden'].user.resident?\n flash.error = \"You are not authorized to access that page.\"\n redirect '/'\n end\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def show\n\t\tif current_usuario.asignacion_roles.where(esActual: true, id: Rol.where(nombre: \"Voluntario\"), proyecto: @reporte.actividad.proyecto) && current_usuario.asignacion_roles.where(esActual: true, proyecto: @reporte.actividad.proyecto).count == 1\n\t\t\traise CanCan::AccessDenied if !Reporte.accessible_by(current_ability, :show).include?(@reporte)\n\t\telse\n\t\t\tauthorize! :show, Reporte\n\t\tend\n\n end", "def is_admin\n render status: :unauthorized unless current_user.admin\n end", "def require_correct_admin\n if current_user.user?\n raise ExceptionTypes::UnauthorizedError.new(\"Admin access only\")\n end\n if current_user.admin?\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to modify the program with ID #{@program.id}\") unless @program.admins.exists? current_user.id\n end\n end", "def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end", "def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end", "def only_for_admins\n raise ActiveRecord::RecordNotFound unless current_user.has_role? :admin\n end", "def verify_self_or_admin\n if !current_cas_user.admin? && (current_cas_user.id != @cas_user.id)\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end\n end", "def admin_only\n unless current_user.admin\n redirect_to home_path, notice: \n \"You must be an admin to perform that function!\"\n end\n end", "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end", "def verify_user\n if action_name != 'export'\n if current_user.to_s.blank?\n flash[:notice] = I18n.t('admin.need_login') and raise Blacklight::Exceptions::AccessDenied\n elsif Rails.configuration.x.admin_users_email.include? current_user.email\n else\n raise Pundit::NotAuthorizedError\n end\n end\n end", "def check_index_permission\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to view all programs\") unless current_user.super_admin?\n end", "def thesis_admin\n processor\n\n can :manage, :all\n cannot 'destroy', :copyright\n cannot 'destroy', :degree\n cannot 'destroy', :department\n cannot 'destroy', :hold_source\n cannot 'destroy', :license\n cannot 'destroy', :thesis\n end", "def admin?() false end", "def require_admin\n deny_wrong_user if !admin?\n end", "def require_admin\n redirect_to(access_denied_path) unless current_user.is_admin_of?(@department)\n end", "def permit_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see all orders.'\n respond_to do |format| \n format.html {redirect_to(root_url)}\n end\n end\n end", "def check_if_admin\n unless current_user.is_admin?\n render json: {\"errors\" => [\"Inaccessible Resource\"]},\n status: :unauthorized\n return\n end\n end", "def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end", "def admin_only\n\t\t\tif logged_in?\n\t\t\t\tif User.find_by(id: current_user.id.to_i).admin != true\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu musisz być adminem\"\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def require_admin\n unless !current_user.nil? && current_user.admin?\n render file: 'public/401.html', status: :unauthorized\n end\n end", "def creation_allowed_only?\n creation_allowed? && !(\n programme_administrator_logged_in? ||\n Programme.site_managed_programme.present?\n )\n end", "def can_edit?\n return !@energy_usage.approved? || current_user.manager? \n end", "def no_admin_set_abilities\n cannot [:edit, :create, :delete], Hydra::Admin::Collection\n end", "def must_be_admin\n if current_user.is? \"EA\"\n return true\n else\n redirect_to root_path,:notice =>\"Access Denied...\"\n end\n end", "def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end", "def rollcall_admin_required\n if current_user.is_rollcall_admin?\n return true\n else\n redirect_to :action => \"unauthorized\", :controller => 'rollcall/rollcall_app'\n return false\n end\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def build_plan_accessible?\n build_plan || is_admin\n end", "def user_accessible?\n is_admin\n end", "def allowed_user\n unless current_user.id == Design.find(params[:design_id]).user.id\n flash[:notice] = 'Voce não tem permissão para fazer isso!'\n redirect_to root_url\n end\n end", "def set_report\n @report = Report.all.find(params[:id])\n if !(current_user.admin? || current_user?(@report.user))\n flash[:alert] = \"올바르지 않은 권한입니다.\"\n redirect_to root_url\n end\n end", "def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end", "def eventunscrape?\n @user.is_admin?\n end", "def admin_access?\n admin?\n end", "def normal_user?\n self.admin ==false\n end", "def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end", "def has_no_admin?\n if e = Employee.find_by_employee_type(\"Administrator\")\n\t if User.find_by_employee_id(e)\n\t\t return false\n\t\t else\n\t\t return true\n\t\t end\n\t else \n\t\t return true\n\t end\n end", "def authenticate_author\n unless current_user.try(:admin?) || @measure_report.author == current_user\n flash[:notice] = \"You cannot edit someone else's report with your current credentials\"\n redirect_to referer\n end\n end", "def check_admin\n if !current_user.admin?\n return redirect_to '/messages/no_access'\n end\n end", "def can_create_opinion_from_admin?\n toggle_allow(admin_creation_is_enabled?) if permission_action.subject == :opinion\n end", "def admin_authorize\n unless admin?\n unauthorized_access\n end\n end", "def isAdmin\n \n end", "def admin_index\n return unless (user_is_allowed_to 'view', 'rets_properties') \n render :layout => 'caboose/admin' \n end", "def require_admin\n end", "def checkAdmin\n if !admin_signed_in?\n # if current user is not an admin then can't access the page like add teacher,department,college and new subject\n redirect_to root_path, notice: \"Only Admin Can Access This Page\"\n end\n end", "def admin?\n false\n end", "def ensure_admin_user!\n redirect_to(enemy_templates_path, :alert => \"You may not perform this action on enemies!\") and return unless current_user.admin?\n end", "def write_permitted?\n return (acting_user.administrator? || users.member?(acting_user))\n end", "def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\n end\n end", "def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end", "def not_change_my_admin\n #今回、「一般ユーザーとする」として登録しようとしている場合\n if admin_status==0\n # if User.where.not(id: 1).size == 0\n if id == current_user_id\n errors.add(\" \",I18n.t(\"activerecord.errors.messages.restrict_change_admin\"))\n # errors.add(:cd, I18n.t(\"activerecord.errors.messages.restrict_dependent_destroy.myself\"))\n end\n end\n end", "def export_tool_authorized?\n authorized_for?(:action => :read)\n end", "def require_admin\n logger.debug \"ApplicationController::require_user\"\n if current_user.admin?\n return true\n else\n flash[:error] = \"You do not have permissions to view this page\"\n redirect_to surveys_path\n end\n end", "def write_permitted?\n return acting_user.administrator?\n end", "def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend", "def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to messages_url\n end\n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end", "def admin_cannot_actions\n [:new, :create].freeze\n end", "def unscrape?\n @user.is_admin?\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end", "def check_customization_editor\n unless user_role_in?(:dmp_admin, :resource_editor, :institutional_admin)\n flash[:error] = \"You do not have permission to view this page.\"\n redirect_to dashboard_path and return\n end\n end", "def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end" ]
[ "0.76286274", "0.7036026", "0.7022285", "0.6983291", "0.69754213", "0.69754213", "0.69754213", "0.6759987", "0.6759987", "0.67431056", "0.67348856", "0.660926", "0.6602365", "0.6595044", "0.6590404", "0.65825343", "0.65761703", "0.6562646", "0.6561403", "0.65384483", "0.6502948", "0.64903593", "0.6485463", "0.64843524", "0.6467393", "0.6462826", "0.64498895", "0.6427635", "0.6427004", "0.6410786", "0.6391976", "0.6382294", "0.63778245", "0.63630044", "0.6361438", "0.6335734", "0.63152385", "0.6302436", "0.6295414", "0.629", "0.62888664", "0.6281534", "0.6275406", "0.6257747", "0.62428975", "0.62422127", "0.6240708", "0.6236932", "0.6230964", "0.6230303", "0.6229387", "0.62273407", "0.6227277", "0.62214", "0.6218897", "0.62182283", "0.6218157", "0.6214139", "0.62140286", "0.6213214", "0.6206164", "0.6197581", "0.6187839", "0.61761004", "0.6171598", "0.617128", "0.61210907", "0.6113078", "0.61093456", "0.610904", "0.610415", "0.6102453", "0.6090917", "0.6090321", "0.60887307", "0.60854125", "0.6082101", "0.60772926", "0.6071055", "0.6067842", "0.6063801", "0.60617524", "0.60599667", "0.60599434", "0.60565674", "0.6052539", "0.60513383", "0.6051152", "0.60449255", "0.60408545", "0.60370684", "0.60370684", "0.60336727", "0.60289794", "0.6028435", "0.6028435", "0.6028435", "0.6028435", "0.6028396", "0.60271287", "0.60262054" ]
0.0
-1
Gracefully shut down the connection.
def disconnect! @driver.close ensure close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown_connection\n teardown_timers\n @conn.shutdown if @conn.respond_to? :shutdown\n @conn.terminate if @conn.respond_to? :terminate\n @conn = nil\n end", "def shutdown\n @conn.shutdown\n end", "def shutdown\n connection.write(\"shutdown\")\n end", "def shut_down\n @shutdown_lock.synchronize {\n return if @shutting_down\n @shutting_down = true\n }\n die NO_ERROR\n end", "def shutdown!\n error { \"forcing connection closed\" }\n socket.close\n end", "def terminate_connection\n @intentionally_closed = true\n close_connection\n end", "def stop\n log \"closing connection\"\n @running = false\n client.stop!\n log \"closed\"\n end", "def disconnect!\n @connection.logoff rescue nil\n end", "def close\n conn.write(\"(api-quit)\") if connected?\n rescue Errno::ECONNRESET\n ensure\n self.conn = nil\n end", "def shutdown\n @data_socket.close\n @ack_socket.close\n @client.disconnect! rescue nil\n end", "def close()\n @connection.disconnect\n @connection = nil\n end", "def shut_down\n trigger(:shut_down_started)\n @server.stop(true) if @server\n @server_thread.join if @server_thread\n adapter.shut_down\n trigger(:shut_down_complete)\n end", "def close\n info { \"closing connection\" }\n socket.shutdown\n end", "def shutdown\n\t\tself.log.info \"Shutting down.\"\n\t\tself.reactor.stop_polling\n\t\[email protected]\n\tend", "def shutdown\n @socket = nil\n @thr.join if @thr\n @thr = nil\n end", "def shutdown\n @connection_manager.shutdown if @connection_manager\n @client = nil\n @connection_manager = nil\n end", "def disconnect!\n @connection.close rescue nil\n end", "def disconnect\n info 'closing connection to host'\n @connected = false\n end", "def stop_gracefully\n @connections_to_stop = 0\n\n Signal.trap \"SIGTERM\", stop\n Signal.trap \"SIGINT\", stop\n Signal.trap \"SIGQUIT\", stop\n end", "def disconnect\n @connection.close if connected?\n @connection = nil\n end", "def shut_down\n end", "def close_connection\n current_connection.logout if current_connection?\n current_connection = nil\n end", "def disconnect!\n @logger.info(\"Terminating SSH connection to server name=#{@name}\")\n @ssh.close\n @ssh = nil\n end", "def close_connection\n @connection.expunge\n @connection.logout\n @connection.disconnect\n end", "def close_connection\n cls if connected?\n stop_read_loop\n stop_write_loop\n @socket.close if @socket\n @socket = nil\n @connected = false\n end", "def graceful_shutdown\n socket_server.close unless socket_server.closed?\n @active_descriptors.delete(socket_server)\n @shutdown = true\n end", "def quit!\n command \"quit\" if alive?\n ensure\n @alive = false\n @socket = nil\n File.delete(@socket_path) if File.exist?(@socket_path)\n end", "def stop\n @socket.close\n ensure\n cleanup\n end", "def kill_connection(connection)\n connection.shutdown!\n end", "def close()\n\t\[email protected]\n\t\t@connection = nil\n\tend", "def disconnect\r\n @connection.close_connection\r\n @connection = nil\r\n end", "def stop\n @pid ? Process.kill('TERM', @pid) : close_connection\n end", "def close\n log \"Closing connection\", level: :warning\n close_stream\n close_socket\n stop_reader\n set_state :disconnected\n notify_error DisconnectError.new(\"Connection was closed\")\n\n # stop timer\n # as we're running inside the timer, code after stop_timer() will not be called,\n # unless it's in the ensure block\n stop_timer\n end", "def halt\n\t\tself.shutting_down = true\n\t\tself.consumer.channel.close\n\tend", "def disconnect! # :nodoc:\n super\n @raw_connection.logoff rescue nil\n end", "def shutdown!\n shutdown\n end", "def terminate\n @intentional_termination = true\n @socket.close\n end", "def disconnect\n\t\tbegin\n\t\t\tActiveRecord::Base.remove_connection\n\t\trescue ::Exception => e\n\t\t\tself.error = e\n\t\t\telog(\"DB.disconnect threw an exception: #{e}\")\n\t\tensure\n\t\t\t# Database drivers can reset our KCODE, do not let them\n\t\t\t$KCODE = 'NONE' if RUBY_VERSION =~ /^1\\.8\\./\n\t\tend\n\tend", "def disconnect(reason)\n if @socket.is_a?(OpenSSL::SSL::SSLSocket)\n @socket.sysclose()\n else\n begin \n @socket.close_read\n rescue IOError => e\n # Ignore, perhaps we shouldn't ignore.\n end\n\n begin \n @socket.close_write\n rescue IOError => e\n # Ignore, perhaps we shouldn't ignore.\n end\n end\n end", "def shutdown\n @pool.shutdown do |connection|\n connection.quit\n end\n end", "def shutdown\n @pool.shutdown do |connection|\n connection.quit\n end\n end", "def shutdown!\n _shutdown 'SIGKILL' unless dead?\n end", "def on_close(env)\n @connection.destroy if @connection\n end", "def close\n if self.conn && !self.conn.closed?\n self.conn.shutdown\n self.conn.close\n end\n\n self.conn = nil\n end", "def destroy_connection\r\n\tbegin\r\n\t\[email protected] if @sock\r\n\tensure\r\n\t\t@connected=false\r\n\tend\r\n end", "def disconnect\n _logout\n @connection.close\n end", "def close_gracefully\n @request_queue.each {|request, deferrable| deferrable.fail(ServerError.new('shutdown requested')) }\n @request_queue = []\n if in_flight\n in_flight.callback { close_connection }\n in_flight.errback { close_connection }\n else\n close_connection\n end\n end", "def shutdown\n request('shutdown')\n end", "def stop\n @logger.info(\"Stopping #{self.class}...\")\n @connection.stop if @connection\n @logger.info(\"#{self.class} stopped.\")\n end", "def stop!\n self.class.cleanup!(:pid => @sudo_pid, :socket => @socket)\n @proxy = nil\n end", "def disconnect!\n super\n @connection.close rescue nil\n end", "def force_close_connection\n destroy_transport\n connection.transition_state_machine :closed\n end", "def graceful_shutdown\n socket_server.close unless socket_server.closed?\n\n until active_connections.zero?\n logger.debug \"#{active_connections} connections still active\"\n sleep 0.5\n end\n\n logger.debug \"No more active connections. Exiting'\"\n\n Process.exit(0)\n end", "def close_connection\n @connection.finish\n end", "def destroy_connection\n begin\n @ssock.close if @ssock\n @rsock.close if @rsock\n ensure\n @connected=false\n end\n end", "def shutdown\n client.close\n end", "def disconnect; @connection.close end", "def shutdown\n @logger.info \"Hastur agent shutting down normally.\"\n @running = false\n @router_socket.close\n @udp_socket.close\n @ctx.terminate\n end", "def close_socket\n @stop = true\n end", "def disconnect\n @socket.close\n end", "def close!\n logger.debug \"Closing...\",\n socket: socket,\n server: server,\n path_exists: path.exist?,\n thread: thread,\n env_var: {\n env_var_name => ENV[env_var_name],\n }\n \n # Remove the path from the ENV so if we do anything after this the\n # old one isn't hanging around\n ENV.delete env_var_name\n \n # Kill the thread first so that it can't try to do anything else\n thread.kill if thread && thread.alive?\n \n socket.close unless socket.nil?\n @socket = nil\n server.close unless server.nil?\n @server = nil\n FileUtils.rm( path ) if path.exist?\n \n logger.debug \"Closed.\",\n socket: socket,\n server: server,\n path_exists: path.exist?,\n thread: thread,\n env_var: {\n env_var_name => ENV[env_var_name],\n }\n \n nil\n end", "def disconnect!\n super\n @raw_connection&.close\n @raw_connection = nil\n end", "def shutdown(level=0)\n check_connection\n @protocol.shutdown_command level\n self\n end", "def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end", "def shutdown\n logger.info('Shutting down ...')\n @lock.synchronize do\n @shutdown = true\n end\n\n reset\n exit\n end", "def disconnect\n if @socket\n @socket.close\n @socket = nil\n end\n end", "def disconnect\n if threaded[:connection]\n threaded[:connection].disconnect\n threaded[:connection] = nil\n end\n end", "def disconnect!\n context.with_connection do |connection|\n connection.disconnect!\n end\n @monitor.stop! and true\n end", "def close()\n #N Without this check, we'll be trying to close the connection even if there isn't one, or it was already closed\n if @connection != nil\n #N Without this we won't get feedback about the SSH connection being closed\n puts \"Closing SSH connection to #{user}@#{host} ...\"\n #N Without this the connection won't actually get closed\n @connection.close()\n #N Without this we won't know the connection has been closed, because a nil @connection represents \"no open connection\"\n @connection = nil\n end\n end", "def stop\n\t\tsuper\n\n\t\tself.socket.shutdown( :WR )\n\tend", "def stop\n\t\tsuper\n\n\t\tself.socket.shutdown( :WR )\n\tend", "def disconnect\n raise \"Not connected. did you forget to call connect?\" unless @_socket\n @_socket.close\n @_socket = nil\n print \"Disconnected\\n\" if @_verbose\n EtherShell::ShellDsl.nothing\n end", "def disconnect_ssh_tunnel\n @logger.debug('closing SSH tunnel..')\n\n @ssh.shutdown! unless @ssh.nil?\n @ssh = nil\n end", "def disconnect\n if @socket\n @socket.close\n @socket = nil\n @authed = false\n end\n end", "def disconnect\n if @socket\n @socket.close\n @socket = nil\n @authed = false\n end\n end", "def shutdown()\n if @conn\n @conn.unsubscribe(@queue_name)\n @@log.debug(\"Unsubscribe complete\")\n StompHelper::pause(\"After unsubscribe\") if $DEBUG\n @conn.disconnect()\n @@log.debug(\"Disconnect complete\")\n StompHelper::pause(\"After disconnect\") if $DEBUG\n end\n end", "def disconnect\n @thread.kill\n @socket.close\n end", "def disconnect\n connection { |conn| conn.disconnect }\n true\n end", "def shutdown!\n @gateway&.shutdown!\n sleep 0.5 until !@gateway&.active?\n @gateway = nil\n end", "def shutdown()\n check_return_code(PureHailDB.ib_shutdown(PureHailDB::ShutdownType[:IB_SHUTDOWN_NORMAL]))\n end", "def stop\n if @running\n @running = false\n @connections.each { |conn| conn.stop(@stop_bytes) }\n end\n end", "def shutdown\n log(\"Shutting down...\")\n # We need to perform the shutdown in a new thread, because this method\n # gets called from within a trap context\n Thread.new {\n Sock.off\n stop_bot\n disconnect_db\n unblock_threads\n exit\n }\nrescue => e\n fatal(\"Failed to shut down bot: #{e}\")\n exit\nend", "def shutdown\n send_recv( KJess::Request::Shutdown.new )\n end", "def graceful_shutdown(signal)\n EventMachine.stop_server(@server) if @server\n Thread.new{ logger.info \"Received #{signal} signal. No longer accepting new connections.\" }\n Thread.new{ logger.info \"Waiting for #{EventMachine.connection_count} connections to finish.\" }\n @server = nil\n graceful_shutdown_check\n end", "def unbind\n @logger.trace 'Connection closed'\n self\n end", "def disconnect\n @write_socket.close\n @read_socket.close\n @write_socket = nil\n @read_socket = nil\n @rc_r = false\n @rc_W = false\n end", "def stop\n synchronize {\n return unless @app\n info(\"Stopping datapath #{name}\")\n\n # gracefully shutdown the connection\n begin @click_socket.send(\"QUIT\", 0) rescue Errno::EPIPE end\n # close the control socket\n @click_socket.close\n\n # kill the process\n begin @app.kill('TERM') rescue Errno::ESRCH end\n @app = nil\n }\n end", "def disconnect()\r\n @callbacks.each { |block| block.call }.clear()\r\n @conn.close if @conn\r\n @conn = nil\r\n end", "def disconnect\n super\n\n @transport.close rescue nil\n @transport = nil\n \n debug 'connections closed'\n end", "def close\n write_message(Vertica::Protocol::Terminate.new)\n ensure\n close_socket\n end", "def disconnect\n @connection.logout\n end", "def graceful_shutdown; end", "def teardown\n logger.debug \"Connection teardown\"\n @connection.active? && disconnect\n @connection.active?\n end", "def destroy\n connection.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def disconnect\n @conn.close\n end", "def connection_closed\n close\n end", "def shutdown(how = 2)\n begin\n super\n ensure\n @tunnel.remove if closed?\n end\n return 0\n end", "def shutdown\n\n @db.connection.close\n end" ]
[ "0.7844399", "0.7694907", "0.7457424", "0.7377247", "0.724101", "0.7214354", "0.70967233", "0.70716923", "0.7030799", "0.7022823", "0.6960099", "0.69594145", "0.6931504", "0.69173324", "0.6862759", "0.6845816", "0.68451434", "0.6768765", "0.67620444", "0.6743782", "0.6743712", "0.6739767", "0.67320335", "0.67295086", "0.6713242", "0.67107826", "0.66823494", "0.6668812", "0.66658473", "0.6663787", "0.6649579", "0.66344154", "0.66011614", "0.6572582", "0.6569391", "0.6562194", "0.6553776", "0.65413314", "0.6533704", "0.6528756", "0.6528756", "0.65187705", "0.6516391", "0.65023303", "0.64949816", "0.6486342", "0.64854616", "0.6457229", "0.6456939", "0.6429179", "0.642655", "0.64259326", "0.6425493", "0.6424822", "0.6416125", "0.6414621", "0.6402427", "0.6397128", "0.6382556", "0.63788223", "0.6363895", "0.63537055", "0.63395333", "0.6331217", "0.63255066", "0.632476", "0.6322045", "0.63218784", "0.63168687", "0.62909734", "0.62909734", "0.62875575", "0.628752", "0.62858504", "0.62858504", "0.6283587", "0.62814784", "0.6280332", "0.62784064", "0.627327", "0.6259791", "0.6255887", "0.6242827", "0.62406814", "0.62398535", "0.623148", "0.62296456", "0.6229534", "0.62279165", "0.6226882", "0.62235904", "0.622202", "0.62212086", "0.6199676", "0.6192563", "0.6192563", "0.6192563", "0.6192563", "0.618703", "0.6182882", "0.6181015" ]
0.0
-1
Convert CSV to HASH based on first field, input csv_name, return the hash
def prod_to_hash(csv_name) prod_array = CSV.read(csv_name) prod_array.each_with_index do |line, index| next if line[0] == "Opportunity ID" break if line[0] == nil @current_opp_list[line[0]] = Opportunity.new(line[@prods_opp], line[@prods_prod], line[@prods_access], line[@prods_status], "unknown") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_csv(file)\n data = CSV.read(file, {encoding: \"UTF-8\", headers: true, header_converters: :symbol, converters: :all})\n hashed_data = data.map { |d| d.to_hash } \n \n puts \"CSV Loaded...\"\n\n return hashed_data\n end", "def grades_to_hash(csv)\n csv.map { |r| r.to_hash }\n end", "def get_csv_data(csv_data)\r\n csv_file = nil\r\n\r\n #Get the path and name of the CSV file\r\n if csv_data.to_s.include? '.csv'\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}\")\r\n elsif (\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}.csv\")\r\n )\r\n end\r\n\r\n csv_arr = CSV.read( csv_file, {:headers => true, :header_converters => :symbol, :encoding => 'UTF-8'} )\r\n keys = csv_arr.headers.to_a\r\n # read attribute example => csv[index][:column1]\r\n return csv_arr.to_a.map {|row| Hash[ keys.zip(row) ] }\r\nend", "def parse_csv(csv_string)\n csv_data = FasterCSV.parse(csv_string)\n header = csv_data.shift\n [csv_data.map{|row| Hash[*header.zip(row).flatten] }, header]\n end", "def csv_parsed\n transform_to_hash(@csv_array, @header)\n end", "def parse_csv(csv)\n objects = CSV.parse(csv)\n headers = objects.shift\n objects.to_a.map! { |row| Hash[headers.zip(row)] }\n end", "def get_references\n references_hash = {}\n FasterCSV.foreach(\"#{Source_path}/TbReference.csv\", :quote_char => '\"', :col_sep =>',', :row_sep =>:auto) do |row|\n references_hash[row[0]] = row[6]\n end\n return references_hash\nend", "def load_csv(file) \n\t\thash = {}\n\t\tCSV.foreach(file) { |row| hash[row[0]] = row[1] } \n\t\thash\n\tend", "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end", "def parse_csv_row(csv_row)\n {\n s_no: csv_row['Sr. No'],\n ticket_no: csv_row['Ticket No'],\n email: csv_row['Email'],\n name: csv_row['Name'],\n new_eth_address: csv_row['New Ethereum Add']\n }\n end", "def load_csv()\n f = File.read(INPUT_CSV)\n CSV.parse(f, :headers => true, :col_sep => \",\").map do |row|\n as_hash = row.to_hash\n\n geom = { \n type: \"Point\",\n coordinates: as_hash['coordinates'].split.map { |num| num.to_f }\n }\n\n as_hash.delete('coordinates')\n as_hash['geom'] = geom\n\n if (as_hash['pic_url'].strip.length < 1)\n as_hash.delete('pic_url')\n end\n\n if (as_hash['place_image'].strip.length < 1)\n as_hash.delete('place_image')\n end\n\n as_hash\n end\nend", "def CSVHash arg, columns=nil\n if arg.is_a?(File)\n CSVHash.from_file(arg.path)\n elsif arg.is_a?(String)\n CSVHash.from_file(arg)\n elsif arg.is_a?(Array) && columns.is_a?(Array)\n CSVHash.to_string(arg,columns)\n end\nend", "def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend", "def get_csv_data(infile)\n csv_data = CSV.read infile\n headers = csv_data.shift.map {|i| i.to_s }\n string_data = csv_data.map {|row| row.map {|cell| cell.to_s } }\n return string_data.map {|row| Hash[*headers.zip(row).flatten] }\nend", "def players(team)\n field= []\n CSV.foreach(\"teams.csv\", headers:true,header_converters: :symbol) do |row|\n if row[:team] == team\n field << row.to_hash\n end\n end\n field\nend", "def read_in_ownership(csv_file_name, temp_hash = Hash.new)\n\t CSV.foreach(csv_file_name, :headers => true) do |row|\n\t\t song_id, owner_data = row[0], row[1]\n\t \t unless (song_id =~ /#/)\n\t \t \t temp_hash[song_id] = owner_data\n\t \t end\n end\n temp_hash\n\tend", "def read_in_ownership(csv_file_name, temp_hash = Hash.new)\n\t CSV.foreach(csv_file_name, :headers => true) do |row|\n\t\t song_id, owner_data = row[0], row[1]\n\t \t unless (song_id =~ /#/)\n\t \t \t temp_hash[song_id] = owner_data\n\t \t end\n end\n temp_hash\n\tend", "def hash_creator(filepath)\n hash = Hash.new\n CSV.foreach(filepath, headers: true) do |row|\n student = Student.new(fname = row[0], lname = row[1], email = row[2], section = row[3], major1 = row[4], major2 = row[5], minor1 = row[6], minor2 = row[7])\n if hash.has_key?(student.section)\n array = hash[student.section]\n array.push(student)\n hash[student.section] = array\n else\n array = [student]\n hash[student.section] = array\n end\n end\n return hash\nend", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # #8 iterate over the CSV::Table rows then create a hash for each row, convert each row_hash\n #to an Entry by using the add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end", "def parse_csv_file\n csv_data = CSV.read(\"../artists_for_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash\n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n \n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painter_num => painter_row_arr[6]\n }\n painter_object_array.push(painter_object)\n end\n painter_object_array.flatten\nend", "def create_league(csv)\n league = []\n CSV.foreach(csv, headers: true, header_converters: :symbol) do |row|\n hash = Hash[row]\n league << hash\n end\n league\n\nend", "def parse_painter_csv_file\n csv_data = CSV.read(\"db/painter_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash \n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painting_num => painter_row_arr[6],\n :portrait => painter_row_arr[7]\n }\n painter_object_array.push(painter_object) \n end\n painter_object_array.flatten\nend", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # Iterate over the CSV::Table object's rows. Then create a has for each row.\n # Convert each row_hash to an entry by using add_entry method.\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end", "def import_from_csv(file_name)\n # implementation\n csv_text = File.read(file_name)\n # the variable 'csv' is a table type object\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n \n # \n csv.each do |row|\n # create a hash type variable 'row_hash'\n row_hash = row.to_hash\n # use 'add_entry' to change 'row_hash' into 'Entry', also add the new Entry into AddressBook's entries\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end", "def read_and_hash\n $students = []\n file = File.open('grades.csv', 'r')\n files = file.readlines\n files = files.map(&:chomp)\n files = files.map { |line| line.split(/\\W+/) }\n file.close()\n files.each do |array|\n $students.push(name: array.shift, grades: array)\n end\nend", "def parse_csv(decoded_data)\n csv = CSV.parse(decoded_data)\n headers = csv.shift\n csv.to_a.map! { |row| Hash[headers.zip(row)] }\n end", "def grab_lookup_table(csv_url)\n cmd = `curl #{csv_url} -s`\n csv = cmd.gsub(\"\\r\",\"\\n\").split(/\\n+/).map{ |x| x.split(\",\")}\n table = {}\n csv.each {|row| table[row[0]] = row[1]}\n return table\n end", "def process_csv(path)\n res = {}\n CSV.foreach(path) do |row|\n (tag_str, _, dest_str, val_str) = row\n next unless $tags.has_key? tag_str\n tag, dest, val = $tags[tag_str], dest_str.to_i, val_str.to_i\n res[dest] = {} unless res.has_key?(dest)\n res[dest][tag] = 0 unless res[dest].has_key?(tag)\n res[dest][tag] += val\n end\n res\nend", "def read_scores_from\n teams_data = []\n\n CSV.foreach('scores.csv', headers: true, header_converters: :symbol) do |row|\n teams_data << row.to_hash\n end\n teams_data\nend", "def row_to_hash(row, columns, key_map)\n hash = {}\n (0..columns.length - 1).each do |i|\n # First, convert the column name using the translation table\n key = key_map[columns[i]]\n\n # Only process column if it's name is included in translation table\n if key\n value = row[i]\n # For string values, convert carriage returns to newlines, since\n # EasyChair form-entered newlines appear to be stored as CRs in\n # the exported data. This is primarily for the abstract field,\n # but this code performs the mapping on all string-valued columns\n if value && value.is_a?(String)\n value.gsub!(/\\r/, \"\\n\")\n end\n\n # Now store the value in the hash we're building\n hash[key] = value\n end\n end\n # Return the hash created from the array representing a CSV row\n hash\nend", "def read_from_roster(csv)\n players = []\n CSV.foreach(csv, headers: true, header_converters: :symbol) do |player|\n players << player.to_hash\n end\n players\nend", "def csv_row_to_map(row_values)\n {\n type: row_values[0],\n key: row_values[1],\n revision: row_values[2],\n last_modified: row_values[3],\n details: JSON.parse(row_values[4])\n }\n end", "def parse_csv\n if self.csv_file.present?\n csv_text = Paperclip.io_adapters.for(self.csv_file).read\n csv = CSV.parse(csv_text, :headers => false)\n\n csv_columns = ['l', 'r', 'units']\n\n csv_to_save = {}\n\n csv.each_with_index do |row, i|\n if i == 0\n csv_to_save['weight'] = row[1].split(':')[1] # string is like Weight:201, only want the number\n csv_to_save['shoe_size'] = row[2].split(':')[1] # string is like Shoe Size:9\n elsif i >= 3\n row.each_with_index do |field, j|\n if j >= 1 and !field.blank?\n csv_to_save[generate_csv_row_key(csv_columns, row, i, j)] = field\n end\n end\n end\n end\n\n # Check to see if any of the fields are nil, then we must have not received the correct file\n is_clean = true\n csv_to_save.each do |key, val|\n if val.nil?\n is_clean = false\n break\n end\n end\n\n CsvFile.create!(csv_to_save) if is_clean\n end\n end", "def csv_hash\n {\n vendor: self.vendor_name,\n name: self.name,\n url: self.url,\n enable_proxy: self.access == 2 ? 1 : 0,\n description: self.description,\n more_info: '',\n enable_new: self.new_database.to_i,\n enable_trial: self.trial_database.to_i,\n types: self.resources.pluck(:name).join(';'),\n keywords: '',\n target: 0,\n slug: '',\n best_bets: self.curated.pluck(:name).join(';'),\n subjects: self.subjects.pluck(:name).join(';'),\n desc_pos: 1,\n lib_note: 0,\n enable_popular: self.popular.to_i,\n enable_hidden: 0,\n internal_note: '',\n owner: '',\n resource_icons: '',\n thumbnail: '',\n content_id: self.libguides_id\n }\n end", "def load_dspace_csv(csv_file, fields)\n final = {}\n table = CSV.parse(File.read(csv_file), headers: true)\n table.each do |row|\n values = {}\n fields.each do |hyrax_name, dspace_name|\n values[hyrax_name] = extract_single_value(row, dspace_name)\n end\n values['handle'] = extract_single_value(row, 'dc.identifier.uri')\n final[values['handle']] = values\n end\n final\n end", "def csvtojson(path, delimiter)\n\t\tdata = CSV.open(path, 'r', :col_sep => delimiter, :headers => true)\n\t\treturn data.map { |row| row.to_hash }\n\tend", "def convert_csv(original_csv)\n csv_options = {}\n csv_options[:col_sep] = option(:csv_col_sep) unless option(:csv_col_sep).blank?\n csv_options[:row_sep] = option(:csv_row_sep) unless option(:csv_row_sep).blank?\n csv_options[:quote_char] = option(:csv_quote_char) unless option(:csv_quote_char).blank?\n value_converter = option(:csv_value_proc)\n\n converted_csv = \"#{original_csv}.converting\"\n CSV.open(converted_csv, 'wb', csv_options) do |csv|\n CSV.foreach(original_csv) do |row|\n row = row.map{ |value| value.blank? ? '' : value_converter.call(value) } if value_converter\n csv << row\n end\n end\n FileUtils.remove(original_csv)\n FileUtils.move(converted_csv, original_csv)\n end", "def csv_import(the_file)\n import_list = []\n CSV.foreach(the_file, headers: true) do |row|\n import_list << row.to_hash\n end\n import_list\n end", "def parse_csv(csv_name, schema)\n CSV.read(csv_name).map {|row| map_row_to_entity(row, schema) }\nend", "def fill_hash_record_from_line(column_names, headers, line)\n hash_record = {}\n fields = line.split(@sep)\n\n fields.each_with_index do |field, field_id|\n hash_record[headers[field_id]] = field if column_names.include?(headers[field_id])\n end\n\n hash_record\n end", "def load_csv(csv_path)\n raise Error::InvalidCSV unless File.exist? csv_path\n begin\n vals = CSV.read(csv_path)\n rescue CSV::MalformedCSVError\n raise Error::InvalidCSV\n end \n\n raise Error::BlankCSV if vals.length == 0\n raise Error::InvalidCSV if vals[0].length != 3\n\n # remove optional header\n vals.shift if vals[0][0] == HEADER_VAL\n\n @data = vals.collect do |data|\n {\n \"image_path\" => data[0],\n \"id\" => data[1],\n \"label\" => data[2]\n }\n end\n end", "def load_csv(filename)\n CSV::Converters[:blank_to_nil] = lambda do |field|\n field && field.empty? ? nil : field\n end\n CSV.new(File.read(filename), \n :headers => true, \n :header_converters => :symbol, \n :converters => [:all, :blank_to_nil]\n ).entries.map { |row| row.to_hash }\nend", "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true)\n # Iterate over the table object's rows\n csv.each do |row|\n # Create a hash for each row\n row_hash = row.to_hash\n # Convert each row_hash to an Entry by using add_entry method\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n\n # Get the number of items parsed by calling the count method\n return csv.count\n end", "def read_last_scans(csv_file_name)\r\n file_identifier_histories = Hash.new(-1)\r\n CSV.foreach(csv_file_name, headers: true) do |row|\r\n file_identifier_histories[row[0]] = row[1]\r\n end\r\n file_identifier_histories\r\n end", "def csv_attributes\n @csv_attributes ||= Hash[header.column_names.zip(row_array)]\n end", "def parse_header(filename, header)\n result = Hash.new(0)\n CSV.foreach(filename, headers: true, converters: %i[numeric date]) do |row|\n result[row[header]] += 1\n end \n result \nend", "def parse_csv_legacy(file)\n\trows = []\n\tlines = File.read(file).split(\"\\n\").map(&:strip).reject { |l| l.empty? }\n\trows = lines.map { |r| r.split(\",\").map(&:strip) }\n\n\theader = rows.shift\n\n\trows.map do |row|\n\t\ti = 0\n\t\trow_hash = {}\n\t\theader.each do |h|\n\t\t\trow_hash[h] = row[i]\n\t\t\ti += 1\n\t\tend\n\t\trow_hash\n\tend\nend", "def transform_csv_file(csv_file)\n @logger.info(\"Transforming CSV file\")\n transformed = []\n headers = csv_file.shift\n headers.map!(&method(:prepare_custom_headers))\n\n csv_file.each do |row|\n transformed << Hash[headers.zip row]\n end\n prefix_sf_attribute_names transformed\n end", "def process_csv_file(filename, no_of_unique,delimiter)\n @arr_unique = Array.new{hash.new}\n @arr_details = Array.new(@no_of_columns){{\"int\" => 0, \"float\" => 0, \"date\" => 0, \"datetime\" => 0, \"string\" => 0, \"max_value\" => 0, \"min_value\" => 0}}\n total_chunks = SmarterCSV.process(filename, {:col_sep => delimiter, :chunk_size => 200, :remove_empty_values => false, :remove_zero_values => false}) do |chunk|\n for i in [email protected]\n arr = chunk.map{|x| x[@headers[i].to_sym]}\n if(@arr_unique[i].to_a.empty?)\n @arr_unique[i] = arr.uniq\n elsif(@arr_unique[i].size < no_of_unique.to_i+2)\n @arr_unique[i] |= arr.uniq\n elsif (arr.uniq.include?(nil) && !@arr_unique[i].include?(nil))\n @arr_unique[i].push(nil)\n elsif (arr.uniq.include?(\"NULL\") && !@arr_unique[i].include?(\"NULL\"))\n @arr_unique[i].push(\"NULL\")\n elsif (arr.uniq.include?(\"\\N\") && !@arr_unique[i].include?(\"\\N\"))\n @arr_unique[i].push(\"\\N\") \n elsif (arr.uniq.include?(\"\") && !@arr_unique[i].include?(\"\"))\n @arr_unique[i].push(\"\")\n elsif (arr.uniq.include?(\" \") && !@arr_unique[i].include?(\" \"))\n @arr_unique[i].push(\" \")\n end \n arr.each do |field|\n field_type = get_datatype(field)\n count = @arr_details[i][field_type]\n @arr_details[i][field_type] = count+1\n if(field != nil)\n begin\n if(@header_datatype[i] == \"int\" || @header_datatype[i] == \"float\") \n if(@arr_details[i][\"max_value\"] < field)\n @arr_details[i][\"max_value\"] = field\n end\n if(@arr_details[i][\"min_value\"] > field || @arr_details[i][\"min_value\"] == 0)\n @arr_details[i][\"min_value\"] = field\n end\n else\n if(@arr_details[i][\"max_value\"] < field.to_s.length)\n @arr_details[i][\"max_value\"] = field.to_s.length\n end\n if(@arr_details[i][\"min_value\"] > field.to_s.length || @arr_details[i][\"min_value\"] == 0)\n @arr_details[i][\"min_value\"] = field.to_s.length\n end\n end\n rescue Exception => e\n end\n end\n end\n end\n end\n end", "def create_csv_for_LLR(csv_data)\n\n csv_string = CSV.open(\"#{$basefile}LLR.csv\", \"wb\") do |csv|\n\n csv << csv_data.first.keys\n csv_data.each do |hash|\n csv << hash.values\n end\n end\n end", "def seed_from_csv(migration_class, csv_file)\n migration_class.transaction do\n csv_file.each do |line_values|\n record = migration_class.new\n line_values.to_hash.keys.map do |attribute|\n record.send(\"#{attribute.strip}=\",line_values[attribute].strip) rescue nil\n end\n record.save(:validate => false)\n end\n end\n end", "def findBarcodeFromCSV()\n puts Dir.pwd\n sampleSheetPath = \"../../../SampleSheet.csv\"\n samplesDirPath = \"../../SamplesDirectories.csv\"\n barcodeHash = Hash.new\n\n if File::exist?(sampleSheetPath) &&\n File::exist?(samplesDirPath)\n\n lines1 = IO.readlines(sampleSheetPath)\n lines2 = IO.readlines(samplesDirPath)\n\n lines2.each do |line|\n tokens = line.split(\",\")\n \n if tokens[1].to_s.eql?(@analysisLane.to_s)\n # puts \"Adding : \" + tokens[4] + \" to hashtable\"\n barcodeHash.store(tokens[4], \"\")\n end\n end\n\n lines1.each do |line|\n tokens = line.split(\",\")\n\n if tokens[1].to_s.eql?(@analysisLane.to_s) &&\n !barcodeHash.has_key?(tokens[4])\n return tokens[4].to_s\n end\n end \n return \"\"\n else\n # The flowcell is not barcoded. Return an empty string\n return \"\"\n end\n end", "def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :birth_year, :first_name, :last_name]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end", "def load_from_csv(row)\n payload = {\n emails: [{ email: row['email'] }],\n firstname: row['first_name'],\n lastname: row['last_name'],\n external_ids: { controlshift: row['id'] },\n updated_at: row['updated_at']\n }\n UpsertMember.call(payload)\n end", "def parse_to_load_file(csv)\n csv.each_with_index do |student, index|\n student = {month: csv[index][0] , name: csv[index][1], city: csv[index][2], hobby: csv[index][3]}\n @students << student\n end\nend", "def recommendation_csv_inputs csv_path\n valid_inputs = []\n\n CSV.foreach(csv_path, {headers: true, header_converters: :symbol}) do |row|\n row = row.to_h\n valid_inputs << row if valid_recommendation_hash?(row)\n end\n\n valid_inputs\n\n rescue => e\n valid_inputs\n end", "def csv_to_json(rows)\n\n objs = []\n \n headers = rows[0]\n \n for i in 1..rows.size - 1\n row = rows[i]\n obj = {}\n for j in 0..headers.size - 1\n header = headers[j].to_s\n val = row[j]\n obj[header] = val\n end\n objs << obj \n end\n\n return objs\n\nend", "def row_hash(row)\n Hash[raw_headers.zip(row)].with_indifferent_access\n end", "def get_csv_data(csv_file)\n\t\tcsv_file = File.read(csv_file)\n\t\tcsv = CSV.parse(csv_file, :headers => true)\t\n\t\tcsv\n\tend", "def build_payload_from_csv(csv, obj)\n payload = {}\n csv.each do |row|\n payload.store(row.first,get_nested_val(row.last.split('.'),obj))\n end\n return payload\n end", "def load_duplicates(filename)\n Hash.new.tap do |duplicates|\n CSV.foreach(filename) do |row|\n duplicates[row[0]] = row[1].to_i\n end\n end\nend", "def read_users_from_file(filename)\n CSV.read(filename, :headers => true, :header_converters => :symbol).map { |row| row.to_hash }\nend", "def reprocess_csv(file)\n raw = open(file).read.force_encoding(\"UTF-8\")\n csv = CSV.parse(raw, headers: true, header_converters: :symbol)\n csv.each do |row|\n data = row.to_hash.each { |k, v| v = v.to_s.gsub(/[[:space:]]+/, ' ').strip }\n data[:area_id] = data[:area].downcase\n data[:gender] = data[:gender].downcase\n data[:term] = '2013'\n %i(num).each { |i| data.delete i }\n ScraperWiki.save_sqlite([:name, :name, :term], data)\n end\nend", "def read_csv(csv_file, data)\n logger.info \"Reading #{data.type} data from '#{csv_file} date column = #{@date_column} data starts at col #{@data_start_column} skipping #{@header_rows} header rows\"\n lines = File.readlines(csv_file)\n (@header_rows...lines.length).each do |i|\n reading = lines[i].split(',')\n begin\n date = Date.parse(reading[@date_column])\n rowdata = reading[@data_start_column, @data_start_column + 47].map(&:to_f)\n data.add(date, rowdata)\n rescue StandardError => e\n logger.warn e.message\n logger.warn e.backtrace.join(\"\\n\")\n logger.warn \"Unable to read data on line #{i} of file #{csv_file} date value #{reading[@date_column]}\"\n end\n end\n logger.info \"Read hash #{data.length} rows\"\n end", "def job_data_to_hash(job, upload_timestamp=nil, partition_field=nil)\n columns = test_dataset_columns(upload_timestamp, partition_field)\n col_names = columns.map(&:getName)\n\n data = job.data.map do |d|\n CSV.parse(d)\n end\n data = Hash[col_names.zip(data.flatten)]\n\n data.reduce({}) do |memo, (k,v)|\n column = csv_header_to_column(columns, k)\n if k == upload_timestamp\n v = DateTime.parse(v)\n v = v.strftime(\"%Y-%m-%d\")\n elsif column.getType == Java::ComDomoSdkDatasetsModel::ColumnType::DATETIME\n v = DateTime.parse(v)\n v = v.strftime(\"%Y-%m-%d %H:%M:%S\")\n end\n\n memo.merge({k => v})\n end\n end", "def read_parameters_from_csv(csv)\r\n\t\tbegin\r\n\t\t\ttemp = CSV.read(csv)\r\n\t\trescue Exception\r\n\t\t\traise ArgumentError, \"It wasn't possible to read from #{csv} file.\"\r\n\t\tend\r\n\t\ttemp.each_with_index do |row,index|\r\n\t\t\t@actual_parameters[index] = row[0].split(';')\r\n\t\tend\r\n\tend", "def csvAccountDataParsing\n\taccounts = {}\n\n\tCSV.foreach(\"accounts.csv\", {headers: true, return_headers: false}) do |row|\n\t\taccountName = row[\"Account\"].chomp.capitalize\n\t\taccounts = set_initial_values(accounts, accountName, row)\n\t\taccounts[accountName].addData(row)\n\tend\n\n\taccounts.each_value do |value|\n\t\tvalue.calculateFinalAmounts\n\tend\n\n\treturn accounts\nend", "def mapArrayToHash(rowarr, field_names)\n\ta = [] # an array of hashes\n\trowarr.each do |row|\n\t\thash = Hash.new\n\t\t0.upto(field_names.length-1) do |index|\n\t\t\t#puts \"#{index} #{field_names[index]} VALUE= #{row[index]} }\"\n\t\t\thash[field_names[index].downcase.to_sym] = row[index]\n\t\tend\n\t\ta << hash\n\tend\n\ta\nend", "def create_csv_for_GH(csv_data)\n\n csv_string = CSV.open(\"#{$basefile}GH.csv\", \"wb\") do |csv|\n\n csv_data.each do |hash|\n csv << hash\n\n end\n end\n end", "def make_testdata_reworked_csv_file\n create_column_headers_index_hash \n create_row_headers_index_hash \n clear_testdata_reworked_file\n CSV.open('testdata_reworked.csv', \"wb\") do |csv|\n CSV.foreach('testdata.csv', {headers: true}) do |row| \n row[0] = @column_hash.key(row[0].to_i)\n row[1] = @row_hash.key(row[1].to_i)\n csv << row\n end\n end\nend", "def parse_csv(csv, &row_block)\n CSV.parse(Encoding.to_utf_8(File.read(\"#{install_path}/Edit Scripts/#{csv}.csv\", mode: 'rb'))).each(&row_block)\n end", "def line_to_hash(line, *cols)\n Hash[cols.zip(line.strip.split(/\\s+/, cols.size))]\n end", "def export_csv(filename)\n game_matchups = []\n CSV.foreach(filename, headers: true) do |row|\n game_matchups << row.to_hash\n end\n game_matchups\nend", "def export_csv(filename)\n game_matchups = []\n CSV.foreach(filename, headers: true) do |row|\n game_matchups << row.to_hash\n end\n game_matchups\nend", "def row_from_csv(csv, line:)\n row_args = %i[timestamp speaker settings content].each_with_object({}) do |key, args|\n args[key] = csv[@key_map[key]]\n args\n end\n\n Row.new(line_number: line, **row_args)\n end", "def import_csv(csv_file)\n data, header = parse_csv(csv_file)\n validate_header(header)\n return if @rollback\n process_data(data, header)\n end", "def populate_csv(csv, headers)\n @source_csv.each do |row|\n csv << [].tap do |arr|\n headers.each do |k, v|\n arr.push(row.to_h.fetch(k, nil))\n end\n end\n end\n end", "def readCSV pmdReportCSVFile\n\tfile = File.open(pmdReportCSVFile, \"rb\")\n\tcsv_contents = file.read\n\tkeys = [\"Problem\",\"Package\",\"File\",\"Priority\",\"Line\",\"Description\",\"Rule set\",\"Rule\"]\n\treturn CSV.parse(csv_contents).map {|a| Hash[ keys.zip(a) ] }\nend", "def get_build_status_json_from_csv_file\n build_status_history = Hash.new\n \n jenkins_job_entries = Array.new\n \n job_index = 0\n CSV.foreach(JOB_STATUS_HISTORY_FILENAME) do |job_status_history_row|\n \n #extract job name\n job_name = job_status_history_row[0]\n \n #create object for Jenkins job\n job_history_entry = Hash.new\n job_history_entry[\"job_name\"] = trim_filename(job_name)\n \n job_status_entries = Array.new\n\n #iterate across status values for the job_status_history_row\n for status_index in 1 ... job_status_history_row.size\n job_status_item = job_status_history_row[status_index]\n job_status_entries << {\"status\" => job_status_item}\n end\n \n job_history_entry.merge!(\"build_status\" => job_status_entries)\n \n jenkins_job_entries << job_history_entry\n \n #increment job index\n job_index = job_index + 1\n end \n \n build_status_history.merge!(\"jenkins_jobs\" => jenkins_job_entries)\nend", "def csv_to_array(csv_name)\n\tCSV.read(csv_name)\nend", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :year, :team_id, :game, :at_bats, :runs, :hits, :doubles, :triples, :home_runs, :runs_batted_in, :stolen_bases, :caught_stealing]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end", "def map_user(csv_user)\n user = {}\n\n user['active'] = true\n user['username'] = csv_user['LOGIN']\n user['firstName'] = csv_user['FIRST_NAME']\n user['middleName'] = csv_user['MIDDLE_NAME']\n user['lastName'] = csv_user['LAST_NAME']\n user['email'] = csv_user['EMAIL']\n\n # Incoming format is '11-FEB-20 07.51.57.521000000 PM', convert to epoch milli\n user['insertInstant'] = Date.parse(csv_user['REGISTRATION_DATE']).strftime(\"%Q\")\n user['lastLoginInstant'] = Date.parse(csv_user['LASTACTIVITY_DATE']).strftime(\"%Q\")\n\n # Register the user to an application\n user['registrations'] = [{\n 'applicationId': $fusionauth_application_id,\n 'insertInstant': Date.parse(csv_user['REGISTRATION_DATE']).strftime(\"%Q\"),\n 'lastLoginInstant': Date.parse(csv_user['LASTACTIVITY_DATE']).strftime(\"%Q\"),\n # Add any roles you would like added to this user, adding 'user' as an example.\n 'roles': [\n 'user'\n ]\n }]\n\n # Import the password, with specified encryption scheme, factor and salt\n user['encryptionScheme'] = 'salted-pbkdf2-hmac-sha256'\n user['factor'] = 10_000\n user['salt'] = csv_user['PASSWORD_SALT']\n user['password'] = csv_user['PASSWORD']\n user['verified'] = true\n\n return user\nend", "def import_csv_new(csv_params:, \n table_name:, \n table_cols:)\n # using table name temp load the intial csv\n # and then updating the results back in.\n table_name_temp = table_name.to_s + \"_clone\"\n \n # 1. clone and load\n ###################\n self.clone_and_load(csv_params: csv_params, \n table_name: table_name, \n table_cols: table_cols)\n \n # 2. compare clone and orig table.\n ##################################\n \n # 3. \n \n return false\n end", "def scanCsvHeader(row)\n @colList = row ;\n @colIndex = {} ;\n ([email protected]).each{|index|\n _label = @colList[index] ;\n if(!_label.nil? && _label.length > 0) then\n @colIndex[_label] = index ;\n end\n }\n return @colIndex ;\n end", "def initialize(csv_in_filename)\n @in_file = csv_in_filename\n @csv_out_headers = nil\n @index = nil\n @csv_out_data = nil\n convert\n end", "def each_row(batch = ETL::Batch.new)\n log.debug(\"Reading from CSV input file #{file_name}\")\n @rows_processed = 0\n ::CSV.foreach(file_name, csv_options) do |row_in|\n # Row that maps name => value\n row = {}\n\n # If we weren't given headers then we use what's in the file\n if headers.nil?\n # We have a hash - OK we'll use it\n if row_in.respond_to?(:to_hash)\n row = row_in.to_hash\n # We have an array - use numbers as the keys\n elsif row_in.respond_to?(:to_a)\n ary = row_in.to_a\n ary.each_index do |i|\n row[i] = ary[i]\n end\n # Error out since we don't know how to process this\n else\n raise ETL::InputError, \"Input row class #{row_in.class} needs to be a hash or array\"\n end\n # if we were given the headers to use then we just need to grab the\n # values out of whatever we have\n else\n values = row_in.kind_of?(::CSV::Row) ? row_in.fields : row_in.to_a\n\n if headers.length != values.length\n raise ETL::InputError, \"Must have the same number of headers #{headers.length} \" + \n \"and values #{values.length}\"\n end\n\n # match up headers and values\n (0...headers.length).each do |i|\n row[headers[i]] = values[i]\n end\n end\n\n # now we apply our header map if we have one\n @headers_map.each do |name, new_name|\n if row.has_key?(name)\n # remap old name to new name\n row[new_name] = row[name]\n row.delete(name)\n else\n raise ETL::InputError, \"Input row does not have expected column '#{name}'\"\n end\n end\n\n transform_row!(row)\n yield row\n @rows_processed += 1\n end\n end", "def create_table_from_csv(name, csv_path)\r\n # Get headers\r\n csv = CSV.open(csv_path, :headers => true)\r\n first = csv.first\r\n unless first\r\n raise \"File Empty!!!\"\r\n end\r\n \r\n # sanitize\r\n headers = first.headers\r\n headers.each_with_index {|e, index|\r\n if e.nil? or e.empty?\r\n headers[index] = \"column_#{index + 1}\"\r\n end\r\n }\r\n headers.map!{|e| e.downcase.underscore }\r\n \r\n # check if every field name is unique\r\n if headers.count != headers.uniq.count\r\n raise \"Field name must be UNIQUE: \\nPlease check your input headers: [#{headers.join(', ')}]\"\r\n end\r\n\r\n # Create table\r\n create_table_sql = headers.map{|e| e == 'id' ? \"\\\"#{e}\\\" integer\" : \"\\\"#{e}\\\" text\"}.join(\",\")\r\n create_table_sql = \"drop table if exists #{name}; create table #{name}( #{create_table_sql} );\"\r\n query(create_table_sql)\r\n\r\n # Dump data\r\n insert_data_sql = headers.map{|e| \"\\\"#{e}\\\"\"}.join(\",\")\r\n insert_data_sql = \"COPY #{name}( #{insert_data_sql} ) FROM '#{csv_path}' DELIMITER ',' CSV HEADER;\"\r\n\r\n # Change output file permission so that postgres user can read it\r\n begin\r\n FileUtils.chmod 0755, csv_path\r\n rescue Exception => ex\r\n puts \"Error while changing file permission\"\r\n end\r\n\r\n if local?\r\n query(insert_data_sql)\r\n else\r\n puts \"\\nWARNING: pushing data to remote server [#{$options[:host]}].\\nBe sure you have the correct version of `psql` command installed\\n\\n\"\r\n insert_data_sql = \"PGPASSWORD=#{$options[:username]} psql -U #{$options[:username]} -h #{$options[:host]} -p #{$options[:listen]} #{$options[:database]} -c \\\"\\\\#{insert_data_sql}\\\"\"\r\n\r\n `#{insert_data_sql}`\r\n `PGPASSWORD=\"\"`\r\n end\r\nend", "def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n line.tr!(\"\\u0000\",\"\")\n next if line == \"\\n\"\n next if line =~ /^\\=/\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp.upcase\n end\n end\n f.close\n return return_hash\nend", "def user_csv_import(row)\n {\n 'user' => {\n 'content' => {\n 'email' => row[0],\n 'login' => row[1],\n 'firstname' => row[2],\n 'lastname' => row[3]\n },\n 'meta' => {}\n }\n }\n end", "def load_csv(csv_file_or_object, table_name, log_name = nil)\n log_name ||= \"load_csv '#{csv_file_or_object.kind_of?(CSV::Table) ? 'CSV Object' : csv_file_or_object }', 'table_name'\"\n csv_object = case csv_file_or_object\n when String then Slacker.get_csv(csv_file_or_object)\n when CSV::Table then csv_file_or_object\n when Array then Slacker.hash_array_to_csv(csv_file_or_object)\n end\n\n Slacker.load_csv(example, csv_object, table_name, log_name)\n end", "def initialize(csv, importer)\n @source_csv = CSV.read(csv, headers: true)\n @is_for_bulkrax = importer == 'bulkrax'\n @fileset_model_or_type = @is_for_bulkrax ? 'FileSet' : 'fileset'\n directory = File.dirname(csv)\n extension = File.extname(csv)\n filename = File.basename(csv, extension)\n @processed_csv = File.join(directory, filename + \"-processed.csv\")\n @merged_headers = exclusion_guard(additional_headers + @source_csv.headers)\n @tree = {}\n end", "def getAgentIdInCsvRow(row)\n# return getValueFromCsvRow(row, \"pedestrianID\").intern ;\n return row[@index_pedestrianID].intern ;\n end", "def makehash(obj, delim, fields)\n\t\tLogUtil.debug(obj, delim, fields)\n\t\tfds = obj.to_s.strip.split(delim)\n\t\thashrec = {}\n\t\tfields.each do |field|\n\t\t\thashrec[field] = fds.shift()\n\t\tend\n\t\treturn hashrec\n\tend", "def split!\n return @keys if instance_variable_defined?('@keys')\n ranges = row_chunker.ranges_for(input_csv)\n @keys = ranges.map.with_index do |range, index|\n chunk_key = key_from_index(index, ranges.count)\n contents = csv_from_range(range)\n BulkProcessor.config.file_class.new(chunk_key).write(contents)\n chunk_key\n end\n end", "def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend", "def fasta_to_hash(infile)\n f=File.open(infile,\"r\")\n return_hash = {}\n name = \"\"\n while line = f.gets do\n if line =~ /^\\>/\n name = line.chomp\n return_hash[name] = \"\"\n else\n return_hash[name] += line.chomp\n end\n end\n f.close\n return return_hash\nend", "def format_data(csv_row)\n\t\tklass = @import_type.classify.constantize\n\t\tklass_object = klass.new({original_row: csv_row})\n\t\tformatted_data = klass_object.get_data\n\t\tformatted_data\n\tend", "def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some reason the iRacing CSV file is buggy.\n unless parsed_line == \"\\n\"\n if i == 5 or i == 6\n parsed_line = parsed_line.gsub(/\\n/,\"\\r\\n\")\n end\n self.parsed_csv_string << parsed_line\n end\n end\n unparsed_file.close\n end", "def a_by_b(filename, headera, headerb)\n result = Hash.new(0)\n all_headerb = Set.new\n CSV.foreach(filename, headers: true, converters: %i[numeric date]) do |row|\n a = row[headera]\n b = row[headerb]\n all_headerb.add(b)\n if !result.key?(a)\n result[a] = Hash.new(0)\n result[a][b] = 1\n elsif !result[a].key?(b)\n result[a][b] = 1\n else\n result[a][b] += 1\n end\n end\n result \nend" ]
[ "0.71611786", "0.6971985", "0.68420637", "0.67427945", "0.6717925", "0.6688303", "0.64841235", "0.64439845", "0.6373775", "0.6362473", "0.63616276", "0.6357385", "0.6355328", "0.6355328", "0.63117266", "0.6295038", "0.62867814", "0.6236435", "0.6200539", "0.61728257", "0.6160189", "0.607123", "0.6005781", "0.6002006", "0.5988245", "0.59582424", "0.5955846", "0.5954312", "0.59248406", "0.5913258", "0.5898507", "0.5821355", "0.58086437", "0.5788665", "0.5752651", "0.57233036", "0.56870985", "0.5685577", "0.56812286", "0.5680827", "0.56736845", "0.5660696", "0.5603491", "0.5593584", "0.55773956", "0.5568128", "0.55675507", "0.55578035", "0.553135", "0.55198187", "0.5510426", "0.5505017", "0.5490224", "0.5431967", "0.5416307", "0.5413839", "0.5408928", "0.5404181", "0.5401947", "0.53986293", "0.53983366", "0.5396662", "0.5389555", "0.5384253", "0.53763586", "0.53744817", "0.5372626", "0.5372547", "0.53550947", "0.5353046", "0.53486466", "0.53292453", "0.5327261", "0.5327261", "0.5320672", "0.52890664", "0.52886516", "0.5271352", "0.52653927", "0.5251903", "0.524621", "0.5244956", "0.524052", "0.52178013", "0.52140146", "0.5213375", "0.5211692", "0.5211524", "0.51996374", "0.5199537", "0.5198173", "0.51958233", "0.5191406", "0.5185407", "0.5181047", "0.5179564", "0.5179564", "0.51764137", "0.51687443", "0.5158094" ]
0.7175659
0