query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
edcd5a721985e586232c9109d967e47f
|
Tries to match our pattern against a certain set of input tokens at the given starting index. Assumes that a sufficient number of tokens exists and does not check bounds. Returns Boolean: match found?, [ReplacementMatch]: the matches
|
[
{
"docid": "352f3bd8e9ece550cd28bd7802a3e406",
"score": "0.75150424",
"text": "def try_match(tokens, begin_index)\n match_data = []\n \n @pattern.each_with_index do |rule, pattern_index|\n token = tokens[pattern_index + begin_index]\n \n # Check flags\n (@requirements.select {|r| r[0] == pattern_index}).each do |r|\n return false, nil if r[2] == true && !token.flagged?(r[1])\n return false, nil if r[2] == false && token.flagged?(r[1])\n end\n \n # Check text of rule\n if rule.is_a?(String)\n if rule.casecmp(token.text) == 0\n match_data << ReplacementMatch.new(token)\n else\n return false, nil\n end\n elsif rule.is_a?(Regexp)\n data = rule.match(token.text)\n if data != nil\n match_data << ReplacementMatch.new(token, data.to_a.drop(1))\n else\n return false, nil\n end\n end\n end\n \n return true, match_data\n end",
"title": ""
}
] |
[
{
"docid": "10adf84e6d20eff8c285881682f917a7",
"score": "0.68129534",
"text": "def matching_tokens(tokens, index)\n # TODO separate space in the tokenizer\n token = tokens[index].gsub(/\\s/, '')\n starts = [token]\n if OPEN_BRACKETS[token]\n direction = 1\n ends = [OPEN_BRACKETS[token]]\n elsif CLOSE_BRACKETS[token]\n direction = -1\n ends = [CLOSE_BRACKETS[token]]\n elsif OPEN_BLOCK.include?(token)\n if as_modifier?(tokens, index)\n return nil\n end\n direction = 1\n ends = ['end']\n starts = OPEN_BLOCK\n elsif token == 'end'\n direction = -1\n ends = OPEN_BLOCK\n else\n return nil\n end\n\n [starts, ends, direction]\n end",
"title": ""
},
{
"docid": "2b8e557156d4f18ef6dee64b8055a6e7",
"score": "0.65753967",
"text": "def match? goal, index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n index = ignore? index unless @ignoring\r\n goal = goal.to_sym\r\n position = parse_results[index]\r\n found = position.fetch(goal) do\r\n position[goal] = IN_USE # used to prevent inifinite recursion in case user attemts \r\n # a left recursion\r\n _memoize goal, index, send(goal, index), position\r\n end\r\n puts \"found #{goal} at #{index}...#{found} #{source_text[index...found].inspect}\" if found && debug_flag\r\n raise \"Parser cannot handle infinite (left) recursions. Please rewrite usage of '#{goal}'.\" if found == IN_USE\r\n found\r\n end",
"title": ""
},
{
"docid": "8b4e2d3f5cc8162734d1dc9b560cd948",
"score": "0.6493335",
"text": "def tags_match?(tokens, index)\n #puts \"#{self.class}::tags_match?(#{tokens}, #{index}) / #{pattern.inspect}\"\n tags = tokens.map { |x| x.tags }\n matches = 0\n pattern.each_index do |pi|\n # if we're on the last token and there's no more to the right\n return false if tags[index + pi].nil?\n token_tags = tags[index + pi].map(&:type).flatten\n matches += 1 if token_tags.include? pattern[pi]\n end\n\n pattern.size == matches ? true : false\n end",
"title": ""
},
{
"docid": "5b0a8e5bb50420cd08c01d733317fbb7",
"score": "0.61868817",
"text": "def look_ahead x\n @string.index(x) ? true : raise(NotMatching.new(x))\n end",
"title": ""
},
{
"docid": "da38572866bb462b225291c72fd36243",
"score": "0.60769784",
"text": "def is_match(text, pattern, text_index = 0, pat_index = 0)\n # base case, one of the indexes reached the end\n if text_index >= text.length\n return true if pat_index >= pattern.length\n if pat_index + 1 < pattern.length && pattern[pat_index + 1] == '*'\n is_match(text, pattern, text_index, pat_index + 2)\n else\n false\n end\n # if we need a next pattern match but there is none\n elsif pat_index >= pattern.length && text_index < text.length\n return false\n # string matching for character followed by '*'\n elsif pat_index + 1 < pattern.length && pattern[pat_index + 1] == '*'\n if pattern[pat_index] == '.' || text[text_index] == pattern[pat_index]\n is_match(text, pattern, text_index, pat_index + 2) || is_match(text, pattern, text_index + 1, pat_index)\n else\n is_match(text, pattern, text_index, pat_index + 2)\n end\n # string matching for ordinary char or '.'\n elsif pattern[pat_index] == '.' || pattern[pat_index] == text[text_index]\n is_match(text, pattern, text_index + 1, pat_index + 1)\n else\n false\n end\nend",
"title": ""
},
{
"docid": "3a1a8dd270ba6f3baaa81c7e4f1be8e2",
"score": "0.6029988",
"text": "def contain?(pattern, position, root_offset, distance = nil, token = nil, inclusive = false)\r\n unit_offset = inclusive ? 1 : 0\r\n if position == :before_or_after\r\n if (offset = rindex(pattern, root_offset))\r\n match = $~\r\n return match if distance == nil || token == nil || slice(offset, root_offset - offset + unit_offset).scan(token).length <= distance\r\n end\r\n if (offset = index(pattern, root_offset))\r\n match = $~\r\n return match if distance == nil || token == nil || slice(root_offset, offset - root_offset + unit_offset).scan(token).length <= distance\r\n end\r\n elsif position == :before\r\n if (offset = rindex(pattern, root_offset))\r\n match = $~\r\n return match if distance == nil || token == nil || slice(offset, root_offset - offset + unit_offset).scan(token).length <= distance\r\n end\r\n elsif position == :after\r\n if (offset = index(pattern, root_offset))\r\n match = $~\r\n return match if distance == nil || token == nil || slice(root_offset, offset - root_offset + unit_offset).scan(token).length <= distance\r\n end\r\n end\r\n nil\r\n end",
"title": ""
},
{
"docid": "0ae0700f67c3d059bd2cd46f31448218",
"score": "0.599854",
"text": "def match?(pattern, pos = 0)\r\n match(pattern, pos).not_nil?\r\n end",
"title": ""
},
{
"docid": "a5b33d98e51c4ba472f43f1e6526fe90",
"score": "0.59316546",
"text": "def regexp? value, index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n value = correct_regexp! value\r\n index = ignore? index unless @ignoring\r\n found = value.match source_text[index..-1]\r\n# puts \"#{value.inspect} ~= #{found[0].inspect}\" if found\r\n _memoize(value, index, found ? found.end(0) + index : NO_MATCH)\r\n end",
"title": ""
},
{
"docid": "28790181b25b01fd1642d17f5618f82f",
"score": "0.59053916",
"text": "def matches?(pattern)\n @str.index(pattern, @pos) == @pos\n end",
"title": ""
},
{
"docid": "eb3ffb2db9e99cd42f25de49d2eb2c11",
"score": "0.58736765",
"text": "def match(*token_types)\n token_types.each do |token_type|\n if check?(token_type)\n advance\n return true\n end\n end\n false\n end",
"title": ""
},
{
"docid": "7aa2cd36d297734528fb5cf075b3dbf1",
"score": "0.58472514",
"text": "def brute_force_matches string, pattern\n i = 0\n pos = []\n while i + pattern.length - 1 < string.length\n pos << i if string[i..(i + pattern.length - 1)] == pattern\n i += 1\n end\n pos\nend",
"title": ""
},
{
"docid": "c64a590e78a214f44c99d28b3aa4a4fe",
"score": "0.58429676",
"text": "def attempt_match\n matches_before = matches.length\n match_length_before = match_length\n (yield && match_length > match_length_before).tap do |success| # match_length test returns failure if no progress is made (our source position isn't advanced)\n unless success\n @matches = matches[0..matches_before-1]\n update_match_length\n end\n end\n end",
"title": ""
},
{
"docid": "0fb043eceebe0935d79c9308ed6d8f90",
"score": "0.57796687",
"text": "def follow_sequence(sequence, seq_index, match_count, chunk_index, term_matcher)\n state = save_state\n begin\n # match the current term with the current chunk\n next_chunk_index = term_matcher.call\n\n if (match_count + 1) >= sequence[seq_index][:mod].last\n # if the current term has been matched enough times: match the next term with the next chunk\n match_sequence sequence, seq_index + 1, 0, next_chunk_index\n else\n # the current term may accept or requires additional matches: match this term again with the next chunk\n match_sequence sequence, seq_index, match_count + 1, next_chunk_index\n end\n rescue Errors::SequenceUnmatched => e\n restore_state state\n\n # raise an unmatched error unless the current matched count is acceptable\n raise e unless sequence[seq_index][:mod].include? match_count\n\n # didn't work; match the next term with the current chunk\n return match_sequence sequence, seq_index + 1, 0, chunk_index\n end\n end",
"title": ""
},
{
"docid": "931589bd5c631106b8eb7176e2667d72",
"score": "0.5749354",
"text": "def row_pattern?(start, input)\n [@data[start], @data[start+1], @data[start+2]].all?{|word| word == input}\n end",
"title": ""
},
{
"docid": "e262892425004e96eb577e8361d41ddf",
"score": "0.5749071",
"text": "def match_token(sequence, seq_index, chunk_index)\n @current_chunk_index = chunk_index # for peeking\n token_type = sequence[seq_index][:token]\n\n Util::Logger.debug(Util::Options::DEBUG_1) { \" #{token_type}? \".yellow + \"\\\"#{@chunks[chunk_index]}\\\"\" }\n raise Errors::SequenceUnmatched, sequence[seq_index] unless send \"#{token_type}?\", @chunks[chunk_index]\n\n Util::Logger.debug(Util::Options::DEBUG_1) { Util::I18n.t('tokenizer.match').green + token_type.to_s }\n send \"tokenize_#{token_type}\", @chunks[chunk_index]\n\n if token_type == Token::EOL\n Util::Logger.debug(Util::Options::DEBUG_1) { Util::I18n.t('tokenizer.flush').green }\n @output_buffer += @stack\n @chunks.clear\n @stack.clear\n end\n\n @context.last_token_type = token_type\n\n chunk_index + 1\n end",
"title": ""
},
{
"docid": "fd243c08332429e296451b5bdf2f5f2e",
"score": "0.57429975",
"text": "def matches_at_offset(input, input_start_offset)\n reset_current_state\n\n matches = []\n (input_start_offset...input.length).each do |offset|\n token = input[offset]\n self << token\n matches << MatchRef.new(input, input_start_offset..offset) if accept?\n end\n matches\n end",
"title": ""
},
{
"docid": "572be4a7b94d4358fe5da5c9e6393270",
"score": "0.57246",
"text": "def find( regexps, options = {} )\n return if regexps.nil?\n regexp = regexps[ 0 ]\n return if regexp.nil? || regexp == //\n\n direction = options[ :direction ]\n replacement = options[ :replacement ]\n auto_choice = options[ :auto_choice ]\n from_row = options[ :starting_row ] || @last_row\n from_col = options[ :starting_col ] || @last_col\n show_context_after = options[ :show_context_after ]\n\n if options[:starting]\n @num_matches_found = nil\n end\n\n num_replacements = 0\n\n search_area = @search_area || TextMark.new( 0, 0, @lines.size - 1, @lines[ -1 ].size, nil )\n if ! search_area.contains?( from_row, from_col )\n from_row, from_col = search_area.start_row, search_area.start_col\n end\n\n if direction == :opposite\n case @last_search_direction\n when :up\n direction = :down\n else\n direction = :up\n end\n end\n @last_search_regexps = regexps\n @last_search_direction = direction\n\n wrapped = false\n\n finding, match = catch :found do\n\n if direction == :down\n\n # Check the current row first.\n\n index = @lines[ from_row ].index(\n regexp,\n ( @last_finding ? @last_finding.start_col : from_col ) + 1\n )\n if index\n establish_finding( regexps, search_area, from_row, index, Regexp.last_match )\n end\n\n # Check below the cursor.\n\n ( (from_row + 1)..search_area.end_row ).each do |i|\n line = @lines[ i ]\n if i == search_area.end_row\n line = line[ 0...search_area.end_col ]\n end\n index = line.index( regexp )\n if index\n establish_finding( regexps, search_area, i, index, Regexp.last_match )\n end\n end\n\n if index\n establish_finding( regexps, search_area, search_area.end_row, index, Regexp.last_match )\n end\n\n # Wrap around.\n\n wrapped = true\n\n index = @lines[ search_area.start_row ].index( regexp, search_area.start_col )\n if index\n establish_finding( regexps, search_area, search_area.start_row, index, Regexp.last_match )\n end\n\n ( search_area.start_row+1...from_row ).each do |i|\n index = @lines[ i ].index( regexp )\n if index\n establish_finding( regexps, search_area, i, index, Regexp.last_match )\n end\n end\n\n # And finally, the other side of the current row.\n\n if from_row == search_area.start_row\n index_col = search_area.start_col\n else\n index_col = 0\n end\n if index = @lines[ from_row ].index( regexp, index_col )\n if index <= ( @last_finding ? @last_finding.start_col : from_col )\n establish_finding( regexps, search_area, from_row, index, Regexp.last_match )\n end\n end\n\n elsif direction == :up\n\n # Check the current row first.\n\n col_to_check = ( @last_finding ? @last_finding.end_col : from_col ) - 1\n if ( col_to_check >= 0 ) && ( index = @lines[ from_row ][ 0...col_to_check ].rindex( regexp ) )\n establish_finding( regexps, search_area, from_row, index, Regexp.last_match )\n end\n\n # Check above the cursor.\n\n (from_row - 1).downto( 0 ) do |i|\n if index = @lines[ i ].rindex( regexp )\n establish_finding( regexps, search_area, i, index, Regexp.last_match )\n end\n end\n\n # Wrap around.\n\n wrapped = true\n\n (@lines.length - 1).downto(from_row + 1) do |i|\n if index = @lines[ i ].rindex( regexp )\n establish_finding( regexps, search_area, i, index, Regexp.last_match )\n end\n end\n\n # And finally, the other side of the current row.\n\n search_col = ( @last_finding ? @last_finding.start_col : from_col ) + 1\n if index = @lines[ from_row ].rindex( regexp )\n if index > search_col\n establish_finding( regexps, search_area, from_row, index, Regexp.last_match )\n end\n end\n end\n end\n\n if ! finding\n remove_selection DONT_DISPLAY\n clear_matches DO_DISPLAY\n if ! options[ :quiet ] && ( replacement.nil? || num_replacements == 0 )\n $diakonos.set_iline \"/#{regexp.source}/ not found.\"\n end\n else\n if wrapped && ! options[ :quiet ]\n if @search_area\n $diakonos.set_iline( \"(search wrapped around to start of search area)\" )\n else\n $diakonos.set_iline( \"(search wrapped around BOF/EOF)\" )\n end\n end\n\n remove_selection( DONT_DISPLAY )\n @last_finding = finding\n if @settings[ \"found_cursor_start\" ]\n anchor_selection( finding.end_row, finding.end_col, DONT_DISPLAY )\n cursor_to( finding.start_row, finding.start_col )\n else\n anchor_selection( finding.start_row, finding.start_col, DONT_DISPLAY )\n cursor_to( finding.end_row, finding.end_col )\n end\n if show_context_after\n watermark = Curses::lines / 6\n if @last_row - @top_line > watermark\n pitch_view( @last_row - @top_line - watermark )\n end\n end\n\n @changing_selection = false\n\n if regexps.length == 1\n @highlight_regexp = regexp\n highlight_matches\n else\n clear_matches\n end\n display\n\n if replacement\n # Substitute placeholders (e.g. \\1) in str for the group matches of the last match.\n actual_replacement = replacement.dup\n actual_replacement.gsub!( /\\\\(\\\\|\\d+)/ ) { |m|\n ref = $1\n if ref == \"\\\\\"\n \"\\\\\"\n else\n match[ ref.to_i ]\n end\n }\n\n choice = auto_choice || $diakonos.get_choice(\n \"#{num_matches_found} match#{ num_matches_found != 1 ? 'es' : '' } - Replace this one?\",\n [ CHOICE_YES, CHOICE_NO, CHOICE_ALL, CHOICE_CANCEL, CHOICE_YES_AND_STOP ],\n CHOICE_YES\n )\n case choice\n when CHOICE_YES\n paste [ actual_replacement ]\n num_replacements += 1 + find( regexps, direction: direction, replacement: replacement )\n when CHOICE_ALL\n num_replacements += replace_all( regexp, replacement )\n when CHOICE_NO\n num_replacements += find( regexps, direction: direction, replacement: replacement )\n when CHOICE_CANCEL\n # Do nothing further.\n when CHOICE_YES_AND_STOP\n paste [ actual_replacement ]\n num_replacements += 1\n # Do nothing further.\n end\n end\n end\n\n num_replacements\n end",
"title": ""
},
{
"docid": "3c4a5a65c32816201d53562871fb804d",
"score": "0.5717666",
"text": "def match_term(sequence, seq_index, chunk_index)\n if sequence[seq_index][:token]\n chunk_index = match_token sequence, seq_index, chunk_index\n\n elsif sequence[seq_index][:sub_sequence]\n chunk_index = match_sequence sequence[seq_index][:sub_sequence], 0, 0, chunk_index\n\n elsif sequence[seq_index][:branch_sequence]\n chunk_index = match_sequence sequence[seq_index][:branch_sequence], 0, 0, chunk_index\n end\n\n chunk_index\n end",
"title": ""
},
{
"docid": "2f407230e5519904bf743552165ab7f1",
"score": "0.5702659",
"text": "def match(pattern_element)\n @num_match_attempts += 1\n return :no_pattern_element unless pattern_element\n return :skipped if pattern_element.delimiter &&\n (\n if last_match\n last_match.delimiter # don't match two delimiters in a row\n else\n @num_match_attempts > 1 # don't match a delimiter as the first element unless this is the first match attempt\n end\n )\n\n if result = pattern_element.parse(self)\n add_match result, pattern_element.name # success, but don't keep EmptyNodes\n end\n end",
"title": ""
},
{
"docid": "31794b44335b3ba64601f2901fb1f923",
"score": "0.56369245",
"text": "def apply_to_tokens(tokens)\n begin_index = 0\n \n # Loop detection apparatus.\n total_replacements = 0\n maximum_replacements_allowed = tokens.count\n original_tokens = tokens\n \n while begin_index <= tokens.count - @pattern.count\n is_match, match_data = try_match(tokens, begin_index)\n if is_match\n # Apply rule\n replace_with = output_function(match_data)\n before = tokens[0, begin_index]\n after = tokens[begin_index + @pattern.count,\n tokens.count - begin_index - @pattern.count]\n tokens = before.concat(replace_with).concat(after)\n \n # Detect loops...\n total_replacements += 1\n if total_replacements > maximum_replacements_allowed\n puts \"ERROR: Potential infinite loop detected in...\"\n puts self\n return 0, original_tokens\n end\n else\n # Only increment index if rule not applied\n begin_index += 1\n end\n end\n \n return total_replacements, tokens\n end",
"title": ""
},
{
"docid": "7697d5251a4eb60514294a5140b10b6e",
"score": "0.56261456",
"text": "def check? goal, index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n found = match? goal, index\r\n found == NO_MATCH ? NO_MATCH : index\r\n end",
"title": ""
},
{
"docid": "b412aa05f0dcd120e093c9eab907175b",
"score": "0.56245255",
"text": "def allow? goal, index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n found = match? goal, index\r\n found == NO_MATCH ? index : found\r\n end",
"title": ""
},
{
"docid": "e89faf2df700cfea647120483124d340",
"score": "0.5584874",
"text": "def match_position(string, match)\n r = regexp.to_s\n multiple_matched = string.scan(match['_']).length > 1\n match_towards_end = r.end_with?('(?:\\b|\\Z))') &&\n r.index('(?<_>') >= (r.length / 2)\n method = multiple_matched && match_towards_end ? :rindex : :index\n string.send(method, match['_'])\n end",
"title": ""
},
{
"docid": "7f257101c05daf5092388ba803448d59",
"score": "0.5567553",
"text": "def match(pattern, pos=0)\n match_data = get_pattern(pattern).search_region(self, pos, @num_bytes, true)\n Regexp.last_match = match_data\n return match_data\n end",
"title": ""
},
{
"docid": "8d327d82f9663bf73789e7e48c057611",
"score": "0.5557171",
"text": "def check_match(s, start, match, length)\n end",
"title": ""
},
{
"docid": "fd3fe1376007835093c0274dd5852d89",
"score": "0.554512",
"text": "def next_match str, startline = nil, _curpos = nil, endline = nil\n return unless str\n\n ## check current line for more occurrences.\n if !startline\n startline = @current_index\n _curpos ||= (@curpos + 1) # FIXME +1 should only happen if a search has already happened\n #_pos = @list[startline].index(str, _curpos)\n _pos = to_searchable(startline).index(str, _curpos)\n return [startline, _pos + search_offset] if _pos\n startline += 1\n end\n ## Check rest of file\n ## loop through array, check after startline to eof\n @list.each_with_index do | line, ix|\n next if ix < startline\n break if endline && ix > endline\n #_found = line.index(str)\n _found = to_searchable(ix).index(str)\n #$log.debug \" next_match: #{line}: #{_found} \" if _found\n return [ix, _found + search_offset] if _found\n end\n if startline > 0\n # this can get called again since startline was made 1 in above block. FIXME\n #return next_match str, 0, @current_index\n end\n return nil\n end",
"title": ""
},
{
"docid": "42899da3a9c6e8ce959a727fc6223f8e",
"score": "0.5527505",
"text": "def match(*tokens)\r\n\t\t\ttokens.each do |t|\r\n\t\t\t\tif @scanner.matches? [t]\r\n\t\t\t\t\t@scanner.next_token\r\n\t\t\t\t\t# puts \"Matched #{t}\".green\r\n\t\t\t\telse\r\n\t\t\t\t\tskip_error([t])\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend",
"title": ""
},
{
"docid": "3062694b18c6720b930d54050f550202",
"score": "0.54855233",
"text": "def match_sequence(sequence, seq_index, match_count, chunk_index)\n return chunk_index if seq_index >= sequence.size\n\n read_chunk while chunk_index >= @chunks.size\n\n state = save_state\n\n if sequence[seq_index][:branch_sequence]\n sequence[seq_index][:branch_sequence].each do |s|\n begin\n term_matcher = proc { match_sequence [s], 0, 0, chunk_index }\n return follow_sequence sequence, seq_index, match_count, chunk_index, term_matcher\n rescue Errors::SequenceUnmatched\n restore_state state\n end\n end\n\n raise Errors::SequenceUnmatched, sequence[seq_index]\n end\n\n term_matcher = proc { match_term sequence, seq_index, chunk_index }\n follow_sequence sequence, seq_index, match_count, chunk_index, term_matcher\n rescue Errors::SequenceUnmatched => e\n restore_state state\n raise e\n end",
"title": ""
},
{
"docid": "5a9010282b469cc9d1d0fcecd0edab19",
"score": "0.5484101",
"text": "def search(tokens, current_token = nil)\n current_token = tokens.shift unless current_token\n\n if current_token == @fragment || wildcard?\n return self if tokens.empty?\n return @match.search(tokens) if @match\n end\n\n return @left.search(tokens, current_token) if @left && current_token < @fragment\n return @right.search(tokens, current_token) if @right && current_token > @fragment\n nil\n end",
"title": ""
},
{
"docid": "532043b3edf8149e6a00c596ce2fcdfc",
"score": "0.547992",
"text": "def brute_search string, pattern\n pattern_length = pattern.length\n for string_index in (0... string.length)\n match_count = 0\n loop do\n # if a non-match is found, then break.\n break if string[string_index + match_count] != pattern[match_count]\n # if it wasn't a non-match, it must be a match!\n match_count += 1\n # if match_count reaches the length of the pattern, you've found your pattern!\n # return the index in string where the pattern begins\n return string_index if match_count == pattern_length\n end\n end\n return \"not found\"\nend",
"title": ""
},
{
"docid": "a7025600ffdbe09e325b426871c75e86",
"score": "0.5476954",
"text": "def find_match regex, ix0=0, ix1=length()\n $log.debug \" find_match got #{regex} #{ix0} #{ix1}\"\n @last_regex = regex\n @search_start_ix = ix0\n @search_end_ix = ix1\n #@search_found_ix = nil\n @list.each_with_index do |row, ix|\n next if ix < ix0\n break if ix > ix1\n if !row.match(regex).nil?\n @search_found_ix = ix\n return ix \n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "822eebdfd7ff145ec629f79166670243",
"score": "0.54579693",
"text": "def find(inF, start, pattern)\n for i in Range.new(start,inF.length-1)\n if inF[i] =~ pattern\n return i-1\n end\n end\nend",
"title": ""
},
{
"docid": "d6dc555a9b04a227f332ec51d8680236",
"score": "0.54507196",
"text": "def _find_next regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil?\n #$log.debug \" _find_next #{@search_found_ix} : #{@current_index}\"\n fend = @list.size-1\n if start != fend\n start += 1 unless start == fend\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.upto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = 0\n if @search_wrap\n start.upto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "51ffbd98f4f29aa74dd68bc6b80fe8b5",
"score": "0.54507124",
"text": "def start_of_pattern?\n matched_patterns.any?\n end",
"title": ""
},
{
"docid": "d4a37e57c5dfc6fa7d801fa2ee224b66",
"score": "0.5443125",
"text": "def fuzzy_match(pattern, loc = 0, text = self.to_s)\n loc = [0, [loc, text.length - pattern.length].min].max || 0\n\n if text == pattern\n return 0\n elsif text.nil? || text.length == 0\n return nil\n elsif text[loc...loc + pattern.length] == pattern\n return loc\n else\n match = match_bitap(text, pattern, loc)\n return match\n end\n end",
"title": ""
},
{
"docid": "8fe518aa5ac07023d652ebb3981f4ff8",
"score": "0.5420904",
"text": "def match?(chars)\n !end? && chars.include?(current)\n end",
"title": ""
},
{
"docid": "de05d9bbeacffa16aca52450cf2b2629",
"score": "0.5416034",
"text": "def matches_indices(search_string, pattern, stop_at_first_match=false)\n table = BadMatchTable.new(pattern)\n i = pattern.size - 1\n indices = []\n while i < search_string.size\n for j in 0...pattern.size\n if search_string[i-j] != pattern[pattern.size-1-j]\n i += table.slide_offset(search_string[i-j])\n break\n elsif j == pattern.size-1\n indices.append(i-j)\n return indices if stop_at_first_match\n i += 1\n end\n end\n end\n indices\nend",
"title": ""
},
{
"docid": "a7f702c8a1b647818022f066c8d783f2",
"score": "0.53851736",
"text": "def scan(pattern)\n if match = @scanner.scan(pattern)\n @pos += match.size\n @current = match[-1]\n end\n\n match\n end",
"title": ""
},
{
"docid": "99a3403f1a1d3c48cc2cc8bae7f5fbc8",
"score": "0.53825927",
"text": "def match(s,p) \n\t#pat = pattern, like ea*t\n\t#word is like eat, so in this case, true for * and ?\n\t#however, word is eaat, it will be false for ?, and true for *\n\ti = 0\n\tj = 0\n\tstarInd = -1\n\tiInd = -1\n\n\twhile (i < s.size)\n\t\tif j < p.size && (p[j] == '?' || p[j] == s[i])\n\t\t\ti += 1\n\t\t\tj += 1\n\t\telsif j < p.size && p[j] == '*'\n\t\t\tstarInd = j\n\t\t\tiInd = i\n\t\t\tj += 1\n\t\telsif starInd != -1\n\t\t\tj = starInd + 1\n\t\t\ti = iInd + 1\n\t\t\tiInd += 1\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend\n\twhile j < p.size && p[j] == '*'\n\t\tj += 1\n\tend\n\treturn j == p.size\nend",
"title": ""
},
{
"docid": "802ed7583c3fd81d4a41dde2a6ab14cb",
"score": "0.53803533",
"text": "def _find_next regex=@last_regex, start = @search_found_ix, first_time = false\n #raise \"No previous search\" if regex.nil?\n warn \"No previous search\" and return if regex.nil?\n #$log.debug \" _find_next #{@search_found_ix} : #{@current_index}\"\n extra = 1 # first time search on current line, next time skip current line or else we get stuck.\n extra = 0 if first_time\n start ||= 0\n fend = @list.size-1\n if start != fend\n start += extra unless start == fend # used to be +=1 so we don't get stuck in same row\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.upto(fend) do |ix| \n row1 = @list[ix].to_s\n\n # 2011-09-29 crashing on a character F3 in log file\n # 2013-03-20 - 18:25 187compat\n if row1.respond_to? :encode\n row = row1.encode(\"ASCII-8BIT\", :invalid => :replace, :undef => :replace, :replace => \"?\")\n else\n row = row1\n end\n\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n ix += (@_header_adjustment || 0)\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = 0\n if @search_wrap\n start.upto(fend) do |ix| \n row = @list[ix].to_s\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n ix += (@_header_adjustment || 0)\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "bc67a58e820392a438d5439ba3a5dbca",
"score": "0.5366754",
"text": "def match_main(text, pattern, loc)\n # Check for null inputs.\n if [text, pattern].any?(&:nil?)\n raise ArgumentError.new(\"Null input. (match_main)\")\n end\n\n loc = [0, [loc, text.length].min].max\n if text == pattern\n # Shortcut (potentially not guaranteed by the algorithm)\n 0\n elsif text.empty?\n # Nothing to match\n -1\n elsif text[loc, pattern.length] == pattern\n # Perfect match at the perfect spot! (Includes case of null pattern)\n loc\n else\n # Do a fuzzy compare.\n match_bitap(text, pattern, loc)\n end\n end",
"title": ""
},
{
"docid": "76bc837053829c7dd6d9a7fe62a6c8c0",
"score": "0.5364602",
"text": "def match (pos_matches)\n #binding.pry\n pos_matches.select do |pos|\n pos.split(\"\").sort == self.word.split(\"\").sort\n end\n end",
"title": ""
},
{
"docid": "bacb52fcdb5a5f6470a3b070e9e8065c",
"score": "0.5358555",
"text": "def position_for_match(start_pos, regex, forwards=true)\n begin\n matching_line = nil\n open(start_pos)\n fr = @fh\n if !forwards\n fr = LogMerge::ReverseFileReader.new(@fh)\n end\n fr.each_line do |line|\n if regex.match line\n matching_line = line\n break\n end\n end\n if matching_line.nil?\n nil\n else\n start_pos = fr.pos\n if !forwards\n # If searching backwards, if the match is found, in the file line that the log starts on, eg\n # DATE LEVEL .... match ....\n # Then the fh.pos will give the start of that line and reading backwards from there will give\n # the previous line to the match. So we need to adjust the positing forwards by the line length\n # and read back from there to find the correct line\n start_pos += matching_line.length\n end\n read_lines_backwards_from_position(1, start_pos).first.start_file_position\n end\n ensure\n close\n end\n end",
"title": ""
},
{
"docid": "4dffba54592c16db7f22c397bede7fa5",
"score": "0.5355154",
"text": "def find_match_forward(text)\n @position = -1 if @position == length - 1 && @cycle\n offset = @position ? @position + 1 : 0\n @history[offset..-1].detect.with_index do |item, index|\n if item.start_with?(text)\n @position = index + offset\n end\n end\n end",
"title": ""
},
{
"docid": "9f225335dacdb66ba7c083292b604437",
"score": "0.53473526",
"text": "def find_pattern_run(pattern)\n return nil if pattern.length == 0\n start = 0\n run = 0\n\n i = 0\n while(i < (self.length-pattern.length+1)) do\n if self[i..i+pattern.length-1] == pattern then\n start = i if start == 0\n run += 1\n i += pattern.length-1 # -1 to compensate for later addition\n #puts \"*\"\n else\n #puts \" r? #{run > 1}\"\n return start, run if run > 1\n start = 0\n run = 0\n end\n #puts \"P: #{ self[i..i+pattern.length-1]}, start: #{start}, run: #{run}\"\n i+= 1\n end \n return start, run if run > 1\n return nil\n end",
"title": ""
},
{
"docid": "f8727294ea0662551dc05234267068dc",
"score": "0.5340841",
"text": "def try_matches(matches, pre_result = nil)\n match_result = nil\n # Begin at the current position in the input string of the parser\n start = @parser.pos\n matches.each do |match|\n # pre_result is a previously available result from evaluating expressions\n result = pre_result ? [pre_result] : []\n\n # We iterate through the parts of the pattern, which may be\n # [:expr,'*',:term]\n match.pattern.each_with_index do |token,index|\n\n # If this \"token\" is a compound term, add the result of\n # parsing it to the \"result\" array\n\n if @parser.rules[token]\n result << @parser.rules[token].parse\n unless result.last\n result = nil\n break\n end\n @logger.debug(\"Matched '#{@name} = #{match.pattern[index..-1].inspect}'\")\n else\n # Otherwise, we consume the token as part of applying this rule\n nt = @parser.expect(token)\n if nt\n result << nt\n if @lrmatches.include?(match.pattern) then\n pattern=[@name]+match.pattern\n else\n pattern=match.pattern\n end\n @logger.debug(\"Matched token '#{nt}' as part of rule '#{@name} <= #{pattern.inspect}'\")\n else\n result = nil\n break\n end\n end\n end\n if result\n if match.block\n match_result = match.block.call(*result)\n else\n match_result = result[0]\n end\n @logger.debug(\"'#{@parser.string[start..@parser.pos-1]}' matched '#{@name}' and generated '#{match_result.inspect}'\") unless match_result.nil?\n break\n else\n # If this rule did not match the current token list, move\n # back to the scan position of the last match\n @parser.pos = start\n end\n end\n\n return match_result\n end",
"title": ""
},
{
"docid": "164af2567ebfd5f37e11b6d809bf48a0",
"score": "0.53190386",
"text": "def matches\n post_process(candidate.empty? ? completions : completions.select { |c| c.start_with?(candidate) })\n end",
"title": ""
},
{
"docid": "6099250d89fbb11f7d2e00979167fbfd",
"score": "0.5316565",
"text": "def match(pattern); end",
"title": ""
},
{
"docid": "64b133eb509d79d6f029c8d348f6de8f",
"score": "0.5313156",
"text": "def match(pattern)\n if (@line =~ pattern)\n @line = $'.lstrip\n result = Regexp.last_match.to_a[1,10]\n case result.length\n when 0 then true\n when 1 then result.first\n else result\n end\n end\n end",
"title": ""
},
{
"docid": "f18deef25af76a69e187ed93806d9019",
"score": "0.530678",
"text": "def afind pattern, offset = 0, params = TRE.fuzziness(0)\n\t\trange = aindex pattern, offset, params\n\n\t\trange && self[range]\n\tend",
"title": ""
},
{
"docid": "bdaec55cb9eaf03772d84f13dcfa928c",
"score": "0.5293034",
"text": "def column_pattern?(start, input)\n [@data[start], @data[start+3], @data[start+6]].all?{|word| word == input}\n end",
"title": ""
},
{
"docid": "8ddd17f10ec2103ea8a9d2e3605d3769",
"score": "0.52913517",
"text": "def try_matches(matches, pre_result = nil)\n match_result = nil\n # Begin at the current position in the input string of the parser\n start = @parser.pos\n matches.each do |match|\n # pre_result is a previously available result from evaluating expressions\n result = pre_result.nil? ? [] : [pre_result]\n\n # We iterate through the parts of the pattern, which may be e.g.\n # [:expr,'*',:term]\n match.pattern.each_with_index do |token,index|\n \n # If this \"token\" is a compound term, add the result of\n # parsing it to the \"result\" array\n if @parser.rules[token]\n result << @parser.rules[token].parse\n if result.last.nil?\n result = nil\n break\n end\n @logger.debug(\"Matched token '#{token.inspect}' as part of rule '#{@name}' <= #{match.pattern.inspect}\")\n else\n # Otherwise, we consume the token as part of applying this rule\n nt = @parser.expect(token)\n if nt\n result << nt\n if @lrmatches.include?(match.pattern) then\n pattern = [@name]+match.pattern\n else\n pattern = match.pattern\n end\n @logger.debug(\"Matched token '#{nt}' as part of rule '#{@name} <= #{pattern.inspect}'\")\n else\n result = nil\n break\n end\n end\n end\n if result\n if match.block\n match_result = match.block.call(*result)\n else\n match_result = result[0]\n end\n @logger.debug(\"'#{result.inspect}' matched '#{@name}' and generated '#{match_result.inspect}'\") unless match_result.nil?\n break\n else\n # If thproductis rule did not match the current token list, move\n # back productto the scan position of the last match\n @parser.pos = start\n end\n end\n \n return match_result\n end",
"title": ""
},
{
"docid": "444d4031b49f1384117b52aaf68c23e4",
"score": "0.52569115",
"text": "def match_first_son(string, position)\n return if not patterns\n\n earliest_match = nil\n earliest_match_offset = nil\n patterns.each do |pattern|\n next unless match = pattern.match_first(string, position)\n\n match_offset = match_offset(match[1]).first\n return match if match_offset == 0 # no need to look any further\n\n if not earliest_match or earliest_match_offset > match_offset\n earliest_match = match\n earliest_match_offset = match_offset\n end\n end\n\n earliest_match\n end",
"title": ""
},
{
"docid": "3fca2ade1b071424efa40ae785fcdd67",
"score": "0.5252145",
"text": "def isCorrectToken(tokens, i, str)\n return tokens[i][1] == str\nend",
"title": ""
},
{
"docid": "806b24f0d9db7bc4731ec2d90f31a9bd",
"score": "0.52350336",
"text": "def index(pattern)\n if pattern.class == String\n if i = @text.index(pattern, @cursor+1)\n return (i+1)\n end\n elsif pattern.class == Regexp\n if m = @text[@cursor+1..@text.length].match(pattern)\n return (@text.index(m[0], @cursor+1)+1)\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "7ad6d9babaf9745be1967e8ecae5e560",
"score": "0.52343225",
"text": "def return_next_match binding, *args\n first = nil\n ix = 0\n filelist().each_with_index do |elem,ii|\n if binding.call(elem.to_s, *args)\n first ||= ii\n if ii > $cursor \n ix = ii\n break\n end\n end\n end\n return first if ix == 0\n return ix\n end",
"title": ""
},
{
"docid": "60ca4b9ab3c36411e99c07679e1077a8",
"score": "0.52174187",
"text": "def do_match (opts)\n\tif (params = opts[:parameters]) && params.size(:seq) > 0 &&\n\t params[0].is_a?(::Regexp)\n\t params[0].in_rubyverse(@template).evaluate :method => 'match',\n\t :parameters => Sarah[ @original, *params[1..-1].values ]\n\telse nil\n\tend\n end",
"title": ""
},
{
"docid": "24365a14612c2ded3a13dbbd70cca342",
"score": "0.5214593",
"text": "def expect *patterns, &block\n patterns = pattern_escape(*patterns)\n @end_time = 0\n if (@timeout != 0)\n @end_time = Time.now + @timeout\n end\n\n @before = ''\n matched_index = nil\n while (@end_time == 0 || Time.now < @end_time)\n return nil if (@read_fh.closed?)\n @last_match = nil\n @buffer_sem.synchronize do\n patterns.each_index do |i|\n if (match = patterns[i].match(@buffer))\n @last_match = match\n @before = @buffer.slice!(0...match.begin(0))\n @match = @buffer.slice!(0...match.to_s.length)\n matched_index = i\n break\n end\n end\n @buffer_cv.wait(@buffer_sem) if (@last_match.nil?)\n end\n unless (@last_match.nil?)\n unless (block.nil?)\n instance_eval(&block)\n end\n return matched_index\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "c762422b2091d074af85191819f40669",
"score": "0.52142835",
"text": "def rindex(target, position = (length - 1))\n case target\n when Regexp then\n return length if target.source.empty?\n when String then\n return 0 if self.empty? and target.empty?\n return length if target.empty?\n target = Regexp.new Regexp.quote(target)\n when Fixnum then\n begin\n target = Regexp.new Regexp.quote(target.chr)\n rescue RangeError\n return nil\n end\n end\n\n # HACK really I want to start matching at the front and move 1 beyond\n # until no more matches\n position.downto 0 do |i|\n return i if self[i..-1] =~ target\n end\n\n return nil # not found\n end",
"title": ""
},
{
"docid": "df249bba9478a887ead2a11625043d30",
"score": "0.520354",
"text": "def match(pattern, text)\n # If the pattern is exhausted, the text matched\n if pattern == \"\"\n return true\n # We can match the end of strings with `$`\n elsif text == \"\" && pattern == \"$\"\n return true\n # `?` denotes optional single-character matches\n elsif pattern[1] == \"?\"\n return match_question(pattern, text)\n # `*` allows zero or more matches of the prior character\n elsif pattern[1] == \"*\"\n return match_star(pattern, text)\n end\n\n return match_one(pattern[0], text[0]) &&\n match(pattern[1..-1], text[1..-1])\nend",
"title": ""
},
{
"docid": "bbe688b4bedd1a89135b32f0715cfd3a",
"score": "0.51904064",
"text": "def find_( direction, case_sensitive, regexp_source, replacement, starting_row, starting_col, quiet )\n return if regexp_source.nil? || regexp_source.empty?\n\n rs_array = regexp_source.newline_split\n regexps = Array.new\n exception_thrown = nil\n\n rs_array.each do |source|\n begin\n warning_verbosity = $VERBOSE\n $VERBOSE = nil\n regexps << Regexp.new(\n source,\n case_sensitive ? nil : Regexp::IGNORECASE\n )\n $VERBOSE = warning_verbosity\n rescue RegexpError => e\n if not exception_thrown\n exception_thrown = e\n source = Regexp.escape( source )\n retry\n else\n raise e\n end\n end\n end\n\n if replacement == ASK_REPLACEMENT\n replacement = get_user_input( \"Replace with: \", @rlh_search )\n end\n\n if exception_thrown and not quiet\n set_iline( \"Searching literally; #{exception_thrown.message}\" )\n end\n\n @current_buffer.find(\n regexps,\n :direction => direction,\n :replacement => replacement,\n :starting_row => starting_row,\n :starting_col => starting_col,\n :quiet => quiet,\n :show_context_after => @settings[ 'find.show_context_after' ]\n )\n @last_search_regexps = regexps\n end",
"title": ""
},
{
"docid": "0fe13e5bb4e1a57b4c6bebafe549c58c",
"score": "0.51796573",
"text": "def match(x)\n if $lookahead == x\n lookahead\n else\n expected x\n end\nend",
"title": ""
},
{
"docid": "2782ca945fcb429edb409d423861dd29",
"score": "0.51796347",
"text": "def get_known_match(pos)\n possible_matches.values.select{|set| set.include?(pos)}&.flatten(1)&.select{|p| p != pos}&.first\n end",
"title": ""
},
{
"docid": "a4f8a67f1fa8def4dc02a40ae57825aa",
"score": "0.5175566",
"text": "def eof index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n index >= source_text.length ? index : NO_MATCH\r\n end",
"title": ""
},
{
"docid": "99b6aeafa964d808f2bcf8084186ae95",
"score": "0.5157186",
"text": "def scan_for_start(line, index)\n return unless (start_match_data = @start_match.match line)\n\n @start_of_include = index + 1\n /^#{start_match_data[1]}/\n end",
"title": ""
},
{
"docid": "c6eb8b46742d5f5508dbe31f14062508",
"score": "0.515158",
"text": "def next_matches(r)\n @scanner.check(r)\n end",
"title": ""
},
{
"docid": "1ab86f7d9ed94321a950e8c5597c22c5",
"score": "0.5118556",
"text": "def _find_prev regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil?\n #$log.debug \" _find_prev #{@search_found_ix} : #{@current_index}\"\n if start != 0\n start -= 1 unless start == 0\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.downto(0) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = @list.size-1\n if @search_wrap\n start.downto(fend) do |ix| \n row = @list[ix]\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "382a556a46406a1333d27f2b55cef9f3",
"score": "0.5108882",
"text": "def offset_matches_rule?(offset, rule_offset); end",
"title": ""
},
{
"docid": "4a084a45e2cc45ba95557d7cc129255f",
"score": "0.51050013",
"text": "def match?(character)\n return false if at_end?\n return false if source[@current] != character\n\n @current += 1\n return true\n end",
"title": ""
},
{
"docid": "c9c022bffabf7c5e9167513023fa6b3e",
"score": "0.509687",
"text": "def scan_until(pattern)\n if match = @scanner.scan_until(pattern)\n @pos += match.size\n @current = match[-1]\n end\n\n match\n end",
"title": ""
},
{
"docid": "f7719948f295cdabf258a8606548a244",
"score": "0.5092954",
"text": "def dissallow? goal, index\r\n return NO_MATCH if index == NO_MATCH # allow users to not check results of a sequence\r\n found = match? goal, index\r\n found == NO_MATCH ? index : NO_MATCH\r\n end",
"title": ""
},
{
"docid": "e37c3193e04601a8148b12dcea7135a0",
"score": "0.5091738",
"text": "def exact_match?(position)\n @guess[position] == @secret[position]\n end",
"title": ""
},
{
"docid": "dfb1139b9181f53e823b01ff0ff30d25",
"score": "0.5089103",
"text": "def expect *patterns, &block\n @logger.debug(\"Expecting: #{patterns.inspect}\") if @logger.debug?\n patterns = pattern_escape(*patterns)\n @end_time = 0\n if (@timeout != 0)\n @end_time = Time.now + @timeout\n end\n\n @before = ''\n matched_index = nil\n while (@end_time == 0 || Time.now < @end_time)\n raise ClosedError.new(\"Read filehandle is closed\") if (@read_fh.closed?)\n break unless (read_proc)\n @last_match = nil\n patterns.each_index do |i|\n if (match = patterns[i].match(@buffer))\n log_buffer(true)\n @logger.debug(\" Matched: #{match}\") if @logger.debug?\n @last_match = match\n @before = @buffer.slice!(0...match.begin(0))\n @match = @buffer.slice!(0...match.to_s.length)\n matched_index = i\n break\n end\n end\n unless (@last_match.nil?)\n unless (block.nil?)\n instance_eval(&block)\n end\n return matched_index\n end\n end\n @logger.debug(\"Timeout\")\n return nil\n end",
"title": ""
},
{
"docid": "0489b333d56d357b21de0dee0fb77a43",
"score": "0.5086731",
"text": "def =~ string\n x=match(string)\n x && x.index\n end",
"title": ""
},
{
"docid": "ac84400a6aa271f9b352615df34d3dc6",
"score": "0.50847465",
"text": "def matches(text)\n # Match every character\n (0...text.length).map do |index|\n Match.new(index, index+1)\n end\n end",
"title": ""
},
{
"docid": "00d38d837df8a4f204d94376211db0bb",
"score": "0.50834143",
"text": "def _find_prev regex=@last_regex, start = @search_found_ix, first_time = false\n #TODO the firsttime part, see find_next\n #raise \"No previous search\" if regex.nil?\n warn \"No previous search\" and return if regex.nil?\n #$log.debug \" _find_prev #{@search_found_ix} : #{@current_index}\"\n if start != 0\n start -= 1 unless start == 0\n @last_regex = regex\n @search_start_ix = start\n regex = Regexp.new(regex, Regexp::IGNORECASE) if @search_case\n start.downto(0) do |ix| \n row = @list[ix].to_s\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n ix += (@_header_adjustment || 0)\n @search_found_ix = ix\n return ix \n end\n end\n end\n fend = start-1\n start = @list.size-1\n if @search_wrap\n start.downto(fend) do |ix| \n row = @list[ix].to_s\n m=row.match(regex)\n if !m.nil?\n @find_offset = m.offset(0)[0]\n @find_offset1 = m.offset(0)[1]\n ix += (@_header_adjustment || 0)\n @search_found_ix = ix\n return ix \n end\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "ea36c86de81c414fe41193dd4cc4d1f6",
"score": "0.5075264",
"text": "def parse! scanner, tokens, pattern, type\n return false unless token = scanner.scan(pattern)\n position = scanner.char_pos\n tokens << Greeb::Span.new(position - token.length,\n position,\n type)\n end",
"title": ""
},
{
"docid": "d800a3f88571d59895986051a69ccccd",
"score": "0.5070453",
"text": "def same_state?(pos, match_str)\n pos == @last_pos && match_str == @last_completion\n end",
"title": ""
},
{
"docid": "18f1ab385c42cbb359d5abe3506409d2",
"score": "0.50676143",
"text": "def matchToken(s)\n Tokens.each do |t, v|\n if s.match(v)\n return [t,s]\n end\n end\n nil\nend",
"title": ""
},
{
"docid": "30ebe3a027392821f097a442bde06d09",
"score": "0.50638926",
"text": "def scan_match_arg_tokens\n @arg_tokens.each do |(str, length)|\n next unless @ss.scan(/#{str}/)\n\n (1...length).each do |idx|\n @line_queue.push token_list(@ss[idx])\n end\n @line_queue.push [:STRING, @ss[length]] # last element\n end\n @ss.matched?\n end",
"title": ""
},
{
"docid": "57f47a352bb70b7e8046efddf913577f",
"score": "0.5062039",
"text": "def next_match char\n data = get_content\n row = focussed_index + 1\n row.upto(data.length-1) do |ix|\n val = data[ix].chomp\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #AND VAL != CURRval\n return ix\n end\n end\n row = focussed_index - 1\n 0.upto(row) do |ix|\n val = data[ix].chomp\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #and val != currval\n return ix\n end\n end\n return -1\n end",
"title": ""
},
{
"docid": "5beffbad13e92e7f847276dab4338f05",
"score": "0.5057705",
"text": "def next_match char\n data = get_content\n row = focussed_index + 1\n row.upto(data.length-1) do |ix|\n #val = data[ix].chomp rescue return # 2010-01-05 15:28 crashed on trueclass\n val = data[ix].to_s rescue return # 2010-01-05 15:28 crashed on trueclass\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #AND VAL != CURRval\n return ix\n end\n end\n row = focussed_index - 1\n 0.upto(row) do |ix|\n #val = data[ix].chomp\n val = data[ix].to_s\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #and val != currval\n return ix\n end\n end\n return -1\n end",
"title": ""
},
{
"docid": "2776112662e9b7ea127517fea08d66a5",
"score": "0.505083",
"text": "def looking_at?(type)\n next_token.type == type\n end",
"title": ""
},
{
"docid": "ceb440a0e58482a182c304fcce2f9794",
"score": "0.5050566",
"text": "def possible_regex?\n prev_token = tokens.reject { |r|\n FORMATTING_TOKENS.include?(r.type)\n }.last\n\n return true if prev_token.nil?\n\n REGEX_PREV_TOKENS.include?(prev_token.type)\n end",
"title": ""
},
{
"docid": "67cd8ae0dc31aaeef8da8729c50be668",
"score": "0.5050286",
"text": "def find_prev regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil? # @last_regex.nil?\n $log.debug \" find_prev #{@search_found_ix} : #{@current_index}\"\n start -= 1 unless start == 0\n @last_regex = regex\n @search_start_ix = start\n start.downto(0) do |ix| \n row = @list[ix]\n if !row.match(regex).nil?\n @search_found_ix = ix\n return ix \n end\n end\n return nil\n #return find_match @last_regex, start, @search_end_ix\n end",
"title": ""
},
{
"docid": "1b93423196e7d0681cb9794714e012a1",
"score": "0.50492096",
"text": "def get_start_index( text )\n return @computed_start unless @computed_start.nil?\n if starting_with.kind_of?( Regexp )\n# FIXME This was just a test to alter the inner workings. Didn't go too well. Either remove or change the whole class!\n# matchdata = starting_with.match( text )\n# if matchdata && matchdata.captures.size > 0\n# @computed_start = matchdata.begin(0)\n# @computed_end = @computed_start + matchdata.captures.first.size\n# else\n @computed_start = ( text =~ starting_with )\n# end\n elsif starting_with.kind_of?( Fixnum )\n @computed_start = starting_with\n else\n @computed_start = nil\n end\n end",
"title": ""
},
{
"docid": "ceb440a0e58482a182c304fcce2f9794",
"score": "0.5049185",
"text": "def possible_regex?\n prev_token = tokens.reject { |r|\n FORMATTING_TOKENS.include?(r.type)\n }.last\n\n return true if prev_token.nil?\n\n REGEX_PREV_TOKENS.include?(prev_token.type)\n end",
"title": ""
},
{
"docid": "ed14ba16c1c94a2242670f16bf6a9c90",
"score": "0.5047836",
"text": "def OLDnext_match str\n _calculate_column_offsets unless @coffsets\n first = nil\n ## content can be string or Chunkline, so we had to write <tt>index</tt> for this.\n @list.each_with_index do |fields, ix|\n #col = line.index str\n #fields.each_with_index do |f, jx|\n #@chash.each_with_index do |c, jx|\n #next if c.hidden\n each_column do |c,jx|\n f = fields[c.index]\n # value can be numeric\n col = f.to_s.index str\n if col\n col += @coffsets[jx]\n first ||= [ ix, col ]\n if ix > @current_index\n return [ix, col]\n end\n end\n end\n end\n return first\n end",
"title": ""
},
{
"docid": "93be5cbd6afd324149bdd52a0f1e7101",
"score": "0.5046007",
"text": "def index(arg, fixnum = -1)\r\n ignore_ending = (fixnum > 0) ? fixnum : 0\r\n ignore_beginning = (fixnum < 0) ? -fixnum - 1: 0\r\n\r\n if (arg.class == String)\r\n return nil if arg.length > self.length\r\n ignore_beginning.upto(self.length - arg.length - ignore_ending) do |i|\r\n return i if (self[i,arg.length] == arg)\r\n end\r\n elsif (arg.class == Fixnum)\r\n return index(\"\" << arg, fixnum)\r\n elsif (arg.class == Regexp)\r\n string_to_match = self[ignore_beginning, self.length - ignore_ending - ignore_beginning]\r\n match_res = arg.match(string_to_match)\r\n return match_res.begin(0) + ignore_beginning if match_res != nil\r\n else\r\n raise TypeError.new(\"type mismatch: \" + arg.class + \" given\")\r\n end\r\n nil\r\n end",
"title": ""
},
{
"docid": "0350d2946d7bb84358c6c0f97f2c0ab6",
"score": "0.50428826",
"text": "def should_insert_mult?(matched)\n match_start_pos = pos - matched.size\n\n # true if matched char preceded by a closing token\n return true if (match_start_pos > 0) && (/[0-9\\)\\}]/ =~ string[match_start_pos - 1])\n\n #true if matched number and next is a char\n return true if matched.is_numeric? && /[a-z]/ =~ string[pos]\n\n # true if matched char and next is number\n return true if /[a-z]/ =~ matched && string[pos] && string[pos].is_numeric?\n\n # true if next char is an open parentheses\n return true if /[\\(\\{]/ =~ string[pos] && /[a-z0-9\\)\\}]/ =~ matched\n\n #true if next char is latex opening token\n return true if /^\\\\frac/ =~ string[pos..pos+4] && /[a-z0-9\\)\\}]/ =~ matched\n\n false\n end",
"title": ""
},
{
"docid": "f592ed02c139239c48565ab229e1b673",
"score": "0.5042703",
"text": "def next_token(tokens, ss)\n pos = ss.pos\n token_type, _ = current_matchers(tokens).find { |_, pattern| ss.scan(pattern) }\n\n Token.new(token_type, ss.matched, pos)\n end",
"title": ""
},
{
"docid": "0cf1a23dd32c10a6936682e61c216ff0",
"score": "0.50418353",
"text": "def match_position_by_pixel_strings\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n\n catch :try_next_position do\n puts \"Checking search image at #{x}, #{y}\" if @verbose\n\n template_image.rows.times do |j|\n template_image.columns.times do |i|\n\n t_pixel = template_image.export_pixels_to_str(i, j, 1, 1)\n s_pixel = search_image.export_pixels_to_str(x+i, y+j, 1, 1)\n\n if s_pixel != t_pixel\n throw :try_next_position\n end\n\n end # template_image.rows.times do\n end # template_image.columns.times do\n\n # Success! We made it through the whole \n # template at this position.\n self.match_result = x, y\n throw :found_match\n\n end # catch :try_next_position\n\n end\n\n end\n end # catch :found_match\n return match_result\n end",
"title": ""
},
{
"docid": "dd94acb62a71b6fe68b67daf4befbb10",
"score": "0.50416446",
"text": "def match(s,p)\n i=0\n w=p.length() #w is how long the search substring is\n while submatch(s,i,p,w) < w #check submatch and compare to given bove\n i = i + 1\n end\n i\nend",
"title": ""
},
{
"docid": "07ea32bb77dbe9b6b8ae0492e0422369",
"score": "0.5036986",
"text": "def match?(pattern, ast, *args)\n Matcher.new(pattern, ast, *args).match?\n end",
"title": ""
},
{
"docid": "adea5b1753c6d10ad05776a3243c92ce",
"score": "0.5036152",
"text": "def look_ahead(number=1)\n @tokens[@index + number - 1]\n end",
"title": ""
},
{
"docid": "73f70bcf1682e5d328b9cd915d6e4baa",
"score": "0.5033679",
"text": "def reverse_match(pattern, offset = -1, greedy = true)\r\n start_index = rindex(pattern, offset)\r\n if start_index\r\n first_match = $~\r\n if greedy\r\n last_character_index = first_match.offset(0)[1]\r\n last_match = first_match\r\n \r\n # decrement start_index until we back up one character too far, then return the last good match\r\n start_index -= 1\r\n while start_index >= 0 && self.index(pattern, start_index) == start_index && $~.offset(0)[1] == last_character_index\r\n last_match = $~\r\n start_index -= 1\r\n end\r\n \r\n return last_match\r\n else\r\n first_match\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "b8f9c97c0fa34d87375f15ed638a357f",
"score": "0.5025954",
"text": "def match_next?(string, i)\n j = (i + 1) % string.length\n string[i] == string[j]\nend",
"title": ""
},
{
"docid": "1173a559b5d1bee0e810b2e4087517bf",
"score": "0.5023888",
"text": "def partially_match?\n @partially_match\n end",
"title": ""
},
{
"docid": "2b4323c19d40369272cfd31415bc26ec",
"score": "0.50161356",
"text": "def match_position_by_full_string\n\n t_width = template_image.columns\n t_height = template_image.rows\n t_pixels = template_image.export_pixels_to_str(0, 0, t_width, t_height)\n\n catch :found_match do\n search_rows.times do |y|\n search_cols.times do |x|\n \n puts \"Checking search image at #{x}, #{y}\" if @verbose\n s_pixels = search_image.export_pixels_to_str(x, y, t_width, t_height)\n \n if s_pixels == t_pixels\n self.match_result = x, y\n throw :found_match\n end\n\n end\n end\n end # catch :found_match\n return match_result\n end",
"title": ""
},
{
"docid": "7b7224a94c48bc0b7a621692744a2ba4",
"score": "0.5015976",
"text": "def find_match(chunk, matchers)\n matchers.each do |matcher|\n match = matcher.match(chunk)\n return match if match\n end\n return nil\n end",
"title": ""
}
] |
17f365ac77cead60a28910b48261b8e2
|
Gets the weather summary data from the darksky website.
|
[
{
"docid": "b4dd5fc2df4b1f9629f0e6197b820e4e",
"score": "0.0",
"text": "def getSummary\n @parsePage.css('span.summary-high-low')\n end",
"title": ""
}
] |
[
{
"docid": "515d6640b6ac4650760f4dcc9f6a6b72",
"score": "0.7628142",
"text": "def get_weather\n\t\tbet_discrete = false\n\t\tweather_response = open('https://api.darksky.net/forecast/9997fed57baa9664ce7817037eed5024/-33.4449336,-70.6568987?lang=es&units=si&exclude=currently,minutely,hourly,alerts,flags')\n\t\tresponse_string = \"\"\n\t\tweather_response.each do |line|\n\t\t response_string << line\n\t\tend\n\t\tweather = JSON.parse(response_string)\n\n\t\tweather[\"daily\"]['data'].each do |day|\n\t\t\tif day['temperatureMax'] > 29\n\t\t\t\tbet_discrete = true\n\t\t\tend\n\t\tend\n\t\tbets_percentage(bet_discrete)\n\tend",
"title": ""
},
{
"docid": "752605a1a121cc5a56a089928390863c",
"score": "0.7196168",
"text": "def fetch_weather\n\t response = HTTParty.get(\"http://api.wunderground.com/api/cdb75d07a23ad227/satellite/q/#{location}/#{cityfixed}.xml\")\n\t parse_response(response)\n\tend",
"title": ""
},
{
"docid": "da61ef125b2edeefb64fd8aa8c3c8358",
"score": "0.7156225",
"text": "def get_weather\n @montreal_statistics = self.get_weather_connection('Montreal')\n content = \"<h2 style=\\\"color:darkblue\\\">The weather in Montreal is #{@montreal_statistics['main']['temp']}C</h2>\"\n puts content\n return content\n end",
"title": ""
},
{
"docid": "7affb6e980b4282908b0adcc4812cdff",
"score": "0.7106639",
"text": "def fetch_weather\n\t response = HTTParty.get(\"http://api.wunderground.com/api/cdb75d07a23ad227/hourly/q/#{location}/#{cityfixed}.xml\")\n\t parse_response(response)\n\tend",
"title": ""
},
{
"docid": "589b59f3902f624abdcacefc71fffee1",
"score": "0.7071593",
"text": "def weather_summary(data)\n ##\n # Sample Summary using !forecast 00687\n # Forecast for: Morovis, PR, US\n # Latitude: 18.32682228, Longitude: -66.40519714\n # Weather is Partly Cloudy, feels like 85 F (27.1 C)\n # UV: 9.5, Humidity: 78%\n # Wind: From the SE at 1.0 MPH Gusting to 5.0 MPH\n # Direction: East, Degrees: 90\n # Last Updated on June 4, 11:25 PM AST\n # More Info: http://www.wunderground.com/US/PR/Morovis.html\n\n %Q{\n Forecast for: #{data.county}, #{data.country}\n Latitude: #{data.lat}, Longitude: #{data.lng}\n Weather is #{data.weather}, #{data.feels_like}\n UV: #{data.uv_level}, Humidity: #{data.relative_humidity}\n Wind: #{data.wind}\n Direction: #{data.wind_direction}, Degrees: #{data.wind_degrees},\n #{data.observation_time}\n More Info: #{data.forecast_url}}\n rescue\n 'Problem fetching the weather summary. Try again later.'\n end",
"title": ""
},
{
"docid": "2870e18f28039ce378854fa30cc1fca7",
"score": "0.6987561",
"text": "def fetch_weather\n\t response = HTTParty.get(\"http://api.wunderground.com/api/cdb75d07a23ad227/forecast10day/q/#{location}/#{cityfixed}.xml\")\n\t if response.nil?\n\t \tredirect_to :back\n\t end\n\t parse_response(response)\n\tend",
"title": ""
},
{
"docid": "53fb25c52293f94e9d9caf36a2d846be",
"score": "0.69400346",
"text": "def weather_details\n @client = YahooWeather::Client.new\n begin\n @response = Timeout.timeout(5) do\n @client.fetch(1_582_504) unless @client.blank?\n end\n @doc = @response.doc unless @response.blank?\n @forecast = @doc['item']['forecast'] unless @doc.blank?\n rescue Net::ReadTimeout, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts e.message\n end\n end",
"title": ""
},
{
"docid": "2c73a17c289eef2f7889ae4db0ea1ed4",
"score": "0.69175303",
"text": "def forecast\n response = HTTParty.get(\"http://api.openweathermap.org/data/2.5/forecast?q=#{city}\")\n JSON.parse(response.body)\n end",
"title": ""
},
{
"docid": "04b92cb2655b9bce0797b0b538deb3eb",
"score": "0.69052666",
"text": "def find_weather\n url = \"http://api.openweathermap.org/data/2.5/forecast?id=524901&APPID={#{API_KEY})\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n weather = JSON.parse(response)\n #^documentation to have the API to have reach and get the weather\n end",
"title": ""
},
{
"docid": "ddd7845ca8bdfc9fe60909432c2805c2",
"score": "0.6841288",
"text": "def get_weather! page, day, time \t\t\t\t\t# Expect day is a number 0-9 indicating days from today\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# time is a number 0-23 indicating the hour of the day\n\n\t\tto_hour = time - @now\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\t\t\t# Get distance from now to target hour\n\t\tjumps = to_hour + 3 \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\t\t\t# Add 3 because we need to jump over three bogus elements in the beginnign\n\t\tif time == 0 then jumps += 2 end\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# Don't know why this is necessary\n\t\tjumps += 25*day\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\t\t\t\t\t\t# Adjust for day\n\n \t# Get weather data\n\t\tweather = page / 'script'\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\t# Look into page JavaScripts\n \tweather = weather[30].to_html.split('\"iso8601\":')[jumps]\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Grab the data section from JavaScripts\n \t\n \thumidity_pos = weather.index('humidity')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get humidity\n \thumidity = weather[humidity_pos+11..humidity_pos+12]\n \tcloud_cover_pos = weather.index('cloudcover')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get cloud cover\n \tcloud_cover = weather[cloud_cover_pos+13..cloud_cover_pos+14]\n \ttemperature_pos = weather.index('temperature')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get temperature\n \ttemperature = weather[temperature_pos+14..temperature_pos+15]\n \tprecipitation_pos = weather.index('pop')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get precipitation\n \tprecipitation = weather[precipitation_pos+5..precipitation_pos+7]\n \twind_pos = weather.index('wind_speed')\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get wind\n \twind = weather[wind_pos+12..wind_pos+13]\n\n \t@data[day][time]['humidity'] = humidity.gsub(/[^0-9]/,'')\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Add data. Also, format by removing nonnumeric info.\n\t @data[day][time]['cloud_cover'] = cloud_cover.gsub(/[^0-9]/,'')\n\t @data[day][time]['temperature'] = temperature.gsub(/[^0-9]/,'')\n\t @data[day][time]['precipitation'] = precipitation.gsub(/[^0-9]/,'')\n\t @data[day][time]['wind'] = wind.gsub(/[^0-9]/,'')\n\n\t # Get time label\n\t if time == 0\n\t \tt_label = \"12AM\"\n\t elsif time < 12\n\t \tt_label = \"#{time}AM\"\n\t elsif time == 12\n\t \tt_label = \"#{time}PM\"\n\t else\n\t \ttimetmp = time - 12\n\t \tt_label = \"#{timetmp}PM\"\n\t end\n\t @data[day][time]['label'] = t_label\n\t offset = Time.new.hour - @now\n\t @data[day][time]['timestamp'] = Time.new.beginning_of_hour + day.days + time.hours - Time.new.hour.hours - offset.hours\n\tend",
"title": ""
},
{
"docid": "d36c377903baddc18ae7f058ba89748d",
"score": "0.67736095",
"text": "def getWeather\n options = { units: \"metric\", APPID: @open_weather }\n OpenWeather::Current.city(\"Sacramento City, CA\", options)\n end",
"title": ""
},
{
"docid": "b9d5b35e02d3d6fe9405be697e7ddc3e",
"score": "0.6770733",
"text": "def weather(m)\n ForecastIO.api_key = \"8826650e770499ac02d3d72d17afd3c8\"\n forecast = ForecastIO.forecast(42.3598, -71.0921)\n humidity = (forecast.currently.humidity) * 100\n response = forecast.currently.summary + \", with a temperature of \" + forecast.currently.temperature.to_s + \" and humidity of \" + humidity.to_s + \"%.\"\n m.reply \"Current weather at MIT (Kendall/MIT, Cambridge, MA):\"\n m.reply response\n end",
"title": ""
},
{
"docid": "b9d5b35e02d3d6fe9405be697e7ddc3e",
"score": "0.6770733",
"text": "def weather(m)\n ForecastIO.api_key = \"8826650e770499ac02d3d72d17afd3c8\"\n forecast = ForecastIO.forecast(42.3598, -71.0921)\n humidity = (forecast.currently.humidity) * 100\n response = forecast.currently.summary + \", with a temperature of \" + forecast.currently.temperature.to_s + \" and humidity of \" + humidity.to_s + \"%.\"\n m.reply \"Current weather at MIT (Kendall/MIT, Cambridge, MA):\"\n m.reply response\n end",
"title": ""
},
{
"docid": "0ff76d06f3b9ea4c8128d2a2b50b91e7",
"score": "0.6707221",
"text": "def index\n response = HTTParty.get(\"http://api.openweathermap.org/data/2.5/weather?APPID=0bd53bfea661dc3aeb620e5fd01c4aff&q=#{weather_params[\"city\"]},#{weather_params[\"country\"]}\")\n if response.parsed_response[\"cod\"] == 200 \n @weather_stat = JSON.parse(response.body)\n p @weather_stat\n else\n @weather_stat = response.parsed_response\n end\n @weather_stat\n end",
"title": ""
},
{
"docid": "6b14c391d12cd5d1478c704c10b60fce",
"score": "0.6680651",
"text": "def get_weather_data(url)\n raise NotImplementedError, \"Function not implemented\"\n end",
"title": ""
},
{
"docid": "a9f232d4f2da8d5703af9465c0e8a353",
"score": "0.66622555",
"text": "def show\n ForecastIO.configure do |c|\n c.api_key = \"1a863a051346e9679b5be7d8a6fb01c7\"\n end\n @meteo = ForecastIO.forecast(@tow.lat, @tow.lon).currently.summary\n end",
"title": ""
},
{
"docid": "5b4f44826fa653156918dbf3098d6f65",
"score": "0.6642539",
"text": "def show\n @weather = OpenWeatherApi.new(\"dae8d10e4ffe898434f2932fc31d48d2\").get_weather(current_user.checklists.last.destination)\n\n @description = @weather['weather'][0]['description']\n @icon = @weather['weather'][0]['icon']\n @temp = @weather['main']['temp']\n end",
"title": ""
},
{
"docid": "7481ae0d0fb52460fb6aa7510b0ffabb",
"score": "0.66358685",
"text": "def weatherApi\n\n options = { units: \"metric\", APPID: \"e70cadf7fe0bb13f9ba7f1f1ead47aff\" }\n request = OpenWeather::Current.city(\"Dublin, IE\", options)\n\n temp = request['main']['temp']\n\n end",
"title": ""
},
{
"docid": "d78b980988e596193df2b0a948202913",
"score": "0.6624354",
"text": "def get_hourly_forecasts\n HourlyWeather.destroy_all\n\n weather_url = \"https://api.darksky.net/forecast/#{ENV[\"DARKSKY_API_LEO\"]}/45.516136,-73.656830?extend=hourly&exclude=daily,minutely\"\n weather_json = open(weather_url).read\n weather = JSON.parse(weather_json)\n next_120_hours = weather[\"hourly\"][\"data\"].slice(0..144)\n\n next_120_hours.each do |weather_condition|\n HourlyWeather.create!(\n summary: weather_condition[\"summary\"],\n temperature: weather_condition[\"temperature\"],\n apparent_temperature: weather_condition[\"apparentTemperature\"],\n cloud_cover: weather_condition[\"cloudCover\"],\n wind_speed: weather_condition[\"windSpeed\"],\n precip_probability: weather_condition[\"precipProbability\"],\n precip_type: weather_condition[\"precipType\"],\n time: Time.at(weather_condition[\"time\"])\n )\n end\n end",
"title": ""
},
{
"docid": "6fb2898220634ed8c89fe4714ae76e35",
"score": "0.661774",
"text": "def weather\n @weather = {}\n\n url = \"http://api.weatherapi.com/v1/current.json?key=e4a2290877b44fc79f5140927221109&q=-6.6413273,107.3890488&aqi=no\"\n response = Net::HTTP.get(URI.parse(url))\n json_response = JSON.parse(response)\n if json_response[\"error\"].nil?\n weather_data = json_response[\"current\"]\n @weather[\"temp\"] = weather_data[\"temp_c\"]\n @weather[\"condition\"] = weather_data[\"condition\"][\"text\"]\n @weather[\"icon\"] = weather_data[\"condition\"][\"icon\"]\n end\n end",
"title": ""
},
{
"docid": "97c14896902f7f49fe038d20f4da1248",
"score": "0.6592638",
"text": "def weather\n @connection.response[\"weather\"].first\n end",
"title": ""
},
{
"docid": "d75ac6e4e9c7cfc35b75c37d0c15c36e",
"score": "0.65788",
"text": "def show\n city_name = @city.name\n open_weather_api = ENV.fetch('OPEN_WEATHER_APPID')\n\n response = HTTParty.get(\"http://api.openweathermap.org/data/2.5/weather?q=#{@city.name},#{@city.country_code}&appid=#{open_weather_api}\")\n @data = response.body\n\n @temp_min = response['main']['temp_min']\n @temp_max = response['main']['temp_max']\n @temp = response['main']['temp']\n @press = response['main']['pressure']\n @rel_humidity = response['main']['humidity']\n # Time of data calculation, unix, UTC\n @time_stamp = Time.at(response['dt']).to_datetime\n\n @weather_description = response['weather'][0]['description']\n\n photo_response = Unsplash::Photo.random(query: @weather_description)\n\n @photo_url = photo_response.urls.small\n @photo_author = photo_response.user.name\n @photo_author_website = photo_response.user.links.html\n\n end",
"title": ""
},
{
"docid": "832a3166224d073018e63c3fce87caf4",
"score": "0.65618277",
"text": "def getWeather()\r\n @response= RestClient::Request.execute(\r\n method: :get,\r\n url: 'http://api.openweathermap.org/data/2.5/forecast?id=524901&APPID=4f0a133d0a455077b361a5e599d95204',\r\n header: {}\r\n )\r\n return @response\r\n end",
"title": ""
},
{
"docid": "1433e8ce28e929e36dde406b9ab44fad",
"score": "0.6527947",
"text": "def forecast(name)\n res = City.get_weather(name, \"forecast\")\n\n unless res['list'].nil?\n temps = []\n res['list'][0, 3].each do |data|\n temps << data['main']['temp'].to_i\n end\n \n # TODO: Make a loop and add date time tooltips\n content_tag(:h4, temps[0]) + content_tag(:h5, temps[1]) + content_tag(:h6, temps[2])\n end\n end",
"title": ""
},
{
"docid": "af3442f535a71ae88c9c8619a5c148ed",
"score": "0.65256494",
"text": "def getWeather\n options = { units: \"metric\", APPID: ENV['open_weather']}\n OpenWeather::Current.city_id(6077243, options)\n end",
"title": ""
},
{
"docid": "38ae09c608d739051c90e4d546470896",
"score": "0.6524496",
"text": "def get_forecast\n target = { target: :forecast, location: get_coordinates }\n @_darksky ||= DarkSkyService.new( target ).target_data\n end",
"title": ""
},
{
"docid": "396229a4917b6a7c97e057b53bc56a9b",
"score": "0.6481792",
"text": "def fetch_weather\n response = RestClient.get(WEATHER_URL)\n body = JSON.parse(response.body)\n {\n text: body['query']['results']['channel']['item']['condition']['text'],\n temperature: body['query']['results']['channel']['item']['condition']['temp']\n }\nend",
"title": ""
},
{
"docid": "8c50bb4e6fd0a0ec2477290260e07e21",
"score": "0.6450292",
"text": "def get_weather!; get_weather(); end",
"title": ""
},
{
"docid": "e0ffdac436250f106da69c64b06de8fa",
"score": "0.6438666",
"text": "def full_data\n if (Time.now - @cache_time).to_i >= @cache_duration\n response = RestClient.get \"https://api.darksky.net/forecast/#{DarkSky.key}/#{@location.join ','}\",\n params: {\n units: @units,\n lang: @language\n }\n @data = JSON.parse response.body, symbolize_names: true\n @cache_time = Time.now\n end\n @data\n end",
"title": ""
},
{
"docid": "1abf2fb077ac2bba834e1b06b830e118",
"score": "0.6438048",
"text": "def getForecast\n options = { units: \"metric\", APPID: @open_weather }\n OpenWeather::Current.city(\"Sacramento City, CA\", options)\n end",
"title": ""
},
{
"docid": "f9d8cdc48061beab01f13abc25fcf654",
"score": "0.6354486",
"text": "def my_api\n my_html_url = \"http://nareshtrainings.com/\"\n doc = Nokogiri::HTML(open(my_html_url))\n @html_result = doc.at_css(\"h2\").text\n \t@html_items = doc.at_css(\"#jm-maincontent p\").text\n\n \tmy_xml_url = \"http://api.openweathermap.org/data/2.5/weather?q=London&mode=xml\"\n \tmy_doc = Nokogiri::XML(open(my_xml_url))\n \t@xml_result = my_doc.xpath(\"//city/@name\").text\n \t@temp = my_doc.xpath(\"//temperature/@value\").text\n \t@dir = my_doc.xpath(\"//direction/@name\").text\n \tmy_stock = \"http://abundancestockadvisors.com/\"\n end",
"title": ""
},
{
"docid": "39274520864dcee022882a14fd749541",
"score": "0.6351023",
"text": "def getWeatherTokyo\n uri = URI('http://weather.livedoor.com/forecast/webservice/json/v1?city=130010')\n weather_data = JSON.parse(Net::HTTP.get(uri))\n today_forecast = weather_data['forecasts'][0]\n tomorrow_forecast = weather_data['forecasts'][1]\n forecast_message = \"#{tomorrow_forecast['dateLabel']}の天気は#{tomorrow_forecast['telop']}です。\" \\\n \"最高気温は#{tomorrow_forecast['temperature']['max']['celsius']}度、\" \\\n \"最低気温は#{tomorrow_forecast['temperature']['min']['celsius']}度です。\"\n\n uri = URI(\"http://api.openweathermap.org/data/2.5/weather?q=\\\"Tokyo\\\",\\\"Japan\\\"&appid=#{ENV['OPENWEATHERMAP_APPID']}\")\n weather = JSON.parse(Net::HTTP.get(uri))\n weather_string = weather['weather'][0]['main'][0, 16].ljust(16, \" \")\n weather_string += \"min: #{ (weather['main']['temp_min'] - 273.15).to_i }\"\n weather_string += \" max: #{ (weather['main']['temp_max'] - 273.15).to_i }\"\n\n return [forecast_message, weather_string]\n end",
"title": ""
},
{
"docid": "d9b0b01b42b0a280e366ee4522cfc00f",
"score": "0.6345945",
"text": "def describe_weather\n weather_object.describe_weather\n end",
"title": ""
},
{
"docid": "7f2339ec9362cd66bcb5b5621204b4a2",
"score": "0.6328504",
"text": "def search_weather(zip)\n\t\tpage = @agent.get('http://wunderground.com') do |page|\n\t\t\tarea_page = search_by_zip(page, zip)\n\t\t\tcalendar_page = find_calendar_page(area_page)\n\t\t\treturn forecast_info(calendar_page)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "fd8631069662d666dd95c1edd44cb467",
"score": "0.63186693",
"text": "def weather_hamburg\n url_hamburg = URI.parse('http://api.openweathermap.org/data/2.5/weather?lat=53.5511&lon=9.9937&&APPID=fecc541c55c2ee50b1ebf1d68067b1e8')\n req_hamburg = Net::HTTP::Get.new(url_hamburg.to_s)\n res_hamburg = Net::HTTP.start(url_hamburg.host, url_hamburg.port) {|http|\n http.request(req_hamburg)}\n puts res_hamburg.body\nend",
"title": ""
},
{
"docid": "78697960aa7f4836b528460726624ec7",
"score": "0.6300022",
"text": "def weather_response\n url = URI(\"http://api.openweathermap.org/data/2.5/weather?q=Vi%C3%B1a%20del%20mar&appid=9484ee17fae08ece349011f24f3ccc6b\")\n # Crear un cliente http\n http = Net::HTTP.new(url.host, url.port)\n # Generar un solicitud\n request = Net::HTTP::Get.new(url)\n # Obtener la respuesta\n response = http.request(request)\n JSON.parse(response.read_body)\nend",
"title": ""
},
{
"docid": "fab0a78f7d85cb5918410946d66e3bdd",
"score": "0.6289514",
"text": "def current_weather\n HTTParty.get(\"http://api.openweathermap.org/data/2.5/weather?q=#{city}\").parsed_response\n end",
"title": ""
},
{
"docid": "441717791a99d5eb95f7ff9512637387",
"score": "0.6287351",
"text": "def getWeather\n options = { units: \"metric\", APPID: @open_weather }\n OpenWeather::Current.city(\"Quebec City, CA\", options)\n end",
"title": ""
},
{
"docid": "f72901febbf4e925b80de92211917296",
"score": "0.627235",
"text": "def getWeatherThen(lat, lng, timeToCompare)\n\tyesterday = (DateTime.now - 1).to_s\n\tkeyDS = \"bdff756c7b33041b10dcef1de7bf1fff/\"\n\texclude = \"?exclude=currently,minutely,alerts,flags\" #hourly\"\n\n\turl = \"https://api.darksky.net/forecast/\" + keyDS + lat + \",\" + lng + \",\" + yesterday + exclude\n\turi = URI(url)\n\tresponse = Net::HTTP.get(uri)\n\tweatherInfo = JSON.parse(response)\n\n\tcheckTime = timeToCompare - (3600 * 24)\n\tweatherInfo[\"hourly\"][\"data\"].each do |hour| \n\t\tif hour[\"time\"] == checkTime\n\t\t\ttempThen = hour[\"temperature\"]\n\t\t\treturn tempThen\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "b33ccf5993637413ee8842556ae550b6",
"score": "0.6269444",
"text": "def get_weather_for_latitude_longitude\n\t\tlatitude, longitude = get_latitude_longitude_for_ip\n\t\tif !(latitude.present?) or !(longitude.present?)\n\t\t\treturn \"Climate couldn't be determined: Lack of information\"\n\t\telse\n\t\t\tweather_based_on_lat_long = RestClient.get \"https://api.openweathermap.org/data/2.5/weather?lat=\" + latitude.to_s + \"&lon=\" + longitude.to_s + \"&appid=7bcc10712fe906ecd190ba0bea2c910e\"\n\t\t\tinfo = JSON.parse weather_based_on_lat_long\n\t\t\treturn info['weather'][0]['main'] + \", \" + info['weather'][0]['description']\n\t\tend\n\tend",
"title": ""
},
{
"docid": "945edf73ef6b405c6095290f2a325f09",
"score": "0.62614983",
"text": "def get_past_weather()\n date_array = get_past_dates()\n @weather_information = []\n date_array.each do |date|\n full_response = get_weather(date)\n\n daily_response = full_response[\"daily\"][\"data\"].first\n # ideal is collection of hash objects of the form, { temperature => [12, 13, 45, 67], pressure => [110, 100, 101] }.. etc\n @weather_information << daily_response\n end\n return @weather_information\n end",
"title": ""
},
{
"docid": "6311117fa51937c9c5d0c928ec261821",
"score": "0.62424004",
"text": "def getForecast\n options = { units: \"metric\", APPID: @open_weather }\n OpenWeather::Current.city(\"Quebec City, CA\", options)\n end",
"title": ""
},
{
"docid": "f27afef9cf3f07dda91a9c39f1782c36",
"score": "0.6221422",
"text": "def city_to_weather\n # City\n # @city = params[:user_city]\n # url_safe_city = URI.encode(@city)\n\n # # Location mapping (wait until setup is availbe)\n # google_url = \"http://maps.googleapis.com/maps/api/geocode/json?address=\"\n # parsed_mapdata = JSON.parse(open(google_url+url_safe_city).read)\n # @lat = parsed_mapdata[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n # @lng = parsed_mapdata[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\n # Weather mapping\n\n # location_url = @lat.to_s+','+@lng.to_s\n # Chicago: 41.8369,-87.6847 (Hard code lat and long to try and get it working)\n location_url = '41.8369,-87.6847'\n darksky_url = \"https://api.forecast.io/forecast/12ab4de221b5a6cd202b2ec39cfa700f/\"\n\n parsed_data = JSON.parse(open(darksky_url+location_url).read)\n\n @day_forecasts = parsed_data[\"daily\"][\"data\"]\n end",
"title": ""
},
{
"docid": "84d0e58fcdf3ad5247222956abdc9a2a",
"score": "0.6194994",
"text": "def weather\r\n temp = current[\"main\"][\"temp\"]\r\n desc = current[\"weather\"][0][\"description\"]\r\n loc = current[\"name\"]\r\n\r\n weather = Weather.new(temp, desc, loc)\r\n\r\n # icon_url is of the form http://openweathermap.org/img/w/04n.png\r\n icon = current[\"weather\"][0][\"icon\"]\r\n weather.icon_url = \"http://openweathermap.org/img/w/#{icon}.png\"\r\n\r\n weather\r\n end",
"title": ""
},
{
"docid": "aa563c30c9dad76444f03f9822bf17be",
"score": "0.61703193",
"text": "def request_weather\n # Get all the HTML/XML source code into an array of strings\n # (each line is one element in the array)\n url = \"http://xml.weather.yahoo.com/forecastrss?p=\" + @zip\n lines = load_strings(url)\n\n # Turn array into one long String\n xml = lines.join # join(lines, \"\"); \n\n # Searching for weather condition\n lookfor = \"<yweather:condition text=\\\"\"\n endmarker = \"\\\"\"\n @weather = give_me_text_between(xml, lookfor, endmarker)\n\n # Searching for temperature\n lookfor = \"temp=\\\"\"\n @temperature = give_me_text_between(xml, lookfor, endmarker).to_i\n end",
"title": ""
},
{
"docid": "60488ea18df78165a7f95ebba65e5269",
"score": "0.6154991",
"text": "def pull_weather(weather_hash)\n @weather = TodaysWeather::Weather.new_from_api(weather_hash)\n @weather.units = @units[:api_input]\n @weather.zipcode = @zipcode\n puts \"\\nIt is currently #{@weather.temp}#{@units[:degrees]} with #{@weather.main.downcase} in #{@weather.city}.\"\n end",
"title": ""
},
{
"docid": "cca7c9ce5b5a4464da52a5ba78196aad",
"score": "0.612239",
"text": "def h_daily\n sun_sign = self.sign.downcase\n source = Nokogiri::HTML(open(\"https://www.astrology.com/horoscope/daily/#{sun_sign}.html\"))\n s_parse = source.css(\"main p\").first.text\n return s_parse\n end",
"title": ""
},
{
"docid": "70fa85dc70bc03de2fd8365f2b3e036a",
"score": "0.6122281",
"text": "def weather\n xpath('.//weather')\n end",
"title": ""
},
{
"docid": "350b6133b2b22d40bb82078fd1569548",
"score": "0.61177397",
"text": "def index\n @all_weather = WeatherDatum.all\n end",
"title": ""
},
{
"docid": "5050357b39968f54634b65b08fe0a737",
"score": "0.61163324",
"text": "def do_tiny_weather_forecast(m, params)\n\n zip = check_zip(m, params)\n return if zip.nil?\n\n do_tiny_weather(m, params) # do this first\n\n w = nil\n begin\n w = scrape_weather_forecast(zip)\n rescue => ex\n end\n return m.reply(\"error getting weather forecast\") if not w\n\n s = [ w.location ]\n date = Time.new\n w.highs.each_with_index { |high, i|\n next if i == 0 # skip todays forecast\n date += 86400\n day = date.strftime(\"%a\")\n precip = w.precips[i]\n s << sprintf(\"%s: %s (%s)\", day, high, precip) # Sun: 80F (10%)\n break if i == 6 # only want to show the next 6 days\n }\n\n m.reply(s.join(' '))\n end",
"title": ""
},
{
"docid": "1f16a81fce402a24866ed6cab369b14b",
"score": "0.61039543",
"text": "def get_forecast\n response = RestClient::Request.execute(\n method: :get,\n url: \"https://api.openweathermap.org/data/2.5/forecast?lat=#{@lat}&lon=#{@lon}&units=imperial&APPID=#{ ENV['WEATHER_KEY'] }\"\n )\n @json_response = JSON.parse(response)\n @filtered_response = []\n # filter data here to include only 2 forecasts per day\n @json_response['list'].each do |forecast|\n # forecast['dt'] is Unix timestamp\n date_time = Time.at(forecast['dt']) # date string\n adjusted_to_timezone = date_time - (60*60*3) # time adjusted to current timezone (this probably throws off the time adjustments. Needs revision.)\n\n if Rails.env.development? # if Rails does not show any weather data saved, check the adj time as it may have changed\n @filtered_response << forecast if adjusted_to_timezone.hour == 13 || adjusted_to_timezone.hour == 1 # works in dev, not heroku\n else\n @filtered_response << forecast if adjusted_to_timezone.hour == 15 || adjusted_to_timezone.hour == 3 # works in Heroku, not in dev\n end\n end\n\n # format data for database\n @filtered_response.each_with_index do |one_forecast, idx|\n date_time = Time.at(one_forecast['dt']) # date string\n adjusted_to_timezone = date_time - (60*60*3)\n if idx.even? # Even idx is main forecast used for the day if pulled before the daytime hour specified in @filtered_response\n location = Location.find_by_id(@location_id)\n weather = Weather.new(\n # format weather\n date: adjusted_to_timezone,\n day: adjusted_to_timezone.day, # day as int\n month: MONTHS.find {|key, val| key === adjusted_to_timezone.month }.last, # month string, e.g. \"April\"\n day_of_week: DAYS_OF_WEEK.find {|key, val| key === adjusted_to_timezone.wday }.last, # day name, e.g. \"Tuesday\"\n wind_dir: WIND_DIRECTIONS.find {|key, val| key === one_forecast['wind']['deg'].round }.last, # string e.g. \"NW\"\n wind_speed: one_forecast['wind']['speed'].round, # MPH\n high_temp: one_forecast['main']['temp'].round, # day temperature in F\n low_temp: @filtered_response[idx+1]['main']['temp'].round, # nighttime low temp in F from odd idx\n conditions_icon: ICON_URL.find {|key, val| key === one_forecast['weather'][0]['id']}.last, # icon url to be used in FE\n conditions_txt: one_forecast['weather'][0]['main'], # general weather description\n )\n weather.location_id = location.id\n weather.save\n end\n end\n end",
"title": ""
},
{
"docid": "39476cb9b5ce4c491a070cf18751cd47",
"score": "0.6103447",
"text": "def index\n # Github api endpoint needs User-Agent sent within the header\n @zen = HTTParty.get('https://api.github.com/zen', headers: {\"User-Agent\" => APP_NAME})\n\n # TODO Take github Zen quote and pipe thru yoda api request\n # mashape_motd_api_key = ENV[\"MASHAPE_MOTD_API_KEY\"]\n # @zen_to_yoda = HTTParty.get(\"https://yoda.p.mashape.com/yoda?sentence=#{@zen}\",\n # headers:{\n # \"X-Mashape-Key\" => mashape_motd_api_key,\n # \"Accept\" => \"text/plain\"\n # })\n # @yoda_response = @zen_to_yoda\n\n ## Weathering function using default zipcode for index weather data request\n weathering()\n end",
"title": ""
},
{
"docid": "bde61e55acefff54bcecf928a497efa0",
"score": "0.6100646",
"text": "def index\n respond_with WeatherDatum.all\n end",
"title": ""
},
{
"docid": "8c92f69698b2dcbf662bce1307fc10a6",
"score": "0.60996413",
"text": "def make_weather_data(cond_wheather)\n logger.info \"In make_weather_data\"\n\n obj = ActiveSupport::JSON.decode(cond_wheather)\n location = obj['query']['results']['channel']['location']\n title = location[\"city\"] + \" - \" + location[\"country\"] + \", \" + location[\"region\"]\n cond_wheather = obj['query']['results']['channel']['item']['forecast'].to_a\n wheather_data = add_weather_image(cond_wheather)\n\n return wheather_data, title\n end",
"title": ""
},
{
"docid": "c086ec89c31af2acb0781f40756f7479",
"score": "0.60994375",
"text": "def get_forecast(location)\n\tclient = Weatherman::Client.new\n\t@response = client.lookup_by_location(location).forecasts\nend",
"title": ""
},
{
"docid": "bbf7cb2bb56b5cf5f8f9db3a8c057b3c",
"score": "0.60924876",
"text": "def get_1day_weather(month, day, hour)\n response = open(@BASE_URL + \"?id=#{@CITY_ID}&APPID=#{@API_KEY}\")\n result = JSON.parse(response.read)\n\n weathers = []\n result['list'].each do |l|\n t = Time.parse(l['dt_txt'])\n if t.day == day && t.hour >= hour # get weathers from previous priod\n # p l['weather'][0]['main'] # there are three types of weather('Clear', 'Clouds', 'Rain')\n weathers.push(l['weather'][0]['main'])\n end\n end\n weathers\n end",
"title": ""
},
{
"docid": "d1287e2bec8f896529600433fab19190",
"score": "0.6089318",
"text": "def index\n @weather_data = WeatherDatum.all\n end",
"title": ""
},
{
"docid": "ef4447c20c57b0e710879995b81dc0e6",
"score": "0.6087149",
"text": "def index\n @weather_logs = WeatherLog.all\n\n # Here you would make the api call to weather server and populate all the arrays\n # @dates = []\n # @temperatures = []\n end",
"title": ""
},
{
"docid": "29850ab0df5634cd8b74ad76fe5f2ca5",
"score": "0.6084454",
"text": "def get_weather_information(latitude, longitude, date)\n #Transform the date into a format Year Month Date\n observations_date = date.strftime(\"%Y%m%d\")\n\n #Call the Wunderground service to get the observations for the place define\n #by longitude and latitude for the date (= observations_date)\n response =@@w_api.history_for(observations_date, \"#{latitude},#{longitude}\")\n observations = response['history']['observations']\n\n get_closest_observation(date, observations)\n end",
"title": ""
},
{
"docid": "2da5b1319865fa2db431066b668af0fd",
"score": "0.6081661",
"text": "def index\n @dailyweathers = Dailyweather.all\n end",
"title": ""
},
{
"docid": "96423e37df9428a5ec5b8052d50083ee",
"score": "0.6081633",
"text": "def index\n @weather_infos = WeatherInfo.all\n end",
"title": ""
},
{
"docid": "94f1513ccaed9e42032abf6cf9b15a33",
"score": "0.6058565",
"text": "def get_climate_data(country, city)\n document = open(\"https://www.timeanddate.com/weather/#{country}/#{city}/climate\")\n content = document.read\n parsed_content = Nokogiri::HTML(content)\n #Array Loop to collect Climate information for each month.\n months = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\"]\n information_all = []\n months.each do |month|\n information_for_month = []\n\n table_for_this_month = parsed_content.at_xpath(\"//div[@class='climate-month climate-month--#{month}']\")\n\n #Variables that represent each data point collected\n high = table_for_this_month.children[1].text.split[2].to_i\n low = table_for_this_month.children[1].text.split[4].to_i\n mean = table_for_this_month.children[1].text.split[6].to_i\n percipitation = table_for_this_month.children[2].text.split[1].to_f\n humidity = table_for_this_month.children[2].text.split[3].to_i\n wind = table_for_this_month.children[3].text.split[1].to_i\n\n #Array of complete climate information for one month\n information_for_month = [\"#{month.capitalize}\", \"#{color_temp(high)}\", \"#{color_temp(low)}\", \"#{color_temp(mean)}\", \"#{percipitation}\", \"#{humidity}\", \"#{wind}\"]\n\n #Array of climate information for all months\n information_all.push(information_for_month)\n end\n return information_all\nend",
"title": ""
},
{
"docid": "220a0d9342830b4b99ad7bd23027fe66",
"score": "0.6055575",
"text": "def get_weather(city)\napi_url = \"http://api.openweathermap.org/data/2.5/weather?q=#{city}\"\n\tRestClient.get(api_url).to_str\nend",
"title": ""
},
{
"docid": "b155a0d40a0f248386b81c9d71d220a2",
"score": "0.60550064",
"text": "def wwir_forecast\n payload = client.get_json_with_cache(\"#{url_prefix}/forecast/wwir.json?#{query}\")\n WwirForecast.new(payload['forecast'], Metadata.new(payload['metadata']))\n end",
"title": ""
},
{
"docid": "722045a60bb59c2d537503a0469cc737",
"score": "0.6052229",
"text": "def get_weather(this_zip)\n\n\tnew_hash = {:unit=>\"f\"}\n\tclient = Weatherman::Client.new(new_hash)\n\tweather_obj = client.lookup_by_location(this_zip) \n\t\n\ti = 1\n\tweather_obj.forecasts.each do |forecast|\n\t\tif (i == 1) \n\t\t\tdatestr = \"Today\"\n\t\t\n\t\telsif (i ==2) \n\t\t\tdatestr = \"Tomorrow\"\n\t\t\n\t\telse \n\t\t\tdatestring = forecast[\"day\"]\n\t\t\tdatestr = case datestring\n\t\t\t\twhen \"Mon\" then \"Monday\"\n\t\t\t\twhen \"Tue\" then \"Tuesday\"\n\t\t\t\twhen \"Wed\" then \"Wednesday\"\n\t\t\t\twhen \"Thu\" then \"Thursday\"\n\t\t\t\twhen \"Fri\" then \"Friday\"\n\t\t\t\twhen \"Sat\" then \"Saturday\"\n\t\t\t\telse \"day unknown\"\n\t\t\tend\n\t\tend\n\t\n\t\tputs datestr + \" is going to be \" + forecast[\"text\"].downcase + \" with a high of \" + forecast[\"high\"].to_s + \"\\nand a low of \" + forecast[\"low\"].to_s + \" degrees Fahrenheit.\"\n\t\ti += 1\n\tend\n\t# puts client.methods\n\t\nend",
"title": ""
},
{
"docid": "2f8cb86e0314139c27ac5712cbe801ba",
"score": "0.6026063",
"text": "def index\n @daily_weathers = DailyWeather.all\n end",
"title": ""
},
{
"docid": "74b274c2014415609f85f0e3609cf76c",
"score": "0.6020019",
"text": "def get_weather\n if cache_valid?\n @xml = @parser.convert_encoding(@cache.get(@cache_id))\n else\n @xml = @parser.convert_encoding(do_request(Regentanz.configuration.base_url + \"?weather=#{CGI::escape(@location)}&hl=#{@lang}\"))\n if @cache\n @cache.expire!(@cache_id)\n @cache.set(@cache_id, @xml)\n end\n end\n parse_xml() if @xml\n end",
"title": ""
},
{
"docid": "c2e7ea7ab7f96d128386259f4895deb2",
"score": "0.60089254",
"text": "def hourly_forecast\n forecast_by_type('forecastHourly')\n end",
"title": ""
},
{
"docid": "662cdf92e95f069e209d9d651c59b8c3",
"score": "0.6007133",
"text": "def getWeatherFromUrl(query)\n return JSON.parse(Net::HTTP.get(HOST, URL + query + APPID))\n end",
"title": ""
},
{
"docid": "d9d9249890e611f15112366aa6230ec0",
"score": "0.6007006",
"text": "def lookup_weather(city)\n uri = URI(\"http://api.openweathermap.org/data/2.5/weather\")\n params = { :q => city, :units => \"metric\" }\n uri.query = URI.encode_www_form(params)\n res = Net::HTTP.get_response(uri)\n res.body if res.is_a?(Net::HTTPSuccess)\nend",
"title": ""
},
{
"docid": "3fcfe8323d7b80fffa12918714b60a0c",
"score": "0.60019994",
"text": "def get_weather\n # Attempt to get current weather from Redis.\n redis_result = @redis.get(\"current_weather\")\n\n # If weather isn't in Redis, download it.\n if redis_result.nil?\n current_weather = download_weather\n else\n current_weather = JSON.parse(redis_result)\n end\n current_weather\n end",
"title": ""
},
{
"docid": "9e1bc321d2f7d0ba9b5e8243bfc4d5c4",
"score": "0.59830046",
"text": "def get_cloudy\n begin\n http = Net::HTTP.new('api.openweathermap.org', 80)\n resp=http.get(\"/data/2.5/weather?lat=#{LATITUDE}&lon=#{LONGITUDE}&APPID=#{WEATHER_API_KEY}\")\n results=JSON.parse(resp.body)\n perc_cloudy = results[\"clouds\"][\"all\"].to_i\n @logger.info \"cloudy: #{perc_cloudy}\"\n return perc_cloudy\n rescue Exception => e\n @logger.fatal \"Problem on get_cloudy\"\n @logger.fatal e\n return 100\n end\nend",
"title": ""
},
{
"docid": "a89090c527a88cf9ebcbae63d370196d",
"score": "0.5975458",
"text": "def index\n @weather = Weather.all\n end",
"title": ""
},
{
"docid": "f4fafe2a0655541ff20159cc4597b34a",
"score": "0.5964728",
"text": "def forecast(num_days, lat, lng)\n ForecastSummary.from_xml(HttpService.new.get_forecast(num_days, lat, lng))\n end",
"title": ""
},
{
"docid": "738e4668b2bc7959e9c281a8bd066e11",
"score": "0.5955648",
"text": "def get_weather\n\treturn unless @options['weather.url']\n\treturn unless @mode == 'append' or @mode == 'replace'\n\treturn unless @date.strftime( '%Y%m%d' ) == Time::now.strftime( '%Y%m%d' )\n\tpath = @options['weather.dir'] || Weather_default_path\n\tw = Weather::restore( path, @date )\n\tif not w or w.error then\n\t\titems = @options['weather.items'] || Weather_default_items\n\t\tw = Weather.new( @date, @options['weather.tz'] )\n\t\tw.get( @options['weather.url'], @options['weather.header'], items )\n\t\tif @options.has_key?( 'weather.oldest' ) then\n\t\t\toldest = @options['weather.oldest']\n\t\telse\n\t\t\toldest = 21600\n\t\tend\n\t\tw.check_age( oldest )\n\t\tw.store( path, @date )\n\tend\nend",
"title": ""
},
{
"docid": "92fe7e3eeccb641527e4f615572a7f94",
"score": "0.5954109",
"text": "def weather_json(loc)\n weather_res = HTTParty.get(\"https://api.darksky.net/forecast/8b4d5ca925446f9db4f7d7d0aac8b40c/#{loc['lat']},#{loc['lng']}\")\n weather = JSON.parse(weather_res.body)\n return weather\n end",
"title": ""
},
{
"docid": "8dbd644d2c3b9e003ec046960cb2cae4",
"score": "0.59491867",
"text": "def weather_for(city)\n owm.get \"/data/2.5/weather?q=#{URI.encode(city)}\"\nend",
"title": ""
},
{
"docid": "f686a5b5ba4cb6954ee4428f74897d70",
"score": "0.594526",
"text": "def do_tiny_weather(m, params)\n\n zip = check_zip(m, params)\n return if zip.nil?\n\n w = nil\n begin\n w = scrape_hourly_weather(zip)\n rescue => ex\n end\n return m.reply(\"error getting hourly weather\") if not w\n\n s = [w.location]\n i = 0\n precip = 0\n w.hours.each { |h|\n i += 1\n precip = h.precip.to_i if h.precip.to_i > precip\n next if i % 2 == 0\n s << sprintf(\"%s: %s (%s)\", h.hour, h.temp, h.precip)\n }\n\n if precip < 30 then\n s << \"no rain :)\"\n elsif precip == 30 or precip == 40 then\n s << \"might want that umbrella\"\n else\n s << \"grab an umbrella!\"\n end\n\n m.reply(s.join(' '))\n\n end",
"title": ""
},
{
"docid": "0c202dae32b192a53bf61793c803497d",
"score": "0.59329194",
"text": "def contact_openweathermap\n JSON.parse(open(@api_url).read)\n end",
"title": ""
},
{
"docid": "5a3c33f782350243c99963801f5cf414",
"score": "0.5928833",
"text": "def get_current_weather\n full_url = build_url(CONDITIONS)\n current_observation = HTTParty.get(full_url)[\"current_observation\"]\n # uncomment the next object and comment the line above in order to test app functionality without making API cals\n # current_observation = {\n # \"temp_f\" => \"90\",\n # \"weather\" => \"Partly Cloudy\",\n # \"precip_today_in\" => \"0.00\",\n # \"icon_url\" => \"http://icons.wxug.com/i/c/k/mostlycloudy.gif\"\n # }\n return {temp: current_observation[\"temp_f\"], \n description: current_observation[\"weather\"],\n precip: current_observation[\"precip_today_in\"].to_f,\n icon: current_observation[\"icon_url\"]\n }\n end",
"title": ""
},
{
"docid": "de938618dd872c358a124cd0515e4d99",
"score": "0.5910739",
"text": "def get_weather(city:)\n response = GetWeather.call(city: city)\n # WeatherUpdateWorker.perform_async(city, \"aboderinemmanuel@gmail.com\")\n # WeatherUpdateWorker.perform_async(city, \"madamwebbe@gmail.com\")\n # WeatherUpdateWorker.perform_async(city, \"wbdev2018@gmail.com\")\n response.weather ? response.weather : {\n name: \"\",\n weather: \"\",\n lat: \"\",\n lng: \"\",\n sunrise: \"\",\n sunset: \"\"\n }\n end",
"title": ""
},
{
"docid": "79ab6bb16ba64feb64d8c9549ac21d08",
"score": "0.59083825",
"text": "def get_weather_connection(city)\n url = URI(\"https://community-open-weather-map.p.rapidapi.com/weather?q=#{city}%2Cca&units=metric\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(url)\n request[\"x-rapidapi-key\"] = ENV['WEATHER_API_KEY']\n request[\"x-rapidapi-host\"] = 'community-open-weather-map.p.rapidapi.com'\n\n response = http.request(request)\n json_response = JSON.parse(response.body)\n\n if response.code == \"200\"\n content = json_response\n else\n content = \"Bad Request\"\n end\n content\n end",
"title": ""
},
{
"docid": "3a2e48ad3b702bfb6518ce9ab397fb28",
"score": "0.5905857",
"text": "def getWeather(options)\n # initialize request\n req = \"http://api.openweathermap.org/data/2.5/weather?\"\n # append data\n if options && options[:city]\n req += \"q=#{options[:city]}\"\n elsif options && options[:lon] && options[:lat]\n # validate values\n if validate_coordinates?(options[:lon], options[:lat])\n req += \"lat=#{options[:lat]}&lon=#{options[:lon]}\"\n else\n return {error_message: \"#{I18n.t('weather_invalid_call')} - #{I18n.t('weather_invalid_parameters')}\"}\n end\n else\n # Invalid Call\n return {error_message: \"#{I18n.t('weather_invalid_call')} - #{I18n.t('weather_wrong_parameters')}\"}\n end\n # Append metric unit options adn APPID\n req += \"&units=metric&APPID=#{WEATHERMAP_APPID}\"\n # Send api call\n weather_response = HTTParty.get req\n # handle response\n if weather_response.code == 200\n weather = {}\n parsed_resp = weather_response.parsed_response\n weather[:city] = parsed_resp[\"name\"]\n weather[:desc] = parsed_resp[\"weather\"][0][\"description\"].capitalize # weather status\n # city coordinates\n weather[:lon] = parsed_resp[\"coord\"][\"lon\"]\n weather[:lat] = parsed_resp[\"coord\"][\"lat\"]\n # weather\n weather[:temp] = parsed_resp[\"main\"][\"temp\"]\n weather[:temp_min] = parsed_resp[\"main\"][\"temp_min\"]\n weather[:temp_high] = parsed_resp[\"main\"][\"temp_max\"]\n weather[:pressure] = parsed_resp[\"main\"][\"pressure\"]\n weather[:humidity] = parsed_resp[\"main\"][\"humidity\"]\n # wind\n weather[:wind_speed] = parsed_resp[\"wind\"][\"speed\"]\n weather[:wind_degree] = parsed_resp[\"wind\"][\"deg\"]\n\n return weather\n else\n return {error_message: \"#{I18n.t('weather_invalid_call')} - #{weather_response.parsed_response['message']}\"}\n end\n end",
"title": ""
},
{
"docid": "bf3b897b84ac2d16a1ff07c2f17753c1",
"score": "0.5902833",
"text": "def retrieve_five_day_weather_name(city_name)\n api_key = ENV['API_KEY']\n @latest_five_day_weather_data = JSON.parse(self.class.get(\"/forecast?q=#{city_name}&appid=#{api_key}\").body)\n end",
"title": ""
},
{
"docid": "1e880980ae824b356d1df50329d38ef8",
"score": "0.5899163",
"text": "def show\n @city = City.find(params[:id])\n @city.update_city_data\n @city.reload\n daily_data = @city.daily_data\n forecasts = daily_data[\"DailyForecasts\"] \n d1 = forecasts[0][\"AirAndPollen\"]\n d2 = forecasts[1][\"AirAndPollen\"]\n d3 = forecasts[2][\"AirAndPollen\"]\n d4 = forecasts[3][\"AirAndPollen\"]\n d5 = forecasts[4][\"AirAndPollen\"]\n @forecasts = [d1,d2,d3,d4,d5]\n end",
"title": ""
},
{
"docid": "34d76ca11115dc059d882d9c5449b3ce",
"score": "0.58989155",
"text": "def index\n @dailyweatheractuals = Dailyweatheractual.all\n end",
"title": ""
},
{
"docid": "850d1b17dcf6804757ef9170123d42d3",
"score": "0.5896666",
"text": "def daily_weather\r\n i = 0\r\n #loop through each hash in the array and store values to keys.\r\n #values are retrieved from the mash of data sent by the forecast_io\r\n while i <8 \r\n @days[i].store(\"date\",Time.at(@data['daily']['data'][i]['time']).to_s)\r\n @days[i].store(\"summary\",@data['daily']['data'][i]['summary'])\r\n @days[i].store(\"temp_high\",@data['daily']['data'][i]['temperatureHigh'])\r\n @days[i].store(\"temp_low\",@data['daily']['data'][i]['temperatureLow'])\r\n @days[i].store(\"precip_type\",@data['daily']['data'][i]['precipType'])\r\n @days[i].store(\"precip_chance\",@data['daily']['data'][i]['precipProbability'])\r\n i += 1\r\n end\r\n end",
"title": ""
},
{
"docid": "b54015d44743e7e0b1bb34b8f994fd0f",
"score": "0.5888227",
"text": "def weather_description\n @weather_description ||= text_from_node('weather')\n end",
"title": ""
},
{
"docid": "de67aee1370ba123571873722dca6cf2",
"score": "0.5871661",
"text": "def city(cityname)\n\t\tdata = JSON.parse(Net::HTTP.get('api.waqi.info', \"/feed/#{cityname}/?token=#{@token}\"))\n\t\tif data['status'] == 'error'\n\t\t\traise data['data']\n\t\telse\n\t\t\treturn data\n\t\tend\n\tend",
"title": ""
},
{
"docid": "734528009d538cec1bf078eb2ebb53d6",
"score": "0.58702767",
"text": "def openweathermap\n @openweathermap ||= JSON.load(open(\"#{openweathermap_url}&q=#{city},#{country}&units=metric\"))\n end",
"title": ""
},
{
"docid": "6841809bd54acab2f5069d39ddaa55c3",
"score": "0.5865964",
"text": "def scrape zip\n\n\t\turl = 'http://www.wunderground.com/cgi-bin/findweather/hdfForecast?query=' + zip\t\t# Get the URL for Weather Undergrond\n\t\tagent = Mechanize.new { |agent|\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 # Start a mechanize agent\n agent.user_agent_alias = 'Mac Safari'\n }\n\n\t agent.get(url) do |page|\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\t# Scrape the page\n\n\t \t# Get Location Data\n\t \tlocation = page / 'div#location' / 'h1'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get location data from the h1 in the location div\n\t \tlocation = location.children[0].text[3..-4]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Get location text from the child and strip out wrapper\n\n\t \t@data = {}\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\t\t\t\t\t\t\t# Initialize hash\n\t\t\t@data['location'] = location\n\n\t\t\tfor day in 0..6\n\t\t\t\t@data[day] = {}\n\t\t\t\t\n\t\t\t\tif day == 0\n\t\t\t\t\tziptime = Ziptime::ZIPTIME \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# Get ziptime data from library\n\t\t\t\t\toffset = ziptime[zip][0]\n\t\t\t\t\tdst = ziptime[zip][1]\n\t\t\t\t\tif Time.now.dst? and dst == 0 then offset = offset - 1 end\n\n\t\t\t\t\tif offset == -5\n\t\t\t\t\t\t@data[day]['label'] = Date.today.strftime(\"%e %B %Y\")\n\t\t\t\t\t\t@now = Time.new.hour\n\t\t\t\t\telse\n\t\t\t\t\t\toffset = offset + 5\n\t\t\t\t\t\t@data[day]['label'] = (Date.today + offset.hours).strftime(\"%e %B %Y\")\n\t\t\t\t\t\t@now = Time.new.hour + offset\n\t\t\t\t\t\tif @now < 0 then @now = @now + 24 end\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tmoon_data = get_moon_phase(day)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# Calculate moon data\n\t\t\t\t\trise_data = get_rises_and_sets(page, day)\n\t\t\t\t\tfor hour in @now+1..23\n\t\t\t\t\t\trun_main(page, day, hour, moon_data, rise_data)\n\t\t\t\t\tend\n\n\t\t\t\telse\n\t\t\t\t\t@data[day]['label'] = (Date.today + day.days).strftime(\"%e %B %Y\")\n\t\t\t\t\tmoon_data = get_moon_phase(day)\n\t\t\t\t\trise_data = get_rises_and_sets(page, day)\n\t\t\t\t\tfor hour in 0..23\n\t\t\t\t\t\trun_main(page, day, hour, moon_data, rise_data)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\n\t\t\tend\n\t\tend\n\n\t @data\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\t\t\t\t\t\t\t\t\t\t\t# Return hash\n\tend",
"title": ""
},
{
"docid": "d34b609e0a9295edec22792ea0974acf",
"score": "0.5865112",
"text": "def get_forecast(weather)\n\ttomorrow = Time.now.strftime('%d').to_i + 1\n\tputs \"Your forecast:\"\n\tweather.forecast.each do |forecast|\n\n\t\t#Determine which day it is \n\t\tday = forecast.starts_at.day\n\t\tif day == tomorrow\n\t\t\tday_name = \"Tomorrow\"\n\t\telse\n\t\t\tday_name = forecast.starts_at.strftime('%A')\n\t\tend\n\n\t\tputs \"For #{day_name}: #{forecast.icon}, low of #{forecast.low.f}f, and high of #{forecast.high.f}f\"\n\tend\nend",
"title": ""
},
{
"docid": "45fa1b3458662cc092a1599c4111cfff",
"score": "0.5858948",
"text": "def getWeather(city)\n options = { units: \"metric\", APPID: ENV[\"OPEN_WEATHER_KEY\"] }\n OpenWeather::Current.city_id(city, options) \n end",
"title": ""
},
{
"docid": "4d4aeab1652d98194a81e79c69089834",
"score": "0.5858512",
"text": "def index\n @weather_forecasts = WeatherForecast.all\n end",
"title": ""
},
{
"docid": "cbbfe75ff8b081350cfe98f4585e3d82",
"score": "0.58531654",
"text": "def getForecast(city) \n options = { units: \"metric\", \n APPID: ENV[\"OPEN_WEATHER_KEY\"] } \n OpenWeather::Current.city_id(city, options)\n end",
"title": ""
},
{
"docid": "2371468628a3bb35fe16e300464b1fc6",
"score": "0.58527297",
"text": "def show\n begin\n @weather = ApiHelper.get_weather(params[:city])\n rescue Exception => e\n @weather = { error: e }\n end\n render json: @weather\n end",
"title": ""
},
{
"docid": "61a2206c057e941b0b0dac3344ea6d9e",
"score": "0.58483577",
"text": "def hourly_forecast(uri)\n self.class.get(uri)\n end",
"title": ""
},
{
"docid": "f537a35581e65b230e0a6752e4f9ba6e",
"score": "0.58328456",
"text": "def getweatheralerts\n @geoid = params[:geoid]\n\n @geoid = '' if @geoid.to_s == 'undefined' || @geoid.to_s == ''\n\n require 'uri'\n require 'net/http'\n\n # includes below a geoid so you can localize\n url = URI('https://api.weather.com/v2/stormreports?apiKey=' +\n ENV['WEATHER_APIKEY'] + '&format=json')\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(url)\n request['accept-encoding'] = 'application/gzip'\n request['content-type'] = 'application/json'\n request['cache-control'] = 'no-cache'\n\n @response = http.request(request)\n puts ' '\n puts '----- weather alerts'\n puts @response.read_body\n\n respond_to do |format|\n format.text { render plain: @response.body }\n end\n end",
"title": ""
},
{
"docid": "704953c47be8e942e521d7cbdadaa2da",
"score": "0.5831982",
"text": "def daily_forecast\n weather_data[:daily][:data].map do |forecast_data|\n DailyForecast.new(forecast_data)\n end\n end",
"title": ""
},
{
"docid": "c920e1a9346d94e4a70b87ee7f2a7ed5",
"score": "0.5810097",
"text": "def weather(source,date)\n content = \"\"\n open(source) do |s| content = s.read end\n rss = RSS::Parser.parse(content,false)\n\n counter = 0\n temp_result = []\n title = \"\"\n while counter < rss.items.size\n if rss.items[counter].title =~ /^(.+) #{date}. (.+)$/\n if title.empty?\n title = rss.items[counter].title[%r{(\\S+)\\s(\\S+)\\s(\\S+)\\s(\\S+)}]\n end\n temp_result << rss.items[counter].description\n end\n counter += 1\n end\n\n if title.empty?\n title = \"No weatherdata available (input too large)\"\n end\n\n return [title] + temp_result\n end",
"title": ""
},
{
"docid": "05567f9673e4494cf6c70875246ce6b8",
"score": "0.58065045",
"text": "def weather\r\n # just day/night messages at the moment\r\n if time.first == Constants::Time::SUNRISE\r\n @players.each_output \"The sun rises in the east.\"\r\n elsif time.first == Constants::Time::SUNRISE + 1\r\n @players.each_output \"The day has begun.\"\r\n elsif time.first == Constants::Time::SUNSET\r\n @players.each_output \"The sun slowly disappears in the west.\"\r\n elsif time.first == Constants::Time::SUNSET + 1\r\n @players.each_output \"The night has begun.\"\r\n end\r\n return nil\r\n end",
"title": ""
}
] |
9e25d4440ab1999386d911d16791a823
|
The deserialization information for the current model
|
[
{
"docid": "6c8a033b6a33c1f2f4e2db67398b8b4b",
"score": "0.5906045",
"text": "def get_field_deserializers()\n return {\n \"attributeMappings\" => lambda {|n| @attribute_mappings = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeMapping.create_from_discriminator_value(pn) }) },\n \"enabled\" => lambda {|n| @enabled = n.get_boolean_value() },\n \"flowTypes\" => lambda {|n| @flow_types = n.get_enum_value(MicrosoftGraph::Models::ObjectFlowTypes) },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ObjectMappingMetadataEntry.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Filter.create_from_discriminator_value(pn) }) },\n \"sourceObjectName\" => lambda {|n| @source_object_name = n.get_string_value() },\n \"targetObjectName\" => lambda {|n| @target_object_name = n.get_string_value() },\n }\n end",
"title": ""
}
] |
[
{
"docid": "8c867fd2c80799d10790d2085d14eba7",
"score": "0.6510734",
"text": "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"title": ""
},
{
"docid": "be6df54ff4d9ca8c6dd1eaa5e0a0615d",
"score": "0.63224316",
"text": "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"fileDetails\" => lambda {|n| @file_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "702b1ca6fda42d37689f0b37b3d64020",
"score": "0.6322254",
"text": "def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end",
"title": ""
},
{
"docid": "c5f01e15e3e8a50956d98dd962730bc4",
"score": "0.63094735",
"text": "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "78e17defcc9f85a758ec2e34a6229774",
"score": "0.62954384",
"text": "def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "2725c020aa729e8c9d0c1dde041dde7e",
"score": "0.6238735",
"text": "def get_field_deserializers()\n return {\n \"attribution\" => lambda {|n| @attribution = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImageInfo.create_from_discriminator_value(pn) }) },\n \"backgroundColor\" => lambda {|n| @background_color = n.get_string_value() },\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayText\" => lambda {|n| @display_text = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "3a1d7ba61cd539bf36d9cd07aa0e6725",
"score": "0.6232461",
"text": "def get_field_deserializers()\n return {\n \"detectionType\" => lambda {|n| @detection_type = n.get_string_value() },\n \"method\" => lambda {|n| @method = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "d7c400f614d3704e2650ff2f3d161ecc",
"score": "0.62155676",
"text": "def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "6a5dfbfafc41af5510990926a17029a3",
"score": "0.6200175",
"text": "def get_field_deserializers()\n return {\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"maxImageSize\" => lambda {|n| @max_image_size = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"timeout\" => lambda {|n| @timeout = n.get_duration_value() },\n }\n end",
"title": ""
},
{
"docid": "bea925e775249a0e23c5686a631800cd",
"score": "0.6199403",
"text": "def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "af291e11062c3907253189b45a59f765",
"score": "0.6173917",
"text": "def get_field_deserializers()\n return {\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"headerValue\" => lambda {|n| @header_value = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "72cf3937074519c6e21d9712bf66cde7",
"score": "0.61733985",
"text": "def get_field_deserializers()\n return {\n \"callEndSubReason\" => lambda {|n| @call_end_sub_reason = n.get_number_value() },\n \"callType\" => lambda {|n| @call_type = n.get_string_value() },\n \"calleeNumber\" => lambda {|n| @callee_number = n.get_string_value() },\n \"callerNumber\" => lambda {|n| @caller_number = n.get_string_value() },\n \"correlationId\" => lambda {|n| @correlation_id = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_number_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"failureDateTime\" => lambda {|n| @failure_date_time = n.get_date_time_value() },\n \"finalSipCode\" => lambda {|n| @final_sip_code = n.get_number_value() },\n \"finalSipCodePhrase\" => lambda {|n| @final_sip_code_phrase = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"inviteDateTime\" => lambda {|n| @invite_date_time = n.get_date_time_value() },\n \"mediaBypassEnabled\" => lambda {|n| @media_bypass_enabled = n.get_boolean_value() },\n \"mediaPathLocation\" => lambda {|n| @media_path_location = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"signalingLocation\" => lambda {|n| @signaling_location = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"successfulCall\" => lambda {|n| @successful_call = n.get_boolean_value() },\n \"trunkFullyQualifiedDomainName\" => lambda {|n| @trunk_fully_qualified_domain_name = n.get_string_value() },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "2c7cf78e1b0f8a12e3737dfd12918fd4",
"score": "0.61705345",
"text": "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "581805656c591c3051c5c12925a07a76",
"score": "0.61631054",
"text": "def get_field_deserializers()\n return {\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"versionId\" => lambda {|n| @version_id = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "86ce059c9d32fca602c2ad29c553f887",
"score": "0.61620396",
"text": "def get_field_deserializers()\n return {\n \"buildNumber\" => lambda {|n| @build_number = n.get_string_value() },\n \"bundleId\" => lambda {|n| @bundle_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"versionNumber\" => lambda {|n| @version_number = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "2c061f149cd414744a2e232094b498cd",
"score": "0.6158031",
"text": "def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "c6ff71dd80136f338a3f53470bb7a34f",
"score": "0.6156071",
"text": "def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end",
"title": ""
},
{
"docid": "f9be92a695a3ec215f62c05b9d215b84",
"score": "0.6142402",
"text": "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"imageFile\" => lambda {|n| @image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n \"parentProcessCreationDateTime\" => lambda {|n| @parent_process_creation_date_time = n.get_date_time_value() },\n \"parentProcessId\" => lambda {|n| @parent_process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"parentProcessImageFile\" => lambda {|n| @parent_process_image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"processCommandLine\" => lambda {|n| @process_command_line = n.get_string_value() },\n \"processCreationDateTime\" => lambda {|n| @process_creation_date_time = n.get_date_time_value() },\n \"processId\" => lambda {|n| @process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"userAccount\" => lambda {|n| @user_account = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityUserAccount.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "e74d5a97c25d2a3334cbda0de64794b2",
"score": "0.613998",
"text": "def get_field_deserializers()\n return super.merge({\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::OperationStatus) },\n })\n end",
"title": ""
},
{
"docid": "8ca1013fc1311bdea23bbefa60b3f3df",
"score": "0.6138061",
"text": "def get_field_deserializers()\n return super.merge({\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"progress\" => lambda {|n| @progress = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DataPolicyOperationStatus) },\n \"storageLocation\" => lambda {|n| @storage_location = n.get_string_value() },\n \"submittedDateTime\" => lambda {|n| @submitted_date_time = n.get_date_time_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "29772c31662ea1509453020f22968250",
"score": "0.61200523",
"text": "def get_field_deserializers()\n return {\n \"completedUnits\" => lambda {|n| @completed_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"progressObservationDateTime\" => lambda {|n| @progress_observation_date_time = n.get_date_time_value() },\n \"totalUnits\" => lambda {|n| @total_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"units\" => lambda {|n| @units = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "5aea8e36e837eb31af05b6908ac80a42",
"score": "0.6089013",
"text": "def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"provisioningStepType\" => lambda {|n| @provisioning_step_type = n.get_enum_value(MicrosoftGraph::Models::ProvisioningStepType) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ProvisioningResult) },\n }\n end",
"title": ""
},
{
"docid": "ad49a40c11fe23cc8c47c210dcd1b647",
"score": "0.60869795",
"text": "def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end",
"title": ""
},
{
"docid": "c5103381a2b09ce9aa4befd567e9cdc5",
"score": "0.6079146",
"text": "def get_field_deserializers()\n return super.merge({\n \"check32BitOn64System\" => lambda {|n| @check32_bit_on64_system = n.get_boolean_value() },\n \"comparisonValue\" => lambda {|n| @comparison_value = n.get_string_value() },\n \"fileOrFolderName\" => lambda {|n| @file_or_folder_name = n.get_string_value() },\n \"operationType\" => lambda {|n| @operation_type = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppFileSystemOperationType) },\n \"operator\" => lambda {|n| @operator = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppRuleOperator) },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "c55a2c6e4510c70fffbb0b80d44fa7a2",
"score": "0.60785794",
"text": "def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end",
"title": ""
},
{
"docid": "0fe085bbcd7d77221cf1404288c6f154",
"score": "0.6070405",
"text": "def get_field_deserializers()\n return {\n \"destinationFileName\" => lambda {|n| @destination_file_name = n.get_string_value() },\n \"sourceFile\" => lambda {|n| @source_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemReference.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
},
{
"docid": "1de9a22f475fef9e81d991f8401584ec",
"score": "0.6063533",
"text": "def get_field_deserializers()\n return {\n \"newText\" => lambda {|n| @new_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numBytes\" => lambda {|n| @num_bytes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"oldText\" => lambda {|n| @old_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"startNum\" => lambda {|n| @start_num = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
},
{
"docid": "c5bdf564257e2a7e0e5c5871b78872e8",
"score": "0.60625833",
"text": "def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "f64c6df883cb3a899d47d65ad51bc59a",
"score": "0.6061235",
"text": "def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"targetType\" => lambda {|n| @target_type = n.get_enum_value(MicrosoftGraph::Models::FeatureTargetType) },\n }\n end",
"title": ""
},
{
"docid": "f36b1a65f072c0f53c9e84e682722a36",
"score": "0.60584134",
"text": "def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "734eb6f6cdf5ea6b4f010b24b52b1ae0",
"score": "0.6055769",
"text": "def get_field_deserializers()\n return super.merge({\n \"activationUrl\" => lambda {|n| @activation_url = n.get_string_value() },\n \"activitySourceHost\" => lambda {|n| @activity_source_host = n.get_string_value() },\n \"appActivityId\" => lambda {|n| @app_activity_id = n.get_string_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"contentInfo\" => lambda {|n| @content_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fallbackUrl\" => lambda {|n| @fallback_url = n.get_string_value() },\n \"historyItems\" => lambda {|n| @history_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ActivityHistoryItem.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::Status) },\n \"userTimezone\" => lambda {|n| @user_timezone = n.get_string_value() },\n \"visualElements\" => lambda {|n| @visual_elements = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::VisualInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "13998b3628e95c6bd6c820f4780f98b5",
"score": "0.6051312",
"text": "def get_field_deserializers()\n return super.merge({\n \"category\" => lambda {|n| @category = n.get_string_value() },\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "5888677c2c7d8472361d55cdfb7c365f",
"score": "0.60465735",
"text": "def get_field_deserializers()\n return {\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"malwareIdentifier\" => lambda {|n| @malware_identifier = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "1147ff055a21447d4d51747ceb6e040a",
"score": "0.6046329",
"text": "def get_field_deserializers()\n return {\n \"lastActionDateTime\" => lambda {|n| @last_action_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operation\" => lambda {|n| @operation = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "ef1c320357d8265c00014ac04b407798",
"score": "0.6031944",
"text": "def get_field_deserializers()\n return super.merge({\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"identityType\" => lambda {|n| @identity_type = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "c85c265f1e7bd0177185243b10182d2c",
"score": "0.6029311",
"text": "def get_field_deserializers()\n return {\n \"dataLocationCode\" => lambda {|n| @data_location_code = n.get_string_value() },\n \"hostname\" => lambda {|n| @hostname = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"root\" => lambda {|n| @root = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Root.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
},
{
"docid": "9e67c801d771a8b8b888b9d4ba1b0877",
"score": "0.6028314",
"text": "def get_field_deserializers()\n return {\n \"address\" => lambda {|n| @address = n.get_string_value() },\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"relevanceScore\" => lambda {|n| @relevance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"selectionLikelihood\" => lambda {|n| @selection_likelihood = n.get_enum_value(MicrosoftGraph::Models::SelectionLikelihoodInfo) },\n }\n end",
"title": ""
},
{
"docid": "3e6b5ebecad14e8d3ea07bb159fac80e",
"score": "0.60255736",
"text": "def get_field_deserializers()\n return {\n \"hashes\" => lambda {|n| @hashes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Hashes.create_from_discriminator_value(pn) }) },\n \"mimeType\" => lambda {|n| @mime_type = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"processingMetadata\" => lambda {|n| @processing_metadata = n.get_boolean_value() },\n }\n end",
"title": ""
},
{
"docid": "c6632a6a0bc858ce8532f5ad938fbb26",
"score": "0.6022033",
"text": "def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end",
"title": ""
},
{
"docid": "743b1c367b2fe1e2211b2f543be3aa08",
"score": "0.60210633",
"text": "def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end",
"title": ""
},
{
"docid": "bbd801016fdde2aadc082ae5e8216cf0",
"score": "0.6009887",
"text": "def get_field_deserializers()\n return {\n \"errorDetails\" => lambda {|n| @error_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::GenericError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"sourceId\" => lambda {|n| @source_id = n.get_string_value() },\n \"targetId\" => lambda {|n| @target_id = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "c2e2b4bea78474885f8e9ef3dbf1c59b",
"score": "0.5988654",
"text": "def get_field_deserializers()\n return {\n \"contentSource\" => lambda {|n| @content_source = n.get_string_value() },\n \"hitId\" => lambda {|n| @hit_id = n.get_string_value() },\n \"isCollapsed\" => lambda {|n| @is_collapsed = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"rank\" => lambda {|n| @rank = n.get_number_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resultTemplateId\" => lambda {|n| @result_template_id = n.get_string_value() },\n \"summary\" => lambda {|n| @summary = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "f3ecbdb77ffe70a9e31fb9e535fb138a",
"score": "0.59844214",
"text": "def get_field_deserializers()\n return super.merge({\n \"assignedUserPrincipalName\" => lambda {|n| @assigned_user_principal_name = n.get_string_value() },\n \"groupTag\" => lambda {|n| @group_tag = n.get_string_value() },\n \"hardwareIdentifier\" => lambda {|n| @hardware_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"importId\" => lambda {|n| @import_id = n.get_string_value() },\n \"productKey\" => lambda {|n| @product_key = n.get_string_value() },\n \"serialNumber\" => lambda {|n| @serial_number = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImportedWindowsAutopilotDeviceIdentityState.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "61d1ba18127f741c311ad7eb01c05042",
"score": "0.59793943",
"text": "def get_field_deserializers()\n return super.merge({\n \"audioRoutingGroups\" => lambda {|n| @audio_routing_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AudioRoutingGroup.create_from_discriminator_value(pn) }) },\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_string_value() },\n \"callOptions\" => lambda {|n| @call_options = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallOptions.create_from_discriminator_value(pn) }) },\n \"callRoutes\" => lambda {|n| @call_routes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CallRoute.create_from_discriminator_value(pn) }) },\n \"callbackUri\" => lambda {|n| @callback_uri = n.get_string_value() },\n \"chatInfo\" => lambda {|n| @chat_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ChatInfo.create_from_discriminator_value(pn) }) },\n \"contentSharingSessions\" => lambda {|n| @content_sharing_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ContentSharingSession.create_from_discriminator_value(pn) }) },\n \"direction\" => lambda {|n| @direction = n.get_enum_value(MicrosoftGraph::Models::CallDirection) },\n \"incomingContext\" => lambda {|n| @incoming_context = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IncomingContext.create_from_discriminator_value(pn) }) },\n \"mediaConfig\" => lambda {|n| @media_config = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaConfig.create_from_discriminator_value(pn) }) },\n \"mediaState\" => lambda {|n| @media_state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallMediaState.create_from_discriminator_value(pn) }) },\n \"meetingInfo\" => lambda {|n| @meeting_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MeetingInfo.create_from_discriminator_value(pn) }) },\n \"myParticipantId\" => lambda {|n| @my_participant_id = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CommsOperation.create_from_discriminator_value(pn) }) },\n \"participants\" => lambda {|n| @participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Participant.create_from_discriminator_value(pn) }) },\n \"requestedModalities\" => lambda {|n| @requested_modalities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Modality.create_from_discriminator_value(pn) }) },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ParticipantInfo.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::CallState) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InvitationParticipantInfo.create_from_discriminator_value(pn) }) },\n \"tenantId\" => lambda {|n| @tenant_id = n.get_string_value() },\n \"toneInfo\" => lambda {|n| @tone_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ToneInfo.create_from_discriminator_value(pn) }) },\n \"transcription\" => lambda {|n| @transcription = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallTranscriptionInfo.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "233d15be0a91210180feaa9b3d75ecfa",
"score": "0.5975247",
"text": "def get_field_deserializers()\n return {\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"teacherNumber\" => lambda {|n| @teacher_number = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "8ba6f5a717d2afc163574a0cfc78dd8c",
"score": "0.5969614",
"text": "def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"key\" => lambda {|n| @key = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"thumbprint\" => lambda {|n| @thumbprint = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"usage\" => lambda {|n| @usage = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "4e0b10e4ef98f8e418c18c2534d6cf09",
"score": "0.596824",
"text": "def get_field_deserializers()\n return {\n \"allowMultipleLines\" => lambda {|n| @allow_multiple_lines = n.get_boolean_value() },\n \"appendChangesToExistingText\" => lambda {|n| @append_changes_to_existing_text = n.get_boolean_value() },\n \"linesForEditing\" => lambda {|n| @lines_for_editing = n.get_number_value() },\n \"maxLength\" => lambda {|n| @max_length = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"textType\" => lambda {|n| @text_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "48f1834e10a609761e88a3cb47abb6be",
"score": "0.5966432",
"text": "def get_field_deserializers()\n return {\n \"assignCategories\" => lambda {|n| @assign_categories = n.get_collection_of_primitive_values(String) },\n \"copyToFolder\" => lambda {|n| @copy_to_folder = n.get_string_value() },\n \"delete\" => lambda {|n| @delete = n.get_boolean_value() },\n \"forwardAsAttachmentTo\" => lambda {|n| @forward_as_attachment_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"forwardTo\" => lambda {|n| @forward_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"markAsRead\" => lambda {|n| @mark_as_read = n.get_boolean_value() },\n \"markImportance\" => lambda {|n| @mark_importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"moveToFolder\" => lambda {|n| @move_to_folder = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"permanentDelete\" => lambda {|n| @permanent_delete = n.get_boolean_value() },\n \"redirectTo\" => lambda {|n| @redirect_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"stopProcessingRules\" => lambda {|n| @stop_processing_rules = n.get_boolean_value() },\n }\n end",
"title": ""
},
{
"docid": "9303b075d2b51c6e394a2fa1afa89ef1",
"score": "0.5965554",
"text": "def get_field_deserializers()\n return {\n \"acceptMappedClaims\" => lambda {|n| @accept_mapped_claims = n.get_boolean_value() },\n \"knownClientApplications\" => lambda {|n| @known_client_applications = n.get_collection_of_primitive_values(UUIDTools::UUID) },\n \"oauth2PermissionScopes\" => lambda {|n| @oauth2_permission_scopes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PermissionScope.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preAuthorizedApplications\" => lambda {|n| @pre_authorized_applications = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PreAuthorizedApplication.create_from_discriminator_value(pn) }) },\n \"requestedAccessTokenVersion\" => lambda {|n| @requested_access_token_version = n.get_number_value() },\n }\n end",
"title": ""
},
{
"docid": "83b016f26a68a0721589d78cdfe4f24a",
"score": "0.596292",
"text": "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end",
"title": ""
},
{
"docid": "7e3f5f9c680532e6931702207e77b1bd",
"score": "0.5951651",
"text": "def get_field_deserializers()\n return {\n \"failedRuns\" => lambda {|n| @failed_runs = n.get_number_value() },\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulRuns\" => lambda {|n| @successful_runs = n.get_number_value() },\n \"totalRuns\" => lambda {|n| @total_runs = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end",
"title": ""
},
{
"docid": "de9b46b8eb9f58dbaee4e4016c4ae88b",
"score": "0.5950895",
"text": "def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_guid_value() },\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "419be0eed1444fd766f303a491f3700d",
"score": "0.59456754",
"text": "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"recommendedActions\" => lambda {|n| @recommended_actions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RecommendedAction.create_from_discriminator_value(pn) }) },\n \"resolvedTargetsCount\" => lambda {|n| @resolved_targets_count = n.get_number_value() },\n \"simulationEventsContent\" => lambda {|n| @simulation_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SimulationEventsContent.create_from_discriminator_value(pn) }) },\n \"trainingEventsContent\" => lambda {|n| @training_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TrainingEventsContent.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
},
{
"docid": "f3eb38068d1244ca9e0c24a4472d53c8",
"score": "0.59448177",
"text": "def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"hint\" => lambda {|n| @hint = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"secretText\" => lambda {|n| @secret_text = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end",
"title": ""
},
{
"docid": "590637dea6f7ebf9247a788298af77fb",
"score": "0.593984",
"text": "def get_field_deserializers()\n return {\n \"isRequired\" => lambda {|n| @is_required = n.get_boolean_value() },\n \"locations\" => lambda {|n| @locations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LocationConstraintItem.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"suggestLocation\" => lambda {|n| @suggest_location = n.get_boolean_value() },\n }\n end",
"title": ""
},
{
"docid": "dff8764ca70a9ffdbeb50b2cc1247bf3",
"score": "0.59362113",
"text": "def get_field_deserializers()\n return {\n \"activityType\" => lambda {|n| @activity_type = n.get_string_value() },\n \"chainId\" => lambda {|n| @chain_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"previewText\" => lambda {|n| @preview_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"recipient\" => lambda {|n| @recipient = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkNotificationRecipient.create_from_discriminator_value(pn) }) },\n \"templateParameters\" => lambda {|n| @template_parameters = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::KeyValuePair.create_from_discriminator_value(pn) }) },\n \"topic\" => lambda {|n| @topic = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkActivityTopic.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
},
{
"docid": "49a712c890e2f6d364736898ec87f8b4",
"score": "0.5935833",
"text": "def metadata\n self.class.metadata\n end",
"title": ""
},
{
"docid": "7fd450d9343b029e08241ec89d2f52c8",
"score": "0.59319806",
"text": "def get_field_deserializers()\n return {\n \"activityIdentifier\" => lambda {|n| @activity_identifier = n.get_string_value() },\n \"countEntitled\" => lambda {|n| @count_entitled = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEntitledForProvisioning\" => lambda {|n| @count_entitled_for_provisioning = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowed\" => lambda {|n| @count_escrowed = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowedRaw\" => lambda {|n| @count_escrowed_raw = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExported\" => lambda {|n| @count_exported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExports\" => lambda {|n| @count_exports = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImported\" => lambda {|n| @count_imported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedDeltas\" => lambda {|n| @count_imported_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedReferenceDeltas\" => lambda {|n| @count_imported_reference_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"error\" => lambda {|n| @error = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::SynchronizationTaskExecutionResult) },\n \"timeBegan\" => lambda {|n| @time_began = n.get_date_time_value() },\n \"timeEnded\" => lambda {|n| @time_ended = n.get_date_time_value() },\n }\n end",
"title": ""
},
{
"docid": "1dc305ebf3f15a443567881c6878aff8",
"score": "0.59312665",
"text": "def get_field_deserializers()\n return {\n \"content\" => lambda {|n| @content = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"transportKey\" => lambda {|n| @transport_key = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "bf143f80feb2f99d33b32d607b761b7f",
"score": "0.59307545",
"text": "def get_field_deserializers()\n return super.merge({\n \"activeDeviceCount\" => lambda {|n| @active_device_count = n.get_number_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"modelAppHealthScore\" => lambda {|n| @model_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "1d8db1053fccd1369db5b028cd1da46b",
"score": "0.5930406",
"text": "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceAccess\" => lambda {|n| @resource_access = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ResourceAccess.create_from_discriminator_value(pn) }) },\n \"resourceAppId\" => lambda {|n| @resource_app_id = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "bf993ac6e3975bdfd876859d3e75f423",
"score": "0.5926444",
"text": "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end",
"title": ""
},
{
"docid": "ad68e8ac4586520333ab3983881af06f",
"score": "0.5926136",
"text": "def get_field_deserializers()\n return {\n \"anchor\" => lambda {|n| @anchor = n.get_boolean_value() },\n \"apiExpressions\" => lambda {|n| @api_expressions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::StringKeyStringValuePair.create_from_discriminator_value(pn) }) },\n \"caseExact\" => lambda {|n| @case_exact = n.get_boolean_value() },\n \"defaultValue\" => lambda {|n| @default_value = n.get_string_value() },\n \"flowNullValues\" => lambda {|n| @flow_null_values = n.get_boolean_value() },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeDefinitionMetadataEntry.create_from_discriminator_value(pn) }) },\n \"multivalued\" => lambda {|n| @multivalued = n.get_boolean_value() },\n \"mutability\" => lambda {|n| @mutability = n.get_enum_value(MicrosoftGraph::Models::Mutability) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"referencedObjects\" => lambda {|n| @referenced_objects = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ReferencedObject.create_from_discriminator_value(pn) }) },\n \"required\" => lambda {|n| @required = n.get_boolean_value() },\n \"type\" => lambda {|n| @type = n.get_enum_value(MicrosoftGraph::Models::AttributeType) },\n }\n end",
"title": ""
},
{
"docid": "96d30f1a2a5ffa50c7862417cb476576",
"score": "0.59240156",
"text": "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end",
"title": ""
},
{
"docid": "29ef3fb5513edb2ac3d070d9744f9aa1",
"score": "0.5922303",
"text": "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "fa594e514c9869eb18a86166140d4efd",
"score": "0.591605",
"text": "def get_field_deserializers()\n return super.merge({\n \"averageBlueScreens\" => lambda {|n| @average_blue_screens = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageRestarts\" => lambda {|n| @average_restarts = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"blueScreenCount\" => lambda {|n| @blue_screen_count = n.get_number_value() },\n \"bootScore\" => lambda {|n| @boot_score = n.get_number_value() },\n \"coreBootTimeInMs\" => lambda {|n| @core_boot_time_in_ms = n.get_number_value() },\n \"coreLoginTimeInMs\" => lambda {|n| @core_login_time_in_ms = n.get_number_value() },\n \"deviceCount\" => lambda {|n| @device_count = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"diskType\" => lambda {|n| @disk_type = n.get_enum_value(MicrosoftGraph::Models::DiskType) },\n \"groupPolicyBootTimeInMs\" => lambda {|n| @group_policy_boot_time_in_ms = n.get_number_value() },\n \"groupPolicyLoginTimeInMs\" => lambda {|n| @group_policy_login_time_in_ms = n.get_number_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"loginScore\" => lambda {|n| @login_score = n.get_number_value() },\n \"manufacturer\" => lambda {|n| @manufacturer = n.get_string_value() },\n \"model\" => lambda {|n| @model = n.get_string_value() },\n \"modelStartupPerformanceScore\" => lambda {|n| @model_startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"operatingSystemVersion\" => lambda {|n| @operating_system_version = n.get_string_value() },\n \"responsiveDesktopTimeInMs\" => lambda {|n| @responsive_desktop_time_in_ms = n.get_number_value() },\n \"restartCount\" => lambda {|n| @restart_count = n.get_number_value() },\n \"startupPerformanceScore\" => lambda {|n| @startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "9f75c6ea68d21bbda614550872dadc9d",
"score": "0.591336",
"text": "def get_field_deserializers()\n return {\n \"connectingIP\" => lambda {|n| @connecting_i_p = n.get_string_value() },\n \"deliveryAction\" => lambda {|n| @delivery_action = n.get_string_value() },\n \"deliveryLocation\" => lambda {|n| @delivery_location = n.get_string_value() },\n \"directionality\" => lambda {|n| @directionality = n.get_string_value() },\n \"internetMessageId\" => lambda {|n| @internet_message_id = n.get_string_value() },\n \"messageFingerprint\" => lambda {|n| @message_fingerprint = n.get_string_value() },\n \"messageReceivedDateTime\" => lambda {|n| @message_received_date_time = n.get_date_time_value() },\n \"messageSubject\" => lambda {|n| @message_subject = n.get_string_value() },\n \"networkMessageId\" => lambda {|n| @network_message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "65579a23de1e0a569004092828861289",
"score": "0.5913327",
"text": "def get_field_deserializers()\n return {\n \"application\" => lambda {|n| @application = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Identity.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preventsDownload\" => lambda {|n| @prevents_download = n.get_boolean_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"webHtml\" => lambda {|n| @web_html = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "64053331ce14a03dd30766a477178afa",
"score": "0.59130335",
"text": "def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "f751e1e458cb7abcc8cebe5a16465a18",
"score": "0.5910617",
"text": "def get_field_deserializers()\n return {\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"uploadUrl\" => lambda {|n| @upload_url = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "33e521343e70f92d160ca202961c1db6",
"score": "0.5906052",
"text": "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceCountWithCrashes\" => lambda {|n| @device_count_with_crashes = n.get_number_value() },\n \"isLatestUsedVersion\" => lambda {|n| @is_latest_used_version = n.get_boolean_value() },\n \"isMostUsedVersion\" => lambda {|n| @is_most_used_version = n.get_boolean_value() },\n })\n end",
"title": ""
},
{
"docid": "d25c49a89f42041f7a772858c6dd2895",
"score": "0.59042066",
"text": "def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "12135f59616f6f70fac7a07099b0e7b1",
"score": "0.5903306",
"text": "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appHangCount\" => lambda {|n| @app_hang_count = n.get_number_value() },\n \"crashedAppCount\" => lambda {|n| @crashed_app_count = n.get_number_value() },\n \"deviceAppHealthScore\" => lambda {|n| @device_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end",
"title": ""
},
{
"docid": "8140d7e7e480378b57395169811bb3b1",
"score": "0.5902868",
"text": "def get_field_deserializers()\n return {\n \"messageId\" => lambda {|n| @message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"replyChainMessageId\" => lambda {|n| @reply_chain_message_id = n.get_string_value() },\n \"threadId\" => lambda {|n| @thread_id = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "88d6d7a9b354ee045a38d676072d2715",
"score": "0.59027255",
"text": "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"isUsable\" => lambda {|n| @is_usable = n.get_boolean_value() },\n \"isUsableOnce\" => lambda {|n| @is_usable_once = n.get_boolean_value() },\n \"lifetimeInMinutes\" => lambda {|n| @lifetime_in_minutes = n.get_number_value() },\n \"methodUsabilityReason\" => lambda {|n| @method_usability_reason = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"temporaryAccessPass\" => lambda {|n| @temporary_access_pass = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "60dd68cf7c9c7ac6571d996fa0def783",
"score": "0.5902389",
"text": "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end",
"title": ""
},
{
"docid": "9e7b8ce2959db7283b6961b71228c32a",
"score": "0.5902219",
"text": "def get_field_deserializers()\n return {\n \"bargeInAllowed\" => lambda {|n| @barge_in_allowed = n.get_boolean_value() },\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"initialSilenceTimeoutInSeconds\" => lambda {|n| @initial_silence_timeout_in_seconds = n.get_number_value() },\n \"maxRecordDurationInSeconds\" => lambda {|n| @max_record_duration_in_seconds = n.get_number_value() },\n \"maxSilenceTimeoutInSeconds\" => lambda {|n| @max_silence_timeout_in_seconds = n.get_number_value() },\n \"playBeep\" => lambda {|n| @play_beep = n.get_boolean_value() },\n \"prompts\" => lambda {|n| @prompts = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Prompt.create_from_discriminator_value(pn) }) },\n \"stopTones\" => lambda {|n| @stop_tones = n.get_collection_of_primitive_values(String) },\n }\n end",
"title": ""
},
{
"docid": "179509031213ddcfd0513519046c2f3b",
"score": "0.5901496",
"text": "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"response\" => lambda {|n| @response = n.get_enum_value(MicrosoftGraph::Models::ResponseType) },\n \"time\" => lambda {|n| @time = n.get_date_time_value() },\n }\n end",
"title": ""
},
{
"docid": "2834f541abbb6d4b363e87ef132907ef",
"score": "0.58978146",
"text": "def get_field_deserializers()\n return {\n \"driveId\" => lambda {|n| @drive_id = n.get_string_value() },\n \"driveType\" => lambda {|n| @drive_type = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n \"shareId\" => lambda {|n| @share_id = n.get_string_value() },\n \"sharepointIds\" => lambda {|n| @sharepoint_ids = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SharepointIds.create_from_discriminator_value(pn) }) },\n \"siteId\" => lambda {|n| @site_id = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "8f3d2467f5d7f0325751de8b8434f5b9",
"score": "0.5891392",
"text": "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end",
"title": ""
},
{
"docid": "0ab805a8f02f8470b0644a7d42255034",
"score": "0.5890228",
"text": "def get_field_deserializers()\n return {\n \"activeMalwareDetectionCount\" => lambda {|n| @active_malware_detection_count = n.get_number_value() },\n \"category\" => lambda {|n| @category = n.get_enum_value(MicrosoftGraph::Models::WindowsMalwareCategory) },\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"distinctActiveMalwareCount\" => lambda {|n| @distinct_active_malware_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "1c2c532b0127162e35bac0b90481b301",
"score": "0.5885622",
"text": "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"issuerName\" => lambda {|n| @issuer_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::CertificateStatus) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"subjectName\" => lambda {|n| @subject_name = n.get_string_value() },\n \"uploadDateTime\" => lambda {|n| @upload_date_time = n.get_date_time_value() },\n })\n end",
"title": ""
},
{
"docid": "f6b8c3716088d902f4e353ff49698980",
"score": "0.5885429",
"text": "def get_field_deserializers()\n return {\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"servicePrincipalId\" => lambda {|n| @service_principal_id = n.get_string_value() },\n \"servicePrincipalName\" => lambda {|n| @service_principal_name = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "15df29816e75c7936bf94989b44de5d9",
"score": "0.5884738",
"text": "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"riskDetections\" => lambda {|n| @risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskDetection.create_from_discriminator_value(pn) }) },\n \"riskyServicePrincipals\" => lambda {|n| @risky_service_principals = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyServicePrincipal.create_from_discriminator_value(pn) }) },\n \"riskyUsers\" => lambda {|n| @risky_users = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyUser.create_from_discriminator_value(pn) }) },\n \"servicePrincipalRiskDetections\" => lambda {|n| @service_principal_risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ServicePrincipalRiskDetection.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
},
{
"docid": "83f7be26c49e1a572d1ed0eaeb7a705b",
"score": "0.5883899",
"text": "def get_field_deserializers()\n return super.merge({\n })\n end",
"title": ""
},
{
"docid": "83f7be26c49e1a572d1ed0eaeb7a705b",
"score": "0.5883899",
"text": "def get_field_deserializers()\n return super.merge({\n })\n end",
"title": ""
},
{
"docid": "83f7be26c49e1a572d1ed0eaeb7a705b",
"score": "0.5883899",
"text": "def get_field_deserializers()\n return super.merge({\n })\n end",
"title": ""
},
{
"docid": "0396a15678cd9b254671bdd34f133f78",
"score": "0.58811784",
"text": "def get_field_deserializers()\n return {\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"failedUsers\" => lambda {|n| @failed_users = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulUsers\" => lambda {|n| @successful_users = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end",
"title": ""
},
{
"docid": "ddfa71584c0188676034a61a07a25a5a",
"score": "0.5878516",
"text": "def get_field_deserializers()\n return {\n \"durationInSeconds\" => lambda {|n| @duration_in_seconds = n.get_number_value() },\n \"joinDateTime\" => lambda {|n| @join_date_time = n.get_date_time_value() },\n \"leaveDateTime\" => lambda {|n| @leave_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "4824dc01c82cb660e7373b3557366f95",
"score": "0.5877111",
"text": "def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "67652ad565a7681dc847455c484bd0a8",
"score": "0.5869185",
"text": "def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"entityType\" => lambda {|n| @entity_type = n.get_string_value() },\n \"mailNickname\" => lambda {|n| @mail_nickname = n.get_string_value() },\n \"onBehalfOfUserId\" => lambda {|n| @on_behalf_of_user_id = n.get_guid_value() },\n }\n end",
"title": ""
},
{
"docid": "60085a1f92a5d1c01134164103ec3a9c",
"score": "0.5844199",
"text": "def get_field_deserializers()\n return {\n \"actionName\" => lambda {|n| @action_name = n.get_string_value() },\n \"actionState\" => lambda {|n| @action_state = n.get_enum_value(MicrosoftGraph::Models::ActionState) },\n \"lastUpdatedDateTime\" => lambda {|n| @last_updated_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end",
"title": ""
},
{
"docid": "e751a38ac180bcb9ef35252459bc3182",
"score": "0.58430207",
"text": "def get_field_deserializers()\n return {\n \"accountName\" => lambda {|n| @account_name = n.get_string_value() },\n \"azureAdUserId\" => lambda {|n| @azure_ad_user_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"domainName\" => lambda {|n| @domain_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n \"userSid\" => lambda {|n| @user_sid = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "cef5ee2f800d78fde578e44cf3b0ed17",
"score": "0.58408237",
"text": "def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end",
"title": ""
},
{
"docid": "0c063d554f8017d9d5b9504b91946b77",
"score": "0.58383596",
"text": "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n }\n end",
"title": ""
},
{
"docid": "5f23b758a93f310546d541d69fbbaf65",
"score": "0.58362466",
"text": "def get_field_deserializers()\n return {\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_guid_value() },\n \"cloudServiceDeploymentEnvironment\" => lambda {|n| @cloud_service_deployment_environment = n.get_string_value() },\n \"cloudServiceDeploymentId\" => lambda {|n| @cloud_service_deployment_id = n.get_string_value() },\n \"cloudServiceInstanceName\" => lambda {|n| @cloud_service_instance_name = n.get_string_value() },\n \"cloudServiceName\" => lambda {|n| @cloud_service_name = n.get_string_value() },\n \"deviceDescription\" => lambda {|n| @device_description = n.get_string_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"mediaLegId\" => lambda {|n| @media_leg_id = n.get_guid_value() },\n \"mediaQualityList\" => lambda {|n| @media_quality_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TeleconferenceDeviceMediaQuality.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"participantId\" => lambda {|n| @participant_id = n.get_guid_value() },\n }\n end",
"title": ""
},
{
"docid": "6b8de691009c1dae14fb2eb60a78317a",
"score": "0.5836192",
"text": "def _before_validation\n serialize_deserialized_values\n super\n end",
"title": ""
},
{
"docid": "f77efd537d829363f91ecbae49b11239",
"score": "0.5835942",
"text": "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isBuiltIn\" => lambda {|n| @is_built_in = n.get_boolean_value() },\n \"roleAssignments\" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },\n \"rolePermissions\" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },\n })\n end",
"title": ""
},
{
"docid": "ddbcb813bf72cd1230c1838b5dacb5e7",
"score": "0.5834559",
"text": "def get_field_deserializers()\n return super.merge({\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_string_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n })\n end",
"title": ""
},
{
"docid": "598da2e991fd36b70c01417d8d7f0c72",
"score": "0.583357",
"text": "def get_field_deserializers()\n return {\n \"color\" => lambda {|n| @color = n.get_string_value() },\n \"criterion1\" => lambda {|n| @criterion1 = n.get_string_value() },\n \"criterion2\" => lambda {|n| @criterion2 = n.get_string_value() },\n \"dynamicCriteria\" => lambda {|n| @dynamic_criteria = n.get_string_value() },\n \"filterOn\" => lambda {|n| @filter_on = n.get_string_value() },\n \"icon\" => lambda {|n| @icon = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookIcon.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operator\" => lambda {|n| @operator = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "b9e42052e8a5264f7b88c8814b31593a",
"score": "0.0",
"text": "def set_core_connection\n @core_connection = Core::Connection.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163163",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045976",
"text": "def action_hook; end",
"title": ""
},
{
"docid": "b8b36fc1cfde36f9053fe0ab68d70e5b",
"score": "0.5946146",
"text": "def run_actions; end",
"title": ""
},
{
"docid": "3e521dbc644eda8f6b2574409e10a4f8",
"score": "0.591683",
"text": "def define_action_hook; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "bfb8386ef5554bfa3a1c00fa4e20652f",
"score": "0.58349305",
"text": "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",
"title": ""
},
{
"docid": "6c8e66d9523b9fed19975542132c6ee4",
"score": "0.5776858",
"text": "def add_actions; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "6ce8a8e8407572b4509bb78db9bf8450",
"score": "0.5652805",
"text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"title": ""
},
{
"docid": "1964d48e8493eb37800b3353d25c0e57",
"score": "0.5621621",
"text": "def define_action_helpers; end",
"title": ""
},
{
"docid": "5df9f7ffd2cb4f23dd74aada87ad1882",
"score": "0.54210985",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "0464870c8688619d6c104d733d355b3b",
"score": "0.53402257",
"text": "def define_action_helpers?; end",
"title": ""
},
{
"docid": "0e7bdc54b0742aba847fd259af1e9f9e",
"score": "0.53394014",
"text": "def set_actions\n actions :all\n end",
"title": ""
},
{
"docid": "5510330550e34a3fd68b7cee18da9524",
"score": "0.53321576",
"text": "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",
"title": ""
},
{
"docid": "97c8901edfddc990da95704a065e87bc",
"score": "0.53124547",
"text": "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",
"title": ""
},
{
"docid": "4f9a284723e2531f7d19898d6a6aa20c",
"score": "0.529654",
"text": "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",
"title": ""
},
{
"docid": "83684438c0a4d20b6ddd4560c7683115",
"score": "0.5296262",
"text": "def before_actions(*logic)\n self.before_actions = logic\n end",
"title": ""
},
{
"docid": "210e0392ceaad5fc0892f1335af7564b",
"score": "0.52952296",
"text": "def setup_handler\n end",
"title": ""
},
{
"docid": "a997ba805d12c5e7f7c4c286441fee18",
"score": "0.52600986",
"text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "1d50ec65c5bee536273da9d756a78d0d",
"score": "0.52442724",
"text": "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",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "635288ac8dd59f85def0b1984cdafba0",
"score": "0.5232394",
"text": "def workflow\n end",
"title": ""
},
{
"docid": "e34cc2a25e8f735ccb7ed8361091c83e",
"score": "0.523231",
"text": "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",
"title": ""
},
{
"docid": "78b21be2632f285b0d40b87a65b9df8c",
"score": "0.5227454",
"text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "923ee705f0e7572feb2c1dd3c154b97c",
"score": "0.52201617",
"text": "def process_action(...)\n send_action(...)\n end",
"title": ""
},
{
"docid": "b89a3908eaa7712bb5706478192b624d",
"score": "0.5212327",
"text": "def before_dispatch(env); end",
"title": ""
},
{
"docid": "7115b468ae54de462141d62fc06b4190",
"score": "0.52079266",
"text": "def after_actions(*logic)\n self.after_actions = logic\n end",
"title": ""
},
{
"docid": "d89a3e408ab56bf20bfff96c63a238dc",
"score": "0.52050185",
"text": "def setup\n # override and do something appropriate\n end",
"title": ""
},
{
"docid": "62c402f0ea2e892a10469bb6e077fbf2",
"score": "0.51754695",
"text": "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",
"title": ""
},
{
"docid": "72ccb38e1bbd86cef2e17d9d64211e64",
"score": "0.51726824",
"text": "def setup(_context)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "1fd817f354d6cb0ff1886ca0a2b6cce4",
"score": "0.5166172",
"text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"title": ""
},
{
"docid": "5531df39ee7d732600af111cf1606a35",
"score": "0.5159343",
"text": "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",
"title": ""
},
{
"docid": "bb6aed740c15c11ca82f4980fe5a796a",
"score": "0.51578903",
"text": "def determine_valid_action\n\n end",
"title": ""
},
{
"docid": "b38f9d83c26fd04e46fe2c961022ff86",
"score": "0.51522785",
"text": "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",
"title": ""
},
{
"docid": "199fce4d90958e1396e72d961cdcd90b",
"score": "0.5152022",
"text": "def startcompany(action)\n @done = true\n action.setup\n end",
"title": ""
},
{
"docid": "994d9fe4eb9e2fc503d45c919547a327",
"score": "0.51518047",
"text": "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",
"title": ""
},
{
"docid": "62fabe9dfa2ec2ff729b5a619afefcf0",
"score": "0.51456624",
"text": "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",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "adb8115fce9b2b4cb9efc508a11e5990",
"score": "0.5133759",
"text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"title": ""
},
{
"docid": "e1dd18cf24d77434ec98d1e282420c84",
"score": "0.5112076",
"text": "def setup(&block)\n define_method(:setup, &block)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "f54964387b0ee805dbd5ad5c9a699016",
"score": "0.5106169",
"text": "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",
"title": ""
},
{
"docid": "35b302dd857a031b95bc0072e3daa707",
"score": "0.509231",
"text": "def config(action, *args); end",
"title": ""
},
{
"docid": "bc3cd61fa2e274f322b0b20e1a73acf8",
"score": "0.50873137",
"text": "def setup\n @setup_proc.call(self) if @setup_proc\n end",
"title": ""
},
{
"docid": "5c3cfcbb42097019c3ecd200acaf9e50",
"score": "0.5081088",
"text": "def before_action \n end",
"title": ""
},
{
"docid": "246840a409eb28800dc32d6f24cb1c5e",
"score": "0.508059",
"text": "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",
"title": ""
},
{
"docid": "dfbcf4e73466003f1d1275cdf58a926a",
"score": "0.50677156",
"text": "def action\n end",
"title": ""
},
{
"docid": "36eb407a529f3fc2d8a54b5e7e9f3e50",
"score": "0.50562143",
"text": "def matt_custom_action_begin(label); end",
"title": ""
},
{
"docid": "b6c9787acd00c1b97aeb6e797a363364",
"score": "0.5050554",
"text": "def setup\n # override this if needed\n end",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "fd421350722a26f18a7aae4f5aa1fc59",
"score": "0.5036181",
"text": "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",
"title": ""
},
{
"docid": "d02030204e482cbe2a63268b94400e71",
"score": "0.5026331",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"title": ""
},
{
"docid": "4224d3231c27bf31ffc4ed81839f8315",
"score": "0.5022976",
"text": "def after(action)\n invoke_callbacks *options_for(action).after\n end",
"title": ""
},
{
"docid": "24506e3666fd6ff7c432e2c2c778d8d1",
"score": "0.5015441",
"text": "def pre_task\n end",
"title": ""
},
{
"docid": "0c16dc5c1875787dacf8dc3c0f871c53",
"score": "0.50121695",
"text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"title": ""
},
{
"docid": "c99a12c5761b742ccb9c51c0e99ca58a",
"score": "0.5000944",
"text": "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",
"title": ""
},
{
"docid": "0cff1d3b3041b56ce3773d6a8d6113f2",
"score": "0.5000019",
"text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"title": ""
},
{
"docid": "791f958815c2b2ac16a8ca749a7a822e",
"score": "0.4996878",
"text": "def setup_signals; end",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"text": "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",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"text": "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",
"title": ""
},
{
"docid": "5aa51b20183964c6b6f46d150b0ddd79",
"score": "0.49864885",
"text": "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",
"title": ""
},
{
"docid": "7647b99591d6d687d05b46dc027fbf23",
"score": "0.49797225",
"text": "def initialize(*args)\n super\n @action = :set\nend",
"title": ""
},
{
"docid": "67e7767ce756766f7c807b9eaa85b98a",
"score": "0.49785787",
"text": "def after_set_callback; end",
"title": ""
},
{
"docid": "2a2b0a113a73bf29d5eeeda0443796ec",
"score": "0.4976161",
"text": "def setup\n #implement in subclass;\n end",
"title": ""
},
{
"docid": "63e628f34f3ff34de8679fb7307c171c",
"score": "0.49683493",
"text": "def lookup_action; end",
"title": ""
},
{
"docid": "a5294693c12090c7b374cfa0cabbcf95",
"score": "0.4965126",
"text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"title": ""
},
{
"docid": "57dbfad5e2a0e32466bd9eb0836da323",
"score": "0.4958034",
"text": "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",
"title": ""
},
{
"docid": "5b6d613e86d3d68152f7fa047d38dabb",
"score": "0.49559742",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4aceccac5b1bcf7d22c049693b05f81c",
"score": "0.4954353",
"text": "def around_hooks; end",
"title": ""
},
{
"docid": "2318410efffb4fe5fcb97970a8700618",
"score": "0.49535993",
"text": "def save_action; end",
"title": ""
},
{
"docid": "64e0f1bb6561b13b482a3cc8c532cc37",
"score": "0.4952725",
"text": "def setup(easy)\n super\n easy.customrequest = @verb\n end",
"title": ""
},
{
"docid": "fbd0db2e787e754fdc383687a476d7ec",
"score": "0.49467874",
"text": "def action_target()\n \n end",
"title": ""
},
{
"docid": "b280d59db403306d7c0f575abb19a50f",
"score": "0.49423352",
"text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"title": ""
},
{
"docid": "9f7547d93941fc2fcc7608fdf0911643",
"score": "0.49325448",
"text": "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",
"title": ""
},
{
"docid": "da88436fe6470a2da723e0a1b09a0e80",
"score": "0.49282882",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd",
"score": "0.49269363",
"text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"title": ""
},
{
"docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3",
"score": "0.49269104",
"text": "def default_action; end",
"title": ""
},
{
"docid": "3ba85f3cb794f951b05d5907f91bd8ad",
"score": "0.49252945",
"text": "def setup(&blk)\n @setup_block = blk\n end",
"title": ""
},
{
"docid": "80834fa3e08bdd7312fbc13c80f89d43",
"score": "0.4923091",
"text": "def callback_phase\n super\n end",
"title": ""
},
{
"docid": "f1da8d654daa2cd41cb51abc7ee7898f",
"score": "0.49194667",
"text": "def advice\n end",
"title": ""
},
{
"docid": "99a608ac5478592e9163d99652038e13",
"score": "0.49174926",
"text": "def _handle_action_missing(*args); end",
"title": ""
},
{
"docid": "9e264985e628b89f1f39d574fdd7b881",
"score": "0.49173003",
"text": "def duas1(action)\n action.call\n action.call\nend",
"title": ""
},
{
"docid": "399ad686f5f38385ff4783b91259dbd7",
"score": "0.49171105",
"text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"title": ""
},
{
"docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a",
"score": "0.4915879",
"text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"title": ""
},
{
"docid": "6e0842ade69d031131bf72e9d2a8c389",
"score": "0.49155936",
"text": "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",
"title": ""
}
] |
d06f3ccdedc8117ba30aa7e7fae117ac
|
TODO DRY into looping over array of classes
|
[
{
"docid": "4c0bb5777142e78bdb7782258be40117",
"score": "0.0",
"text": "def call\n CollectAllCards.new(game).call\n DealAllCards.new(game).call\n end",
"title": ""
}
] |
[
{
"docid": "e0ffe4bb375187a9afb210b5bdde1e45",
"score": "0.68550056",
"text": "def classes=(ary)\n `for(var result=[],i=0,l=ary.length;i<l;++i){result.push(ary[i].__value__);}`\n `this.__native__.className=result.join(' ')`\n return ary\n end",
"title": ""
},
{
"docid": "ea47c06912079c1b939b1f087d9a724f",
"score": "0.68324846",
"text": "def process_classes(klass_hash, scope)\n interpolate_array(klass_hash['classes'], scope) +\n get_classes_from_groups(\n interpolate_array(klass_hash['class_groups'], scope), scope\n )\n end",
"title": ""
},
{
"docid": "05a45d0235c598ff04723ed3cff2276e",
"score": "0.6799454",
"text": "def classes; end",
"title": ""
},
{
"docid": "d357d350069a7a45f6bbb7f1d9134fa1",
"score": "0.6761983",
"text": "def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end",
"title": ""
},
{
"docid": "7487f14d29f234edc6284716ecad7b58",
"score": "0.6701184",
"text": "def classes\n @classes.values\n end",
"title": ""
},
{
"docid": "7487f14d29f234edc6284716ecad7b58",
"score": "0.6701184",
"text": "def classes\n @classes.values\n end",
"title": ""
},
{
"docid": "e29ce518220160159de894af1c4c449a",
"score": "0.6631539",
"text": "def classes\n [self]\n end",
"title": ""
},
{
"docid": "5bfdf7875d910e60f32fd53711a82c2c",
"score": "0.661652",
"text": "def uses(*classes)\n class_helpers.push(*classes).uniq!\n end",
"title": ""
},
{
"docid": "18aef99411b9b8a99b0e2ea43060b179",
"score": "0.65281105",
"text": "def define_classes klasses\n klasses.each do |klassname|\n klass = klassname.gsub(/\\b('?[a-z])/) { $1.capitalize } #make uppercase\n #could check to see if not already define but at the minute not important\n #if (eval \"defined? #{klass}\") != \"constant\"\n eval \"class #{klass} < DynAttrClass \\n end\"\n #end\n end\nend",
"title": ""
},
{
"docid": "405d1c273b354cfec238c5032c765c06",
"score": "0.65218353",
"text": "def class_names\n classes.map &:name\n end",
"title": ""
},
{
"docid": "ba58baba04868fc7eb31f5a106c89757",
"score": "0.6483304",
"text": "def load_classes class_path_list\n class_path_list.each do |path|\n add_class path\n end\n end",
"title": ""
},
{
"docid": "60baeb21da834372fff993ff671a8304",
"score": "0.64547545",
"text": "def add_classes(*classes)\n classes.map{|e| e.kind_of?(String) ? [e, nil] : e}.map{|p| add_class(*p)}\n end",
"title": ""
},
{
"docid": "c499af921515489621cc51e2fd07a360",
"score": "0.64455616",
"text": "def class_list\n array = []\n ObjectSpace.each_object(Class) {|m| array << m }\n array\n end",
"title": ""
},
{
"docid": "d09c37c98a9b22507faa3d5769e41afd",
"score": "0.64431196",
"text": "def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "b83edd6050672796d0d2195346928900",
"score": "0.6430774",
"text": "def add_classes(rule_set, class_array)\n rule_set.each_selector do |selector|\n selector_name = selector.to_s.strip\n if selector_name[0] == '.'\n selector_name = selector_name[1, selector_name.length]\n unless class_array.include?(selector_name)\n class_array << selector_name\n end\n end\n end\n end",
"title": ""
},
{
"docid": "41bf4b77a989073f9e73fc512892727c",
"score": "0.6415745",
"text": "def classes\n\t\tlist = []\n\t\teach_class { |class_constant|\n\t\t\tlist\t<< class_constant\n\t\t}\n\t\treturn list\n\tend",
"title": ""
},
{
"docid": "44d701006715273905b393d87acbec02",
"score": "0.6374491",
"text": "def fetch_classes_list\n uri = URI(BASE_URI + \"classes\")\n classes = make_request(uri)\n classes_instances = classes[\"results\"].map do |classes_data|\n Classes.new classes_data[\"name\"]\n end\n end",
"title": ""
},
{
"docid": "0749afffa8cd1dc7608f2714afe707b5",
"score": "0.6366049",
"text": "def classes\n @class_list ||= Element::Classes.new(self)\n end",
"title": ""
},
{
"docid": "838690a26e9575ffa077fa37e0391165",
"score": "0.6364721",
"text": "def defined_classes\n # TODO: check content type before scanning\n content.scan(/\\s*class\\s+([A-Za-z0-9_\\.]*)/).flatten\n end",
"title": ""
},
{
"docid": "7b69c94697bbd9b4325a8dde3c941861",
"score": "0.63639313",
"text": "def populate_class_cache(class_cache, classes, extension = false)\n classes.each do |cdesc|\n desc = read_yaml cdesc\n klassname = desc[\"full_name\"]\n\n unless class_cache.has_key? klassname then\n desc[\"display_name\"] = \"Class\"\n desc[\"sources\"] = [cdesc]\n desc[\"instance_method_extensions\"] = []\n desc[\"class_method_extensions\"] = []\n class_cache[klassname] = desc\n else\n klass = class_cache[klassname]\n\n if extension then\n desc[\"instance_method_extensions\"] = desc.delete \"instance_methods\"\n desc[\"class_method_extensions\"] = desc.delete \"class_methods\"\n end\n\n klass.merge_enums desc\n klass[\"sources\"] << cdesc\n end\n end\n end",
"title": ""
},
{
"docid": "4349d59b12a658a18776eb0d03680593",
"score": "0.6358687",
"text": "def classes\n @classes\n end",
"title": ""
},
{
"docid": "988c1ad7077536ce7d7b552772a90b56",
"score": "0.6310183",
"text": "def classes(name = nil)\n if name\n classes.find(:name => name)\n else\n @classes.flatten\n end\n end",
"title": ""
},
{
"docid": "4b9e068e0d537e4484858318bea9f075",
"score": "0.627815",
"text": "def get_classes\n (attr['class'] || '').downcase.split(' ').sort\n end",
"title": ""
},
{
"docid": "2e0d3573a751933196caef95227b53a5",
"score": "0.62665474",
"text": "def objects_of_class(name)\n find_all { |r| name === r['class'] }\n end",
"title": ""
},
{
"docid": "1aa5ca43362681ec13d5be9eeb3b3f65",
"score": "0.6250622",
"text": "def generate_all_classes(site)\n puts \"222222222222222222222222222222222222222222222222222222222222\"\n if Dir.exists?('src/_classes')\n puts \"3333333333\"\n Dir.chdir('src/_classes')\n\n Dir[\"*.yml\"].each do |path|\n puts \"444444444 \" + path\n name = File.basename(path, '.yml')\n self.generate_class_index(site, site.source, \"/pages/classes/\" + name, name, 'el')\n self.generate_class_index(site, site.source, \"/en/pages/classes/\" + name, name, 'en')\n end\n\n Dir.chdir(site.source)\n self.generate_all_classes_index(site)\n end\n end",
"title": ""
},
{
"docid": "6355d3c1635004a32a60c798ee541345",
"score": "0.62015295",
"text": "def list_known_classes names = []\n classes = []\n\n stores.each do |store|\n classes << store.module_names\n end\n\n classes = classes.flatten.uniq.sort\n\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n\n classes = classes.grep filter\n end\n\n page do |io|\n if paging? or io.tty? then\n if names.empty? then\n io.puts \"Classes and Modules known to ri:\"\n else\n io.puts \"Classes and Modules starting with #{names.join ', '}:\"\n end\n io.puts\n end\n\n io.puts classes.join(\"\\n\")\n end\n end",
"title": ""
},
{
"docid": "325f35730644c1883f4397ff45838529",
"score": "0.6168449",
"text": "def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end",
"title": ""
},
{
"docid": "6a11cb0745c791de528050281f6c8fac",
"score": "0.6157283",
"text": "def initialize(*classes)\n @classes = classes\n end",
"title": ""
},
{
"docid": "2579cdbd260a31379139f0687ef84d17",
"score": "0.6156279",
"text": "def all_classes\n @classes_hash.values\n end",
"title": ""
},
{
"docid": "7ec965364796e088e1e8a9648f0563e7",
"score": "0.6156158",
"text": "def classes_and_includes_and_extends_for name\n klasses = []\n extends = []\n includes = []\n\n found = @stores.map do |store|\n begin\n klass = store.load_class name\n klasses << klass\n extends << [klass.extends, store] if klass.extends\n includes << [klass.includes, store] if klass.includes\n [store, klass]\n rescue RDoc::Store::MissingFileError\n end\n end.compact\n\n extends.reject! do |modules,| modules.empty? end\n includes.reject! do |modules,| modules.empty? end\n\n [found, klasses, includes, extends]\n end",
"title": ""
},
{
"docid": "b5f184ebc5f2ef33253ea289105c9307",
"score": "0.6146165",
"text": "def get_objects_of_class_by_class_name(class_name)\n var_array = []\n @objects.each do |_k, v|\n var_array.push(v) if v.class.to_s == class_name.to_s\n end\n var_array\n end",
"title": ""
},
{
"docid": "ce60acd053ea5bc8278e63f817fe7626",
"score": "0.6137466",
"text": "def classes()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |file|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + file )\n\t\t\t\t\tnext if ( file[/^([A-Z][A-Za-z]*)+\\.class\\.rb$/] == nil )\n\t\t\t\t\tlist << clazz( $1 )\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn list\n\t\t\tend",
"title": ""
},
{
"docid": "10e05b5e145bd51e861003cf77b550bc",
"score": "0.61354995",
"text": "def boot_classes\n classes = space.classes\n type_names.each do |name , vars|\n cl = object_with_type Parfait::Class\n cl.instance_type = @types[name]\n @types[name].object_class = cl\n @types[name].instance_methods = object_with_type Parfait::List\n cl.instance_methods = object_with_type Parfait::List\n #puts \"instance_methods is #{cl.instance_methods.class}\"\n cl.name = name\n classes[name] = cl\n end\n # superclasses other than default object\n supers = { :Object => :Kernel , :Kernel => :Value,\n :Integer => :Value , :BinaryCode => :Word }\n type_names.each do |classname , ivar|\n next if classname == :Value # has no superclass\n clazz = classes[classname]\n super_name = supers[classname] || :Object\n clazz.set_super_class_name super_name\n end\n end",
"title": ""
},
{
"docid": "320e61bb19b81ebdb3976c07450a4ba4",
"score": "0.6135075",
"text": "def include_into(*klasses)\n klasses.flatten!\n klasses.each do |klass|\n (@@class_mixins[klass] ||= []) << self\n @@class_mixins[klass].uniq!\n end\n end",
"title": ""
},
{
"docid": "58485f4f2460ba61e2d791d8fdbbed5b",
"score": "0.6134862",
"text": "def add_class class_name\n each do |el|\n next unless el.respond_to? :get_attribute\n classes = el.get_attribute('class').to_s.split(\" \")\n el.set_attribute('class', classes.push(class_name).uniq.join(\" \"))\n end\n self\n end",
"title": ""
},
{
"docid": "63efa6ea3e85ce9c9249cd27631df2bb",
"score": "0.6108674",
"text": "def creatable_classes\n #FIXME: make these discovered automatically.\n #FIXME: very bad method name\n #[Model,DataFile,Sop,Study,Assay,Investigation]\n [\"Method\",\"Survey\",\"Study\"]\n\n end",
"title": ""
},
{
"docid": "00b345fa172303abec1165721a1ad57c",
"score": "0.61082286",
"text": "def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end",
"title": ""
},
{
"docid": "b7c2a6c12a580ae7b1922bb99f1ffc49",
"score": "0.6100249",
"text": "def bootstrap_classes_for_collection coll, class_type='label'\n remaining = BOOTSTRAP_CLASSES.dup\n assignments = {}\n coll.each do |v|\n unless remaining.empty?\n assignments[v] = \"#{class_type}-#{remaining.shift}\"\n end\n end\n assignments\n end",
"title": ""
},
{
"docid": "dc6f0b44c31f9edaf0515b345c537e21",
"score": "0.60985535",
"text": "def record_class_definitions\n extant, novel = [], []\n ObjectSpace.each_object(Class) { |k| extant << k }\n yield\n ObjectSpace.each_object(Class) { |k| novel << k if !extant.include?(k) }\n novel\n end",
"title": ""
},
{
"docid": "38e78cc0a460af0b530d433d909aebaf",
"score": "0.60920876",
"text": "def each(&block)\n @class_map.each(&block);\n end",
"title": ""
},
{
"docid": "315d386205eea321beda75fa83d27ae2",
"score": "0.60632026",
"text": "def object_classes( *additional_classes )\n\t\t# self.log.debug \"Fetching object classes for %s\" % [ self.dn ]\n\t\tschema = self.directory.schema\n\n\t\toc_oids = self[:objectClass] || []\n\t\toc_oids |= additional_classes.collect {|str| str.to_sym }\n\t\toc_oids << 'top' if oc_oids.empty?\n\n\t\toclasses = []\n\t\toc_oids.each do |oid|\n\t\t\toc = schema.object_classes[ oid.to_sym ] or\n\t\t\t\traise Treequel::Error, \"schema doesn't have a %p objectClass\" % [ oid ]\n\t\t\toclasses << oc\n\t\tend\n\n\t\t# self.log.debug \" found %d objectClasses: %p\" % [ oclasses.length, oclasses.map(&:name) ]\n\t\treturn oclasses.uniq\n\tend",
"title": ""
},
{
"docid": "2aea0070e42d917973c7c5c14b6720e0",
"score": "0.60533315",
"text": "def generate_user_classes *klasses\n return [] unless healthy?\n klasses.map do |klass|\n klass.from_hash(raw)\n end\n end",
"title": ""
},
{
"docid": "aca875df0e18546b5ed82d1cbd24d631",
"score": "0.6048167",
"text": "def classes(*args)\n [node ? node.classes(*args) : [], @wrapped_classes].flatten\n end",
"title": ""
},
{
"docid": "38b0f6c45b33d9acc6e9b2f2f0571c0c",
"score": "0.6046827",
"text": "def class_choices(stats)\n cl0 = [12, 0, 0, 0, 12, \"Guerrier/Gladiateur\"]\n cl1 = [0, 0, 13, 0, 0, \"Ninja/Assassin\"]\n cl2 = [0, 0, 12, 0, 0, \"Voleur\"]\n cl3 = [0, 0, 0, 12, 0, \"Prêtre\"]\n cl4 = [0, 12, 0, 0, 0, \"Mage/Sorcier\"]\n cl5 = [12, 10, 0, 11, 9, \"Paladin\"]\n cl6 = [0, 0, 10, 10, 0, \"Ranger\"]\n cl7 = [0, 0, 11, 12, 0, \"Ménestrel\"]\n cl8 = [11, 0, 11, 0, 0, \"Pirate\"]\n cl9 = [0, 12, 0, 11, 0, \"Marchand\"]\n cl10 = [0, 0, 11, 0, 0, \"Ingénieur\"]\n cl11 = [0, 10, 0, 11, 0, \"Bourgeois/Noble\"]\n\n classes = []\n i = 0\n while binding.eval(\"defined?(cl#{i})\")\n classes += [binding.eval(\"cl#{i}\")]\n i += 1\n end\n determine_choices(stats, classes)\n end",
"title": ""
},
{
"docid": "e2b027e56d121eacba1bf28523cd3929",
"score": "0.6046684",
"text": "def get_class_lut(class_map)\n\tclass_lut = {}\n\tfor ast_class in class_map.all_classes\n\t\tclass_lut[ast_class.name] = ast_class\n\tend\n\treturn class_lut\nend",
"title": ""
},
{
"docid": "e2b027e56d121eacba1bf28523cd3929",
"score": "0.6046684",
"text": "def get_class_lut(class_map)\n\tclass_lut = {}\n\tfor ast_class in class_map.all_classes\n\t\tclass_lut[ast_class.name] = ast_class\n\tend\n\treturn class_lut\nend",
"title": ""
},
{
"docid": "e9745863130d8bd6ccbd20cc1866e4b3",
"score": "0.604246",
"text": "def classes\n @class_ids.collect { |idx| BClass.store[idx] }\n end",
"title": ""
},
{
"docid": "b088bc64855567edb6d89f6018f6c886",
"score": "0.60423917",
"text": "def all_from_class\n begin\n class_name.all\n rescue\n @errors << {message: \"Unable to find this class in the database.\", variable: \"class_name\"}\n []\n end \n end",
"title": ""
},
{
"docid": "87c254b77cfad0ea51fb5bd11f1db8b3",
"score": "0.603141",
"text": "def classes\n self\n end",
"title": ""
},
{
"docid": "e6db6aaedb7c91cdc42af2e40c82dc39",
"score": "0.60283124",
"text": "def get_classes(trans)\n classes = []\n trans.each do |t|\n classes.push(t[:program])\n end\n classes.uniq\n end",
"title": ""
},
{
"docid": "a54eba36cd41f36fc738d23d93f9a89b",
"score": "0.6026537",
"text": "def instantiate_subclasses(klass); end",
"title": ""
},
{
"docid": "0f2a1707ba07587d462671abc752686b",
"score": "0.6015929",
"text": "def test_generate_with_varied_class_entries\n forms = ['classtest.utils.MathUtil', \n 'classtest.utils.MathUtil.as', \n 'classtest/utils/MathUtil', \n 'classtest/utils/MathUtil.as'\n ]\n forms.each do |form|\n run_generator(form)\n assert_generated_class(form, @src_dir)\n remove_file(@src_dir)\n FileUtils.mkdir_p(@src_dir)\n remove_file(@test_dir)\n FileUtils.mkdir_p(@test_dir)\n end\n end",
"title": ""
},
{
"docid": "248c2faccf05cd124cfcb8262b9f2946",
"score": "0.60147256",
"text": "def list_known_classes\n end",
"title": ""
},
{
"docid": "ebff3e95ea383c9e6aaaf73d7b80fe4e",
"score": "0.60137767",
"text": "def new_classes(snapshot)\n self.classes do |klass|\n if !snapshot.include?(klass)\n klass\n end\n end\n end",
"title": ""
},
{
"docid": "6ed0c976143c6617e4ecf66c5f12a878",
"score": "0.59976286",
"text": "def classes\n kwattr_values(\"class\")\n end",
"title": ""
},
{
"docid": "c40557fdfff4e4bba69695ec5694b7fb",
"score": "0.59933805",
"text": "def resolve_upper_class\n\t$class_map.each do |keyc, valuec|\n\t\t#TODO: should change the name of \"resolve_upper_class\"\n\t\t#adjustFilters remove filter name which has :on=> properties and insert into according :on=> functions\n\t\t#valuec.adjustFilters\n\t\tif $class_map.has_key?(valuec.getUpperClass)\n\t\t\tvaluec.setUpperClassInstance($class_map[valuec.getUpperClass])\n\t\t\ttemp_upper_class = valuec.getUpperClass\n\t\t\t@class_traversed = Array.new\n\t\t\twhile $class_map[temp_upper_class] != nil\n\t\t\t\t@class_traversed.push(temp_upper_class)\n\t\t\t\t#puts \"Set parent class: #{keyc} < #{valuec.getUpperClass}\"\n\t\t\t\tparent = $class_map[temp_upper_class]\n\t\t\t\tvaluec.mergeBeforeFilter(parent)\n\t\t\t\tvaluec.mergeSave(parent)\n\t\t\t\tvaluec.mergeCreate(parent)\n\t\t\t\tvaluec.mergeAssoc(parent.getAssocs)\n\t\t\t\tvaluec.mergeClassFields(parent.getClassFields)\n\t\t\t\tif valuec.include_module == nil\n\t\t\t\t\tvaluec.include_module = parent.include_module.dup\n\t\t\t\tend\n\t\t\t\tcur_class = temp_upper_class\n\t\t\t\ttemp_upper_class = $class_map[temp_upper_class].getUpperClass\n\t\t\t\tif @class_traversed.include?(temp_upper_class)\n\t\t\t\t\t$class_map[cur_class].setUpperClass(nil)\n\t\t\t\t\t$class_map[cur_class].setUpperClassInstance(nil)\n\t\t\t\t\ttemp_upper_class = nil\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\t#create valid? function\n\t\t\tif valuec.getMethod(\"valid?\") == nil\n\t\t\t\ttemp_method = Method_class.new(\"valid?\")\n\t\t\t\tvaluec.getMethod(\"before_validation\").getCalls.each do |c|\n\t\t\t\t\ttemp_method.addCall(c)\n\t\t\t\tend\n\t\t\t\tvaluec.addMethod(temp_method)\n\t\t\tend\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "8c02a5f3cdd5c5f6049ca067043e5ef1",
"score": "0.5959137",
"text": "def loadClasses( reload = false )\n\t\t\t\tloaded = []\n\t\t\t\t\n\t\t\t\tclasses().each do |clazz|\n\t\t\t\t\tclazz.load( reload )\n\t\t\t\t\tloaded << clazz\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn loaded\n\t\t\tend",
"title": ""
},
{
"docid": "a1672ba6ab540aca4a68951c5a4c3aca",
"score": "0.5945796",
"text": "def has_class?(name)\n a = []\n \n each do |e|\n if e.get(\"className\").split(\" \").index(name)\n a << e\n end\n end\n \n JS::Collection.new(a)\n end",
"title": ""
},
{
"docid": "257d0261747b96f0bac3a7a419e0ceba",
"score": "0.5934877",
"text": "def index_classes\n debug_msg \" generating class search index\"\n\n documented = @classes.uniq.select do |klass|\n klass.document_self_or_methods\n end\n\n documented.each do |klass|\n debug_msg \" #{klass.full_name}\"\n record = klass.search_record\n @index[:searchIndex] << search_string(record.shift)\n @index[:longSearchIndex] << search_string(record.shift)\n @index[:info] << record\n end\n end",
"title": ""
},
{
"docid": "931b4491607e91830db160ca56bdaf1a",
"score": "0.592122",
"text": "def load_components_from_class(component_class)\n a = []\n entities_set_for(component_class.name).each do |entity_id|\n components_set_for(entity_id).each do |component|\n a << component if component_class == component.class\n end\n end\n a\n end",
"title": ""
},
{
"docid": "2f9532767691bdc03ba367db35b44452",
"score": "0.5918928",
"text": "def classes\n\t\traise \"classes: Not Implemented\"\n\tend",
"title": ""
},
{
"docid": "d2e396a8ce549db957db410b4047f98d",
"score": "0.59040654",
"text": "def match(klass); end",
"title": ""
},
{
"docid": "956c6c7edc7ad9530d9a2b12d8f4f902",
"score": "0.58978087",
"text": "def append_class(name); end",
"title": ""
},
{
"docid": "956c6c7edc7ad9530d9a2b12d8f4f902",
"score": "0.58978087",
"text": "def append_class(name); end",
"title": ""
},
{
"docid": "fbc3e7699d5a3bcf20331b6b3bddfbb3",
"score": "0.5891903",
"text": "def get_sorted_module_list classes\n classes.select do |klass|\n klass.display?\n end.sort\n end",
"title": ""
},
{
"docid": "d06541429d6c72e53d20974ccea7f479",
"score": "0.5885586",
"text": "def instantiate_subclasses(klass)\n klass.descendants.sort.map do |c|\n c.new(config)\n end\n end",
"title": ""
},
{
"docid": "d06541429d6c72e53d20974ccea7f479",
"score": "0.5885586",
"text": "def instantiate_subclasses(klass)\n klass.descendants.sort.map do |c|\n c.new(config)\n end\n end",
"title": ""
},
{
"docid": "71522f1c7f54664c09490eeca9ef19b4",
"score": "0.58847797",
"text": "def test_classes\n if(@fiber && @input_classes.size == 0)\n @fiber.transfer [:error, \"Could not find any classes\"]\n end\n @input_classes.each do |c|\n if @regression_file.nil?\n single_class_test(c)\n else\n double_class_test(c,@regression_file)\n end\n end\n end",
"title": ""
},
{
"docid": "b2f2ae37e51b97a6a5429c89033568a9",
"score": "0.58847654",
"text": "def sc_all_classes()\n @all_class_names = @driver.get_sc_object_class_names(abs_path) if @all_class_names.nil?\n return @all_class_names\n end",
"title": ""
},
{
"docid": "20a3724e726c1ffcc8f021fc9f44ff71",
"score": "0.5883424",
"text": "def classes\n @_classes ||= vedeu_classes - vedeu_exceptions - ignored_classes\n end",
"title": ""
},
{
"docid": "df9412d950844960d775fca6b8893f11",
"score": "0.58819854",
"text": "def unique_classes\n @unique_classes\n end",
"title": ""
},
{
"docid": "421472e84cafcf0289ed09b746260291",
"score": "0.5878866",
"text": "def trim_classes\n deletions = 1\n while deletions > 0 do\n deletions = 0\n @classes.each do |cls, value|\n next unless value.fetch(:sub_classes, {}).empty? && !value.has_key?(:examples)\n deletions += 1\n @classes.delete(cls)\n sc = value[:super_class]\n next unless sc\n puts \"trim class #{cls}, super-class #{sc}\"\n @classes[sc][:sub_classes].delete(cls) if @classes.fetch(sc, {})[:sub_classes]\n end\n end\n end",
"title": ""
},
{
"docid": "f36ba536e1152510f56edc6d87a57f07",
"score": "0.587838",
"text": "def print_classes(class_name=nil)\n\tif class_name == nil\n\t\t$class_map.each do |keyc, valuec|\n\t\t\tvaluec.print_calls\n\t\tend\t\n\telse\n\t\t$class_map[class_name].print_calls\n\tend\nend",
"title": ""
},
{
"docid": "4b9eedd204353653dca06ffffc42bc36",
"score": "0.58702445",
"text": "def list_known_classes(classes)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "f82f45226bfde6fe7e4dfb1fac958862",
"score": "0.5868857",
"text": "def process_class exp\n exp\n end",
"title": ""
},
{
"docid": "4f6fa14dbdb8e458ad1960c46ace22ed",
"score": "0.5864749",
"text": "def instantiate_subclasses(klass)\n klass.descendants.select { |c| !safe || c.safe }.tap do |result|\n result.sort!\n result.map! { |c| c.new(config) }\n end\n end",
"title": ""
},
{
"docid": "d360e1c5a16fe3e48e937333a2847f69",
"score": "0.5864034",
"text": "def get_classes( obj )\n cls = obj.class\n print cls.to_s\n while cls.superclass != nil\n cls = cls.superclass\n print ' < ' + cls.to_s\n end\nend",
"title": ""
},
{
"docid": "c2dc9238c9028d7413dfc1e9544403c8",
"score": "0.5863902",
"text": "def page_classes(page)\n classes = []\n classes << 'home' if page.home?\n classes << page.class.name.underscore.dasherize\n classes.join ' '\n end",
"title": ""
},
{
"docid": "d6ad2e9a490fc949296b331dd6d61325",
"score": "0.5854193",
"text": "def extract_rdoc_information_from_classes(classes, options, stats)\n result = []\n classes.each do |clzz|\n tp = returning_nil(File, :stat) { ::RDoc::TopLevel.new(clzz.java_class.to_s) }\n result << AnnotationParser.new(tp, clzz, options, stats).scan\n stats.num_files += 1\n end\n result\n end",
"title": ""
},
{
"docid": "ab2ec8e44e4d834959ba444ab928e735",
"score": "0.58487034",
"text": "def find_classes\n puppetClasses = []\n Dir.glob( SpkDashboard::MANIFEST_ROOT + \"/modules/**/*.pp\" ).each do |manifest|\n File.read( manifest ).each do |line|\n foundClass = line.match(/^class (\\S+).*\\{/)\n if foundClass and puppetClasses.include?( foundClass[1] ) == false\n puppetClasses << foundClass[1]\n end\n end\n end\n \n return puppetClasses\n end",
"title": ""
},
{
"docid": "a848930a3d56b2e0a3a733df8a7f217d",
"score": "0.58457285",
"text": "def generate\n classes = registry.all(:class)\n classes.each do |c|\n data = methods(c)\n output(data, c.to_s)\n end\n end",
"title": ""
},
{
"docid": "fa9d3442feca1eb5d32bbae42423897e",
"score": "0.5845558",
"text": "def classes_for_day(day)\n days_classes = Tableau::ClassArray.new\n @classes.each { |c| days_classes << c if c.day == day }\n days_classes.count > 0 ? days_classes : nil\n end",
"title": ""
},
{
"docid": "614b344f24cac34968a8c4fa7b21cf3d",
"score": "0.58442426",
"text": "def populate_queue\n Test.classes.flat_map do |klass, line_numbers|\n list = klass.test_list\n\n unless line_numbers.empty?\n list.select! do |method_name|\n line_numbers.include?(klass.instance_method(method_name).source_location.last.to_s)\n end\n end\n\n list.map! { |method| [klass, method] }.shuffle!\n end\n end",
"title": ""
},
{
"docid": "1a7941d2790299640981e518a1c79a96",
"score": "0.5842236",
"text": "def update_class(aclass, adbclass)\n #I honestly don't know why I did it this way. It isn't very DRY. There must be a reason, so tinker with caution.\n begin\n lastcreated = adbclass.find(:first, :order => 'created_date desc')\n lastmodified = adbclass.find(:first, :order => 'last_modified_date desc')\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'createddate > ' + (lastcreated.created_date - 18000).to_s(:iso_8601_special))\n scrape(aobj, aclass, adbclass)\n end\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'lastmodifieddate > ' + (lastmodified.last_modified_date - 18000).to_s(:iso_8601_special))\n adbclass.delete(aobj.id)\n scrape(aobj, aclass, adbclass)\n end\n rescue\n begin\n lastcreated = adbclass.find(:first, :order => 'created_date desc')\n lastmodified = adbclass.find(:first, :order => 'last_modified_date desc')\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'created_date > ' + (lastcreated.created_date - 18000).to_s(:iso_8601_special))\n scrape(aobj, aclass, adbclass)\n end\n for aobj in aclass.find(:all, :limit => 0, :conditions => 'last_modified_date > ' + (lastmodified.last_modified_date - 18000).to_s(:iso_8601_special))\n adbclass.delete(aobj.id)\n scrape(aobj, aclass, adbclass)\n end\n rescue\n puts \"Skipping \" + aclass.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "bf17e7d5255c2bf579d88ab66efa78df",
"score": "0.5840499",
"text": "def matchMethodsInClasses(classList, type, mname)\n res = []\n \n for cname in classList\n cl = findClass(cname)\n res.concat cl.findMethods(mname, type == \"::\")\n# meths.each {|m| res << \"#{cname}#{m.type=='class'?'::':'#'}#{m.name}\" }\n end\n\n return res\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(res)\n end\n end",
"title": ""
},
{
"docid": "4c70376c0bf9ca83af2b690e396cf648",
"score": "0.5832948",
"text": "def emit_page_classes\n @page_classes ||= default_page_classes\n @page_classes.flatten!\n @page_classes.compact_blank!\n @page_classes.map! { |c| c.to_s.gsub(/[^a-z_0-9-]/i, '_') }\n @page_classes.uniq!\n @page_classes.join(' ')\n end",
"title": ""
},
{
"docid": "b8a2beb2ca1424bcae789af855e38ae6",
"score": "0.5831484",
"text": "def classes\n return @classes if @classes\n @classes = @context.classes.sort.find_all{|c| c.document_self}.collect{|c| R2Doc.all_references[c.full_name]}\n end",
"title": ""
},
{
"docid": "e028e2fe4a776a589c7d596bd8b7e5ac",
"score": "0.58288974",
"text": "def all_occurrances_of(klass, array)\n array.each do |instance|\n if !instance.instance_of?(klass)\n return false\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "d76c61b0d27bc673c8113c1b4909a64f",
"score": "0.5823101",
"text": "def add_classes(*args)\n args.each {|x| self.add_class(x) }\n return self\n end",
"title": ""
},
{
"docid": "641b71e12ee8776750e1fc01fe94126d",
"score": "0.58143574",
"text": "def add_class c\n each do |q|\n str = q.get_attribute(\"class\")\n\n if str.empty?\n str = c.to_s\n else\n str = str+\" #{c}\"\n end\n \n q.set_attribute(\"class\",str)\n end\n end",
"title": ""
},
{
"docid": "5b36b404ddc537dc41c0b5106fc269eb",
"score": "0.58110386",
"text": "def class_names\n return if @class_names.empty?\n @class_names.uniq.sort\n end",
"title": ""
},
{
"docid": "e744bed52733701bedb8600fd81dbbe3",
"score": "0.5804322",
"text": "def class_elements(*element_names)\n options = element_names.extract_options!\n\n patterned_elements \".%{element_name}\", *element_names, options.slice(:element_array)\n end",
"title": ""
},
{
"docid": "462e676e94dae18e61612099dd853edc",
"score": "0.57987595",
"text": "def makena_classes_u\n passsingles = makena_classes.map{|a| a.to_s.underscore}\n passsingles - makena_classes_doubled\n end",
"title": ""
},
{
"docid": "5d6dde1036d02f376e3d844507d64aba",
"score": "0.57919824",
"text": "def class_for_json_class(json_class)\n case json_class\n when MEGAM_ERROR\n Megam::Error\n when MEGAM_ACCOUNT\n Megam::Account\n when MEGAM_ACCOUNTCOLLECTION\n Megam::AccountCollection\n when MEGAM_ASSEMBLIES\n Megam::Assemblies\n when MEGAM_ASSEMBLIESCOLLECTION\n Megam::AssembliesCollection\n when MEGAM_ASSEMBLY\n Megam::Assembly\n when MEGAM_ASSEMBLYCOLLECTION\n Megam::AssemblyCollection\n when MEGAM_COMPONENTS\n Megam::Components\n when MEGAM_COMPONENTSCOLLECTION\n Megam::ComponentsCollection\n when MEGAM_REQUEST\n Megam::Request\n when MEGAM_REQUESTCOLLECTION\n Megam::RequestCollection\n when MEGAM_SSHKEY\n Megam::SshKey\n when MEGAM_SSHKEYCOLLECTION\n Megam::SshKeyCollection\n when MEGAM_EVENTSVM\n Megam::EventsVm\n when MEGAM_EVENTSVMCOLLECTION\n Megam::EventsVmCollection\n when MEGAM_EVENTSMARKETPLACE\n Megam::EventsMarketplace\n when MEGAM_EventsMarketplaceCollection\n Megam::EventsMarketplaceCollection\n when MEGAM_LICENSE\n Megam::License\n when MEGAM_LICENSECOLLECTION\n Megam::LicenseCollection\n when MEGAM_FLAVORS\n Megam::Flavors\n when MEGAM_FLAVORSCOLLECTION\n Megam::FlavorsCollection\n when MEGAM_EVENTSALL\n Megam::EventsAll\n when MEGAM_EVENTSALLCOLLECTION\n Megam::EventsAllCollection\n when MEGAM_EVENTSCONTAINER\n Megam::EventsContainer\n when MEGAM_EVENTSCONTAINERCOLLECTION\n Megam::EventsContainerCollection\n when MEGAM_EVENTSBILLING\n Megam::EventsBilling\n when MEGAM_EVENTSBILLINGCOLLECTION\n Megam::EventsBillingCollection\n when MEGAM_EVENTSSTORAGE\n Megam::EventsStorage\n when MEGAM_EVENTSSTORAGECOLLECTION\n Megam::EventsStorageCollection\n when MEGAM_MARKETPLACE\n Megam::MarketPlace\n when MEGAM_MARKETPLACECOLLECTION\n Megam::MarketPlaceCollection\n when MEGAM_ORGANIZATION\n Megam::Organizations\n when MEGAM_ORGANIZATIONSCOLLECTION\n Megam::OrganizationsCollection\n when MEGAM_DOMAIN\n Megam::Domains\n when MEGAM_DOMAINCOLLECTION\n Megam::DomainsCollection\n when MEGAM_SENSORS\n Megam::Sensors\n when MEGAM_SENSORSCOLLECTION\n Megam::SensorsCollection\n when MEGAM_SNAPSHOTS\n Megam::Snapshots\n when MEGAM_SNAPSHOTSCOLLECTION\n Megam::SnapshotsCollection\n when MEGAM_BACKUPS\n Megam::Backups\n when MEGAM_BACKUPSCOLLECTION\n Megam::BackupsCollection\n when MEGAM_BALANCES\n Megam::Balances\n when MEGAM_BALANCESCOLLECTION\n Megam::BalancesCollection\n when MEGAM_CREDITS\n Megam::Credits\n when MEGAM_CREDITSCOLLECTION\n Megam::CreditsCollection\n when MEGAM_BILLEDHISTORIES\n Megam::Billedhistories\n when MEGAM_BILLEDHISTORIESCOLLECTION\n Megam::BilledhistoriesCollection\n when MEGAM_BILLINGTRANSACTIONS\n Megam::Billingtransactions\n when MEGAM_BILLINGTRANSACTIONSCOLLECTION\n Megam::BillingtransactionsCollection\n when MEGAM_SUBSCRIPTIONS\n Megam::Subscriptions\n when MEGAM_SUBSCRIPTIONSCOLLECTION\n Megam::SubscriptionsCollection\n when MEGAM_DISKS\n Megam::Disks\n when MEGAM_DISKSCOLLECTION\n Megam::DisksCollection\n when MEGAM_ADDONS\n Megam::Addons\n when MEGAM_ADDONSCOLLECTION\n Megam::AddonsCollection\n when MEGAM_REPORTS\n Megam::Reports\n when MEGAM_REPORTSCOLLECTION\n Megam::ReportsCollection\n when MEGAM_QUOTAS\n Megam::Quotas\n when MEGAM_QUOTASCOLLECTION\n Megam::QuotasCollection\n when MEGAM_RAWIMAGES\n Megam::Rawimages\n when MEGAM_RAWIMAGESCOLLECTION\n Megam::RawimagesCollection\n when MEGAM_PROMOS\n Megam::Promos\n else\n fail JSON::ParserError, \"Unsupported `json_class` type '#{json_class}'\"\n end\n end",
"title": ""
},
{
"docid": "0846ec5f4658750a388245dd2ea54465",
"score": "0.57860243",
"text": "def create_classes\n bpmn_xml.class_names_with_same_bpmn_id_as_topic.each do |class_name|\n template 'bpmn_class.rb.template',\n File.join(model_path, module_name.underscore, \"#{class_name.underscore}.rb\"), class_name: class_name\n end\n end",
"title": ""
},
{
"docid": "ef3cc527a2891da5aa757c44c772e2f8",
"score": "0.5777718",
"text": "def classnames_to_check(object)\n names = []\n clazz = object.getClass\n while clazz\n names << clazz.getName\n clazz.getInterfaces.each {|i| names << i.getName}\n clazz = clazz.getSuperclass\n end\n \n names.uniq\n end",
"title": ""
},
{
"docid": "9a3754bc93fa2631a829745afc5be836",
"score": "0.57710093",
"text": "def generate_core_classes(params)\n %w(android.view.View.OnClickListener android.widget.AdapterView.OnItemClickListener).each do |i|\n name = i.split(\".\")[-1]\n if(params[:class] == name or params[:class] == \"all\")\n generate_subclass_or_interface({:package => \"org.ruboto.callbacks\", :class => i, :name => \"Ruboto#{name}\"})\n end\n end\n\n hash = {:package => \"org.ruboto\"}\n %w(method_base method_include implements force).inject(hash) {|h, i| h[i.to_sym] = params[i.to_sym]; h}\n hash[:method_exclude] = params[:method_exclude].split(\",\").push(\"onCreate\").push(\"onReceive\").join(\",\")\n\n %w(android.app.Activity android.app.Service android.content.BroadcastReceiver android.view.View).each do |i|\n name = i.split(\".\")[-1]\n if(params[:class] == name or params[:class] == \"all\")\n generate_subclass_or_interface(\n hash.merge({:template => name == \"View\" ? \"InheritingClass\" : \"Ruboto#{name}\", :class => i, :name => \"Ruboto#{name}\"}))\n end\n end\n \n # Activities that can be created, but only directly (i.e., not included in all)\n %w(android.preference.PreferenceActivity android.app.TabActivity).each do |i|\n name = i.split(\".\")[-1]\n if params[:class] == name\n generate_subclass_or_interface(hash.merge({:template => \"RubotoActivity\", :class => i, :name => \"Ruboto#{name}\"}))\n end\n end\nend",
"title": ""
},
{
"docid": "209a93c4e3bf8b97825881bd31e23cb7",
"score": "0.57434446",
"text": "def all_classes(noun)\n classes = []\n c = noun\n while(c != :not_defined)\n classes.push(c)\n break if c == :noun\n c = what_is?(c)\n end\n return classes\n end",
"title": ""
},
{
"docid": "936fe5f1e35debf4a45a629c9f9cd066",
"score": "0.5742367",
"text": "def has_any? klass\n not find_all(\"class\", klass).empty?\n end",
"title": ""
},
{
"docid": "20b0906abff8406111dc0ee21ff6bad5",
"score": "0.57245415",
"text": "def use_with_class_names\n (\n DynamicModel.model_names +\n ExternalIdentifier.model_names +\n ActivityLog.model_names +\n Master::PrimaryAssociations\n )\n .map { |m| m.to_s.singularize }\n .select { |m| m != 'master' }\n end",
"title": ""
},
{
"docid": "421f7bc4496d0c870f8d6072b4fadd30",
"score": "0.57240343",
"text": "def list_by_class(uuid_list, klass)\n PBXObjectList.new(klass, @project) do |list|\n list.let(:uuid_scope) do\n # TODO why does this not work? should be more efficient.\n #uuid_list.select do |uuid|\n #@project.objects_hash[uuid]['isa'] == klass.isa\n #end\n uuid_list.map { |uuid| @project.objects[uuid] }.select { |o| o.is_a?(klass) }.map(&:uuid)\n end\n list.let(:push) do |new_object|\n # Add the uuid of a newly created object to the uuids list\n uuid_list << new_object.uuid\n end\n yield list if block_given?\n end\n end",
"title": ""
}
] |
6ae2c0481f526a29627b9ce6b17f0965
|
Gets a gravatar for a given email gravatar_default: If a gravatar is used, but no image is found several defaults are available. Leaving this value nil will result in the 'default_image' being used. Other wise one of the following can be set: identicon, monsterid, wavatar, 404 size: Size in pixels for the gravatar. Can be from 1 to 512. rating: Default gravatar rating g, pg, r, x.
|
[
{
"docid": "ca5079e1bb2a1649d596344024e20f2c",
"score": "0.819764",
"text": "def gravatar(email, gravatar_default, size = 40, rating = 'g')\n hash = MD5::md5(email)\n image_url = \"http://www.gravatar.com/avatar/#{hash}\"\n image_url << \"?d=#{CGI::escape(gravatar_default)}\"\n image_url << \"&s=#{size}\"\n image_url << \"&r=#{rating}\"\n end",
"title": ""
}
] |
[
{
"docid": "2455e63dac7e8cc75b566c72bab6b9d1",
"score": "0.7707364",
"text": "def gravatar(email, options = {})\n options[:size] ||= 35\n options[:default] ||= 'identicon'\n options[:rating] ||= 'PG'\n options[:class] ||= 'gravatar'\n options[:secure] ||= request.ssl?\n host = (options[:secure] ? 'https://secure.gravatar.com' : 'http://gravatar.com')\n path = \"/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email.to_s.downcase)}&rating=#{options[:rating]}&size=#{options[:size] * 2}&d=#{options[:default]}\"\n image_tag([host,path].join, :class => options[:class], :width => options[:size], :height => options[:size])\n end",
"title": ""
},
{
"docid": "8f312f04d86967eae51fe0006ba1f8d6",
"score": "0.7402763",
"text": "def gravatar_for(model, args = {})\n args = {:class => 'gravatar', :gravatar => {:default => default_avatar_url}}.merge(args)\n gravatar_image_tag(model.email, args)\n end",
"title": ""
},
{
"docid": "a7154db54c4b0f0e48343e095db441f7",
"score": "0.7330922",
"text": "def gravatar_url(email, options={})\n email_hash = Digest::MD5.hexdigest(email)\n options = DEFAULT_GRAVATAR_OPTIONS.merge(options)\n options[:default] = CGI::escape(options[:default]) unless options[:default].nil?\n gravatar_api_url(email_hash, options.delete(:ssl)).tap do |url|\n opts = []\n [:rating, :size, :default].each do |opt|\n unless options[opt].nil?\n value = h(options[opt])\n opts << [opt, value].join('=')\n end\n end\n url << \"?#{opts.join('&')}\" unless opts.empty?\n end\n end",
"title": ""
},
{
"docid": "bd357a0a17da60d59b9c0a42985498a2",
"score": "0.73100185",
"text": "def gravatar(email, options={})\n src = h(gravatar_url(email, options))\n options = DEFAULT_GRAVATAR_OPTIONS.merge(options)\n [:class, :alt, :size, :title].each { |opt| options[opt] = h(options[opt]) }\n tabindex = (options.has_key?(:tabindex) ? \"tabidex=#{options[:tabindex]}\" : \"\")\n \"<img class=\\\"#{options[:class]}\\\" title=\\\"#{options[:title]}\\\" alt=\\\"#{options[:alt]}\\\" width=\\\"#{options[:size]}\\\" height=\\\"#{options[:size]}\\\" src=\\\"#{src}\\\" #{tabindex} />\"\n end",
"title": ""
},
{
"docid": "90d9ce47c5444dfbca3258116e89e76c",
"score": "0.7287301",
"text": "def gravatar\n if self.avatar_file_name.nil?\n mail = email || \"#{provider}_#{uid}\"\n hash = Digest::MD5.hexdigest(mail)\n \"http://www.gravatar.com/avatar/#{hash}?d=identicon\"\n else\n self.avatar \n end \n end",
"title": ""
},
{
"docid": "f7efedc65ce6e8bfe7ce3803dbe8af95",
"score": "0.72680396",
"text": "def gravatar\n mail = email || \"#{provider}_#{uid}\"\n hash = Digest::MD5.hexdigest(mail)\n \"http://www.gravatar.com/avatar/#{hash}?d=identicon\"\n end",
"title": ""
},
{
"docid": "cf56a820a2b93caf59b4b09c011f3c85",
"score": "0.72654414",
"text": "def gravatar(email, options={})\n src = h(gravatar_url(email, options))\n options = DEFAULT_OPTIONS.merge(options)\n [:class, :alt, :size].each { |opt| options[opt] = h(options[opt]) }\n \"<img class=\\\"#{options[:class]}\\\" alt=\\\"#{options[:alt]}\\\" width=\\\"#{options[:size]}\\\" height=\\\"#{options[:size]}\\\" src=\\\"#{src}\\\" />\" \n end",
"title": ""
},
{
"docid": "ee105013cbd1d888e1aabc6e4a4aac9c",
"score": "0.7252235",
"text": "def gravatar_tag(email, options = {})\n opts = {}\n opts[:gravatar_id] = Digest::MD5.hexdigest(email.strip)\n opts[:default] = CGI.escape(options[:default]) if options.include?(:default)\n opts[:size] = options[:size] || 48\n klass = options[:class] || \"avatar gravatar\"\n\n url = +\"https://www.gravatar.com/avatar.php?\"\n url << opts.map { |key, value| \"#{key}=#{value}\" }.sort.join(\"&\")\n tag.img(src: url, class: klass, alt: \"Gravatar\")\n end",
"title": ""
},
{
"docid": "f956fecfa4e0293b11c11e78a5f545fb",
"score": "0.7226326",
"text": "def gravatar(email, gravatar_options={})\r\n\r\n # Set the img alt text.\r\n alt_text = 'Gravatar'\r\n\r\n # Sets the image sixe based on the gravatar_options.\r\n img_size = gravatar_options.include?(:size) ? gravatar_options[:size] : '80'\r\n\r\n \"<img src=\\\"#{gravatar_url(email, gravatar_options)}\\\" alt=\\\"#{alt_text}\\\" height=\\\"#{img_size}\\\" width=\\\"#{img_size}\\\" />\"\r\n end",
"title": ""
},
{
"docid": "5ee073b86444b0ae8b9389d2020049bb",
"score": "0.72183543",
"text": "def gravatar_for(email)\n gravatar_id = Digest::MD5::hexdigest(email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: \"Gravatar\", class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "7a70d7ec12b16b5dcacf5caec610e920",
"score": "0.7199338",
"text": "def gravatar_url(email, options={})\n email_hash = Digest::MD5.hexdigest(email)\n options = DEFAULT_OPTIONS.merge(options)\n options[:default] = CGI::escape(options[:default]) unless options[:default].nil?\n returning \"http://www.gravatar.com/avatar.php?gravatar_id=#{email_hash}\" do |url| \n [:rating, :size, :default].each do |opt|\n unless options[opt].nil?\n value = h(options[opt])\n url << \"&#{opt}=#{value}\" \n end\n end\n end\n end",
"title": ""
},
{
"docid": "e6525966bf81c2ed4aef02d6c41c2160",
"score": "0.71876884",
"text": "def gravatar(email)\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}.jpg?s=40\"\n end",
"title": ""
},
{
"docid": "254d35353ac1375bcbd5baad2e16bc09",
"score": "0.71282595",
"text": "def gravatar_url(email, options={})\n email_hash = Digest::MD5.hexdigest(email)\n options = DEFAULT_OPTIONS.merge(options)\n options[:default] = CGI::escape(options[:default]) unless options[:default].nil?\n gravatar_api_url(email_hash, options.delete(:ssl)).tap do |url|\n opts = []\n [:rating, :size, :default].each do |opt|\n unless options[opt].nil?\n value = h(options[opt])\n opts << [opt, value].join('=')\n end\n end\n url << \"?#{opts.join('&')}\" unless opts.empty?\n end\nend",
"title": ""
},
{
"docid": "b47f49327633a74475a218126a1363a7",
"score": "0.71147776",
"text": "def gravatar_image_url(email = nil, size = nil)\n url = '//www.gravatar.com/avatar/'\n url += if email\n Digest::MD5.hexdigest(email)\n else\n '0' * 32\n end\n size ? \"#{url}?size=#{size}\" : url\n end",
"title": ""
},
{
"docid": "93ce8cbf050ea32246d98a38e3e29f3e",
"score": "0.6999635",
"text": "def gravatar(email,gravatar_options={})\n\n # Set the img alt text.\n alt_text = 'Gravatar'\n\n # Sets the image sixe based on the gravatar_options.\n img_size = gravatar_options.include?(:size) ? gravatar_options[:size] : '80'\n\n \"<img src=\\\"#{gravatar_url(email, gravatar_options)}\\\" alt=\\\"#{alt_text}\\\" height=\\\"#{img_size}\\\" width=\\\"#{img_size}\\\" />\"\n\n end",
"title": ""
},
{
"docid": "02a03dd9dbbad4e5f812d07f78b89cb8",
"score": "0.6978539",
"text": "def avatar_url\n return image_url if image_url\n return DEFAULT_AVATAR if email.nil?\n\n gravatar_url\n end",
"title": ""
},
{
"docid": "a8f1c6f6abcd4d4b38d6dd1362fd0667",
"score": "0.69257826",
"text": "def gravatar\n gravatar_id = Digest::MD5::hexdigest(email).downcase \n \"http://gravatar.com/avatar/#{gravatar_id}.png\" \n end",
"title": ""
},
{
"docid": "0e0ba6dff37f65e35eebe43da8d647fb",
"score": "0.691699",
"text": "def gravatar(type)\n\t\tgravatar_id = Digest::MD5.hexdigest(email.to_s.downcase)\n\t\tforce = type == :mm ? \"\" : \"&f=y\"\n\t\t\"https://gravatar.com/avatar/#{gravatar_id}.png?s=128&d=#{type}#{force}\"\n\tend",
"title": ""
},
{
"docid": "3ea9bcf89826de3a3ba61ad75e6d5752",
"score": "0.6913873",
"text": "def gravatar_url(email,gravatar_options={})\n grav_url = 'http://www.gravatar.com/avatar.php?'\n grav_url << \"gravatar_id=#{Digest::MD5.new.update(email)}\"\n grav_url << \"&rating=#{gravatar_options[:rating]}\" if gravatar_options[:rating]\n grav_url << \"&size=#{gravatar_options[:size]}\" if gravatar_options[:size]\n grav_url << \"&default=#{gravatar_options[:default]}\" if gravatar_options[:default]\n end",
"title": ""
},
{
"docid": "cf370b133c46cd300c2ad80de1e87011",
"score": "0.6889074",
"text": "def avatar(user, options = { })\r\n if Setting.gravatar_enabled?\r\n email = nil\r\n if user.respond_to?(:mail)\r\n email = user.mail\r\n elsif user.to_s =~ %r{<(.+?)>}\r\n email = $1\r\n end\r\n return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil\r\n end\r\n end",
"title": ""
},
{
"docid": "6a97184870b7a90c83436cd119d5c476",
"score": "0.6882115",
"text": "def gravatar_url(email, size = 140)\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "88a1acb79fda2022b5d593ef875a083a",
"score": "0.68752015",
"text": "def gravatar(options={})\n configuration = gravatar_options\n\n configuration.update(options) if options.is_a? Hash\n if configuration[:default] =~ /^(https?:\\/\\/|\\/)/i \n configuration[:default] = CGI::escape(configuration[:default]) \n end\n \n url = configuration.delete(:ssl) == true ? SECURE_AVATAR_URL : AVATAR_URL\n \n email = \"#{self.send(configuration[:attr])}\".downcase\n id = Digest::MD5.hexdigest(email)\n params = configuration.collect{ |k, v| \"#{k}=#{v}\" }.join('&')\n \"#{url}/#{id}?#{params}\"\n end",
"title": ""
},
{
"docid": "fd2e8316f9439a338c1108f3382a05bc",
"score": "0.68619835",
"text": "def gravatar_url(size = 500)\n email_temp = (email || 'nonexistentuser@example.com').downcase\n gravatar_id = Digest::MD5::hexdigest(email_temp)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}&d=mm\"\n end",
"title": ""
},
{
"docid": "524dc3342ca0cc4d62132083441d67d2",
"score": "0.6845468",
"text": "def gravatar_for(user)\n if user.email\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=48&d=mm\"\n else\n gravatar_url = \"https://secure.gravatar.com/avatar/0000000000?s=48&d=mm\"\n end\n image_tag(gravatar_url, alt: user.name, class: \"csw-avatar\")\n end",
"title": ""
},
{
"docid": "acb3fb0026a63693cf56bcf87c482c4f",
"score": "0.6833919",
"text": "def gravatar_url(email)\n \"https://secure.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}?s=40\"\n end",
"title": ""
},
{
"docid": "54047d78f3b6f022be0972c002b6187b",
"score": "0.68155915",
"text": "def gravatar_for(user, small=false)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase) \n default_pic = CGI.escape(root_url + \"/emmi200x200.jpg\")\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?d=#{default_pic}\"\n # <img src=\"http://www.gravatar.com/avatar/00000000000000000000000000000000?d=http%3A%2F%2Fexample.com%2Fimages%2Favatar.jpg\" />\n if (small)\n image_tag(gravatar_url + \"&s=32\", alt: user.name, size: \"32x32\", class: \"gravatar\")\n else\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end \n end",
"title": ""
},
{
"docid": "707d01d8e3851f3a116d6b26fc977f03",
"score": "0.6801992",
"text": "def gravatar_path\n \"/avatar/#{Digest::MD5.hexdigest(email)}?s=48&r=r&d=#{ENCODED_DEFAULT_AVATAR}\"\n end",
"title": ""
},
{
"docid": "3947adc7c8ac9c0ef826a101bbfbead1",
"score": "0.6796482",
"text": "def gravatar_for(user, size)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "bee26dd58830be7ab5b55f7f8ef9f0fc",
"score": "0.67836004",
"text": "def gravatar email, *options\n\temail_md5 = Digest::MD5.hexdigest email\n\tunless options.empty?\n\t\tparams = Addressable::URI.new\n\t\tparams.query_values = options.first\n\t\tparams_query = \"?#{params.query}\"\n\tend\n\t\"http://www.gravatar.com/avatar/#{email_md5}#{params_query}\"\nend",
"title": ""
},
{
"docid": "cca57c274638950539cac42523d617fc",
"score": "0.67583776",
"text": "def gravatar_for(user, options = {size:50})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.firstname, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "043672eedeaa534aa4f0c9a5d6d7ce2d",
"score": "0.6755346",
"text": "def gravatar_url\n require 'digest/md5'\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email.downcase)}\"\n end",
"title": ""
},
{
"docid": "ecc2658cfacb30157827b7be8bebd7ac",
"score": "0.672424",
"text": "def gravatar_url(options = { rating: 'g'})\n opts = options.collect {|key, value| \"#{key}=#{value}\"}.join('&')\n \"https://secure.gravatar.com/avatar/#{self.gravatar_id}.png?#{opts}\"\n end",
"title": ""
},
{
"docid": "48b978090f5dc61975962a5ff219c962",
"score": "0.6717331",
"text": "def gravatar_url(size=48)\n gravatar_id = Digest::MD5.hexdigest(email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "7c3ff6753fa47f9675a9ccc10a008505",
"score": "0.669348",
"text": "def gravatar(email,gravatar_options={})\n\n # Set the img alt text.\n alt_text = 'Gravatar'\n\n # Sets the image sixe based on the gravatar_options.\n img_size = gravatar_options.include?(:size) ? gravatar_options[:size] : '80'\n\n \"<img src=\\\"#{gravatar_url(email, gravatar_options)}\\\" alt=\\\"#{alt_text}\\\" height=\\\"#{img_size}\\\" width=\\\"#{img_size}\\\" />\" \n\nend",
"title": ""
},
{
"docid": "24f173de763e228bc0e97d0254aae9ca",
"score": "0.6658816",
"text": "def gravatar_for(user, options = { :size => 50 })\n gravatar_image_tag(\"james.jpg\", :alt => user.firstname,\n :class => 'gravatar',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "03097fd1aa57cff0e043156784dd7022",
"score": "0.6649255",
"text": "def gravatar_image(email, size=50, opts={})\n hash = Digest::MD5.hexdigest(email)\n url = \"http://www.gravatar.com/avatar/#{hash}?s=#{size}\"\n image_tag url, {:class => :gravatar}.merge(opts)\n end",
"title": ""
},
{
"docid": "af1c4b86d8715d36e02303721ac18bd1",
"score": "0.66252446",
"text": "def gravatar_url\n return @gravatar_url if @gravatar_url\n\n md5 = Digest::MD5.hexdigest((author_email || author).to_s.downcase)\n default = CGI.escape(Config.theme.gravatar.default)\n rating = Config.theme.gravatar.rating\n size = Config.theme.gravatar.size\n\n @gravatar_url = \"http://www.gravatar.com/avatar/#{md5}.jpg?d=#{default}&r=#{rating}&s=#{size}\"\n end",
"title": ""
},
{
"docid": "f9413460958ad69ec9159c705f585419",
"score": "0.6622457",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?size=225\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "8559754c5c62e8a3e4a0533a41c2ab8e",
"score": "0.66166764",
"text": "def gravatar_url\n hash = Digest::MD5.hexdigest(self.email)\n\n image_src = \"//www.gravatar.com/avatar/#{hash}?d=identicon\"\n end",
"title": ""
},
{
"docid": "8ab0a08345ae6394e0a4f8d35041d098",
"score": "0.66064566",
"text": "def gravatar_for(user)\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.name, class: 'gravatar')\n end",
"title": ""
},
{
"docid": "dd2fac767c3b1ea799e40940eaf55b46",
"score": "0.6604545",
"text": "def gravatar_for(user, options = { :size => 75 })\n gravatar_image_tag(user.email.strip, :alt => h(user.name),\n :class => 'gravatar round',\n :gravatar => options)\n end",
"title": ""
},
{
"docid": "94c68a515b7044dfcb3bfb25f1547bf9",
"score": "0.6598398",
"text": "def gravatar_for(user, size = nil, options={} )\n gravatar_id = Digest::MD5::hexdigest(user.email.chomp.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?d=retro\"\n gravatar_url += \"&size=#{size}\" unless size.nil?\n\n options = { alt: user.nickname, class: \"gravatar\" }.merge options\n options[:height] = size unless size.nil?\n options[:width] = size unless size.nil?\n\n image_tag( gravatar_url, options )\n end",
"title": ""
},
{
"docid": "4b260e982ebfb3b3b33c6773b568ddbf",
"score": "0.6565394",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: current_user.email + \" gravatar\", width: 130, height: 80, \n class: \"img-responsive img-rounded\")\n end",
"title": ""
},
{
"docid": "4b260e982ebfb3b3b33c6773b568ddbf",
"score": "0.6565394",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: current_user.email + \" gravatar\", width: 130, height: 80, \n class: \"img-responsive img-rounded\")\n end",
"title": ""
},
{
"docid": "fd67e0605394fcf55de670da6777b80a",
"score": "0.65589315",
"text": "def gravatar_url\n # to remove white spaces from email\n stripped_email = email.strip\n downcased_email = stripped_email.downcase\n hash = Digest::MD5.hexdigest(downcased_email)\n \"http://gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "09fbe84d7116a2f452e14e9803ad0407",
"score": "0.65569425",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "a87f9f952392a5889ebcc2c3f34f2b81",
"score": "0.6556763",
"text": "def gravatar_for(user, options = { size: 50})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\nend",
"title": ""
},
{
"docid": "07c933159773d570fde862b2580efd48",
"score": "0.65428895",
"text": "def gravatar_url\n stripped_email = email.strip\n downcased_email = stripped_email.downcase\n hash = Digest::MD5.hexdigest(downcased_email)\n \n \"http://gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "9f09102571825cebdd2d9c56532e900b",
"score": "0.6525072",
"text": "def gravatar_for(user, size: 80)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "7b1631cfd849c1e73ce7794efb871824",
"score": "0.6497169",
"text": "def gravatar_image_url(size_in_pixels=32)\n email_hash = Digest::MD5.hexdigest(email.strip.downcase)\n \"https://secure.gravatar.com/avatar/#{ email_hash }?s=#{ size_in_pixels.to_i }&d=retro\"\n end",
"title": ""
},
{
"docid": "586b32976e09416910255fe47802387f",
"score": "0.6493671",
"text": "def gravatar_for(user, options = { size: Settings.helper.size })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "db0a947d2953fa5bc501e0840c0a77b5",
"score": "0.649084",
"text": "def gravatar_for(user, options)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n options[:style] == :thumb ? size = 50 : size = 200 \n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar img-rounded\")\n end",
"title": ""
},
{
"docid": "4b2d3377e7bfa7ac9fbb37233730dc80",
"score": "0.647842",
"text": "def gravatar_for(user, size)\n\t \tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t \tgravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n\t image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "b007bc6b9d4fb55dc5ab9c0ec490c87a",
"score": "0.6462002",
"text": "def gravatar_for user,options = {:size=>40}\n if options[:class].blank?\n cclass = \"img-circle\"\n else\n cclass = options[:class]\n end\n gravatar_image_tag user.email.downcase,\n :class=>cclass,\n :alt=>user.name.capitalize,\n :gravatar=>options,\n :style => options[:style] unless options[:style].blank?\n end",
"title": ""
},
{
"docid": "21f7789f4963da36dcb44b666ac31700",
"score": "0.6457796",
"text": "def gravatar_for(user, options = {size: 80})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "18d29c463bfcf3a64779c98bdd72cad1",
"score": "0.64533556",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.first_name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "61eed1e680167a1191a13c698f83caca",
"score": "0.64526665",
"text": "def gravatar_img_src\n # Não usa facebook\n if self.uid.nil?\n # include MD5 gem, should be part of standard ruby install\n require 'digest/md5'\n # create the md5 hash\n hash = Digest::MD5.hexdigest(self.email.downcase)\n # compile URL which can be used in <img src=\"RIGHT_HERE\"...\n self.image = \"http://www.gravatar.com/avatar/#{hash}\"\n end\n end",
"title": ""
},
{
"docid": "4b37e0b3439e03a54ab372d0a02ed074",
"score": "0.6449406",
"text": "def avatar(user, options = { })\n if Setting.gravatar_enabled?\n options.merge!(:default => Setting.gravatar_default)\n options[:class] = GravatarHelper::DEFAULT_OPTIONS[:class] + \" \" + options[:class] if options[:class]\n email = nil\n if user.respond_to?(:mail)\n email = user.mail\n options[:title] = user.name unless options[:title]\n elsif user.to_s =~ %r{<(.+?)>}\n email = $1\n end\n if email.present?\n gravatar(email.to_s.downcase, options) rescue nil\n elsif user.is_a?(AnonymousUser)\n anonymous_avatar(options)\n elsif user.is_a?(Group)\n group_avatar(options)\n else\n nil\n end\n else\n ''\n end\n end",
"title": ""
},
{
"docid": "aa72072080ba97723a42b6d1a4fe992d",
"score": "0.6444856",
"text": "def gravatar_for(user, options = {size: 80})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.username, class: \"img-circle gravatar\")\n end",
"title": ""
},
{
"docid": "1c31b9d474b4fcd871b5498a3ef72e88",
"score": "0.64332414",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.full_name, class: 'gravatar')\n end",
"title": ""
},
{
"docid": "2482c4030bee2f30e797d8aa308b6651",
"score": "0.6431542",
"text": "def gravatar_for(user, options = { size: 60 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "14feca1e5abbd1581caac759810400a6",
"score": "0.64247525",
"text": "def gravatar_for(user)\n gravatar_url = \"\"\n unless user.authentications.first.nil?\n auth = user.authentications.find_by_provider('facebook')\n unless auth.nil?\n gravatar_url = \"http://graph.facebook.com/#{user.authentications.first.username}/picture?width=180&height=180\"\n u = URI.parse(gravatar_url)\n head = Net::HTTP.get_response(u)\n gravatar_url = head['location']\n end\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n end\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "4a8c45f1113e702bb66281289064c90d",
"score": "0.6412326",
"text": "def gravatar_for(user, options = { size: 80 })\n # Standardize on all lower-case addresses\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "4a8c45f1113e702bb66281289064c90d",
"score": "0.6412326",
"text": "def gravatar_for(user, options = { size: 80 })\n # Standardize on all lower-case addresses\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.email, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "4ae97d5070dc5399638284bb19c894e4",
"score": "0.6404586",
"text": "def gravatar_for(user)\n\t\tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t\tgravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n\t\timage_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "e730ee8e3568b2e2eefde2afb6e0e0ad",
"score": "0.63969636",
"text": "def gravatar_url\n unless defined?(@@gravatar_md5)\n @@gravatar_md5 = Digest::MD5.hexdigest(Settings.gravatar_email.downcase)\n end\n \"https://secure.gravatar.com/avatar/#@@gravatar_md5\"\n end",
"title": ""
},
{
"docid": "957712742ed624805e98458e85a52410",
"score": "0.6394607",
"text": "def gravatar_for(user, options = { size: 80 })\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "8a0cdfc5bf7235da157e9a448d9de5b1",
"score": "0.6387968",
"text": "def avatar_url(user)\n default_url = \"#{root_url}images/user-img.gif\"\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}\"\n end",
"title": ""
},
{
"docid": "b3fbe86bf1a71eed0b2824cd329d2727",
"score": "0.6369414",
"text": "def gravatar_for(user, options = { size: 100 } )\n\t\tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t\tsize = options[:size]\n\t\tgravatar_url = \"http://gravatar.com/avatar/#{ gravatar_id }.png?s=#{ size }\"\n\t\timage_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n\tend",
"title": ""
},
{
"docid": "1f6243548509f5119ae045d4130ac3ce",
"score": "0.6364499",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_url = \"\"\n size = options[:size]\n unless user.authentications.first.nil?\n if user.authentications.first.provider == 'facebook'\n gravatar_url = \"http://graph.facebook.com/#{user.authentications.first.username}/picture?width=#{size}&height=#{size}\"\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\" \n end\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n end\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "191abc656d31433a906aedb9e1092248",
"score": "0.6353655",
"text": "def gravatar_tag(email, *params)\n html_attrs = gravatar_attrs(email, *params).map { |key,value| \"#{key}=\\\"#{CGI.escapeHTML(value.to_s)}\\\"\" }.sort.join(\" \")\n Gravatarify::Utils.make_html_safe_if_available(\"<img #{html_attrs} />\");\n end",
"title": ""
},
{
"docid": "9460cd9c8bd51ccec6ff1c2f154d32e3",
"score": "0.63498294",
"text": "def photo_url\n gravatar_id = Digest::MD5.hexdigest(email.downcase)\n \"https://gravatar.com/avatar/#{gravatar_id}.png\"\n end",
"title": ""
},
{
"docid": "a385bac2c17a65e03e4ff950f830026e",
"score": "0.6330476",
"text": "def gravatar_for(user, options = { size: 50 })\n gravatar_url = \"\"\n begin\n size = options[:size]\n unless user.authentications.first.nil?\n auth = user.authentications.find_by_provider('facebook')\n unless auth.nil?\n size = (size.to_i-10).to_s\n gravatar_url = \"http://graph.facebook.com/#{auth.username}/picture?width=#{size}&height=#{size}\"\n u = URI.parse(gravatar_url)\n head = Net::HTTP.get_response(u)\n gravatar_url = head['location']\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\" \n end\n else\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n end\n rescue Exception => e\n end\n image_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "7cd9e3934b144648d971db38b79be8cb",
"score": "0.63166904",
"text": "def gravatar_url(hacker)\n gravatar_id = Digest::MD5.hexdigest(hacker.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=200&r=r\"\n end",
"title": ""
},
{
"docid": "148dd3e55402c13d62356699c09a7d95",
"score": "0.63093686",
"text": "def gravatar_for(user, options = { size: 50 })\n\t\tgravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n\t\tsize = options[:size]\n\t\tgravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n\t\timage_tag(gravatar_url, alt: user.name, class: \"gravatar\")\n\t\t\n\tend",
"title": ""
},
{
"docid": "4ea1576bac096575b4bd240e1ab8051e",
"score": "0.6302301",
"text": "def avatar_url\n \"http://robohash.org/#{email}?gravatar=yes\"\n end",
"title": ""
},
{
"docid": "6b385f7f73238b1513551906e562d0a9",
"score": "0.6291914",
"text": "def gravatar_for(user, options = { size: 50 })\n size = options[:size]\n image_tag(avatar_url(user, size), alt: user.name, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "0b3d243adf7b60a6db0d76f99ca1bd8c",
"score": "0.62684184",
"text": "def gravatar_url(size)\n \"https://www.gravatar.com/avatar/?default=mm&size=#{size}\"\n end",
"title": ""
},
{
"docid": "bcd963cbc22e6609276fe091dff6e785",
"score": "0.62671506",
"text": "def gravatar_for(user, options = { size: 40 }) \n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n #gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\" #Chapter 7 version, Chapter 7 excercise version on line above ^\n #gravatar_url = \"https://secure.gravatar.com/avatar/614692da29e7cacc0bf3862783be7456\"\n image_tag(gravatar_url, alt: LARD, class: \"gravatar\")\n #image_tag(gravatar_url, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "9d2f8e55d10e4b55c032a52bf03916cd",
"score": "0.6215158",
"text": "def gravatar_id\n Digest::MD5.hexdigest(email) if email\n end",
"title": ""
},
{
"docid": "67fe39de8fabc5e3f385ea646b4abcb5",
"score": "0.6172228",
"text": "def avatar_url(user)\n if user.avatar_url.present?\n user.avatar_url\n else\n default_url = \"#{root_url}images/guest.png\"\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}\"\n end\n end",
"title": ""
},
{
"docid": "67fe39de8fabc5e3f385ea646b4abcb5",
"score": "0.6171549",
"text": "def avatar_url(user)\n if user.avatar_url.present?\n user.avatar_url\n else\n default_url = \"#{root_url}images/guest.png\"\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=48&d=#{CGI.escape(default_url)}\"\n end\n end",
"title": ""
},
{
"docid": "90a81051c561ed7582688855d1674457",
"score": "0.6156348",
"text": "def user_icon(login, email)\n\t\tif @app[:gravatar] == true\n\t\t\tsite_url = @app[:url].chomp('/')\n\t\t\tdefault = html_escape \"#{site_url}#{@app[:default_icon]}\"\n\t\t\turl = \"http://www.gravatar.com/avatar.php?gravatar_id=#{Digest::MD5.hexdigest(email)}&size=#{@app[:icon_size]}&default=#{default}\"\n\t\t\timage_tag(url, :align => 'absmiddle', :width => @app['icon_size'], :border => 0, :alt => 'icon for ' + login)\n\t\telse\n\t\t\timage_tag(auth_url(:action => 'image', :id => login + '.png'), :align => 'absmiddle', :border => 0, :alt => 'icon for ' + login)\n\t\tend\n end",
"title": ""
},
{
"docid": "3f6ccee2d5dc420d2a48ad3c89d11b2c",
"score": "0.61370915",
"text": "def avatar_url(options = {})\n options = {\n rating: 'pg',\n default: 'retro'\n }.merge(options)\n hash = Digest::MD5.hexdigest(object.email)\n\n uri = URI.parse(\"https://secure.gravatar.com/avatar/#{hash}\")\n uri.query = URI.encode_www_form(options)\n\n uri.normalize.to_s\n end",
"title": ""
},
{
"docid": "62288afb261a5b96d2e28354183d16f8",
"score": "0.61025417",
"text": "def avatar_url(size)\n gravatar_id = Digest::MD5::hexdigest(self.email).downcase\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "ea7e184121bcc9e759f7fc02518465ae",
"score": "0.6091588",
"text": "def gravatar_url\n \tstripped_email = email.strip\n \tdowncased_email = stripped_email.downcase\n \thash = Digest::MD5.hexdigest(downcased_email)\n\n \t\"http://www.gravatar.com/#{hash}\" \n end",
"title": ""
},
{
"docid": "018980e84219d61461bb415dfdec0e31",
"score": "0.60746896",
"text": "def avatar_url\n hash = Digest::MD5.hexdigest(email)\n \"http://www.gravatar.com/avatar/#{hash}\"\n end",
"title": ""
},
{
"docid": "4133e8b90561ad1f75ae8846d7d1924d",
"score": "0.60731417",
"text": "def generate_default_avatar \n # Original\n key1 = bucket.key(\"avatars/#{id}/#{@@avatars[:original][:filename]}\")\n key1.put(File.new(\"#{AmazonAvatar.dir}/default.png\").read, 'public-read', {'Content-Type'=>'image/png','Cache-Control' => 'public,max-age=31536000'})\n \n # image\n image = MiniMagick::Image.from_file(\"#{AmazonAvatar.dir}/default.png\")\n # resized\n put_resized(bucket,id,image)\n end",
"title": ""
},
{
"docid": "99ca6927f666398d6d7634e7277fd3df",
"score": "0.60719055",
"text": "def gravatar_for(pod)\n gravatar_id = Digest::MD5::hexdigest(pod.description.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.id, class: \"gravatar\")\n end",
"title": ""
},
{
"docid": "983c5478bb30f53b68ffa75dee908e52",
"score": "0.6060552",
"text": "def avatar_url(user)\n default_url = \"#{root_url}images/guest.jpg\"\n # BUG: Don't use gravatar as you can get someone else's gravatar with your name.\n # eg. Try signing up with name \"test meme\" ... it's some dude's distorted face\n # if user.profile\n # if user.profile.avatar_url.present?\n # user.profile.avatar_url\n # else\n # gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n # \"http://gravatar.com/avatar/#{gravatar_id}?s=200&d=#{CGI.escape(default_url)}\"\n # end\n # else\n # default_url\n # end\n end",
"title": ""
},
{
"docid": "d57561e355a213cc1f16ea1267efc52c",
"score": "0.60375595",
"text": "def image\n require 'digest/md5'\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(author_email.downcase)}\"\n end",
"title": ""
},
{
"docid": "72052da1edba586050022663ee861acb",
"score": "0.60348374",
"text": "def set_gravatar_url\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png\"\n end",
"title": ""
},
{
"docid": "6cd9811058c6be0a72719fd15fd8b779",
"score": "0.59858704",
"text": "def avatar\n \t\t# get the email from URL-parameters or what have you and make lowercase\n\t\temail_address = self.email.downcase\n\t\t \n\t\t# create the md5 hash\n\t\thash = Digest::MD5.hexdigest(email_address)\n\t\t \n\t\t# compile URL which can be used in <img src=\"RIGHT_HERE\"...\n\t\timage_src = \"http://www.gravatar.com/avatar/#{hash}\"\n \tend",
"title": ""
},
{
"docid": "1339000371e15b8ecf920aa8bcbb1477",
"score": "0.5982265",
"text": "def profile_picture_url\n hash = Digest::MD5.hexdigest(email)\n \"https://www.gravatar.com/avatar/#{hash}?d=mm\"\n end",
"title": ""
},
{
"docid": "ecc228eeb0dc19a4ebf651647ab31260",
"score": "0.5968756",
"text": "def avatar_url(size = 80)\n encoded_mail = MD5::md5(mail(true).first.downcase) rescue nil\n \"http://www.gravatar.com/avatar/#{encoded_mail}.jpg?s=#{size}&d=wavatar\"\n end",
"title": ""
},
{
"docid": "d94e114059222cc1390d8affa0bf9e92",
"score": "0.5943835",
"text": "def gravatar\n anchor_title = \"#{source.username} GitHub Profile\"\n github_url = GitHub.profile_page(source.username)\n gravatar_url = Gravatar.url(source.gravatar_id)\n\n h.link_to(github_url, title: anchor_title) do\n\n h.image_tag(gravatar_url, alt: source.username,\n width: 90,\n height: 90,\n class: \"img-polaroid\")\n end\n end",
"title": ""
},
{
"docid": "a2db97dd86dcff13fee71c149848e3c0",
"score": "0.589521",
"text": "def avatar_url(user, size)\n gravatar_id = Digest::MD5.hexdigest(user.email.downcase)\n \"http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"title": ""
},
{
"docid": "05dee351d540fdaa43d656f8e72ace47",
"score": "0.58832693",
"text": "def icon(object, size = :icon, default_image = '/images/profile_default.jpg', use_only_gravatar = false, gravatar_size = 50, rating = 'g', gravatar_default = nil)\n return \"\" if object.blank?\n \n if object.photo.original_filename && !use_only_gravatar\n image_url = object.photo.url(size) rescue nil\n end\n\n if image_url.blank? && object.respond_to?(:email) && object.email.present?\n gravatar_default = File.join(root_url, default_image) if gravatar_default.blank?\n image_url = gravatar(object.email, gravatar_default, gravatar_size, rating)\n else\n image_url ||= default_image\n end\n \n link_to(image_tag(image_url, :class => size), object, { :title => object.full_name })\n end",
"title": ""
},
{
"docid": "8faa30ad4f52f41a22f3cc042be8d6d2",
"score": "0.58680856",
"text": "def user_image_tag(email, size = 1)\n if APP_CONFIG.enabled?(\"gravatar\")\n gravatar_image_tag(email)\n else\n render html: \"<i class=\\\"fa fa-user fa-#{size}x\\\"></i>\".html_safe\n end\n end",
"title": ""
},
{
"docid": "95fe1c8482624c287a329c95cf42c296",
"score": "0.58308655",
"text": "def new_avatar(avatar,comment)\n gravatar_url_from_email(comment.email)\n end",
"title": ""
}
] |
4cf70f54026b8ca585032eca6b11783d
|
Get the class from the metadata.
|
[
{
"docid": "daa10d7dee0d591fe65ffc6766045cbc",
"score": "0.7569292",
"text": "def klass\n @klass ||= metadata.klass\n end",
"title": ""
}
] |
[
{
"docid": "6c726020fd1bcc0b0ebdf97ca1d7f098",
"score": "0.7330803",
"text": "def get_class\n Built::Class.get(@class_uid)\n end",
"title": ""
},
{
"docid": "816568c48ab12c88cfdfe4152ff016c9",
"score": "0.69055593",
"text": "def query_class\n\t\treturn self.client.sys.registry.query_class(self.hkey)\n\tend",
"title": ""
},
{
"docid": "6e6b8a4c9f32c4933d3959b63312bf12",
"score": "0.6893681",
"text": "def klass\n reflection.klass\n end",
"title": ""
},
{
"docid": "6e6b8a4c9f32c4933d3959b63312bf12",
"score": "0.6893681",
"text": "def klass\n reflection.klass\n end",
"title": ""
},
{
"docid": "6e6b8a4c9f32c4933d3959b63312bf12",
"score": "0.6893681",
"text": "def klass\n reflection.klass\n end",
"title": ""
},
{
"docid": "6e6b8a4c9f32c4933d3959b63312bf12",
"score": "0.6893681",
"text": "def klass\n reflection.klass\n end",
"title": ""
},
{
"docid": "6e6b8a4c9f32c4933d3959b63312bf12",
"score": "0.6893681",
"text": "def klass\n reflection.klass\n end",
"title": ""
},
{
"docid": "2870394e17368ef2c9d8bd76306cd923",
"score": "0.68775374",
"text": "def clazz\n Util.full_const_get(@class_name)\n end",
"title": ""
},
{
"docid": "e54d03e5d996173f0b73c4e6f9fbf49a",
"score": "0.6828342",
"text": "def klass\n reflection.klass\n end",
"title": ""
},
{
"docid": "45ba49a9257539948421bb050da2fc5c",
"score": "0.68220896",
"text": "def klass\n @klass ||= compute_class(class_name)\n end",
"title": ""
},
{
"docid": "45ba49a9257539948421bb050da2fc5c",
"score": "0.68220896",
"text": "def klass\n @klass ||= compute_class(class_name)\n end",
"title": ""
},
{
"docid": "45ba49a9257539948421bb050da2fc5c",
"score": "0.68220896",
"text": "def klass\n @klass ||= compute_class(class_name)\n end",
"title": ""
},
{
"docid": "45ba49a9257539948421bb050da2fc5c",
"score": "0.68220896",
"text": "def klass\n @klass ||= compute_class(class_name)\n end",
"title": ""
},
{
"docid": "7b0468917e2040420207963570c658a8",
"score": "0.67202175",
"text": "def klass\n info.klass\n end",
"title": ""
},
{
"docid": "73d74de7e013ab9d82d174dca1284d23",
"score": "0.65195704",
"text": "def get_class\n @class ||= Class.new\n end",
"title": ""
},
{
"docid": "b173ffc2cd8aa177e23d9a13ef4edfb4",
"score": "0.647713",
"text": "def lookup_class\n if self.kind\n Toolkit.classify(self.kind)\n else\n self.class.item_class\n end\n end",
"title": ""
},
{
"docid": "b98d3b8f0f005cad8dde017803115d55",
"score": "0.64750403",
"text": "def get_class( name )\n\tif name.to_i > 0\n \treturn Klass.find( name )\n end\nend",
"title": ""
},
{
"docid": "70248de657d3e2d3ac53a12ea895425e",
"score": "0.64649576",
"text": "def read_class\n klass_name = read_string(cache: false)\n result = safe_const_get(klass_name)\n unless result.class == ::Class\n ::Kernel.raise ::ArgumentError, \"#{klass_name} does not refer to a Class\"\n end\n @object_cache << result\n result\n end",
"title": ""
},
{
"docid": "96834cfe17ef696feeb6d4bfdce6755b",
"score": "0.6460806",
"text": "def klass\n class_name = @attributes[:class_name]\n class_name ? class_name.constantize : name.to_s.classify.constantize\n end",
"title": ""
},
{
"docid": "7f7ad43833c995944201db188912c814",
"score": "0.6435077",
"text": "def get_clazz\n return @m_clazz\n end",
"title": ""
},
{
"docid": "b4216db3b6ad58396b92fbc4f3d1b39e",
"score": "0.6433626",
"text": "def observed_class\n if observed_class_name\n observed_class_name.constantize\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "19dcabc0847764ae71c1463488dc9148",
"score": "0.64158845",
"text": "def class_object(cls)\n class_tracker.class_for(cls)\n end",
"title": ""
},
{
"docid": "83d8374dab967eeb30beee6ffbffc40d",
"score": "0.6415486",
"text": "def to_class\n klass = self.split(\"::\").inject(Kernel) do |namespace, const|\n const == '' ? namespace : namespace.const_get(const)\n end\n klass.is_a?(Class) ? klass : nil\n rescue NameError\n nil\n end",
"title": ""
},
{
"docid": "5af457cf2987041bb72631db7992b008",
"score": "0.64122015",
"text": "def lookup_class\n ObjectSpace.each_object(Class) do |obj|\n return obj if obj.ancestors.include?(Rails::Generator::Base) and\n obj.name.split('::').last == class_name\n end\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\n end",
"title": ""
},
{
"docid": "8c6ae2aeb30a1e791dd88c655760478d",
"score": "0.6392612",
"text": "def class_name\n assert_exists\n return @o.invoke(\"className\")\n end",
"title": ""
},
{
"docid": "c73389e1d2f6f44e053d7c8b9473fc7a",
"score": "0.63834465",
"text": "def to_class\n chain = self.split \"::\"\n klass = Kernel\n chain.each do |klass_string|\n klass = klass.const_get klass_string\n end\n klass.is_a?(Class) ? klass : nil\n rescue NameError\n nil\n end",
"title": ""
},
{
"docid": "f9b89b7780afb7a69f28fd9903544bbf",
"score": "0.6370141",
"text": "def get_class(name)\n Kernel.const_get(name)\n rescue NameError\n nil\n end",
"title": ""
},
{
"docid": "07a6c445acdf8ebd839e5c38a4ce072f",
"score": "0.63543475",
"text": "def class_name\n attribute 'class'\n end",
"title": ""
},
{
"docid": "95f2357b8cb0bfa1d39f63588a52ed2c",
"score": "0.6350294",
"text": "def klass\n return @rrs[0].klass\n end",
"title": ""
},
{
"docid": "c7abcb277479f93c85c947df98a617e9",
"score": "0.63438153",
"text": "def getKlass()\n @plugin.peer.klassFor(@impl)\n end",
"title": ""
},
{
"docid": "3a1f78cc804b5e37e3ef70cae86e1f4e",
"score": "0.6320192",
"text": "def klass\n @klass ||= BSON.const_get(description)\n end",
"title": ""
},
{
"docid": "3a1f78cc804b5e37e3ef70cae86e1f4e",
"score": "0.6320192",
"text": "def klass\n @klass ||= BSON.const_get(description)\n end",
"title": ""
},
{
"docid": "9a8fef84925c7b17f8fc2f97d9f5a982",
"score": "0.63060164",
"text": "def get_class\n\t\tend",
"title": ""
},
{
"docid": "87838808bade537fbe1fa88ba7ddbd91",
"score": "0.6290339",
"text": "def get_class(class_name)\n class_name.split('::').inject(Kernel) do |scope, name|\n scope.const_get(name)\n end\n end",
"title": ""
},
{
"docid": "873d1885ff526f26ec060ba1b4e0691f",
"score": "0.62729025",
"text": "def class_for_activity(activity_kind)\n result = self.activities[activity_kind]\n raise \"No class defined for activity kind: #{activity_kind}\" if result.blank?\n result\n end",
"title": ""
},
{
"docid": "46ce6e858d8fa37112ed43425b32075e",
"score": "0.62708694",
"text": "def lookup_class\n ObjectSpace.each_object(Class) do |obj|\n return obj if valid_superclass?(obj) and\n obj.name.split('::').last == class_name\n end\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\n end",
"title": ""
},
{
"docid": "b8a58ab0571c2bd90166310049f477c7",
"score": "0.62527156",
"text": "def name2class(name)\n result = fetch(name)\n result.kind_of?(Class) ? result : nil\n end",
"title": ""
},
{
"docid": "3ab11d1a429b15f023f94af872455cf9",
"score": "0.62491614",
"text": "def klass\n unless @klass\n require class_file\n @klass = lookup_class\n @klass.spec = self\n end\n @klass\n end",
"title": ""
},
{
"docid": "de037e01495bd900c70369e9c135dc26",
"score": "0.6245923",
"text": "def determine_google_class\n return (google_class || self.class.to_s.split('::').last)\n end",
"title": ""
},
{
"docid": "b020af81873612dc4d18bfa11f167a05",
"score": "0.62291867",
"text": "def klass\n return @rrs[0].klass\n end",
"title": ""
},
{
"docid": "2014dacfdb0f82fa0a4474b169a91390",
"score": "0.62247705",
"text": "def result_class(cls)\n result_object_named_in_set(cls, :class)\nend",
"title": ""
},
{
"docid": "195ed5e2d69842999bf5d1e4341d88fe",
"score": "0.6220763",
"text": "def get_rdf_class(object, attribute)\n return nil unless object.class.respond_to?(:properties)\n\n property = object.class.properties[attribute]\n klass = property[:class_name]\n\n return nil unless klass.respond_to?(:from_uri)\n\n return klass\n end",
"title": ""
},
{
"docid": "7f36520f0dc4f7912cc21cd7d4df806d",
"score": "0.6215896",
"text": "def class_for(json_object)\n class_name = json_object['object_type']\n Reader::Object.const_get(class_name)\n rescue NameError\n Reader::Object::Base\n end",
"title": ""
},
{
"docid": "2f34a4da4fe204f08df299ade6123b72",
"score": "0.62011915",
"text": "def klass\n Kernel::const_get(@klass)\n end",
"title": ""
},
{
"docid": "6ff0a3ab082a54262f23dcbd89fdce01",
"score": "0.62004554",
"text": "def class\n __getobj__.class\n end",
"title": ""
},
{
"docid": "6ff0a3ab082a54262f23dcbd89fdce01",
"score": "0.62004554",
"text": "def class\n __getobj__.class\n end",
"title": ""
},
{
"docid": "a280b901a1a1497095c2a4dbc3f51fe7",
"score": "0.6200159",
"text": "def get(klass)\n @@klasses[klass]\n end",
"title": ""
},
{
"docid": "7d8e3ac642ef947d72130b8ce2ac83e9",
"score": "0.6192723",
"text": "def class_for(code_object)\n class_name = code_object.class.to_s.split('::').last\n const_get(class_name)\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "4850737747a50523479cc0996f7d0c0b",
"score": "0.61894166",
"text": "def klass\n @klass ||= class_name.constantize\n end",
"title": ""
},
{
"docid": "5820cf06eb7f0e20f998fdcac7585b52",
"score": "0.6188916",
"text": "def klass\n @klass\n end",
"title": ""
},
{
"docid": "5820cf06eb7f0e20f998fdcac7585b52",
"score": "0.6188916",
"text": "def klass\n @klass\n end",
"title": ""
},
{
"docid": "9075a23a4585eef43ffcb4cf682635ee",
"score": "0.6176152",
"text": "def klass\n unless @klass\n require class_file\n @klass = lookup_class\n @klass.spec = self\n end\n @klass\n end",
"title": ""
},
{
"docid": "18d19690724ca9ec1cb4dfd3171b3898",
"score": "0.6175679",
"text": "def klass\n self.class_name.constantize\n end",
"title": ""
},
{
"docid": "e0c3143e12de50494b57886186de7f49",
"score": "0.6168208",
"text": "def class_value\n @pairs.fetch(\"class\", \"\")\n end",
"title": ""
},
{
"docid": "f72fc7c4494bcb54510305e59d43e673",
"score": "0.6167521",
"text": "def get_class_by_name(name)\r\n @classes.each do |entry_array|\r\n entry_array.each do |entry|\r\n if entry[\"signature\"].downcase == name.downcase\r\n return entry\r\n end\r\n end\r\n end\r\n\r\n nil\r\n end",
"title": ""
},
{
"docid": "790c294e4b0f76c6465c54062bfb2f6a",
"score": "0.6157712",
"text": "def class\n klass\n end",
"title": ""
},
{
"docid": "2d3a687c3f3d2c9c66ddbd5dccb3615c",
"score": "0.61572015",
"text": "def klass\n @klass ||=\n if klass_name\n klass_name.constantize\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "49b046d1099007569b58f533276ff867",
"score": "0.6146294",
"text": "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"title": ""
},
{
"docid": "49b046d1099007569b58f533276ff867",
"score": "0.6146294",
"text": "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"title": ""
},
{
"docid": "49b046d1099007569b58f533276ff867",
"score": "0.6146294",
"text": "def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"title": ""
},
{
"docid": "e49dee746f150a60adf283e97d8d8cb3",
"score": "0.61394155",
"text": "def klass\n @klass ||= ACH.to_const(@name.classify.to_sym)\n end",
"title": ""
},
{
"docid": "f3c5611694d3f287b1e8af4e1827a349",
"score": "0.61283964",
"text": "def model_klass\n Object.const_get(\"::#{name.split('::')[0..-3].last}\")\n end",
"title": ""
},
{
"docid": "a855744e91e8496f80ac48849e0f8136",
"score": "0.61269546",
"text": "def klass\n fetch('heroes.klasses')\n end",
"title": ""
},
{
"docid": "258a597a8dfbd735f676b347fcb728bd",
"score": "0.6126765",
"text": "def class_for_model(model)\r\n classes.find { |resource| resource.model == model }\r\n end",
"title": ""
},
{
"docid": "b4ca7aaf9eb07dfb807e37b7e0f3fe79",
"score": "0.61167693",
"text": "def klass\n @object.name if (defined? @object.class.name)\n end",
"title": ""
},
{
"docid": "b4ca7aaf9eb07dfb807e37b7e0f3fe79",
"score": "0.61167693",
"text": "def klass\n @object.name if (defined? @object.class.name)\n end",
"title": ""
},
{
"docid": "0725a25c4ce328e7bdf87ee9aa9923c7",
"score": "0.60983336",
"text": "def response_class\n ret = self.class.response_class\n raise \"Invalid response_class; see docs for naming conventions etc\" if !ret\n return Object.const_get(ret)\n end",
"title": ""
},
{
"docid": "7c8a1737747ecc0a3a95b05a6169fa89",
"score": "0.6089902",
"text": "def klass\n @klass ||= klass_name ? klass_name.constantize : nil\n end",
"title": ""
},
{
"docid": "90a66914e2e3342080762a033ab58f79",
"score": "0.6089307",
"text": "def model_class(resp)\n resource = nil\n ct = resp.content_type\n if ct == \"application/json\"\n resp.json[\"resourceURI\"].wont_be_nil\n resource = resp.json[\"resourceURI\"].split(\"/\").last\n elsif ct == \"application/xml\"\n if resp.xml.root.name == \"Collection\"\n resource = resp.xml.root[\"resourceURI\"].split(\"/\").last\n else\n resource = resp.xml.root.name\n end\n elsif resp.body.nil? || resp.body.size == 0\n raise \"Can not construct model from empty body\"\n else\n raise \"Unexpected content type #{resp.content_type}\"\n end\n CIMI::Model::const_get(resource)\n end",
"title": ""
},
{
"docid": "1f1837098508eccabce96227bcfb96c9",
"score": "0.608325",
"text": "def klass\n self.class.to_s.split(\"::\").last\n end",
"title": ""
},
{
"docid": "307766d7a8f94d1443fb258465606b5e",
"score": "0.6079925",
"text": "def ruby_class\n attributes[\"ruby_class\"]\n end",
"title": ""
},
{
"docid": "420ed9dac22341855868afe9608f90a6",
"score": "0.6077885",
"text": "def target_class\n\n if class_name.nil?; return nil; end\n\n klass = class_name.constantize\n if klass.nil? || !klass.is_a?( Class )\n raise NameError, \"#{class_name} is not the name of a class\"\n end\n\n return klass\n\n end",
"title": ""
},
{
"docid": "4954b77d4c91eb142f058279e7c13912",
"score": "0.60683763",
"text": "def clazz\n @clazz ||= path.\n basename.\n to_s.\n split('.').\n first.\n classify.\n singularize.\n constantize\n end",
"title": ""
},
{
"docid": "680358f54b23504a7022b3b16f2f497b",
"score": "0.6057169",
"text": "def clazz(name)\n # cl_name = self.class.name.split('::').last\n # cl = Jaspion::Kilza.const_get(\"#{cl_name}::Class\")\n # return cl.new(name) unless cl.nil?\n #\n Class.new(name)\n end",
"title": ""
},
{
"docid": "f8e8b15776ef4c3756c0c51c53ea421c",
"score": "0.60551924",
"text": "def __phpclass\n @args[:php_process].func(\"get_class\", self)\n end",
"title": ""
},
{
"docid": "1ee7826a26302c646c4a0f4d173ed84a",
"score": "0.60544527",
"text": "def klass\n @_klass ||= self.value.constantize\n end",
"title": ""
},
{
"docid": "2d2e4aa8a78ba4c7fab3affab2b17eb2",
"score": "0.6052544",
"text": "def klass\n if @klass.blank?\n begin \n Object.full_const_get( class_name ) # only works for testing\n rescue \n # for regular merb-gen use the database has not yet connected, so ...\n Merb::Config.session_stores = []\n Merb::Orms::ActiveRecord::Connect.run unless Merb.disabled? :initfile\n # also the model classes haven't been loaded ...\n Merb::BootLoader::LoadClasses.run\n end \n @klass ||= Object.full_const_get( class_name )\n end\n @klass \n end",
"title": ""
},
{
"docid": "224ab678de4a7ee08faeadc8ec94017c",
"score": "0.605002",
"text": "def classname\n self.class.to_s.split(':')[-1]\n end",
"title": ""
},
{
"docid": "38f475af10939ddb4bb54932d68a0038",
"score": "0.6041902",
"text": "def to\n if defined?(ActiveSupport::Dependencies::ClassCache)\n @ref.get @class_name\n else\n @ref.get\n end\n end",
"title": ""
},
{
"docid": "3fe781b06a1613408be19939164b5559",
"score": "0.6038435",
"text": "def class_for(yard_object)\n class_name = yard_object.class.to_s.split('::').last\n const_get(class_name)\n rescue NameError\n Base\n end",
"title": ""
},
{
"docid": "b63499db9a76fe49d9d40d46af48c2da",
"score": "0.60316736",
"text": "def class_with_slave\n klass_name = self.class.to_s.split(\"::\").last\n return eval(klass_name)\n end",
"title": ""
},
{
"docid": "7c18a8d7eefae78c60636b1b66dcfa32",
"score": "0.60310817",
"text": "def resource_class\n return self.class unless self.namespace\n return self.class unless type_name = self.data_type_name\n class_name = \"#{self.namespace}::#{type_name}\".\n gsub(/[^_0-9A-Za-z:]/, '')\n\n ## Return data type class if it exists\n klass = eval(class_name) rescue :sorry_dude\n return klass if klass.is_a?(Class)\n\n ## Data type class didn't exist -- create namespace (if necessary),\n ## then the data type class\n if self.namespace != ''\n nsc = eval(self.namespace) rescue :bzzzzzt\n unless nsc.is_a?(Class)\n Object.module_eval \"class #{self.namespace} < #{self.class}; end\"\n end\n end\n Object.module_eval \"class #{class_name} < #{self.namespace}; end\"\n eval(class_name)\n end",
"title": ""
},
{
"docid": "4d0059c57a8810437649401fe107f184",
"score": "0.60282063",
"text": "def klass\n @klass ||= ancestor_klasses[0]\n end",
"title": ""
},
{
"docid": "17c68526f0d8f05ddfb1cfc60012979f",
"score": "0.6013622",
"text": "def get_class(resource)\n return false if resource.nil?\n res = resource.to_s.modulize\n\n begin\n const_get(res)\n rescue NameError\n ZendeskAPI.get_class(resource)\n end\n end",
"title": ""
},
{
"docid": "a79b959bc6ea521e1d8d581581e0dae6",
"score": "0.60135996",
"text": "def get_class(object)\n object.class\n end",
"title": ""
},
{
"docid": "395234baf7b924bdf9964e6743b49526",
"score": "0.60021865",
"text": "def klass_for(name)\n @result_set ? @result_set[name] : nil\n end",
"title": ""
},
{
"docid": "b1130afce97d410d447868e3f154d909",
"score": "0.5999892",
"text": "def classObj ()\n @Class\n end",
"title": ""
},
{
"docid": "6331b466e10d542b022570a544a0f3f2",
"score": "0.59971297",
"text": "def model_class_from_name(class_name)\n class_name.constantize\n end",
"title": ""
},
{
"docid": "c90ef3a6223f2c07db8c537158ceae69",
"score": "0.59958476",
"text": "def specific_class\n @classname\n end",
"title": ""
},
{
"docid": "caa5710bce77ff838199c48a3f3a537a",
"score": "0.5993415",
"text": "def atk_class\n return data.atk_class\n end",
"title": ""
},
{
"docid": "e6c3ad73851c13e6172aa3f292c3230c",
"score": "0.5988914",
"text": "def get_class(_class, opts = {})\n data, _status_code, _headers = get_class_with_http_info(_class, opts)\n return data\n end",
"title": ""
},
{
"docid": "6be2dbc2295c7b9b9647d8d1f6640226",
"score": "0.5987043",
"text": "def type\n @klass\n end",
"title": ""
},
{
"docid": "f3fb09d956b84527b50a72e9e2300d3d",
"score": "0.59822935",
"text": "def klass\n @object.object.klass\n end",
"title": ""
},
{
"docid": "e6ec47a86433bcf9b8ea1d3a3c155c7b",
"score": "0.5980966",
"text": "def building_class\n self.dig_for_string(\"buildingClass\")\n end",
"title": ""
}
] |
5f2cd38fffb95b41507910f1a7bc0881
|
DELETE /bookmark_tags/1 DELETE /bookmark_tags/1.json
|
[
{
"docid": "6191f641c4fbcfabe95b32d4c5d2546f",
"score": "0.78512025",
"text": "def destroy\n @bookmark_tag = BookmarkTag.find(params[:id])\n @bookmark_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to bookmark_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "f3556d6972f6f78f70303c500860537f",
"score": "0.726558",
"text": "def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"title": ""
},
{
"docid": "4f831421b0c93f1489765ae4831733ea",
"score": "0.71941286",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to [@tag, :bookmarks], notice: \"Bookmark, #@bookmark deleted.\" }\n\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a6a2b8df0e2daf1f0747610b641f1ee",
"score": "0.7102789",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a6d82658497d12d869aaab9d2bc2d81c",
"score": "0.7052665",
"text": "def _delete\n # Set id and cache key\n id = @options[:id]\n cache_key = nil #\"bookmark_#{id}\"\n\n # Retrieve bookmark object\n bookmark = Taupe::Model::Bookmark.load id, cache_key\n fail \"Unknown bookmark ##{id}\" if bookmark.empty?\n\n # Delete it\n Taupe::Model::Tag.exec \"DELETE FROM bookmark_tag WHERE bookmark_id = #{bookmark.bookmark_id}\"\n bookmark.delete\n\n puts 'Bookmark deleted successfully'\n end",
"title": ""
},
{
"docid": "e709d186ed680bf2e3dd3364788ba5c3",
"score": "0.70460165",
"text": "def delete(tag)\n api_client.tags.multi_delete(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"title": ""
},
{
"docid": "a0d34d113da50e832f10fc048a936b65",
"score": "0.6969281",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { redirect_to bookmarks_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2bd6ec4678539176418b92b4206c18dd",
"score": "0.6966002",
"text": "def destroy\n\t@tag = Tag.find(params[:id])\n\t@tag.destroy\n\tflash[:notice] = \"Bookmark was successfully deleted\"\n\trespond_to do |format| \n\t \tformat.html {redirect_back_or current_user}\n\t\tformat.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f6e39ae057f1568e1b039f85dbd56451",
"score": "0.69279295",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to \"/timeline\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1c2fb5ae949dbbc48507c8a446311abf",
"score": "0.68760294",
"text": "def destroy\n @bookmark.destroy\n flash[:notice] = t('controller.successfully_deleted', :model => t('activerecord.models.bookmark'))\n @bookmark.create_tag_index\n\n if @user\n respond_to do |format|\n format.html { redirect_to user_bookmarks_url(@user) }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to user_bookmarks_url(@bookmark.user) }\n format.json { head :no_content }\n end\n end\n end",
"title": ""
},
{
"docid": "14aada3eaf4d8300f14af6569b8862e2",
"score": "0.6868084",
"text": "def destroy\n BuzzTag.where(:buzz_id => params[:buzz_id], :tag_id => params[:tag_id]).first.destroy\n end",
"title": ""
},
{
"docid": "6cca111d8a04a4d484e18f111a760900",
"score": "0.68147993",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n \n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n\n end",
"title": ""
},
{
"docid": "804ebfe19f6dc12b3208bdbf32d2acf6",
"score": "0.6811906",
"text": "def destroy\n @posttag = Posttag.find(params[:id])\n @posttag.destroy\n\n respond_to do |format|\n format.html { redirect_to posttags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d757ab0cd3c3c2a08984703461e792b8",
"score": "0.6804914",
"text": "def destroy\n # @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c79db7808ea5990864285759de32dca7",
"score": "0.6803207",
"text": "def destroy\n @quotetags = Quotetags.find(params[:id])\n @quotetags.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotetags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f94a041aae025b474cecc00367925386",
"score": "0.6795173",
"text": "def delete_tags(name); end",
"title": ""
},
{
"docid": "06667229334809f93125852c81f53ca3",
"score": "0.6788016",
"text": "def delete()\n\n client.delete(\"/tags/#{gid}\") && true\n end",
"title": ""
},
{
"docid": "313aae2f8d2b9de674224fa3dcffe43a",
"score": "0.67784584",
"text": "def remove_tag\n @kyu_entry.tag_list.remove(params[:tag])\n @kyu_entry.save\n render json: true\n end",
"title": ""
},
{
"docid": "2ad172ec1f73e2e8a717c0243058d869",
"score": "0.67764896",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to bookmarks_url, notice: 'Bookmark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e3a1150f0224c44a4f86e7e312e128e8",
"score": "0.6774499",
"text": "def destroy\n @bookmark_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to bookmark_stats_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bbf72e5c7675dd1bae961d26d96348b9",
"score": "0.6774389",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n if session[:user_id] != @bookmark.user_id\n flash[:error] = \"Sorry, you do not have permission to delete this bookmark.\"\n redirect_to root_url\n else \n @bookmark.destroy\n # added these 2 lines because tags are not getting deleted!\n # title = @bookmark.title\n # Bookmark.destroy(params[:id])\n # @bookmark.destroy\n\n redirect_to root_url, :notice => \"#{@bookmark.title} was deleted!\"\n end\n end",
"title": ""
},
{
"docid": "b8e1c12fd3c5e562729d0b900ef2e4f1",
"score": "0.6769499",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to bookmarks_url, notice: \"Bookmark was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "834bfa8a759941deb4f697c191efac5e",
"score": "0.6767146",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n render json: JSON.parse({msg:\"success\"}.to_json)\n end",
"title": ""
},
{
"docid": "a348bf601cdd9ebc6148249ce3e1ae24",
"score": "0.6761897",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n # format.html { redirect_to bookmarks_url, notice: 'Bookmark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "09f630292fd82737b51a22e4485456b4",
"score": "0.6760535",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to @bookmark.poi }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d0f454d6a55395a395c0811635a7247",
"score": "0.6738489",
"text": "def delete\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f93ec8ecb3926797d0e43f33dcc2596e",
"score": "0.6737092",
"text": "def destroy\n get_status\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "58ef9ce9c7f316dbc9e335b6efa68986",
"score": "0.67291933",
"text": "def destroy\n tag = @user.tags.find_by_tid(params[:id])\n if tag.nil?\n render json_status_response(404, \"Tag not found\")\n return\n end\n\n tag.destroy\n render json_status_response(200, \"Tag removed successfully\")\n end",
"title": ""
},
{
"docid": "30dd77b67b9e236a7b8a156d3c95dc01",
"score": "0.6725713",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "30dd77b67b9e236a7b8a156d3c95dc01",
"score": "0.6725713",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "30dd77b67b9e236a7b8a156d3c95dc01",
"score": "0.6725713",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d19cb280a4f4a4873a86906b4430e6bf",
"score": "0.67229456",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookmarks_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d19cb280a4f4a4873a86906b4430e6bf",
"score": "0.67229456",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookmarks_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "408e0ebbda6e2bf06220c62c52b90f33",
"score": "0.6713122",
"text": "def destroy\n @tag_ref.destroy\n respond_to do |format|\n format.html { redirect_to tag_refs_url, notice: 'Usunięto Tag z artykułu.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c7312ffa3e0b138795a6380388e459dd",
"score": "0.671104",
"text": "def destroy\n @tag = Tag.find(params[:id])\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "eaf570294a240f521a1e487838366ae7",
"score": "0.67095363",
"text": "def destroy\n @api_tag = Api::Tag.find(params[:id])\n @api_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to api_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a476f3cf869bf8f64a8856e88237b6b5",
"score": "0.6708029",
"text": "def destroy\n if @bookmark.destroy\n head :no_content\n else\n render json: { errors: @bookmark.errors }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3115639e71a20eb851cdcbd5a761d76e",
"score": "0.6704608",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to @redirect, notice: 'Bookmark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fffadd458f11db7923ae1a00d70215be",
"score": "0.6697915",
"text": "def destroy\n @bookmark.destroy\n respond_to do |format|\n format.html { redirect_to topic_bookmarks_url, notice: 'Bookmark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc038b27433d7cbf29ab34da482ec1ba",
"score": "0.6666769",
"text": "def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "20bd83ad40716ca2388fb27e7230a68f",
"score": "0.66600245",
"text": "def tag_delete(id, tag)\n wf_event_id?(id)\n wf_string?(tag)\n api.delete([id, 'tag', tag].uri_concat)\n end",
"title": ""
},
{
"docid": "1192e0c4c8b521a70462242fd308333f",
"score": "0.6659297",
"text": "def destroy\n\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n\n end",
"title": ""
},
{
"docid": "c77a194ddd892c1d575e74df72dce96f",
"score": "0.6658639",
"text": "def destroy\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "01e34270dcfb60a8310ad3d449be2351",
"score": "0.66562825",
"text": "def destroy\n @tagging.destroy\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b1a02c50d7e9903d45f16deffde6a1c",
"score": "0.6636457",
"text": "def destroy\n @bookmarklet = Bookmarklet.find(params[:id])\n @bookmarklet.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookmarklets_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "59e4e570a3fc2cc9d124f0b5a23b25f9",
"score": "0.66215515",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7b75133244b6607edaefd0806d11ae37",
"score": "0.6620325",
"text": "def destroy\n @taggable = current_user.taggables.find(params[:id])\n\n #destroy each tag in the taggable\n @taggable.tags.each do |tag|\n tag.destroy\n end\n\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to taggables_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7eff077940d1750798db5d1d40c591f3",
"score": "0.6618989",
"text": "def destroy\n @post_tag.destroy\n respond_to do |format|\n format.html { redirect_to post_tags_url, notice: 'Tagi poistettu' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3fb06e350d033009e79d4f32af7cb630",
"score": "0.66149616",
"text": "def destroy\n @user_follow_tag = UserFollowTag.find(params[:id])\n @user_follow_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_tags_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ced8f84629051eb5681c885f4cda9f75",
"score": "0.6613826",
"text": "def destroy\n @hash_tag = HashTag.find(params[:id])\n @hash_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(hash_tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1db40e550937fa93a144ba818b416a80",
"score": "0.6611559",
"text": "def destroy\n @tag = Tag.find(params[:id])\n respond_to do |format|\n if @tag.destroy\n format.json { render json: {:id => @tag.id}, status: :ok }\n else\n format.json { render json: @tag.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cbf4ed11a56ae1bd21e5ba5bf4e11760",
"score": "0.65977633",
"text": "def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "997eef0f3340a1a00074ee5ffe4639c1",
"score": "0.65944433",
"text": "def destroy\n @tagged_item = TaggedItem.find(params[:id])\n @tagged_item.destroy\n\n respond_to do |format|\n format.html { redirect_to all_items_tagged_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "333f5f1241cdd0e4afaa6ad87f8eaaea",
"score": "0.65941316",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @user = User.find(session[:user_id])\n @user.bookmarks.delete(@bookmark)\n\n respond_to do |format|\n format.html { redirect_to(bookmarks_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "180882fdc5312a45e658b24f8cdfc49c",
"score": "0.6592854",
"text": "def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "810158092dd8983aab006ba6fc1d0b14",
"score": "0.6586226",
"text": "def destroy\n @has_tag.destroy\n respond_to do |format|\n format.html { redirect_to has_tags_url, notice: 'Has tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7c97266422d78bb868675db990fe956a",
"score": "0.6582989",
"text": "def destroy\n @events_tag = EventsTag.find(params[:id])\n @events_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to events_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "18213991415922a885a7cb7525d3f146",
"score": "0.6567092",
"text": "def destroy\n @tagg = Tagg.find(params[:id])\n @tagg.destroy\n\n respond_to do |format|\n format.html { redirect_to taggs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f63bc5b7109eb6ff63521e892300483b",
"score": "0.65630585",
"text": "def destroy\n @nagayoshi_bookmark_log.destroy\n respond_to do |format|\n format.html { redirect_to nagayoshi_bookmark_logs_url, notice: 'Nagayoshi bookmark log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8aca0cb52f61b5925b424e79dd05ef0a",
"score": "0.65535396",
"text": "def destroy\n @tag.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "c17ad6e5012b0518a679d4b01a895e63",
"score": "0.6552479",
"text": "def destroy\n real_post_path = @tag.post\n @tag.destroy\n respond_to do |format|\n format.html { redirect_to post_path(real_post_path), notice: 'tag deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6284409883fcb0c83fa04a45d970562a",
"score": "0.6551995",
"text": "def destroy\n @climb_tag.destroy\n respond_to do |format|\n format.html { redirect_to climb_tags_url, notice: 'Climb tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f4a360d5d9492d987d7a1e98e4d253c3",
"score": "0.6550265",
"text": "def destroy\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect_to(taggables_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "16aeed73848d55a546c40f724f2eb461",
"score": "0.65442705",
"text": "def destroy\n @tagging = Tagging.find(params[:id])\n @tagging.destroy\n\n respond_to do |format|\n format.html { redirect_to taggings_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "739224150819fd5165b61246e52c0929",
"score": "0.65387344",
"text": "def destroy\n @bookmark = Bookmark.find(params[:id])\n @bookmark.destroy\n\n\n# if (@bookmark=Bookmark.all).blank?\n# folderArray=['ruby']\n# bookmarks= Bookmark.create([{origin: 'ruby on rails',name: 'Ruby on Rails',url: 'http://rubyonrails.org',\n# folder: folderArray,create_date: DateTime.now,visited_date: DateTime.now,modified_date: DateTime.now}])\n# end\n\n\n\n respond_to do |format|\n format.html { redirect_to bookmarks_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "574c304966dabc16f9e2297b64262483",
"score": "0.6537775",
"text": "def delete\n @tag.destroy\n redirect_to(tags_url)\n end",
"title": ""
},
{
"docid": "0635ceda6b995409892269cbf63e98ee",
"score": "0.65370303",
"text": "def destroy\n @twitter_crawler_hash_tag = TwitterCrawlerHashTag.find(params[:id])\n @twitter_crawler_hash_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(twitter_crawler_hash_tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0ef7ec04a7a02737a8f4fbb390734090",
"score": "0.65361387",
"text": "def destroy\n @storyline_tag.destroy\n respond_to do |format|\n format.html { redirect_to storyline_tags_url, notice: 'Storyline tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fb9e2ebb4e0280b2938309bb6cbc3e6e",
"score": "0.6531362",
"text": "def destroy\n @hash_tag.destroy\n respond_to do |format|\n format.html { redirect_to hash_tags_url, notice: 'Hash tag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f5ecd4818f67be76fa2a4f975bd2c755",
"score": "0.6528533",
"text": "def delete\n resource.delete_tags([self])\n nil\n end",
"title": ""
},
{
"docid": "9121f0cfe2e0a3f56e6bd6f2156ed30c",
"score": "0.65282124",
"text": "def destroy\n @recommend_recommend_tag = Recommend::RecommendTag.find(params[:id])\n @recommend_recommend_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4413caa4ffc0703aa5695439f7b55085",
"score": "0.65232944",
"text": "def destroy\n @bookmarkable = @bookmark.bookmarkable\n #url = (bookmarkable.class.to_s == \"Dress\" ? bookmarkable : vendor_seo_path(bookmarkable))\n @bookmark.destroy\n\n respond_to do |format|\n format.js\n format.html { redirect_to request.referer }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c439ccbd42273e085853ac2797d73c8d",
"score": "0.6508531",
"text": "def destroy\n @tag_tag = TagTag.find(params[:id])\n @tag_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tag_tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ee234fbeabaedf2f2abc8c86e59398ef",
"score": "0.6493166",
"text": "def destroy\n tag = tag.find(params[:id])\n\n if tag.destroy\n render json: {\"message\": \"Record was deleted\", status: :ok, }, status: :ok\n else\n render json: {\"message\": \"You are not authorized to delete this tag\"}, status: :unauthorized\n end\n end",
"title": ""
},
{
"docid": "ace31159c9f41c7eb6b5a03405a1c48c",
"score": "0.64904666",
"text": "def destroy\n @tag_one.destroy\n respond_to do |format|\n format.html { redirect_to tag_ones_url, notice: 'Tag one was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aceea9d3614fe93ed7f1a7d9e1d7080b",
"score": "0.6489624",
"text": "def destroy\n @bookmark_category.destroy\n respond_to do |format|\n format.html { redirect_to bookmark_categories_url, notice: 'Bookmark category was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "840e3a55dcb5813695d788163a958b98",
"score": "0.6478085",
"text": "def delete\n validate_presence_of :name\n wrapper.delete_tag(@name) || raise(OperationFailed)\n end",
"title": ""
},
{
"docid": "ba7f3386955a2c7a38fa83aa5b0033f0",
"score": "0.6461648",
"text": "def destroy\n # @post.delete_all_tags\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7d818233a553f2e44a21130cb589e7b9",
"score": "0.64561206",
"text": "def deletebookmark\n\t\t\t\tbookmark = Bookmark.find_by_id(params[:id])\n\t\t\t\tif bookmark.user_id == doorkeeper_token.resource_owner_id\n\t\t\t\t\tbookmark.destroy\n\t\t\t\t\thead :ok\n\t\t\t\telse\n\t\t\t\t\trender :status => 504\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "920e3eab1695d302a6150611f6280680",
"score": "0.6451829",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ba7e146d56610b59464e01c081f3a59f",
"score": "0.6451301",
"text": "def destroy\n @admin_album_tag.destroy\n respond_to do |format|\n format.html { redirect_to admin_album_tags_url, notice: \"#{t 'activerecord.successful.messages.album_tag_deleted'}\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "93f1f494a5c465621c4a89f4fe06a916",
"score": "0.644361",
"text": "def tags_delete(tag)\n params = prepare_tags_delete_param(tag)\n response = request(API_PATH_TAGS_DELETE, params)\n parse_and_eval_execution_response(response.body)\n end",
"title": ""
},
{
"docid": "ed8ca37dc1df8604e6057d25058947b5",
"score": "0.64398056",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ed8ca37dc1df8604e6057d25058947b5",
"score": "0.64398056",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ed8ca37dc1df8604e6057d25058947b5",
"score": "0.64398056",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ed8ca37dc1df8604e6057d25058947b5",
"score": "0.64398056",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(tags_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "3404a1a559ae1f0f0fb4890490689b8e",
"score": "0.64372236",
"text": "def destroy\n @asset_tag = AssetTag.find(params[:id])\n @asset_tag.destroy\n render json: {}\n \n end",
"title": ""
},
{
"docid": "1f078dcac9e466764ff8110f21dda9f6",
"score": "0.6435688",
"text": "def destroy\n @ad_tag = AdTag.find(params[:id])\n @ad_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to ad_tags_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "87075cc81ccc98bd7dc253ce659933dd",
"score": "0.64307743",
"text": "def destroy\n @answer_tag.destroy\n respond_to do |format|\n format.html { redirect_to answer_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e10e2f340376ca6bfa4903829c612135",
"score": "0.6424165",
"text": "def destroy\n @tag = @category.tags.find_by_permalink!(params[:id])\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to(category_tags_url(@category)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "08ee912e373e5957c9053d2190ef3bd8",
"score": "0.6420007",
"text": "def destroy\n @question_tag = QuestionTag.find(params[:id])\n @question_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to question_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8edb0d098812d65cdec1b86e4550ad2c",
"score": "0.641628",
"text": "def destroy\n @recommend_recommend_ptag = Recommend::RecommendPtag.find(params[:id])\n @recommend_recommend_ptag.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_ptags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d8bdf4e8a3e12ba67263bec90f6ae87e",
"score": "0.64049715",
"text": "def destroy\n\t\tif params[:owner].present? && params[:post].present?\n\t\t\t@bookmark = Bookmark.where(:owner => params[:owner], :post => params[:post])\n\t\telsif params[:id].present?\n\t\t\t@bookmark = Bookmark.where(:id => params[:id])\n\t\tend\n\n\t\t@bookmark.each do |b|\n\t\t\tb.destroy\n\t\tend\n\n\t\trender :text => \"Nothing\"\n\tend",
"title": ""
},
{
"docid": "ea27cdbf1a30014a5e6e8d670efd9155",
"score": "0.63992465",
"text": "def destroy\n \t\t\n\t@tag = Tag.find(params[:id])\n @tag.destroy\n\t\t\n respond_to do |format|\n format.html { redirect_to(tags_path) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ed292b4deac87a6328ff059d599537c3",
"score": "0.6396873",
"text": "def destroy\n begin\n breed = Tagger.tagged_klass.constantize.find(params[:id])\n breed.destroy\n render json: { message: \"Deleted successfully\" }\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"title": ""
},
{
"docid": "7761879210be3c36a27d7d8f9fe586e4",
"score": "0.63950247",
"text": "def destroy\n @tag.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_path, success: I18n.t(\"admin.flash.tags.success.destroy\") }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7fdb4b7cff6159a8b74fd93ababef8b6",
"score": "0.63942444",
"text": "def destroy\n @skill_tag = SkillTag.find(params[:id])\n @skill_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to skill_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0d3ce11ea64c9b1121b2b8e9ad4c839a",
"score": "0.6393679",
"text": "def destroy\n @tag = Tag.find(params[:id])\n @tag.destroy\n\tflash[:error] = @tag.errors[:base]\n\n respond_to do |format|\n format.html { redirect_to tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "346b0bf3240ff2cd94650f2eaa73af3f",
"score": "0.6392527",
"text": "def destroy\n @solicitation_bookmark.destroy\n respond_to do |format|\n format.html { redirect_to solicitation_bookmarks_url, notice: 'Solicitation bookmark was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "44b0b46416df80c6149b01269e378edc",
"score": "0.63830507",
"text": "def destroy\n @photo_tag_reference.destroy\n respond_to do |format|\n format.html { redirect_to photo_tag_references_url, notice: 'Photo tag reference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8fe034814704a6013cc9940ceae31c3b",
"score": "0.6373549",
"text": "def destroy\n @user_tag = UserTag.find(params[:id])\n @user_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tags_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
3dc00fcc4898295c1c62e0d75c07cb54
|
Add (Disjunction) a Rangeary (or RangeExtd or Range)
|
[
{
"docid": "fa0385c2fc9d7f9a894642186cb7e0a3",
"score": "0.0",
"text": "def disjunction(inr)\n self.class.new(self, inr)\n end",
"title": ""
}
] |
[
{
"docid": "4f804a860763b86e8b331ec8067c474f",
"score": "0.67931485",
"text": "def add_range(range = (0..-1))\n @ranges << range\n end",
"title": ""
},
{
"docid": "5a0c3b45654cd5a85660f275a9559334",
"score": "0.6520829",
"text": "def add_range(cells); end",
"title": ""
},
{
"docid": "f058ac0bf0f6a02173640268a352a922",
"score": "0.64255565",
"text": "def add_range(cells)\n sqref = if cells.is_a?(String)\n cells\n elsif cells.is_a?(SimpleTypedList) || cells.is_a?(Array)\n Axlsx.cell_range(cells, false)\n end\n self << ProtectedRange.new(sqref: sqref, name: \"Range#{size}\")\n last\n end",
"title": ""
},
{
"docid": "3b36e9cbf0abc2e8206df7edefa3db4f",
"score": "0.6405498",
"text": "def literal_other_append(sql, v)\n case v\n when Range\n super(sql, Sequel::Postgres::PGRange.from_range(v))\n else\n super\n end\n end",
"title": ""
},
{
"docid": "d66c8490864d6d9b01c6b6a1f5a10872",
"score": "0.6379205",
"text": "def add_range(left, right)\n return nil if left >= right\n i = @ranges.bsearch_index { |l, r| r >= left }\n if i.nil?\n @ranges << [left, right]\n elsif right < @ranges[i][0]\n @ranges.insert(i, [left, right])\n else\n @ranges[i][0] = left if left < @ranges[i][0]\n @ranges[i][1] = right if right > @ranges[i][1]\n end\n (0..@ranges.size-1).each do |i|\n while @ranges[i+1] && @ranges[i][1] >= @ranges[i+1][0]\n @ranges[i][1] = [@ranges[i][1], @ranges[i+1][1]].max\n @ranges.delete_at(i+1)\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "44d4db32622b5f184c9cb33f3da30d21",
"score": "0.632844",
"text": "def merge_or_append range, ranges\n ranges.each_with_index do |r, i|\n if merged = merge(r, range)\n ranges[i] = merged\n return ranges\n end\n end\n ranges.push range\n end",
"title": ""
},
{
"docid": "b3e3bb0c13c60bd6a74c794faa071bd2",
"score": "0.62425077",
"text": "def + other\n other = convert(other)\n\n return other if self.empty?\n return self if other.empty?\n\n if other.lower >= self.upper || (other.lower_inc? && self.upper_inc? && other.lower != self.upper)\n raise ArgumentError, \"result of range union would not be contiguous\"\n end\n\n case other.lower <=> self.lower\n when -1\n lrng = other\n when 1\n lrng = self\n when 0\n lrng = self.lower_inc? ? self : other\n end\n\n case other.upper <=> self.upper\n when 1\n urng = other\n when -1\n urng = self\n when 0\n urng = self.upper_inc? ? self : other\n end\n\n bounds = lrng.lower_inc + urng.upper_inc\n self.class.new(lrng.lower, urng.upper, bounds)\n end",
"title": ""
},
{
"docid": "1aab7eac28807f64ab8e9d2e30ba6a45",
"score": "0.6014084",
"text": "def <<(other)\n @range.concat(other.range).uniq!\n self\n end",
"title": ""
},
{
"docid": "065efc6d80cfe55162b2bd0ec3c23c1c",
"score": "0.6003078",
"text": "def add(other)\n case other\n when Range\n add_range(other)\n when IntervalSet\n add_interval_set(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end",
"title": ""
},
{
"docid": "507b9c3741e9f169da3917fe9a1d4d9b",
"score": "0.5980936",
"text": "def add_cut_ranges(*cut_ranges)\n cut_ranges.flatten.each do |cut_range|\n raise TypeError, \"Not of type CutRange\" unless cut_range.kind_of? CutRange\n self.add_cut_range( cut_range )\n end\n end",
"title": ""
},
{
"docid": "4fb681d6fef3bf690ce9c34b0562faf5",
"score": "0.59770143",
"text": "def parse_range(elems)\n before, op, after = rpart(elems) { |e| e.atom?(:range) }\n return parse_additive(elems) if op.nil?\n\n lhs = nonempty!(op, before) { parse_additive(before) }\n rhs = nonempty!(op, after) { parse_range(after) }\n\n AST::Range.make(elems, lhs, rhs)\n end",
"title": ""
},
{
"docid": "bea9d62494c6e93e028145c184d4c116",
"score": "0.58819205",
"text": "def +(o) check_pre(o.range2d?); Union2d[self,o] end",
"title": ""
},
{
"docid": "3298e0f8148e5acb1a7deae3256fd43b",
"score": "0.587198",
"text": "def range_add_edge(item); end",
"title": ""
},
{
"docid": "4b0229cfd2ad5893a6b8529835183773",
"score": "0.5834099",
"text": "def |(range)\n return range | self if range.is XRange\n return XRange.new self, range if !x?(range, true)\n [first, range.first].min..[included_end, range.included_end].max\n end",
"title": ""
},
{
"docid": "2b0118ae288db88b53d495c1669b5379",
"score": "0.583281",
"text": "def include?(number_or_range)\n if Numeric === number_or_range or String === number_or_range\n include_number? number_or_range\n elsif XRange === number_or_range\n number_or_range.include? self\n elsif Range === number_or_range\n include_number? number_or_range.first and include_number? number_or_range.last\n else\n #raise TypeError, \"can not find #{number_or_range.class} in Range\"\n # activerecord 4.0 tells it must not raise\n false\n end\n end",
"title": ""
},
{
"docid": "b47eb258df1a9198b8ff78bebb8e1bcd",
"score": "0.57732075",
"text": "def ranges(flat_args)\n ranges = stringify_range_bounds flat_args.select(&Range.method(:===))\n ranges = remove_subranges explode_multi_case_ranges ranges\n\n merge_ranges(ranges.select(&method(:numeric_range?))) +\n merge_ranges(ranges.select(&method(:character_range?)))\n end",
"title": ""
},
{
"docid": "0554276a130ced8baa7a6bb04695357f",
"score": "0.57431614",
"text": "def protect_range(cells)\n protected_ranges.add_range(cells)\n end",
"title": ""
},
{
"docid": "b93764d90346c3339326ecc51f21acea",
"score": "0.57416326",
"text": "def add_range measurement_name, values\n @ranges[measurement_name].add_range({\n maximum: values[:maximum],\n resolution: values[:resolution],\n error: values[:error],\n digits: values[:digits],\n })\n end",
"title": ""
},
{
"docid": "62bd7a8324ba1a466720017ad0e15b00",
"score": "0.5731437",
"text": "def overlap(new_range, existing_ranges)\n existing_ranges.each do |range|\n return true if range.include?(new_range.first) || range.include?(new_range.last)\n end\n existing_ranges << new_range\n false\n end",
"title": ""
},
{
"docid": "80b9674f354eb3b597b0411ea4ab518a",
"score": "0.5716026",
"text": "def contains_range?(_other)\n false\n end",
"title": ""
},
{
"docid": "b4bed7e5fa4f1be33e7e59600f276caf",
"score": "0.5686979",
"text": "def add_active_range(active_range)\n raise ArgumentError.new(Rack::AARM::DSL::Helpers::ARGUMENTS_BAD) unless active_range.is_a? Rack::AARM::DSL::ActiveRange\n active_ranges << active_range\n self\n end",
"title": ""
},
{
"docid": "50161d3a3ad6c937c1bf9b04df7f497e",
"score": "0.5678666",
"text": "def range(start_range, end_range)\n return [start_range] if start_range == end_range\n\n range(start_range, end_range - 1 ) << end_range\nend",
"title": ""
},
{
"docid": "9cc5ebd1a2c52e1bf34d1a60e32d5444",
"score": "0.5657998",
"text": "def optimize_right_range\n right = operation.right\n return unless left.respond_to?(:range)\n right.to_inclusive if right.overlaps?(left.range)\n end",
"title": ""
},
{
"docid": "60865a810d2817251d31fb25e29b1830",
"score": "0.56459135",
"text": "def include_range?(other)\n return false if (!@ranges || @ranges.empty?)\n return false if !other.ranges || other.ranges.empty?\n\n # Check that all the ranges in +other+ fall within at least one of\n # our ranges.\n other.ranges.all? do |other_range|\n ranges.any? do |range|\n other_range.start.between?(range.start, range.stop) && other_range.stop.between?(range.start, range.stop)\n end\n end\n end",
"title": ""
},
{
"docid": "028cf22a4cb84e119e73e0cc29f7f797",
"score": "0.5630589",
"text": "def merge(other_range)\n return Range.new([self.begin, other_range.begin].min, [self.end, other_range.end].max)\n end",
"title": ""
},
{
"docid": "464c0a352a6fbc3112c62b510d83cc27",
"score": "0.5589403",
"text": "def RangeNode(left, operator, right); end",
"title": ""
},
{
"docid": "19ad52189b8ca418fc3fbbd716e90012",
"score": "0.5568904",
"text": "def from_rangelets\n self.inject([]) {|a,b| a + b.to_a}\n end",
"title": ""
},
{
"docid": "5f9db9889a5742513d0d7f4f83910710",
"score": "0.5540061",
"text": "def reduce_bound_range(_production, _range, _tokens, theChildren)\n low = theChildren[0].token.lexeme\n high = theChildren[2].token.lexeme\n case [low, high]\n when %w[0 1]\n :zero_or_one\n when %w[1 1]\n :exactly_one\n else\n Range.new(low.to_i, high.to_i)\n end\n end",
"title": ""
},
{
"docid": "25eb9e8a4f631fa2baef45722e862ff2",
"score": "0.55365735",
"text": "def +(value)\n range = extract_range_from_value(value)\n\n newfirst = self.first + range.first\n newlast = self.last + range.last\n\n return (newfirst..newlast)\n end",
"title": ""
},
{
"docid": "4d81e13cfdca0c766b13360db2cf3f9e",
"score": "0.5530119",
"text": "def insert num_or_range, val\n key = Range(num_or_range)\n unless key.atom?\n left, right = find_pair(key.first), find_pair(key.last)\n unless left[0] || right[0]\n if left[1] == right[1]\n pair = [key, val]\n @pairs[left[1]...left[1]] = [pair]\n pair\n else\n nil\n end\n else\n nil\n end\n else\n [key, self.[]=(key.first, val)]\n end\n end",
"title": ""
},
{
"docid": "d9740277e948d6a5d1b463834c36eb0f",
"score": "0.55269873",
"text": "def include_with_range?(value)\n if value.is_a?(::Range)\n operator = exclude_end? ? :< : :<=\n end_value = value.exclude_end? ? last.succ : last\n include?(value.first) && (value.last <=> end_value).send(operator, 0)\n else\n include_without_range?(value)\n end\n end",
"title": ""
},
{
"docid": "7320862abf15eee3a66cad680ebafed5",
"score": "0.5490658",
"text": "def ranges=(_arg0); end",
"title": ""
},
{
"docid": "3c325d21fca5f6dd252f298396f80d0b",
"score": "0.54696906",
"text": "def bounding_range(in_range, in_range2)\n\tin_range.range2d? ? combine_range2d(in_range, in_range2) : combine_range(in_range, in_range2)\nend",
"title": ""
},
{
"docid": "b165ba3269d21db97036af41c1925839",
"score": "0.5463539",
"text": "def range(type = :cardinal, first, last)\n first, last = last, first if last < first\n @ranges.fetch(classify(type, first)) { return :other }.fetch(classify(type, last), :other)\n end",
"title": ""
},
{
"docid": "b8f9159b8e5ee47f6e0be564e6a448c6",
"score": "0.54593354",
"text": "def valid_ruby_range?\n !(empty? || exclude_begin? || (STARTLESS_RANGE_NOT_SUPPORTED && !self.begin) || (ENDLESS_RANGE_NOT_SUPPORTED && !self.end))\n end",
"title": ""
},
{
"docid": "689a3d65de514cfeff5da98402c1d435",
"score": "0.54497683",
"text": "def add(rngI,rngS)\n # Convert the ranges to arrays.\n rngI,rngS = self.r2a(rngI), self.r2a(rngS)\n # Add them\n @truncers << [rngI,rngS]\n end",
"title": ""
},
{
"docid": "f35d1581423fe7e25dc9d16c0191a47d",
"score": "0.54494315",
"text": "def add(addition)\n # System.out.println(\"add \"+addition+\" to \"+intervals.toString());\n if (addition.attr_b < addition.attr_a)\n return\n end\n # find position in list\n # Use iterators as we modify list in place\n iter = @intervals.list_iterator\n while iter.has_next\n r = iter.next_\n if ((addition == r))\n return\n end\n if (addition.adjacent(r) || !addition.disjoint(r))\n # next to each other, make a single larger interval\n bigger = addition.union(r)\n iter.set(bigger)\n # make sure we didn't just create an interval that\n # should be merged with next interval in list\n if (iter.has_next)\n next__ = iter.next_\n if (bigger.adjacent(next__) || !bigger.disjoint(next__))\n # if we bump up against or overlap next, merge\n iter.remove # remove this one\n iter.previous # move backwards to what we just set\n iter.set(bigger.union(next__)) # set to 3 merged ones\n end\n end\n return\n end\n if (addition.starts_before_disjoint(r))\n # insert before r\n iter.previous\n iter.add(addition)\n return\n end\n end\n # ok, must be after last interval (and disjoint from last interval)\n # just add it\n @intervals.add(addition)\n end",
"title": ""
},
{
"docid": "aea060b58b49ab1134a3110575360d51",
"score": "0.54331535",
"text": "def add(other)\n overlaps?(other) ? [union(other)] : [other, self]\n end",
"title": ""
},
{
"docid": "192ea875e33790d3b739b7a351c22bee",
"score": "0.5406845",
"text": "def set_range r\n self.range = r\n end",
"title": ""
},
{
"docid": "475b858f7cc84b4cf2d4642ab2bd5f8e",
"score": "0.5398648",
"text": "def add(*new_segments)\n return self + IPAddrRangeSet.new(*new_segments)\n end",
"title": ""
},
{
"docid": "bf930b05ea1e41cf172ca51a7e9bf070",
"score": "0.5376916",
"text": "def union(other)\n case other\n when Range\n union_range(other)\n when IntervalSet\n union_interval_set(other)\n else\n IntervalSet.unexpected_object(other)\n end\n end",
"title": ""
},
{
"docid": "7af72462eee33bec826424dc0fcb62c4",
"score": "0.5366861",
"text": "def int_range name, int_type, i1, i2, *options\n if i1.class == Integer && i2.class == Integer\n parse_tree.append(add_options(\"h.int_range(\" + int_type + ',' + i1.to_s + \", \" + i2.to_s + \")\"))\n # Hammer::Parser.int_range(i1, i2)\n end\n end",
"title": ""
},
{
"docid": "41d0d264804bacf390e7bb73ffac81ef",
"score": "0.536557",
"text": "def range(field, value)\n @value = {:range => {field => value}}\n end",
"title": ""
},
{
"docid": "bbe39aa0194ba6be4cdbab790121fba1",
"score": "0.5348531",
"text": "def inter(var2)\n R::Support.exec_function(R::Support.range, self, var2)\n end",
"title": ""
},
{
"docid": "6fb56c672a88fd216592d8c4ca16b702",
"score": "0.5346618",
"text": "def from_ranges; end",
"title": ""
},
{
"docid": "6fb56c672a88fd216592d8c4ca16b702",
"score": "0.5346618",
"text": "def from_ranges; end",
"title": ""
},
{
"docid": "267753e37de927502924d6fd5051e4bc",
"score": "0.53411216",
"text": "def insert_at_ranges(ranges_to_insert, ranges_at_which_to_insert,\n ranges_to_skip = [])\n return self.dup.insert_at_ranges!(ranges_to_insert, ranges_at_which_to_insert,\n ranges_to_skip)\n end",
"title": ""
},
{
"docid": "85c8add37bddbff2d938d4bac105c35e",
"score": "0.5332011",
"text": "def add_cut_range( p_cut_left=nil, p_cut_right=nil, c_cut_left=nil, c_cut_right=nil )\n @__fragments_current = false\n if p_cut_left.kind_of? CutRange # shortcut\n @cut_ranges << p_cut_left\n else\n [p_cut_left, p_cut_right, c_cut_left, c_cut_right].each { |n| (raise IndexError unless n >= @left and n <= @right) unless n == nil }\n @cut_ranges << VerticalCutRange.new( p_cut_left, p_cut_right, c_cut_left, c_cut_right )\n end\n end",
"title": ""
},
{
"docid": "6f2eb9fbeadb55dc3c9f9af68eddd214",
"score": "0.532564",
"text": "def can_combine?(range1, range2, merge_same_value)\n return merge_same_value if range1.end == range2.begin and range1.exclude_end?\n return range1.end >= range2.begin if @is_float\n return range1.end + 1 >= range2.begin\n end",
"title": ""
},
{
"docid": "77354c82d31006f620c8550efeca6b39",
"score": "0.5319439",
"text": "def to_range\n return @range if @range\n raise(Error, \"cannot create ruby range for an empty PostgreSQL range\") if empty?\n raise(Error, \"cannot create ruby range when PostgreSQL range excludes beginning element\") if exclude_begin?\n # :nocov:\n raise(Error, \"cannot create ruby range when PostgreSQL range has unbounded beginning\") if STARTLESS_RANGE_NOT_SUPPORTED && !self.begin\n raise(Error, \"cannot create ruby range when PostgreSQL range has unbounded ending\") if ENDLESS_RANGE_NOT_SUPPORTED && !self.end\n # :nocov:\n @range = Range.new(self.begin, self.end, exclude_end?)\n end",
"title": ""
},
{
"docid": "01b383ef5b574fda4bada0cbe69f8f9a",
"score": "0.53192246",
"text": "def add_conjunction\n self\n end",
"title": ""
},
{
"docid": "23ae18a3885557f8886366dfa618f544",
"score": "0.5315397",
"text": "def sum_range(i, j)\n \n end",
"title": ""
},
{
"docid": "23ae18a3885557f8886366dfa618f544",
"score": "0.5315397",
"text": "def sum_range(i, j)\n \n end",
"title": ""
},
{
"docid": "23ae18a3885557f8886366dfa618f544",
"score": "0.5315397",
"text": "def sum_range(i, j)\n \n end",
"title": ""
},
{
"docid": "80d10b8019d47597b7918d448142c778",
"score": "0.5312848",
"text": "def add_range_requirement_query(hash_table, range)\n min, max = range.min, range.max\n return if min > max\n @requirement_query.unshift(\"if #{min} <= #{hash_table} and #{hash_table} <= #{max} then\")\n @requirement_query.push(\"end\")\n end",
"title": ""
},
{
"docid": "80d10b8019d47597b7918d448142c778",
"score": "0.5312848",
"text": "def add_range_requirement_query(hash_table, range)\n min, max = range.min, range.max\n return if min > max\n @requirement_query.unshift(\"if #{min} <= #{hash_table} and #{hash_table} <= #{max} then\")\n @requirement_query.push(\"end\")\n end",
"title": ""
},
{
"docid": "2cf4f2310599d33fccb3303bfcd076b3",
"score": "0.5311778",
"text": "def add_shorthand_restriction(field_name, value, negated = false) #:nodoc:\n restriction_type =\n case value\n when Range\n Restriction::Between\n when Array\n Restriction::AnyOf\n else\n Restriction::EqualTo\n end\n add_restriction(field_name, restriction_type, value, negated)\n end",
"title": ""
},
{
"docid": "ecd893bca75aca32589637bfeeeb89d9",
"score": "0.5311691",
"text": "def range\n raise AnyError, \"No range for type #{self}\"\n end",
"title": ""
},
{
"docid": "c7ac3794ad235417b9bd4d6f5fbdeff6",
"score": "0.5307651",
"text": "def add(*terms)\n @term = @term.and(*terms)\n self\n end",
"title": ""
},
{
"docid": "4f97f0dac4a8b282597d2961ffbddd6b",
"score": "0.53043187",
"text": "def update_r(range)\n update(range.rmax)\n update(range.rmin)\n end",
"title": ""
},
{
"docid": "ad1dbc6a940db68ae535605b0f197f0d",
"score": "0.5286889",
"text": "def +(other)\n (first + other)..(last_included + other)\n end",
"title": ""
},
{
"docid": "80e18495c61bf9f5c545b6e3cda88327",
"score": "0.52816975",
"text": "def union(other)\n Interval.union(other.to_interval, self)\n end",
"title": ""
},
{
"docid": "d10fe5f21a4100b93253870a12e08524",
"score": "0.5275164",
"text": "def add( x, y )\n raise \"Bijection: x may not be nil\" if x == nil\n raise \"Bijection: y may not be nil\" if y == nil\n raise \"Bijection: #{x.to_s} already present in domain set X\" if @X.key? x\n raise \"Bijection: #{y.to_s} already present in range set Y\" if @Y.key? y\n @X[x] = y\n @Y[y] = x\n self\n end",
"title": ""
},
{
"docid": "9cd18cc71267198ab109aba28d1a5822",
"score": "0.52701306",
"text": "def unionator(range)\n Unionator.new(self, range)\n end",
"title": ""
},
{
"docid": "df807c46eeeabee7fa114a59b78c4af7",
"score": "0.5267037",
"text": "def ranges; end",
"title": ""
},
{
"docid": "df807c46eeeabee7fa114a59b78c4af7",
"score": "0.5267037",
"text": "def ranges; end",
"title": ""
},
{
"docid": "df807c46eeeabee7fa114a59b78c4af7",
"score": "0.5267037",
"text": "def ranges; end",
"title": ""
},
{
"docid": "df807c46eeeabee7fa114a59b78c4af7",
"score": "0.5267037",
"text": "def ranges; end",
"title": ""
},
{
"docid": "df807c46eeeabee7fa114a59b78c4af7",
"score": "0.5267037",
"text": "def ranges; end",
"title": ""
},
{
"docid": "158d4c503d1148d2be32b9a5de2ee5b8",
"score": "0.52662086",
"text": "def range= range\n @rangehistory << @range if @range\n if range.nil?\n @range = nil\n return self\n end\n if range.is_a? Fixnum\n if range < 0\n raise ArgumentError, \"Range must be nil, an integer offset (1-based), or a Range, not #{range}\"\n end\n \n @range = range..range\n \n elsif range.is_a? Range\n if range.begin < 1 or range.begin > range.end\n raise ArgumentError \"Range must be one-based, with the start before the end, not #{range}\"\n else\n @range = range\n end\n else\n raise ArgumentError, \"Range must be nil, an integer offset (1-based), or a Range, not #{range.inspect}\"\n end\n return self\n end",
"title": ""
},
{
"docid": "b799f3fcebd9183e7a681f45e381d58d",
"score": "0.5264597",
"text": "def post_range(field, options = {})\n post_filter(range: { field => options })\n end",
"title": ""
},
{
"docid": "515830c63d9cbb22d5747cd790a18697",
"score": "0.5264484",
"text": "def compute_overlap range, ranges\n ranges.inject(0) do |memo, other|\n next memo unless intersects? range, other\n lower_bound = range.begin > other.begin ? range.begin : other.begin\n upper_bound = range.end < other.end ? range.end : other.end\n memo += upper_bound - lower_bound\n end\n end",
"title": ""
},
{
"docid": "ae9479ae8fb79cc02b2026b9b2151957",
"score": "0.52611864",
"text": "def range(start_range, end_range)\n return [] if end_range <= start_range\n range(start_range, end_range - 1) << end_range - 1\nend",
"title": ""
},
{
"docid": "115897ad20d65898a09a172feac17d08",
"score": "0.5253714",
"text": "def mark_range_field(range_field)\n # Interface method\n end",
"title": ""
},
{
"docid": "05b816c2fe2b206a39b093a8998e1aea",
"score": "0.5252546",
"text": "def bounding_range(val) check_pre(val.range2d?); Range2d[self.first.bounding_range(val.first),self.last.bounding_range(val.last)] end",
"title": ""
},
{
"docid": "269c2e5f584abdb5e194586864fe10f5",
"score": "0.5226294",
"text": "def bounding_range(val) check_pre(val.range1d?); Range1d[(self.first.min(val.first)),(self.last.max(val.last)) ] end",
"title": ""
},
{
"docid": "951dc2002abd05fb200f22e084a144fc",
"score": "0.52210754",
"text": "def gradient_ranges=(_arg0); end",
"title": ""
},
{
"docid": "f9d24e619fd669277df27a220665db3a",
"score": "0.5214372",
"text": "def update_range(data_series=@data_series)\n\t\tif validate_parameters\n\t\t\tresult = determine_range(data_series)\n\t\t\t@range = result[:range]\n\t\t\t@coefficient_of_range = result[:coefficient_of_range]\n\t\telse\n\t\t\traise RangeError, \"The input parameter must be an array with all numbers\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2ce17104340e8c397015a8f582816953",
"score": "0.52056324",
"text": "def sum_range(left, right)\n @x[right+1] - @x[left]\n \n end",
"title": ""
},
{
"docid": "739721d99f6ebc711bceb892dcad3d69",
"score": "0.52035284",
"text": "def range\n only_with('range', 'NilClass', 'Numeric', 'String', 'DateTime')\n return nil if items.all?(&:nil?)\n\n Range.new(min, max)\n end",
"title": ""
},
{
"docid": "bf79bc86182e46d2a68996a59c76a80f",
"score": "0.5196029",
"text": "def add_shorthand_restriction(negated, field, value)\n restriction_type =\n case value\n when Array then Restriction::AnyOf\n when Range then Restriction::Between\n else Restriction::EqualTo\n end\n add_restriction(negated, field, restriction_type, value)\n end",
"title": ""
},
{
"docid": "7c6f29005593e4f5a21d2ada658174c3",
"score": "0.5190297",
"text": "def range(value)\n deep_merge boolean_wrapper(:range => value)\n end",
"title": ""
},
{
"docid": "e071eb69fafbd92c589235056ae80f9b",
"score": "0.5188281",
"text": "def parens_range(node); end",
"title": ""
},
{
"docid": "a1d5d2507e8a9b4aa9f6112f1616235c",
"score": "0.5185592",
"text": "def input_expression_ranges=(_arg0); end",
"title": ""
},
{
"docid": "a1d5d2507e8a9b4aa9f6112f1616235c",
"score": "0.5185592",
"text": "def input_expression_ranges=(_arg0); end",
"title": ""
},
{
"docid": "b41e9f5602f1aa874183666117d51ec0",
"score": "0.5184282",
"text": "def sum_range(i, j)\r\n \r\n end",
"title": ""
},
{
"docid": "b41e9f5602f1aa874183666117d51ec0",
"score": "0.5184282",
"text": "def sum_range(i, j)\r\n \r\n end",
"title": ""
},
{
"docid": "46b6656d0f366e1d2b5b4440f69402ed",
"score": "0.51826453",
"text": "def query_for_range(relation, attribute, range)\n relation.where(<<-SQL)\n people.#{attribute} BETWEEN '#{range.min}' AND '#{range.max}'\n OR (\n people.#{attribute} is null\n AND rms_people.#{attribute} BETWEEN '#{range.min}' AND '#{range.max}'\n )\n SQL\n end",
"title": ""
},
{
"docid": "be3ac8e14b3b1231e7d25c486a5e169e",
"score": "0.5172629",
"text": "def test_each_range\n s = IntegerSet.new\n s.add(1, 5)\n s.add(10, 20)\n\n b = IntegerRange.new(1, 2)\n\n a = []\n s.each_range do |r|\n assert_equal(b.class, r.class)\n a << r\n end\n\n assert_equal(1, a[0].bottom)\n assert_equal(5, a[0].top)\n assert_equal(10, a[1].bottom)\n assert_equal(20, a[1].top)\n\n s.add(2, 19)\n\n a = []\n s.each_range do |r|\n assert_equal(b.class, r.class)\n a << r\n end\n\n assert_equal(1, a[0].bottom)\n assert_equal(20, a[0].top)\n end",
"title": ""
},
{
"docid": "2cfddff8373bc3daa9fcd4c4d07b0e35",
"score": "0.51647073",
"text": "def register_multirange_type(db_type, opts=OPTS, &block)\n oid = opts[:oid]\n soid = opts[:range_oid]\n\n if has_converter = opts.has_key?(:converter)\n raise Error, \"can't provide both a block and :converter option to register_multirange_type\" if block\n converter = opts[:converter]\n else\n has_converter = true if block\n converter = block\n end\n\n unless (soid || has_converter) && oid\n range_oid, subtype_oid = from(:pg_range).join(:pg_type, :oid=>:rngmultitypid).where(:typname=>db_type.to_s).get([:rngmultitypid, :rngtypid])\n soid ||= subtype_oid unless has_converter\n oid ||= range_oid\n end\n\n db_type = db_type.to_s.dup.freeze\n\n if soid\n raise Error, \"can't provide both a converter and :range_oid option to register\" if has_converter \n raise Error, \"no conversion proc for :range_oid=>#{soid.inspect} in conversion_procs\" unless converter = conversion_procs[soid]\n end\n\n raise Error, \"cannot add a multirange type without a convertor (use :converter or :range_oid option or pass block)\" unless converter\n creator = Creator.new(db_type, converter)\n add_conversion_proc(oid, creator)\n\n @pg_multirange_schema_types[db_type] = db_type.to_sym\n\n singleton_class.class_eval do\n meth = :\"typecast_value_#{db_type}\"\n scalar_typecast_method = :\"typecast_value_#{opts.fetch(:scalar_typecast, db_type.sub('multirange', 'range'))}\"\n define_method(meth){|v| typecast_value_pg_multirange(v, creator, scalar_typecast_method)}\n private meth\n end\n\n @schema_type_classes[db_type] = PGMultiRange\n nil\n end",
"title": ""
},
{
"docid": "11961dbe88923b59a4716ca08b8347c8",
"score": "0.51593643",
"text": "def range(*args)\n value = \"[\"\n args.each_slice(2) do |from, to|\n from = sanitize(from)\n to = sanitize(to)\n value += \"#{from}-#{to}\"\n end\n value += \"]\"\n add(value)\n end",
"title": ""
},
{
"docid": "1ced0bd18079708a41afd39c810360f4",
"score": "0.51588386",
"text": "def merge_range(*args)\n if (row_col_array = row_col_notation(args.first))\n row_first, col_first, row_last, col_last = row_col_array\n string, format, *extra_args = args[1..-1]\n else\n row_first, col_first, row_last, col_last,\n string, format, *extra_args = args\n end\n\n raise \"Incorrect number of arguments\" if [row_first, col_first, row_last, col_last, format].include?(nil)\n raise \"Fifth parameter must be a format object\" unless format.respond_to?(:xf_index)\n raise \"Can't merge single cell\" if row_first == row_last && col_first == col_last\n\n # Swap last row/col with first row/col as necessary\n row_first, row_last = row_last, row_first if row_first > row_last\n col_first, col_last = col_last, col_first if col_first > col_last\n\n # Check that the data range is valid and store the max and min values.\n check_dimensions(row_first, col_first)\n check_dimensions(row_last, col_last)\n store_row_col_max_min_values(row_first, col_first)\n store_row_col_max_min_values(row_last, col_last)\n\n # Store the merge range.\n @merge << [row_first, col_first, row_last, col_last]\n\n # Write the first cell\n write(row_first, col_first, string, format, *extra_args)\n\n # Pad out the rest of the area with formatted blank cells.\n write_formatted_blank_to_area(row_first, row_last, col_first, col_last, format)\n end",
"title": ""
},
{
"docid": "ed3ea8546b1869e0fa735df615d16915",
"score": "0.5157792",
"text": "def us_grade_range=(range=[])\n audience_range_set(11, range[0], range[1])\n end",
"title": ""
},
{
"docid": "cc1c2b53182de65f376786f704df7b3e",
"score": "0.5156499",
"text": "def map_range(a, b, s)\n af, al, bf, bl = a.first, a.last, b.first, b.last\n bf + (s - af)*(bl - bf).quo(al - af)\nend",
"title": ""
},
{
"docid": "8ba22f18158a87551ffd83ddaeff273c",
"score": "0.5153592",
"text": "def range_type(type, start_value, end_value, args, block)\n filter_size_before = filter.size\n range(start_value, end_value, args, block)\n (filter.size - filter_size_before).times { types << type }\n end",
"title": ""
},
{
"docid": "4daad8fc333c0ba2c91162969b3bb6f8",
"score": "0.51527375",
"text": "def audience_range_set(type, min=nil, max=nil)\n a = audience_range(type)\n\n # create a new audience_range record if we need to\n if a.nil?\n a = ONIX::AudienceRange.new\n a.audience_range_qualifier = type\n product.audience_ranges << a\n end\n\n unless min.nil?\n a.audience_range_precisions << \"03\"\n a.audience_range_values << min\n end\n unless max.nil?\n a.audience_range_precisions << \"04\"\n a.audience_range_values << max\n end\n a.audience_range_precisions = [\"01\"] if min.nil? || max.nil?\n end",
"title": ""
},
{
"docid": "b506ea9d12716a7209fbdc4a41489f10",
"score": "0.51506925",
"text": "def bounding_range(r2)\n if (self.range1d? and r2.range1d?) then\n first = (self.first.int).find_min(r2.first.int)\n last = (self.last.int).find_max(r2.last.int)\n Range1d[Point1d[first],Point1d[last]]\n elsif \n (self== Range2d and r2== Range2d) then\n x_first = (self.x_range.first.int).find_min(r2.x_range.first.int)\n x_last = (self.x_range.last.int).find_max(r2.x_range.last.int)\n x_range_new = Range1d[Point1d[x_first], Point1d[x_last]]\n y_first = (self.y_range.first.int).find_min(r2.y_range.first.int)\n y_last = (self.y_range.last.int).find_max(r2.y_range.last.int)\n y_range_new = Range1d[Point1d[y_first], Point1d[y_last]]\n Range2d[x_range_new, y_range_new]\n else\n check_pre((false))\n end\nend",
"title": ""
},
{
"docid": "b506ea9d12716a7209fbdc4a41489f10",
"score": "0.51506925",
"text": "def bounding_range(r2)\n if (self.range1d? and r2.range1d?) then\n first = (self.first.int).find_min(r2.first.int)\n last = (self.last.int).find_max(r2.last.int)\n Range1d[Point1d[first],Point1d[last]]\n elsif \n (self== Range2d and r2== Range2d) then\n x_first = (self.x_range.first.int).find_min(r2.x_range.first.int)\n x_last = (self.x_range.last.int).find_max(r2.x_range.last.int)\n x_range_new = Range1d[Point1d[x_first], Point1d[x_last]]\n y_first = (self.y_range.first.int).find_min(r2.y_range.first.int)\n y_last = (self.y_range.last.int).find_max(r2.y_range.last.int)\n y_range_new = Range1d[Point1d[y_first], Point1d[y_last]]\n Range2d[x_range_new, y_range_new]\n else\n check_pre((false))\n end\nend",
"title": ""
},
{
"docid": "b506ea9d12716a7209fbdc4a41489f10",
"score": "0.51506925",
"text": "def bounding_range(r2)\n if (self.range1d? and r2.range1d?) then\n first = (self.first.int).find_min(r2.first.int)\n last = (self.last.int).find_max(r2.last.int)\n Range1d[Point1d[first],Point1d[last]]\n elsif \n (self== Range2d and r2== Range2d) then\n x_first = (self.x_range.first.int).find_min(r2.x_range.first.int)\n x_last = (self.x_range.last.int).find_max(r2.x_range.last.int)\n x_range_new = Range1d[Point1d[x_first], Point1d[x_last]]\n y_first = (self.y_range.first.int).find_min(r2.y_range.first.int)\n y_last = (self.y_range.last.int).find_max(r2.y_range.last.int)\n y_range_new = Range1d[Point1d[y_first], Point1d[y_last]]\n Range2d[x_range_new, y_range_new]\n else\n check_pre((false))\n end\nend",
"title": ""
},
{
"docid": "b506ea9d12716a7209fbdc4a41489f10",
"score": "0.51506925",
"text": "def bounding_range(r2)\n if (self.range1d? and r2.range1d?) then\n first = (self.first.int).find_min(r2.first.int)\n last = (self.last.int).find_max(r2.last.int)\n Range1d[Point1d[first],Point1d[last]]\n elsif \n (self== Range2d and r2== Range2d) then\n x_first = (self.x_range.first.int).find_min(r2.x_range.first.int)\n x_last = (self.x_range.last.int).find_max(r2.x_range.last.int)\n x_range_new = Range1d[Point1d[x_first], Point1d[x_last]]\n y_first = (self.y_range.first.int).find_min(r2.y_range.first.int)\n y_last = (self.y_range.last.int).find_max(r2.y_range.last.int)\n y_range_new = Range1d[Point1d[y_first], Point1d[y_last]]\n Range2d[x_range_new, y_range_new]\n else\n check_pre((false))\n end\nend",
"title": ""
},
{
"docid": "b506ea9d12716a7209fbdc4a41489f10",
"score": "0.51506925",
"text": "def bounding_range(r2)\n if (self.range1d? and r2.range1d?) then\n first = (self.first.int).find_min(r2.first.int)\n last = (self.last.int).find_max(r2.last.int)\n Range1d[Point1d[first],Point1d[last]]\n elsif \n (self== Range2d and r2== Range2d) then\n x_first = (self.x_range.first.int).find_min(r2.x_range.first.int)\n x_last = (self.x_range.last.int).find_max(r2.x_range.last.int)\n x_range_new = Range1d[Point1d[x_first], Point1d[x_last]]\n y_first = (self.y_range.first.int).find_min(r2.y_range.first.int)\n y_last = (self.y_range.last.int).find_max(r2.y_range.last.int)\n y_range_new = Range1d[Point1d[y_first], Point1d[y_last]]\n Range2d[x_range_new, y_range_new]\n else\n check_pre((false))\n end\nend",
"title": ""
}
] |
6145d2dcaa268c3aefeecbb70fa47daa
|
This will print all PT's whether finished or not. This can not be run until the charts have been processed. After the start button has run and after the builder button has been pressed. This link should probably be on the chartscharting page.
|
[
{
"docid": "c651e04aa0a4f9493ca56964873c454e",
"score": "0.5562404",
"text": "def pt_print\n @task = Task.includes(:assignment).find(params[:task_id])\n @assignment = @task.assignment\n @titles = Title.build_paragraph_title_collection(@task.id,current_user.id)\n end",
"title": ""
}
] |
[
{
"docid": "4a6e54a8ea96995cc231c3ca9df9f3b3",
"score": "0.6632965",
"text": "def printall\n @assignment = Assignment.find(params[:assignment_id])\n @tasks = Task.where(\"assignment_id = ? and task_type = ?\",@assignment.id,1).all\n @chart = Task.where(\"assignment_id = ? and task_type = ?\",@assignment.id,3).first\n if @chart\n check_state_and_update\n build_all_charts(@chart.id,current_user.id)\n @verticals = Title.get_segments(@chart.id,current_user.id)\n end\n\n end",
"title": ""
},
{
"docid": "ff844ebe24c93c312fe4c702b38b155e",
"score": "0.6015343",
"text": "def print\n @steps = @experiment.steps\n \n # renders the print template without the normal layout\n render :layout => false;\n end",
"title": ""
},
{
"docid": "eba8a02ef8aac9e03579461815d85aa3",
"score": "0.59244347",
"text": "def printallcentered\n @assignment = Assignment.find(params[:assignment_id])\n @tasks = Task.where(\"assignment_id = ? and task_type = ?\",@assignment.id,1).all\n @chart = Task.where(\"assignment_id = ? and task_type = ?\",@assignment.id,3).first\n if @chart\n check_state_and_update\n build_all_charts(@chart.id,current_user.id)\n @verticals = Title.get_segments(@chart.id,current_user.id)\n end\n\n end",
"title": ""
},
{
"docid": "a2d3737e5f41ea30c6f504764b670b7d",
"score": "0.59163237",
"text": "def print_progress\n @data[\"print_progress\"]\n end",
"title": ""
},
{
"docid": "523b64c0da01d0e92b759f5d70bb11a2",
"score": "0.586387",
"text": "def results\r\n print_books\r\n print_toys\r\n print_classes\r\n end",
"title": ""
},
{
"docid": "af5a955bd72886f9fc46ce1419e4ef93",
"score": "0.5825597",
"text": "def print_results\n Report::print(@result_set)\n end",
"title": ""
},
{
"docid": "a3e25fb88b2d08f3dd7ad8902b295f3f",
"score": "0.5815895",
"text": "def printout()\n user_training_rows = @user_training.user_training_rows\n .includes(:exercise, :training_step_type)\n .sort_by_part_order\n .all\n if user_training_rows.size < 1\n flash[:error] = I18n.t(:no_detail_to_process)\n redirect_to( user_trainings_path() ) and return\n end\n title = I18n.t('trainings.show_title').gsub( \"{TRAINING_TITLE}\", @user_training.description )\n\n # == OPTIONS setup + RENDERING phase ==\n base_filename = \"#{I18n.t('trainings.training')}_#{@user_training.description}\"\n filename = create_unique_filename( base_filename ) + '.pdf'\n options = {\n report_title: title,\n meta_info_subject: 'training model printout',\n meta_info_keywords: \"Goggles, #{base_filename}\",\n header_row: TrainingDecorator.decorate( @user_training ),\n detail_rows: TrainingRowDecorator.decorate_collection( user_training_rows )\n }\n send_data( # == Render layout & send data:\n TrainingPrintoutLayout.render( options ),\n type: 'application/pdf',\n filename: filename\n )\n end",
"title": ""
},
{
"docid": "4c6d9d28d7249d759807eecd3a95b77e",
"score": "0.57933885",
"text": "def show_results(generated_files: true)\n @end_time = Time.now\n tree = if generated_files\n [' ',\n \"Generated files: #{@out_dir}\",\n ' ',\n TTY::Tree.new(@out_dir).render]\n else\n ''\n end\n puts\n puts TTY::Box.frame(\"Start : #{@start_time}\",\n \"End : #{@end_time}\",\n \"Time : #{@end_time - @start_time} sec\",\n *tree,\n title: { top_left: \" #{self.class.name} \" },\n width: TTY::Screen.width, padding: 1)\n end",
"title": ""
},
{
"docid": "0732347a27c9b0e70cebc61c78a43f22",
"score": "0.5721465",
"text": "def print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # datas\n @status = (params[:status] ? params[:status] : ['wait', 'develop', 'test', 'completed'])\n @collaborators = (params[:collaborators] ? params[:collaborators] : @project.collaborators.ids)\n @start_date = params[:start_date]\n @end_date = params[:end_date]\n @show_expected_time = (params[:show_expected_time] === '1')\n # find tasks\n @tasks = @project.tasks.where(status: @status, collaborator_id: @collaborators)\n unless @start_date.blank?\n @tasks = @tasks.where('start_date >= ?', @start_date.to_date)\n end\n unless @end_date.blank?\n @tasks = @tasks.where('end_date <= ?', @end_date.to_date)\n end\n # disable layout\n render layout: false\n end",
"title": ""
},
{
"docid": "ff50fdaefe716fa08d57a100485afb70",
"score": "0.5712681",
"text": "def print_final_report\n puts; puts; puts \"=== FINAL DATABASE COUNTS ===\"\n puts; puts end_of_task_report\n puts; puts; puts \"=== BY SCHOOL ===\"\n puts by_school_report\n puts; AssessmentsReport.new.print_report\n end",
"title": ""
},
{
"docid": "88024c7cae59874057431cca6b92f832",
"score": "0.56549436",
"text": "def show\n @print_jobs = PrintJob.all\n \n end",
"title": ""
},
{
"docid": "f8b9491d95c95ae01ebf98c5b96e313d",
"score": "0.56391966",
"text": "def print\n @planning.draw\n @segments.each do |s|\n s.draw(@drawer)\n end\n @points.each do |p|\n @drawer.draw_circle(p.x, p.y, 3)\n end\n end",
"title": ""
},
{
"docid": "411e513f110249b0361e241cf7c70cf4",
"score": "0.5629436",
"text": "def show\n calculate_progress\n ##complete_goal\n end",
"title": ""
},
{
"docid": "399c646d3fdea6601b9b792e114333f1",
"score": "0.5615066",
"text": "def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now} #{@options}\" }\n raise 'Missing required options' unless @options[:url] && @options[:datapoint_id] && @options[:project_id]\n send_status('Complete')\n send_file(\"#{@options[:output_directory]}/run.log\")\n Dir.glob(\"#{@options[:output_directory]}/../reports/*\").each do |f|\n next if File.basename(f) == 'view_model_report.json'\n\n send_file(f)\n end\n end",
"title": ""
},
{
"docid": "cdeacadb8c0e43a11707d7f13e5501ef",
"score": "0.56108314",
"text": "def all\n Print.print_all\n end",
"title": ""
},
{
"docid": "c43c822b168e998b6f48dbc2f80cdaee",
"score": "0.5610378",
"text": "def print\n results :print => true\n end",
"title": ""
},
{
"docid": "c74cd65ecd2c45dd0f6018a99ee9aec8",
"score": "0.55648136",
"text": "def show\n @chart_data0 = make_chart_data(@progress.company_name,0)\n @chart_data1 = make_chart_data(@progress.company_name,1)\n @chart_data2 = make_chart_data(@progress.company_name,2)\n end",
"title": ""
},
{
"docid": "ebfe945b9bc30c412d8dbcc7ad83ba53",
"score": "0.55617136",
"text": "def done\n puts \"this is done\"\n #puts @runtime.to_yaml\n p @runtime.results\n end",
"title": ""
},
{
"docid": "470045f89f722f1ae728ceef7deb1406",
"score": "0.55360967",
"text": "def print_status\n next_run = ((@@next_task-Time.now)/60.0).round(2)\n\n print \"\\r\"\n print \"#{Time.now} #{[@chains.count,@steps_done].min}/#{@chain_count} chains active - #{@chains.sum(&:remaining_task_count)}/#{@task_count} Tasks remaining - Next task will run in #{next_run} minutes\"\n\n EM.add_timer 1, proc {\n print_status\n }\n end",
"title": ""
},
{
"docid": "a1403d8a4d4cd5cb3fa61c0b22d1d10b",
"score": "0.5520763",
"text": "def print_results_forever(wait_between_print=5)\r\n while(1) do\r\n print_results\r\n sleep wait_between_print\r\n end\r\n end",
"title": ""
},
{
"docid": "ff1f1138688f3146cfcf6d51768aee5b",
"score": "0.5514814",
"text": "def prints\n tiros = @tiros\n tiros.each do |tiro_puntaje|\n puts \"Puntaje por tiro: #{tiro_puntaje}\"\n end\n end",
"title": ""
},
{
"docid": "ca2f381fc7dc5aea917acd3b22acbfd1",
"score": "0.5505399",
"text": "def print_out_all_items\n list_header(title)\n to_do_list.each do |item|\n item.print_details\n end\n puts (\"Task list completed #{to_do_list_completed?}\")\n end",
"title": ""
},
{
"docid": "b6fba285da83b464a7fce1badb4f6873",
"score": "0.54970026",
"text": "def print_planets\n puts \"\\n#{@name} has #{@planets.length} planets and was formed #{@formation_year} years ago.\"\n puts \"\\nHere are the planets in the #{@name} solar system:\\n\\n\"\n @planets.each do |planet|\n puts \"#{planet.print_planet_data}\"\n end\n puts \"\\n\"\n end",
"title": ""
},
{
"docid": "8fa469ba36fe42d3cb5d114be8dbb38d",
"score": "0.54846203",
"text": "def no_more_jobs\n @output.puts\"</table>\"\n @output.puts\"</body>\"\n @output.puts\"</html>\"\n @output.close\n end",
"title": ""
},
{
"docid": "ba4c047de4e10195dfd6ec37137e2dbf",
"score": "0.54515254",
"text": "def print_results\n UI.puts results_message\n end",
"title": ""
},
{
"docid": "57300c5bfa4e7e28d383b1248fbf87ed",
"score": "0.54459983",
"text": "def board_visualization\n @players.each do|x|\n print_lane\n x.print_progress\n end\n return nil\n end",
"title": ""
},
{
"docid": "5d551cf46e50eb81a4486945bd4dac32",
"score": "0.5391899",
"text": "def print_all_tasks\n tasks = retrieve_tasks\n @values[:result] = Array.new()\n tasks.each_key { |key|\n print_tasks_to_key(tasks[key]) if (tasks[key].size > 0)\n }\n end",
"title": ""
},
{
"docid": "45e8d6ff938c4aabc80c86bd711ff714",
"score": "0.536815",
"text": "def display_results\n\n title1 = sprintf(TITLE_ROW, \"METH\", \"PATH\", \"CALLED\", \"RESPONSE TIME(ms)\",\"\", \"\", \"\", \"\",\"\",\"\", \"DYNO\", \"MESSAGE\", \"SIZE\")\n puts(title1)\n printf(TITLE_ROW, \"\", \"\", \"Times\", \"Mean\",\" : \",\"Median\",\" : \",\"Mode\",\" : \", \"Range\", \"Busiest\", \"Average\", \"Max\")\n puts('-'*title1.length)\n @endpoints.each do | ep |\n if ep.called == 0 then\n printf(TITLE_ROW, ep.ep_method,ep.ep_path, \" Never\", \" \",\" : \",\" \",\" : \",\" \",\" : \", \" \", \" \", \" \", \" \")\n else\n printf(DATA_ROW,\n ep.ep_method,\n ep.ep_path,\n ep.called,\n ep.averages[:responses].mean,\n ep.averages[:responses].median,\n ep.averages[:responses].mode,\n ep.averages[:responses].range,\n ep.busiest_dyno,\n ep.averages[:bytes].mean,\n ep.averages[:bytes].hi)\n end\n end\n\n if @endpoints.unprocessed_lines > 0\n puts \"There were #{@endpoints.unprocessed_lines} Unprocessed Lines of data from #{@loglines} total lines in the log!\"\n else\n puts \"All #{@loglines} total lines in the log were processed!\"\n end\n end",
"title": ""
},
{
"docid": "edc6aa47da43c75072d36366dadba8a8",
"score": "0.53456146",
"text": "def dump_results\n progress('END')\n t = total\n\n if config.live_logging || false === config.print_limit || t > config.print_limit.to_f\n log_header(true)\n @buffer.each { |message| log_line(message) }\n log_footer(t)\n end\n end",
"title": ""
},
{
"docid": "0580716f4f8daf5ca0e96cc7114a0427",
"score": "0.5344306",
"text": "def print_internal_stats(final=false)\n #\n # Find and print any incompleted jobs\n #\n if final\n task_groups = Message.job_stats.incomplete_jobs.group_by { |jt| jt.message.task.name }\n task_groups.reject! { |k, v| config.lookup_task(k).producer? } # We don't track producers\n avg_defer_times = { }\n task_groups.each_pair do |k,v|\n logger.raw \"#{k}: incompleted jobs (#{v.length}):\"\n v.each do |jt|\n body = jt.message.opaque_obj.dereference\n str = format(\"[%1d:%5d] Sent -- Recevied %s - %s Eval Started -- Completed %s -- %s Thread: %s Msg Body: %s\\n\",\n proc_id, jt.id, jt.fmt(:sent_at), jt.fmt(:received_at), jt.fmt(:eval_started_at), jt.fmt(:eval_completed_at), jt.last_thread, body.to_s)\n logger.raw(str)\n end\n end\n end\n #\n # Compute Average Defer Time by Task\n #\n logger.raw(\"Average defer times by task\\n\\n\")\n avg_defer_times = Message.job_stats.average_defer_times\n lines = avg_defer_times.map { |k,v| format(\"%24s: %3.2f\", k, v) }\n logger.raw(lines.join(\"\\n\"))\n #\n # General global stats\n #\n sent = Message.sent_messages\n recv = Message.received_messages\n line = format(\"Messages sent:recv %5d:%5d Jobs:Queued:Results %5d:%5d:%5d\\n\",\n sent, recv, jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(line)\n #\n # Thread Pool\n #\n logger.raw(\"Thead Stats\\n\")\n logger.raw(\" Thread Pool\\n\")\n lines = thpool.members.map { |th| \" #{th[:name]}: \\t #{th.status}\" }\n logger.raw(lines.join(\"\\n\"))\n #\n # Consumer threads\n #\n logger.raw(\" Consumer Threads\\n\")\n lines = consumers.map { |c| th = c.thread; \" #{th[:name]}: \\t #{th.status}\" }\n logger.raw(lines.join(\"\\n\"))\n #\n # Test for activity\n #\n activity = activity?(jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(\"\\nactivity? reports #{activity ? 'SOME' : 'NO'} activity\\n\")\n end",
"title": ""
},
{
"docid": "d04a3d9dabfc02d7c4712876e2ef53cc",
"score": "0.5321051",
"text": "def calculate_results\n Logger.info \"Probing finished. Calculating results.\"\n calculate_startup_time\n calculate_results_stalling\n calculate_results_switching\n print_results\n # TODO what to do with the results?\n end",
"title": ""
},
{
"docid": "343419650df17f2a02288289a4995340",
"score": "0.531796",
"text": "def print_all( print_result )\n print_result.each do |print_output|\n puts print_output\n end\nend",
"title": ""
},
{
"docid": "f9c8a25be9cbfa9a33beeea5560c06cd",
"score": "0.5306232",
"text": "def call\n timer do\n fetch_gems_data\n GemsBond::Printers::HTML.new(gems).call\n GemsBond::Printers::CSV.new(gems).call\n end\n end",
"title": ""
},
{
"docid": "4f52151e2587ec3c27b008992840f400",
"score": "0.5299423",
"text": "def printer( names )\n print_all( batch_badge_creator(names))\n print_all( assign_rooms(names))\n\n true # doing this so it doesnt return the last print value\nend",
"title": ""
},
{
"docid": "20c384472696565ef5f11c76bfbde644",
"score": "0.5285884",
"text": "def iterate\n fill_first_task\n step until status.finished?\n save_tree if @printing\n end",
"title": ""
},
{
"docid": "1828c69fbe517e7a9853b6e4ae9f57a2",
"score": "0.52748644",
"text": "def do_print\n @printer.exec(@buddy)\n end",
"title": ""
},
{
"docid": "c60eb069dc24714f3766d2a61b46d8b6",
"score": "0.52623373",
"text": "def display_results\n print_header\n print_detailed_report\n write_csv_report\n display_status\n end",
"title": ""
},
{
"docid": "f224b6200a4c4530a45434c5a80e6f2e",
"score": "0.52477",
"text": "def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend",
"title": ""
},
{
"docid": "c3a807cf92091215b541ce28d2f1db0e",
"score": "0.524431",
"text": "def print_progress_bar_at i\n if (i%PROGRESSOR_SAMPLE_PERIOD == 0)\n print '.'\n $stdout.flush\n end\nend",
"title": ""
},
{
"docid": "318c189a3abf4e0e48e5b4db343f1fe1",
"score": "0.5243864",
"text": "def trail_printer(trail_instance)\n trail_instance.print_info\n 15.times {print \"*\"}\n print \"\\n\"\n end",
"title": ""
},
{
"docid": "b213a088c05ec45b8ce3fc4871413df4",
"score": "0.5218732",
"text": "def publish_results\n # @contest is fetched by CanCan\n\n # Define params for PDF output\n prawnto filename: \"ergebnisliste#{random_number}\", prawn: { page_size: 'A4', skip_page_creation: true }\n @contest_category = ContestCategory.find(params[:contest_category_id]) if params[:contest_category_id]\n @age_group = params[:age_group] if params[:age_group]\n @performances = @contest.performances\n .where(contest_category_id: @contest_category, age_group: @age_group)\n .accessible_by(current_ability)\n .order(:stage_time)\n end",
"title": ""
},
{
"docid": "fb7d3e099283b7fac841283f0242b32f",
"score": "0.5208989",
"text": "def print_s1\n stories.each do |story|\n show_new_story_notification(story[:title], story[:category], story[:upvotes])\n end\nend",
"title": ""
},
{
"docid": "e85dd5851e71dcb328b4eaa14092ce2c",
"score": "0.5195836",
"text": "def index\n @tbdotreports = Tbdotreport.new\n @tbdotreports.drawDotsGraph(\"work\")\n end",
"title": ""
},
{
"docid": "9780649668f5b1e8ea38306db24f8baa",
"score": "0.51855105",
"text": "def paused_job_buttons_xhtml\n if @paused.empty?\n [body_row(\"None\")]\n else\n names = @paused.collect { | ar | ar.job.full_name }.sort\n names.collect { | name | \n body_row(submit('name', name))\n }\n end\n end",
"title": ""
},
{
"docid": "7e04db69b1aa3ea74cf4c1f22ae7c151",
"score": "0.5182513",
"text": "def show_progress\n\t\t\t# bar_size is between 0 and 30\n finish_size = (((@top_card-12).to_f / (@deck.length-11).to_f) * 30).to_i\n\t\t\tremain_size = 30 - finish_size\n\t\t\tprint \"\\nProgress: \"\n\t\t\tfinish_size.times {print '▓'}\n\t\t\tremain_size.times {print '░'}\n\t\t\tputs\n\t\t\tputs\n end",
"title": ""
},
{
"docid": "34430b61216e275115cc47bdf0875750",
"score": "0.51661366",
"text": "def debug_final_report\n case\n when @debug_level > 0\n puts \"\\nSuccess at: \\t#{@current_point.to_a}\"\n ptus \"Cost: \\t\\t#{@current_cost}\"\n end\n end",
"title": ""
},
{
"docid": "0f048ff6c814edd9acf1386d5868d706",
"score": "0.5163236",
"text": "def print_tasks_in_interval\n tasks = retrieve_tasks\n @values[:result] = Array.new()\n print_tasks_to_key(tasks[:during])\n end",
"title": ""
},
{
"docid": "785bee20510c08540ca01418a692d888",
"score": "0.5161003",
"text": "def progress(status)\n #For each SUT\n $sut.each do |ip, sut|\n #We check the status that we determined earlier,\n #depending on it we call the progress functions\n if status[ip]['status'] == 'Autotest'\n autotestprogress(status, sut, ip)\n elsif status[ip]['status'] == 'Stability'\n stabilityprogress(status, sut, ip)\n elsif status[ip]['status'] == 'CanWakeupTest'\n status[ip]['progress'] == 'Not implemented'\n elsif status[ip]['status'] == 'Manual'\n #If the test is manual, we just say it is not implemented yet. Do not know if it ever will,\n #because it is kind of impossible to know where manual test results will be saved.\n status[ip]['progress'] = 'Not implemented'\n elsif status[ip]['status'] == \"Idle\"\n latest = `ls -td #{$autotestpath}#{sut[:name]}*/ | head -n 1`[0...-1]\n latest = `ls -td #{latest}2017*/ | head -n 1`[0...-1]\n failed = `find #{latest} -name *TestRun.txt`[0...-1]\n if failed == '' && latest != ''\n status[ip]['progress'] = \"Last test failed to proceed\"\n status[ip]['progresscolor'] = \"color:red;\"\n else\n #Idle will be shown as empty in progress tab\n status[ip]['progress'] = ' '\n status[ip]['progresscolor'] = \"color:white;\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "0f0dccde77f898d510d74f0d42bb70ea",
"score": "0.5156701",
"text": "def write_to_screen!\n puts report_title\n puts report_body.lines.take(show_count)\n end",
"title": ""
},
{
"docid": "00b5aa1cb9fbd7c4f95192f60b0e52bc",
"score": "0.5136145",
"text": "def print_hosts\n\t\t@hosts.each do |id,values|\n\t\t\tFile.open(@options[:output] + \"/host_\" + id.to_s + \".html\", 'w') do |f|\n\n\t\t\t\thtml_header(f,values[:ip])\n\n\t\t\t\tif values[:total_excl_info] == 0\n\t\t\t\t\tpie_js(f,\"pie_graph\",\"Criticality Breakdown\",\"Criticality Breakdown\",[['Informational ONLY',values[:info].to_i,'blue']])\n\t\t\t\telse\n\t\t\t\t\tpie_data = []\n\t\t\t\t\tpie_data << ['Info',values[:info].to_i,'blue'] if @options[:severity] <= 0 and values[:info].to_i >= 0\n\t\t\t\t\tpie_data << ['Low',values[:low].to_i,'green'] if @options[:severity] <= 1 and values[:low].to_i > 0\n\t\t\t\t\tpie_data << ['Medium',values[:med].to_i,'orange'] if @options[:severity] <= 2 and values[:med].to_i > 0\n\t\t\t\t\tpie_data << ['High',values[:high].to_i,'red'] if @options[:severity] <= 3 and values[:high].to_i > 0\n\t\t\t\t\tpie_data << ['Critical',values[:crit].to_i,'purple'] if @options[:severity] <= 4 and values[:crit].to_i > 0\n\t\t\t\t\tpie_js(f,\"pie_graph\",\"Criticality Breakdown\",\"Criticality Breakdown\",pie_data,\"document.location.href = '#' + event.point.name;\")\n\t\t\t\tend\n\n\t\t\t\tclose_html_header(f)\n\n\t\t\t\tbody = '<a href=\"index.html\">Home</a><br /><div id=\"host\" style=\"font-family: Arial, Helvetica, sans-serif\"><div id=\"overview\">Hostname: ' + values[:hostname] + '<br />IP: ' + values[:ip] + '<br />OS: ' + values[:os] + '<br /></div>'\n\t\t\t\tbody += '<div id=\"graphs\"><h2>Overview</h2>'\n\t\t\t\tbody += '<div id=\"pie_graph\" style=\"min-width: 400px; height: 400px; margin: 0 auto\"></div>'\n\t\t\t\tbody += '</div>'\n\n\t\t\t\tbody += '<div id=\"vulns\"><h2>Vulnerabilities</h2>'\n\n\n\t\t\t\tif @options[:severity] <= 4 and values[:crit].to_i > 0\n\t\t\t\t\tbody += '<div id=\"critical\"><a name=\"Critical\"></a><h3>Critical</h3>'\n\n\t\t\t\t\tbody += '<table id=\"critical_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\t@events.sort_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 4\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 3 and values[:high].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"high\"><a name=\"High\"></a><h3>High</h3>'\n\n\t\t\t\t\tbody += '<table id=\"high_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\t@events.sort_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 3\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 2 and values[:med].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"medium\"><a name=\"Medium\"></a><h3>Medium</h3>'\n\n\t\t\t\t\tbody += '<table id=\"medium_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\t@events.sort_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 2\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 1 and values[:low].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"low\"><a name=\"Low\"></a><h3>Low</h3>'\n\n\t\t\t\t\tbody += '<table id=\"low_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\t@events.sort_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 1\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\t\t\t\tif @options[:severity] <= 0 and values[:info].to_i > 0\n\n\t\t\t\t\tbody += '<div id=\"informational\"><a name=\"Informational\"></a><h3>Informational</h3>'\n\n\t\t\t\t\tbody += '<table id=\"informational_table\" class=\"display\"><thead><tr><th>Nessus ID</th><th>Name</th><th>Synopsis</th><th>Result</th><th>Family</th><th>Port</th></tr></thead><tbody>'\n\t\t\t\t\t@events.sort_by{|k,v| v[:port].to_s}.each do |vuln_id,vuln_data|\n\t\t\t\t\t\tvuln_data[:ports].each {|k,v|\n\t\t\t\t\t\t\tv[:hosts].each do |h,v2|\n\t\t\t\t\t\t\t\tif h == id and vuln_data[:severity] == 0\n\t\t\t\t\t\t\t\t\tbody += '<tr><td><a href=\"vuln_' + vuln_id.to_s + '.html\">' + vuln_id.to_s + '</a></td><td>' + vuln_data[:plugin_name] + '</td><td>' + vuln_data[:synopsis] + '</td><td>' + v2.to_s.gsub(/<\\/?[^>]*>/, \"\").gsub(\"\\n\",\"<br />\") + '</td><td>' + vuln_data[:family] + '</td><td>' + k.to_s + '</td></tr>'\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t\tbody += '</tbody></table></div>'\n\t\t\t\tend\n\n\n\t\t\t\tbody += \"<script>$(document).ready(function() {\\n \";\n\t\t\t\tbody += \"$('#critical_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 4\n\t\t\t\tbody += \"$('#high_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 3\n\t\t\t\tbody += \"$('#medium_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 2\n\t\t\t\tbody += \"$('#low_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 1\n\t\t\t\tbody += \"$('#informational_table').dataTable({\\\"bPaginate\\\": false});\\n\" if @options[:severity] <= 0\n\t\t\t\tbody += \"});</script>\"\n\n\t\t\t\tbody += '</div></div>'\n\n\t\t\t\tbody_text(f,body)\n\n\t\t\t\tclose_all(f)\n\t\t\tend\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "1a5d2fe2ced007f6bb530de112e98656",
"score": "0.5128924",
"text": "def print_report\n # total_bikes = @fleet.count \n # broken_bikes = @fleet.count {|b| b.is_broken?}\n # working_bikes = total_bikes-broken_bikes\n total_people = @people.count\n total_stations = @stations.count\n # show_stations = @stations.each do {|name, capacity| puts \"#{name}, #{capacity}\"}\n #tell me its name and capcity\n # puts \"Total bikes: #{total_bikes}\"\n # puts \"Broken bikes: #{broken_bikes}\"\n # puts \"Working bikes: #{working_bikes}\"\n puts \"Total people: #{total_people}\"\n # puts \"People with bikes: #{people_with_bikes}\"\n puts \"People without bikes #{people_without_bikes.count}\" \n puts \"Number of stations: #{total_stations}\" \n puts \"Stations:\"\n @stations.each do |station|\n puts \"#{station.name}, #{station.capacity}, #{station.bikes.count}\"\n end\n # result = \"total bikes #{total_bikes}\\n\" + \"broken bikes #{broken_bikes}\\n\" + \"working bikes #{working_bikes}\\n\"\n # result + \"total people #{total_people}\\n\" + \"people with bikes #{people_with_bikes}\\n\" + \"people without bikes #{people_without_bikes}\\n\" + \"number of stations #{total_stations}\\n\" + \"stations #{show_stations}\"\n end",
"title": ""
},
{
"docid": "b27f5f5abef67423133d2ba5ee6b3b31",
"score": "0.51266295",
"text": "def rover_controller_report\n @rover_bay.each{|x| x.print_rover}\n end",
"title": ""
},
{
"docid": "7e0af7ce554a79d9bdb831234359f3a1",
"score": "0.5123705",
"text": "def printDone\n doneList = \"\"\n @toDoListArray.each do |e|\n if e.status\n doneList = doneList + e.printItem + \" \"\n end\n end\n doneList\n end",
"title": ""
},
{
"docid": "1e5d6011421b0bcce40f315201852942",
"score": "0.5123048",
"text": "def show\n @title = \" - Order#\" + @order.id.to_s\n @print_sections = PrintSection.all\n @order_data = eval(@order.data)\n # parts_arr = []\n # options_arr = []\n\n # strhash = eval(@order.data).with_indifferent_access\n\n # strhash[:part].each do |key, val|\n # parts_arr << Part.find(key)\n # options_arr << Option.find(val[:option])\n # end\n\n # @parts_options = parts_arr.zip(options_arr)\n\n if params[:view] == 'print'\n render action: 'print', :layout => 'application'\n return\n end\n end",
"title": ""
},
{
"docid": "3bc6ac588930ee9b3e4b139794cf3095",
"score": "0.5113799",
"text": "def run\n getPage\n getLocations\n printLocations\n end",
"title": ""
},
{
"docid": "2707db2a188a24cb492f95f2d4f0a632",
"score": "0.5100368",
"text": "def flush\n @output.puts @widgets.values.join\n end",
"title": ""
},
{
"docid": "e219b94c16a4d94272dd2aad82c52053",
"score": "0.50972587",
"text": "def print_out_line\n\t\t\t#p ['id', id, 'ctd', ctd]\n\t\t\t#p rcp.results.zip(rcp.results.map{|r| send(r)})\n\t\t\tname = @run_name\n\t\t\tname += \" (res: #@restart_id)\" if @restart_id\n\t\t\tname += \" real_id: #@real_id\" if @real_id\n\t\t\tbeginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s)\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s)\n\t\t\tif @status == :Incomplete and @completed_timesteps\n\t\t\t\tbeginning += sprintf(\" %d steps \", @completed_timesteps)\n\t\t\telsif @percent_complete\n \t\t\t\tbeginning+=sprintf(\" %3s%1s \", percent_complete, \"%\")\n\t\t\tend\n\t\t\tif ctd\n\t\t\t\t#beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n\t\t\tend\n\t\t\tbeginning += \" ---#{@comment}\" if @comment\n\t\t\tbeginning\n\t\tend",
"title": ""
},
{
"docid": "4cf69ed602ee61d383acc3d0d4070e2e",
"score": "0.5093208",
"text": "def task_report\n print \"task #{@name} is #{@state}\"\n case @state\n when 'waiting' ; puts \"\"\n when 'running'\n puts \" and \"+VT100.RED(\"has not completed\")+\" because\"\n @emits.each { |event_name|\n event = @joblist.find(event_name)\n event.report_consumers(@joblist)\n }\n end\n end",
"title": ""
},
{
"docid": "e694d2cab06622932375b59d376a53f2",
"score": "0.50891536",
"text": "def completedIndex\n time_range = (1.week.ago..Time.now)\n\n check_and_handle_kites_per_page_update(current_user, params)\n\n @kites = Kite.completed_kites.paginate(:page => params[:page], :per_page => @kitesPerPage)\n get_common_stats()\n @function = \"Completed Kites\"\n\n respond_to do |format|\n format.html { render :template => 'kites/index' }# index.html.erb\n format.xml { render :xml => @kites }\n format.js { render :template => 'kites/index' }\n end\n end",
"title": ""
},
{
"docid": "c6e6fbab10fddd077092948476aacc24",
"score": "0.50685334",
"text": "def scrap_trip_pages\n \n mp_trip_pages.each do |mp, trip_page|\n printf \"mp - #{mp}\\n\"\n doc = utf_page(trip_page)\n t = Time.now\n komandiruotes = (doc/\"//a[text()='Komandiruotės']\").first\n mp_business_trip(mp, denormalize( komandiruotes.attributes['href'] ) ) if komandiruotes\n printf \"Laikas: #{Time.now - t}\\n\"\n #sleep 3\n end\n \n end",
"title": ""
},
{
"docid": "b47a0d91a22ed589442246791ce71c4f",
"score": "0.5056431",
"text": "def show\r\n @pc_product = PcProduct.find(params[:id])\r\n #@pc_result = @pc_product.pc_result\r\n @product = @pc_product.product\r\n @indicators_checked = Array.new \r\n @indicators = Indicator.where(\"sector='printed'\")\r\n Indicator.all.each do |indicator|\r\n if @product.indicators.include?indicator\r\n @indicators_checked << indicator\r\n end\r\n end\r\n \r\n @step = 1\r\n \r\n add_breadcrumb _(\"My products\").html_safe, :products_url\r\n add_breadcrumb @product.name, edit_product_url(@product)\r\n add_breadcrumb _(\"Environmental Assessment\").html_safe, pc_basic_url(@pc_product)\r\n add_breadcrumb _(\"Detailed results\").html_safe, pc_result_path(@product.pc_product)\r\n \r\n \r\n do_results\r\n end",
"title": ""
},
{
"docid": "9eae714aff90d7beab3e260a155139b0",
"score": "0.50514895",
"text": "def printall\n $page.css('.oneRes').each do |play|\n puts \"#{play.css('.eventTitle').text}---#{play.css('.detail li a')[0].text}\"\n end\nend",
"title": ""
},
{
"docid": "64634b080b810784c40b45cabc060bad",
"score": "0.5046633",
"text": "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend",
"title": ""
},
{
"docid": "64634b080b810784c40b45cabc060bad",
"score": "0.5046633",
"text": "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend",
"title": ""
},
{
"docid": "64634b080b810784c40b45cabc060bad",
"score": "0.5046633",
"text": "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend",
"title": ""
},
{
"docid": "6be6ed1a8d956694058af4f0fe0653e0",
"score": "0.5043607",
"text": "def print_end_round\n print_separator_strong\n print_msg('round_complete')\n print_separator_strong\n end",
"title": ""
},
{
"docid": "3828e800e3d8ab0b058a92df21f89158",
"score": "0.5039783",
"text": "def pretty_print(pp)\n pp.text \"Frames: #{available_frames.to_a.sort.join(\", \")}\"\n\n pp.breakable\n pp.text \"Needed Transformations:\"\n transforms = each_transformation.map { |tr| [tr.from, tr.to] }.sort\n if !transforms.empty?\n pp.nest(2) do\n pp.breakable\n pp.seplist(transforms) do |tr|\n pp.text \"%s => %s\" % tr\n end\n end\n end\n\n pp.breakable\n pp.text \"Frame/Port Associations:\"\n associations = each_annotated_port.map { |port, frame| [port.name, frame] }.sort\n if !associations.empty?\n pp.nest(2) do\n pp.breakable\n pp.seplist(associations) do |portdef|\n pp.text \"data of %s is in frame %s\" % portdef\n end\n end\n end\n\n pp.breakable\n pp.text \"Transform Inputs and Outputs:\"\n ports = each_transform_port.map { |port, transform| [port.name, transform.from, transform.to] }.sort\n if !ports.empty?\n pp.nest(2) do\n pp.breakable\n pp.seplist(ports) do |portdef|\n pp.text \"%s: %s => %s\" % portdef\n end\n end\n end\n end",
"title": ""
},
{
"docid": "bc37fd79401b87523b5a2333128fc447",
"score": "0.5021482",
"text": "def disp_progres\n print '.'\nend",
"title": ""
},
{
"docid": "bdd9937a058aca07551887de52c2216f",
"score": "0.5015349",
"text": "def finished\n @tasks = @project.tasks.finished(true).paginate(:page => params[:page])\n @allow_reordering = false\n @final = true\n \n respond_to do |format|\n format.html # finished.html.erb\n end\n end",
"title": ""
},
{
"docid": "7fe1a7f669a25df87adebc9435e4658b",
"score": "0.50148517",
"text": "def after_run\n check_output_files\n show_results\n end",
"title": ""
},
{
"docid": "b3cd138f0de63269cc845a2d7f547e89",
"score": "0.5011937",
"text": "def print_job\n @scanjob = Scanjob.find(params[:id])\n update_scanjob_state(@scanjob)\n\n render :template => 'admin/scanjobs/print_job', :layout => 'print'\n end",
"title": ""
},
{
"docid": "e20080c6d06ae0dad1df8af0fffb3f16",
"score": "0.50072753",
"text": "def complete\n unless options[:quiet]\n puts \"*\" * 75\n puts \" \"\n puts \">> Questionnaire has been installed successfully.\"\n puts \">> You're all ready to go!\"\n puts \" \"\n puts \">> Enjoy!\"\n end\n end",
"title": ""
},
{
"docid": "288e133748089ec8f37452c89f630917",
"score": "0.5007128",
"text": "def pretty_print(pp)\n pp.text \"#{task.name}.#{name}\"\n pp.nest(2) do\n pp.breakable\n pp.text \"tracked = #{@tracked}\"\n pp.breakable\n pp.text \"readers = #{@readers.size}\"\n pp.breakable\n pp.text \"filtered = #{(@filter!=nil).to_s}\"\n @connections.each do |connection|\n pp.breakable\n if connection.is_a?(OutputPort::Connection)\n pp.text \"connected to #{connection.port.task.name}.#{connection.port.name} (filtered = #{(connection.filter!=nil).to_s})\"\n end\n if connection.is_a?(OutputPort::CodeBlockConnection)\n pp.text \"connected to code block\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3db3a1e28ae673e7689c2a28ee348852",
"score": "0.5006489",
"text": "def print\n puts \"====== Pastes History ======\".green\n unless @links.empty?\n @links.each_with_index { |l, i| puts \"#{i+1}. #{l}\" }\n else\n puts \"your history is empty...\"\n end\n puts \"============================\".green\n end",
"title": ""
},
{
"docid": "f173b3ad68d4792dbb054a6538aef626",
"score": "0.5005931",
"text": "def print\n list = @data.display_list\n @labels = []\n @ship = []\n\n @data.label_count, @data.ship_count = update_from_form(list)\n\n if @data.label_count + @data.ship_count == 0\n note \"Nothing to ship\"\n @session.pop\n return\n end\n \n values = {}\n if @data.label_count > 0\n labels = print_labels\n if labels\n values['label_url'] = labels\n else\n error \"Error producing labels. Call Dave\"\n @session.pop\n return\n end\n end\n if @data.ship_count > 0\n statements = print_statements\n if statements\n values['statements_url'] = statements\n else\n error \"Error producing Statements. Call Dave\"\n @session.pop\n return\n end\n end\n\n mark_stuff_shipped(values)\n end",
"title": ""
},
{
"docid": "049d14f7b38986530c9e64c855dbbbbd",
"score": "0.49955165",
"text": "def show\n @complete_quiz = serve_complete_quiz_sorted(@quiz)\n @section = @quiz.section\n @course = @quiz.section.course\n @next_checkpoint = get_next_checkpoint(@quiz)\n puts @next_checkpoint.to_json\n end",
"title": ""
},
{
"docid": "95251b1ed3be43aab1ff438a1c6678e2",
"score": "0.49952573",
"text": "def print_pq_data\n\t \tresponse = \"\"\n\t \tprice_quotes = pnr_info.pq_data\n\t \tunless price_quotes.blank?\n\t \t\tif price_quotes.is_a?(Array) then\n\t \t\t\ttext_pqs = price_quotes.each {\n\t \t\t\t\t|pq|\n\t \t\t\t\tresponse += extra_info(pq)\n\t \t\t\t}\n\t \t\telse\n\t \t\t\tresponse += extra_info(price_quotes)\n\t \t\tend\n\t \t\tresponse += table_pq_totals(price_quotes)\n\t \tend\n\t \treturn \tresponse\n\t end",
"title": ""
},
{
"docid": "06f125efa137d49a78752805eb82e1de",
"score": "0.49868405",
"text": "def show\n @tasks.each do |project_name, project_tasks|\n @output.puts project_name\n project_tasks.each do |task|\n @output.printf(\" [%c] %d: %s : %s \\n\", (task.done? ? 'x' : ' '), task.id, task.description, task.deadline)\n end\n @output.puts\n end\n end",
"title": ""
},
{
"docid": "9936c407408a2cb20e8a638a919ac182",
"score": "0.49856168",
"text": "def print_plan_result(info, names = [])\n said_any_things = false\n unless Array(info.stacks).empty?\n info.stacks.each do |s_name, s_info|\n result = print_plan_result(s_info, [*names, s_name].compact)\n said_any_things ||= result\n end\n end\n if !names.flatten.compact.empty? || info.name\n said_things = false\n output_name = names.empty? ? info.name : names.join(\" > \")\n ui.puts\n ui.puts \" #{ui.color(\"Update plan for:\", :bold)} #{ui.color(names.join(\" > \"), :blue)}\"\n unless Array(info.unknown).empty?\n ui.puts \" #{ui.color(\"!!! Unknown update effect:\", :red, :bold)}\"\n print_plan_items(info, :unknown, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.unavailable).empty?\n ui.puts \" #{ui.color(\"Update request not allowed:\", :red, :bold)}\"\n print_plan_items(info, :unavailable, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.replace).empty?\n ui.puts \" #{ui.color(\"Resources to be replaced:\", :red, :bold)}\"\n print_plan_items(info, :replace, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.interrupt).empty?\n ui.puts \" #{ui.color(\"Resources to be interrupted:\", :yellow, :bold)}\"\n print_plan_items(info, :interrupt, :yellow)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.remove).empty?\n ui.puts \" #{ui.color(\"Resources to be removed:\", :red, :bold)}\"\n print_plan_items(info, :remove, :red)\n ui.puts\n said_any_things = said_things = true\n end\n unless Array(info.add).empty?\n ui.puts \" #{ui.color(\"Resources to be added:\", :green, :bold)}\"\n print_plan_items(info, :add, :green)\n ui.puts\n said_any_things = said_things = true\n end\n unless said_things\n ui.puts \" #{ui.color(\"No resource lifecycle changes detected!\", :green)}\"\n ui.puts\n said_any_things = true\n end\n end\n said_any_things\n end",
"title": ""
},
{
"docid": "2c421e060b06cf27918a585b8cc0600c",
"score": "0.4985203",
"text": "def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend",
"title": ""
},
{
"docid": "e95a029cefe43dc983d59198f9c61286",
"score": "0.49836648",
"text": "def request_plot(args, options)\n\n experiments = options.experiments.split(',')\n machines = options.machines.split(',')\n\n data = Ppbench::load_data(args)\n filtered_data = Ppbench::filter(\n data,\n experiments: experiments,\n machines: machines\n )\n aggregated_data = Ppbench::aggregate(filtered_data)\n\n max_x = Ppbench::maximum(aggregated_data, of: :length)\n max_y = Ppbench::maximum(aggregated_data, of: :rps)\n\n rplot = Ppbench::plotter(\n aggregated_data,\n to_plot: :rps,\n machines: machines,\n experiments: experiments,\n receive_window: options.recwindow,\n xaxis_max: options.xaxis_max == 0 ? max_x : options.xaxis_max,\n confidence: options.confidence,\n no_points: options.nopoints,\n with_bands: options.withbands,\n yaxis_max: options.yaxis_max == 0 ? max_y : options.yaxis_max,\n yaxis_steps: options.yaxis_steps,\n xaxis_steps: options.xaxis_steps,\n title: \"Requests per seconds\",\n subtitle: \"bigger is better\",\n xaxis_title: \"Message Size\",\n xaxis_unit: \"kB\",\n yaxis_title: \"Requests per seconds\",\n yaxis_unit: \"Req/sec\",\n yaxis_divisor: 1\n )\n\n pdf = pdfout(rplot, file: options.pdf, width: options.width, height: options.height)\n print(\"#{pdf}\") unless options.pdf.empty?\n print(\"#{rplot}\") if options.pdf.empty?\nend",
"title": ""
},
{
"docid": "ec54efccc193c887140be0dad0206b55",
"score": "0.49699873",
"text": "def loading (program = \"Name encoder\", i = 0)\n puts \"#{program} initialized\"\n sleep(0.25)\n puts \"loading\"\n loading_bar = [\n \". \",\". \",\n \". \",\". \",\n \". \",\". \"\n ]\n until i == 6\n print loading_bar[i]\n sleep(0.5)\n i += 1\n end\n puts \"Ready!\"\nend",
"title": ""
},
{
"docid": "125053c28a8cff6ce456f9d5b2414364",
"score": "0.49660602",
"text": "def loading_bar\n loading_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n 1.upto(loading_array.length.to_i) do |i|\n printf(\"\\rCycles Complete: %d\", i)\n sleep(0.1)\n end\n end",
"title": ""
},
{
"docid": "de126b13bcb53d05ce6b3539c70ad28e",
"score": "0.4958604",
"text": "def finalize_standard_report\n render_pdf\n end",
"title": ""
},
{
"docid": "2115e1008f649a6c3b1949df5e4a5993",
"score": "0.49444517",
"text": "def print_out_line\n #p ['id', id, 'ctd', ctd]\n #p rcp.results.zip(rcp.results.map{|r| send(r)})\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\")\n if ctd and fusionQ\n beginning += sprintf(\"Q:%f, Pfusion:%f MW, Ti0:%f keV, Te0:%f keV, n0:%f x10^20\", fusionQ, pfus, ti0, te0, ne0)\n end\n beginning += \" ---#{@comment}\" if @comment\n beginning\n end",
"title": ""
},
{
"docid": "9c197c1e7780c0388c334c90fad169e9",
"score": "0.4943787",
"text": "def printer(speakers)\n batch_badge_creator(speakers).each do |badge|\n puts badge\n end\n assign_rooms(speakers).each do |room|\n puts room\n end\nend",
"title": ""
},
{
"docid": "7e50c19e6195f7903e10021ec3e58b2a",
"score": "0.49436054",
"text": "def minimal_progress_callback(state)\n case state\n when :start then print '|'\n when :step then print '.'\n when :end then puts\n end\n\n $stdout.flush\n end",
"title": ""
},
{
"docid": "16d6c939ec97a9264f032cc31f5f1f79",
"score": "0.49347913",
"text": "def settings_print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # get all collaborators\n @collaborators = @project.collaborators\n end",
"title": ""
},
{
"docid": "bc84280af2012a59d0959ca5be215978",
"score": "0.49310547",
"text": "def get_completed_quests\n\n#check if the player has actually completed any quests\n#if he has not, tell him\n if self.quests.size == 0\n puts \"You have not completed any quests!!!\".red\n\n#otherwise, pull the completed quest objects and print the quest titles\n else\n puts \"Completed Quests:\".underline\n self.quests.each_with_index do |quest, i|\n puts \"#{i+1}: #{quest.title}\"\n end\n end\n end",
"title": ""
},
{
"docid": "575c1ad928548f72ca16073d4255b79a",
"score": "0.49215913",
"text": "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",
"title": ""
},
{
"docid": "82ef028297603b29a1984cbc3e900d94",
"score": "0.49171597",
"text": "def report_results(t)\n say \"Finished in #{t.real.to_s[0..6]} seconds\"\n res = \"#{Result.list.length} tests\"\n color = :green\n res = \"#{res} #{Result.failures.length} Failures\" and color = :red unless Result.failures.empty?\n res = \"#{res} #{Result.errors.length} Errors\".yellow and color = :yellow unless Result.errors.empty?\n say res.send(color)\n end",
"title": ""
},
{
"docid": "d9c85f8a529888e91aaed0c9aefd1aba",
"score": "0.49137345",
"text": "def showInformation()\n print(\"Starting up the scraper for the RAND Terrorism Incident Database. The flashing numbers that will appear represent written incidents. It will take a few moments for the initial program to load... \\n\");\nend",
"title": ""
},
{
"docid": "ea195596cd6bba3d976afb291a654a0c",
"score": "0.49123308",
"text": "def dump\n puts\n puts \"WorkFlow '#{ @label }' consists of the following tasks:\"\n @task_list.each{ |t| t.dump }\n puts\n end",
"title": ""
},
{
"docid": "cca6545ae855a5566d2c623b1b82d3b5",
"score": "0.4911563",
"text": "def after_resolution\n output.puts\n end",
"title": ""
},
{
"docid": "59c8cd61b71467944132270fbde63ad2",
"score": "0.49101242",
"text": "def show_progress\n\t\t@placeholder.join(\" \")\n\tend",
"title": ""
},
{
"docid": "7d7df824cc70332dee060f1882a86323",
"score": "0.4909044",
"text": "def dump_pending\n end",
"title": ""
},
{
"docid": "7d7df824cc70332dee060f1882a86323",
"score": "0.4909044",
"text": "def dump_pending\n end",
"title": ""
},
{
"docid": "40a536cac7bf6e08c1562d518bd4a6d9",
"score": "0.4902301",
"text": "def print_products\n$report_file.puts \"\n\n | | | |\n _ __ _ __ ___ __| |_ _ ___| |_ ___\n| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\n| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\n| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\n| |\n|_|\n\t \t\t\t\t\t\t\t\t\t\"\nend",
"title": ""
},
{
"docid": "2f62fac37119cff3d36f36e67042ffb4",
"score": "0.49001744",
"text": "def progress_output\n arr = @progress.map do |key, value|\n \"#{key}: #{value}\\n\"\n end\n arr.join('')\n end",
"title": ""
},
{
"docid": "425f6850c5e424d7682de4f74672fb75",
"score": "0.48969308",
"text": "def print_event\n clear\n @talks.sort_by {|task| task.start_time }.each do |t|\n puts \"#{t.start_time.strftime(\"%I:%M%p\").delete_prefix(\"0\").downcase} - #{t.end_time.strftime(\"%I:%M%p\").delete_prefix(\"0\").downcase}\"\n puts \" #{t.name} presented by #{t.speaker.name}\"\n end\n puts\n end",
"title": ""
}
] |
bb9a389418ef29ff5c36ebd30b8aa73f
|
recover(requeue = false, &block)
|
[
{
"docid": "833c6c35bf67812acb965d3eded8de80",
"score": "0.0",
"text": "def on_delivery(&block)\n self.callbacks[:delivery] = block if block\n end",
"title": ""
}
] |
[
{
"docid": "e466646c741d3093d7f60942a95495df",
"score": "0.81264555",
"text": "def recover requeue = false\n send Protocol::Basic::Recover.new(:requeue => requeue)\n self\n end",
"title": ""
},
{
"docid": "a7985cdb2b7590ebecf836eb47b9f01e",
"score": "0.762428",
"text": "def recover(requeue = true, &block)\n @connection.send_frame(AMQ::Protocol::Basic::Recover.encode(@id, requeue))\n\n self.redefine_callback :recover, &block\n self\n end",
"title": ""
},
{
"docid": "08c126090710adc7b01fdcf4e953f4eb",
"score": "0.75701183",
"text": "def recover(requeue = true, &block)\n @connection.send_frame(Protocol::Basic::Recover.encode(@id, requeue))\n\n self.redefine_callback :recover, &block\n self\n end",
"title": ""
},
{
"docid": "08c126090710adc7b01fdcf4e953f4eb",
"score": "0.75701183",
"text": "def recover(requeue = true, &block)\n @connection.send_frame(Protocol::Basic::Recover.encode(@id, requeue))\n\n self.redefine_callback :recover, &block\n self\n end",
"title": ""
},
{
"docid": "bc0900dff717ab0c213340dc756d467e",
"score": "0.7430961",
"text": "def recover(requeue = true, &block)\n @client.send(Protocol::Basic::Recover.encode(@channel.id, requeue))\n\n self.callbacks[:recover] = block\n @channel.queues_awaiting_recover_ok.push(self)\n end",
"title": ""
},
{
"docid": "396c3070d771718a557fb035d23c243c",
"score": "0.7370217",
"text": "def recover(ignored = true)\n # RabbitMQ only supports basic.recover with requeue = true\n basic_recover(true)\n end",
"title": ""
},
{
"docid": "3b385896d16b6da5442027ad14336b2d",
"score": "0.72739357",
"text": "def recover(requeue = false)\n channel.once_open{\n channel.recover(true) # rabbitmq (as of 2.5.1) does not support requeue = false yet.\n }\n self\n end",
"title": ""
},
{
"docid": "a0c4405e0461f942b9b186afcfd295b7",
"score": "0.6559241",
"text": "def recover(opts = {})\n\n\t send_frame(\n\t Qrack::Protocol::Basic::Recover.new({ :requeue => false }.merge(opts))\n\t )\n\n\t end",
"title": ""
},
{
"docid": "6882a8bd48e0717a2ffce7863289a34f",
"score": "0.64689755",
"text": "def recover(opts = {})\n send_frame(Qrack::Protocol::Basic::Recover.new({ :requeue => false }.merge(opts)))\n end",
"title": ""
},
{
"docid": "66495415700640e39995ef1324999293",
"score": "0.6435001",
"text": "def do_with_rebase_retry(&block)\n begin\n yield block\n rescue GapTooSmall\n Rails.logger.tagged(:queue, :rebase) do\n Rails.logger.info \"rebasing user #{@user.id}'s queue\"\n\n rebase\n\n Rails.logger.info \"done rebasing user #{@user.id}'s queue\"\n\n yield block\n end\n end\n end",
"title": ""
},
{
"docid": "86a82e04bc9226f59c0547886edd804f",
"score": "0.63174856",
"text": "def with_rescuing(&block)\n if @rescuing\n block.call\n else\n begin\n @rescuing = true\n enable_rescuing!(block)\n ensure\n @rescuing = false\n end\n end\n end",
"title": ""
},
{
"docid": "f1de07095a836e7e2e3f4200f8c278e3",
"score": "0.6282195",
"text": "def auto_recover\n return unless auto_recovering?\n\n @channel_is_open_deferrable.fail\n @channel_is_open_deferrable = AMQP::Deferrable.new\n\n self.open do\n @channel_is_open_deferrable.succeed\n\n # re-establish prefetch\n self.prefetch(@options[:prefetch], false) if @options[:prefetch]\n\n # exchanges must be recovered first because queue recovery includes recovery of bindings. MK.\n @exchanges.each { |name, e| e.auto_recover }\n @queues.each { |name, q| q.auto_recover }\n end\n end",
"title": ""
},
{
"docid": "5f379216a4c504a55583f6bb10e01980",
"score": "0.62784797",
"text": "def requeue(clear_after_requeue=false, options={}, &block)\n requeued = 0\n queue = options[\"queue\"] || options[:queue]\n @limiter.lock do\n @limiter.jobs.each_with_index do |job,i|\n if !block_given? || block.call(job)\n index = @limiter.start_index + i - requeued\n\n value = redis.lindex(:failed, index)\n redis.multi do\n # no change needed to support ActiveJob\n Job.create(queue||job['queue'], job['payload']['class'], *job['payload']['args'])\n\n if clear_after_requeue\n # remove job\n # TODO: should use ltrim. not sure why i used lrem here...\n redis.lrem(:failed, 1, value)\n else\n # mark retried\n job['retried_at'] = Time.now.strftime(\"%Y/%m/%d %H:%M:%S\")\n redis.lset(:failed, @limiter.start_index+i, Resque.encode(job))\n end\n end\n\n requeued += 1\n end\n end\n end\n requeued\n end",
"title": ""
},
{
"docid": "708099ec54ca8edd90fb9744f3f6dddc",
"score": "0.6057862",
"text": "def auto_recover\n super\n end",
"title": ""
},
{
"docid": "30310e31e950abf03e2cbd2fe4294642",
"score": "0.6042388",
"text": "def recover()\n @successful = true\n @exception = nil\n end",
"title": ""
},
{
"docid": "9afb8982016fa65b1372b159ed0bb64b",
"score": "0.59976345",
"text": "def auto_recover\n return unless auto_recovering?\n\n self.open do\n # exchanges must be recovered first because queue recovery includes recovery of bindings. MK.\n @exchanges.each { |name, e| e.auto_recover }\n @queues.each { |name, q| q.auto_recover }\n end\n end",
"title": ""
},
{
"docid": "9afb8982016fa65b1372b159ed0bb64b",
"score": "0.59976345",
"text": "def auto_recover\n return unless auto_recovering?\n\n self.open do\n # exchanges must be recovered first because queue recovery includes recovery of bindings. MK.\n @exchanges.each { |name, e| e.auto_recover }\n @queues.each { |name, q| q.auto_recover }\n end\n end",
"title": ""
},
{
"docid": "3bc0e0abdecc9a4b77dd85f135c3c097",
"score": "0.5994119",
"text": "def recover_async\n return if status_is_final?\n if self.owner.item.extra['fixer_queue'] == \"batch_processor\"\n RecoverTaskWorker.sidekiq_options_hash={\"retry\"=>0, \"queue\"=>\"batch_processor\"}\n end\n RecoverTaskWorker.perform_async(id) unless Rails.env.test?\n end",
"title": ""
},
{
"docid": "bea5a29c03cb5c5e2af6431eb2fef76f",
"score": "0.5979722",
"text": "def auto_recover\n self.exec_callback_yielding_self(:before_recovery)\n self.resubscribe\n self.exec_callback_yielding_self(:after_recovery)\n end",
"title": ""
},
{
"docid": "fc43838990247a7d49806dddf48d7a38",
"score": "0.5954403",
"text": "def recover!\n raise self.class.name + \" does not implement recover! method\"\n end",
"title": ""
},
{
"docid": "fc49e659a806464330df5d23f2a37dd2",
"score": "0.5942055",
"text": "def auto_recover\n self.exec_callback_yielding_self(:before_recovery)\n self.redeclare do\n self.rebind\n\n @consumers.each { |tag, consumer| consumer.auto_recover }\n\n self.exec_callback_yielding_self(:after_recovery)\n end\n end",
"title": ""
},
{
"docid": "2a90f7b95506c4791ec41965506d0fbd",
"score": "0.5893045",
"text": "def on_recovery(&block)\n super(&block)\n end",
"title": ""
},
{
"docid": "7567722cb6c5ce9eca9cdcff199626e1",
"score": "0.58574474",
"text": "def recovery()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0a7d01394564114854b2d56688c071f7",
"score": "0.5855476",
"text": "def auto_recover\n self.exec_callback_yielding_self(:before_recovery)\n self.resubscribe\n self.exec_callback_yielding_self(:after_recovery)\n end",
"title": ""
},
{
"docid": "f161f4dcf65af6226ff1219a81a4c7e1",
"score": "0.583739",
"text": "def requeue\n Requeue.new(@message, @metadata, @requeue_opts).requeue\n end",
"title": ""
},
{
"docid": "df7d68f0cb664eb030e1e91159747891",
"score": "0.58294183",
"text": "def listen\n\t\t@@requeue.rpop('!')\n\tend",
"title": ""
},
{
"docid": "d916ade4b53f55a222fafaa60746d3f1",
"score": "0.58281314",
"text": "def cancel_errback(block); end",
"title": ""
},
{
"docid": "989446ede4a2fa9f276c19b9956b8f0f",
"score": "0.5824134",
"text": "def recover\n#--{{{\n init_logging\n recoverer = Recoverer::new self\n recoverer.recover\n#--}}}\n end",
"title": ""
},
{
"docid": "614c5c8ebf3fd146c4f9c55446546a2a",
"score": "0.5797324",
"text": "def recovery_final\n end",
"title": ""
},
{
"docid": "5e8241f76024b9f8b59010d1d3c9cae0",
"score": "0.57965267",
"text": "def listen\n\t\t@requeue.rpop('!')\n\tend",
"title": ""
},
{
"docid": "032f7bdbbd106d15d1f3b7d40111ca15",
"score": "0.5781585",
"text": "def reject! &block\n modify_ack_deadline! 0, &block\n end",
"title": ""
},
{
"docid": "ab5a448d73eab1da7df2140dad13f836",
"score": "0.5762458",
"text": "def wait_for_retry; end",
"title": ""
},
{
"docid": "fe10fea7471aebf700382213fe7da2e6",
"score": "0.5726842",
"text": "def call(event, _)\n yield\n rescue Exception => e\n event.retry_count += 1\n if event.retry_count > MAX_RETRY_ATTEMPTS\n logger.error(\"event #{event.id} failed over #{MAX_RETRY_ATTEMPTS} times\")\n event.acknowledge\n elsif event.retry_count > 2 and Donaghy.storage.member_of?('kill_list', event.id)\n logger.error(\"event #{event.id} was killed due to a kill_list entry\")\n event.acknowledge\n else\n Donaghy.storage.inc('retry', 1)\n event.requeue(delay: delay(event))\n end\n raise e\n end",
"title": ""
},
{
"docid": "fc07e59f017eb4f8edd13bae750ef305",
"score": "0.5725834",
"text": "def prepare_to_die!\r\n abandon_job!\r\n end",
"title": ""
},
{
"docid": "53e72518347e2805e3f586f292507ba9",
"score": "0.56692654",
"text": "def after_recovery_attempts_exhausted(&block)\n @recovery_attempts_exhausted = block\n end",
"title": ""
},
{
"docid": "c8f3e1dac13ecd464eeff86e7d63d52f",
"score": "0.56282085",
"text": "def waiting_for_retry?; end",
"title": ""
},
{
"docid": "52e373cac3330c0582ee30b050fc9466",
"score": "0.56277204",
"text": "def retryable(&block)\n yield\n end",
"title": ""
},
{
"docid": "0462b5de0ce9f3e4e4db37af3dd678b4",
"score": "0.56261307",
"text": "def recover(times = 1)\n begin\n yield\n rescue Yaram::ActorRestarted => e\n times -= 1\n times > -1 ? retry : raise(e)\n end # begin\n end",
"title": ""
},
{
"docid": "31e27cadcdaf72d31aafa79a6bc38bf5",
"score": "0.5588694",
"text": "def catch(&block); end",
"title": ""
},
{
"docid": "31e27cadcdaf72d31aafa79a6bc38bf5",
"score": "0.5588694",
"text": "def catch(&block); end",
"title": ""
},
{
"docid": "717b53bbb11901f3463df2946e0ae133",
"score": "0.557974",
"text": "def without_reconnect(&blk); end",
"title": ""
},
{
"docid": "09086748e161e60bc4271c3036c74bf3",
"score": "0.5579518",
"text": "def reject(&block); end",
"title": ""
},
{
"docid": "09086748e161e60bc4271c3036c74bf3",
"score": "0.5579518",
"text": "def reject(&block); end",
"title": ""
},
{
"docid": "09086748e161e60bc4271c3036c74bf3",
"score": "0.5579518",
"text": "def reject(&block); end",
"title": ""
},
{
"docid": "a1d454c152c5f508c61534efccf8930a",
"score": "0.5573873",
"text": "def reject!(&block); end",
"title": ""
},
{
"docid": "b1a9107dfe8b71b72ecc6784c703c77b",
"score": "0.5568797",
"text": "def requeue(timeout = nil)\n return managed if managed\n timeout ||= requeue_period\n\n timeout = [timeout, FastlyNsq.max_req_timeout].min\n\n @managed = :requeued\n nsq_message.requeue(timeout)\n end",
"title": ""
},
{
"docid": "0b1dc3b73dfdcb9e0f3ca2864cd3d566",
"score": "0.5561984",
"text": "def on_retry; end",
"title": ""
},
{
"docid": "12668bad96bc63408191666ae3b3f152",
"score": "0.5546125",
"text": "def perform(&block)\n response = nil\n tries = 0\n while response.blank?\n break if tries > @options[:max_retries]\n response = block.call\n tries += 1\n sleep @options[:sleep]\n end\n response\n end",
"title": ""
},
{
"docid": "e6d669c2b2241a4855a6b832f5af2815",
"score": "0.5543858",
"text": "def retry\n failed\n queue.push self\n end",
"title": ""
},
{
"docid": "25edee9cb0f2d8ddc68755fd303d64e1",
"score": "0.5543305",
"text": "def recover_complete\n procline 'listening'\n log(:info, 'recover complete')\n end",
"title": ""
},
{
"docid": "e744bcfab9c146e77a510d5d1bde286c",
"score": "0.5536601",
"text": "def recover_queues\n @queue_mutex.synchronize { @queues.values }.each do |q|\n @logger.debug { \"Recovering queue #{q.name}\" }\n q.recover_from_network_failure\n end\n end",
"title": ""
},
{
"docid": "5d248ebba151b0dac3f277156b0c73d5",
"score": "0.55347836",
"text": "def recover\n @recovery.call(@host) if @recovery\n @up = true\n end",
"title": ""
},
{
"docid": "4598871ce1e476b35938709da1cd3655",
"score": "0.5511519",
"text": "def Retry; end",
"title": ""
},
{
"docid": "fb3f5b011cc8c9414c1e20fd1aa05b52",
"score": "0.55035454",
"text": "def successfully_enqueued=(_arg0); end",
"title": ""
},
{
"docid": "18908498558b59e35fa863287071e6ff",
"score": "0.5499224",
"text": "def on_failure_aaa(exception, *args)\n # note: sorted alphabetically\n # queue needs to be set for rety to work (know what queue in Requeue.class_to_queue)\n @requeue_in_queue = args[0][\"full_queue\"]\n end",
"title": ""
},
{
"docid": "7c021f50ee98485d6120038a4b251ad5",
"score": "0.54956764",
"text": "def retry\n Resque::Failure.requeue(params[:id])\n redirect_to failures_path(redirect_params)\n end",
"title": ""
},
{
"docid": "7038c4c716485ce7f9c87a1b76804574",
"score": "0.5491088",
"text": "def requeue\n client.queue( request, shortname => { skip: true } )\n end",
"title": ""
},
{
"docid": "878e367b319cc5f78ac9a98721560c70",
"score": "0.5484944",
"text": "def automatically_recover\n ms = @network_recovery_interval * 1000\n # recovering immediately makes little sense. Wait a bit first. MK.\n java.lang.Thread.sleep(ms)\n\n new_connection = converting_rjc_exceptions_to_ruby do\n reconnecting_on_network_failures(ms) do\n if @uses_uri\n self.new_uri_connection_impl(@uri)\n else\n self.new_connection_impl(@hosts, @host_selection_strategy)\n end\n end\n end\n self.recover_shutdown_hooks(new_connection)\n\n # sorting channels by id means that the cases like the following:\n #\n # ch1 = conn.create_channel\n # ch2 = conn.create_channel\n #\n # x = ch1.topic(\"logs\", :durable => false)\n # q = ch2.queue(\"\", :exclusive => true)\n #\n # q.bind(x)\n #\n # will recover correctly because exchanges and queues will be recovered\n # in the order the user expects and before bindings.\n @channels.sort_by {|id, _| id}.each do |id, ch|\n begin\n ch.automatically_recover(self, new_connection)\n rescue Exception, java.io.IOException => e\n # TODO: logging\n $stderr.puts e\n end\n end\n\n @connection = new_connection\n end",
"title": ""
},
{
"docid": "c76b4f94e06eec5563ea531ecba6f30f",
"score": "0.5482282",
"text": "def recover\n restore(recursive: true)\n end",
"title": ""
},
{
"docid": "be0e706f8ff2a390f27422619dba9c84",
"score": "0.54774016",
"text": "def recover\n listen_for_connections\n end",
"title": ""
},
{
"docid": "e1cc7bbaae806c8237f528ab5ddd74e4",
"score": "0.54770696",
"text": "def delayed_ack_state\n super\n end",
"title": ""
},
{
"docid": "1ba8c188f3990fdd9c79594029328395",
"score": "0.5465935",
"text": "def retries; end",
"title": ""
},
{
"docid": "6960f52aa6a65fd8964083a4eb1c2fea",
"score": "0.54406124",
"text": "def __force__\n # ::Kernel.puts \"__force__ called !\"\n @mutex.synchronize do\n if pending?\n begin\n fulfill @block.call\n rescue ::Exception => error\n fail error\n end\n end\n end if pending?\n # BasicObject won't send raise to Kernel\n ::Kernel.raise(@error) if failed?\n @result\n end",
"title": ""
},
{
"docid": "5abd9da89cb14614fc13541e7c6e2568",
"score": "0.5436686",
"text": "def resolve_block\n blocker = $redis.get('blocker')\n blocked = $redis.get('blocked')\n if blocker != (nil || '') && blocked != (nil || '')\n response = \"<@#{blocker}> resolved <@#{blocked}>'s issue after #{get_time_blocked}\"\n create_or_update_time(blocked, 'total_time_blocked')\n create_or_update_time(blocker, 'total_time_blocking')\n $redis.set('blocker', nil)\n $redis.set('blocked', nil)\n $redis.set('time_blocked', nil)\n else\n response = 'No blocks found.Yay!'\n end \n response\nend",
"title": ""
},
{
"docid": "141d95127f7ba3a7783a469b4961ef45",
"score": "0.54363173",
"text": "def fast_requeue(index, queue=nil)\n item = all(index)\n mark_retries!(item)\n queue ||= item['queue']\n Job.create(queue, item['payload']['class'], *item['payload']['args'])\n end",
"title": ""
},
{
"docid": "34164085afa12c4b7b41f1059fa4964f",
"score": "0.5430069",
"text": "def attempt_reap; end",
"title": ""
},
{
"docid": "8d626201739043924256ad0497446b5d",
"score": "0.542867",
"text": "def rescue(&block); end",
"title": ""
},
{
"docid": "8d626201739043924256ad0497446b5d",
"score": "0.542867",
"text": "def rescue(&block); end",
"title": ""
},
{
"docid": "5898f5ff7760e351d1bb08052887eb07",
"score": "0.54222107",
"text": "def requeue_oldest_failed_job\n failed_queue.requeue(0)\n { rescheduled?: true, ok_to_remove?: true }\n rescue Resque::Helpers::DecodeException => e\n # This means we tried to dequeue a job with invalid encoding.\n # We just want to delete it from the queue.\n logger.notify(e)\n { rescheduled?: false, ok_to_remove?: true }\n rescue Exception => e\n logger.notify(e)\n { rescheduled?: false, ok_to_remove?: ok_to_remove?(e.message)}\n end",
"title": ""
},
{
"docid": "69c7f4ed6f641562bfd47e73e9733855",
"score": "0.5401288",
"text": "def try(&blk)\n \n end",
"title": ""
},
{
"docid": "baefd3fe1549cd9565e873d5dad52ecb",
"score": "0.5396931",
"text": "def requeue\n self.dequeue; self.queue\n end",
"title": ""
},
{
"docid": "bd9807d560cb7bc7c9edbda68ea50ca6",
"score": "0.5395998",
"text": "def recover_all\n allowed_queues\n .map { |key| key.to_s.sub(REDIS_KEY_PREFIX, '') }\n .each(&method(:recover))\n end",
"title": ""
},
{
"docid": "0fa432d26a7a105fa19f8d4b2148cf74",
"score": "0.53895897",
"text": "def before_recovery(&block)\n super(&block)\n end",
"title": ""
},
{
"docid": "15c6331dc9e930ebe55af05b00b3f50a",
"score": "0.53832173",
"text": "def cleanup_dead_deployment\n @@recover_count = @@recover_count + 1\n puts \"Recover count: \" + @@recover_count.to_s\n if @@recover_count >= 2\n puts \"To many recover process running, skip it\"\n @@recover_count = @@recover_count - 1\n return\n end\n ScheduleTask.cleanup_dead_deployment(11, 0) \n @@recover_count = @@recover_count - 1\nend",
"title": ""
},
{
"docid": "43eb14c062f889dad497f95078ec94ff",
"score": "0.5371533",
"text": "def discarded_transaction; end",
"title": ""
},
{
"docid": "bfdf8f2b3f8a93174c240921b1e04450",
"score": "0.5368364",
"text": "def after_recover_soft_deleted\n\n end",
"title": ""
},
{
"docid": "feaf4baf3ff6b2fd23422821461cf08d",
"score": "0.53558695",
"text": "def disable_automatic_connection_recovery\n @recover = nil\n end",
"title": ""
},
{
"docid": "249fa61db8cf593580a379d897829d42",
"score": "0.5336627",
"text": "def delayed_requeue(seconds = 60)\n unless defined?(@args)\n raise RuntimeError, \"Attempted to requeue #{self} but there were no args present.\" \\\n \"If you overrided Serviced::Jobs::Refresh be sure to set @args in #{self}.perform.\"\n end\n\n Resque.enqueue_in(seconds, self, *Array(@args))\n end",
"title": ""
},
{
"docid": "333d42905f5014e7ba581186e6f98327",
"score": "0.53353524",
"text": "def recover_queues\n @queues.values.each do |q|\n begin\n q.recover_from_network_failure\n rescue Exception => e\n # TODO: logger\n $stderr.puts \"Caught exception when recovering queue #{q.name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "2c0f24c8c09bc3a18554cae7ea81de59",
"score": "0.53261834",
"text": "def with_retries(options = {}, &block)\n options = WITH_RETRIES_DEFAULT_OPTIONS.merge(options)\n retries = 0\n while true do\n begin\n return yield\n rescue *options[:ignore] => e\n # $stderr.puts(\"=== ignoring #{e.class}: #{e.message}\") if options[:verbose]\n return\n rescue *options[:retry] => e\n # $stderr.puts(\"=== rescuing #{e.class}: #{e.message} (retry = #{retries}/#{options[:max_retries]})\") if options[:verbose]\n raise if (retries >= options[:max_retries])\n if (options[:delay_exponent] > 0.0) \n delay_time = options[:delay_exponent] ** retries\n sleep delay_time\n end\n retries += 1\n end\n end\n end",
"title": ""
},
{
"docid": "764144db9b807d662cb8b293797a55c0",
"score": "0.5316658",
"text": "def fail\n proc do |state|\n nil\n end\n end",
"title": ""
},
{
"docid": "adbd1573a63842a23960c7af1642ffdc",
"score": "0.53160936",
"text": "def recover(content_identifier)\n request = ContentRecoverRequest.new(content_identifier, nil)\n rs = Time.new\n recovered_content = @endpoint.recover(request)\n re = Time.new - rs\n puts \"Recover elapsed #{re}\"\n return recovered_content\n end",
"title": ""
},
{
"docid": "52befcfff66ffa0649fee4bd0576dc5f",
"score": "0.5309381",
"text": "def return_to_queue\n extend_timeout(0)\n end",
"title": ""
},
{
"docid": "8f9a4f4d139358692abad97c1331a3b0",
"score": "0.53060836",
"text": "def recover\n account = Account.find_by_email_address(params[:email_address])\n if account\n account.is_pending_recovery!\n Mailer.deliver_recovery(:site => @authenticated_site, :account => account)\n head :ok\n else\n head :not_found\n end\n end",
"title": ""
},
{
"docid": "524da894a61d3ec926b9073a32cca7c5",
"score": "0.5287978",
"text": "def with_retries(&block)\n tries = @options[:retries].to_i\n yield\n rescue *@options[:retriable_exceptions] => ex\n tries -= 1\n if tries > 0\n sleep 0.2\n retry\n else\n raise ex\n end\n end",
"title": ""
},
{
"docid": "d02e8c5abbda8411aa2a24a281c20500",
"score": "0.52606815",
"text": "def with_failover #:nodoc:\n tries = 0\n begin\n yield\n rescue Exception => e\n Beetle::reraise_expectation_errors!\n logger.error \"Beetle: redis connection error '#{e}'\"\n if (tries+=1) < 120\n @redis = nil\n sleep 1\n logger.info \"Beetle: retrying redis operation\"\n retry\n else\n raise NoRedisMaster.new(e.to_s)\n end\n end\n end",
"title": ""
},
{
"docid": "a2cdd72a66e296d5f5363877dd14d8de",
"score": "0.52535343",
"text": "def rebalance!\n end",
"title": ""
},
{
"docid": "aaea0961042f2dbdb82c2c9ccb312210",
"score": "0.52486134",
"text": "def recover_exchanges\n @exchange_mutex.synchronize { @exchanges.values }.each do |x|\n x.recover_from_network_failure\n end\n end",
"title": ""
},
{
"docid": "1d84e6fa521003b7968d1415db50a43a",
"score": "0.524423",
"text": "def read_blocked\n end",
"title": ""
},
{
"docid": "7b0955cdc64651de85fbc2418440ee76",
"score": "0.5239916",
"text": "def on_recovery(proc = nil, &block)\n @recovery = proc || block unless proc.nil? and block.nil?\n @recovery\n end",
"title": ""
},
{
"docid": "869ae75cb6a7edb2586b2b993ec38acc",
"score": "0.52332515",
"text": "def reject!(*)\n @lock.synchronize { super }\n end",
"title": ""
},
{
"docid": "4788823012b3976175500e2a4ec52450",
"score": "0.5231515",
"text": "def enqueue_error; end",
"title": ""
},
{
"docid": "6daeb4fa4cdf2567db9e62e9e323ec34",
"score": "0.521778",
"text": "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [email finder] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "2df544af118bd56b4e99acb6a117c904",
"score": "0.5211776",
"text": "def raise_delivery_errors; end",
"title": ""
},
{
"docid": "a7badf6b25aa870d1329e9d66d7abbb6",
"score": "0.52082556",
"text": "def queue_some_for_delete\n nil\n end",
"title": ""
},
{
"docid": "09ef72277e6e4b26eb9cae28d79d1b51",
"score": "0.52027893",
"text": "def fail_fast; end",
"title": ""
},
{
"docid": "e7daeae718422374eacf7d3700bbdaae",
"score": "0.51935077",
"text": "def recover_consumers\n unless @consumers.empty?\n @work_pool = ConsumerWorkPool.new(@work_pool.size, @work_pool.abort_on_exception)\n @work_pool.start\n end\n\n @consumer_mutex.synchronize { @consumers.values }.each do |c|\n c.recover_from_network_failure\n end\n end",
"title": ""
},
{
"docid": "d412354d9d0934cd4dedd9ca00db55d8",
"score": "0.51882225",
"text": "def queue_wait_attempts\n\t\t200\n\tend",
"title": ""
},
{
"docid": "64985ebb8db012a2e12150dfa4bf1b21",
"score": "0.51849174",
"text": "def recover_failed_records!\n task_records.complete.no_timeout.each do |record|\n Hekenga::TaskSplitter.new(record, @executor_key).call.tap do |new_record|\n next if new_record.nil?\n\n Hekenga::ParallelJob.perform_later(new_record.id.to_s, @executor_key.to_s)\n end\n end\n end",
"title": ""
},
{
"docid": "65fca0ded73f51c5538f854776ccf09a",
"score": "0.51835275",
"text": "def set_retry_state!; end",
"title": ""
},
{
"docid": "4bdeabbb206c9fd2d4751d1dae545da7",
"score": "0.51793635",
"text": "def selective_ack_state\n super\n end",
"title": ""
}
] |
6a66f76bf70127bd7bdfcfb063cc4359
|
TODO: actual check frequency
|
[
{
"docid": "8ba7d4fe5cf68a78d60b9a0924ef6e2e",
"score": "0.693667",
"text": "def in_frequency?\n true\n end",
"title": ""
}
] |
[
{
"docid": "ab6a46e19bb0b8aaeff0daec4e8b53a8",
"score": "0.7051543",
"text": "def check_frequency\n return unless frequency_hash[:interval].is_a? Numeric\n check_daily_frequency\n check_weekly_frequency\n check_monthly_frequency\n check_weekly_days\n check_monthly_days\n end",
"title": ""
},
{
"docid": "a1301e1f300eb1df214e723ef94d2d5e",
"score": "0.70158124",
"text": "def frequency; end",
"title": ""
},
{
"docid": "d85bc456aae60b22b621fb0545a5a6ab",
"score": "0.6534551",
"text": "def mtf_freq; end",
"title": ""
},
{
"docid": "5cb98a97b331a313ed714c528b37b88a",
"score": "0.6511029",
"text": "def frequency\n inquire[:frequency]\n end",
"title": ""
},
{
"docid": "1e126d4c18400bf9980e2a23cb54e35b",
"score": "0.6381524",
"text": "def reaping_frequency; end",
"title": ""
},
{
"docid": "db9376d2e3ef72d14fa47ce0c6c589fe",
"score": "0.6312229",
"text": "def frequency\n @frequency ||= 0.2\n end",
"title": ""
},
{
"docid": "1f643ec53969b15172bd2610e12d0fec",
"score": "0.61958426",
"text": "def occurrences; end",
"title": ""
},
{
"docid": "c69d82384fe598596554c0ce5d8877e3",
"score": "0.6134632",
"text": "def frequency\n 1.second\n end",
"title": ""
},
{
"docid": "2009b4a8b89456d9f7cbf0fd4e1ab7fe",
"score": "0.61322576",
"text": "def reaper?; (@reaper ||= nil) && @reaper.frequency end",
"title": ""
},
{
"docid": "8b8feaace6749b845cee82625d0ec7d2",
"score": "0.6103165",
"text": "def detect_min_frequency(detect_params)\n \n if !check_dmf_params(detect_params)\n return nil\n end\n detect_params[\"verbose\"] = detect_params[\"verbose\"] == \"true\" ? true : false\n puts if detect_params[\"verbose\"]\n puts \"[#{Time.now.iso8601(4).to_s}] ----- Start detect_min_frequency\" if detect_params[\"verbose\"]\n detect_params[\"fminer_algo\"] = detect_params[\"fminer_algo\"] == \"last\" ? \"last\" : \"bbrc\"\n detect_params[\"nr_com_ratio\"] = detect_params[\"nr_com_ratio\"].nil? ? 0.25 : detect_params[\"nr_com_ratio\"] \n puts \"Params: #{detect_params.to_yaml}\" if detect_params[\"verbose\"]\n\n ds = OpenTox::Dataset.find(detect_params[\"dataset_uri\"], detect_params[\"subjectid\"])\n if ds.nil?\n puts \"Dataset has to be accessable. Please check given dataset_uri: '#{detect_params[\"dataset_uri\"]}' and subjectid: '#{detect_params[\"subjectid\"]}'\"\n return nil\n end\n ds_nr_com = ds.compounds.size\n puts \"Number of compound in training dataset: #{ds_nr_com}\" if detect_params[\"verbose\"]\n\n durations = []\n x = ds_nr_com\n ds_result_nr_f = 0\n y = x\n y_old = 0\n puts if detect_params[\"verbose\"]\n puts \"[#{Time.now.iso8601(4).to_s}] ----- Initialization: -----\" if detect_params[\"verbose\"]\n while ds_result_nr_f < (ds_nr_com * detect_params[\"nr_com_ratio\"]).to_i do\n y_old = y\n y = x\n x = (x/2).to_i\n detect_params[\"min_frequency\"] = x\n puts \"Min_freq: '#{x}'\" if detect_params[\"verbose\"]\n t = Time.now\n result_uri = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services][\"opentox-algorithm\"],\"fminer/#{detect_params[\"fminer_algo\"]}/\"), detect_params )\n durations << Time.now - t\n ds_result = OpenTox::Dataset.find(result_uri,detect_params[\"subjectid\"])\n ds_result_nr_f = ds_result.features.size\n ds_result.delete(detect_params[\"subjectid\"])\n puts \"Number of features #{ds_result_nr_f}\" if detect_params[\"verbose\"]\n puts \"Duration of feature calculation: #{durations.last}\" if detect_params[\"verbose\"]\n puts \"----------\" if detect_params[\"verbose\"]\n end\n puts if detect_params[\"verbose\"]\n puts \"[#{Time.now.iso8601(4).to_s}] ----- Main phase: -----\" if detect_params[\"verbose\"]\n max_duration = durations[0] +(ds_nr_com.to_f * detect_params[\"time_per_cmpd\"])\n puts \"Max duration: '#{max_duration}'sec\" if detect_params[\"verbose\"]\n detect_params[\"min_frequency\"] = y\n y = y_old\n found = false\n cnt = 0\n min_f = detect_params[\"min_frequency\"]\n # Search for min_frequency with following heuristic procedure. If no good min_frequency found the delivered value(from the arguments) is used.\n while found == false && cnt <= 2 do\n if min_f == detect_params[\"min_frequency\"]\n cnt = cnt + 1\n end\n min_f = detect_params[\"min_frequency\"]\n puts \"Min_freq: '#{min_f}'\" if detect_params[\"verbose\"]\n t = Time.now\n result_uri = OpenTox::RestClientWrapper.post( File.join(CONFIG[:services][\"opentox-algorithm\"],\"fminer/#{detect_params[\"fminer_algo\"]}/\"), detect_params )\n durations << Time.now - t\n ds_result = OpenTox::Dataset.find(result_uri, detect_params[\"subjectid\"])\n ds_result_nr_f = ds_result.features.size\n ds_result.delete(detect_params[\"subjectid\"])\n puts \"Number of features #{ds_result_nr_f}\" if detect_params[\"verbose\"]\n puts \"Duration of feature calculation: #{durations.last}\" if detect_params[\"verbose\"]\n puts \"----------\" if detect_params[\"verbose\"]\n # Check if number of features is max half and min one-tenth of the number of compounds and performed in accaptable amount of time\n if ds_result_nr_f.to_i < (ds_nr_com * detect_params[\"upper_limit\"]).to_i && ds_result_nr_f.to_i > (ds_nr_com * detect_params[\"lower_limit\"]).to_i\n if durations.last < max_duration\n found = true\n return detect_params[\"min_frequency\"]\n else\n x = detect_params[\"min_frequency\"]\n detect_params[\"min_frequency\"] = ((detect_params[\"min_frequency\"]+y)/2).to_i\n end\n else\n y = detect_params[\"min_frequency\"]\n detect_params[\"min_frequency\"] = ((x+detect_params[\"min_frequency\"])/2).to_i\n end\n end\n return 0\nend",
"title": ""
},
{
"docid": "5621f7860b0e9202842ba78a98c6a78f",
"score": "0.61023974",
"text": "def frequency\n @freq\n end",
"title": ""
},
{
"docid": "cddd34d1273debdb7bedebe4f7a09f8f",
"score": "0.6088794",
"text": "def send_mtf_values_rfreq; end",
"title": ""
},
{
"docid": "351d6b035a75ce301f020861a1907560",
"score": "0.6053379",
"text": "def check; end",
"title": ""
},
{
"docid": "7c50d200b753c1e1ec80ecfede6b3f47",
"score": "0.6052076",
"text": "def frequency\n @rrule.getFreq\n end",
"title": ""
},
{
"docid": "770c34733423b00c64875c8d30671d1f",
"score": "0.5902005",
"text": "def frequency\n @values[:frequency] || 1\n end",
"title": ""
},
{
"docid": "8b1177bb0468193d36b7bbb1a6cc3b3c",
"score": "0.5893228",
"text": "def call_counts; end",
"title": ""
},
{
"docid": "408a6da3f229d5ae971c426c0f6e4467",
"score": "0.58911914",
"text": "def frequency\n\t\traise \"Abstract method must be implemented in subclass\"\n\tend",
"title": ""
},
{
"docid": "d7ac4170a346961510639495d3512d10",
"score": "0.58744884",
"text": "def can_show?\n self.frequency>0\n end",
"title": ""
},
{
"docid": "586d2a5ae562e1020ce91bf80db7d030",
"score": "0.58626086",
"text": "def check_save\n if @savefreq.nil?\n freq = 30\n elsif @savefreq == \"0\"\n return\n else\n freq = @savefreq.to_i\n end\n if @counter % freq == 0\n @server.puts \"save-all\"\n save\n end\n end",
"title": ""
},
{
"docid": "3f90b51f144bcaf128d5814316614ae3",
"score": "0.5859255",
"text": "def freq_options\r\n end",
"title": ""
},
{
"docid": "d06e48128db86d7b0d40082673a2559e",
"score": "0.58582205",
"text": "def frequency_supports_frequency_modifier?\n # these are the only ones that don't\n !%w{once on_logon onstart on_idle}.include?(new_resource.frequency)\n end",
"title": ""
},
{
"docid": "fade71989dfbb531311ef4c3664a1e1d",
"score": "0.5840696",
"text": "def check\n end",
"title": ""
},
{
"docid": "fbb94991178761f4101db35cc86fe7d9",
"score": "0.5811374",
"text": "def frequency\n @frequency ||= parse_frequency(@params[:every])\n end",
"title": ""
},
{
"docid": "5d20eae2372a91e74a48b46d741d2062",
"score": "0.5807969",
"text": "def unique_cutoff; end",
"title": ""
},
{
"docid": "caca658a2cd7adf2c3b744be44a541ac",
"score": "0.5807214",
"text": "def single_submission_frequency?\n sub_frequency == 0 or sub_frequency == 1\n end",
"title": ""
},
{
"docid": "f214e1e81b62e32c8d17eb22ed060494",
"score": "0.5799563",
"text": "def check\n \n end",
"title": ""
},
{
"docid": "bddfdcb4b06b3c34630888131f757223",
"score": "0.5752569",
"text": "def highestfrequency\n \n end",
"title": ""
},
{
"docid": "43174443bd8a223d19f3146eb4ec77a4",
"score": "0.5712956",
"text": "def check_lrate lrate; nil; end",
"title": ""
},
{
"docid": "43174443bd8a223d19f3146eb4ec77a4",
"score": "0.5712956",
"text": "def check_lrate lrate; nil; end",
"title": ""
},
{
"docid": "43174443bd8a223d19f3146eb4ec77a4",
"score": "0.5712956",
"text": "def check_lrate lrate; nil; end",
"title": ""
},
{
"docid": "a6759828b1fc5b8ab7add6e91c15ffe1",
"score": "0.5711968",
"text": "def at_least_times_executed; end",
"title": ""
},
{
"docid": "a6759828b1fc5b8ab7add6e91c15ffe1",
"score": "0.5711968",
"text": "def at_least_times_executed; end",
"title": ""
},
{
"docid": "86152b26f19b3700018d5428cc2d8373",
"score": "0.5708184",
"text": "def occur()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "bd3f150f4b4d085b071fef62378922ff",
"score": "0.5707863",
"text": "def high_frequency\n log \"Running high_frequency\"\n log \"Finished high_frequency\"\n true\n end",
"title": ""
},
{
"docid": "bd3f150f4b4d085b071fef62378922ff",
"score": "0.5707863",
"text": "def high_frequency\n log \"Running high_frequency\"\n log \"Finished high_frequency\"\n true\n end",
"title": ""
},
{
"docid": "7c9d300048e75d2c9119684b70a4a330",
"score": "0.5696652",
"text": "def day_1_a\n data = File.readlines('input.txt').map(&:to_i)\n\n freq = 0\n seen = Set.new\n data.cycle do |num|\n freq += num\n (puts freq; break) unless seen.add?(freq)\n end\nend",
"title": ""
},
{
"docid": "d50121b4a6fe3e41637f7905370ba98e",
"score": "0.56962466",
"text": "def sample_frequency?\n (bytes[2] & 0b1100) != 0b1100\n end",
"title": ""
},
{
"docid": "4044112d95c2a7d48280e682152098a9",
"score": "0.56804866",
"text": "def day_1_b\n data = File.readlines('input.txt').map(&:to_i)\n\n freq = 0\n seen = Set.new\n data.cycle do |num|\n freq += num\n (puts freq; break) if seen.include?(freq)\n seen.add(freq)\n end\nend",
"title": ""
},
{
"docid": "b40b07042b5e95ad616ebb4c6a2d1c30",
"score": "0.5674352",
"text": "def medium_frequency\n log \"Running medium_frequency\"\n if M2mhub::Feature.enabled?(:inspection_tasks)\n tasks = Quality::InspectionTask.status_open.all\n Quality::RmaInspectionRunner.new.run(tasks.select { |t| t.task_type.rma_inspection? })\n Quality::IncomingInspectionRunner.new.run(tasks.select { |t| t.task_type.incoming_inspection? })\n tasks.each(&:update_lighthouse_status!)\n end \n log \"Finished medium_frequency\"\n true\n end",
"title": ""
},
{
"docid": "721015d17590b56a3f71d563a9189331",
"score": "0.565695",
"text": "def frequency_supports_random_delay?\n %w{once minute hourly daily weekly monthly}.include?(new_resource.frequency)\n end",
"title": ""
},
{
"docid": "5a44cd01f6c8f90ad5a7c516bff650a2",
"score": "0.5654695",
"text": "def analyze_freqs(string)\n test_freqs = {}\n errors = []\n ('a'..'z').each do |letter|\n test_freqs[letter] = string.count(letter) / string.length.to_f\n errors << (@letter_freq[letter] - test_freqs[letter]).abs\n end\n errors.inject(0.0) { |sum, el| sum + el } / errors.size\nend",
"title": ""
},
{
"docid": "e66c3e6966b775d1799a6b8fed500121",
"score": "0.5652044",
"text": "def check()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "11fcc890f6e47d494ba20ea8b6a5ac0a",
"score": "0.56491333",
"text": "def expected_times_executed; end",
"title": ""
},
{
"docid": "11fcc890f6e47d494ba20ea8b6a5ac0a",
"score": "0.56491333",
"text": "def expected_times_executed; end",
"title": ""
},
{
"docid": "99f5ddc7e053457be1177bec4206f35d",
"score": "0.5642545",
"text": "def weigh_by_frequency(rumor)\n \n \treturn 0\n end",
"title": ""
},
{
"docid": "5d75fd04de370058667e00029f17ad18",
"score": "0.5638969",
"text": "def rand_checker\n store = {}\n 1000000.times do\n # n = rand_7_from_5\n n = rand_7_from_2\n store[n] ? store[n] += 1 : store[n] = 0\n end\n p store.keys.sort\n store.values.map {|v| v/1000}\nend",
"title": ""
},
{
"docid": "c8710975e3f4f34118d9f310d936f7e0",
"score": "0.5631352",
"text": "def can_tweak_sign?(normal_sign, vandalized_sign)\n van_freq = character_count(vandalized_sign)\n nom_freq = character_count(normal_sign)\n\n van_freq.each do |letter, freq|\n #debugger\n if van_freq[letter] > nom_freq[letter]\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "6495495a5f698404db12ac9541e7c109",
"score": "0.5617515",
"text": "def brute_frequency(year = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "f167bcc38206af6693d86ae3f5c9c664",
"score": "0.56145126",
"text": "def numFmts; end",
"title": ""
},
{
"docid": "e8da08e270834181004c6389f0ca2bb7",
"score": "0.56093377",
"text": "def four_of_a_kind?\n\t\t@frequency.values.uniq.include?(4) ? [true, [8, [@frequency.key(4)]]] : false\n\tend",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.5601483",
"text": "def count; end",
"title": ""
},
{
"docid": "7e4a35f1efc80ad73232e18c42a4b5c0",
"score": "0.56010187",
"text": "def count; end",
"title": ""
},
{
"docid": "ff53129ee5994bea45b2981350c972fd",
"score": "0.5599991",
"text": "def verifyWarnCount(count)\n maxWarn = Integer(count)\n\n puts \"maxWarn = \"\n puts maxWarn\n resourceToWarnCount = Hash.new(0)\n resourceToWarnCount = getWarnCount\n\n resourceToWarnCount.keys.each do |k,v|\n if maxWarn >= resourceToWarnCount[k]\n assert(true, \"Number of Warnings written to warning.log file is less than max number of Warnings\")\n else\n assert(false, \"Number of Warnings written to warning.log file is more than max number of Warnings\")\n end\n end\nend",
"title": ""
},
{
"docid": "8a8e5e9b88892fee07abe0b25e1fb00a",
"score": "0.5596175",
"text": "def chronal_calib_part2\n sum = 0\n frequency = {}\n found_frequency = false\n while found_frequency == false\n File.open('advent_of_code/day1.txt', 'r') do |f|\n f.each_line do |line|\n sum += line.to_i\n if frequency[sum] == true\n frequency[sum] = false\n found_frequency = true \n break\n else\n frequency[sum] = true \n end\n end\n end \n end \n puts frequency.key(false)\nend",
"title": ""
},
{
"docid": "6db77415b0542086b5c6b6e5ae1e2373",
"score": "0.55923176",
"text": "def check\n end",
"title": ""
},
{
"docid": "6db77415b0542086b5c6b6e5ae1e2373",
"score": "0.55923176",
"text": "def check\n end",
"title": ""
},
{
"docid": "b8f123f112644c2c7a20a8b4bcf2e221",
"score": "0.55865127",
"text": "def threshold; end",
"title": ""
},
{
"docid": "36cc1a2b3979955392d4cacdb0b7508e",
"score": "0.55838525",
"text": "def freq\n return self.ratio() * BASE_FREQ\n end",
"title": ""
},
{
"docid": "ad2e14a6354790c4e0f60364b4f0f6fd",
"score": "0.5577691",
"text": "def freq(x) \n count[x]\n end",
"title": ""
},
{
"docid": "fabff6ea3fc32866fe0bbb1b6083d9bb",
"score": "0.5570084",
"text": "def isValid(s)\n code_counts = get_counts_hash s.chars\n freq_counts = get_counts_hash code_counts.values\n delta =-> ary {ary.max - ary.min}\n # puts str_counts\n res = (freq_counts.size == 1 or\n (freq_counts.size == 2 and\n (freq_counts[1]==1) or (freq_counts.values.min == 1 and\n (delta[freq_counts.keys]==1 and\n (freq_counts[freq_counts.keys.max] == 1 or freq_counts[freq_counts.keys.max] - freq_counts[freq_counts.keys.min] == 1 ))))) ? \"YES\" : \"NO\"\n # [code_counts, freq_counts.values, freq_counts, freq_counts.size == 1, freq_counts.size == 2, freq_counts.values.min == 1, delta[freq_counts.keys], res]\nend",
"title": ""
},
{
"docid": "5f9ce5446974dc90606834897ff8ed3d",
"score": "0.5567",
"text": "def infrequent_in_date\n return false if date_array.nil?\n return false if frequency < 26\n expected_date = date_array.sort.reverse.first + frequency.weeks #Belt and Braces: the date array should already be sorted.\n expected_date > Date.local_today + 3.months\n end",
"title": ""
},
{
"docid": "600745f81af1ce78324dbbc73f8ab19b",
"score": "0.5561463",
"text": "def stats; end",
"title": ""
},
{
"docid": "600745f81af1ce78324dbbc73f8ab19b",
"score": "0.5561463",
"text": "def stats; end",
"title": ""
},
{
"docid": "600745f81af1ce78324dbbc73f8ab19b",
"score": "0.5561463",
"text": "def stats; end",
"title": ""
},
{
"docid": "dbe2e31a8d2d67a3dafb2d4ceb439767",
"score": "0.55590725",
"text": "def verifyErrorCount(count)\n maxError = Integer(count)\n\n puts \"maxError = \"\n puts maxError\n resourceToErrorCount = Hash.new(0)\n resourceToErrorCount = getErrorCount\n\n resourceToErrorCount.keys.each do |k,v|\n if maxError >= resourceToErrorCount[k]\n assert(true, \"Number of Errors written to error.log file is less than max number of Errors\")\n else\n assert(false, \"Number of Errors written to error.log file is more than max number of Errors\")\n end\n end\n\nend",
"title": ""
},
{
"docid": "f7faf01e0a416264862433b7d6408ed8",
"score": "0.5548421",
"text": "def known\n # puts practicing.map { |k, v| [k, v[:count]] }.inspect\n # puts practicing.map { |k, v| [k, 1 - item_chance**(v[:count] - 1)] }.inspect\n # puts \"item_count: #{item_count}\"\n sum = practicing.values.map { |v| 1 - item_chance**(v[:count] - 1) }.sum\n sum / item_count\n end",
"title": ""
},
{
"docid": "3cafc262abb69deba118bb54ce0dd69a",
"score": "0.5539142",
"text": "def check_100\n end",
"title": ""
},
{
"docid": "6370bf626de09dcb44216603b8844ecd",
"score": "0.5532966",
"text": "def test_dice_roll_distribution\n@values = Array.new(100_000) { |_| DiceRoll.new.value }\n @counts = Array.new(13) { 0 }\n @values.each do |v|\n\t @counts[v] += 1\n\t end\n\t\t \n\t\t def test_one(val)\n\t\t\t expected_count = { 2 => 1, 3 => 2, 4 => 3, 5 =>4, 6 => 5,\n\t\t\t 7 =>6, 8=>5, 9=>4, 10=>3, 11=>2, 12=>1 }\n\t\t\t\t freq = @values.size * (expected_count[val] / 36.0)\n\t\t\t\t delta = freq * 0.10\n\t\t\t\t\t assert((freq - delta) <= @counts[val] && @counts[val] <= (freq + delta))\n\t\t\t\t\t end\n\t\t\t\t\t\t \n\t\t\t\t\t\t (2..12).each do |n|\n\t\t\t\t\t\t\t test_one(n)\n\t\t\t\t\t\t\t end\n\n\t\t\tassert_equal(0, @counts[0])\n\t\t\tassert_equal(0, @counts[1])\n\t\t\tassert_equal(13, @counts.size)\n\n\tend",
"title": ""
},
{
"docid": "a94688d988bf40db8f97c04c5db398b9",
"score": "0.5528194",
"text": "def checkLength(freqArray, keyArray)\n total = 0\n keyArray.each do |k|\n total = total + k\n end\n if total < freqArray.length \n return -1\n else \n return total\n end\nend",
"title": ""
},
{
"docid": "d7a5e0940c25125d1bee0b88f7f303b3",
"score": "0.552323",
"text": "def check_keys\n \tnow = DateTime.now.iso8601\n if(DateTime.strptime(@@keys['google'][2].to_s) < now)\n @@keys['google'][2] = (DateTime.now + 1).iso8601\n @@keys['google'][1] = 25000\n end\n \n if(DateTime.strptime(@@keys['bing'][2].to_s) < now)\n @@keys['bing'][2] = (DateTime.now + 1).iso8601\n @@keys['bing'][1] = 50000\n end\n \n if(DateTime.strptime(@@keys['yandex'][2].to_s) < now)\n @@keys['yandex'][2] = (DateTime.now + 1).iso8601\n @@keys['yandex'][1] = 25000\n end\n end",
"title": ""
},
{
"docid": "fa8d3cc3dcd7b021d009b94072f44dd3",
"score": "0.5522558",
"text": "def valid_change_frequency?(change_frequency)\n VALID_FREQUENCY_VALUES.include? change_frequency\n end",
"title": ""
},
{
"docid": "b0a9376754ca26db0a014ed66752fde9",
"score": "0.5516916",
"text": "def frequency(notices, expected_notices)\n return 0 if notices.empty?\n range = if notices.size < expected_notices && notices.last.created_at > (Time.now - HOUR)\n HOUR # we got less notices then we wanted -> very few errors -> low frequency\n else\n Time.now - notices.map{ |n| n.created_at }.min\n end\n errors_per_second = notices.size / range.to_f\n (errors_per_second * HOUR).round(2) # errors_per_hour\n end",
"title": ""
},
{
"docid": "8257b328c641582970c042b03d9089ad",
"score": "0.55165964",
"text": "def infrequent_in_date\n return false if dates.nil?\n return false if frequency < 26\n \n expected_date = latest_date + frequency.weeks #Belt and Braces: the date array should already be sorted.\n expected_date > Date.local_today + 3.months\n end",
"title": ""
},
{
"docid": "3fea835183205bbce8977c5f5d6eaafc",
"score": "0.55006003",
"text": "def at_most_times_executed; end",
"title": ""
},
{
"docid": "3fea835183205bbce8977c5f5d6eaafc",
"score": "0.55006003",
"text": "def at_most_times_executed; end",
"title": ""
},
{
"docid": "913212556d077813c7d229e10f08b778",
"score": "0.5500562",
"text": "def frequency_twice(input_filename)\n current_frequency = 0\n frequency_hash = { current_frequency => 1 }\n\n while true\n File.readlines(input_filename).each do |line|\n if frequency_hash[current_frequency] == 2 # Seen a second time\n return current_frequency\n end\n\n current_frequency = add_frequency(current_frequency, line)\n frequency_hash[current_frequency] ||= 0\n frequency_hash[current_frequency] += 1\n end\n end\nend",
"title": ""
},
{
"docid": "5ab4a7d9a5351323aa8072b0801e0ead",
"score": "0.55004627",
"text": "def utilized?\n\n end",
"title": ""
},
{
"docid": "2a2274ca99b20fce42c2f70fcb175324",
"score": "0.5498761",
"text": "def day_one_part_two(input)\n sum = 0\n repeat = 1\n freq_res = Hash.new(0)\n while repeat != 0 do\n freq_array = structure_input(input).each do |i|\n sum+=i\n x = freq_res[sum]+=1\n if (x == 2)\n repeat = 0\n puts \"returning now\"\n break\n end\n end\n end\n return sum\nend",
"title": ""
},
{
"docid": "491ad205b70d0ff12aebd862cc2e851a",
"score": "0.5485734",
"text": "def used(n)\n end",
"title": ""
},
{
"docid": "c17f02322e938eda6dcab2e86edb2417",
"score": "0.54843336",
"text": "def precheck\n end",
"title": ""
},
{
"docid": "e792e4dc6ca93a668f74c318c761deb2",
"score": "0.5484056",
"text": "def calculate_freqs cardinality\n # for each symbols\n (0..self.length - 1).each { |s|\n self[s].symbol_card += 1 if cardinality[s] > 0\n }\n\n self.map { |f| f.freq = f.symbol_card.to_f / @documents_count.to_f }\n end",
"title": ""
},
{
"docid": "abb71e3081ee2afbd6e7b25e0401659c",
"score": "0.54796153",
"text": "def paralysis_check\n return rand(100)<Paralyze_check_rate\n end",
"title": ""
},
{
"docid": "474d49516af4035f126837a5f2a02bd1",
"score": "0.547922",
"text": "def filter_repeated\n occurrences = @event['check']['occurrences'] || 1\n interval = @event['check']['interval'] || 30\n refresh = @event['check']['refresh'] || 1800\n if @event['occurrences'] < occurrences\n bail 'not enough occurrences'\n end\n if @event['occurrences'] > occurrences && @event['action'] == 'create'\n n = refresh.fdiv(interval).to_i\n bail 'only repeating alert every ' + n.to_s + ' occurrences' unless @event['occurrences'] % n == 0\n end\n end",
"title": ""
}
] |
166e3d0d771c674c1a3b47ed5b4e44ae
|
Create friends if given a name instead of a person_id
|
[
{
"docid": "64dacc5f72682e9251cd6c38e2da46e4",
"score": "0.62440336",
"text": "def participations_attributes_change(attributes)\n return unless attributes\n attributes.each do |index, participation|\n person_id = participation[:person_id]\n if person_id !~ /^([0-9]+|)$/\n friend = current_user_or_guest.friends.where(name: person_id).first_or_create!\n attributes[index][:person_id] = friend.id\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "1ccc8eecd8699a625398065c52877c2e",
"score": "0.7673109",
"text": "def add_friend(name)\n # If friend does not already exist, create them without a phone number.\n friend = User.find_by_name name.downcase\n if !friend.nil? && !friend.id.nil?\n puts \"Found user, #{friend.id}, creating Friendship\"\n Friendship.create(:user_1_id => self.id, :user_2_id => friend.id)\n else\n friend = User.create :name => name.downcase\n if !friend.nil? && !friend.id.nil?\n puts \"Found no user, created use, #{friend.id}, creating Friendship\"\n Friendship.create(:user_1_id => self.id, :user_2_id => friend.id)\n else\n puts \"Found no user and could not create new User.\"\n return false\n end\n end\n end",
"title": ""
},
{
"docid": "804b993aaf87fe9b28ed7a5cba579f7e",
"score": "0.68177044",
"text": "def add_first_friend\n if User.count > 0\n f = self.friendships.create!(:friend_id => User.find_by_username(DEFAULT_FRIEND_NAME).id)\n f.status=true;\n f.save\n end\n end",
"title": ""
},
{
"docid": "6ff889c76b5fe911b085099ccf41a671",
"score": "0.6781067",
"text": "def befriend! new_friend\n run_callbacks :befriend do\n friendships.create! friend: new_friend\n end\n end",
"title": ""
},
{
"docid": "dd34f6d99eb062f1211855f210658abc",
"score": "0.6755421",
"text": "def create\n current_user.friends.create(\n friend_id: @user.id\n )\n redirect_to root_path\nend",
"title": ""
},
{
"docid": "4d7de78c12857e5c771fbb1118bd94f3",
"score": "0.6741334",
"text": "def befriend new_friend\n run_callbacks :befriend do\n friendships.create friend: new_friend\n end\n end",
"title": ""
},
{
"docid": "cc6ef7d2a4a77d485b25f551deaa589b",
"score": "0.6617152",
"text": "def friend(other_user)\n friendships.create!(friend_id: other_user.id)\n end",
"title": ""
},
{
"docid": "5732a839e8962c227207e1a633ed64dd",
"score": "0.661675",
"text": "def add_friend(friend)\n raise ArgumentError unless friend\n raise ArgumentError.new(\"Already friended\") if friends.include? friend\n\n f = Friendship.new :user_id => self.id, :friend_id => friend.id\n return f.save\n end",
"title": ""
},
{
"docid": "965751fb79c7299a745d6cba79a410a5",
"score": "0.66005486",
"text": "def create\n # prevent user from adding friends who are already on friends list.\n if @friendship\n render json: { Message: \"You're already friends!\" }, status: :unprocessable_entity\n else\n @friend = current_user.friendships.create(:friend_id => @friend_id)\n render json: @friend, status: 201\n end\n end",
"title": ""
},
{
"docid": "2c1cab7cbe569dde36ed22b7a14ef826",
"score": "0.6591847",
"text": "def add_friend\n # If there is no pending connection between persons,\n # add pendind/requested connections between them.\n # If there is already a pending connection requested from the other direction,\n # change friendship status to accepted.\n\n if (params['user_id'] == params['friend_id'])\n render_json :messages => \"Cannot add yourself to your friend.\", :status => :bad_request and return\n end\n\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n @friend = Person.find_by_guid(params['friend_id'])\n if ! @friend\n render_json :status => :not_found and return\n end\n\n if @person.association? or @friend.association?\n render_json :messages => \"Association users cannot have friends.\", :status => :bad_request and return\n end\n\n if @person.pending_contacts.include?(@friend) #accept if pending\n Connection.accept(@person, @friend)\n else\n unless @person.requested_contacts.include?(@friend) || @person.contacts.include?(@friend)\n Connection.request(@person, @friend) #request if didn't exist\n end\n end\n\n render_json :status => :ok\n end",
"title": ""
},
{
"docid": "abc4c896e2d3169587765640523c4f14",
"score": "0.6552507",
"text": "def create\n @user.make_friend_with! params[:id]\n render_created\n end",
"title": ""
},
{
"docid": "302f7e19a04ae13ef621cb01f1080d6b",
"score": "0.65248245",
"text": "def make_friendship!(other_user)\n relationship.create!(friend_id: other_user.id)\n other_user.relationship.create!(friend_id: self.id)\n return true\n end",
"title": ""
},
{
"docid": "c02d4713bedc7a5e8e7e6442cc535f28",
"score": "0.6519276",
"text": "def enfriend!(friend)\n friendships.create(friend: friend)\n friend.friendships.create(friend: self)\n end",
"title": ""
},
{
"docid": "1b0b11c110eeac26bd8455367f89996e",
"score": "0.64933246",
"text": "def add_future_friend(friend_id)\n add_future_params(:add_friends, [friend_id])\n end",
"title": ""
},
{
"docid": "720550a8b811a74912cd15e41d680bf2",
"score": "0.6441124",
"text": "def create_specific_friends\n @friend_id = 28 # gabriel\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n\n @friend_id = 25 # John\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n\n @friend_id = 24 # Sara\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n\n\n @friend_id = 29 # aubrey\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n\n\n @friend_id = 26 #artem\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n\n @friend_id = 32 #millu\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n @friend_id = 34 #marketing\n if User.exists?(id:@friend_id)\n Friend.create(user_id:@friend_id,user_id_friend:self.id)\n Friend.create(user_id:self.id,user_id_friend:@friend_id)\n end\n\n end",
"title": ""
},
{
"docid": "cb23b99c22d2d47fb8b41ed8c0ed509f",
"score": "0.6412022",
"text": "def add_friend\n\t\t# unless @current_user.friends.include? params[:id] \n\t\t@current_user.push(friends: params[:id])\n\t\t# push to friends array id number of friend\n\n\t\tredirect_to \"/profile/#{@current_user.id}\"\n\t\t# show the new friend\n\tend",
"title": ""
},
{
"docid": "62d0f4ad036826caf41038422f2f1c2f",
"score": "0.6381305",
"text": "def create_or_update_friendship(friend)\n if Friendship.find_by(user_id: friend.id, friend_id: id) ||\n Friendship.find_by(user_id: id, friend_id: friend.id)\n friendship = Friendship.find_by(user_id: friend.id, friend_id: id) ||\n Friendship.find_by(user_id: id, friend_id: friend.id)\n friendship.update(status: \"pending\")\n else\n Friendship.create(user_id: id, friend_id: friend.id, status: \"pending\")\n send_friend_request_email(friend.email, self.username)\n end\n end",
"title": ""
},
{
"docid": "f4e3cde3f8704732f38e5eff1537cb93",
"score": "0.6380483",
"text": "def make_friends_with(other_user)\n if (self != other_user) && !self.friends.include?(other_user)\n self.friendships.create!(friend: other_user)\n other_user.friendships.create!(friend: self)\n end\n end",
"title": ""
},
{
"docid": "bea678e162978177266de2b89add7584",
"score": "0.63627356",
"text": "def add_friend\n # check if this friend isnt't to our list friend\n if params[:user_id].to_i == params[:friend_id].to_i \n render json: {\n message: \"Not yourself\"\n }, status: 400\n else\n @current_user = User.find(params[:user_id])\n if @current_user.friend.find_by(friend: params[:friend_id])\n render json: {\n message: \"#{User.find(params[:user_id]).name} can't be added, You are friend with this user\",\n errors: {\n error_code: \"\",\n error_description: \"\"\n }\n }, status: 401\n else\n # add friend\n puts \"Starting adding friend ...\"\n @new = @current_user.friend.new(friend: params[:friend_id], status: :pending)\n if @new.save\n render json: {\n message: \"#{User.find(params[:user_id]).name} added as friend\"\n }, status: 201\n else\n render json: {\n message: @new.errors.messages\n }, status: 401\n end\n end\n end\n\n end",
"title": ""
},
{
"docid": "e69c4d6c4ef839236b6efd109a47570b",
"score": "0.63549006",
"text": "def create\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n unless relationship\n current_user.add_friend(User.find(params[:user_two_id]))\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n relationship.status = 1\n relationship.save\n end\n friend = User.find_friend(current_user, relationship)\n redirect_to friendlist_path\n end",
"title": ""
},
{
"docid": "7e2e862e9b376c2e1d8cf4342057a83b",
"score": "0.63531524",
"text": "def create \n @friend = User.find(params[:friend_id])\n @friendship = Friendship.create_or_accept(@user, @friend) \n\n flash[:notice] = \n if @user.is_friends_with?(@friend)\n \"You and #{@friend.login} are now friends!\"\n else\n \"You are now an admirer of #{@friend.login}\"\n end\n\n redirect_to user_path(@friend)\n end",
"title": ""
},
{
"docid": "fb3469482722a04279997f9ca84faf1c",
"score": "0.6350978",
"text": "def new_friend(person, new_friend)\n return person[:friends] << new_friend\nend",
"title": ""
},
{
"docid": "7e74dcac46dd37aefe7731c8d1e82c5f",
"score": "0.6341427",
"text": "def friend\n @user.friendships.build(friend_id: @friend.id)\n if @user.save\n render json: { success: true }\n else\n render json: {message: @user.errors&.messages || 'Unable add as friend, please try again'}, status: 202\n end\n end",
"title": ""
},
{
"docid": "1768ef7bb6565cdd6cadf6379bec78d1",
"score": "0.6301491",
"text": "def become_friends_with(friend)\n unless self.is_friends_with?(friend)\n unless self.is_pending_friends_with?(friend)\n Friendship.create!(:friendshipped_by_me => self, :friendshipped_for_me => friend, :accepted_at => Time.now)\n else\n self.friendship(friend).update_attribute(:accepted_at, Time.now)\n end\n else\n self.friendship(friend)\n end\n end",
"title": ""
},
{
"docid": "7098433588908c149b08b4515097e4f8",
"score": "0.62880415",
"text": "def add_friend_request(user_id)\n friend_suggestions.where(user_id: user_id).delete_all\n req = pending_friends.where(id: user_id).first\n if req.present?\n req.accept!\n else\n req = UserFriendRelationship.between(user_id, id).first || user_friend_relationships.create(user_to_id: user_id)\n PubSub::Publisher.new.publish_for([req.user_to], 'friend_request', {source: self.as_basic_json}, {title: full_name(false), body: 'wants to be your friend'})\n end\n # reset_cache('suggested_friends')\n end",
"title": ""
},
{
"docid": "e927e051dfb4ce88e246cbcdc8026dec",
"score": "0.62558854",
"text": "def add_friends\n @params[:friend_ids].each do |id|\n @plan.users_plans.new(user_id: id)\n end\n end",
"title": ""
},
{
"docid": "b1a19b0df6f8b5ac0a20b6baabc5a9a4",
"score": "0.6247622",
"text": "def become_friends_with(friend)\n \t unless self.is_friends_with?(friend)\n \t unless self.is_pending_friends_with?(friend)\n \t ::Friendship.create!(\n\t\t\t\t\t\t\t\t:friendshipped_by_me => self,\n\t\t\t\t\t\t\t\t:friendshipped_for_me => friend,\n\t\t\t\t\t\t\t\t:accepted_at => Time.now)\n \t else\n \t self.friendship(friend).update_attribute(:accepted_at, Time.now)\n \t end\n \t else\n \t self.friendship(friend)\n \t end\n \t end",
"title": ""
},
{
"docid": "45c3c7474b33f78e71781bb17bd7292f",
"score": "0.6228205",
"text": "def add_fb_friends(fb_user_info)\n friend_ids = self.friends.pluck(:id)\n\n (fb_user_info ||= []).each do |index, friend|\n\n auth = UserAuthentication.find_by(provider: \"facebook\", uid: friend['id'])\n user_friend = auth.user if auth\n\n if user_friend && !(friend_ids.include? user_friend.id)\n self.friended_users << user_friend\n end\n end\n end",
"title": ""
},
{
"docid": "1440c5e333c9c019225c73f3ba78c9fe",
"score": "0.62240446",
"text": "def request_friend(friend)\n self.friendships.create!(friend_id: friend.id, status: 'requested')\n friend.friendships.create!(friend_id: self.id, status: 'pending')\n end",
"title": ""
},
{
"docid": "044601c3ae30699761d016c956760891",
"score": "0.62200683",
"text": "def fetch_facebook_friends(facebook_user)\n #facebook_user.friends.collect(&:id).each do |friend_id|\n # unless self.facebook_friends.collect(&:facebook_id).include?(friend_id.to_s)\n # self.facebook_friends.create!(:facebook_id => friend_id)\n # end\n #end\n end",
"title": ""
},
{
"docid": "e9085881154a5ecdf60942fa81649888",
"score": "0.6218892",
"text": "def create\n @friendship = current_user.friendships.build(friend_id: params[:friend_id])\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:alert] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "5071480deeefdc2cadf83e9a318ba37b",
"score": "0.6213056",
"text": "def request_friendship_with(friend)\n\t\t\t\t\tunless is_friends_or_pending_with?(friend) || self == friend\n \t \t::Friendship.create!(:friendshipped_by_me => self, :friendshipped_for_me => friend)\n\t\t\t\t\tend\n \t end",
"title": ""
},
{
"docid": "44bf5da91be5a85ae32fdedee7496440",
"score": "0.6183372",
"text": "def add_friend(person, name)\n person[:friends].push(name)\nend",
"title": ""
},
{
"docid": "11d007d9417bbababa51553c8a5b5fa8",
"score": "0.61774045",
"text": "def create\n\n if current_user.friends.include?(params[:friend_id])\n flash[:notice] = \"It's polite to ask once.\"\n else\n\n\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n\n if @friendship.save\n\n\n\n log_activity\n\n flash[:notice] = \"Friend requested.\"\n\n\n\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end\n end",
"title": ""
},
{
"docid": "639e98c2a950a61e6886e8ca5d939f2d",
"score": "0.61702013",
"text": "def add_friend\n # byebug\n #we get user_id from jwt!\n user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n #we get friend_id from frontend\n if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty?\n return render json: {error: \"There was a problem! (Ya been blocked!)\"}\n end\n\n followee = User.find(follow_params[:user2])\n #insert the one way relation in db!\n friend_request = Follow.new(follower_id: user.id, followee_id: followee.id)\n if friend_request.save\n render json: {friend_request: followee} \n else\n render json: {error: \"There was a problem!\"}\n end\n end",
"title": ""
},
{
"docid": "c7259a87a36cc3ccde31a39c14f4fa69",
"score": "0.6168942",
"text": "def follow!(amigo_id)\n self.friendships.create!(friend_id: amigo_id)\n \n end",
"title": ""
},
{
"docid": "5e03561f61f2152d30ae838df735aa10",
"score": "0.6167521",
"text": "def create\n logger.debug('In the create method afterall')\n logger.debug( friend_params )\n current_user.friendships.create!(:friend_id => params[:friend_id]) \n\n redirect_to friendship_index_path\n end",
"title": ""
},
{
"docid": "431b6f45c66f1b8e0a19ea703dfc0913",
"score": "0.61652035",
"text": "def request_friendship(user_2)\n \tself.friendships.create(friend: user_2)\n end",
"title": ""
},
{
"docid": "e1719653109b856692f60fb06406b055",
"score": "0.6164506",
"text": "def request_friendship(user_2)\n self.friendships.create(friend: user_2)\n end",
"title": ""
},
{
"docid": "c652ee1e7f78984dc8cb8dce485d0626",
"score": "0.6162528",
"text": "def friend\n if params.include?(:id)\n @user.friends += [User.find(params[:id])]\n elsif params.include?(:username)\n @user.friends += [User.find_by(username: params[:username])]\n end\n redirect_to root_path\n end",
"title": ""
},
{
"docid": "08a8302a37cf151406786f940f45eb01",
"score": "0.6162053",
"text": "def fb_add_friend(name = 'Add as a friend', options = {})\n options = {\n :method => 'friends',\n :callback => 'function(response) {}'\n }.merge(options)\n\n fb_ui name, options\n end",
"title": ""
},
{
"docid": "5594fc189c37e684e4f1d8c3c99acc44",
"score": "0.6153976",
"text": "def create_for(user, friend)\n # First check, if the friendship already exsits or the users are equal\n if user == friend or not Friendship.friendship_for_users(user.id, friend.id).blank?\n return nil\n end\n friendship_2 = nil\n # Create the friendship in a transaction\n transaction do\n friendship_1 = create(:user => user, :friend => friend, :user_type => \"User\")\n UserMailer.deliver_friendship_request(friendship_1)\n \n friendship_2 = create(:friend => user, :user => friend, :user_type => \"User\")\n friendship_2.pend!\n end\n friendship_2\n end",
"title": ""
},
{
"docid": "9b5cc5ed0f154b71b05128ef30a402a0",
"score": "0.6143634",
"text": "def create\n @friendship = current_user.friendships.build(:friend_id => params[:id])\n \n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_path\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_path\n end\n end",
"title": ""
},
{
"docid": "9b04b42729903b6838c5664e9896a59f",
"score": "0.614121",
"text": "def add\n id = params.require(:friend_id)\n current_user.friendships.create friend_id: id\n\n respond_to do |format|\n format.html { redirect_to friends_path, alert: \"#{User.find(id).name} is now your friend\" }\n format.json { render :json => {success: 'OK'} }\n end\n end",
"title": ""
},
{
"docid": "51118f52dba1b71e53de61027110a49f",
"score": "0.61302817",
"text": "def create\n \n @friendship1 = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n @friendship1.original = true\n @user_being_friended = User.find(params[:friend_id])\n @friendship2 = @user_being_friended.friendships.build(:friend_id => current_user.id, approved: \"false\")\n @friendship2.original = false\n if !(Friendship.where(friend_id: params[:friend_id], user_id: current_user.id).count >= 1)\n if @friendship1.save && @friendship2.save\n flash[:notice] = \"Friend requested.\"\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n else\n flash[:notice] = \"Friend requested again.\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "baa4f84ad20474b65c3e158775d2206b",
"score": "0.61052066",
"text": "def request_friendship_with(friend)\n Friendship.create!(:friendshipped_by_me => self, \n :friendshipped_for_me => friend) unless self.is_friends_or_pending_with?(friend) || self == friend\n end",
"title": ""
},
{
"docid": "385f9964f714d1013a8ea310f168e686",
"score": "0.60770994",
"text": "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n @friendship.status = \"SENT\"\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to root_url\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "56b4bf4f78937c6b8de8c9ef6698d160",
"score": "0.60682917",
"text": "def create\n if current_user.friends.exists?(params[:friend_request][:receiver_id])\n redirect_to users_show_path(current_user), flash: {notice: \"You are already friend\"}\n else\n @friend_request = FriendRequest.new(friend_request_params.merge(sender_id: current_user.id))\n respond_to do |format|\n if @friend_request.save\n format.html { redirect_to @friend_request, notice: 'Friend request was successfully created.' }\n format.json { render :show, status: :created, location: @friend_request }\n else\n format.html { render :new }\n format.json { render json: @friend_request.errors, status: :unprocessable_entity }\n end\n end\n\n end\n\n\n end",
"title": ""
},
{
"docid": "e1ce708d0133020ff51cd66e65bdb638",
"score": "0.6066829",
"text": "def make_friends(user, target)\n return false if user.blank? || target.blank? || user == target\n transaction do\n begin\n self.find(:first, :conditions => {:inviter_id => user.id, :invited_id => target.id, :status => MuckFriends::FOLLOWING}).update_attribute(:status, MuckFriends::FRIENDING)\n friend = self.create!(:inviter_id => target.id, :invited_id => user.id, :status => MuckFriends::FRIENDING)\n friend.add_friends_with_activity\n rescue Exception\n return make_friends(target, user) if user.followed_by?(target)\n return add_follower(user, target)\n end\n end\n true\n end",
"title": ""
},
{
"docid": "493008f1c298a7998bd6095f608b54c2",
"score": "0.6057395",
"text": "def user_already_friend(friend_id)\n @friend = Friendship.where('friend_id = ' + friend_id.to_s + \" AND user_id = \"+id.to_s)[0]\n return !@friend.blank?\n end",
"title": ""
},
{
"docid": "e42894f06fcb8d6df7b852251b9d4825",
"score": "0.605261",
"text": "def create_friends(db, name, status, check_in)\r\n\tdb.execute('INSERT INTO friends (name, status, check_in) VALUES\t(?, ?, ?)', [name, status, check_in])\r\nend",
"title": ""
},
{
"docid": "c0a0bc92bc0b0c363ac0987d5e60cf2d",
"score": "0.6033376",
"text": "def add\n params[:friends].each do |email|\n friend = User.find_by_email(email)\n next unless friend.present?\n\n # Check the inverse friendship and add if necessary\n friendship = Friendship.find_by_user_id_and_friend_id(friend.id, current_user.id)\n unless friendship.present?\n inverse_friendship = friend.friendships.build(friend_id: current_user.id)\n if inverse_friendship.save\n puts \"Added friendship for #{friend.name} (#{friend.id}) and #{current_user.name} (#{current_user.id})\"\n end\n end\n end\n\n render json: { success: true }\n end",
"title": ""
},
{
"docid": "2a10be181e95e1aecaeebcdfa5b9f701",
"score": "0.6020984",
"text": "def create\n @friend = Friend.new(params[:friend])\n case @friend.profile_url\n when %r!facebook\\.com/profile\\.php\\?id=(\\d+)!\n friend_info = rest_graph.get($1)\n @friend.user_id = friend_info[\"id\"]\n @friend.user_name = friend_info[\"name\"]\n when %r!facebook\\.com/([^?]+)!\n friend_info = rest_graph.get($1)\n @friend.user_id = friend_info[\"id\"]\n @friend.user_name = friend_info[\"name\"]\n end\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to(@friend, :notice => 'Friend was successfully created.') }\n format.xml { render :xml => @friend, :status => :created, :location => @friend }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c1b057275e469a0f0f173b9cb2511188",
"score": "0.6007415",
"text": "def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end",
"title": ""
},
{
"docid": "8dfabe5a71eca1f829d4aef5ea08e7c5",
"score": "0.6004079",
"text": "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n if @friendship.save\n flash[:notice] = t('friendship.create')\n else\n flash[:notice] = t('friendship.create_error')\n end\n redirect_to friendships_path\n end",
"title": ""
},
{
"docid": "0cb1dd17469ba2128f331c05befcb0d0",
"score": "0.5976522",
"text": "def create\n @friend = Friend.new(friend_params)\n flash[:notice] = if @friend.save\n \"You Sent Friend request to #{@friend.user.name}\"\n else\n \"You already Added #{@friend.user.name} to your list\"\n end\n redirect_to users_path\n end",
"title": ""
},
{
"docid": "bc20af905a594faa9d70e5a216ba98ec",
"score": "0.5972908",
"text": "def addFriend\n #Now i have this friend data from the data base and i already have the groupId\n #get the friend name\n @notify = current_user.invited_members;\n\t\t@friendName = params[:name]\t\n #check if it is null\n if @friendName.empty?\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Please insert some data !' }\n format.json { head :no_content }\n end\n else\n #check if it is wrong type\n if User.exists? name: @friendName\n #it is really a user\n #check if he is tring to add himself\n if @friendName == current_user.name\t\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'Cant inser your self!' }\n format.json { head :no_content }\n end\n else\t\n #check if the user exist in the group itself before\n @fid = User.find_by(name: params[:name])\n @current_group = Group.find(params[:groupId])\n if @current_group.group_members.exists? user: @fid.id \t \n puts \"why you are tring to add the same friend\"\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This Friend is already assigned to this group !!' }\n format.json { head :no_content }\n end\n else\n #check if this user in friendship list or not\n @fid = User.find_by(name: params[:name])\n @user = current_user\n if @user.user_friends.exists? friend: @fid.id\n @fid = User.find_by(name: params[:name])\n @gid = params[:groupId]\n @group = @fid.group_members.create(group_id: @gid)\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This Friend is Add !!' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This user is not currently in your friend list! !!' }\n format.json { head :no_content }\n end\n \t\n end\n end\t\t\t\t\t\n \n \n end\t\n else\n #it is a robot\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'This user is not exist !' }\n format.json { head :no_content }\n\n end\t\n end\n end\t\t\n\n end",
"title": ""
},
{
"docid": "3707314b236067e80dfac93494fa6f8d",
"score": "0.59714746",
"text": "def create\n @friendship = current_user.friendships.build(friend_id: params[:friend_id])\n @valid = @friendship.save\n respond_to do |format|\n format.html do\n if @valid\n flash[:success] = \"Friended.\"#{@friendship.friend.username} \n else\n flash[:error] = \"Unable to add friend.\"\n end\n redirect_to :back\n end\n format.js do\n if current_user.mutual_friends.include? @friendship.friend\n @new_friend = @friendship.friend\n inverse_friendship = current_user.inverse_friendships.where(user: @friendship.friend).first\n end\n end\n end\n end",
"title": ""
},
{
"docid": "dba3012dfbfffd32676a4bc63c1bce98",
"score": "0.59618205",
"text": "def accept\n\t\tuser.friends << friend\n\t\tdestroy\n\tend",
"title": ""
},
{
"docid": "3f81d9a3c7a2b65153345f80066ab913",
"score": "0.59534854",
"text": "def check_if_already_friends\n unless Friendship.find_friendship(requester_id, requestee_id).nil?\n errors.add(:base, \"You are already friends with this user\")\n end\n end",
"title": ""
},
{
"docid": "a180e3611b5c65cf7d533cce617f2515",
"score": "0.5949605",
"text": "def friend_params\n params.require(:friend).permit(:user_id, :name)\n end",
"title": ""
},
{
"docid": "04ba514f5263433177113de9c96004d7",
"score": "0.59383965",
"text": "def add_friend(person, new_friend)\n person[:friends].push(new_friend)\n return person[:friends].length()\nend",
"title": ""
},
{
"docid": "ebc456cc953c2fc3f417d398e10a900b",
"score": "0.5925356",
"text": "def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end",
"title": ""
},
{
"docid": "4b618362422c50c6ab3f11d3ed366e06",
"score": "0.5916096",
"text": "def add_family!(family_name)\n self.family = Family.where(name: family_name).first_or_create! \n self.save!\n end",
"title": ""
},
{
"docid": "d279b84a897b7bc426552b19a25264af",
"score": "0.5896712",
"text": "def make_friends(user, target)\n transaction do\n begin\n find_friendship(user, target, :pending).update_attribute(:status, :accepted)\n Friendship.create!(:inviter_id => target.id, :invited_id => user.id, :status => :accepted)\n rescue Exception\n return make_friends(target, user) if user.followed_by? target\n return add_follower(user, target)\n end\n end\n true\n end",
"title": ""
},
{
"docid": "45e3d2f95a4f9362859262764ac140f6",
"score": "0.5890306",
"text": "def inverse_friendship\n return if new_user_or_friend?\n\n return unless FriendshipsQuery.new.friends?(user_id: user.id, friend_id: friend.id)\n\n errors.add(:user_id, :already_friends)\n end",
"title": ""
},
{
"docid": "d78880b2bdef369692f61f9a9956cc97",
"score": "0.58857477",
"text": "def add_friend(db, friend_name, age, birth_month, birth_day, likes_birthdays)\n db.execute(\"INSERT INTO friends (friend_name, age, birth_month, birth_day, likes_birthdays) VALUES (?, ?, ?, ?, ?)\", [friend_name, age, birth_month, birth_day, likes_birthdays])\nend",
"title": ""
},
{
"docid": "1321273cd4158eee954b34bb9b39b855",
"score": "0.58791417",
"text": "def add_friend(person, friend_to_add)\n person[:friends] << friend_to_add\n return person[:friends].length()\nend",
"title": ""
},
{
"docid": "75ad643388375b88f3d50b43dc32da0b",
"score": "0.5867743",
"text": "def friend_params\n params.require(:friend).permit(:id, :name)\n end",
"title": ""
},
{
"docid": "05ae61259e59395114c503215de7d7e2",
"score": "0.58627075",
"text": "def add_friend\n\n current_user.friends_list.push(define_friend)\n # binding.pry\n if current_user.save\n render json: current_user \n else\n render json: @user.errors, status: 422\n end\n\n end",
"title": ""
},
{
"docid": "c2d94cd329af04b87597cf21b523cae6",
"score": "0.586188",
"text": "def add_xo_monster_friendship!\n xo_monster_id = Rails.configuration.xo_monster['id']\n return if id == xo_monster_id\n Friendship.create(sender_user_id: xo_monster_id,\n receiver_user_id: id,\n confirmed: true)\n end",
"title": ""
},
{
"docid": "3707b460e76066537a10d15599644a93",
"score": "0.58543044",
"text": "def add_friend(person, friend)\nperson[:friends].push(friend)\nend",
"title": ""
},
{
"docid": "3707b460e76066537a10d15599644a93",
"score": "0.58543044",
"text": "def add_friend(person, friend)\nperson[:friends].push(friend)\nend",
"title": ""
},
{
"docid": "e6b97b6698f26df7d2fb4f864ca2ba58",
"score": "0.5850506",
"text": "def create\n @friend = Friend.new(friend_params)\n if @friend.save\n redirect_to friends_serch_path\n elsif Friend.find_by(user_id: friend_params[:user_id], to_id: friend_params[:to_id]).establish?\n redirect_to friends_serch_path, error: ['もう友達だよーん']\n else\n redirect_to friends_serch_path, error: @friend.errors.full_messages\n end\n end",
"title": ""
},
{
"docid": "e07ea9bfe618462ea6c9b0c63a8e1588",
"score": "0.58500063",
"text": "def assign_name\n friend = User.find self.friend_id\n self.name = friend.username\n end",
"title": ""
},
{
"docid": "e2eeea105bdc8641c213d3c47c81cd51",
"score": "0.5847944",
"text": "def add_friend_ids=(attributes)\n # I need this custom attr because without it, the friends that were previously saved are not appended to the new\n # friends that are added in the add_friend form.\nattributes[:friend_ids].each do |attribute|\n if attribute != \"\"\n friend = User.find(attribute)\n create_this_transaction(self, friend.id, attributes[:transactions][:amount])\n set_relationship_for_friendship(friend, attributes)\n if !self.friends.include?(friend)\n self.friends << friend\n end\n end\n end\n self.save\nend",
"title": ""
},
{
"docid": "b3d17dc76ff98394d91991155f3a99cb",
"score": "0.58478236",
"text": "def create\n #@friendrequest = Friendrequest.new(params[:friendrequest])\n \n @user = User.find(params[:user_id])\n #@friend = Friend.new(params[:friend])\n @friendreq = @user.friendrequests.create(params[:friendrequest].permit(:futurefriend))\n\n respond_to do |format|\n if @friendrequest.save\n format.html { redirect_to @friendrequest, notice: 'Friendrequest was successfully created.' }\n format.json { render json: @friendrequest, status: :created, location: @friendrequest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @friendrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "76c0edeb3197fc5064d7cd88b0b64f2f",
"score": "0.58469445",
"text": "def create\n @plant = Plant.find(params[:plant])\n @friendship = @plant.friendships.build(:friend_id => params[:friend])\n if @friendship.save\n flash[:notice] = \"added friend\"\n redirect_to request.referrer\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to request.referer\n end\n end",
"title": ""
},
{
"docid": "745672489a9e2aca64e5522b633b2dd1",
"score": "0.5844786",
"text": "def create\n user = User.find(params[:friend_id])\n if current_user == user\n redirect_to root_path, notice: \"You can't send request to yourself\"\n return\n elsif Friendship.where(friend_id: user.id, user_id: current_user, confirm: false).exists?\n redirect_to root_path, notice: \"Friend request already sent\"\n return\n elsif Friendship.where(friend_id: current_user, user_id: user.id, confirm: false).exists?\n redirect_to root_path, notice: \"This user already sent friend request to you. Respond to it!\"\n return\n end\n @friendship = current_user.friendships.build(friend_id: user.id)\n\n respond_to do |format|\n if @friendship.save\n format.html { redirect_to root_path, notice: \"Friends request sent\" }\n format.json { render :show, status: :created, location: @friendship }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friendship.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "83d5d641361c3b268bdf9de6d211136f",
"score": "0.5839414",
"text": "def create\n if params[:invitee_email]\n @friend = User.where(params[:invitee_email])\n @friendship = current_user.friendships.new(invitee_email :@friend)\n if @friendship.save\n flash[:success] = \"Congrats! You are now friends.\"\n else\n flash[:error] = \"Oops! There's been a mistake.\"\n redirect_to profile_path(@friend)\n end\n end\n end",
"title": ""
},
{
"docid": "97521d8ff266ffdf3e0decaeaf5db619",
"score": "0.58375114",
"text": "def create\n # @friend = Friend.new(friend_params)\n @friend = current_user.friends.build(friend_params)\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: I18n.t('friend.create') }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0a4cba242907d057ebf9717acc801e97",
"score": "0.5829735",
"text": "def request_friendship (user_2)\n #self will be current user (user_1)\n self.friendships.create(friend: user_2)\n end",
"title": ""
},
{
"docid": "10a3125d992d6e378925b224b5ea2468",
"score": "0.58283085",
"text": "def invite_facebook_friends\n end",
"title": ""
},
{
"docid": "6a03e19f1074fd11a599f43b4b7e5db9",
"score": "0.58126736",
"text": "def create\n @friend = Friend.new(params[:friend])\n\t@friend.user_id = flash[:user_id]\n @friend.image_url = \"http://128.100.195.55:3000/content/friendphoto2.jpg\";\n @user = User.find(@friend.user_id);\n @user.friends << @friend;\n \n respond_to do |format|\n if @friend.save\n flash[:notice] = 'Friend was successfully created.'\n format.html { redirect_to(@friend) }\n format.xml { render :xml => @friend, :status => :created, :location => @friend }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @friend.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3494442497a34b70e17ebce8358028db",
"score": "0.57939124",
"text": "def create\n @friend = Friend.new(user_id: params[:user_id], friend_id: params[:friend_id])\n\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc11c96c3b5f5ec3ad02011500a87be3",
"score": "0.5791139",
"text": "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end",
"title": ""
},
{
"docid": "cc11c96c3b5f5ec3ad02011500a87be3",
"score": "0.5791139",
"text": "def friend(note = nil)\n name = get_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n @client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end",
"title": ""
},
{
"docid": "3f004985fecf097b37115761a1e02112",
"score": "0.5775826",
"text": "def friend(note = nil)\n name = read_attribute(:name)\n body = JSON.generate(note ? { name: name, note: note } : { name: name })\n client.request(:put, \"/api/v1/me/friends/#{name}\", body: body)\n end",
"title": ""
},
{
"docid": "b077e6569182f3f72800f1828a34d3bf",
"score": "0.57650423",
"text": "def build_friendships\n graph = Koala::Facebook::API.new(self.f_token)\n friends = graph.get_connections('me', 'friends')\n\n # update users and user_user_link relation\n friends.each do |friend|\n user = User.where(:f_id => friend['id']).first_or_create\n user.update!({ :name => friend['name'] })\n user.update_friends_count\n self.user_user_links.where(:user_id => self.f_id, :friend_id => user.f_id).first_or_create\n end\n\n # delete user_user_link is not facebook friend anymore\n friend_ids = friends.collect{ |friend| friend['id'] }\n self.user_user_links.where('user_user_links.friend_id not in (?)', friend_ids).destroy_all\n\n self.update!({ :friends_updated_at => Time.now })\n end",
"title": ""
},
{
"docid": "1d115536067464e8791f1f8004b2e1d5",
"score": "0.57588816",
"text": "def create\n @friendship = current_user.friendships.build(:friend_id => params[:friend_id], approved: \"false\")\n if @friendship.save\n flash[:notice] = \"Friend requested.\"\n redirect_to :back\n else\n flash[:error] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "d0023e7a80080d99b8b7f17807d9d15f",
"score": "0.5758352",
"text": "def create\n #@friend = Friend.new(friend_params)\n @friend = current_user.friends.build(friend_params)\n respond_to do |format|\n if @friend.save\n format.html { redirect_to @friend, notice: \"Friend was successfully created.\" }\n format.json { render :show, status: :created, location: @friend }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friend.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e166950ba0f2644495467cdfdf6b7c45",
"score": "0.57533616",
"text": "def test_add_friend__works\n result = add_friend(@person1, \"George\")\n end",
"title": ""
},
{
"docid": "c968fc3d77741d9f07ea52125993af72",
"score": "0.57419467",
"text": "def friends_with_creator\n\tcheck_friends_with_creator(current_user.friends?(@micropost.user))\n end",
"title": ""
},
{
"docid": "70dc23cfa18cd0601004d2529df83751",
"score": "0.57385993",
"text": "def create\n user = User.find(params[:user_id])\n friendship = current_user.friendships.build(friend: user)\n if friendship.save\n reciprocal_friendship = user.friendships.build(friend: current_user)\n if reciprocal_friendship.save\n request_1 = FriendshipRequest.find_by(sender: current_user, recipient: user)\n request_2 = FriendshipRequest.find_by(sender: user, recipient: current_user)\n request_1.destroy if request_1\n request_2.destroy if request_2\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: \"You and #{user.name} are now friends!\") }\n format.json do\n render json: {\n friendship: {\n name: current_user.name,\n id: current_user.id\n },\n message: \"You and #{user.name} are now friends!\"\n }\n end\n end\n else\n friendship.destroy\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n else\n redirect_back(fallback_location: root_path, notice: \"There was an error creating the friendship\")\n end\n end",
"title": ""
},
{
"docid": "c0a4e6dcb56bef700f6d4eaab2e64e9b",
"score": "0.57339823",
"text": "def make_friend_with(username)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_post_call('/friends/%s/request' % [username]).status == \"OK\"\n end",
"title": ""
},
{
"docid": "00709295b5cf59a707ec2f72b11c8e37",
"score": "0.5733251",
"text": "def add_friends(friends_array,name)\n friends_array << name\nend",
"title": ""
},
{
"docid": "c16885403c85e7bb0bd18e91bcd2d9e0",
"score": "0.5730314",
"text": "def sync_facebook_friends\n find_facebook_friends_with_accounts.each do |auth| \n if !friend?(auth)\n Friendship.create! do |f|\n f.user_id = self.id\n f.friend_id = auth.id\n end\n end\n \n # Create the inverse friendship to save\n # extra db taxes later when the user logs in\n if !inverse_friend?(auth)\n Friendship.create! do |f|\n f.user_id = auth.id\n f.friend_id = self.id\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ca8d2d6108df43e37e8b9d3c71e30919",
"score": "0.5727237",
"text": "def friend_params\n params.require(:friend).permit(:friend_name)\n end",
"title": ""
},
{
"docid": "c9e4667eb3d9b01a72f5b68b0ba47392",
"score": "0.5721326",
"text": "def save\n return false unless valid?\n Friendship.create( member: member1, friend: member2 ) && Friendship.create( member: member2, friend: member1 )\n end",
"title": ""
},
{
"docid": "5119a88d128bd6db29d2056c972fa67f",
"score": "0.5720471",
"text": "def create\n @user = User.find_by(:email => friendship_params[:email])\n if @user.nil?\n render json: { error: \"Cannot find user with specified email\"}, status: 400\n else\n id = @user.firstName\n if Friendship.exists?(:user_id => @current_user.id, :friend_id => @user.id)\n render json: { error: 'Already Friends'}, status: 400\n else\n @friendship = @current_user.friendships.build(:friend_id => @user.id)\n if @friendship.save\n @friend_user = @friendship.friend\n @inverse_friendship = @friend_user.friendships.build(:friend_id => @current_user.id)\n if @inverse_friendship.save\n render json: @friendship, status: :created\n else\n render json: @inverse_friendship.errors, status: :unprocessable_entity\n end\n else\n render json: @friendship.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"title": ""
},
{
"docid": "fc9167e930b6be69d3601b44d8ecf4c4",
"score": "0.57195807",
"text": "def add_friends( whose, conn, friends )\n friends[whose] = true\n links = conn.delete( whose )\n return unless links\n\n # We added the user; now add all of their connections. Tack them on to the\n # end of the list (dropping duplicates) as we run through it, so they will\n # be similarly processed in turn. We must continue to make passes through\n # the list until it stopped growing, at which point we know we've added\n # all the friends and friends of friends of the first user. \n count = 0\n until count == links.size\n count = links.size\n\n links.keys.each do |link|\n sublinks = conn.delete( link )\n links.merge!( sublinks ) if sublinks\n end\n end \n\n # Now that we have the definitive list of this user's connections (and\n # their connections), tag them all as friends of the PM.\n friends.merge!( links )\n end",
"title": ""
}
] |
72a78394d73a3dae7ef84166464e4717
|
Create the files given the url and the local name of file.
|
[
{
"docid": "74b643940cf896fb29763f725456eec6",
"score": "0.66187596",
"text": "def get_file(name,url)\n open(name, 'wb') do |file|\n file << open(url).read\n end\nend",
"title": ""
}
] |
[
{
"docid": "dc8b983a4bba6c11b38e122a620cbc5f",
"score": "0.76481205",
"text": "def create_file_from_url(url, file_name)\n ::FileSet.new(import_url: url, label: file_name) do |fs|\n actor = Hyrax::Actors::FileSetActor.new(fs, user)\n actor.create_metadata(visibility: curation_concern.visibility)\n actor.attach_file_to_work(curation_concern)\n apply_saved_metadata(fs, curation_concern)\n fs.save!\n uri = URI.parse(URI.encode(url))\n if uri.scheme == 'file'\n IngestLocalFileJob.perform_later(fs, URI.decode(uri.path), user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: user))\n end\n end\n end",
"title": ""
},
{
"docid": "e9ac11f8f5f7126fe1bebfcf32b9a284",
"score": "0.7322222",
"text": "def create_file_from_url(url, file_name)\n generic_file = ::GenericFile.new(import_url: url, label: file_name).tap do |gf|\n actor = Sufia::GenericFile::Actor.new(gf, current_user)\n actor.create_metadata(params[:batch_id])\n gf.save!\n Sufia.queue.push(ImportUrlJob.new(gf.id))\n end\n end",
"title": ""
},
{
"docid": "20eb4602d5d8f8d3953182b62eb628ab",
"score": "0.7102714",
"text": "def create_file_from_url(env, uri, file_info, auth_header = {})\n ::FileSet.new(import_url: uri.to_s, label: file_info[:file_name]) do |fs|\n actor = Hyrax::Actors::FileSetActor.new(fs, env.user)\n# TODO: add more metadata\n# TODO: reconsider visibility\n actor.create_metadata(visibility: env.curation_concern.visibility)\n fs.save!\n # TODO: add option for batch vs single assignment?\n @file_sets << fs\n structure_to_repo_map[file_info[:id]] = fs.id\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end",
"title": ""
},
{
"docid": "8d634fc36ebe95e6a50a8f9dd051b74f",
"score": "0.69719636",
"text": "def create_file_from_url(env, uri, file_name, auth_header = {})\n ::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|\n actor = file_set_actor_class.new(fs, env.user)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n fs.save!\n ordered_members << fs\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end",
"title": ""
},
{
"docid": "a53a134af2fb5d98a3245cad91c1ccf7",
"score": "0.6960494",
"text": "def create_file_from_url(env, uri, file_name, _auth_header = {})\n ::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|\n actor = Hyrax::Actors::FileSetActor.new(fs, env.user)\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n apply_saved_metadata(fs, env.curation_concern)\n fs.save!\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = CGI.unescape(uri.path)\n IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ImportUrlJob.perform_later(fs, operation_for(user: actor.user))\n end\n end\n end",
"title": ""
},
{
"docid": "db254e799ef59348df13108a1593e3f3",
"score": "0.6939307",
"text": "def download_file(url, local_path)\n local_path += \"/\" unless local_path.match(/\\/$/)\n `mkdir -p #{local_path}`\n \n uri = URI.parse(url)\n filename = uri.path.split(\"/\").last\n \n # If file already exists locally, give it a new randomized name to avoid clashes\n filename = Digest::MD5.hexdigest(Time.now.to_s) + \"-#{filename}\" if File.exists?(local_path + filename)\n\n writeOut = open(local_path + filename, 'wb')\n writeOut.write(open(uri).read)\n writeOut.close\n\n # return the download file local path\n local_path + filename\nrescue OpenURI::HTTPError => ex\n puts \" HTTPError while downloading file: #{ex.message}\"\n nil\nend",
"title": ""
},
{
"docid": "11c90f2babafef1392b00818960ca7a9",
"score": "0.6801784",
"text": "def create_file_from_url(env, uri, file_info, auth_header = {})\n ::FileSet.new(import_url: uri.to_s, label: file_info[:file_name]) do |fs|\n actor = file_set_actor_class.new(fs, env.user)\n # TODO: add more metadata\n # TODO: reconsider visibility\n actor.create_metadata(visibility: env.curation_concern.visibility)\n actor.attach_to_work(env.curation_concern)\n fs.save!\n # TODO: add option for batch vs single assignment?\n env.retrieve(self, :ordered_members) << fs\n structure_to_repo_map[file_info[:id]] = fs.id\n if uri.scheme == 'file'\n # Turn any %20 into spaces.\n file_path = ::CGI.unescape(uri.path)\n ::IngestLocalFileJob.perform_later(fs, file_path, env.user)\n else\n ::ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)\n end\n end\n end",
"title": ""
},
{
"docid": "b1470aea23df8dc918c391801e97fde8",
"score": "0.67960125",
"text": "def create_file_from_url(url, batch_id=nil)\n @generic_file = ::GenericFile.new\n @generic_file.import_url = url\n @generic_file.label = File.basename(url)\n create_metadata(@generic_file)\n Sufia.queue.push(ImportUrlJob.new(@generic_file.pid))\n return @generic_file\n end",
"title": ""
},
{
"docid": "b32b3123ef00e45e8177203cf8fc72c2",
"score": "0.6556478",
"text": "def get_file(name,url)\n open(name, 'wb') do |file|\n file << open(url).read\n end\n end",
"title": ""
},
{
"docid": "c0144fe8302a5fa095ae2b45e04211c8",
"score": "0.65331167",
"text": "def create_file(content)\n if is_url?(content)\n # return file name from url func\n create_url_file(extract_url(content))\n else\n # return file name from text func\n create_text_file content\n end\n end",
"title": ""
},
{
"docid": "f8be96d122f2614b462704209a30eca5",
"score": "0.6504049",
"text": "def create_url_file(url)\n # name from domain name+tld\n name = url.gsub(/(https?|s?ftp):\\/\\//, \"\").gsub(/(\\/.*)*/, \"\")\n BruseFile.new(name: name,\n foreign_ref: url,\n filetype: \"bruse/url\")\n end",
"title": ""
},
{
"docid": "ecf98c712815c90cfeef48e23ee6cb21",
"score": "0.64957803",
"text": "def create_local_file(local_dir_name,media_file_id,filename)\n FileUtils.mkdir_p(local_dir_name)\n local_file_name = local_dir_name + \"/\" + filename\n local_file = File.open(local_file_name, 'w') {|f| f.puts(\"this is just a test\") } \n return local_file_name\n end",
"title": ""
},
{
"docid": "804d1fbc083303a66df14cf26e6fc304",
"score": "0.63068044",
"text": "def create_file(name)\n response = HTTParty.post(\n \"https://www.googleapis.com/drive/v3/files\",\n headers: headers.merge('Content-Type' => 'application/json; charset=UTF-8'),\n body: { name: name }\n )\n end",
"title": ""
},
{
"docid": "1800c5992afecaade318b33f53424ed6",
"score": "0.62606925",
"text": "def create_files( files = [] )\n files.each do |file|\n path = file[:path]\n File.open(path, 'w') do |f|\n f.write file[:content]\n assert File.exists?( file[:path] )\n end\n end\n end",
"title": ""
},
{
"docid": "2016263ae62c9bdbe37780f2831762e9",
"score": "0.6210802",
"text": "def save_file(url)\n \tputs \"Downloading file from URL ...\"\n \t file_name = url.split(\"/\").last\n \t file_path = \"#{Rails.root}/public/#{file_name}\"\n \n open(file_path, 'wb') do |file|\n file << open(url).read\n end \n\n file_path\t\n end",
"title": ""
},
{
"docid": "3de34a5e4d62d89b85a30451267bc123",
"score": "0.6194112",
"text": "def create_file(file_path, options={})\n options[:digest] ||= false\n options[:public] ||= false\n\n begin\n file = File.open(file_path)\n rescue\n raise FileNotFound, file_path\n end\n \n extension = File.extname(file_path)\n filename = File.basename(file_path, extension)\n filename += \"_#{Digest::SHA1.hexdigest(File.basename(file_path))}\" if options[:digest]\n filename += extension\n\n file = @dir.files.create(\n key: filename,\n body: file,\n public: options[:public]\n )\n\n return file.public_url if options[:public] && file.public_url\n\n file.url((Time.now + 3600).to_i) # 1 hour\n end",
"title": ""
},
{
"docid": "d7dc90274e056b963388a741f21d6b2a",
"score": "0.61894286",
"text": "def add_file_from_url(url)\n Resource.client.add_file_from_url(self,url)\n end",
"title": ""
},
{
"docid": "2b0412491fcbaf83d21489e58f8dfae6",
"score": "0.6189265",
"text": "def create_file\n create_temp_file\n download = initiate_download\n return if download.nil?\n save_file(download)\n end",
"title": ""
},
{
"docid": "5f711b40109b7bfc5e6cb5b9fe734eb6",
"score": "0.616933",
"text": "def create_url_file\n name = params[:bruse_file][:data].gsub(/(https?|s?ftp):\\/\\//, \"\").gsub(/(\\/.*)*/, \"\")\n @file = BruseFile.new(\n name: name,\n foreign_ref: params[:bruse_file][:data],\n filetype: params[:bruse_file][:type],\n identity: @identity\n )\n end",
"title": ""
},
{
"docid": "79fab0f71d6e359f1b08c9d83ecc0ae9",
"score": "0.61578584",
"text": "def write_urls(template:, path:, count: nil, parameters: {}, data: nil, filename:)\n FileUtils.mkdir_p(File.dirname(filename))\n command = DataGenerator.new.url_command(template: template, path: path, count: count, parameters: parameters, data: data)\n execute(\"#{command} > #{filename}\")\n end",
"title": ""
},
{
"docid": "16c8995ff6c224bea8480f4e4e9fe861",
"score": "0.6117395",
"text": "def fetch(base_url, file_name, dst_dir)\n FileUtils.makedirs(dst_dir)\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if File.exists?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n end\n return dst\nend",
"title": ""
},
{
"docid": "17a87b7da7482508f4aaef6b5d7265cb",
"score": "0.6108036",
"text": "def create_locally\n write_file(@music_file, @music_name)\n write_file(@poster_file, @poster_name)\n end",
"title": ""
},
{
"docid": "c20a92c101cc6094e77481c271db21e7",
"score": "0.60953945",
"text": "def create_file(file_id, filename, file)\n Dir.mkdir \"./public/uploads/#{file_id}\"\n path = \"./public/uploads/#{file_id}/#{filename}\"\n File.open(path, 'wb') do |f|\n f.write(file.read)\n end\nend",
"title": ""
},
{
"docid": "be49695757e8b46111865ac5d428d75c",
"score": "0.6059986",
"text": "def download_to_file url, file\n url = URI.parse(URI.encode(url.strip))\n\n File.new(file, File::CREAT)\n\n Net::HTTP.start(url.host) { |http|\n resp = http.get(url.path)\n open(file, \"wb\") { |file|\n file.write(resp.body)\n }\n }\n end",
"title": ""
},
{
"docid": "c5422bf46f99124c9913491620e0c59b",
"score": "0.60386324",
"text": "def get_files(url, file, destination, owner = node['apache']['user'])\n case File.extname(file)\n when '.tar.gz', '.zip' then unpack_archive(url, file, destination)\n when '.git'\n repo = \"#{destination}/#{File.basename(file, '.git')}\"\n git repo do\n repository file.to_s\n reference 'master'\n user owner\n action :sync\n end\n else raise ArgumentError, \"dunno how to handle #{file}\"\n end\nend",
"title": ""
},
{
"docid": "0d8bf8031a6eb12169fb5cf9bdbc479d",
"score": "0.6000972",
"text": "def fetch_http_file(base_url, file_name, dst_dir)\n require 'open-uri'\n FileUtils.makedirs(dst_dir)\n base_url.chomp!('/')\n src = \"#{base_url}/#{file_name}\"\n dst = File.join(dst_dir, file_name)\n if options[:cache_files_locally] && File.exist?(dst)\n logger.notify \"Already fetched #{dst}\"\n else\n logger.notify \"Fetching: #{src}\"\n logger.notify \" and saving to #{dst}\"\n begin\n URI.open(src) do |remote|\n File.open(dst, \"w\") do |file|\n FileUtils.copy_stream(remote, file)\n end\n end\n rescue OpenURI::HTTPError => e\n raise \"Failed to fetch_remote_file '#{src}' (#{e.message})\" if /404.*/.match?(e.message)\n\n raise e\n end\n end\n return dst\n end",
"title": ""
},
{
"docid": "1b54861b8b52afeae3005263556ebba8",
"score": "0.59755147",
"text": "def download!(source_url, destination_file); end",
"title": ""
},
{
"docid": "e78b7e7b8d148fa4934f074fe058d1f5",
"score": "0.5949092",
"text": "def fetch_local(filename)\n \n return unless filename\n \n file_path = ::File.expand_path(filename)\n raise \"Can't access file #{file_path}!\" unless ::File.exists?(file_path) and\n ::File.readable?(file_path)\n\n file = Tempfile.new(Time.new.to_i.to_s) \n open(file_path, 'w') { |f| f << http_response.to_s }\n\n return file\n\n end",
"title": ""
},
{
"docid": "6bdf47165f0968293b760f0db04df425",
"score": "0.594269",
"text": "def save_page_files(url)\n\tpage = Nokogiri::HTML(open(url.url))\n\tpath = url.relative_path\n\tif url.file_extension == '/'\n\t\tpath = path.gsub(/\\/+$/, '') + '/' + DEFAULT_FILE_NAME\n\tend\n\tpath.gsub!(/^\\/+/, '')\n\tfull_file_name = OUTPUT_DIR + path + DEFAULT_FILE_EXTENSION\n\t# puts full_file_name\n\tFileUtils.mkdir_p(OUTPUT_DIR + url.enclosing_dir.gsub(/^\\/+/, ''))\n\twrite_flag = OVERWRITE_OUTPUT_FILES ? 'w' : 'a'\n\tFile.open(full_file_name, write_flag) {|f| f.write(page) }\nend",
"title": ""
},
{
"docid": "7efe6e786f3bef85debbeefc97103999",
"score": "0.5923547",
"text": "def download\n FileUtils.rm_rf(local_file)\n\n File.open(local_file, \"wb\") do |local_file|\n open(url, \"rb\") do |remote_file|\n local_file.write(remote_file.read)\n end\n end\n end",
"title": ""
},
{
"docid": "3e63c437e723150fda53a19aa18e3c49",
"score": "0.59025353",
"text": "def urlposts_xml_file(url)\n fname = urlpost_fname url\n File.open fname\n end",
"title": ""
},
{
"docid": "f529e98392587d29fb56213199563e57",
"score": "0.5896491",
"text": "def download_remote_files\n $l.info \"(#{self.class}) downloading started for #{name.inspect}\"\n\n urls.each do |uri|\n destination = cache_path_for(uri.filename)\n\n if File.exist?(destination)\n $l.info \"#{File.basename(destination)} already exists!\"\n else\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Write out file as we receive it\n File.open(destination, \"w+\") do |f|\n http.request_get(uri.path) do |resp|\n original_length = resp[\"content-length\"].to_f\n remaining = original_length.to_f\n\n resp.read_body do |chunk|\n f.write(chunk)\n remaining -= chunk.length\n print \" #{(100 - (remaining / original_length * 100.0)).round(2)}% downloaded\\r\"\n end\n end\n end\n\n end\n end\n\n puts\n $l.info \"(#{self.class}) downloading finished for #{name.inspect}\"\n end",
"title": ""
},
{
"docid": "37988d51593f3c388ac7dd23a1b941b3",
"score": "0.5894492",
"text": "def add_local_image_files(photos)\n photos.map do |photo|\n path = \"./lib/images/#{photo['id']}.jpg\"\n open(path, 'wb') do |file|\n file << open(create_photo_url(photo)).read\n end\n photo.merge!({'local_path' => open(path)})\n end\n end",
"title": ""
},
{
"docid": "2e2cb9b332d7231e7df92903ec35a2a0",
"score": "0.58887446",
"text": "def write(files, private_gist = false)\n url = URI.parse(CREATE_URL)\n \n if PROXY_HOST\n proxy = Net::HTTP::Proxy(PROXY_HOST, PROXY_PORT)\n http = proxy.new(url.host, url.port)\n else\n http = Net::HTTP.new(url.host, url.port)\n end\n \n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_file = File.join(File.dirname(__FILE__), \"cacert.pem\")\n \n req = Net::HTTP::Post.new(url.path)\n req.form_data = data(files, private_gist)\n \n http.start{|h| h.request(req) }['Location']\n end",
"title": ""
},
{
"docid": "2ebdef27858452345b61f01c67808594",
"score": "0.5883552",
"text": "def get_file(file, url)\n open(file, 'wb').write(open(url).read)\nend",
"title": ""
},
{
"docid": "214dbde39bff55d38eeaf4cb24b41f4b",
"score": "0.58819455",
"text": "def download_files_from_URLs(agent, target_dir, links, file_in_names, current_link)\n # Open file from web URL, using username and password provided\n\n uri = URI(current_link)\n\n queue = Queue.new\n name_queue = Queue.new\n\n links.map { |url| queue << url }\n file_in_names.map { |name| name_queue << name }\n\n # Concurrent file downloads\n threads = $thread_count.times.map do\n Thread.new do\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n while !queue.empty?\n url = queue.pop\n name = name_queue.pop unless name_queue.empty?\n if (url == nil)\n next\n end\n if(name == \"\")\n # Extract file name using this snippet found on SO\n begin\n name = url.meta['content-disposition'].match(/filename=(\\\"?)(.+)\\1/)[2]\n rescue Exception => e\n name = File.basename(URI.parse(url.to_s).path)\n end\n end\n\n # Skip .ps files as no support for PS exists in textract\n if (File.extname(name) == \".ps\")\n next\n end\n\n # Clear name of garbage and add extension\n name = name.gsub(/[\\/ ]/, \"\").gsub(/[%20]/, \"_\") + \".pdf\"\n if (name.size > 100)\n name = name[0..100]\n end\n\n if (File.exists?(name))\n print \"Skip, #{name} already exists\\n\"\n else\n # Perform a new request for the file\n request = Net::HTTP::Get.new(url)\n request.basic_auth(ENV['IC_USERNAME'], ENV['IC_PASSWORD'])\n\n http.request request do |response|\n case response\n when Net::HTTPRedirection\n # Do Nothing for now\n when Net::HTTPOK\n # Write chunks of file while also reading new chunks, to increase\n # efficiency\n File.open(name, 'w') do |file_out|\n response.read_body do |chunk|\n file_out << chunk\n end\n end\n when Net::HTTPNotFound\n # Do nothing\n when Net::HTTPNetworkAuthenticationRequired\n puts \"Wrong credentials\"\n end\n end\n\n end\n end\n end\n end\n end\n threads.each(&:join)\nend",
"title": ""
},
{
"docid": "0d699a5403b54dcc2b682675ba65cce8",
"score": "0.5879972",
"text": "def CreateFile(cn, mn)\r\n\tfilename = sprintf(\"%s_%s.html\", cn, mn)\r\n\r\n\t$file = OpenFile(filename)\r\nend",
"title": ""
},
{
"docid": "3ab972147bf72383a1224c34ce984afb",
"score": "0.58693",
"text": "def create_from_url(url, options = {})\n opts = { upload_file: url, user_id: 1, aws_acl: EffectiveAssets.aws_acl }.merge(options)\n\n attempts = 3 # Try to upload this string file 3 times\n begin\n asset = Asset.new(opts)\n\n if asset.save\n asset\n else\n puts asset.errors.inspect\n Rails.logger.info asset.errors.inspect\n false\n end\n rescue => e\n (attempts -= 1) >= 0 ? (sleep 2; retry) : false\n end\n end",
"title": ""
},
{
"docid": "4471a6f4b88285eada0b3ccc3bb9b518",
"score": "0.58577675",
"text": "def test_files\r\n\t\t@job.addFile(\"http://www.google.com\", \"c:\\\\temp\\\\google.com.html\")\r\n\t\t@job.addFile(\"http://www.heise.de\", \"c:\\\\temp\\\\heise.de.html\")\r\n\t\tassert_equal(@job.files[0].remote_url, \"http://www.google.com\")\r\n\t\tassert_equal(@job.files[0].local_name, \"c:\\\\temp\\\\google.com.html\")\r\n\t\tassert_equal(@job.files[1].remote_url, \"http://www.heise.de\")\r\n\t\tassert_equal(@job.files[1].local_name, \"c:\\\\temp\\\\heise.de.html\")\r\n\tend",
"title": ""
},
{
"docid": "6061ab388a61fa6cdecb59ac89ca6fc1",
"score": "0.58501345",
"text": "def make_files_for_download(records, type)\n \n end",
"title": ""
},
{
"docid": "37c265b7785a44e60790e8064c199b76",
"score": "0.5837549",
"text": "def createurl(filepath)\r\n\turl = base_url + \"original\" + filepath\r\n\tputs url\r\nend",
"title": ""
},
{
"docid": "6fcab3ab312b4bcf558de1a6a84e4500",
"score": "0.58355737",
"text": "def download_file(url, full_path, count = 3)\n return if File.exist?(full_path)\n uri = URI.parse(url)\n begin\n case uri.scheme.downcase\n when /ftp/\n download_file_ftp(uri, full_path)\n when /http|https/\n download_file_http(url, full_path, count)\n end\n rescue Exception => e\n File.unlink full_path if File.exists?(full_path)\n output \"ERROR: #{e.message}\"\n raise \"Failed to complete download task\"\n end\n end",
"title": ""
},
{
"docid": "56cee7e0553ea25d881d0e5bb8e52bab",
"score": "0.57928336",
"text": "def create_from_url(url, options = {})\n opts = {:upload_file => url, :user_id => 1}.merge(options)\n\n if (asset = Asset.create(opts))\n Effective::DelayedJob.new.process_asset(asset)\n asset\n else\n false\n end\n end",
"title": ""
},
{
"docid": "bf701803896c421d50ba0cdd332a525f",
"score": "0.57759494",
"text": "def download_to_file url, target\n File.open(target, 'w') do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\n end",
"title": ""
},
{
"docid": "094250f6681b2f4f8d13a8594fbef7ad",
"score": "0.57755494",
"text": "def file_download(url)\n return \"\" if url.nil? || url.empty?\n path = \"/tmp/vedafiles/#{url.split('/').last}\"\n File.open(path, \"wb\") do |file|\n file.write open(url).read\n end\n return path\n end",
"title": ""
},
{
"docid": "6e3249b8ea9a7bf2875d95e0e9548b2f",
"score": "0.57738143",
"text": "def download_and_store(url, filename=\"#{SecureRandom.uuid}\")\n file = Tempfile.new(filename) # use an array to enforce a format\n # https://ruby-doc.org/stdlib-1.9.3/libdoc/tempfile/rdoc/Tempfile.html\n\n @task_result.logger.log_good \"Attempting to download #{url} and store in #{file.path}\" if @task_result\n\n begin\n\n uri = URI.parse(URI.encode(\"#{url}\"))\n\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n # TODO enable proxy\n http = Net::HTTP.start(uri.host, uri.port, nil, nil, opts) do |http|\n http.read_timeout = 20\n http.open_timeout = 20\n http.request_get(uri.path) do |resp|\n resp.read_body do |segment|\n file.write(segment)\n end\n end\n end\n\n rescue URI::InvalidURIError => e\n @task_result.logger.log_error \"Invalid URI? #{e}\" if @task_result\n return nil\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n @task_result.logger.log_error \"Unable to request URI: #{uri} #{e}\" if @task_result\n return nil\n rescue OpenSSL::SSL::SSLError => e\n @task_result.logger.log_error \"SSL connect error : #{e}\" if @task_result\n return nil\n rescue Errno::ECONNREFUSED => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ECONNRESET => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Errno::ETIMEDOUT => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Net::HTTPBadResponse => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::BufError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue SocketError => e\n @task_result.logger.log_error \"Unable to connect: #{e}\" if @task_result\n return nil\n rescue Encoding::InvalidByteSequenceError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue Encoding::UndefinedConversionError => e\n @task_result.logger.log_error \"Encoding error: #{e}\" if @task_result\n return nil\n rescue EOFError => e\n @task_result.logger.log_error \"Unexpected end of file, consider looking at this file manually: #{url}\" if @task_result\n return nil\n ensure\n file.flush\n file.close\n end\n\n file.path\n end",
"title": ""
},
{
"docid": "8dd135bff224aadcd5f9279e9a23e2ee",
"score": "0.5773028",
"text": "def put(url)\n file = filepath(url)\n return nil if File.exist?(file)\n\n FileUtils.mkdir_p path(url)\n trys = 0\n begin\n trys = trys + 1\n data = open(escape(url)).read\n File.open(file, \"wb\") { |f| f << data }\n rescue OpenURI::HTTPError => httperror\n raise httperror unless trys < 3\n retry\n rescue Timeout::Error => timeout\n raise timeout unless trys < 3\n retry\n rescue OpenSSL::SSL::SSLError => ssl\n raise ssl unless trys < 3\n retry\n rescue => error\n raise error\n end\n nil\n end",
"title": ""
},
{
"docid": "45b665b18683e3f6a316610bc3e5945d",
"score": "0.57650554",
"text": "def download_file(file_url, file_destination) \n File.open(file_destination, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(file_url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend",
"title": ""
},
{
"docid": "609965acf74c6496b2291652cfe68597",
"score": "0.57553536",
"text": "def fetchfiles(params={})\n raise \"ERROR: Either :dir or :file must be supplied to fetchfiles method.\" unless params[:file] || params[:dir]\n\n localfilenames = []\n if params[:testdata_url]\n raise \":dir not handled for URL #{params[:testdata_url]}\" if params[:dir]\n\n source_url = URI(\"#{params[:testdata_url]}/#{params[:file]}\")\n destination_dir = params[:destination_dir] ? params[:destination_dir] : @testcase.dirs.downloaddir\n localfilename = params[:destination_file] ? params[:destination_file] : File.join(destination_dir, File.basename(params[:file]))\n\n RemoteFileUtils.download(source_url, localfilename)\n\n testcase_output(\"Downloaded #{source_url} to #{localfilename} on host #{`hostname`}\")\n localfilenames << localfilename\n else\n raise \":dir and :destination_file can not both be specified\" if params[:dir] && params[:destination_file]\n\n destination_dir = params[:destination_dir] ? params[:destination_dir] : @testcase.dirs.drbfiledir\n destination_dir = params[:destination_file] ? File.dirname(params[:destination_file]) : destination_dir\n FileUtils.mkdir_p(destination_dir)\n\n filereader = @testcase.create_filereader\n if params[:dir]\n filenames = Dir.glob(params[:dir]+\"/*\")\n elsif params[:file]\n filenames = [params[:file]]\n end\n filenames.each do |filename|\n localfilename = params[:destination_file] ? params[:destination_file] : File.join(destination_dir, File.basename(filename))\n unless File.exist?(localfilename) && File.size?(localfilename) == filereader.size?(filename) &&\n File.mtime(localfilename) == filereader.mtime(filename) &&\n Digest::MD5.digest(localfilename) == filereader.md5(filename)\n File.open(localfilename, \"w\") do |fp|\n filereader.fetch(filename) do |buf|\n fp.write(buf)\n end\n end\n File.utime(Time.now, filereader.mtime(filename), localfilename)\n end\n localfilenames << localfilename\n end\n end\n localfilenames\n end",
"title": ""
},
{
"docid": "63a038366a80ea1af6fdf2fb8fef9fd6",
"score": "0.5754628",
"text": "def ensure_local_image(url, local_file)\n return local_file if File.exist?(local_file)\n\n connection = Faraday.new do |faraday|\n faraday.adapter(Faraday.default_adapter)\n end\n response = download_file_helper(connection, url)\n File.open(local_file, 'wb') { |file| file << response.body }\n\n local_file\n end",
"title": ""
},
{
"docid": "a7dd4a7114a89d021ae3e37297fd82e0",
"score": "0.5745761",
"text": "def set_file_url url\n return nil if url.blank?\n extension = File.extname(url).gsub(/^\\.+/, '')\n filename = url.gsub(/\\.#{extension}$/, '')\n \"#{NameParse::parse_url(filename)}.#{NameParse::transliterate(extension)}\" rescue url\n end",
"title": ""
},
{
"docid": "7009b166dfa0b52a7ada8580e4a5e6db",
"score": "0.57450294",
"text": "def create_file(fileName, data = {}, content_type = nil)\n headers = {}\n headers.merge!({ Parse::Protocol::CONTENT_TYPE => content_type.to_s }) if content_type.present?\n response = request :post, \"#{FILES_PATH}/#{fileName}\", body: data, headers: headers\n response.parse_class = Parse::Model::TYPE_FILE\n response\n end",
"title": ""
},
{
"docid": "c8bf9c3cd5b7dace6aa63ba4967e7aee",
"score": "0.5740928",
"text": "def create\n\n # clean badly hashing files\n if File.exists? resource[:path] then\n FileUtils.rm resource[:path]\n info 'cleaned out existing file, since it hashed badly or was outdated'\n end\n\n digester = Digest::SHA2.new\n uri = resource[:source]\n\n info \"Starting to download Httpfile[#{resource[:name]}) from URI[#{uri.to_s}]/#{hash}\"\n\n Net::HTTP.start uri.host, uri.port do |http|\n http.request_get uri.request_uri do |resp|\n open resource[:path], \"w+\" do |io|\n resp.read_body do |segment|\n io.write segment\n digester.update segment\n end\n end\n end\n end\n\n info 'download complete, verifying file integrity'\n\n unless hash == digester.hexdigest\n raise Puppet::Error, \"Data at URI[#{uri.to_s}]/#{digester.hexdigest}]\\\n didn\\'t match expected Httpfile[#{hash}], please retry or correct the hash.\"\n end\n\n end",
"title": ""
},
{
"docid": "538493b5134c0874b7e6fc420c380b4f",
"score": "0.5740501",
"text": "def distribute!\n args = [ filename, remote_filename ]\n args << { :via => configuration[:copy_via] } if configuration[:copy_via]\n run \"mkdir #{configuration[:release_path]}\"\n upload(*args)\n end",
"title": ""
},
{
"docid": "7f849c135ccea2a66b248af8cf46c777",
"score": "0.5740105",
"text": "def upload_file(local_filename)\n resp = RestClient.post(url, data.merge({file: ::File.new(local_filename, 'rb')}))\n File.new(JSON.parse(resp.body))\n end",
"title": ""
},
{
"docid": "44eb35feaf760e5f47cd5b37fe9b4933",
"score": "0.573979",
"text": "def load_from_url(url) # :doc:\n tempfile = \"#{RAILS_ROOT}/tmp/api_upload.#{$$}\"\n header = {}\n uri = URI.parse(url)\n File.open(tempfile, 'w') do |fh|\n Net::HTTP.new(uri.host, uri.port).start do |http|\n http.request_get(uri.request_uri) do |response|\n response.read_body do |chunk|\n fh.write(chunk)\n end\n header['Content-Length'] = response['Content-Length'].to_i\n header['Content-Type'] = response['Content-Type']\n header['Content-MD5'] = response['Content-MD5']\n end\n end\n end\n return [tempfile, header]\n end",
"title": ""
},
{
"docid": "849de64387cbcb708a343e6c924e31ec",
"score": "0.5737827",
"text": "def download(url, filename)\n Dir.mkdir TUTOR_ATTACHMENTS_PATH \\\n unless File.exists? TUTOR_ATTACHMENTS_PATH\n destination = \"#{TUTOR_ATTACHMENTS_PATH}/#{filename}\"\n write(destination, http_get(url))\n \"#{TUTOR_ATTACHMENTS_URL}/#{filename}\"\n end",
"title": ""
},
{
"docid": "6d6c1157399c30f952dc0ec4c1e1a30e",
"score": "0.5737621",
"text": "def copy_remote_file(name)\n filename = File.basename(name)\n dir = Dir.mktmpdir\n Hyrax.logger.debug(\"ImportUrlJob: Copying <#{uri}> to #{dir}\")\n\n File.open(File.join(dir, filename), 'wb') do |f|\n write_file(f)\n yield f\n rescue StandardError => e\n send_error(e.message)\n end\n Hyrax.logger.debug(\"ImportUrlJob: Closing #{File.join(dir, filename)}\")\n end",
"title": ""
},
{
"docid": "2b21fabc37eb2540a9054eb1cf90100b",
"score": "0.5726762",
"text": "def add_file_from_url(url, description = nil, convert_to = nil, pingback_url = nil)\n Dropio::Resource.client.add_file_from_url(self,url,description, convert_to, pingback_url)\n end",
"title": ""
},
{
"docid": "af9cb3bc2d6ec0852ba6f4e15660d636",
"score": "0.5725758",
"text": "def save_url(path, url)\n resp = request('/files/save_url', path: path, url: url)\n parse_tagged_response(resp)\n end",
"title": ""
},
{
"docid": "73b33fd8eba646261fccc3dd4773975f",
"score": "0.5713044",
"text": "def create_tempfile(basename); end",
"title": ""
},
{
"docid": "e4a71182c00da521bb122e9babacefbc",
"score": "0.5707115",
"text": "def write_sru(url,filename)\n filename = ( filename =~ /.xml$/ ? filename : filename + '.xml')\n File.open(\"data/downloads/#{filename}\",'w') do |file|\n open(url).each_line do |line|\n file << line\n end\n end\n end",
"title": ""
},
{
"docid": "a2e97eb53116df3d44d2e2ade1a7e0f0",
"score": "0.57064706",
"text": "def create_file(payload)\n JSON.parse Files.create_file(@base_url, @headers, payload.to_json)\n end",
"title": ""
},
{
"docid": "8f2781ba8f3876cf394acf4594d7712c",
"score": "0.57062274",
"text": "def download(url, name)\n path = \"#{ETFC::TMP_DIR}/#{name}\"\n download = open(url)\n IO.copy_stream(download, path)\n path\n end",
"title": ""
},
{
"docid": "940635d528c4ba851ccd572a24632218",
"score": "0.57050014",
"text": "def http_get_zip_file(url, destination)\n require 'open-uri'\n require 'swissmatch/zip' # patched zip/zip\n require 'fileutils'\n\n files = []\n\n open(url) do |zip_buffer|\n Zip::ZipFile.open(zip_buffer) do |zip_file|\n zip_file.each do |f|\n target_path = File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(target_path))\n zip_file.extract(f, target_path) unless File.exist?(target_path)\n files << target_path\n end\n end\n end\n\n files\n end",
"title": ""
},
{
"docid": "b18fd9b2c4f70caae67eae3f573be569",
"score": "0.56993836",
"text": "def download_file(url, full_path, count = 3)\n return if File.exist?(full_path)\n uri = URI.parse(url)\n\n case uri.scheme.downcase\n when /ftp/\n download_file_ftp(uri, full_path)\n when /http|https/\n download_file_http(url, full_path, count)\n when /file/\n download_file_file(uri, full_path)\n else\n raise ArgumentError.new(\"Unsupported protocol for #{url}\")\n end\n rescue Exception => e\n File.unlink full_path if File.exist?(full_path)\n raise e\n end",
"title": ""
},
{
"docid": "db83033c1c508c5d82624fd3ee694a91",
"score": "0.5688755",
"text": "def fetch_file\n # Handle any redirection\n redirect_url = Net::HTTP.get_response(URI url)['location'] || url\n\n download = open redirect_url\n IO.copy_stream download, filename\n end",
"title": ""
},
{
"docid": "a5183155070bc19b9c6e3e8be9faea2c",
"score": "0.56881267",
"text": "def create\n @remote_file = RemoteFile.new(params[:remote_file])\n myUri = URI.parse( 'http://www.mglenn.com/directory' )\n s = Site.find_or_create_by_url(myUri.host)\n @remote_file.site=s\n\n\n\n\n respond_to do |format|\n if @remote_file.save\n unless @remote_file.invalid?\n @remote_file.start!\n end\n format.html { redirect_to(@remote_file, :notice => 'Remote file was successfully created.') }\n format.xml { render :xml => @remote_file, :status => :created, :location => @remote_file }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @remote_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28651f13df57365373b4edd7e918db55",
"score": "0.56791484",
"text": "def inject_file filename, local_path, remote_lib\n r_file = File.join remote_lib, filename\n r_FileUtils.mkdir_p File.dirname r_file\n\n r_open r_file, 'w' do |r_io|\n open local_path do |l_io|\n r_io.write l_io.read\n end\n end\n end",
"title": ""
},
{
"docid": "8c3edeeee3e5be1a0c7bcec0b0a8ce01",
"score": "0.5665815",
"text": "def make_file(filename,contents,file_options={})\r\n raise \"creating files for #{file_system} file system not yet supported\"\r\n end",
"title": ""
},
{
"docid": "7d830c1cfe6add0810a20c8dfe8cf200",
"score": "0.56601477",
"text": "def createfile(filename)\n newfile = File.new(filename, self)\n @contents[filename] = newfile\n end",
"title": ""
},
{
"docid": "8807b78200cc2a57d552964f58a89a5d",
"score": "0.565968",
"text": "def upload_url url\n # download file and get token\n token = response :post,\n \"/from_url/\",\n :source_url => url,\n :pub_key => @options[:public_key]\n\n # wait valid response status\n status = \"unknown\"\n while \"unknown\" == status\n result = response :post,\n \"/from_url/status/\",\n token\n status = result[:status]\n sleep 0.5\n end\n\n # raise if response status is invalid\n raise ArgumentError.new result[\"error\"] if \"error\" == result[\"status\"]\n\n # return file ID\n result[\"file_id\"]\n end",
"title": ""
},
{
"docid": "5eebd86cd1fda46eb46e26051f94c12c",
"score": "0.5649214",
"text": "def create_file(file_created)\n file = File.new(file_created,\"a+\") \n file.close\n end",
"title": ""
},
{
"docid": "f4f6b1abb0a226c1e0c2a399fd29589f",
"score": "0.5633797",
"text": "def create_url(path)\n FileUtils.cd(Rails.root.join(Rails.public_path).to_s)\n unless File.directory?(path)\n FileUtils.mkdir_p(path)\n end\n end",
"title": ""
},
{
"docid": "9d785697d043273a78aed333114e05e5",
"score": "0.5625297",
"text": "def save_path\n return unless name && url\n\n path = File.join(working_directory, 'feeds')\n FileUtils.mkdir_p(path) unless File.directory?(path)\n\n hash = Digest::MD5.hexdigest(url)\n File.join(path, \"#{name}-#{hash[0..8]}.txt\")\n end",
"title": ""
},
{
"docid": "8fa9a6a5b47354142893a4ad31282072",
"score": "0.5622962",
"text": "def save_images(urls, file_path)\n urls.each_with_index do |url, i|\n open(\"#{@topic.gsub(' ', '-')}_#{i}.jpg\", 'wb') do |file|\n file << open(url).read\n end\n end\n end",
"title": ""
},
{
"docid": "620c95864f9fc201e144ff2822a59f7e",
"score": "0.56225085",
"text": "def write_file(url, destination, user_name, password_hash, owner, group)\n # [RELEASE] has special signifiance in Artifactory. Let's escape it\n escaped_url = url.gsub(/\\[RELEASE\\]/, '%5BRELEASE%5D')\n\n uri = URI(escaped_url)\n\n Net::HTTP.start(uri.host, uri.port, use_ssl: (uri.scheme == 'https'), verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|\n request = Net::HTTP::Get.new uri\n\n if user_name && password_hash\n request.basic_auth user_name, password_hash\n end\n\n http.request request do |response|\n if response.code == \"200\"\n open destination, 'w' do |io|\n response.read_body do |chunk|\n io.write chunk\n end\n end\n elsif response.code == \"404\"\n raise Puppet::Error, 'No file can be found at ' + url\n else\n raise Puppet::Error, 'Error retrieving file at ' + url + \" (Response code: \" + response.code + \")\"\n end\n end\n\n FileUtils.chown owner, group, destination\n end\n end",
"title": ""
},
{
"docid": "a295b341f90da5217fd6588e3caf34f8",
"score": "0.56185764",
"text": "def download_file(host, remote_file, local_file)\n require 'net/http'\n Net::HTTP.start(host) do |http|\n resp = http.get(remote_file)\n open(local_file, \"w\") { |file| file.write(resp.body) }\n end\n end",
"title": ""
},
{
"docid": "6aaa99186109cc938040791ee7b1dfff",
"score": "0.56125516",
"text": "def createFiles(src, amount)\n i = 1\n while i<amount do\n #Create\n File.open(src + \"/test\" + i.to_s + \".txt\", \"a+\") {|f| f.write(\"Placeholder text\")}\n #puts \"Created test#{i}.txt\"\n i += 1\n end\nend",
"title": ""
},
{
"docid": "beadb82b795321a1bb388af1825589cd",
"score": "0.5607651",
"text": "def save_image_file(url, src, dir, async=false)\n # get a file name from src attribute\n file_name = src.split('/').last\n # if src attribute presented as relative path - attach it to url of a page in order to make it absolute\n src = url + src unless src =~ /\\Ahttp/\n # create directory if it doesnt exist\n Dir.mkdir(dir) unless File.directory?(dir)\n doc = nil\n begin\n # try to get a file as html-document (html-response)\n doc = async ? fetcher_fabric.get_fetcher(src, 'faraday').async.get : fetcher_fabric.get_fetcher(src, 'faraday').get\n rescue => e\n raise 'Error occurred during file downloading: '+e.message\n end\n # if doc exists - save it to a file with proper file name in target directory\n File.open(File.join(dir, file_name), 'w+') { |f| f.write doc } if doc\n rescue => e\n raise 'Error occurred during file saving: '+e.message\n end",
"title": ""
},
{
"docid": "0e7861d5e8f0c67f69aff1f71dfa4a35",
"score": "0.56006193",
"text": "def mkfile(name)\n new_name = name\n i = 0\n while File.exist?(new_name)\n i += 1\n new_name = \"#{File.basename(name, \".*\")}_#{i}#{File.extname(name)}\"\n end\n File.open(new_name, \"w\")\n end",
"title": ""
},
{
"docid": "fb85aa4975ed6bd3b0446126895e9548",
"score": "0.5598341",
"text": "def save_images(urls, file_path)\n urls.each_with_index do |url, i|\n open(\"#{@query.gsub(' ', '-')}_#{i}.jpg\", 'wb') do |file|\n file << open(url).read\n end\n end\n end",
"title": ""
},
{
"docid": "fc458aeb7f3ac69a028282fd604494bd",
"score": "0.5596582",
"text": "def download_files(files, local, remote)\n remote = SERVER_ALIASES[remote] if SERVER_ALIASES.has_key?(remote)\n if remote.index(':')\n url, path = remote.split(':')\n else\n url = remote\n path = '.'\n end\n\n tempfile = \"/tmp/update_images.#{$$}\"\n open(tempfile, 'w') do |fh|\n for file in files.sort\n fh.puts(file)\n end\n end\n\n cmd = \"cat #{tempfile} | ssh #{url} \\\\(cd #{path}\\\\; tar -T - -cf -\\\\) | tar -xvPf -\"\n verbose cmd\n\n cmd = \"(#{cmd}) > /dev/null\" if !@@verbose\n cmd = \"cd #{local}; #{cmd}; rm #{tempfile}\"\n system cmd\n\n # This causes a fork and runs out of memory.\n # save = Dir.getwd\n # Dir.chdir(local)\n # open(\"|#{cmd}\") do |fh|\n # fh.each_line do |line|\n # verbose line\n # end\n # end\n # Dir.chdir(save)\n #\n # File.delete(tempfile)\nend",
"title": ""
},
{
"docid": "5dec05faed5bd23c9b5748fdc19c9771",
"score": "0.55815643",
"text": "def create()\n\tif $cgi.params.has_key? \"file\"\n\t\t$cgi.params[\"file\"].each { |file|\n\t\t\tfileName = myBaseName(file.original_filename.untaint)\n\t\t\tdestPath = \"#{$localContentDir}/#{fileName}\"\n\t\t\ttmpPath = file.local_path\n\t\t\t\n\t\t\tprocessNewFile(fileName, destPath, tmpPath, file)\n\t\t}\n\t\n\telsif $cgi.params.has_key? \"file[filename]\"\n\t\t$cgi.params[\"file[filename]\"].each_index { |index|\n\t\t\tfileName = myBaseName($cgi.params[\"file[filename]\"][index])\n\t\t\tdestPath = \"#{$localContentDir}/#{fileName}\"\n\t\t\ttmpPath = $cgi.params[\"file[path]\"][index]\n\t\t\t\n\t\t\tprocessNewFile(fileName, destPath, tmpPath, nil)\n\t\t}\n\telse\n\t\t$errors << {\"error\"=>\"Internal error: Invalid file parameter\"}\n\t\treturn\n\tend\n\twriteDescriptionFile()\n\t$successMsg = \"File uploaded\"\n\tsignalNewContent()\nend",
"title": ""
},
{
"docid": "652c96929696bc0ca3490cf69bd1f96b",
"score": "0.5571503",
"text": "def download( filex, downc )\n # Create the directory recursively, substituting the date in\n system \"mkdir -p \\\"\" + folderDate( downc['destination'] ) + \"\\\"\"\n if filex[2] != \"\"\n filex[2] += \"/\"\n end\n print downc['baseurl'] + filex[2] + filex[0] + \" \" + \"...\" + \" \"\n # Open an HTTP connection\n File.open( folderDate( downc['destination'] ) + filex[0], \"wb\") do |file|\n if downc['user'] != nil\n file.write open( URI::encode( downc['baseurl'] + filex[2] + filex[0] ), \n\t\t :http_basic_authentication => [downc['user'], downc['pass']],\n\t\t :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE ).read\n else\n file.write open( URI::encode( downc['baseurl'] + filex[2] + filex[0] ),\n\t\t :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE ).read\n end\n end\n \n print \"done\\n\"\nend",
"title": ""
},
{
"docid": "8f88adf35869b4b137406ab07a083f90",
"score": "0.5560048",
"text": "def filepath(url)\n hsh = hash url\n path_h(hsh) + filename_h(hsh)\n end",
"title": ""
},
{
"docid": "9b04ea4347b93b6f9803b6cc4930a1e2",
"score": "0.5555715",
"text": "def create_remote_temp_file(content)\n make_remote_temp_path.tap do |path|\n update_remote_file_content(content: content, path: path)\n end\n end",
"title": ""
},
{
"docid": "945ec862a70606e14b99f9c9ae9e25e6",
"score": "0.55548745",
"text": "def fetch_file( src, dest )\r\n\r\n logger.info \"fetch file src => #{src}, dest => #{dest}\"\r\n \r\n# if src.include?( 'http://' ) == false && src.include?( 'https://' ) == false\r\n# # for non-http uris use File copy\r\n# FileUtils.makedirs( File.dirname( dest )) # todo: check if dir exists\r\n# FileUtils.cp src, dest # todo: check for overwrite/force option??\r\n# return true\r\n# end\r\n\r\n\r\n response = Fetcher::Worker.new.get_response( src )\r\n\r\n # on error return false; do NOT copy file; sorry\r\n return false if response.code != '200'\r\n\r\n ## todo/fix: check content type for zip,exe,dll (needs binary?)\r\n ## fix: default to binary!! and just use 'w' for text/hypertext and text/text, for example\r\n# if response.content_type =~ /image/\r\n# logger.debug ' switching to binary'\r\n# flags = 'wb'\r\n# else\r\n# flags = 'w'\r\n# end\r\n\r\n ## -- always safe a binary (as is) for now\r\n flags = 'wb'\r\n \r\n \r\n File.open( dest, flags ) do |f|\r\n f.write( response.body )\r\n end\r\n\r\n return true\r\n end",
"title": ""
},
{
"docid": "ac72a9c992c37133bf5b369a736ccd20",
"score": "0.555257",
"text": "def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"title": ""
},
{
"docid": "ebe2f499eca99f10bb20bd1d1c52663d",
"score": "0.55523074",
"text": "def download(url, filename)\n File.open(filename, 'wb') do |file|\n file << open(url).read\n end\n end",
"title": ""
},
{
"docid": "809a64859ab15ea6485f2d8e033aa86f",
"score": "0.55507565",
"text": "def create(path:, type:, filename:)\n request do\n io =\n Faraday::UploadIO.new(path, type, filename)\n\n response =\n connection.post('', 'file' => io)\n\n parse(response.body)\n end\n end",
"title": ""
},
{
"docid": "b0970101d4d7cd5f84dccd48dfa57584",
"score": "0.5550603",
"text": "def download(url,filename=nil)\n path = File.join(self.tmpdir,filename_from_url(url))\n open(url) do |f|\n File.open(path,\"wb\") do |file|\n file.puts f.read\n end\n end \n path\n end",
"title": ""
},
{
"docid": "b127194ec65c8ac1272e2f9075dd1eaf",
"score": "0.5546114",
"text": "def file_create(*args, &block); end",
"title": ""
},
{
"docid": "ca12961117be70612c482fd05aaee3f0",
"score": "0.55424124",
"text": "def download_resource(url, path)\n FileUtils.mkdir_p(File.dirname(path))\n the_uri = URI.parse(url)\n if the_uri\n data = html_get(the_uri)\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"title": ""
},
{
"docid": "5375fc534489276b2ab4f699b5d42d97",
"score": "0.55423295",
"text": "def create_by_files(files_paths, options = {})\n response = api.post_files(url('create-by-file'), files_paths, options.merge(token: @access_token.token))\n success_uploads = response['Success']\n processes = []\n success_uploads.each do |upload|\n processes.push(CopyleaksProcess.create(self, api, upload))\n end\n processes\n end",
"title": ""
},
{
"docid": "d6f02e78732b276087cf2968bd470773",
"score": "0.5541322",
"text": "def fetch_remote(url)\n\n self.class.init_caches \n \n http_response = RestClient.get(url)\n\n file = Tempfile.new(Time.new.to_i.to_s)\n open(file.path, 'w') { |f| f << http_response.to_s }\n\n return file\n\n end",
"title": ""
},
{
"docid": "7d4bc4a4ae95e67c0ae22aa0584553e0",
"score": "0.5530436",
"text": "def new_file(human_name, filename, content)\n @required_folder = File.dirname(filename)\n FileUtils.mkdir_p @required_folder\n fatal(\"Unable to create folder for file #{filename}\") unless Dir.exist?(@required_folder)\n File.open(filename, 'w') do |s|\n s.puts content\n end\n fatal(\"Failed to create #{human_name} #{filename}\") unless File.exist?(filename)\nend",
"title": ""
},
{
"docid": "8bca3bd3bf70de7db73aac49b01e12c9",
"score": "0.55263233",
"text": "def create_filename(uri)\n now = Time.now\n filename = uri.to_s + '_' + (now.to_s[0..9] + '_' + now.to_s[11..18]).to_s\n filename.tr!( '/', '-' )\n filename.tr!( ' ', '_' )\n\n filename\n end",
"title": ""
},
{
"docid": "48eaae950c29c66421f428ff4e345e54",
"score": "0.55251336",
"text": "def createFiles(dir, numFiles)\n\tfor i in 1..numFiles\n\t\tf = File.new(\"test_#{i}.txt\", \"w\")\n\t\tf.close()\n\tend\nend",
"title": ""
},
{
"docid": "77d84fbbe6471f9dacec4a6d39831365",
"score": "0.55213594",
"text": "def download_resource(url, path)\n FileUtils.mkdir_p File.dirname(path)\n the_uri = URI.parse(url)\n if the_uri\n data = html_get the_uri\n File.open(path, 'wb') { |f| f.write(data) } if data\n end\n end",
"title": ""
}
] |
ccfb9fa3829d0c02a3f40e147eeeb7b7
|
[Task:] Make setters for the value and type.
|
[
{
"docid": "a4891e82df69e017fdfe1938df83ca68",
"score": "0.0",
"text": "def test_pay_monthly_fee__business\nbank_account = BankAccount.new(\"Chris\", 1000, \"business\")\nbank_account.pay_monthly_fee()\nassert_equal(950, bank_account.balance())\n\nend",
"title": ""
}
] |
[
{
"docid": "6cb335f971ec4e7f2b4495cb45d52e05",
"score": "0.65781987",
"text": "def value=(val); end",
"title": ""
},
{
"docid": "3ac9e6ce4de9c58d70d21df00296e797",
"score": "0.6549506",
"text": "def set(value)\n case value\n when DateTime\n set(value.to_time)\n when Time\n set(value.to_i)\n when Integer\n self.val = value\n else\n self.val = value.to_i\n end\n val\n end",
"title": ""
},
{
"docid": "75852459d1103e2fc40eaea3958dabc7",
"score": "0.6384675",
"text": "def type=(v)\n case v\n when :get then super('get')\n when :set then super('set')\n when :result then super('result')\n when :error then super('error')\n else super(nil)\n end\n end",
"title": ""
},
{
"docid": "c44965db33e0045f75660529ba047532",
"score": "0.6184366",
"text": "def type=(type); end",
"title": ""
},
{
"docid": "6828884a4015a329a911f370efc7e10f",
"score": "0.6165483",
"text": "def set_value(object, value)\n value = cast_value(value)\n\n case value_type\n when 'integer' then object.value_integer = value\n when 'float' then object.value_float = value\n when 'string' then object.value_string = value\n else raise_invalid_type\n end\n end",
"title": ""
},
{
"docid": "e109e721093cf6bd456777b1722c7eb8",
"score": "0.61295444",
"text": "def value=(value)\n if @value.class == value.class\n @value = value\n @updater = nil\n else\n raise \"Class of new value (#{value.class}) does not match class of current value (#{@value.class})\"\n end\n end",
"title": ""
},
{
"docid": "7d507cd57201ee47ff0bcd7d71c50429",
"score": "0.6095948",
"text": "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n self[#{name.inspect}] = value\n end\n EOS\n end",
"title": ""
},
{
"docid": "2e9bb3fed96c5d881c18fc7acca701c5",
"score": "0.6050198",
"text": "def set(object, value); end",
"title": ""
},
{
"docid": "14acf7ea634c46636b3593c2d5a3012a",
"score": "0.60388577",
"text": "def set_value(value)\n send(\"set_#{value[:type]}_value\", value)\n end",
"title": ""
},
{
"docid": "50eabf64cf97a97b23a585d7ffbb047c",
"score": "0.6024041",
"text": "def set_value( value )\n @value = value \n end",
"title": ""
},
{
"docid": "fd28a48465a2dccaade34678340e82e1",
"score": "0.6020255",
"text": "def value=(value); self.data.value = value; end",
"title": ""
},
{
"docid": "ca3225c384fa9f6f2ba1d37113f7d185",
"score": "0.6002645",
"text": "def type(val); @type = val; self; end",
"title": ""
},
{
"docid": "96083b1222508794fc54337604fadb9a",
"score": "0.59660053",
"text": "def value=(_); end",
"title": ""
},
{
"docid": "7b97fb931b27377d805b94cae2a14135",
"score": "0.59648347",
"text": "def define_setter\n name = @name\n klass.send :define_method, \"#{name}=\" do |unit|\n send \"#{name}_value=\", unit.value\n send \"#{name}_unit=\", unit.unit.to_s\n end\n end",
"title": ""
},
{
"docid": "cd86af82e3119a760e150aa18b240bfb",
"score": "0.59588313",
"text": "def sync\n unless self.class.values\n self.devfail \"No values defined for %s\" %\n self.class.name\n end\n\n # Set ourselves to whatever our should value is.\n self.set(self.should)\n end",
"title": ""
},
{
"docid": "043647401630ad2b220004f8bd468ded",
"score": "0.5945765",
"text": "def _refresh_set_values(values)\n ret = super\n load_typecast\n ret\n end",
"title": ""
},
{
"docid": "25bde86ee55f5524dfaf9611266dc47d",
"score": "0.5942148",
"text": "def set_value(owner, value)\n if value.nil?\n raw_value = nil\n else\n raw_value = case type\n when 'string' then value.to_s\n when 'integer' then value.to_i\n when 'decimal' then value.to_f\n when 'length' then value.to_i\n when 'color' then value[1..-1].to_i(16)\n when 'percent' then value.to_f/100\n end\n end\n\n owner.set_raw_property_value(name, raw_value)\n end",
"title": ""
},
{
"docid": "5ace8daca2d91a0486e80528d599b47b",
"score": "0.5939468",
"text": "def set(obj, value)\n if @type\n if @single\n value = @type.parse(value)\n else\n value = value.map{|e| @type.parse(e)}\n end\n elsif @builder\n if @single\n value = @builder.call(value)\n else\n value = value.map{|e| @builder.call(e)}\n end\n end\n obj.send(\"#{@sym}=\".to_sym, value)\n end",
"title": ""
},
{
"docid": "c58c8f10eec71f0d64d98b0335033c82",
"score": "0.5937207",
"text": "def value=(val)\n self[:value] = serialize_value(val)\n end",
"title": ""
},
{
"docid": "18265762457c3129a80e8246de0af964",
"score": "0.59363097",
"text": "def _save_set_values(values)\n ret = super\n load_typecast\n ret\n end",
"title": ""
},
{
"docid": "6750faedfddc2acf1177a7a0e5c2bacf",
"score": "0.59071237",
"text": "def value=(v)\n set(v)\n end",
"title": ""
},
{
"docid": "27dc32b48911efc934a73560c98268e8",
"score": "0.58781743",
"text": "def value=(new_value)\n case @type\n when :switch\n set_switch(new_value)\n when :variable, :bar\n set_variable(new_value)\n end\n method(@method).call(new_value) if @method\n end",
"title": ""
},
{
"docid": "61158f10681a211e34b9f50898d29e6e",
"score": "0.58695793",
"text": "def set(value)\n # Set a name for looking up associated options like the event.\n name = self.class.value_name(value)\n\n call = self.class.value_option(name, :call) || :none\n\n if call == :instead\n call_valuemethod(name, value)\n elsif call == :none\n # They haven't provided a block, and our parent does not have\n # a provider, so we have no idea how to handle this.\n self.fail \"#{self.class.name} cannot handle values of type #{value.inspect}\" unless @resource.provider\n call_provider(value)\n else\n # LAK:NOTE 20081031 This is a change in behaviour -- you could\n # previously specify :call => [;before|:after], which would call\n # the setter *in addition to* the block. I'm convinced this\n # was never used, and it makes things unecessarily complicated.\n # If you want to specify a block and still call the setter, then\n # do so in the block.\n devfail \"Cannot use obsolete :call value '#{call}' for property '#{self.class.name}'\"\n end\n end",
"title": ""
},
{
"docid": "96ee97923481007ed3a8846ecea5d0d1",
"score": "0.5851138",
"text": "def set(fields)\n case self[:value]\n when Proc\n fields.send \"#{self[:key]}=\", self[:value].call(nil)\n else\n attr = if self[:key].to_s.end_with?('?')\n self[:key].to_s[0..-2]\n else\n self[:key]\n end\n fields.send \"#{attr}=\", self[:value]\n end\n end",
"title": ""
},
{
"docid": "938cf5149d95651a6b444338a5ed6652",
"score": "0.5841786",
"text": "def set_type_of_value\n @type_of_value = TypeOfValue.find(params[:id])\n end",
"title": ""
},
{
"docid": "5618d399855067f808d992fb8078827d",
"score": "0.58347654",
"text": "def value=(new_value)\n method(@method).call(new_value) if @method\n case @type\n when :switch\n set_switch(new_value)\n when :variable, :bar\n set_variable(new_value)\n end\n end",
"title": ""
},
{
"docid": "bd7b0485f9cb105e3c01651960ab44c5",
"score": "0.5816024",
"text": "def value=(value)\n @value = value\n end",
"title": ""
},
{
"docid": "28549dbed4fa752295755f959525116c",
"score": "0.5804142",
"text": "def initialize(name, type, value)\n\t\t@name, @type= name, type\n\t\tassign(value)\n\tend",
"title": ""
},
{
"docid": "4bbacb163ff25f455f89ee4dbf6f190c",
"score": "0.5781625",
"text": "def set_value\n if resolver.params.key?(name) && options.key?(resolver.params[name])\n self.value = resolver.params[name]\n else\n self.value = attributes.delete(:value)\n end\n end",
"title": ""
},
{
"docid": "ace1f5a00d86d5672152c1302cb9dafc",
"score": "0.57783026",
"text": "def create_setter\n @model.class_eval <<-EOS, __FILE__, __LINE__\n #{writer_visibility}\n def #{name}=(value)\n attribute_set(#{name.inspect}, value)\n end\n EOS\n end",
"title": ""
},
{
"docid": "33d5217145f535a17b90168dfec988f5",
"score": "0.57764864",
"text": "def set(value)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "ee17783d47a10b2541acde8feed918f5",
"score": "0.576698",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "d9839c4856d985427f456bc7978dd348",
"score": "0.5751335",
"text": "def value=(value)\n @object.instance_variable_set(:\"@#{@name}\",coerce(value))\n end",
"title": ""
},
{
"docid": "206d3aa777f60cc152ce19e47b970c30",
"score": "0.57456607",
"text": "def value_type= value_type\n self.type = value_type.gsub(\"-\", \"_\").camelize\n end",
"title": ""
},
{
"docid": "91d85111462227b53e2e782779edb10f",
"score": "0.5744902",
"text": "def initialize(type,value)\n @type, @value = type, value\n\n end",
"title": ""
},
{
"docid": "6c192f58065ad95e4241a406d2bf9c6c",
"score": "0.5721905",
"text": "def set(value)\n case value\n when DateTime\n set(value.to_time)\n when Time\n time_int = value.to_i\n time_int *= NS_MULTIPLIER\n adjusted_epoch = time_int + EPOCH_DIFF_100NS\n set(adjusted_epoch)\n when Integer\n self.val = value\n else\n self.val = value.to_i\n end\n val\n end",
"title": ""
},
{
"docid": "cdf7a80e60fba902f4552de272927b0b",
"score": "0.57177234",
"text": "def define_setter_for(name)\n define_method(\"#{name}=\") do |associated|\n instance_variable_set(\"@#{name}\".to_sym, associated)\n\n assign_id_for(name, associated)\n assign_type_for(name, associated)\n assign_serialized_attributes(name, associated)\n end\n end",
"title": ""
},
{
"docid": "f166838f2bd83ced19646335dbdfc230",
"score": "0.5715982",
"text": "def initialize(type:, value:)\n @type = type\n @value = value\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "47395f516fae2bb9edaf4770ffc48dd1",
"score": "0.5711636",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "a8ae288b2db5b275dad792caddcf467e",
"score": "0.5697096",
"text": "def as(value)\n @value = value\n end",
"title": ""
},
{
"docid": "b2ee7ded266f1f6cbf2dd0c28ceea561",
"score": "0.5692365",
"text": "def value=(v)\n @value = from_type(v)\n end",
"title": ""
},
{
"docid": "91063efafe40b0709e46678aca1a9c25",
"score": "0.56773055",
"text": "def define_type_and_value\n if boolean?\n @type = :boolean\n @value = @arg[:boolValue]\n elsif string?\n @type = :string\n @value = @arg[:textValue]\n elsif datetime?\n @type = :datetime\n @value = @arg[:datetimeValue]\n elsif extension?\n @type = :extension\n @value = @arg[:extension]\n else\n @type = :unknown\n end\n end",
"title": ""
},
{
"docid": "117daaef65f12e3de35dd9fd6e173dd6",
"score": "0.56681854",
"text": "def assign_value\n if assigned_attr = AttrName.find_by_id(self.attr_name_id)\n case assigned_attr.value_type\n when \"STRING\"\n self.string_val = self.raw_value\n when \"FLOAT\" #has a special case to remove the dollar symbol in front of it\n #remove_dollar_sign\n self.float_val = self.raw_value.to_f\n when \"DATETIME\"\n self.datetime_val = self.raw_value.to_datetime\n when \"BOOLEAN\"\n if self.raw_value == 'true'\n self.bool_val = true\n else\n self.bool_val = false\n end\n when \"INTEGER\"\n if assigned_attr.treat_as_price\n logger.debug \"Treating this as a price\"\n self.price_val_cents = Money.parse(self.raw_value).cents\n else\n self.int_val = self.raw_value.to_i\n end\n else\n self.string_val = self.raw_value\n end\n end\n end",
"title": ""
},
{
"docid": "c32369d7307584e2d41bf8e2cc361ffd",
"score": "0.5667251",
"text": "def cattr_setter_thread *names\n opts = Hash === names[-1] ? names.pop : EMPTY_HASH\n\n transform = opts[:setter_transform]\n transform = \"__val = (#{transform})\" if transform\n\n names.each do | name |\n instance_eval(expr = <<\"END\", __FILE__, __LINE__)\ndef self.#{name}= __val\n #{transform}\n Thread.current[:'#{self.name}.#{name}'] = [ __val ]\nend\nEND\n # $stderr.puts \"#{expr}\"\n end\n end",
"title": ""
},
{
"docid": "f4fe57036420540578366971b46deead",
"score": "0.5667034",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "f4fe57036420540578366971b46deead",
"score": "0.5667034",
"text": "def update!(**args)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "39134d0e5bd2ee41c465ea4d29618fa7",
"score": "0.5657657",
"text": "def set_value(opts)\n opts = check_params(opts,[:create_instances_if_needed,:class_instance_key,:field_instance_name,:value])\n super(opts)\n end",
"title": ""
},
{
"docid": "aab97a5d38952a21568fa7a2d67a5b8c",
"score": "0.56486875",
"text": "def initialize(type, value)\n @type = type\n @value = value\n end",
"title": ""
},
{
"docid": "4262a38fa624f78860077d5882d9be05",
"score": "0.56432635",
"text": "def set_field_value(name, value)\n\t\tend",
"title": ""
},
{
"docid": "3beefb1e50317449640ae53e84527b5a",
"score": "0.5641883",
"text": "def setValue(value)\n @value = value\n end",
"title": ""
},
{
"docid": "347a79039739705fe7af51583e989fc8",
"score": "0.5639852",
"text": "def value= (val) ; write_attribute(:value, Marshal.dump(val)) ; end",
"title": ""
},
{
"docid": "34d7ac1c948fea70f965d80a49c8bd9e",
"score": "0.5627304",
"text": "def value(value)\n\t\t@value=value\n\tend",
"title": ""
},
{
"docid": "fe9e2198f3f0a2b95fa262e5ddee8c2f",
"score": "0.5627196",
"text": "def attr_set_sb2(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "448243d71d66b176445153304aa63455",
"score": "0.56249297",
"text": "def value=(value)\n @value = value\n end",
"title": ""
},
{
"docid": "5bc5861b505af992fb66cf0f270d8832",
"score": "0.5622527",
"text": "def set_value new_value\n if validate_value new_value\n @value = new_value\n end\n end",
"title": ""
},
{
"docid": "25440cdddf4e32f00e0e71aec1459c94",
"score": "0.5619474",
"text": "def setter\r\n @setter ||= Field.setter(@name)\r\n end",
"title": ""
},
{
"docid": "aaf04675b5ec153651e6f0c4edbdd2e1",
"score": "0.5617971",
"text": "def set(value)\n value\n end",
"title": ""
},
{
"docid": "f542cdf3dd4355f23fb575bea0dd09a5",
"score": "0.56110096",
"text": "def set_values (type, time, x, y)\n\t\t@type=type\n\t\t@time=time\n\t\t@x=x\n\t\t@y=y\n\t\tself\n\tend",
"title": ""
},
{
"docid": "0dd2783ce433f87b5481e70b88a784b6",
"score": "0.5601051",
"text": "def set_type\n end",
"title": ""
},
{
"docid": "bb67501064942364fb867e80120cd408",
"score": "0.5593768",
"text": "def type=(_); end",
"title": ""
},
{
"docid": "bb67501064942364fb867e80120cd408",
"score": "0.5593768",
"text": "def type=(_); end",
"title": ""
},
{
"docid": "bb67501064942364fb867e80120cd408",
"score": "0.5593768",
"text": "def type=(_); end",
"title": ""
},
{
"docid": "bb67501064942364fb867e80120cd408",
"score": "0.5593768",
"text": "def type=(_); end",
"title": ""
},
{
"docid": "bb67501064942364fb867e80120cd408",
"score": "0.5593768",
"text": "def type=(_); end",
"title": ""
},
{
"docid": "adeebc24eb06015e7354a5bc7788c36b",
"score": "0.5591982",
"text": "def assign_property(name, value); end",
"title": ""
},
{
"docid": "863dd8904071c983c6c7479a0f2cc1cf",
"score": "0.5579798",
"text": "def value_update(_value, type)\n if _value.blank? or _value == 'null'\n destroy\n else\n case type\n when AttributeClass::TYPE_NUMBER\n create_or_update_value SitescanCommon::AttributeNumber, {value: _value}\n when AttributeClass::TYPE_RANGE\n create_or_update_value SitescanCommon::AttributeRange,\n {from: _value[:from], to: _value[:to]}\n when AttributeClass::TYPE_OPTION\n create_or_update_value SitescanCommon::AttributeOption,\n {attribute_class_option_id: _value}\n when AttributeClass::TYPE_BOOLEAN\n create_or_update_value SitescanCommon::AttributeBoolean, {value: _value}\n when AttributeClass::TYPE_STRING\n create_or_update_value SitescanCommon::AttributeString, {value: _value}\n end\n end\n end",
"title": ""
},
{
"docid": "e9699d7d2ff126a5d46a12564e5cde76",
"score": "0.557723",
"text": "def value=(obj)\n @value = to_value(obj)\n end",
"title": ""
},
{
"docid": "d6811d78b478f1ba0915299c6310f4d9",
"score": "0.55642676",
"text": "def set_values(opts)\n opts = check_params(opts,[:create_instances_if_needed,:class_instance_keys,:field_instance_names,:values])\n super(opts)\n end",
"title": ""
},
{
"docid": "37481fa124e385ebd2305f3a8b8d8eca",
"score": "0.556417",
"text": "def value=(val)\n if(val.nil?)\n self[:length] = 0\n self[:value] = val\n elsif(val.is_a?(String))\n buff = FFI::MemoryPointer.from_string(val)\n self[:length] = val.length\n self[:value] = buff\n elsif(val.is_a?(Fixnum))\n buff = FFI::MemoryPointer.new :OM_uint32\n buff.write_int val\n self[:length] = FFI::type_size :OM_uint32\n self[:value] = buff\n else\n raise StandardError, \"Can't handle type #{val.class.name}\"\n end\n end",
"title": ""
},
{
"docid": "4d3e730ee4be61d3ccd11c8e918f8916",
"score": "0.55635905",
"text": "def set_value value\n if allows? value\n @set_value_handler.call value\n end\n end",
"title": ""
},
{
"docid": "471b07012b1fab1369aff4b88329a169",
"score": "0.5553876",
"text": "def assign(obj)\n @value = obj\n end",
"title": ""
},
{
"docid": "c8c42c9fa10ce0a677c829261bb7de08",
"score": "0.5548456",
"text": "def attribute_set(name, value) \n \n super(name, value)\n \n if (name.to_sym == :content_type) \n check_content_type!\n check_publishing_workflow!\n end\n\n end",
"title": ""
},
{
"docid": "2e773c29a39a1d9c23a5d25201150802",
"score": "0.55482376",
"text": "def attr_set_sb4(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "5d3e8a3c467fe82c1519fc87c65d1a1c",
"score": "0.5547903",
"text": "def value=(value)\n\t\tself.updated_at = Time.now\n\t\tif is_multi_object?\n\t\t\t(@value ||= []) << value\n\t\telse\n\t\t\t@value = value\n\t\tend\n\tend",
"title": ""
},
{
"docid": "26602e41d597a729539edc03bfc17961",
"score": "0.5536837",
"text": "def set_type(val)\n self.type = val\n self\n end",
"title": ""
},
{
"docid": "4fc307aeba511a18b114610b0b0a869b",
"score": "0.5529779",
"text": "def initialize(type, value)\n @value = Hash[type: type, value: value]\n end",
"title": ""
},
{
"docid": "b899896a2c851ca4af4ffe353b359062",
"score": "0.5528411",
"text": "def update!(**args)\n @int_value_spec = args[:int_value_spec] if args.key?(:int_value_spec)\n @option_value_spec = args[:option_value_spec] if args.key?(:option_value_spec)\n @type = args[:type] if args.key?(:type)\n end",
"title": ""
},
{
"docid": "061436cf9fec507465246ff131dcc561",
"score": "0.55258465",
"text": "def value_type=(value)\n @value_type = value\n end",
"title": ""
},
{
"docid": "bf3116cb85646b1cbe66f1ed0030b80e",
"score": "0.5517729",
"text": "def value=(value)\n self.should = value\n end",
"title": ""
},
{
"docid": "fccde309310c4f2ea9fd1739f0c6f030",
"score": "0.5506761",
"text": "def method_missing(method_name, *arguments, &block)\n if /^(?<id>[^=]+)(?<assign>=)?$/ =~ method_name.to_s && attribute = self[id]\n assign ? attribute.send(\"value=\", *arguments) : attribute.value\n else\n super\n end\n end",
"title": ""
},
{
"docid": "dd148ed5dbaa7095ea2103e80a13705e",
"score": "0.5504039",
"text": "def type_setter\n @type_setter ||= type.__setter__\n end",
"title": ""
},
{
"docid": "d8d0c2e9524ade4a8bb7da085af3e754",
"score": "0.55035895",
"text": "def set_values\n self[:type] = @type\n self[:line] = @line\n self[:column] = @column\n self[:message] = @message\n self[:level] = @level\n end",
"title": ""
},
{
"docid": "34e0321a1e8ea3b0e23dd7481763a054",
"score": "0.5493483",
"text": "def create_setters\n schema_fields.keys.each do |key|\n self.class.send(:define_method, \"#{key.to_s}=\".to_sym) do |value| \n @data[key] = value #get_value key, value\n end\n end\n end",
"title": ""
},
{
"docid": "78e2a511223b48c15090959f58f05b50",
"score": "0.54925805",
"text": "def attr_set_sb1(attr_type, attr_value)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "43f1d4d41a57a45c6b7d6921ad4e955c",
"score": "0.54892987",
"text": "def expected_value=(arg)\n end",
"title": ""
},
{
"docid": "43f1d4d41a57a45c6b7d6921ad4e955c",
"score": "0.54892987",
"text": "def expected_value=(arg)\n end",
"title": ""
},
{
"docid": "069c63cef6c27377704622f11ddcd40c",
"score": "0.54820454",
"text": "def define_attribute_setter(attribute_name, options)\n define_method \"#{attribute_name}=\" do |value|\n send(\"#{attribute_name}_will_change!\") unless value == send(attribute_name)\n\n value = ActiveModel::Type.lookup(options[:type]).deserialize(value) if options[:type]\n\n instance_variable_set(\"@#{attribute_name}\", value)\n end\n end",
"title": ""
},
{
"docid": "d508f29eea085d040ff4c00efa72b4ff",
"score": "0.5478483",
"text": "def set_attribute(name, value); end",
"title": ""
},
{
"docid": "0938a73aeadb8eb1805173739c7831e5",
"score": "0.5475922",
"text": "def set_value val, key=\"\"\n oldval = @value\n if @klass == 'String'\n @value = val\n elsif @klass == 'Hash'\n #$log.debug \" Variable setting hash #{key} to #{val}\"\n oldval = @value[key]\n @value[key]=val\n elsif @klass == 'Array'\n #$log.debug \" Variable setting array #{key} to #{val}\"\n oldval = @value[key]\n @value[key]=val\n else\n oldval = @value\n @value = val\n end\n return if @update_command.nil?\n @update_command.each_with_index do |comm, ix|\n comm.call(self, *@args[ix]) unless comm.nil?\n end\n @dependents.each {|d| d.fire_property_change(d, oldval, val) } unless @dependents.nil?\n end",
"title": ""
},
{
"docid": "d59e43ccef7813ee8ae1ad46da0a06da",
"score": "0.5472635",
"text": "def process_attribute(key, value)\n return super unless key == :value\n\n @built[:value] = value\n nil\n end",
"title": ""
},
{
"docid": "b75ab7365b227791058b08ea81090b2e",
"score": "0.546514",
"text": "def value=(value)\n @value = value\n end",
"title": ""
},
{
"docid": "b75ab7365b227791058b08ea81090b2e",
"score": "0.546514",
"text": "def value=(value)\n @value = value\n end",
"title": ""
},
{
"docid": "b75ab7365b227791058b08ea81090b2e",
"score": "0.546514",
"text": "def value=(value)\n @value = value\n end",
"title": ""
},
{
"docid": "90d392a6603cce5ccb682c4dbc646abe",
"score": "0.5461937",
"text": "def initialize(value)\n @value = value\n @type = self.class.type\n end",
"title": ""
},
{
"docid": "8975f95936438911763d46097c40f12f",
"score": "0.5458044",
"text": "def set; end",
"title": ""
}
] |
cae28626681bca97e1f5a6c737750104
|
POST /statuses POST /statuses.json
|
[
{
"docid": "37991d1a63f9814607bcfc6451bdfd75",
"score": "0.0",
"text": "def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "c28ad5d86fbc4bc993a73f1765d4708e",
"score": "0.6963445",
"text": "def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end",
"title": ""
},
{
"docid": "7245d9188c2e1f0ad6cd86fe4a52211b",
"score": "0.6957925",
"text": "def postTweet(status)\n\t\t\t@client.update(status)\n\t\tend",
"title": ""
},
{
"docid": "9da87576cf20e76fe5da452525ec06f4",
"score": "0.6830754",
"text": "def create\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:post, params[:text])\n flash[:notice] = 'Tweet was successfully created.'\n format.html { redirect_to tweet_url(@tweet) }\n format.json { head :created, :location => tweet_url(@tweet) }\n format.xml { head :created, :location => tweet_url(@tweet) }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format, 'new')\n end\n end\n end",
"title": ""
},
{
"docid": "930e72a5a53a18df28e3ef6013582525",
"score": "0.6570347",
"text": "def create\n user = user_from_token\n @tweet = user.tweets.new()\n @tweet.tweet = params[:tweet]\n if @tweet.save\n render :json => @tweet, :status => :created\n else\n render :json => @tweet.errors, :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ee24242928fa493df435991b3bdf03d9",
"score": "0.6524462",
"text": "def create\n @status = current_user.statuses.new(status_params)\n\n if current_user.state_facebook? && @status.content?\n current_user.facebook(current_user).put_wall_post(@status.content)\n end\n\n if current_user.state_twitter? && @status.content?\n current_user.twitter(current_user).update(@status.content)\n end\n \n respond_to do |format|\n if @status.save\n format.html { redirect_to statuses_url, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { redirect_to statuses_url }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c7460067ffb48d73eae8a7712f0d3f87",
"score": "0.6512795",
"text": "def create\n @tweet = current_user.tweets.create(params[:tweet])\n respond_with(@tweet, :location => tweet_url(@tweet))\n end",
"title": ""
},
{
"docid": "702b552b6f1b01fec2c33623059ab6e1",
"score": "0.62574154",
"text": "def create_statuses\n end",
"title": ""
},
{
"docid": "702b552b6f1b01fec2c33623059ab6e1",
"score": "0.62574154",
"text": "def create_statuses\n end",
"title": ""
},
{
"docid": "cb223b9602acfe9d419bb0c78e326529",
"score": "0.62528837",
"text": "def create\n @tweet = Tweet.new(tweet_params)\n if @tweet.username == nil\n # This is for the current user posting tweets\n @tweet.username = current_user.name\n @tweet.user_id = current_user.id\n # Updates to Twitter\n current_user.twitter.update(@tweet.tweetbody)\n else \n # Incoming tweets from the daemon script\n @tweet.save\n end\n respond_with(@tweet)\n end",
"title": ""
},
{
"docid": "b294067c26b8d6dedf0e1c6f97dbfb5c",
"score": "0.6230583",
"text": "def tweet(postids)\n handle_response(get(\"/content/tweet.json\", :query => {:postids => postids}))\n end",
"title": ""
},
{
"docid": "943783088daf7ccfd24df793f293b9b3",
"score": "0.62248516",
"text": "def create\n \n # API Status Update - Basic Authentication\n if !session[\"user_id\"]\n authenticate_or_request_with_http_basic do |username, password|\n if request.url.index('localhost')\n user = User.find(:first, :conditions => ['username LIKE ?', username.strip])\n else\n user = User.find(:first, :conditions => ['username ILIKE ?', username.strip])\n end\n\n if user && user.authenticate(password)\n session[\"user_id\"] = user.id\n end\n end\n end\n \n\n respond_to do |format|\n \n if params[:status] and params[:status][:message] \n postmessage = params[:status][:message]\n elsif params[:message] \n postmessage = params[:message]\n end\n \n if session[\"user_id\"] and postmessage\n\n @status = Status.new \n @status.user_id = session[\"user_id\"]\n @status.message = postmessage \n @status.save\n \n @activity = Activity.new\n @activity.user_id = session[\"user_id\"]\n @activity.status_id = @status.id\n @activity.council_id = @council.id\n @activity.save\n \n # Check if message includes a mention \n txtcall = @status.message.gsub(\"@\", \"\")\n txtarray = txtcall.split(\" \")\n if request.url.index('localhost')\n @mention = User.find(:first, :conditions => ['username LIKE ?', txtarray[0]])\n else\n @mention = User.find(:first, :conditions => ['username ILIKE ?', txtarray[0]])\n end\n \n if @mention and @mention.email and @mention.allowemail != false\n begin\n MentionMailer.alerter(session[:username], @mention.username, session[:image], @mention.email, @activity.id.to_s).deliver\n rescue\n end\n end \n \n # Tweet\n if session['access_token'] and params[:status][:twitter] == \"1\"\n @client.update(@status.message)\n end \n \n # FB\n if session['fbtoken'] and params[:status][:facebook] == \"1\"\n RestClient.post 'https://graph.facebook.com/' + session['fbid'] + '/feed', :access_token => session['fbtoken'], :message => @status.message\n end\n \n \n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n # format.json { render json: @status, status: :created, location: @status }\n format.js { render :action => 'create.js.coffee', :content_type => 'text/javascript'}\n format.json { render :json => @status}\n else\n format.html { render action: \"new\" }\n format.json { }\n end\n end\n end",
"title": ""
},
{
"docid": "cbfc5dd735b1ccafcd30ec01ec62552a",
"score": "0.62126905",
"text": "def tweet(message, options = {})\n status = Status.new\n status.lat = options[:lat]\n status.long = options[:long]\n status.body = messages\n status.reply_id = options[:reply_id]\n status.post\nend",
"title": ""
},
{
"docid": "e95de797ef280eb0ce343e1dc23a0982",
"score": "0.6162643",
"text": "def tweet_params\n params.require(:tweet).permit(:status, :message, :location, :user_id)\n end",
"title": ""
},
{
"docid": "b5b15a5f46c7a14cda0cc52d1bb3eac8",
"score": "0.6137117",
"text": "def create\n @tweet = FuKing::Twitter.update(params[:tweet][:text])\n\n respond_to do |format|\n if @tweet\n flash[:notice] = 'Tweet was successfully created.'\n format.html { redirect_to(:action => :index) }\n format.mobile { redirect_to(:action => :index) }\n format.xml { render :xml => @tweet, :status => :created, :tweet => @tweet }\n else\n format.html { render :action => \"new\" }\n format.mobile { render :action => \"new\" }\n format.xml { render :xml => @tweet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1cfaad94bedcaf1c33a94c4cecce526b",
"score": "0.6115783",
"text": "def tweet_from_api\n @tweet_api = User.find(2).tweets.create(tweet_params)\n render json: @tweet_api\n end",
"title": ""
},
{
"docid": "533daa8ba17a9a0169da0e873d1fe8a6",
"score": "0.610219",
"text": "def twitter\n @user = User.find(session[:user_id])\n t = @user.twitter\n unless t.present?\n redirect_to @user, :notice => \"Please add your twitter account!\"\n return\n end\n @tweets = t.home_timeline\n @posts = []\n @tweets.each do |tweet|\n if Post.exists?(:tweet_id => tweet[:id])\n @posts.push(Post.find_by_tweet_id(tweet[:id]))\n else\n p = Post.new\n p.tweet_id = tweet[:id]\n p.tweeter_twitter_id = tweet[:user][:id]\n if User.exists?(:twitter_id => tweet[:user][:id])\n p.user_id = User.find_by_twitter_id(tweet[:user][:id]).id\n else\n p.user_id = -1\n end\n p.post_type = 3\n p.created_at = tweet[:created_at].to_datetime\n url = \"https://api.twitter.com/1/statuses/oembed.json?id=#{tweet[:id]}&omit_script=true\"\n begin\n tweet_page = open(URI.parse(url))\n p.body = JSON.parse(tweet_page.read)['html']\n if p.save!\n @posts.push(p)\n end\n rescue\n # Tried to access a protected tweet, just skip it\n end\n end\n end\n\n @body_class = 'twitter-background'\n respond_to do |format|\n format.html # twitter.html.erb\n format.json { render json: @posts }\n end\n end",
"title": ""
},
{
"docid": "a4a8ea0d71cc47c3335700a06cf0fa93",
"score": "0.60935134",
"text": "def create\n @tweet = @user.tweets.build(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to user_tweet_path(@user, @tweet), notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: user_tweet_path(@user, @tweet) }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2dd479916952894df700cb80f15c7cfb",
"score": "0.6080883",
"text": "def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end",
"title": ""
},
{
"docid": "f7c43ca208fa90e1cbfea5de3bb90757",
"score": "0.60697585",
"text": "def tweet(message, options = {})\n status = Status.new\n status.lat = options[:lat]\n status.long = options[:long]\n status.body = message\n status.reply_id = options[:reply_id]\n status.post\nend",
"title": ""
},
{
"docid": "f7c43ca208fa90e1cbfea5de3bb90757",
"score": "0.60697585",
"text": "def tweet(message, options = {})\n status = Status.new\n status.lat = options[:lat]\n status.long = options[:long]\n status.body = message\n status.reply_id = options[:reply_id]\n status.post\nend",
"title": ""
},
{
"docid": "f7c43ca208fa90e1cbfea5de3bb90757",
"score": "0.60697585",
"text": "def tweet(message, options = {})\n status = Status.new\n status.lat = options[:lat]\n status.long = options[:long]\n status.body = message\n status.reply_id = options[:reply_id]\n status.post\nend",
"title": ""
},
{
"docid": "27e369bf73cdf7effe266283cff2b0af",
"score": "0.6066338",
"text": "def create\n\t\tputs params[:post_now]\n\t\tif params[:post_now] == \"1\"\n\t\t\tclient = Twitter::REST::Client.new do |config|\n\t\t\t\tconfig.consumer_key = TWITTER_API_KEY\n\t\t\t\tconfig.consumer_secret = TWITTER_API_SECRECT\n\t\t\t\tconfig.access_token = current_user.access_token\n\t\t\t\tconfig.access_token_secret = current_user.access_token_secret\n\t\t\tend\n\t\t\tcontent = params[:tweet][:content]\n\t\tend\n\t\t@tweet = current_user.tweets.build(tweet_params)\n\t\trespond_to do |format|\n\t\t\tif @tweet.save\n\t\t\t\tif client.update(\"#{content}\")\n\t\t\t\t\tputs @tweet.update(tweeted: true)\n\t\t\t\t\tflash[:notice] = \"Successfully posted \" \n\t\t\t\telse\n\t\t\t\t\tflash[:notice] = \"not updated \" \n\t\t\t\tend\n\t\t\t\tformat.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @tweet }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @tweet.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "cb2f21513f097e281d4c1b1d65e5dc5a",
"score": "0.60485756",
"text": "def create\n @tweet = Tweet.create(:user_id => current_user.id, :text => tweet_params[:text])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "37e68b30c61329814382d8a238bc5d42",
"score": "0.6026185",
"text": "def post_to_twitter\n tweet = event_post_to_twitter(current_user.events.find(params[:id]))\n if tweet\n tweet_url = \"https://twitter.com/#{current_user.twitter_username}/status/#{tweet.id}\"\n redirect_to request.referer,\n :flash => { :success => \"Your event has been twitted,\n <br><i class='fa fa-twitter'></i> \n <a href='#{tweet_url}' rel='nofollow' target='_blank'>#{tweet_url}</a>\" }\n else\n redirect_to request.referer, :flash => { :error => \"Ooops. something wrong\" }\n end\n end",
"title": ""
},
{
"docid": "41435f1c6bcb2503b85728207de74cbb",
"score": "0.6022849",
"text": "def tweet_params\n params.require(:tweet).permit(:status, :zombie_id)\n end",
"title": ""
},
{
"docid": "cb4f091ac23c752d70fa217c9c2fab69",
"score": "0.60216755",
"text": "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('statuses', :post) do |req|\n req.body = {\n status_object: attrs.slice(:name),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end",
"title": ""
},
{
"docid": "b04a7da6020d0fb8ce490fe8399aa5bc",
"score": "0.60179526",
"text": "def create\n @tweet = Tweet.new(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: @tweet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b04a7da6020d0fb8ce490fe8399aa5bc",
"score": "0.60179526",
"text": "def create\n @tweet = Tweet.new(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: @tweet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4f1eb0cf38c8bc2061978b2c0e11c684",
"score": "0.6009024",
"text": "def tweet(message, options = {}) # options = {} is the hash argument\n status = Status.new\n status.lat = options[:lat] # each item in [] that starts with : are reference keys from hash\n status.long = options[:long]\n status.body = options[:body]\n status.reply_id = options[:reply_id]\n status.post\nend",
"title": ""
},
{
"docid": "4bb0d786cc3a1ba2358a5b760b5409c0",
"score": "0.60028815",
"text": "def queue\n raise StringTooBigError if status.length > MAX_STATUS_LENGTH\n api_url = 'http://twitter.com/statuses/update.json'\n url = URI.parse(api_url)\n req = Net::HTTP::Post.new(url.path)\n req.basic_auth(@@username, @@password)\n req.set_form_data({ 'status'=> status }, ';')\n res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }.body\n @id = JSON.parse(res)[\"id\"]\n @created_at = JSON.parse(res)[\"created_at\"]\n self\n end",
"title": ""
},
{
"docid": "cd6e1ead0933a618b552137a16b5c5cb",
"score": "0.5992083",
"text": "def create\n @tweet = current_user.tweets.build(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5c05630078a8feabe386de85a5f926ed",
"score": "0.5990289",
"text": "def tweet(tweet_body)\n encoded_url = url_encode \"#{@handle}/#{@password}/#{tweet_body}\"\n HTTParty.post(\"#{@api_path}/tweets/new/#{encoded_url}\")\n end",
"title": ""
},
{
"docid": "d3fbe4c7e43487e36c09d033e07f136e",
"score": "0.59868217",
"text": "def mentions(params = {})\n get \"statuses/mentions\", params\n end",
"title": ""
},
{
"docid": "0c49ed6d44ba82cacf794cea70e4eae2",
"score": "0.59865755",
"text": "def create\n tweet.user = current_user\n\n respond_to do |format|\n if tweet.save\n format.html { redirect_to tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: tweet }\n else\n format.html { render :new }\n format.json { render json: tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c61229d675018e310548d4101c857b00",
"score": "0.5983578",
"text": "def index\n\n #client = Twitter::REST::Client.new do |config|\n # config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n # config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n # config.access_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n # config.access_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n #end\n\n require \"rubygems\"\n\n # Certain methods require authentication. To get your Twitter OAuth credentials,\n # register an app at http://dev.twitter.com/apps\n Twitter.configure do |config|\n config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n config.oauth_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n config.oauth_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n end\n\n # Initialize your Twitter client\n client = Twitter::Client.new\n\n # Post a status update\n client.update(\"I just posted a status update via the Twitter Ruby Gem !\")\n redirect_to request.referer, :notice => 'Tweet successfully posted'\n\n end",
"title": ""
},
{
"docid": "07e296ad9a616dcc11f119fca68ea875",
"score": "0.59669757",
"text": "def tweet(message, options = {})\n status = Status.new \n status.lat = options[:lat] \n status.long = options[:long]\n status.body = message\n status.reply_id = options[:reply_id]\n status.post\n end",
"title": ""
},
{
"docid": "a9c1ef85ec3a9e758f9d57fecfcd88fd",
"score": "0.5943071",
"text": "def create\n @tweet = Tweet.new(tweet_params)\n @tweet.user = current_user\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to root_path, notice: \"Tweet creado felizmente.\" }\n format.json { redirect_to root_path, status: :created, location: @tweet }\n else\n format.html { redirect_to root_path, notice: \"No se puede tuitear nada.\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39d88996230d5bf2bff38d5ab553930b",
"score": "0.5939241",
"text": "def create\n @tweet = current_user.tweets.build(tweet_params)\n\n #respond_to do |format|\n if @tweet.save\n flash[:success] = 'ツイートを投稿しました。'\n redirect_to tweets_path\n #format.html { redirect_to @tweet }\n #format.json { render :show, status: :created, location: @tweet }\n else\n @tweets = current_user.feed_tweets.order(id: :desc).page(params[:page])\n flash.now[:danger] = 'ツイートを投稿できませんでした。'\n render 'tweets/index'\n #format.html { render :new }\n #format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end",
"title": ""
},
{
"docid": "bd458e4488f5b40c47fb8740e8d8d0c3",
"score": "0.59224397",
"text": "def create\n @tweet = current_user.tweets.build(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to member_url(current_user), notice: '投稿しました' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5738d0faff9169c6c0a451963a2fcbc5",
"score": "0.59178144",
"text": "def create\n @tweet = current_user.tweets.new(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_back fallback_location: root_path, notice: 'ツーイトの投稿が完了しました。' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "301014b7659d18e070b60df5d9e449a6",
"score": "0.5895106",
"text": "def create\n @tweet = Tweet.new(tweet_params)\n \n respond_to do |format|\n if @tweet.save\n format.html { redirect_to tweets_path, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67ae7eac670c7c9f1ccffed4b913b210",
"score": "0.5883411",
"text": "def create\n begin \n new_tweet = Tweet.new(tweet_params)\n if new_tweet.save()\n render(status: 201, json: {tweet: new_tweet})\n else # if validation fails\n render(status: 422, json: {error: new_tweet.errors})\n end\n rescue => error\n render(status: 500, json: {error: \"Internal Server Error: #{error.message}\"})\n end\n end",
"title": ""
},
{
"docid": "6c32b41ae279f889b14a8b743a8e70b5",
"score": "0.58790505",
"text": "def create\n @tweet = Tweet.new(tweet_params.merge(user: current_user))\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to root_path, notice: \"Tweet was successfully created.\" }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1bd34899436e637983e2cde925176ac0",
"score": "0.5867793",
"text": "def create\n username = params[:username]\n tweets = timeline_query username\n tweet_sentiment_list = get_sentiment(tweets)\n redirect_to :action => \"index\", :tweets => tweet_sentiment_list\n end",
"title": ""
},
{
"docid": "b24331353fc509124d035c34451428c6",
"score": "0.586033",
"text": "def create\r\n @tweet = Tweet.new(tweet_params)\r\n @tweet.user = current_user\r\n \r\n respond_to do |format|\r\n if @tweet.save\r\n format.html { redirect_to @tweet, notice: \"Tweet was successfully created.\" }\r\n format.json { render :show, status: :created, location: @tweet }\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "fce057d1ab7b06aa74bf2c38d3ef7120",
"score": "0.5852546",
"text": "def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"title": ""
},
{
"docid": "41792e0f85e6884264ddafafab0ec636",
"score": "0.5839742",
"text": "def post_tweet(message)\n tweet = Tweet.new(self, message)\n self.tweets << tweet\n end",
"title": ""
},
{
"docid": "9975947a72c926154cec47e45828a227",
"score": "0.58354264",
"text": "def post_tweet(message)\n Tweet.new(message, self)\n end",
"title": ""
},
{
"docid": "6d29aaaf5b759883fa552fa2ae6ef313",
"score": "0.5810921",
"text": "def create\n @tweet = Tweet.create(tweet_params)\n\n @tweet = get_tagged(@tweet)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to home_path, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "62f4d640749cdbcfcb86fbf64522fc79",
"score": "0.58002824",
"text": "def post_tweet\n # @tweets << tweet: violates SST\n Tweet.new('tweet message', self)\n end",
"title": ""
},
{
"docid": "9aa0134f72842417b6e36187c1f3f7ce",
"score": "0.5776818",
"text": "def update_status\n if current_user.has_twitter_oauth?\n @T_OAUTH = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_KEY,\n :consumer_secret => TWIITER_SECRET,\n :token => current_user.twitter_account.token,\n :secret => current_user.twitter_account.secret \n )\n\n if @T_OAUTH.authorized? and @T_OAUTH.update(params[:status])\n flash[:notice] = \"Your tweet has been sent\"\n else\n flash[:notice] = \"Sorry ! Your tweet failed to sent, try later !\"\n end\n else\n flash[:notice] = \"You dont have twitter account with oauth token, please authorize myapp in your twitter !\"\n end\n\n redirect_to :action => 'index'\n\n end",
"title": ""
},
{
"docid": "363cb7784554caa6ebf5862ace7fe96a",
"score": "0.57631797",
"text": "def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end",
"title": ""
},
{
"docid": "17bca780080c8b8e7fabc75032a9248d",
"score": "0.5757915",
"text": "def update_status( status ) # status = { :message => 'new post on ruby', :url => 'http://www.ruby-lang.com' }\n message = status[:message]\n short_url = ::ShortUrl::Client.new.short_url( status[:url] )\n if message.nil? or message.empty?\n posted = shorted unless ( short_url.nil? or short_url.empty? )\n else\n posted = message\n posted = posted + ': ' + short_url unless ( short_url.nil? or short_url.empty? )\n end\n if posted.nil?\n { :error => 'Invalid status.'}\n else\n call( 'statuses/update', { :status => posted } , :post )\n end\n end",
"title": ""
},
{
"docid": "8bcf40c1be33a4b84cc88c11a29fa25b",
"score": "0.5749519",
"text": "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"title": ""
},
{
"docid": "eb5543bc0d2b69ffbe6eacd360929047",
"score": "0.57390845",
"text": "def create\n @tweet = current_user.tweets.new tweet_params\n\n if current_user\n @tweet.user_id = current_user.id\n end\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: \"Tweet was successfully created.\" }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ea3470bf825fb5e435e317d02ce74982",
"score": "0.5725892",
"text": "def create\n @user = User.find(params[:user_id])\n @tweet = @user.tweets.create(tweet_params)\n redirect_to user_tweets_path\n end",
"title": ""
},
{
"docid": "faf7e6666dee4c96d694a313197ddc1a",
"score": "0.57250625",
"text": "def update_status!( status , in_reply_to_status_id = nil )\n\t\tif in_reply_to_status_id\n\t\t\tresponse = access_token.post('/statuses/update.json', { :status => status, :in_reply_to_status_id => in_reply_to_status_id })\n\t\telse\n\t\t\tresponse = access_token.post('/statuses/update.json', { :status => status })\n\t\tend\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessage=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless message.is_a? Hash\n\t\t\tmessage\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in update_status!: #{err}\"\n\t\traise err\n\tend",
"title": ""
},
{
"docid": "91ebd97f5c839660e6eacf93d5a9b2eb",
"score": "0.57160395",
"text": "def create\n tweet = params[:tweet]\n message = tweet[:message]\n @tweet = current_user.tweets.create(tweet_params)\n @comment = Comment.new\n \n redirect_to action: \"index\"\n end",
"title": ""
},
{
"docid": "a524f1ca639685b2001675fd4d7ea270",
"score": "0.57150966",
"text": "def create\n @tweet = Tweet.new(tweet_params)\n @tweet.user_id = current_user.id\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to root_path, notice: \"Tu Tweet se ha publicado con exito!\" }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e24e501a7cfb2d643db5c6f80791985e",
"score": "0.571433",
"text": "def retweet(id)\n # one thread per retweet, \n # cause it's much, much faster\n Thread.new do \n LOG.info \"retweet status ##{id}\"\n @handler.post(\"/statuses/retweet/#{id}.json\", nil)\n end\n end",
"title": ""
},
{
"docid": "5c44364b276673b83c6bf6c1a4950ade",
"score": "0.57073325",
"text": "def post_tweet(message)\n Tweet.new(message, self)\n end",
"title": ""
},
{
"docid": "417cd04b5cbcca526a652356d74f01ac",
"score": "0.5705873",
"text": "def create\n @new_tweet = NewTweet.new(new_tweet_params)\n\n respond_to do |format|\n if @new_tweet.save\n format.html { redirect_to @new_tweet, notice: 'New tweet was successfully created.' }\n format.json { render :show, status: :created, location: @new_tweet }\n else\n format.html { render :new }\n format.json { render json: @new_tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7eaa4a35557890538bfaa20bbd97ae00",
"score": "0.5701085",
"text": "def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end",
"title": ""
},
{
"docid": "b85cde4ea9648ad912c97ed5d2eca5ba",
"score": "0.5687296",
"text": "def create\n @tweet = Tweet.new(tweet_params)\n\n if @tweet.save\n render :show, status: :created, location: { tweet: @tweet }\n else\n render json: @tweet.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6cfef036c44dfc65626ee57d4b2d6089",
"score": "0.56776506",
"text": "def tweets(opts={})\n params = {\n :screen_name => NAME,\n :trim_user => true,\n :include_entities => true\n }.merge(opts)\n get(\"/statuses/user_timeline.json\",params)\n end",
"title": ""
},
{
"docid": "bb094ea7ac14ce7f48643c81b1fb6072",
"score": "0.56715167",
"text": "def create\n @twitter_user = TwitterUser.new(params[:twitter_user])\n\n respond_to do |format|\n if @twitter_user.save\n format.html { redirect_to @twitter_user, notice: 'Twitter user was successfully created.' }\n format.json { render json: @twitter_user, status: :created, location: @twitter_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @twitter_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d4db0117df7a5577f73b7df9ae7d1a81",
"score": "0.5669276",
"text": "def create\n @tweet = current_user.tweets.new(tweet_params)\n\n # respond_to do |format|\n if @tweet.save\n # format.html { \n # puts \"html\"\n # render json: TweetBlueprint.render(@tweet), status: :created \n # }\n # format.json { \n puts \"json\"\n render json: TweetBlueprint.render(@tweet), status: :created \n # }\n else\n # format.html { \n # puts \"error html\"\n # render :new \n # }\n # format.json { \n puts \"error json\"\n render json: { result: 'error', error: @tweet.errors }, status: :unprocessable_entity \n # }\n end\n # end\n end",
"title": ""
},
{
"docid": "4bc05cfd1d80c0ad3b9c7542b499b3bf",
"score": "0.5669065",
"text": "def create\n @user = current_user\n @status = @user.statuses.build(status_params)\n\n #@status = Status.new(status_params)\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3e0c7a12d0c128b1504e85cbd7275cf8",
"score": "0.5665592",
"text": "def create\n @tweet = Tweet.new(params[:tweet])\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to(@tweet, :notice => 'Tweet was successfully created.') }\n format.xml { render :xml => @tweet, :status => :created, :location => @tweet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tweet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94ffffb9c6d7eaf926f0cd5e2fe4312d",
"score": "0.5665099",
"text": "def tweet_params\n params.require(:tweet).permit(:tweet)\n end",
"title": ""
},
{
"docid": "d9266a66a5b037d428344d843bbb6849",
"score": "0.56629235",
"text": "def create\n @status = current_user.statuses.new(params[:status])\n\n respond_to do |format|\n if @status.save\n current_user.create_activity(@status, 'created')\n format.html { redirect_to profile_path(current_user), notice: 'Status was successfully created.' }\n format.json { render json: @status, status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "52da9d63a3ae220ead3f1fb2da029482",
"score": "0.5657602",
"text": "def tweet(user, msg)\n # build URI and headers (opt)\n url, opt = url_for(user, 'tweet'), opt_for(user)\n uri = URI.parse(url)\n ret = nil\n\n # build post data\n data = {\n 'status' => msg,\n }.map { |a| \n a.map { |v| CGI.escape(v) }.join('=') \n }.join('&')\n\n # FIXME: add user-agent to headers\n req = Net::HTTP.new(uri.host, uri.port)\n req.use_ssl = (uri.scheme == 'https')\n\n # start http request\n req.start do |http|\n # post request\n r = http.post(uri.path, data, opt)\n\n # check response\n case r\n when Net::HTTPSuccess\n ret = JSON.parse(r.body)\n\n # File.open('/tmp/foo.log', 'a') do |fh|\n # fh.puts \"r.body = #{r.body}\"\n # end\n\n # check result\n if ret && ret.key?('id')\n @store.add_message(ret['id'], ret)\n else\n throw \"got weird response from twitter\"\n end\n else\n throw r\n end\n end\n\n # return result\n ret\n end",
"title": ""
},
{
"docid": "99e3be94dc4e93890f9b312502a2b981",
"score": "0.56485635",
"text": "def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end",
"title": ""
},
{
"docid": "7c491f35eb93c41ddfdbdcd9a246750e",
"score": "0.5648208",
"text": "def create\n signin_apikey\n \n if session[:user_id] != nil\n @tweet = Tweet.new(tweet_params)\n @tweet.author = User.find(session[:user_id]).email.split('@')[0].strip\n @tweet.user_id = User.find(session[:user_id]).id\n if !@tweet.url.blank?\n if !is_url(@tweet.url)\n respond_to do |format|\n format.json { render json: \"Invalid url!\".to_json, status: 400 }\n end\n return\n end\n @tweet.url = @tweet.url.sub \"https://\", \"\"\n @tweet.url = @tweet.url.sub \"www.\", \"\"\n @urlsplit = @tweet.url.split(\"/\")\n @urlsplit.each do |suburl|\n if suburl.include?(\".\")\n @tweet.shorturl = suburl\n end\n end\n end\n @tweet2 = Tweet.find_by url: @tweet.url\n if (@tweet.content.blank? && !@tweet.url.blank?)\n respond_to do |format|\n if @tweet.title.blank?\n format.html { redirect_to new_tweet_path, alert: 'Please try again.' }\n format.json { render json: \"Title property cannot be blank\".to_json, status: 400 }\n elsif (@tweet2 != nil)\n format.html { redirect_to '/tweets/' + @tweet2.id.to_s }\n msg = \"The URL already exists\"\n format.json { render json: msg.to_json , status: 400, location: @tweet }\n elsif @tweet.save\n format.html { redirect_to '/tweets', notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: 201 }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n elsif (@tweet.url.blank? && !@tweet.content.blank?)\n @tweet.ask = true\n respond_to do |format|\n if @tweet.title.blank?\n format.html { redirect_to new_tweet_path, alert: 'Please try again.' }\n format.json { render json: \"Title property cannot be blank\".to_json, status: 400 }\n elsif @tweet.save\n format.html { redirect_to '/tweets', notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: 201 }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n else\n @comment_text=@tweet.content\n @tweet.content=nil\n @tweet.ask = false\n \n if @tweet.save\n Comment.create(contribution: @tweet.id, text: @comment_text, escomment: true, comment_id: nil, user: @tweet.user_id)\n render :json => @tweet.attributes.merge( )\n end\n end\n else\n respond_to do |format|\n format.json { render json: {message: 'Unauthorized, you don\\'t have a valid api_key' }, status: 401 }\n end\n end\n end",
"title": ""
},
{
"docid": "c6f42d5b24c7f57d3062ab5643a6403b",
"score": "0.56404084",
"text": "def mention(status, *names)\n tweet(\"#{names.join(' ')} #{status}\")\nend",
"title": ""
},
{
"docid": "c6f42d5b24c7f57d3062ab5643a6403b",
"score": "0.56404084",
"text": "def mention(status, *names)\n tweet(\"#{names.join(' ')} #{status}\")\nend",
"title": ""
},
{
"docid": "d33e5a63056fac536664bdc2791ca5c7",
"score": "0.5636795",
"text": "def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end",
"title": ""
},
{
"docid": "9a67573c348d79622bee8d7012dbf428",
"score": "0.5630533",
"text": "def tweet_new_tweet(tweet)\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n $log.debug(tweet)\n client.update(tweet)\n $log.info(\"Successfully tweeted!\")\nend",
"title": ""
},
{
"docid": "a1942ebd9aaf3cbc0096ed7a77104a43",
"score": "0.5629546",
"text": "def create\n @tw_stat = TwStat.new(tw_stat_params)\n\n respond_to do |format|\n if @tw_stat.save\n format.html { redirect_to @tw_stat, notice: 'Tw stat was successfully created.' }\n format.json { render :show, status: :created, location: @tw_stat }\n else\n format.html { render :new }\n format.json { render json: @tw_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e9872f320873b8eea585e4c59cf8a8c",
"score": "0.56174636",
"text": "def create\n @tweet = Tweet.new(params[:tweet])\n @user = User.find(session[:user_id])\n @tweet.user = @user\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to tweets_url, notice: 'Tweet was successfully created.' }\n format.json { render json: @tweet, status: :created, location: @tweet }\n else\n @tweets = Tweet.paginate page: params[:page], order:'created_at desc', per_page: 10\n @user = User.new\n format.html { render action: \"index\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b6b9b9049f49c0e7ccd9a73d83df4547",
"score": "0.5610773",
"text": "def mention(status, *name)\n tweet(\"#{name.join('')} #{status}\")\nend",
"title": ""
},
{
"docid": "5975165e5da109c715b419a3eb0fc4d2",
"score": "0.5606064",
"text": "def create\n @watcher = Watcher.new(watcher_params)\n\n respond_to do |format|\n if @watcher.save\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = \"1jFn305ISZq4moZsv6mYyGls4\"\n config.consumer_secret = \"i8JvIWmswNqA7c9HIpTHJ1nIxZAGGcWyLaGBxfteQXMkNK4DqK\"\n config.access_token = \"14191779-n4X4Fs1WDx9IlNqjt5WhDYT0oMttRlmBP3ysoUhII\"\n config.access_token_secret = \"dixLEBjwapLNrmlZEu2amiB8qcZGihvPnLXoN5d15AgsA\"\n end\n # TODO: max_id, since_id\n client.search(@watcher.keywords, :lang => 'en', :count => 100).take(100).collect do |tweet|\n Tweet.create(:watcher_id => @watcher.id, :tweet_id => tweet.id, :fields => tweet.to_h)\n end\n\n format.html { redirect_to @watcher, notice: 'Watcher was successfully created.' }\n format.json { render :show, status: :created, location: @watcher }\n else\n format.html { render :new }\n format.json { render json: @watcher.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "73d6b56a7452471247a856c5e885c078",
"score": "0.56059736",
"text": "def tweet_params\n params.require(:tweet).permit(:message)\n end",
"title": ""
},
{
"docid": "665ed70a9c99ca7543baf45be33038ef",
"score": "0.5594022",
"text": "def create\n # Use current_user below, so that new tweets are only created by the logged in user #MDM\n #@tweet = Tweet.new(tweet_params)\n @tweet = current_user.tweets.new(tweet_params)\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e94f41244ee56ac8b1e6c4d5ac72d57",
"score": "0.55890954",
"text": "def create\n @tweet_post = TweetPost.new(tweet_post_params)\n\n respond_to do |format|\n if @tweet_post.save\n format.html { redirect_to @tweet_post, notice: \"Tweet post was successfully created.\" }\n format.json { render :show, status: :created, location: @tweet_post }\n \n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @tweet_post.errors, status: :unprocessable_entity }\n \n end\n end\n end",
"title": ""
},
{
"docid": "8f26d66924fb60cf64777c89f3a49b7b",
"score": "0.5587617",
"text": "def tweet_params\n params.require(:tweet).permit(:content, :total_tweet, :retweet)\n end",
"title": ""
},
{
"docid": "0a8b26a7f55105ec9c7b7fb47885dc35",
"score": "0.5580831",
"text": "def create\n require 'twitter'\t \n @muscle_diary = MuscleDiary.new(muscle_diary_params)\n @muscle_diary.user_id = current_user.id\n\n # tweet記述\n auth = request.env[\"omniauth.auth\"]\n \n client = Twitter::REST::Client.new do |config|\n # developer\n\n config.consumer_key = \"p1kXruMcvR9qzaANAphm3sgav\"\n config.consumer_secret = \"rLLYwiOdTqq7HJNoSQLiqhMEQ55IKGriax9mlYKIj3AKGKgXCl\"\n\n #config.consumer_key = Rails.application.secrets.twitter_consumer_key\n #config.consumer_secret = Rails.application.secrets.twitter_consumer_secret\n \n # user\n config.access_token = \"hogehoge\" \n config.access_token_secret = \"hogehoge\"\n\n #config.access_token = auth.credentials.token\n #config.access_token_secret = auth.credentials.secret\n end\n \n # Twitter投稿\n client.update(\"test\")\n\n respond_to do |format|\n if @muscle_diary.save\n format.html { redirect_to '/', notice: '日記をつけました。ナイスバルク!' }\n format.json { render action: 'show', status: :created, location: @muscle_diary }\n else\n format.html { render action: 'new' }\n format.json { render json: @muscle_diary.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e98c6464a14458199c1ec3a77da991db",
"score": "0.5575472",
"text": "def create\n @tweet = Tweet.new(tweet_params)\n @tweet.user_vote = 0\n\n respond_to do |format|\n if @tweet.save\n format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tweet }\n else\n format.html { render :new }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "366c4c1a8456810ae37d19db496fabe9",
"score": "0.55669045",
"text": "def post(number = 1)\n results = twitter_client.search(\"#sad\")\n return unless results.try(:any?)\n results.take(number).each do |tweet|\n twitter_client.favorite(tweet)\n twitter_client.update(\"@#{tweet.user.screen_name} Happiness is the art of never holding in your mind the memory of any unpleasant thing that has passed.\")\n end\n end",
"title": ""
},
{
"docid": "f123fe3fee3d5cb507f5ac9ad341f0ec",
"score": "0.5566357",
"text": "def tweet_params\n params.require(:tweet).permit(:message, :user_id, :link)\n end",
"title": ""
},
{
"docid": "f123fe3fee3d5cb507f5ac9ad341f0ec",
"score": "0.5566357",
"text": "def tweet_params\n params.require(:tweet).permit(:message, :user_id, :link)\n end",
"title": ""
},
{
"docid": "f123fe3fee3d5cb507f5ac9ad341f0ec",
"score": "0.5566357",
"text": "def tweet_params\n params.require(:tweet).permit(:message, :user_id, :link)\n end",
"title": ""
},
{
"docid": "0be93d288593003c446aad673196841a",
"score": "0.5558822",
"text": "def tweet_params\n params.require(:tweet).permit(:message, :user_id)\n end",
"title": ""
},
{
"docid": "9aaf817605451deb0cbcd4e40f6190d7",
"score": "0.5555675",
"text": "def post\n config = create_or_find_config\n \n if ARGV.size == 0\n puts %(\\n You didn't enter a message to post.\\n\\n Usage: twitter post \"You're fabulous message\"\\n)\n exit(0)\n end\n \n post = ARGV.shift\n print \"\\nSending twitter update\"\n finished = false\n status = nil\n progress_thread = Thread.new { until finished; print \".\"; $stdout.flush; sleep 0.5; end; }\n post_thread = Thread.new(binding()) { |b|\n status = Twitter::Base.new(config['email'], config['password']).post(post)\n finished = true\n }\n post_thread.join\n progress_thread.join\n puts \" OK!\"\n puts \"Got it! New twitter created at: #{status.created_at}\\n\"\n end",
"title": ""
},
{
"docid": "6fc76c72d0cecf8399ea9acc3c039266",
"score": "0.55529726",
"text": "def tweet_params\n params.require(:tweet).permit(:body)\n end",
"title": ""
},
{
"docid": "6fc76c72d0cecf8399ea9acc3c039266",
"score": "0.55529726",
"text": "def tweet_params\n params.require(:tweet).permit(:body)\n end",
"title": ""
},
{
"docid": "6fc76c72d0cecf8399ea9acc3c039266",
"score": "0.55529726",
"text": "def tweet_params\n params.require(:tweet).permit(:body)\n end",
"title": ""
},
{
"docid": "cb2d563c1a88acb04c2c3fe9587b0d6c",
"score": "0.55527407",
"text": "def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end",
"title": ""
},
{
"docid": "3f5200028172724ceb3b99a8b51f3c26",
"score": "0.55492234",
"text": "def tweet_params\n params.require(:tweet).permit(:username, :tweetbody)\n end",
"title": ""
},
{
"docid": "8472a8059bd4a9bf6f58b61c9a4b5db9",
"score": "0.55491745",
"text": "def create\n @tweett = Tweett.new(tweett_params)\n\n respond_to do |format|\n if @tweett.save\n format.html { redirect_to @tweett, notice: 'Tweett was successfully created.' }\n format.json { render :show, status: :created, location: @tweett }\n else\n format.html { render :new }\n format.json { render json: @tweett.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "11a2197c26c270af371f7dd3f06a99d1",
"score": "0.55479395",
"text": "def tweet_params\n params.require(:tweet).permit(:user_id, :text)\n end",
"title": ""
}
] |
2f773753cea16096d510cfbe55156145
|
Two polygons are equivalent if their collection of points is equivalent.
|
[
{
"docid": "84903be3cb05ce1488f38bfd50889177",
"score": "0.57509136",
"text": "def ==(other)\n @points == other.points\n end",
"title": ""
}
] |
[
{
"docid": "46654731d45039ec0e6fdb12c1335f8d",
"score": "0.67408794",
"text": "def ==(other)\n return false unless other.is_a?(Polygon)\n self.hashable_content == other.hashable_content\n end",
"title": ""
},
{
"docid": "7926071885a44b9653ae939340afb45e",
"score": "0.61985296",
"text": "def as_polygon\n GeoRuby::SimpleFeatures::Polygon.from_points([@points[0] == @points[-1] ? @points : (@points + [@points[0].clone])])\n end",
"title": ""
},
{
"docid": "e30fd97d7a8d8649503d7ea4e2ea115c",
"score": "0.6121195",
"text": "def ==(other)\n case other\n when Osgb::Point\n other = other.transform_to(self.datum) unless other.datum == self.datum\n self.lat == other.lat && self.lng == other.lng && self.datum == other.datum\n when Array\n self.to_a == other\n when String\n self == other.to_latlng(:datum => self.datum) # serves to normalise string representation\n end\n end",
"title": ""
},
{
"docid": "5afc21845dee5fcab95b88074822027d",
"score": "0.6115726",
"text": "def ==(collection)\n collection.kind_of?(CoordinateCollection) &&\n collection.sets == sets &&\n collection.coordinates == coordinates\n end",
"title": ""
},
{
"docid": "79a66489d4929017bb64c31060764061",
"score": "0.60922",
"text": "def test_nonconvex\n nonconvex_polygon = Polygon.new [\n Point(0, 0),\n Point(0, 6),\n Point(4, 6),\n Point(4, 4),\n Point(2, 4),\n Point(2, 2),\n Point(4, 2),\n Point(4, 0)\n ]\n\n inner_points = [\n Point(1, 5),\n Point(3, 5),\n Point(1, 3),\n Point(1, 1),\n Point(3, 1)\n ]\n\n outer_points = [\n Point(7, 5),\n Point(5, 3),\n Point(7, 3),\n Point(7, 1)\n ]\n\n inner_points.each do |inner_point|\n assert nonconvex_polygon.contains?(inner_point)\n end\n\n outer_points.each do |outer_point|\n assert ! nonconvex_polygon.contains?(outer_point)\n end\n end",
"title": ""
},
{
"docid": "79a66489d4929017bb64c31060764061",
"score": "0.60922",
"text": "def test_nonconvex\n nonconvex_polygon = Polygon.new [\n Point(0, 0),\n Point(0, 6),\n Point(4, 6),\n Point(4, 4),\n Point(2, 4),\n Point(2, 2),\n Point(4, 2),\n Point(4, 0)\n ]\n\n inner_points = [\n Point(1, 5),\n Point(3, 5),\n Point(1, 3),\n Point(1, 1),\n Point(3, 1)\n ]\n\n outer_points = [\n Point(7, 5),\n Point(5, 3),\n Point(7, 3),\n Point(7, 1)\n ]\n\n inner_points.each do |inner_point|\n assert nonconvex_polygon.contains?(inner_point)\n end\n\n outer_points.each do |outer_point|\n assert ! nonconvex_polygon.contains?(outer_point)\n end\n end",
"title": ""
},
{
"docid": "d43c92081494de00e1f06b56c5a95a98",
"score": "0.6063004",
"text": "def ==(other_polygon)\r\n if other_polygon.class != self.class or\r\n length != other_polygon.length\r\n false\r\n else\r\n index=0\r\n while index<length\r\n return false if self[index] != other_polygon[index]\r\n index+=1\r\n end\r\n true\r\n end\r\n end",
"title": ""
},
{
"docid": "768496f526c0ae1e6a93890bf61e04fb",
"score": "0.60330284",
"text": "def is_same_polygon?(entity, player)\n return entity == player\n end",
"title": ""
},
{
"docid": "69846d09a990dec89840d1fb3403e9a9",
"score": "0.5882249",
"text": "def == (other)\n @points == other.points\n end",
"title": ""
},
{
"docid": "243b9d9b33ab7625fa226b8ddffb1be7",
"score": "0.5634391",
"text": "def test_is_polygon_with_polygon\n m = Sketchup.active_model\n ents = m.entities\n\n # Create a polygon\n center = [0, 0, 0]\n normal = [0, 0, 1]\n radius = 20\n nsides = 8\n ents.add_ngon center, normal, radius, nsides\n\n # Check poly edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(true, e.curve.is_polygon?,\n 'Curve of polygon edge should be polygon.')\n end\n end\n end",
"title": ""
},
{
"docid": "ee1eec4fed143b323bce485c0ebd1e1b",
"score": "0.56337386",
"text": "def eql?(other)\n\t if other.is_a?(Array)\n\t\t@elements.eql? other\n\t elsif other.is_a?(PointIso)\n\t\tvalue = other.value\n\t\t@elements.all? {|e| e.eql? value }\n\t elsif other.is_a?(PointOne)\n\t\t@elements.all? {|e| e.eql? 1 }\n\t elsif other.is_a?(PointZero)\n\t\t@elements.all? {|e| e.eql? 0 }\n\t else\n\t\tsuper other\n\t end\n\tend",
"title": ""
},
{
"docid": "81fd75eeb4970332cf351e170f0efa4a",
"score": "0.5530372",
"text": "def ==(other)\n case other\n when Point\n float_equal(x, other.x) && float_equal(y, other.y)\n when Array\n self == Geom2D::Point(other)\n else\n false\n end\n end",
"title": ""
},
{
"docid": "9fc89c02e88a505dc784363c053e56ca",
"score": "0.5517326",
"text": "def formPolygon?(lines)\n endpoints = {}\n\n lines.each do |l|\n [l.p1, l.p2].each do |p|\n endpoints[p.to_s] ||= []\n endpoints[p.to_s] << l\n end\n end\n\n # the algorithm is to follow the points until you end up at one that \n # you've already seen\n l = lines.first\n p = l.p1\n op = p\n begin\n ls = endpoints[p.to_s]\n return false if ls.nil?\n endpoints.delete p.to_s\n\n # get the line that we weren't on before\n ls.delete(l)\n l = ls[0]\n return false if l.nil? # this means that there weren't 2 lines with endpoint p\n\n # get the other point on that line\n p = (l.p1 == p) ? l.p2 : l.p1\n end until p == op\n\n return endpoints.length == 0\n end",
"title": ""
},
{
"docid": "8a09cb7a140b69ba677637171056799c",
"score": "0.55159116",
"text": "def equal_by_trans?(g1, g2)\n check_pre((\n (graph_obj?(g1)) and\n (graph_obj?(g2))\n ))\n\n # pick two points\n # sub p1 from p2\n # translate p2 by diff\n # check equal_by_tree\n\n if not equal_by_dim?(g1, g2)\n return false\n end\n\n p1 = shape_lowest_left_point(g1)\n p2 = shape_lowest_left_point(g2)\n\n tp1 = p1 - p2\n tg1 = g2.translate(tp1)\n\n return equal_by_tree?(g1, tg1)\nend",
"title": ""
},
{
"docid": "b6b2957c6965452e2d58c3d6606249a3",
"score": "0.5496973",
"text": "def do_poly_distance(e2)\n e1 = self\n\n # Tests for a possible intersection between the polygons and outputs a warning\n e1_center = e1.centroid\n e2_center = e2.centroid\n e1_max_radius = Rational(0)\n e2_max_radius = Rational(0)\n\n e1.vertices.each do |vertex|\n r = e1_center.distance(vertex)\n e1_max_radius = r if e1_max_radius < r\n end\n\n e2.vertices.each do |vertex|\n r = e2_center.distance(vertex)\n e2_max_radius = r if e2_max_radius < r \n end\n\n center_dist = e1_center.distance(e2_center)\n if center_dist <= e1_max_radius + e2_max_radius\n puts \"Polygons may intersect producing erroneous output\"\n end\n\n # Find the upper rightmost vertex of e1 and the lowest leftmost vertex of e2\n e1_ymax = e1.vertices.first\n e2_ymin = e2.vertices.first\n\n e1.vertices.each do |vertex|\n if vertex.y > e1_ymax.y || (vertex.y == e1_ymax.y && vertex.x > e1_ymax.x)\n e1_ymax = vertex\n end\n end\n \n e2.vertices.each do |vertex|\n if vertex.y < e2_ymin.y || (vertex.y == e2_ymin.y && vertex.x < e2_ymin.x)\n e2_ymin = vertex\n end\n end\n\n min_dist = e1_ymax.distance(e2_ymin)\n\n # Produce a dictionary with vertices of e1 as the keys and, for each vertex, the points\n # to which the vertex is connected as its value. The same is then done for e2.\n\n e1_connections = {}\n e2_connections = {}\n\n e1.sides.each do |side|\n if e1_connections[side.p1].nil?\n e1_connections[side.p1] = [side.p2]\n else\n e1_connections[side.p1] << side.p2\n end\n\n if e1_connections[side.p2].nil?\n e1_connections[side.p2] = [side.p1]\n else\n e1_connections[side.p2] << side.p1 \n end\n end\n\n e2.sides.each do |side|\n if e2_connections[side.p1].nil?\n e2_connections[side.p1] = [side.p2]\n else\n e2_connections[side.p1] << side.p2\n end\n\n if e2_connections[side.p2].nil?\n e2_connections[side.p2] = [side.p1]\n else\n e2_connections[side.p2] << side.p1\n end\n end\n\n e1_current = e1_ymax\n e2_current = e2_ymin\n support_line = Line.new([0, 0], [1, 0])\n\n # Determine which point in e1 and e2 will be selected after e2_ymin and e1_ymax,\n # this information combined with the above produced dictionaries determines the\n # path that will be taken around the polygons\n\n point1 = e1_connections[e1_ymax][0]\n point2 = e1_connections[e1_ymax][1]\n angle1 = support_line.angle_between(Line.new(e1_ymax, point1))\n angle2 = support_line.angle_between(Line.new(e1_ymax, point2))\n\n if angle1 < angle2\n e1_next = point1\n elsif angle2 < angle1\n e1_next = point2\n elsif e1_ymax.distance(point1) > e1_ymax.distance(point2)\n e1_next = point2\n else\n e1_next = point1\n end\n\n point1 = e2_connections[e2_ymin][0]\n point2 = e2_connections[e2_ymin][1]\n angle1 = support_line.angle_between(Line.new(e2_ymin, point1))\n angle2 = support_line.angle_between(Line.new(e2_ymin, point2))\n\n if angle1 > angle2\n e2_next = point1\n elsif angle2 > angle1\n e2_next = point2\n elsif e2_ymin.distance(point1) > e2_ymin.distance(point2)\n e2_next = point2\n else\n e2_next = point1\n end\n\n # Loop which determines the distance between anti-podal pairs and updates the\n # minimum distance accordingly. It repeats until it reaches the starting position.\n\n while true\n e1_angle = support_line.angle_between(Line.new(e1_current, e1_next))\n e2_angle = Math::PI - support_line.angle_between(Line.new(e2_current, e2_next))\n\n if e1_angle < e2_angle\n support_line = Line.new(e1_current, e1_next)\n e1_segment = Segment.new(e1_current, e1_next)\n min_dist_current = e1_segment.distance(e2_current)\n\n if min_dist_current < min_dist\n min_dist = min_dist_current\n end\n\n if e1_connections[e1_next][0] != e1_current\n e1_current = e1_next\n e1_next = e1_connections[e1_next][0]\n else\n e1_current = e1_next\n e1_next = e1_connections[e1_next][1]\n end\n elsif e1_angle > e2_angle\n support_line = Line.new(e2_next, e2_current)\n e2_segment = Segment.new(e2_current, e2_next)\n min_dist_current = e2_segment.distance(e1_current)\n\n if min_dist_current < min_dist\n min_dist = min_dist_current\n end\n\n if e2_connections[e2_next][0] != e2_current\n e2_current = e2_next\n e2_next = e2_connections[e2_next][0]\n else\n e2_current = e2_next\n e2_next = e2_connections[e2_next][1]\n end\n\n else\n support_line = Line.new(e1_current, e1_next)\n e1_segment = Segment.new(e1_current, e1_next)\n e2_segment = Segment.new(e2_current, e2_next)\n min1 = e1_segment.distance(e2_next)\n min2 = e2_segment.distance(e1_next)\n\n min_dist_current = [min1, min2].min\n\n if min_dist_current < min_dist\n min_dist = min_dist_current\n end\n\n if e1_connections[e1_next][0] != e1_current\n e1_current = e1_next\n e1_next = e1_connections[e1_next][0]\n else\n e1_current = e1_next\n e1_next = e1_connections[e1_next][1]\n end\n\n if e2_connections[e2_next][0] != e2_current\n e2_current = e2_next\n e2_next = e2_connections[e2_next][0]\n else\n e2_current = e2_next\n e2_next = e2_connections[e2_next][1]\n end\n end\n\n break if e1_current == e1_ymax && e2_current == e2_ymin\n end\n\n return min_dist\n end",
"title": ""
},
{
"docid": "99a2ce627fa0c11231ed5680f2b74cfd",
"score": "0.5415212",
"text": "def eql?(other_point)\n @x == other_point.x && @y == other_point.y\n end",
"title": ""
},
{
"docid": "09bb1f854cff42ce8f8f83ee5a82199f",
"score": "0.539256",
"text": "def ==(other)\n\t if other.is_a?(Array)\n\t\t@elements.eql? other\n\t elsif other.is_a?(PointIso)\n\t\tvalue = other.value\n\t\t@elements.all? {|e| e.eql? value }\n\t elsif other.is_a?(PointOne)\n\t\t@elements.all? {|e| e.eql? 1 }\n\t elsif other.is_a?(PointZero)\n\t\t@elements.all? {|e| e.eql? 0 }\n\t else\n\t\tsuper other\n\t end\n\tend",
"title": ""
},
{
"docid": "1e6c89add63da552b28e481711dfcdfd",
"score": "0.5330018",
"text": "def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n if (c - other.coords.to_a[i])**2 > PRECISION\n equal = false\n break\n end\n end\n equal\n end",
"title": ""
},
{
"docid": "2cffaf39b992f4421c7f74ecbea42e77",
"score": "0.5329393",
"text": "def obstructed?(new_x, new_y); end",
"title": ""
},
{
"docid": "02735ee76be7d4dae1a9afa8998bab21",
"score": "0.52881706",
"text": "def rep_equals?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#rep_equals? not defined.\"\n end",
"title": ""
},
{
"docid": "112e9b2f32159092f99e731b26ff41e0",
"score": "0.5279179",
"text": "def eql?(other)\n return false if !other.is_a?(Point) || other.group != group\n x == other.x && y == other.y\n end",
"title": ""
},
{
"docid": "024e0632be9e3f79fee649eafd0a3fc9",
"score": "0.5259875",
"text": "def equal_by_trans?(graph_obj1, graph_obj2)\n check_pre((graph_obj?(graph_obj1) and graph_obj?(graph_obj2)))\n bounds_obj1 = bounds(graph_obj1)\n bounds_obj2 = bounds(graph_obj2)\n if (not (bounds_obj1.size == bounds_obj2.size)) #or (not equal_by_dim?(graph_obj1, graph_obj2))\n false\n elsif one_dim?(graph_obj1) and one_dim?(graph_obj2)\n translate(graph_obj1, -(bounds_obj1.first - bounds_obj2.first)) == graph_obj2\n #equal_by_tree?(translate(graph_obj1, -(bounds_obj1.first - bounds_obj2.first)), graph_obj2)\n elsif two_dim?(graph_obj1) and two_dim?(graph_obj2)\n translate(graph_obj1, Point2d[-(bounds_obj1.x_range.first - bounds_obj2.x_range.first),\n -(bounds_obj1.y_range.first - bounds_obj2.y_range.first)]) == graph_obj2\n #equal_by_tree?(translate(graph_obj1, Point2d[-(bounds_obj1.x_range.first - bounds_obj2.x_range.first), \n #-(bounds(graph_obj1).y_range.first - bounds(graph_obj2).y_range.first)]), graph_obj2)\n else false\n end\nend",
"title": ""
},
{
"docid": "34e3291570fd549bc6aff277cb7fb0c0",
"score": "0.52521336",
"text": "def ===(other)\n other === collection\n end",
"title": ""
},
{
"docid": "29a91d9e012ed81934d8c2a844fa3cae",
"score": "0.5247146",
"text": "def ==(other)\n return false unless other.is_a?(LatLng)\n lat == other.lat && lng == other.lng\n end",
"title": ""
},
{
"docid": "29a91d9e012ed81934d8c2a844fa3cae",
"score": "0.5247146",
"text": "def ==(other)\n return false unless other.is_a?(LatLng)\n lat == other.lat && lng == other.lng\n end",
"title": ""
},
{
"docid": "998417d736913bf6e6cee96fa37d5715",
"score": "0.52205634",
"text": "def test_inside_non_overlapping()\n shape_ds = Gdal::Ogr.open('../../ogr/data/testpoly.shp')\n shape_lyr = shape_ds.get_layer(0)\n\n shape_lyr.set_spatial_filter_rect( -10, -130, 10, -110 )\n assert(check_features_against_list( shape_lyr, 'FID',\n [ 13 ] ))\n end",
"title": ""
},
{
"docid": "d3a525bf4a18355816cae8aaff9813c6",
"score": "0.5220337",
"text": "def ==( other )\n [ self.lattitude, self.longitude, self.radius ] == [ other.lattitude, other.longitude, other.radius ]\n end",
"title": ""
},
{
"docid": "64c2bc16d37372a0b7fb32d7cb7c980c",
"score": "0.51568866",
"text": "def ==(other)\n other.is_a? VertexWrapper and\n element_id == other.element_id and\n graph == other.graph\n end",
"title": ""
},
{
"docid": "8b927fe054d093ba0e925f747f6fc551",
"score": "0.51562244",
"text": "def test_is_polygon_api_example\n # For backwards compatibility, only run test if curve instance has\n # is_polygon? method\n if Sketchup::Curve.new().public_methods.include? 'is_polygon?'\n assert_nothing_raised do\n # Create a polygon and check its edge\n ents = Sketchup.active_model.entities\n ents.add_ngon [0, 0, 0], [0, 0, 1], 10, 6\n curve = nil\n ents.each { |e| curve = e.curve if e.is_a? Sketchup::Edge }\n is_poly = curve.is_polygon?\n end\n end\n end",
"title": ""
},
{
"docid": "85dcd5e86b21a86582bfff525ce7b3e5",
"score": "0.5134029",
"text": "def ==(other_point)\r\n if other_point.class != self.class\r\n false\r\n else\r\n @x == other_point.x and @y == other_point.y and @z == other_point.z and @m == other_point.m\r\n end\r\n end",
"title": ""
},
{
"docid": "b8a1ce8099630d8424272347234b04e2",
"score": "0.512507",
"text": "def ==(other)\n return false unless other.is_a?(Point)\n @x == other.x && @y == other.y && @z == other.z && @m == other.m\n end",
"title": ""
},
{
"docid": "03d64cecec31a7a5698333b0aa052072",
"score": "0.5116304",
"text": "def ==(other)\n return false unless other.is_a?(Point)\n (x - other.x).abs < EQUITY_TOLERANCE && (y - other.y).abs < EQUITY_TOLERANCE\n end",
"title": ""
},
{
"docid": "f478924b7453a8edfc12dfeb5b605364",
"score": "0.51134807",
"text": "def ==(other_envelope)\r\n if other_envelope.class != self.class\r\n false\r\n else\r\n upper_corner == other_envelope.upper_corner and lower_corner == other_envelope.lower_corner\r\n end\r\n end",
"title": ""
},
{
"docid": "f0b88af33bf9eaeb39027e5e922c8ad5",
"score": "0.51114315",
"text": "def check_polygon\n return false if @points.length < 3\n zpoints = Array.new(@points)\n zpoints += [@points[0], @points[1]]\n side_prev = zcrossproduct(zpoints[0], zpoints[1], zpoints[2])\n for i in 1...(zpoints.length-2)\n side_next = zcrossproduct(zpoints[i], zpoints[i+1], zpoints[i+2])\n return false if (side_prev * side_next < 0)\n end\n return true\n end",
"title": ""
},
{
"docid": "8c204a4bc9057ca87b352e19674a3897",
"score": "0.51043206",
"text": "def !=(other_vector, precision = 6)\n @x.round(precision) != other_vector.x.round(precision) or\n @y.round(precision) != other_vector.y.round(precision)\n end",
"title": ""
},
{
"docid": "859143f066b1a54cc16aed85bb1bc1d2",
"score": "0.5066069",
"text": "def inside?(zone)\n inPoly = false\n if zone == nil || zone.count == 0\n return false\n end\n\n lastPointData = Point.new(zone[zone.size-1])\n lastPoint = lastPointData.asMapPoint\n here = self.asMapPoint\n\n zone.each do |point|\n point = Point.new(point).asMapPoint\n\n if (((point.y < here.y) && (lastPoint.y >= here.y)) || ((lastPoint.y < here.y) && (point.y >= here.y)))\n if ((point.x + (((here.y - point.y) / (lastPoint.y - point.y)) * (lastPoint.x - point.x))) < here.x)\n inPoly = !inPoly\n end\n end\n lastPoint = point\n end\n\n inPoly\n end",
"title": ""
},
{
"docid": "b2d174e62467ffb5e70981dd24897836",
"score": "0.5064149",
"text": "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"title": ""
},
{
"docid": "b2d174e62467ffb5e70981dd24897836",
"score": "0.5064149",
"text": "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"title": ""
},
{
"docid": "b2d174e62467ffb5e70981dd24897836",
"score": "0.5064149",
"text": "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"title": ""
},
{
"docid": "32e47e8bce85f16593d004a907de233f",
"score": "0.5063144",
"text": "def ==(other)\n comparison_attributes = ->(area) { [area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons] }\n comparison_attributes.call(self) == comparison_attributes.call(other)\n end",
"title": ""
},
{
"docid": "690189d1ae8e84496b41da674f0d2e71",
"score": "0.50626767",
"text": "def ==(other_vector, precision = 6)\n @x.round(precision) == other_vector.x.round(precision) and\n @y.round(precision) == other_vector.y.round(precision)\n end",
"title": ""
},
{
"docid": "c20268ae8b584cc4f4a17d160ea1cd0c",
"score": "0.50606704",
"text": "def equals?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#equals? not defined.\"\n end",
"title": ""
},
{
"docid": "bb439e07ce23c7a733295ea4aa69bb8d",
"score": "0.50595367",
"text": "def is_closed?\n return @polygon_points.first == @polygon_points.last\n end",
"title": ""
},
{
"docid": "bb439e07ce23c7a733295ea4aa69bb8d",
"score": "0.50595367",
"text": "def is_closed?\n return @polygon_points.first == @polygon_points.last\n end",
"title": ""
},
{
"docid": "6234427fa619f6b287a696208ae8a36a",
"score": "0.50280327",
"text": "def ==(vector2)\n end",
"title": ""
},
{
"docid": "f91d69a559782724b01cc979116885a3",
"score": "0.5023939",
"text": "def detect_invalid \n @shapes.each do |shape|\n if shape.is_polygon\n @convex_polygons << shape\n else\n @non_convex_polygons << shape\n end\n end \n end",
"title": ""
},
{
"docid": "2f6f8d5809a3c78d66a8c2a1b2868c28",
"score": "0.5018974",
"text": "def inverse_all!(collection)\r\n collection.each do |point|\r\n inverse!(point)\r\n end\r\n collection\r\n end",
"title": ""
},
{
"docid": "1e8b603e248cf5e72ffe32c6a717ce2f",
"score": "0.5011094",
"text": "def disjoint?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#disjoint? not defined.\"\n end",
"title": ""
},
{
"docid": "3a29320e77298031f08a9f208e156d37",
"score": "0.500647",
"text": "def polygon\n raise OSMLib::Error::NoDatabaseError.new(\"can't create Polygon from relation if it is not in a OSMLib::Database\") if @db.nil?\n raise OSMLib::Error::NoDatabaseError.new(\"can't create Polygon from relation if it does not represent a polygon\") if self['type'] != 'multipolygon' and self['type'] != 'polygon'\n\n c = []\n member_objects.each do |way|\n raise TypeError.new(\"member is not a way so it can't be represented as Polygon\") unless way.kind_of? OSMLib::Element::Way\n raise OSMLib::Error::NotClosedError.new(\"way is not closed so it can't be represented as Polygon\") unless way.is_closed?\n raise OSMLib::Error::GeometryError.new(\"way with less then three nodes can't be turned into a polygon\") if way.nodes.size < 3\n c << way.node_objects.collect{ |node| [node.lon.to_f, node.lat.to_f] }\n end\n GeoRuby::SimpleFeatures::Polygon.from_coordinates(c)\n end",
"title": ""
},
{
"docid": "5dd6a57a21428bba45be38a279a4f1cb",
"score": "0.49814",
"text": "def polygon *points, color\n points << points.first\n points.each_cons(2) do |p1, p2|\n w.line(*p1, *p2, color)\n end\n end",
"title": ""
},
{
"docid": "6b0306772eba28bf9c9e4ae40b73f1c5",
"score": "0.49506",
"text": "def isolates\n edges.inject(Set.new(vertices)) { |iso, e| iso -= [e.source, e.target] }\n end",
"title": ""
},
{
"docid": "0b5ef2bd87416c3c9cbfca8f33f374ee",
"score": "0.4949044",
"text": "def inverse_all(collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\r\n newcollection << inverse(point)\r\n end\r\n newcollection\r\n end",
"title": ""
},
{
"docid": "061b28b78ee8f9ccaf0a86cad9f089bf",
"score": "0.49442792",
"text": "def equal_to?(shape)\n return false if shape.type != @type\n shape.squares.each do |square|\n found = false\n #Shapes don't have to have the same order of squares\n @squares.each do |sq|\n found = true if square.x == sq.x and square.y == sq.y\n end\n return false if !found\n end\n return true\n end",
"title": ""
},
{
"docid": "48a2ee441d1fa7ac23e97752d08ac336",
"score": "0.49369863",
"text": "def ==( other ) \n\t\t\tcomparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}\n\t\t\tcomparison_attributes.call( self ) == comparison_attributes.call( other )\n\t\tend",
"title": ""
},
{
"docid": "eb8fa30b094e2c69227b126010118f83",
"score": "0.49299163",
"text": "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"title": ""
},
{
"docid": "eb8fa30b094e2c69227b126010118f83",
"score": "0.49299163",
"text": "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end",
"title": ""
},
{
"docid": "c36627d3c4e33bb675be68d55d3dca58",
"score": "0.4928727",
"text": "def equal?(point)\r\n return true if @x == point.x and @y == point.y\r\n return false\r\n end",
"title": ""
},
{
"docid": "833734661ecfc2a816df823a9ada804c",
"score": "0.49275756",
"text": "def ==(coordinate_set)\n coordinate_set.kind_of?(CoordinateSet) &&\n coordinates == coordinate_set.coordinates \n end",
"title": ""
},
{
"docid": "a105046bf2bae7ff3a7ae8800fe65372",
"score": "0.4925224",
"text": "def lenient_multi_polygon_assertions?\n @zfactory.lenient_multi_polygon_assertions?\n end",
"title": ""
},
{
"docid": "00a54bbaa1b674f056f925849e5df715",
"score": "0.49083388",
"text": "def transform_all(otherProjection, collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\r\n newcollection << transform(otherProjection, point)\r\n end\r\n newcollection\r\n end",
"title": ""
},
{
"docid": "bd517802d559853773d1bc3322e6ac95",
"score": "0.48997658",
"text": "def intersects?(other)\n other.vertices.each do |vertex|\n return true if interior?(vertex)\n end\n false\n end",
"title": ""
},
{
"docid": "6651e7225394c263bb90fdc536fa7c2a",
"score": "0.48964286",
"text": "def == other\n other = subtrahend other\n (@lat == other.lat) && (@lon == other.lon)\n end",
"title": ""
},
{
"docid": "402f36f1b276c8a936220611f0ede581",
"score": "0.48881066",
"text": "def unionshape?(x)\n x.union1d? || x.union2d?\nend",
"title": ""
},
{
"docid": "415712852e327e15caa7201397677871",
"score": "0.48875085",
"text": "def -(polygon)\n\t\t\tps = Polygon_set_2.difference_polygons_with_holes root, polygon.root\n\t\t\tps.to_a.collect{|pwh| Polygon.new(pwh)}\n\t\tend",
"title": ""
},
{
"docid": "a5518cac16582486c0f08f7c37ed179f",
"score": "0.4882916",
"text": "def same_pos?(pos1, pos2)\n pos1 = pos1.pos if pos1.respond_to?(:pos)\n pos2 = pos2.pos if pos2.respond_to?(:pos)\n pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z\n end",
"title": ""
},
{
"docid": "a5518cac16582486c0f08f7c37ed179f",
"score": "0.4882916",
"text": "def same_pos?(pos1, pos2)\n pos1 = pos1.pos if pos1.respond_to?(:pos)\n pos2 = pos2.pos if pos2.respond_to?(:pos)\n pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z\n end",
"title": ""
},
{
"docid": "1991dadefb889f49da26b1fdd041f1bb",
"score": "0.48824504",
"text": "def points\n object.polygon.points\n end",
"title": ""
},
{
"docid": "2450ad7841360bafda630ff4481d8437",
"score": "0.48761356",
"text": "def == (other)\n iguales = true\n @filas.times do |i|\n @columnas.times do |j|\n if @elementos[i][j] != other.at(i,j)\n iguales = false\n end\n end\n end\n \n return iguales\n end",
"title": ""
},
{
"docid": "fdf8d2a73f3968cb8383dd47ea2f712e",
"score": "0.48435637",
"text": "def is_obstructed?(x1, y1, x2, y2, bad)\n bad.include?(\"#{x1} #{y1} #{x2} #{y2}\") || bad.include?(\"#{x2} #{y2} #{x1} #{y1}\")\nend",
"title": ""
},
{
"docid": "473063ece95436bf813e55060e5b5bb7",
"score": "0.48385462",
"text": "def ==(p)\n @x == p.x && @y == p.y \n end",
"title": ""
},
{
"docid": "c1514f5892bf5327c52f732e86b5f2a7",
"score": "0.48283085",
"text": "def ==(other)\n other.x == @x && other.y == @y\n end",
"title": ""
},
{
"docid": "6bfc998b3bab653f060ce341ec743d23",
"score": "0.48189795",
"text": "def test_is_polygon_with_curve\n m = Sketchup.active_model\n ents = m.entities\n\n # Create a curve\n pts = []\n pts.push [1, 4, 0]\n pts.push [3, 3, 0]\n pts.push [2, 3, 0]\n pts.push [0, 4, 0]\n pts.push [3, 2, 0]\n pts.push [3, -2, 0]\n pts.push [3, -3, 0]\n pts.push [2, -4, 0]\n pts.push [1, -4, 0]\n ents.add_curve pts\n\n # Check curve edges\n m.entities.each do |e|\n if e.is_a? Sketchup::Edge and e.curve.respond_to? 'is_polygon?'\n assert_equal(false, e.curve.is_polygon?,\n 'Curve of curve edge should not be polygon.')\n end\n end\n end",
"title": ""
},
{
"docid": "401b4c075ed3a1dd6c0e92685a0cabbf",
"score": "0.48147798",
"text": "def transform_all!(otherProjection, collection)\r\n collection.each do |point|\r\n transform!(otherProjection, point)\r\n end\r\n collection\r\n end",
"title": ""
},
{
"docid": "147b01cfb2e84061832fb98e82b70f3c",
"score": "0.48000833",
"text": "def union_shape?(o)\n o.union1d? or o.union2d?\nend",
"title": ""
},
{
"docid": "71f86c11e81ffa2b716d82f04adc9494",
"score": "0.47902995",
"text": "def flip_range_neg_xy(points); points.collect{ |v| Vertex.new(v.y,v.x)}; end",
"title": ""
},
{
"docid": "121f1e2742009387d49997f67ec5b4db",
"score": "0.47895655",
"text": "def exact_copy(from_collection, to_collection: nil, label_plates: false)\n collection_type = from_collection.object_type\n if to_collection.nil?\n to_collection = make_new_plate(collection_type, label_plate: label_plates)\n end\n matrix = from_collection.matrix\n to_collection.matrix = matrix\n to_collection\n end",
"title": ""
},
{
"docid": "e35ff37d0e0852634f7dfa6a322e50b3",
"score": "0.47880316",
"text": "def same(u, p)\n u == p\nend",
"title": ""
},
{
"docid": "a1fb60b371a2c280ffb3ec2b0d1bcf74",
"score": "0.47778302",
"text": "def ==(val)\n val.is_a?(Edgie::Coordinate) && to_a == val.to_a\n end",
"title": ""
},
{
"docid": "feb2fd621866dc7277846851901fc58a",
"score": "0.47772402",
"text": "def polygons_points(p_polygon)\n # initialization\n points = \"\"\n i_polygon = 0\n current_hexagon = p_polygon[:enveloppe][0]\n i_connection = p_polygon[:connections][0].index(\"0\")\n initial_vertex = \"#{current_hexagon.to_s},#{VERTICES[i_connection].to_s}\"\n done = false\n \n until done\n while not done and p_polygon[:connections][i_polygon][i_connection] == \"0\"\n done = initial_vertex == \"#{current_hexagon.to_s},#{VERTICES[i_connection].to_s}\" unless points.empty?\n unless done\n vertex = VERTICES[i_connection]\n points << \"#{x_vertex(current_hexagon, vertex).floor},#{y_vertex(current_hexagon, vertex).floor} \"\n i_connection == 5 ? i_connection = 0 : i_connection += 1\n end\n end\n \n if not done and i_connection < 6 then\n current_hexagon = adjacent(current_hexagon, EDGES[i_connection])\n i_polygon = p_polygon[:enveloppe].index(current_hexagon)\n i_connection -= 2\n i_connection += 6 unless i_connection >= 0\n end \n end\n \n return points.chop\n end",
"title": ""
},
{
"docid": "eb0473587e41d19baa9f8c086dd5ad86",
"score": "0.477655",
"text": "def ==(other)\n return false unless other.is_a? Vector2\n @x == other.x && @y == other.y\n end",
"title": ""
},
{
"docid": "92f46aa1f1c434db0adb6043c19516e4",
"score": "0.4775348",
"text": "def georss_simple_representation(options)\r\n georss_ns = options[:georss_ns] || \"georss\"\r\n geom_attr = options[:geom_attr]\r\n \"<#{georss_ns}:polygon#{geom_attr}>\" + self[0].georss_poslist + \"</#{georss_ns}:polygon>\\n\"\r\n end",
"title": ""
},
{
"docid": "70a928a30760414949b0e1e7b4d9643a",
"score": "0.4772507",
"text": "def isEqual(p)\n (p.x == x) && (p.y == y)\n end",
"title": ""
},
{
"docid": "5f498103d94dc2ef8e9b3d13dbf859ce",
"score": "0.47711387",
"text": "def is_convex?\n return @is_convex if defined?(@is_convex)\n\n @is_convex = false\n\n cw = Polygon.is_right?(vertices[-2], vertices[-1], vertices[0])\n (1...vertices.length).each do |i|\n if cw ^ Polygon.is_right?(vertices[i - 2], vertices[i - 1], vertices[i])\n return @is_convex\n end\n end\n\n # check for intersecting sides\n sides = self.sides\n sides.each_with_index do |si, i|\n points = [si.p1, si.p2]\n\n first_number = 0\n first_number = 1 if i == sides.length - 1\n (first_number...i - 1).each do |j|\n sj = sides[j]\n if !points.include?(sj.p1) && !points.include?(sj.p2)\n hit = si.intersection(sj)\n return @is_convex if !hit.empty?\n end\n end\n end\n \n @is_convex = !@is_convex\n @is_convex\n end",
"title": ""
},
{
"docid": "ff1f7f34baab35456c7ab8c52a07b9f5",
"score": "0.4768725",
"text": "def same_land?(other)\n land == other.land\n end",
"title": ""
},
{
"docid": "680a615258f6c8dc01c38872dcedb944",
"score": "0.4764099",
"text": "def topologically_equivalent?(other)\n our_nodes = nodes.to_a\n other_nodes = other.nodes.to_a\n return false if our_nodes.size != other_nodes.size\n our_edges = edges.to_a\n other_edges = other.edges.to_a\n return false if our_edges.size != other_edges.size\n\n our_node_numbers = Hash[\n our_nodes.each_with_index.map{|n, i| [n, i]}\n ]\n\n # Since there are no permutations,\n # we have to special case graphs with 0 or 1 node:\n case our_nodes.size\n when 0\n true\n when 1\n true # since we already know they have the same number of edges\n else\n # Now we have to try all permutations of the nodes:\n 0.upto(nodes.size - 1).to_a.permutation.each do |phi|\n equivalent = true\n catch :answered do\n our_nodes.each_with_index do |u, i|\n phi_u = other_nodes[phi[i]]\n u.feeds.each do |v|\n phi_v = other_nodes[phi[our_node_numbers[v]]]\n if not phi_u.feeds.include?(phi_v)\n equivalent = false\n throw :answered\n end\n end\n end\n end\n return true if equivalent\n end\n false\n end\n end",
"title": ""
},
{
"docid": "6dbed4ad59f05c484a0b32b0c973f428",
"score": "0.47585645",
"text": "def ==(other)\n return false unless other.is_a?(Line)\n Point.is_collinear?(self.p1, other.p1, self.p2, other.p2)\n end",
"title": ""
},
{
"docid": "777be3ccb8889f193d8d29809323bce9",
"score": "0.47507215",
"text": "def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend",
"title": ""
},
{
"docid": "95e8f19a85722b0241281778af3436db",
"score": "0.4750438",
"text": "def eql?(other)\n other.is_a?(AggregateGraph) ? super : false\n end",
"title": ""
},
{
"docid": "0807aa3a22b4f7519dcb080c1ab991b0",
"score": "0.47431904",
"text": "def symring_equalizer(one, two)\n return self.make_symring(one) == self.make_symring(two)\n end",
"title": ""
},
{
"docid": "8bea278f2868138c093bf7c8e5ce93fe",
"score": "0.474274",
"text": "def intersects?(other)\n if origin <= other.origin\n vertices.each { |vertex| return true if vertex > other.origin }\n else\n other.vertices.each { |vertex| return true if vertex > origin }\n end\n false\n end",
"title": ""
},
{
"docid": "6cc3658ea183bfeb9d7e78a5f1098daf",
"score": "0.47396562",
"text": "def is_encloses_point?(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point objects' unless point.is_a?(Point)\n\n return false if vertices.include?(point)\n\n sides.each do |s|\n return false if s.contains?(point)\n end\n\n # move to point, checking that the result is numeric\n lit = []\n vertices.each do |v|\n lit << v - point\n end\n\n poly = Polygon.new(*lit)\n # polygon closure is assumed in the following test but Polygon removes duplicate pts so\n # the last point has to be added so all sides are computed. Using Polygon.sides is\n # not good since Segments are unordered.\n args = poly.vertices\n indices = (-args.length..0).to_a\n\n if poly.is_convex?\n orientation = nil\n indices.each do |i|\n a = args[i]\n b = args[i + 1]\n test = ((-a.y)*(b.x - a.x) - (-a.x)*(b.y - a.y)) < 0\n \n if orientation.nil?\n orientation = test\n elsif test != orientation\n return false\n end\n end\n\n return true\n end\n\n hit_odd = false\n p1x, p1y = args[0].x, args[0].y\n indices[1..-1].each do |i|\n p2x, p2y = args[i].x, args[i].y\n\n if [p1y, p2y].min < 0 && [p1y, p2y].max >= 0 && \n [p1x, p2x].max >= 0 && p1y != p2y\n\n xinters = (-p1y)*(p2x - p1x)/(p2y - p1y) + p1x\n hit_odd = !hit_odd if p1x == p2x or 0 <= xinters \n end \n\n p1x, p1y = p2x, p2y\n end\n\n return hit_odd\n end",
"title": ""
},
{
"docid": "8b957c4a30a9366a07d5797d5e4ec1d6",
"score": "0.47307587",
"text": "def ===(other)\n to_set == other.to_set\n end",
"title": ""
},
{
"docid": "33bec1fdfc56272ea8acbf6f70fc3fc1",
"score": "0.47292104",
"text": "def ==(p)\n (self.lat == p.lat) && (self.lon == p.lon)\n end",
"title": ""
},
{
"docid": "7df7a711dea9ed2dde621e2d9140af7d",
"score": "0.47274804",
"text": "def test_empty_centroid\n assert_equal(@factory.collection([]), @factory.multi_polygon([]).centroid)\n end",
"title": ""
},
{
"docid": "ac42a1eb90acaa7add3f5aaca1779d87",
"score": "0.47139344",
"text": "def supports_intersect_except_all?\n false\n end",
"title": ""
},
{
"docid": "aa606bb5523bde8b37d59bbdd43e1650",
"score": "0.47128078",
"text": "def equivalentValues(other) # JS == operator\n other.is_a?(Object) && unwrap.eql?(other.unwrap)\n end",
"title": ""
},
{
"docid": "049be6addcd89bdd29846595df7cc61b",
"score": "0.47057766",
"text": "def shape1d?(o)\n o.union1d? or range1d?(o)\nend",
"title": ""
},
{
"docid": "6a02a72c122f1f7d583322341ecceec0",
"score": "0.47008592",
"text": "def ==(other)\n case other\n when Graph\n other.to_cypher == to_cypher\n when Array\n to_a == other\n end\n end",
"title": ""
},
{
"docid": "8735066c790244fc5b30be610db76c00",
"score": "0.46973917",
"text": "def samedirection?(vector2)\n end",
"title": ""
},
{
"docid": "80216789ba301093aa7497c45affc3f7",
"score": "0.46969914",
"text": "def envelope_to_polygon\n exp = /^\\s*ENVELOPE\\(\n \\s*([-.\\d]+)\\s*,\n \\s*([-.\\d]+)\\s*,\n \\s*([-.\\d]+)\\s*,\n \\s*([-.\\d]+)\\s*\n \\)\\s*$/x # uses 'x' option for free-spacing mode\n bbox_match = exp.match(geom)\n minx, maxx, maxy, miny = bbox_match.captures\n \"POLYGON ((#{minx} #{maxy}, #{minx} #{miny}, #{maxx} #{miny}, #{maxx} #{maxy}, #{minx} #{maxy}))\"\n end",
"title": ""
}
] |
57e87b5d0733822968d76525c5c0c467
|
movies(u) returns the array of movies that user u has watched
|
[
{
"docid": "8d49936822db12c6f46b4e3e79f558f2",
"score": "0.77871686",
"text": "def movies(u)\n\t\tif(@user.has_key?(u))\n\t\t\t@user[u].keys\n\t\tend\n\tend",
"title": ""
}
] |
[
{
"docid": "c8135ffbb3b8bf469489e6d0e33e414f",
"score": "0.8215377",
"text": "def movies(u)\r\n\t\tu_movies = []\r\n\t\ttemp = @user_list[u]\r\n\t\ttemp.each do |mov_id, rate|\r\n\t\t\tu_movies.push(mov_id)\r\n\t\tend\r\n\t\treturn u_movies\r\n\tend",
"title": ""
},
{
"docid": "30439b0decaaaf7653500c4623ef8e67",
"score": "0.82033974",
"text": "def movies(user)\n movies_he_watched = []\n @training_set.each do |record|\n if record.user == user.to_i\n movies_he_watched.push(record.movie)\n end\n end\n return movies_he_watched\n end",
"title": ""
},
{
"docid": "789f6808d4f8e1935ecd5f3fabe2e5a7",
"score": "0.79120755",
"text": "def movies(user)\n movie_list = Array.new\n user_table = @user_movie_rate[user]\n user_table.each do |m, _r|\n movie_list.push(m)\n end\n return movie_list\n end",
"title": ""
},
{
"docid": "81e2bb4815202aaa33de64f24ed44bba",
"score": "0.7891773",
"text": "def movies(u)\r\n hashes_arr = train_set_users[u]\r\n movies_arr = Array.new()\r\n hashes_arr.each do |hash|\r\n movie = hash[\"movie_id\"]\r\n movies_arr.push(movie)\r\n end\r\n return movies_arr\r\n end",
"title": ""
},
{
"docid": "18dc09f10782514ddbfbd794f3c04f2a",
"score": "0.7786513",
"text": "def movies(u)\n\t\tif @user_reviews.has_key?(u)\n\t\t\treturn @user_reviews[u].keys\n\t\telse\n\t\t\treturn []\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4bb5d23900a6e6e9fe05faf07b22b1b5",
"score": "0.77699244",
"text": "def movies (u)\n return @users[@numbers.index(u)].movies_seen \n end",
"title": ""
},
{
"docid": "17a98e33d280398677fe7c7957357f60",
"score": "0.77367026",
"text": "def movies(u)\n\t\treturn user_data[u].u_hash.keys\n\tend",
"title": ""
},
{
"docid": "09a6fffa73705266e70a9f41237f8763",
"score": "0.7709813",
"text": "def viewers(movie)\n\n\t \tuserarray=@movies[movie.to_i]\n\t \tusers=@users.select {|k,v| userarray.include? k} \n\t return users\n\t end",
"title": ""
},
{
"docid": "56eb6dee10e960b53a1b8728669c7cd2",
"score": "0.76904",
"text": "def movies(u)\n\t\t#hash_table is hash table where each key user contains a hash tables with key=movie and values = ratings\n\t\thash_table = @h_table[1]\n\t\tmovies_a = [ ]\n\t\thash_table[u].keys.each do |x|\n\t\t\tmovies_a.push(x)\n\t\tend \n\t\treturn movies_a\n\tend",
"title": ""
},
{
"docid": "b72907cef0cc3cd8e23cd59e326516a1",
"score": "0.7672364",
"text": "def movies(u)\n\t\treturn @training_hash[:users_reviewed][u-1]\t\n\tend",
"title": ""
},
{
"docid": "5baa2d4dacbcb56b47c1a05d5835baf1",
"score": "0.7620816",
"text": "def movies u\n @usersData[u].data.keys\n end",
"title": ""
},
{
"docid": "fc4d101d2a96c6b95f7425ddc85fcf3b",
"score": "0.7605308",
"text": "def movies(u)\n \t\tmovie_array = Array.new \n \t\t#loop through the array\n \t\t@movie.each do |row|\n \t\t\tif u.to_i == row[\"user_id\"].to_i\n \t\t\t\tmovie_array.push(row[\"movie_id\"].to_i) \n \t\t\tend \n \t\tend \n \t\treturn movie_array\n \tend",
"title": ""
},
{
"docid": "05c96bc9988cb589730bbf4c454ee3b2",
"score": "0.7588437",
"text": "def viewers(movie)\n user_list = Array.new()\n movie_table = @movie_user_rate[movie]\n movie_table.each do |u, _r|\n user_list << u\n end\n return user_list\n end",
"title": ""
},
{
"docid": "a381a1c0856b27b3256c44452078c676",
"score": "0.7574239",
"text": "def movie(u)\n all_mov = Array.new\n @user_hash[u].each do |m|\n all_mov.push(m)\n end\n return all_mov\n end",
"title": ""
},
{
"docid": "23593cf8df708680619927c4b89bdf11",
"score": "0.7545744",
"text": "def movies(user_id)\n raise 'User does not exist.' unless @movie_database.users_include?(user_id)\n @movie_database.movies_user_rated(user_id).map(&:movie_id)\n end",
"title": ""
},
{
"docid": "c60fb33b565d5f829192a1ee32546bca",
"score": "0.7531087",
"text": "def movies(user)\n\t\treturn movie_viewer_helper(user,@data_of_movies[0],@data_of_movies[1])\n\tend",
"title": ""
},
{
"docid": "17630dcbd2b24f29b29ed7775334147c",
"score": "0.7514599",
"text": "def movies(u)\n\t\treturn @training_data[u.to_s].keys \n\tend",
"title": ""
},
{
"docid": "5b5239da9ca002ed89a0eda9052c8fd8",
"score": "0.7498045",
"text": "def movies(user)\n\n\t\tif @train_umr_h.has_key?(user)\n\t\t\treturn @train_umr_h[user].keys\n\t\telse\n\t\t\treturn []\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "74cdf931539117b2d6e4149acfa16b3c",
"score": "0.74874127",
"text": "def movies(user)\n\t u= @users[user]\n\t return u.keys\n\t end",
"title": ""
},
{
"docid": "bca281fba908b555e46df006c90dfb3a",
"score": "0.74651676",
"text": "def movies(u)\n general_calculate(users[u.to_i], 0)\n end",
"title": ""
},
{
"docid": "76c52b508f7a6697e6683b5f9b0d60a9",
"score": "0.7445095",
"text": "def viewers(movie)\n\t\tusers = []\n\t\t@user_hash.keys.each do |user|\n\t\t\tusers << user if rating(user, movie) != nil\n\t\tend\n\t\tusers\n\tend",
"title": ""
},
{
"docid": "39b764c4b461a2deecd291bdd3916e62",
"score": "0.7387817",
"text": "def movies(u)\n\t\t return @train_u_i[u]\n\tend",
"title": ""
},
{
"docid": "4f7bd2629942bfa66319e0b0ff08d25f",
"score": "0.7373088",
"text": "def movies(user_id)\n return @dict_uid[user_id].keys if @dict_uid.has_key?(user_id)\n ret = []\n end",
"title": ""
},
{
"docid": "4640e2fead4133dba7397c6bec788bc4",
"score": "0.7367473",
"text": "def movies(u)\n @training_ratings_u[u].keys\n end",
"title": ""
},
{
"docid": "031e41b32d67dbf2e3c7e9f354991848",
"score": "0.7365901",
"text": "def movies(user)\n\t\tif @hash_tables[1].has_key?(user)\n\t\t\t@hash_tables[1][user].keys # return the movies u has seen after finding u in the hashtable\n\t\telse \n\t\t\t0 # return 0 when u has not seen any movies or user inputs invalid user \n\t\tend\n\t\t\t\n\tend",
"title": ""
},
{
"docid": "0ea8555a86b0059e3fabcf82a8ab7bc2",
"score": "0.73533684",
"text": "def movies(user)\n\t\t@user_hash[user].movies_rated_ids\n\tend",
"title": ""
},
{
"docid": "a21da68949953de2423e5023df006e5b",
"score": "0.7326987",
"text": "def user_movies(user)\n MOVIES.select do |m|\n m[:id].in?(user[:seen] + user[:skipped] + [user[:suggested]])\n end\n end",
"title": ""
},
{
"docid": "0515567582d35978acccd47d4b86d36d",
"score": "0.73145473",
"text": "def movies(user)\r\n return @users[user].keys\r\n end",
"title": ""
},
{
"docid": "0374246eb7f5643eab33840133433b05",
"score": "0.7307732",
"text": "def movies(u)\n #init empty array that will hold movies u has seen\n movies_seen_by_u = []\n (0..1681).each do |i|\n rating = training_set[u-1][i]\n if rating != 0.0 #if movie has a rating push it on array\n movie_id = i + 1\n movies_seen_by_u.push(movie_id)\n end\n end\n return movies_seen_by_u\n end",
"title": ""
},
{
"docid": "d683e359d7f608bc6fcf9ffece695dc8",
"score": "0.72977275",
"text": "def movies(user)\n\t\treturn training_data[user].keys\n\tend",
"title": ""
},
{
"docid": "31b4ef83371404f24b5e884785152ed1",
"score": "0.7244279",
"text": "def movies(u)\n\t\treturn @base_um_hsh[u].keys\n\tend",
"title": ""
},
{
"docid": "e12423544fc9366e3d1fc35fe3546709",
"score": "0.7221368",
"text": "def movies(u)\n p @user_hash[u].keys\n end",
"title": ""
},
{
"docid": "f5b9b548415cb382a463291d0ea356a2",
"score": "0.71740496",
"text": "def movies u\r\n \t @training_set[u].keys\r\n end",
"title": ""
},
{
"docid": "1643b703738c6d386727d0256ccf46d1",
"score": "0.7129444",
"text": "def movies(file, u)\n return @u[user_id].user_id.movie_id\n end",
"title": ""
},
{
"docid": "8b515dce49ead2fd03d8c071bd188e8e",
"score": "0.7121631",
"text": "def viewers(movie_id)\n return [] unless @movie_database.movies_include?(movie_id)\n @movie_database[movie_id].user_list\n end",
"title": ""
},
{
"docid": "bcf083bb97444f778c1661302e5ec817",
"score": "0.7108678",
"text": "def viewers (m) \n reuturn @movies[@movieFake.index(m)].users_seen\n end",
"title": ""
},
{
"docid": "755993061e166edbbe8db42752a787b1",
"score": "0.7084571",
"text": "def list\n @user = current_user\n @movies = Itune.new(params[:movie], @user).get_movies\n if @movies.empty?\n @movie = Movie.unrecognized_movie(params[:movie], false)\n @user_movie = UserMovie.find_or_create_by(:user_id => @user.id, :movie_id => @movie.id, :watchlist => false)\n end\n end",
"title": ""
},
{
"docid": "c988bfef7d34e69363c9651963bc798d",
"score": "0.7075551",
"text": "def movies user_id\n\t\treturn user_reviews[user_id].movies.keys.sort\n\tend",
"title": ""
},
{
"docid": "c0090da932a2426300de9adf5abbbe74",
"score": "0.7041055",
"text": "def viewers(movie_id)\n \tbegin \n \t\treturn movie_users_list[movie_id.to_i].transpose[0]\n \trescue\n \t\tputs \"No such movie\"\n \t\texit(0)\n \tend\n end",
"title": ""
},
{
"docid": "e8a681343d024190e287418b4aed9dc9",
"score": "0.7009453",
"text": "def movies(user_id)\n \tbegin \n \t\treturn reviews_hash[user_id.to_i].transpose[0]\n \trescue\n \t\tputs \"No such user\"\n \t\texit(0)\n \tend\n end",
"title": ""
},
{
"docid": "cc3d44d82d9f2ab1d98d63f8da42440f",
"score": "0.69882745",
"text": "def movies(u)\n\n\t\tif @train_umr_h.has_key?(u)\n\t\t\treturn @train_umr_h[u].keys\n\t\telse\n\t\t\treturn 0\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "79d04f0b11198cdb2788ccfe02099c8c",
"score": "0.6950326",
"text": "def viewers(movie, usermovieratings)\n\treturnarray = Array.new\n\tusermovieratings.each do |key, val|\n\t\tuser = val.each do |w|\n\t\t\tif w.include?(\"#{movie}\")\n\t\t\t\treturnarray.push(key)\n\t\t\tend\n\t\tend\n\tend\n\treturnarray.sort_by!{ |x| x[/\\d+/].to_i }\nend",
"title": ""
},
{
"docid": "8dede0df9145d29be90b1623f8f13328",
"score": "0.6922156",
"text": "def viewers(m)\n \t\tuser_array = Array.new \n \t\t@movie.each do |row|\n \t\t\tif m.to_i == row[\"movie_id\"].to_i\n \t\t\t\tuser_array.push(row[\"user_id\"].to_i)\n \t\t\tend \n \t\tend \n \t\treturn user_array\n \tend",
"title": ""
},
{
"docid": "aa97dbb15231ed9bd38f957c4490ed43",
"score": "0.682895",
"text": "def viewers(m)\n\t\tviewers_array = []\n\t\t@training_data.each do |user, movie|\n\t\t\tif movie.keys.include?(m.to_s)\n\t\t\t\tviewers_array.push(user)\n\t\t\tend\n\t\tend\n\t\treturn viewers_array\n\tend",
"title": ""
},
{
"docid": "2962cb293f22a40c79f4642c6356d063",
"score": "0.6812246",
"text": "def movies_towatch\n unless self.participants.empty?\n Movie.find(eval(self.participants.map(&:towatch_movie_ids).map(&:to_json).join(\"&\")))\n else\n []\n end\n end",
"title": ""
},
{
"docid": "73fcae29b8e608836d1c5569d9ed07de",
"score": "0.6769303",
"text": "def viewers(m)\n\t\tputs \"Array of users who have seen movie #{m}: \"\n\t\tprint find_pop_hash(m)[:users_seen]\n\tend",
"title": ""
},
{
"docid": "88a3d0001f1acd33a9f77180ecc3834b",
"score": "0.6727861",
"text": "def movies()\n sql = \" SELECT * FROM movies\n INNER JOIN roles\n ON movies.id = roles.movie_id\n WHERE actor_id = $1;\"\n movie_hash = SqlRunner.run(sql, [@id])\n movies = movie_hash.map{|movie_hash| Movie.new(movie_hash)}\n return movies\n end",
"title": ""
},
{
"docid": "3a9625aeb2834449e892f7178bcedcfc",
"score": "0.66412616",
"text": "def movies\n @movies ||= parse_movies\n end",
"title": ""
},
{
"docid": "a41e3a83abdb531e8b54e59f5c78a6d8",
"score": "0.6590902",
"text": "def movies(user, usermovieratings)\n\treturnarray = Array.new\n\tusermovieratings[\"#{user}\"].each { |x| returnarray.push(x.split(\" \").first)}\n\treturnarray\nend",
"title": ""
},
{
"docid": "8657f457d12cf9cf889d7958ce3cd7e4",
"score": "0.65738",
"text": "def viewers(m)\r\n hash_arr = train_set_movies[m]\r\n arr = Array.new()\r\n hash_arr.each do |hash|\r\n arr.push(hash[\"user_id\"])\r\n end\r\n return arr\r\n end",
"title": ""
},
{
"docid": "3ec4bd49bc68066ec3f933122b6ec8a5",
"score": "0.65581626",
"text": "def load_movies(all_users)\n all_users.each {|hash| \n if(hash[:user_id] == id)\n add_movie(hash[:movie_id], hash[:rating])\n end\n }\n end",
"title": ""
},
{
"docid": "4803101a96cfce1109017bfa094a8dbf",
"score": "0.65323466",
"text": "def movies\n find_nodes_film_and_year.map{|n| new_movie n }.compact\n end",
"title": ""
},
{
"docid": "23ee1d4570b3d01465d9da58cacf6e85",
"score": "0.6484618",
"text": "def index\n @user_movies = UserMovie.all\n end",
"title": ""
},
{
"docid": "e334b84c8dcd1147b481e19bc4b6ed31",
"score": "0.6469411",
"text": "def movies \n roles.map { |role| role.movie }\n end",
"title": ""
},
{
"docid": "4ce89b9973759e50e656b44a7afaaad9",
"score": "0.646786",
"text": "def index\n @movies = current_user.movies\n end",
"title": ""
},
{
"docid": "34e916e868b14fd5166fcb531618211b",
"score": "0.6461251",
"text": "def movies()\n sql = \"SELECT movies.* FROM movies INNER JOIN castings ON movies.id = castings.movie_id WHERE performer_id = $1\"\n values = [@id]\n movie_data = SqlRunner.run(sql, values)\n return Movie.map_items(movie_data)\n end",
"title": ""
},
{
"docid": "9360d7cc6efc3fae6b08e9d16928778e",
"score": "0.64522153",
"text": "def movies\n [\n {id: 3, name: 'Affliction', rating: 'R', desc: 'Little Dark', length: 123},\n {id: 7, name: 'Mad Max', rating: 'R', desc: 'Fun, action', length: 154},\n {id: 10, name: 'Rushmore', rating: 'PG-13', desc: 'Quirky humor', length: 105}\n ]\n end",
"title": ""
},
{
"docid": "4605d82e524a65555eb845245b0091d3",
"score": "0.64428765",
"text": "def viewers(movie)\n\t\treturn movie_viewer_helper(movie, @data_of_movies[1],@data_of_movies[0])\n\tend",
"title": ""
},
{
"docid": "5b32adb37036c662190eec3071f9b919",
"score": "0.6430592",
"text": "def viewers(movie)\n\n\t\tif @train_mur_h.has_key?(movie)\n\t\t\treturn @train_mur_h[movie].keys\n\t\telse\n\t\t\treturn []\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "ca949877c37ec6834554ad4d5b51ed17",
"score": "0.6393209",
"text": "def viewers(m)\r\n\t\t@movie_list[m]\r\n\tend",
"title": ""
},
{
"docid": "65abe14f59939cd04eb0e5a724753785",
"score": "0.63909763",
"text": "def movies( params={} )\n movies = get_connections(\"movies\", params)\n return map_connections movies, :to => Facebook::Graph::Movie\n end",
"title": ""
},
{
"docid": "4323fec2086ac9184fe923506d0a530f",
"score": "0.6364313",
"text": "def favourite_movies_list\n render json: @user.movies\n end",
"title": ""
},
{
"docid": "ac632611c804528113a3e5ee9c618850",
"score": "0.63460547",
"text": "def rating(user, movie)\n\n\t\tuser_lst = []\n\t\tmovie_lst = []\n\n\t\t@data_of_movies[0].each_with_index do |item, index| # user_id list\n\t\t\tif item == user\n\t\t\t\tuser_lst.push(index)\n\t\t\tend\n\t\tend\n\n\t\t@data_of_movies[1].each_with_index do |item, index| # movie_id list\n\t\t\tif item == movie\n\t\t\t\tmovie_lst.push(index)\n\t\t\tend\n\t\tend\n\n\t\tindex_rating = user_lst & movie_lst\n\t\treturn @data_of_movies[2][index_rating[0]]\n\tend",
"title": ""
},
{
"docid": "503c3a5de237aca44da04d4898306351",
"score": "0.632818",
"text": "def index\n @movies = Movie.all\n if current_user.movie_users.size > 0\n @movies = @movies.where(\"id NOT IN (?)\", MovieUser.where(user_id: current_user.id).pluck(:movie_id))\n end\n @movies = @movies.order(:created_at)\n end",
"title": ""
},
{
"docid": "f9589132e3909136a2e8e4de99f57107",
"score": "0.63252443",
"text": "def movie_list\n seen_movies = Array.new\n movie_ratings.each {|movie|\n seen_movies.push(movie[:movie_id])\n }\n return seen_movies\n end",
"title": ""
},
{
"docid": "411d4dfeb5c05d9ddec705a8b2c65339",
"score": "0.6321465",
"text": "def list_movies(params)\n data = self.class.get(\"/list_movies\", { query: params })\n Yify::Response.new(data, :movies)\n end",
"title": ""
},
{
"docid": "85e4fa78b87ffd35803dcb5fc7266b41",
"score": "0.63181704",
"text": "def viewers(movie)\r\n return @movies[movie].keys\r\n end",
"title": ""
},
{
"docid": "af9590ac835689edda369b71b3217067",
"score": "0.6317476",
"text": "def viewers(movie_id)\n\t\tmovie_hash = training_set[:movies][movie_id]\n\t\tmovie_hash[:viewers]\n\tend",
"title": ""
},
{
"docid": "1eaa2ade0c20f143b724b5a9eb9717b5",
"score": "0.6299272",
"text": "def get_movie_list(curr_user)\n\tcurr_user = check_user(curr_user.name)\n\tmovie_list = curr_user.movie_list\n\t\t\n\tif movie_list.size == 0\n\t\t\tclear_text\n\t\t\tputs \"It's empty!\"\n\telse\n\t\t\tclear_text\n\t\t\tputs display_table(parse_movie_list(movie_list))\n\tend\nend",
"title": ""
},
{
"docid": "a039dd3665a040fb62fe2f6afab52078",
"score": "0.62885654",
"text": "def viewers(movie_id)\n return @dict_mid[movie_id].keys if @dict_mid.has_key?(movie_id)\n ret = []\n end",
"title": ""
},
{
"docid": "dc85f021dc9b1015aa144e51d0fd584c",
"score": "0.6251172",
"text": "def genres_wise_movies\n begin\n @genres = Genre.joins(:movies).distinct.order(:name)\n @recentaly_watched = []\n if params[:user_id] != \"0\" && params[:user_id].present?\n @user = User.find(params[:user_id])\n if @user\n @recentaly_watched = @user.user_video_last_stops.map do |user_video_last_stop|\n create_json_recentaly_watched user_video_last_stop\n end\n end\n elsif params[:device_id].present?\n @user = Visitor.find_by_device_id(params[:device_id])\n if @user\n @recentaly_watched = @user.user_video_last_stops.map do |user_video_last_stop|\n create_json_recentaly_watched user_video_last_stop\n end\n end\n end\n if @genres.present? && Movie.exists?\n @genres=@genres.map do |genre|\n create_json_genres_with_movie genre\n end\n @response = { code: \"0\",status: \"Success\",message: \"Successfully genere with movie found\",genres: @genres,recentaly_watched: @recentaly_watched}\n else\n @response = { code: \"1\",status: \"Error\",message: \"No any genres found\"}\n end\n rescue Exception => e\n @response = {:code => \"-1\",:status => \"Error\",:message => e.message}\n end\n render json: @response\n end",
"title": ""
},
{
"docid": "3cf9b6b23a080947c0f1702e66687264",
"score": "0.6164781",
"text": "def viewers(movie) \n\t\tif @hash_tables[2].has_key?(movie)\n\t\t\t@hash_tables[2][movie].keys # return keys or viewers of movie m\n\t\telse\n\t\t\t0 # there are no viewers for the movie\n\t\tend\n\n\t\t\n\tend",
"title": ""
},
{
"docid": "9dbc2a3f7743545906de895178674a59",
"score": "0.61593467",
"text": "def get_movies\n @movies = Movie.all\n end",
"title": ""
},
{
"docid": "5aa84be734da122647fddace9a35b879",
"score": "0.61520493",
"text": "def actor_rec_list(actors,actors_movies)\n actors.each do |actor|\n actors_movies << Actor.where(:id => actor.id).includes(:movies).first.movies\n end\n actors_movies.flatten!\n end",
"title": ""
},
{
"docid": "219e1a2aafddebe0b0c56b94f6cc942a",
"score": "0.6141969",
"text": "def watched(m)\n all_usr = Array.new\n @user_hash.each do |u, mr|\n if mr.has_key?(m)\n all_usr.push(u)\n end\n end\n return all_usr\n end",
"title": ""
},
{
"docid": "987cf7c5af85cdc12935b0bb5f54d1d0",
"score": "0.61230433",
"text": "def movies\n Movie.all\n end",
"title": ""
},
{
"docid": "893f78048dec5fc0d9ebbd8a1208c38c",
"score": "0.61157835",
"text": "def viewers movie_id\n\t\treturn m_stats[movie_id].viewers.sort\n\tend",
"title": ""
},
{
"docid": "0dc004de5e4655ce7eaee5d716f29661",
"score": "0.6115441",
"text": "def index\n @bought_movies = current_user.bought_movies.all\n end",
"title": ""
},
{
"docid": "7cd58bf989343e3bf245caf7b3f57af7",
"score": "0.6113987",
"text": "def movies\n\t\t@movie_to_rating.keys\n\tend",
"title": ""
},
{
"docid": "91a3ffc92d9433bf9de21f404d0272a9",
"score": "0.61072797",
"text": "def index\n movies = Movie.where(user_id: current_user.id)\n render json: { movies: movies }\n end",
"title": ""
},
{
"docid": "fcffe75603a3cfcfa9c744032db456ff",
"score": "0.61066943",
"text": "def get_movies\n movies = []\n Capybara.page.all(:xpath, @movie_name_xpath).map { |element| movies << element.text }\n return movies\n end",
"title": ""
},
{
"docid": "d3648f12540eb20dd418c5ce49270ea0",
"score": "0.60988563",
"text": "def movies\n @movies ||= (exact_match? ? parse_movie : parse_movies)\n end",
"title": ""
},
{
"docid": "b332a8dd0ad1f723024b167cbfae241f",
"score": "0.60813653",
"text": "def all\n @movies\n end",
"title": ""
},
{
"docid": "909e9cbe2bd0cdd32f01011588600348",
"score": "0.60387737",
"text": "def viewers m\n @moviesData[m].data.keys\n end",
"title": ""
},
{
"docid": "0f025e5b5e38b2eb560d082404c8bffc",
"score": "0.6018929",
"text": "def movies\n roles.all(:include => :movie).map(&:movie)\n end",
"title": ""
},
{
"docid": "ede9ddccccc33b69b77f9e4aac4fd810",
"score": "0.6018465",
"text": "def show_users_watched\n self.views.select do |v|\n v.watched\n end \n end",
"title": ""
},
{
"docid": "8a6727327f6abfeeec264e14f68c745c",
"score": "0.60140616",
"text": "def viewers(file,m)\n return @m[movie_id].user_id.rating\n end",
"title": ""
},
{
"docid": "a856fec52b021404747519522010645f",
"score": "0.60058975",
"text": "def movies\n Role.all.select do |role|\n role.actor == self\n end\n end",
"title": ""
},
{
"docid": "bce7d7727e5ae5d6bf90d3b427a96fce",
"score": "0.6001376",
"text": "def movies\n Movie.where(:\"roles._id\"=>self.id)\n end",
"title": ""
},
{
"docid": "09fa0191a2c762f82b936b05ab21daa8",
"score": "0.59732133",
"text": "def index\n @watched_movies = WatchedMovie\n .order(watched_date: \"DESC\")\n .includes(:movie, movie: [:director])\n .where(user_id: @current_user.id)\n authorize @watched_movies\n end",
"title": ""
},
{
"docid": "ab5a0ec1e5d6a324faa42b00373e0766",
"score": "0.5969821",
"text": "def list_movies(movies)\n movies.each_with_index do |movie, index|\n puts \"#{index+1}. #{movie.title}\"\n end\n end",
"title": ""
},
{
"docid": "d690f576a57d84d2b2d0921ecf31fad9",
"score": "0.59690756",
"text": "def movies_by_favorite_actor\n Redis.current.zrange(\"actorMovies:#{favorite_actor}\", 0, -1)\n end",
"title": ""
},
{
"docid": "0c6343626989ae0a4064e41628d104e9",
"score": "0.5963042",
"text": "def favorite_videos(username)\n response = users_list_favorite_videos(:user => username)\n _parse_video_response(response)\n end",
"title": ""
},
{
"docid": "36359e3a9661a3cb1c5977bac97014ba",
"score": "0.59574586",
"text": "def movie_view_by_user?(user_id)\n (self.user_filmlists.find_by_user_id user_id).present?\n end",
"title": ""
},
{
"docid": "be4419a0085e845a1a533a2d7dac93e4",
"score": "0.5953549",
"text": "def predict(user,movie)\n\t\tsimilar_user_hash=Hash.new\n\t\tviewers_of_movie=viewers(movie)\n\t\tmovies_of_user=movies(user)\n\n\t\tnum_of_other_users_to_check=20\n\t\tnum_movies_to_check=50\n\n\t\tcheck_users=subset_array(viewers_of_movie,num_of_other_users_to_check)\n\n\t\tcheck_users.each do |other_user|\n\t\t\tif other_user!=user\n\t\t\t\tcheck_movies_of_user=subset_array(movies_of_user,num_movies_to_check)\n\t\t\t\tcheck_movies_of_other_user=subset_array(movies(other_user),num_movies_to_check)\n\t\t\t\tnum_common_movies=check_movies_of_user&check_movies_of_other_user\n\t\t\t\tsimilar_user_hash[num_common_movies]=other_user\n\t\t\tend\n\t\tend\n\n\t\t#finds the user out of the viewers who has the maximum number of movies watched in common with our user u and returns the rating that user gave to movie m\n\t\treturn rating(similar_user_hash[similar_user_hash.keys.max],movie)\n\t\t\n\n\tend",
"title": ""
},
{
"docid": "45de9203d04ff1cb6cc33eaeda3244af",
"score": "0.59386057",
"text": "def watched\n @movies.select(&:viewed?).sort_by { |m| [-m.my_rating * rand, (Date.today - m.view_date).to_i * rand] }.first(5).each(&:description)\n end",
"title": ""
},
{
"docid": "9deb93d7d582ee0b12fbf75d5e638cf8",
"score": "0.59293276",
"text": "def rating(u, m)\n \t\t ratings = 0\n \t\t @movie.each do |row| #loops through the rows of movie data \n \t\t\tif u == row[\"user_id\"].to_i && m == row[\"movie_id\"].to_i #goes to the movie_id hash\n \t\t\t\tratings = row[\"rating\"].to_i \t\n \t\t\tend\n \t\tend\n \t\treturn ratings \n \tend",
"title": ""
},
{
"docid": "9f5c96fed11d8ed19300838964c062c4",
"score": "0.5920391",
"text": "def getRecentlyWatchedVideos(user_id=0,offset=0)\n videoRows = Array.new\n if user_id > 0\n if offset > 0\n recentVideoIDsResult = VideoWatch.where(\"user_id = ?\",user_id).select(:video_id).distinct.order('created_at DESC').limit(offset)\n else\n recentVideoIDsResult = VideoWatch.where(\"user_id = ?\",user_id).select(:video_id).distinct.order('created_at DESC')\n end\n else\n if offset > 0\n recentVideoIDsResult = VideoWatch.select(:video_id).distinct.order('created_at DESC').limit(offset)\n else\n recentVideoIDsResult = VideoWatch.select(:video_id).distinct.order('created_at DESC')\n end\n end\n \n recentVideoIDsResult.each do |wRow| \n videRow = Video.where(\"id = ? AND published=1\",wRow.video_id).take \n if videRow != nil\n videoRows.push(videRow) \n end\n end \n return videoRows\n end",
"title": ""
},
{
"docid": "326cb1d40273048402c3812b2c213134",
"score": "0.59103906",
"text": "def similar_movies(movie_id)\n return @badfruit.parse_movies_array(JSON.parse(@badfruit.similar_movies(movie_id)))\n end",
"title": ""
},
{
"docid": "afa4dcfef80ca97da086ab0be5d98964",
"score": "0.59042895",
"text": "def get_actors_in_movie(name)\r\n movie_node = get_movie_node(name)\r\n if(movie_node != nil)\r\n actors_in_movie = []\r\n movie_node.adjacency_list.each { |actor_adj_node| actors_in_movie << actor_adj_node.name }\r\n return actors_in_movie\r\n end\r\n end",
"title": ""
}
] |
a2168488319c1b1214ee0293e274454f
|
Get the "pain" array
|
[
{
"docid": "7f46294d8c9a384fd6c8adf1a99220ef",
"score": "0.52879745",
"text": "def pain(classes = @pain_classes)\n return @pain_override unless @pain_override.nil? # For testing mostly\n result = {}\n classes.each do |class_name, obj|\n next if class_name =~ /::Hash$/\n x_pain = obj.pain(self)\n x_pain.each do |key, val|\n result[key] ||= { pain: false, score: 0 }\n result[key][:score] += val[:score] if val.key?(:score)\n result[key][:pain] = true if val.key?(:pain) && val[:pain]\n end\n end\n result\n end",
"title": ""
}
] |
[
{
"docid": "b69d942d526a77bddf5f3bc995aa960e",
"score": "0.5776505",
"text": "def list_penalized_arrays(args = {}) \n get(\"/arrays.json/backoffice/penalty\", args)\nend",
"title": ""
},
{
"docid": "1be8babfd7579a2fe8183e2020539c94",
"score": "0.56484705",
"text": "def working_bike_array\n #filter out broken bikes and return array\n @bikes.reject { |bike| bike.working == false}\n # @bikes.select(&:working)\n end",
"title": ""
},
{
"docid": "4071dfbbe6a175243cbac55d6196faf0",
"score": "0.56315774",
"text": "def points(arr, grace)\r\n arr.map! {|grade| grade += grace} \r\nend",
"title": ""
},
{
"docid": "f8915bc3e9f1a94e37395004d0382476",
"score": "0.55307704",
"text": "def power_of_attorneys\n claimants.map(&:power_of_attorney).compact\n end",
"title": ""
},
{
"docid": "ff922cf25625bedc688a1ed5bf797d6f",
"score": "0.5490061",
"text": "def pfam_B\n doms = Array.new\n @proteins.values.each{|p| doms += p.pfam_B }\n return doms\n end",
"title": ""
},
{
"docid": "0388a0e62b764b47fc778bdd43d553f3",
"score": "0.5482049",
"text": "def index\n @pain_points = PainPoint.all\n end",
"title": ""
},
{
"docid": "6ca387a6a4d3f29af619756105b81c94",
"score": "0.54189265",
"text": "def set_pain\n @pain = Pain.find(params[:id])\n end",
"title": ""
},
{
"docid": "6ca387a6a4d3f29af619756105b81c94",
"score": "0.54189265",
"text": "def set_pain\n @pain = Pain.find(params[:id])\n end",
"title": ""
},
{
"docid": "95139acb8a51691320f6076225a7e686",
"score": "0.54039055",
"text": "def impacto \n\t\tresultado = [0,0]\n\t\t@alimentos.each {|i| resultado = i + resultado}\n\t\treturn resultado\n\tend",
"title": ""
},
{
"docid": "76d27b498750eafc74fe00dc16c4e2be",
"score": "0.5364321",
"text": "def GainLevels()\n @salida = Array.new\n for m in @@monsters\n\n if ( m.prize.level > 1 )\n @salida << m\n end\n end\n return (@salida)\n end",
"title": ""
},
{
"docid": "b338ec2bf4592f8fb9b01caa6e391b2a",
"score": "0.5333068",
"text": "def pain_params\n params.require(:pain).permit(:assume_pain, :asleep, :scale_type, :scale_value, :orientation, :location, :treatment, :pasero_sedation, :admission_id, :author)\n end",
"title": ""
},
{
"docid": "239075559bcd9a0631a4354b1c3cb3fe",
"score": "0.5284918",
"text": "def non_tamperables\n\t\t[]\n\tend",
"title": ""
},
{
"docid": "e918efdfa064c73afb6072f61178a62f",
"score": "0.5275024",
"text": "def get_canon_as_array()\n return @canon_complete\n end",
"title": ""
},
{
"docid": "24062a2acf99e5e303a8d6e9e55740dc",
"score": "0.527275",
"text": "def debt_array\n @debt_map.map {|obj, data| data[:owed]}\n end",
"title": ""
},
{
"docid": "38c6f970f1d4ec9c5d4cb570f42b844f",
"score": "0.52645344",
"text": "def soaarr\n ['zone','host','ttl','data','resp_person','refresh','retry','expire','minimum'];\n end",
"title": ""
},
{
"docid": "461c6a9a82be3d3b0654954d975f352b",
"score": "0.52615315",
"text": "def get_item_stats\n h = pcp_items.group( :new_assmt ).count\n a = Array.new( PcpItem::ASSESSMENT_LABELS.count, 0 )\n h.each {|k,v| a[ k ] = v }\n return a\n end",
"title": ""
},
{
"docid": "5c47a638f0cf07acf8452498a77aa4a9",
"score": "0.52594024",
"text": "def pfam_A\n doms = Array.new\n @proteins.values.each{|p| doms += p.pfam_A }\n return doms\n end",
"title": ""
},
{
"docid": "948781d10041c278cb0ba4f49a87d843",
"score": "0.5248362",
"text": "def to_array\n [id, name, illness, cured]\n end",
"title": ""
},
{
"docid": "0b3785c30cfd877800919eed6ee15af0",
"score": "0.5237897",
"text": "def grades_array\n return @grades_array if defined? @grades_array\n results = self.assignment.current_results\n .where(marking_state: Result::MARKING_STATES[:complete])\n @grades_array = self.marks.where.not(mark: nil).where(result_id: results.ids).pluck(:mark)\n end",
"title": ""
},
{
"docid": "fcb05dd32f0976964619b6e4d814b67d",
"score": "0.52301514",
"text": "def determine_pain_severity_message\n\n # => Get the last 2 submissions\n last_submissions = previous_submissions.limit(2)\n\n # => If there are at least 2 submissions\n if last_submissions.count == 2\n \n # => Get the different between their current_pain questions\n current_pain, previous_pain = last_submissions.collect{|sub| sub.current_pain_answer.try(:value) || 0}\n if current_pain < previous_pain - 20\n # => The pain has improved by 20\n BETTER\n elsif current_pain > previous_pain + 20\n # => The pain has gotten worse by 20\n WORSE\n else\n OK\n end\n else\n # => There aren't at least 2 results, show the OK by default\n OK\n end\n end",
"title": ""
},
{
"docid": "9251065800393f175cb7d76b065e1ffc",
"score": "0.52075565",
"text": "def incoming_proficiency_arrays\n results = []\n 1.upto 5 do |i|\n slot = incoming_proficiencies_for_slot(i)\n unless slot.nil? or slot.empty?\n results.push(slot)\n end\n end\n results\n end",
"title": ""
},
{
"docid": "5c2eb3913522c7b1dbface1787237264",
"score": "0.5202509",
"text": "def duty(good)\n good[]\n # 0.5\n end",
"title": ""
},
{
"docid": "69403452d38893f52bc1a756c4eba124",
"score": "0.5201308",
"text": "def calculate_blood_sugar_array\n logger.debug \"calculate_blood_sugar_array\"\n\n add_each_performed_exercise\n add_each_consumed_food\n calculate_glycation_and_normalization\n end",
"title": ""
},
{
"docid": "b6540406570c02cae062682a3ba35261",
"score": "0.51944333",
"text": "def mined_minds_kata_array #the array to be made\r\n\t# (1..100).to_a\t#easierst way to make it pass for now, array.method\r\n\t\tkata_array = []\t# well push all results here, the 100 elemts.\r\n\r\n\tnumber = 1\r\n\tkata_array << number #push 1 into kata_array\r\nend",
"title": ""
},
{
"docid": "b32efe684a4c31550840d42b2056eae7",
"score": "0.5167557",
"text": "def get_tas\n []\n end",
"title": ""
},
{
"docid": "e429612492162d921fceb834030ef804",
"score": "0.5165412",
"text": "def getLigne(y)\n\n\t\tresultat = Array.new()\n\t\t\n\t\t@cases.each{|x|\n\t\t\n\t\t\tresultat.push(x[y])\n\t\t}\n\t\t\n\t\treturn resultat\n\tend",
"title": ""
},
{
"docid": "3aabc4036c6ded76cd9e0dfb85e2443f",
"score": "0.5120842",
"text": "def summon_captain_planet(planeteer_calls)\n new_array = planeteer_calls.map {|calls| calls.capitalize + \"!\"}\nend",
"title": ""
},
{
"docid": "37789a392ff9acf0d2cb4e2f12aaaa75",
"score": "0.511155",
"text": "def assessments_array\n @assessments_array ||= Assessment.all.to_a\n end",
"title": ""
},
{
"docid": "65905a6f2703806c92d27536bb4d0cc5",
"score": "0.5108883",
"text": "def expected_as_array; end",
"title": ""
},
{
"docid": "f2f41181027178bdda20525a6cf97dcd",
"score": "0.51012266",
"text": "def index\n @pain_levels = PainLevel.all\n respond_to do |format|\n format.html\n format.json { render json: @pain_levels }\n end\n end",
"title": ""
},
{
"docid": "49596404faa0751dfacb998c1b5ed4b2",
"score": "0.5087545",
"text": "def summon_captain_planet(array)\n cap_return = []\n array.map do |planeteer|\n cap_return << planeteer.capitalize + \"!\"\n end\n cap_return\nend",
"title": ""
},
{
"docid": "c083ede235e201677003343f57f68964",
"score": "0.50815105",
"text": "def likely_anatomy\n patient_cases.map(&:anatomy).first\n end",
"title": ""
},
{
"docid": "502c357e8844bbba910d2e30371f24a7",
"score": "0.50756663",
"text": "def add_ons_array\n @add_ons_array = ClientPlan.get_bits_set_for_add_ons(add_ons)\n end",
"title": ""
},
{
"docid": "157283c67192b13f5ba72f85df0df9f6",
"score": "0.50729394",
"text": "def puntos(j)\n if j.is_a? Jugada\n if self.class.pierde.include? j.class.name\n return [0, 1]\n elsif j.class.name.eql? self.class.name\n return [0, 0]\n else\n return [1, 0]\n end\n else\n puts \"J no es una jugada válida\"\n end\n end",
"title": ""
},
{
"docid": "0895672a460ae1bc66d600c5724ee858",
"score": "0.5067722",
"text": "def get_hit_states_array\n array = []\n for state in self.states\n array.push([state.status_hit, state.status_hit_prob]) if state.status_hit > 0\n array.push([state.id, 100]) if state.viral\n end\n for equip in equips\n next if equip.nil?\n array.push([equip.status_hit, equip.status_hit_prob]) if equip.status_hit > 0\n end\n return array\n end",
"title": ""
},
{
"docid": "2062a06acb22c2a6d28e0251f60fea91",
"score": "0.5066818",
"text": "def percentage_grades_array\n return [] if self.max_mark.zero?\n\n factor = 100 / self.max_mark\n self.completed_result_marks.map { |mark| mark * factor }\n end",
"title": ""
},
{
"docid": "b58e52683ef393f12098eced8cadc0c7",
"score": "0.5042066",
"text": "def arrays; @arrays; end",
"title": ""
},
{
"docid": "82e12f6d2b7e296c8e4fabec77b73424",
"score": "0.50413704",
"text": "def threatened_by\n []\n end",
"title": ""
},
{
"docid": "a4cbdcb5860467cb01e9e35b84145517",
"score": "0.503145",
"text": "def jirra\n array = [\n ['@Proposal_New', '@Award_New', '@Proposal_Continuation', '@Award_Allotment', '@Award_Supplement_Continuation', '@Proposal_Revision', '@Proposal_Renewal'],\n ['@Proposal_New', '@Proposal_Resubmission'],\n ['@Proposal_New', '@Award_New', '@Award_Deobligation', '@Proposal_Admin_Change'],\n ['@Proposal_New', '@Award_New', '@Award_Admin_Amendment'],\n ['@Proposal_New', '@Award_New', '@Award_No_Cost_Extension'],\n ['@Proposal_New', '@Award_New', '@Award_Unlink_IP', '@Award_Supp_Cont_II']\n ]\nend",
"title": ""
},
{
"docid": "6c5e112b2a20ea124fabc79796c2530f",
"score": "0.50210893",
"text": "def get_final_skills_array\n result = []\n (0..MAX_SKILL_NUM).each do |skill_num|\n result << get_final_skill_value(skill_num)\n end\n result.map {|num| num == nil ? 0 : num}\n end",
"title": ""
},
{
"docid": "f17e6ff5e10b8d9feef0826452c4370a",
"score": "0.5020861",
"text": "def get_uv_array\n return nil unless @use_uv\n a = []\n @polylist.each_value { |poly| a.push(poly[:uv_array]) }\n return a.flatten\n end",
"title": ""
},
{
"docid": "601e24d42220ebddf8843eba51a2434f",
"score": "0.502035",
"text": "def puntos(j)\n super(j)\n case j\n when Piedra\n [0,1]\n when Lagarto\n [1,0]\n when Tijera\n [0,0]\n when Spock\n [0,1]\n when Papel\n [1,0]\n end\n end",
"title": ""
},
{
"docid": "e8c6410cc85b7ece249eb1bf1c9369ff",
"score": "0.5018541",
"text": "def puntos(j)\n super(j)\n case j\n when Piedra\n [0,1]\n when Lagarto\n [0,0]\n when Tijera\n [0,1]\n when Spock\n [1,0]\n when Papel\n [1,0]\n end\n end",
"title": ""
},
{
"docid": "b639f29b0fbdaafb9e1b1166e4a50e82",
"score": "0.5017285",
"text": "def new_aray(gender,cp,hp,favorite)\n\n\t\t@new_pokemonarray = []\n\t\t@new_pokemonarray << @name.capitalize\n\t\t@new_pokemonarray << height()\n\t\t@new_pokemonarray << weight()\n\t\t@new_pokemonarray << gender\n\t\t@new_pokemonarray << cp\n\t\t@new_pokemonarray << hp\n\t\t@new_pokemonarray << favorite\n\t\t@new_pokemonarray << @stage1\n\t\t@new_pokemonarray << @stage2\n\t\t@new_pokemonarray << @stage3\n\n\t\treturn @new_pokemonarray\n\n\tend",
"title": ""
},
{
"docid": "ec4bbbf7ee1258ae2b9e99e84e89b0ac",
"score": "0.5007666",
"text": "def get_trip_purposes \n purposes = []\n purposes_hash = []\n customer_information = fetch_customer_information(funding=true)\n arrayify(customer_information[\"customer\"][\"funding\"][\"funding_source\"]).each do |funding_source|\n if not @use_ecolane_rules and not funding_source[\"name\"].strip.in? @preferred_funding_sources\n next \n end\n arrayify(funding_source[\"allowed\"]).each do |allowed|\n purpose = allowed[\"purpose\"]\n # Add the date range for which the purpose is eligible, if available.\n purpose_hash = {code: allowed[\"purpose\"], valid_from: funding_source[\"valid_from\"], valid_until: funding_source[\"valid_until\"]}\n unless purpose.in? purposes #or purpose.downcase.strip.in? (disallowed_purposes.map { |p| p.downcase.strip } || \"\")\n purposes.append(purpose)\n end\n purposes_hash << purpose_hash\n end\n end\n banned_purposes = @service.banned_purpose_names\n purposes = purposes.sort.uniq - banned_purposes\n [purposes, purposes_hash]\n end",
"title": ""
},
{
"docid": "a2869d36c4ca9694f036a015977a1875",
"score": "0.50049055",
"text": "def get_sample_arrays\n [@xp, @yp]\n end",
"title": ""
},
{
"docid": "3d9239ea00fd434fe82141075073cfb8",
"score": "0.49991733",
"text": "def fire_ant_risk_levels\n [\n ['None', 0],\n ['Medium', 1],\n ['High', 2]\n ]\n end",
"title": ""
},
{
"docid": "2c0a6dece9ea410874ca119fc1a4328b",
"score": "0.49984047",
"text": "def getpreset(type)\n presetarray = Array.new\n \n # Go through govsites data\n if type === \"govsites\"\n sites = JSON.parse(File.read(\"public/sites.json\"))\n sites[\"data\"].each do |d|\n presetarray.push(d[8])\n end\n end\n\n return presetarray\nend",
"title": ""
},
{
"docid": "0d037d08a06a635af1c1f80f6fa1a1c6",
"score": "0.49956188",
"text": "def puntos(j)\n super(j)\n case j\n when Piedra\n [1,0]\n when Lagarto\n [0,1]\n when Tijera\n [1,0]\n when Spock\n [0,0]\n when Papel\n [0,1]\n end\n end",
"title": ""
},
{
"docid": "b881a36e3614f9b6f3a741a8887729e8",
"score": "0.49898535",
"text": "def all_traces_as_arrays\n @traces\n end",
"title": ""
},
{
"docid": "50752684063910ed2c4533f06efe5c60",
"score": "0.4988223",
"text": "def look_ahead\n looking_array = warrior.look\n end",
"title": ""
},
{
"docid": "2e7e9e14ef466f14b8efaad12c0949ab",
"score": "0.49801445",
"text": "def puntos(j)\n super(j)\n case j\n when Piedra\n [1,0]\n when Lagarto\n [0,1]\n when Tijera\n [0,1]\n when Spock\n [1,0]\n when Papel\n [0,0]\n end\n end",
"title": ""
},
{
"docid": "84d8d2f0f41b51354c2eac294bcc6218",
"score": "0.49721313",
"text": "def genders_as_array\n genders.map do |g|\n g.value\n end\n end",
"title": ""
},
{
"docid": "08acf4bb6b1d9cce4ac6767ded1a66b7",
"score": "0.49661082",
"text": "def get_in_arr # testing purposes\r\n return @in_arr\r\n end",
"title": ""
},
{
"docid": "ce28e52c9de0516dac7db480101045ba",
"score": "0.49636877",
"text": "def use_cases\n\t\treturn @use_cases unless @use_cases.nil?\n\t\t@use_cases = Array.new\n\t\tpackages.each do |p|\n\t\t\t@use_cases.concat p.use_cases.sort\n\t\tend\n\t\t@use_cases\n\tend",
"title": ""
},
{
"docid": "7f4339cd2df34999a911ce11af0daf9c",
"score": "0.49617675",
"text": "def summon_captain_planet(planeteer_calls)\n new_array = [ ]\n planeteer_calls.collect do |element|\n new_array.push(\"#{element.capitalize}!\")\n end\n return new_array\nend",
"title": ""
},
{
"docid": "d80b86bd95d6c24a39fd46e21f171c20",
"score": "0.49612677",
"text": "def puntos(j)\n super(j)\n\n case j\n when Piedra\n [0,0]\n when Lagarto\n [1,0]\n when Tijera\n [1,0]\n when Spock\n [0,1]\n when Papel\n [0,1]\n end\n end",
"title": ""
},
{
"docid": "eda7baa12a64369684e20ce051d26c4b",
"score": "0.49582314",
"text": "def boosts() @boosts ||= Array.new end",
"title": ""
},
{
"docid": "45cc7232aa848440431faf5f7ab1da44",
"score": "0.49528506",
"text": "def create_bouncy_txt_arr\n @bouncy_text_era = []\n end",
"title": ""
},
{
"docid": "f44fdd3e30db45b7d46aab2647cd6c4b",
"score": "0.49510285",
"text": "def bikes\n\t\t@bikes ||= []\n\tend",
"title": ""
},
{
"docid": "dc48efebaf0b8b0f280349d2884b8743",
"score": "0.49446917",
"text": "def bakery_array\n\n\tbakery = []\n\t\n\tbread = Product.new(\"Bread\", 25, 3234, 1, 2)\n\tbakery.push(bread)\n\t@products.push(bread)\n\n\tdanish = Product.new(\"Danish\", 25, 3235, 3, 6)\n\tbakery.push(danish)\n\t@products.push(danish)\n\n\tcroissant = Product.new(\"Croissant\", 25, 3236, 2, 4)\n\tbakery.push(croissant)\n\t@products.push(croissant)\n\n\twhole_wheat_bread = Product.new(\"Whole Wheat Bread\", 25, 3237, 1, 3)\n\tbakery.push(whole_wheat_bread)\n\t@products.push(whole_wheat_bread)\n\n\tcookies = Product.new(\"Cookies\", 25, 2238, 2, 3)\n\tbakery.push(cookies)\n\t@products.push(cookies)\n\n\treturn bakery\nend",
"title": ""
},
{
"docid": "9a349bfe2bc491d20ff77c9024133d9b",
"score": "0.49437094",
"text": "def get_vs_ab\r\n results = []\r\n abs = get_game.get_atbats\r\n abs.each do |ab|\r\n if ab.pitcher_id == @pid\r\n results << ab\r\n end\r\n end\r\n results\r\n end",
"title": ""
},
{
"docid": "a22dc0828b545ca14a7a8ff05e4c09b6",
"score": "0.49423432",
"text": "def posible_bids\n a = Array.new\n @@BIDS.each do |bid|\n if bid_posible?(bid)\n a << bid\n end\n end \n a\n end",
"title": ""
},
{
"docid": "41330d11666496944376a8a6a91eb27b",
"score": "0.49371433",
"text": "def getArray\n \treturn @a\n end",
"title": ""
},
{
"docid": "c875ac6509d4fc29340c115b53b33bb2",
"score": "0.492629",
"text": "def array; end",
"title": ""
},
{
"docid": "c875ac6509d4fc29340c115b53b33bb2",
"score": "0.492629",
"text": "def array; end",
"title": ""
},
{
"docid": "c875ac6509d4fc29340c115b53b33bb2",
"score": "0.492629",
"text": "def array; end",
"title": ""
},
{
"docid": "c875ac6509d4fc29340c115b53b33bb2",
"score": "0.492629",
"text": "def array; end",
"title": ""
},
{
"docid": "4ba7e4df794874ce27368dd1c04a6f46",
"score": "0.49168137",
"text": "def get_blood_pressures\n # Call VistA Novo\n response = call_vista_novo('http://localhost:3000/observation')\n blood_pressures = []\n\n # Parse blood pressure data from response into an array\n response[\"entry\"].map do |item|\n value = Hash.new\n value[:date] = Date.parse(item[\"content\"][\"appliesDateTime\"]).to_datetime.to_i * \n MILLISECONDS_PER_SECOND\n value[:systolic], value[:diastolic] = item[\"content\"][\"component\"].map do |component|\n component[\"valueQuantity\"][\"value\"].to_i\n end\n blood_pressures << value\n end\n\n # Sort blood pressure readings by date\n blood_pressures.sort_by { |bp| bp[:date] }\n end",
"title": ""
},
{
"docid": "96fa76966cb5b9850ba3456de5c463be",
"score": "0.49162522",
"text": "def painscore(classes = @pain_classes, _options = {}, pain_in = nil)\n x_pain = pain_in.nil? ? pain(classes) : pain_in\n result = 0\n pain_multiplier = 0\n x_pain.values.each do |val|\n result += val[:score]**2\n pain_multiplier = 1 if val[:pain]\n end\n (result * pain_multiplier).to_i\n end",
"title": ""
},
{
"docid": "190ab5fbeeb667b35b309c96cf3731b2",
"score": "0.4910942",
"text": "def validation_array\n allnames = Array.new\n @planets.each do |thisplanet|\n allnames.push(thisplanet.name)\n end\n for i in 0..allnames.length-1\n allnames.push((i+1).to_s)\n end\n return allnames\n end",
"title": ""
},
{
"docid": "277825c469e405c9c8449ff64cb4925f",
"score": "0.49098486",
"text": "def pain(locations)\n total_run = 0\n total_pain = 0\n # For each pair of locations,\n (locations.length - 1).times do |i|\n from_location = locations[i]\n to_location = locations[i+1]\n\n rise = to_location[:elevation] - from_location[:elevation]\n run = distances([from_location, to_location])[0]\n slope_percentage = rise / run * 100\n total_run += run\n\n area = slope_percentage * run\n total_pain += area if area > 0\n end\n\n total_pain\n end",
"title": ""
},
{
"docid": "2a23db28a635e724c45c3646239a6c94",
"score": "0.49048772",
"text": "def getTstrain trial\n\t\ttstrain = Array.new\n\t\ttrial.each do |key, value|\n\t\t\t#change the key to the tstrain\n\t\t\tnew_key = Math.log(1 + key)\n\t\t\ttstrain << new_key\n\t\tend\n\t\treturn tstrain\n\tend",
"title": ""
},
{
"docid": "1f5797b38a257a0f0056c1f863a112e3",
"score": "0.49046138",
"text": "def array\n\t\tret = []\n\t\tp_i = 0\n\t\tp = 0\n\t\t@json_need_check.each do |x|\n\t\t\ti = 0\n\t\t\tp = p + @symbols[p_i].to_i\n\t\t\tputs JSON.parse(x)['flaggedTokens']\n\t\t\twhile i < JSON.parse(x)['flaggedTokens'].length do\n\t\t\t\ttemp = JSON.parse(x)['flaggedTokens'][i]\n\t\t\t\tword = []\n\t\t\t\tword.push(temp[\"offset\"].to_i + p)\n\t\t\t\tword.push(temp[\"token\"])\n\t\t\t\ttemp = temp[\"suggestions\"].first\n\t\t\t\tword.push(temp[\"suggestion\"])\n\t\t\t\tword.push(temp[\"score\"])\n\t\t\t\tret.push(word)\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\tp_i += 1\n\t\tend\n\t\treturn ret\n\tend",
"title": ""
},
{
"docid": "a76fc9e79cef447ae1c3f4dd43592dc7",
"score": "0.49019462",
"text": "def eligible_appeals\n active_veteran_appeals.select(&:eligible_for_ramp?)\n end",
"title": ""
},
{
"docid": "5b3c5bb1adc1aa3a0b1ecce32e9092fc",
"score": "0.4898986",
"text": "def working_bikes\n working_bikes = []\n bikes.each do |bike|\n working_bikes << bike if bike.working?\n end\n working_bikes\n end",
"title": ""
},
{
"docid": "1c6f9bde1a4e396f30a137d3a4623b96",
"score": "0.4898485",
"text": "def obtener_array_silabas\n indices_palabra.inject([]) do |arr, h| \n arr << h.last[:vals]\n end\n end",
"title": ""
},
{
"docid": "ee07957dd6d0e92670431816da370ed3",
"score": "0.48978215",
"text": "def occupancy_info\n \t[\n \t\t['Annual','Annual'],\n \t\t['Monthly','Monthly'],\n \t\t['Offseason', 'Offseason'],\n \t\t['Seasonal', 'Seasonal'],\n \t\t['Vacant', 'Vacant']\n \t]\n end",
"title": ""
},
{
"docid": "665cee0e900d8891de6deba475bbc5d7",
"score": "0.48905233",
"text": "def callnride_boundary_array\n if Setting.callnride_boundary.nil?\n return []\n end\n # Returns an array of coverage zone polygon geoms\n myArray = []\n Setting.callnride_boundary.each do |boundary|\n polygon_array = []\n boundary[:geometry].each do |polygon|\n ring_array = []\n polygon.exterior_ring.points.each do |point|\n ring_array << [point.y, point.x]\n end\n polygon_array << ring_array\n polygon.interior_rings.each do |ring|\n ring_array = []\n ring.points.each do |point|\n ring_array << [point.y, point.x]\n end\n polygon_array << ring_array\n end\n end\n myArray << polygon_array\n end\n myArray\n end",
"title": ""
},
{
"docid": "2a97f81608329938e3ecb1fa220d0cb4",
"score": "0.48891625",
"text": "def pages_array()\n\t\n\t\t(1..@page_count).to_a\n\n\tend",
"title": ""
},
{
"docid": "28f8723fffc7d4cfec9d592480ae8191",
"score": "0.48826298",
"text": "def get_all_base_exp_over(array, ex_points)\n array.select { |poke| poke[:base_experience] > ex_points }\nend",
"title": ""
},
{
"docid": "208d0963bb449c6f75d4576e10e612a6",
"score": "0.4872441",
"text": "def exp_over_40(pokemon)\n pokemon.map{|poke_profile|\n if poke_profile[:base_experience] > 40\n return poke_profile\n end\n }\nend",
"title": ""
},
{
"docid": "46e0f15be7cdd0c958da63331eb88dce",
"score": "0.48702967",
"text": "def current_astronauts\n missions.map do |mission|\n mission.astronaut\n end\n end",
"title": ""
},
{
"docid": "46e0f15be7cdd0c958da63331eb88dce",
"score": "0.48702967",
"text": "def current_astronauts\n missions.map do |mission|\n mission.astronaut\n end\n end",
"title": ""
},
{
"docid": "5cc0012eb22e7fb37ba3d9641d1e2a08",
"score": "0.4868565",
"text": "def current_resources\n wreckage = Wreckage.in_location(solar_system_point).first\n wreckage.nil? \\\n ? [0, 0, 0] \\\n : [wreckage.metal, wreckage.energy, wreckage.zetium]\n end",
"title": ""
},
{
"docid": "a06077887ee21abb8a03cae7c23cc062",
"score": "0.4866674",
"text": "def map(olympians)\n only_athletes = []\n for athlete in olympians\n if athlete[:event] == 'Athletics'\n only_athletes.push(athlete)\n end\n end\n return only_athletes\nend",
"title": ""
},
{
"docid": "a6695193bd72450e4329e9577b3dc908",
"score": "0.48633447",
"text": "def contra_rock\n [0,0]\n end",
"title": ""
},
{
"docid": "74e23b230d4a0b4f36fc8f05236c7bf1",
"score": "0.48627862",
"text": "def normal(joke)\n [{\n phrase: joke[\"set_up\"],\n delay: joke['delay'] || DEFAULT_DELAY\n },\n {\n phrase: joke['punchline'],\n delay: 0\n }]\n end",
"title": ""
},
{
"docid": "0cb11ff231926d893c444035a12b74f8",
"score": "0.48590618",
"text": "def create\n @pain = Pain.new(pain_params)\n\n if @pain.save\n render json: @pain, status: :created, location: @pain\n else\n render json: @pain.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7efdb43c5691fdd3df9f549d34b5b270",
"score": "0.48534006",
"text": "def to_arr # objects make things much easier\n return [@day, @mood]\n end",
"title": ""
},
{
"docid": "a6066c1127e810a39262a1c50d744249",
"score": "0.48457676",
"text": "def contra_sccisors\n [0,0]\n end",
"title": ""
},
{
"docid": "8b41d7bbef08e76e813c241f2f6283b5",
"score": "0.48448545",
"text": "def trust_potential\n (1..[((trust || 0) / 100).round, MAX_TRUST_POTENTIAL].min).to_a\n end",
"title": ""
},
{
"docid": "04b1eef9de49afdfcab0eef5d04525df",
"score": "0.48426685",
"text": "def score_Paper m\n [0,1]\n end",
"title": ""
},
{
"docid": "c9c84f995747f7a71559ad5a006ef8ad",
"score": "0.48413825",
"text": "def key_info_array\n # Important that harvesting goes first because picking keys up to limit from front of array\n @key_info_array ||= self.harvesting_keys_array + self.account_keys_array \n end",
"title": ""
},
{
"docid": "c75cf2ebaf7a1d99ab1997bdf416a0f5",
"score": "0.48394686",
"text": "def items_array\n array = []\n self.excerpts.each do |object|\n array.push object\n end\n self.quotes.each do |object|\n array.push object\n end\n self.terms.each do |object|\n array.push object\n end\n self.people.each do |object|\n array.push object\n end\n return array\n end",
"title": ""
},
{
"docid": "c75cf2ebaf7a1d99ab1997bdf416a0f5",
"score": "0.48394686",
"text": "def items_array\n array = []\n self.excerpts.each do |object|\n array.push object\n end\n self.quotes.each do |object|\n array.push object\n end\n self.terms.each do |object|\n array.push object\n end\n self.people.each do |object|\n array.push object\n end\n return array\n end",
"title": ""
},
{
"docid": "73ccd4984aecde31e8270c231137ff5f",
"score": "0.48372775",
"text": "def getPre\n # hat = 1\n if @nextProcess == 1\n @pre = [3]\n # pants = 2\n elsif @nextProcess == 2\n @pre = [2]\n # shirt = 3\n elsif @nextProcess == 3\n @pre = [3]\n # shoes = 4\n elsif @nextProcess == 4\n @pre = [5, 2]\n # socks = 5\n elsif @nextProcess == 5\n @pre = [5]\n # leave = 6\n elsif @nextProcess == 6\n @pre = [2, 3, 4, 5]\n else\n @pre = []\n end\n end",
"title": ""
},
{
"docid": "c552994d6aef42f7d969c614b039f646",
"score": "0.48368645",
"text": "def get_damage_states_array\n array = []\n for state in self.states\n array.push([state.status_dmg, state.status_dmg_prob]) if state.status_dmg > 0\n array.push([state.id, 100]) if state.viral\n end\n for equip in equips\n next if equip.nil?\n array.push([equip.status_dmg, equip.status_dmg_prob]) if equip.status_dmg > 0\n end\n array\n end",
"title": ""
},
{
"docid": "8765ee0d93195d82a2c5d9b7f13dc25a",
"score": "0.4836168",
"text": "def results\n array\n end",
"title": ""
},
{
"docid": "8d4841f4ef9761f0150db338a15b3631",
"score": "0.483614",
"text": "def set_pain_level\n @pain_level = PainLevel.find(params[:id])\n end",
"title": ""
}
] |
5e301d664a4f34898085fdf8348c4fba
|
If there's a current blogger and the display name method is set, returns the blogger's display name Otherwise, returns an empty string
|
[
{
"docid": "48004156056ac900a5e72709df5fe829",
"score": "0.87553346",
"text": "def blogger_display_name\n if self.blogger and !self.blogger.respond_to?(Magazine.configuration.blogger_display_name_method)\n raise ConfigurationError, \n \"#{self.blogger.class}##{Magazine.configuration.blogger_display_name_method} is not defined\"\n elsif self.blogger.nil?\n \"\"\n else\n self.blogger.send Magazine.configuration.blogger_display_name_method \n end\n end",
"title": ""
}
] |
[
{
"docid": "68ed8628c4e6a6c5a651322f67ee576d",
"score": "0.88222677",
"text": "def blogger_display_name\n if self.blogger and !self.blogger.respond_to?(Blogit.configuration.blogger_display_name_method)\n raise ConfigurationError,\n \"#{self.blogger.class}##{Blogit.configuration.blogger_display_name_method} is not defined\"\n elsif self.blogger.nil?\n \"\"\n else\n self.blogger.send Blogit.configuration.blogger_display_name_method\n end\n end",
"title": ""
},
{
"docid": "9eb387bb4eba40cdaf8f8995a6006120",
"score": "0.8814063",
"text": "def blogger_display_name\n if self.blogger and !self.blogger.respond_to?(Blogit.configuration.blogger_display_name_method)\n raise ConfigurationError, \n \"#{self.blogger.class}##{Blogit.configuration.blogger_display_name_method} is not defined\"\n elsif self.blogger.nil?\n \"\"\n else\n self.blogger.send Blogit.configuration.blogger_display_name_method \n end\n end",
"title": ""
},
{
"docid": "0606d69836ea6ddc83b462a8fad15c60",
"score": "0.7110417",
"text": "def display_name\n display_name_with_title\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.7090195",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70899785",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.7089903",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
},
{
"docid": "4fb480c6458d4a1cc9a882721688c52f",
"score": "0.70898336",
"text": "def display_name\n return @display_name\n end",
"title": ""
}
] |
e7a704e301a9a5e1e05ca08d80146f55
|
Sets the attribute description
|
[
{
"docid": "1bf92350ba4fb4ebd55139a6d7d04a11",
"score": "0.0",
"text": "def description=(_arg0); end",
"title": ""
}
] |
[
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "d5364c1f09542811fb97fd4f8099e2c0",
"score": "0.75925654",
"text": "def description=(value)\n @description = value\n end",
"title": ""
},
{
"docid": "5242aaed258f7c9ff01a4b82ed2ef850",
"score": "0.75840425",
"text": "def description=(val)\n self[:description] = val\n end",
"title": ""
},
{
"docid": "49093b3177df9016c10e4f3d7928522e",
"score": "0.75201565",
"text": "def description=(str)\n @description = str\n end",
"title": ""
},
{
"docid": "5f5d0b52b933bfd46733fc9495a05edd",
"score": "0.7501889",
"text": "def set_description(description)\n @description = description\n end",
"title": ""
},
{
"docid": "b3460faaaeaa7dcf6c79be162b903fc8",
"score": "0.7440694",
"text": "def description=(v)\n @description = v\n end",
"title": ""
},
{
"docid": "65d6a05f04d50148aa4f66cb811c5a4e",
"score": "0.73934996",
"text": "def description=(desc)\n zombie_check\n @metadata.update(@name, desc: desc) \n end",
"title": ""
},
{
"docid": "4c88fe560beae4bb6de45f934f1d0954",
"score": "0.7390124",
"text": "def description=(str)\n @description = str\n write_properties\n end",
"title": ""
},
{
"docid": "2bd393fca5bec5351b8925f9707a028c",
"score": "0.73361",
"text": "def description=(description)\n end",
"title": ""
},
{
"docid": "09531fbc30f0da310c95afc2c59e8bcd",
"score": "0.7310949",
"text": "def description=(description)\r\n\t\t\t`#{BITS::BITSADMIN} /setdescription {#{@id}} \\\"#{description}\\\"`\r\n\t\tend",
"title": ""
},
{
"docid": "14db0c5711b4056eef7be6e980579239",
"score": "0.7287148",
"text": "def description=(str)\n @description = str.to_s\n end",
"title": ""
},
{
"docid": "191eb108359fcba8cc70e62e1df1d665",
"score": "0.72483593",
"text": "def setDescription(description)\r\n\t\t\t\t\t@description = description\r\n\t\t\t\tend",
"title": ""
},
{
"docid": "191eb108359fcba8cc70e62e1df1d665",
"score": "0.72483593",
"text": "def setDescription(description)\r\n\t\t\t\t\t@description = description\r\n\t\t\t\tend",
"title": ""
},
{
"docid": "957cd652b99337a1b251ab7fb8795adf",
"score": "0.7225674",
"text": "def description(value)\n @ole.Description = value\n nil\n end",
"title": ""
},
{
"docid": "957cd652b99337a1b251ab7fb8795adf",
"score": "0.7225674",
"text": "def description(value)\n @ole.Description = value\n nil\n end",
"title": ""
},
{
"docid": "5322f051bbd959aeb164042e1ee439a0",
"score": "0.7220119",
"text": "def desc( description )\n @description = description\n end",
"title": ""
},
{
"docid": "9da571d84aa61b52c85192f57fb5231f",
"score": "0.71924126",
"text": "def setDescription(description)\n @description = description.to_s\n end",
"title": ""
},
{
"docid": "3a930f3ec8ac358b3089d80785decdc6",
"score": "0.7117649",
"text": "def description(value, target=nil)\n attribute(:description, value, {}, target || [])\n end",
"title": ""
},
{
"docid": "3a8fa1e10cd8d7c078a06b5c0c78d407",
"score": "0.70096797",
"text": "def description=(desc)\n @link.Description = desc\n end",
"title": ""
},
{
"docid": "9c204a72f4c6c2edfc90096df17dde85",
"score": "0.69990385",
"text": "def set_description(desc)\n @result.description = desc\n end",
"title": ""
},
{
"docid": "d096a2ced8221cb22a372b2da4cc156a",
"score": "0.6995281",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "f9bff55776fbe752454821484c05afa1",
"score": "0.6995065",
"text": "def set_Description(value)\n set_input(\"Description\", value)\n end",
"title": ""
},
{
"docid": "ed622e8863a68b921b1afa4e0057a64f",
"score": "0.69814193",
"text": "def description; attributes[:description] || attributes[:desc] end",
"title": ""
},
{
"docid": "776e797ef3426b52de3cf5648b44e24c",
"score": "0.6929062",
"text": "def description=(value)\n super(\"value\" => value)\n end",
"title": ""
},
{
"docid": "776e797ef3426b52de3cf5648b44e24c",
"score": "0.6929062",
"text": "def description=(value)\n super(\"value\" => value)\n end",
"title": ""
},
{
"docid": "633c57f105fc53015c3dcc6658323ed7",
"score": "0.6893665",
"text": "def set_description\n self.description = \"#{self.manufacturer.code} #{self.manufacturer_model}\" unless self.manufacturer.nil?\n end",
"title": ""
},
{
"docid": "79cab3d414e9c253222f5b3a71fd5f0d",
"score": "0.6864718",
"text": "def set_description\n\t\t@description = \"Sales by Rails\"\n\tend",
"title": ""
},
{
"docid": "e53bbc6236ac55f04ca1b85c9df34ffd",
"score": "0.685411",
"text": "def description(str)\n @description = str\n end",
"title": ""
},
{
"docid": "854d0621455d894d1abeeabc1a95dc2f",
"score": "0.6830657",
"text": "def decorate_descrption(metric, dumped_attribute)\n if Hash === dumped_attribute && dumped_attribute.key?('description')\n metric['description'] = dumped_attribute['description']\n elsif !metric.key?('description')\n metric['description'] = ''\n end\nend",
"title": ""
},
{
"docid": "fbcbbf552bf67e6b609a69f4eea1db5a",
"score": "0.67796516",
"text": "def set_description(text)\n @description_label.set_text(text)\n if text\n @description_label.set_hidden(false)\n else\n @description_label.set_hidden(true)\n end\n end",
"title": ""
},
{
"docid": "4f6a7b72d932d4d95b5dd02d683239c8",
"score": "0.67434484",
"text": "def description\n attributes.fetch(:description)\n end",
"title": ""
},
{
"docid": "82b39a985495d48fdce9fc0325224e7a",
"score": "0.6730094",
"text": "def describe(description)\n @description = description\n end",
"title": ""
},
{
"docid": "0f16d5a9c858d66f2e3ba11550dec054",
"score": "0.67287385",
"text": "def description=(description)\n if description.to_s.length > 255\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 255.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "7d449e973155ae0bab3c212d5cd7867e",
"score": "0.6728057",
"text": "def desc(description)\n last_options[:description] = description\n end",
"title": ""
},
{
"docid": "af3642d0b67375c25c4b0b57cff702ab",
"score": "0.67060363",
"text": "def set_description(v)\n Saklient::Util::validate_type(v, 'String')\n @m_description = v\n @n_description = true\n return @m_description\n end",
"title": ""
},
{
"docid": "af3642d0b67375c25c4b0b57cff702ab",
"score": "0.67060363",
"text": "def set_description(v)\n Saklient::Util::validate_type(v, 'String')\n @m_description = v\n @n_description = true\n return @m_description\n end",
"title": ""
},
{
"docid": "badd9fd443c4606a052211d5f9c8068f",
"score": "0.6695524",
"text": "def description=(description)\n if description.nil?\n fail ArgumentError, \"description cannot be nil\"\n end\n\n if description.to_s.length > 100\n fail ArgumentError, \"invalid value for 'description', the character length must be smaller than or equal to 100.\"\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "d85e0a70c3b0d30dc853e45155c450a3",
"score": "0.6693845",
"text": "def description\n @attributes[:description]\n end",
"title": ""
},
{
"docid": "03d93ae357baa04af897677c41c4fdd1",
"score": "0.66909164",
"text": "def desc(name, description)\n commands[name].description = description\n end",
"title": ""
},
{
"docid": "d5efd313ad02808098d01be26b2a30b8",
"score": "0.66771865",
"text": "def description=(new_desc)\n @options[:connection].put(\"/namespaces/#{path}\", :payload => {:description => new_desc})\n @options[:description] = new_desc\n end",
"title": ""
},
{
"docid": "52be8ba7d23733a08e48efca2b708002",
"score": "0.6667085",
"text": "def description=(value)\n start = Time.now\n debug \"Updating description on device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n value,\n resource[:properties],\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"title": ""
},
{
"docid": "265cf26df90a55437db939f574faf660",
"score": "0.6658621",
"text": "def description(desc = nil)\n @description = desc if desc\n @description\n end",
"title": ""
},
{
"docid": "4b8a090ddfff55071f35c4c516db5667",
"score": "0.66442204",
"text": "def description(s)\n command.description = s\n end",
"title": ""
},
{
"docid": "05c97581665c495f2020981e4df4b5ab",
"score": "0.663726",
"text": "def description=(str)\n @description = str.strip.split(\"\\n\").map { |s| \" #{s.rstrip}\\n\" }\n end",
"title": ""
},
{
"docid": "101e804c20439e07d3828105acf0c3c5",
"score": "0.662797",
"text": "def description d\n @description = d\n end",
"title": ""
},
{
"docid": "762a0bc47a9654b8b1ca9ff766e90f50",
"score": "0.6619688",
"text": "def device_description=(value)\n @device_description = value\n end",
"title": ""
},
{
"docid": "cfbf44b48ebe0412cebba0a7567ce20a",
"score": "0.661337",
"text": "def description(arg=nil)\n @description = arg if arg\n @description\n end",
"title": ""
},
{
"docid": "fb5178d42d12573eb52ce204226dd7b5",
"score": "0.6603189",
"text": "def description=(description)\n\n if !description.nil? && description.to_s.length > 100\n fail ArgumentError, \"invalid value for 'description', the character length must be smaller than or equal to 100.\"\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "8f64948a87a1800a22f9ecc7c23f1199",
"score": "0.6594388",
"text": "def set_description(name, opts = {})\n commands = command_builder('description', opts)\n configure_interface(name, commands)\n end",
"title": ""
},
{
"docid": "f36575f3fcba888988a712ad920bc18a",
"score": "0.6590877",
"text": "def description= new_description\n @gapi.update! description: new_description\n end",
"title": ""
},
{
"docid": "30dfb617da22c29748cd23eb0ae4dec3",
"score": "0.65803736",
"text": "def impact_description=(value)\n @impact_description = value\n end",
"title": ""
},
{
"docid": "ea2bbb8a30a1d3e414fa4fc2f575df35",
"score": "0.6570832",
"text": "def description\n text_attribute('description')\n end",
"title": ""
},
{
"docid": "ee02f5295325451a65dc90a0bba653c6",
"score": "0.65644926",
"text": "def description(description)\n @controller.description = description\n end",
"title": ""
},
{
"docid": "9620e2478b7c188c3b83086ceb2546a2",
"score": "0.6561903",
"text": "def description=(description)\n if !description.nil? && description.to_s.length > 255\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 255.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "9620e2478b7c188c3b83086ceb2546a2",
"score": "0.6561903",
"text": "def description=(description)\n if !description.nil? && description.to_s.length > 255\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 255.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "9620e2478b7c188c3b83086ceb2546a2",
"score": "0.6561903",
"text": "def description=(description)\n if !description.nil? && description.to_s.length > 255\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 255.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "9620e2478b7c188c3b83086ceb2546a2",
"score": "0.6561903",
"text": "def description=(description)\n if !description.nil? && description.to_s.length > 255\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 255.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "0afaf2b0ec5ff5c27b9ab51456a7fc74",
"score": "0.6540195",
"text": "def description\n @description = \"Espresso\"\n end",
"title": ""
},
{
"docid": "82c2f2c3a09ba1d17956c68f9b3993e1",
"score": "0.65354496",
"text": "def description=(description)\n if description.nil?\n fail ArgumentError, 'description cannot be nil'\n end\n\n if description.to_s.length > 4096\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 4096.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "e70eec7f24fff6ed86a56d39fd8e6805",
"score": "0.6524468",
"text": "def description!\n read_attribute :description\n end",
"title": ""
},
{
"docid": "44c2a76822bebdb4a8c19449e6a6b976",
"score": "0.65073526",
"text": "def description= new_description\n patch_gapi! description: new_description\n end",
"title": ""
},
{
"docid": "d0a90f25696538010fee07228c96a447",
"score": "0.64843947",
"text": "def description=(description)\n if !description.nil? && description.to_s.length < 0\n fail ArgumentError, 'invalid value for \"description\", the character length must be great than or equal to 0.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "780c2c6f8407efa94d3aa604de3570ce",
"score": "0.64802283",
"text": "def description=(description)\n if !description.nil? && description.to_s.length > 512\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 512.'\n end\n\n @description = description\n end",
"title": ""
},
{
"docid": "3d2a4da0e7cd518e62ea01a75531e620",
"score": "0.6474246",
"text": "def description\n if description_attribute = read_attribute(:description)\n description_attribute\n elsif self.properties && self.properties['description'].present?\n self.properties['description']\n else\n default_description\n end\n end",
"title": ""
},
{
"docid": "b1151466d6299fb7a55e69978b42cfe6",
"score": "0.6456479",
"text": "def description=(description)\n if !description.nil? && description.to_s.length > 1024\n fail ArgumentError, 'invalid value for \"description\", the character length must be smaller than or equal to 1024.'\n end\n\n @description = description\n end",
"title": ""
}
] |
197b4878b13def9979cebc7282adbe7a
|
GET /stories/1 GET /stories/1.json
|
[
{
"docid": "324a0b9adca9758fd6d2f9dfc08ec847",
"score": "0.0",
"text": "def show\n @story = Story.includes(:comments).find(params[:id])\n @comment = Comment.new\n impressionist(@story)\n end",
"title": ""
}
] |
[
{
"docid": "af636de7576febeb1bbea645dd57184a",
"score": "0.77517796",
"text": "def show\n story = Story.find(params[:id])\n render json: story\n end",
"title": ""
},
{
"docid": "d630364f3ee942ebb865792b16d07ae9",
"score": "0.7708573",
"text": "def index\n @stories = Story.all\n render json: @stories, root: false\n end",
"title": ""
},
{
"docid": "b16d444884936504a4d0beec8eef3ab9",
"score": "0.7525053",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "97b9e7f293464b35723e23ddbba0fbaf",
"score": "0.7514882",
"text": "def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end",
"title": ""
},
{
"docid": "c67c8e680efa118edb860235cda4df9f",
"score": "0.7487153",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "c67c8e680efa118edb860235cda4df9f",
"score": "0.7486738",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "c67c8e680efa118edb860235cda4df9f",
"score": "0.7486738",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "ba9f9d0a7ab95240ba64cb6a7a86888b",
"score": "0.746419",
"text": "def show\n @stories = Story.find_by(id: params[:id])\n \n end",
"title": ""
},
{
"docid": "fc8e337a6c92a5df69a115ba4d6f175b",
"score": "0.7455591",
"text": "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end",
"title": ""
},
{
"docid": "fc8e337a6c92a5df69a115ba4d6f175b",
"score": "0.7455591",
"text": "def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.736725",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.736725",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.736725",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.736725",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.736725",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.736725",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "0ab2ab45cdabbc565971cd78f3c76586",
"score": "0.7365923",
"text": "def index\n @stories = Story.all\n end",
"title": ""
},
{
"docid": "68c1fba4de44e9a824e8f06498496e60",
"score": "0.7325072",
"text": "def get_stories\n api_url = \"#{CONFIG[:api_location]}/projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"title": ""
},
{
"docid": "55a0ad00a202d3ff697da5a57b1f77cd",
"score": "0.73073804",
"text": "def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end",
"title": ""
},
{
"docid": "9e56a5cbdde57390913e3f0d9c53dbce",
"score": "0.7269669",
"text": "def index\n render json: Story.all\n end",
"title": ""
},
{
"docid": "372b3f189cf5b3e32ef80f9c0ea781ec",
"score": "0.7202681",
"text": "def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end",
"title": ""
},
{
"docid": "8285e733c4240bc2d43713cf73ba6e1e",
"score": "0.71863514",
"text": "def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"title": ""
},
{
"docid": "5bebce043e967dcb8179a6c5dd327a8f",
"score": "0.71552104",
"text": "def show\n @story = Story.find(params[:id])\n\t\t@title = \"Newsy | \" + @story.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "1e5373f8332c8fcb0926d4c7b5991082",
"score": "0.71204364",
"text": "def fresh_stories\n get_data(\"stories/fresh\")\n end",
"title": ""
},
{
"docid": "d45768da5d9568fb0e95edca3b878309",
"score": "0.70868814",
"text": "def show\n render json: @story, root: false\n end",
"title": ""
},
{
"docid": "b97171cafa33c13a17f8dab1b8e53116",
"score": "0.7076273",
"text": "def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"title": ""
},
{
"docid": "f840f2f6fc628dd404b6d87751003261",
"score": "0.7075205",
"text": "def index\n @stories = Story.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"title": ""
},
{
"docid": "fceb68a083f4e6123e2f4922f85aa168",
"score": "0.70648074",
"text": "def show\n render status: 200, json: UserTrainingStory.find(params[:id])\n end",
"title": ""
},
{
"docid": "375f6b766a89ac375ddd4ac886f4e1d5",
"score": "0.70577556",
"text": "def get_stories\n api_url = \"#{CONFIG[:api_url]}projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| TrackR::Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"title": ""
},
{
"docid": "ef19d0bf46c0adc631b5249f70db9df3",
"score": "0.70238024",
"text": "def show\n @story = Story.find(params[:id])\n end",
"title": ""
},
{
"docid": "ce0c179e98ba874c82f6d56e4244c59f",
"score": "0.7016694",
"text": "def task_stories(id, options = {})\n request(:get, \"tasks/#{id}/stories\", options)\n end",
"title": ""
},
{
"docid": "257ccf542fff24a54a96b414ad807252",
"score": "0.6979465",
"text": "def show\n # params[#id] is form the URL, e.g if /stories/7\n # then params[:id] is 7\n @story = Story.find(params[:id])\n end",
"title": ""
},
{
"docid": "679f2c002564578dfa5d00afd2266610",
"score": "0.69683355",
"text": "def show\n redirect_to sections_story_path(params[:id])\n # @story = Story.find_by_id(params[:id])\n\n # respond_to do |format|\n # format.html #show.html.erb\n # format.json { render json: @story }\n # end\n end",
"title": ""
},
{
"docid": "0329cd8ecf0c1df22b12ee0cf86f5050",
"score": "0.6963905",
"text": "def stories\n @stories ||= Stories.new(data)\n end",
"title": ""
},
{
"docid": "d7f5a6db9fcf54ae69066c809895af8a",
"score": "0.6958875",
"text": "def show\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_status }\n end\n end",
"title": ""
},
{
"docid": "e9321deffcf1e71b789b28e4e3c952ff",
"score": "0.6955792",
"text": "def stories ; @stories || get_stories ; end",
"title": ""
},
{
"docid": "e9321deffcf1e71b789b28e4e3c952ff",
"score": "0.6955792",
"text": "def stories ; @stories || get_stories ; end",
"title": ""
},
{
"docid": "c88462c5d3425beede9b0b55a3045ebf",
"score": "0.6948531",
"text": "def show\n\n\t# params[:id] is the number in the url we are looking for\n\n\t\t# @story = Story.find(params[:id])\n\n\tend",
"title": ""
},
{
"docid": "68991c6a8b921c503834ae9a9fcb4f5b",
"score": "0.6944335",
"text": "def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end",
"title": ""
},
{
"docid": "68991c6a8b921c503834ae9a9fcb4f5b",
"score": "0.6944335",
"text": "def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end",
"title": ""
},
{
"docid": "35979b28fb74deda659b75a8ee99fe31",
"score": "0.6937768",
"text": "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end",
"title": ""
},
{
"docid": "ee40fe446caf46875819e2934a6fe80c",
"score": "0.69246197",
"text": "def show\n @story = Story.all(:include => :role, :conditions => {:stories => { :id => params[:id] } })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "4d6b2dbb42c1099de657da179736bf49",
"score": "0.6873154",
"text": "def show\n\t\t# params[:id] is the number in the url that we are looking for\n\t\t# @story = Story.find(params[:id])\n\t\t\n\tend",
"title": ""
},
{
"docid": "22c9a6139492c5544be50235c0479446",
"score": "0.6866486",
"text": "def show\n\t\t#params[:id] is the number in the url we are looking for\n\t\t#@story = Story.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "1ee80e7a9113607896ae1e9e6614b067",
"score": "0.6837309",
"text": "def show\n @story = Story.find(params[:id])\n\n # Set meta information\n @page_title = @story.title\n @page_description = @story.subtitle\n\n if Arrowhead.is_arrowhead_story? @story\n @arrowhead_stories = Arrowhead.stories\n @i = @arrowhead_stories.find_index(@story)\n if @i\n @prev = @i > 0 ? @i - 1 : nil \n @next = @i < @arrowhead_stories.length - 1 ? @i + 1 : nil\n end\n set_meta_tags :og => {\n :title => @story.title,\n :description => @story.subtitle,\n :type => 'article',\n :url => url_for(@story),\n :image => URI.join(root_url, view_context.image_path('arrowhead_ogimage.jpg'))\n }\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story.to_json(:include => { :scenes => { :include => :paragraphs }}) }\n end\n end",
"title": ""
},
{
"docid": "9ba2dfb0a6caa8b4dbcdb9948635bc5d",
"score": "0.6836953",
"text": "def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end",
"title": ""
},
{
"docid": "e1d1904c414c2c02313d45c5e93f76a0",
"score": "0.68213576",
"text": "def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"title": ""
},
{
"docid": "34682836b448c3326611f1a820b9f736",
"score": "0.6771517",
"text": "def index\n #@usemap = true\n\n @stories = Story.editable_user(current_user.id) \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @stories }\n end\n end",
"title": ""
},
{
"docid": "6bca82e1a9741b9efad8032a8121726e",
"score": "0.67672443",
"text": "def index\n @stories = Story(:all, :order => 'value')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"title": ""
},
{
"docid": "a191a9073e82dac81ecdc0f6996df1c7",
"score": "0.6763285",
"text": "def story(story_id)\n Endpoints::Story.new(self).get_story(story_id)\n end",
"title": ""
},
{
"docid": "4516791e52c8329b6caf2b09ddc3d309",
"score": "0.6747532",
"text": "def get_mashable_stories\n\n\ts = JSON.load(RestClient.get('http://mashable.com/stories.json')) \n\ts[\"hot\"].map do |story|\n\ts = {story: story[\"title\"], category: story[\"channel\"]}\n\tget_upvotes(story)\n\tdisplay_new_story\n\tstory\n\tend\nend",
"title": ""
},
{
"docid": "9268a0496778d88babb1e4af44499d12",
"score": "0.6744951",
"text": "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "0f2ea22c0ee87cc69ed4b5f6de206d02",
"score": "0.67191637",
"text": "def show\n @storyboard = Storyboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storyboard }\n end\n end",
"title": ""
},
{
"docid": "eb70b00e8dc53a022f0579865b5aebee",
"score": "0.6717403",
"text": "def retrieve\n sort = 'created_at DESC'\n\n case params[:sort]\n when 'recent'\n sort = 'created_at DESC'\n when 'popular'\n sort = 'views DESC, likes DESC'\n else\n\n end\n\n stories = Story.where(\"LOWER(name) LIKE ?\", '%' + params[:query].downcase + '%').order(sort).offset(params[:offset]).limit(params[:limit])\n\n render json: stories\n end",
"title": ""
},
{
"docid": "6d7aa9b33bac06315f89d7af557a2f88",
"score": "0.6710239",
"text": "def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"title": ""
},
{
"docid": "46e3c1d3daa49e60c97bf7593aee96e7",
"score": "0.6703801",
"text": "def index\n @stories = Story.all\n authorize! :index, @story\n end",
"title": ""
},
{
"docid": "62d324c0b539d9e512d6a6c710a0f52d",
"score": "0.6701244",
"text": "def index\n @user_stories = UserStory.all\n end",
"title": ""
},
{
"docid": "1ed4bfa48ebab0d2892c42c6dddedbb5",
"score": "0.67001843",
"text": "def show\n @story = Story.find(params[:id]) # place dans l'objet @story accessible par la vue les infos de la story[id]\n end",
"title": ""
},
{
"docid": "71bca47aa1b8fc04cd2c4cce93683ab3",
"score": "0.66776955",
"text": "def find_story\n @story = Story.find(params[:id])\n end",
"title": ""
},
{
"docid": "e9d1ae43ca90197d4f9af0ccb2ca82f0",
"score": "0.6664024",
"text": "def show\n\t\t# @story = Story.find( params[:id] )\n\n\tend",
"title": ""
},
{
"docid": "53c9c7b54c2fdd2c2cd2a6ca58e74aa5",
"score": "0.6644793",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"title": ""
},
{
"docid": "53c9c7b54c2fdd2c2cd2a6ca58e74aa5",
"score": "0.6644793",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"title": ""
},
{
"docid": "53c9c7b54c2fdd2c2cd2a6ca58e74aa5",
"score": "0.6644793",
"text": "def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"title": ""
},
{
"docid": "4991033156433d1ef0f69c54b3007443",
"score": "0.6632936",
"text": "def show\n @story_choice = StoryChoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story_choice }\n end\n end",
"title": ""
},
{
"docid": "1b16991caba4c67ada15a9b68b091bd6",
"score": "0.6632478",
"text": "def stories(options = {})\n stories = if options[:id]\n [@project.stories(options[:id]).get.payload]\n else\n @project.stories.get(params: options)\n end\n stories = stories.map { |s| Story.new(s, @project) }\n stories.select(&:estimated)\n end",
"title": ""
},
{
"docid": "6d74f31966daaf85eb28b47be4c333b6",
"score": "0.66307855",
"text": "def index\n @project_stories = ProjectStory.all\n end",
"title": ""
},
{
"docid": "f9de3acf704c5dc1be74e72fc01e8120",
"score": "0.66167146",
"text": "def stories() @stories = Stories.new end",
"title": ""
},
{
"docid": "e5817f620ca3a5cb4353fd585be1fe5e",
"score": "0.6616528",
"text": "def project_story(project_id, story_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}/story/#{story_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"title": ""
},
{
"docid": "cc2303cda922e52e177c4e4126a1b8f8",
"score": "0.66140276",
"text": "def index\n page = 1\n page = params[:page] if params[:page]\n @stories = Story.paginate :page => page, :order => 'created_at DESC', :per_page => 5\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"title": ""
},
{
"docid": "418e5c3d0e76b0fcce3a632e81ae43be",
"score": "0.6605247",
"text": "def list_stories(opts = {})\n data, _status_code, _headers = list_stories_with_http_info(opts)\n data\n end",
"title": ""
},
{
"docid": "3beea857aadf6a0ad06e75c12b2e63ba",
"score": "0.66026956",
"text": "def index\n @stories = Story.where(user_id: current_user.id)\n end",
"title": ""
},
{
"docid": "49fa6cb52b62744f99726d50a376bcd5",
"score": "0.65986204",
"text": "def show\n @story = Story.find(params[:id])\n @stat = Status.where(:id => @story.status_id).first.descripcion\n @criterios = Criterio.where(:story_id => @story.id)\n @tasks = Task.where(:story_id => @story.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n format.json { render json: @criterios }\n format.json { render json: @tasks }\n end\n end",
"title": ""
},
{
"docid": "b9d6b0508bdbc189162fffde1de20c64",
"score": "0.65951455",
"text": "def find_story\n @story = Story.find(params[:id])\n end",
"title": ""
},
{
"docid": "c5413662fde90830860e67851822c4f4",
"score": "0.6592759",
"text": "def find_story\n\n\t\t@story = Story.find(params[:id])\n\n\n\n\n\tend",
"title": ""
},
{
"docid": "c14ee0343608d8ed12cfe5a752afa4c1",
"score": "0.6574684",
"text": "def find_story\n\t\t@story = Story.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "367954cb8935f922829080dc23d978eb",
"score": "0.65610456",
"text": "def retrieve_story(uid)\n response = get(\"/api/v1/stories/#{uid}\")\n Trubl::Story.new.from_response(response)\n end",
"title": ""
},
{
"docid": "06f12173c54160fc7049a50d6f990a36",
"score": "0.65485275",
"text": "def find_story\n\n\t\t\t@story = Story.find(params[:id])\n\n\tend",
"title": ""
},
{
"docid": "4d9fbfe03e8388c0a3df84c8738f15a1",
"score": "0.65473574",
"text": "def show\n @sprint = Sprint.find(params[:id])\n @stat = Status.find(4)\n @stories = Story.where(\"status_id = ?\", @stat.id)\n @examples = @sprint.stories \n @project_id = @examples.first.project_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end",
"title": ""
},
{
"docid": "2266297b146c3fdf7f0ce613f20ce934",
"score": "0.6542817",
"text": "def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"title": ""
},
{
"docid": "1f79863d286a0ebec72854903680bdbd",
"score": "0.6537407",
"text": "def find_story\n\t\t@story = Story.find(params[:id])\n\t\t\n\tend",
"title": ""
},
{
"docid": "c1de4196d7641700bac9b72866e27e81",
"score": "0.6537166",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "c1de4196d7641700bac9b72866e27e81",
"score": "0.6537166",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "c1de4196d7641700bac9b72866e27e81",
"score": "0.6537166",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "c1de4196d7641700bac9b72866e27e81",
"score": "0.6537166",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"title": ""
},
{
"docid": "9d752173cf695722b6055d3827e36532",
"score": "0.6530321",
"text": "def index\n @stories = Story.order(params[:sort]).page(params[:page]).per(10)\n end",
"title": ""
},
{
"docid": "ab0a58c4d637bcbea479bbc99c8fa5c8",
"score": "0.65249157",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "ab0a58c4d637bcbea479bbc99c8fa5c8",
"score": "0.65249157",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "ab0a58c4d637bcbea479bbc99c8fa5c8",
"score": "0.65249157",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "ab0a58c4d637bcbea479bbc99c8fa5c8",
"score": "0.65249157",
"text": "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"title": ""
},
{
"docid": "5ebd023b62d5c445e887d9d85fa8d9e7",
"score": "0.6505855",
"text": "def history\n @story = Story.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"title": ""
},
{
"docid": "b2ebc9eeddcda7a10f0b3bbcca1e39d0",
"score": "0.6499249",
"text": "def index\n @stories = Story.all.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"title": ""
},
{
"docid": "6d6d1866a59a7e89e7de969b50644397",
"score": "0.6492882",
"text": "def show\n user = User.find(params[:id])\n # render json: {\n # # user.to_json(include: :stories, except: :password_digest)\n # user: user,\n # stories: user.stories,\n # success: true\n # }\n render json: user.to_json(include: :stories, except: :password_digest)\n end",
"title": ""
},
{
"docid": "e8d953fec98edd38fa7e1373d4461ad3",
"score": "0.6491131",
"text": "def green_stories\n get_data(\"stories/green\")\n end",
"title": ""
},
{
"docid": "a54bc81fb509e8386f1210104b0c4e40",
"score": "0.6489515",
"text": "def index\n @stories = Story.scoped\n\n @stories = @stories.where(:user_id => params[:user]) if params[:user].present? \n @stories = @stories.where(:state => params[:state]) if params[:state].present? \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories.all }\n end\n end",
"title": ""
},
{
"docid": "c64d1fb5921df574a74afcd7d763cfdf",
"score": "0.64743114",
"text": "def show\n @storylink = Storylink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storylink }\n end\n end",
"title": ""
},
{
"docid": "fba320700753c857cded32417db29f1f",
"score": "0.64631057",
"text": "def show \n PivotalTracker::Client.token = current_user.setting.pt_api_key\n @project = PivotalTracker::Project.find(params[:id].to_i)\n @stories = @project.stories.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"title": ""
},
{
"docid": "f5cc7fb12f2857bbba77b522e89b921a",
"score": "0.64617264",
"text": "def stories\n @stories.keys.each_with_index.map { |story_name, i| get_story(story_name, i) }\n end",
"title": ""
},
{
"docid": "f37dae2a48e041e2a503c879b5511fae",
"score": "0.6455745",
"text": "def show\n @story_comment = StoryComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_comment }\n end\n end",
"title": ""
},
{
"docid": "14f0315a184b0fd4bf1b2252f0f1a48c",
"score": "0.6407208",
"text": "def index\n @story_pages = StoryPage.all\n end",
"title": ""
},
{
"docid": "6311fe016939e3e29ba7bb4e5675dd13",
"score": "0.6406328",
"text": "def index\n @news_stories = NewsStory.all\n end",
"title": ""
},
{
"docid": "4171b3f230dbbaa9dc6d78d7f8094e29",
"score": "0.6403091",
"text": "def create\n story_params = {\n title: params[:title],\n summary: params[:summary],\n }\n @story = Story.new(story_params)\n\n if @story.save\n # render :show, status: :created, location: @story\n render json: @story\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end",
"title": ""
}
] |
674285ed37f8dbf6903bdf8a0a7c6fd9
|
Lists resources for REST version specified Retrieves the base resources available for the DocuSign REST APIs. You do not need an integrator key to view the REST API versions and resources. Example: lists all of the base resources available in version 2 of the REST API on the DocuSign Demo system. To view descriptions and samples of the service operations for all versions, remove the version number and add /help to the URL. Example: lists the REST API operations on the DocuSign Demo system with XML and JSON request and response samples.
|
[
{
"docid": "d56a28fd75851702612f235336ed5fef",
"score": "0.0",
"text": "def get_resources()\n data, _status_code, _headers = get_resources_with_http_info()\n return data\n end",
"title": ""
}
] |
[
{
"docid": "a85264ba96d8d387fa275da0bc55f432",
"score": "0.73233926",
"text": "def index\n @api_v1_resources = Api::V1::Resource.all\n end",
"title": ""
},
{
"docid": "eaa11dc29cd81c2883828fcb0a2479a0",
"score": "0.6841851",
"text": "def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"title": ""
},
{
"docid": "ab3d23882cb786d5e25311801498aed9",
"score": "0.6583521",
"text": "def index\n @api_versions = ApiVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end",
"title": ""
},
{
"docid": "3881b80a8a308f64961f6f97aaeff7a2",
"score": "0.65636694",
"text": "def versions(resource_uri, format = \"text/turtle\")\n log \"versions for #{resource_uri}\"\n get \"#{resource_uri}/fcr:versions\", format\n end",
"title": ""
},
{
"docid": "cec604087a4f74d66bb34f0e4f375bb4",
"score": "0.63749546",
"text": "def index\n @api_versions = ApiVersion.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @api_versions }\n end\n end",
"title": ""
},
{
"docid": "dfb29174dc0b1f550f8145ad5be20498",
"score": "0.6346101",
"text": "def index\n @rest_apis = RestApi.all\n end",
"title": ""
},
{
"docid": "e46f752299e4f4d22d0b1fc2a8c6245d",
"score": "0.62826425",
"text": "def index\n @admin_versions = Admin::Version.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_versions }\n end\n end",
"title": ""
},
{
"docid": "2cbd9ded6ceddccb308336ccee504aa8",
"score": "0.622065",
"text": "def versions\n JSON.parse(RestClient.get(\"#{VERSION_URL}/.json\", self.default_headers))[\"versions\"].collect { |v| v[\"id\"] }.uniq\n end",
"title": ""
},
{
"docid": "c271cb733ae66ff5aad0f33384b825b0",
"score": "0.62037486",
"text": "def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"title": ""
},
{
"docid": "30ac9e9d8ec4ab7f3d2a421b5ed39666",
"score": "0.61555636",
"text": "def index\n @versions = @application.versions.all\n respond_to do |format|\n format.html\n format.json { render json: VersionsDatatable.new(view_context) }\n end\n end",
"title": ""
},
{
"docid": "6f603ca98c47e96886b6b14a9e9c0e15",
"score": "0.60981923",
"text": "def list\n Requests::ListAppLocations.new.\n send_to_api(:get, endpoint_path(:v14))\n end",
"title": ""
},
{
"docid": "814de68a0e69ffb22e0c9076b9595371",
"score": "0.60835946",
"text": "def index(**params)\n params.stringify_keys!\n path = nest_path_within_parent(plural_resource_path, params)\n api_request(:get, path, params: params)\n end",
"title": ""
},
{
"docid": "a685281193e60912d9e043ee9b21ea79",
"score": "0.60797024",
"text": "def index\n @versions = Version.all\n end",
"title": ""
},
{
"docid": "208cbdd57e263d6d82d97bd42c9bd305",
"score": "0.6011778",
"text": "def index\n build_resource({})\n respond_with self.resource\n end",
"title": ""
},
{
"docid": "a835a5877a9c26c2ec07ead74d25f0ac",
"score": "0.6006854",
"text": "def index\n\t\t# Check for optional limit parameter.\n\t\tif params[:limit].nil?\n\t\t\tparams[:limit] = params[:default][:limit]\n\t\tend\n\n\t\t# GET /api/v1/tags\n\t\t@tags = Tag.paginate(:page => params[:page], :per_page => params[:limit])\n\n\t\t# GET api/v1/resources/:resource_id/tags\n\t\t# Return all tags used by a specific resource.\n\t\tif params[:resource_id]\n\t\t\t@tags = Resource.find_by(id: params[:resource_id]).tags.paginate(:page => params[:page])\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5993008602f7ee60f79c164be1978a22",
"score": "0.60054135",
"text": "def api_list_resource(collection: nil, search_fields: nil, paginate: true,\n filtering_params: nil)\n ApiListResource.new(\n collection: collection,\n params: params,\n search_fields: search_fields,\n filtering_params: filtering_params,\n paginate: paginate\n )\n end",
"title": ""
},
{
"docid": "113d6ef64334dc179aebdd9bdf9f4e99",
"score": "0.5994289",
"text": "def index\n @manage_app_versions = Manage::AppVersion.all\n end",
"title": ""
},
{
"docid": "03b3fc89ea15e5f4c28970dfc467add8",
"score": "0.59764445",
"text": "def listversions(project=self.project)\n get('listversions.json', project: project)['versions']\n end",
"title": ""
},
{
"docid": "d353ac7fc6d736c11152f3a7361d3469",
"score": "0.595816",
"text": "def index\n @api_docs_services = api_docs_services.all\n respond_with(@api_docs_services)\n end",
"title": ""
},
{
"docid": "58dd4082204e59da0634658962a2a148",
"score": "0.59521276",
"text": "def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end",
"title": ""
},
{
"docid": "d4fe6f7b833101d0a28bc6f7bb4f66ea",
"score": "0.59200567",
"text": "def all\n api_get(path)\n end",
"title": ""
},
{
"docid": "d6193aef29ac47b3cede522625681caf",
"score": "0.5883866",
"text": "def list(resource,limit=0,params={})\n uri = '/api/' + resource.to_s\n params.merge!({limit: limit.to_s})\n http_get(uri,params)\n end",
"title": ""
},
{
"docid": "3503e75535ccbeba6849aee931bb6e9d",
"score": "0.5882012",
"text": "def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"title": ""
},
{
"docid": "5bdb8e8fb1bdbd632f06be6b9ff7fffc",
"score": "0.58786553",
"text": "def get(api_version, resource, query_parameters = nil, headers = nil)\n make_rest_call(:get, uri_builder(api_version, resource,\n query_parameters), headers)\n end",
"title": ""
},
{
"docid": "86ffd703cfa6339e1f36ee074f47bb38",
"score": "0.58784086",
"text": "def list\n url = prefix + \"list\"\n return response(url)\n end",
"title": ""
},
{
"docid": "308a30ab8ed531445b238dd5e91890e3",
"score": "0.58778137",
"text": "def list\n url = prefix + \"list\"\n return response(url)\n end",
"title": ""
},
{
"docid": "c28fc0203615b78e9a0c56d21009d403",
"score": "0.58727974",
"text": "def all\n describe(resource_uri)\n end",
"title": ""
},
{
"docid": "e8d595b377264d012367ef2e7eac9653",
"score": "0.5863085",
"text": "def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_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: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "25d69fb5241cec7467d8d087ddeb3776",
"score": "0.58609855",
"text": "def index\n @active_page = :versions\n\n respond_to do |format|\n format.html\n format.xml do\n find_versions\n @versions_count = @versions.size\n @versions = @versions[ @page_limit * (@current_page - 1), @page_limit ].to_a\n render :action => :index, :layout => false\n end\n end\n end",
"title": ""
},
{
"docid": "0da0211519726e0174e068bbbbb3de73",
"score": "0.5847989",
"text": "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"title": ""
},
{
"docid": "769a6e0ea07292cb5714e6a90826d9da",
"score": "0.58477867",
"text": "def list\n get('/')\n end",
"title": ""
},
{
"docid": "9501e56ec7a3b762fed7c5a947d308be",
"score": "0.58334595",
"text": "def index\n @resources = Resource.all\n end",
"title": ""
},
{
"docid": "1e5f1c7a9b985ea763fc244940b49c55",
"score": "0.58227855",
"text": "def endpoints_list\n get \"endpoints\"\n end",
"title": ""
},
{
"docid": "9d8da5209ff0e26298b2d9496f3845dd",
"score": "0.58207387",
"text": "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"title": ""
},
{
"docid": "77f8f53690b1e37834177617f2ec2784",
"score": "0.58094466",
"text": "def index\n @api_v1_properties = Api::V1::Property.all\n end",
"title": ""
},
{
"docid": "fd84fb868a3b7bec3ed680951685ec39",
"score": "0.5806108",
"text": "def versions_list_with_http_info(project_id, translation_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VersionsHistoryApi.versions_list ...'\n end\n # verify the required parameter 'project_id' is set\n if @api_client.config.client_side_validation && project_id.nil?\n fail ArgumentError, \"Missing the required parameter 'project_id' when calling VersionsHistoryApi.versions_list\"\n end\n # verify the required parameter 'translation_id' is set\n if @api_client.config.client_side_validation && translation_id.nil?\n fail ArgumentError, \"Missing the required parameter 'translation_id' when calling VersionsHistoryApi.versions_list\"\n end\n # resource path\n local_var_path = '/projects/{project_id}/translations/{translation_id}/versions'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)).sub('{' + 'translation_id' + '}', CGI.escape(translation_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'branch'] = opts[:'branch'] if !opts[:'branch'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<TranslationVersion>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: VersionsHistoryApi#versions_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end",
"title": ""
},
{
"docid": "708a57c5ef74ad9f600e9b69e0a6183e",
"score": "0.5796769",
"text": "def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end",
"title": ""
},
{
"docid": "0e72ebdf1b73c2d09023823e8ceb2113",
"score": "0.5791457",
"text": "def list(abs_url = nil)\n @ro_resource_mixin.list(abs_url)\n end",
"title": ""
},
{
"docid": "9f7cdafb72f64624e118cac4b9ae2fc5",
"score": "0.5787428",
"text": "def list_controller_revision_for_all_namespaces_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppsV1Api.list_controller_revision_for_all_namespaces ...\"\n end\n # resource path\n local_var_path = \"/apis/apps/v1/controllerrevisions\"\n\n # query parameters\n query_params = {}\n query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?\n query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?\n query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?\n query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?\n query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?\n query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?\n query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].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', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BearerToken']\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 => 'V1ControllerRevisionList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppsV1Api#list_controller_revision_for_all_namespaces\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "2436ab94153dcb517be8f624fd0d3da9",
"score": "0.57851183",
"text": "def list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BundleApi.list ...\"\n end\n # resource path\n local_var_path = \"/bundles.json\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basic']\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 => 'BundleList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BundleApi#list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "4762e6a5ca792f42a68d36d5cf9769fc",
"score": "0.57700986",
"text": "def index\n @service_versions = ServiceVersion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_versions }\n end\n end",
"title": ""
},
{
"docid": "7a5a0d842ca53bda2849db8b78d35b29",
"score": "0.5757183",
"text": "def index\n @resources = Resource.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"title": ""
},
{
"docid": "b676af04daf75c5fa141600679343106",
"score": "0.5756375",
"text": "def index\n @resources = Resource.all\n end",
"title": ""
},
{
"docid": "b676af04daf75c5fa141600679343106",
"score": "0.5756375",
"text": "def index\n @resources = Resource.all\n end",
"title": ""
},
{
"docid": "b676af04daf75c5fa141600679343106",
"score": "0.5756375",
"text": "def index\n @resources = Resource.all\n end",
"title": ""
},
{
"docid": "50e35348b4c4ddb15fe94d0a100607e2",
"score": "0.57526183",
"text": "def versions\n Version.all\n end",
"title": ""
},
{
"docid": "550609d0080851cb9bab7732f6c16432",
"score": "0.57492346",
"text": "def get_resources\n routes_doc = get_routes_doc\n resources_names = routes_doc.get_resources_names - resources_black_list\n\n resources_names.map do |resource|\n puts \"Generating #{resource} documentation...\" if trace?\n ResourceDoc.new( resource, routes_doc.get_actions_route_info( resource ) )\n end\n end",
"title": ""
},
{
"docid": "bb53f268526081889bad2ff68cac7522",
"score": "0.57377857",
"text": "def get_resources_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DiagnosticsApi.get_resources ...\"\n end\n # resource path\n local_var_path = \"/v2.1\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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 => 'ResourceInformation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiagnosticsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "366ceb3e65e5188bb6233429b0c28cf8",
"score": "0.5726649",
"text": "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end",
"title": ""
},
{
"docid": "cf2419a4597a540a5d8f5ae20a00ead7",
"score": "0.57178175",
"text": "def resource_list\n self.resources\n end",
"title": ""
},
{
"docid": "ba93d24acbd48b2e8554b77cce0f647d",
"score": "0.5711449",
"text": "def get_kubernetes_version_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_version_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersionResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_version_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_version_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "a63eb567c891510e54c4c39fd6ba3c21",
"score": "0.5696711",
"text": "def set_api_v1_list\n @api_v1_list = Api::V1::List.find(params[:id])\n end",
"title": ""
},
{
"docid": "ba49e152d519f832e3c969bbcdfc1dbd",
"score": "0.5694012",
"text": "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end",
"title": ""
},
{
"docid": "ee7b585c167ad52fbc13a7717f413df0",
"score": "0.5688855",
"text": "def index\n @resources = resource_class.send(:all)\n render json: @resources\n end",
"title": ""
},
{
"docid": "64dc617921fb6ddf5876bcc6a90e91e1",
"score": "0.5688427",
"text": "def index\n self.resources = resource_class.all.paginate(per_page: 15, page: (params[:page] || 1).to_i)\n end",
"title": ""
},
{
"docid": "7fcbd3360d270e3f5424ee06f2554927",
"score": "0.56850266",
"text": "def rest\n @rest ||= Chef::ServerAPI.new(server.root_url, {:api_version => \"0\"})\n end",
"title": ""
},
{
"docid": "6c4a25ec285942da008d2983897a6af0",
"score": "0.56612325",
"text": "def list\n call(:get, path)\n end",
"title": ""
},
{
"docid": "8f44eaab00173937b7ce1ad484f9967a",
"score": "0.56593907",
"text": "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"title": ""
},
{
"docid": "4b2faede3367a26ea3a7c95ba9f11d21",
"score": "0.56528836",
"text": "def list(project_id, options)\n @_client.get(resource_root(project_id), options)\n end",
"title": ""
},
{
"docid": "af0a4f434e90eaa166b3cd8f625a193f",
"score": "0.5652713",
"text": "def get_resource_descriptions(resource)\n available_versions.map do |version|\n get_resource_description(resource, version)\n end.compact\n end",
"title": ""
},
{
"docid": "54ff5624e6a8f6243810476f02476332",
"score": "0.5652165",
"text": "def index\n @api_v1_questions = Api::V1::Question.all\n end",
"title": ""
},
{
"docid": "ac994dfd602dff74b35c893471c72257",
"score": "0.5649597",
"text": "def index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end",
"title": ""
},
{
"docid": "fafc7ea1a9f81c2c32d9c4470a5a398c",
"score": "0.56392395",
"text": "def rest__list\n diff = ret_request_params(:diff)\n project = get_default_project()\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff)\n datatype = :module_diff if diff\n\n rest_ok_response filter_by_namespace(TestModule.list(opts)), datatype: datatype\n end",
"title": ""
},
{
"docid": "e81eeb8c0bd38ab03f1b3dd2aa4052bf",
"score": "0.56387776",
"text": "def index\n @api_v1_posts = Api::V1::Post.all\n end",
"title": ""
},
{
"docid": "5a4080142d45680c32c6745e636233b9",
"score": "0.56346494",
"text": "def list(resource_group, options = {})\n url = build_url(resource_group, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end",
"title": ""
},
{
"docid": "3eab99eafbfe848c74694189af66c567",
"score": "0.5627767",
"text": "def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"title": ""
},
{
"docid": "6ce2dace6c29147982f4065fdc0b584b",
"score": "0.56164414",
"text": "def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"title": ""
},
{
"docid": "356861a05140e29bd2a08502447293f7",
"score": "0.5613988",
"text": "def list_resources(options)\n #debug \"options = \" + options.inspect\n body, format = parse_body(options)\n params = body[:options]\n #debug \"Body & Format = \", opts.inspect + \", \" + format.inspect\n\n debug 'ListResources: Options: ', params.inspect\n\n only_available = params[:only_available]\n slice_urn = params[:slice_urn]\n\n authorizer = options[:req].session[:authorizer]\n # debug \"!!!authorizer = \" + authorizer.inspect\n\n debug \"!!!USER = \" + authorizer.user.inspect\n debug \"!!!ACCOUNT = \" + authorizer.account.inspect\n # debug \"!!!ACCOUNT_URN = \" + authorizer.account[:urn]\n # debug \"!!!ACCOUNT = \" + authorizer.user.accounts.first.inspect\n\n if slice_urn\n @return_struct[:code][:geni_code] = 4 # Bad Version\n @return_struct[:output] = \"Geni version 3 no longer supports arguement 'geni_slice_urn' for list resources method, please use describe instead.\"\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n else\n resources = @am_manager.find_all_samant_leases(nil, $acceptable_lease_states, authorizer)\n comps = @am_manager.find_all_samant_components_for_account(nil, authorizer)\n # child nodes should not be included in listresources\n comps.delete_if {|c| ((c.nil?)||(c.to_uri.to_s.include?\"/leased\"))}\n if only_available\n debug \"only_available selected\"\n # TODO maybe delete also interfaces and locations as well\n comps.delete_if {|c| (c.kind_of?SAMANT::Uxv) && c.hasResourceStatus && (c.hasResourceStatus.to_uri == SAMANT::BOOKED.to_uri) }\n end\n resources.concat(comps)\n #debug \"the resources: \" + resources.inspect\n # TODO uncomment to obtain rspeck, commented out because it's very time-wasting\n #used_for_side_effect = OMF::SFA::AM::Rest::ResourceHandler.rspecker(resources, :Offering) # -> creates the advertisement rspec file inside /ready4translation (less detailed, sfa enabled)\n start = Time.now\n debug \"START CREATING JSON\"\n res = OMF::SFA::AM::Rest::ResourceHandler.omn_response_json(resources, options) # -> returns the json formatted results (more detailed, omn enriched)\n debug \"END CREATING JSON. total time = \" + (Time.now-start).to_s\n end\n\n @return_struct[:code][:geni_code] = 0\n @return_struct[:value] = res\n @return_struct[:output] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n rescue OMF::SFA::AM::InsufficientPrivilegesException => e\n @return_struct[:code][:geni_code] = 3\n @return_struct[:output] = e.to_s\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n end",
"title": ""
},
{
"docid": "b4d31af56212fb51442b2255b9c88103",
"score": "0.5612321",
"text": "def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end",
"title": ""
},
{
"docid": "3a3de860ec699a3aede3bcc9ed7f01cf",
"score": "0.56008685",
"text": "def list_endpoints\n render json: @endpoints, status: 200\n end",
"title": ""
},
{
"docid": "962f51288901d20b504c83c7b10f8804",
"score": "0.55872667",
"text": "def result_list\n supported = ['2.0.3', '3.0']\n unless supported.include? params[:version] then\n raise ActionController::RoutingError.new('Not Found')\n end\n\t\t\n @version = params[:version]\n @event = Event.find(params[:id])\n respond_to do |format|\n format.xml { render :layout => false }\n end\n end",
"title": ""
},
{
"docid": "f628d230534ea31ce01d5f7b1d9b6133",
"score": "0.55839545",
"text": "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end",
"title": ""
},
{
"docid": "02e49e571c780dc5f60ff93336570520",
"score": "0.5582864",
"text": "def index\n @current_api_v1_user = current_api_v1_user\n @api_v1_properties = Property.all\n end",
"title": ""
},
{
"docid": "bfde240441b3907145e9474ab3d94888",
"score": "0.55782866",
"text": "def index\n @api_v1_accounts = Api::V1::Account.all\n end",
"title": ""
},
{
"docid": "9a524b9d91ec71e09efd1fed677beebe",
"score": "0.5569011",
"text": "def list_all(options = {})\n url = build_url(nil, options)\n response = rest_get(url)\n\n if options[:all]\n get_all_results(response)\n else\n Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Resource)\n end\n end",
"title": ""
},
{
"docid": "765eaf3771d1036dc77addc858496e0b",
"score": "0.5561141",
"text": "def index()\n method_url = @resource\n return self.get(method_url)\n end",
"title": ""
},
{
"docid": "dd5a521d960e3460371f73b43329d3b3",
"score": "0.5552695",
"text": "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"title": ""
},
{
"docid": "b2ea03ba07f827d766139d6a0c50a683",
"score": "0.5547921",
"text": "def index\n @api_v1_shopping_lists = ShoppingList.all\n end",
"title": ""
},
{
"docid": "b1ac5d0b2adb1666f9b0f2fb6e0058ab",
"score": "0.5546905",
"text": "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"title": ""
},
{
"docid": "b1ac5d0b2adb1666f9b0f2fb6e0058ab",
"score": "0.5546905",
"text": "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"title": ""
},
{
"docid": "5127b3eea97f5c8baf78ba2ea090bf5e",
"score": "0.5541997",
"text": "def index\n response = VersionResponse.new( BUILD_VERSION )\n render json: response, :status => 200\n end",
"title": ""
},
{
"docid": "468abcc2246ea9daac6bcdc16f6b3cce",
"score": "0.55373776",
"text": "def resources\n @resources\n end",
"title": ""
},
{
"docid": "c7c0146a87703d8500708b19d01531fe",
"score": "0.55283195",
"text": "def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end",
"title": ""
},
{
"docid": "885a50a1172a9cd0656f1f95a0154137",
"score": "0.55093646",
"text": "def base_path\n \"/api/v1\"\n end",
"title": ""
},
{
"docid": "958a3b9beeba36f5aa3bade9483abc57",
"score": "0.5509098",
"text": "def list_all_aos_version_boxes(args = {}) \n get(\"/aosversions.json/aosversionbox\", args)\nend",
"title": ""
},
{
"docid": "a90230da370e00964238a76a1893f2b3",
"score": "0.5504558",
"text": "def get_all_versions\n []\n end",
"title": ""
},
{
"docid": "9abed6c4ff426c60f5d75d7c2690f0b1",
"score": "0.5498982",
"text": "def show\n @extension_versions_urls = @extension.sorted_extension_versions.map do |version|\n api_v1_extension_version_url(@extension, version)\n end\n end",
"title": ""
},
{
"docid": "932e665bc9809c5b45a067a7a974287d",
"score": "0.54863",
"text": "def index\n @resources = @project.resources.all\n end",
"title": ""
},
{
"docid": "462c5864a51d69131627fda4fd5f9850",
"score": "0.548038",
"text": "def versions\n # TODO make this a collection proxy, only loading the first, then the\n # rest as needed during iteration (possibly in chunks)\n return nil if @archived\n @versions ||= [self].concat(CloudKit.storage_adapter.query { |q|\n q.add_condition('resource_reference', :eql, @resource_reference)\n q.add_condition('archived', :eql, 'true')\n }.reverse.map { |hash| self.class.build_from_hash(hash) })\n end",
"title": ""
},
{
"docid": "c5e2787e9579dee3f3608eefce5650a7",
"score": "0.5477107",
"text": "def all\n setup_request \"#{@@resource_url}s\"\n end",
"title": ""
},
{
"docid": "e135f4f5dc60e11ed382ad3b450c3d48",
"score": "0.54768884",
"text": "def lists\n Resources::Lists.new(self)\n end",
"title": ""
},
{
"docid": "cc0ffa7b1fd4c7dd56f24e871baea2ef",
"score": "0.54741794",
"text": "def get_version_admin_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.get_version_admin ...'\n end\n # resource path\n local_var_path = '/api/kratos/admin/version'\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] || 'InlineResponse2001'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryToken']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.get_version_admin\",\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#get_version_admin\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "e68024345c9d2eb6d0a01ffecc99dda8",
"score": "0.5471638",
"text": "def rest_endpoint; end",
"title": ""
},
{
"docid": "8fc03a82fe35b059721b6d5b75c08d5d",
"score": "0.5469018",
"text": "def list(group = @resource_group)\n set_default_subscription\n\n if group\n @api_version = '2014-06-01'\n url = build_url(@subscription_id, group)\n JSON.parse(rest_get(url))['value'].first\n else\n arr = []\n thr = []\n\n resource_groups.each do |group|\n @api_version = '2014-06-01' # Must be set after resource_groups call\n url = build_url(@subscription_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n\n thr.each{ |t| t.join }\n\n arr\n end\n end",
"title": ""
},
{
"docid": "9226c89b91420490b183d6f933ae2d16",
"score": "0.54626584",
"text": "def index \n @clients = ApiClient.all\n end",
"title": ""
},
{
"docid": "09d268c6bd81b7b7abfe9471dc67538f",
"score": "0.54593265",
"text": "def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end",
"title": ""
},
{
"docid": "8999b9e40f3f457f50cf61e22cd70782",
"score": "0.5459153",
"text": "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"title": ""
},
{
"docid": "1fa4775250626ebde9d930995840c851",
"score": "0.5455178",
"text": "def show\n @document = Document.where(:id => params[:id])\n render :json => @document, :include => [:versions]\n end",
"title": ""
},
{
"docid": "19499c847b501cfda14771f3599b3192",
"score": "0.54500514",
"text": "def list_all_tenantcircles_for_a_version_box(args = {}) \n get(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args)\nend",
"title": ""
},
{
"docid": "c8d393f0b546c4def0e2689c8783cfa7",
"score": "0.54492044",
"text": "def resource_routes\n Hash(\n self: api_v1_boot_path,\n auth: api_v1_auth_path,\n users: api_v1_users_path,\n charges: api_v1_charges_path(':user_id'),\n purchases: api_v1_purchases_path(':user_id'),\n credits: api_v1_credits_path(':user_id'),\n comps: api_v1_comps_path(':user_id')\n )\n end",
"title": ""
},
{
"docid": "84768aac7333f69b95c886f21e21f02f",
"score": "0.54465204",
"text": "def rest__list\n Log.info(MessageQueue.object_id)\n diff = ret_request_params(:diff)\n project = get_default_project()\n namespace = ret_request_params(:module_namespace)\n datatype = :module\n remote_repo_base = ret_remote_repo_base()\n\n opts = Opts.new(project_idh: project.id_handle())\n if detail = ret_request_params(:detail_to_include)\n opts.merge!(detail_to_include: detail.map(&:to_sym))\n end\n\n opts.merge!(remote_repo_base: remote_repo_base, diff: diff, namespace: namespace)\n datatype = :module_diff if diff\n\n # rest_ok_response filter_by_namespace(ComponentModule.list(opts)), :datatype => datatype\n rest_ok_response ComponentModule.list(opts), datatype: datatype\n end",
"title": ""
}
] |
6973eea82c84ceaa3162e5f0a11a325e
|
Metodo par inserta en el diccionario los nodos y su lista de adyacencias como 'clave'/'valor' respectivamente
|
[
{
"docid": "4354181a9bb31720d3a396a6d140102a",
"score": "0.6266126",
"text": "def insert(clave, valor)\r\n @grafo[clave] = valor\r\n end",
"title": ""
}
] |
[
{
"docid": "2467f91efa95bbded0d5cfb1b4061077",
"score": "0.7297009",
"text": "def insertar_varios(nodos)\n \n nodos.each do |nodoo|\n \n insertar(nodoo)\n \n end\n \n end",
"title": ""
},
{
"docid": "3c3081a9941ca2022fd345b098e3a04c",
"score": "0.67136014",
"text": "def insertar_por_cola(value)\n\t\tnodo=Node.new(value,nil,nil)\n if(@tail==nil)\n @tail=nodo\n @head=nodo\n else\n nodo.prev=@tail\n @tail.nest=nodo\n @tail=nodo\n\t\t\tnodo.nest=nil\n end\n\n\tend",
"title": ""
},
{
"docid": "bbed4e82f3d64cd0c9da07e15ee8d68e",
"score": "0.65927935",
"text": "def insertar_lista_principio(referencia)\n if @principio != nil && @principio.siguiente != nil\n n = @principio\n @principio = Nodo.new(referencia, n, nil)\n n.anterior = @principio\n elsif @principio != nil\n n = @principio\n @principio = Nodo.new(referencia, n, nil)\n n.anterior = @principio\n @final = n\n else\n @principio = Nodo.new(referencia, nil, nil)\n @final = @principio\n end\n end",
"title": ""
},
{
"docid": "abc5064080756217ad0f0a0cfa4f61e0",
"score": "0.6372417",
"text": "def insertar_por_cabeza(value)\n\t\tnodo=Node.new(value,nil,nil)\n\t\tif(@head==nil)\n\t\t\t@tail=nodo\n\t\t\t@head=nodo\n\t\telse\n\t\t\tnodo.nest=@head\n\t\t\t@head.prev=nodo\n\t\t\t@head=nodo\n\t\t\tnodo.prev=nil\n\t\tend\n\n\tend",
"title": ""
},
{
"docid": "227134f9d20792c5146ef9abceec033f",
"score": "0.6301467",
"text": "def insertar_lista_final(referencia)\n if @final != nil\n @final = Nodo.new(referencia, nil, @final)\n n = @final.anterior\n n.siguiente = @final\n else\n @principio = Nodo.new(referencia, nil, nil)\n @final = @principio\n end\n end",
"title": ""
},
{
"docid": "1ab7be5768f48b39bbc16373bf9e1b56",
"score": "0.5861747",
"text": "def insertar_elemento(nodo)\n \n @nodo = Nodo_.new(nil, nodo, nil)\n \n if @tail == nil\n @head = @nodo\n @tail = @nodo\n #@nodo\n else\n @nodo.next = @head\n @head.prev = @nodo\n @head = @nodo\n #@nodo\n end\n \n end",
"title": ""
},
{
"docid": "8d038cd01224939bf66f7fd63131c4ea",
"score": "0.57229125",
"text": "def insert_head (value) # Insertar desde la cabeza\n\t nodo=Node.new(value,nil,nil)\n nodo.nest = @head\n @head = nodo # el head ahora apunta a este nodo\n if (@tail == nil)\n @tail = nodo\n end\n nodo.prev = nil\n if (nodo.nest != nil)\n nodo.nest.prev = nodo\n end\n end",
"title": ""
},
{
"docid": "945e9fe41b6006dd152a92ec10a7d73a",
"score": "0.5720859",
"text": "def insert(nodos)\n for i in (0.. nodos.size-1)\n insert_tail(nodos[i])\n end\n end",
"title": ""
},
{
"docid": "32f8956a625b3da27bc38fbe3c8f3edb",
"score": "0.57178026",
"text": "def adyacentes(nodo, analisados)\n adyacentes = []\n @graph[nodo].each do |n|\n adyacentes << n[0] if analisados[n[0]] == false\n end\n adyacentes\n end",
"title": ""
},
{
"docid": "236f97c3cf6da90d84c10aa48106b87d",
"score": "0.5694787",
"text": "def insert_final(*val)\n \n val.each do |nuevo_nodo|\n \n if @tail != nil\n @tail.next = nuevo_nodo\n nuevo_nodo.previous = @tail\n @tail = nuevo_nodo\n else\n @head = @tail = nuevo_nodo\n end\n @num_nodos += 1\n end\n end",
"title": ""
},
{
"docid": "b5327a6b28f960637ab8ad521067d19f",
"score": "0.5630192",
"text": "def add_nodes_r(nodes)\n cnode = self\n nodes.each do |n|\n n = Node.new(n) if n.instance_of?(String)\n x = cnode.find_child_to_update(n) \n if x then\n x.name = n.name\n x.value = n.value\n cnode = x \n else\n cnode << n\n cnode = n\n end\n end\n cnode\n end",
"title": ""
},
{
"docid": "20e4030df0a2d1f128e34f6ec35e8a90",
"score": "0.55995136",
"text": "def insert_values(values, subtree) \n values.each do |val|\n value = REXML::Element.new('value')\n subtree << value\n\n path = REXML::Element.new('path')\n path.add_text(val.path)\n value << path\n\n name = REXML::Element.new('name')\n name.add_text(val.name)\n value << name\n\n data = REXML::Element.new('data')\n\n begin\n cdata = REXML::CData.new(val.data) \n rescue\n p(val)\n end\n\n data << cdata\n value << data\n end\n end",
"title": ""
},
{
"docid": "51db0c866e4b60001147951f9e29c3d0",
"score": "0.55414253",
"text": "def insert_tail (value) # Insertar desde la cola ( este es el que usaremos para practica 7)\n\tnodo=Node.new(value,nil,nil)\n nodo.prev = @tail\n @tail = nodo\n if (@head == nil)\n @head = nodo\n end\n nodo.nest = nil\n if (nodo.prev != nil)\n nodo.prev.nest = nodo\n end\n end",
"title": ""
},
{
"docid": "cbe8d33836cfd76830ea97e6dcdb01c3",
"score": "0.5496419",
"text": "def <<(p)\n raise TypeError, \"Esperada pregunta para inserción\" unless p.is_a? (Pregunta)\n if (@total == 0)\n @cabeza = Nodo.new(p, nil, nil)\n @cola = @cabeza\n else\n @cola.next = Nodo.new(p, nil, @cola)\n @cola = @cola.next\n @cola.value\n end\n @total += 1\n end",
"title": ""
},
{
"docid": "9430c1f7bff1d22279d7267d9f305085",
"score": "0.5454196",
"text": "def insert token, tipo, variable = true\n\n\t\tif variable \n\t\t\tif @tabla.has_key? (token.texto)\n\t\t\t\traise RedefinirError.new(token, self.find(token.texto)[:token], variable)\n\t\t\telse\n\t\t\t\t@tabla[token.texto] = {:token => token, :tipo => tipo, :valor => nil}\n\t\t\tend\n\t\telse\n\t\t\tif @tabla.has_key? (token.idFuncion.nombre.texto)\n\t\t\t\traise RedefinirError.new(token.idFuncion.nombre, self.find(token.idFuncion.nombre.texto)[:instancia].idFuncion.nombre, variable)\t\n\t\t\telse\n\t\t\t\t@tabla[token.idFuncion.nombre.texto] = {:instancia => token, :tipo => tipo}\n\t\t\tend\n\t\tend\t\n\tend",
"title": ""
},
{
"docid": "e3153979e09f88063c8999a4aaf19b46",
"score": "0.54316944",
"text": "def busqueda(g, d, h, nro_nodos, nodos_visitados, nro_nodos_en_caminos)\r\n #Luego, en esta variable dependiendo de si estamos en un objeto DFS o BFS, se definira el orden\r\n #en el que se seleccionaran los nodos para la busqueda. Ademas, esta variable tendra los elementos\r\n #adyacentes del nodo d ya sea en una pila o en una cola. \r\n pila_o_cola = self.orden_nodos(g,d)\r\n\r\n #pila_o_cola.estructura.each {|elem| puts elem}\r\n\r\n #Verificamos si la pila o cola, de adyacentes, incluye a \"h\"\r\n if pila_o_cola.estructura.include? h \r\n\r\n #De ser asi, se incluye el numero de nodos del recorrido que llevo a \"h\"\r\n nro_nodos_en_caminos << nro_nodos\r\n\r\n #Si la pila o cola no incluye a \"h\"\r\n else\r\n\r\n #Entonces mientras no este vacia, se recorre la estructura\r\n while not(pila_o_cola.vacio)\r\n\r\n #Luego se remueve un nodo de la estructura, que sera el siguiente que se usara\r\n #como \"inicio\" de la busqueda\r\n siguiente_nodo = pila_o_cola.remover\r\n\r\n #Si el nodo en cuestion no ha sido visitado\r\n if not(nodos_visitados.include? siguiente_nodo)\r\n #Lo agregamos al arreglo de visitados\r\n nodos_visitados << siguiente_nodo\r\n #Y hacemos una llamada recursiva al metodo busqueda pero esta vez partiendo\r\n #del nodo antes tomado. En esta llamada aumentamos el numero de nodos (nro_nodos)\r\n #en 1\r\n busqueda(g, siguiente_nodo, h , nro_nodos + 1 , nodos_visitados, nro_nodos_en_caminos)\r\n end\r\n end\r\n end\r\n\r\n #Luego de que acaba todo el procesamiento verificamos si en el arreglo \"nro_nodos_en_caminos\"\r\n #esta vacio, si es asi entonces significa que el nodo \"h\" no fue alcanzado entonces\r\n if nro_nodos_en_caminos.empty?\r\n #retornamos -1\r\n return -1\r\n end\r\n\r\n #Finalmente, si sobrevivimos todo lo anterior, llegados a este punto retornamos el numero de nodos que\r\n #fueron recorridos de \"d\" a \"h\". Recordamos que el arreglo \"nro_nodos_en_caminos\" contiene para todos los\r\n #caminos de \"d\" a \"h\", el numero de nodos recorridos.\r\n\r\n ## OJO: En este caso se retornara el nro de nodos recorridos del camino mas corto. ##\r\n\r\n #Sin embargo, si se quisiera el nro de nodos de solo el primer camino por el que se metio y encontro a \"h\"\r\n #bastaria con solo retornar \"nro_nodos_en_caminos[0]\".\r\n #Por otra parte, si se quisiera para cada camino el nro de nodos recorridos entonces basta con retornar\r\n #el arreglo completo, etc.\r\n \r\n return \"#{nro_nodos_en_caminos.min} nodos recorridos.\"\r\n end",
"title": ""
},
{
"docid": "2607691ca9263b58f899ee8b5a98afbe",
"score": "0.5422135",
"text": "def insertar(value)\n insert(Node.new(value, nil, nil))\n end",
"title": ""
},
{
"docid": "9d8794e9ffaaa33836c1346a7d0b2b6b",
"score": "0.5408839",
"text": "def traktiNodon(nod, stato)\n\n objekto = {\"tipo\" => nod.name, \"filoj\" => [], \"tradukoj\" => {}, \"filNombro\" => 0}\n stato[\"super\"] << nod.name\n\n miaMarko = false\n\n if nod[\"mrk\"] != nil\n objekto[\"mrk\"] = nod[\"mrk\"]\n stato[\"marko\"] << nod[\"mrk\"]\n miaMarko = true\n end\n\n teksto = \"\"\n \n nod.children().each do |fil|\n\n if fil.name == \"kap\"\n novaKapo = traktiKapon(fil, stato)\n objekto[\"nomo\"] = novaKapo[\"nomo\"]\n objekto[\"tildo\"] = novaKapo[\"tildo\"]\n objekto[\"kapo\"] = novaKapo\n if nod.name == \"drv\"\n # Registri tradukojn en esperanton\n\t for nom in objekto[\"nomo\"].split(\", \")\n\t @esperantaj << fariSerchTradukon(nom, nom, stato[\"nomo\"], stato[\"artikolo\"][\"indekso\"], stato[\"marko\"].last, 0)\n\t end\n end\n elsif fil.name == \"uzo\"\n novaUzo = traktiUzon(fil, stato)\n \t if objekto[\"uzoj\"] == nil\n\t objekto[\"uzoj\"] = []\n\t end\n\t objekto[\"uzoj\"] << novaUzo\n elsif fil.name == \"gra\"\n fil.children().each do |fil2|\n if fil2.name == \"vspec\"\n objekto[\"vspec\"] = fil2.text\n end\n end\n elsif fil.name == \"subart\"\n objekto[\"filNombro\"] += 1\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n elsif fil.name == \"drv\"\n objekto[\"filNombro\"] += 1\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n elsif fil.name == \"subdrv\"\n objekto[\"filNombro\"] += 1\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n elsif fil.name == \"snc\"\n objekto[\"filNombro\"] += 1\n stato[\"senco\"] = objekto[\"filNombro\"]\n novaSenco = traktiNodon(fil, stato)\n objekto[\"filoj\"] << novaSenco\n if novaSenco[\"mrk\"] != nil\n @indikiloDeMarko[novaSenco[\"mrk\"]] = objekto[\"filNombro\"].to_s\n end\n stato[\"senco\"] = 0\n elsif fil.name == \"subsnc\"\n objekto[\"filNombro\"] += 1\n novaSubSenco = traktiNodon(fil, stato)\n objekto[\"filoj\"] << novaSubSenco\n if novaSubSenco[\"mrk\"] != nil\n litero = (\"a\"..\"z\").to_a[objekto[\"filNombro\"]-1]\n numero = stato[\"senco\"].to_s + litero\n @indikiloDeMarko[novaSubSenco[\"mrk\"]] = numero\n end\n elsif fil.name == \"dif\"\n novaDifino = traktiDifinon(fil, stato)\n objekto[\"filoj\"] << novaDifino\n elsif fil.name == \"rim\"\n novaRimarko = traktiRimarkon(fil, stato)\n objekto[\"filoj\"] << novaRimarko\n elsif fil.name == \"ref\"\n stato[\"refspac\"] = objekto[\"filoj\"].count > 0\n novaRefo = traktiRefon(fil, stato)\n objekto[\"filoj\"] << novaRefo\n elsif fil.name == \"refgrp\"\n stato[\"refspac\"] = objekto[\"filoj\"].count > 0\n novaRefgrupo = traktiRefgrupon(fil, stato)\n objekto[\"filoj\"] << novaRefgrupo\n elsif fil.name == \"ekz\"\n novaEkzemplo = traktiEkzemplon(fil, stato)\n #teksto += novaEkzemplo[\"teksto\"]\n\t objekto[\"filoj\"] << novaEkzemplo\n elsif fil.name == \"trd\"\n traktiTradukon(fil, stato)\n elsif fil.name == \"trdgrp\"\n traktiTradukGrupon(fil, stato)\n elsif fil.name == \"text\"\n #puts \"teksto: \" + fil.text + \"|\"\n #objekto[\"filoj\"] << {\"tipo\" => \"teksto\", \"teksto\" => fil.text}\n elsif fil.name == \"frm\"\n novaFormulo = traktiFormulon(fil, stato)\n\t teksto += novaFormulo[\"teksto\"]\n else\n objekto[\"filoj\"] << traktiNodon(fil, stato)\n end\n end\n\n for fil in objekto[\"filoj\"]\n if fil[\"teksto\"] != nil\n if fil[\"tipo\"] == \"refo\" or fil[\"tipo\"] == \"refgrupo\"\n\t teksto += \" \"\n\t end\n teksto += fil[\"teksto\"]\n end\n end\n\n # atendu ghis la fino de drv antau enmeti tradukojn el ekzemploj -\n # tiuj ghenerale rilatas al dirajhoj, ke ne estas baza vortoj por serchi\n if stato[\"super\"].count == 1 and stato[\"ekzTradukoj\"] != []\n for lng, tradoj in stato[\"ekzTradukoj\"]\n for trad in tradoj\n\t stato[\"artikolo\"][\"tradukoj\"][lng] << trad\n\t end\n end\n\n stato[\"ekzTradukoj\"] = {}\n end\t \t \n\n if miaMarko then stato[\"marko\"].pop end\n\n #objekto[\"teksto\"] = teksto\n stato[\"super\"].pop\n return objekto\nend",
"title": ""
},
{
"docid": "4a96c6f66ed436583f9d49c68c30cb1f",
"score": "0.5403567",
"text": "def insertar_elemento(nodo)\n \n if @elemento != nil\n \n nodo.next = @elemento\n @elemento = nodo\n end\n end",
"title": ""
},
{
"docid": "8fe5b798d389c57862baf06e7dfb3690",
"score": "0.54024667",
"text": "def entrada_de_dados(*args)\n @conta = ContaLuz.new\n\n @conta.qtd_kw_gasto = args[0]\n @conta.valor_pagar = args[1]\n @conta.numero_leitura = args[2]\n @conta.mes = args[3]\n @conta.ano = args[4]\n @conta.emissao = args[5]\n @conta.vencimento = args[6]\n\n @lista_contas << @conta\n end",
"title": ""
},
{
"docid": "5580e934d8bd02c6c0326d53184cd1f2",
"score": "0.53898174",
"text": "def insert(nodo, pos)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la posicion la debe indicar un entero\" unless ( pos.instance_of? Integer)\n raise \"Error posicion inadecuada\" unless ( pos <= @nodos )\n if pos == 0\n insert_head(nodo)\n elsif pos == @nodos\n insert_tail(nodo)\n else\n i = 1\n a = @head\n while i != pos\n i = i+1\n a = a.next\n end\n b = a.next\n nodo.prev = a\n nodo.next = b\n a.next = nodo\n b.prev = nodo\n @nodos = @nodos +1\n nodo\n end\n end",
"title": ""
},
{
"docid": "8275e884500dedfb214f39aafe0fe74f",
"score": "0.53782743",
"text": "def insertar(x)\n nodo = Nodo.new(x, nil, nil) \n if @head == nil && @tail==nil\n nodo.next=@head\n nodo.prev=@tail\n @head=nodo\n @tail=nodo\n else\n nodo.prev=@head\n nodo.next=nil\n @head.next=nodo\n @head=nodo\n end\n \n end",
"title": ""
},
{
"docid": "76c64e32ff62dae1b7c4979b4f8c9ca0",
"score": "0.5367579",
"text": "def insert(etiqueta)\n nodo = Node.new(etiqueta, nil, nil)\n\n if self.empty\n nodo.next=nodo\n nodo.prev=nodo\n @head=nodo\n @tail=nodo\n\n else\n nodo.prev = @tail\n nodo.next = nil\n @tail.next = nodo\n @tail = nodo\n end\n end",
"title": ""
},
{
"docid": "81a91a1ac11a03e5b32a5b388c5b184d",
"score": "0.53427964",
"text": "def insert_beginning(*val)\n \n val.each do |nuevo_nodo|\n \n if @head != nil\n \n @head.previous = nuevo_nodo\n nuevo_nodo.next = @head\n @head = nuevo_nodo\n else\n @head = nuevo_nodo\n end\n @num_nodos += 1\n \n end\n end",
"title": ""
},
{
"docid": "ac074cc7a00010e45d364459bd81435a",
"score": "0.533228",
"text": "def insert_nodes_only(items, location, target, contexts)\n \n puts @location_path_processor.get_node(location).to_s\n \n #sort items the way they should be stored\n #so for BEFORE, INTO and AS LAST INTO (which are the same) we dont need to sort anything\n #for AFTER and AS FIRST INTO should be sorted reversely because we are going to insert them sequentially\n # - always AFTER the location or AS FIRST in the location\n reverse_specific_items = Proc.new { |item_array, specific_target|\n case specific_target\n when ExpressionModule::InsertExprHandle::TARGET_AFTER, ExpressionModule::InsertExprHandle::TARGET_INTO_FIRST\n item_array.reverse!\n end\n }\n reverse_specific_items.call(items, target)\n \n items.each { |item|\n case item.type\n #adding relative or previously loaded var\n when ExpressionModule::RelativePathExpr, ExpressionModule::VarRef\n extended_keys_to_insert = []\n contexts.each { |context|\n case item.type\n when ExpressionModule::RelativePathExpr\n extended_keys_to_insert.concat(@path_solver.solve(item, context))\n when ExpressionModule::VarRef\n extended_keys_to_insert.concat(context.variables[item.var_name])\n else\n raise StandardError, \"impossible\"\n end\n }\n reverse_specific_items.call(extended_keys_to_insert, target)\n add_elements(extended_keys_to_insert, location, target)\n \n #adding constructor\n when ExpressionModule::CompAttrConstructor\n case target\n when ExpressionModule::InsertExprHandle::TARGET_BEFORE, ExpressionModule::InsertExprHandle::TARGET_AFTER \n add_attribute(item, Transformer::KeyElementBuilder.build_from_s(location.key_builder, location.parent_key))\n else\n add_attribute(item, location.key_element_builder)\n end\n \n \n when ExpressionModule::DirElemConstructor\n contexts.each { |context|\n add_node(item.nokogiri_node(@path_solver, context), location, target)\n }\n \n \n when ExpressionModule::StringLiteral\n contexts.each { |context|\n add_text(item.text, location, target)\n }\n \n \n end\n }\n end",
"title": ""
},
{
"docid": "a569912d72241cfa4e2ecc1a8cbcd796",
"score": "0.5328778",
"text": "def insertAll \n \n # begin\n\n # tengo romper la abstraccion porque quiero que empiece el id siempre desde 1\n # si no bastaría con hacer Cine.delete_all\n #ActiveRecord::Base.connection.execute(\"truncate table #{'cines'}\") # no funciono en postgres\n Cine.delete_all\n Horario.delete_all\n \n doc = Nokogiri::HTML(open(\"http://www.bases123.com.ar/eldia/cines/index.php\"))\n \n doc.xpath('//select[@id=\"cine\"]/option').map do |info|\n Cine.create(:nombre => info.text, :external_id => info.xpath('@value').text)\n end \n \n # borro el primer registro porque dice simplemente \"+ Cines\"\n Cine.find(:first).destroy\n\n # Para cada cine que cree actualizo su información\n @cines = Cine.all \n @cines.each do |cine|\n\n # obtengo los datos del cine\n doc = Nokogiri::HTML(open(\"http://www.bases123.com.ar/eldia/cines/cine.php?id=\" + cine.external_id.to_s))\n\n doc.xpath('/html/body/div/p[1]').map do |info|\n data_cine = info.text.lines\n dir = data_cine.to_a[2].gsub(/\\n/,'')\n loc = data_cine.to_a[3].gsub(/\\n/,'')\n c = Cine.find(cine.id)\n c.attributes = \n {\n :direccion => dir, \n :localidad => loc,\n :address => dir + ', ' + loc.gsub(/\\|/,', '), \n }\n c.save\n end\n \n # obtengo las peliculas que se proyectan en el cine y sus horario\n # nota: el 1 misterioso que se agrega es porque los ids del sitio terra son los mismos que infojet pero con la diferencia \n # que llevan conctenado un 1 al final\n doc = Nokogiri::HTML(open(\"http://cartelera.terra.com.ar/carteleracine/sala/\" + cine.external_id.to_s + \"1\") )\n\n #@horarios = doc.xpath(\"//a[starts-with(@href,'pelicula.php')]/@href\").map do |info|\n doc.xpath(\"//div[@id='filmyhorarios']/ul/li\").map do |info|\n \n horarios = info.xpath(\"div[@class='horario fleft']\").text.gsub(/\\t|\\n/, '')\n pelicula_link = info.xpath(\"div[@class='film fleft']/h3/a/@href\").text.split('/').to_a\n # saco el 1 misterioso, para que el id vuelva a la normalidad\n pelicula_id = pelicula_link[pelicula_link.count - 1].chop \n @p = Pelicula.where(:external_id => pelicula_id).first\n logger.debug \"Peli: \" + @p.class.to_s\n if (@p != nil)\n Horario.create(:cine_id => cine.id, :pelicula_id => @p.id, :horas => horarios )\n end\n\n \n end \n \n end \n\n \n @mensaje = \"Los cines fueron creados y actualizados con éxito!\"\n\n\n \n\n# rescue Exception => exc\n# logger.error(\"Message for the log file #{exc.message}\")\n# @mensaje = \"Algo malo pasó :(\"\n# end \n render :text => @mensaje\n \n end",
"title": ""
},
{
"docid": "8012e6a3b319ec1318474584aa76552b",
"score": "0.53196925",
"text": "def insertar(texto,timestamp,usuario,fotousuario)\n\t\n\t\tlistaobjeto=[texto,timestamp,usuario,fotousuario]\n\t\t@Lista+=[listaobjeto]\n\tend",
"title": ""
},
{
"docid": "9a165fff5fb75420104f2d76c430196f",
"score": "0.5302367",
"text": "def insertar (id_usu_den,id_tip_doc,num_doc_den,fec_exp_doc_den,fec_nac_den,pri_nom_den,seg_nom_den,pri_ape_den,seg_ape_den,tel_den,dir_den,push_den,ema_den)\n \tputs \"insertar: \"\n \tprint \"INSERT INTO public.denunciante(\n id_usu_den, id_tip_doc, num_doc_den, fec_exp_doc_den, fec_nac_den, \n pri_nom_den, seg_nom_den, pri_ape_den, seg_ape_den, tel_den, \n dir_den, push_den, ema_den)\n VALUES (?, ?, ?, ?, ?, \n ?, ?, ?, ?, ?, \n ?, ?, ?);\"\n\n end",
"title": ""
},
{
"docid": "3857010d5da025a222ae9b9251ea6f18",
"score": "0.5283827",
"text": "def insert(key, value = nil)\n node = @root\n if node.full? \n @root = Btree::Node.new(@degree)\n @root.add_child(node)\n @root.split(@root.children.size - 1)\n #puts \"After split, root = #{@root.inspect}\"\n # split child(@root, 1)\n node = @root\n end\n node.insert(key, value)\n @size += 1\n return self\n end",
"title": ""
},
{
"docid": "d7b59a8866f5bb094d4754fc52c1a08f",
"score": "0.52300346",
"text": "def extraer_elemento\n \n @nodo = Nodo_.new(nil, @head.value, nil)\n \n @head = @head.next\n @head.prev = nil\n return @nodo\n \n #nodo = @head\n #if @head.next == nil\n # @head = nil\n # else\n # @head = @head.next\n #end\n #return nodo\n \n #nodo = @head\n #@head = @head.next\n \n #nodo.next = nil\n #nodo.prev = nil\n \n #if @head == nil\n # @tail = nil\n #end\n \n #return nodo\n end",
"title": ""
},
{
"docid": "9d6be8313abc3ec2a4d5fb2793e6c124",
"score": "0.52131706",
"text": "def AddNodes(nodes)\n\tnodes.each do |n|\n\t\tn.id=@lastId\n\t\tDefineGroup(n)\n\t\t@lastId=@lastId+1\n\tend\n\treturn nodes\n end",
"title": ""
},
{
"docid": "1e64d1efa68183077970f489f1320739",
"score": "0.521149",
"text": "def set_insert_vars(data, position)\n node = DoubleNode.new(:data => data)\n\n head = position.head\n tail = position.tail\n\n [node, head, tail]\n end",
"title": ""
},
{
"docid": "140aa3a8e3405bec5be5231d55000313",
"score": "0.51850235",
"text": "def agregar_compra(producto, unidades = 1)\n DB.execute(\"insert into compras values ( ?, ?)\", producto, unidades)\nend",
"title": ""
},
{
"docid": "e8780fc258a681b369a8885295491a71",
"score": "0.51702577",
"text": "def add(value)\n if @root == nil\n @root = Node.new(value)\n startMethods()\n else\n @addMethods.add(value)\n end\n puts \"* DATO INSERTADO CORRECTAMENTE !\"\n\n end",
"title": ""
},
{
"docid": "c6f6a32ce09eaad30b1de338e6499ca3",
"score": "0.51641756",
"text": "def add(node, value)\n tree_navigator.descendents(node).each do |descendent|\n values[descendent] += value\n end\n end",
"title": ""
},
{
"docid": "f41c7ba769c11f590fccde53405ef49d",
"score": "0.51594466",
"text": "def save_atributos\n\n unless @pre.nil?\n @pre[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@pre[:valor][key],campo:'precio')\n end\n end\n\n unless @compraAtributo.nil?\n @compraAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@compraAtributo[:valor][key],campo:'compra')\n end\n end\n\n unless @polizaAtributo.nil?\n @polizaAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@polizaAtributo[:valor][key],campo:'poliza')\n end\n end\n\n unless @tipovehiculoAtributo.nil?\n @tipovehiculoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@tipovehiculoAtributo[:valor][key],campo:'tipovehiculo')\n end\n end\n\n unless @tipoproductoAtributo.nil?\n @tipoproductoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@tipoproductoAtributo[:valor][key],campo:'tipoproducto')\n end \n end\n \n unless @aseguradoraAtributo.nil?\n @aseguradoraAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@aseguradoraAtributo[:valor][key],campo:'aseguradora')\n end\n end\n \n unless @destacadoAtributo.nil?\n @destacadoAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@destacadoAtributo[:valor][key],campo:'destacado')\n end\n end\n\n unless @vigenciaAtributo.nil?\n @vigenciaAtributo[:llave].each do |key,value|\n Atributo.create(producto_id:self.id,llave:value,valor:@vigenciaAtributo[:valor][key],campo:'vigencia')\n end\n end\n\n end",
"title": ""
},
{
"docid": "56643f50474dc840cd57f42062133529",
"score": "0.514626",
"text": "def insertarHead(value)\n nodo = Node.new(value)\n if @head == nil and @tail == nil\n @head = nodo\n @tail = nodo\n else\n @head.next = nodo\n nodo.prev = @head\n @head = nodo\n end\n @size+=1\n end",
"title": ""
},
{
"docid": "cd53d1d9fcdf93954958202a6446694f",
"score": "0.51063293",
"text": "def insert_head(nodo)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la lista debe contener nodos\" unless ( nodo.instance_of? Nodo )\n nodo.next = @head\n @head.prev = nodo\n nodo.prev = nil\n @nodos = @nodos +1\n @head = nodo\n end",
"title": ""
},
{
"docid": "229ccbac55efd208198b6707a2a6e4d4",
"score": "0.50827056",
"text": "def getPontEntre(n1, n2)\n\n # Tableau temporaire visant à contenir l'index des cases formant le pont\n arr = [] \n\n # Cas où la case est le voisin du haut\n if n1.northNode == n2 # Ile HAUT\n\n for y2 in (n1.row-1).downto(0)\n if(self.get_child_at(n1.column,y2) == n2) \n break;\n\t\t\t\telse\n self.get_child_at(n1.column,y2).set_directionPont(2)\n arr << self.get_child_at(n1.column,y2)\n end\n\t\t\tend\n # Cas où la case est le voisin de droite\n elsif n1.eastNode == n2 #Ile droit\n\n for x2 in (n1.column+1).upto(self.lignes-1)\n if(self.get_child_at(x2,n1.row) == n2) \n break;\n\t\t\t\telse\n self.get_child_at(x2,n1.row).set_directionPont(1)\n arr << self.get_child_at(x2,n1.row)\n end\n\t\t\tend\n # Cas où la case est le voisin de gauche \n elsif n1.westNode == n2 # Ile gauche\n\n for x2 in (n1.column-1).downto(0)\n if(self.get_child_at(x2,n1.row) == n2) \n break;\n else\n self.get_child_at(x2,n1.row).set_directionPont(1)\n arr << self.get_child_at(x2,n1.row)\n end\n end\n\n # Cas où la case est le voisin du bas\n elsif n1.southNode == n2 # Ile bas\n for y2 in (n1.row+1).upto(self.colonnes-1)\n if(self.get_child_at(n1.column,y2) == n2) \n break;\n else\n self.get_child_at(n1.column,y2).set_directionPont(2)\n arr << self.get_child_at(n1.column,y2)\n end\n\t\t\tend\n end \n return arr\n end",
"title": ""
},
{
"docid": "8b76b00ade5e3de49ee6a2ad8c775246",
"score": "0.5073539",
"text": "def ordenes_consumos_detalle_params\n params.require(:ordenes_consumos_detalle).permit(:ordenes_de_consumo_id,:concepto_id,:lectura_id,:monto, :IVA)\n end",
"title": ""
},
{
"docid": "0f02f927bb90de53eeb44d6954525026",
"score": "0.50719565",
"text": "def aumentar_cantidad(cant = 1)\n @cantidad += cant\n end",
"title": ""
},
{
"docid": "0d664e6dfaeedffa06a56bd774ba21e2",
"score": "0.5067668",
"text": "def insertar(identificador, tipo, tamanio, asignacion, modificable = true)\n\t\t@tabla.store(identificador.valor.str, tipo)\n\n\t\tif tamanio != nil then\n\t\t\t@tamanio.store(identificador.valor.str, tamanio)\n\t\tend\n\n\t\tif asignacion != nil then\n\t\t\t@asignacion.store(identificador.valor.str, asignacion)\n\n\t\telse\n\n\t\t\tif tipo.str == \"int\" then\n\t\t\t\t# token = Token.new(\"0\", -1, -1)\n\t\t\t\t# nodo = NodoInt.new(token)\n\t\t\t\t@asignacion.store(identificador.valor.str, 0)\n\n\t\t\telsif tipo.str == \"bool\" then\n\t\t\t\t# token = Token.new(\"false\", -1, -1)\n\t\t\t\t# nodo = NodoBool.new(token)\n\t\t\t\t@asignacion.store(identificador.valor.str, false)\n\n\t\t\telsif tipo.str == \"bits\" && (tamanio.is_a?(Integer) || tamanio.is_a?(String)) then\n\n\t\t\t\ti = 0\n\t\t\t\tvalor = \"0b\"\n\t\t\t\twhile (i<Integer(tamanio))\n\t\t\t\t\tvalor += \"0\"\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\n\t\t\t\t@asignacion.store(identificador.valor.str, valor)\n\n\t\t\tend\n\n\t\tend\n\n\t\t@modificable.store(identificador.valor.str, modificable)\n\n\tend",
"title": ""
},
{
"docid": "655a0012b9879f8cbfed6b669ec49e2e",
"score": "0.5057071",
"text": "def contando\n tags = Tag.find(:all)\n \n for tag in tags\n tag.ocurrencias = contador tag.descripcion \n tag.enlazados = Enlace.count(:all, :conditions =>['tag_id = ?', tag.id])\n \n tag.save\n end \n end",
"title": ""
},
{
"docid": "4b7677211865c72325c01716d66d7993",
"score": "0.5056471",
"text": "def node_query_mapping_insert\n # binding.pry\n branches.each do |br|\n br.nodes.each do |nd|\n nodeName = nd.name\n\n # columnsArray=nd.columns.map{|c| \"'\"+(c.relalias.nil? ? '' : c.relalias+'.')+c.colname+\"'\"}.join(',')\n columnsArray = nd.columns.map { |c| \"'\" + c.relname + '.' + c.colname + \"'\" }.join(',')\n query = \"INSERT INTO #{@nqTblName} values (#{@test_id} ,'#{br.name}','#{nd.name}', '#{nd.query.gsub(/'/, '\\'\\'')}',#{nd.location}, ARRAY[#{columnsArray}], #{nd.suspicious_score} , '#{@type}' )\"\n # pp query\n DBConn.exec(query)\n end\n end\n end",
"title": ""
},
{
"docid": "ae7994bf6f44eb248256a63b24f96af9",
"score": "0.5056329",
"text": "def push_back(*preguntas)\n preguntas.each do |p|\n if (@total == 0)\n @cabeza = Nodo.new(p, nil, nil)\n @cola = @cabeza\n else\n @cola.next = Nodo.new(p, nil, @cola)\n @cola = @cola.next\n end\n @total += 1\n end\n preguntas\n end",
"title": ""
},
{
"docid": "e9e3bbb577c3f1e5577e8b3ddd5ab40b",
"score": "0.5038604",
"text": "def insert(v)\n \n end",
"title": ""
},
{
"docid": "f35a4fe2c79e1287edc5bc89d4fc96b2",
"score": "0.502744",
"text": "def cargar_datos(formulario, registro, indice)\n formulario.each do |llave, valor|\n next if llave == indice\n\n registro.send(\"#{llave}=\", valor)\n end\nend",
"title": ""
},
{
"docid": "89e3934c6f062dd67b33aa1ba9d4f0cf",
"score": "0.50217247",
"text": "def valorenergetico\n acumulador1 = 0\n nodo = @head\n while nodo != @tail\n acumulador1 = acumulador1 + nodo.value.valor_energetico\n nodo = nodo.next\n end\n acumulador1\n end",
"title": ""
},
{
"docid": "ff708c797a19e5d0cba127c992c60f32",
"score": "0.5019698",
"text": "def ajoutPont(n1,n2)\n\n # incrémente le nombre de pont sur les iles\n n1.inc()\n n2.inc()\n\n # Récupère les cases entre les deux iles ( le pont )\n ponts = getPontEntre(n1,n2)\n\n # Ile Nord\n if n1.northNode == n2 \n\t\t\tn1.northEdge = n1.northEdge + 1\n\t\t\tn2.southEdge = n2.southEdge + 1 \n n1.update\n n2.update\n\n elsif n1.eastNode == n2 #Ile droit\n n1.eastEdge = n1.eastEdge + 1\n\t\t\tn2.westEdge = n2.westEdge + 1\n n1.update\n n2.update\n\n elsif n1.westNode == n2 # Ile gauche\n\n n1.westEdge = n1.westEdge + 1 \n\t\t\tn2.eastEdge = n2.eastEdge + 1\n n1.update\n n2.update\n\n elsif n1.southNode == n2 # Ile bas\n\n n1.southEdge = n1.southEdge + 1\n\t\t\tn2.northEdge = n2.northEdge + 1\n n1.update\n n2.update\n \n else \n p \"Erreur: n2 n'est pas un noeud valide pour n1\"\n\t\tend\n \n n1.pontRestants\n n2.pontRestants\n\n # Ajoute le pont entre deux iles\n ponts.each do |pont|\n pont.set_typePont( pont.get_typePont() + 1)\n pont.estDouble = true\n pont.update\n end\n\t \n return self\n end",
"title": ""
},
{
"docid": "c2ef4c60aa97d999625d7c5eea3be48b",
"score": "0.50178",
"text": "def caso_params\n params.require(:caso).permit(lista_params)\n end",
"title": ""
},
{
"docid": "0f32a3176e2d06c522ce63c93f9922cb",
"score": "0.5010505",
"text": "def ordenar_cola(array=[])\n size = array.size\n for i in 0..size-1\n @paso.push(\"ingresar #{array[i]}\")#paso..\n nodo = {\n valor: array[i],\n siguiente: nil\n }\n if @cola[:esta_vacia]\n @cola[:tope]=nodo\n @cola[:fondo]=nodo\n @cola[:esta_vacia]=false\n @cola[:size]+=1\n\n else\n if array[i]>@cola[:fondo][:valor]\n fondo = @cola[:fondo]\n fondo[:siguiente]=nodo\n @cola[:fondo]=nodo\n @cola[:size]+=1\n @paso.push(mostrar_cola())\n else\n vaciar(nodo,array[i])\n end\n end\n end\n end",
"title": ""
},
{
"docid": "9a7169764b6139dd7ce34152fcf994a7",
"score": "0.5010493",
"text": "def insert(key,value)\n tree = insert_help(key,value)\n if tree.kick?\n tree.to_tree\n else\n tree\n end\n end",
"title": ""
},
{
"docid": "b4db63419a79960847d92462270622de",
"score": "0.5005596",
"text": "def insert_node\n self.cspsearchpath ||= []\n dslocal_node = '/Local/Default'\n bsd_node = '/BSD/local'\n \n unless self.cspsearchpath.include? @label \n if index = cspsearchpath.index(bsd_node)\n cspsearchpath.insert(index + 1, @label)\n elsif index = cspsearchpath.index(dslocal_node)\n cspsearchpath.insert(index + 1, @label)\n else\n cspsearchpath.unshift(@label)\n end\n end\n self.cspsearchpath.uniq!\n end",
"title": ""
},
{
"docid": "3d772291b58a7efcb1dee99e7e1b2284",
"score": "0.49861047",
"text": "def agregarMetodos unaClase\n self.metodos.each do |metodo|\n self.agregar_metodo(unaClase,metodo[0],&metodo[1])\n end\n end",
"title": ""
},
{
"docid": "1006f293d2f083523b6538b90282fd98",
"score": "0.49803394",
"text": "def add_nodes(node_info)\n keyname = @creds['keyname']\n new_nodes = Djinn.convert_location_array_to_class(node_info, keyname)\n\n # Since an external thread can modify @nodes, let's put a lock around\n # it to prevent race conditions.\n @state_change_lock.synchronize {\n @nodes.concat(new_nodes)\n Djinn.log_debug(\"Changed nodes to #{@nodes}\")\n }\n\n update_firewall\n initialize_nodes_in_parallel(new_nodes)\n end",
"title": ""
},
{
"docid": "d15b78536258d7372fc81ddd63874eb4",
"score": "0.49774218",
"text": "def datos(opc={})\n return [] unless cadena_especies.present?\n\n # Por default muestra todos\n Especie.caso_rango_valores('especies.id',cadena_especies).order('nombre_cientifico ASC').limit(opc[:limit] ||= 300000).each do |taxon|\n self.taxon = taxon\n asigna_datos\n self.taxones << taxon\n end\n end",
"title": ""
},
{
"docid": "75e797bfcf91b6f082226145c1c3349b",
"score": "0.49724835",
"text": "def insertRemanescentes(conn,id)\n\tputs \" insert Subpopulacao_Remanescente\"\n\tt_init = Time.new\n\tgid_subpop = getSubpopById(conn,id)\n\tfor x in (0..gid_subpop.count-1)\n\t\t#puts \"Subpopulacao #{x+1} de #{gid_subpop.count}\"\n\t\tconn.exec(\"SELECT distinct(gid) as gid_rem from geo.remanescentes where st_intersects(geom,(select geom from geo.subpopulacoes where gid = #{gid_subpop[x]} and id = #{id})) and (geom && (select geom from geo.subpopulacoes where gid = #{gid_subpop[x]} and id = #{id})) and legenda = 'Mata';\").each do |row|\n\t\t\tif (row['gid_rem']) then\n\t\t\t\tconn.exec(\"insert into geo.subpopulacao_remanescente(gid_subpop, gid_remanescente, id) values (#{gid_subpop[x]}, #{row['gid_rem']}, #{id});\")\n\t\t\tend\n\t\tend\n\tend\n\tt = (Time.new - t_init)\n\tconn.exec(\"update geo.tempos set t_subpop_rem = #{t} where id = #{id}\")\nend",
"title": ""
},
{
"docid": "c4db4b13557c76a2aa02e4e001826c23",
"score": "0.496552",
"text": "def guarda_nombres_comunes_todos\n dame_nombres_comunes_todos\n\n if x_nombre_comun_principal.present?\n a = adicional ? adicional : Adicional.new(especie_id: id)\n a.nombres_comunes = x_nombres_comunes.encode('UTF-8', {invalid: :replace, undef: :replace, replace: ''})\n a.nombre_comun_principal = x_nombre_comun_principal.force_encoding(\"UTF-8\")\n\n if a.changed?\n a.save\n reload\n end\n end\n end",
"title": ""
},
{
"docid": "ad62e181e181aa9d8a6b5c7ffdfbf30f",
"score": "0.4962306",
"text": "def clasificar_por_imc (lista)\n \n imc_bajo = Lista.new()\n imc_normal = Lista.new()\n imc_excesivo = Lista.new()\n\n nodo = lista.extract\n \n while !(nodo.nil?)\n\n if nodo.value.datos_ant.indice_masa_corporal >= 30\n imc_excesivo.insert(nodo.value.datos_ant.indice_masa_corporal)\n elsif nodo.value.datos_ant.indice_masa_corporal >=18.5\n imc_normal.insert(nodo.value.datos_ant.indice_masa_corporal)\n else\n imc_bajo.insert(nodo.value.datos_ant.indice_masa_corporal)\n end\n nodo = lista.extract\n end\n\n \"Los IMC por debajo de lo normal son #{imc_bajo.to_s}, los IMC dentro de lo normal son #{imc_normal.to_s} y los que tienen un IMC excesivo son #{imc_excesivo.to_s}\"\n\nend",
"title": ""
},
{
"docid": "86aa508a85efde8b054339a1c0cb50bf",
"score": "0.49491808",
"text": "def add_obrigacao(conta_id, estabelecimento_id, obrigacao_id, dia_entrega)\n obest = Taxcalendario::Admin::Client::Entities::ObrigacaoEstabelecimento.new\n obest.dia_entrega = dia_entrega\n obest.obrigacao_id = obrigacao_id\n map = JSON.parse(post_and_give_me_a_json(\"/estabelecimentos/obrigacoes/#{conta_id}/#{estabelecimento_id}\",obest)) \n obj = Taxcalendario::Admin::Client::Entities::ObrigacaoEstabelecimento.new\n obj.from_hash(map)\n obj\n end",
"title": ""
},
{
"docid": "4bd019fd476348703b6b4da0770450e0",
"score": "0.49433523",
"text": "def create\n # valor = params[:pedido][:valor]\n # params[:pedido][:valor] = valor.split( ',').join('.')\n conta = Conta.find_by_cliente_id(params[:pedido][:cliente_id])\n @proteinas_disponiveis = Proteina.where(:disponibilidade => true)\n @acompanhamentos_disponiveis = Acompanhamento.where(:disponibilidade => true)\n @guarnicoes_disponiveis = Guarnicao.where(:disponibilidade => true)\n @saladas_disponiveis = Salada.where(:disponibilidade => true)\n @bebidas_disponiveis = Bebida.where(:disponibilidade => true)\n @sobremesas_disponiveis = Sobremesa.where(:disponibilidade => true)\n #descricao = \"\"\n @pedido = Pedido.new(pedido_params)\n @pedido.conta_id = conta.id.to_i\n # if @pedido.cliente.nil?\n # @pedido.cliente = Cliente.find(current_usuario.cliente.id)\n # @pedido.conta = Conta.find_by_cliente_id(current_usuario.id)\n # end\n # ENTRADAS #\n # acompanhamentos = params[:pedido][:acompanhamento_ids]\n # acompanhamentos.each do |id|\n # if !id.blank?\n # acompanhamento = Acompanhamento.find(id.to_i)\n # @pedido.pedidos_acompanhamentos.new(:acompanhamento_id => id)\n # #@pedido.acompanhamentos << acompanhamento\n # end\n # end\n ###### FINAL ENTRADAS ########\n acompanhamentos = Acompanhamento.where(:disponibilidade => true).count\n for i in 0...acompanhamentos do\n if !params[\"acompanhamento_#{i}\"].blank?\n @pedido.pedidos_acompanhamentos.new(:acompanhamento_id => params[\"acompanhamento_#{i}\"], :quantidade => params[\"quantidade_acompanhamento_#{i}\"])\n end\n end\n\n proteinas = Proteina.where(:disponibilidade => true).count\n for i in 0...proteinas do\n if !params[\"proteina_#{i}\"].blank?\n @pedido.pedidos_proteinas.new(:proteina_id => params[\"proteina_#{i}\"], :quantidade => params[\"quantidade_proteina_#{i}\"])\n end\n end\n\n guarnicoes = Guarnicao.where(:disponibilidade => true).count\n for i in 0...guarnicoes do\n if !params[\"guarnicao_#{i}\"].blank?\n @pedido.pedidos_guarnicoes.new(:guarnicao_id => params[\"guarnicao_#{i}\"], :quantidade => params[\"quantidade_guarnicao_#{i}\"])\n end\n end\n\n saladas = Salada.where(:disponibilidade => true).count\n for i in 0...saladas do\n if !params[\"salada_#{i}\"].blank?\n @pedido.pedidos_saladas.new(:salada_id => params[\"salada_#{i}\"], :quantidade => params[\"quantidade_salada_#{i}\"])\n end\n end\n\n bebidas = Bebida.where(:disponibilidade => true).count\n for i in 0...bebidas do\n if !params[\"bebida_#{i}\"].blank?\n @pedido.pedidos_bebidas.new(:bebida_id => params[\"bebida_#{i}\"], :quantidade => params[\"quantidade_bebida_#{i}\"])\n end\n end\n\n sobremesas = Sobremesa.where(:disponibilidade => true).count\n for i in 0...sobremesas do\n if !params[\"sobremesa_#{i}\"].blank?\n @pedido.pedidos_sobremesas.new(:sobremesa_id => params[\"sobremesa_#{i}\"], :quantidade => params[\"quantidade_sobremesa_#{i}\"])\n end\n end\n\n\n #@pedido.proteinas << Proteina.where(:nome => params[:proteina]).first\n\n # debugger\n # if !params[:arroz].nil?\n # descricao = \"Arroz \"+ params[:arroz] + \",\"\n # end\n # if params[:feijao] = \"Sim\"\n # descricao = descricao + \" Feijao, \"\n # end\n\n # if params[:farofa] == \"Sim\"\n # descricao = descricao + \" Farofa,\"\n # end\n\n # descricao = descricao + params[:proteina] + \", \" + params[:acompanhamento] + \" Salada: \"+ params[:salada]\n # @pedido.descricao = descricao\n # itens = params[:pedido][:item_de_pedidos_attributes]\n\n # if !itens.nil?\n # for i in 0..params[:pedido][:item_de_pedidos_attributes].count do\n # if itens[\"#{i}\"] != nil\n # if itens[\"#{i}\"][:produto_id].blank?\n # itens.delete(\"#{i}\")\n # end\n # else\n # itens.delete(\"#{i}\")\n # end\n # end\n # end\n # if !itens.blank?\n # @pedido.calcular_valor\n # else\n # @pedido.item_de_pedidos.destroy_all\n # @pedido.valor = 0\n # end\n # if !itens.nil?\n # params[:pedido][:item_de_pedidos_attributes].replace(itens)\n # end\n\n @pedido.situacao = \"Em processamento\"\n #parametros[:valor] = @pedido.valor\n\n respond_to do |format|\n if @pedido.save\n @pedido.calcular_valor\n @pedido.conta.calcular_saldo\n #@pedido.adicionar_conta\n #proteina = @pedido.proteina\n #proteina.decrescer\n format.html { redirect_to @pedido }\n format.json { render action: 'show', status: :created, location: @pedido }\n else\n format.html { render action: 'new' }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eb1112274f1eb81abcff0a632824367d",
"score": "0.49427626",
"text": "def clasificar_por_sal (lista)\n \n sal_recomendada = Lista.new()\n sal_excesiva = Lista.new()\n \n nodo = lista.extract\n \n while !(nodo.nil?)\n \n if nodo.value.sal > 6\n sal_excesiva.insert(nodo.value.sal)\n else\n sal_recomendada.insert(nodo.value.sal)\n end\n nodo = lista.extract\n end\n \n \"Los productos con una cantidad de sal menor o igual a la recomendada son #{sal_recomendada.to_s} y los que tienen una sal excesiva son #{sal_excesiva.to_s}\"\n \nend",
"title": ""
},
{
"docid": "96880774c53c69036b557222b5faa363",
"score": "0.49306807",
"text": "def insert_data(data)\n self.root = insert(data)\n end",
"title": ""
},
{
"docid": "20851998a2c96f2d18d71c414564fc07",
"score": "0.4915355",
"text": "def setorden\n @xml = params[:solicitud]\n @arreglo = Orden.validarRemota(@xml)\n if !(@arreglo.nil?)\n # @cliente = Persona.new(@xml[:cliente])\n # @cliente.save\n\n # @tarjeta = @xml[:tarjeta]\n # @tarjeta = TipoPago.new(@tarjeta)\n # @tarjeta.personas_id = @cliente.id\n # @tarjeta.save\n\n # @recoleccion = Direccion.new(@xml[:direccionrecoleccion])\n @entrega = Direccion.new(@xml[:direccionentrega])\n # @recoleccion.save\n @entrega.save\n\n @orden = Orden.new(@xml[:orden])\n @orden.estado = 'Pendiente por recolectar'\n @orden.personas_id= @arreglo[0]\n @orden.save\n\n @paquete = Paquete.new(@xml[:paquete])\n @paquete.ordens_id = @orden.id\n @paquete.personas_id = @arreglo[0]\n @paquete.save\n\n @historico1= Historico.new(:ordens_id => @orden.id, :direccions_id => @arreglo[2], :tipo => 'Recolectada')\n @historico= Historico.new(:ordens_id => @orden.id, :direccions_id => @entrega.id, :tipo => 'Entregada')\n @historico1.save\n @historico.save\n \n @monto = Enviar.montoTotal(@orden.id)\n @iva = (@monto * 0.12).round(2)\n @montototal = @monto + @iva\n Enviar.compania\n @factura = Factura.new(:companias_id => 1, :ordens_id =>@orden.id , :tipo_pagos_id => @arreglo[1] , :costoTotal => @monto ,:iva => @iva)\n @factura.save\n else\n render \"errorxml\"\n end\n end",
"title": ""
},
{
"docid": "78d1eaabe1b2b5d9d2ac3b4a27fb7a6e",
"score": "0.49063206",
"text": "def insert_keys(keys, subtree)\n keys.each do |clef|\n key = REXML::Element.new('key')\n subtree << key\n\n path = REXML::Element.new('path')\n path.add_text(clef.path)\n key << path\n end\n end",
"title": ""
},
{
"docid": "600972d648d5067d58a5432741102f45",
"score": "0.49018747",
"text": "def modelo_carne_build_data_left(doc, boleto, colunas, linhas)\n # LOGOTIPO do BANCO\n doc.image boleto.logotipo, x: (colunas[0] - 0.11), y: linhas[0]\n\n # Dados\n\n # Numero do banco\n doc.moveto x: colunas[1], y: linhas[0]\n doc.show \"#{boleto.banco}-#{boleto.banco_dv}\"\n\n # vencimento\n doc.moveto x: colunas[0], y: linhas[1]\n doc.show boleto.data_vencimento.to_s_br\n\n # agencia/codigo cedente\n doc.moveto x: colunas[0], y: linhas[2]\n doc.show boleto.agencia_conta_boleto\n\n # nosso numero\n doc.moveto x: colunas[0], y: linhas[3]\n doc.show boleto.nosso_numero_boleto\n\n # valor do documento\n doc.moveto x: colunas[0], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # numero documento\n doc.moveto x: colunas[0], y: linhas[11]\n doc.show boleto.documento_numero\n\n # sacado\n doc.moveto x: colunas[0], y: linhas[13]\n doc.show boleto.sacado.to_s\n end",
"title": ""
},
{
"docid": "b4b35fecccb710cb25e5e7d388036841",
"score": "0.4900752",
"text": "def insert_head(value)\n if @head.nil?\n @head = Nodo.new(value, nil, nil)\n @tail = @head\n else\n @head[:prev] = Nodo.new(value, @head, nil)\n @head = @head[:prev]\n end\n end",
"title": ""
},
{
"docid": "441b5335b49206f158abdf1309d4f17b",
"score": "0.48977005",
"text": "def insert_author_affiliation(affi_object, cd_affi_ids)\n # insert the object\n # get the id of the inserted object\n # update all cr_affiliations with the author_affiliation_id\n sql_statement = \\\n \"SELECT id, name FROM cr_affiliations WHERE article_author_id = \" + affi_object.article_author_id.to_s + \";\"\n db = get_db()\n #stm = db.prepare sql_statement\n #rs = stm.execute\n\n db.execute(\"INSERT INTO Author_Affiliations VALUES (?,?,?,?,?,?,?,?,?,?,?,?)\", 1, affi_object.article_author_id, affi_object.name, affi_object.short_name,\n affi_object.add_01, affi_object.add_02, affi_object.add_03,affi_object.add_04, affi_object.add_05, affi_object.country,'2020-09-27','2020-09-27')\nend",
"title": ""
},
{
"docid": "df34ee8559daec590952b5aa23fc8af7",
"score": "0.48961425",
"text": "def insertion(val, rel, recursive = T.unsafe(nil), list = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "a85d14d9538686e35397449732fcfc36",
"score": "0.4890108",
"text": "def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end",
"title": ""
},
{
"docid": "9356f4bb8090abec863928d54e1492f3",
"score": "0.48868024",
"text": "def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"title": ""
},
{
"docid": "b042a5a4e5152e9955975bbbb47020df",
"score": "0.48807293",
"text": "def permitted_params\n params.permit(:cliente_id, :id, :veiculo => [:placa, :marca, :modelo])\n end",
"title": ""
},
{
"docid": "5ce6d87054b7c25693f1c54509480b7f",
"score": "0.48795858",
"text": "def metodos_con(letras,*clase) # puede ser metodos de una clase, una lista de clases, o una lista de metodos\n if not clase.none? # si no hay parametros busca en los metodos_observados\n self.get_metodos_de(clase) # aca los setea en @metodos_observados\n end\n @metodos_observados.select{|metodo| metodo[0..letras.size].include? letras}\n end",
"title": ""
},
{
"docid": "d49565a625ae12e6b9fa90db94dee450",
"score": "0.4878516",
"text": "def datos_descarga(taxa)\n return unless taxa.any?\n self.taxones = []\n\n taxa.each do |taxon|\n self.taxon = taxon\n asigna_datos\n self.taxones << taxon\n end\n end",
"title": ""
},
{
"docid": "aea9c77ac94a3dd0caf7a36cd75ab3ef",
"score": "0.48704225",
"text": "def create\n cour = Cour.find(params[:elefe][:ville_entrainement])\n u = current_user\n #info_ville = params[:elefe][:info_ville].join.to_i\n #params[:elefe][:info_ville] = info_ville\n # CAS DES FICHES EXISTANTES\n if @All_Eleves.exists?(:nom => params[:elefe][:nom], :prenom => params[:elefe][:prenom])\n @fiche_exist = @All_Eleves.find_by(:nom => params[:elefe][:nom], :prenom => params[:elefe][:prenom])\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n # Fusion de l'élève avec une fiche existante créée à partir des présences (officialisation)\n if !@fiche_exist.date_naissance\n puts \"On update eleve existant\"\n @elefe = @fiche_exist\n cours = @elefe.cours\n if !cours.detect { |b| b.id == cour.id }\n @elefe.cours << cour\n end\n u.eleves << @elefe\n u.commandes << Commande.create(description: 'Affiliation '+params[:elefe][:nom]+' '+params[:elefe][:prenom], montant: params[:elefe][:prix])\n @elefe.commandes << u.commandes.last\n respond_to do |format|\n if @elefe.update(elefe_params)\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @elefe }\n else\n format.html { render :edit }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n else\n # Ne peut pas écraser une fiche existante\n redirect_back(fallback_location: :back, alert: 'Il existe déjà un élève inscrit avec le même nom et prénom. Peut-être pourriez-vous entrer un deuxième prénom pour vous différencier ?')\n end\n # CAS CLASSIQUE DE L'INSCRIPTION\n else\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n @elefe = Elefe.new(elefe_params)\n @elefe.cours << cour\n u.eleves << @elefe\n u.commandes << Commande.create(description: 'Affiliation '+params[:elefe][:nom]+' '+params[:elefe][:prenom], montant: params[:elefe][:prix])\n @elefe.commandes << u.commandes.last\n respond_to do |format|\n if @elefe.save\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été créée.' }\n format.json { render :show, status: :created, location: @elefe }\n else\n format.html { render :new }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "c9b4a9eb07d335ba08c902ddc97a20b0",
"score": "0.48700264",
"text": "def ajouter_cours(effectif_param, effectif_limite_param, nom_param, enseignant_nom_param)\n cours = {\n \"effectif\" => effectif_param,\n \"effectif_limite\" => effectif_limite_param,\n \"nom\" => nom_param,\n \"enseignant_nom\" => enseignant_nom_param\n }\n \n LISTE_COURS.push(cours)\nend",
"title": ""
},
{
"docid": "36f4c9d8a540969c1c6d86404fe8bd0d",
"score": "0.48669732",
"text": "def insert_node(atlas_node_id, node_name, node)\n return if atlas_node_id.blank? || node_name.blank?\n current_node = TaxGenerator::TaxonomyNode.new(atlas_node_id, node_name)\n node << current_node\n current_node\n end",
"title": ""
},
{
"docid": "5f359a42fb827455ab580774219b1a78",
"score": "0.48631123",
"text": "def create\n\n @var=params[:despachar]\n if !(params[:enviar].nil?)\n\n @ordenes=params[:enviar]\n @ordenes.each do |orden|\n if orden[1] != \"no\"\n @orden = Orden.find(orden[1])\n @orden.empleado_id = @var[\"recolector\"]\n @orden.estado = \"Asignada para Recoleccion\"\n NUESTRO_LOG.info \"Se despacho la orden correctamente\"\n @orden.save\n end\n end\n end\n @ordenprincipal = Orden.find(@var[\"orden\"])\n @ordenprincipal.estado = \"Asignada para Recoleccion\"\n @ordenprincipal.empleado_id = @var[\"recolector\"]\n @ordenprincipal.save\n redirect_to(despachador_path, :notice => t('rutarecolecciones'))\n\n end",
"title": ""
},
{
"docid": "8dad9e64200b5889ebb43a694f6b678e",
"score": "0.4850079",
"text": "def permitted_params\n params.permit(:cliente_id, :veiculo_id, :id, :ordem_servico => [:numero_os, :orcamento, :pedido, :data_inicio, :data_conclusao, :descricao, :valor])\n end",
"title": ""
},
{
"docid": "0931707068c4d5799b148dc5280f1d53",
"score": "0.4849903",
"text": "def add_taxons\n # TODO smart column ordering to ensure always valid by time we get to associations\n product_load_object.save_if_new\n\n chain_list = value.to_s.split(multi_assoc_delim) # potentially multiple chains in single column (delimited by multi_assoc_delim)\n\n chain_list.each do |chain|\n\n # Each chain can contain either a single Taxon, or the tree like structure parent>child>child\n name_list = chain.split(/\\s*>\\s*/)\n\n parent_name = name_list.shift\n\n parent_taxonomy = taxonomy_klass.where(:name => parent_name).first_or_create\n\n raise DataShift::DataProcessingError.new(\"Could not find or create Taxonomy #{parent_name}\") unless parent_taxonomy\n\n parent = parent_taxonomy.root\n\n # Add the Taxons to Taxonomy from tree structure parent>child>child\n taxons = name_list.collect do |name|\n\n begin\n taxon = taxon_klass.where(:name => name, :parent_id => parent.id, :taxonomy_id => parent_taxonomy.id).first_or_create\n\n # pre Rails 4 - taxon = taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(name, parent && parent.id, parent_taxonomy.id)\n\n unless(taxon)\n logger.warn(\"Missing Taxon - could not find or create #{name} for parent #{parent_taxonomy.inspect}\")\n end\n rescue => e\n logger.error(e.inspect)\n logger.error \"Cannot assign Taxon ['#{taxon}'] to Product ['#{product_load_object.name}']\"\n next\n end\n\n parent = taxon # current taxon becomes next parent\n taxon\n end\n\n taxons << parent_taxonomy.root\n\n unique_list = taxons.compact.uniq - (@product_load_object.taxons || [])\n\n logger.debug(\"Product assigned to Taxons : #{unique_list.collect(&:name).inspect}\")\n\n @product_load_object.taxons << unique_list unless(unique_list.empty?)\n # puts @product_load_object.taxons.inspect\n\n end\n\n end",
"title": ""
},
{
"docid": "1c3bb908a48ee532060b4e894a7c778c",
"score": "0.4848839",
"text": "def asigna_datos\n return unless taxon.present?\n\n cols = if columnas_array.present?\n columnas_array\n else\n columnas.split(',') if columnas.present?\n end\n\n cols.each do |col|\n\n case col\n when 'x_snib_id'\n if proveedor = taxon.proveedor\n self.taxon.x_snib_id = proveedor.snib_id\n end\n when 'x_snib_reino'\n if proveedor = taxon.proveedor\n self.taxon.x_snib_reino = proveedor.snib_reino\n end\n when 'x_naturalista_id'\n if proveedor = taxon.proveedor\n self.taxon.x_naturalista_id = proveedor.naturalista_id\n end\n when 'x_foto_principal'\n if adicional = taxon.adicional\n self.taxon.x_foto_principal = adicional.foto_principal\n end\n when 'x_nombre_comun_principal'\n if adicional = taxon.adicional\n self.taxon.x_nombre_comun_principal = adicional.nombre_comun_principal\n end\n when 'x_categoria_taxonomica'\n self.taxon.x_categoria_taxonomica = taxon.try(:nombre_categoria_taxonomica) || taxon.categoria_taxonomica.nombre_categoria_taxonomica\n when 'x_estatus'\n self.taxon.x_estatus = Especie::ESTATUS_SIGNIFICADO[taxon.estatus]\n when 'x_nombres_comunes'\n nombres_comunes = taxon.nombres_comunes.map{ |nom| nom.nombre_comun.capitalize }.uniq.sort\n next unless nombres_comunes.any?\n self.taxon.x_nombres_comunes = nombres_comunes.join(', ')\n when 'x_tipo_distribucion'\n tipos_distribuciones = taxon.tipos_distribuciones.map(&:descripcion).uniq\n next unless tipos_distribuciones.any?\n self.taxon.x_tipo_distribucion = tipos_distribuciones.join(',')\n when 'x_nom' # TODO: homologar las demas descargas\n nom = taxon.catalogos.nom.distinct\n next unless nom.any?\n self.taxon.x_nom = nom.map(&:descripcion).join(', ')\n \n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [14,15,16,17].include?(cat.catalogo_id)\n end\n \n self.taxon.x_nom_obs = obs.join(', ')\n when 'x_iucn' # TODO: homologar las demas descargas\n iucn = taxon.catalogos.iucn.distinct\n next unless iucn.any?\n self.taxon.x_iucn = iucn.map(&:descripcion).join(', ')\n \n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [25,26,27,28,29,30,31,32,1022,1023].include?(cat.catalogo_id)\n end\n \n self.taxon.x_iucn_obs = obs.join(', ')\n when 'x_cites' # TODO: homologar las demas descargas\n cites = taxon.catalogos.cites.distinct\n next unless cites.any?\n self.taxon.x_cites = cites.map(&:descripcion).join(', ') \n\n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [22,23,24].include?(cat.catalogo_id)\n end\n \n self.taxon.x_cites_obs = obs.join(', ') \n when 'x_ambiente' # TODO: homologar las demas descargas\n if hash_especies.present? # Quiere decir que viene de las descargas pr region\n ambiente = []\n taxon.catalogos.each do |catalogo|\n if catalogo.nivel1 == 2\n ambiente << catalogo\n end\n end\n else\n ambiente = taxon.catalogos.ambientes\n end\n\n next unless ambiente.any?\n self.taxon.x_ambiente = ambiente.map(&:descripcion).join(', ') \n when 'x_naturalista_fotos'\n next unless adicional = taxon.adicional\n if proveedor = taxon.proveedor\n self.taxon.x_naturalista_fotos = \"#{CONFIG.site_url}especies/#{taxon.id}/fotos-naturalista\" if proveedor.naturalista_id.present? && adicional.foto_principal.present?\n end\n when 'x_bdi_fotos'\n next unless adicional = taxon.adicional\n self.taxon.x_bdi_fotos = \"#{CONFIG.site_url}especies/#{taxon.id}/bdi-photos\" if adicional.foto_principal.present?\n when 'x_bibliografia'\n biblio = taxon.bibliografias\n self.taxon.x_bibliografia = biblio.map(&:cita_completa).join(\"\\n\")\n when 'x_url_ev'\n self.taxon.x_url_ev = \"#{CONFIG.site_url}especies/#{taxon.id}-#{taxon.nombre_cientifico.estandariza}\"\n when 'x_num_reg'\n self.taxon.x_num_reg = hash_especies[taxon.scat.catalogo_id]\n else\n next\n end # End switch\n end # End each cols\n\n # Para agregar todas las categorias taxonomicas que pidio, primero se intersectan\n cats = COLUMNAS_CATEGORIAS & cols\n\n if cats.any?\n return if taxon.is_root? # No hay categorias que completar\n ids = taxon.path_ids\n\n Especie.select(:nombre, \"#{CategoriaTaxonomica.attribute_alias(:nombre_categoria_taxonomica)} AS nombre_categoria_taxonomica\").left_joins(:categoria_taxonomica).where(id: ids).each do |ancestro|\n categoria = 'x_' << ancestro.nombre_categoria_taxonomica.estandariza\n next unless COLUMNAS_CATEGORIAS.include?(categoria)\n eval(\"self.taxon.#{categoria} = ancestro.nombre\") # Asigna el nombre del ancestro si es que coincidio con la categoria\n end\n end\n end",
"title": ""
},
{
"docid": "59a7a51a4424fad3bd8d591e84f944bc",
"score": "0.4844466",
"text": "def inserta\n\t\tnum_pago = 1\n\t\tmonto = divide_pagos()\n\t\tfecha_pago = suma_dias()\n\t\tpago_total = calcula_pago_total()\n\n\t\t\tpagos = Payment.new(num_pago: num_pago, monto: pago_total, fecha_pago: fecha_pago, registro: \"\", client_id: self.id)\n\t\t pagos.save!\n\n\tend",
"title": ""
},
{
"docid": "e90f6361c50fa4d6512ef403bd4eb36f",
"score": "0.48374057",
"text": "def save_cidade(e, nome)\n cid = Cidade.where(estado: e, nome: nome).first\n if cid == nil\n puts \"Criando novo cidade...\"\n cid = Cidade.create!(estado: e, nome: nome)\n puts cid\n else\n puts \">>> Cidade ja cadastrado #{nome} - #{e.uf}\"\n end\n cid\n end",
"title": ""
},
{
"docid": "6aae66c22a9ca7db1eb3e2837f1f6aec",
"score": "0.48362955",
"text": "def create \n Documento.transaction do \n @cliente = Usuario.find_by_cpf(params[:usuario][:cpf]) \n @documento = Documento.new(params[:documento]) \n @documento.usuario = current_usuario\n @documento.cliente = @cliente\n @documento.cartorio_id = current_usuario.entidade_id\n\n @documento.save \n\n params[:metadados].each do |k,v|\n @documento.valor_campo_documentos.create(:campo_documento_id => k, :valor => v)\n end \n end\n respond_to do |format|\n if !@documento.new_record?\n flash[:notice] = 'Documento was successfully created.'\n format.html { redirect_to(@documento) }\n format.xml { render :xml => @documento, :status => :created, :location => @documento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @documento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "84d0378010cb53642fbb88d78d5e6c3b",
"score": "0.48357895",
"text": "def paraLetras(d)\n #excluídos o \"L minúsculo\" e o \"ó maiúsculo\"\n a = Array.new; a.push('x','y','z','a','b','c','u','v','w','d','e','f','r','s','t','g','h','i','o','p','q','j','k','m','n')\n b = Array.new; b.push('Z','A','Y','B','X','C','W','D','V','E','U','F','T','G','S','H','R','I','Q','J','P','K','N','L','M')\n c = a + b\n return c[d]\n end",
"title": ""
},
{
"docid": "ae0599c8d64cc4c7702b1034d37bb021",
"score": "0.48231182",
"text": "def extraer_detras\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cola\n @cola = @cola[:prev]\n @cola[:Next_] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end",
"title": ""
},
{
"docid": "63edc2dc2ae106e724ea99b3e6edc698",
"score": "0.4817119",
"text": "def nombres_comunes\n datos = eval(naturalista_info.decodifica64)\n datos = datos.first if datos.is_a?(Array)\n return [] unless datos['taxon_names'].present?\n nombres_comunes_faltan = []\n\n # Nombres comunes de la base de catalogos\n nom_comunes = especie.nombres_comunes\n nom_comunes = nom_comunes.map(&:nombre_comun).map{ |nom| I18n.transliterate(nom).downcase }.sort if nom_comunes\n\n datos['taxon_names'].each do |datos_nombres|\n next unless datos_nombres['is_valid']\n next if datos_nombres['lexicon'] == 'Scientific Names'\n\n # Nombre comun de NaturaLista\n nombre = I18n.transliterate(datos_nombres['name']).downcase\n lengua = datos_nombres['lexicon']\n\n if nom_comunes.present?\n next if nom_comunes.include?(nombre)\n end\n nombres_comunes_faltan << \"#{especie.catalogo_id},\\\"#{datos_nombres['name']}\\\",#{lengua},#{especie.nombre_cientifico},#{especie.categoria_taxonomica.nombre_categoria_taxonomica},http://naturalista.conabio.gob.mx/taxa/#{naturalista_id}\"\n end\n\n nombres_comunes_faltan\n end",
"title": ""
},
{
"docid": "cc19b7b0efd90bff3ab8abd392f0d45a",
"score": "0.48167965",
"text": "def add_nodes(*nodes)\n @nodes.merge nodes\n end",
"title": ""
},
{
"docid": "216963fb839887027c6d48c14b2a1865",
"score": "0.48109466",
"text": "def set_nodo\n @nodo = Nodo.find(params[:id])\n end",
"title": ""
},
{
"docid": "b18ced71a168b12986ef46a682ae74f2",
"score": "0.481087",
"text": "def dominio_params\n params.require(:dominio).permit(:id_valor, :nombre_valor)\n end",
"title": ""
},
{
"docid": "a616123fbc66b3db9414c775228a0e1b",
"score": "0.4802654",
"text": "def agregar(palabra, relacion)\n return if palabra.nil?\n\n @trie.agregar(palabra, relacion)\n end",
"title": ""
},
{
"docid": "69ffb609918cce140b3f8e449a80d04c",
"score": "0.48006558",
"text": "def findCicle(nodes, idInicio, passed)\n if(!passed.any?{|id| id == nodes.operationId})\n passed.push(nodes.operationId)\n nodes.entradas.each { \n |node|\n if(node.operationId != idInicio)\n return findCicle(node, idInicio, passed)\n else\n return true\n end \n }\n else \n return true\n end\n return false\nend",
"title": ""
},
{
"docid": "b3fb7f788a9ada2c8998a2d7bcf3005a",
"score": "0.4797491",
"text": "def aniade_taxones_seleccionados\n notice = if params[:especies].present?\n @listas.each do |lista|\n lista = Lista.find(lista)\n lista.cadena_especies.present? ? lista.cadena_especies+= ',' + params[:especies].join(',') :\n lista.cadena_especies = params[:especies].join(',')\n lista.save\n end\n 'Taxones incluidos correctamente.'\n else\n 'Debes seleccionar por lo menos una lista y un taxon para poder incluirlo.'\n end\n\n redirect_to :back, :notice => notice\n end",
"title": ""
},
{
"docid": "869cb90f43b3419e4abdd301df12fd63",
"score": "0.4796592",
"text": "def detect(sexo,tempo_empresa)\n\t\tkey = sexo + tempo_empresa.to_i.to_s\n\t\tnode = self.get(key)\n\tend",
"title": ""
},
{
"docid": "67c06ab78e3ba0d40ea314dc955ad145",
"score": "0.47960892",
"text": "def insert_tail(nodo)\n if (nodo.instance_of? Nodo) == false\n nodo = Nodo.new(nodo,nil,nil)\n end\n raise \"Error la lista debe contener nodos\" unless ( nodo.instance_of? Nodo )\n @tail.next = nodo\n nodo.prev = @tail\n nodo.next = nil\n @nodos = @nodos +1\n @tail = nodo\n end",
"title": ""
},
{
"docid": "c2203ec6bf9e96247fbe68828c06ee6f",
"score": "0.47951323",
"text": "def modelo_carne_build_data_right(doc, boleto, colunas, linhas)\n # LOGOTIPO do BANCO\n doc.image boleto.logotipo, x: (colunas[2] - 0.11), y: linhas[0]\n\n # Numero do banco\n doc.moveto x: colunas[4], y: linhas[0]\n doc.show \"#{boleto.banco}-#{boleto.banco_dv}\", tag: :grande\n\n # linha digitavel\n doc.moveto x: colunas[6], y: linhas[0]\n doc.show boleto.codigo_barras.linha_digitavel, tag: :media\n\n # local de pagamento\n doc.moveto x: colunas[2], y: linhas[1]\n doc.show boleto.local_pagamento\n\n # vencimento\n doc.moveto x: colunas[11], y: linhas[1]\n doc.show boleto.data_vencimento.to_s_br\n\n # cedente\n doc.moveto x: colunas[2], y: linhas[2]\n doc.show boleto.cedente\n\n # agencia/codigo cedente\n doc.moveto x: colunas[11], y: linhas[2]\n doc.show boleto.agencia_conta_boleto\n\n # data do documento\n doc.moveto x: colunas[2], y: linhas[3]\n doc.show boleto.data_documento.to_s_br if boleto.data_documento\n\n # numero documento\n doc.moveto x: colunas[3], y: linhas[3]\n doc.show boleto.documento_numero\n\n # especie doc.\n doc.moveto x: colunas[8], y: linhas[3]\n doc.show boleto.especie_documento\n\n # aceite\n doc.moveto x: colunas[9], y: linhas[3]\n doc.show boleto.aceite\n\n # dt processamento\n doc.moveto x: colunas[10], y: linhas[3]\n doc.show boleto.data_processamento.to_s_br if boleto.data_processamento\n\n # nosso numero\n doc.moveto x: colunas[11], y: linhas[3]\n doc.show boleto.nosso_numero_boleto\n\n # uso do banco\n ## nada...\n\n # carteira\n doc.moveto x: colunas[3], y: linhas[4]\n doc.show boleto.carteira\n\n # especie\n doc.moveto x: colunas[5], y: linhas[4]\n doc.show boleto.especie\n\n # quantidade\n doc.moveto x: colunas[7], y: linhas[4]\n doc.show boleto.quantidade\n\n # valor documento\n doc.moveto x: colunas[8], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # valor do documento\n doc.moveto x: colunas[11], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # Instruções\n doc.moveto x: colunas[2], y: linhas[5]\n doc.show boleto.instrucao1\n doc.moveto x: colunas[2], y: linhas[6]\n doc.show boleto.instrucao2\n doc.moveto x: colunas[2], y: linhas[7]\n doc.show boleto.instrucao3\n doc.moveto x: colunas[2], y: linhas[8]\n doc.show boleto.instrucao4\n doc.moveto x: colunas[2], y: linhas[9]\n doc.show boleto.instrucao5\n doc.moveto x: colunas[2], y: linhas[10]\n doc.show boleto.instrucao6\n\n # Sacado\n doc.moveto x: colunas[2], y: linhas[11]\n if boleto.sacado && boleto.sacado_documento\n doc.show \"#{boleto.sacado} - #{boleto.sacado_documento.formata_documento}\"\n end\n\n # Sacado endereço\n doc.moveto x: colunas[2], y: linhas[12]\n doc.show boleto.sacado_endereco.to_s\n\n # codigo de barras\n # Gerando codigo de barra com rghost_barcode\n if boleto.codigo_barras\n doc.barcode_interleaved2of5(boleto.codigo_barras, width: '10.3 cm', height: '1.2 cm', x: colunas[2],\n y: linhas[14])\n end\n end",
"title": ""
},
{
"docid": "c9c518b9c7f95760348c002cda9e5a59",
"score": "0.47938964",
"text": "def insert(key, value=nil)\n if key.kind_of?(Array)\n key, value = key\n end\n if key.nil? || value.nil?\n raise CorpusError.new(\"Invalid key/value: #{key} - #{value}\")\n end\n\n ret = @db.put(key.to_s.downcase ,value.to_s.downcase)\n if !ret\n raise CorpusError.new(\"#{@db.errmsg}: #{key} - #{value}\")\n end\n end",
"title": ""
},
{
"docid": "054c6dc2a62f1c6b2deed638b49b66ee",
"score": "0.47910517",
"text": "def insert(data)\n @nodes << data\n heapify_up\n end",
"title": ""
},
{
"docid": "30e632d763daaad28ab3b4f19b96780d",
"score": "0.47903413",
"text": "def detect(sexo,idade)\n\t\tkey = sexo + idade.to_i.to_s\n\t\tnode = self.get(key)\n\tend",
"title": ""
},
{
"docid": "7036cc89f105499f49bdc0a728300218",
"score": "0.47899786",
"text": "def cargos_solicitud(presupuesto)\n delete = \"Delete FROM public.sep_solicitudcargos where numsol='#{self.numsol}';\" \n cargo = \"\"\" INSERT INTO public.sep_solicitudcargos (codemp, numsol, codcar, codestpro1, codestpro2, codestpro3, codestpro4, codestpro5, spg_cuenta, cod_pro, ced_bene, sc_cuenta, formula) \n SELECT distinct '0001' as codemp,A.numsol,A.codcar,\n '#{presupuesto[:codestpro1]}' as codestpro1,'#{presupuesto[:codestpro2]}' as codestpro2,\n '#{presupuesto[:codestpro3]}' as codestpro3,'#{presupuesto[:codestpro4]}' as codestpro4,\n '#{presupuesto[:codestpro5]}' as codestpro5,trim(spg_cuenta),'----------' as cod_pro,'----------' as ced_bene, \n '11212000spg_ep30001 ' as sc_cuenta, A.formula \n FROM public.sep_dta_cargos A JOIN public.sigesp_cargos using (codemp, codcar) \n WHERE A.numsol = '#{self.numsol}' \n UNION ALL\n SELECT distinct '0001' as codemp,A.numsol,A.codcar,\n '#{presupuesto[:codestpro1]}' as codestpro1,'#{presupuesto[:codestpro2]}' as codestpro2,\n '#{presupuesto[:codestpro3]}' as codestpro3,'#{presupuesto[:codestpro4]}' as codestpro4,\n '#{presupuesto[:codestpro5]}' as codestpro5, trim(spg_cuenta),'----------' as cod_pro,'----------' as ced_bene,\n '11212000spg_ep30001 ' as sc_cuenta, A.formula \n FROM public.sep_dts_cargos A JOIN public.sigesp_cargos using (codemp, codcar) \n WHERE A.numsol = '#{self.numsol}'; \"\"\"\n Sigesp::Solicitud.connection.execute(delete)\n Sigesp::Solicitud.connection.execute(cargo)\n end",
"title": ""
}
] |
a729edf90176ebe6c0660089d4e592f0
|
Return true of false if the given subtree exists or not
|
[
{
"docid": "cfd33ab8b8fc52f643b468e21bb82f7c",
"score": "0.78605443",
"text": "def has_subtree?(path)\n\t\tbegin\n\t\t\tfind_subtree(path)\n\t\t\treturn true\n\t\trescue PathNotFoundError\n\t\t\treturn false\n\t\tend\n\tend",
"title": ""
}
] |
[
{
"docid": "ad52c66c00e84b8cc0e4f78e108c4c80",
"score": "0.8092718",
"text": "def exist?\n @subtree_testrun_directory.exist?\n end",
"title": ""
},
{
"docid": "e44020e020e9dd36b7a16b16c3832f24",
"score": "0.7958296",
"text": "def subtree?\n \n return true\n \n end",
"title": ""
},
{
"docid": "0a5e362eae327fece617aa254882bc22",
"score": "0.726665",
"text": "def is_subtree(s, t)\n return false if s.nil? || t.nil?\n is_subtree_helper(s, t) || is_subtree(s.left, t) || is_subtree(s.right, t)\nend",
"title": ""
},
{
"docid": "8e84696ebbeb01e825a73d7698a1e504",
"score": "0.7248256",
"text": "def contains_tree?(another_tree)\n self.any? do |node|\n node.contains(another_tree)\n end\n end",
"title": ""
},
{
"docid": "64b80a7fcb5ee776e06d20ffa42b350e",
"score": "0.7240209",
"text": "def exist?(node, val)\n return false if node.nil?\n return true if node.value == val\n exist?(node.left, val) or exist?(node.right, val)\nend",
"title": ""
},
{
"docid": "1d0d720d6de4b50baca58d27820b49a1",
"score": "0.723888",
"text": "def isSubtree(t1, t2)\n return true if identify(t1, t2) || t2.nil?\n return false if t1.nil?\n return true if isSubtree(t1.left, t2)\n return true if isSubtree(t1.right, t2)\n false\nend",
"title": ""
},
{
"docid": "9d87edd63ea98efbc3631a95a66e1938",
"score": "0.71864545",
"text": "def leaf?\n !children.exists?\n end",
"title": ""
},
{
"docid": "d56e31a3a9c30eca6a16267c4c68bbc6",
"score": "0.71652603",
"text": "def has_node?(node)\n not find(node).nil?\n end",
"title": ""
},
{
"docid": "dd8070623779b1e6fabbaf2dc7a321fe",
"score": "0.71114665",
"text": "def check_subtree(t1, t2)\n return false if t1.nil?\n return true if t1.data == t2.data && compare_trees(t1, t2)\n check_subtree(t1.left, t2) || check_subtree(t1.right, t2)\nend",
"title": ""
},
{
"docid": "f5a6f22393cf59f848cfc813450ed639",
"score": "0.7086977",
"text": "def check_subtree\n if children.empty?\n return false unless left and right\n # puts \"NO children: left = #{left}, right = #{right}, expected: #{left + 1}\" unless right - left == 1\n right - left == 1\n else\n n = left\n for c in (children)\n return false unless c.left and c.right\n return false unless c.left == n + 1 \n return false unless c.check_subtree\n n = c.right\n end\n # puts \"children: left = #{left}, right = #{right}, expected: #{n + 1}\" unless right == n + 1\n right == n + 1\n end\n end",
"title": ""
},
{
"docid": "7905030a9f3de4a2eb52921e7dca898b",
"score": "0.6994867",
"text": "def has_element name, root\n if root.name == name and root.element_children.length > 0\n return true\n else\n root.children.each do |child|\n if has_element name, child\n return true\n end\n end\n end\n false\nend",
"title": ""
},
{
"docid": "4d2e85e90c38956bb80b33c1de387a32",
"score": "0.69916284",
"text": "def has(name)\n thing = root.find(name)\n children.select{|child| child == thing}.any?\n end",
"title": ""
},
{
"docid": "df903a4ac02f3c7b38bdd81732c221c5",
"score": "0.691811",
"text": "def leaf?\n children.length == 0\n end",
"title": ""
},
{
"docid": "a1566b58ace1d2f9f19eeb9e80ecbd78",
"score": "0.69071317",
"text": "def has_children?\n !leaf?\n end",
"title": ""
},
{
"docid": "e829d7d4c6dd95051ef50bee07723a74",
"score": "0.6901429",
"text": "def missing_children?\n !missing_children.empty?\n end",
"title": ""
},
{
"docid": "71e4def55fb6ccccf200ec97415d8c3d",
"score": "0.6893375",
"text": "def is_subtree(root, sub)\n stack = [root]\n while !stack.empty?\n current = stack.pop\n stack.push current.left if current.left\n stack.push current.right if current.right\n if current.val == sub.val\n return true if is_same_tree(current, sub)\n end\n end\n false\nend",
"title": ""
},
{
"docid": "63d043beee3f2e44e550cc4c5a392ff3",
"score": "0.68911976",
"text": "def structure_contains?(element, node)\n return false unless node\n return true if element == node.value\n structure_contains?(element,node.left) || structure_contains?(element,node.right)\n end",
"title": ""
},
{
"docid": "f7c538ca8544e8fb73aad24ea7edef99",
"score": "0.6877752",
"text": "def valid_tree?\n false\n end",
"title": ""
},
{
"docid": "f4a16472703ee9c768eed2839ed5002a",
"score": "0.68525773",
"text": "def is_tree?(c)\n %w[# X].include?(c)\nend",
"title": ""
},
{
"docid": "f8810da7ed56667e6a9cd6ccf93e658c",
"score": "0.6850744",
"text": "def leaf?(r)\n r.children.empty?\n end",
"title": ""
},
{
"docid": "d11a44fb26593cc399ef74cddb7a4a6e",
"score": "0.6849867",
"text": "def valid_tree?\n true\n end",
"title": ""
},
{
"docid": "faabc456b4f4759cede6282152b57090",
"score": "0.6836441",
"text": "def has_nodes?\n @values.any? {|e| e.node? || e.list? && e.has_nodes?}\n end",
"title": ""
},
{
"docid": "78a1c3a52ed88f06c34b31ffe30179bb",
"score": "0.68355525",
"text": "def contains?(element)\n structure_contains?(element,@root)\n end",
"title": ""
},
{
"docid": "6d94282f8bfc3b640ef21b8abafa76e1",
"score": "0.682544",
"text": "def contains?(value, root_node )\n return if root_node.nil?\n\n start_node = root_node\n contains?(value, start_node)\n result = true if start_node.value == value\n result = true if start_node.left_child.value == value\n result = true if start_node.right_child.value == value\n result\n end",
"title": ""
},
{
"docid": "032c6006c271ba0803607944fe80f7be",
"score": "0.680819",
"text": "def valid_tree?\n true\n end",
"title": ""
},
{
"docid": "032c6006c271ba0803607944fe80f7be",
"score": "0.680819",
"text": "def valid_tree?\n true\n end",
"title": ""
},
{
"docid": "0c0b0a69f074ae68689004c9622dc7f0",
"score": "0.68040425",
"text": "def leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "0c0b0a69f074ae68689004c9622dc7f0",
"score": "0.68040425",
"text": "def leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "0c0b0a69f074ae68689004c9622dc7f0",
"score": "0.68040425",
"text": "def leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "0c0b0a69f074ae68689004c9622dc7f0",
"score": "0.68040425",
"text": "def leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "0c0b0a69f074ae68689004c9622dc7f0",
"score": "0.68040425",
"text": "def leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "5fc3d4874d30b65d3d4a3f3c26424a96",
"score": "0.68029517",
"text": "def leaf?\n self.children.empty?\n end",
"title": ""
},
{
"docid": "3f61e3e8b38094162189304894c59ca1",
"score": "0.6781067",
"text": "def contains?(element)\n return @bst.contains?(element)\n end",
"title": ""
},
{
"docid": "89279afee3ee72d5624ee633e4894d09",
"score": "0.6777758",
"text": "def node_exists?(nodename)\n search_results.include?(nodename)\n end",
"title": ""
},
{
"docid": "0c145bd19dbd2787a49a8d54b17bb3e4",
"score": "0.6767698",
"text": "def has_node(branch,node)\n default = false\n return false if branch['children'].count==0\n branch['children'].map do |leaf|\n if leaf['text'] == node\n return true\n end\n end\n return default\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "915e2b4a53edf051b94fa664fec455f5",
"score": "0.676397",
"text": "def has_children?\n self.children.any?\n end",
"title": ""
},
{
"docid": "5a2e34590a02313008874d134a01d90c",
"score": "0.67636025",
"text": "def has_children?\n children.any?\n end",
"title": ""
},
{
"docid": "5a2e34590a02313008874d134a01d90c",
"score": "0.67636025",
"text": "def has_children?\n children.any?\n end",
"title": ""
},
{
"docid": "7b1af8124d04a450743c2a14c69a6fce",
"score": "0.6762246",
"text": "def valid_bst_a?(tree)\n valid_bst_node?(tree.root)\nend",
"title": ""
},
{
"docid": "78c1d38d714f19eff8a0930197591db3",
"score": "0.6761522",
"text": "def node_exists?(node_name)\n\t\t\t@nodes.select{ |k, v| v.name == node_name}.any?\n\t\tend",
"title": ""
},
{
"docid": "924693299f6893dfdfcab199c43db4ca",
"score": "0.6758241",
"text": "def leaf?\n self.children.size == 0\n end",
"title": ""
},
{
"docid": "85f46154b8a9cb1e51421a4041d4224b",
"score": "0.6748908",
"text": "def leaf?\n children.length == 0\n end",
"title": ""
},
{
"docid": "36a124d6810ff65b231675edc426e6ff",
"score": "0.674535",
"text": "def node_exists(path)\n # The root always exists\n return true if path == ''\n\n (parent, base) = Tilia::Http::UrlUtil.split_path(path)\n\n parent_node = node_for_path(parent)\n return false unless parent_node.is_a? ICollection\n parent_node.child_exists(base)\n rescue Exception::NotFound => e\n false\n end",
"title": ""
},
{
"docid": "d382974c33b327cb19813476fb0b7aaf",
"score": "0.6733813",
"text": "def has_node? node\n nodes.include? node\n end",
"title": ""
},
{
"docid": "13d39712166aac803ff64eeeb0f5f945",
"score": "0.6729455",
"text": "def has_ancestor?(node, tags); end",
"title": ""
},
{
"docid": "59361ffea6cbf29baac299d135e15478",
"score": "0.672752",
"text": "def leaf?\n children.nil? || children.empty?\n end",
"title": ""
},
{
"docid": "f73e777d897dd953d5ed4f3bb9ad4eac",
"score": "0.6718377",
"text": "def has_node?(name)\n !node(name).nil?\n end",
"title": ""
},
{
"docid": "8df00efd877ea5bf545a7190230ee253",
"score": "0.67073107",
"text": "def contains?(key)\n\t\treturn contains_at_node?(key,@root_node)\n\tend",
"title": ""
},
{
"docid": "e1cda5c2e59034fab0ab161565efe248",
"score": "0.6703272",
"text": "def node_exists?(*term_pointer)\n !find_by_terms(*term_pointer).empty?\n end",
"title": ""
},
{
"docid": "77e76487bb11602357326e89c1d3fe54",
"score": "0.6679663",
"text": "def leaf?\n children.none?\n end",
"title": ""
},
{
"docid": "3f3ccd9fd6abda06e3cbec9a033b778e",
"score": "0.6671067",
"text": "def isLeaf?\r\n !hasChildren?\r\n end",
"title": ""
},
{
"docid": "6fde83ebd59b25ba15867f8bdf52afc0",
"score": "0.6671006",
"text": "def nodeExists name\n\t\treturn @nodes[name] != nil\n\tend",
"title": ""
},
{
"docid": "be1a7df7c7348dec30ba0f8d5cc98ee7",
"score": "0.6670619",
"text": "def has_grandchildren?\n return false if children.size == 0\n return false if children.first.is_a?(LeafMatrix)\n true\n end",
"title": ""
},
{
"docid": "c0e3f8d120745f8339d0c9a7491f6160",
"score": "0.6669569",
"text": "def leaf?\n if (@children.empty?)\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "919d5f3e0455aac697509c7d7b5a51a7",
"score": "0.6669499",
"text": "def leaf?\n children.size.zero?\n end",
"title": ""
},
{
"docid": "2a71ddd16ef28fa9b47dcd46498ac28d",
"score": "0.6668859",
"text": "def empty?\n @tree.empty?\n end",
"title": ""
},
{
"docid": "2a67e2849131eb8f5d8a953bfbbb8bd8",
"score": "0.6664884",
"text": "def has_child?\n self.children.length > 0 ? true : false\n end",
"title": ""
},
{
"docid": "97ce21606efacae1cb0123091dd9aeeb",
"score": "0.6658828",
"text": "def leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "8ae3d9a9e0b15d58090249f3dfb08bec",
"score": "0.6658119",
"text": "def is_leaf?\n children.empty?\n end",
"title": ""
},
{
"docid": "1d4cf72792458f835aad7eb9cabd14b5",
"score": "0.6654099",
"text": "def has_node?\n @nodes.length > 0\n end",
"title": ""
},
{
"docid": "e40b98d2be60f08f242fb1221fed4328",
"score": "0.6652138",
"text": "def leaf?\n children.size == 0\n end",
"title": ""
},
{
"docid": "b251a51b50a612d902606eea452849af",
"score": "0.6651335",
"text": "def has_children?\n self.children.size > 0\n end",
"title": ""
},
{
"docid": "b251a51b50a612d902606eea452849af",
"score": "0.6651335",
"text": "def has_children?\n self.children.size > 0\n end",
"title": ""
},
{
"docid": "b251a51b50a612d902606eea452849af",
"score": "0.6651335",
"text": "def has_children?\n self.children.size > 0\n end",
"title": ""
},
{
"docid": "b251a51b50a612d902606eea452849af",
"score": "0.6651335",
"text": "def has_children?\n self.children.size > 0\n end",
"title": ""
},
{
"docid": "b251a51b50a612d902606eea452849af",
"score": "0.6651335",
"text": "def has_children?\n self.children.size > 0\n end",
"title": ""
},
{
"docid": "b251a51b50a612d902606eea452849af",
"score": "0.6651335",
"text": "def has_children?\n self.children.size > 0\n end",
"title": ""
},
{
"docid": "6cd8c392431b4e4ab2a43b3be1664b7a",
"score": "0.66464037",
"text": "def hasChildren?\n @children.length != 0\n end",
"title": ""
},
{
"docid": "0d68727dd358bea1e7bf618dfa988580",
"score": "0.6643947",
"text": "def contains?(&block)\n children.each do |node|\n return true if yield(node)\n return true if node.is_a?(Node) && node.contains?(&block)\n end\n false\n end",
"title": ""
},
{
"docid": "7d57c80bc5bb69c85bc5e1b8317f15d4",
"score": "0.6637846",
"text": "def has_children?\n self.children.size > 0 \n end",
"title": ""
},
{
"docid": "7d57c80bc5bb69c85bc5e1b8317f15d4",
"score": "0.6637846",
"text": "def has_children?\n self.children.size > 0 \n end",
"title": ""
},
{
"docid": "7d57c80bc5bb69c85bc5e1b8317f15d4",
"score": "0.6637846",
"text": "def has_children?\n self.children.size > 0 \n end",
"title": ""
},
{
"docid": "7d57c80bc5bb69c85bc5e1b8317f15d4",
"score": "0.6637846",
"text": "def has_children?\n self.children.size > 0 \n end",
"title": ""
},
{
"docid": "7d57c80bc5bb69c85bc5e1b8317f15d4",
"score": "0.6637846",
"text": "def has_children?\n self.children.size > 0 \n end",
"title": ""
},
{
"docid": "7d57c80bc5bb69c85bc5e1b8317f15d4",
"score": "0.6637846",
"text": "def has_children?\n self.children.size > 0 \n end",
"title": ""
},
{
"docid": "d9349f05fed9909043d4b03c4820e6e3",
"score": "0.6630244",
"text": "def presence\n @tree or Nothing\n end",
"title": ""
},
{
"docid": "5385c70d148f307c8cef3ad15c08cb68",
"score": "0.66187793",
"text": "def has_children?\n !children.empty?\n end",
"title": ""
},
{
"docid": "5385c70d148f307c8cef3ad15c08cb68",
"score": "0.66187793",
"text": "def has_children?\n !children.empty?\n end",
"title": ""
},
{
"docid": "897083f71dc4d2f85851bd5ce81b1415",
"score": "0.6615299",
"text": "def contains?(key)\n search(@root, key) != nil\n end",
"title": ""
},
{
"docid": "897083f71dc4d2f85851bd5ce81b1415",
"score": "0.6615299",
"text": "def contains?(key)\n search(@root, key) != nil\n end",
"title": ""
},
{
"docid": "897083f71dc4d2f85851bd5ce81b1415",
"score": "0.6615299",
"text": "def contains?(key)\n search(@root, key) != nil\n end",
"title": ""
},
{
"docid": "90ec3478b776d8348e141c933129813d",
"score": "0.6614929",
"text": "def leaf?(node)\n include_node?(node) && child_at(node).empty?\n end",
"title": ""
},
{
"docid": "42f64579c6c518eaf88823ca9e22ed34",
"score": "0.6604969",
"text": "def node_exists?(node_name)\n @nodes.has_key?(node_name)\n end",
"title": ""
},
{
"docid": "3615b5453ea6ef0c8afe207a63d6c7bc",
"score": "0.65895814",
"text": "def contains?(element)\n node = @root\n while node\n return true if node.value == element\n node = element < node.value ? node.left : node.right\n end\n return false\n end",
"title": ""
},
{
"docid": "6ece0cf11709f7f49bb5c05558747aa7",
"score": "0.658869",
"text": "def root_exists?\n !(@root.nil?)\n end",
"title": ""
},
{
"docid": "7a443dd423260e1bdca12de902617eb5",
"score": "0.6586448",
"text": "def leaf?\r\n @left == nil && @right == nil\r\n end",
"title": ""
},
{
"docid": "ea2aeb1416a1e6ae951157a0b7eb0631",
"score": "0.6568022",
"text": "def leaf?\n self.children.empty?\n end",
"title": ""
},
{
"docid": "4ad444f8d0d8b14da15818f00c89c338",
"score": "0.65613395",
"text": "def has_children?\n children.count > 0\n end",
"title": ""
},
{
"docid": "2e219b4db3e22463573e174c3f528f76",
"score": "0.6560808",
"text": "def full?\n traverse do |node|\n if !node.leaf? && (node.right_child.nil? || node.right_child.nil?)\n return false\n end\n end\n true\n end",
"title": ""
},
{
"docid": "fbbd9ffbb761e9179e3402130f98ae14",
"score": "0.655967",
"text": "def contains?(element)\n node = @root\n while node\n return true if node.value == element\n node = element < node.value ? node.left : node.right\n end\n false\n end",
"title": ""
}
] |
67ddcdf3592d4b5ca53921e50153eb9f
|
def fetchList [Bookmark.new('', 1)] end def empty? list.nil? || list.length.zero? end
|
[
{
"docid": "ffc0d65a3afb378d6e51f7926f0fe78f",
"score": "0.0",
"text": "def add(bookmark)\n @list << bookmark.add_id(@list.length + 1)\n end",
"title": ""
}
] |
[
{
"docid": "940e9166b43ec8b4460621c2ac1cb778",
"score": "0.66476774",
"text": "def list\r\n @list.empty? ? list! : @list\r\n end",
"title": ""
},
{
"docid": "b867eec78fce441b2efc68f95f878bb6",
"score": "0.6607832",
"text": "def empty?\n @list.head.nil?\n end",
"title": ""
},
{
"docid": "38b7af774e34f938e7b9d4904ff0fb7e",
"score": "0.65141445",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "38b7af774e34f938e7b9d4904ff0fb7e",
"score": "0.65141445",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "38b7af774e34f938e7b9d4904ff0fb7e",
"score": "0.65141445",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "38b7af774e34f938e7b9d4904ff0fb7e",
"score": "0.65141445",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "abe9c90d06b8f3aa9d4568ad63f26751",
"score": "0.6470914",
"text": "def empty?\n list.empty?\n end",
"title": ""
},
{
"docid": "89dec3e52cf637f4be903c9a40f2f135",
"score": "0.64521617",
"text": "def empty?\n return @list.empty?\n end",
"title": ""
},
{
"docid": "0afbff493a3332df24a6944b6ebd22a0",
"score": "0.64400303",
"text": "def empty!\n @list = []\n end",
"title": ""
},
{
"docid": "8b31ddddf3a9035ee53735156650de92",
"score": "0.63223445",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "8b31ddddf3a9035ee53735156650de92",
"score": "0.63223445",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "c3df48c02470dfebfa81a683edde073e",
"score": "0.6185225",
"text": "def empty\n empty_lists\n end",
"title": ""
},
{
"docid": "291b30306fd7c32d5cc12629d4176950",
"score": "0.61309344",
"text": "def empty?\n @list.empty?\n end",
"title": ""
},
{
"docid": "71cfcd54803e4afa7dc393a58260e746",
"score": "0.610819",
"text": "def list; end",
"title": ""
},
{
"docid": "71cfcd54803e4afa7dc393a58260e746",
"score": "0.610819",
"text": "def list; end",
"title": ""
},
{
"docid": "71cfcd54803e4afa7dc393a58260e746",
"score": "0.610819",
"text": "def list; end",
"title": ""
},
{
"docid": "71cfcd54803e4afa7dc393a58260e746",
"score": "0.610819",
"text": "def list; end",
"title": ""
},
{
"docid": "71cfcd54803e4afa7dc393a58260e746",
"score": "0.610819",
"text": "def list; end",
"title": ""
},
{
"docid": "71cfcd54803e4afa7dc393a58260e746",
"score": "0.610819",
"text": "def list; end",
"title": ""
},
{
"docid": "768735655a84854944c80c98f6ea0e19",
"score": "0.6046467",
"text": "def black_list url_list=[]\n @black_list = url_list\nend",
"title": ""
},
{
"docid": "42e40fb50f68429c8f60fca558d241e1",
"score": "0.60135734",
"text": "def list()\n []\n end",
"title": ""
},
{
"docid": "8cbf3d8a5159b614183f6f4771a29d21",
"score": "0.6008948",
"text": "def list_empty?\n return (@first_node == nil && @last_node == nil) ? true : false\n end",
"title": ""
},
{
"docid": "728f3bdfc7bee64c76fcda166f7f61b1",
"score": "0.5953367",
"text": "def list() @list; end",
"title": ""
},
{
"docid": "55f652e4288807265c496fe9ebd71acf",
"score": "0.59480596",
"text": "def empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "55f652e4288807265c496fe9ebd71acf",
"score": "0.59462523",
"text": "def empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "55f652e4288807265c496fe9ebd71acf",
"score": "0.59462523",
"text": "def empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "55f652e4288807265c496fe9ebd71acf",
"score": "0.59462523",
"text": "def empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "55f652e4288807265c496fe9ebd71acf",
"score": "0.59462523",
"text": "def empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "0fb472e42df34f186e83b62eb89f2e85",
"score": "0.59343183",
"text": "def empty\n empty_lists\n end",
"title": ""
},
{
"docid": "57c909f928aa513d44274c11a0e0c4af",
"score": "0.59203124",
"text": "def list\n load if @list.nil?\n\n @list\n end",
"title": ""
},
{
"docid": "4cc1c4a53ee4ecaad19168c1e702bb33",
"score": "0.58964646",
"text": "def can_be_made\r\n @list = []\r\nend",
"title": ""
},
{
"docid": "b89a20fbf4885b4c479477a3021d44a1",
"score": "0.5888256",
"text": "def is_empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "247e0c62453df113389c1f137a2cfe4c",
"score": "0.5885793",
"text": "def empty?\n !head\n end",
"title": ""
},
{
"docid": "247e0c62453df113389c1f137a2cfe4c",
"score": "0.5885793",
"text": "def empty?\n !head\n end",
"title": ""
},
{
"docid": "6c0827b796b59da652497596265d682b",
"score": "0.5871189",
"text": "def empty?\n\t\tp = @head[0].get_link\n\t\tpp, m = p[0].get\n\t\twhile m do\n\t\t\tp = pp\n\t\t\tpp, m = p[0].get\n\t\tend\n\t\tp.equal? @tail\n\tend",
"title": ""
},
{
"docid": "c878f431ea26c569e62f39107b03cd6f",
"score": "0.5861578",
"text": "def empty?\n @head == nil\n end",
"title": ""
},
{
"docid": "c878f431ea26c569e62f39107b03cd6f",
"score": "0.5861578",
"text": "def empty?\n @head == nil\n end",
"title": ""
},
{
"docid": "c878f431ea26c569e62f39107b03cd6f",
"score": "0.5861578",
"text": "def empty?\n @head == nil\n end",
"title": ""
},
{
"docid": "c878f431ea26c569e62f39107b03cd6f",
"score": "0.5861578",
"text": "def empty?\n @head == nil\n end",
"title": ""
},
{
"docid": "364ac6f9dccaddf6b1d4c78e02206f76",
"score": "0.5858118",
"text": "def list?\n tail.cdr == NULL; end",
"title": ""
},
{
"docid": "2382ef5566d365e0d879315a527e16b3",
"score": "0.58527344",
"text": "def initialize()\n @list = nil\n end",
"title": ""
},
{
"docid": "fea01f8686f56023ef67f4a2502a8d8d",
"score": "0.58466566",
"text": "def is_empty()\n @head == nil\n end",
"title": ""
},
{
"docid": "5342979b2bd972813867c4bfd111ef16",
"score": "0.58411664",
"text": "def empty?\n @head.nil?\n end",
"title": ""
},
{
"docid": "3a3e3b91ca03a5a327e2c7536f9e0354",
"score": "0.58376527",
"text": "def empty?\r\n\t\t@head.nil?\r\n\tend",
"title": ""
},
{
"docid": "e98b8e82c2f50d02177329768ecc2f83",
"score": "0.58278483",
"text": "def is_empty?\n\t\t@head.nil?\n\tend",
"title": ""
},
{
"docid": "6b7dcd72eb93b78536965a1d622f2cc2",
"score": "0.5801209",
"text": "def head\n @list && @list.size > 0 ? 0 : nil\n end",
"title": ""
},
{
"docid": "8c5e215bd752345af5ac37d1417407cb",
"score": "0.57872057",
"text": "def make_list\n {}\nend",
"title": ""
},
{
"docid": "161e5bfeb768cb6029311a6ab913374b",
"score": "0.57626975",
"text": "def check_empty_list\n throw \":empty list\" if self.empty?\n end",
"title": ""
},
{
"docid": "efd3a40676ba98dd6f3ff6290d50b288",
"score": "0.5754566",
"text": "def empty?\n urls.empty?\n end",
"title": ""
},
{
"docid": "adeec79b609d278f06672fb182950fff",
"score": "0.5735653",
"text": "def initialize\n\t\t@list = []\n\tend",
"title": ""
},
{
"docid": "5a2c0a1a259a1a3ea42ff0417c0a5b71",
"score": "0.573149",
"text": "def empty?\n head.nil?\n end",
"title": ""
},
{
"docid": "e9ee721bc293f78e9b2520d65f622c0e",
"score": "0.5720434",
"text": "def parse_list; end",
"title": ""
},
{
"docid": "e8f7f08e3dc7d3899735dc70e6a5f94a",
"score": "0.57080346",
"text": "def empty; end",
"title": ""
},
{
"docid": "225bd9566556ce32acad03e794561bda",
"score": "0.569878",
"text": "def initialize(list_title)\n @title = list_title\n @items = Array.new # Starts empty! No Items yet!\n end",
"title": ""
},
{
"docid": "225bd9566556ce32acad03e794561bda",
"score": "0.569878",
"text": "def initialize(list_title)\n @title = list_title\n @items = Array.new # Starts empty! No Items yet!\n end",
"title": ""
},
{
"docid": "67434b906259911c5bac5c52477afca1",
"score": "0.5683154",
"text": "def empty_list(empty,list)\n#This is code to check to see if the shopping list is empty\n#returns empty as true if empty\t\n\tif list.include?(\"shopping list is empty\")\n\t\tputs \"\"\n\t\tputs \"Currently your shopping list is empty\"\n\t\tputs \"\"\n\t\t\tloop do\n\t\t\t\tprint \"Press <ENTER> to return to the main menu: \"\n\t\t\t\tans=gets.chomp\n\t\t\t\tbreak if ans==\"\"\n\t\t\tend\n\t\tempty = true\n\t\treturn empty\n\tend\nend",
"title": ""
},
{
"docid": "f76f54ed40888b7883968b555b52e5a2",
"score": "0.56796473",
"text": "def initialize(list_title)\n @title = list_title\n @items = Array.new # Starts empty! No Items yet!\n end",
"title": ""
},
{
"docid": "f0166467553ab2c473ed662a42736d60",
"score": "0.5673428",
"text": "def list \n end",
"title": ""
},
{
"docid": "c637b13f47f93e69f5f052085bb4d6bc",
"score": "0.5650064",
"text": "def __list ; @list ; end",
"title": ""
},
{
"docid": "2d40b45b6b0a3abd6390dbfdb84dac39",
"score": "0.56392455",
"text": "def initialize(list_title)\n @title = list_title\n @items = Array.new # Starts empty! No Items yet!\n end",
"title": ""
},
{
"docid": "54cd39b2bd3e7848aa8ea3d086041087",
"score": "0.563918",
"text": "def empty?\n head.nil?\n end",
"title": ""
},
{
"docid": "617b6ce8f8b74f9ca18f7a15b828eed8",
"score": "0.5637751",
"text": "def empty?\n @rootlist.nil?\n end",
"title": ""
},
{
"docid": "02798773813d40bce594a286e78ec68f",
"score": "0.5637643",
"text": "def can_list?\n\t\tobject.length > 0\n\tend",
"title": ""
},
{
"docid": "ee77536a38857c4fb131bcf9378562d8",
"score": "0.5633568",
"text": "def initialize(list_title)\n\t @title = list_title\n\t @items = Array.new # Starts empty! No Items yet!\n\tend",
"title": ""
},
{
"docid": "e7c4ef36c0468c42f0445a786ad8f608",
"score": "0.5613963",
"text": "def empty?\n @list.size <= @index\n end",
"title": ""
},
{
"docid": "52c0701637f5f4b8372b549042920774",
"score": "0.5610112",
"text": "def initialize\n @list = []\n end",
"title": ""
},
{
"docid": "dc5d791a94ea4a0389a96220a975ab83",
"score": "0.5603464",
"text": "def empty?\n @smart_listing.count == 0\n end",
"title": ""
},
{
"docid": "23b1af9fc9a9eacf7fd556c83080f966",
"score": "0.55827177",
"text": "def is_empty()\n @pointer_obj[:head].nil?\n end",
"title": ""
},
{
"docid": "87a92170e5a4b0db1edef103a5aaf4e4",
"score": "0.55820185",
"text": "def test_get_all_bookmarks\n\n bookmarks = Bookmark.getAll()\n\n assert_equal 4, bookmarks.length\n \n end",
"title": ""
},
{
"docid": "68ce6fdfdcbe2281e943b3784cd4c217",
"score": "0.55812407",
"text": "def bookmarks\n if File.exist?(\"#{ENV[\"HOME\"]}/.shell-fm/bookmarks\")\n return File.open(\"#{ENV[\"HOME\"]}/.shell-fm/bookmarks\", \"r\").collect {|h|\n h.split(\"=\").collect {|k| k.strip }\n }.uniq\n else\n return []\n end\nend",
"title": ""
},
{
"docid": "ec74f3ab342dbd5717399e338b372d42",
"score": "0.557624",
"text": "def clean\r\n @list = []\r\n @list_end = 0\r\n end",
"title": ""
},
{
"docid": "71dc2a103ad86ce99f87479bfd237e90",
"score": "0.5574978",
"text": "def createList(list_size)\n status = false\n\n self.destroyInfo\n\n if list_size >= 0\n status = true\n\n @list = []\n @list_pos = []\n @list_len = []\n end\n return status\n end",
"title": ""
},
{
"docid": "ec688784a7abd995f6d1d2c41657b6e8",
"score": "0.5562123",
"text": "def get_list \n\t\tlist = cookies[:\"eList\"] # liest Rohdaten (string) aus cookie\n\t\tif list == nil # Liste ist leer \n\t\t\tlist = Array.new # erzeuge neue Liste \n\t\telse # Liste enthält Eintrag \n\t\t\tif list.length > 0 \n\t\t\t\tlist = list.split(\" \") #erzeuge lesbare Liste (Array) aus Rohdatensatz\n\t\t\telse\n\t\t\t\tlist = Array.new \n\t\t\tend \n\t\tend \n\t\treturn list \n\tend",
"title": ""
},
{
"docid": "3278431d623f62ae65056302481c8a95",
"score": "0.5549233",
"text": "def create_list_from()\nend",
"title": ""
},
{
"docid": "217ec86df1d7edfb558c5816883c4f64",
"score": "0.55381936",
"text": "def is_empty?\n if self.head == nil\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "8eb1231893a33b06e040c552da19b438",
"score": "0.5534473",
"text": "def list\n @list ||= self.empty? ? [] : [self]\n end",
"title": ""
},
{
"docid": "cb469e9c4d7face4d5bc85e390221fc9",
"score": "0.55281234",
"text": "def list\n res = listFull\n res ? res[0] : nil\n end",
"title": ""
},
{
"docid": "04dd7178145f15ca458df4a6732f5e5b",
"score": "0.5517752",
"text": "def empty?() end",
"title": ""
},
{
"docid": "1ded1909f6471ee61e9ddcf75ee754e7",
"score": "0.5515491",
"text": "def empty?\n return @data.values.first[:list].empty? if @data.size == 1\n @data.empty?\n end",
"title": ""
},
{
"docid": "3845006b60aa2b366679540f752267a0",
"score": "0.551447",
"text": "def empty? \n end",
"title": ""
},
{
"docid": "e7f677de1d5e4b4786ba2e6b422172e3",
"score": "0.5510489",
"text": "def initialize(list_title)\n \t@title=list_title;\n \t@items= Array.new;\n end",
"title": ""
},
{
"docid": "67d6829941769fea8c630d093a1de356",
"score": "0.55085605",
"text": "def create\n \tpp \"Create\"\n \tpp params\n \n @bookmarklist = BookmarkList.new(params[:bookmark_list])\n\n pp @bookmarklist\n\n\n if @bookmarklist.save\n \tif params[:bookmark_list][:picture].present? || params[:bookmark_list][:remote_picture_url].present? \n \t\trender action: \"crop\"\n \telse\n \tredirect_to bookmark_lists_url, notice: 'BookmarkList was successfully created.'\n end\n else\n render action: \"new\"\n end\n\n end",
"title": ""
},
{
"docid": "42c49d56a2e797b733025072e4b5a801",
"score": "0.5507072",
"text": "def initialize(list_title)\n @title = list_title\n @items = Array.new # Starts empty! No items yet!\n end",
"title": ""
},
{
"docid": "800f0e2b13c538c013da597675c94f5f",
"score": "0.550249",
"text": "def initialize(list_title)\n @title = list_title\n @items = Array.new # Empty array to start with\n end",
"title": ""
},
{
"docid": "136dcc06d21196b1326c2dce19a7fc8f",
"score": "0.55013794",
"text": "def empty\nend",
"title": ""
},
{
"docid": "136dcc06d21196b1326c2dce19a7fc8f",
"score": "0.55013794",
"text": "def empty\nend",
"title": ""
},
{
"docid": "136dcc06d21196b1326c2dce19a7fc8f",
"score": "0.55013794",
"text": "def empty\nend",
"title": ""
},
{
"docid": "e76854ba1e75231938ee6589593eb431",
"score": "0.5500149",
"text": "def list\n \tend",
"title": ""
},
{
"docid": "a41a4f14b0eb5fb8a09240651f01e8d8",
"score": "0.549765",
"text": "def empty?; return @results.empty?; end",
"title": ""
},
{
"docid": "a41a4f14b0eb5fb8a09240651f01e8d8",
"score": "0.549765",
"text": "def empty?; return @results.empty?; end",
"title": ""
},
{
"docid": "f519fffb0024f6bac74c1b562c2b8b7e",
"score": "0.5495702",
"text": "def list\n \n end",
"title": ""
},
{
"docid": "a389de15810d75d269355265602e8ae0",
"score": "0.54909736",
"text": "def user_view_list(token, list_id, page_number, sort)\r\n if sort.nil?\r\n sort = 'container_date.descending'\r\n end\r\n url = Settings.machine_readable + 'eg/opac/results?contains=nocontains&query='\r\n #weird screen scraping requirement\r\n url += SecureRandom.hex(13)\r\n url += '&qtype=keyword&bookbag='+ list_id\r\n url += '&sort='+ sort\r\n url += '&limit=10&page=' + page_number.to_s\r\n url += '&loc=' + Settings.location_default\r\n page = scrape_request(url, token)[0]\r\n if test_for_logged_in(page) == false\r\n return 'error'\r\n else\r\n list = List.new\r\n list.sort = sort\r\n list.title = page.parser.css('.result-bookbag-name').text rescue nil\r\n list.description = page.parser.css('.result-bookbag-description').text rescue nil\r\n list.list_id = list_id\r\n list.page = page_number\r\n items = []\r\n page.parser.css('.result_table_row').each do |l|\r\n item_hash = Hash.new\r\n item_hash['record_id'] = l.css('.search_link').attr('name').to_s.gsub('record_','') \r\n item_hash['list_item_id'] = l.css('.result-bookbag-item-id').text.strip rescue nil\r\n notes = Array.new\r\n l.css('.result-bookbag-item-note-id').each do |n|\r\n note = Hash.new\r\n note ['note_id'] = n.text.strip rescue nil\r\n note['note'] = n.next.next.text.strip rescue nil\r\n notes = notes.push(note)\r\n end\r\n item_hash['notes'] = notes\r\n items.push(item_hash)\r\n end\r\n if items.size > 0\r\n list.items = list_items_to_full_items(items)\r\n if page.parser.css('.search_page_nav_link:contains(\"Next\")').present?\r\n list.more_results = \"true\"\r\n end\r\n else\r\n list.items = []\r\n list.title = page.parser.css('.lowhits-bookbag-name').text.strip rescue nil\r\n list.no_items = true\r\n if list.title == ''\r\n list.not_accessible = true\r\n list.error = true\r\n end\r\n end\r\n return list\r\n end\r\n end",
"title": ""
},
{
"docid": "e554d51ae9ccf1873752695fcac28ee3",
"score": "0.5490549",
"text": "def list # for testing \n\tend",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "bdced372a045b0ae4de5039c558e061a",
"score": "0.54886085",
"text": "def empty?\n end",
"title": ""
},
{
"docid": "e53c0bfb414badb8074d80055ede95aa",
"score": "0.548499",
"text": "def fetch(url)\n list = cacher.get 'list-' + url\n return list unless list.nil?\n\n fetcher = HtmlEntry::PageFetcher.new\n fetcher.instructions = instructions\n list = fetcher.fetch(get_document(url))\n\n cacher.put 'list-' + url, list\n\n list\n end",
"title": ""
}
] |
f6fb8ccae830c05529506948824606d1
|
Loads in any default front matter associated with the resource.
|
[
{
"docid": "74c815dc998da544ec33c801097ca894",
"score": "0.5800184",
"text": "def front_matter_defaults\n site.frontmatter_defaults.all(\n relative_path.to_s,\n collection.label.to_sym\n ).with_dot_access\n end",
"title": ""
}
] |
[
{
"docid": "733cab09e579d449d725ea76bf86a938",
"score": "0.60619456",
"text": "def init\n super\n @page_title = page_title\n if @file\n if @file.attributes[:namespace]\n @object = options.object = Registry.at(@file.attributes[:namespace]) || Registry.root\n end\n @breadcrumb_title = \"File: \" + @file.title\n @page_title = \"Cookbook Documentation\"\n sections :layout, [:title, [:diskfile, :cookbook_table]]\n elsif object == '_index.html'\n sections :layout, [:title, [T('chef')]]\n end\nend",
"title": ""
},
{
"docid": "596ade839a3a56cd6e34aa47de113539",
"score": "0.5931874",
"text": "def read_front_matter(input_file)\n $front_matter= YAML.load_file(input_file) || { }\n rescue\n # no front-matter found in input_file\n $front_matter={}\n dd \"WARNING:no front-matter\"\n # TODO: add front-matter automatically\nend",
"title": ""
},
{
"docid": "7df294cf787fcf81c7b380e3e4eecca9",
"score": "0.5825751",
"text": "def initialize_views\n initialize_default_admin_tabs\n initialize_framework_views\n admin.load_default_regions\n end",
"title": ""
},
{
"docid": "101828b45a48b1f620def43db792a4b4",
"score": "0.5741557",
"text": "def frontmatter_defaults\n @frontmatter_defaults ||= FrontmatterDefaults.new(self)\n end",
"title": ""
},
{
"docid": "1c570d96273bfefe6dbc608797c735d3",
"score": "0.57003427",
"text": "def template_setup\n # to be overridden by other controllers\n end",
"title": ""
},
{
"docid": "1c570d96273bfefe6dbc608797c735d3",
"score": "0.57003427",
"text": "def template_setup\n # to be overridden by other controllers\n end",
"title": ""
},
{
"docid": "4861b77492f80105314f0146ab13f8c6",
"score": "0.5689783",
"text": "def load_default_styles; end",
"title": ""
},
{
"docid": "694f09fb926fb3c669f44cb1c8db6e6e",
"score": "0.5680809",
"text": "def init\n super\n\n # Register custom stylesheets\n asset('css/common.css', file('css/common.css', true))\n\n # Generate cookbook pages\n chef = YARD::Registry.all(:chef).first\n chef.cookbooks.each do |cookbook|\n serialize(cookbook)\n end\nend",
"title": ""
},
{
"docid": "42b50b0baa1b782d4e09dbde0b032225",
"score": "0.5675812",
"text": "def basic_setup\n # Setup Initializer\n template \"rest_rails.rb\", \"config/initializers/rest_rails.rb\"\n end",
"title": ""
},
{
"docid": "a7c23ebd0c09acf7d7f3fb6100f2965a",
"score": "0.56722605",
"text": "def set_default_page\n #define the array for the javascripts and stylesheets\n styles_arr = ['application']\n js_arr = []\n #create the new instance of the page object\n @page ||= ::Page.new(\n :title => 'College Dual',\n :stylesheets => styles_arr,\n :javascripts => js_arr\n )\n if devise_controller?\n @page.stylesheets.push.push('sign-in') if (controller_name == 'sessions' and action_name == 'new') or (controller_name == 'registrations' and action_name == 'new')\n end\n end",
"title": ""
},
{
"docid": "b03a63210fe9d6a5870d8c7dfd777fba",
"score": "0.55527306",
"text": "def default_template(action_name = self.action_name)\n view_paths.find_template(default_template_name(action_name), default_template_format)\n rescue ActionView::MissingTemplate\n raise if controller.resource_controller_options[:scaffold_root].blank?\n action_name = \"index\" if action_name.blank?\n \n scaffold_paths = view_paths.class.new\n scaffold_paths.unshift(controller.resource_controller_options[:scaffold_root])\n scaffold_paths.find_template(action_name, default_template_format)\n end",
"title": ""
},
{
"docid": "0863e53d5f1deb1f57fb0f4eb3bf3aea",
"score": "0.55377007",
"text": "def init\n @breadcrumb = []\n if @onefile\n sections :layout\n elsif @file\n if @file.attributes[:namespace]\n @object = options.object = Registry.at(@file.attributes[:namespace]) || Registry.root\n end\n @breadcrumb_title = \"File: \" + @file.title\n @page_title = options[:title]\n sections :layout, [:diskfile, :index]\n elsif @contents\n sections :layout, [:contents]\n else\n case object\n when '_index.html'\n @page_title = options[:title]\n sections :layout, [:index, [:listing, [:files, :objects]]]\n when CodeObjects::Base\n unless object.root?\n cur = object.namespace\n while !cur.root?\n @breadcrumb.unshift(cur)\n cur = cur.namespace\n end\n end\n\n @page_title = format_object_title(object)\n type = object.root? ? :module : object.type\n sections :layout, [T(type)]\n end\n end\nend",
"title": ""
},
{
"docid": "a7436c29e4e4d9c94c9d8cc31b58d2d0",
"score": "0.5533665",
"text": "def make_global_frontpage\n respond_to do |format|\n if !@node.visible?\n format.json { render :json => { :error => I18n.t('nodes.frontpage_cant_be_hidden') }.to_json, :status => :precondition_failed }\n format.xml { head :precondition_failed }\n elsif Node.root.content.set_frontpage!(@node)\n format.json { render :json => { :notice => I18n.t('nodes.frontpage_set') }.to_json, :status => :ok }\n format.xml { head :ok }\n else\n format.json { render :json => { :error => I18n.t('nodes.frontpage_cant_be_set') }.to_json, :status => :precondition_failed }\n format.xml { head :precondition_failed }\n end\n end\n end",
"title": ""
},
{
"docid": "a33cf7a8abfd60b5d715b08bde7c530b",
"score": "0.55133295",
"text": "def load_theme\n end",
"title": ""
},
{
"docid": "a100120a0e949eed8749f1d550e9e800",
"score": "0.5511137",
"text": "def front_page\n\n end",
"title": ""
},
{
"docid": "3a79f5954648ebd0d28d87fc3d181ebf",
"score": "0.5502911",
"text": "def default_controller; end",
"title": ""
},
{
"docid": "45b0a8f5aa605b53c0a3a42423480059",
"score": "0.5471944",
"text": "def set_default_resources\n name = self.name\n namespaced_names = name.split(/::|Controller/)\n\n model_name = namespaced_names.pop.try(:singularize)\n parent_name = namespaced_names.join('::').try(:singularize)\n\n if model_name.present?\n set_resource model_name.constantize\n else\n raise \"#{model_name} based on #{name} does not exist.\"\n end\n\n if parent_name.present?\n parent_klass = parent_name.safe_constantize\n if parent_klass\n set_resource_parent parent_klass\n else\n logger.debug \"[lazy_crud] #{parent_name} could not be found as a class / module.\"\n end\n end\n end",
"title": ""
},
{
"docid": "bf359e8252c80abe46514627dccca073",
"score": "0.5466016",
"text": "def index\n set_page_mode \n render 'sections/base.html.erb', :layout => 'templates/default'\n end",
"title": ""
},
{
"docid": "0578fd23fd4c72e544cb394cbfd8c434",
"score": "0.54584885",
"text": "def scaffold_setup_helper\n map generate_mapping, :scaffolding_extensions\n map_views '/'\n map_layouts '/'\n engine :Erubis\n layout(:layout){|name, wish| !request.xhr? }\n\n o = Ramaze::App[:scaffolding_extensions].options\n o.roots = [scaffold_template_dir]\n o.views = ['/']\n o.layouts = ['/']\n\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::RamazeController\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::PrototypeHelper\n end",
"title": ""
},
{
"docid": "06a985dd7831c4d326a48d457e752e14",
"score": "0.5432891",
"text": "def resources; end",
"title": ""
},
{
"docid": "fa496ef7208bb5433c066884b3b2c001",
"score": "0.5418122",
"text": "def setup_default_structure!\n self.push_path(:application, self.root / 'app')\n self.push_app_path(:application, Merb.root / 'slices' / self.identifier / 'app')\n \n [:view, :model, :controller, :helper, :mailer, :part, :lib].each do |component|\n self.push_path(component, dir_for(:application) / \"#{component}s\")\n self.push_app_path(component, app_dir_for(:application) / \"#{component}s\")\n end\n \n self.push_path(:public, self.root / 'public', nil)\n self.push_app_path(:public, Merb.root / 'public' / 'slices' / self.identifier, nil)\n \n [:stylesheet, :javascript, :image].each do |component|\n self.push_path(component, dir_for(:public) / \"#{component}s\", nil)\n self.push_app_path(component, app_dir_for(:public) / \"#{component}s\", nil)\n end\n end",
"title": ""
},
{
"docid": "b6596aabbdfe9afaf17d73db7380469c",
"score": "0.541626",
"text": "def default_template(action_name = self.action_name)\n view_paths.find_template(default_template_name(action_name), default_template_format)\n rescue ActionView::MissingTemplate => ex\n raise if self.vogue(:root).blank?\n action_name = \"index\" if action_name.blank?\n \n scaffold_paths = view_paths.class.new\n Array(self.vogue(:root)).each do |path|\n scaffold_paths.unshift(path)\n end\n \n begin\n scaffold_paths.find_template(action_name, default_template_format)\n rescue ActionView::MissingTemplate\n raise ex\n end\n \n end",
"title": ""
},
{
"docid": "1ad18f5629ac5111c9074dfeca522043",
"score": "0.54109395",
"text": "def default_page\n #nested_erb :'rw_index.html', :'rw_layout.html', settings.layout\n respond_with :rw_index\n end",
"title": ""
},
{
"docid": "1a2021d422b94f48fd839e12bf205742",
"score": "0.53925794",
"text": "def load_default\n require 'controller'\n require 'handler'\n end",
"title": ""
},
{
"docid": "58eace0f359249a18e2e417bf7bce5cb",
"score": "0.5382614",
"text": "def load_current_resource\n # Dummy\n end",
"title": ""
},
{
"docid": "3ce844edb5856c5241fd1b993701d131",
"score": "0.5344077",
"text": "def initialize_first_theme_if_selected\n if foreign_template_theme.present?\n self.class.with_site(self) {\n new_imported_theme = foreign_template_theme.import_with_resource\n self.apply_theme( new_imported_theme ) \n } \n end\n end",
"title": ""
},
{
"docid": "42166497216de433e80f5f15b4e0398f",
"score": "0.5322459",
"text": "def load_resources; end",
"title": ""
},
{
"docid": "451384c1654c57f61a2f0322cc1f87db",
"score": "0.5300562",
"text": "def local\n @load_frontend = true\n end",
"title": ""
},
{
"docid": "b3128b2223a32874bf04c4d6dcbedb8f",
"score": "0.5291764",
"text": "def root\n ResourcesNode.new.tap do |node|\n DirectoryCollection.new(assets: pages_assets, path: pages_path).mount(node)\n resources_pipeline.process node\n end\n end",
"title": ""
},
{
"docid": "15faf7e1403a776be6b2a4b419ef37ad",
"score": "0.5291556",
"text": "def resource\n super\n end",
"title": ""
},
{
"docid": "af8b1aacd22ccfd27a72537d3093e3ff",
"score": "0.5288427",
"text": "def initialize_generate\n super\n @flavor.class.do_declare_resources do\n directories << 'templates'\n directories << File.join('templates', 'default')\n files_if_missing << File.join('templates', 'default', 'example.conf.erb')\n end\n end",
"title": ""
},
{
"docid": "ed0b163d442178dd93ec5a67e0feeee1",
"score": "0.5287824",
"text": "def initialize\n self.cms_layouts = { :default => 'default' }\n self.content_path = 'content'\n end",
"title": ""
},
{
"docid": "b41a17aa34ce7d3994332568c0967417",
"score": "0.5280879",
"text": "def load_current_resource\n end",
"title": ""
},
{
"docid": "b41a17aa34ce7d3994332568c0967417",
"score": "0.5280879",
"text": "def load_current_resource\n end",
"title": ""
},
{
"docid": "35a59c3a8682c141af24d535d2e88fa8",
"score": "0.5280002",
"text": "def load_template()\n file = @site\n .liquid_renderer\n .file(template_path(@template_name))\n\n content = template_content(@template_name)\n\n template = Hash.new\n data = get_front_matter(content)\n markup = strip_front_matter(content)\n\n if content\n template[\"data\"] = data\n template[\"template\"] = file.parse(markup)\n template\n end\n end",
"title": ""
},
{
"docid": "0209048fcf69bc28b9aafe4a184f56d4",
"score": "0.52791524",
"text": "def add_scaffolding\n\n # load yaml env file\n env_path = File::join(Dir::pwd, HLDR_ENV)\n\n return if !File::exists? env_path\n return if File.zero?(env_path)\n hldr_config = YAML.load_file(env_path)\n\n # ensure scaffolding section is defined\n return if !hldr_config || \n hldr_config[\"scaffolding\"].nil? || \n hldr_config[\"scaffolding\"].empty?\n\n hldr_config[\"scaffolding\"].each do |resource|\n\n # if ends in .css or is a hash with value of css, add style\n if (resource[-4..-1] == \".css\") || \n (resource.is_a?(Hash) && resource[resource.keys.first] == \"css\")\n\n begin\n css_res = Nokogiri::XML::Node.new \"style\", @doc\n res_handler = open(resource)\n next if !res_handler\n\n css_res.content = res_handler.read\n css_res[:type] = \"text/css\"\n head = @doc.at_css(\"html\") \n head << css_res if !head.nil?\n\n res_handler.close\n rescue\n next\n end\n \n end\n\n # if ends in .js or is a hash with value of js, add script\n if (resource[-4..-1] == \".js\") || \n (resource.is_a?(Hash) && resource[resource.keys.first] == \"js\")\n\n begin\n css_res = Nokogiri::XML::Node.new \"script\", @doc\n res_handler = open(resource)\n next if !res_handler\n\n css_res.content = res_handler.read\n css_res[:type] = \"text/javascript\"\n head = @doc.at_css(\"html\") \n head << css_res if !head.nil?\n\n res_handler.close\n rescue\n next\n end\n \n end\n\n end \n\n end",
"title": ""
},
{
"docid": "5294eae16c6d4e631eae26687f00a3cc",
"score": "0.5273134",
"text": "def default_templates\r\n \treturn super\r\n end",
"title": ""
},
{
"docid": "e2018394976a6b5d6cd8d4b8098e0c58",
"score": "0.526775",
"text": "def show\n render layout: \"sites/application\"\n end",
"title": ""
},
{
"docid": "cb0a87ecc0b6db2d911e634607e33831",
"score": "0.5265274",
"text": "def show\n #self.class.layout(@page.layout_name || 'application')\n end",
"title": ""
},
{
"docid": "cb31c58ba415556ebb5456bd16148183",
"score": "0.52590805",
"text": "def front_cache_before_load\n end",
"title": ""
},
{
"docid": "11117c662dec0261d3b237697955f348",
"score": "0.5257208",
"text": "def template_setup\n content_for :content_title, \"System Administration\"\n content_for :content_subtitle, \"Multi-site Management\"\n end",
"title": ""
},
{
"docid": "6727558b7acba63c7176ff31fe9a8fd9",
"score": "0.5242832",
"text": "def load_defaults\n @root_page = Page.root\n @top_level_page = @page.ancestors[1] || @root_page\n end",
"title": ""
},
{
"docid": "e2281064ae8e52749f6de4867c014687",
"score": "0.52427244",
"text": "def default_render; end",
"title": ""
},
{
"docid": "ba6e85a196422e42bd751957ed8705f1",
"score": "0.524265",
"text": "def template_setup\n content_for :content_title, 'Lesson Pages'\n end",
"title": ""
},
{
"docid": "bed78362d6b38fa12970ce46ddee0336",
"score": "0.52424175",
"text": "def head\n stylesheet 'structure', 'form', 'theme', 'buttons'\n javascript 'wufoo'\n end",
"title": ""
},
{
"docid": "bd02ed8e8a84e5386a1ecc3ac5166df3",
"score": "0.52379555",
"text": "def index\n @_resources = Client.all\n render layout: 'application_fluid'\n end",
"title": ""
},
{
"docid": "5d94d597a49086845818cd9e79873280",
"score": "0.5237501",
"text": "def init\r\n @title_page = 'Pine app'\r\n erb :welcome, layout: :template\r\nend",
"title": ""
},
{
"docid": "523b4f72d585879e1ba2fd25dd967f72",
"score": "0.5228868",
"text": "def homepage_v1\n @featured_beer = Beer.default_beer\n render :homepage\n end",
"title": ""
},
{
"docid": "954e6ca9e7782a168040e63bbc0a5b5b",
"score": "0.52281046",
"text": "def init\n add_breadcrumb I18n.t('form.forms'), :controller => \"forms\", :action => \"index\"\n end",
"title": ""
},
{
"docid": "177692bd10447034d81637de57d38b4e",
"score": "0.5221993",
"text": "def initialize_framework_views\n Engine::Controller::ViewPaths.default_view_paths << configuration.view_path\n end",
"title": ""
},
{
"docid": "30b0e2081f5decedc4c8c67d8698cda2",
"score": "0.52186286",
"text": "def show\n add_breadcrumb I18n.t('integral.breadcrumbs.blog'), integral.posts_url\n add_breadcrumb @resource.title, nil\n\n @meta_data = {\n page_title: @resource.title,\n page_description: @resource.description,\n open_graph: {\n image: @resource.preview_image_url(size: :large)\n }\n }\n template = 'default' # TODO: Implement post templates\n render \"integral/posts/templates/#{template}\"\n end",
"title": ""
},
{
"docid": "e23a95779ac26523ecd081679915ce1b",
"score": "0.5216445",
"text": "def pre_render(site)\n end",
"title": ""
},
{
"docid": "aed9746ef372dab34dd4e912efdab7c9",
"score": "0.52156556",
"text": "def home\n if load_subsite.nil?\n render status: :not_found, text: \"#{params[:slug]} is not a subsite\"\n return\n end\n load_site_document\n # override the blacklight config to support featured content and facets\n @blacklight_config = load_subsite.blacklight_config\n # TODO: load facet data. Requires configuration of fields, and override of default solr params.\n respond_to do |format|\n format.json { render json: @subsite.to_json }\n format.html { render }\n end\n end",
"title": ""
},
{
"docid": "b1a259dd74df2f606566b0532206f891",
"score": "0.52148515",
"text": "def core_index\n render :template => 'home/index', :layout => 'core'\n end",
"title": ""
},
{
"docid": "f87dd6fbdae807b1299d4dbc9ad47434",
"score": "0.5213038",
"text": "def add_resources_and_root\n add_resource_route\n end",
"title": ""
},
{
"docid": "ae5a3b5afc613869a3567522b5417b53",
"score": "0.52111673",
"text": "def developer_home\n \trender layout: \"developer_home_template\"\n end",
"title": ""
},
{
"docid": "4b37ad8ebf8010ecdb143def45043c9c",
"score": "0.520604",
"text": "def front_page\n\n\n respond_to do |format|\n format.html # front_page.html.erb\n end\nend",
"title": ""
},
{
"docid": "b4ba194a178c34d9e30b9add16ebca60",
"score": "0.520501",
"text": "def initialize_first_theme_if_selected\n if foreign_template_theme.present?\n self.class.with_site(self) {\n new_imported_theme = foreign_template_theme.import_with_resource\n self.stores.first.apply_theme( new_imported_theme )\n }\n end\n end",
"title": ""
},
{
"docid": "946727437cf19b1aedf87c1c97ecae9a",
"score": "0.5201435",
"text": "def first_upload\n # renders static page\n end",
"title": ""
},
{
"docid": "50e708e5963e3c10527c7a081f67db0d",
"score": "0.5194898",
"text": "def pre_layouts\n ['layouts/borders.yml', 'layouts/debug.yml']\nend",
"title": ""
},
{
"docid": "b9d7df0d99dd3a6bb4b0f3ede9b2081d",
"score": "0.5191557",
"text": "def default_content\n @bridge.switchToDefaultContent\n end",
"title": ""
},
{
"docid": "ac45ce4cd5e03d5aff80a33dae11f0a5",
"score": "0.516283",
"text": "def default_route\n render :index\n end",
"title": ""
},
{
"docid": "ebe9060f505b39727ec94fdfac5e04b9",
"score": "0.5162222",
"text": "def initialize_default_admin_tabs\n admin.initialize_nav\n end",
"title": ""
},
{
"docid": "ba508f11f8a89faf9c37472557ad6d3d",
"score": "0.5158854",
"text": "def layout\n begin\n abbr\n rescue ActionView::MissingTemplate\n \"publinator/site\"\n end\n end",
"title": ""
},
{
"docid": "aaa7e8425eba8d9270c0f9e1b7e98468",
"score": "0.5149982",
"text": "def home\r\n\t\t@static_page = StaticPage.find_by_form_name(\"home\")\r\n\r\n\t\tif File.exist? \"#{RAILS_ROOT}/custom/layouts/home.rhtml\"\r\n\t\t\t# We cannot specify an absolute path for the layout :/\r\n\t\t\tlayout_to_use = \"../../custom/layouts/home.rhtml\"\r\n\t\telse\r\n\t\t\tlayout_to_use = \"products\"\r\n\t\tend\r\n\r\n\t\tif File.exist? \"#{RAILS_ROOT}/custom/templates/home.rhtml\"\r\n\t\t\trender :file => \"#{RAILS_ROOT}/custom/templates/home.rhtml\", :use_full_path => false, :layout => layout_to_use\r\n\t\telse\r\n\t\t\trender :action => :home, :layout => layout_to_use\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "026f7146ca3bb3c16da5e47790215951",
"score": "0.51473284",
"text": "def index\n @front_pages = FrontPage.all\n end",
"title": ""
},
{
"docid": "c878f0549348459e7e96d7d7408082fb",
"score": "0.514638",
"text": "def home\n init_home\n end",
"title": ""
},
{
"docid": "1907945582ae5bb63f44b3c062bddeac",
"score": "0.514419",
"text": "def head\n render 'head.html'\n end",
"title": ""
},
{
"docid": "2b7aeda0e5bd230f8012985537b52142",
"score": "0.5132385",
"text": "def setup_for_blog_context\n route = request.path_info.split('/').reject{|pi| pi.blank?}.first\n @context = Blog.translate_route_to_context(route)\n \n # Controls menu highlighting and arrow\n active_section(@context)\n end",
"title": ""
},
{
"docid": "79d0734eb654e065c32b8bb0c629354e",
"score": "0.5131057",
"text": "def run_defaults(view = current_action)\n @defaults_ran_for_resourceful_views ||= []\n unless @defaults_ran_for_resourceful_views.include?(view.to_sym)\n if resource_check_template_exists?(controller.class.controller_path + '/' + '_'+view.to_s+\"_defaults\")\n # if @template.file_exists?(controller.class.controller_path + '/' + '_'+view.to_s+\"_defaults\")\n render :partial => view.to_s+\"_defaults\"\n end\n @defaults_ran_for_resourceful_views << view.to_sym \n end\n end",
"title": ""
},
{
"docid": "690bc9721c1cad077c526909b97a9f77",
"score": "0.512471",
"text": "def homepage\n render :homepage\n end",
"title": ""
},
{
"docid": "015d0f413f610b48485a2e79abde118a",
"score": "0.51227874",
"text": "def template_setup; end",
"title": ""
},
{
"docid": "d853c2ceec479165367d7f063b239e80",
"score": "0.51186025",
"text": "def load\n super\n end",
"title": ""
},
{
"docid": "5afab028b8b774d59894999aac980454",
"score": "0.51163715",
"text": "def defaults\n @defaults ||= @site.frontmatter_defaults.all url, type\n end",
"title": ""
},
{
"docid": "751f0a06d088e8d08a6bcc558d451bb9",
"score": "0.51148236",
"text": "def view_front_page\n\tdisplay_page(\"Main Page\", \"http://www.reddit.com/.json\", 1)\nend",
"title": ""
},
{
"docid": "0dd0fc7ec56f5fa83449f5a3342eb519",
"score": "0.5113526",
"text": "def process_default_render exp\n process_layout\n process_template template_name, nil, nil, nil\n end",
"title": ""
},
{
"docid": "005dac756bd18cfe3200202a07469408",
"score": "0.511269",
"text": "def template_setup\n content_for :content_title, \"User Management\"\n end",
"title": ""
},
{
"docid": "e1c20391a43f2fe0fbe1aacb6343654c",
"score": "0.51109535",
"text": "def after_initialize\n super\n extension_loader.activate_extensions # also calls initialize_views\n configuration.add_controller_paths(extension_loader.paths(:controller))\n configuration.add_eager_load_paths(extension_loader.paths(:eager_load))\n end",
"title": ""
},
{
"docid": "a32524d104efaada2c49dd160f66f76f",
"score": "0.5108662",
"text": "def load\n load_views\n end",
"title": ""
},
{
"docid": "a95858d1063fce5918cdf9b273443d64",
"score": "0.51034176",
"text": "def resources\n @resources ||= ResourceCollection.new(node: root, root_path: pages_path)\n end",
"title": ""
},
{
"docid": "25382c86a674803956314a472b156210",
"score": "0.51023775",
"text": "def load_cms_context\n @cms_site = Comfy::Cms::Site.first\n # @cms_layout = @cms_site.layouts.find_by_identifier!('default')\n end",
"title": ""
},
{
"docid": "15e951b18cff1d31486b5d6763b4745a",
"score": "0.50988156",
"text": "def default\n render :index\n end",
"title": ""
},
{
"docid": "afbcba3277664a29381508e17f16ba91",
"score": "0.5096421",
"text": "def default_render\n @default_response.call\n end",
"title": ""
},
{
"docid": "361c7ee2c46928dd81e62cd517f6e9c4",
"score": "0.5094346",
"text": "def default_sections; end",
"title": ""
},
{
"docid": "ec3ddd4d8366f9c04cccdf69ad6ea679",
"score": "0.5090787",
"text": "def default_render\n @renderit_template ||= RenderIt.get_template_name(request)\n template_path = default_template_name + '_' + @renderit_template\n if view_paths.find_template(template_path, default_template_format)\n render template_path\n end\n rescue ActionView::MissingTemplate => e\n render default_template_name\n end",
"title": ""
},
{
"docid": "ba8f9a614f5c974c36f64dd84f0ddc44",
"score": "0.5089795",
"text": "def show\n @layout = \"application\"\n end",
"title": ""
},
{
"docid": "7f67597b61c64b470f33364ad11559d8",
"score": "0.50856036",
"text": "def index\n # show top page\n @content_page = content.default_page\n if @content_page\n render text: content.render, layout: true\n else\n redirect_to action: 'new', id: content.content[:default_name]\n end\n end",
"title": ""
},
{
"docid": "2dbb83a6305808d355fa0d87c34013ab",
"score": "0.5085325",
"text": "def show\n if @static_page.nil?\n @static_page = StaticPage.find_by_name('home')\n redirect_to :root\n else\n if lookup_context.exists?(\"static_pages/pages/#{@static_page.name}\")\n render \"static_pages/pages/#{@static_page.name}\"\n else\n render :show\n end\n end\n end",
"title": ""
},
{
"docid": "a43ebf1ba0f077083b1e4b62a9223b1b",
"score": "0.50813365",
"text": "def show\n render layout: 'webinius_cms/sites'\n end",
"title": ""
},
{
"docid": "9860e3f92a06faf4beda1e05c19b58ba",
"score": "0.50802356",
"text": "def default_configuration\n if request.post?\n begin\n Redmine::DefaultData::Loader::load(params[:lang])\n flash[:notice] = l(:notice_default_data_loaded)\n rescue Exception => e\n flash[:error] = l(:error_can_t_load_default_data, ERB::Util.h(e.message))\n end\n end\n redirect_to admin_path\n \n unless controller_name == 'admin' && action_name == 'index' \n content_for :sidebar do \nl(:label_administration)\n render :partial => 'admin/menu' \n end \n end \n render :file => \"layouts/base\" \n\nend",
"title": ""
},
{
"docid": "266571ad80b809e66365d07a1e82c4a2",
"score": "0.5079811",
"text": "def index\n render 'static_pages/home'\n end",
"title": ""
},
{
"docid": "89593ca75ed07aa41ee80dc044b6c738",
"score": "0.50764906",
"text": "def template\n @global_page.layout.content\n end",
"title": ""
},
{
"docid": "3d8a9b9474c599142fc96bdca11530a8",
"score": "0.50691116",
"text": "def generate_homepage\n Rails.configuration.homepage_base or return true\n self.homepage ||= (Rails.configuration.homepage_base + \"/#{self.name}\")\n end",
"title": ""
},
{
"docid": "2f69eb4d4583fd990b92f01bbf5593df",
"score": "0.5068065",
"text": "def default_controller\n @default_controller ||= nil\n end",
"title": ""
},
{
"docid": "ab4fe36dd721e3286985cf5787920272",
"score": "0.50653154",
"text": "def set_front_page\n @front_page = FrontPage.find_by(id: 1)\n end",
"title": ""
},
{
"docid": "2d5a268e565efc882c5d9a29b78e2b30",
"score": "0.5064877",
"text": "def setup!\n register_default_assets\n end",
"title": ""
},
{
"docid": "2d5a268e565efc882c5d9a29b78e2b30",
"score": "0.5064877",
"text": "def setup!\n register_default_assets\n end",
"title": ""
},
{
"docid": "44404208e3bfabc5848513cfcfe1693f",
"score": "0.5061665",
"text": "def defaults\n @title = 'Default Provider For'\n @collection = object.defaults\n erb(:collection)\nend",
"title": ""
},
{
"docid": "6dd42f33422f1a71688919b534333da1",
"score": "0.50578743",
"text": "def initialize\n @sitename = create_template(\".clayoven/sitename\", \"clayoven.io\").first\n @hidden = create_template \".clayoven/hidden\", %w[404 scratch].join(\"\\n\")\n @tzmap =\n (create_template \".clayoven/tz\", TZ_DEFAULT)\n .map { |l| l.split(\" \", 2) }\n .to_h\n @stmap =\n (create_template \".clayoven/subtopic\", SUBTOPIC_DEFAULT)\n .map { |l| l.split(\" \", 2) }\n .to_h\n @stmap.default_proc = proc { |h, k| h[k] = k }\n @template = (create_template \"design/template.slim\", SLIM_DEFAULT).join \"\\n\"\n end",
"title": ""
},
{
"docid": "8e92dd92e45a6e4e0ae76e228afff43e",
"score": "0.50539774",
"text": "def load_page\n mount\n end",
"title": ""
}
] |
b33e9f99b5b8d279d7e6cda4e2139ef4
|
GET /events/new GET /events/new.xml
|
[
{
"docid": "94b44a1a787e2aaf91d24ccc9b0c63a8",
"score": "0.0",
"text": "def new\n @event = Event.new\n @event.set_hours(params[:start], params[:end])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
}
] |
[
{
"docid": "014d3aee04bd3e2beab48a255a846bb4",
"score": "0.8013102",
"text": "def new\n @event = Event.new \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events }\n end\n end",
"title": ""
},
{
"docid": "2100dc5cf8bdd4d705e40bfda7873a12",
"score": "0.7863166",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "b19e89b0f49f053a4e621387557a3bda",
"score": "0.78574026",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "eea2a1915dcbf29ffaf7bb7b6ebfb204",
"score": "0.785604",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "70d6acfd3fc5fc4d86b151f008afc8f3",
"score": "0.7855499",
"text": "def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "70d6acfd3fc5fc4d86b151f008afc8f3",
"score": "0.7855499",
"text": "def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "9e165d2b199b6fecbcaeb40e0dbebb0f",
"score": "0.7850271",
"text": "def new\n @event = Event.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "a3ab395a65c616484f6b10a571898095",
"score": "0.7825033",
"text": "def new\n @event = Event.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "806a5ac217321d65a053dd4d89ef37f5",
"score": "0.7775429",
"text": "def new\n\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "aa84cddefe0a495fae48972efddf4306",
"score": "0.7751336",
"text": "def new\n @event = Event.new(params[:event])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "a4139eef021b2fa5e387048f56c1bef8",
"score": "0.7717244",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "a4139eef021b2fa5e387048f56c1bef8",
"score": "0.7717244",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "f609fc0a03f8009489e99cd2555fc7bf",
"score": "0.76959246",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "8702f02e188e7e29b6fa3fdb9c70444f",
"score": "0.75936246",
"text": "def new\n @event = Event.new\n \n set_page_title\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => Event.xml(@event) }\n end\n end",
"title": ""
},
{
"docid": "484c26ef88cedfa6ad719cb267a2436f",
"score": "0.75730455",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "5bff1e41ff42700ddb2eabf1aecc6061",
"score": "0.75543064",
"text": "def new\n @page_title = \"New Event\"\n @site_section = \"admin\"\n \n @event = Event.new\n @users = User.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "e77d3bb9182179ebb17e291169508f41",
"score": "0.75355524",
"text": "def new\n @events_type = EventsType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @events_type }\n end\n end",
"title": ""
},
{
"docid": "86190ce67c96ab941750cbac87b6493b",
"score": "0.75057834",
"text": "def new\r\n @event = Event.new\r\n @day = Time.now.day\r\n @month = Time.now.month\r\n @year = Time.now.year \r\n \r\n @view = 'new' \r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @event }\r\n end\r\n end",
"title": ""
},
{
"docid": "a1878fdf71190a9a3d2613fc6fbd4625",
"score": "0.749708",
"text": "def new\n @event = Event.new\n find_new_event\n \n respond_to do |format|\n format.html\n format.js\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "f0ca43fce5b46b923e5e7ce3fe6b1d0c",
"score": "0.74492234",
"text": "def new\n @users = User.find :all\n @event = Event.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "f47859cd825cc5b1599c3f68a8170f78",
"score": "0.7431478",
"text": "def new\n @custom_event = CustomEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @custom_event }\n end\n end",
"title": ""
},
{
"docid": "b7c642b6516f2ce07585c51a8e323489",
"score": "0.7426331",
"text": "def new\n\t\n @event = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "72fea24242055ee44f18659ec155950e",
"score": "0.7399578",
"text": "def new\n @event1 = Event1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event1 }\n end\n end",
"title": ""
},
{
"docid": "12e7c5ac92cf368bc129442f7cff65c9",
"score": "0.7367552",
"text": "def new\n @event = Event.new(:organizer => current_member)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "52fdb88726af964f482ad265630c8a12",
"score": "0.73591036",
"text": "def new\n @eventday = Eventday.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @eventday }\n end\n end",
"title": ""
},
{
"docid": "2fde9993614db13d7763330b078b1d26",
"score": "0.73390394",
"text": "def new\n @agenda_event = Agenda::Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @agenda_event }\n end\n end",
"title": ""
},
{
"docid": "be65c4cbdf4a2de9a1bbb3b4bed2379a",
"score": "0.7325916",
"text": "def new\n @election_event = ElectionEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election_event }\n end\n end",
"title": ""
},
{
"docid": "27c0c707902504f94c9396fac2f5d1b3",
"score": "0.7318706",
"text": "def new\n @event_type = EventType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event_type }\n end\n end",
"title": ""
},
{
"docid": "0ce9522763b40d72c5aa9f0ed9e53bb7",
"score": "0.7315598",
"text": "def new\n\t\t@event = Event.new\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "7f614b834ec6941c2f5c38e67561023a",
"score": "0.7314909",
"text": "def new\n # @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evento }\n end\n end",
"title": ""
},
{
"docid": "2eb7c084283c64f1ef0e5e51bf67d056",
"score": "0.7292313",
"text": "def new\n @event = @calendar.events.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "98e2eeeede6571aee6e481ebff2d4374",
"score": "0.7290972",
"text": "def new\n @event = Event.new\n\n @title = 'Novi događaj'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "b6ffff1a33ae2e535a92630bd5cf6757",
"score": "0.72878945",
"text": "def new\r\n @event = Event.new\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render :json => @event }\r\n end\r\n end",
"title": ""
},
{
"docid": "9082eca4247a836a91b4ab8bd3ee5e7b",
"score": "0.72831964",
"text": "def new\n @event = Event.new\n set_default_start_and_end_times @event\n set_default_category @event\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "6028189b03b041cee12312171df11e5e",
"score": "0.7279938",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # haml 'new'\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "964f26f6a11e612de5548d2f9cd1854d",
"score": "0.72747713",
"text": "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "a847a041a482d38d998e15be017357a3",
"score": "0.72743064",
"text": "def new\n @project_event = ProjectEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_event }\n end\n end",
"title": ""
},
{
"docid": "0312512f5e3cf3a9c357129bb01b10ed",
"score": "0.7272386",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "0312512f5e3cf3a9c357129bb01b10ed",
"score": "0.7272386",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "f02ab5fdc7f5e6d44bf5a5fd0bec71f7",
"score": "0.7268984",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "f02ab5fdc7f5e6d44bf5a5fd0bec71f7",
"score": "0.7268984",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "f02ab5fdc7f5e6d44bf5a5fd0bec71f7",
"score": "0.7268984",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "f02ab5fdc7f5e6d44bf5a5fd0bec71f7",
"score": "0.7268984",
"text": "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "aac8365401e138c63414fbb79e8c5295",
"score": "0.7268922",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "8d5590df76b7d1405e6aa6ac4081de43",
"score": "0.7262112",
"text": "def new\n @log_event = LogEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @log_event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "43e0463272fcfebd481162eb0304ba8b",
"score": "0.7259886",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
},
{
"docid": "220a62a4f40b7d22da89cb0fdb1b07d6",
"score": "0.7257569",
"text": "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"title": ""
}
] |
83d6b1c136ff7bd3d0fb3ae23ca5b2f2
|
Returns an account client
|
[
{
"docid": "b4c8c0e1f3c0f59edb327dd60cda06d3",
"score": "0.0",
"text": "def [](name)\n raise NotFound, \"Account #{name} not found\" unless tokens.include? name\n\n token = tokens[name]\n\n if token.expired? and token.refresh_token.to_s.strip.empty?\n @clients.delete name\n raise NotAuthorized, \"Token for account #{name} is expired and cannot be renewed\"\n end\n\n if token.expired?\n logger.debug \"Token for account #{name} expired, renewing\"\n token = tokens.store name, token.refresh!\n @clients[name] = nil\n end\n\n @clients[name] ||= Client.new token\n end",
"title": ""
}
] |
[
{
"docid": "c85d3d8cd730a4d4b0f29239e166311a",
"score": "0.766463",
"text": "def account\n client.account\n end",
"title": ""
},
{
"docid": "c85d3d8cd730a4d4b0f29239e166311a",
"score": "0.766463",
"text": "def account\n client.account\n end",
"title": ""
},
{
"docid": "759d3dd91e119247c8729a9b9544d266",
"score": "0.7547471",
"text": "def get_service_account\n client = Boxr::Client.new\n end",
"title": ""
},
{
"docid": "298e22cf0aaebcf0dfb8d998b00e7497",
"score": "0.73062533",
"text": "def client\n return nil unless @customer.budgea_account\n\n @client ||= Budgea::Client.new @customer.budgea_account.access_token\n end",
"title": ""
},
{
"docid": "086dc67666e5115994596f6d51a8287d",
"score": "0.72815186",
"text": "def get_account\n\t\t\tresponse = @client.get_profile\n\t\t\tAccount.new(@client, **response)\n\t\tend",
"title": ""
},
{
"docid": "cddb18811a0a8e4a07060cf893ea42d3",
"score": "0.72566646",
"text": "def account\n account = rpc(:account_get, _access: :account)\n as_account(account)\n end",
"title": ""
},
{
"docid": "a3fe88fff7ccb3f8cecb731210f847fe",
"score": "0.71497345",
"text": "def account\n @account_resource ||= Account.new(@client)\n end",
"title": ""
},
{
"docid": "a3fe88fff7ccb3f8cecb731210f847fe",
"score": "0.71497345",
"text": "def account\n @account_resource ||= Account.new(@client)\n end",
"title": ""
},
{
"docid": "32f00983937466dfa89d306b19ee9bdb",
"score": "0.71075416",
"text": "def client\n check_configuration!\n @client ||= Softlayer::Client.new(\"SoftLayer_Account\")\n end",
"title": ""
},
{
"docid": "f479fdf02654d081f53f794e519ac242",
"score": "0.6969085",
"text": "def get_account(opts= {})\n c = @client[\"#{@account}\"]\n headers = gen_headers(opts)\n attempt(opts[:attempts]) do\n do_get(c, headers)\n end\n end",
"title": ""
},
{
"docid": "5a93202d7ce08c5cce8fef101d42cb60",
"score": "0.6903039",
"text": "def account\n code, response = get(version_prefix('/account.json'))\n Account.new(response['account'])\n end",
"title": ""
},
{
"docid": "ed4a49c90bcd11a4dc3c3dcce65a52c4",
"score": "0.68477845",
"text": "def get_account\n url = ApiRequest.base_path(\"questionpro.survey.getAccount\")\n result = self.class.get(url, body: self.options)\n\n self.full_response = result\n self.status = result['status']\n \n account = Account.new(result['response']['account'])\n \n return account\n end",
"title": ""
},
{
"docid": "c3e12e7e191274598f532198c394e76d",
"score": "0.68324137",
"text": "def get_client(requestenv)\n user = get_user(requestenv)\n return one_client_user(user)\n end",
"title": ""
},
{
"docid": "1da00abe079f04cddd91434649e861cf",
"score": "0.6810949",
"text": "def client\n return @api_client if @api_client.present?\n\n token = decoded_auth_token\n # If the token is missing or invalid then set the client to nil\n errors[:token] = _('Invalid token') if token.blank?\n @api_client = nil unless token.present? && token[:client_id].present?\n return @api_client unless token.present? && token[:client_id].present?\n\n @api_client = ApiClient.where(client_id: token[:client_id]).first\n return @api_client if @api_client.present?\n\n @api_client = User.where(email: token[:client_id]).first\n end",
"title": ""
},
{
"docid": "b00119320adcf3aee9cb688eace120df",
"score": "0.6805824",
"text": "def account\n Creator.new(relinkly_request(:get, 'account'))\n end",
"title": ""
},
{
"docid": "283e020fcb4e1c4a4db366fdd6bd53c1",
"score": "0.6800255",
"text": "def account\n get('/account') do |resp|\n return AssetZen::Resources::Account.new(JSON.parse(resp.body), dup)\n end\n end",
"title": ""
},
{
"docid": "bba7a85b1b7492a46adb5ee9342f7c37",
"score": "0.6799303",
"text": "def account\n result = FinerWorks::Request.get(self, \"/Account\")\n FinerWorks::Account.new(result.json)\n end",
"title": ""
},
{
"docid": "e5aab3e3779aac4262f7bb1cae50a7d7",
"score": "0.678218",
"text": "def account\n Services::AccountService.new(@api_service)\n end",
"title": ""
},
{
"docid": "8b5f66f3da850d37d3b5994720dfa5aa",
"score": "0.6771208",
"text": "def get_account\n send_request get(account_path)\n end",
"title": ""
},
{
"docid": "77c2bc4aa1a6740ece959220eac73367",
"score": "0.6766763",
"text": "def get_client(mac)\n AuthClient.get(mac)\n end",
"title": ""
},
{
"docid": "c5901afe8ab3420b2245225d14205b44",
"score": "0.67421186",
"text": "def get_account()\n\t\treturn self.get(\"account\",\"\")\n\tend",
"title": ""
},
{
"docid": "bc0acb468f60b1ad087186b96de4538f",
"score": "0.67103267",
"text": "def get_client_by_id(id)\n request 'clients.getClient', id\n end",
"title": ""
},
{
"docid": "afde2ae8e36daf2d6999b9b119fd3acb",
"score": "0.66885585",
"text": "def get_client( query ) \n client = nil\n @customers.each do |c|\n buildQ = [ c[\"name\"], c[\"alias\"] ].join(\"|\")\n regex = Regexp.new(buildQ, Regexp::IGNORECASE)\n if regex.match( query ) != nil\n client = c\n end\n end\n return client\n end",
"title": ""
},
{
"docid": "a7ab42a7e9cc5e09e7d90e04022cd36a",
"score": "0.6655037",
"text": "def account\n @account ||= ApiFactory.new 'Users::Account'\n end",
"title": ""
},
{
"docid": "e667e13f42f20618bf7227273a210517",
"score": "0.66531926",
"text": "def get_current_account\n resp = request('/users/get_current_account')\n FullAccount.new(resp)\n end",
"title": ""
},
{
"docid": "353ac1ce0ead92a12f458bcc384c40ae",
"score": "0.6651011",
"text": "def find_client\n @client = @account.clients.find(params[:client_id])\n end",
"title": ""
},
{
"docid": "6cf8f6ed5dd31b37bf8470b162728be0",
"score": "0.6625984",
"text": "def get_auth_client\n @auth_client\n end",
"title": ""
},
{
"docid": "f35a3e302a458fd44c17ad0c78430e13",
"score": "0.6616223",
"text": "def account\n return @account if @account\n @account = @db[ACCOUNT_COLLECTION_NAME].find_one()\n end",
"title": ""
},
{
"docid": "60253648791830328f225e54a6a2e231",
"score": "0.6615236",
"text": "def account\n @account ||= Identity::AccountCreator.new(self).call\n end",
"title": ""
},
{
"docid": "406dfc9e1116f353de1c2ff046d48715",
"score": "0.6612959",
"text": "def account\n perform_get_request('/account')\n end",
"title": ""
},
{
"docid": "a18ff0141a0be9f74284dfb872e0db63",
"score": "0.6612934",
"text": "def get_client\n\t\tcase self.client\n\t\t# when 'messenger'\n\t\t\t# return MessengerAdapter.instance \n\t\twhen 'telegram'\n\t\t\treturn TelegramAdapter.instance \n\t\telse\n\t\t\tputs 'No client!'\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b27b14069160a9707bf000c60d633cba",
"score": "0.660922",
"text": "def client\n if access_token\n @client ||= AuthServer.get_client(AuthServer.get_access_token(access_token).client_id)\n elsif authorization\n @client ||= AuthServer.get_client(AuthServer.get_auth_request(authorization).client_id)\n end\n end",
"title": ""
},
{
"docid": "f0ba8adeacc2d0c821d0fd092b386c37",
"score": "0.66048086",
"text": "def client\n @client ||= ::Nexmo::Client.new(key: @account_sid, secret: @auth_token)\n end",
"title": ""
},
{
"docid": "0f1d4712a17d5c0fa753e400763d8c52",
"score": "0.6573041",
"text": "def account\n JSON.parse(@cli[\"/account\"].get)\n end",
"title": ""
},
{
"docid": "c90b3a6eeac39a0a46ac086a5400e96f",
"score": "0.65692633",
"text": "def get_user\n\t\treturn Account.find(self.account_id)\n\tend",
"title": ""
},
{
"docid": "690564f987ec4a57a2bc208f557e24df",
"score": "0.654935",
"text": "def client\n Client.find( self[:uuid] )\n end",
"title": ""
},
{
"docid": "c55f8aa3894366ad42a0317c6e4472d5",
"score": "0.6523821",
"text": "def get_creator\n\t\treturn Account.find(self.account_id)\n\tend",
"title": ""
},
{
"docid": "ad051aac8d8066cc1a2fd0e66acd2c9f",
"score": "0.6504965",
"text": "def client\n contact.client\n end",
"title": ""
},
{
"docid": "8d35efd4e0206993dcaef288e4f48fff",
"score": "0.6498674",
"text": "def getClient(name)\n @clients.each { |client| client.name == name}.first\n end",
"title": ""
},
{
"docid": "8d35efd4e0206993dcaef288e4f48fff",
"score": "0.6498674",
"text": "def getClient(name)\n @clients.each { |client| client.name == name}.first\n end",
"title": ""
},
{
"docid": "e1e7e5c34bfb5625934101dfdfeeb6fc",
"score": "0.6479426",
"text": "def account\n process_response(get)['account']\n end",
"title": ""
},
{
"docid": "7a29361ac5506c58bfe8a13318e4f7dc",
"score": "0.6464234",
"text": "def get()\n path = '/account'\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::User\n )\n end",
"title": ""
},
{
"docid": "bb46c5c8aa17b57677dca0a93e37572d",
"score": "0.64593947",
"text": "def client\n return @rabbits.first.client\n end",
"title": ""
},
{
"docid": "65c1acbe95091ef0eb8efe19c1892117",
"score": "0.6459018",
"text": "def account_id\n @account_id ||= @client.identity.whoami.data.account.id\n end",
"title": ""
},
{
"docid": "37be90ee53648f00a8696092ccb12f26",
"score": "0.64522874",
"text": "def account\n @account ||= Harvest::API::Account.new(credentials)\n end",
"title": ""
},
{
"docid": "0cd4a04e9b5cf334f0cfd84793042cf4",
"score": "0.64490944",
"text": "def client\n @client ||= create_client\n end",
"title": ""
},
{
"docid": "f8e530ea3cd510b4ec5c2e1dae391439",
"score": "0.64459693",
"text": "def account\n get('account')\n end",
"title": ""
},
{
"docid": "6eb9532e66646398c1dfce14a151ae8f",
"score": "0.6441227",
"text": "def client\n Stinger::Client.find(client_id)\n end",
"title": ""
},
{
"docid": "409b55abe4fc5851d15a371a625774a7",
"score": "0.6439294",
"text": "def account(id)\n Near::Account.new(get(\"/accounts/#{id}\"))\n end",
"title": ""
},
{
"docid": "370be37ef8714f3e1cf3894e28a20de6",
"score": "0.64290124",
"text": "def client\n @client ||= begin\n client = Clients.with_name(client_name)\n if database_name_option\n client = client.use(database_name)\n end\n unless client_options.empty?\n client = client.with(client_options)\n end\n client\n end\n end",
"title": ""
},
{
"docid": "cdfcef8e03d797677cb3ce8a90d94610",
"score": "0.6428014",
"text": "def client\n @client ||= create_client()\n end",
"title": ""
},
{
"docid": "f3995f175cb3892e9a407fefa8e182a9",
"score": "0.64271325",
"text": "def get_account\n JSON.parse(get_results('/account'), {symbolize_names: true})\n end",
"title": ""
},
{
"docid": "f3995f175cb3892e9a407fefa8e182a9",
"score": "0.64271325",
"text": "def get_account\n JSON.parse(get_results('/account'), {symbolize_names: true})\n end",
"title": ""
},
{
"docid": "da7729ab09fcfe91a118df8b8de70f04",
"score": "0.64178866",
"text": "def get_account\n\trequest_type = \"GET\"\n\turl = \"account\"\n\thash = create_hmac(request_type, url)\n\tresponse = http_send(request_type, url, hash)\nend",
"title": ""
},
{
"docid": "2d72efea49adb5fb7e7e5d59b751af9d",
"score": "0.6408681",
"text": "def account\n @account ||= find_account\n end",
"title": ""
},
{
"docid": "35e684c1e5b29f37f7579f0951ac4313",
"score": "0.6408577",
"text": "def client\n @client ||= configure_gplus(user_tokens)\n end",
"title": ""
},
{
"docid": "d7166ff1a892b19edab4095845cb84e4",
"score": "0.6403441",
"text": "def get_client(client_id)\n database.first(Client.by_id(client_id.to_s))\n end",
"title": ""
},
{
"docid": "cb9a31c65ea421b06641959cb077a846",
"score": "0.63912386",
"text": "def account\n\t\t\t@bc.get_account(@bc.jr.getaccount(@address))\n\t\tend",
"title": ""
},
{
"docid": "ddcd359494e2a28a6787a9c365046fc6",
"score": "0.638735",
"text": "def find_client\n @client = Client.first\n end",
"title": ""
},
{
"docid": "b663820b9bd0b0e0b6c631235741959e",
"score": "0.63821566",
"text": "def account\n account_data = get_scoped_account.merge(service: self)\n Fog::Brightbox::Compute::Account.new(account_data)\n end",
"title": ""
},
{
"docid": "fb1adb0c53d53c72fd3a15c5b5b4c26e",
"score": "0.6366171",
"text": "def client\n @client ||= Basecamp::Client.new(:account_id => account_id, :token => token)\n end",
"title": ""
},
{
"docid": "927b03c72a68473b2956d5bade527f5d",
"score": "0.6361164",
"text": "def twilio_account\n return self.twilio_client.account\n end",
"title": ""
},
{
"docid": "ea60926242a439a90845e2ca29066c65",
"score": "0.63487303",
"text": "def account\n AffiliateWindow::Account.new(\n :user => '34475', \n :datafeed_password => '3ef2db0c8d9230f90e9974000d7b4ebb', \n :api_key => 'ab3fe0c405ecf92fa8df973f5aa279cf',\n :api_password => 'dc6024ea40e16826cb75e6a7c3f08cfc6b3d500f4ee684ec'\n )\n end",
"title": ""
},
{
"docid": "d9486b6fc17798e27e3cac639d7a9983",
"score": "0.6340139",
"text": "def twilio_client(reload=false)\n @twilio_client = nil if reload\n raise SignalCloud::MissingTwilioAccountError.new(self) unless self.has_twilio_account?\n @twilio_client ||= Twilio::REST::Client.new self.twilio_account_sid, self.twilio_auth_token\n return @twilio_client\n end",
"title": ""
},
{
"docid": "9ebacb4905b24c19c179418bc4f60d67",
"score": "0.63294864",
"text": "def client\n @client ||= new_client\n end",
"title": ""
},
{
"docid": "0d26a11dbe5518d68d864b571b3ad7c6",
"score": "0.63276595",
"text": "def get_account_info()\n Services::AccountService.get_account_info()\n end",
"title": ""
},
{
"docid": "6727223774d7f10c4aa0676fbe5257a0",
"score": "0.6317699",
"text": "def client\n Authorize.new_client(API_KEY, API_SECRET)\n end",
"title": ""
},
{
"docid": "390b4b89d9009af5e12485c9515ef7fe",
"score": "0.631766",
"text": "def get_account_info\n cloud_api.get_account_info\n end",
"title": ""
},
{
"docid": "38f953a302ac89e3854ba9fd09a9ccba",
"score": "0.63171375",
"text": "def get_account(id)\n\t\t$nutshell.get_account(id)\n\tend",
"title": ""
},
{
"docid": "cd87fc03bfc42eb9b4eb5035a2501d1c",
"score": "0.630869",
"text": "def client\n @client = Me2day::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"title": ""
},
{
"docid": "5bf6e7618a0627955b0b376c057eb58f",
"score": "0.6307641",
"text": "def default_client\n @client ||= configured_client *credentials\n end",
"title": ""
},
{
"docid": "9cf1950b0d80eb3b1aa2df9eb1c69138",
"score": "0.63039863",
"text": "def client\n cloud_auth_client.client\n end",
"title": ""
},
{
"docid": "a6e908ed9f9c535852ce033672162f1b",
"score": "0.629958",
"text": "def cloud_account\n CloudAccount.find(self.cloud_account_id)\n end",
"title": ""
},
{
"docid": "8c47854c572d0aee73bfe15d27e926b0",
"score": "0.62909645",
"text": "def client\n\t @client ||= Client.find(session[:CLIENT_ID])\n\tend",
"title": ""
},
{
"docid": "629db7e8e506bf612c5fcd185dcbef10",
"score": "0.628419",
"text": "def access_client(name)\n @clients.each do |client|\n return client if client.client_name.capitalize == name.capitalize\n end\n end",
"title": ""
},
{
"docid": "ce84a39c3780e6b861c6d52cf201f7af",
"score": "0.62808776",
"text": "def user_get\n req_objs = get_http_request({request: 'get',authorize: true,\n api_endpoint: \"/api/v1/accounts/verify_credentials\"})\n \n begin\n response = req_objs[0].request(req_objs[1])\n rescue Exception => o\n error = Error.new(\"NO RESPONSE: #{o}\")\n return error\n end\n\n unless request_failed? response\n\n response = JSON.parse(response.body)\n response = symbolize_keys response\n\n account = Account.new response\n\n return account\n else\n error = Error.new(response.body) \n return error\n end\n\n end",
"title": ""
},
{
"docid": "1dcf7966696b2452178efc77a2717b5b",
"score": "0.62805045",
"text": "def client\n @client ||= self.class.base_client\n end",
"title": ""
},
{
"docid": "a381d875acff2bd6b44e75868ed79fb4",
"score": "0.62774605",
"text": "def client\n return @client\n end",
"title": ""
},
{
"docid": "5af95a0a8e552c032f3661a4f1d38317",
"score": "0.62641567",
"text": "def get_acme_client(account_key, options)\n return @client if @client\n\n logger.debug { \"connect to #{options[:server]}\" }\n @client = Acme::Client.new(private_key: account_key, endpoint: options[:server])\n\n yield @client if block_given?\n\n if options[:email].nil?\n logger.warn { '--email was not provided. ACME CA will have no way to ' \\\n 'contact you!' }\n end\n\n begin\n logger.debug { \"register with #{options[:email]}\" }\n registration = @client.register(contact: \"mailto:#{options[:email]}\")\n rescue Acme::Client::Error::Malformed => ex\n raise if ex.message != 'Registration key is already in use'\n else\n # Requesting ToS make acme-client throw an exception: Connection reset\n # by peer (Faraday::ConnectionFailed). To investigate...\n #if registration.term_of_service_uri\n # @logger.debug { \"get terms of service\" }\n # terms = registration.get_terms\n # if !terms.nil?\n # tos_digest = OpenSSL::Digest::SHA256.digest(terms)\n # if tos_digest != @options[:tos_sha256]\n # raise Error, 'Terms Of Service mismatch'\n # end\n @logger.debug { 'agree terms of service' }\n registration.agree_terms\n # end\n #end\n end\n\n @client\n end",
"title": ""
},
{
"docid": "a148ba2b6c60a52d4f1ca551d6892b73",
"score": "0.6258597",
"text": "def get_account_oauth_client(account_id, client_id, opts = {})\n data, _status_code, _headers = get_account_oauth_client_with_http_info(account_id, client_id, opts)\n data\n end",
"title": ""
},
{
"docid": "31a1e7e2a60ce622a0bad93142a7aa4b",
"score": "0.6256657",
"text": "def get_client(addr)\n client = REDIS.hgetall(\"clients:#{addr}\")\n raise UnknownClient if client == {}\n return client\nend",
"title": ""
},
{
"docid": "39a93cb1e37018d306323877a5b20373",
"score": "0.6255275",
"text": "def account(account, options = {})\n get(\"accounts/#{account}\", options).pop\n end",
"title": ""
},
{
"docid": "2b8f07fafc6cb6fec8c64cb466008c4d",
"score": "0.625501",
"text": "def get_client()\n apiUrl = \"#{APP_CONFIG['api_base']}\"\n uri = URI.parse(apiUrl)\n apiUrl = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\n return OAuth2::Client.new(APP_CONFIG['client_id'], APP_CONFIG['client_secret'], {:site => apiUrl, :token_url => '/api/oauth/token', :authorize_url => '/api/oauth/authorize'})\n end",
"title": ""
},
{
"docid": "f9c215e8c55eeda9a4227effb242f58f",
"score": "0.62485003",
"text": "def get_client(bancbox_id = nil, ref_id = nil)\n resp = setup_client(:get_client) do |soap|\n soap.body do |xml|\n xml.getClientRequest do |xml|\n xml.subscriberId BancBox.subscriber_id\n xml.clientId do |xml|\n xml.bancBoxId bancbox_id\n xml.subscriberReferenceId ref_id\n end\n end\n end\n end.to_hash\n return resp[:get_client_response][:return]\n end",
"title": ""
},
{
"docid": "ad86a9a817898df18ceb3adab653521a",
"score": "0.62407327",
"text": "def show\n @wx_official_account.client\n\n end",
"title": ""
},
{
"docid": "8b74bc42397dc6d9616251c1b890163d",
"score": "0.62402743",
"text": "def channel_account\n @channel_account ||= Resource.new(self, '/v1/channelaccounts', options)\n end",
"title": ""
},
{
"docid": "dea099d984a9010f627d78d46e2cb25e",
"score": "0.6239219",
"text": "def client\n @client = Tradier::Client.new(options) unless defined?(@client) && @client.hash == options.hash\n @client\n end",
"title": ""
},
{
"docid": "d25fe3195167bf0dac8123634aae5f9e",
"score": "0.62326074",
"text": "def account\n @account ||= Endpoints::AccountEndpoint.new(self)\n end",
"title": ""
},
{
"docid": "19228ae3fba82289b511dcebc2cd9450",
"score": "0.62306255",
"text": "def account\n Accounts.match_by_id(self.account_id)\n end",
"title": ""
},
{
"docid": "6b867226b0b1de1541f37a1e976d915c",
"score": "0.62297946",
"text": "def client\n return @api_client if @api_client.present?\n\n @api_client = send(:\"#{@auth_method}\")\n return @api_client if @api_client.present?\n\n # Record an error if no ApiClient or User was authenticated\n @errors[:client_authentication] = _('Invalid credentials')\n nil\n end",
"title": ""
},
{
"docid": "3d76d295a99ea2d1b740128c1ab17d25",
"score": "0.62288815",
"text": "def account\n account_data = get_scoped_account.merge(:service => self)\n Fog::Compute::Brightbox::Account.new(account_data)\n end",
"title": ""
},
{
"docid": "0545a3214bae2d0ee2552b1c21ae5e9a",
"score": "0.6226877",
"text": "def client\n @client ||= CLIENT.new(@api_token)\n end",
"title": ""
},
{
"docid": "7853463165fb71fbeda12ddfbd43c046",
"score": "0.6223592",
"text": "def find_account_id(username, client_ip)\n instance.find_account_id(username, client_ip)\n end",
"title": ""
},
{
"docid": "dbebdab0ffe75d1e5cba5bd67d534bf8",
"score": "0.622009",
"text": "def accounts\n @accounts ||= AccountsService.new(@http_client)\n end",
"title": ""
},
{
"docid": "545ef1102d757386b07255de71a11b17",
"score": "0.6215082",
"text": "def client\n @client ||= client_class.new\n end",
"title": ""
},
{
"docid": "d58416cab20309fe5c566a17669fb9ba",
"score": "0.6209742",
"text": "def account\n @account ||= Account.find(@account_id)\n end",
"title": ""
},
{
"docid": "5bff27b44fc40e66300b8544695f3c0b",
"score": "0.62091583",
"text": "def client\n @client ||= Bitlyr::Client.new(@access_token)\n end",
"title": ""
},
{
"docid": "d58416cab20309fe5c566a17669fb9ba",
"score": "0.62089556",
"text": "def account\n @account ||= Account.find(@account_id)\n end",
"title": ""
},
{
"docid": "d2cba0b50336855ebe0c400bade64cc0",
"score": "0.62080127",
"text": "def client\n @client\n end",
"title": ""
},
{
"docid": "32067c58181eb163c1275751b9abe83f",
"score": "0.61988336",
"text": "def account\n response = send(:get , '/api/v1/account.json')\n \n Unfuddled::Account.from_response(response)\n end",
"title": ""
},
{
"docid": "95ae8308b0bdc60dbcf309ecc9334f25",
"score": "0.6198186",
"text": "def enterprise_account\n @enterprise_account_resource ||= EnterpriseAccount.new(@client)\n end",
"title": ""
}
] |
707db7469ce4c39d8b6b52dcb494843c
|
[NOTE] Doesn't support direct filters
|
[
{
"docid": "e0a94ae7174627175d113802128c94b4",
"score": "0.0",
"text": "def load_proxy_list(*)\n doc = load_document(PROVIDER_URL, {})\n doc.xpath('//table[contains(@class, \"table\")]/tr[(not(@id=\"proxy-table-header\")) and (count(td)>2)]')\n end",
"title": ""
}
] |
[
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.82246053",
"text": "def filters; end",
"title": ""
},
{
"docid": "4087b6a41b936c81a3da596e44442616",
"score": "0.8103523",
"text": "def filtering; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.80801076",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.80801076",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.80801076",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.80801076",
"text": "def filter; end",
"title": ""
},
{
"docid": "08ecfc5d5251841112a950c6a2dcc756",
"score": "0.80801076",
"text": "def filter; end",
"title": ""
},
{
"docid": "dcc6749c2270ff875d24ec6eecdfc64f",
"score": "0.80384624",
"text": "def filter\n end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.7926986",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.7926986",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.7926986",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "9666b9263e460eb869709fbc0a418762",
"score": "0.7926986",
"text": "def filters=(_arg0); end",
"title": ""
},
{
"docid": "4e24461b754fc7eaeb8b99dd506bf94c",
"score": "0.7847612",
"text": "def subfilters; end",
"title": ""
},
{
"docid": "68194633da67c783b2a3ed7dd341587c",
"score": "0.7826557",
"text": "def filters=(_); end",
"title": ""
},
{
"docid": "c561d9c5e61df6cbb2e4192dd4c685db",
"score": "0.77251804",
"text": "def filter(params); end",
"title": ""
},
{
"docid": "60d748a318d87749f020b525b0d050cb",
"score": "0.7638434",
"text": "def filter!; end",
"title": ""
},
{
"docid": "ea65fbd14f47a2eafe875c75c5be60cb",
"score": "0.76188344",
"text": "def deep_filters?; end",
"title": ""
},
{
"docid": "eb2996860362f20764d82a1c47575e1a",
"score": "0.7565426",
"text": "def query_filters; end",
"title": ""
},
{
"docid": "1bdadcc2f6d3a6f2bf8d5243ffbe5a48",
"score": "0.7555532",
"text": "def filter\r\n raise NotImplementedError\r\n end",
"title": ""
},
{
"docid": "ca0738b14101c2d459a2b987cdbf1641",
"score": "0.75471205",
"text": "def process_filter\n # TODO\n end",
"title": ""
},
{
"docid": "46c24c2be4ceca522d8026bb12bc7d33",
"score": "0.7535423",
"text": "def named_filter; end",
"title": ""
},
{
"docid": "5a7ce324b9467d1e1508f4477cb646f5",
"score": "0.7462159",
"text": "def get_filter\n end",
"title": ""
},
{
"docid": "5a7ce324b9467d1e1508f4477cb646f5",
"score": "0.7462159",
"text": "def get_filter\n end",
"title": ""
},
{
"docid": "c1936776d18ab04ac1d6d7aefb506799",
"score": "0.7445748",
"text": "def items_and_filters; end",
"title": ""
},
{
"docid": "e506ebdfc05f3896b50170508c8938d4",
"score": "0.74169976",
"text": "def filtering=(_arg0); end",
"title": ""
},
{
"docid": "e88e9dd4a1ed6927e44b29a413674989",
"score": "0.74160534",
"text": "def filtering(*)\n end",
"title": ""
},
{
"docid": "ac7ac13706d9c39052e77b10d35c06d1",
"score": "0.74095774",
"text": "def get_filter\n\n end",
"title": ""
},
{
"docid": "5a53787f848cd6f13c93910acd27cac6",
"score": "0.7407133",
"text": "def query_filters=(_arg0); end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.7332129",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "b41c05e628d49016e2070e9acc86093c",
"score": "0.7289803",
"text": "def filter=(filter); end",
"title": ""
},
{
"docid": "4c282705d7f37ebb9494fafefc45412b",
"score": "0.72856045",
"text": "def filter=(_arg0); end",
"title": ""
},
{
"docid": "b2b7172f417be62e132a79405c17b677",
"score": "0.7242719",
"text": "def sub_filters\n []\n end",
"title": ""
},
{
"docid": "b3468a7f6c1b6a95065392783aef7dcd",
"score": "0.72378725",
"text": "def post_filters; end",
"title": ""
},
{
"docid": "ce30b678d1ef191325ab8853632861b6",
"score": "0.7162709",
"text": "def filter\n raise NotImplementedError, 'This is an interface'\n end",
"title": ""
},
{
"docid": "6d737e1aeb135a590643570e132e2b08",
"score": "0.71094126",
"text": "def filter_argument; end",
"title": ""
},
{
"docid": "adb6f88b8d44abbcecadbf5891de0902",
"score": "0.7098332",
"text": "def make_filter(parts); end",
"title": ""
},
{
"docid": "9f50ba336c1ea341da4f4cea93fa4e91",
"score": "0.70711285",
"text": "def remove_filters!; end",
"title": ""
},
{
"docid": "d699018ed6dada655297b9cd5e0cef73",
"score": "0.703881",
"text": "def inclusion_filter; end",
"title": ""
},
{
"docid": "dbf604514d20dc5238bb1afbb0bb4ffe",
"score": "0.7036202",
"text": "def prepare_example_filtering; end",
"title": ""
},
{
"docid": "568878880d3e204a460a92cf05f3ea58",
"score": "0.70292246",
"text": "def filter_generator\n end",
"title": ""
},
{
"docid": "b4b49e58a85a086c28d1904c4a201cdd",
"score": "0.7015017",
"text": "def filters\n @filters\nend",
"title": ""
},
{
"docid": "1c148848cd8f8f551137f64ed287e1a3",
"score": "0.70071507",
"text": "def expression_filters; end",
"title": ""
},
{
"docid": "72347fd6976387f7c77b74e6440673f0",
"score": "0.70056564",
"text": "def potential_filters\n [:sort_by_filter]\n end",
"title": ""
},
{
"docid": "40f47b4a6204052d6cc3123b843113d8",
"score": "0.6993204",
"text": "def filters\n @filters\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.697815",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "a82926943adb5e5e5df7385df937c4ea",
"score": "0.69571805",
"text": "def auto_filter; end",
"title": ""
},
{
"docid": "0dbc51c3e70c3eb06f25124a19fe608e",
"score": "0.6951985",
"text": "def filter\n @filter\n end",
"title": ""
},
{
"docid": "2cb3ccbca7de4ec2b6414329485c7c06",
"score": "0.69409657",
"text": "def available_filters\n %w(me type priest_id distance now)\n end",
"title": ""
},
{
"docid": "c735401e0f62168962db8b9abdf20d27",
"score": "0.6939565",
"text": "def node_filters; end",
"title": ""
},
{
"docid": "2e6e5b0f0af8994318fef718d3953aa8",
"score": "0.6937295",
"text": "def filters\n _filters = []\n self.each do |_filter|\n _filters.add(_filter.filters)\n end\n _filters \n end",
"title": ""
},
{
"docid": "6aa538a02f9dc1d635428f49ef32f734",
"score": "0.69309336",
"text": "def filter_items; end",
"title": ""
},
{
"docid": "99bbcc6101a9e521313cf04f280f4583",
"score": "0.69296324",
"text": "def potential_filters\n [:date_filter,:classroom_filter, :sort_by]\n end",
"title": ""
},
{
"docid": "5b04edb8b01b189290c02bf5ec41d9b6",
"score": "0.68960774",
"text": "def filter_parameters=(_arg0); end",
"title": ""
},
{
"docid": "e3f385da3b6496ce50baf3f69fccb3ed",
"score": "0.6892276",
"text": "def autofilter\n\t\ttrue\n\tend",
"title": ""
},
{
"docid": "fe0c25f88db4650b6b2543d522b4977e",
"score": "0.68546355",
"text": "def potential_filters\n [:date_filter, :sort_by]\n end",
"title": ""
},
{
"docid": "d3732ff42abd0a618a006d1f24e31e38",
"score": "0.6836466",
"text": "def add_to_filter_parameters; end",
"title": ""
},
{
"docid": "f86f4a9aa78e3b7b4ffa6cae7c170c09",
"score": "0.68259484",
"text": "def filter(*args); Typelib.filter_function_args(args, self) end",
"title": ""
},
{
"docid": "eef18eddfd80b96da8af6e0cb719c12d",
"score": "0.68150127",
"text": "def mine_filter\n nil\n end",
"title": ""
},
{
"docid": "292555f8d20f5f7cdfc7b9a919df4175",
"score": "0.6812945",
"text": "def safe_filter(filters = {}, meta = {})\n\n filter(filters, meta, true)\n\n self\n\n end",
"title": ""
},
{
"docid": "688e6bcaa47f028d4c2130418098b8e9",
"score": "0.6811541",
"text": "def post_filters=(_arg0); end",
"title": ""
},
{
"docid": "7ce015fda1d180e773a8d868bb1384a5",
"score": "0.67935956",
"text": "def filters\n # make it difficult to mess with the list directly\n @filters.dup\n end",
"title": ""
},
{
"docid": "0a30209cc4d89015c1e2a5b9bd8753a2",
"score": "0.67836523",
"text": "def filter\n index\n end",
"title": ""
},
{
"docid": "656e3e62d123f8d16933e24e71ea62da",
"score": "0.67822427",
"text": "def filters\n @filters\n end",
"title": ""
},
{
"docid": "656e3e62d123f8d16933e24e71ea62da",
"score": "0.67822427",
"text": "def filters\n @filters\n end",
"title": ""
},
{
"docid": "656e3e62d123f8d16933e24e71ea62da",
"score": "0.67822427",
"text": "def filters\n @filters\n end",
"title": ""
},
{
"docid": "656e3e62d123f8d16933e24e71ea62da",
"score": "0.67822427",
"text": "def filters\n @filters\n end",
"title": ""
},
{
"docid": "f40360f64e09bcbd950a31f804aa4d5c",
"score": "0.6774559",
"text": "def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"title": ""
},
{
"docid": "47b24c36ebb017cdbf131365c5224577",
"score": "0.6766931",
"text": "def filter(art)\n if @config['filters'] then \n if @config['filters']['attributes'] then \n art= filter_by_attribute(art)\n end \n if @config['filters']['regexp'] then \n art= filter_by_regexp(art)\n \n end \n end \n art \n \n end",
"title": ""
},
{
"docid": "c451de2e36954526f95cffe782ceaf7d",
"score": "0.6737521",
"text": "def filter(params)\n @no_filters ? params.dup : call(params)\n end",
"title": ""
},
{
"docid": "caac3357384713db3c3dd54f0fba9211",
"score": "0.67350066",
"text": "def filters\n @filters ||= {}\n end",
"title": ""
},
{
"docid": "efe2b9c98e44b54a5260d33dda0eb601",
"score": "0.67259467",
"text": "def perform_filter(filter, doc, context, result); end",
"title": ""
},
{
"docid": "ca34999606dc9d5af6be0de62cd5c0a3",
"score": "0.671718",
"text": "def filters\n @filters ||= []\n end",
"title": ""
},
{
"docid": "ca34999606dc9d5af6be0de62cd5c0a3",
"score": "0.671718",
"text": "def filters\n @filters ||= []\n end",
"title": ""
},
{
"docid": "db1eebdda9385be79ecc7acf34329c8b",
"score": "0.67078614",
"text": "def filters\n @filters ||= @params[:f_inclusive]&.deep_dup || {}\n end",
"title": ""
},
{
"docid": "10d1aa0f65e94c21f492a8f8cacd9c76",
"score": "0.6693717",
"text": "def filter(lexers); end",
"title": ""
},
{
"docid": "52c6413685e17b0045783358879f6853",
"score": "0.66880023",
"text": "def potential_filters\n [:date_filter, :reward_status_filter, :teachers_filter, :reward_creator_filter, :sort_by]\n end",
"title": ""
},
{
"docid": "6a8aa953696fe0ff73843414ba3aa41c",
"score": "0.66843855",
"text": "def apply_filters\n if @filters.present?\n @filters.map {|i| i[1]}.each do |filter|\n unless apply_filter(filter)\n @query = @query.none\n\n return\n end\n end\n end\n end",
"title": ""
},
{
"docid": "3ecc3271bb4740cce78072569142487c",
"score": "0.66836554",
"text": "def filters\n @filters ||= {}\n end",
"title": ""
},
{
"docid": "3ecc3271bb4740cce78072569142487c",
"score": "0.66836554",
"text": "def filters\n @filters ||= {}\n end",
"title": ""
},
{
"docid": "3c2ad741b6b1e48d5e25a145fd468a04",
"score": "0.6679438",
"text": "def & filter; Filter.new :and, self, filter; end",
"title": ""
},
{
"docid": "3c2ad741b6b1e48d5e25a145fd468a04",
"score": "0.6679438",
"text": "def & filter; Filter.new :and, self, filter; end",
"title": ""
},
{
"docid": "2cef5663c072abf218c907f53cdccad0",
"score": "0.6678596",
"text": "def filter\n return @filter\n end",
"title": ""
},
{
"docid": "d632648ca13a3d3e9cea4e05f969121d",
"score": "0.66664976",
"text": "def filters\n @filters ||= []\n end",
"title": ""
},
{
"docid": "b6d410b335feb12da25d08f2b5a40f96",
"score": "0.66617864",
"text": "def announce_filters; end",
"title": ""
},
{
"docid": "070724126c8013fc7041e3664521d204",
"score": "0.66494083",
"text": "def filter(*args, &block)\n @filters.use(*args, &block)\n end",
"title": ""
},
{
"docid": "a1a721485215bbd874716661a07d9fd7",
"score": "0.6635907",
"text": "def uhook_filtered_search filters\n []\n end",
"title": ""
},
{
"docid": "f707278f8ab8258c73f0d5a3b593b30a",
"score": "0.6628758",
"text": "def exclusion_filter; end",
"title": ""
},
{
"docid": "ee2fbc05329022f5bf04aa34de994ae2",
"score": "0.6628711",
"text": "def apply_filters\n raise NotImplementedError, \"#{self.class.name} does not allow queryable filtering, use apply_tournament_filter, apply_match_filter instead\"\n end",
"title": ""
},
{
"docid": "4f4754f1ab3b995cc590537879075363",
"score": "0.6623355",
"text": "def filter\n filter_disabled\n filter_repeated\n # filter_silenced\n filter_dependencies\n end",
"title": ""
},
{
"docid": "0b396cfb8cb99e38b051176b384608ce",
"score": "0.6613617",
"text": "def apply_filter(scope, value)\n #wip\n end",
"title": ""
},
{
"docid": "c1d4e3b7cc5bfe383df988a6729ca511",
"score": "0.6608386",
"text": "def scopes_to_filter=(_arg0); end",
"title": ""
},
{
"docid": "71afaaea2e2d9cd6a691b17f41e1b50d",
"score": "0.66081774",
"text": "def autofilter\r\n\t\tfalse\r\n\tend",
"title": ""
},
{
"docid": "71afaaea2e2d9cd6a691b17f41e1b50d",
"score": "0.66081774",
"text": "def autofilter\r\n\t\tfalse\r\n\tend",
"title": ""
},
{
"docid": "71afaaea2e2d9cd6a691b17f41e1b50d",
"score": "0.66081774",
"text": "def autofilter\r\n\t\tfalse\r\n\tend",
"title": ""
}
] |
573af92be0a75024c8194ac51cffbb84
|
number The number to which factorial is supposed to count up to. Examples factorial(5) => 120 Returns the factorial of every number up to the given number.
|
[
{
"docid": "672739447a39fcf49a863e26a2e7bc7b",
"score": "0.0",
"text": "def factorial(number)\n i = 0\n output = 1\n while i < number\n i +=1\n output = output*i\n end\n return output\nend",
"title": ""
}
] |
[
{
"docid": "df27a9f59011ff035a18ed148cfcc539",
"score": "0.8281185",
"text": "def factorial(number)\n\tsum = 1\n\tsum.upto(number) { |n| sum *= n }\n\treturn sum\nend",
"title": ""
},
{
"docid": "e8c9d8a3892c54061e6dfea9e8dcfea3",
"score": "0.8215098",
"text": "def factorial(number)\n\tif number == 0\n\t\treturn 1\n\telse\n\t\tnumber * factorial(number - 1)\n\tend\nend",
"title": ""
},
{
"docid": "b1934a433138a2b3c2a5d82571cd149f",
"score": "0.8076517",
"text": "def factorial(number)\n\treturn number <= 1 ? 1 : number * factorial(number-1)\nend",
"title": ""
},
{
"docid": "6ce5e064afe426014734b09f68747dc5",
"score": "0.807162",
"text": "def factorial(number)\n \n\tif number <= 1\n\t\treturn 1\n\t\n\telse\n\t \n\t x = number \n\t answer = 1\n\t \n\t until x == 0\n\t \tanswer = answer*x\n\t \tx = x-1\n\t end\n\n\t return answer\n\n\tend\n\nend",
"title": ""
},
{
"docid": "464747fd8dba0fac67f096b93fd4662d",
"score": "0.8025185",
"text": "def factorial(number)\n\ttotal = 1\n\t(1..number).each do |number|\n\t\ttotal *= number \n\tend\n\ttotal\nend",
"title": ""
},
{
"docid": "288a69d562bf77fdcabdbd1e3b1163df",
"score": "0.80164313",
"text": "def calculate_factorial(number)\n\tfactorial = 1\n\tif(number == 0 || number == 1)\n\t\tfactorial = 1\n\telse\n\t\tfor i in 1..number do\n\t\t\tfactorial *= i\n\t\tend\n\tend\n\tfactorial\nend",
"title": ""
},
{
"docid": "5830c9b4e1ea111097cbe06fa955c442",
"score": "0.79731375",
"text": "def factorial (number)\n\n\tanswer = 1\n\tcounter = 1\n\n\tif number < 0\n\t\t\"Less than zero\"\n\telse\n\t\twhile counter <= number\n\t\t\tanswer *= counter #answer = counter * answer\n\t\t\tcounter += 1\n\t\tend \n\t\treturn answer\n\tend\nend",
"title": ""
},
{
"docid": "2a5c2af6d3d7b4fd4501547a0cf03953",
"score": "0.7964097",
"text": "def factorial(number)\n\tif number != 0 \n\t\tproduct = 1\n\t\twhile number > 1\n\t\t\tproduct = product*number \n\t\t\tnumber-=1\n\t\tend\n\t\tproduct\n\telse return 1\n\tend\nend",
"title": ""
},
{
"docid": "b5af20524d363b9965c2ec6a70115a1c",
"score": "0.7957193",
"text": "def factorial(number)\n\tresult = 1\n\twhile number > 0\n\t\tresult = number * result\n\t\tnumber = number - 1\n\tend\n\treturn result\nend",
"title": ""
},
{
"docid": "9d55d14d950d455b5ee6381dae2a5d7b",
"score": "0.79330873",
"text": "def factorial(number)\n result = number\n for i in 1...number\n \tresult *= (number - i)\n end\n number == 0 ? 1 : result\nend",
"title": ""
},
{
"docid": "614a24e2a3ed81949c7658dbfbeea3d5",
"score": "0.79187524",
"text": "def factorial(number)\n if number == 0\n \treturn 1\n else\n \tn = number - 1\n \twhile n >= 1\n \t\tnumber *= n\n \t\tn -= 1\n \tend\n \treturn number\n end\nend",
"title": ""
},
{
"docid": "951d25431ac17cdcb8f9cce528948858",
"score": "0.7906837",
"text": "def factorial(number)\n if number == 0 || number == 1\n \t return 1\n end\n\n i = (number-1)\n n = (number*i)\n while i > 1\n \t i = i-1\n \t n = n*i\t\n end\n return n\nend",
"title": ""
},
{
"docid": "06571a9daa195f74d26fa38cbad80ea5",
"score": "0.7903098",
"text": "def factorial(number)\n\tif number <= 1\n\t\treturn 1\n\telse\n \tproduct = 1\n \ta = 0\n \t\tnumber.times do\n \t\ta += 1 # starts at 1 and goes up\n \t\tproduct *= a\n \t\tend\n \tend\n \treturn product\nend",
"title": ""
},
{
"docid": "97b942bf851f031293d07d2e8cad8703",
"score": "0.7900183",
"text": "def factorial(number)\n x = 1\n number.times {|i| x = (i+1) * x}\n end",
"title": ""
},
{
"docid": "37b02ed32ec09d8a41ad5b0a3331627e",
"score": "0.78859",
"text": "def factorial(number)\n if number == 0\n return 1\n else\n counter = 1\n for n in (1..number)\n counter *= n\n end\n return counter\n end\nend",
"title": ""
},
{
"docid": "82b33f6a684563c5315fed0174f8290c",
"score": "0.78808004",
"text": "def factorial(number)\n raise ArgumentError.new(\"Invalid number\") if number == nil\n return 1 if number == 0\n\n final_number = number\n\n (number - 1).times do\n number -= 1\n final_number *= number\n end\n return final_number\nend",
"title": ""
},
{
"docid": "def924c4b618d2bfc8addc3844d27d92",
"score": "0.7878623",
"text": "def factorial(number)\n if number == 0\n 1\n else\n i = number-1\n while i >= 1\n number = number * i\n i = i - 1\n end\n number\n end\nend",
"title": ""
},
{
"docid": "543b482e30925ef5416c3cf9f69582ee",
"score": "0.7873642",
"text": "def factorial(number)\n\tif number == 0\n\t\treturn 1\n\tend\n\ttotal = number\n\twhile (number - 1) > 0\n\t\ttotal = total * (number - 1)\n\t\tnumber = number - 1\n\tend\n\treturn total\nend",
"title": ""
},
{
"docid": "cda00e28c60251feddabeb5610848de0",
"score": "0.7870846",
"text": "def factorial(number)\n if number == 1\n 1\n elsif number == 0\n \t1 \n else\n number * factorial(number-1) \n end \nend",
"title": ""
},
{
"docid": "e7900cea35577dccb0e9a76e13f03ce0",
"score": "0.7830844",
"text": "def factorial\n \t\n if (number > 1)\t\n\t(1..number).inject {|product, number| product * number}\n\t\n else \n\treturn 1\n\t\n\tend\t \n\nend",
"title": ""
},
{
"docid": "c7b17598d780d7199925c837c56e9cac",
"score": "0.7829826",
"text": "def factorial(number)\n if number == 0 || number==1\n return 1\n end\n\n i = (number - 1)\n n = number * i\n while i > 1\n i= i-1\n n = n * i\n end\n return n\nend",
"title": ""
},
{
"docid": "6d422ea924a260b580559722495b67eb",
"score": "0.7795819",
"text": "def factorial(number)\n\t#number - (number-1) - number-2, etc., until number = 0\n\tcounter = number\n\tsum = 1\n\twhile (counter > 0)\n\t\tsum = sum * counter\n \t\tcounter = counter - 1\n\tend\n\tp sum\nend",
"title": ""
},
{
"docid": "5e4654b0ae5c82a87c51538d7919c1d7",
"score": "0.7765554",
"text": "def factorial(number)\n if number == 0 || number == 1\n return 1\n else\n result = 1\n while number > 1\n result = result * number\n number -= 1\n end\n end\n return result\nend",
"title": ""
},
{
"docid": "34bf3af2bb6bdb3087f222171558ef46",
"score": "0.7762967",
"text": "def factorial(number)\n if number == 0\n return 1\n else\n count = number - 1\n factorial = number\n while count > 0\n factorial = factorial * count\n count -= 1\n end\n end\n return factorial\nend",
"title": ""
},
{
"docid": "1b16db18db510fc3de307ecef25c0e96",
"score": "0.7758649",
"text": "def factorial(number)\n if number <= 1\n number\n else\n number * factorial(number - 1)\n end\nend",
"title": ""
},
{
"docid": "c446c8a6b8cba3cd9f7ca0dc1edd0068",
"score": "0.77576035",
"text": "def factorial(number)\n n = 0\n x = 1\n if number == 0\n return 1\n else\n while number > 0\n x = x * number\n number -= 1\n end\n end\n return x\nend",
"title": ""
},
{
"docid": "e1eeec9e2fc2fceb93c2f39768e80fb1",
"score": "0.77539074",
"text": "def factorial(number)\r\n if number == 0\r\n \treturn 1\r\n else\r\n \ttotal = 1\r\n \tuntil number == 1\r\n \t\ttotal = total * number\r\n \t\tnumber = (number-1)\r\n \tend\r\n \treturn total\r\n end\r\nend",
"title": ""
},
{
"docid": "19ede9669a1be953d429cab900fe15f5",
"score": "0.7750291",
"text": "def factorial(number)\n if number == 0\n 1\n else\n number * factorial(number - 1)\n end\nend",
"title": ""
},
{
"docid": "27fd13f252ec2ae980ab96d38b79347d",
"score": "0.77461994",
"text": "def factorial(number)\n if number == 0\n 1\n else\n sum = 1\n (1..number).each do |num|\n sum = sum * num\n end\n sum\n end\nend",
"title": ""
},
{
"docid": "c14c76af2913e3ebbb2ba692717b72ea",
"score": "0.77443165",
"text": "def factorial(number)\n sum = 1\n sum.upto(number) { |n| sum *= n }\n return sum\nend",
"title": ""
},
{
"docid": "06882731870641eab151564e7bc2bcf1",
"score": "0.7738528",
"text": "def factorial(number)\n\tif number <= 1\n\t\treturn 1\n\tend\n ans = number\n while number > 1\n ans = ans * (number - 1)\n number -= 1\n end\n return ans\nend",
"title": ""
},
{
"docid": "7dfce3c4952258b9e933c1a59525052b",
"score": "0.7738231",
"text": "def factorial(number)\r\n return number > 1 ? factorial(number - 1) * number : 1\r\nend",
"title": ""
},
{
"docid": "632d31782c3351da03c55d99b2cd5dde",
"score": "0.77269995",
"text": "def factorial(number)\n factorial = 1\n i=0\n\n if number == 0\n return 1\n\n else\n while i < number\n factorial = factorial*(number-i)\n i +=1\n end\n end\n\n return factorial\nend",
"title": ""
},
{
"docid": "4de2f58ff20b5595022abaedd32343c3",
"score": "0.7721141",
"text": "def factorial(number)\n\n if number == 0\n i = 1\n else\n i = number\n end\n\n while number > 1\n i = i * (number - 1)\n number = number - 1\n end\n\n return i\nend",
"title": ""
},
{
"docid": "0ba6a77095506f44d47ad1d9a9891299",
"score": "0.77170974",
"text": "def factorial(number)\n num = number\n answer = 1\n\n while num > 0 do \n \tanswer *= num\n \tnum = num - 1\n\n end \n answer\n \t\n end",
"title": ""
},
{
"docid": "6d8efd132ff189818f161dfb760993bd",
"score": "0.7714971",
"text": "def factorial(number)\n if number == 0\n return 1\n else\n f_num = 1\n (1..number).each {|n| f_num = f_num * n}\n # f_num is the product of a number and the factorial of its previous of number\n return f_num\n end\nend",
"title": ""
},
{
"docid": "53e1b622ae9765ecf3ed0fbb9e1581e9",
"score": "0.771353",
"text": "def factorial(number)\n return 1 if number == 0\n \n result = 1\n while number > 1\n \tresult = result * number\n \tnumber -= 1\n end\n return result\nend",
"title": ""
},
{
"docid": "8fc7a5cb8f98cccdfcc53f0fd650e1b2",
"score": "0.77104384",
"text": "def factorial(number)\r\n # Your code goes here\r\n if number == 0\r\n \t1\r\n else\r\n \tnumber * factorial(number-1) \r\n \tend\r\nend",
"title": ""
},
{
"docid": "f9e4bfbc17dec85c3554fafd219d94dd",
"score": "0.77070105",
"text": "def factorial(number)\n\ti=1\n\tx = number\n if number == 0\n \treturn 1\n end\n while i<x do\n\t\tnumber = number*i\n\t\ti +=1\n\tend\n\treturn number\nend",
"title": ""
},
{
"docid": "61de45148d2d6e73863e0a965656a829",
"score": "0.7700591",
"text": "def factorial(number)\n\tcurrent_product = 1\n\twhile number > 0\n\t\tcurrent_product *= number\n\t\tnumber -= 1\n\tend\n\treturn current_product\nend",
"title": ""
},
{
"docid": "ce9d5a27d2616d0eb9f84ee6e03c0f8a",
"score": "0.770022",
"text": "def factorial(number)\n result = 1\n if number == 0 || number == 1\n return 1\n else\n idx = number\n while idx > 0\n result *= idx\n idx -= 1\n end\n result\n end\nend",
"title": ""
},
{
"docid": "68a0b585647226fd3c8ecaef4256901a",
"score": "0.7695202",
"text": "def factorial(number)\n if number == 0\n return 1\n elsif number >= 1000\n return 0\n else\n return number*factorial(number-1)\n end\nend",
"title": ""
},
{
"docid": "f1da4dd137c88bc06a32fe20dfb54f91",
"score": "0.76895404",
"text": "def factorial(number)\n if number == 0\n \treturn 1\n end\n\n result = number\n i = 1\n while i < number\n \tresult = result* i\n \ti += 1\n end\n\n return result\nend",
"title": ""
},
{
"docid": "57fabe214bd8bbd4ce0f4e31d93cc85a",
"score": "0.76810443",
"text": "def factorial(number)\n raise ArgumentError unless number\n factorial = 1\n while number > 1\n factorial *= number\n number -= 1\n end\n return factorial\nend",
"title": ""
},
{
"docid": "22ffcb6b100d11708f489b57bcf4ee1f",
"score": "0.7675878",
"text": "def factorial(number)\n return 1 if number == 0\n\n (number - 1).times do |n|\n number *= (n + 1)\n end\n\n return number\nend",
"title": ""
},
{
"docid": "5d32f21db85d0932a53c17d860d86a4b",
"score": "0.7675135",
"text": "def factorial(number)\n factor = 1\n counter = 1\n while counter < number\n factor *= (counter + 1)\n counter += 1\n end\n return factor\nend",
"title": ""
},
{
"docid": "5d32f21db85d0932a53c17d860d86a4b",
"score": "0.7675135",
"text": "def factorial(number)\n factor = 1\n counter = 1\n while counter < number\n factor *= (counter + 1)\n counter += 1\n end\n return factor\nend",
"title": ""
},
{
"docid": "187616ef8dee859807e2b9a392928661",
"score": "0.7671178",
"text": "def factorial(number)\n raise ArgumentError.new if number.class != Integer\n return 1 if number <= 1\n\n i = 0\n result = 1\n while (number - i) != 0\n result *= (number - i)\n i += 1\n end\n return result\nend",
"title": ""
},
{
"docid": "f3c6790d8bc962afb4829a671050237d",
"score": "0.7658548",
"text": "def factorial(number)\n factorial = number\n while number > 1\n number = number - 1\n factorial = factorial * number\n end\n return factorial\nend",
"title": ""
},
{
"docid": "c473ce6fac809bc4d4c450717b7664a1",
"score": "0.76553214",
"text": "def factorial(number)\n # Your code goes here\n if number == 0\n \t 1\n else\n number * factorial(number-1)\n end\nend",
"title": ""
},
{
"docid": "4f16ac0ce1fd3e3e1f1cf9ba316d5968",
"score": "0.7651346",
"text": "def factorial(number)\n if number == 0\n return 1\n end\n factorial = 1\n while number > 1\n factorial = factorial * number\n number = number - 1\n end\n return factorial\nend",
"title": ""
},
{
"docid": "e3dc4842fd027b3c4deb7cfc8d9274d6",
"score": "0.76468134",
"text": "def factorial(number)\n n=1\n if number == 0\n return 1\n elsif number == 1\n return 1\n end\n while number > 1\n n *= number\n number -= 1\n puts n\n end\n return n\nend",
"title": ""
},
{
"docid": "a4cab27f3324e4970c11c56d97097de7",
"score": "0.7644443",
"text": "def factorial(number)\n fact = number\n\n if number==0\n return 1\n end\n\n while number > 1\n fact = fact * (number - 1)\n number = number - 1\n end\n\n return fact\nend",
"title": ""
},
{
"docid": "e4efa0daa0965d7614c938577635f7b2",
"score": "0.76401556",
"text": "def factorial(number)\n # Your code goes here\n result = 1\n\n if number == 1 or number == 0\n \treturn 1\n else\n \twhile (number>=2)\n \t\tresult *= number * (number - 1)\n \t\tnumber -= 2\n \tend\n \treturn result\n end\nend",
"title": ""
},
{
"docid": "e0da553b4131f16699a273ea5c084c1d",
"score": "0.76351815",
"text": "def factorial(number)\n raise ArgumentError if number.nil?\n return 1 if number == 0\n factorial = number\n while number > 1\n number = number - 1\n factorial *= number\n end\n return factorial\nend",
"title": ""
},
{
"docid": "7f7783eaf31afdedbe3127d24307574a",
"score": "0.76330644",
"text": "def factorial(number)\n raise ArgumentError if number == nil\n return 1 if number == 0 || number == 1\n\n factorial = number\n while number > 1\n number -= 1\n factorial *= number\n end\n return factorial\nend",
"title": ""
},
{
"docid": "a5762c156ee1c47bd9f6c71042e32149",
"score": "0.76309836",
"text": "def factorial(number)\n result = (1..number).inject(1) {|total, next_number| total *= next_number }\n result\nend",
"title": ""
},
{
"docid": "b441630c110bfd567f17b2bd72fd5900",
"score": "0.7630785",
"text": "def factorial(number)\n unless number\n raise ArgumentError, \"Non-number entered.\"\n end\n if number == 1 || number == 0\n return 1\n else\n number * factorial(number - 1)\n end\nend",
"title": ""
},
{
"docid": "f3ddb75cbb6de8f1e486425d39f148b9",
"score": "0.7630573",
"text": "def factorial(number)\n raise ArgumentError unless number\n fact = 1\n number.times do |i|\n fact *= (i + 1)\n end\n return fact\nend",
"title": ""
},
{
"docid": "08eef449a96cb1d8a244e5e865dfc8f6",
"score": "0.762449",
"text": "def factorial(number)\n if number == 0 || number == 1\n \treturn 1\n elsif number > 1\n # fac = number\n x = number\n while x > 1\n x = x - 1 \n number = number * x\n end\n return number\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "66bb17df6977d678f5454de2899f4bdd",
"score": "0.76226676",
"text": "def factorial(number)\n if number <= 1\n return 1\n end\n sum = 1\n number.times do |x|\n sum = (x + 1) * sum\n end\n return sum\nend",
"title": ""
},
{
"docid": "01e8ce8e6a778e1f917d366874746d79",
"score": "0.7622245",
"text": "def factorial(number)\n if number == 0 \n return 1\n end\n holder = number\n while number > 1\n number = number-1\n holder = number * holder\n end\n return holder\nend",
"title": ""
},
{
"docid": "e9b02842c9c66ff558fa7b133130d17e",
"score": "0.76150733",
"text": "def factorial(number)\n\treturn 1 if number ==0\n num = number - 1\n result= number\n while num >= 1\n result *= num\n num -= 1\n end\n result\nend",
"title": ""
},
{
"docid": "b7d6498bc4d47dbd31da76b77d36da31",
"score": "0.7610418",
"text": "def factorial(number)\n return 1 if number == 0\n return 1 if number == 1\n raise ArgumentError if number == nil\n fact = 1\n index = 1\n while index < number\n fact *= (index + 1)\n index += 1\n end\n\n return fact\nend",
"title": ""
},
{
"docid": "676601bc9fd1197bc8a93426634b4657",
"score": "0.76059365",
"text": "def factorial(number)\n if number == 0\n return 1\n else\n value = 1\n until number == 1\n value *= number\n number -= 1\n end\n return value\n end\nend",
"title": ""
},
{
"docid": "852d4b2482a5692c572992a12311580b",
"score": "0.7602194",
"text": "def factorial(number)\n raise ArgumentError if number == nil\n return 1 if number == 0\n counter = number\n while counter > 1\n counter -= 1\n number *= counter\n end\n return number\nend",
"title": ""
},
{
"docid": "ceabc85156894af560c0dbc26da4cebb",
"score": "0.76019335",
"text": "def factorial(number)\n if number == 0\n return 1\n else\n count = number - 1\n factorial = number\n while count > 0\n factorial = factorial * count\n count -= 1\n end\n end\n return factorial\nend",
"title": ""
},
{
"docid": "b345d78f441a7a7700d00769aedb7ed6",
"score": "0.7600741",
"text": "def factorial(number)\n raise ArgumentError, \"Bad Value\" if number == nil\n\n return 1 if number == 0 || number == 1\n\n minus_one = number - 1\n until minus_one == 0\n number *= minus_one\n minus_one -= 1\n end\n return number\nend",
"title": ""
},
{
"docid": "9e7529d405411e0559ad0e82cb913d7f",
"score": "0.7596646",
"text": "def factorial(number)\n if number < 2 \n return 1\n else\n result = 1\n number.downto(2) { |num| result *= num }\n return result\n end\nend",
"title": ""
},
{
"docid": "c5d15c12ed8fb98e1535e1030a74c6e4",
"score": "0.7596328",
"text": "def factorial(number)\n if number == 0\n \treturn 1\n end\n base = number\n answer = 1\n while base > 1\n \tanswer = answer * base\n \tbase = base -1\n end\n return answer\nend",
"title": ""
},
{
"docid": "832deca79185b6d613f351255c4d2de7",
"score": "0.75826496",
"text": "def factorial(number)\n counter = number\n sum = 1\n while (counter > 0)\n sum = sum * counter\n counter -= 1\n end\n p sum\n end",
"title": ""
},
{
"docid": "e2e1dd8a0d4cc9a4a6ae9ad8c0be0f32",
"score": "0.7570455",
"text": "def factorial(number)\n result = 1\n current_number = number\n number.times do\n result = result * current_number\n current_number = current_number - 1\n end\n result\nend",
"title": ""
},
{
"docid": "e2e1dd8a0d4cc9a4a6ae9ad8c0be0f32",
"score": "0.7570455",
"text": "def factorial(number)\n result = 1\n current_number = number\n number.times do\n result = result * current_number\n current_number = current_number - 1\n end\n result\nend",
"title": ""
},
{
"docid": "1523ec729334a11a5b41fcd66a90766d",
"score": "0.75685716",
"text": "def factorial(number)\r\n\tif number == 0\r\n\t\treturn 1\r\n\telse\r\n\t\ttotal = number\r\n\t\tnumber -= 1\r\n\t\tuntil number == 0 do\r\n\t\t\ttotal *= number\r\n\t\t\tnumber -= 1\r\n\t\tend\r\n\t\treturn total\r\n\tend\r\nend",
"title": ""
},
{
"docid": "d9dfd7460fc556c91adb97f598869fd2",
"score": "0.75645334",
"text": "def factorial(number)\n if !number\n raise ArgumentError, \"Number cannot be nil\"\n end\n\n product = number > 1 ? number : 1\n while number >= 2\n product = product *= (number - 1)\n number -= 1\n end\n return product\nend",
"title": ""
},
{
"docid": "433344c23484cb5ed65aa0e39ad672b9",
"score": "0.7558197",
"text": "def factorial(number)\n\t# Your code goes here\n\tsum = 1 # local variable\n\tif number < 0\n\t\treturn 0\n\telse\n\t\t(1..number).each do |y|\n\t\t\tsum = sum * y\n\t\tend\n\t\treturn sum\n\tend\nend",
"title": ""
},
{
"docid": "9f2291abad57dfc3782ad721ca155c25",
"score": "0.75574356",
"text": "def factorial(number)\n raise ArgumentError if number == nil\n\n i = 2\n factorial = 1\n\n until i > number\n factorial *= i\n\n i += 1\n end\n\n return factorial\nend",
"title": ""
},
{
"docid": "89a937e008752c3ed93324f770f40b79",
"score": "0.75541127",
"text": "def factorial(number)\n answer = 1\n base = 1\n while base <= number do\n \tanswer = answer * base\n \tbase += 1\n end\n return answer\nend",
"title": ""
},
{
"docid": "5967bbc6aadb7a60be7ac78afa286762",
"score": "0.75524765",
"text": "def factorial(number)\n\tproduct = 1\n\tnumber.times.with_index {|index| product *= index + 1}\n\tproduct\nend",
"title": ""
},
{
"docid": "b025bc518bd4b2ab128b1286039f5de7",
"score": "0.7550208",
"text": "def factorial(number)\n if number == 0\n \treturn 1\n else\n \tfactor = Array.new\n \tfinal = 1\n \twhile number > 0\n \t\tfactor.push(number)\n \t\tnumber -= 1\n \tend\n \tfactor.each { |i| final *= i}\n \treturn final\n end\n\nend",
"title": ""
},
{
"docid": "21cc47b42339cbda4474f1fec55e5f9b",
"score": "0.7543675",
"text": "def factorial(number)\n if number.nil?\n raise ArgumentError.new(\"Input cannot be nil\")\n end\n\n factorial = 1\n\n if number == 0\n return factorial\n end\n\n for i in 1..number\n factorial *= i\n end\n\n return factorial\nend",
"title": ""
},
{
"docid": "19c1da3c4f7adee9a12943c2c5b05bd7",
"score": "0.75404173",
"text": "def factorial(number)\n if number ==0\n return 1\n else\n result= 1\n i = number\n while i > 0\n result = result * i\n i= i - 1\n end\n return result\n end\nend",
"title": ""
},
{
"docid": "f167ac511c5bf21a705f132dd8d66869",
"score": "0.7540222",
"text": "def factorial(number)\ntotal = 1\t\n\twhile number != 0\n\t\ttotal *= number\n\t\tnumber = number -1\n\tend\n\ttotal\nend",
"title": ""
},
{
"docid": "74af452f377bdf555e42797a1664fd6c",
"score": "0.75376266",
"text": "def factorial(number)\n if number == 0\n return 1\n elsif (number < 0)\n return false\n elsif (number == 1)\n return 1\n else\n product = number\n next_number = 0\n while (number > 0)\n next_number = number - 1\n product = product * next_number\n number = number - 1\n break if number == 1\n end\n return product\n end\nend",
"title": ""
},
{
"docid": "898f353d7749697f1c0877d2c4d1f038",
"score": "0.7536808",
"text": "def factorial(number)\n n=1\n if number == 0\n return 1\n elsif number == 1\n return 1\n end\n while number > 1\n n *= number\n number -= 1\n puts n\n end\n return n\nend",
"title": ""
},
{
"docid": "079aa443e807165a3293d46b136f11ea",
"score": "0.75322366",
"text": "def factorial number\n # Your code here\n raise \"Wrong type of argument\" if !number.is_a? Numeric\n # result = number\n # (1..(number-1)).each do |item|\n # result = result * item\n # end\n # number.downto(1).reduce(:*)\n # result\n # return 1 if number == 0\n # return number * factorial(number - 1)\n number == 0 ? 1 : number * factorial(number -1)\nend",
"title": ""
},
{
"docid": "da88488bf468064b556f1df6ce5b4549",
"score": "0.75285834",
"text": "def factorial(number)\n if number == 1 then return 1\n else return number * factorial(number-1)\n end\nend",
"title": ""
},
{
"docid": "9f5f76f4b9b26a224a846e230091c5cf",
"score": "0.752826",
"text": "def factorial(number)\n raise ArgumentError, \"You must enter a number.\" if number == nil\n return 1 if number == 0 || number == 1\n result = 1\n while number > 0\n result *= number\n number -= 1\n end\n return result\nend",
"title": ""
},
{
"docid": "ac50ff77cdf0cf97df6dd553a9775fcd",
"score": "0.7525876",
"text": "def factorial(number)\n\ttotal = 1\n\t(1..number).each do |multiplier|\n\t\ttotal = total * multiplier\n\t\t\n\tend\n\tputs total.to_s\nend",
"title": ""
},
{
"docid": "e6b2797e66c957969b255e8ea96443b1",
"score": "0.75183237",
"text": "def factorial(number)\n if number == nil || number < 0\n raise ArgumentError, \"Need positive integer\"\n end\n factorial = 1\n while number >= 1\n factorial *= number\n number = number - 1\n end\n return factorial\nend",
"title": ""
},
{
"docid": "0405c497065a0295bfd51ac45bd9a4a6",
"score": "0.7515873",
"text": "def factorial(number)\r\n answer = 1\r\n i = 0\r\n if \r\n \tnumber == 0\r\n \treturn 1\r\n else\r\n\t while i < number\r\n\t \tanswer = number * answer\r\n\t \tnumber -= 1\r\n\t end\r\n end\r\n return answer\r\nend",
"title": ""
},
{
"docid": "2131cc1ddc292343fd25eeadd7acdd0b",
"score": "0.751379",
"text": "def factorial(number)\n raise ArgumentError if number.nil?\n\n i = 0\n j = number\n factorial = 1\n while i < j\n factorial *= number\n number -= 1\n i += 1\n end\n\n return factorial\nend",
"title": ""
},
{
"docid": "54f6bcc307f5e129202adc2c70df3aa6",
"score": "0.7506351",
"text": "def factorial(number)\n return 1 if number == 0\n result = 1\n while number > 0\n result = result * number\n number -= 1\n end\n return result\nend",
"title": ""
},
{
"docid": "a0db6d0ed0905d99d8dc894fee3c8686",
"score": "0.74999803",
"text": "def various_factorial(number)\n\treturn 1 if number <= 1\n\tmethod = 4\n\tresult = 1\n\tcase method\n\twhen 1\n\t\treturn number * factorial(number - 1)\n\twhen 2\n\t\t(1..number).each {|x| result *= x}\n\twhen 3\n\t\treturn (1..number).inject {|product, x| product * x}\n\twhen 4\n\t\twhile number > 1\n\t\t\tresult *= number\n\t\t\tnumber -= 1\n\t\tend\n\twhen 5\n\t\tfor x in 2..number do result *= x end\t\t\n\tend\n\treturn result\nend",
"title": ""
},
{
"docid": "5905925af5871d72d8d60b512e5f9dee",
"score": "0.74989945",
"text": "def recursive_factorial(number)\n\treturn 1 if number < 1\n\n\trecursive_factorial(number -1) * number\n\t\nend",
"title": ""
},
{
"docid": "1aa0d5f812bc2cbae75c660d7c94136f",
"score": "0.74966335",
"text": "def factorial(number)\n if number == 0\n return 1\n \n elsif number == 1\n return 1\n \n elsif\n x = number\n while x != 1\n x = (x - 1)\n number = (number * x)\n end\n return number\n end\nend",
"title": ""
},
{
"docid": "14ab82b10191c873d9aa92d728006540",
"score": "0.74916345",
"text": "def factorial(number)\n # Your code goes here\n if number == 0\n \treturn 1\n else\n \ti = number\n \tresult = 1\n \twhile i > 0\n \t\tresult = result * i\n \t\ti -= 1\n \tend\n \treturn result\n end \nend",
"title": ""
},
{
"docid": "cbfd4a87e610ff97033e1250eba75450",
"score": "0.7487883",
"text": "def factorial(number)\n if number == 0\n return 1\n else\n return number * factorial(number - 1)\n end\nend",
"title": ""
},
{
"docid": "a729047b1efd56b77e00953da211bc51",
"score": "0.74871284",
"text": "def factorial(number)\n if number == nil || number < 0\n raise ArgumentError, \"Enter a positive integer\"\n end\n \n factorial = 1\n while number > 1\n factorial *= number\n number -= 1\n end\n return factorial \nend",
"title": ""
},
{
"docid": "561ae432260d06b86cf22b665b046a63",
"score": "0.74808866",
"text": "def factorial(number)\n # Your code goes here\n if number == 0\n return 1\n elsif number == 1\n return 1\n elsif number > 1\n total = 1\n (1..number).each do |n| \n if n <= number\n total = total * n\n end\n end\n return total\n end\nend",
"title": ""
},
{
"docid": "b72b494f1040ae50cfba8cf0568e155f",
"score": "0.74755085",
"text": "def factorial(number)\n number == 0 ? 1 : number * factorial(number - 1)\nend",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "abfbf32566f895e4114bb3240f189a84",
"score": "0.0",
"text": "def set_checklist\n @checklist = Checklist.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60322535",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6012846",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.5923006",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59147197",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59147197",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5898899",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.58899754",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58778226",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863685",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58098996",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.5740018",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.5730792",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57159567",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.56995213",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.5692253",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.5668434",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5652364",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5649457",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5637111",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.56268275",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56099206",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5595526",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.55951923",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.55885196",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55564445",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55564445",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5509468",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5502921",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5466533",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.54644245",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.5448076",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.5445466",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54391384",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54171526",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54118705",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54118705",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5398984",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53935355",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53935355",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.53924096",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.53874743",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5379617",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53577393",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.53494817",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.5347875",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.5346792",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5344054",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.53416806",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53265905",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53036004",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5284624",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5283799",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5256181",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52549016",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52492326",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.52462375",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52388823",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52388823",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.52384317",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.5233074",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52307343",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.52247876",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.5221976",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.52215284",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215321",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213458",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.5209029",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5206747",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.52043396",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5203811",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5202598",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.52015066",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51961863",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51961863",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5190015",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5179595",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.5177569",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5163597",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.51522565",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.51422286",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.5142005",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.5140699",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51397085",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.5134159",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115907",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5113603",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.51112026",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51074827",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5105795",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.50995123",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.5096676",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "b2a4ff1f0080ca2a1e6e22f77f907573",
"score": "0.50926304",
"text": "def commit\n if valid?\n callback_process = setup(controller)\n controller.after_filter callback_process, :only => action_name\n controller\n else\n Innsights::ErrorMessage.log(\"#{controller_name} class has no valid method #{action_name}\")\n end\n end",
"title": ""
}
] |
b58a31c4920a7bc22f489321020003eb
|
Subtract b from a
|
[
{
"docid": "6886cea7695d0e3b8d265307c1d74c5f",
"score": "0.77949136",
"text": "def subtract(a,b)\n a-b\nend",
"title": ""
}
] |
[
{
"docid": "04d66b511db106637def1e4316188a69",
"score": "0.87715966",
"text": "def subtract(a, b); a - b end",
"title": ""
},
{
"docid": "74fa52f53fd737633ddf17a71c230a72",
"score": "0.862935",
"text": "def subtract(a,b)\n a - b\n end",
"title": ""
},
{
"docid": "4f67b29d7b461304d6d7c89fcae14b2e",
"score": "0.84120274",
"text": "def resta(a,b)\n\t\ta.-(b)\n\tend",
"title": ""
},
{
"docid": "83541e8fae00f05149073044222db9cd",
"score": "0.83939785",
"text": "def AminusB(a,b)\n\t\treturn a.to_i-b.to_i\t\n\tend",
"title": ""
},
{
"docid": "e09347b748a66ba7b8ce23e2a3823344",
"score": "0.83689004",
"text": "def subtract(a, b)\n\treturn a - b\nend",
"title": ""
},
{
"docid": "5b6e076c11024eddabca57799558b934",
"score": "0.83497614",
"text": "def subtract (a, b)\n\treturn a - b\nend",
"title": ""
},
{
"docid": "b736b8b3efd5a281db3f8af1a4999875",
"score": "0.82814837",
"text": "def subtract (a,b)\n\treturn a - b\nend",
"title": ""
},
{
"docid": "5c7c8e1d6345b358f3c2cf200e2a1b7e",
"score": "0.81179",
"text": "def set_subtract(a, b)\n a - b\n end",
"title": ""
},
{
"docid": "1b99d524f26eb997c8e5422f795d359e",
"score": "0.7906721",
"text": "def subtract(a, b)\n a - b\nend",
"title": ""
},
{
"docid": "1b99d524f26eb997c8e5422f795d359e",
"score": "0.7906721",
"text": "def subtract(a, b)\n a - b\nend",
"title": ""
},
{
"docid": "1b99d524f26eb997c8e5422f795d359e",
"score": "0.7906721",
"text": "def subtract(a, b)\n a - b\nend",
"title": ""
},
{
"docid": "1b99d524f26eb997c8e5422f795d359e",
"score": "0.7906721",
"text": "def subtract(a, b)\n a - b\nend",
"title": ""
},
{
"docid": "1b99d524f26eb997c8e5422f795d359e",
"score": "0.7906721",
"text": "def subtract(a, b)\n a - b\nend",
"title": ""
},
{
"docid": "e0d5091037e8c2c3039f320b4a5e00b4",
"score": "0.78766",
"text": "def subtract (a,b)\n a - b\nend",
"title": ""
},
{
"docid": "74587d89098508ae0914c9fbb912dbc6",
"score": "0.77537084",
"text": "def substract (a,b)\n a - b\nend",
"title": ""
},
{
"docid": "bdf0fb3a1d90bcd6ea39c4243a5ebce6",
"score": "0.7712074",
"text": "def subtract(n1, n2); n1 - n2 end",
"title": ""
},
{
"docid": "fd0dc003bd1a607d7a2cb605dee7f07d",
"score": "0.7681823",
"text": "def subtract(a, b)\n\tputs \"SUBTRACTING #{a} - #{b}\"\n\ta - b\nend",
"title": ""
},
{
"docid": "757900296f812f32878b9dd36553af80",
"score": "0.76809955",
"text": "def subtract_them(a, b)\n return a - b\nend",
"title": ""
},
{
"docid": "15dea8d91aff22acd59dff6807992967",
"score": "0.7676348",
"text": "def subtract(first, second)\n first - second\nend",
"title": ""
},
{
"docid": "27d1031c2163548b8cd8fc63ba966a72",
"score": "0.7670544",
"text": "def subtract(first,second)\n first - second\nend",
"title": ""
},
{
"docid": "2f6986a1de108182cf512a71c7a89407",
"score": "0.7617686",
"text": "def subtraction(a, b)\n\t# 'a' and 'b' are converted in to floating point from strings and subtracted\n\treturn a.to_f - b.to_f\nend",
"title": ""
},
{
"docid": "b20a1c24c0c885a69091d63d2b52d7e5",
"score": "0.76167196",
"text": "def substract(a,b)\n return a-b\nend",
"title": ""
},
{
"docid": "f7f63b3bb9c1489a3e99a946137376bf",
"score": "0.7611077",
"text": "def difference(a, b) a - b; end",
"title": ""
},
{
"docid": "2ac93444b279e1a6d1f55dc56025d386",
"score": "0.7565036",
"text": "def subtract(a, b)\n\tputs \"SUBTRACTING #{a} - #{b}\"\n\treturn a - b\nend",
"title": ""
},
{
"docid": "c6ac6e48abe2f59b72bedae970d30e45",
"score": "0.7524987",
"text": "def subtract(other)\n # Implement.\n end",
"title": ""
},
{
"docid": "d29ae1c055acecf135b4a9147fee1c9d",
"score": "0.7523085",
"text": "def minus(other); end",
"title": ""
},
{
"docid": "653845b3de3867c4dd3455bfdf720d15",
"score": "0.7516291",
"text": "def subtract(a, b) \n\t\treturn Point.new(a.x - b.x, a.y - b.y)\n\tend",
"title": ""
},
{
"docid": "ee346a1268dbd2b4c4c32acae874d463",
"score": "0.75011736",
"text": "def subtract(input_a, input_b, name: nil)\n input_a, input_b = check_data_types(input_a, input_b)\n sub(input_a, input_b, name: name)\n end",
"title": ""
},
{
"docid": "92be32f0ecfa3d2cbd017462f5c1e142",
"score": "0.74707156",
"text": "def subtract (x,y)\n\treturn x - y\nend",
"title": ""
},
{
"docid": "2b89c07014334bcc574a838d372bf8de",
"score": "0.7447788",
"text": "def -(other) difference(other) end",
"title": ""
},
{
"docid": "7b683b604e4cc6fa8df30b0b8032edad",
"score": "0.7412927",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b\nend",
"title": ""
},
{
"docid": "7b683b604e4cc6fa8df30b0b8032edad",
"score": "0.7412927",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b\nend",
"title": ""
},
{
"docid": "7b683b604e4cc6fa8df30b0b8032edad",
"score": "0.7412927",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n a - b\nend",
"title": ""
},
{
"docid": "02f420be8efde2d8a8d3a053fb0647e2",
"score": "0.7405046",
"text": "def sub(other)\n applyBinaryComponentwise(:-, other)\n end",
"title": ""
},
{
"docid": "97a9574d1a97f6f464cf31666c34e0e3",
"score": "0.74027747",
"text": "def mod_sub (a, b)\n self.mod_add a, Ecc::Point.new(b.x, -b.y)\n end",
"title": ""
},
{
"docid": "aa9b385fecba15131ac1f39e56a7491b",
"score": "0.7387115",
"text": "def subtract(x,y)\n _convert(x).subtract(y,self)\n end",
"title": ""
},
{
"docid": "ff908373932855a3d4f9c9ee866faa73",
"score": "0.7325358",
"text": "def subtract(a, b)\n\tputs \"Subtracting #{a}, - #{b}\"\n\treturn a - b\nend",
"title": ""
},
{
"docid": "0fdabc10c0779940e8b609afd9306e87",
"score": "0.7323249",
"text": "def subtract(x, y)\n x - y\nend",
"title": ""
},
{
"docid": "7fe55de12a5c086fdd3e9adae729f477",
"score": "0.7323028",
"text": "def subtract(x, y)\n\tsubtract = x - y \n\treturn subtract\nend",
"title": ""
},
{
"docid": "3ca709253c12f7ddd39140aa40d92315",
"score": "0.73226184",
"text": "def subtract (x,y)\n\tx-y\nend",
"title": ""
},
{
"docid": "b249912cfaba770516bee9089fa39cf6",
"score": "0.7291111",
"text": "def subtract(number1, number2)\n number1 - number2\n end",
"title": ""
},
{
"docid": "253965d390d9aa16acd468621b9d7f81",
"score": "0.72883856",
"text": "def subtract!(rhs)\n subtract rhs, self\n end",
"title": ""
},
{
"docid": "253965d390d9aa16acd468621b9d7f81",
"score": "0.72883856",
"text": "def subtract!(rhs)\n subtract rhs, self\n end",
"title": ""
},
{
"docid": "56c4cedbe78c8a0b7101f2758056a7dd",
"score": "0.7266697",
"text": "def subtract( one, two )\n one - two \nend",
"title": ""
},
{
"docid": "29e98d966d773d87f869b9055140cbce",
"score": "0.72664905",
"text": "def subtract(x,y)\n x - y\nend",
"title": ""
},
{
"docid": "aa69a05572dd15f63db3b8a460674153",
"score": "0.7250079",
"text": "def minus(other)\n end",
"title": ""
},
{
"docid": "cf98c9d0b303d414ace23fadacfb527d",
"score": "0.72433573",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "cf98c9d0b303d414ace23fadacfb527d",
"score": "0.72433573",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "cf98c9d0b303d414ace23fadacfb527d",
"score": "0.72433573",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "cf98c9d0b303d414ace23fadacfb527d",
"score": "0.72433573",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "f79c0c27560b7b3c539b79f557dae92c",
"score": "0.7198232",
"text": "def subtract\n match('-')\n term # Result, b, is in eax.\n asm.pop(EBX)\n asm.neg(EAX) # Fake the subtraction. a - b == a + -b\n asm.add(EAX, EBX) # Add a(ebx) to -b(eax).\n end",
"title": ""
},
{
"docid": "684344d782ce2124eb2d2a8f7d0cb910",
"score": "0.7195885",
"text": "def subtract(n1, n2)\n\tn1 - n2\nend",
"title": ""
},
{
"docid": "abf75dfa03a203e0d938188d4f4bd5d5",
"score": "0.7189714",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "abf75dfa03a203e0d938188d4f4bd5d5",
"score": "0.7189714",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} - #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "e3a7ccd64a2602fd47f8ccdbda8431b8",
"score": "0.7185285",
"text": "def -(other, context=nil)\n _bin_op :-, :subtract, other, context\n end",
"title": ""
},
{
"docid": "45d37869b62d15800dc12597c6667328",
"score": "0.71777743",
"text": "def substract(a,b)\n @@num_of_calc += 1\n puts \"Status: Total calculations #{@@num_of_calc}\"\n result = a - b\n puts \"Answer: The substraction of #{a} from #{b} is #{result}\"\n end",
"title": ""
},
{
"docid": "ca1bbd1d154821828e9058951d95f7f2",
"score": "0.7173772",
"text": "def -(other)\n self.substract(other)\n end",
"title": ""
},
{
"docid": "038cbcbf14fb3a6fd5e754223ce49f2f",
"score": "0.716158",
"text": "def sub(a, b)\n @cycle += 2\n (b > a) ? @O.write(0xffff) : @O.write(0x0)\n a - b\n end",
"title": ""
},
{
"docid": "afcb98335dbdc4bdfb903c65e7b7961c",
"score": "0.71579975",
"text": "def subtract(num1, num2)\n\tnum1 - num2\nend",
"title": ""
},
{
"docid": "4de053a6d8a8a77357e1cabd80271a04",
"score": "0.71456254",
"text": "def sub(a,b)\n y = self.dup\n y.sub!(a,b)\n y\n end",
"title": ""
},
{
"docid": "ab9fdab9a4608bdc48fe43ef689a9f28",
"score": "0.71383727",
"text": "def subtract(a, b)\n puts \"SUBTRACTING #{a} + #{b}\"\n return a - b\nend",
"title": ""
},
{
"docid": "da8da37cff0ec6d989a5fa6a23d07e70",
"score": "0.7127099",
"text": "def subtract val1, val2\n val1 - val2\nend",
"title": ""
},
{
"docid": "4d34d7a310fde6a96d2f344b644e73b7",
"score": "0.7110521",
"text": "def resta(a, b)\n r = a - b\n return \"#{r}\"\nend",
"title": ""
},
{
"docid": "6602a496dbfb212a58029d22ce0c69bc",
"score": "0.70925343",
"text": "def subtract(n1, n2)\n n1 - n2\nend",
"title": ""
},
{
"docid": "dffc6d17b6d394714c25756a615b846b",
"score": "0.7083077",
"text": "def substract\n subtract\n end",
"title": ""
},
{
"docid": "91e6e19432ec72130b9ec02231e4831b",
"score": "0.70825684",
"text": "def array_dif(a,b)\r\n a-b end",
"title": ""
},
{
"docid": "9728d8f3df071b9e4df36386e86e4e47",
"score": "0.70777464",
"text": "def -(b)\n b = b.symdescfy\n return case b \n when Number\n __sub_number b \n when BinaryOp\n __sub_binary_op b \n when Neg \n self + b.argument\n else \n Sub.new self, b \n end\n end",
"title": ""
},
{
"docid": "d24506ba94ed78bf3a2ce7353b53faba",
"score": "0.7059401",
"text": "def subtract(n_1, n_2)\n n_1 - n_2\nend",
"title": ""
},
{
"docid": "8cb81b03855f77aaf9ec887b5cb0e7e8",
"score": "0.70552075",
"text": "def -(b)\n b = b.symdescfy\n case b\n when Neg\n b.argument - @argument\n else\n -(@argument + b)\n end\n end",
"title": ""
},
{
"docid": "e984b2eed43f2611e22eed9e6dfc7e93",
"score": "0.70540386",
"text": "def subtract(num1, num2)\n return num1 - num2\n end",
"title": ""
},
{
"docid": "ecb6b451548460c1e4f8598e2746116f",
"score": "0.704122",
"text": "def tempDifference(a,b)\n\ttemp = a - b\n\tif (temp < 0)\n\t\ttemp = temp * -1\n\tend\n\treturn temp\nend",
"title": ""
},
{
"docid": "cc669ef3455f17f84c6b017ebc322d5a",
"score": "0.702713",
"text": "def subtract (number_1, number2)\n\n\tnumber_1 - number2\n\nend",
"title": ""
},
{
"docid": "dc3ff250f32d0ce47a586c823cf310b7",
"score": "0.7021504",
"text": "def subtract(i, j)\n i - j\nend",
"title": ""
},
{
"docid": "a99c4ab83789a4c2294526570aef4913",
"score": "0.700851",
"text": "def subtract(a, b)\n\t# prints the string describing the operation\n\tputs \"SUBTRACTING #{a} - #{b}\"\n\t# returns the value of the subtraction of the arguments\n\treturn a - b\n\t# ends the function\nend",
"title": ""
},
{
"docid": "57a3800b4ebee4e7eedf800c9e27e235",
"score": "0.7001587",
"text": "def subtract(number1, number2)\n number1 - number2\nend",
"title": ""
},
{
"docid": "06c532d078b256aafda72365d6d7a7ae",
"score": "0.6993741",
"text": "def subtract(other)\n Subtraction.new(self, other)\n end",
"title": ""
},
{
"docid": "7d4753b28ff4d9283fc2062704d83ff9",
"score": "0.6993026",
"text": "def minus_operation\n puts \"minus\"\n timespan ^ (timespan & other)\n end",
"title": ""
},
{
"docid": "c483d6a8c0c6008485eb715f751019e7",
"score": "0.69823134",
"text": "def subtract(number1, number2)\n difference = number1 - number2\n return difference \n end",
"title": ""
},
{
"docid": "baf09d017b1a1ad0d7e1640d9ac08f21",
"score": "0.6978999",
"text": "def subtract(first_number, second_number)\n return first_number - second_number\nend",
"title": ""
},
{
"docid": "52fac4f5d22bac8e3e1cd8ed17760871",
"score": "0.6971895",
"text": "def subtract(num1, num2)\n num1 - num2\nend",
"title": ""
},
{
"docid": "97abfa308609183fcd98ea6457b3486e",
"score": "0.69656044",
"text": "def subtract(n1,n2)\n n1-n2\nend",
"title": ""
},
{
"docid": "cc02170b237ca1a536f437f887059bce",
"score": "0.6962418",
"text": "def subtract(num1, num2)\n return num1 - num2\nend",
"title": ""
},
{
"docid": "b79e038f9319cfb8d3cd22b031d18793",
"score": "0.69552654",
"text": "def subtract(number1,number2)\n number1-number2\nend",
"title": ""
},
{
"docid": "a3c21b84aec678bbb5c2c7941f6bddde",
"score": "0.69478977",
"text": "def subtract(num1,num2)\n return num1 - num2\nend",
"title": ""
},
{
"docid": "161c08b73a6c983bfb8dcbee502b8811",
"score": "0.69175696",
"text": "def demo(a, b)\n a = b-2\n b = a-3\nend",
"title": ""
},
{
"docid": "161c08b73a6c983bfb8dcbee502b8811",
"score": "0.69175696",
"text": "def demo(a, b)\n a = b-2\n b = a-3\nend",
"title": ""
},
{
"docid": "75d1ef5a5c100da63bc9f3d7c415ea92",
"score": "0.69096285",
"text": "def _sub # sub a b -> (result)\r\n a, b = @operands\r\n var = read_byte\r\n\r\n store var, (sint16 a) - (sint16 b)\r\n end",
"title": ""
},
{
"docid": "98cd3bcca71fa8269071aa48d3f95ba2",
"score": "0.69010484",
"text": "def restar(a, b)\r\n return a - b\r\nend",
"title": ""
},
{
"docid": "97b0c0fd3e2cdd4f6f7b233c9d8860ed",
"score": "0.6891865",
"text": "def sub(x,y)\n\tx - y\nend",
"title": ""
},
{
"docid": "54d2811e01ae637907165f4eaa74fc0e",
"score": "0.68871003",
"text": "def subtract!(to_subtract)\n element_math(to_subtract, :-)\n end",
"title": ""
},
{
"docid": "d3df70ef524b927c74b51c3ac17e9a64",
"score": "0.688665",
"text": "def subtract(first_number , second_number)\n return first_number - second_number\nend",
"title": ""
},
{
"docid": "ff659560a8f5832c089dc5207fd24dfa",
"score": "0.68818593",
"text": "def -(other)\n calculate_each(:-, other)\n end",
"title": ""
},
{
"docid": "255081268a2aa48736068441b7c8f05d",
"score": "0.6866338",
"text": "def subtract(number1, number2)\r\n substraction = number2 - number1\r\n substraction.abs #return absolute value\r\nend",
"title": ""
},
{
"docid": "c26c342d2f1b5f7f00ca31ec5009c82f",
"score": "0.6865119",
"text": "def subtract(x, y)\n return x-y\n\nend",
"title": ""
},
{
"docid": "45598c51d0d39be43e99018ecf72f757",
"score": "0.6853774",
"text": "def subtract(num_one, num_two)\n return num_one - num_two\nend",
"title": ""
},
{
"docid": "9665793e806939a701b0b60b83347928",
"score": "0.6849436",
"text": "def - other\n binary_operation :-, other\n end",
"title": ""
},
{
"docid": "c9ea785d553791792cbc7bbd79e47417",
"score": "0.6833912",
"text": "def subtraction(num1, num2)\n num1 - num2\nend",
"title": ""
},
{
"docid": "af25d75b1cc751496cc32aa42cc547a4",
"score": "0.6803481",
"text": "def subtract\n @first.gsub(@second, \"\")\n end",
"title": ""
},
{
"docid": "aca6fe38f4d7843beef301389b784735",
"score": "0.6790558",
"text": "def subtractor(num1, num2)\n num1 - num2\nend",
"title": ""
},
{
"docid": "f574521c9f05370ffdf977c7b98ef6e5",
"score": "0.67807525",
"text": "def bag_diff a, b\n t1 = table a\n t2 = table b\n t1.each{|item, count| t1[item] -= t2[item] if t2.has_key?(item)}\n detable t1\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "81c67f3dfed7e893d60529bd7124b57f",
"score": "0.0",
"text": "def album_params\n params.require(:album).permit(:user_id, :title, :access)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.74939764",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.6955084",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69205093",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.6891745",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67835",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.6742323",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.66817623",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6635011",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66280156",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66248137",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.6561888",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6489396",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.64763314",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64523757",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.63985187",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.6379674",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.636227",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.6337434",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6335199",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.63245684",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.63194174",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.6313726",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63134545",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6304745",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6299775",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.62989247",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.6294581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.6291996",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.6291996",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.62786806",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.62717277",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.62658894",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6254184",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.625358",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62506795",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.62342095",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62271494",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.62269396",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226112",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6224588",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.62000334",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.619004",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.6182373",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.61777395",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61629707",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160594",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.61548823",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.6153307",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61359197",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61332136",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.6117462",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.6113605",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61135256",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.61135256",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61102164",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.610241",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.610241",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.60958886",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.60958886",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.6085571",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.608522",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.6084166",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.60775006",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.6073921",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.6067218",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065894",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.6064601",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.6064436",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.60631806",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6061806",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.6060409",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.6056974",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.6047898",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.6047841",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.6047841",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.604599",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041073",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60329294",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6029157",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.602574",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.60209215",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.60183305",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6016583",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.6013783",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.6007249",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6005397",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005393",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005393",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.6003378",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.6001586",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000142",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000142",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.5999887",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.5998492",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5996129",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.5996129",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.5992997",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5992662",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.59919816",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59903735",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59890324",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
f9bbf8a2d96d568101ce0d7b3c1aa502
|
PUT /categorias/1 PUT /categorias/1.xml
|
[
{
"docid": "98a610c532e4af38f2b2e55095ed285a",
"score": "0.6463777",
"text": "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to(@categoria, :notice => 'Categoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "36b8ee5131991440b8496779f1092df3",
"score": "0.6417726",
"text": "def update\n @sotto_categoria = SottoCategoria.find(params[:id])\n\n respond_to do |format|\n if @sotto_categoria.update_attributes(params[:sotto_categoria])\n format.html { redirect_to(@sotto_categoria, :notice => 'Sotto categoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sotto_categoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2e90d079c05191baa15984e5d6c0faba",
"score": "0.63219",
"text": "def update\n @categorie = Categorie.find(params[:id])\n\n respond_to do |format|\n if @categorie.update_attributes(params[:categorie])\n format.html { redirect_to(@categorie, :notice => 'Categorie was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@categorie}}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "469bdbc38667dce5ae4a6a976de6d60e",
"score": "0.6200228",
"text": "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a1043537dd3e8512cdf4fb7d144d542c",
"score": "0.61865884",
"text": "def update\n @categoria = Categoria.find(params[:id])\n\n @categoria.update_attributes(params[:categoria])\n render :layout => false\n end",
"title": ""
},
{
"docid": "46fc270aa0e51229476aff37ec97aaf3",
"score": "0.6183006",
"text": "def update\n @categoria = Categoria.find(params[:id])\n\n respond_to do |format|\n if @categoria.update_attributes(params[:categoria])\n format.html { redirect_to [:admin, @categoria], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d8d84f77d276561dec27ec0a26da003d",
"score": "0.6158447",
"text": "def putCategory( category_id, language, name)\n params = Hash.new\n params['category_id'] = category_id\n params['language'] = language\n params['name'] = name\n return doCurl(\"put\",\"/category\",params)\n end",
"title": ""
},
{
"docid": "20b131322c25fa665586d598bc45b64a",
"score": "0.6155079",
"text": "def update\n @categorias = CategoriaObjeto.all.order(:nome).map { |categoria| [categoria.nome, categoria.id]}.prepend(['Selecione uma categoria', 0])\n \n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c75d43cdecf4f06d147a84c96bd6a2ee",
"score": "0.60775673",
"text": "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end",
"title": ""
},
{
"docid": "67df0d52f34e485c308257edf3c6be00",
"score": "0.6077487",
"text": "def update\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n if @categorias_tipo.update_attributes(params[:cat_tipo])\n \t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n format.html { redirect_to cat_tipos_path, notice: 'Categorias tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d042a4b8d67e19e968d8c4f929e81e33",
"score": "0.6066082",
"text": "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"title": ""
},
{
"docid": "596135dbec8a5ba30c3f8ca9f35ab7f5",
"score": "0.60466635",
"text": "def update\n @categoria_comida = CategoriaComida.find(params[:id])\n\n respond_to do |format|\n if @categoria_comida.update_attributes(params[:categoria_comida])\n format.html { redirect_to(@categoria_comida, :notice => 'Categoria comida was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categoria_comida.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7f3e15cf6f01465710d4f94afb5a143",
"score": "0.6045334",
"text": "def update\n @categorias = CategoriaObjeto.all.order(:nome).map { |categoria| [categoria.nome, categoria.id]}.prepend(['Selecione uma categoria', 0])\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { render :success, :locals => {:e => 1} }\n else\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "93353848b78b6aa8f04527de8df14ab2",
"score": "0.60432696",
"text": "def update\n respond_to do |format|\n if @categoria.update(categoria_params)\n format.html { redirect_to categorias_path, notice: @@titulo + t('msg.update') }\n format.json { render :show, status: :ok, location: @categoria }\n else\n format.html { render :edit }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7c1c8726e61eadf7dbc38cafa0241c1",
"score": "0.59626955",
"text": "def update\n @post = Post.find(params[:id])\n @categoria = Categorium.find(:all, :order => 'nombre ASC').collect {|m| [m.nombre, m.id]}\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to([@post, @categoria], :notice => 'Un nuevo post creado.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => [@post.errors, @categoria], :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b9bc532b675e5f8a45e82cb150134eb",
"score": "0.5957115",
"text": "def update\n respond_to do |format|\n if @categorium.update(categorium_params)\n format.html { redirect_to @categorium, notice: 'Categoría fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @categorium }\n else\n format.html { render :edit }\n format.json { render json: @categorium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a6f96d54d4c92b5fef9e4ae2e487d65d",
"score": "0.59481925",
"text": "def update\n @categorialivro = Categorialivro.find(params[:id])\n\n respond_to do |format|\n if @categorialivro.update_attributes(params[:categorialivro])\n format.html { redirect_to @categorialivro, :notice => 'Categorialivro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @categorialivro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8efbadf20853ae8f07589d7714e7a347",
"score": "0.591536",
"text": "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end",
"title": ""
},
{
"docid": "ad119b557882672f452c734f1263b736",
"score": "0.5880729",
"text": "def update\n @documentocategoria = Documentocategoria.find(params[:id])\n\n respond_to do |format|\n if @documentocategoria.update_attributes(params[:documentocategoria])\n format.html { redirect_to(@documentocategoria, :notice => 'Documentocategoria was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @documentocategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0da7b4dbb2f85bf81f101db6e074b79f",
"score": "0.5867605",
"text": "def update\n respond_to do |format|\n if @categoriafinaceiro.update(categoriafinaceiro_params)\n format.html { redirect_to @categoriafinaceiro, notice: 'Categoria alterada com sucesso.' }\n format.json { render :show, status: :ok, location: @categoriafinaceiro }\n else\n format.html { render :edit }\n format.json { render json: @categoriafinaceiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa4f1513109fd10cb5c555b68f7960e4",
"score": "0.5793399",
"text": "def update\n @categoria_do_recebimento = CategoriaDoRecebimento.find(params[:id])\n\n respond_to do |format|\n if @categoria_do_recebimento.update_attributes(params[:categoria_do_recebimento])\n format.html { redirect_to(@categoria_do_recebimento, :notice => 'Categoria do recebimento was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categoria_do_recebimento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e631b376ae2ccb776680432bf94b01cc",
"score": "0.57892203",
"text": "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"title": ""
},
{
"docid": "fa2d7481111b2b16a0fd0da32a4c63d9",
"score": "0.5767814",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Kategoria została zapisana poprawnie.'\n format.html { redirect_to([:admin, @category]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfc98e6c634daef18049d03ea1bd43c4",
"score": "0.57608056",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Категория изменена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f3558f9e9d19dbbd41b3df8e13bcb24",
"score": "0.57371414",
"text": "def update\n @categorie_analytique = CategorieAnalytique.find(params[:id])\n\n respond_to do |format|\n if @categorie_analytique.update_attributes(params[:categorie_analytique])\n format.html { redirect_to @categorie_analytique, notice: 'Categorie analytique was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorie_analytique.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c36c04c0090bd024392597fefed392d7",
"score": "0.5735443",
"text": "def update\n @subcategoria = Subcategoria.find(params[:id])\n\n respond_to do |format|\n if @subcategoria.update_attributes(params[:subcategoria])\n format.html { redirect_to [:admin, @subcategoria], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @subcategoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "87156e048f0feb8f8c6765e82b086bfe",
"score": "0.5735398",
"text": "def update\n respond_to do |format|\n if @categor.update(categor_params)\n format.html { redirect_to @categor, notice: 'Categor was successfully updated.' }\n format.json { render :show, status: :ok, location: @categor }\n else\n format.html { render :edit }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "97c7ec69282466c61975c71df36d19b3",
"score": "0.57248914",
"text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { render \"add_categories\"}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cfa293fcedd9d142b87e170ab49ecf0e",
"score": "0.5716997",
"text": "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end",
"title": ""
},
{
"docid": "361d46cae80e86485a9bfa1135580bac",
"score": "0.5700671",
"text": "def update\n @activo_categoria_ci = Activo::CategoriaCi.find(params[:id])\n\n respond_to do |format|\n if @activo_categoria_ci.update_attributes(params[:activo_categoria_ci])\n format.html { redirect_to edit_activo_categoria_ci_path(@activo_categoria_ci), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activo_categoria_ci.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f0386544c95adca4786a830663ccbd8",
"score": "0.56949496",
"text": "def update\n @catena = Catena.find(params[:id])\n\n respond_to do |format|\n if @catena.update_attributes(params[:catena])\n format.html { redirect_to(@catena, :notice => 'Catena was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catena.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "26a79a32d88071c9feb01632bcf72d88",
"score": "0.56577563",
"text": "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_categorias_path }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e50e79d36c27787e12e22deefa64adf3",
"score": "0.56576115",
"text": "def set_categoria\n @categoria = Categoria.find(params[:id])\n end",
"title": ""
},
{
"docid": "e50e79d36c27787e12e22deefa64adf3",
"score": "0.56576115",
"text": "def set_categoria\n @categoria = Categoria.find(params[:id])\n end",
"title": ""
},
{
"docid": "e50e79d36c27787e12e22deefa64adf3",
"score": "0.56576115",
"text": "def set_categoria\n @categoria = Categoria.find(params[:id])\n end",
"title": ""
},
{
"docid": "e50e79d36c27787e12e22deefa64adf3",
"score": "0.56576115",
"text": "def set_categoria\n @categoria = Categoria.find(params[:id])\n end",
"title": ""
},
{
"docid": "e50e79d36c27787e12e22deefa64adf3",
"score": "0.56576115",
"text": "def set_categoria\n @categoria = Categoria.find(params[:id])\n end",
"title": ""
},
{
"docid": "69f325efe87e96ea87a9c876fe15795f",
"score": "0.5654096",
"text": "def update\n respond_to do |format|\n if @mk_categoria.update(mk_categoria_params)\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully updated.' }\n format.json { render :show, status: :ok, location: @mk_categoria }\n else\n format.html { render :edit }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "345b0ca03b88b49bc81276296e23a4bb",
"score": "0.56368846",
"text": "def update\n @categoria_producto = CategoriaProducto.find(params[:id])\n\n respond_to do |format|\n if @categoria_producto.update_attributes(params[:categoria_producto])\n format.html { redirect_to @categoria_producto, notice: 'Categoria producto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categoria_producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "59ab9355e081b70eb7ce6f4b909e21ea",
"score": "0.56334627",
"text": "def update\n if @categoria.update(categoria_params)\n flash[:success] = 'Se actualizó exitosamente la Categoría.'\n redirect_to categorias_path\n else\n render 'edit'\n end\n end",
"title": ""
},
{
"docid": "11808a844ea6bee6a9efbccf1dbf4ad3",
"score": "0.5631594",
"text": "def update\n @otml_category = OtrunkExample::OtmlCategory.find(params[:id])\n\n respond_to do |format|\n if @otml_category.update_attributes(params[:otml_category])\n flash[:notice] = 'OtrunkExample::OtmlCategory was successfully updated.'\n format.html { redirect_to(@otml_category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @otml_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f0db344cf9a9a3efc67fbeeb0de37f98",
"score": "0.5618508",
"text": "def update\n respond_to do |format|\n if @proyectos_categoria.update(proyectos_categoria_params)\n format.html { redirect_to @proyectos_categoria, notice: 'Proyectos categoria was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyectos_categoria }\n else\n format.html { render :edit }\n format.json { render json: @proyectos_categoria.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e5560e9da42d91d79fa879f12198ff3a",
"score": "0.5601829",
"text": "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6656f8ba7d77b8a54bb8e0ed50d7697c",
"score": "0.5598625",
"text": "def update\n respond_to do |format|\n if @categoria_norma.update(categoria_norma_params)\n format.html { redirect_to @categoria_norma, notice: 'Categoria norma was successfully updated.' }\n format.json { render :show, status: :ok, location: @categoria_norma }\n else\n format.html { render :edit }\n format.json { render json: @categoria_norma.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9fde58b6eac06e646ee18a9d3d4fc46",
"score": "0.55902666",
"text": "def update\n @category = Category.find(params[:id])\n @title = 'Kategorie ' + @category.title + ' bearbeiten'\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4095c38a998d1235ac57f37ab6e9c647",
"score": "0.55821675",
"text": "def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3e86af181e8540b9809c84b5b7012d2",
"score": "0.55675465",
"text": "def update\n\t\tif (@category.titulo != \"Geral\")\n\t\t\trespond_to do |format|\n\t\t\t\tif @category.update(category_params)\n\t\t\t\t\tformat.html { redirect_to @category, notice: 'Categoria atualizada com sucesso.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\t\tformat.json { render json: @category.errors, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "c2c0b673628fdc28b181d18c0afd2d5b",
"score": "0.5567333",
"text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"title": ""
},
{
"docid": "53f98941564eb7e3518d27cbb479cab8",
"score": "0.5560684",
"text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Категория была успешно изменена' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "64342e33d137990e24b5fa224c350bd3",
"score": "0.55548126",
"text": "def update\n json_update(category,category_params, Category)\n end",
"title": ""
},
{
"docid": "83a1bcdb77232f83f8687b6273c57268",
"score": "0.5544612",
"text": "def update\n update! {admin_categories_path}\n end",
"title": ""
},
{
"docid": "caef06c6f57079e61e9df3c8739e154e",
"score": "0.55091345",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(@category) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "70019269a3316d58f81e8822824af602",
"score": "0.5502435",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e2610c7cd7c245a723f372610a9911dd",
"score": "0.5489175",
"text": "def update\n if @service_category.name == \"Sin Categoría\"\n redirect_to service_categories_path, notice: 'No es posible actualizar la categoría \"Sin Categoría\".'\n end\n respond_to do |format|\n if @service_category.update(service_category_params)\n format.html { redirect_to service_categories_path, notice: 'Categoría de Servicios actualizada exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a2c9d4953937beb667b776ba51db738a",
"score": "0.54805",
"text": "def update\n # respond_to do |format|\n # if @categorias_produto.update(categorias_produto_params)\n # format.html { redirect_to @categorias_produto, notice: 'Categorias produto was successfully updated.' }\n # format.json { render :show, status: :ok, location: @categorias_produto }\n # else\n # format.html { render :edit }\n # format.json { render json: @categorias_produto.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"title": ""
},
{
"docid": "30703ebdfe1fb5d648e1ed25b98bf656",
"score": "0.54773706",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:success] = 'Category was successfully updated.'\n format.html { redirect_to(admin_categories_url) }\n format.xml { head :ok }\n else\n flash[:error] = 'Category could not be updated. Please see errors below.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46d604284b623c5495163f9bfe008d27",
"score": "0.5476425",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to(@category, :notice => 'Category was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "46d604284b623c5495163f9bfe008d27",
"score": "0.5476425",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to(@category, :notice => 'Category was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a19d069909f4d3f053f7e7047a68bc89",
"score": "0.5471838",
"text": "def update\n category = Documents::Category.find(params[:id])\n category.update!(category_params)\n redirect_to categories_path\n end",
"title": ""
},
{
"docid": "b64f7642f49af5088cd474b4a1fc0229",
"score": "0.5470631",
"text": "def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end",
"title": ""
},
{
"docid": "f3dd4268c112648e14159e3870ad9c2d",
"score": "0.54692334",
"text": "def update\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n\n respond_to do |format|\n if @taxonomy_category.update_attributes(params[:taxonomy_category])\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5036487a8dc2a3b72c40a62047d7ff06",
"score": "0.54632616",
"text": "def set_categorium\n @categorium = Categoria.find(params[:id])\n end",
"title": ""
},
{
"docid": "88f0e03c56e3ebfcef85de2eb48b119f",
"score": "0.54579663",
"text": "def update\n respond_to do |format|\n if @categoriaproduto.update(categoriaproduto_params)\n format.html { redirect_to @categoriaproduto, notice: 'Categoriaproduto was successfully updated.' }\n format.json { render :show, status: :ok, location: @categoriaproduto }\n else\n format.html { render :edit }\n format.json { render json: @categoriaproduto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "829610c5c7e7bdf59bed95f4176d4964",
"score": "0.54452527",
"text": "def update\n @catalogo_catalogo = Catalogo::Catalogo.find(params[:id])\n\n @catalogo_tipo_catalogo = Catalogo::TipoCatalogo.find(@catalogo_catalogo.tipo_catalogo_id)\n\n respond_to do |format|\n if @catalogo_catalogo.update_attributes(params[:catalogo_catalogo])\n format.html { redirect_to edit_catalogo_tipo_catalogo_path(@catalogo_tipo_catalogo), notice: 'Guardado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @catalogo_catalogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "09f22f0b33e467f07e644568a62faa3c",
"score": "0.54402393",
"text": "def update\n respond_to do |format|\n if @asset_categorization.update_attributes(params[:asset_categorization])\n format.html { redirect_to @asset_categorization, notice: I18n.t('controllers.update_success', name: @asset_categorization.class.model_name.human) }\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset_categorization.errors, status: :unprocessable_entity }\n format.xml { render xml: @asset_categorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f42a8ea94a2acd35870444cf6d9c913b",
"score": "0.54394764",
"text": "def update\n respond_to do |format|\n if @categoria_producto.update(categoria_producto_params)\n format.html { redirect_to @categoria_producto, notice: 'Categoria producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @categoria_producto }\n else\n format.html { render :edit }\n format.json { render json: @categoria_producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4bc02d64eb4891647cce0d7d5503dc4",
"score": "0.543751",
"text": "def destroy\n @categoria.update(ativo: false)\n render json: @categoria\n end",
"title": ""
},
{
"docid": "a73a181d57f46c29ac4a5608c37fc6bc",
"score": "0.5429633",
"text": "def update\n if @category.update_attributes(params[:category])\n flash[:notice] = \"Категория успешно изменена\"\n else\n flash[:alert] = \"Ошибка изменения категории: #{@category.errors.full_messages}\"\n end\n respond_to do |format|\n format.html { redirect_to categories_path }\n end\n end",
"title": ""
},
{
"docid": "4339055f65eeba3f068ec0fb4dbbe82a",
"score": "0.54267037",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = '分类修改成功.'\n format.html { redirect_to(cpanel_categories_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @menu.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "119aabd37cadd5396993e00a9812a122",
"score": "0.5420701",
"text": "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to(@categoria, :notice => 'Categoria was successfully created.') }\n format.xml { render :xml => @categoria, :status => :created, :location => @categoria }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categoria.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "67aff330ff45b526f49581beb9523898",
"score": "0.54167926",
"text": "def update\n @nspirefile = Nspirefile.find(params[:id])\n @categories = get_categories\n respond_to do |format|\n if @nspirefile.update_attributes(params[:nspirefile])\n flash[:notice] = 'TI-Nspire file \"' + @nspirefile.title + '\" was successfully updated.'\n format.html { redirect_to(@nspirefile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nspirefile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0d44bb91c619d4b5aa50f6374e8acfc3",
"score": "0.5415439",
"text": "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to(@cat, :notice => 'Cat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cat.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c97ea6d9c73b3fa6dd8a3bae209ecf3c",
"score": "0.5412454",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Category was successfully updated.'\n format.html { redirect_to(admin_categories_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7f7094198250528d00572ee5c7cc180c",
"score": "0.5409328",
"text": "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "f1f0e4bfbf18fc0b2c5cb925bd18fc70",
"score": "0.5407159",
"text": "def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end",
"title": ""
},
{
"docid": "3c404f80239eff8af130d956c7d3edda",
"score": "0.54060304",
"text": "def update\n @tipo_curso = TipoCurso.find(params[:id])\n\n respond_to do |format|\n if @tipo_curso.update_attributes(params[:tipo_curso])\n flash[:notice] = 'TipoCurso actualizado correctamente.'\n format.html { redirect_to(@tipo_curso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_curso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8e0aa857849998562f0955171978edeb",
"score": "0.53989184",
"text": "def update\n @components_category = Components::Category.find(params[:id])\n index\n respond_to do |format|\n if @components_category.update_attributes(params[:components_category])\n format.js { \n @notice = 'Categoria actualizada correctamente' \n render 'index'\n }\n else\n format.js { \n @notice = \"Error al actualizar categoria\"\n render action: \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "d2029fc2ed0b6d5c57b93b71027e29e6",
"score": "0.539526",
"text": "def set_categoriafinaceiro\n @categoriafinaceiro = Categoriafinaceiro.find(params[:id])\n end",
"title": ""
},
{
"docid": "449cdda4653268c4848b78501cf3817e",
"score": "0.5394556",
"text": "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",
"title": ""
},
{
"docid": "76f3bf4a28a43aff7248ea1d0db449d2",
"score": "0.53935665",
"text": "def save(category = nil)\n params = { id: read_attribute(:name) }\n params[:category] = category if category\n client.post('/api/save', params)\n end",
"title": ""
},
{
"docid": "967ceb4c4ca71c69820ed74b487e1a99",
"score": "0.53876793",
"text": "def update\n respond_to do |format|\n if @categorie_service.update(categorie_service_params)\n format.html { redirect_to @categorie_service, notice: 'Categorie service was successfully updated.' }\n format.json { render :show, status: :ok, location: @categorie_service }\n else\n format.html { render :edit }\n format.json { render json: @categorie_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "07c4d2fc4c26d4bd7ef995d000faf340",
"score": "0.5380893",
"text": "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n # format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie zaktualizowano kategorię.' }\n format.json { head :no_content }\n else\n # format.html { render action: \"edit\" }\n format.html { redirect_to units_path, :flash => { :error => 'Nie udało się zaktualizować kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9dbd7160ae2e6cbf3d59a1ebff9c82f6",
"score": "0.53735095",
"text": "def update\n respond_to do |format|\n if @categoria_rec.update(categoria_rec_params)\n format.html { redirect_to @categoria_rec, notice: 'Categoria rec was successfully updated.' }\n format.json { render :show, status: :ok, location: @categoria_rec }\n else\n format.html { render :edit }\n format.json { render json: @categoria_rec.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cd08bb61ed4757539f243e0ff5ca6226",
"score": "0.53730005",
"text": "def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_subcategorias_path }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "bff1bea0fccef6326598a60ca19bfe34",
"score": "0.53702974",
"text": "def update\n @coleccionista = Coleccionista.find(params[:id])\n\n respond_to do |format|\n if @coleccionista.update_attributes(params[:coleccionista])\n \n format.html { redirect_to(@coleccionista, :notice => 'Coleccionista was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @coleccionista.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e35025ad615a4823e1c8ce036b9513dc",
"score": "0.5364041",
"text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to category_index_path, notice: 'Categorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f34362ca320db227724b78a037ebd6ed",
"score": "0.53534436",
"text": "def update\n @categorie_endroit = CategorieEndroit.find(params[:id])\n\n respond_to do |format|\n if @categorie_endroit.update_attributes(params[:categorie_endroit])\n format.html { redirect_to @categorie_endroit, notice: 'Categorie endroit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @categorie_endroit.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1962ae0719ef47997ba9ae2f5e666153",
"score": "0.5324684",
"text": "def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end",
"title": ""
},
{
"docid": "f9a7a536729eebfbc48fc36353b11bcd",
"score": "0.53093594",
"text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно обновлена\" }\n format.json { render :show, status: :ok, location: adminpanel_categories_path }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d7c255b3badb20e632941bef4978901c",
"score": "0.5295007",
"text": "def update\n @tipo_conta = TipoConta.find(params[:id])\n\n respond_to do |format|\n if @tipo_conta.update_attributes(params[:tipo_conta])\n flash[:notice] = 'TipoConta was successfully updated.'\n format.html { redirect_to(tipo_contas_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_conta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "558c891728154b22b7093bebf3dbcf58",
"score": "0.5285442",
"text": "def update\n @catalog = Catalog.find(params[:id])\n\n respond_to do |format|\n if @catalog.update_attributes(params[:catalog])\n format.html { redirect_to(@catalog, :notice => 'Минус обновлен.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalog.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b2ce30823333306bb59042ad1ed4e803",
"score": "0.52783704",
"text": "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.destroy\n\n respond_to do |format|\n format.html { redirect_to(categorias_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ef8adb1a5704a8b5a121b08109edc7a3",
"score": "0.5266374",
"text": "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0ce8bbcb51352c6192aa38167143681a",
"score": "0.52649385",
"text": "def update\n @tipo_controles = TipoControle.find(params[:id])\n\n respond_to do |format|\n if @tipo_controles.update_attributes(params[:tipo_controle])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@tipo_controles) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_controles.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "115bd4aeab0db94bfe42390c60675136",
"score": "0.525091",
"text": "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b6ef957374693bd8a3490013689c341",
"score": "0.5246869",
"text": "def update\n respond_to do |format|\n if @categoria_ing.update(categoria_ing_params)\n format.html { redirect_to @categoria_ing, notice: 'Categoria ing was successfully updated.' }\n format.json { render :show, status: :ok, location: @categoria_ing }\n else\n format.html { render :edit }\n format.json { render json: @categoria_ing.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "680ace4ad34ff19b0b4a14f18a3d79f5",
"score": "0.52465713",
"text": "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "925baff74911ed08747504a7139d3972",
"score": "0.5244891",
"text": "def update\n respond_to do |format|\n if @factura.update_attributes(params[:factura])\n format.html { redirect_to([@cliente, @factura], :notice => t('flash.actions.update.notice', :resource_name => Factura.model_name.human)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @factura.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "88fa900a8480b49aaa22b7e0d2ccdec0",
"score": "0.52435344",
"text": "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "279d82f66421b443c81bf28c6750f043",
"score": "0.5238858",
"text": "def update\n respond_to do |format|\n if @category.update_attributes(params[:category])\n if @category.cambio_algo\n format.html {redirect_to notify_changes_category_url}\n else\n format.html { redirect_to(@category, :notice => t('scaffold.notice.updated', :item=> Category.model_name.human)) }\n format.xml { head :ok }\n end\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9cd926d0e383441c658d4adfb78ccdc2",
"score": "0.5237692",
"text": "def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @catalogo }\n else\n format.html { render :edit }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
7bd23a76cf709055373a54b2c7408c1d
|
Attempts to turn the light(s) on asynchronously. This method cannot guarantee the message was received.
|
[
{
"docid": "6ddec70bee1426e3cb28d6097e55fc1e",
"score": "0.53316945",
"text": "def turn_on\n set_power(:on)\n end",
"title": ""
}
] |
[
{
"docid": "f95142043b824f1eff0c32d16a906567",
"score": "0.6348697",
"text": "def turn_on\n $logger.debug \"Turning light #{id} on\"\n put_request($uri + \"/#{$key}/lights/#{id}/state\", {:on => true})\n end",
"title": ""
},
{
"docid": "1b79f3e99a2ccceebe1babd1ce218ee1",
"score": "0.6307366",
"text": "def on()\n puts \"Turning on\"\n $client.lights.turn_on\n $client.flush\nend",
"title": ""
},
{
"docid": "330712a6de69edef5c4b6746d8739519",
"score": "0.61198014",
"text": "def execute\n @light.on\n end",
"title": ""
},
{
"docid": "dda72a109214db7d33e4b9bbb97ab576",
"score": "0.60949343",
"text": "def execute\n @light.on\n end",
"title": ""
},
{
"docid": "a0c2752838ea81a30d84efe789a61b83",
"score": "0.60693896",
"text": "def turnLightsOn\n @lightsOn = true\n end",
"title": ""
},
{
"docid": "383fb6dc4551957db1c00385bdb7d1bb",
"score": "0.59300894",
"text": "def on_turn(&block)\n @on_turn = block\n end",
"title": ""
},
{
"docid": "671a908c98af7f394f3ae7f3ee0bb490",
"score": "0.59014374",
"text": "def execute\n @lights.on\n end",
"title": ""
},
{
"docid": "cfa2c6c75d2635c53d9f42210025268f",
"score": "0.5862305",
"text": "def run\n led.on! # this does what you think it does\n sleep(1) # sleep for 1 second, kind of blunt, since it blocks everthing.\n led.off!\n sleep(1)\n end",
"title": ""
},
{
"docid": "fbcba12f6556ade13f3a0d3fa110c8fa",
"score": "0.58208275",
"text": "def leds_on\n send_request(FUNCTION_LEDS_ON, [], '', 0, '')\n end",
"title": ""
},
{
"docid": "f7caf5cc4be0d91c40585707e32436f7",
"score": "0.5721143",
"text": "def lightsOn\n @turn_lights_on_off=true\n end",
"title": ""
},
{
"docid": "94a2f87a27c47adbb445f7b72247d7b3",
"score": "0.57124573",
"text": "def run_light_sequence(duration)\n @light.set_state( { :on => true })\n @sched.in duration do\n @light.set_state( { :on => false })\n end\n @sched.in duration do\n request_pass_update\n end\n end",
"title": ""
},
{
"docid": "8ab4e3443ce6b125473fecc83bd5af8b",
"score": "0.56803906",
"text": "def light_leds( leds, color )\n \n if leds == :all\n leds_to_light = @leds.keys\n elsif leds.kind_of? Range\n leds_to_light = leds.to_a\n else\n leds_to_light = ( leds.kind_of?( Array ) ? leds : [ leds ] )\n end\n \n if leds_to_light.max > @leds.keys.max\n add_message( \"Error: Led '#{leds_to_light.max}' does not correspond to an actual led.\" )\n return false\n end\n \n case color\n when :off\n leds_to_light.each{ |l| @leds[l] = 0 }\n when :green\n leds_to_light.each{ |l| @leds[l] = 2 ** l }\n when :orange\n leds_to_light.each{ |l| @leds[l] = 2 ** l * 16 + 2 ** l }\n when :red\n leds_to_light.each{ |l| @leds[l] = 2 ** l * 16 }\n else\n add_message( \"Error: Unknown color '#{color}'\" )\n return false\n end\n \n command = Command.new( \"output #{ @leds.values.sum }\" )\n response = send_command( command )\n \n if response.successful?\n add_message( \"Leds #{leds_to_light} were correctly lit\" )\n return true\n else\n add_message( \"Leds #{leds_to_light} were NOT correctly lit (#{response.message})\" )\n return false\n end\n \n end",
"title": ""
},
{
"docid": "fa64a72ff51af114cd1ba30f1ede08a1",
"score": "0.5627939",
"text": "def light(led)\n led.on\n end",
"title": ""
},
{
"docid": "0cce5f63c7ddd13d1e93b733d431bd98",
"score": "0.5542665",
"text": "def sync\n @leds.each_with_index {|_, index| sync_single index}\n end",
"title": ""
},
{
"docid": "44c75e8572a1446317ccea1fed644dd7",
"score": "0.5441583",
"text": "def alarm\n lights.extinguish\n sleep 0.25\n lights.yellow.on\n sleep 0.25\n lights.yellow.off\n sleep 0.25\n end",
"title": ""
},
{
"docid": "6f1d068695e911b3ec6f634272fe5258",
"score": "0.5417927",
"text": "def light_switch\n if (@lights == \"On\")\n @lights = \"Off\"\n else @lights = \"On\"\n end\n end",
"title": ""
},
{
"docid": "623ccb183447732040c219f84d4c8f08",
"score": "0.5361679",
"text": "def wait_until_enabled\n @initiate_future.get\n end",
"title": ""
},
{
"docid": "19c31f6185674886f9c28dd5a4e19648",
"score": "0.53571564",
"text": "def turn_on\n\t\tputs \"model, light on\"\n\tend",
"title": ""
},
{
"docid": "1ba90cd6ddf9cc70e4b71f1dac3dcd81",
"score": "0.53483444",
"text": "def lights_on= light_status\n @lights = light_status\n end",
"title": ""
},
{
"docid": "ad60902d29f188a7ff5fcc58ab070b0e",
"score": "0.528981",
"text": "def are_leds_on\n send_request(FUNCTION_ARE_LEDS_ON, [], '', 1, '?')\n end",
"title": ""
},
{
"docid": "f3a5c0757580df6e83b133e0b9b6ddee",
"score": "0.5288888",
"text": "def lightsOn?\n @turn_lights_on_off\n end",
"title": ""
},
{
"docid": "df777446ad6c6db1cea1d53cd4a98005",
"score": "0.5286955",
"text": "def backlight_on\n send_request(FUNCTION_BACKLIGHT_ON, [], '', 0, '')\n end",
"title": ""
},
{
"docid": "7142e53f3426f56e13958cfbabc4dba4",
"score": "0.52861977",
"text": "def run_async\n # Handle heartbeats\n @heartbeat_interval = 1\n @heartbeat_active = false\n @heartbeat_thread = Thread.new do\n Thread.current[:discordrb_name] = 'heartbeat'\n loop do\n sleep @heartbeat_interval\n send_heartbeat if @heartbeat_active\n end\n end\n\n @ws_thread = Thread.new do\n Thread.current[:discordrb_name] = 'websocket'\n\n # Initialize falloff so we wait for more time before reconnecting each time\n @falloff = 1.0\n\n loop do\n websocket_connect\n debug(\"Disconnected! Attempting to reconnect in #{@falloff} seconds.\")\n sleep @falloff\n @token = login\n\n # Calculate new falloff\n @falloff *= 1.5\n @falloff = 115 + (rand * 10) if @falloff > 1 # Cap the falloff at 120 seconds and then add some random jitter\n end\n end\n\n debug('WS thread created! Now waiting for confirmation that everything worked')\n @ws_success = false\n sleep(0.5) until @ws_success\n debug('Confirmation received! Exiting run.')\n end",
"title": ""
},
{
"docid": "83b25b4a3ea4217ab0d1ea28e754d13c",
"score": "0.5267529",
"text": "def turn_on\n @sensor.turn_on(@building, self)\n @appliance.turn_on(@building)\n @on = true\n end",
"title": ""
},
{
"docid": "b40680a3fa21c92ab6007d35f4a9faa5",
"score": "0.5262231",
"text": "def turn_on!; end",
"title": ""
},
{
"docid": "f27e6d3df6145acd2857cd6d157ab74a",
"score": "0.5232656",
"text": "def led\n @message = 'Someone activated a led!'\n\n Pusher['myscreen-input'].trigger('led-activated', @message)\n end",
"title": ""
},
{
"docid": "a3956d3976592580ea15aad164f2017f",
"score": "0.52248144",
"text": "def turn_on\n all.map(&:on)\n end",
"title": ""
},
{
"docid": "149810bfd6d2548c6b68fe30903351ae",
"score": "0.51833194",
"text": "def on\n @level = 100\n puts \"Light is on\"\n end",
"title": ""
},
{
"docid": "149810bfd6d2548c6b68fe30903351ae",
"score": "0.51833194",
"text": "def on\n @level = 100\n puts \"Light is on\"\n end",
"title": ""
},
{
"docid": "149810bfd6d2548c6b68fe30903351ae",
"score": "0.51833194",
"text": "def on\n @level = 100\n puts \"Light is on\"\n end",
"title": ""
},
{
"docid": "7afff2095dc668bc5b70c65e0e6c7017",
"score": "0.5174722",
"text": "def internal_await\n end",
"title": ""
},
{
"docid": "9cadea7364b5cc1d7ce5f90cefbeb1f5",
"score": "0.5160045",
"text": "def cycle!\n traffic_lights.each { |light| \n puts light\n puts light.red \n light.change }\n end",
"title": ""
},
{
"docid": "740d9fe2a59a6fa15a677409fd0094dd",
"score": "0.5133786",
"text": "def flash_lights!\n tesla.flash_lights!(self)\n end",
"title": ""
},
{
"docid": "49ed7d5dd3956153aa1e999d7c4027d5",
"score": "0.5131891",
"text": "def ensure_on\n outlet = []\n @status.each_with_index do |o,i|\n if o == @power_off \n outlet << i + 1\n end\n end\n if outlet.length > 0 #We have relays to alter the state of\n on(outlet)\n end\n end",
"title": ""
},
{
"docid": "d715b24edef48dfd723826711b6eb01c",
"score": "0.51217014",
"text": "def on(light)\n write(light, on: true)\n end",
"title": ""
},
{
"docid": "55ccae294164f033a03f3324a07d2ecd",
"score": "0.5113248",
"text": "def light_fire\n return unless fire_ready? # returns unless the fire is ready to be lit\n state.fire = :roaring # fire is lit, set to roaring\n state.fire_progress = 0 # the fire progress returns to 0, since the fire has been lit\n if state.fire != state.previous_fire\n set_story_line \"the fire is #{state.fire}.\" # the story line is set using string interpolation\n state.previous_fire = state.fire\n end\n end",
"title": ""
},
{
"docid": "0ceafca30f72cfc1f5814ba7ccdf65bc",
"score": "0.5101638",
"text": "def lights\n poll_state unless @state\n @state['lights']\n end",
"title": ""
},
{
"docid": "3cab5bbd13ba12be4e42990ecdfedc44",
"score": "0.5095192",
"text": "def turn(light, on_or_off)\n target = \"1\" if on_or_off.downcase == \"on\" \n target = \"0\" if on_or_off.downcase == \"off\"\n perform_action(light, \"SetTarget\", \"newTargetValue\", target) \n end",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "be83dd9e3d1da17107ffe17698f257cf",
"score": "0.50778127",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "7a078119419cdc7999f2a05d5776fb93",
"score": "0.5059644",
"text": "def toggle_lights\n @lights_on = @lights_on == false\n end",
"title": ""
},
{
"docid": "d1f5aa6385f8b48022777a5df31584c2",
"score": "0.5057565",
"text": "def async_start\n ensure_thread\n end",
"title": ""
},
{
"docid": "89625b132116a9c24295f53f7294ff24",
"score": "0.50490737",
"text": "def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end",
"title": ""
},
{
"docid": "89625b132116a9c24295f53f7294ff24",
"score": "0.50490737",
"text": "def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end",
"title": ""
},
{
"docid": "7f9d3677658350a5a21a90875b523cbd",
"score": "0.5045834",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\non_lights(lights)\nend",
"title": ""
},
{
"docid": "178093e3a7e1be01eb83babc9031a7cd",
"score": "0.5041062",
"text": "def switch_on(light_id)\n return unless @stack\n return if light_id < 0\n\n light = @stack[light_id]\n if light\n light.on = true\n $pokemon_party.nuri_yuri_dynamic_light[light_id][:on] = true\n end\n end",
"title": ""
},
{
"docid": "09eae29f487efe627cd42d32d2d67e9b",
"score": "0.50363696",
"text": "def lights_on?\n if @lights == true\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "09eae29f487efe627cd42d32d2d67e9b",
"score": "0.50363696",
"text": "def lights_on?\n if @lights == true\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "27ed3dd24e4d0f7355f50bde1e6721d2",
"score": "0.50353694",
"text": "def run\n # pre-set light color to avoid green at low brightness\n @lights.set_color(\"brightness:#{start_brightness} kelvin:#{start_temperature}\", duration: 0, power_on: false)\n @lights.set_color(\"brightness:#{end_brightness}\", duration: half_sunrise_time)\n sleep(half_sunrise_time)\n @lights.set_color(\"kelvin:#{end_temperature}\", duration: half_sunrise_time)\n end",
"title": ""
},
{
"docid": "3ac4dadc80c117a1e1ad35cf45c7afb3",
"score": "0.50280774",
"text": "def toggle_lights\n if @lights == false\n @lights = true\n elsif @lights == true\n @lights = false\n end\n end",
"title": ""
},
{
"docid": "df5b89d2c7aee70d61dfc2068e4ec729",
"score": "0.49909547",
"text": "def sirenate!\n 2.times do\n SIREN_RELAY.off\n sleep 0.5\n SIREN_RELAY.on\n sleep 0.25\n end\nend",
"title": ""
},
{
"docid": "d371d3ba50e05f3d01348a100ab49eff",
"score": "0.4978062",
"text": "def lights_on\n @lights_on\n end",
"title": ""
},
{
"docid": "b5130ee8c4578b5e8aa21298d9f405f2",
"score": "0.49760354",
"text": "def turnLightsOff\n @lightsOn = false\n end",
"title": ""
},
{
"docid": "a0e5000797599724e3f4d2156e6b1ad1",
"score": "0.49753386",
"text": "def turn_off\n $logger.debug \"Turning light #{id} off\"\n put_request($uri + \"/#{$key}/lights/#{id}/state\", {:on => false})\n end",
"title": ""
},
{
"docid": "8fdaf7fcf2621a28d06c1dc28dd6e1a6",
"score": "0.49715236",
"text": "def sunset (client, tag, h, s, b, kelvin, duration)\t\t\t\t\t\t# passes in client object, tag (or room), hue, saturation, brightness, kelvin \n\n\tlights = client.lights.with_tag(tag)\t\t\t\t\t\t\t# Array of lights in the room\n\ton = false\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If any light is on in the room, does not proceed. This stops the lights dimming to 1% in the room if you already have them turned on\n\t\tlights.each do |l|\t\t\t\t\t\t\t\t\t\t\t# Iterates through each light in the array. \n\t\t\tif l.on?()\t\t\t\t\t\t\t\t\t\t\t\t# If a light is on, print out that it is on and then break out of the loop as there is no need to verify other lights. Your taste may differ to mine... you have the code.\n\t\t\t\tputs \"\\nLight #{l.label} is on.\"\t\t\t\t\t\n\t\t\t\ton = true\t\t\t\t\t\t\t\t\t\t\t# Set on to be true. Later this is used to not modify the light settings for a room that already has at least one light on.\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tputs \"\\nLight #{l.label} is off.\"\t\t\t\t\t# If light is off, print it's off\n\t\t\tend\n\t\tend\n\t\tif on == false\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# If no lights are on in the room\n\t\t\tlights.set_color(LIFX::Color.hsl(0, 0, 0.01), duration: 0.1)\t\t# set the colour to 1% white before turning on\n\t\t\tsleep 1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# wait 1 second. This gives the light time to set the colour above.\n\t\t\tlights.turn_on\t\t\t\t\t\t\t\t\t\t\t\t\t\t# turn the lights in the room on.\n\t\t\toff = false\t#check lights actually turned on.\n\t\t\tlights.each do |l|\n\t\t\t\twhile l.off?(refresh: true)\n\t\t\t\t\tputs \"\\nLight #{l.label} is still off. Retrying...\"\n\t\t\t\t\tl.turn_on\n\t\t\t\t\tsleep(0.5)\n\t\t\t\tend\n\t\t\tend\n\t\t\tlights.set_color(LIFX::Color.hsbk(h, s, b, kelvin), duration: duration)\t# slowly turn the light on to set hue, saturation, brightness and kelvin over 'duration' seconds\n\t\t\tprint(\"Colour has changed\\n\")\t\t\t\t\t\t\t\t\t\t\n\t\t\tprint(\"------------------------------------------------------\\n\")\n\t\tend\n\tclient.flush\n\t\t\t\t\nend",
"title": ""
},
{
"docid": "e5860822af649fc880f5f6633ab893b3",
"score": "0.49584448",
"text": "def set_light\n light = Light.new(\"Living Room\")\n light_on = LightOnCommand.new(light)\n light_off = LightOffCommand.new(light)\n @rc.set_command(0, light_on, light_off)\n end",
"title": ""
},
{
"docid": "9c8126633f3f28d43372dc8c00b9e612",
"score": "0.49530658",
"text": "def user_led\n packet = Request::GetRGB.new\n queue_packet packet\n return sync_response packet.seq\n end",
"title": ""
},
{
"docid": "178b27f67b675ac86e248ea8e1a9efee",
"score": "0.49422234",
"text": "def await; end",
"title": ""
},
{
"docid": "4fd45051096ab0cfca1c1a32ad1c640c",
"score": "0.4934344",
"text": "def user_led\n packet = Request::GetRGB.new(@seq)\n queue_packet packet\n return sync_response packet.seq\n end",
"title": ""
},
{
"docid": "c0d86322e12dff50dd9f9d6850fe8787",
"score": "0.49305728",
"text": "def lights_on(gpio, pins)\n\n pins.each do |p|\n gpio.write p, 1\n end\n\nend",
"title": ""
},
{
"docid": "0ca353126db73dce5ec24121f4acafef",
"score": "0.49196896",
"text": "def awaiting\n\n end",
"title": ""
},
{
"docid": "3582959b4b140e6dba2850a79745b733",
"score": "0.4915125",
"text": "def update_random\n colours = [\"\\#red\", \"\\#green\", \"\\#blue\"]\n tags = colours.shuffle[0..Random.rand(colours.size)]\n\n update_lights_via_serial_port(tags)\n sleep 0.1\n update_lights_via_serial_port([])\n sleep 0.1\n update_lights_via_serial_port(tags)\n\n tags\nend",
"title": ""
},
{
"docid": "7d36f1c10a6668b8a0a0662d175f7bfd",
"score": "0.49041674",
"text": "def turn_on\n $logger.debug \"Turning scene #{id} on\"\n put_request($uri + \"/#{$key}/groups/#{group.id}/scenes/#{id}/recall\", \"\")\n end",
"title": ""
},
{
"docid": "b9db9519f8d163952570aae8858ecc45",
"score": "0.4895388",
"text": "def wait_message\n loop do\n message = Message.new(gets)\n trigger_message(message)\n send(\"trigger_#{message.type}\", message)\n end\n end",
"title": ""
},
{
"docid": "bfaf545c68bcd541ed56af566cd5d62f",
"score": "0.48863766",
"text": "def send_pony_async(message, params = {})\n letter.set_async_flag!\n send_pony(message, params)\n end",
"title": ""
},
{
"docid": "b2e988516577566cb0c6895a75ca056e",
"score": "0.48787427",
"text": "def on_map_init\n $pokemon_party.nuri_yuri_dynamic_light ||= [] # Safe init the stack\n light_info_stack = $pokemon_party.nuri_yuri_dynamic_light.clone\n unless light_info_stack.empty?\n @delay = proc do\n start\n light_info_stack.each do |light_info|\n id = add(*light_info[:params], type: light_info[:type])\n switch_off(id) unless light_info[:on]\n end\n end\n Scheduler.add_message(:on_transition, Scene_Map, 'NuriYuri::DynamicLight', 100, self, :update)\n end\n end",
"title": ""
},
{
"docid": "bbad06f4679d23684735ec4ebc012f77",
"score": "0.48731133",
"text": "def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n binding.pry\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_lights(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"title": ""
},
{
"docid": "733969234d2907d9d0cfb939bbddef49",
"score": "0.48649243",
"text": "def on\n response = put('state', on: true)\n set_power_from_response!(response)\n response_successful?(response)\n end",
"title": ""
},
{
"docid": "c4e6322c5df95058a3d864d8679483e6",
"score": "0.4860651",
"text": "def declare_victory(color)\n loop do\n change_light(color)\n sleep(0.5)\n change_light(WHITE)\n sleep(0.5)\n end\nend",
"title": ""
},
{
"docid": "d32e2385def0a5e7a17f3ab25f0542ff",
"score": "0.48553795",
"text": "def lightsOff\n @turn_lights_on_off=false\n end",
"title": ""
},
{
"docid": "da87a5a05e3e380f722947c44e3bab4e",
"score": "0.48110652",
"text": "def send_light(r, g, b)\n #puts \"sending #{r}, #{g}, #{b}\"\n m = OSC::Message.new('/light/color/set', 'fff', r, g, b)\n @osc.send(m, 0, @host, @port)\n end",
"title": ""
},
{
"docid": "ca675d623f5251a80fed9cbcd6caedff",
"score": "0.480206",
"text": "def sync\n @ws_thread.join\n end",
"title": ""
},
{
"docid": "1dc7c75ad9072dfafd6b038ce3e69b4f",
"score": "0.48004752",
"text": "def wait_until_open_confirmed\n connection.loop { !remote_id }\n end",
"title": ""
},
{
"docid": "afb9ef7d072faa05a5c05718a3f54a2b",
"score": "0.4791366",
"text": "def turn\n know_the_word\n obtain_guess\n add_guess\n update_gameboard\n game_status\n end",
"title": ""
},
{
"docid": "9b2a988bfd0a10bc8ddf33e67404682b",
"score": "0.47910133",
"text": "def lights_on?\n @lights\n end",
"title": ""
},
{
"docid": "7b95902509a6d4ec693338a9400b3d03",
"score": "0.47814682",
"text": "def lock\n unless @locked\n @prelock_direction = @direction\n turn_toward_player\n @locked = true\n end\n end",
"title": ""
},
{
"docid": "3a207638eb3005bc9de32137dde1f377",
"score": "0.4760581",
"text": "def start_filming\n if actor.ready?\n actor.act\n actor.fall_off_ladder\n actor.light_on_fire\n actor.act \n end\n end",
"title": ""
},
{
"docid": "4dd195d3328d4c182d3e203e5724840f",
"score": "0.47543797",
"text": "def wait\n @pieceManager.wait\n end",
"title": ""
},
{
"docid": "fcbb054151d4226d5825271d44927824",
"score": "0.47539833",
"text": "def test_light\n @rc.on_button_was_pushed(0)\n @rc.off_button_was_pushed(0)\n p @rc\n @rc.undo_button_was_pushed\n @rc.off_button_was_pushed(0)\n @rc.on_button_was_pushed(0)\n p @rc\n @rc.undo_button_was_pushed\n assert_equal \\\n \"Light is on\\n\" \\\n \"Light is off\\n\" \\\n \"\\n------ Remote Control -------\\n\" \\\n \"[slot 0] LightOnCommand LightOffCommand\\n\" \\\n \"[slot 1] CeilingFanMediumCommand CeilingFanOffCommand\\n\"\\\n \"[slot 2] CeilingFanHighCommand CeilingFanOffCommand\\n\" \\\n \"[slot 3] NoCommand NoCommand\\n\" \\\n \"[slot 4] NoCommand NoCommand\\n\" \\\n \"[slot 5] NoCommand NoCommand\\n\" \\\n \"[slot 6] NoCommand NoCommand\\n\" \\\n \"[undo] LightOffCommand\\n\\n\" \\\n \"Light is on\\n\" \\\n \"Light is off\\n\" \\\n \"Light is on\\n\" \\\n \"\\n------ Remote Control -------\\n\" \\\n \"[slot 0] LightOnCommand LightOffCommand\\n\" \\\n \"[slot 1] CeilingFanMediumCommand CeilingFanOffCommand\\n\"\\\n \"[slot 2] CeilingFanHighCommand CeilingFanOffCommand\\n\" \\\n \"[slot 3] NoCommand NoCommand\\n\" \\\n \"[slot 4] NoCommand NoCommand\\n\" \\\n \"[slot 5] NoCommand NoCommand\\n\" \\\n \"[slot 6] NoCommand NoCommand\\n\" \\\n \"[undo] LightOnCommand\\n\\n\" \\\n \"Light is off\\n\", @out.string\n end",
"title": ""
},
{
"docid": "169909c9106ecaa6c0d97df9dba5072f",
"score": "0.47510436",
"text": "def ready\n end_turn([@name])\n end",
"title": ""
},
{
"docid": "31bf8e01b590a7ac286c0899a1be09cb",
"score": "0.47442082",
"text": "def on_led_change( &block )\n @led_handler = block\n end",
"title": ""
},
{
"docid": "611ca9ce13f438ef670c9d33467ae59f",
"score": "0.47401455",
"text": "def lock\n return if @locked\n # Store the old direction\n @prelock_direction = @direction\n # Make it look to the player\n turn_toward_player\n # Store the state\n @locked = true\n end",
"title": ""
},
{
"docid": "cecae932425eea01eb8f67b5912041b8",
"score": "0.47335064",
"text": "def blink_lights(gpio, pins, repeat = 1, speed = 0.05)\n\n state = 0\n (1..repeat*2).each do\n\n # Loop through each of the pins we're using\n pins.each do |p|\n gpio.write p, 1 - state\n end\n\n state = 1 - state\n\n sleep speed\n\n end\n\n lights_off(gpio, pins)\n\nend",
"title": ""
},
{
"docid": "a8fc9a01c85180c1f38e19c7b7e36d5e",
"score": "0.47324452",
"text": "def turn!\n unless turnable?\n raise AufAktienException, \"#{inspect} turned without possibility.\"\n end\n @turned = !@turned\n end",
"title": ""
},
{
"docid": "411cc59b0d71dff11284489aa23384f2",
"score": "0.47319022",
"text": "def turn_on(activity:)\n do_request post_request(\"/api/services/remote/turn_on\", {\n entity_id: @entity_id,\n activity: activity\n })\n end",
"title": ""
},
{
"docid": "f8fb396bb82b5039c0d8def6c11a99bc",
"score": "0.47314903",
"text": "def transit_to_sleeping\n sleep 1\n end",
"title": ""
},
{
"docid": "30367cb9e6ac50c933bbbd8a544188fc",
"score": "0.47189483",
"text": "def lights_on?\n @lights_on\n end",
"title": ""
},
{
"docid": "ad57c9362cffcc6622a95af217d706d7",
"score": "0.47163704",
"text": "def perform\n begin\n color = (\"%02x%02x%02x\" % [interaction.red, interaction.green, interaction.blue]).upcase\n\n if device_response = device.glow(color)\n self.response = device_response.to_json\n self.status = \"success\"\n else\n self.status = \"error\"\n end\n rescue Exception => e\n self.error = e.message\n self.status = \"error\"\n end\n\n save\n end",
"title": ""
},
{
"docid": "3ff5f0b1450e9c70173541734e94c7e9",
"score": "0.47072598",
"text": "def turn\n puts \"round end\"\n sleep 2 #/wacht 2 sec en dan print het weer uit\nend",
"title": ""
},
{
"docid": "a364ccfa5bd9dd742ade27d73dc57fd7",
"score": "0.47069833",
"text": "def sync_all_data\n return if self.disabled?\n self.channel.class.get_all_room_type_mapping(self.property).each do |rtcm|\n rtcm.delay.sync_all_data\n end\n end",
"title": ""
},
{
"docid": "22d0b7a80fe6983ea825f076c81adf38",
"score": "0.47004378",
"text": "def run_lights(gpio, pins, repeat = 1, speed = 0.05)\n\n pin_index = 0\n # This will run 'repeat' times number of pins so that we get\n # 'repeat' complete sequences\n (1..repeat * pins.length).each do\n\n # Loop through each of the pins we're using\n pins.each do |p|\n\n if pins[pin_index] == p\n gpio.write p, 1\n else\n gpio.write p, 0\n end\n\n end # pins.each\n\n if pin_index == pins.length - 1\n pin_index = 0\n else\n pin_index += 1\n end\n\n sleep speed\n\n end\n\n lights_off(gpio, pins)\n\nend",
"title": ""
},
{
"docid": "4b64ae61f540832512aa6f25a9f04a43",
"score": "0.46998072",
"text": "def wait_for_callback\n @turnstile.wait unless @paused\n end",
"title": ""
},
{
"docid": "4b64ae61f540832512aa6f25a9f04a43",
"score": "0.46998072",
"text": "def wait_for_callback\n @turnstile.wait unless @paused\n end",
"title": ""
},
{
"docid": "6911bebc19f19ca1900b40f1b254049a",
"score": "0.46987998",
"text": "def async_relay(message)\n request = Message::Relay.new(Thread.mailbox, message)\n send_message request, :relay\n end",
"title": ""
},
{
"docid": "f3de3184c7d4e3ad897a13aea4d361ba",
"score": "0.4692234",
"text": "def notify_awaiting_instructions\n say('Awaiting instructions...')\n end",
"title": ""
}
] |
700fdd30236e0256bcc11cdc9fb58f1f
|
def send_msg_to_room(r, m, p=nil)
|
[
{
"docid": "76cb46569283764f5bda42abf103e1d5",
"score": "0.8609593",
"text": "def send_room_msg\n r = params[:r]\n m = params[:m]\n u = params[:u]\n MsgUtil.send_room_msg(u, r, m)\n success()\n end",
"title": ""
}
] |
[
{
"docid": "f6cb48b532977d88ba72d2353112f6c5",
"score": "0.6840528",
"text": "def send_message(msg); end",
"title": ""
},
{
"docid": "5825c62f1f47e1df0216b24891bc1d0d",
"score": "0.6674925",
"text": "def sendM(message)\n\t\t@conexion.puts(message)\t\n\tend",
"title": ""
},
{
"docid": "1b41aaa95a5e66902925337410b8ba31",
"score": "0.6547182",
"text": "def send_message(message); end",
"title": ""
},
{
"docid": "1b41aaa95a5e66902925337410b8ba31",
"score": "0.6547182",
"text": "def send_message(message); end",
"title": ""
},
{
"docid": "f8c3aa15cafe7d9ddb8b59cc8592b471",
"score": "0.65448564",
"text": "def broadcast_to(room, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: room, text: msg })\n\t\t\tm.save!\n\t\t\troom.broadcast(m)\n\t\tend",
"title": ""
},
{
"docid": "623ed861ab73cb3fd7c9041024a13360",
"score": "0.65170497",
"text": "def send_message_to_room(company, room_id, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/messages/v3/' + company + '/rooms/' + room_id + '/stories', params\n end",
"title": ""
},
{
"docid": "15dd0465e839f88855b6916b7c4d037f",
"score": "0.63962644",
"text": "def privmsg(t, m)\n @socket << \"PRIVMSG #{t} :#{m}\"\n end",
"title": ""
},
{
"docid": "cf30e2c0f4c20a555eb22d73176cf0bf",
"score": "0.63650024",
"text": "def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end",
"title": ""
},
{
"docid": "eb1dd6ceecc67c9c7f0936561d493777",
"score": "0.62947834",
"text": "def set_room_message\n @room_message = RoomMessage.find_by(id: params[:id])\n end",
"title": ""
},
{
"docid": "2c05a246643e25e845d7a45f9c879ea1",
"score": "0.62873214",
"text": "def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts the message without a job. BUT: that is only the message.\n # We want do more :)\n # ActionCable.server.broadcast(\"chat_rooms_channel\", message: data[\"message\"])\n end",
"title": ""
},
{
"docid": "a9ac16cf45ffa225178740c8820db0dc",
"score": "0.62676615",
"text": "def remote_chat(sender, room, msg)\n add_msg \"<#{room || 'unknown'}> #{sender}: #{msg}\"\n end",
"title": ""
},
{
"docid": "039be2a66e010af960df1b1a779dbad4",
"score": "0.62557477",
"text": "def set_message\n @message = RoomMessage.find(param[:id])\n end",
"title": ""
},
{
"docid": "4d1f007fb7972ad2e0cfdac969d54297",
"score": "0.6240052",
"text": "def event_incoming_broadcast(peer, room, msg)\nend",
"title": ""
},
{
"docid": "bec2ce543dc5f3379b3f4c3ec01e48f8",
"score": "0.6226189",
"text": "def reply(message, to = nil)\n if to == :room\n reply_to.reply(message, nil)\n else\n reply_to.reply(message, to || private_sender)\n end\n end",
"title": ""
},
{
"docid": "c0c97aa63efae6aee23123e59d7a9b66",
"score": "0.6196158",
"text": "def local_motd(body)\n room_name = @var[:room]\n room_hash = MD5::digest(room_name)[0,8]\n room_hash = EMPTY_ROOM if room_name == 'chat'\n _server_control('motd', room_hash + body)\nend",
"title": ""
},
{
"docid": "bef72aabedc1843f81bc7523489f5c4c",
"score": "0.6144822",
"text": "def message(to, message)\n send_raw_line(\"PRIVMSG \"+to.to_s+\" :\"+message.chomp)\n end",
"title": ""
},
{
"docid": "160b82cbb4cf935510ad08b6a0cc9dc3",
"score": "0.6131828",
"text": "def on_message(m)\n end",
"title": ""
},
{
"docid": "fe8c3b2280d1b7049cd09eb9b9ff510c",
"score": "0.61281",
"text": "def send(message)\n message\n end",
"title": ""
},
{
"docid": "36bd66b7083d85519ff75c2e1b72b047",
"score": "0.612428",
"text": "def sendChatMessage(a_to, a_text)\n\t\tp 'JabberClient.sendChatMessage'\n\tend",
"title": ""
},
{
"docid": "eb42cd296fdc5950008f5b87660cb6f8",
"score": "0.6102449",
"text": "def chat_message\n @room=current_user.room\n\n @chat_message=ChatMessage.create! content: params[:message],owner_id: current_user.id\n chat_message=render_to_string partial: \"chat_message/chat_message\"\n\n publish_async(\"presence-room_#{@room.id}\", \"chat_message\", {\n message: chat_message\n })\n\n render json: {\n message: chat_message\n }\n end",
"title": ""
},
{
"docid": "6d6d092d34dd3741fe9fed91812ca0bf",
"score": "0.6102143",
"text": "def reply_message(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/reply\"), :body_params => params)\n end",
"title": ""
},
{
"docid": "2ded1ebbb0f3a5117b99bf06d9ffd818",
"score": "0.6048289",
"text": "def send_to(other_player, msg)\n\t\t\tm = GreyGoo::Message.new({ from: self, to: other_player, text: msg })\n\t\t\tm.save!\n\t\t\tother_player.send_message(m)\n\t\tend",
"title": ""
},
{
"docid": "7060b93159661a07134d0da144a60368",
"score": "0.60387564",
"text": "def publish_message(args)\n room_id = args.shift\n if room_id.nil? or room_id.empty?\n puts \"Please enter room id\"\n exit(0)\n end\n\n message = (args.shift || \"\").dup\n target_topic = \"worker/rooms/#{room_id}\"\n payload = {name: 'Tarou', message: message}.to_json\n client.publish(target_topic, payload)\n end",
"title": ""
},
{
"docid": "b7413f035b5b4899ac0779da88000ea4",
"score": "0.6033293",
"text": "def room_speak(room, message_body, options = {})\n actb_room_messages.create!({room: room, body: message_body}.merge(options))\n end",
"title": ""
},
{
"docid": "bc5d9c2174479bafd4fbcb8d5a88b72d",
"score": "0.6023626",
"text": "def send_message(msg)\n send_data({:type => :message, :body => msg})\n end",
"title": ""
},
{
"docid": "58e47204e4cd883b36b265ffe88a5c44",
"score": "0.6021897",
"text": "def respond(m, cl, msg)\n m2 = Message.new(m.from, msg)\n m2.type = m.type\n cl.send(m2)\nend",
"title": ""
},
{
"docid": "acb9cf1b398785dfcf4b7a8f567a397f",
"score": "0.60154",
"text": "def send_message_to_rooms(company, params = {})\n $LOG.i \"running \" + __method__.to_s\n @client.post '/messages/v3/' + company + '/stories/batch', params\n end",
"title": ""
},
{
"docid": "e1fed03d663cd09e321fd16d4f8db9ca",
"score": "0.6015361",
"text": "def send_message(text)\n end",
"title": ""
},
{
"docid": "3bcdcfc046e0ede564638464007cedfc",
"score": "0.6008097",
"text": "def send_msg(msg)\n s = ''\n case msg\n when Const::MSG_PAUSE\n s = \"#{Const::MSG_PAUSE}\"\n when Const::MSG_GAME_OVER\n s = \"#{Const::MSG_GAME_OVER}\"\n when Const::MSG_BOARD\n s = \"#{Const::MSG_BOARD}:#{@game.get_board_s}\"\n when Const::MSG_GARBAGE\n s = \"#{Const::MSG_GARBAGE}:#{@game.rows_cleared}\"\n end\n begin\n @socket.sendmsg_nonblock(s)\n rescue\n # problem s pripojenim -- game over\n @socket.close\n @window.state = MenuState.new(@window)\n end\n end",
"title": ""
},
{
"docid": "c2a1e76be398e95fc0145b6ac6050727",
"score": "0.6003379",
"text": "def create\n @room_message = RoomMessage.create user: current_user,\n room: @room,\n watsonmsg: false,\n message: params.dig(:room_message, :message),\n params: @room.params\n\n RoomChannel.broadcast_to @room, @room_message\n \n #check if user is currently reviewing a movie or taking quiz. If they are, send message to sentiment analysis and update rating\n if @room.lastIntent == \"already_seen\" then\n \tputs \"\\n\\n\\n The message you just sent was a review: \" + @room_message.message.to_s + \"\\n\\n\\n\" #debugging\n \t#send @room_message to sentiment analysis\n \t#set rating for movie\n \trate_movie\n\t \n\t #clear lastIntent\n\t @room.lastIntent = \"\"\n\t @room.save\n #check if user is answering quiz question\n\t elsif @room.lastIntent == \"start_quiz\" then\n\t take_quiz\n\t \n\t #clear lastIntent\n\t @room.lastIntent = \"\"\n\t @room.save\n\t #otherwise, get response from watson \n else\n\t \tget_response\n\t end\n end",
"title": ""
},
{
"docid": "413fb6b913bcca4d47fc02c5adfc66ca",
"score": "0.600313",
"text": "def notify(msg)\n @room_queue.push(msg)\n end",
"title": ""
},
{
"docid": "675df21474437bacc2c74b53a6ba56f4",
"score": "0.6002044",
"text": "def send_msg(conn,args)\n p = @app.get_client(conn) #pega objeto Player da lista de clientes\n unless p.nil?\n @app.broadcast(Message.new('chat','txt',\n {'author' => CGI::escapeHTML(p.to_s), 'msg' => CGI::escapeHTML(args['msg'])}\n )) #envia a mensagem para todos os clientes\n end\n end",
"title": ""
},
{
"docid": "99eddda796370b277172abd21a5f62a0",
"score": "0.60010237",
"text": "def play_prog(room_name,msg)\n begin\n @client\n @muc\n\n server = \"jabber.example.com\"\n zid = rand(9999)\n\n @client = Client.new(\"#{server}/#{zid}\")\n# Jabber::debug = true\n @client.connect\n puts @client.supports_anonymous?\n @client.auth_anonymous_sasl\n\n\n @muc = MUC::SimpleMUCClient.new(@client)\n puts \"#{room_name}@conference.#{server}/#{zid}\"\n @muc.join(Jabber::JID.new(\"#{room_name}@conference.#{server}/#{zid}\"))\n\n## tell the tv about the thing\n\n @muc.send(Jabber::Message.new(\"#{room_name}@conference.#{server}/#{zid}\",msg))\n @client.close()\n rescue Exception=>e\n puts e\n puts e.backtrace\n end\n end",
"title": ""
},
{
"docid": "94374bf4dd0722d51b1ba3a78d745195",
"score": "0.59865284",
"text": "def write_message\n\t\t# sender will be the current user\n\t\t@user = current_user\n\t\t@message = Message.new\n\t\t@message.sender = current_user\n\t\t@unread_messages = Message.find(:all, :conditions => {:receiver_id => current_user.id, :unread => true})\n\t\t# if reciever has been specified, automatically use his/her name in the \"To:\" box\n\t\tif params[:receiver]\n\t\t\t@message.receiver = User.find_by_login(params[:receiver])\n\t\tend\n end",
"title": ""
},
{
"docid": "8454fb6243515fed820886f0ded16ba1",
"score": "0.59846187",
"text": "def send(m)\n\t\t#nick = m.message[/^[[A-z0-9]|[-_]]+/]\n\t\tnick = m.message[/^.[^ :]+/]\n\t\tbot.logger.debug \"Nick: #{nick}\"\n\t\tuser = @users[nick]\n\t\tif Mailbox.exists? nick\n\t\t if user.is_afk?\n\t\t\t\t#user.mailbox.temp_mailbox.each { |msg| user.mailbox.send_to_inbox msg }\n\t\t\t\t#user.mailbox.empty_temp_mailbox\n\t\t\t\tuser.mailbox.send_to_inbox m\n\t\t\t\tm.reply \"-.-\"\n\t\t else\n\t\t\t # User hasn't be inactive long enough, so put this msg into the temp queue\n\t\t\t\tuser.mailbox.send_to_temp m\n\t\t end\n\t end\n end",
"title": ""
},
{
"docid": "a3b5baae632dc19eec3aa593d2de860b",
"score": "0.5982678",
"text": "def send_notification(params)\n room_id = self.room_id || params.delete(:room_id)\n raise ArgumentError.new(\"room_id required\") unless room_id\n call_api(:method => :post, :uri => @api_base.merge(\"room/#{room_id}/notification\"), :body_params => params)\n end",
"title": ""
},
{
"docid": "85a3f2dbd34cfa7a81a820af6103433d",
"score": "0.59766185",
"text": "def growl(room, m)\n case m['type']\n when 'system:enter'\n type = GROWL_MESSAGE_TYPES[:join]\n when 'system:leave'\n type = GROWL_MESSAGE_TYPES[:leave]\n when 'system:nickname_change'\n type = GROWL_MESSAGE_TYPES[:nickname]\n else\n type = GROWL_MESSAGE_TYPES[:message]\n message = \"#{m['nickname']}: #{m['text']}\"\n end\n\n @growl.notify(type, room, message || m['text'])\n end",
"title": ""
},
{
"docid": "6b5d4313fe971b9555095484fcfcfbbe",
"score": "0.59493554",
"text": "def watrcoolr\n @room = Room.find(params[:id])\n @user_id = current_user.id.to_i\n @messages = Message.where(room_id: @room.id)\n @text_message = Message.new\n end",
"title": ""
},
{
"docid": "279ba385deced2da523ea817a627ef4f",
"score": "0.5923006",
"text": "def messaging\n end",
"title": ""
},
{
"docid": "746729ce08aeab7139dc4d94df6c0602",
"score": "0.5919603",
"text": "def write(msg)\n\t\t\t\t# object should implement send_data\n\t\t\t\traise \"Abstract method called\"\n\t\t\tend",
"title": ""
},
{
"docid": "03151edb3fcf19779715af6b9b9eb33a",
"score": "0.5914913",
"text": "def sendmsg(type, where, message, chan=nil, ring=0,plain=nil)\n #if !plain\n # p = PirateTranslator.new\n # message = p.translate(message)\n # debug \"Piratized message: #{message}\"\n #end\n super(type,where,message,chan,ring)\n end",
"title": ""
},
{
"docid": "30b1e2a2df1181af296065fac78e5da3",
"score": "0.5913443",
"text": "def message(msg)\n\t\t@messager.message(msg)\n\tend",
"title": ""
},
{
"docid": "b1e046c4fe070e5d0418b681988e2f18",
"score": "0.59089535",
"text": "def send_message(msg, from = nil)\n msg = \"#{msg} (@#{from})\" unless from.nil?\n @auth_required ? @after_auth.push({:m => msg}) : send_data({:m => msg})\n end",
"title": ""
},
{
"docid": "7992e0f25b9a102ca29fbc1d5bae8b06",
"score": "0.5896785",
"text": "def send_el_msg(pid, msg)\n buffer = $b.clone\n buffer[:type] = \"ELECTION\"\n buffer[:msg] = msg\n\n # najdu dalsi aktivni proces\n succ = next_pid(pid)\n while($processes[succ][:active] != true)\n succ = next_pid(succ)\n end\n\n $processes[succ][:buffer] = buffer\nend",
"title": ""
},
{
"docid": "f5bba44505398c3bd7b363df897936f9",
"score": "0.5894928",
"text": "def send_msg(data, connection)\n # TODO\n end",
"title": ""
},
{
"docid": "64e84463065cafa08b723377857e2de0",
"score": "0.58898365",
"text": "def send(msg=\"\")\n\t\tif @connected\n\t\t\t@sock.write \"\\1#{msg}\\r\\n\" # leading \\1 for terse reply\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ea59bd58450e6aa81a4df0e7f38fe73a",
"score": "0.58893734",
"text": "def rubicante_message\n #@mSocket.puts \"PRIVMSG #{@mChannel} : I respect men like you. Men with...courage. \" + \n #\" But you are a slave to your emotions, and so will never know true strength.\" + \n #\" Such is the curse of men.\"\n @mSocket.puts \"Long ago in a distant land, I, Aku, the shape-shifting Master of Darkness, unleashed an unspeakable evil...\"\n end",
"title": ""
},
{
"docid": "85f60a2d274d575ac11c75113e5d4b2e",
"score": "0.58885026",
"text": "def rx_message(data)\n\t\t# Get the current user from connection.rb and then create the Message\n\t\tcurrent_user.messages.create(content: data['message'], to_id: nil) # Nil means the global chatroom\n\tend",
"title": ""
},
{
"docid": "50637ca8c9768df21f29f938402c2592",
"score": "0.58663905",
"text": "def send(message)\n ## empty\n end",
"title": ""
},
{
"docid": "22a909f89a9a3cddaf7dd4c15337db0d",
"score": "0.5849143",
"text": "def message( message )\n\tend",
"title": ""
},
{
"docid": "0ebd19bef41b43ed65642d668b1c88dd",
"score": "0.584795",
"text": "def send_im(fromnick,tonick,message)\n return ret_fail('can not send IM to yourself') if fromnick==tonick #self-explainatory\n\n usr = User.first(:nickname=>fromnick) #find own record\n return ret_fail('own user not found') if usr == nil #must be error\n\n tousr = User.first(:nickname=>tonick)\n return ret_fail('addressee not found') if tousr == nil #must be error\n\n contact = usr.contacts.first(:userid => tousr.id)\n return ret_fail('not in list') if contact == nil #that nick is not in contact list!\n\n\n if message['type'] != 'auth_request' #Normal message\n return ret_fail('not authorized') if contact.authgiven != 't' #failure: not authorized!\n else #its an authorization request!\n return ret_fail('already given') if contact.authgiven == 't' #already has permission!\n return ret_fail('already sent') if contact.authgiven == 'p' #already sent a request!\n\n #ok... its a valid auth request... so set state to 'p' and update db record\n contact.authgiven = 'p' #awaiting to be answered\n contact.save\n end\n\n #append message to addressees message queue, update database record\n msg = tousr.messages.new\n msg.data = JSON.generate({'from'=>fromnick, 'message'=>message})\n msg.save\n\n return ret_success\nend",
"title": ""
},
{
"docid": "9db54947e5a88dc57e6d991bec9a1c27",
"score": "0.5846507",
"text": "def send_msg(data, connection)\n # TODO\n end",
"title": ""
},
{
"docid": "4ded68c3d47c330ab545b7cc142bd6ee",
"score": "0.58198655",
"text": "def send_message (*params)\n send_line Message.new(*params)\n end",
"title": ""
},
{
"docid": "edd8d437dacda094abd69c3c0cf27c9e",
"score": "0.5808178",
"text": "def msg_params\n params.require(:msg).permit(:room, :sender, :body)\n end",
"title": ""
},
{
"docid": "a0f96f2353b75beb3c1f8b48af397d64",
"score": "0.5808117",
"text": "def msg(message)\n end",
"title": ""
},
{
"docid": "a7e8a23fdc14c117782ac0a6250c762c",
"score": "0.5796562",
"text": "def privmsg(m, *args)\n args.each { |msg| m.user.safe_send(msg) }\n end",
"title": ""
},
{
"docid": "48ef32456d9c35a2f05858bed3af70cf",
"score": "0.57851267",
"text": "def sendmsg(s)\n @sock.send \"#{s}\\n\", 0 \n end",
"title": ""
},
{
"docid": "0794e20758f208f6df5e705241575f47",
"score": "0.57824063",
"text": "def push msg\n end",
"title": ""
},
{
"docid": "80237e228d98687cace20c105f5a36cb",
"score": "0.5781258",
"text": "def publish_to_socket(params)\n message = params.to_json\n data = \"~m~#{message.length}~m~#{message}\"\n @socket.send(data)\n end",
"title": ""
},
{
"docid": "3722db9b43e8d632f987f13b26c60d2f",
"score": "0.57802343",
"text": "def server_motd(client, body)\n room = body[0,8]\n msg = body[8..-1]\n return nil unless @rooms[room]\n return nil unless @rooms[room].include?(client.name)\n if msg.empty?\n select_send(MSG_SERVER, EMPTY_ROOM, @keyring.default.iv,\n server_encrypt(\"motd #{room}#{@motd[room] || ''}\")\n ) { |x| x == client }\n else\n @motd[room] = \"#{client.name}#{msg}\"\n select_send(MSG_SERVER, EMPTY_ROOM, @keyring.default.iv,\n server_encrypt(\"motd #{room}#{@motd[room]}\")\n ) { |x| @rooms[room].include?(x.name) }\n end\nend",
"title": ""
},
{
"docid": "8dfea1b2094c34e540716675bb3d02d0",
"score": "0.5779357",
"text": "def send room = nil, device = nil, state = 'on', debug = false\n debug and ( p self.time 'send' )\n success = false\n debug and ( p 'Executing send on device: ' + device + ' in room: ' + room + ' with ' + ( state ? 'state ' + state : 'no state' ))\n\n\n # starting to optionally move some functionality out of here\n alternativeScript = self.get_config['pywaverf']\n if alternativeScript and File.exist?( alternativeScript )\n cmd = \"#{alternativeScript} \\\"#{room}\\\" \\\"#{device}\\\" \\\"#{state}\\\" \\\"#{debug}\\\"\"\n debug and ( p cmd )\n p `#{cmd}`\n debug and ( p self.time 'done python' )\n return\n end\n\n\n rooms = self.class.get_rooms self.get_config, debug\n debug and ( p self.time 'got rooms' )\n\n unless rooms[room] and state\n debug and ( p 'Missing room (' + room.to_s + ') or state (' + state.to_s + ')' );\n STDERR.puts self.usage( room );\n else\n # support for setting state for all devices in the room (recursive)\n if device == 'all'\n debug and ( p 'Processing all devices...' )\n rooms[room]['device'].each do | device_name, code |\n debug and ( p \"Device is: \" + device_name )\n self.send room, device_name, state, debug\n sleep 1\n end\n success = true\n # process single device\n elsif device and rooms[room]['device'][device]\n state = self.class.get_state state\n command = self.command rooms[room], device, state\n debug and ( p self.time 'command is ' + command )\n data = self.raw command\n debug and ( p self.time 'response is ' + data.to_s )\n success = true\n data = self.update_state room, device, state, debug\n else\n STDERR.puts self.usage( room );\n end\n end\n success\n end",
"title": ""
},
{
"docid": "315c2642972c1adf589945fa416978d5",
"score": "0.57732743",
"text": "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end",
"title": ""
},
{
"docid": "808fe7bd84ab0d711d053a9566e642a4",
"score": "0.5767087",
"text": "def send_message( msg )\n @session.send_message msg\n self\n end",
"title": ""
},
{
"docid": "4501de333be06c7ae2a2a9014878c0f2",
"score": "0.5756551",
"text": "def send_message(jid,text)\n m = Jabber::Message.new(jid, text)\n m.set_type :chat\n @client.send m\n end",
"title": ""
},
{
"docid": "109800bafeb19d23a0f2bd0cff588189",
"score": "0.5748383",
"text": "def sendmsg(message)\n text = message.respond_to?(:sendmsg) ? message.sendmsg : message.to_s\n message = \"sendmsg\\n%s\\n\" % text\n self.respond_to?(:send_data) ? send_data(message) : message\n end",
"title": ""
},
{
"docid": "349dffb8ea7443e2444638ecf34cadc5",
"score": "0.57443905",
"text": "def sendChatAction to, act\n self.query(\"sendChatAction\", {:chat_id=>to, :action=>act})\n end",
"title": ""
},
{
"docid": "d56cccfb83d0a5414848a0fa4f366a4d",
"score": "0.57398987",
"text": "def send_message(msg)\n session.transport.send_message(msg)\n end",
"title": ""
},
{
"docid": "dc995b093d38149b96278cd8bf2f022f",
"score": "0.5733882",
"text": "def send_message(other_user, room_id, content)\n from_messages.create!(to_id: other_user.id, room_id: room_id, content: content)\n end",
"title": ""
},
{
"docid": "7a6043f93bbb8e0e0e866d66fa03ca7f",
"score": "0.573328",
"text": "def send_message(message, wparam = 0, lparam = 0)\n with_handle { User32.SendMessage(@handle, User32::EditMessage[message], wparam, lparam) }\n end",
"title": ""
},
{
"docid": "b9700a676a0f15cebd905647079c7371",
"score": "0.57309264",
"text": "def put(msg)\n socket.write(msg + \"\\n\") if socket\n end",
"title": ""
},
{
"docid": "fd6a648baee84845c02bfaacd1f2b5c6",
"score": "0.57285863",
"text": "def send( a )\n\t\tbegin\n\t @jabbermsg.body = a\n \t @jabberchatroom.send( @jabbermsg )\n \trescue Jabber::ServerDisconnected\n \t\tputs \"Server disconnected. Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \trescue Jabber::JabberError => e\n \t\tputs \"Error for #{e.error.to_s.inspect}\"\n \t\tputs \"Trying reconnect\"\n \t\t@jabberReconnect = true\n \t\t@jabberRetryMessage = a\n \tend\n\tend",
"title": ""
},
{
"docid": "ecde8107829a1f65607d1187cc1d6971",
"score": "0.5721723",
"text": "def peer_send(peer,message)\r\n\t\t\tpeer.socket.puts(message)\r\n\t\tend",
"title": ""
},
{
"docid": "e72901c3106f7d356c592bef03b6ca3d",
"score": "0.57135516",
"text": "def handle(time, send, message)\n match(message, \"(join|switch to) (.*)\") do |md|\n new_room_name = md[2]\n \n old_room_name = Robut::Connection.config.room\n \n # nasty gsub of the room name in the room name string\n full_new_room_name = old_room_name.gsub(/[\\d]+_(.*)\\@.*/) { |str| str.gsub($1, new_room_name) }\n \n Robut::Connection.config.room = full_new_room_name\n \n # Reconnect to the new channel.\n # There is a lighter-weight way to accomplish this,\n # but we don't have access to the muc accessor here.\n begin\n Robut::Connection.new.connect\n rescue => e\n $stderr.puts e\n # reply(\"I can't join that room, bro.\")\n \n # reconnect to the original room if we can't connect to the new one\n Robut::Connection.config.room = old_room_name\n Robut::Connection.new.connect\n end\n end\n end",
"title": ""
},
{
"docid": "6857cd747730bfe58f8f5c2a0217b534",
"score": "0.5712946",
"text": "def create\n message = msg_params\n @msg = Msg.new(msg_params)\n thesender = @msg.sender\n thesentdate = @msg.sent\n theservertime = DateTime.now\n unless @msg.content.empty? || @msg.sender.empty?\n ActionCable.server.broadcast 'room_channel',\n content: @msg.content,\n sender: thesender,\n servertime: theservertime\n end\n end",
"title": ""
},
{
"docid": "0f74ec3ce4b0cc51e1bf197fc776a7cf",
"score": "0.568394",
"text": "def room_message_params\n params.require(:room_message).permit(:message , :room_id)\n end",
"title": ""
},
{
"docid": "1d78b483c1f91b9ee714eaa81a0ea673",
"score": "0.56826216",
"text": "def room_message_params\n @room = Room.find(params[:room_message][:room_id])\n\n params.require(:room_message)\n .permit(:message, :room_id)\n .merge(user: current_user,\n room: @room)\n end",
"title": ""
},
{
"docid": "7e807eda699b49be0ea0e61b4dda14fb",
"score": "0.567649",
"text": "def message( *msgs )\n\t\tself.class.message( *msgs )\n\tend",
"title": ""
},
{
"docid": "90f15629d4d5203713379d24919680d3",
"score": "0.56699055",
"text": "def receive(data)\n puts(\"data.class.name = #{data.class.name}\")\n puts(\"data['room'] = #{data['room']}\")\n\n ActionCable.server.broadcast(\"chat_room-#{data['room_name']}\", data)\n end",
"title": ""
},
{
"docid": "26031c7d792f5b4305bf7a04ef456167",
"score": "0.564169",
"text": "def send_msg(data, connection)\n connection.send_msg(data)\n end",
"title": ""
},
{
"docid": "dfffcd452d58e3e3e9fa049bd362cee1",
"score": "0.5634941",
"text": "def remote_motd(sender, body)\n return nil unless sender == 'server'\n room = @connection.room_names[body[0,8]]\n username = _user_name(body[8,8])\n body[0,16] = ''\n _notice \"-- MOTD (#{username}) --\\n#{body}\", room\nend",
"title": ""
},
{
"docid": "360640d8639c968edf312f2b796c7f32",
"score": "0.5633908",
"text": "def send(msg)\n @socket.puts msg\n puts '<< ' << msg\n end",
"title": ""
},
{
"docid": "ba98f312a6c9ead2b657e688aa0aac30",
"score": "0.5628074",
"text": "def send_an_email(message, subject, to)\n message_params = {}\n message_params[:from] = 'QuikSort Bot <***@quiksort.in>'\n message_params[:to] = to\n message_params[:subject] = subject\n message_params[:text] = message\n logger.info $MG_CLIENT.send_message 'quiksort.in', message_params\nend",
"title": ""
},
{
"docid": "ba8be748d6fc42ac2630adf42f7e097d",
"score": "0.56272864",
"text": "def motd(t)\n @socket << \"MOTD #{t}\"\n end",
"title": ""
},
{
"docid": "27ab25ebc39e30a0c3ccad896360ec3e",
"score": "0.5620705",
"text": "def send_message(arg1, arg2)\n account_sid = 'AC5XXXXXXXXXXXXXXXXXXX' # place twilio sid here\n auth_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' # place twilio auth token here\n client = Twilio::REST::Client.new(account_sid, auth_token)\n \n from = '' # Your Twilio number\n to = arg1 # Your mobile phone number\n \n client.messages.create(\n from: from,\n to: to,\n body: arg2\n )\n\n end",
"title": ""
},
{
"docid": "1877944a2486ee24ceb896ac8e66ab2a",
"score": "0.56184214",
"text": "def reply(*args, &block)\n self.rooms.each do |room|\n room.reply(*args, &block)\n end\n end",
"title": ""
},
{
"docid": "2cea6d0d8e834807fe79eb69e0dff425",
"score": "0.5602631",
"text": "def speak(data)\n sender = current_user\n message = data['message']\n\n # Save message in database as historical data\n msg = Message.new\n msg.user_id = current_user.id \n msg.recipient_id = data[\"target_user\"]\n msg.content = data['message']\n puts msg\n msg.save!\n\n # Sends back the data in realtime using websockets\n ActionCable.server.broadcast \"RoomChannel\", {message: message, sender: current_user, recipient: User.find(msg.recipient_id)}\n\n end",
"title": ""
},
{
"docid": "17f66091ad44a98fbe223f51030cb8e3",
"score": "0.5599362",
"text": "def set_meeting_room_message\n @meeting_room_message = MeetingRoomMessage.find(params[:id])\n end",
"title": ""
},
{
"docid": "1a3c42da7e556627b7c33f7d34aada30",
"score": "0.55976856",
"text": "def send_message(**opts, &with_communication_do)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "2384b05fb870cad3f21214d698d39011",
"score": "0.5596009",
"text": "def send_message(data)\n @chatroom = Chatroom.find(data[\"chatroom_id\"])\n message = @chatroom.messages.create(body: data[\"body\"], user: current_user)\n MessageRelayJob.perform_later(message)\n #Rails.logger.info data\n end",
"title": ""
},
{
"docid": "06aa8f05a099afd7610b92f5ff729d74",
"score": "0.55914897",
"text": "def rco_broadcast(m)\n puts @pid.to_s+\" rco_broadcast: \"+m\n self.rb_broadcast(m)\n self.rco_deliver(@pid, m)\n end",
"title": ""
},
{
"docid": "6dd71b6fb786652bb0b9cfc12f287aac",
"score": "0.55862087",
"text": "def msg(m=\"\")\n @m ||= m\n end",
"title": ""
},
{
"docid": "075a64a10d1645910dcef90e574c6161",
"score": "0.55815065",
"text": "def message_broadcast\n\n @subject = params[:subject] ? params[:subject] : 'IMPORTANT - Please Read'\n @message = params[:message] ? params[:message] : ''\n @active_roles = Role.find_all_active\n\n end",
"title": ""
},
{
"docid": "9d99549225f8568bb50a3f940e39678d",
"score": "0.55808276",
"text": "def write text=\"\"\n\t\t@message.text = @msg = text.to_s\n\tend",
"title": ""
},
{
"docid": "d0a83ea66e1255052f6b90bdf966f1a5",
"score": "0.55802035",
"text": "def user(u, m, r)\n @socket << \"USER #{u} #{m} * :#{r}\"\n end",
"title": ""
},
{
"docid": "a1bf225b2635c046ad47082591c45f87",
"score": "0.5576052",
"text": "def send(recipients, message)\n players[:x].print(message) if recipients.include? :x\n players[:o].print(message) if recipients.include? :o\n print message if recipients.include? :term and send_output_to_terminal\n end",
"title": ""
},
{
"docid": "15a4bef775bfcff790464f8b09011a75",
"score": "0.5574989",
"text": "def privmsg(destination, s)\n sendmsg \"PRIVMSG #{destination} :#{s}\"\n end",
"title": ""
},
{
"docid": "34ce10022132088f68f7705d0941b07d",
"score": "0.55745804",
"text": "def room; end",
"title": ""
},
{
"docid": "147630aaff988bd51ae9d706fda88bc6",
"score": "0.55719876",
"text": "def send(p)\n options = {} \n\n p.each do |k,v|\n\n case k\n when :reply_path\n # Automatically request delivery receipt if reply path is set\n options[sym_to_param(:confirm_delivery)] = 'on'\n options[sym_to_param(k)] = v\n when :scheduled_for\n # Set timestamp correctly for :scheduled_for\n options[sym_to_param(k)] = v.strftime('%Y%m%d%H%M%S')\n else\n options[sym_to_param(k)] = v\n end\n\n end\n\n res = self.class.post('/submit_sm', :basic_auth => @auth, :body => JSON.dump(options))\n\n responses = []\n res['sms'].each do |r|\n responses << Dialogue::Toolkit::Sms::Response.new(r)\n end\n\n responses\n end",
"title": ""
},
{
"docid": "cb12d0faec6e4a8775004fd8644eea41",
"score": "0.55689573",
"text": "def chatroom_message(msg, cl, state)\n body = msg.body.to_s\n \n # update room status every MSGS_UNTIL_REFRESH messages\n # Use a countdown and not mod to avoid skips happenning if multiple messages come at once\n if(state[:time_until_list] <= 0)\n respond(msg, cl, \"/list\")\n state[:time_until_list] = MSGS_UNTIL_REFRESH\n else\n state[:time_until_list] -= 1\n end\n\n # redo the /list whenever anybody changes their name or joins the room\n if(/^\\'(.*)\\' is now known as \\'(.*)\\'/.match(body) ||\n /^.* has joined the channel with the alias '.*'/.match(body) )\n out(\"sending /list because of user change\")\n respond(msg, cl, \"/list\")\n return\n end\n \n # handle /list result when it comes in\n if(/^Listing members of '#{ROOM_NAME}'\\n/.match(body))\n out(\"received a room listing.\")\n listing_refresh(state, body)\n return\n end \n \n # messages starting and ending with '_' are emotes \n if body[0].chr == '_' && body[body.length - 1].chr == '_'\n chatroom_emote(msg, cl, state)\n return\n end\n\n # If someone says [word]bomb search for [word] on Google image\n # search and post the first result to the room.\n # eg: pugbomb\n if /\\w+bomb/.match(body)\n q = /(\\w+)bomb/.match(body)[1]\n uri = 'http://www.google.com/search?num=1&hl=en&safe=off&site=imghp&tbm=isch&source=hp&biw=1060&bih=669&q=' + q\n response = Net::HTTP.get_response(URI.parse(uri)) # => #<Net::HTTPOK 200 OK readbody=true>\n arr = response.body.scan(/imgurl=([^&,]+)/)\n if arr.length < 1\n respond(msg, cl, \"No results for \" + q)\n elsif\n respond(msg, cl, arr[0][0])\n end\n end\n\n # getting here means the message was a regular comment from a user\n regular_user_chatroom_message(msg, cl, state)\nend",
"title": ""
},
{
"docid": "06ba7473f69bbb9a4afa923d0af55ad7",
"score": "0.5568347",
"text": "def write(rawmsg)\r\n @connection.send(rawmsg)\r\n end",
"title": ""
}
] |
825f4c4fbc42f54a0ca70d26a89626bc
|
GET /belge_tips GET /belge_tips.json
|
[
{
"docid": "318cc6ca7f84ed14f4e32157879769a8",
"score": "0.73987865",
"text": "def index\n @belge_tips = BelgeTip.all\n end",
"title": ""
}
] |
[
{
"docid": "8d18147fd420e60550e6aec795b9bf05",
"score": "0.70829225",
"text": "def venue_tips(id, options = {})\n get(\"venues/#{id}/tips\", options).tips\n end",
"title": ""
},
{
"docid": "8bec1fa2c6835e6414ed08afd341a0ab",
"score": "0.69710064",
"text": "def index\n @kt_tips = KtTip.all\n end",
"title": ""
},
{
"docid": "513557844bce2d328a1d5883eb1d3b8e",
"score": "0.68565834",
"text": "def tips(venue_id, params={:sort => \"recent\"})\n perform_graph_request(\"venues/#{venue_id}/tips\", params)\n end",
"title": ""
},
{
"docid": "c77f0b1ffe8241187e059a59f127b4d7",
"score": "0.6852292",
"text": "def index\n @tips = Tip.all\n end",
"title": ""
},
{
"docid": "c77f0b1ffe8241187e059a59f127b4d7",
"score": "0.6852292",
"text": "def index\n @tips = Tip.all\n end",
"title": ""
},
{
"docid": "4cb43d06ce20c04efa32774c79dd4783",
"score": "0.6837146",
"text": "def get_tip\n request({ req: 'gettip'})\n end",
"title": ""
},
{
"docid": "00d55f62b13daac0b767e4656bf6d8ee",
"score": "0.67311716",
"text": "def index\n @tips = @game.tips\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tips }\n end\n end",
"title": ""
},
{
"docid": "3799e0b69ad5319b713db161da6c0b1b",
"score": "0.6710857",
"text": "def index\n @fanzo_tips = FanzoTip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fanzo_tips }\n end\n end",
"title": ""
},
{
"docid": "bc1d3d18c502db845613c55b5773bc47",
"score": "0.6656698",
"text": "def index\n @extra_tips = ExtraTip.all\n end",
"title": ""
},
{
"docid": "909cd6aed511faa28a1e05e189a0c9c1",
"score": "0.66343707",
"text": "def user_tips(user_id, options={})\n response = connection.get do |req|\n req.url \"users/#{user_id}/tips\", options\n end\n return_error_or_body(response, response.body.response.tips)\n end",
"title": ""
},
{
"docid": "c3a7a706477c8d006992ee126729aebd",
"score": "0.65995735",
"text": "def tips\n ## nb: removed .all() - check if still working; should - but never know\n recs = Tip.where( pool_id: pool_id, user_id: user_id )\n recs\n end",
"title": ""
},
{
"docid": "54ac47bab8d983bb3eb9ffd8d3454ef6",
"score": "0.6572259",
"text": "def show\n \n @tips = Tip.find(params[:id])\n \n end",
"title": ""
},
{
"docid": "9778274b37e38d4264c79e3f6d09d9fa",
"score": "0.65651685",
"text": "def suggest_tip options={}\n @tips = client.get(\"/lists/#{id}/suggesttip\", options)[\"response\"][\"tips\"]\n if @tips\n @tips.each_key do |key|\n key[\"items\"].map!{|item| Foursquared::Response::Photo.new(client, item)}\n end\n end\n @tips\n end",
"title": ""
},
{
"docid": "d3d08e2fa8193372266f8b2bd4406d0b",
"score": "0.655434",
"text": "def get_tips(token)\n resp = Faraday.get(\"https://api.foursquare.com/v2/lists/self/tips\") do |req|\n req.params['oauth_token'] = token\n req.params['v'] = '20160201'\n end\n return JSON.parse(resp.body)[\"response\"][\"list\"][\"listItems\"][\"items\"] \n end",
"title": ""
},
{
"docid": "e0b6a3fbf89f3d327761f60223becf45",
"score": "0.6551171",
"text": "def tip(id)\n get(\"tips/#{id}\").tip\n end",
"title": ""
},
{
"docid": "457d33ae2cb4dd5ad4e50acce2087750",
"score": "0.65404445",
"text": "def tip_search(params={})\n self.class.get(\"http://api.foursquare.com/v1/tips.json\", :query=>params)\n end",
"title": ""
},
{
"docid": "993a04f0c40d686be032134400a367b1",
"score": "0.6512675",
"text": "def index\n @tipps = Tipp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipps }\n end\n end",
"title": ""
},
{
"docid": "e40ec43ed00c7efbfc3b2191fbf86876",
"score": "0.6488822",
"text": "def index\n @tippers = Tipper.all\n json_response(@tippers)\n end",
"title": ""
},
{
"docid": "70a7ef4fa37d3cbeede41c6cc050e6d0",
"score": "0.64337987",
"text": "def show\n @tip = @game.tips.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip }\n end\n end",
"title": ""
},
{
"docid": "7030b46cceff8d58da442c2acbb1869a",
"score": "0.6346706",
"text": "def index\n @bet_tips = BetTip.all\n end",
"title": ""
},
{
"docid": "fa66cf8fa023400181fb0343f8110381",
"score": "0.62459856",
"text": "def index\n @admin_tips = Admin::Tip.all\n end",
"title": ""
},
{
"docid": "bfdfeddc89bf9482db395ce7c9234a37",
"score": "0.6234964",
"text": "def tip_listed(id, options = {})\n get(\"tips/#{id}/listed\", options).lists\n end",
"title": ""
},
{
"docid": "55f864d35ea46f2545934b15c1e923f8",
"score": "0.6218081",
"text": "def all_tips\n if params[:filter] == nil\n @tips = Tip.all\n else\n @tips = Tip.where(category: params[:filter])\n end\n end",
"title": ""
},
{
"docid": "f01ba82881c6e1ce7c10e879a2cf0b98",
"score": "0.6191595",
"text": "def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end",
"title": ""
},
{
"docid": "3722c31c7bc34a445517b4e983677ec0",
"score": "0.6170519",
"text": "def tips\n if request.xhr?\n render layout: false\n end\n end",
"title": ""
},
{
"docid": "dfa619a735e4d86d4a10d17fcd4dbde3",
"score": "0.6165389",
"text": "def tip\n Foursquared::Response::Tip.new(client, response[\"tip\"]) if response[\"tip\"]\n end",
"title": ""
},
{
"docid": "dfa619a735e4d86d4a10d17fcd4dbde3",
"score": "0.6165389",
"text": "def tip\n Foursquared::Response::Tip.new(client, response[\"tip\"]) if response[\"tip\"]\n end",
"title": ""
},
{
"docid": "89b1bd7a6e90c77c91e8899fd6cfc81d",
"score": "0.6160284",
"text": "def tip_likes(id)\n get(\"tips/#{id}/likes\").likes\n end",
"title": ""
},
{
"docid": "d4e2a72a37052b621f2a2e38a42f5de9",
"score": "0.61586964",
"text": "def index\n @tips = Tip.published_only\n end",
"title": ""
},
{
"docid": "2209174a18946f844535dce3b24d2df0",
"score": "0.61546975",
"text": "def index\n\t@comp = Comp.first(:order => \"id DESC\", :conditions => [ \"status = ?\", 0 ])\n\tuser = User.find(@user_id)\n\tif @comp\n\t\t@tips = Tip.where(:user_id => @user_id, :comp_id => @comp.id)\n\t\tif @tips \n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # new.html.erb\n\t\t\t\tformat.json { render json: @tip }\n\t\t\tend\n\t\tend\n\tend\n end",
"title": ""
},
{
"docid": "28ab07bddb3902fc22936855025387e9",
"score": "0.6125716",
"text": "def show_tips\n\t\tcompetition_id = params[:id]\n\t\t@data = get_competition_data(competition_id)\n\t\tuid = params[:uid]\n\t\t\n\t\t@tips = get_user_tips(competition_id, uid)\n\t\t\n\t\trender :layout=>'competition'\n\tend",
"title": ""
},
{
"docid": "b2bceee70e779d199d5f3e246b22e71d",
"score": "0.610545",
"text": "def tip_search(ll, options = {})\n get(\"tips/search\", { :ll => ll }.merge(options)).tips\n end",
"title": ""
},
{
"docid": "080d172d62b876f73a64322867d5d336",
"score": "0.6049142",
"text": "def index\n @gemtips = Gemtip.all\n end",
"title": ""
},
{
"docid": "ba77b93db3c01e28dcfcfcf79f3d1b06",
"score": "0.5960603",
"text": "def index\n @winners_tips = WinnersTip.joins(:user).order(\"users.points DESC, name ASC\").where(:key => false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners_tips }\n end\n end",
"title": ""
},
{
"docid": "85bf9a58aa5e25f945c760a3edc8cdb9",
"score": "0.59542507",
"text": "def suggest_list_tip list_id, options={}\n @tips = get(\"/lists/#{list_id}/suggesttip\", options)[\"response\"][\"tips\"]\n if @tips\n @tips.each_key do |key|\n key[\"items\"].map!{|item| Foursquared::Response::Photo.new(client, item)}\n end\n end\n @tips\n end",
"title": ""
},
{
"docid": "90e2d9f96788dc453d6543a88a512677",
"score": "0.5950243",
"text": "def index\n @preparation_tips = PreparationTip.all\n end",
"title": ""
},
{
"docid": "b32a88c86659028af618e3ba4298f445",
"score": "0.5946196",
"text": "def show\n @tip_doc = TipDoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tip_doc }\n end\n end",
"title": ""
},
{
"docid": "c2b1a3d35776208f23c323ab03054abc",
"score": "0.5919215",
"text": "def show\n @fanzo_tip = FanzoTip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fanzo_tip }\n end\n end",
"title": ""
},
{
"docid": "48e69f76644867fded042eaf17b545f8",
"score": "0.59155977",
"text": "def set_belge_tip\n @belge_tip = BelgeTip.find(params[:id])\n end",
"title": ""
},
{
"docid": "caee7840397015d1e9ee643141a055a6",
"score": "0.5897413",
"text": "def index\n @ebook = Ebook.find(params[:ebook_id])\n @everydaytips = @ebook.everydaytips.order(created_at: :desc).page(params[:page])\n #@everydaytips = Everydaytip.all.order(created_at: :desc).page(params[:page])\n end",
"title": ""
},
{
"docid": "e763f09b3a2aba103bff0aa744830b29",
"score": "0.5877222",
"text": "def tip_add(params={})\n self.class.post(\"http://api.foursquare.com/v1/addtip.json\", :body=>params)\n end",
"title": ""
},
{
"docid": "40e7f6ef5e615444f566368320ac47d0",
"score": "0.58603215",
"text": "def index\n opts = {}\n opts[:site_id] = params[:site_id].blank? ? @site.id : params[:site_id]\n opts[:jb_name] = /.*#{params[:key]}.*/ unless params[:key].blank?\n opts[:checked] = params[:checked] unless params[:checked].blank?\n @tips = Xmt::Faq::Tip.where(opts).order(id: :desc).page(params[:page])\n end",
"title": ""
},
{
"docid": "67c331d2249b47b46a34646cfb533b45",
"score": "0.5842843",
"text": "def new\n @fanzo_tip = FanzoTip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fanzo_tip }\n end\n end",
"title": ""
},
{
"docid": "b9831904ba5927d95309dc4cae28bde4",
"score": "0.5833401",
"text": "def create\n @belge_tip = BelgeTip.new(belge_tip_params)\n\n respond_to do |format|\n if @belge_tip.save\n format.html { redirect_to @belge_tip, notice: 'Belge tip was successfully created.' }\n format.json { render :show, status: :created, location: @belge_tip }\n else\n format.html { render :new }\n format.json { render json: @belge_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9a2602baa22c4242a91b07248a7db43",
"score": "0.5818026",
"text": "def new\n @tipp = Tipp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipp }\n end\n end",
"title": ""
},
{
"docid": "4e7564ca471a2200368d38e89f3f31d9",
"score": "0.5804935",
"text": "def index\n @tip_images = TipImage.all\n\n render json: @tip_images\n end",
"title": ""
},
{
"docid": "1a31b35a717480b405e81f41905b3f38",
"score": "0.5803499",
"text": "def new\n @tip_doc = TipDoc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip_doc }\n end\n end",
"title": ""
},
{
"docid": "8760fb5f1ca5932eeae2427cb519e350",
"score": "0.5792994",
"text": "def description_for_tip(tip)\n return @tips_data[tip][:description]\n end",
"title": ""
},
{
"docid": "43b14e78ca5ca2d80ccead75e35ee4b2",
"score": "0.57594454",
"text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @winners_tip }\n end\n end",
"title": ""
},
{
"docid": "2fc9a46dfc0e8ec9914ea58b932b4fe7",
"score": "0.5758234",
"text": "def get_mail_tips()\n return MicrosoftGraph::Me::GetMailTips::GetMailTipsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"title": ""
},
{
"docid": "3511397e742427c7e0e834a35d3f439e",
"score": "0.5752416",
"text": "def index\n \n \n if params[:category_id] # TO CHANGE\n @category = Category.find_by_cached_slug(params[:category_id])\n @tips = @category.tips.published.recent.page(params[:page]).per(5)\n add_breadcrumb \"Catégories\", :categories_path, :title => \"Revenir à la liste des catégories\"\n add_breadcrumb @category.name.camelize, category_path(@category)\n add_breadcrumb \"Astuces\", tips_from_category_path(@category), :title => \"Revenir à la liste des astuces\"\n else\n add_breadcrumb \"Astuces\", :tips_path, :title => \"Revenir à la liste des astuces\"\n @tips = Tip.published.recent.page(params[:page]).per(5)\n end\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tips }\n end\n end",
"title": ""
},
{
"docid": "2aea7e0477679c7016acdab0cb593e82",
"score": "0.57101864",
"text": "def number_of_tips\n return @tips_data.count\n end",
"title": ""
},
{
"docid": "1b2a5586ce5803c5da4769de22d0b05a",
"score": "0.56888366",
"text": "def show\n @tips = @concept.tips.order('created_at DESC')\n # @concept = Tip.where('concept_id = ?', 193).order('created_at desc')\n # @concept.tips = @concept.tips.group_by { |t| t.posted_at. }\n #\n #\n # @concept.tips.all\n end",
"title": ""
},
{
"docid": "b218b1842faae529877f01e53042b178",
"score": "0.5685432",
"text": "def all \n @everydaytips = Everydaytip.all.order(created_at: :desc).page(params[:page])\n end",
"title": ""
},
{
"docid": "e0af3504ff65ceff912ce86681ea0b62",
"score": "0.5677163",
"text": "def show\n render json: @tip_image\n end",
"title": ""
},
{
"docid": "dfa082d82bae6de6b30479cb7888383c",
"score": "0.5636944",
"text": "def index\n @tip_docs = TipDoc.all\n end",
"title": ""
},
{
"docid": "aa31c52770768834feccede8dcf2b638",
"score": "0.5633519",
"text": "def tipsters\n nully\n @tipsters = User.where(role: \"Tipster\").to_json(:include => :user_connections)# the include is needed for the following button\n render json: { data: @tipsters }\n end",
"title": ""
},
{
"docid": "e561931df3ca61ecccb2e5642995cb3b",
"score": "0.56330925",
"text": "def index\n @tips = policy_scope(Tip)\n end",
"title": ""
},
{
"docid": "d0e188162e82595d91574be62c11a599",
"score": "0.56263876",
"text": "def show\n @crime_tip = CrimeTip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crime_tip }\n end\n end",
"title": ""
},
{
"docid": "20b23ddfe2610faf10a4dbced2c56fd8",
"score": "0.56212664",
"text": "def load_trips_json\n self.trips = get_trips\n load_guides_json\n trips.reject! {|t| t['type'] == 'content'}\n trips.to_json\n end",
"title": ""
},
{
"docid": "c7e35fb31ba0ebe277d5d15bb0c3ec9b",
"score": "0.56145495",
"text": "def create\n @tip = @user.tips.new(tip_params)\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tip }\n else\n format.html { render action: 'new' }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e18ec1da5876fde5bebcdb72692c3a47",
"score": "0.5607105",
"text": "def index\n @search = CrimeTip.search(params[:search])\n @crime_tips = @search.paginate(:per_page => 25, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @crime_tips }\n end\n end",
"title": ""
},
{
"docid": "b44e0e89cf7670070775f270f84f3a23",
"score": "0.5595518",
"text": "def get_tip_info\n\t\t\tdata = read_command_output( 'hg', 'tip' )\n\t\t\treturn YAML.load( data )\n\t\tend",
"title": ""
},
{
"docid": "5bcd37b4c466214eb6a98819db8e1552",
"score": "0.55544573",
"text": "def index\n @trips = Trip.all\n # @trips = Trip.where(user_id: current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {\n render json: @trips.to_json(include: :markers)\n }\n end\n end",
"title": ""
},
{
"docid": "8910864d40ed8c7aec48fdbf68e7453d",
"score": "0.55425227",
"text": "def index\n @tipocargues = Tipocargue.all\n end",
"title": ""
},
{
"docid": "f1d47657cf93ab10ad4467988824e4f0",
"score": "0.5519575",
"text": "def tips_fmt tips\n if tips['count'] > 0\n list = tips['groups'].map { |grp|\n grp['items'].map { |t| tip_fmt t }.join '' \n }.join ''\n \"<p><b>Tips:</b>#{list}\"\n else\n ''\n end\nend",
"title": ""
},
{
"docid": "9786bf4b45c1fa79d5dc5c66e89f139f",
"score": "0.5508541",
"text": "def index\n @trips = Trip.all\n\n render json: @trips\n end",
"title": ""
},
{
"docid": "0864fa152ca69af2ba5d4f9eda310871",
"score": "0.55034393",
"text": "def tip_params\n params.fetch(:tip, {}).permit(:title, :link, :resource_type, :time_requirement, :other_info, :user_id)\n end",
"title": ""
},
{
"docid": "f41fe97ee5ec3226f4f52bed491b0913",
"score": "0.55007917",
"text": "def show\n @doc = Doc.find(params[:id])\n check_tip\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doc }\n end\n end",
"title": ""
},
{
"docid": "2e1cf81e303020638069f4402482b1a5",
"score": "0.5499785",
"text": "def index\n @tips = Tip.by_votes\n if @user.present? && params[:all].blank?\n @tips = @tips.where(:user_id => @user.id)\n end\n \n\n end",
"title": ""
},
{
"docid": "65fdc14f06487e19ffd6d57331b1fe02",
"score": "0.5491473",
"text": "def tips_params\n params.require(:tips_ycomentario).permit(:tip, :remitente, :nutriologo_id,\n :paciente_id)\n end",
"title": ""
},
{
"docid": "b3ac3ce7bcbf594434086caf583295da",
"score": "0.5473932",
"text": "def index\n @tip_types = TipType.all\n end",
"title": ""
},
{
"docid": "fdab183501c01d1381e30f188dbb9c80",
"score": "0.5469498",
"text": "def fill_tips\n\t\tcompetition_id = params[:competition_id]\n\t\t\n\t\tparticipants = CompetitionParticipant.where({:competition_id=>competition_id, :status=>STATUS[:ACTIVE]})\n\t\tparticipants.each do|participant|\n\t\t\tuser_id = participant.user_id\n\t\t\tCompetitionTip.fill_tips(user_id, competition_id)\n\t\tend\n\t\t\n\t\trender :text=>'Tips filled. You may close this page now.'\n\tend",
"title": ""
},
{
"docid": "05d09302be982f21a67335593750f388",
"score": "0.5463101",
"text": "def all_trips\n @trips = Trip.all\n render json: @trips\n end",
"title": ""
},
{
"docid": "44eca8882b449e987dcb40e91a536b37",
"score": "0.54552096",
"text": "def show\n\t\t@tip = Hint.find_by_id(params[:id])\n\tend",
"title": ""
},
{
"docid": "c6e42e9b56354846c5a07eaf211de59a",
"score": "0.5447246",
"text": "def index\n @hints = Hint.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hints }\n end\n end",
"title": ""
},
{
"docid": "0df10ccd91f5577ed9be3e49056d09b9",
"score": "0.5446028",
"text": "def get_trouble_spots()\n exec_get(\"#{@base_path}/api/v2/customers/trouble_spots.json?api_key=#{@api_key}\")\n end",
"title": ""
},
{
"docid": "42a9db0f3a35307aca0ee9924a96a97d",
"score": "0.5445938",
"text": "def show\n @lote = Lote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lote }\n end\n end",
"title": ""
},
{
"docid": "1193cfc638e14c9804aa64b0a46ae362",
"score": "0.544513",
"text": "def show\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tip }\n end\n end",
"title": ""
},
{
"docid": "283584c2e557580b783c505e6f2697ee",
"score": "0.5444628",
"text": "def index\n @tipees = Tipee.all\n json_response(@tipees)\n end",
"title": ""
},
{
"docid": "2da7ed7a5f6593ebe912ed4ecb4049a2",
"score": "0.544414",
"text": "def index \n\n if params[:tag]\n @tips = Tip.tagged_with(params[:tag])\n # @tips = Tip.find_with_reputation(:votes, :all, order: \"votes desc\")\n \n \n \n else\n @tips = Tip.where(params[:sort_by])\n end\n \n end",
"title": ""
},
{
"docid": "b93b40d9e679a3c36af4f5c136b4a507",
"score": "0.54426754",
"text": "def test \n @trips = current_user.trips.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"title": ""
},
{
"docid": "f8083adcac91fba28ad3b7164e6016f4",
"score": "0.54394245",
"text": "def recent_tips(quantity = 10)\n self.tips.includes(:author, :sport, :match).order('created_at desc').limit(quantity)\n end",
"title": ""
},
{
"docid": "039da080186d58e718606dcc4a953a24",
"score": "0.5434695",
"text": "def kt_tip_params\n params.require(:kt_tip).permit(:topic, :content, :written_on, :likes)\n end",
"title": ""
},
{
"docid": "2ec207ea7030cf8616deb70c1e468a79",
"score": "0.5420817",
"text": "def show\n @hot_spot = current_user.hot_spots.find(params[:id])\n @trip_idn = @hot_spot.trip_id\n @trip = current_user.trips.find(@trip_idn)\n @trip_description = current_user.trips.find(@trip_idn).description\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hot_spot }\n end\n end",
"title": ""
},
{
"docid": "8bd8efac263bdd23f4843caadf249e80",
"score": "0.5420676",
"text": "def new\n @tip = @game.tips.build\n @tip.user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tip }\n end\n end",
"title": ""
},
{
"docid": "1bb2a9099996bd7c99efc740b0f081f9",
"score": "0.5413583",
"text": "def show\n @toppick = Toppick.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @toppick }\n end\n end",
"title": ""
},
{
"docid": "818003a3df17ce846beeaf6eb8ad5c1e",
"score": "0.54067457",
"text": "def index\n @topics = Topic.order('num_votes desc, created_at desc').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"title": ""
},
{
"docid": "318f33c87efb9d04f6594255ab9207da",
"score": "0.5402176",
"text": "def create\n @kt_tip = KtTip.new(kt_tip_params)\n\n respond_to do |format|\n if @kt_tip.save\n format.html { redirect_to @kt_tip, notice: 'Kt tip was successfully created.' }\n format.json { render :show, status: :created, location: @kt_tip }\n else\n format.html { render :new }\n format.json { render json: @kt_tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb518d422e16d000ef051c45557bb5b0",
"score": "0.53969043",
"text": "def index\n @tees = Tee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tees }\n end\n end",
"title": ""
},
{
"docid": "cfa9989bc854c80171d4a5d3e672ebca",
"score": "0.53928405",
"text": "def set_kt_tip\n @kt_tip = KtTip.find(params[:id])\n end",
"title": ""
},
{
"docid": "5e33c1bd2f3c31da0202ecac7d0eb226",
"score": "0.5380904",
"text": "def test_mb_tips\n # Step 1\n id = (rand(5) + 1)\n\n params = {\n 'user_id' => @user.id\n }\n\n post \"/em/mb_tips/#{id}\", params\n assert_response(@response, :client_error)\n end",
"title": ""
},
{
"docid": "a3d93643cb5f85a0cfb0ac474b549f47",
"score": "0.5378811",
"text": "def like_tip(id, set = 1)\n post(\"tips/#{id}/like\", { :set => set }).likes\n end",
"title": ""
},
{
"docid": "5b05219a871f719e5564cf205c285c51",
"score": "0.5378503",
"text": "def index\n @tipoincidentes = Tipoincidente.all\n end",
"title": ""
},
{
"docid": "c70f21731bbb0a004c3f6b9885d73a49",
"score": "0.5374297",
"text": "def index\n json_response(current_user.topics_of_interests)\n end",
"title": ""
},
{
"docid": "e1c76db0bfc410f115d5c8bf33ea0a17",
"score": "0.53628546",
"text": "def show\n @tipos_quarto = TiposQuarto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipos_quarto }\n end\n end",
"title": ""
},
{
"docid": "9f82eae1c5fbdf93d798505b7a439a85",
"score": "0.53620666",
"text": "def tips_total\n 5\n end",
"title": ""
},
{
"docid": "23a5e60836424460e7bb2b85fc9e5000",
"score": "0.53493005",
"text": "def top5\n @ideas = Idea.top5\n\n respond_to do |format|\n format.html # top5.html.erb\n format.json { render json: @ideas }\n end\n end",
"title": ""
},
{
"docid": "dc83c79dc9ba6d7b8daa6c7d0e2f474d",
"score": "0.5349067",
"text": "def done_tip(id, options = {})\n get(\"tips/#{id}/done\", options).users\n end",
"title": ""
},
{
"docid": "2bc010b8ccda784a3ddd28a6bcdd968d",
"score": "0.5345758",
"text": "def index\n @tipocars = Tipocar.all\n end",
"title": ""
}
] |
f50f2563f8c0b9a98c28b488c5b58c59
|
Write a function that has one parameter hash It should return the first key from the hash
|
[
{
"docid": "0cb9bba48765b0992a10791f2aecb629",
"score": "0.82864594",
"text": "def get_first_key(hash)\n return \nend",
"title": ""
}
] |
[
{
"docid": "6428eecaae089b3ddffd8860e6da7270",
"score": "0.76760477",
"text": "def get_first_key(hash)\n return hash.keys[0]\nend",
"title": ""
},
{
"docid": "d8a9e2d7ad126609c3c567dc64c968d4",
"score": "0.75357157",
"text": "def first_key_from_hash(hash)\n keys=hash.keys\n return keys[0]\nend",
"title": ""
},
{
"docid": "cafadc30628f473be4903e6fbe29ba63",
"score": "0.71712273",
"text": "def first_key_name(hash_name)\n return hash_name.keys[0]\n end",
"title": ""
},
{
"docid": "5c0daf751a0b2cfb5ca6aed7d23d1290",
"score": "0.7068648",
"text": "def hash(key); end",
"title": ""
},
{
"docid": "b9990bf7495e2a3659bdad2d265f0d27",
"score": "0.70115364",
"text": "def _key(*args); args.hash; end",
"title": ""
},
{
"docid": "117257764152b949e54f41db3b374e80",
"score": "0.6956984",
"text": "def hash_key(name); end",
"title": ""
},
{
"docid": "9b20087d7b76fee4cae09329efefe987",
"score": "0.690669",
"text": "def result(hash, key)\n hash[key]\nend",
"title": ""
},
{
"docid": "bad5f61c8a356c9e30342f6daf2efe6b",
"score": "0.6673235",
"text": "def key_for(data)\n data.hash\n end",
"title": ""
},
{
"docid": "7e0a2c0f291de73b5d8673447b1dd56c",
"score": "0.663223",
"text": "def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend",
"title": ""
},
{
"docid": "34e4ff303e56a084a54b13f22b8aeed8",
"score": "0.6571182",
"text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n else\n new = name_hash.sort_by { |name, value| value }\n #puts \"a = \"\n #puts a\n #puts \"name_hash = \"\n #puts name_hash\n end\n return new.first.first\nend",
"title": ""
},
{
"docid": "ae1a628dcfbcd0df0510d0ce3bf0cde6",
"score": "0.65578914",
"text": "def hash=(_arg0); end",
"title": ""
},
{
"docid": "40a3086277bc4a4e33b6a6fd731e673a",
"score": "0.6556875",
"text": "def key_for_min_value(my_hash)\n if my_hash ==Hash.new\n nil\n else\n my_hash.min_by{|key,value| value }[0]\n end\n end",
"title": ""
},
{
"docid": "f40fdf5d2eb47240db3e8759df804313",
"score": "0.6554834",
"text": "def hashcode(key)\n hashcode_with_internal_hashes(key).first\n end",
"title": ""
},
{
"docid": "4bffaf065426db2f0c46a60453f3d59a",
"score": "0.65304285",
"text": "def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend",
"title": ""
},
{
"docid": "84675e4905962ed669619a372dec82fa",
"score": "0.649807",
"text": "def key_for_min_value(name_hash)\n #if the method is called of an empty\n if name_hash.empty?\n nil\n else\n #the min_value is set to the first value\n min_value = name_hash.first[1]\n #the min_key is set to hash first index\n min_key = name_hash.first[0]\n #iterate over the hash and return key\n name_hash.each do |key, value|\n #when the value is less than the min_value\n if value < min_value\n #min value is now equal to the first value\n min_value = value\n #min key is now equal to the first key\n min_key = key\n end\n end\n #returns the key with the samllest value\n min_key\n end\nend",
"title": ""
},
{
"docid": "ea4ea2f207149a6114621e1cf8599982",
"score": "0.6491793",
"text": "def hkey(h)\n h.sort_by{|x| x[0].to_s}\n end",
"title": ""
},
{
"docid": "4cdac4340299e1f2d916988bf6195b71",
"score": "0.64784235",
"text": "def key_for_min_value(name_hash)\n if name_hash=={}\n nil\n else\n new1=name_hash.sort_by(&:last)\n new1[0][0]\n end\nend",
"title": ""
},
{
"docid": "b78a8c3fbbda0dc6b3ed59f810316f24",
"score": "0.6457297",
"text": "def hash(*) end",
"title": ""
},
{
"docid": "82b8b5bd5cd7d0e9d9cf490eb393aba9",
"score": "0.64341193",
"text": "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend",
"title": ""
},
{
"docid": "964b320ab34f3228615515b852f9d86f",
"score": "0.6430911",
"text": "def show_first_unique()\n # Iterate hash and return where value is equal to 1\n @h1.each do |k,v|\n if v == 1\n return k\n end \n end\n return -1 # Return -1 if no value with count 1.\n end",
"title": ""
},
{
"docid": "19055f2c4a19ee4f2ea7b17f90deef45",
"score": "0.64286125",
"text": "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend",
"title": ""
},
{
"docid": "3e59b5363bc0386f8d5e6f7dff471bce",
"score": "0.6422212",
"text": "def key_for_min_value(name_hash)\nif name_hash.size != 0\n while name_hash.length != 1 \n test = name_hash.max_by{|k,v| v}\n name_hash.delete(test[0])\n end\n r = name_hash.to_a \n r[0][0]\nelse\n return nil\nend\nend",
"title": ""
},
{
"docid": "17c3a4fbdd1c5bde26bd0d525f5ff54b",
"score": "0.6406957",
"text": "def key_for_min_value(name_hash)\n if name_hash == {}\n nil\n else\n hash = name_hash.sort {|k, v| v[1] <=> k[1]}.reverse\n array = hash.first\n array[0]\n end\nend",
"title": ""
},
{
"docid": "813940e2c3e0a081177eb35b5a71e77f",
"score": "0.6405241",
"text": "def key_for_min_value(name_hash)\n return_key, return_value = name_hash.first\n name_hash.collect do |key, value|\n if value < return_value\n return_value = value\n return_key = key\n end\n end\n return_key\nend",
"title": ""
},
{
"docid": "970dfb1e1fa41fe50e952fd4323ad858",
"score": "0.6381268",
"text": "def key_for_min_value(name_hash)\nif !name_hash.empty?\n name_hash.min_by{|k,v|v}[0]\nend\nend",
"title": ""
},
{
"docid": "ef5c474f7757d97525b0bd4b1c53581c",
"score": "0.6366031",
"text": "def key_for_min_value(name_hash)\n if name_hash.length == 0 \n return nil\n end\n \n valArr = name_hash.collect do |key, value|\n value\n end\n sorted = valArr.sort\n name_hash.collect do |key, value|\n if value == sorted[0]\n return key\n end\n end\nend",
"title": ""
},
{
"docid": "aaaebd487f2c1746ee029c8567713a5e",
"score": "0.63515425",
"text": "def key_for_min_value(name_hash)\n \n min_key, min_value = name_hash.first\n \n name_hash.each do |name, hash|\n if min_value > hash\n min_value = hash\n end\n end\n #name_hash.select{|name, hash| hash == min_value}.keys[0]\n name_hash.key(min_value)\n \nend",
"title": ""
},
{
"docid": "202e801f1b4554a9a978e1c94dc6200f",
"score": "0.635049",
"text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n return nil\n else\n lowest_key = name_hash.reduce{ |f, s| f.last > s.last ? s : f }.first\n return lowest_key\n end\nend",
"title": ""
},
{
"docid": "5bb5e0e43ce72b9017391a2bdbc4b9f8",
"score": "0.6350417",
"text": "def key_for_min_value(hash)\n if hash.empty? == true\n nil\n else\n array = []\n \n hash.each do |k, v|\n array << v\n end \n \n min_value = array[0]\n \n array.each do |value|\n min_value = value if value < min_value\n end \n \n hash.each do |k, v|\n return k if min_value == v\n end \n end\nend",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "23cdf6a080837fbe407633be0799ea0e",
"score": "0.6331996",
"text": "def hash() end",
"title": ""
},
{
"docid": "f8640e9e20439deaeaf99cbc20512303",
"score": "0.63296694",
"text": "def key_for_min_value(name_hash)\n i = 0\n a = []\n if name_hash == {}\n return nil\n else\n name_hash.each do |key, value|\n a.push(value)\n end\n while i < a.length\n if a[i] > a[a.length-1]\n a[i], a[a.length-1] = a[a.length-1], a[i]\n i += 1\n else\n i += 1\n end\n end\n name_hash.each do |key, value|\n if value == a[0]\n return key\n end\n end\nend\n \n \n \n \nend",
"title": ""
},
{
"docid": "9c6996c5c454ad3de6316f812ad2074a",
"score": "0.632607",
"text": "def key_for_min_value(name_hash)\n if !name_hash.empty?\n name_hash.min_by{|k,value| value}[0]\n end\nend",
"title": ""
},
{
"docid": "eae66fafb69868acd3a8a879a9f98567",
"score": "0.6307328",
"text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n else\n name_hash = name_hash.sort_by {|k, v| v}\n name_hash[0][0]\n end\nend",
"title": ""
},
{
"docid": "5a291391152fd8ced2c9d32782726eca",
"score": "0.63066065",
"text": "def key_for_min_value(name_hash)\n placeholder = {}\n if name_hash == {}\n return nil\n else name_hash.each { |name|\n first_hash = name_hash.first\n if name[1] < first_hash[1]\n first_hash = name\n end\n placeholder = first_hash\n }\n end\n return placeholder[0]\nend",
"title": ""
},
{
"docid": "3abc824ffe4d0b5994c292a0185be8da",
"score": "0.6305491",
"text": "def first_key\n first = node_next(@head, 0)\n return first ? first[1] : nil\n end",
"title": ""
},
{
"docid": "3abc824ffe4d0b5994c292a0185be8da",
"score": "0.6305491",
"text": "def first_key\n first = node_next(@head, 0)\n return first ? first[1] : nil\n end",
"title": ""
},
{
"docid": "417c8caa1ec2ca0ffbac485b31fa15de",
"score": "0.6304064",
"text": "def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend",
"title": ""
},
{
"docid": "39b15da071a5d18e77c7674f9a946414",
"score": "0.6303394",
"text": "def hash\n @hash || calculate_hash!\n end",
"title": ""
},
{
"docid": "3237dab54576f4a7b17345e42305d9b0",
"score": "0.63019454",
"text": "def get_cache_key(unique_hash)\n memcache_key_object.key_template % @options.merge(u_h: unique_hash)\n end",
"title": ""
},
{
"docid": "d12b93d0f0aba5aeb4a943cefa0e3aca",
"score": "0.62912756",
"text": "def key_for_min_value(name_hash)\n\n values = []\n return_key = nil\n name_hash.collect do |key, value|\n values << value\n end\n\n sorted_values = values.sort\n return_value = sorted_values[0]\n\n name_hash.each do |key,value|\n if value == return_value\n return_key = key\n end\n end\nreturn return_key\nend",
"title": ""
},
{
"docid": "5dbc2deab0cd7616ad91cd8361bd565a",
"score": "0.6287367",
"text": "def my_hash_finding_method(my_hash, number)\n\t\n\tif !number.is_a?(Fixnum)\nraise ArgumentError.new('The Second Argument Should be a Fixnum')\n\tend\n\n\treturn my_hash.select {|key, value| value == number}.keys\nend",
"title": ""
},
{
"docid": "1663f4318cef9e17e493237b0ae118bb",
"score": "0.6283707",
"text": "def key_for_min_value(name_hash)\n\twanted_key = nil\n\tvalue_array = []\n\n\tname_hash.each do |key,value|\n\t\tvalue_array << value\n\tend\n\n\twanted_value = value_array.sort[0]\n\n\tname_hash.each do |key,value|\n\t\tif wanted_value == value\n\t\t\twanted_key = key\n\t\tend\n\tend\n\nwanted_key\nend",
"title": ""
},
{
"docid": "5f7b8151d367391d2f710aa077d92455",
"score": "0.6273651",
"text": "def get_key(hash, key)\n if hash.has_key? key\n return hash[key]\n else\n raise \"key '#{key}' was expected but not found in #{hash}\"\n end\n end",
"title": ""
},
{
"docid": "f813b5be1e6fc292e8d7a32537ee101b",
"score": "0.62685597",
"text": "def key_for_min_value(name_hash)\n #name_hash.collect do|key, value|\n #name_hash.sort\n hash1={}\n hash1=Hash[name_hash.sort_by{|k,v| v}]\n hash1.keys[0]\nend",
"title": ""
},
{
"docid": "df4f0c0cfbe4f5340cb64f85863e6b74",
"score": "0.6262927",
"text": "def key_for_min_value(name_hash)\n\treturn_key = nil\n\treturn_key \n\tmin_value = 0\n\tname_hash.each do |key, value|\n\t\tif [key, value] == name_hash.first \n\t\t\treturn_key = key\n\t\t\tmin_value = value\n\n\t\tend\n\n\t\tif value < min_value \n\t\t\treturn_key = key\n\t\t\tmin_value = value\n\t\tend\n\n\tend\n\treturn_key\n\nend",
"title": ""
},
{
"docid": "bce4f7fdef0d5efa76f6592f4c7fbddf",
"score": "0.6259891",
"text": "def key_for_min_value(name_hash)\n if name_hash.empty? ==false\n array=[]\n name_hash.each_value{|value| array.push(value)}\n while array.length > 1\n if array[0] > array [1]\n array.delete_at(0)\n else\n array.delete_at(1)\n end\n end\n lowval=array[0]\n return name_hash.key(lowval)\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "ee289d008acdac07e3fb36886dbf1450",
"score": "0.62538093",
"text": "def hash(*args, **_arg1, &block); end",
"title": ""
},
{
"docid": "e9020d0b11846bbd3ce6c3bc14f58424",
"score": "0.6243331",
"text": "def key_for_min_value(name_hash)\n if name_hash != {}\n key = name_hash.sort_by{|k, v| v}.first\n return key[0]\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "173826bb729ddbb2da7ce0f5a4c6427a",
"score": "0.62308484",
"text": "def hash_key(*args, block)\n # TODO: can't be nested\n def_args = extract_definition_args_nameless(args)\n\n return unless check_when(def_args, @current_source)\n return unless version_wanted(def_args)\n\n @hash_key = field_value(def_args, block)\n # puts \"hash_key = #{@hash_key}\"\n end",
"title": ""
},
{
"docid": "174d6d7ed73a107f14b1a90eea7e7a1e",
"score": "0.6225813",
"text": "def key_for_min_value(name_hash)\n array = name_hash.collect do |key, value|\n value\n end\n \n new_array = array.sort\n empty = nil\n \n name_hash.each do |key, value|\n if value == new_array[0]\n return key\n end\n end\n empty\nend",
"title": ""
},
{
"docid": "7b56072eeaea53163657c77a6621daaf",
"score": "0.6224924",
"text": "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend",
"title": ""
},
{
"docid": "031cd40348607a9a61fdaff639e60289",
"score": "0.6224571",
"text": "def key_for_min_value(name_hash)\nlowest_value = 0 \n\nname_hash.index do |(x,y)|\n\nx = key \ny = value \nend",
"title": ""
},
{
"docid": "caaac57095e6a9b97583448a39ee037a",
"score": "0.62210923",
"text": "def get_hash(key)\n (Zlib.crc32(key).abs % 100).to_s(36)\n end",
"title": ""
},
{
"docid": "ef9f196a1a48c051ba7cc4a3a2627aac",
"score": "0.6220655",
"text": "def key_for_min_value(name_hash)\n if x = name_hash.sort_by {|key, value| value}.first \n x[0]\n else x \n end\nend",
"title": ""
},
{
"docid": "928ea958886467cc317f3362fc09c272",
"score": "0.6218832",
"text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n values = []\n name_hash.each do |item, value|\n values.push(value)\n end\n values_s = values.sort\n name_hash.each do |item, value|\n if value == values_s[0]\n return item\n end\nend\nend",
"title": ""
},
{
"docid": "04bc9d4c1d2635fad88708942ca4197b",
"score": "0.6218032",
"text": "def key_for_min_value(name_hash)\n name_hash = name_hash.sort_by {|key, value| value}\n name_array = []\n name_hash.each do |key, value|\n name_array << key\n end\n return name_array[0]\nend",
"title": ""
},
{
"docid": "1be1b10822bb0f30bfe233111e45baa8",
"score": "0.62166363",
"text": "def my_key(h, i)\n p [h, i]\nend",
"title": ""
},
{
"docid": "bb63779e4e74d9766f1efa561c32c264",
"score": "0.62164557",
"text": "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n #get the first key:value pair by using .first method\n min_key, min_value = name_hash.first\n name_hash.collect do |k, v|\n # iterate over each value to check which one smaller than the return value\n if v < min_value\n min_key = k #just need the key\n end\n\n end\n min_key\n\n #end\nend",
"title": ""
},
{
"docid": "236bccf1708770fb907037b87da88d14",
"score": "0.6215059",
"text": "def key_for_min_value(hash)\n min_key = nil \n hash.each do |key, value|\n \n if min_key == nil \n min_key = key\n end \n if value <= hash[min_key]\n min_key = key \n end\n end\n # binding.pry \n min_key\nend",
"title": ""
},
{
"docid": "1ccacfb56d23c75ce5bf0e009adefb98",
"score": "0.6212187",
"text": "def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend",
"title": ""
},
{
"docid": "094c1561604767af8c592bd5e5500be7",
"score": "0.62069505",
"text": "def key_for_min_value(name_hash)\n if name_hash.size == 0\n nil\n else\n key_value_pair = name_hash.sort_by { |key, value| value}.first\n key_value_pair.shift\n end\nend",
"title": ""
},
{
"docid": "7545c3b832af9115e3727d4d43dffed3",
"score": "0.62064195",
"text": "def key_for_min_value(name_hash)\n\n\t\tif name_hash == {}\n\t\t\tnil \n\t\telse\n\t\t the_key = name_hash.first[0]\n\t the_value = name_hash.first[1]\n\t\t\tname_hash.each do |key,value|\n\t\t\t\tif value < the_value\n\t\t\t\t\tthe_key = key\n\t\t\t\t\tthe_value = value\n\t\t\t\tend \n\t\t\tend \n\t\tend \n\t\tthe_key\n\tend",
"title": ""
},
{
"docid": "250995a761e0ed060ba8d116d5f5e045",
"score": "0.62046224",
"text": "def hashfunction(key, size)\n #key.hash % size\n key % size\n end",
"title": ""
},
{
"docid": "4e3823c37685438a82b3ebb23e9b1c26",
"score": "0.6201976",
"text": "def key_for_min_value(name_hash)\n\tmin_key_array = name_hash.collect do |key, value|\n\t\tif value == (name_hash.collect { |key, value| value }).min\n\t\t\tkey\n\t\tend\n\tend\n\tmin_key_array.compact.first\nend",
"title": ""
},
{
"docid": "c2427fbb3d9c5d3b60f998ec0326d3f5",
"score": "0.6196577",
"text": "def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend",
"title": ""
},
{
"docid": "ef2c5261b366a4a48f094c1f2b5aab33",
"score": "0.61956835",
"text": "def key_for_min_value(name_hash)\nreturn nil if name_hash.size == 0\nmin_key, min_value = name_hash.first\nname_hash.each do |key, value|\n if value < min_value\n min_key = key\n end\n end\n min_key\nend",
"title": ""
},
{
"docid": "72158e19985f3abc43db6a81ba5ec4a9",
"score": "0.61919045",
"text": "def digest_hash_function\n decode[:hash_function]\n end",
"title": ""
},
{
"docid": "4b367681127fb9fa42c6a2f14f901d9a",
"score": "0.6190914",
"text": "def key_for_min_value(name_hash)\n values = name_hash.collect {|key, value| value}\n name_hash.index(values.sort[0])\nend",
"title": ""
},
{
"docid": "4d119d3343bb819fbf6983b89e21fa1b",
"score": "0.61890495",
"text": "def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend",
"title": ""
},
{
"docid": "728596c4f65859fc1b59948b26ea369b",
"score": "0.6185628",
"text": "def key_for_min_value(name_hash)\n\tmin_value = nil\n\tthe_key = nil\n\tname_hash.each do |key, value|\n\t\tif min_value.nil? || value < min_value\n\t\t\tmin_value = value\n\t\t\tthe_key = key\n\t\tend\n\tend\n\tthe_key\t\t\t\t\nend",
"title": ""
},
{
"docid": "4b1d9efc5a8df8a732466e27963f4e75",
"score": "0.6172715",
"text": "def key_for_min_value(name_hash)\n newarray = []\n who = \" \"\n if name_hash == { }\n return nil\n else\n newarray << name_hash.collect {|key, value| value }\n\n newarray[0].sort\n\n name_hash.each {|key, value|\n\n if value == newarray[0].sort[0]\n who = key\n end\n }\n return who\n end\nend",
"title": ""
},
{
"docid": "c151ded0355a92c5b827fcd31d64f732",
"score": "0.61681825",
"text": "def get_lh_hash(key)\n res = 0\n key.upcase.bytes do |byte|\n res *= 37\n res += byte.ord\n end\n return res % 0x100000000\n end",
"title": ""
},
{
"docid": "976b436729358ec8057d1b2d8e0421a5",
"score": "0.6167214",
"text": "def key_for_min_value(name_hash)\n output = nil\n current_value = nil\n name_hash.each do |name, hash|\n if current_value == nil || hash <= current_value\n current_value = hash\n output = name\n end \n end \n output\nend",
"title": ""
},
{
"docid": "93120ec5fe71574d5d67a7c1a6c417c0",
"score": "0.6157038",
"text": "def key_for_min_value(name_hash)\n #name_hash.sort_by { |key, value| value }.first\n if name_hash.empty?\n nil\n else\n name_hash.sort_by { |key, value| value }.first[0]\n end\nend",
"title": ""
},
{
"docid": "b7872a5fdb4fd1872db2cbb794768a73",
"score": "0.61550575",
"text": "def key_for_min_value(name_hash)\n return nil if name_hash == {}\nend",
"title": ""
},
{
"docid": "727b40f9aeaf16679278f4e7e7c6a588",
"score": "0.6150093",
"text": "def hash()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "20bd7d1c486d92d12f14f3557984265b",
"score": "0.6148759",
"text": "def key_for_min_value(name_hash)\n if name_hash.size == 0\n return nil\n else\n min_hash_value = 10 ** 80\n min_hash_key = -1\n name_hash.collect do |k, v|\n min_hash_value, min_hash_key = v, k if v < min_hash_value\n end\n\n end\n return min_hash_key\nend",
"title": ""
},
{
"docid": "aac3a16c7d0c9a97cb760cf86b78bf9a",
"score": "0.6146897",
"text": "def key_for_min_value(name_hash)\n return nil if name_hash.nil? || name_hash.empty?\n min_key = name_hash.first[0]\n name_hash.each do |key, val|\n min_key = key if val < name_hash[min_key]\n end\n min_key\nend",
"title": ""
},
{
"docid": "44d16ba5635b5c7dee3a21bc602c8d02",
"score": "0.6146704",
"text": "def key_for_min_value(name_hash)\n array=[]\n if name_hash.length > 0 \n name_hash.collect do |key,value|\n array << value\n end\n for j in 0...array.length\n for i in 0...array.length-1-j \n if array[i] > array[i+1]\n array[i],array[i+1]=array[i+1],array[i]\n end\n end\n end\n name_hash.each do |key,value|\n if value == array[0]\n return key\n end\n end\n end\nend",
"title": ""
},
{
"docid": "04f43af8404184db5a85b81db3c18e5a",
"score": "0.6141741",
"text": "def key_for_min_value(name_hash)\n\tsmall_value = nil \n\tsmall_key = nil\n\tname_hash.each do |k,v|\n\t\tif small_value == nil\n\t\t\tsmall_value = v \n\t\t\tsmall_key = k\n\t\telsif v < small_value\n\t\t\tsmall_value = v \n\t\t\tsmall_key = k \n\t\tend \n\tend \n\tsmall_key\nend",
"title": ""
},
{
"docid": "cffadb6714d600c9de9794fce1c2bc4c",
"score": "0.6141639",
"text": "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n else\n firstKey, firstVal = name_hash.first\n name_hash.each do |key, value|\n if firstVal > value\n firstVal = value\n firstKey = key \n end\n end\n end\n return firstKey \nend",
"title": ""
},
{
"docid": "a9c2e04f234486f81506c03d7c4baaa8",
"score": "0.6139075",
"text": "def key_for_min_value(name_hash)\n val = 110000000000\n retkey = \"\"\nname_hash.collect do |key, value|\n if value < val then \n retkey = key\n val = value\n end\nend\nif name_hash.empty? then\n retkey = NIL\nend\nretkey\nend",
"title": ""
},
{
"docid": "38583175abbab9541a672a91812dd586",
"score": "0.6137386",
"text": "def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend",
"title": ""
},
{
"docid": "3399890fc9a7392a182b2bf33158a754",
"score": "0.6133843",
"text": "def key_for_min_value(name_hash)\n newArray = []\n if name_hash == {}\n return nil\n else\n name_hash.each {|key, value| newArray.push(value) }\n end\n \n newArray = newArray.sort\n min = newArray[0]\n \n \n name_hash.select{|key, hash| if hash == min\n return key\n end\n }\n\n \n \nend",
"title": ""
},
{
"docid": "edccae6b54f0f500364f28e658e6f592",
"score": "0.613273",
"text": "def key_for_min_value(name_hash)\n new_numbers = []\n if name_hash.length == 0\n nil\n else\n first_value = name_hash.first[1]\n return_key = \"\"\n name_hash.collect do |key, value|\n if first_value >= value\n puts \"yay match\"\n return_key = key\n else\n puts \"no Match\"\n #pass\n end\n end\n return_key\n end\nend",
"title": ""
},
{
"docid": "cf77ceda9fd94c99d9b93c7ab0d3653c",
"score": "0.613081",
"text": "def hash_keys(hash)\n\thash.map { |k, v| k }\nend",
"title": ""
},
{
"docid": "de6bf145c44a60570308537f537f3d67",
"score": "0.61302197",
"text": "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"title": ""
},
{
"docid": "4a542431078f885032093e4e6ed57022",
"score": "0.6122313",
"text": "def key_for_min_value(name_hash)\n if name_hash.size > 0 \n values = []\n name_hash.collect do |key, value|\n values << value\n end \n min_value = values[0]\n values.each do |value|\n min_value = value if value < min_value \n end\n name_hash.each do |key, value|\n return key if value == min_value\n end \n end\nend",
"title": ""
},
{
"docid": "9caa8978b53e00c7717c0f9fea5a5a10",
"score": "0.6119634",
"text": "def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend",
"title": ""
},
{
"docid": "f226a1b304322c98cb317e5c2a2925bc",
"score": "0.6118762",
"text": "def key_for_min_value(name_hash)\nname_hash = {\"apple\" => -25, \"pine\" => -28, \"banana\" =>- 39}\nkey_for_min_value(name_hash)\nend",
"title": ""
},
{
"docid": "cb7eddcd6747173175abb4933529617e",
"score": "0.61163545",
"text": "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n min = name_hash.first\n name_hash.each do |key, value|\n if value < min[1]\n min = [key, value]\n end\n end\n min[0] \nend",
"title": ""
},
{
"docid": "69f7f1341c525336a377e4e6a4dd18e6",
"score": "0.6114019",
"text": "def key_for_min_value(name_hash)\n min_value = name_hash.collect{|key, val| val}.min\n name_hash.collect do |key, val|\n return key if val == min_value\n end\n nil\nend",
"title": ""
},
{
"docid": "a6729ea6fd9cf8809b517a7b36453b54",
"score": "0.6111669",
"text": "def key_for_min_value(name_hash)\n if name_hash.empty?\n return nil\n else\n lowest = name_hash.reduce { |x, y| x.last > y.last ? y : x }.first\n return lowest\n end\nend",
"title": ""
},
{
"docid": "24cfb47cf71f4b68e60acf6a5d937546",
"score": "0.61109793",
"text": "def key_for_min_value(name_hash)\n return nil if name_hash.size == 0\n min_key, min_value = name_hash.first\nname_hash.each do |key, value|\n if value < min_value\n min_key = key\n end\nend\n min_key\nend",
"title": ""
}
] |
da7794230a97f8abc886e6985e17e6ce
|
Create a .ssh folder for the user.
|
[
{
"docid": "1f2089caa321655d2e1d26a11375e04f",
"score": "0.83587813",
"text": "def create_dotssh\n directory ::File.expand_path(\"~#{new_resource.user}/.ssh\") do\n owner new_resource.user\n group new_resource.group\n mode '755'\n end\n end",
"title": ""
}
] |
[
{
"docid": "8b35d6bfc02ff8fa2cfcd3656d434eca",
"score": "0.78817654",
"text": "def add_ssh_dir\n userHome = new_resource.home || \"/home/#{ new_resource.name }\"\n\n Chef::Log.debug \"Adding user's .ssh directory '#{ userHome }/.ssh'\"\n\n directory \"create_user_ssh_dir\" do\n owner new_resource.name\n group new_resource.primary_group || new_resource.name\n mode 0700\n recursive true\n path \"#{ userHome }/.ssh\"\n action :create\n end\nend",
"title": ""
},
{
"docid": "c6a8d2afc663fcfa8217c155f25de371",
"score": "0.77239424",
"text": "def create_remote_path\n if host\n return unless mode == :ssh\n\n run \"#{utility(:ssh)} #{ssh_transport_args} #{host} \" +\n %(\"mkdir -p '#{remote_path}'\")\n else\n FileUtils.mkdir_p(remote_path)\n end\n end",
"title": ""
},
{
"docid": "a73b6cdd52ace9e0fc7b4fa64f1df670",
"score": "0.769437",
"text": "def mkdir_on_remote_as userid, host, dir, options = {}\n result = nil\n options[:permissions] = 0755 unless options.include? :permissions\n Net::SFTP.start(host, userid) do |sftp|\n begin\n result = sftp.opendir! dir\n rescue ::Net::SFTP::StatusException\n result = sftp.mkdir dir, options\n end\n end\n result\n end",
"title": ""
},
{
"docid": "a39ed23cb161b63f8df88d6adab1dcc4",
"score": "0.7548381",
"text": "def create_dest_path!\n return unless mode == :ssh && dest_path.index(\"/\").to_i > 0\n\n run \"#{utility(:ssh)} #{ssh_transport_args} #{host} \" +\n %(\"mkdir -p '#{dest_path}'\")\n end",
"title": ""
},
{
"docid": "76a76e2ed18e3c98ccb153ae3056240e",
"score": "0.7325928",
"text": "def create_remote_directories(ssh)\n path_parts = Array.new\n remote_path.split('/').each do |path_part|\n path_parts << path_part\n ssh.exec!(\"mkdir '#{path_parts.join('/')}'\")\n end\n end",
"title": ""
},
{
"docid": "096bd544a5e7462ad4066315dd3fb97a",
"score": "0.7124914",
"text": "def create_ssh_dir_if_missing\n FileUtils.mkdir_p(ssh_key_path) unless Dir.exists?(ssh_key_path)\n rescue\n error_msg = \"The ssh key directory does not have write permissions: \"\n error_msg << ssh_key_path\n raise Souffle::Exceptions::PermissionErrorSshKeys, error_msg\n end",
"title": ""
},
{
"docid": "b3166a2651969d37f23f98284ee97800",
"score": "0.7119933",
"text": "def mkdir(dir, ssh)\n unless chkdir(dir, ssh)\n if ssh\n puts \"\\tCreating remote dir #{dir}\"\n ssh.exec!(\"mkdir #{dir}\") do |ch, stream, data|\n if stream == :stderr\n raise \"Failed to create #{dir}:\\n #{data}\"\n end\n end\n else\n dir_spc = dir.gsub(/\\\\\\s+/, ' ') # Dir.* methods doen't work with spaces escaped, \"unescape them\"\n puts \"\\tCreating local dir #{dir_spc}\"\n Dir.mkdir(dir_spc)\n raise \"Failed to create #{dir_spc}\" if !File.directory?(dir_spc)\n end\n end\nend",
"title": ""
},
{
"docid": "98fe8159016c8b85c5d3732e62f10b5a",
"score": "0.7010437",
"text": "def create_home_dir(u)\n if u['home']\n home_dir = u['home']\n else\n home_dir = \"/home/#{u['id']}\"\n home_dir = \"/Users/#{u['id']}\" if platform? 'windows'\n end\n\n\tdirectory \"#{home_dir}\" do\n\t\towner u['id']\n\t\tgroup u['gid'] || u['id'] \tunless platform? 'windows'\n\t\tmode \"0755\" \t\t\t\tunless platform? 'windows'\n\tend\n\t\n\thome_dir\nend",
"title": ""
},
{
"docid": "443c1bd12c2a8509bc06cca42c4fe811",
"score": "0.6973624",
"text": "def create_remote_directories!\n if @local\n mkdir(remote_path)\n else\n connection.exec!(\"mkdir -p '#{ remote_path }'\")\n end\n end",
"title": ""
},
{
"docid": "0f3c9f50f2dbfc6226ae28c9dcf0a479",
"score": "0.6972183",
"text": "def create_ssh_keys\n\n ssh_loc = lambda { |str| File.join('~/.ssh', str) }\n\n user = ARGV[1]\n raise \"File name is not defined.\" unless user\n\n names = []\n names << (priv = \"#{user}.private\")\n names << (pub = \"#{user}.pub\")\n names << (base = \"#{user}\")\n\n files = names.map { |str| ssh_loc.call(str) }\n\n # Make sure we don't overwrite existing files.\n files.each do |old_file|\n if File.file?( old_file )\n raise( \"Can't overwrite existing file: #{old_file}\" )\n end \n end \n\n sh \"ssh-keygen -t rsa -f #{ssh_loc.call base}\"\n\n sh \"mv #{ssh_loc.call base } #{ssh_loc.call base }.private\"\n sh \"mv #{ssh_loc.call base }.pub #{ssh_loc.call base }\" \n sh \"chmod 700 ~/.ssh\"\n\n [base, priv].each do | str |\n sh \"chmod 600 #{ssh_loc.call str}\"\n end \n end",
"title": ""
},
{
"docid": "f471faefa7684e151eb48fe7f39a40f6",
"score": "0.682482",
"text": "def create_destination!\n ui.info \"Creating Babushka directory...\", :scope => name\n communicate.sudo [\n # Create directory, and parent directories if also missing\n \"mkdir -p /usr/local/babushka\",\n\n # Change Babushka directory's group to user's primary group\n \"chgrp #{escape group} /usr/local/babushka /usr/local/bin\",\n\n # Add read/write privileges where Babushka needs them\n \"chmod g+rw /usr/local/babushka /usr/local/bin\",\n ].join(\" && \")\n end",
"title": ""
},
{
"docid": "a7a54628f29c55f60e43dd5ea684a10f",
"score": "0.6768374",
"text": "def create_user_directory\n if Rails.application.secrets.local_upload_path\n require 'fileutils'\n FileUtils.mkdir_p(Rails.application.secrets.local_upload_path+\"/#{self.id}\")\n end\n end",
"title": ""
},
{
"docid": "38d5998def00a015a77ae58dacbd4a29",
"score": "0.67212635",
"text": "def mkdir path\n parent = lookup! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"title": ""
},
{
"docid": "02951a11c4a8db802a8087a7177db81b",
"score": "0.6663115",
"text": "def create_remote_path(sftp)\n path_parts = []\n remote_path.split(\"/\").each do |path_part|\n path_parts << path_part\n begin\n sftp.mkdir!(path_parts.join(\"/\"))\n rescue Net::SFTP::StatusException; end\n end\n end",
"title": ""
},
{
"docid": "204eca3519e489e7310aabce441f079b",
"score": "0.6644028",
"text": "def create_profile_directory\n # TODO: background job.\n FileUtils.mkdir_p local_path\n FileUtils.chmod_R 0770, local_path\n begin\n FileUtils.chown_R ConfigVar['git_user'], nil, local_path\n rescue ArgumentError\n # Happens in unit testing, when the git user isn't created yet.\n raise unless Rails.env.test?\n rescue Errno::EPERM\n # Not root, not allowed to chown. \n end \n local_path\n end",
"title": ""
},
{
"docid": "114352cd91824808564bc3b1fdfb0ad7",
"score": "0.6637947",
"text": "def mkdir(path);end",
"title": ""
},
{
"docid": "114352cd91824808564bc3b1fdfb0ad7",
"score": "0.6637947",
"text": "def mkdir(path);end",
"title": ""
},
{
"docid": "4a0c0d9d19b6b8f2fd23274f7123dd0a",
"score": "0.6630058",
"text": "def create_remote_directories!\n path_parts = Array.new\n remote_path.split('/').each do |path_part|\n path_parts << path_part\n begin\n connection.mkdir(path_parts.join('/'))\n rescue Net::FTPPermError; end\n end\n end",
"title": ""
},
{
"docid": "658dc3fa96ac4895bfb96369d6e04274",
"score": "0.66279423",
"text": "def create_remote_set_user_dir(vcs)\n name = PackageSet.name_of(ws, vcs)\n raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)\n FileUtils.mkdir_p(remotes_user_dir)\n symlink_dest = File.join(remotes_user_dir, name)\n\n # Check if the current symlink is valid, and recreate it if it\n # is not\n if File.symlink?(symlink_dest)\n dest = File.readlink(symlink_dest)\n if dest != raw_local_dir\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n else\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n\n symlink_dest\n end",
"title": ""
},
{
"docid": "65e718dd99bcf6f041b6d75144bd37e8",
"score": "0.662137",
"text": "def create_remote_set_user_dir(vcs)\n name = PackageSet.name_of(ws, vcs)\n raw_local_dir = PackageSet.raw_local_dir_of(ws, vcs)\n FileUtils.mkdir_p(remotes_user_dir)\n symlink_dest = File.join(remotes_user_dir, name)\n\n # Check if the current symlink is valid, and recreate it if it\n # is not\n if File.symlink?(symlink_dest)\n dest = File.readlink(symlink_dest)\n if dest != raw_local_dir\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n else\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n\n symlink_dest\n end",
"title": ""
},
{
"docid": "b05acf6e0fcf1f8e7e7712521c644528",
"score": "0.66026825",
"text": "def install_ssh_key!\n command = \"mkdir -p '#{File.join(home_dir, '.ssh')}';\"\n command += \"echo '#{ssh_key}' >> '#{File.join(home_dir, '.ssh', 'authorized_keys')}';\"\n command += \"chown -R #{c.user}:#{c.user} '#{File.join(home_dir, '.ssh')}';\"\n command += \"chmod 700 '#{File.join(home_dir, '.ssh')}'; chmod 600 '#{File.join(home_dir, '.ssh', 'authorized_keys')}'\"\n execute_as_root(command)\n end",
"title": ""
},
{
"docid": "c66f7e054accfaf0f171f0351017af8f",
"score": "0.65925264",
"text": "def create_profile_directory\n # TODO: background job.\n FileUtils.mkdir_p local_path\n FileUtils.chmod_R 0770, local_path\n begin\n FileUtils.chown_R ConfigVar['git_user'], nil, local_path\n rescue ArgumentError\n # Happens in unit testing, when the git user isn't created yet.\n raise unless Rails.env.test?\n rescue Errno::EPERM\n # Not root, not allowed to chown.\n end\n local_path\n end",
"title": ""
},
{
"docid": "cc7754d55910a0162006223aa283c7c8",
"score": "0.6588644",
"text": "def create_directory(remote_directory_name)\n run %(mkdir -p \"#{remote_directory_name}\")\n end",
"title": ""
},
{
"docid": "bb949e94f14e21e93520475c23cd206b",
"score": "0.6544484",
"text": "def create_remote_set_user_dir(vcs)\n name = PackageSet.name_of(ws.manifest, vcs)\n raw_local_dir = PackageSet.raw_local_dir_of(vcs)\n FileUtils.mkdir_p(remotes_user_dir)\n symlink_dest = File.join(remotes_user_dir, name)\n\n # Check if the current symlink is valid, and recreate it if it\n # is not\n if File.symlink?(symlink_dest)\n dest = File.readlink(symlink_dest)\n if dest != raw_local_dir\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n else\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n\n symlink_dest\n end",
"title": ""
},
{
"docid": "143c6580be1485f6e2336f59cfb320a2",
"score": "0.65435076",
"text": "def create_dir_session\n begin\n Dir.mkdir(File.join(parent_local, @client.tunnel_peer.to_s.split(\":\")[0]))\n rescue\n nil\n end\n end",
"title": ""
},
{
"docid": "9ab4ef2734559e48cd7231f0a2111292",
"score": "0.6536574",
"text": "def create_homedir\n unless File.exists?(homedir)\n FileUtils.mkdir_p(homedir, :mode => 0750)\n FileUtils.mkdir_p(\"#{homedir}/cur\", :mode => 0750)\n FileUtils.mkdir_p(\"#{homedir}/new\", :mode => 0750)\n FileUtils.mkdir_p(\"#{homedir}/tmp\", :mode => 0750)\n FileUtils.chown(IpcAuthpipe::config.mail['owner_name'], IpcAuthpipe::config.mail['owner_group'], \"#{homedir}/..\")\n FileUtils.chown_R(IpcAuthpipe::config.mail['owner_name'], IpcAuthpipe::config.mail['owner_group'], homedir)\n end\n end",
"title": ""
},
{
"docid": "5f7d7a5d1a3875915f38f335b57f38e7",
"score": "0.6532577",
"text": "def create_directory\n connection.directories.create({\n :key => directory_name,\n :public => true\n })\n end",
"title": ""
},
{
"docid": "542b0ce8cda75c6a0438868a600add62",
"score": "0.6507718",
"text": "def create_remote_set_user_dir(vcs)\n name = PackageSet.name_of(manifest, vcs)\n raw_local_dir = PackageSet.raw_local_dir_of(vcs)\n FileUtils.mkdir_p(remotes_user_dir)\n symlink_dest = File.join(remotes_user_dir, name)\n\n # Check if the current symlink is valid, and recreate it if it\n # is not\n if File.symlink?(symlink_dest)\n dest = File.readlink(symlink_dest)\n if dest != raw_local_dir\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n else\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n\n symlink_dest\n end",
"title": ""
},
{
"docid": "542b0ce8cda75c6a0438868a600add62",
"score": "0.6507718",
"text": "def create_remote_set_user_dir(vcs)\n name = PackageSet.name_of(manifest, vcs)\n raw_local_dir = PackageSet.raw_local_dir_of(vcs)\n FileUtils.mkdir_p(remotes_user_dir)\n symlink_dest = File.join(remotes_user_dir, name)\n\n # Check if the current symlink is valid, and recreate it if it\n # is not\n if File.symlink?(symlink_dest)\n dest = File.readlink(symlink_dest)\n if dest != raw_local_dir\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n else\n FileUtils.rm_f symlink_dest\n Autoproj.create_symlink(raw_local_dir, symlink_dest)\n end\n\n symlink_dest\n end",
"title": ""
},
{
"docid": "512e9f8a8ea3550d47a63fddf97dc8ac",
"score": "0.6498555",
"text": "def create_folder\n\t\tbegin\n\t\t\tDir.mkdir(Pathname.new(Rails.root.to_s + '/data/users/') + resource.id.to_s) \n\t\t\tServices::Slog.debug({:message => \"New user registration\", :module => \"RegistrationsController\", :task => \"user_registration\", :extra => {:user => resource}}) \n\t\trescue Exception => e\n\t\t\tServices::Slog.exception e\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2c4c1acd9becaca903c22ad8c5ebda77",
"score": "0.6488222",
"text": "def create_remote_windows_directory(hosts, windows_path)\n windows_path = windows_path.gsub('\\\\','\\\\\\\\\\\\')\n on(hosts, \"cmd.exe /c mkdir #{windows_path}\", :accept_all_exit_codes => true)\nend",
"title": ""
},
{
"docid": "af163357738691e8239f446ffd0f22c1",
"score": "0.64773667",
"text": "def setup_ssh_keys(u, home_dir)\n\tif home_dir != \"/dev/null\"\n directory \"#{home_dir}/.ssh\" do\n owner u['id']\n group u['gid'] || u['id']\n mode \"0700\"\n end\n\n if u['ssh_keys']\n template \"#{home_dir}/.ssh/authorized_keys\" do\n source \"authorized_keys.erb\"\n owner u['id']\n group u['gid'] || u['id']\n mode \"0600\"\n variables :ssh_keys => u['ssh_keys']\n end\n end\n end\nend",
"title": ""
},
{
"docid": "6370d676d3862bc12526d83f2654ce7f",
"score": "0.64771074",
"text": "def mkdir(default)\n obj = get_config_file_default(default)\n\n Puppet::Util::SUIDManager.asuser(obj.owner, obj.group) do\n mode = obj.mode || 0750\n Dir.mkdir(obj.value, mode)\n end\n end",
"title": ""
},
{
"docid": "86df98dc5075757a1156deaea3c6e2d9",
"score": "0.6459658",
"text": "def mkdir(path, options={})\n via = options.delete(:via) || :run\n # XXX need to make sudo commands wrap the whole command (sh -c ?)\n # XXX removed the extra 'sudo' from after the '||' - need something else\n invoke_command \"test -d #{path} || #{sudo if via == :sudo} mkdir -p #{path}\"\n invoke_command \"chmod #{sprintf(\"%3o\",options[:mode] || 0755)} #{path}\", :via => via if options[:mode]\n invoke_command \"chown -R #{options[:owner]} #{path}\", :via => via if options[:owner]\n groupadd(options[:group], :via => via) if options[:group]\n invoke_command \"chgrp -R #{options[:group]} #{path}\", :via => via if options[:group]\n end",
"title": ""
},
{
"docid": "f4be13fbaa60d4effcaa1b1f554ce5d0",
"score": "0.6440302",
"text": "def create_directory\n\t\tdirname = \"Profiles/#{self.first_name}/Pictures\"\n\t\tFileUtils.mkdir_p dirname\n\tend",
"title": ""
},
{
"docid": "928e8028136075545280201786062c2b",
"score": "0.6439923",
"text": "def mkdir(path)\n Timeout::timeout(@@timeout) do\n connect do |sftp|\n sftp.mkdir! File.join(base_path, path)\n end\n end\n end",
"title": ""
},
{
"docid": "79d65295af214236cd16940d0b9e623c",
"score": "0.6427717",
"text": "def create\n unless File.exists?(ssh_dir)\n FileUtils.mkdir_p(ssh_dir)\n FileUtils.chmod(0770, ssh_dir)\n end\n\n if File.exists?(file_path)\n Rails.logger.debug(\"Found existing authorized_keys file: #{file_path}\")\n else\n Rails.logger.debug(\"Creating authorized_keys file: #{file_path}\")\n FileUtils.touch(file_path)\n end\n\n # TODO\n # FileUtils.chmod doesn't set correct permissions\n # FileUtils.chmod(0660, authorized_keys_file())\n App.call_os_cmd(\"chmod 0660 #{file_path}\")\n App.call_os_cmd(\"chgrp #{app_group} #{file_path}\")\n\n if File.exists?(file_path)\n Rails.logger.debug('authorized_keys file initialization: [ OK ]')\n else\n Rails.logger.debug('authorized_keys file initialization: [ FAILED ]')\n end\n end",
"title": ""
},
{
"docid": "93c27121c2d09ad6ec7df841aab282ac",
"score": "0.6414237",
"text": "def mkdir(path)\n create_folder(path)\n end",
"title": ""
},
{
"docid": "fabb0bc9a4582c4859f89422fb86bb29",
"score": "0.63886416",
"text": "def mkdir(path)\n \n end",
"title": ""
},
{
"docid": "17ba9b8ae4f7f1fd6f7a36439d73d315",
"score": "0.6382352",
"text": "def mkdir!(path) #make directory\n @client.mkdir!(join_to_pwd(path))\n end",
"title": ""
},
{
"docid": "645892cd4d400acb3ef65f8feae2dad7",
"score": "0.63638693",
"text": "def mkdir(dirname); end",
"title": ""
},
{
"docid": "8b7fcadca033529d7e512b5e6e758a1d",
"score": "0.63586503",
"text": "def create_working_directory(curriculum, user)\n working_repo = Git.clone(::GitFunctionality::Path.new.get_bare_path(curriculum), ::GitFunctionality::Path.new.get_working_path(curriculum))\n working_repo.config('user.name', user.username)\n working_repo.config('user.email', user.email)\n end",
"title": ""
},
{
"docid": "e860563d83e08e88cb0ada902a153bf1",
"score": "0.63430434",
"text": "def prepare_path(path, user, group, use_sudo = false)\r\n commands = []\r\n commands << \"#{sudo_cmd(use_sudo)} mkdir -p #{path}\"\r\n commands << \"#{sudo_cmd(use_sudo)} chown #{user}:#{group} #{path} -R\"\r\n commands << \"#{sudo_cmd(use_sudo)} chmod +rw #{path}\"\r\n @@capistrano_instance.run commands.join(\" &&\")\r\n end",
"title": ""
},
{
"docid": "91ad8f257342e97bfd1ea34d8489a442",
"score": "0.63186824",
"text": "def create_tmp_folder\n #need to create with universal privlages as some backup tasks might create this path under sudo\n run \"mkdir -m 0777 -p #{tmp_path.sub(/\\/[^\\/]+$/, '')}\" #this is the parent to the tmp_path\n run \"mkdir -m 0777 -p #{tmp_path}\" #the temp path dir\n end",
"title": ""
},
{
"docid": "8e40b0699daa23b47484bc6e4a7767a2",
"score": "0.6313767",
"text": "def create_remote_authorized_key_file(host, ssh_username, password, key, remote_dot_ssh_path = \".ssh\", target_username = nil)\n\n remote_authorized_keys_path = remote_dot_ssh_path + \"/authorized_keys\"\n \n begin \n \n Net::SFTP.start(host, ssh_username, :password => password) do |sftp| \n #TODO Smarter way to determine home directory\n stats = sftp.stat!(\"/home/#{target_username}\") if target_username\n \n begin\n sftp.mkdir!(remote_dot_ssh_path)\n sftp.setstat(remote_dot_ssh_path, :uid => stats.uid, :gid => stats.gid) if target_username\n rescue Net::SFTP::StatusException => e\n # Most likely the .ssh folder already exists raise again if not.\n raise e unless e.code == 4\n end\n sftp.upload!(key[:path].to_s, remote_authorized_keys_path)\n sftp.setstat(remote_authorized_keys_path, :uid => stats.uid, :gid => stats.gid) if target_username \n end \n rescue Net::SSH::AuthenticationFailed => e\n create_remote_authorized_key_file(host, ssh_username, ask_for_ssh_password(ssh_username), key, remote_dot_ssh_path, target_username)\n end\n \n end",
"title": ""
},
{
"docid": "9d27d0df71b9a60005325d022ad67680",
"score": "0.62930775",
"text": "def create_folder\n\tDir.mkdir(\"C:/Users/Hery Mirindra/Desktop/New folder\")\nend",
"title": ""
},
{
"docid": "6f8c6848dabe730a93ae1bf62058e121",
"score": "0.62851363",
"text": "def create_skel_dirs\n userHome = new_resource.home || \"/home/#{ new_resource.name }\"\n\n new_resource.skel_dirs.each do |skelDir|\n Chef::Log.debug \"Adding user skel directory '#{userHome}/#{ skelDir }'\"\n\n directory \"#{ userHome }/#{ skelDir }\" do\n owner new_resource.name\n group new_resource.primary_group || new_resource.name\n recursive true\n path \"#{ userHome }/#{ skelDir }\"\n mode new_resource.skel_dirs_mode\n action :create\n end\n end\nend",
"title": ""
},
{
"docid": "7e04b84fff88a949e98be28e8cd77601",
"score": "0.62835073",
"text": "def mkdir(dir)\n system \"install -d -o #{$www_user} -g #{$www_group} #{dir}\"\nend",
"title": ""
},
{
"docid": "5d9c1d5ace23de050f44827569a2335e",
"score": "0.6249178",
"text": "def create_dir path\n ::Dir.mkdir path\n end",
"title": ""
},
{
"docid": "38d4cffdb6765a06631e40b2858e3f4b",
"score": "0.6240169",
"text": "def create_home\n create_dirs\n copy_files\n create_vimrc\n end",
"title": ""
},
{
"docid": "644a15e074d80cb714b031ece44e84db",
"score": "0.6218725",
"text": "def directory(param_hash)\n case param_hash[\"action\"]\n when \"create\"\n output = param_hash[:ssh].exec!(\"mkdir #{param_hash[\"remote_directory\"]}\").chomp\n if output.empty?\n puts \"#{param_hash[\"remote_directory\"]} created successfully\"\n else\n puts \"Error creating directory: '#{output}'\"\n end\n when \"delete\"\n output = param_hash[:ssh].exec!(\"rmdir #{param_hash[\"remote_directory\"]}\").chomp\n if output.empty?\n puts \"#{param_hash[\"remote_directory\"]} removed successfully\"\n else\n puts \"Error removing directory: '#{output}'\"\n end\n end\n end",
"title": ""
},
{
"docid": "bbb2908b7df87a2a16fb31d1e5fab57e",
"score": "0.6216315",
"text": "def ftp_mkdir(params)\n params_desc = {\n :username => { :mandatory => false, :type => :string },\n :password => { :mandatory => false, :type => :string },\n :host => { :mandatory => true, :type => :string },\n :dir => { :mandatory => true, :type => :string }\n }\n check_parameters(params, params_desc)\n username = params[:username]\n password = params[:password]\n host = params[:host]\n dir = params[:dir]\n basename = File.basename(dir)\n puts \"Making directory '#{basename}'...\"\n begin\n Net::FTP.open(host) do |ftp|\n ftp.login(username, password)\n ftp.mkdir(dir)\n ftp.close\n end\n rescue Exception\n error \"Error making directory '#{basename}': #{$!}\"\n end\n end",
"title": ""
},
{
"docid": "ef2228acfd5be6007def4f8eca0b1143",
"score": "0.6203113",
"text": "def create_remote_path(ftp)\n path_parts = []\n remote_path.split(\"/\").each do |path_part|\n path_parts << path_part\n begin\n ftp.mkdir(path_parts.join(\"/\"))\n rescue Net::FTPPermError; end\n end\n end",
"title": ""
},
{
"docid": "005d05a4d53cbe590fd8cf9baa29c451",
"score": "0.61964786",
"text": "def ssh_wrapper_for_user(username)\n File.join(WORKING_DIR, \"#{username}-ssh-wrapper\")\nend",
"title": ""
},
{
"docid": "5241240aa6727bec92e80c8dbbb97f68",
"score": "0.6187009",
"text": "def mount_shared_folder(ssh, name, guestpath); end",
"title": ""
},
{
"docid": "4637666acd51cee06c74a9e0e8128345",
"score": "0.61810833",
"text": "def create_path_in_home(*path)\n path = File.join(Dir.home, *path)\n FileUtils.mkpath(path)\n end",
"title": ""
},
{
"docid": "d38bad4cfbf2d275a3f7eedaaaf98dde",
"score": "0.61741245",
"text": "def create_remote_directories(ftp)\n path_parts = Array.new\n remote_path.split('/').each do |path_part|\n path_parts << path_part\n begin\n ftp.mkdir(path_parts.join('/'))\n rescue Net::FTPPermError; end\n end\n end",
"title": ""
},
{
"docid": "f6a4219de901eda813740d83d4f8a805",
"score": "0.6165426",
"text": "def create_dir(dir, user = 'root', group = 'root')\n subdirs = subdirs_to_create(dir, user)\n subdirs.each do |dir|\n directory dir do\n action :create\n recursive true\n owner user\n group group\n end\n end\nend",
"title": ""
},
{
"docid": "86f7ae049411c73f8b0ea14fdbe38bfb",
"score": "0.6158394",
"text": "def mkdir(directory)\n FileUtils.mkdir_p \"#{@home}/#{directory}\"\n end",
"title": ""
},
{
"docid": "1dec02f81d0459e491236fe007fd6848",
"score": "0.61385363",
"text": "def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "1dec02f81d0459e491236fe007fd6848",
"score": "0.61385363",
"text": "def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "1dec02f81d0459e491236fe007fd6848",
"score": "0.61385363",
"text": "def mkdir(path)\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "e69a1d49022744a60eb97f8dfa458baa",
"score": "0.6132489",
"text": "def create_image_folder\n\t\treturn unless self.user_role == \"presenter\"\n dirname = \"#{Rails.root}/uploads/#{self.meeting_id}/#{self.user_id}\"\n FileUtils.mkdir_p(dirname) unless File.directory?(dirname)\n FileUtils.mkdir_p(\"#{dirname}/imgs\") unless File.directory?(\"#{dirname}/imgs\")\n # FileUtils.mkdir_p(\"#{dirname}/box\") unless File.directory?(\"#{dirname}/box\")\n end",
"title": ""
},
{
"docid": "2bcc2dfdf11cece09b8f7dcb030e2104",
"score": "0.6118903",
"text": "def make_dir\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "74746620f1da9f8d7535359c301855ca",
"score": "0.6117956",
"text": "def create_paths\n paths = [@config[:releases_dir], @config[:temp_dir], @config[:shared_dir]]\n @remote_shell.run(paths.collect { |path| \"mkdir -p '#{@config[:remote_path]}/#{path}'\" })\n end",
"title": ""
},
{
"docid": "761f619a200e1840b2460e8f8a9c98f2",
"score": "0.61120623",
"text": "def mkdir(path)\n path = @path.join path\n FileUtils.mkpath path\n end",
"title": ""
},
{
"docid": "216a43c2a31f7e91f542e32b8d2ef3ca",
"score": "0.6101399",
"text": "def mkdir!(path, directory_permissions); end",
"title": ""
},
{
"docid": "d4b30006bdce26ac268cee11b4e800c8",
"score": "0.6092328",
"text": "def make_directory(path)\n Log.info \"#@deployment_name: Making directory structure '#{path}'...\"\n execute \"mkdir -p #{path}\"\n end",
"title": ""
},
{
"docid": "d84a7a3b50c4114d73f696728114e9f5",
"score": "0.6090961",
"text": "def create_directory\n # Use FileUtils\n fu = FileUtils\n # If we're just running as a simulation\n if $simulate\n # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils\n fu = FileUtils::DryRun # ::DryRun / ::NoWrite\n end\n\n # Get the default user path ...\n user_path = USER_PATH\n # Replace the placeholders with the domain\n user_path['%user'] = ''\n user_path['%domain'] = $domain\n\n # Concat the paths of the directories we should create\n mail_dir = BASE_PATH_MAIL + user_path \n home_dir = BASE_PATH_HOME + user_path\n\n puts \"> Skapar kataloger\".green\n\n # Create the directories (the full path)\n fu.mkdir_p mail_dir\n fu.mkdir_p home_dir\n\n # Tell the user what's going on\n puts \"> Ändrar ägare och rättigheter för katalogerna\".green\n\n # Check to see if we have root privileges\n if is_root?\n # Change the ownerships of the directories\n fu.chown_R $uid, $gid, mail_dir\n fu.chown_R $uid, $gid, home_dir\n # not root!\n else\n # Let the user know that we couldn't change the owner of the directories\n puts \"\\nOBS!!!\".red\n puts \"Kan inte ändra ägare och grupp för katalogerna, då skriptet inte körs som root!\".red\n puts \"Vänligen se till att katalogerna får rätt ägare genom att köra följande kommandon som root:\".red\n print \"\\n\"\n # Use ::DryRun to let the user know what commands to run\n FileUtils::DryRun.chown_R $uid, $gid, mail_dir\n FileUtils::DryRun.chown_R $uid, $gid, home_dir\n\n print \"\\n\"\n end\n\n # Change the rights of the directories\n fu.chmod_R MAILBOX_RIGHTS, mail_dir\n fu.chmod_R MAILBOX_RIGHTS, home_dir\nend",
"title": ""
},
{
"docid": "f4f6b1abb0a226c1e0c2a399fd29589f",
"score": "0.6088815",
"text": "def create_url(path)\n FileUtils.cd(Rails.root.join(Rails.public_path).to_s)\n unless File.directory?(path)\n FileUtils.mkdir_p(path)\n end\n end",
"title": ""
},
{
"docid": "6abe33a983430369fa5095194b37fa17",
"score": "0.607865",
"text": "def create_authorized_keys_file(connection, stdout)\n connection.exec!(\"touch ~/.ssh/authorized_keys\")\n stdout << \"- Created ~/.ssh/authorized_keys\\n\"\nend",
"title": ""
},
{
"docid": "22e3337c688aee3edcb5bf0d6c05f87b",
"score": "0.6077056",
"text": "def create\n FileUtils.mkdir path unless exist?\n end",
"title": ""
},
{
"docid": "d9b3d6956042c9fcb5faeef2ac3b86f5",
"score": "0.6068261",
"text": "def install_root_ssh_key!\n command = \"mkdir -p $HOME/.ssh; echo '#{ssh_key}' >> $HOME/.ssh/authorized_keys;\"\n command += \"chmod 700 $HOME/.ssh; chmod 600 $HOME/.ssh/authorized_keys\"\n execute_as_root(command)\n end",
"title": ""
},
{
"docid": "8cf832ceea3a4eebb138c8a0d7ac6900",
"score": "0.6064955",
"text": "def create!\n Dir.mkdir(path)\n end",
"title": ""
},
{
"docid": "d6f337da372f39281d3ff955e53b4b73",
"score": "0.6062469",
"text": "def createfolder(name)\n @session.add_folder(name, 0)\n end",
"title": ""
},
{
"docid": "f34b6deec4d47076052e4e25ea51f712",
"score": "0.60553783",
"text": "def create_directory\n directory new_resource.destination do\n group new_resource.group if new_resource.group\n owner new_resource.user if new_resource.user\n # There is explicitly no mode being set here. If a non-default mode\n # is needed, you should manage that outside of poise_archive.\n end\n end",
"title": ""
},
{
"docid": "d3e89335715ca894c5c05ced7dd5320c",
"score": "0.6055045",
"text": "def prepare_folders\n synced_folders.each do |id, options|\n hostpath = Pathname.new(options[:hostpath]).expand_path(@env[:root_path])\n\n if !hostpath.directory? && options[:create]\n # Host path doesn't exist, so let's create it.\n @logger.debug(\"Host path doesn't exist, creating: #{hostpath}\")\n\n begin\n hostpath.mkpath\n rescue Errno::EACCES\n raise Vagrant::Errors::SharedFolderCreateFailed,\n :path => hostpath.to_s\n end\n end\n end\n end",
"title": ""
},
{
"docid": "1fbc0d3abea8f27d7e7ef40eedef6544",
"score": "0.6051012",
"text": "def create\n FileUtils.mkdir_p path\n end",
"title": ""
},
{
"docid": "f1f974ff7fd0248a7eff13a1cc9976c5",
"score": "0.6045632",
"text": "def create\n FileUtils.mkdir_p @path\n end",
"title": ""
},
{
"docid": "f395baf0f3b768663618461a97a30563",
"score": "0.6041533",
"text": "def create_synced_dir(config, host_dir, vm_dir, owner = 'vagrant', group = 'vagrant')\n config.vm.synced_folder host_dir, vm_dir, owner: owner, group: group if File.directory?(host_dir)\nend",
"title": ""
},
{
"docid": "15753d9c62f45f5bacbeb858f13c8a23",
"score": "0.60276145",
"text": "def mkdir!\n FileUtils.mkdir_p(dir_path)\n end",
"title": ""
},
{
"docid": "80ead4783a242d7f02b6a3e2689103e9",
"score": "0.60254985",
"text": "def mkdir(path, attrs); end",
"title": ""
},
{
"docid": "074a1be32e5d05f50b77f58b36ce8ffb",
"score": "0.6009342",
"text": "def make_dir(path)\n FileUtils.mkdir_p( path )\n end",
"title": ""
},
{
"docid": "37990d9d2ea9ec4e984676c8b1c58ce7",
"score": "0.6002735",
"text": "def make_dir(path)\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "e0f33c2af2fdb0b9464a35063ca26dec",
"score": "0.60010666",
"text": "def create!\n @dirs.each do |dir|\n FileUtils.mkdir_p(dir)\n end\n end",
"title": ""
},
{
"docid": "64cb5163b657d67e499b7d95b52e9193",
"score": "0.598595",
"text": "def create_directory(path)\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "816e24fa49a7a003e340fac863d2080d",
"score": "0.5984647",
"text": "def create!\n FileUtils.mkdir_p path unless exist?\n end",
"title": ""
},
{
"docid": "b42166f557c3ef53fe36a4c8e16ecf7d",
"score": "0.59840363",
"text": "def create_folder\n unless Dir.exist?(root)\n FileUtils.mkdir_p(root)\n end\n end",
"title": ""
},
{
"docid": "a759af26faf55b4086f42bb12b29df66",
"score": "0.5983198",
"text": "def create_directory\n directory new_resource.path do\n group new_resource.group\n mode '700'\n owner new_resource.owner\n end\n end",
"title": ""
},
{
"docid": "a1de9f92b091c105d71065d07531b320",
"score": "0.598245",
"text": "def make_path(path)\n FileUtils.mkdir_p(path)\n end",
"title": ""
},
{
"docid": "7777122fd3a5f7fc20bac0d90ddb187a",
"score": "0.5979377",
"text": "def make_dirs(dirs,ownedby='root')\n dirs.each do |thisdir|\n directory thisdir do\n action :create\n user ownedby\n group ownedby\n mode '755'\n recursive true\n end\n end\n end",
"title": ""
},
{
"docid": "be414e795474fe0942110c07c3a81fa4",
"score": "0.59785753",
"text": "def create_teachers_users\n @teachers.each do |teacher|\n first_name, last_name = teacher[:name].split(' ').map(&:downcase)\n new_dir = \"#{ENV['USERS_PATH']}/#{first_name}_#{last_name}\"\n system \"mkdir -p #{new_dir}\"\n system \"touch #{new_dir}/nouveau_mdp.txt\"\n end\n end",
"title": ""
},
{
"docid": "f6fb38a17011b2c0a391008302b5b327",
"score": "0.5978291",
"text": "def create_directory\n connection.directories.create({\n :key => fog_directory,\n :public => true\n })\n end",
"title": ""
},
{
"docid": "aafbaf987aa71ede88d290517c362bf3",
"score": "0.5977558",
"text": "def build_ssh(options = {}, path = '')\n options[:user] = user :allow\n options[:server] = server :allow\n options[:path] = remote_path path\n\n build options\n end",
"title": ""
},
{
"docid": "dd30be5577df0af4c4fb3a56870c4a84",
"score": "0.59771216",
"text": "def make_dir up_to_path = nil\n up_to_path ||= path\n `if [ ! -d \"#{up_to_path}\" ];then mkdir -p \"#{up_to_path}\";fi`\n end",
"title": ""
},
{
"docid": "fe77fd3f87ac5a0c569af5dd21586035",
"score": "0.59579295",
"text": "def create_project\n run \"mkdir /home/#{project_name}\"\n run \"mkdir /home/#{project_name}/config\"\n run \"mkdir /home/#{project_name}/shared\"\n run \"mkdir /home/#{project_name}/shared/pids\"\n run \"mkdir /home/#{project_name}/shared/sockets\"\n run \"mkdir /home/#{project_name}/shared/db\"\n run \"mkdir /home/#{project_name}/shared/db/sphinx\"\n run \"chown -R #{project_name}:#{project_name} /home/#{project_name}\"\n end",
"title": ""
},
{
"docid": "06befc2a2f041460c085195e1dea051e",
"score": "0.5957082",
"text": "def get_ssh_dir_for_user(username)\n # Set home_basedir based on platform_family\n case node['platform_family']\n when 'mac_os_x'\n home_basedir = '/Users'\n when 'debian', 'rhel', 'fedora', 'arch', 'suse', 'freebsd'\n home_basedir = '/home'\n end\n\n # First we try to read the user's home directory from the username\n # If that fails then we manually handle the home directory path generation\n begin\n home_dir = ::File.expand_path(\"~#{username}\")\n rescue\n # Set home to a reasonable default ($home_basedir/$user).\n # Root user is a special use case\n if username == \"root\"\n home_dir = \"/#{username}\"\n else\n home_dir = \"#{home_basedir}/#{username}\"\n end\n end\n\n return \"#{home_dir}/.ssh\"\n end",
"title": ""
},
{
"docid": "7a51bed43e41003584d5dd5bde1a8f35",
"score": "0.5955717",
"text": "def create_dir path\n path = with_root path\n ::Dir.mkdir path\n end",
"title": ""
},
{
"docid": "45f57015ee199ae8699555d869b1759c",
"score": "0.5936941",
"text": "def create_synced_dir(config, host_dir, vm_dir, options = {})\n config.vm.synced_folder host_dir, vm_dir, options if File.directory?(host_dir)\nend",
"title": ""
},
{
"docid": "45f57015ee199ae8699555d869b1759c",
"score": "0.5936941",
"text": "def create_synced_dir(config, host_dir, vm_dir, options = {})\n config.vm.synced_folder host_dir, vm_dir, options if File.directory?(host_dir)\nend",
"title": ""
}
] |
492ccacb4d24eacd3267f698edf3761e
|
Provided num_one and provided num_two must be rational numbers or ints. Returns the remainder of num_one divided by num_two.
|
[
{
"docid": "a931f986a8b4f90b337edcc6073da192",
"score": "0.66351455",
"text": "def mod(num_one, num_two)\n return num_one % num_two\nend",
"title": ""
}
] |
[
{
"docid": "b4850c67cba8ff9cffbb62cde3c27f23",
"score": "0.74463",
"text": "def divide_remainder(num1, num2)\n num1 / num2.to_f\nend",
"title": ""
},
{
"docid": "d41e1b2c80220fc325a5eadc034d4665",
"score": "0.7190836",
"text": "def division (first_number, second_number)\n\t\tif second_number == 0\n\t\t\tnil\n\t\telse\nanswer = first_number / second_number\nanswer\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b9b71fac67479197d7ff151afdb84ed0",
"score": "0.70895135",
"text": "def div(first_number, second_number)\n first_number / second_number \nend",
"title": ""
},
{
"docid": "a680b9520300419368d298e6f954bec6",
"score": "0.706628",
"text": "def divmod(num1, num2)\n quotient, remainder = num1.divmod(num2)\n puts \"quotient is #{quotient} remainder is #{remainder}\"\nend",
"title": ""
},
{
"docid": "15eb1efe40af447e69dc1841d3b8bc3e",
"score": "0.70304245",
"text": "def divide_with_remainder\n number1 = get_a_number\n number2 = get_a_number\n\n quotient = number1 / number2\n remainder = number1 % number2\n puts \"the answer is #{quotient} remainder #{remainder}\"\nend",
"title": ""
},
{
"docid": "1c1cd1c9acf1e70ba22d8e632d6145f0",
"score": "0.69977003",
"text": "def division(num1, num2)\n\tquotient=num1/num2\nend",
"title": ""
},
{
"docid": "1c1cd1c9acf1e70ba22d8e632d6145f0",
"score": "0.69977003",
"text": "def division(num1, num2)\n\tquotient=num1/num2\nend",
"title": ""
},
{
"docid": "d818cc09ab096644a3758d6216557f43",
"score": "0.6992961",
"text": "def dividing_integers\n integer1 = get_number\n integer2 = get_number\n integer_divide = integer1/integer2\n remainder = integer1%integer2\n puts \"The answer is #{integer_divide} with a remainder of #{remainder}\"\nend",
"title": ""
},
{
"docid": "ecce03f862467601803e32620aec8ad7",
"score": "0.69873273",
"text": "def division(arg1, arg2)\n\t\tnum, denom = reduc_num(arg1, arg2)\n\t\t\n\t\tnum *= @denom\n\t\tdenom *= @num\n\t\t\n\t\ta, b = reduc_num(denom, num)\n\t\t\n\t\treturn a, b\n\tend",
"title": ""
},
{
"docid": "dff65801bd3b47321161833c877aaed3",
"score": "0.69713587",
"text": "def remainder (int1, int2)\n\tquotient = int1 / int2\n\tremainder = int1 % int2\n\tputs \"#{int1} / #{int2} = #{quotient} r #{remainder}\"\nend",
"title": ""
},
{
"docid": "6868b6676467e0a0abb234809986cc41",
"score": "0.69580334",
"text": "def remainder(num1, num2)\n return num1 % num2\nend",
"title": ""
},
{
"docid": "5df0da1241c4f1d8c30cf243d8458948",
"score": "0.68918574",
"text": "def get_remainder(num1, num2) #num1 and num2 are taken as parameters\n\tputs \"#{num1} divided by #{num2} is #{num1/num2}, and the remainder is #{num1%num2}\" #values are interpolated into a string\nend",
"title": ""
},
{
"docid": "e18ca2770c5da2da538438b364258f8c",
"score": "0.6849675",
"text": "def divide_first_by_the_second(first_number_argument, second_number_argument)\n return first_number_argument / second_number_argument.to_f\n end",
"title": ""
},
{
"docid": "8527d28d6da92ce08e4e101404dc4af6",
"score": "0.68446153",
"text": "def division(num1, num2)\n small, big = [num1, num2].sort\n divisors = []\n 1.upto(small) do |divisor|\n divisors << divisor if small % divisor == 0\n end\n divisors.reverse.each do |divisor|\n return divisor if big % divisor == 0\n end\nend",
"title": ""
},
{
"docid": "82bc6624863f2404725309a69eba0c1c",
"score": "0.68262076",
"text": "def divide(first_number, second_number)\n first_number.to_f / second_number.to_f\nend",
"title": ""
},
{
"docid": "f5b9bc685fc59d203e3c29d7c10aeecd",
"score": "0.68211865",
"text": "def division(num1, num2)\n return num1 / num2\nend",
"title": ""
},
{
"docid": "1dcf0a60fb0dd7f4f99e0ddd06f55407",
"score": "0.68070805",
"text": "def %(other)\t\t\t\t\t\t\t\t\t\t#Obtenemos el resto de la division de dos fracciones\t\t\t\t\t\t\t\t\n\t\taux1 = self.numer * other.denomin\t\t\t\t#Multiplicamos el numerador de la primera entre el denominador de la segunda\n\t\taux2 = self.denomin * other.numer\t\t\t\t#Multiplicamos el denominador de la primera entre el numerador de la segunda\n\t\tresto = aux1%aux2\t\t\t\t\t\t\t\t#Obtenemos el Resto de la fraccion resultante\n\tend",
"title": ""
},
{
"docid": "3c03d0cf71f68e32cd813e583db49e12",
"score": "0.6802039",
"text": "def divide_with_remainder\n number1 = get_a_number\n number2 = get_a_number\n # quotient\n quotient = number1 / number2\n # remainder\n remainder = number1 % number2\n\n # return both\n # Tell the user the answer with a remainder\n puts \"The answer is #{quotient} remainder #{remainder}.\"\nend",
"title": ""
},
{
"docid": "538273ee70dd1fe5dd3ebf217c9cc1e3",
"score": "0.67997986",
"text": "def dec_remainder_of_two_integers(i_dividend, i_divisor)\n # your code goes here\n dec_remainder_of_two_floats(i_dividend.to_f, i_divisor.to_f)\nend",
"title": ""
},
{
"docid": "8f35dd378704ebb55a304d8983c2e7a5",
"score": "0.67958105",
"text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n (f_dividend/f_divisor).modulo(1)\nend",
"title": ""
},
{
"docid": "761c1c65e7a80459a5cae9c325baaab3",
"score": "0.6782426",
"text": "def div_em_out(num1, num2)\n\tif num1 < num2\n\t\tdiv = num2 / num1\n\telse\n\t\tdiv = num1 / num2\n\tend\nend",
"title": ""
},
{
"docid": "5b03eb8494b995d03cd29bf2e3fff6e3",
"score": "0.67616653",
"text": "def remainder(arr_one, arr_two, sig_dig=2)\n raise ArgumentError, 'First argument is not an array' unless arr_one.is_a? Array\n\n result = []\n\n arr_two = arr_two.class != Array ? make_array(arr_two) : arr_two\n\n if arr_one.length != arr_two.length\n length_matched_arrays = update_array_length(arr_one, arr_two)\n\n length_matched_arrays[0].each_with_index do |value, index|\n if length_matched_arrays[1][index] == 0\n result << \"Divide by 0 error\"\n else\n result << (value.to_f % length_matched_arrays[1][index]).round(sig_dig)\n end\n end\n else\n arr_one.each_with_index do |value, index|\n if arr_two[index] == 0\n result << \"Divide by 0 error\"\n else\n result << (value.to_f % arr_two[index]).round(sig_dig)\n end\n end\n end\n\n return result\n end",
"title": ""
},
{
"docid": "16bffafe94743f50b3d2027f0b540cce",
"score": "0.67577004",
"text": "def dec_remainder_of_two_integers(i_dividend, i_divisor)\n dec_remainder_of_two_floats(i_dividend.to_f, i_divisor.to_f)\nend",
"title": ""
},
{
"docid": "16bffafe94743f50b3d2027f0b540cce",
"score": "0.67577004",
"text": "def dec_remainder_of_two_integers(i_dividend, i_divisor)\n dec_remainder_of_two_floats(i_dividend.to_f, i_divisor.to_f)\nend",
"title": ""
},
{
"docid": "89ac578a66d151c5286e32c99f5a9dec",
"score": "0.6740817",
"text": "def divide(op1, op2)\n [op1, op2].all? { |value| Integer === value } ? \\\n Rational(op1, op2) : op1.to_f / op2\n end",
"title": ""
},
{
"docid": "05e811aa4b9aee940bce5b665613c5df",
"score": "0.67206377",
"text": "def dec_remainder_of_two_integers(i_dividend, i_divisor)\n # your code goes here\n dec_remainder_of_two_floats(i_dividend.to_f, i_divisor.to_f)\n end",
"title": ""
},
{
"docid": "3f11aee265291b4420dfc835ffbd0156",
"score": "0.6717991",
"text": "def dec_remainder_of_two_integers(i_dividend, i_divisor)\n # your code goes here\n dec_remainder_of_two_floats(i_dividend.to_f,i_divisor)\nend",
"title": ""
},
{
"docid": "7f131281b75ee26fa8e96e3f4eedc366",
"score": "0.67153776",
"text": "def divide(num_one, num_two)\n if num_two == 0\n puts \"😱 Can't divide by 0! 😵\"\n exit\n end\n return num_one / num_two\nend",
"title": ""
},
{
"docid": "0de66960226c68c0995813c340239036",
"score": "0.671333",
"text": "def modulo(num1, num2)\n\tremainder=num1%num2\nend",
"title": ""
},
{
"docid": "917d9c70ba71f8df0dfce2532e9249b3",
"score": "0.6705284",
"text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n puts (f_divisor/f_dividend).round(1)\nend",
"title": ""
},
{
"docid": "744e68f9031fc057054157bd402cd24a",
"score": "0.66759926",
"text": "def divide(op1, op2)\n [op1, op2].all? { |value| Integer === value } ?\n Rational(op1, op2) :\n op1.to_f / op2\n end",
"title": ""
},
{
"docid": "9fcf3138391e57bab5d018cee8611588",
"score": "0.6659447",
"text": "def division(number1, number2)\n\ttotal = number1 / number2\n\tp total\nend",
"title": ""
},
{
"docid": "0d0a83b492a80e1421459325fe222794",
"score": "0.66512924",
"text": "def divide(first_number, second_number)\nreturn first_number / second_number\nend",
"title": ""
},
{
"docid": "26600e0984321fcb290c2bcbd0305fd4",
"score": "0.66488",
"text": "def quotient (int1, int2)\n\tint1 / int2\nend",
"title": ""
},
{
"docid": "1ea05d733c8d19d98a4548bd90eb1655",
"score": "0.6644394",
"text": "def div(n1,n2)\r\n\r\n @num1=n1\r\n @num2=n2\r\n\r\n print \"The division is : #{@num1.to_i/@num2.to_i}\\n\"\r\n \r\n end",
"title": ""
},
{
"docid": "159c462e54a07cbc75d1ac6ed5b8a513",
"score": "0.66427475",
"text": "def /(other)\n BigNum.ensure_bignum! other\n divmod(other).first\n end",
"title": ""
},
{
"docid": "f1111b708fabf1a04250820b96e22868",
"score": "0.66273046",
"text": "def div(a,b)\n a.to_i * inv(b.to_i)\n end",
"title": ""
},
{
"docid": "045c99c6fd5c7cc78da8481c298cbeff",
"score": "0.6594369",
"text": "def divmod(other)\n value = (self / other).to_i\n return value, self - other * value\n end",
"title": ""
},
{
"docid": "83374ebfd2f6b1bc169ca97260a5fd35",
"score": "0.6583819",
"text": "def remainder(numerator, denominator)\n leftover = numerator.fdiv denominator\n (denominator * (leftover - leftover.floor)).ceil\nend",
"title": ""
},
{
"docid": "cd6b6da989a346cb0068eb45d36a08e7",
"score": "0.6583188",
"text": "def division(num1, num2)\n quotient = num1 / num2\n p quotient\nend",
"title": ""
},
{
"docid": "fd58be3330cbb3302850dc12739b391a",
"score": "0.6572784",
"text": "def divide(num_1, num_2)\n num_1.to_f / num_2.to_f\nend",
"title": ""
},
{
"docid": "c67dbcdf8333a039a3aedbb7b2504fdf",
"score": "0.6571674",
"text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n f_quotient = f_dividend / f_divisor\n f_quotient - f_quotient.to_i\nend",
"title": ""
},
{
"docid": "be448276d014249328791bf00423a5f3",
"score": "0.65666646",
"text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n res = f_dividend / f_divisor\n puts res\n #res.modulo(1)\n res = res - res.to_i\n end",
"title": ""
},
{
"docid": "5be968b9ab23e778cda0d13be2492c98",
"score": "0.6558661",
"text": "def quotient(a, b) a / b; end",
"title": ""
},
{
"docid": "c6dd27ea57e9c7583ec119f8bf28e1fb",
"score": "0.6528336",
"text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n divis_value = f_dividend / f_divisor\n divis_value - divis_value.floor\nend",
"title": ""
},
{
"docid": "d861e356b9f934e2daa5f24595f08e09",
"score": "0.6511548",
"text": "def r_div(a, b)\n r2n(a / b.to_r)\n end",
"title": ""
},
{
"docid": "625c2a9708e8db8258fbfe34d0beb712",
"score": "0.6474433",
"text": "def divide(n1, n2)\n return n1.to_f / n2.to_f\nend",
"title": ""
},
{
"docid": "ad7d6a1394194022fd80e47e1a1ebc48",
"score": "0.6447385",
"text": "def first_int_divby_second(first, second)\n first / second\nend",
"title": ""
},
{
"docid": "2f5cfed82ec9a47c4cbe80dbf345b1ee",
"score": "0.6439452",
"text": "def divide(num1, num2)\n return\nend",
"title": ""
},
{
"docid": "eca7938b0860dca8caf33060978aba4c",
"score": "0.6429994",
"text": "def returned_output(num1, num2)\n num3 = num1.divmod(num2) \n \n return num3\nend",
"title": ""
},
{
"docid": "2ed8d57e27e2ddc23643e3a86f08757e",
"score": "0.64282453",
"text": "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n n = f_dividend / f_divisor\n n - n.floor\n end",
"title": ""
},
{
"docid": "d87a07a29639868c55798d0cb1544ec8",
"score": "0.6426779",
"text": "def div(n1, n2)\nend",
"title": ""
},
{
"docid": "8354df224b504030fe248fd6b1da4ed5",
"score": "0.642159",
"text": "def first_int_divby_remainder(first, second)\n first % second\nend",
"title": ""
},
{
"docid": "759880aea412adbd17e22343936a6e71",
"score": "0.6417525",
"text": "def remainder(a,b)\n @@num_of_calc += 1\n puts \"Status: Total calculations #{@@num_of_calc}\"\n result = a % b\n puts \"Answer: The remainder of #{a} divided by #{b} is #{result}\"\n end",
"title": ""
},
{
"docid": "9f02b42444bcb3c6939ebbc91734ce09",
"score": "0.6414791",
"text": "def div(num1, num2)\n if(num1.is_a?(Integer) || num1.is_a?(Float))\n return \"happy\"\n end\n # if(!num2.is_a?(Integer) || !num2.is_a?(Float))\n # return \"The second argument was not a valid input\"\n # end\n return \"The first argument was not a valid input\"\nend",
"title": ""
},
{
"docid": "70c6ff928c72eb13cb7798821caf95e6",
"score": "0.6406637",
"text": "def divide(number_one, number_two)\n puts number_one / number_two\nend",
"title": ""
},
{
"docid": "43070eaad72c21dfb038066822bbd857",
"score": "0.6401839",
"text": "def modulo(num1, num2)\n remainder = num1 % num2\n p remainder\nend",
"title": ""
},
{
"docid": "df26fc261a37680b50a43039f7359c26",
"score": "0.6394571",
"text": "def greatest_common_divisor_rec_mod(number1, number2)\n if number2 == 0\n number1\n else\n greatest_common_divisor_rec_mod(number2, number1 % number2)\n end\nend",
"title": ""
},
{
"docid": "5de03afc4fa2d31d69b8964da52b8703",
"score": "0.63919467",
"text": "def divide(num1, num2)\n num1 / num2\nend",
"title": ""
},
{
"docid": "0f2005715bbc44328e526cef706fd043",
"score": "0.63654476",
"text": "def div\n puts 'Give me a number.'\n num1 = gets.chomp.to_i\n puts 'One more number please'\n num2 = gets.chomp.to_i\n if num1 == 0 || num2 == 0\n puts 'Sorry give me 2 more numbers.'\n div\n else\n puts (num1.divmod(num2))\n end\nend",
"title": ""
},
{
"docid": "b466eebf3506157aeb05f8738cfda24c",
"score": "0.63634366",
"text": "def divide (num1, den1, num2, den2)\n change = den1\n\tden1 = den2\n\tden2 = change\n\toutputFrac = (multiply num1, den1, num2, den2)\nend",
"title": ""
},
{
"docid": "2127f524c6b1f81657eb4edbb8032d48",
"score": "0.63517404",
"text": "def modulus(num1, num2)\n answer = num1 % num2\n return answer\nend",
"title": ""
},
{
"docid": "6f6043d115cbd684a9e1170ad47a9777",
"score": "0.63488233",
"text": "def %(other) # Calcula el resto al dividir dos fracciones (modulo)\n result = self./(other)\n result = (result.numerador%result.denominador).to_i\n end",
"title": ""
},
{
"docid": "59ec6755a14f50281aa0d6461ec91efc",
"score": "0.6348782",
"text": "def greatest_common_divisor_it_mod(number1, number2)\n while number2 != 0\n stored = number1\n number1 = number2\n number2 = stored % number2\n end\n number1\nend",
"title": ""
},
{
"docid": "a5063274a8536b691db3cced5351c530",
"score": "0.6340817",
"text": "def div(a, b)\n q, r = bld(abs(a), abs(b))\n if sign(a) == sign(b)\n return q\n else\n return -q\n end\n end",
"title": ""
},
{
"docid": "b9f80213a6bf91fcfa23f7537d8edacd",
"score": "0.6335663",
"text": "def divide(one, two)\r\n return \"Non penso proprio\" if two == 0\r\n one / two\r\nend",
"title": ""
},
{
"docid": "b4abd3ab56fce753c7998aac32b61d73",
"score": "0.6335367",
"text": "def my_modulo(first_number_argument, second_number_argument)\n return first_number_argument % second_number_argument\n end",
"title": ""
},
{
"docid": "7aab9cf5f875caae74341d1a413fb381",
"score": "0.63118666",
"text": "def remain(x,y)\n divide = x / y\n remainder = x % y\n if divide == 0\n puts \"The first number is smaller than the second, therefore there is no remainder.\"\n elsif divide > 0\n puts \"These numbers divide #{divide} times with a remainder of #{remainder}.\"\n end\nend",
"title": ""
},
{
"docid": "7ed1e367f009de52412c60e56cbbe201",
"score": "0.62821347",
"text": "def division(a, b)\n\t# 'a' and 'b' are converted in to floating point from strings and divided\n\treturn a.to_f / b.to_f\nend",
"title": ""
},
{
"docid": "858d42000efc85217b3f2d2b04d7e4c0",
"score": "0.6279029",
"text": "def %(other)\n BigNum.ensure_bignum! other\n divmod(other)[1]\n end",
"title": ""
},
{
"docid": "1b9a9c4fb160390fef07ce4dbe2f76f1",
"score": "0.62514657",
"text": "def divide_numbers(x, y)\n x.to_f / y.to_f\nend",
"title": ""
},
{
"docid": "1f0baafb4367511a4565a0b8aa06cc9c",
"score": "0.62483275",
"text": "def modulo_op(a, b)\n raise 'Can\\'t divide by zero.' if b.zero?\n\n if a > 0 && b > 0\n ((a.to_f / b.to_f - (a / b)) * b).round(0)\n else\n (((a.to_f / b.to_f) - (a / b)) * b).round(0)\n end\nend",
"title": ""
},
{
"docid": "ee9efaee56367594fefcd4dbbf7911af",
"score": "0.6239915",
"text": "def divmod(other)\n raise ArgumentError, \"Incompatible Units\" unless self =~ other\n if self.units == other.units\n return self.scalar.divmod(other.scalar)\n else\n return self.to_base.scalar.divmod(other.to_base.scalar)\n end\n end",
"title": ""
},
{
"docid": "988c7016316debbd733bfe1cdc590d6d",
"score": "0.6233466",
"text": "def divides?(a, b)\n if a < b && (b % a).zero?\n b / a\n elsif a > b && (a % b).zero?\n a / b\n elsif a == b\n a\n else\n 0\n end\nend",
"title": ""
},
{
"docid": "30d44826a7eb93b03b17b168f7ca9fe8",
"score": "0.62320125",
"text": "def helper(value1, value2)\n result = 0\n if value1 > value2\n result = value1 / value2\n else\n result = value2 / value1\n end\n result\n end",
"title": ""
},
{
"docid": "7838f3daad27453b70ca636bf9a097cd",
"score": "0.6209378",
"text": "def remainder(x,y)\n _convert(x).remainder(y,self)\n end",
"title": ""
},
{
"docid": "1945dc29730041e3619db77d4dcfb23e",
"score": "0.6202987",
"text": "def divide(a,b)\n a / b\n end",
"title": ""
},
{
"docid": "45049dd97d12ddcf29b5ebe66cb5f349",
"score": "0.6202462",
"text": "def divide(num1, num2)\n until num2 != 0\n print \"Please provide a divisor value greater than zero. > \"\n num2 = gets.chomp.to_i\n end\n return num2, num1 / num2\nend",
"title": ""
},
{
"docid": "1209ea9642070fabacfe349c987ea013",
"score": "0.61959344",
"text": "def _div # div a b -> (result)\r\n a, b = @operands\r\n var = read_byte\r\n\r\n raise 'divide by 0' if b == 0\r\n\r\n store var, ((sint16 a).idiv (sint16 b)) # integer division??\r\n end",
"title": ""
},
{
"docid": "259d339f21c6d105f0280cf6987b3121",
"score": "0.6193234",
"text": "def remainder(a, b)\n sortz = [a,b].sort\n if sortz[0] == 0\n return nil\n elsif sortz[1] == nil || sortz[0] == nil\n return nil\n else\n sortz[1] % sortz[0]\n end\nend",
"title": ""
},
{
"docid": "4da7c35b6d9eefd5d2f98812d57daeab",
"score": "0.61925787",
"text": "def divisor_func(a, b)\n a, b = b, a if a > b\n r = b % a\n while(r != 0)\n a, b = r, a\n r = b % a\n end\n return a\nend",
"title": ""
},
{
"docid": "de37dd615eee6fd61c4a34afbfdd20c2",
"score": "0.6152721",
"text": "def %(other)\n # Comprobacion en caso de que el numero a sumar no sea fraccionario. \n if other.instance_of? Fixnum\n c = Fraccion.new(other,1)\n division = Fraccion.new(@num * c.denom, @denom * c.num)\n else\n division = Fraccion.new(@num * other.denom, @denom * other.num)\n end \n division.num % division.denom\n end",
"title": ""
},
{
"docid": "21a15d15d60b06efb83726a2ffae9d5e",
"score": "0.61521626",
"text": "def divmod(other)\n BigNum.ensure_bignum! other\n normalize\n other.normalize\n if @d.length <= 256 or other.d.length <= 256\n return slow_divmod(other)\n else\n return fast_divmod(other)\n end \n end",
"title": ""
},
{
"docid": "1629a78941a89da53852f0eaac757783",
"score": "0.61462086",
"text": "def division(first_number, second_number)\n# Conditional that removes divide by zero error\nif second_number == 0\n\tnil\nelse\nif (first_number == \"\") || (second_number == \"\")\n\tnil\nelsif (first_number == []) || (second_number == [])\n\tnil\nelse\n\tanswer = first_number / second_number\nend\nend\n\tanswer\n\nend",
"title": ""
},
{
"docid": "130f47b576063c9a80b3592b471c49b2",
"score": "0.61372316",
"text": "def div(other)\n Rubinius.primitive :bignum_div\n redo_coerced :div, other\n end",
"title": ""
},
{
"docid": "8f52cc77c872217bce0ea2780a47945f",
"score": "0.61184883",
"text": "def divmod(other)\n if other.is_a?(Money)\n delimiter = other.exchange_to(currency).to_d\n quotient, remainder = to_d.divmod(delimiter)\n [quotient, build_new(remainder, currency)]\n else\n subunit_to_unit = currency.subunit_to_unit\n fractional.divmod(other).map { |x| build_new(x.to_d / subunit_to_unit, currency) }\n end\n end",
"title": ""
},
{
"docid": "e46bf2fbf14aa5e2480b78ebb4a241ea",
"score": "0.61161983",
"text": "def divide_numbers x, y\n# the above involves integer division - returns an int even if it shouldn't and\n# rounds it down. \n x.to_f / y\nend",
"title": ""
},
{
"docid": "d8810a3470253a12f1f62953c09c8c03",
"score": "0.6103221",
"text": "def fast_divmod(other)\n # Special-case 1 so we don't have to deal with its inverse.\n if other.d.length == 1 and other.d.first == Byte.one\n return self, BigNum.zero \n end\n \n ensure_inverse_exists other \n \n # Division using other's multiplicative inverse.\n bn_one = BigNum.one\n loop do\n quotient = (self * other.inverse) >> other.inverse_precision\n product = other * quotient\n if product > self\n product -= other\n quotient -= bn_one\n end\n if product <= self\n remainder = self - product\n if remainder >= other\n remainder -= other\n quotient += bn_one\n end\n return [quotient, remainder] if remainder < other\n end\n improve_inverse other\n end\n end",
"title": ""
},
{
"docid": "272f930afda117115eec073037e42f6f",
"score": "0.60920995",
"text": "def div (x, y)\n return (x . to_f / y) . to_i\nend",
"title": ""
},
{
"docid": "de8d89a071ed80ef6e4c0adc7b1e0e53",
"score": "0.60906243",
"text": "def accurate_division(int1, int2)\n accurate_quotient = ( int1.to_f ) / (int2.to_f)\nend",
"title": ""
},
{
"docid": "50962f1fd85ecdf31c300ffc0c07b437",
"score": "0.60736746",
"text": "def divideNumber2(number)\n p number /2\nend",
"title": ""
},
{
"docid": "6e0e9a3ee64106f1b953beaef78c25c3",
"score": "0.6045577",
"text": "def remainder(numeric)\n #This is a stub implementation, it may not coincide with the actual behavior of the method\n numeric\n end",
"title": ""
},
{
"docid": "6e0e9a3ee64106f1b953beaef78c25c3",
"score": "0.6045577",
"text": "def remainder(numeric)\n #This is a stub implementation, it may not coincide with the actual behavior of the method\n numeric\n end",
"title": ""
},
{
"docid": "39ac1f986cf6dbdb5c195d12919fb6ba",
"score": "0.6040414",
"text": "def divide(op1, op2)\n begin\n result = op1 / op2\n rescue ZeroDivisionError\n result = nil\n end\n result\n end",
"title": ""
},
{
"docid": "94479f8dff2a80cdfa61e6791335ab90",
"score": "0.6032172",
"text": "def get_remainder(num_array)\n\tnum_array.sort!\n\n\tquotient = num_array[1]/num_array[0]\n\tremainder = num_array[1]%num_array[0]\n\n\tputs \"The quotient of #{num_array[1]} and #{num_array[0]} is #{quotient} and the remainder is #{remainder}.\"\nend",
"title": ""
},
{
"docid": "ac0a8014bceeadfb0e50ef50d5b54b07",
"score": "0.6029811",
"text": "def divrem(x,y)\n _convert(x).divrem(y,self)\n end",
"title": ""
},
{
"docid": "0cadc743b835ad2f7d652c57355dce41",
"score": "0.60157144",
"text": "def div(x,y)\n\tx / y\nend",
"title": ""
},
{
"docid": "fa6576e792fa74e255beb72f7659dc04",
"score": "0.6012782",
"text": "def operate_numbers(num_one, num_two, operation)\n if operation == \"/\"\n if num_two.to_i == 0\n result = \"undefined\"\n else\n result = num_one.to_f.send(operation, num_two.to_f)\n end\n else\n result = num_one.to_i.send(operation, num_two.to_i)\n end\n puts \"\\n#{num_one} #{operation} #{num_two} = #{result}\\n\"\n puts \"thanks for calculating. good-bye\\n\\n\"\nend",
"title": ""
},
{
"docid": "cb10f2550fb089ae1041976106697365",
"score": "0.60006046",
"text": "def div_by_2(number)\nend",
"title": ""
},
{
"docid": "f8edab2485182d951a520c0231745603",
"score": "0.59951967",
"text": "def __ratio_from_numeric2(a, b)\n n1, d1 = __ratio_from_numeric(a)\n n2, d2 = __ratio_from_numeric(b)\n return n1 * d2, d1 * n2\n end",
"title": ""
}
] |
986f80f5769577e8ce823aaba98e95c5
|
create annotation download link for a user
|
[
{
"docid": "31069409c54cfc9be94cca3aabd399df",
"score": "0.588063",
"text": "def make_user_annotations_path(user_value)\n user_id = user_value.is_a?(User) ? user_value.id : user_value.to_i\n user_tz = user_value.is_a?(User) && !user_value.rails_tz.blank? ? user_value.rails_tz : 'UTC'\n data_request_path(selected_user_id: user_id, selected_timezone_name: user_tz)\n end",
"title": ""
}
] |
[
{
"docid": "7bfa9d6b02cbd926727d96c13ea9e36c",
"score": "0.73135144",
"text": "def annotation_download_link\n if self.link.starts_with?('http')\n self.link\n else\n # assume the link is a relative path to a file in a GCS bucket, then use service account to generate api url\n # will then need to use user or read-only service account access_token to render in client\n config = AdminConfiguration.find_by(config_type: 'Reference Data Workspace')\n if config.present?\n begin\n ApplicationController.firecloud_client.execute_gcloud_method(:generate_signed_url, 0, self.bucket_id, self.link, expires: 15)\n rescue => e\n ErrorTracker.report_exception(e, nil, self, { method_call: :generate_signed_url})\n Rails.logger.error \"Cannot generate genome annotation download link for #{self.link}: #{e.message}\"\n ''\n end\n else\n ''\n end\n end\n end",
"title": ""
},
{
"docid": "b6e837f83f849ff0004bc08004ab63cd",
"score": "0.6434292",
"text": "def link_to_doc_download(text, entry)\n if SemiStatic::Engine.config.ga4\n \"<a onclick='var that=this;gtag(\\\"event\\\", \\\"Download\\\", {\\\"file\\\" : \\\"#{entry.doc.original_filename.parameterize}\\\"});setTimeout(function(){location.href=that.href;},400);return false;' href='#{entry.doc.url}'>#{text}</a>\".html_safe\n else\n \"<a onclick='var that=this;ga(\\\"send\\\", \\\"event\\\", \\\"Download\\\", \\\"#{entry.doc.original_filename.parameterize}\\\");setTimeout(function(){location.href=that.href;},400);return false;' href='#{entry.doc.url}'>#{text}</a>\".html_safe\n end\n end",
"title": ""
},
{
"docid": "462a40ca639a4e9e1538decc20be6384",
"score": "0.63952667",
"text": "def public_annotation_link\n if self.link.starts_with?('http')\n self.link\n else\n # assume the link is a relative path to a file in a GCS bucket, then use service account to generate api url\n # will then need to use user or read-only service account access_token to render in client\n config = AdminConfiguration.find_by(config_type: 'Reference Data Workspace')\n if config.present?\n begin\n ApplicationController.firecloud_client.execute_gcloud_method(:generate_api_url, 0, self.bucket_id, self.link)\n rescue => e\n ErrorTracker.report_exception(e, nil, self, { method_call: :generate_api_url})\n Rails.logger.error \"Cannot generate public genome annotation link for #{self.link}: #{e.message}\"\n ''\n end\n else\n ''\n end\n end\n end",
"title": ""
},
{
"docid": "07bb697f05823c59444c51426739e1ec",
"score": "0.60056436",
"text": "def link_to_user_with_image(user, size=0)\n if user\n completeLink = output_user_image user, size\n completeLink << link_to(user, :controller => 'users', :action => 'show', :id => user)\n if size == 1\n completeLink << \" (#{user.login})\"\n end\n completeLink # return it\n else\n 'Anonymous'\n end\n end",
"title": ""
},
{
"docid": "07bb697f05823c59444c51426739e1ec",
"score": "0.60056436",
"text": "def link_to_user_with_image(user, size=0)\n if user\n completeLink = output_user_image user, size\n completeLink << link_to(user, :controller => 'users', :action => 'show', :id => user)\n if size == 1\n completeLink << \" (#{user.login})\"\n end\n completeLink # return it\n else\n 'Anonymous'\n end\n end",
"title": ""
},
{
"docid": "19a13e7e2319bda002f63d5a33ea403c",
"score": "0.60011286",
"text": "def user_column(record)\n link_to record.user.name,\n :controller => :public_annotations,\n :action => :user,\n :username => record.user.username\n end",
"title": ""
},
{
"docid": "5dfcfb1e6b3f53b1be11a951fb52d16a",
"score": "0.5946812",
"text": "def link_to_google_image(url)\n string = url.to_s\n string['https://drive.google.com/open?id='] = ''\n string = 'https://drive.google.com/uc?export=download&id=' + string\n string\n end",
"title": ""
},
{
"docid": "62c7c98f792cbefa1dfca9755b8f4428",
"score": "0.5881813",
"text": "def download\n\t@downloadlink = generate_download_ref( params[:id] )\nend",
"title": ""
},
{
"docid": "ea88aebd048f9b5d414da9f59cbeb7f6",
"score": "0.587637",
"text": "def download_link\n url = client.get(\"/#{id}/content\", :download => true, :suppress_redirects => true)[\"location\"]\n end",
"title": ""
},
{
"docid": "02d4ae18879569f439e07a63ad816d0d",
"score": "0.5871736",
"text": "def options_for_download_link(attributes)\n raise AuthenticationError unless attributes[:access_token]\n {\n auth_type: :user_token,\n auth_token: attributes[:access_token]\n }\n end",
"title": ""
},
{
"docid": "59198c98d4ceb6502f2f5fb3b04f5e66",
"score": "0.5784674",
"text": "def anonymous_link_create_download( main_app:, curation_concern: solr_document )\n debug_verbose = work_show_presenter_debug_verbose || ::Hyrax::AnonymousLinkService.anonymous_link_service_debug_verbose\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"id=#{id}\",\n \"\" ] if debug_verbose\n rv = AnonymousLink.find_or_create( id: curation_concern.id,\n path: \"/data/concern/data_sets/#{id}/anonymous_link_zip_download\",\n debug_verbose: debug_verbose )\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv=#{rv}\",\n \"\" ] if debug_verbose\n return rv\n end",
"title": ""
},
{
"docid": "cfc7fa67b7e14029d2f8b4b390b5b860",
"score": "0.57740045",
"text": "def api_download_link_url(id=nil)\n url = \"#{self.name.split(\"::\").last.downcase}\"\n url += \"/#{id}\" if id\n url += \"/download/link\"\n url\n end",
"title": ""
},
{
"docid": "6ca4779f52d1a2df23e37ae427e66e63",
"score": "0.5761093",
"text": "def user_link(user_id)\n \"<@#{user_id}>\"\n end",
"title": ""
},
{
"docid": "6c192932a353aaeabd51f30a5b32c721",
"score": "0.573852",
"text": "def download_link_iiif\n link_to(\n download_text(\"JPG\"),\n iiif_jpg_url,\n \"contentUrl\" => iiif_jpg_url,\n :data => {\n download: \"trigger\"\n }\n )\n end",
"title": ""
},
{
"docid": "fa1d7d255b0d7f1311c325aff0b547ec",
"score": "0.5726596",
"text": "def link_to_user_training_printout( user_training )\n link_to( user_training_printout_path(id: user_training.id), class: 'btn btn-default' ) do\n image_tag('page_white_acrobat.png') << \" PDF\".html_safe # Too long for grid: I18n.t('agex_action.download_pdf')\n end if check_user_training_visibility_for( user_training )\n end",
"title": ""
},
{
"docid": "39718b5b316eec91f4df01a993166610",
"score": "0.5722948",
"text": "def download_link(submission, ontology = nil)\n ontology ||= @ontology\n if submission.ontology.summaryOnly\n link = 'N/A - metadata only'\n else\n uri = submission.id + \"/download?apikey=#{get_apikey}\"\n link = \"<a href='#{uri}' 'rel='nofollow'>#{submission.pretty_format}</a>\"\n latest = ontology.explore.latest_submission({ include_status: 'ready' })\n if latest && latest.submissionId == submission.submissionId\n link += \" | <a href='#{ontology.id}/download?apikey=#{get_apikey}&download_format=csv' rel='nofollow'>CSV</a>\"\n if !latest.hasOntologyLanguage.eql?('UMLS')\n link += \" | <a href='#{ontology.id}/download?apikey=#{get_apikey}&download_format=rdf' rel='nofollow'>RDF/XML</a>\"\n end\n end\n unless submission.diffFilePath.nil?\n uri = submission.id + \"/download_diff?apikey=#{get_apikey}\"\n link = link + \" | <a href='#{uri} 'rel='nofollow'>Diff</a>\"\n end\n end\n link\n end",
"title": ""
},
{
"docid": "2ca3de892ce4fc1663dd128e81fec282",
"score": "0.57118154",
"text": "def generate_url value, cnt=0\n ProcessMethod::generate_url 'User', value, cnt\n end",
"title": ""
},
{
"docid": "a2f53397911581bee32514f2d0b87bbc",
"score": "0.56816375",
"text": "def download_link(submission, ontology = nil)\n ontology ||= @ontology\n if submission.ontology.summaryOnly\n link = 'N/A - metadata only'\n else\n uri = submission.id + \"/download?apikey=#{get_apikey}\"\n link = \"<a href='#{uri}' 'rel='nofollow'>#{submission.pretty_format}</a>\"\n latest = ontology.explore.latest_submission({:include_status => 'ready'})\n if latest && latest.submissionId == submission.submissionId\n link += \" | <a href='#{ontology.id}/download?apikey=#{get_apikey}&download_format=csv' rel='nofollow'>CSV</a>\"\n if !latest.hasOntologyLanguage.eql?(\"UMLS\")\n link += \" | <a href='#{ontology.id}/download?apikey=#{get_apikey}&download_format=rdf' rel='nofollow'>RDF/XML</a>\"\n end\n end\n unless submission.diffFilePath.nil?\n uri = submission.id + \"/download_diff?apikey=#{get_apikey}\"\n link = link + \" | <a href='#{uri} 'rel='nofollow'>Diff</a>\"\n end\n end\n return link\n end",
"title": ""
},
{
"docid": "0f268c12490c463212fee68cfeb20032",
"score": "0.5670234",
"text": "def gh_user_link(username, opts={})\n opts[:class] = opts[:class] || 'username'\n gh_link username, opts\nend",
"title": ""
},
{
"docid": "65ba3ec933c428507c1c98c10aff821e",
"score": "0.56613696",
"text": "def document_link; end",
"title": ""
},
{
"docid": "3ec2a5452851ba119e5b7a15e1b5436b",
"score": "0.5645767",
"text": "def link\r\n if is_community?\r\n url + \"#{usejournal}\"\r\n else\r\n url + \"profile\"\r\n end\r\n end",
"title": ""
},
{
"docid": "283a610bc31f733a29c8cf889f5f3799",
"score": "0.56452614",
"text": "def link_to_user(user, opts={})\n avatar = AvatarAttachment.find_by_owner_id(user.id)\n img = image_tag(avatar.small_thumb, class: \"profile-pic pull-left\", style: \"height:20px;padding-right:5px\") if avatar\n link_to img.to_s+user.full_name, user_path(user.slug, network: user.network)\n end",
"title": ""
},
{
"docid": "c9ca6671cd98d640f9c1451acbf3d617",
"score": "0.5644984",
"text": "def get_download_url\n \n end",
"title": ""
},
{
"docid": "f1824ed77856aaa405116a514ba95ec0",
"score": "0.5625872",
"text": "def link_user_google_apps_account(google_apps_linking_item)\n # POST /d2l/api/gae/(version)/linkuser\nend",
"title": ""
},
{
"docid": "3137e2595ab25b312ca14318467077d1",
"score": "0.5579453",
"text": "def download_link(submission, ontology = nil)\n ontology ||= @ontology\n if submission.ontology.summaryOnly\n if submission.homepage.nil?\n link = 'N/A'\n else\n uri = submission.homepage\n link = \"<a href='#{uri}'>Home Page</a>\"\n end\n else\n uri = submission.id + \"/download?apikey=#{get_apikey}\"\n link = \"<a href='#{uri}'>#{submission.hasOntologyLanguage}</a>\"\n latest = ontology.explore.latest_submission({:include_status => 'ready'})\n if latest && latest.submissionId == submission.submissionId\n link += \" | <a href='#{ontology.id}/download?apikey=#{get_apikey}&download_format=csv'>CSV</a>\"\n end\n unless submission.diffFilePath.nil?\n uri = submission.id + \"/download_diff?apikey=#{get_apikey}\"\n link = link + \" | <a href='#{uri}'>Diff</a>\"\n end\n end\n return link\n end",
"title": ""
},
{
"docid": "8c5480b49e92fbbefbb99d0c9afc337c",
"score": "0.5571455",
"text": "def make_downloadlink(link,wanted,venue)\n begin\n #FIXME get_port doesnt work\n #old: \"http://\" + request.host + get_port + \"/file/\" + link + \"/\" + bool_to_str(venue) + \"/\" + wanted.join(\"/\") + \"/\" +@@link.sub(\"/\",\"_\") +\".ics\"\n\t\toptions.base_url = request.host if options.base_url == ''\n \"http://\" + options.base_url + \"/file/\" + link + \"/\" + bool_to_str(venue) + \"/\" + wanted.join(\"/\") + \"/\" + link.sub(\"/\",\"_\") +\".ics\"\n rescue Exception => e\n @e = throw_error session['error'] = e.to_s + \"<br />(Es ist ein Fehler aufgetreten. Bitte sende mir die Fehlermeldung per Mail.)\"\n erb :error\n end\nend",
"title": ""
},
{
"docid": "f9a8eb2ea92e204d3724a7fdf6be6025",
"score": "0.5561803",
"text": "def public_annotation_index_link\n if self.index_link.starts_with?('http')\n self.index_link\n else\n # assume the index link is a relative path to a file in a GCS bucket, then use service account to generate api url\n # will then need to use user or read-only service account access_token to render in client\n config = AdminConfiguration.find_by(config_type: 'Reference Data Workspace')\n if config.present?\n begin\n ApplicationController.firecloud_client.execute_gcloud_method(:generate_api_url, 0, self.bucket_id, self.index_link)\n rescue => e\n ErrorTracker.report_exception(e, nil, self, { method_call: :generate_api_url})\n Rails.logger.error \"Cannot generate public genome annotation index link for #{self.index_link}: #{e.message}\"\n ''\n end\n else\n ''\n end\n end\n end",
"title": ""
},
{
"docid": "dfa48aebcd885219471d02cedba3e0bc",
"score": "0.55590785",
"text": "def href\n 'users/' + identifier if identifier\n end",
"title": ""
},
{
"docid": "60ee5f6d868fe05c0cb96ef0b925107f",
"score": "0.5558794",
"text": "def download_link\n ALLOWABLE_IMAGES.include?(blog_file.doc_content_type) ? image_download_link : download_link\n end",
"title": ""
},
{
"docid": "c5d84ba7fc3709cd79a286464221d84b",
"score": "0.5550786",
"text": "def download_document(options)\n document = options[:document]\n save_to = options[:to]\n\n ISigned::API.request(:url => 'user/download_document', \n :parameters => {:id => document.id, :api_token => self.token}, \n :save_as => \"#{save_to}/#{document.filename_with_extension}\")\n end",
"title": ""
},
{
"docid": "c9d03a76ce03e463b791e386a67ec999",
"score": "0.5541064",
"text": "def user_link\n h.link_to(h.user_path(object), class: 'hover-emphasis user-link') do\n (h.content_tag(:div, '', class: 'user-icon inlined') + object.username)\n end\n end",
"title": ""
},
{
"docid": "5010e15649eb02e4372400cbe14f7eb9",
"score": "0.5539281",
"text": "def links\n {\n download: Rails.application.routes.url_helpers.plan_export_url(@plan, format: :pdf, 'export[form]': true)\n }\n end",
"title": ""
},
{
"docid": "810ba5de83966957b2cd6388bf6ea92b",
"score": "0.5519802",
"text": "def document_download_icon(document)\n link_to '', document_download_path(document_id: document), class: 'glyphicon glyphicon-download'\n end",
"title": ""
},
{
"docid": "05c235158358dcf799342bb3ea4a9eeb",
"score": "0.55133086",
"text": "def create_user_link(request)\n start.uri('/api/identity-provider/link')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"title": ""
},
{
"docid": "e764054fb5484ffb21815c58d0bccc74",
"score": "0.55128723",
"text": "def bookmarks_export_url(format, params = {})\n bookmarks_url(params.merge(format: format, encrypted_user_id: encrypt_user_id(current_or_guest_user.id)))\n end",
"title": ""
},
{
"docid": "c77a61fcc56a539b699b169cd1435ec3",
"score": "0.5511312",
"text": "def show_by_user_url\n if !params[:user_id].present? or !params[:url_postfix].present? or !params[:lang].present?\n respond_to do |format|\n format.json { render json: {msg: Utilities::Message::MSG_INVALID_PARA}, \n status: :bad_request}\n end\n return\n end\n\n user = User.where(:public_key => params[:user_id]).first\n if user.nil?\n # response\n respond_to do |format|\n format.json { render json: { msg: Utilities::Message::MSG_INVALID_PARA}, \n status: :bad_request }\n end\n return \n end\n user_id = user.id\n\n article_id = Utilities::ArticleUtil.get_article_id(params[:url_postfix], params[:lang])\n \n @annotations = article_id.nil? ? {}: Annotation.joins(:annotation_histories).where('annotation_histories.user_id=? AND article_id=?', user_id, article_id)\n \n respond_to do |format|\n format.json { render json: {msg: Utilities::Message::MSG_OK, annotations: @annotations}, \n status: :ok}\n end\n end",
"title": ""
},
{
"docid": "14d1e8efbfc4426556a1a2cd29d74314",
"score": "0.5510885",
"text": "def generate_download_uri(result)\n uri = []\n uri << endpoint.sub(/\\/$/, \"\")\n uri << result[\"repo\"]\n uri << result[\"path\"]\n uri << result[\"name\"]\n uri.join(\"/\")\n end",
"title": ""
},
{
"docid": "3a1cc2a572f8ce9f0952b73ec8370188",
"score": "0.5499042",
"text": "def link_to_google_image(url)\n string = url\n string[\"https://drive.google.com/open?id=\"] = \"\"\n string = \"https://drive.google.com/uc?export=download&id=\" + string\n puts string\nend",
"title": ""
},
{
"docid": "8ea7706b9173e59ae05225be68690d00",
"score": "0.5497713",
"text": "def url\n \"/users/#{feed.author.username}\"\n end",
"title": ""
},
{
"docid": "714fdc68ec485e4034ba45b3f9dd7312",
"score": "0.5496587",
"text": "def document_link_provider; end",
"title": ""
},
{
"docid": "978a0f879ef63f0d935a92348e5fa21b",
"score": "0.5487663",
"text": "def annotation2oa(annotation, user)\n\n begin\n # id --> part of URI for the annotation but, triannon POST will not accept an ID\n annotation_id = sprintf 'revs_annotation_%04d', annotation[:id]\n\n # convert the 'druid' into a PURL URI\n purl = 'http://purl.stanford.edu/' + annotation[:druid]\n purl_uri = RDF::URI.parse(purl)\n\n # Commentary on the annotation json field\n #\n # > for each row of the annotation table (in mysql), can the 'shapes' array\n # contain more than one entry?\n #\n # Shapes can currently only contain one entry, and are currently always\n # rectangular. This data structure and shape implementation is a result of our\n # use of the annotorious plugin, which is not guaranteed across projects or even\n # in Revs in the long term.\n #\n # > if so, this suggests that a 'text' annotation might refer to more than\n # one segment or region of a REVS image?\n #\n # Not at the moment. Not sure why it is an array. Perhaps so you can store\n # multiple annotations about the same image in one row instead of many, but we\n # do not do this for various reasons.\n #\n # > What is the 'context' field? Would you rather use the 'context' field than\n # the 'src' field as the target of an open annotation (OA)?\n #\n # Context is just what annotorious uses for the src target. Again, we just used\n # their vocabulary for ease of implementation. If we were to use a different\n # back-end data store at some point, we could always transform into and out-of\n # their specific json structure as needed.\n #\n\n # convert the 'json' field\n annotation_json = JSON.parse(annotation[:json])\n revs_uri = RDF::URI.parse(annotation_json['context'])\n revs_img_src = annotation_json['src']\n revs_img_uri = RDF::URI.parse(revs_img_src)\n revs_fragments = []\n annotation_json['shapes'].each do |shape|\n # shapes are likely type 'rect'\n if shape['type'] == 'rect'\n # image annotation geometry\n # x is % across from top left\n # y is % down from top left\n # width is % across from x\n # height is % down from y\n x = shape['geometry']['x'] * 100\n y = shape['geometry']['y'] * 100\n w = shape['geometry']['width'] * 100\n h = shape['geometry']['height'] * 100\n # media fragment: #xywh=percent:30.1,16.8,35.1,52.2\n fragment = sprintf '#xywh=percent:%04.1f,%04.1f,%04.1f,%04.1f', x, y, w, h\n revs_fragments << fragment\n end\n end\n revs_img_graph = RDF::Graph.new\n # revs_img_node = RDF::Node.new(revs_img_uri)\n # revs_img_graph.insert([revs_img_node, RDF.type, RDF::Vocab::OA.SpecificResource])\n # revs_img_graph.insert([revs_img_node, RDF::Vocab::OA.hasSource, revs_img_uri])\n revs_img_graph.insert([revs_uri, RDF.type, RDF::Vocab::OA.SpecificResource])\n revs_img_graph.insert([revs_uri, RDF::Vocab::OA.hasSource, revs_img_uri])\n revs_img_graph.insert([revs_img_uri, RDF.type, RDF::DCMIType.Image])\n # Note: it's most likely there is only one fragment in a REVS annotation.\n revs_fragment_graphs = []\n revs_fragments.each_with_index do |f, i|\n # img_uri = RDF::URI.parse(revs_img_src + fragment)\n # revs_img_uris << img_uri\n f_id = sprintf '%s_fragment_%02d', annotation_id, i\n f_uri = RDF::URI.parse(f_id)\n f_graph = RDF::Graph.new\n # avoid creation of blank nodes?\n # f_node = RDF::Node.new(f_uri)\n # f_graph.insert([f_node, RDF.type, RDF::Vocab::OA.FragmentSelector])\n # f_graph.insert([f_node, RDF::DC.conformsTo, RDF::MA.MediaFragment])\n # f_graph.insert([f_node, RDF.value, RDF::Literal.new(f)])\n # revs_img_graph.insert([revs_img_node, RDF::Vocab::OA.hasSelector, f_node])\n f_graph.insert([f_uri, RDF.type, RDF::Vocab::OA.FragmentSelector])\n f_graph.insert([f_uri, RDF::DC.conformsTo, RDF::MA.MediaFragment])\n f_graph.insert([f_uri, RDF.value, RDF::Literal.new(f)])\n revs_img_graph.insert([revs_uri, RDF::Vocab::OA.hasSelector, f_uri])\n revs_fragment_graphs << f_graph\n end\n\n # oa#hasBody\n # text --> value of cnt:chars property of a ContentAsText body of the annotation\n body_id = sprintf '%s_comment', annotation_id\n body_uri = RDF::URI.parse(body_id)\n # TODO: add a language tag?\n #body_text = RDF::Literal.new(annotation[:text], :language => :en)\n body_text = RDF::Literal.new(annotation[:text])\n body_graph = RDF::Graph.new\n # avoid creation of blank nodes?\n # body_node = RDF::Node.uuid\n # body_node = RDF::Node.new(annotation[:id])\n body_graph.insert([body_uri, RDF.type, RDF::Content.ContentAsText])\n body_graph.insert([body_uri, RDF.type, RDF::DCMIType.Text])\n body_graph.insert([body_uri, RDF::Content.chars, body_text])\n body_graph.insert([body_uri, RDF::Content.characterEncoding, 'UTF-8'])\n\n # oa#annotatedAt\n # created_at --> discard if updated_at is always present\n # updated_at --> oa:annotatedAt\n #\n # > annotation[:created_at].class\n # => Time\n # > annotation[:created_at].utc\n # => 2014-03-25 01:56:01 UTC\n # > annotation[:created_at].to_i # unix time since epoch\n # => 1395712561\n # > [annotation[:created_at].utc, annotation[:updated_at].utc]\n # => [2014-03-25 01:56:01 UTC, 2014-03-25 01:56:14 UTC]\n #\n # create an RDF literal with datatype, see\n # http://rdf.greggkellogg.net/yard/RDF/Literal.html\n # > RDF::Literal.new(annotation[:created_at]).datatype\n # => #<RDF::Vocabulary::Term:0x3f86333d6ca8 URI:http://www.w3.org/2001/XMLSchema#time>\n # However, this automatic conversion discards the date!\n # > RDF::Literal.new(annotation[:created_at]).to_s\n # => \"01:56:01Z\"\n # So, an explicit datatype is required, i.e.:\n # > RDF::Literal.new(annotation[:created_at], :datatype => RDF::XSD.dateTime).to_s\n # => \"2014-03-25T01:56:01Z\"\n created_datetime = RDF::Literal.new(annotation[:created_at].utc, :datatype => RDF::XSD.dateTime)\n updated_datetime = RDF::Literal.new(annotation[:updated_at].utc, :datatype => RDF::XSD.dateTime)\n annotation_datetime = updated_datetime #if annotation[:created_at].utc < annotation[:updated_at].utc\n\n # Create and populate an Open Annotation instance.\n oa = Annotations2triannon::OpenAnnotation.new\n oa.insert_hasTarget(revs_uri)\n oa.insert_hasTarget(purl_uri)\n oa.insert_hasTarget(revs_img_uri)\n # oa.insert_hasTarget(revs_img_node)\n oa.graph.insert(revs_img_graph)\n revs_fragment_graphs.each {|g| oa.graph.insert(g) }\n # to enable the blank node, change body_graph to use body_node instead of body_uri\n # oa.insert_hasBody(body_node)\n oa.insert_hasBody(body_uri)\n oa.graph.insert(body_graph)\n oa.insert_annotatedAt(annotation_datetime)\n # to enable the blank node, change user_graph to use user_node instead of user_uri\n # oa.insert_annotatedBy(user[:node])\n oa.insert_annotatedBy(user[:uri])\n oa.graph.insert(user[:graph])\n oa\n rescue => e\n puts e.message\n # binding.pry\n raise e\n end\n end",
"title": ""
},
{
"docid": "003fcb3e394fbac91f387214203ee973",
"score": "0.5486625",
"text": "def final_url; end",
"title": ""
},
{
"docid": "97ff12b22e39a44a11f5097bc4404388",
"score": "0.5480726",
"text": "def make_url\n # This works for most of the twitter calls\n \"http://twitter.com/#{resource_path}/#{twitter_user_id}.json?page=#{page||1}\"\n end",
"title": ""
},
{
"docid": "e21a37233bf015c2c7b275ccbe7be092",
"score": "0.54706323",
"text": "def download_link\n \"http://#{self.registered_download.brand.default_website.url}/#{self.registered_download.url}/get_it/#{self.download_code}\"\n end",
"title": ""
},
{
"docid": "6746ea78e5482fa0bbf9d27eea1ca069",
"score": "0.54581827",
"text": "def annotation_add_by_popup_link(annotatable, *args)\n # Do options the Rails Way ;-)\n options = args.extract_options!\n # defaults:\n options.reverse_merge!(:attribute_name => nil,\n :tooltip_text => 'Add annotation',\n :style => '',\n :class => nil,\n :link_text => '',\n :show_icon => true,\n :icon_filename => 'add_annotation.png',\n :icon_hover_filename => 'add_annotation_hover.png',\n :icon_inactive_filename => 'add_annotation_inactive.png',\n :show_not_logged_in_text => true,\n :only_show_on_hover => true,\n :multiple => false,\n :multiple_separator => ',')\n \n link_content = ''\n \n if logged_in?\n \n icon_filename_to_use = (options[:only_show_on_hover] == true ? options[:icon_hover_filename] : options[:icon_filename])\n \n link_inner_html = ''\n link_inner_html = link_inner_html + image_tag(icon_filename_to_use, :style => 'vertical-align:middle;margin-right:0.3em;') if options[:show_icon] == true\n link_inner_html = link_inner_html + content_tag(:span, options[:link_text], :style => \"vertical-align: middle; text-decoration: underline;\") unless options[:link_text].blank?\n\n url_options = { :annotatable_type => annotatable.class.name, :annotatable_id => annotatable.id }\n url_options[:attribute_name] = options[:attribute_name] unless options[:attribute_name].nil?\n url_options[:multiple] = options[:multiple] if options[:multiple]\n url_options[:separator] = options[:multiple_separator] if options[:multiple]\n \n link_class = (options[:only_show_on_hover] == true ? \"active #{options[:class]}\" : options[:class])\n\n link_content = link_to_remote_redbox(link_inner_html.html_safe,\n {:url => new_popup_annotations_url(url_options),\n :id => \"annotate_#{annotatable.class.name}_#{annotatable.id}_#{options[:attribute_name]}_redbox\",\n :failure => \"alert('Sorry, an error has occurred.'); RedBox.close();\"},\n {:style => \"text-decoration: none; vertical-align: middle; #{options[:style]}\",\n :class => link_class,\n :alt => options[:tooltip_text],\n :title => tooltip_title_attrib(options[:tooltip_text])\n })\n\n # Add the greyed out inactive bit if required\n if options[:only_show_on_hover] == true\n inactive_span = content_tag(:span, \n image_tag(options[:icon_inactive_filename], :style => 'vertical-align:middle;margin-right:0.3em;'), \n :class => \"inactive #{options[:class]}\", \n :style => \"vertical-align: middle; #{options[:style]}\")\n \n link_content = inactive_span + link_content\n end\n \n else\n # Not logged in...\n if options[:show_not_logged_in_text] == true\n icon_filename_to_use = options[:icon_inactive_filename]\n \n login_text = \"Log in to add #{options[:attribute_name].nil? ? \"annotation\" : options[:attribute_name].downcase}\"\n \n link_content_inner_html = image_tag(icon_filename_to_use, :style => 'vertical-align:middle;margin-right:0.3em;') if options[:show_icon] == true\n link_content_inner_html = link_content_inner_html + content_tag(:span, login_text, :style => \"vertical-align: middle; text-decoration: underline;\") unless options[:link_text].blank?\n \n link_class = (options[:only_show_on_hover] == true ? \"active #{options[:class]}\" : options[:class])\n \n link_content = link_to(link_content_inner_html, login_path, :class => link_class, :style => \"text-decoration: none; vertical-align: middle; #{options[:style]}\", :title => tooltip_title_attrib(login_text))\n \n # Add the greyed out inactive bit if required\n if options[:only_show_on_hover] == true\n inactive_span = content_tag(:span, \n image_tag(icon_filename_to_use, :style => 'vertical-align:middle;margin-right:0.3em;'), \n :class => \"inactive #{options[:class]}\", \n :style => \"vertical-align: middle; #{options[:style]}\")\n \n link_content = inactive_span + link_content\n end\n \n end\n end\n \n return link_content \n end",
"title": ""
},
{
"docid": "8723ad66e9e6f867bae89212efd51146",
"score": "0.54575557",
"text": "def generate_link\n logger.tagged('recognition') { logger.info \"sending email for recognition #{id}\" }\n generate_key(id)\n RecognitionMailer.email(Recognition.find(id)).deliver_now\n end",
"title": ""
},
{
"docid": "5b3ff81aa29ea7733c236f81ae6da480",
"score": "0.5453611",
"text": "def map_link_url(coordinates); end",
"title": ""
},
{
"docid": "b9246dda034eef952cca4a9ce3cf3f8f",
"score": "0.54527557",
"text": "def download_url\n download_api_file_path(object)\n end",
"title": ""
},
{
"docid": "d217a4f64d09df16f03c8144d4fe21cd",
"score": "0.54464614",
"text": "def download_data\n add_dataset_nav_options\n\n gon.generate_download_files_dataset_path = generate_download_files_dataset_path(@owner, @dataset)\n gon.generate_download_file_status_dataset_path = generate_download_file_status_dataset_path(@owner, @dataset)\n\n @js.push('generate_download.js')\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"title": ""
},
{
"docid": "0cc555e8542ce98a4cbe4e88e8bdc432",
"score": "0.5444708",
"text": "def link_to_create_asset(link_label, content_type)\n if current_user\n link_to link_label, {:action => 'new', :controller => 'assets', :content_type => content_type}, :class=>\"create_asset\"\n else \n link_to link_label, {:action => 'new', :controller => 'user_sessions', :redirect_params => {:action => \"new\", :controller=> \"assets\", :content_type => content_type}}, :class=>\"create_asset\"\n end\n end",
"title": ""
},
{
"docid": "c93ae110717043e5556df3bcd048c577",
"score": "0.54418224",
"text": "def make_image_link(url) #:doc:\n url\n end",
"title": ""
},
{
"docid": "fdbeb33dc98367b8315ef33c4ea3db42",
"score": "0.5441753",
"text": "def download_folder\n dl_authors = self.download_authors \n \"downloads/#{dl_authors[0..1]}/#{dl_authors}/#{self.id}\"\n end",
"title": ""
},
{
"docid": "6cee5a3ec2dbfea9284360084ba88ae5",
"score": "0.54389226",
"text": "def google_datasource_export_link(format)\n label = t(\"google_data_source.export_links.#{format}\")\n link_to(label, '#', :class => \"export_as_#{format}\")\n end",
"title": ""
},
{
"docid": "c6ccb10f4c7934c09d49b9e87c29d1ae",
"score": "0.54286295",
"text": "def userhelp_identity_url( user )\n return auto_link( h( user.identity_url ) )\n end",
"title": ""
},
{
"docid": "dc924f5a87cfff1bb0c24a26e95b7561",
"score": "0.54249483",
"text": "def link_activity_user activity\n return \"[system]\" unless activity.user\n activity.user.decorate.name_linking_to_email\n end",
"title": ""
},
{
"docid": "732ee17827cc1020fb14cc7a26bdca79",
"score": "0.54230344",
"text": "def download_object(download_path, url_extra: nil,\n optional: false, is_rdf: false,\n should_add_user_email: false)\n\n uri = URI(object_url(url_extra))\n\n request = Net::HTTP::Get.new(uri)\n request.basic_auth(PushmiPullyu.options[:fedora][:user],\n PushmiPullyu.options[:fedora][:password])\n\n request['Accept'] = RDF_FORMAT if is_rdf\n\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(request)\n end\n\n if response.is_a?(Net::HTTPSuccess)\n body = if should_add_user_email\n PushmiPullyu::AIP::OwnerEmailEditor.new(response.body).run\n else\n response.body\n end\n file = File.open(download_path, 'wb')\n file.write(body)\n file.close\n return true\n elsif response.is_a?(Net::HTTPNotFound)\n raise FedoraFetchError unless optional\n\n return false\n else\n raise FedoraFetchError\n end\n end",
"title": ""
},
{
"docid": "75f16ddeaa3b2ad02450f2a76f1b1d10",
"score": "0.5415715",
"text": "def canvas_uri_for_annotation\n \"#{base_url}/manifest/canvas/#{file_set_id}#{coordinates}\"\n end",
"title": ""
},
{
"docid": "d024633ed2afdb5543a32e7f7132f633",
"score": "0.5393062",
"text": "def to_page_url\n\t\t\t\"#{FLICKR_PHOTO_URL}/#{USER_ID}/#{id}\"\n\t\tend",
"title": ""
},
{
"docid": "3a93312511f0919c44020d54ca264cdd",
"score": "0.53882766",
"text": "def link_for(id)\n file = drive_service.get_file(id, fields: 'id, name, size')\n auth_header = { 'Authorization' => \"Bearer #{credentials.access_token}\" }\n extras = {\n auth_header: auth_header,\n expires: 1.hour.from_now,\n file_name: file.name,\n file_size: file.size.to_i\n }\n [download_url(id), extras]\n end",
"title": ""
},
{
"docid": "61adf6d8a553482a7db28e253a31ad65",
"score": "0.5380133",
"text": "def show_user_urls\n if !params[:user_id].present?\n respond_to do |format|\n format.json { render json: {msg: Utilities::Message::MSG_INVALID_PARA}, \n status: :bad_request}\n end\n return\n end\n\n @user = User.where(:public_key => params[:user_id]).first\n if @user.nil?\n respond_to do |format|\n format.json { render json: {msg: Utilities::Message::MSG_INVALID_PARA}, \n status: :bad_request}\n end\n return\n end\n \n if params[:lang].present?\n article_ids = Annotation.joins(:annotation_histories).where('user_id=? and annotation_histories.lang=?', @user.id, params[:lang]).pluck(:article_id).uniq\n else\n article_ids = Annotation.joins(:annotation_histories).where('user_id=?', @user.id).pluck(:article_id).uniq\n end\n \n @articles = Article.where(id: article_ids)\n @articles.each do |article|\n article.lang = Utilities::Lang::CODE_TO_LANG[article.lang.to_sym]\n end\n\n respond_to do |format|\n format.html # show_user_annotations.html.erb\n format.json { render json: {msg: Utilities::Message::MSG_OK, articles: @articles}, status: :ok}\n end\n end",
"title": ""
},
{
"docid": "aa87ff7f778a54312974198fcc303e2a",
"score": "0.5377285",
"text": "def download_url(options = {})\n Bio::SRA::Accession.run_download_url(run_accession, options)\n end",
"title": ""
},
{
"docid": "b8e6119a75d82ffc244c7c03af3597f0",
"score": "0.53719467",
"text": "def generate_download_ref( hashkey )\n \t# %Q|<a href=\"/download/#{hashkey}/uconnect.upd\" type=\"application/octet-stream\">Click here to download your update file</a><br>|\n\n \t'<a href=\"' + url_for(:controller=>\"download\", :action=>\"#{hashkey}\", :id=>\"uconnect.upd\") + %Q|\" type=\"application/octet-stream\">Click here to download your update file</a><br>|\n\tend",
"title": ""
},
{
"docid": "f10dd122dbcf2a89d4bfdc346b2ee900",
"score": "0.5359035",
"text": "def download_pdf\n user = User.find(params[:id])\n send_data generate_pdf(user),\n filename: \"#{user.name}.pdf\",\n type: \"application/pdf\"\n end",
"title": ""
},
{
"docid": "ffc58d74a06f2db08f5a59447e25b45f",
"score": "0.53581804",
"text": "def build_user_image_url(user)\r\n if !user.image.nil?\r\n return image_tag(url_for(:controller => 'pictures', :action => 'show', :id => \"#{user.image.id}#{user.image.extension}\"), :alt => user.display_name)\r\n else\r\n return \"<img alt=\\\"no user image\\\" src='/images/noimage.gif'/>\"\r\n end\r\n end",
"title": ""
},
{
"docid": "a75a9a6283233ae04a8d9e93e3b15f18",
"score": "0.53556",
"text": "def make_retrieval_link!(data = nil)\n link, rid = get_field_values(data, *RETRIEVAL_FIELDS)\n return if link.present? || rid.blank?\n link = Upload.make_retrieval_link(rid)\n set_field_value!(data, :emma_retrievalLink, link)\n end",
"title": ""
},
{
"docid": "e5116fbff732087a321fe8ec4e977cf8",
"score": "0.5342816",
"text": "def retrieve_user_link(identity_provider_id, identity_provider_user_id, user_id)\n start.uri('/api/identity-provider/link')\n .url_parameter('identityProviderId', identity_provider_id)\n .url_parameter('identityProviderUserId', identity_provider_user_id)\n .url_parameter('userId', user_id)\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "fe8e241d951db4f9c471eeaca8e4e81c",
"score": "0.5333943",
"text": "def download_text(format)\n download_format = proper_case_format(format)\n value = t(\"geoblacklight.download.download_link\", download_format: download_format)\n value.html_safe\n end",
"title": ""
},
{
"docid": "82a7f2c8326cc51f140aa15faf32aced",
"score": "0.5328845",
"text": "def image_download_path\n link_to image_tag(blog_file.doc.url, width: '150px'), download_blog_files_path(id: blog_file.id)\n end",
"title": ""
},
{
"docid": "6e22705292663a129eebb4605b0d719c",
"score": "0.5321764",
"text": "def download_email email_address, download_link\n @download_link = download_link\n mail to: email_address\n end",
"title": ""
},
{
"docid": "7d68766d8f888b223ebd37879faa5d4f",
"score": "0.53196114",
"text": "def genome_annotation_link\n if self.genome_assembly.present? && self.genome_assembly.current_annotation.present?\n self.genome_assembly.current_annotation.public_annotation_link\n else\n nil\n end\n\tend",
"title": ""
},
{
"docid": "3f6d6c3b64b9742ec652f09173161630",
"score": "0.53186566",
"text": "def user_link(user, name=nil)\n begin\n name ||= h(user.unique_text_name)\n user_id = user.is_a?(Fixnum) ? user : user.id\n link_to(name, :controller => 'observer', :action => 'show_user', :id => user_id)\n rescue\n (user || name).to_s\n end\n end",
"title": ""
},
{
"docid": "3f6d6c3b64b9742ec652f09173161630",
"score": "0.53186566",
"text": "def user_link(user, name=nil)\n begin\n name ||= h(user.unique_text_name)\n user_id = user.is_a?(Fixnum) ? user : user.id\n link_to(name, :controller => 'observer', :action => 'show_user', :id => user_id)\n rescue\n (user || name).to_s\n end\n end",
"title": ""
},
{
"docid": "3f6d6c3b64b9742ec652f09173161630",
"score": "0.53186566",
"text": "def user_link(user, name=nil)\n begin\n name ||= h(user.unique_text_name)\n user_id = user.is_a?(Fixnum) ? user : user.id\n link_to(name, :controller => 'observer', :action => 'show_user', :id => user_id)\n rescue\n (user || name).to_s\n end\n end",
"title": ""
},
{
"docid": "ba6db1e2d01a3acc00c1cb88275ed943",
"score": "0.53051007",
"text": "def href_template; end",
"title": ""
},
{
"docid": "044e91c3a917dd5a8092467921f89f59",
"score": "0.53008515",
"text": "def source_retrieval_link(**opt)\n url = opt.delete(:url) || object.record_download_url\n url = CGI.unescape(url.to_s)\n return if url.blank?\n\n repo = repository_for(object, url)\n label = opt.delete(:label) || url.dup\n\n # Adjust the link depending on whether the current session is permitted to\n # perform the download.\n permitted = can?(:download, Upload)\n append_css!(opt, 'sign-in-required') unless permitted\n\n # Set up the tooltip to be shown before the item has been requested.\n opt[:title] ||=\n if permitted\n fmt = object.dc_format.to_s.underscore.upcase.tr('_', ' ')\n origin = repo&.titleize || 'the source repository' # TODO: I18n\n \"Retrieve the #{fmt} source from #{origin}.\" # TODO: I18n\n else\n tip_key = (h.signed_in?) ? 'disallowed' : 'sign_in'\n tip_key = :\"emma.download.link.#{tip_key}.tooltip\"\n fmt = object.label\n origin = repo || EmmaRepository.default\n default = %i[emma.download.tooltip]\n I18n.t(tip_key, fmt: fmt, repo: origin, default: default)\n end\n\n case repo&.to_sym\n when :emma then emma_retrieval_link(label, url, **opt)\n when :ace then ace_retrieval_link( label, url, **opt)\n when :internetArchive then ia_retrieval_link( label, url, **opt)\n when :hathiTrust then ht_retrieval_link( label, url, **opt)\n when :bookshare then bs_retrieval_link( label, url, **opt)\n else Log.error { \"#{__method__}: #{repo.inspect}: unexpected\" } if repo\n end\n end",
"title": ""
},
{
"docid": "44a278f74db4f97bce6dd816434e9da8",
"score": "0.52943546",
"text": "def link_to_avatar\n helpers.link_to(image_tag_avatar(title: model.display_name), helpers.person_activities_path(person_id: model.id))\n end",
"title": ""
},
{
"docid": "43f0d4af37c24089203d21d329bae230",
"score": "0.52923006",
"text": "def download_alchemy_attachment_url(attachment)\n alchemy.download_attachment_url(attachment, attachment.urlname)\n end",
"title": ""
},
{
"docid": "43f0d4af37c24089203d21d329bae230",
"score": "0.52923006",
"text": "def download_alchemy_attachment_url(attachment)\n alchemy.download_attachment_url(attachment, attachment.urlname)\n end",
"title": ""
},
{
"docid": "f7bb4cf8534e7b19f37d1ffd1dc75a1c",
"score": "0.5291648",
"text": "def download_url\n download_url_response['g']\n end",
"title": ""
},
{
"docid": "f9d2e46337828ff0e4d7fc1a343e61bd",
"score": "0.5289616",
"text": "def link_to_download(attachment, options={})\n text = options.delete(:text) || attachment.filename\n link_to(text, { :controller => 'attachments', :action => 'download',\n :id => attachment, :filename => attachment.filename },\n options.merge({ :target => '_blank' }))\n #options.merge({ :download => attachment.filename, :target => '_blank' }))\n end",
"title": ""
},
{
"docid": "adc1cbd7e9741b306de3400766215140",
"score": "0.52862793",
"text": "def generate_link\n CWS_BASE + \"/view_profile.php?m=#{@id}\"\n end",
"title": ""
},
{
"docid": "f4bd968aa2fc1d461d8abd2f1bbacc1b",
"score": "0.528586",
"text": "def link_to_mentioned_user(login)\n result[:mentioned_usernames] |= [login]\n\n url = base_url.dup\n url << \"/\" unless %r{[/~]\\z}.match?(url)\n\n \"<a href='#{url << login}'>\" \\\n \"@#{login}\" \\\n \"</a>\"\n end",
"title": ""
},
{
"docid": "ab617598ea9f9f3f7716e64f4d57b96f",
"score": "0.5284985",
"text": "def download_link\n if downloadable?\n @item[:item][\"accessInfo\"][\"pdf\"][\"downloadLink\"] \n else\n \"your book is not downloadable\"\n end\n end",
"title": ""
},
{
"docid": "d43d427f4b0515bbcbbb670ef16746c2",
"score": "0.5280482",
"text": "def link_to_attachment_with_download_name(attachment, options={})\n text = options.delete(:text) || attachment.filename\n action = options.delete(:download) ? 'download' : 'show'\n\n link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.download_name }, options)\n end",
"title": ""
},
{
"docid": "a68ba1dfb7a5749ecb9707b945eb094b",
"score": "0.5270276",
"text": "def person_link(options = {})\n source_name = send \"#{options[:source]}_name\".to_sym\n source_email = send \"#{options[:source]}_email\".to_sym\n text = if options[:avatar]\n avatar = h.image_tag h.gravatar_icon(source_email, options[:size]), class: \"avatar #{\"s#{options[:size]}\" if options[:size]}\", width: options[:size], alt: \"\"\n %Q{#{avatar} <span class=\"commit-#{options[:source]}-name\">#{source_name}</span>}\n else\n source_name\n end\n\n user = User.where('name like ? or email like ?', source_name, source_email).first\n\n if user.nil?\n h.mail_to(source_email, text.html_safe, class: \"commit-#{options[:source]}-link\")\n else\n h.link_to(text.html_safe, h.user_path(user), class: \"commit-#{options[:source]}-link\")\n end\n end",
"title": ""
},
{
"docid": "058328fd808c7eeaf23ca15bcd9a32ca",
"score": "0.52664584",
"text": "def genome_annotation_link\n if self.genome_assembly.present? && self.genome_assembly.current_annotation.present?\n self.genome_assembly.current_annotation.public_annotation_link\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "058328fd808c7eeaf23ca15bcd9a32ca",
"score": "0.5266365",
"text": "def genome_annotation_link\n if self.genome_assembly.present? && self.genome_assembly.current_annotation.present?\n self.genome_assembly.current_annotation.public_annotation_link\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "eea1d0b654e9301e5d9ddd2fa833a860",
"score": "0.52657986",
"text": "def annotations\n @annotations=@user.annotations(current_user).includes(:item).order(@order).page(@current_page).per(@per_page)\n @page_title=\"#{@user.to_s}: #{I18n.t('revs.annotations.plural')}\"\n end",
"title": ""
},
{
"docid": "f6de088e7623a340b76833e93409f9cd",
"score": "0.52643394",
"text": "def doc_link(destination_data)\n doc_file_name(destination_data)\n end",
"title": ""
},
{
"docid": "6b0e6b026aa011b29b4d4269f62ad984",
"score": "0.52631223",
"text": "def shortened_link_for(user)\n #link_to \"@\" + user.email.match(/(.*)@/i)[1] + user.id.to_s, user\n link_to \"@\" + user.pseudo_login_name, user\n end",
"title": ""
},
{
"docid": "e2335a2f0de470ba7930b572ad5c464b",
"score": "0.52630144",
"text": "def document_id_file_url\n doc_file_path = document_id_file_path_d\n if @user_kyc_comparison_detail.present?\n rotation_angle = @user_kyc_comparison_detail.document_dimensions[:rotation_angle].to_s\n doc_file_path += \"_#{rotation_angle}\" if rotation_angle.present?\n end\n get_url(doc_file_path)\n end",
"title": ""
},
{
"docid": "3f9e41247a3cadfd3822385ef1cdbffd",
"score": "0.52620983",
"text": "def download_alchemy_attachment_url(attachment)\n alchemy.download_attachment_url(attachment, attachment.slug)\n end",
"title": ""
},
{
"docid": "3533c39e56abc8c6cfdd5051c47f46b4",
"score": "0.526185",
"text": "def determine_join_url(user)\n url = nil\n if user.automatic?\n if user.completed_step == 1\n url = finish_profile_url\n else\n url = join_url\n end\n end\n url\n end",
"title": ""
},
{
"docid": "053f7ed5041e3b2ead5e01f3b118901e",
"score": "0.525973",
"text": "def create_link\n link = Link.new(:organisation_id => self.id)\n link.set_user_creator(user_id)\n link.save!\n end",
"title": ""
},
{
"docid": "daaded65b8ad987567f47d4acc7fe910",
"score": "0.52572197",
"text": "def link_to_avatar\n helpers.link_to(image_tag_avatar(title: model.display_name),\n helpers.person_activities_path(person_id: model.id))\n end",
"title": ""
},
{
"docid": "623fe703fb09b8058bf2eef1732ab64b",
"score": "0.5256946",
"text": "def hyperlink; end",
"title": ""
},
{
"docid": "fc235e18aebab1a24375f884d1d32fde",
"score": "0.5254643",
"text": "def link_docs\n \"#{link_generator.root_url}/docs\"\n end",
"title": ""
},
{
"docid": "b4256cf004a6ef40bcf07a5b0701f72a",
"score": "0.52440345",
"text": "def user_profile_link(user)\n link_element(xpath: \"//a[contains(.,'#{user.full_name}')]\")\n end",
"title": ""
},
{
"docid": "d3c7e26365c7b0957e51f9b93445f227",
"score": "0.52433157",
"text": "def links_for_user\n link ::File.join('/home',new_resource.user,'application') do\n to ::File.join(application_full_path)\n end\n\n link ::File.join('/home',new_resource.user,'log') do\n to ::File.join(new_resource.path,'log')\n end\n end",
"title": ""
},
{
"docid": "61d573eb4d6f45c0e1014fd65dade9b0",
"score": "0.5232344",
"text": "def filename\n\"#{@user.screen_name}\"\n end",
"title": ""
}
] |
80c8af403ec8e54176e7a476d3523679
|
These defaults will show us what placeholders are supposed to be there in the event that they don't load. It is not meant to be seen by users just to aid testing. If these appear in an end user page, it is a bug.
|
[
{
"docid": "38e7add3ef8c8d262982e07856c13c60",
"score": "0.0",
"text": "def setup_defaults\n @program_title = 'PROGRAM TITLE'\n @program_site = 'PROGRAM SITE'\n @request_availability = false\n @meeting_times = ''\n @sourcing_options = ''\n @course_options = ''\n @student_id_required = false\n @student_id_format = ''\n @student_id_format_help = ''\n @student_id_excluded_chars = ''\n @contact_email = 'info@bebraven.org'\n @is_preaccelerator_student = false\n end",
"title": ""
}
] |
[
{
"docid": "104cccd3c0c474f24f14c6d2c64624ca",
"score": "0.64865166",
"text": "def placeholders\n [:firebase_properties, :address, :address_2]\n end",
"title": ""
},
{
"docid": "669237681e16ed57764a3c6bc7966ff6",
"score": "0.6368948",
"text": "def reset_placeholders\n self.preview_mode = false\n self.placeholder_tags = {}\n end",
"title": ""
},
{
"docid": "5f43cdadca508b4cfe9ce610b27b0c5e",
"score": "0.6173886",
"text": "def placeholder_names\n placeholders.map(&:contents).to_set\n end",
"title": ""
},
{
"docid": "3e32fda51f3ff4be5b4507173db6c1b8",
"score": "0.6097521",
"text": "def placeholder(placeholderText)\n @placeholder = placeholderText.nil? ? nil : placeholderText.to_s\n end",
"title": ""
},
{
"docid": "c8543b1f0845e3073cc3df73a8adf506",
"score": "0.600809",
"text": "def url_placeholders; end",
"title": ""
},
{
"docid": "c8543b1f0845e3073cc3df73a8adf506",
"score": "0.600809",
"text": "def url_placeholders; end",
"title": ""
},
{
"docid": "05d15b6737d84ebbba588dee5fc82c14",
"score": "0.5990713",
"text": "def url_placeholders\n my_palceholders = super\n if site.config['content_pages'] && site.config['content_pages']['url_placeholders']\n site.config['content_pages']['url_placeholders'].each do |key,value|\n my_palceholders[key] = @page_info[\"#{value}\"]\n end\n end\n return my_palceholders\n end",
"title": ""
},
{
"docid": "b4cad4f2b16958630bd434da56622620",
"score": "0.57550883",
"text": "def placeholders\n ast.select{ |node| SimpleTemplates::AST::Placeholder === node }.to_set\n end",
"title": ""
},
{
"docid": "327086ed5abb59929cef40ec13a43162",
"score": "0.5749026",
"text": "def placeholder_html\n to_html\n end",
"title": ""
},
{
"docid": "29d1c9173544d0a85cbd33d6166a72c9",
"score": "0.56578714",
"text": "def placeholder\n [\"placeholder\", \"placeholder\", \"placeholder\", \"placeholder\"]\nend",
"title": ""
},
{
"docid": "722bcd4fb29725b19e167a734d0b29d6",
"score": "0.5468952",
"text": "def print_defaults\n puts \"default_settings:\\n\"\n config_keys = @@default_settings.keys.map{|k|k.to_s}\n config_keys.sort.each do |key|\n puts \" #{key} => #{@@default_settings[key.to_sym]} (#{@@default_settings_source[key.to_sym] || 'code'})\\n\"\n end\n end",
"title": ""
},
{
"docid": "aee5a23377007c14256c6fc02c2ccec2",
"score": "0.5419932",
"text": "def set_defaults\n self.why_text ||= \"\"\n self.why_source ||= \"\"\n end",
"title": ""
},
{
"docid": "9e77225f9ad6e04c83bb9ac3a5395282",
"score": "0.5398837",
"text": "def inplace_editable_default_display_with(value); value; end",
"title": ""
},
{
"docid": "eddb102738819e4d376a9541f7295ce2",
"score": "0.53926986",
"text": "def display_players_defaults\n players.each do |player|\n display_template_bind(\"ttt_players\", player.template_binding)\n end\n display_template_bind(\"ttt_first_player\", first_player.template_binding)\n end",
"title": ""
},
{
"docid": "6c80807f73ae0434897f998077864c4e",
"score": "0.5339985",
"text": "def default_place\n [:noplace, :baduelle, :baltimora];\n end",
"title": ""
},
{
"docid": "00dd4c3a99f9d08251500c37f9a15b5e",
"score": "0.5306842",
"text": "def fill_missing_fields\n unless self.title.blank?\n self.menu_name = self.title if self.menu_name.blank?\n self.shortcut = self.title.parameterize.html_safe if self.shortcut.blank?\n else\n unless self.menu_name.blank?\n self.title = self.menu_name if self.title.blank?\n self.shortcut = self.menu_name.parameterize.html_safe if self.shortcut.blank?\n end\n end\n end",
"title": ""
},
{
"docid": "00e02af2b75e36ef96e15bd34af55188",
"score": "0.53045624",
"text": "def missing_translation_placeholder field\n evaluate_localization_option!(:placeholder, field)\n end",
"title": ""
},
{
"docid": "6f7fa917e0b57add1ecf322cd73ab89a",
"score": "0.5277425",
"text": "def set_text_placeholders(text)\n return \"\" if text.nil?\n # set application applicable year placeholder\n if text.include? '<application-applicable-year-placeholder>'\n text.sub! '<application-applicable-year-placeholder>', (@model.class.to_s == \"FinancialAssistance::Application\" ? @model.family.application_applicable_year.to_s : @model.application.family.application_applicable_year.to_s)\n else\n text\n end\n end",
"title": ""
},
{
"docid": "cb330fbe428c1210a2454929ae4e3073",
"score": "0.5265077",
"text": "def inject_placeholder(collection)\n placeholder = if options[:include_blank]\n placeholder_option(options[:include_blank])\n elsif options[:prompt] && options[:value].nil?\n placeholder_option(options[:prompt])\n end\n\n collection.unshift(placeholder) if placeholder\n\n collection\n end",
"title": ""
},
{
"docid": "6539e153fac8a592cad887f2165f9802",
"score": "0.5257801",
"text": "def info_defaults\n [:dn, :email, :firstName, :lastName, :fullName, :citizenshipStatus,\n :country, :grantBy, :organizations, :uid, :dutyorg, :visas,\n :affiliations]\n end",
"title": ""
},
{
"docid": "b916d1c6e0b8de9120a42d8f26fa1dd1",
"score": "0.5234122",
"text": "def default_url\n PLACEHOLDER_URL\n end",
"title": ""
},
{
"docid": "26e4323fc72d27bc70ad6880dfe071b5",
"score": "0.5233204",
"text": "def is_placeholder?(fieldname)\n self.class.placeholders.include?(fieldname.to_sym)\n end",
"title": ""
},
{
"docid": "8bf6e591001447f5f8f28fdea14a54bc",
"score": "0.5207139",
"text": "def set_defaults\n self.help ||= ENV['help_text']\n self.help_url ||= ENV['help_url']\n self.created_at ||= DateTime.current\n end",
"title": ""
},
{
"docid": "a5314dc884e5c30d28dccfc7d2d36d2e",
"score": "0.52045786",
"text": "def defaults\n {\n :key_index => { \"1\" => \"red\", \"2\" => \"green\", \"3\" => \"blue\" },\n :form_options => { :alt => 'AntiSpam Image', :class => 'antispam-image', :path => '/images/antispam', :extension => 'png' },\n :error_message => \"Spam Detected! Please make sure you've properly answered the anti spam question.\"\n }\n end",
"title": ""
},
{
"docid": "2fd33bcb14feb0af2fb3309a85e27516",
"score": "0.5194691",
"text": "def defaults_str\n \"\"\n end",
"title": ""
},
{
"docid": "81439b0ebe00f180744bc683ddaa5fdb",
"score": "0.51895374",
"text": "def default_input_html; {} end",
"title": ""
},
{
"docid": "5af7fa2f003521a0f47d911ea8e5f2fb",
"score": "0.518674",
"text": "def set_text_placeholders(text) # rubocop:disable Naming/AccessorMethodName\n return \"\" if text.nil?\n # set application applicable year placeholder\n if text.include? '<application-applicable-year-placeholder>'\n text.sub! '<application-applicable-year-placeholder>', FinancialAssistanceRegistry[:application_year].item.call.value!.to_s\n else\n text\n end\n end",
"title": ""
},
{
"docid": "12c9447621ff768bea22015617a9eafd",
"score": "0.5180035",
"text": "def requires_placeholder_type_specifiers?\n true\n end",
"title": ""
},
{
"docid": "d419f525edf5f74e91a4d7cc1c17ac03",
"score": "0.51769656",
"text": "def set_defaults\n\t\tself.main_image ||= PlaceholderConcern.image_generator(height: '200', width: '300')\n self.sport_icon ||= PlaceholderConcern.image_generator(height: '40', width: '40')\n\tend",
"title": ""
},
{
"docid": "230abd4d3d8f42b5edf416cd853205d1",
"score": "0.5166998",
"text": "def set_defaults\n\t\tself.main_image ||= Placeholder.image_generator(height: '200', width: '200')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '300', width: '300')\n\tend",
"title": ""
},
{
"docid": "d252ccd035393ab5fc834eee708b7984",
"score": "0.5157793",
"text": "def set_defaults\n\t\tself.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n\tend",
"title": ""
},
{
"docid": "0373e607cb4c6fb03f2be0fcf0c44eaf",
"score": "0.5153928",
"text": "def load_default_config\n self[:disable_html] ||= true\n self[:url_target] ||= \"_BLANK\"\n self[:image_alt] ||= \"Posted Image\"\n self[:table_width] ||= \"100%\"\n self[:syntax_highlighter] ||= :raw\n self[:coderay_options] ||= {}\n end",
"title": ""
},
{
"docid": "09fe8460c47713de1a755140b0edae5c",
"score": "0.5141605",
"text": "def default_description\n options[:default_description]\n end",
"title": ""
},
{
"docid": "afea1353381f0cdf302307d32dee4226",
"score": "0.514146",
"text": "def placeholders\n begin\n @code.scan(/\\{([a-z0-9_]{1,})\\}/).collect { |ph| ph.first }\n rescue\n []\n end\n end",
"title": ""
},
{
"docid": "442e4fba973b2391b987a4b08c8143a6",
"score": "0.5135374",
"text": "def hint_text\n return '' unless @field_config[:hint]\n\n <<~HTML\n <div style=\"display:none\" data-cb-hint=\"#{@page_config.name}_#{@field_name}\">\n #{@field_config[:hint]}\n </div>\n HTML\n end",
"title": ""
},
{
"docid": "a0343dcf3b972bc7e1b04c8297d4282e",
"score": "0.5129212",
"text": "def default_values\n @query = \"default values\"\n end",
"title": ""
},
{
"docid": "6594a673001764ecfdfdb3ae36aaeaa5",
"score": "0.51290697",
"text": "def placeholder(&block)\n\t\t\tkey = \"‡‡‡‡‡PLACEHOLDER¤#{@placeholders.length+1}‡‡‡‡‡\".to_sym\n\t\t\t@placeholders[key] = block\n\t\t\tkey\n\t\tend",
"title": ""
},
{
"docid": "36cbd39662b988ed52f8b6d732fb5cf7",
"score": "0.5113391",
"text": "def url_placeholders\n @url_placeholders ||= Drops::UrlDrop.new(self)\n end",
"title": ""
},
{
"docid": "822010b1101e856f0c47cf36f18ca113",
"score": "0.5110779",
"text": "def debug_prompt\n\t\t_fmt(:white, super)\n\tend",
"title": ""
},
{
"docid": "5253e68dbe73de600809a2b0cf3d9db0",
"score": "0.51043576",
"text": "def required_defaults; end",
"title": ""
},
{
"docid": "e5c609f33cb01f6a28c6d35b8e3be8ad",
"score": "0.50884813",
"text": "def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"title": ""
},
{
"docid": "059042ce18bc41b2042872b463a1fa17",
"score": "0.5085232",
"text": "def filter_hint_form_value(field, value=\"\")\n value.gsub(I18n.t(\"form.input.#{field}.hint\"), \"\")\n end",
"title": ""
},
{
"docid": "8a8a8bea95e2aaf8b9f332aa12d685a6",
"score": "0.50617015",
"text": "def append_default( )\n if @question =~ /([\\t ]+)\\Z/\n @question << \"|#{@default}|#{$1}\"\n elsif @question == \"\"\n @question << \"|#{@default}| \"\n elsif @question[-1, 1] == \"\\n\"\n @question[-2, 0] = \" |#{@default}|\"\n else\n @question << \" |#{@default}|\"\n end\n end",
"title": ""
},
{
"docid": "2512370a0096f955b8f3af194d327f65",
"score": "0.50578797",
"text": "def set_defaults\n\t\tself.badge ||= Placeholder.image_generator(height: '150', width: '150')\n\tend",
"title": ""
},
{
"docid": "c255c2fb90613fd5b01e17aa53dc35e0",
"score": "0.50449085",
"text": "def show_default_table\n\t\tshow_table(\"Options\", 2, @skeys, @lkeys, @kvals, @kdescriptions)\n\tend",
"title": ""
},
{
"docid": "8e5fdabb349202a40d27e8b076610061",
"score": "0.50442225",
"text": "def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"title": ""
},
{
"docid": "8e5fdabb349202a40d27e8b076610061",
"score": "0.50442225",
"text": "def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"title": ""
},
{
"docid": "8e5fdabb349202a40d27e8b076610061",
"score": "0.50442225",
"text": "def set_defaults\n self.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n self.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n end",
"title": ""
},
{
"docid": "b57c16daf09234f669afee6c5b035968",
"score": "0.50340915",
"text": "def set_defaults\n\t\t#when ever you are creating a new portfolio item (nothing else)\n\t\t#||= means if nil, replace with this:\n\t\tself.main_image ||= Placeholder.image_generator(height: '600', width: '400')\n\t\tself.thumb_image ||= Placeholder.image_generator(height: '350', width: '200')\n\tend",
"title": ""
},
{
"docid": "467db4bb2874c2ab5e7eda6e89da555d",
"score": "0.50031",
"text": "def defaults()\n @height ||= 200\n @width ||= 350\n @filename ||= \"文件名\"\n @title ||= \"文章标题\"\n @smalltitle ||= \"文章小标题\"\n @foot ||= \"页脚\"\n end",
"title": ""
},
{
"docid": "6d4fbd6a878848fb43dd4cd47eab1cbf",
"score": "0.49821866",
"text": "def donation_request_explanation_with_default\n donation_request_explanation_without_default || Configuration.default_donation_message % owner.display_name\n end",
"title": ""
},
{
"docid": "c700a0aa2da44fc6ec9440f0fa1beab3",
"score": "0.4980791",
"text": "def set_initial_values\n self.hints_used = 0\n end",
"title": ""
},
{
"docid": "829d116b40298e81f413f8ea587d09d0",
"score": "0.4974765",
"text": "def search_input_placeholder(ctrlr = nil, **opt)\n # noinspection RubyMismatchedReturnType\n search_input_type(ctrlr, **opt)[:placeholder]\n end",
"title": ""
},
{
"docid": "328a6116c823d237891c0852a9e65feb",
"score": "0.49712485",
"text": "def default_values\n self.mode ||= 'challenge_quick'\n end",
"title": ""
},
{
"docid": "fc8585e189afade85d3432f3bee1c429",
"score": "0.49665913",
"text": "def render_missing_snip(snip_name)\n \"[snip '#{snip_name}' cannot be found]\"\n end",
"title": ""
},
{
"docid": "1ff8aca43ee0523e12b47ebe43da075b",
"score": "0.4932776",
"text": "def default_values\n self.tramito = 'Lic. Hector Hernandez Rolon' unless self.tramito\n self.autorizo = 'Dr. Salvador Becerra Rodriguez' unless self.autorizo\n end",
"title": ""
},
{
"docid": "70c7f3badcdfdbd4dbe7779168c0024b",
"score": "0.4931526",
"text": "def default_values\n if self.new_record?\n self.email_at_notices ||= Errbit::Config.email_at_notices\n end\n end",
"title": ""
},
{
"docid": "f1fcb831a880dda19cdb51dc7de90681",
"score": "0.49187446",
"text": "def restrict_default_value\n self.content = nil if self.content.eql?('Edit this text to see the text area expand and contract.')\n end",
"title": ""
},
{
"docid": "0b6818a9cf698dad60e0eec6e7f57034",
"score": "0.49168208",
"text": "def defaults()\n\t\t@height ||= 200\n\t\t@width ||= 350\n\t\t@title ||= \"Savable Settings Demo\"\n\t\t@text ||= \"Try changing the window size, title and text in this window. You will see that it saves its state \" +\n\t\t\t\"to a file named settings.yaml. So when you run this program again, it will be the same as \" +\n\t\t\t\"when you left. To see this file, click the 'Refresh' button. To reset to \" +\n\t\t\t\"defaults, just delete settings.yaml.\"\n\tend",
"title": ""
},
{
"docid": "6652b03c9f170265e4c72ee2c80ab009",
"score": "0.49163315",
"text": "def test_undefined_models\n [true, false].each do |with_debug_or_not|\n ArkanisDevelopment::SimpleLocalization::Language.debug = with_debug_or_not\n assert_nil UndefinedModel.localized_model_name\n assert_equal 'name'.humanize, UndefinedModel.human_attribute_name('name')\n end\n end",
"title": ""
},
{
"docid": "60a3b629ba0b8a13af2981ac6350b203",
"score": "0.49160072",
"text": "def url_placeholders\n {\n :path => @dir,\n :basename => basename,\n :output_ext => output_ext,\n }\n end",
"title": ""
},
{
"docid": "ceb22762168fec0fb8f5e6b1301bdc25",
"score": "0.4908401",
"text": "def empty_trap_required\n is_human = true\n params.slice(*TheCommentsBase.config.empty_inputs).values.each{|v| is_human = (is_human && v.blank?) }\n\n if !is_human\n k = t('the_comments.trap')\n v = t('the_comments.trap_message')\n @errors[ k ] = [ v ]\n end\n end",
"title": ""
},
{
"docid": "e6c34d3e484b8ac32ca9037f6de7e76b",
"score": "0.4907595",
"text": "def display_unconfigured_elements\n elts = @unconf_elts.keys\n if elts.empty?\n puts \"The document contains no unconfigured elements.\"\n else\n puts \"The following document elements were assigned no formatting options:\"\n puts line_wrap(elts.sort.join(\" \"), 0, 0, 65).join(\"\\n\")\n end\n\n elts.each do |elt_name|\n @elt_opts.delete(elt_name)\n end\n end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "de19c51c3af8f2b7f87d063f19e973fb",
"score": "0.4896885",
"text": "def defaults; end",
"title": ""
},
{
"docid": "4949419be4569ebac7a419b42c60b5ef",
"score": "0.4896132",
"text": "def set_defaults\n self.badge ||= Placeholder.image_generator(height: '250', width: '250') \n end",
"title": ""
},
{
"docid": "7ad2a0c4be2028362d8884518cd28b17",
"score": "0.48875746",
"text": "def default_fields\n Sunspot::Search::Hit::SPECIAL_KEYS.to_a\n end",
"title": ""
},
{
"docid": "091c6e5c7d81b741b75bf1a6eda31181",
"score": "0.4884871",
"text": "def default_parameter_for(options)\n default, allow_nil = options.values_at(:default, :allow_nil)\n return ' nil' if default.nil? && allow_nil\n return '' if default.nil? && !allow_nil\n\n \" #{prefix(default)}#{default}#{suffix(default)}\"\n end",
"title": ""
},
{
"docid": "478be14b712da469b171688f332208b1",
"score": "0.4865669",
"text": "def default_content; end",
"title": ""
},
{
"docid": "7ecaa8a24e802ece77ab14fd4547837e",
"score": "0.4865388",
"text": "def default_value_for_description\n warn(\"Using README as description\")\n # RubyGems refuses to build a gem if the description contains `FIXME` or `TODO`,\n # which are perfectly valid words to use in a description, but alas.\n @chunked_source.readme.gsub(/FIXME/i, \"FIZZIX-ME\").gsub(/TODO/i, \"TOODLES\")\n end",
"title": ""
},
{
"docid": "8a280fe47b31b4b3dfdf8eea8d609c8e",
"score": "0.4858932",
"text": "def defaults\n self.searchable ||= false\n self.displayable ||= true\n self.facetable ||= false\n self.multivalued ||= false\n self.sortable ||= false\n self.data_type ||= \"string\"\n end",
"title": ""
},
{
"docid": "5f3c29c0ccdbc7f677a4af27960e1156",
"score": "0.48446438",
"text": "def get_default_field_options\n @default_field_options ||= {\n :suppress_fields => []\n }\n end",
"title": ""
},
{
"docid": "498bd3dc4d121fe567c6dfc04b20d3e9",
"score": "0.4844312",
"text": "def dummy\r\n N_('Open')\r\n N_('Close')\r\n N_('close')\r\n N_('Edit')\r\n N_('Delete')\r\n N_('Show')\r\n N_('Search')\r\n N_('Search Terms')\r\n N_('No Entries')\r\n N_('Found')\r\n N_('Create New')\r\n N_('Are you sure?')\r\n N_('Cancel')\r\n end",
"title": ""
},
{
"docid": "bef34366fbcf78d20c34ce84c2e6bde3",
"score": "0.48316926",
"text": "def _validates_default_keys\n %i[if unless on allow_blank allow_nil strict]\n end",
"title": ""
},
{
"docid": "22ac849c68d529897144d1ab552c454b",
"score": "0.4796875",
"text": "def set_default_data\n return unless issues_tracker.present?\n\n self.title ||= issues_tracker['title']\n\n # we don't want to override if we have set something\n return if project_url || issues_url || new_issue_url\n\n data_fields.project_url = issues_tracker['project_url']\n data_fields.issues_url = issues_tracker['issues_url']\n data_fields.new_issue_url = issues_tracker['new_issue_url']\n end",
"title": ""
},
{
"docid": "fb3e64133003d635534068ae3172e043",
"score": "0.47931728",
"text": "def notes\n @default_options.fetch(:notes, nil)\n end",
"title": ""
},
{
"docid": "1c1f9b2749c53039a66f916d0eab719b",
"score": "0.4792212",
"text": "def prepared_arg_placeholder\n PREPARED_ARG_PLACEHOLDER\n end",
"title": ""
},
{
"docid": "b9f5f1e6aad57ddcdc04c693751494a6",
"score": "0.47764024",
"text": "def missing_field( err = 'none', color: '#d2d2d2' )\n \"<em style='color: #{color};'>(#{err})</em>\".html_safe\n end",
"title": ""
},
{
"docid": "3fd9e11b151c3e548f5563cd772c5bc3",
"score": "0.47743022",
"text": "def defaults!\n @badge_enabled = true\n @badge_position = 'top-left'\n @page_size = 25\n @webpacker_enabled = true\n end",
"title": ""
},
{
"docid": "91a3525d2b1d1072d17b3a4a4b78d3e6",
"score": "0.47607088",
"text": "def default_options; {} end",
"title": ""
},
{
"docid": "9579341445de6efce3267f4dd7449c2b",
"score": "0.47557274",
"text": "def set_defaults\n self.published ||= false\n self.archived ||= false\n self.is_default ||= false\n self.version ||= 0\n self.visibility = ((self.org.present? && self.org.funder_only?) || self.is_default?) ? Template.visibilities[:publicly_visible] : Template.visibilities[:organisationally_visible] unless self.id.present?\n self.customization_of ||= nil\n self.family_id ||= new_family_id\n self.archived ||= false\n self.links ||= { funder: [], sample_plan: [] }\n end",
"title": ""
},
{
"docid": "82ab1dcf8c5f385730ab02e94bcb9160",
"score": "0.475177",
"text": "def skip_include_blank?\n (options.keys & [:prompt, :include_blank, :default, :selected]).any? ||\n options[:input_html].try(:[], :multiple)\n end",
"title": ""
},
{
"docid": "9cb4f3a5d96fd1e38e2147b47f6c6661",
"score": "0.47463784",
"text": "def missing_data_params\n default_params\n end",
"title": ""
},
{
"docid": "a0d7dc850a78312f27c9f3d82e94172d",
"score": "0.47452605",
"text": "def default_options\n # {}\n end",
"title": ""
},
{
"docid": "fcf7691fc0070a65e6fdf68e3d56fbed",
"score": "0.4742601",
"text": "def default_field_template(l = {})\n <<-END\n <div data-role=\"fieldcontain\" id=\"#{l[:div_id]}\" class=\"field\">\n\t #{l[:label]}<br />\n #{l[:element]}#{l[:decoration]}\n #{\"<p class=\\\"field_description\\\">#{l[:description]}</p>\" unless l[:description].blank?}\n\t </div>\n\t END\n end",
"title": ""
},
{
"docid": "9d2c4a33e7cc9bb6dd4db348ce375f93",
"score": "0.47383383",
"text": "def request_placeholder\n \"JIRA Number: HIANDEV-XXXX\nSolution: HealtheAnalytics\nTest Date: 10-May-2017\nEnvironment: Staging\nOperating System: OS-X\nAssociate ID: AA00000\nPrerequisite Evidence: N/A\"\n end",
"title": ""
},
{
"docid": "9551b760702cf5a8fd3ed58d1ee4ac48",
"score": "0.47365612",
"text": "def default_url_options_without_override\n super.merge(alternate_name.present? ? {prefill: {alternate: alternate_name}} : {})\n end",
"title": ""
},
{
"docid": "f9185fd4d1f6bc7fa96c4f1d9c874178",
"score": "0.473411",
"text": "def placeholder_hidden_input\n if primitive?\n template.hidden_field_tag \"#{form_builder.object_name}[#{attribute_name}_attributes][]\", \"\"\n else\n template.hidden_field_tag \"#{form_builder.object_name}[#{attribute_name}_attributes][_kithe_placeholder][_destroy]\", 1\n end\n end",
"title": ""
},
{
"docid": "cf879f2f2fc235afe768ebf16ffc1c50",
"score": "0.47303477",
"text": "def field_supplied( field )\n return false if field.blank?\n return false if BLANK_PLACEHOLDERS.include?( field )\n return true\n end",
"title": ""
},
{
"docid": "e07cdbb077d272124a1f42193fed2043",
"score": "0.47238976",
"text": "def details_uncached\n return description unless description.blank?\n unless undescribable?\n return \"#{I18n.t('admin.medium.local_info.no_title')}.ID#{id}\"\n end\n ''\n end",
"title": ""
},
{
"docid": "ff88a99a81019731cf4efb1830345fe2",
"score": "0.4719732",
"text": "def set_defaults\n end",
"title": ""
},
{
"docid": "ff88a99a81019731cf4efb1830345fe2",
"score": "0.4719732",
"text": "def set_defaults\n end",
"title": ""
},
{
"docid": "6f3cf70b7f88b292357c7ddb20ea77cc",
"score": "0.47070417",
"text": "def default_values\n {name: \"default\", index: -1, experiment_id: nil}\n end",
"title": ""
}
] |
638b92f75060969e908a39f4f0ae5da4
|
DELETE /auction_values/1 DELETE /auction_values/1.json
|
[
{
"docid": "04a9af856fb12fe06a35876cd17e6bab",
"score": "0.735951",
"text": "def destroy\n @auction_value.destroy\n respond_to do |format|\n format.html { redirect_to auction_values_url, notice: 'Auction value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "6bf12f783aa62f086784e207da638f16",
"score": "0.6822444",
"text": "def destroy\n @auctionitems = AuctionItem.find(params[:id])\n @auctionitems .destroy\n\n respond_to do |format|\n format.html { redirect_to auction_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "813a76f25413591493b59c404f1d7d23",
"score": "0.68148655",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @auction.destroy\n\n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1a21c99a7128757a9511d792a97dc908",
"score": "0.68037724",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @auction.remove_auction\n\n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3ff59dbad49456c288c875e03b02d3de",
"score": "0.66852134",
"text": "def destroy\n @item_auction = ItemAuction.find(params[:id])\n @item_auction.destroy\n\n respond_to do |format|\n format.html { redirect_to item_auctions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8bfdbf589b907f4dde5f1d769a848942",
"score": "0.6665337",
"text": "def destroy\n @item.auction.destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to view_my_auctions_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8e448ff9240bd6b6429ea78689d829ef",
"score": "0.6645849",
"text": "def destroy\n @value = @asset.values.find(params[:id])\n @value.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "66d7d6ff61ea310983d7ca51a4759554",
"score": "0.66072094",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @auction.destroy\n \n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e3cc7337dd8d5b38616376ed8865f237",
"score": "0.65871334",
"text": "def destroy\n @coin_value = CoinValue.find(params[:id])\n @coin_value.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.6581103",
"text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end",
"title": ""
},
{
"docid": "bc5ddfbb3c919e40e3405771611d70e2",
"score": "0.65388346",
"text": "def destroy\n @mvs_auction = MvsAuction.find(params[:id])\n @mvs_auction.destroy\n\n respond_to do |format|\n format.html { redirect_to mvs_auctions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "aba49f0bf643c96543e7c380f61ee639",
"score": "0.6506946",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "179ff0053e8f4f967cb3d92206094cf0",
"score": "0.6494",
"text": "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"title": ""
},
{
"docid": "4fbd5284827d72874617075574f4c601",
"score": "0.6469575",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, notice: 'Auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4fbd5284827d72874617075574f4c601",
"score": "0.6469575",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, notice: 'Auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4fbd5284827d72874617075574f4c601",
"score": "0.6469575",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, notice: 'Auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4fbd5284827d72874617075574f4c601",
"score": "0.6469575",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, notice: 'Auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ac57520eb2f4b19cff201b6d227309a4",
"score": "0.6461843",
"text": "def destroy\n @auction_multibuy.destroy\n respond_to do |format|\n format.html { redirect_to auction_multibuys_url, notice: 'Multibuy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3ad1e017c505167b1c489dc9468c87f6",
"score": "0.6460974",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @auction.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_auctions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "46d7b4906249a878c220089cf7bc9edd",
"score": "0.6432464",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @auction.destroy\n\n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b445c184893647d3482f8fbc6a507a52",
"score": "0.6416551",
"text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end",
"title": ""
},
{
"docid": "73f5dc0c7e26681ab0003302fff565d8",
"score": "0.64109635",
"text": "def destroy\n @auction_configuration.destroy\n respond_to do |format|\n format.html { redirect_to auction_configurations_url, notice: 'Auction configuration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7e8d1caeeadb886dd02e8099c99223c3",
"score": "0.6405205",
"text": "def destroy\r\n @auction = Auction.find(params[:id])\r\n @auction.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(auctions_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"title": ""
},
{
"docid": "6e03fcf8eef80e7911b563c77908fe79",
"score": "0.63959444",
"text": "def destroy\n @income_value = IncomeValue.find(params[:id])\n @income_value.destroy\n\n respond_to do |format|\n format.html { redirect_to income_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5940997e1457f7ea2111f04abdecddde",
"score": "0.6368053",
"text": "def destroy\n @bell_value.destroy\n respond_to do |format|\n format.html { redirect_to bell_values_url, notice: 'Bell value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fb48355ea25b97f2dc25a8ab5ebb3860",
"score": "0.6358546",
"text": "def destroy\n @reagent_value = ReagentValue.find(params[:id])\n @reagent_value.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "23e8bcc4e33d336f43fb162362ef5245",
"score": "0.63436824",
"text": "def destroy\n id = SecureRandom.uuid.to_s\n auction_id = params[:id]\n\n auction_info = {:id => id, :type => \"delete\", \n :auction_id => auction_id \n }\n\n publish :auction, JSON.generate(auction_info)\n\n status, @error = get_success(id)\n\n if status \n @status = \"Auction deleted!\"\n else\n @status = \"Auction could not be deleted\"\n end\n\n render 'confirm' \n end",
"title": ""
},
{
"docid": "cf7d5c93d7c9300c17d89a5f4f522765",
"score": "0.6321016",
"text": "def destroy\n @coin_value_attribute = @coin_value.coin_value_attributes.find(params[:id])\n @coin_value_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_value_coin_value_attributes_path([@coin_value]) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "72f21bf9b56fca16101544d56802433e",
"score": "0.6320305",
"text": "def destroy\n @attribute_test_value.destroy\n respond_to do |format|\n format.html { redirect_to attribute_test_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8fbd9a0571edc81d35a9f63c33bdbe5a",
"score": "0.6307105",
"text": "def destroy\n @real_value = RealValue.find(params[:id])\n @real_value.destroy\n\n respond_to do |format|\n format.html { redirect_to real_values_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2070f20800d116e6cb91e24d0f7a49a3",
"score": "0.6281007",
"text": "def destroy\n @stat_value = StatValue.find(params[:id])\n @stat_value.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4df19d9366f8e33885dd1e2b8b14ae64",
"score": "0.62809485",
"text": "def destroy\n @vehicle_auto_auction.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_auto_auctions_url, notice: 'Vehicle auto auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a12e4430e5a77d2429bfcb56dcc3b5d",
"score": "0.6266077",
"text": "def destroy\n budget_item = BudgetItem.find(params[:id])\n budget_item.destroy\n render :json => 'success'\nend",
"title": ""
},
{
"docid": "fb3562959a1773355b4c0b81c4e6f783",
"score": "0.62504005",
"text": "def destroy\n @simple_value = SimpleValue.find(params[:id])\n @simple_value.destroy\n\n respond_to do |format|\n format.html { redirect_to simple_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "116f7d083680c722a2a128d8ea743c9b",
"score": "0.6213041",
"text": "def destroy\n @custom_value = CustomValue.find(params[:id])\n @custom_value.destroy\n\n respond_to do |format|\n format.html { redirect_to custom_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "773e5d611adeb09776f9c841e1b876cc",
"score": "0.6209582",
"text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end",
"title": ""
},
{
"docid": "545636f0012ddeda51afbe94b3a136ee",
"score": "0.6209141",
"text": "def destroy\n @value_item.destroy\n respond_to do |format|\n format.html { redirect_to value_items_url, notice: 'Value item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f128646684747725713c9184560358cb",
"score": "0.6206563",
"text": "def destroy\n @api_v1_budget.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b5d1baad2807103268dc79ada866e56c",
"score": "0.6189656",
"text": "def destroy\n @api_v1_budget_item.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_budget_items_url, notice: 'Budget item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a2c09f627238a3d785b4a43eac33d5bc",
"score": "0.6185174",
"text": "def destroy\n @item_value = ItemValue.find(params[:id])\n @item_value.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_values_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "61de9dc307661a4481a25e8c990cabbf",
"score": "0.61840165",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n flash[:info] = 'Auction was successfully deleted.'\n format.html { redirect_to admin_panel_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f714cd980c07b5a5850860c20c08ebda",
"score": "0.61672235",
"text": "def destroy\n @api_stadium.destroy\n respond_to do |format|\n format.html { redirect_to api_stadia_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2cc699314fe02c8bdc70bdb0b8b127d",
"score": "0.6166597",
"text": "def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a01f7fc207254aa41430ef62120625c6",
"score": "0.6165012",
"text": "def destroy\n @coin = @coin_value.coins.find(params[:id])\n @coin.destroy\n\n respond_to do |format|\n format.html { redirect_to coin_value_coins_path(@coin_value) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5fe16f76af591cf128c0088bcb867e19",
"score": "0.6161175",
"text": "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5fe16f76af591cf128c0088bcb867e19",
"score": "0.6161175",
"text": "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5fe16f76af591cf128c0088bcb867e19",
"score": "0.6161175",
"text": "def destroy\n @bid.destroy\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.616099",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "7c4c82a10b57e7188a898eee33a1a1cc",
"score": "0.61608344",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to sell_url }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f22bb82a543b88255d8ead6f83e6c781",
"score": "0.61495847",
"text": "def destroy\n @catalog_auction.destroy\n respond_to do |format|\n format.html { redirect_to catalog_auctions_url, notice: 'Catalog auction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "726dea3821fe6606641606af9512d611",
"score": "0.6149105",
"text": "def destroy\n @budget_item.destroy\n respond_to do |format|\n format.html { redirect_to client_budget_mobile_url(@client, @budget, @mobile), notice: \"Item deletado com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c06ff180c611c9538d5fc149513af011",
"score": "0.6145714",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, notice: 'Auction was successfully destroyed.' }\n end\n end",
"title": ""
},
{
"docid": "74b0b7da4a0618077208a67db0b91227",
"score": "0.61443627",
"text": "def destroy\n @expense_value = ExpenseValue.find(params[:id])\n @expense_value.destroy\n\n respond_to do |format|\n format.html { redirect_to expense_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae0626ea3c4594f2fd6bfff81dafbc09",
"score": "0.61435455",
"text": "def destroy\n @itemholdon.destroy\n respond_to do |format|\n format.html { redirect_to itemholdons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0b6cd550fde1e38ad58fa775dd15d97",
"score": "0.6141139",
"text": "def destroy\n @auction = Auction.find(params[:id])\n @search = Item.search(params[:search])\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "33ae3fbaabb68170de9f95477c22d5d1",
"score": "0.6140357",
"text": "def delete_json(path)\n retries = 0\n begin\n return resource(path).delete()\n rescue => e\n if e.kind_of?(RestClient::Exception) and e.http_code == 503 and retries < RETRY_503_MAX\n # the G5K REST API sometimes fail with error 503. In that case we should just wait and retry\n puts(\"G5KRest: DELETE #{path} failed with error 503, retrying after #{RETRY_503_SLEEP} seconds\")\n retries += 1\n sleep RETRY_503_SLEEP\n retry\n end\n handle_exception(e)\n end\n end",
"title": ""
},
{
"docid": "1d181e78896301aca69c100901572edb",
"score": "0.6133918",
"text": "def destroy\n @metavalue.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Metavalue was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ac9616f9a7353d9bd6e82f364aa4943",
"score": "0.6125928",
"text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend",
"title": ""
},
{
"docid": "7ac9616f9a7353d9bd6e82f364aa4943",
"score": "0.6125928",
"text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend",
"title": ""
},
{
"docid": "60d39d0cfc2971e89a07bfadd68405fd",
"score": "0.61255425",
"text": "def destroy\n @auction_level.destroy\n respond_to do |format|\n format.html { redirect_to auction_levels_url, notice: 'Level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c181505ac0deedddfba684db419e428",
"score": "0.61247766",
"text": "def delete\n render json: Own.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "d7187115e7ae7b714181b8243204f120",
"score": "0.6115828",
"text": "def destroy\n @alternate_value.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Alternate value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "295679bd7f985be688875ea757fff132",
"score": "0.6104889",
"text": "def destroy\n @statusvalue = Statusvalue.find(params[:id])\n @statusvalue.destroy\n\n respond_to do |format|\n format.html { redirect_to statusvalues_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fdb5222e60f67418931a74e6eb7c9a1d",
"score": "0.6101055",
"text": "def delete\n GoodData.delete(uri)\n end",
"title": ""
},
{
"docid": "f848d1c3ba8abe864882ce035e6a9bfe",
"score": "0.6099856",
"text": "def destroy\r\n @order_auction.destroy\r\n respond_to do |format|\r\n format.html { redirect_to order_auctions_url, notice: 'Order auction was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "5f265dc4781149a2e23537165c4ff5a8",
"score": "0.6099646",
"text": "def destroy\n @auction_table = AuctionTable.find(params[:id])\n @auction_table.destroy\n\n respond_to do |format|\n format.html { redirect_to(auction_tables_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8dd36523fb45422047df96d155b6177e",
"score": "0.6092357",
"text": "def delete!\n json = web_method_call( {\n :method => 'smugmug.albums.delete',\n :album_id => album_id\n })\n\n nil\n end",
"title": ""
},
{
"docid": "0b24cbc6495df3923ea7679acbcd8deb",
"score": "0.60920393",
"text": "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"title": ""
},
{
"docid": "0387aa3c568d857184e97a214e580a14",
"score": "0.609006",
"text": "def delete(path, params = {}, payload = {})\n JSON.parse Generic.delete(@base_url, @headers, path, params, payload)\n end",
"title": ""
},
{
"docid": "d8ea965d2a05b6048a21eb0f2314113f",
"score": "0.608679",
"text": "def destroy\n @t_value.destroy\n respond_to do |format|\n format.html { redirect_to t_values_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e707575d7c1283ed2c95aa8822dd37dc",
"score": "0.6085848",
"text": "def destroy\n @contract_budget_item.destroy\n respond_to do |format|\n format.html { redirect_to contract_budget_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1d795b07fd558db9384c983cdeaa4199",
"score": "0.60664964",
"text": "def destroy\n budget = Budget.find(params[:id])\n\n budget.destroy\n\n render :json => { :destroyed => true }\n end",
"title": ""
},
{
"docid": "6f0894be9636ba58ab89a69c94bbf56c",
"score": "0.60661906",
"text": "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to client_budgets_url(@client), notice: 'Orçamento deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ed34b478e8f5bd061a15e9ad902c700f",
"score": "0.60650545",
"text": "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ed34b478e8f5bd061a15e9ad902c700f",
"score": "0.60650545",
"text": "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ed34b478e8f5bd061a15e9ad902c700f",
"score": "0.60650545",
"text": "def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6f9230037aea122cdbfc0fe72ecc5e1e",
"score": "0.6064159",
"text": "def destroy\n @balance.destroy\n\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4cd25efe0b9d0d49be8fc54f7752585a",
"score": "0.6058292",
"text": "def destroy\n @benchmark_value = BenchmarkValue.find(params[:id])\n @benchmark_value.destroy\n\n respond_to do |format|\n format.html { redirect_to benchmark_values_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ac2a9ae4c9c15429797c761914af6c94",
"score": "0.6056446",
"text": "def destroy\n @automount = Automount.find(params[:id])\n @automount.destroy\n\n respond_to do |format|\n format.html { redirect_to automounts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "896d8e3ea2d7c112060e6fdff978c642",
"score": "0.6054954",
"text": "def destroy\n @budget_item = BudgetItem.find(params[:id])\n @budget_item.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cf50a61006b0e6b3ec20f9114e0ec910",
"score": "0.6051421",
"text": "def destroy\n @datavalue = Datavalue.find(params[:id])\n @datavalue.destroy\n\n respond_to do |format|\n format.html { redirect_to datavalues_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c1cde2518cb592b6add14fe05ae1b37d",
"score": "0.6048666",
"text": "def delete\n options = self.to_h \n uri = self.class.path_builder(:delete, self.id)\n data = {}\n data['id'] = self.id \n data = data.to_json\n VivialConnect::Client.instance.make_request('DELETE', uri, data)\n end",
"title": ""
},
{
"docid": "f42326c808655d15108038e2d41429f8",
"score": "0.6047306",
"text": "def destroy\n @record = AssetCycleFact.find(params[:id])\n @record.trash\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9c8ef0b4313fef9d26c4290371bc530d",
"score": "0.6037626",
"text": "def delete!\n client.delete(:path => base_path)\n nil\n end",
"title": ""
},
{
"docid": "6c75090b922adb645c13cf4266b09695",
"score": "0.60365725",
"text": "def destroy\n @auction.destroy\n respond_to do |format|\n format.html { redirect_to auctions_url, danger: 'Product is successfully removeld from auction.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "56f0b77fbb74b2e0d3a287d19fd512df",
"score": "0.60341495",
"text": "def destroy\n @value.destroy\n respond_to do |format|\n format.html {redirect_to values_path, notice: \"Valor foi excluído\"}\n format.json {head :no_content}\n end\n end",
"title": ""
},
{
"docid": "329bd33bcbabaaf4647d6018fc11a882",
"score": "0.60340565",
"text": "def destroy\n @liquor_license_auction = LiquorLicenseAuction.find(params[:id])\n @liquor_license_auction.destroy\n\n respond_to do |format|\n format.html { redirect_to(liquor_license_auctions_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "96f2d4750d88864f8e0c11059ef1fe5a",
"score": "0.6030404",
"text": "def destroy\n @biketour = Biketour.find(params[:id])\n @biketour.destroy\n\n respond_to do |format|\n format.html { redirect_to biketours_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a21726cde9e0a1a061c3fd5077c38a2",
"score": "0.60293484",
"text": "def delete_aos_version_box(args = {}) \n delete(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend",
"title": ""
},
{
"docid": "6c42285262fde27057eec63381eada53",
"score": "0.60228544",
"text": "def destroy\n @heightweightvalue = Heightweightvalue.find(params[:id])\n @heightweightvalue.destroy\n\n respond_to do |format|\n format.html { redirect_to(heightweightvalues_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6b1a753ae41f93f127136a5789b0eeb3",
"score": "0.60210735",
"text": "def destroy\n @indicator_value.destroy\n respond_to do |format|\n format.html { redirect_to indicator_values_url, notice: 'Indicator value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a0bb5494a01da87e704f72598117899c",
"score": "0.6019627",
"text": "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a0bb5494a01da87e704f72598117899c",
"score": "0.6019627",
"text": "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a0bb5494a01da87e704f72598117899c",
"score": "0.6019627",
"text": "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "099d573b9af85c768a83e94bdf9b2a7f",
"score": "0.6015883",
"text": "def delete(value)\n end",
"title": ""
},
{
"docid": "6b0c4297e2fd9c553acfa376efa3e4c1",
"score": "0.60150653",
"text": "def destroy\r\n @value_set = ValueSet.find(params[:id])\r\n @value_set.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to value_sets_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"title": ""
},
{
"docid": "6994abe1b2246c92fdcec4f91409a03c",
"score": "0.60030055",
"text": "def destroy\n @attribute_value.destroy\n respond_to do |format|\n format.html { redirect_to attribute_values_url, notice: 'Attribute value was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6f5749f16b100b18afd7654d284cb162",
"score": "0.600037",
"text": "def destroy\n # @low_chamber_vote = LowChamberVote.find(params[:id])\n @low_chamber_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to low_chamber_votes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "19f61815ef5e40da5be13a5fdf99e932",
"score": "0.599698",
"text": "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "19f61815ef5e40da5be13a5fdf99e932",
"score": "0.599698",
"text": "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "19f61815ef5e40da5be13a5fdf99e932",
"score": "0.599698",
"text": "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "698abbe8b394ade5a8f9c2f9ea77030e",
"score": "0.0",
"text": "def set_creation_category\n @creation_category = CreationCategory.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59219855",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5913137",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.589884",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889191",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58780754",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863248",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58094144",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57375425",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57285565",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57149214",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.56900954",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.56665677",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5651118",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648135",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56357735",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5627078",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.5608873",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5598699",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5598419",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.5589822",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5558845",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55084664",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5504379",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465574",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5464707",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54471064",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455084",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.5437386",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54160327",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5397424",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392518",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5385411",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53794575",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5357573",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53487605",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5346655",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53448105",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5342072",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5341318",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53243506",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53025913",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5283114",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5282289",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.52585614",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52571374",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52483684",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244467",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5236853",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52330637",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52300817",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.522413",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.521999",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215832",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213786",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.52100146",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.52085197",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5203262",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5202406",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.520174",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5201504",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51963276",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5191404",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178325",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51765746",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5162045",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5150735",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5143402",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51415485",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51398855",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51376045",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51318985",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115387",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110294",
"text": "def action\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.5109771",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5107364",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5106081",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51001656",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50964546",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5093199",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
29c8c4b051f8f9d912344a70d11adc7e
|
Use this for debugging purposes only...
|
[
{
"docid": "3f11419c43ce759af96af5c3c0c9bb70",
"score": "0.0",
"text": "def what_is_parent?\n puts @@classes[:parent]\n end",
"title": ""
}
] |
[
{
"docid": "07cbeffd3225c56b4a5d17ffad4af21a",
"score": "0.76367676",
"text": "def debug()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "c78eee6c6966cc915ed922822c723baa",
"score": "0.7629993",
"text": "def debug()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "c78eee6c6966cc915ed922822c723baa",
"score": "0.7629993",
"text": "def debug()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "f806f8c423fb12347a81fa630b0bdf51",
"score": "0.7584785",
"text": "def debug_output; end",
"title": ""
},
{
"docid": "f806f8c423fb12347a81fa630b0bdf51",
"score": "0.7584785",
"text": "def debug_output; end",
"title": ""
},
{
"docid": "f806f8c423fb12347a81fa630b0bdf51",
"score": "0.7584785",
"text": "def debug_output; end",
"title": ""
},
{
"docid": "4372fd4f69c6cbddd980211668e0d819",
"score": "0.7538499",
"text": "def debug; end",
"title": ""
},
{
"docid": "4372fd4f69c6cbddd980211668e0d819",
"score": "0.7538499",
"text": "def debug; end",
"title": ""
},
{
"docid": "9725dff5a6b8cb6fa61ecd0b454a4711",
"score": "0.7236953",
"text": "def debug!; end",
"title": ""
},
{
"docid": "82233fd7d184eec653098ab068ee6805",
"score": "0.7189145",
"text": "def debug?; end",
"title": ""
},
{
"docid": "cab006b8d0c64c93a8b85e3b308728c1",
"score": "0.7155604",
"text": "def debug\n end",
"title": ""
},
{
"docid": "e1f9301e1cedb32337e043617f998de1",
"score": "0.69324857",
"text": "def debug!; @debug=true; end",
"title": ""
},
{
"docid": "0b23368aea4b421ee66f6e93dda7642a",
"score": "0.69235504",
"text": "def current_debug\n #This is a stub, used for indexing\nend",
"title": ""
},
{
"docid": "401488bf6b8a0a74f1e3c6a9ca451ebb",
"score": "0.68799895",
"text": "def debug_print(msg); end",
"title": ""
},
{
"docid": "404ac6fd3adc46996d04106f5f1df61a",
"score": "0.6847833",
"text": "def debug_mode; end",
"title": ""
},
{
"docid": "884a55d3d2f78e5520f337ebd9ab8a73",
"score": "0.68447995",
"text": "def debug; @debug || false; end",
"title": ""
},
{
"docid": "fe114501a1390b9046cd24093bab4867",
"score": "0.6837651",
"text": "def debug? ; false ; end",
"title": ""
},
{
"docid": "06b4ae2004d6859794fa3b275bccb0eb",
"score": "0.67946386",
"text": "def yydebug()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "ab6e20b3ae17fb6fd8d9cb0804f58dc5",
"score": "0.67766154",
"text": "def debug_me\n pp self.inspect\n end",
"title": ""
},
{
"docid": "b37037fcdbf2daaaebcaa4fe29f082d3",
"score": "0.67431515",
"text": "def inspect_output; end",
"title": ""
},
{
"docid": "e2475ec1e458614b4ae000b226d500e9",
"score": "0.6742404",
"text": "def trace; end",
"title": ""
},
{
"docid": "e2475ec1e458614b4ae000b226d500e9",
"score": "0.6742404",
"text": "def trace; end",
"title": ""
},
{
"docid": "e2475ec1e458614b4ae000b226d500e9",
"score": "0.6742404",
"text": "def trace; end",
"title": ""
},
{
"docid": "e2475ec1e458614b4ae000b226d500e9",
"score": "0.6742404",
"text": "def trace; end",
"title": ""
},
{
"docid": "e2475ec1e458614b4ae000b226d500e9",
"score": "0.6742404",
"text": "def trace; end",
"title": ""
},
{
"docid": "e2475ec1e458614b4ae000b226d500e9",
"score": "0.67423546",
"text": "def trace; end",
"title": ""
},
{
"docid": "dfef23d4917a6844e6f2bfde85cf7d22",
"score": "0.6674783",
"text": "def trace?; end",
"title": ""
},
{
"docid": "dfef23d4917a6844e6f2bfde85cf7d22",
"score": "0.6674783",
"text": "def trace?; end",
"title": ""
},
{
"docid": "dfef23d4917a6844e6f2bfde85cf7d22",
"score": "0.6674783",
"text": "def trace?; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
},
{
"docid": "473108fa97cee58671b779c2ccfec06f",
"score": "0.66041315",
"text": "def inspect; end",
"title": ""
}
] |
a4bd6dad60f03f32f98d223e6eb15690
|
GET /bankets/1 GET /bankets/1.json
|
[
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] |
[
{
"docid": "b478e50bcf27145eb63f1b94e6cba26e",
"score": "0.74209857",
"text": "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end",
"title": ""
},
{
"docid": "5b2cb5adec5fe17dadd063ec02fbab7a",
"score": "0.7413908",
"text": "def index\n @banks = Bank.all\n render json: @banks\n end",
"title": ""
},
{
"docid": "3bce2a56ea949c4099ca3fe55b5165a3",
"score": "0.7079778",
"text": "def show\n render json: @bank\n end",
"title": ""
},
{
"docid": "20fbb504ad23adfc3c8b2cdec9058698",
"score": "0.7064105",
"text": "def index\n @bankets = Banket.all\n end",
"title": ""
},
{
"docid": "fd9096825c955e0e9d207bdec528ef7e",
"score": "0.701003",
"text": "def show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end",
"title": ""
},
{
"docid": "327f6d8b9e1b257639531f63ff3e22f1",
"score": "0.69089586",
"text": "def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end",
"title": ""
},
{
"docid": "b15ff5885b3c6d3fa79dce20e9b21da3",
"score": "0.6884841",
"text": "def index\n @banks = Bank.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banks }\n end\n end",
"title": ""
},
{
"docid": "8e711ef13cb1187832cfe6aebc57cdfe",
"score": "0.6879096",
"text": "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"title": ""
},
{
"docid": "d82ff7cf1bd9d2ec1c830756bc2f97af",
"score": "0.6802867",
"text": "def show\n @title = t('view.banks.show_title')\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end",
"title": ""
},
{
"docid": "2c121fb3f86d18b36e478f35197912c8",
"score": "0.6735408",
"text": "def index\n @bank_accounts = BankAccount.all\n render :json => @bank_accounts.to_json\n end",
"title": ""
},
{
"docid": "2d1ae097967286723bef6e3fb3331cde",
"score": "0.67252326",
"text": "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend",
"title": ""
},
{
"docid": "4a2b45925a115751df0545dedf8f60b6",
"score": "0.672463",
"text": "def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"title": ""
},
{
"docid": "68d920b8f87fc92435c7da1e34d2d1cf",
"score": "0.67204434",
"text": "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end",
"title": ""
},
{
"docid": "53a9d68c0a6e28521eaadb3be1cb66e2",
"score": "0.6717139",
"text": "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"title": ""
},
{
"docid": "a5407f8a25437c7a082b927e14222ccb",
"score": "0.66331",
"text": "def show\n @bruschettum = Bruschettum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bruschettum }\n end\n end",
"title": ""
},
{
"docid": "cc0b837b326baa875dce5082afd2b5b9",
"score": "0.6571266",
"text": "def index\n @bets = Bet.all\n end",
"title": ""
},
{
"docid": "7cba67eb5278730a68bff9a8d51b06ba",
"score": "0.6552814",
"text": "def index\n @utilized_bitcoin_wallets = UtilizedBitcoinWallet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @utilized_bitcoin_wallets }\n end\n end",
"title": ""
},
{
"docid": "111b4f0c6ecf31c93d8954bc01d0440b",
"score": "0.6551983",
"text": "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end",
"title": ""
},
{
"docid": "6c9ab7e1e0bc85fef5d89b69a9f008ba",
"score": "0.6505937",
"text": "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"title": ""
},
{
"docid": "a08788d9adeab1f8ca7df7b72824b04d",
"score": "0.6490335",
"text": "def index\n @money = Money.all\n require 'net/http'\n require 'json'\n @url = 'https://api.coinmarketcap.com/v1/ticker/'\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_money = JSON.parse(@response)\n end",
"title": ""
},
{
"docid": "1c00b1f8ed55042cf6b529d329e4cd8f",
"score": "0.64858145",
"text": "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"title": ""
},
{
"docid": "8ef701f198b4c61bf82f1bcd05950f70",
"score": "0.6481551",
"text": "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"title": ""
},
{
"docid": "324ae055b5439c2dfa3f852413b1e822",
"score": "0.6477081",
"text": "def show\n @breadcrumb = 'read'\n @bank = Bank.find(params[:id])\n @bank_offices = @bank.bank_offices.order(\"code\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end",
"title": ""
},
{
"docid": "9642f58fa3a8224d42d4f1c7a2f72ae4",
"score": "0.6453262",
"text": "def get_marketplace_bank_account\n Balanced::BankAccount.find(\"/v1/bank_accounts/BAj6sNNBdMp5WmY6PJ7sAu3\")\n end",
"title": ""
},
{
"docid": "f86cab27572c50f31d7f3878d36e10e5",
"score": "0.64344627",
"text": "def index\n render json: Bill.all\n end",
"title": ""
},
{
"docid": "33fc8e21e73f7b6cb6b61f9bca743545",
"score": "0.64295083",
"text": "def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"title": ""
},
{
"docid": "c40e0bb153086f2ce1e21b786b75df8d",
"score": "0.6427698",
"text": "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"title": ""
},
{
"docid": "5928468f0bf087b503a022f1608ca11d",
"score": "0.6417166",
"text": "def index\n @funds = Fund.all\n\n render json: @funds\n end",
"title": ""
},
{
"docid": "dae13b63983aa44582b14bcc9b28d413",
"score": "0.6390041",
"text": "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"title": ""
},
{
"docid": "07c28c17c9abfd18685fe5687cff3684",
"score": "0.63504696",
"text": "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end",
"title": ""
},
{
"docid": "a2f6078b717fee4dbd8796306d82ecd1",
"score": "0.6346772",
"text": "def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"title": ""
},
{
"docid": "cd63cae536231ed4f9ddbab3871dbfe2",
"score": "0.63376385",
"text": "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"title": ""
},
{
"docid": "4ff2ae01662a85fb8facbffe9f481bed",
"score": "0.63241565",
"text": "def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end",
"title": ""
},
{
"docid": "e48d3b6cf618d4abe01e9b55257eb45a",
"score": "0.6323776",
"text": "def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"title": ""
},
{
"docid": "93c904acdc8f0d7f647f57c3ee08ba80",
"score": "0.63207245",
"text": "def index\n @bets = Bet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bets }\n end\n end",
"title": ""
},
{
"docid": "00a226c4fd18011541ec66f182878c71",
"score": "0.63178366",
"text": "def show\n render \"api/v1/bounties/show\"\n end",
"title": ""
},
{
"docid": "40c109ec954dd1d0bb0dd109c5e494f4",
"score": "0.63055545",
"text": "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"title": ""
},
{
"docid": "fa5ac309bb1f91772268912a0baaaf37",
"score": "0.63014907",
"text": "def index\n @budgets = Budget.all\n end",
"title": ""
},
{
"docid": "a3a745b918cb8e3e306f43141bc3d32d",
"score": "0.6289201",
"text": "def index\n @avalaible_banks = AvalaibleBank.all\n end",
"title": ""
},
{
"docid": "19776ccc61bb3c7a49b0af52774e2d38",
"score": "0.62800044",
"text": "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end",
"title": ""
},
{
"docid": "ac7ae307458fb73ba7b72e24a2a9b986",
"score": "0.6259982",
"text": "def index\n @title = t('view.banks.index_title')\n @searchable = true\n @banks = Bank.filtered_list(params[:q]).page(params[:page])\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banks }\n end\n end",
"title": ""
},
{
"docid": "43003c1ac8a10a745648df6c3e6d123a",
"score": "0.6257311",
"text": "def index\n @bets = Bet.all\n respond_to do |format|\n format.html\n format.js\n end\n end",
"title": ""
},
{
"docid": "e205fd7feb652e6f0fa9cd4d3994d4e0",
"score": "0.6256308",
"text": "def show\n @bill = Bill.find(params[:id])\n\n render json: @bill\n end",
"title": ""
},
{
"docid": "12ea101542bab3130880457a7ba2bafe",
"score": "0.62542564",
"text": "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"title": ""
},
{
"docid": "4a4855304f5e432d193fed216ffa64c2",
"score": "0.62478715",
"text": "def show\n @banking_detail = BankingDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banking_detail }\n end\n end",
"title": ""
},
{
"docid": "98b77b2ce7399b3bc0f9d4fffcc9cc68",
"score": "0.62447375",
"text": "def my_bets\n @bets = Bet.where('owner = ? AND status != ? AND status != ?', params[:id], \"won\", \"lost\").to_a\n @bets.sort! {|x,y| x.id <=> y.id }\n render 'my-bets.json.jbuilder'\n end",
"title": ""
},
{
"docid": "3c5d761456c8c1dc36e25a735869382e",
"score": "0.6241921",
"text": "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end",
"title": ""
},
{
"docid": "9c87e74cd954311227e7494edd4d9f70",
"score": "0.62324727",
"text": "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end",
"title": ""
},
{
"docid": "0382563017f71f768645d1909a3a3ff7",
"score": "0.6196086",
"text": "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end",
"title": ""
},
{
"docid": "3706c803d934a8922170fdc54e3df416",
"score": "0.6183843",
"text": "def show\n @utilized_bitcoin_wallet = UtilizedBitcoinWallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utilized_bitcoin_wallet }\n end\n end",
"title": ""
},
{
"docid": "c3a6655b983baa434ac0eb2e325d4192",
"score": "0.6181878",
"text": "def index\n get_budgets\n end",
"title": ""
},
{
"docid": "493219d7e50949838c101393e66c20c9",
"score": "0.6178537",
"text": "def index\n @bank_transactions = BankTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bank_transactions, methods: :balance, callback: params[:callback] }\n format.xml { render xml: @bank_transactions, methods: :balance }\n end\n end",
"title": ""
},
{
"docid": "7434de9c0888830cf7b4b4e1336b45b5",
"score": "0.6174856",
"text": "def show\n @bet = Bet.find_all_by_id(params[:id])\n # session[\"last_bet_id\"] = @bet.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"title": ""
},
{
"docid": "91c393dcf0c11e958fb8cc749e459603",
"score": "0.6171194",
"text": "def show\n @image_bank = ImageBank.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_bank }\n end\n end",
"title": ""
},
{
"docid": "2b6ac06abfb57d71655c98449f57b340",
"score": "0.6169734",
"text": "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end",
"title": ""
},
{
"docid": "757f5faf41cef3c7fb6f4efca7585889",
"score": "0.6163996",
"text": "def show\n @blast = Blast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blast }\n end\n end",
"title": ""
},
{
"docid": "068cf3b5990506855a67b82d2b5e4136",
"score": "0.6163051",
"text": "def bank\n @session.get_bank @bank_id\n end",
"title": ""
},
{
"docid": "c03be01bb5a68f3b37463489d6526ae0",
"score": "0.61546063",
"text": "def index\n @bank_accounts = BankAccount.all\n @result = []\n @bank_accounts.each do |bank_accounts|\n @obj = {\n id: bank_accounts.id,\n account_number: bank_accounts.account_number,\n account_type: bank_accounts.account_type,\n bank: bank_accounts.bank,\n statu_id: bank_accounts.statu_id,\n user_id: bank_accounts.user_id,\n active: bank_accounts.active,\n approved: bank_accounts.approved,\n certificate: bank_accounts.certificate.attached? ? url_for(bank_accounts.certificate) : nil,\n created_at: bank_accounts.created_at,\n updated_at: bank_accounts.updated_at\n }\n @result << @obj\n end\n render json: @result\n end",
"title": ""
},
{
"docid": "049d31c729a5123bd98df156f8fa4755",
"score": "0.6148605",
"text": "def index\n @battery_banks = BatteryBank.all\n end",
"title": ""
},
{
"docid": "716d43b3f16242c0b01fe9591bfd8d68",
"score": "0.61465895",
"text": "def show\n @budgeting_type = BudgetingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgeting_type }\n end\n end",
"title": ""
},
{
"docid": "d54866b19b93ba320bd46ff80cb0c840",
"score": "0.61378163",
"text": "def index\n @personal_banks = PersonalBank.all\n end",
"title": ""
},
{
"docid": "53b7340c1290c73a7d6203cc41d037c1",
"score": "0.6132111",
"text": "def new\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",
"title": ""
},
{
"docid": "d39d15f866831ff4762af8316d20e985",
"score": "0.6105126",
"text": "def index\n @bank_accounts = BankAccount.all\n end",
"title": ""
},
{
"docid": "d39d15f866831ff4762af8316d20e985",
"score": "0.6105126",
"text": "def index\n @bank_accounts = BankAccount.all\n end",
"title": ""
},
{
"docid": "2b3152be79eaae734f54bb15aaec882b",
"score": "0.60897917",
"text": "def show\n\n @bet = Bet.find(params[:id])\n\n\n redirect_to root_path and return unless @bet.new?\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end",
"title": ""
},
{
"docid": "45a218d7b70b4d62128e4f01a9ba2327",
"score": "0.6086897",
"text": "def show\n @bank_account_operation = BankAccountOperation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank_account_operation }\n end\n end",
"title": ""
},
{
"docid": "6bc5a5355300a0414d5edd3165cdc711",
"score": "0.60765946",
"text": "def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end",
"title": ""
},
{
"docid": "e064bcb45f87d0ac87ff98dff7191976",
"score": "0.6075548",
"text": "def index\n @bike_types = BikeType.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @bike_types #each_serializer: Web::V1::BikeTypeSerializer\n end",
"title": ""
},
{
"docid": "603c112b00054cd110eb74edc9207b35",
"score": "0.60750264",
"text": "def get_banks_by_country\n params_hash = {\n # Mandatory\n 'x_login' => @x_login,\n 'x_trans_key' => @x_trans_key,\n 'country_code' => country,\n 'type' => response_type\n }\n\n astro_curl(@astro_urls['banks'], params_hash)\n end",
"title": ""
},
{
"docid": "6768800245743cc9053432d25976c721",
"score": "0.60728514",
"text": "def index\n respond_to do |format|\n if params[:search]\n format.html { @banks = Bank.search(params[:search]).order(\"created_at DESC\") }\n format.json { @banks = Bank.search(params[:search]).order(\"created_at DESC\") }\n else\n format.html { @banks = Bank.all.order('created_at DESC') }\n format.json { @banks = Bank.all.order('created_at DESC')}\n end\n end\n end",
"title": ""
},
{
"docid": "6a9c6504041b9c3483220c011c16517f",
"score": "0.6061797",
"text": "def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end",
"title": ""
},
{
"docid": "ff333e8a337d7a8a9ee7957c3d26807f",
"score": "0.6061014",
"text": "def index\n @brave_bursts = BraveBurst.all\n end",
"title": ""
},
{
"docid": "73da3dd569cc136886cf1a6648aca9be",
"score": "0.60596925",
"text": "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end",
"title": ""
},
{
"docid": "aad0a9d8accc48333d446cc39f035522",
"score": "0.60567075",
"text": "def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end",
"title": ""
},
{
"docid": "68bdc1f25f2f71f97a05b447378077a2",
"score": "0.60554206",
"text": "def index\n @bettings = Betting.all\n end",
"title": ""
},
{
"docid": "caa80cafd2f0db50670c15c57c7e68a9",
"score": "0.60523",
"text": "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",
"title": ""
},
{
"docid": "854b08050036a06aee57839b00c70e54",
"score": "0.60500246",
"text": "def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"title": ""
},
{
"docid": "20130e65e4e2a633a6fac37d24c91748",
"score": "0.6049246",
"text": "def index\n @birds = Bird.all.to_a\n begin\n respond_to do |format|\n format.json { render json: {items: @birds, description: \"List all visible birds in the registry\", additionalProperties: false, title: \"POST /birds [request]\",:status => OK } }\n end\n rescue => e\n render json: ({:status => INTERNAL_SERVER_ERROR})\n end\n end",
"title": ""
},
{
"docid": "f0e06b1dc6c00613fcc81507743c760b",
"score": "0.6047154",
"text": "def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end",
"title": ""
},
{
"docid": "78022b117a8beef9a4adfc31deed0057",
"score": "0.60367924",
"text": "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end",
"title": ""
},
{
"docid": "b2c6449063a187f509c81fff66ea3c3e",
"score": "0.60313004",
"text": "def show\n if @bird\n respond_to do |format|\n format.json { render json: {required: @bird, properties: @bird.properties, families: @bird.families, title: \"POST /birds [request]\", description: \"Get bird by id\",:status => OK }}\n end\n else\n respond_to do |format|\n format.json { render json: {:status => NOT_FOUND} }\n end\n end\n end",
"title": ""
},
{
"docid": "0f272876b14af353d0080725e043ef4e",
"score": "0.6030958",
"text": "def show\n @balance = scope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @balance }\n end\n end",
"title": ""
},
{
"docid": "6344313714ecb8bcd034bcb6f40f9a04",
"score": "0.60305595",
"text": "def index\n @contracts = Contract.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contracts }\n end\n end",
"title": ""
},
{
"docid": "f3f73de20b5eed925da34568b5dd916a",
"score": "0.60302776",
"text": "def show\n @obj = {\n id: @bank_account.id,\n account_number: @bank_account.account_number,\n account_type: @bank_account.account_type,\n bank: @bank_account.bank,\n statu_id: @bank_account.statu_id,\n user_id: @bank_account.user_id,\n active: @bank_account.active,\n approved: @bank_account.approved,\n certificate: @bank_account.certificate.attached? ? url_for(@bank_account.certificate) : nil,\n created_at: @bank_account.created_at,\n updated_at: @bank_account.updated_at\n }\n render json: @obj\n end",
"title": ""
},
{
"docid": "535943a7673309f0cfed6f070ae9af73",
"score": "0.60279757",
"text": "def index\n @bagtypes = Bagtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bagtypes }\n end\n end",
"title": ""
},
{
"docid": "30ce86bc57a13a8516fe27429ba55618",
"score": "0.6022219",
"text": "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"title": ""
},
{
"docid": "e978c308f6e0dc07a09e52bc3077e38c",
"score": "0.6021323",
"text": "def show\n @bagtype = Bagtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bagtype }\n end\n end",
"title": ""
},
{
"docid": "b87d39fffd897b27c5ea8b7b3c02fa57",
"score": "0.6015041",
"text": "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"title": ""
},
{
"docid": "07703f2ab96a0dd148f1b5fba767caf5",
"score": "0.60148215",
"text": "def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end",
"title": ""
},
{
"docid": "ea58f6854c19fea19e540c2395ffc907",
"score": "0.601137",
"text": "def show\n @kb = Kb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kb }\n end\n end",
"title": ""
},
{
"docid": "710d51e8c3c2df6de29ca0dc1175e4ee",
"score": "0.6008534",
"text": "def show\n @questionbank = Questionbank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionbank }\n end\n end",
"title": ""
},
{
"docid": "6d434cbfe2294ca427dcc9a885bd4ac4",
"score": "0.60079473",
"text": "def index\n @coins = Coin.all\n render \"index.json.jbuilder\"\n end",
"title": ""
},
{
"docid": "cdaa1eac531e9b79cf12ab17580a61c0",
"score": "0.5999507",
"text": "def bank\n @session.get_bank @bank_id\n end",
"title": ""
},
{
"docid": "e1e8b4323419d91814f0fa89c1a49023",
"score": "0.5994197",
"text": "def index\n if session[:kunde_id] == nil\n @buchungs = Buchung.all\n else\n @buchungs = Buchung.find(:all, :conditions => ['kunde_id = ?',session[:kunde_id]], :order =>\"anfangszeit ASC\") \n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @buchungs }\n end\n end",
"title": ""
},
{
"docid": "48c0c2f431d58c8b84d7db0d8c620873",
"score": "0.5994074",
"text": "def show\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bundlesticker }\n end\n end",
"title": ""
},
{
"docid": "258ed7f3ee33e8737f4abf28b7225395",
"score": "0.5993058",
"text": "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"title": ""
},
{
"docid": "c3d32987bfbca53f709003d7bfca8b7f",
"score": "0.59924406",
"text": "def index\n @banking_systems = BankingSystem.all\n end",
"title": ""
},
{
"docid": "d27c5ad51addd40b2ded3cccf0092cd9",
"score": "0.59882945",
"text": "def show\n render json: @bike #serializer: Web::V1::BikeSerializer\n end",
"title": ""
},
{
"docid": "cd5cb80257045d775d6e5f72fb9e25e6",
"score": "0.59879565",
"text": "def show\n @bill = Bill.find(params[:id])\n\t respond_to do |format|\n format.json { render json: @bill}\n format.html \n end\n end",
"title": ""
},
{
"docid": "f7e53e92729b1f977e689ec477a5fa8f",
"score": "0.5983831",
"text": "def index\n @boks = Bok.all\n end",
"title": ""
},
{
"docid": "d0bbbe7f24c3879545a29950805999f0",
"score": "0.5980746",
"text": "def index\n @bets = Bet.where(user_id: current_user.id)\n\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "8667b1497bf9727e043c85d6e40da126",
"score": "0.0",
"text": "def first_login_setup\n redirect_to first_login_path if current_user.sign_in_count < 2\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60310465",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60152966",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.5920606",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5912896",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.5912896",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5898134",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5887081",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5887026",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5887026",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5887026",
"text": "def actions; end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.5876557",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5860066",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.5807812",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.57404715",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57310694",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5715928",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5701527",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.569245",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.5669733",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.56503016",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5648064",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5636733",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5623887",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56089544",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.559635",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5595486",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.55868655",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55584484",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55584484",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5507632",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.55033326",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.5466339",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.54640555",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.54472816",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.54455507",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54398936",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.5415934",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5407991",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5407991",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.54",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5394463",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5394463",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5391065",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.5388469",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5376582",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5355932",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5348422",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53466004",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53451854",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5343858",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5339292",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.532725",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53038853",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.52850133",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.52815986",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.5257178",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5257024",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.5248709",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.5244428",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.5239302",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5235414",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5235414",
"text": "def action; end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.5230717",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52270764",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.5222752",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.5222485",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.52205867",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.52127427",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.52127236",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.520801",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5204501",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5204178",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.52039874",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.52032334",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5198697",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51944995",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51944995",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.51913106",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5178707",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.51781213",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5172379",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5172379",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5172379",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5163576",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5152934",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.5142308",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51392764",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51391184",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.51387095",
"text": "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",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.51351416",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115222",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.51131564",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.51114494",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5107052",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5107052",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5107052",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51055247",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5102995",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.50979155",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.50949734",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "076c761e1e84b581a65903c7c253aa62",
"score": "0.5091706",
"text": "def add_callbacks(base); end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "ae8613312ab247dfb7c1b1e3956da94a",
"score": "0.0",
"text": "def set_event_type\n @event_type = EventType.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60322535",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6012846",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.5923006",
"text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59147197",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59147197",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5898899",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.58899754",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58778226",
"text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end",
"title": ""
},
{
"docid": "a80b33627067efa06c6204bee0f5890e",
"score": "0.5863685",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58098996",
"text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end",
"title": ""
},
{
"docid": "33ff963edc7c4c98d1b90e341e7c5d61",
"score": "0.5740018",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.5730792",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57159567",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.56995213",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.5692253",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.5668434",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5652364",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5649457",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5637111",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.56268275",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56099206",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5595526",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.55951923",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.55885196",
"text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55564445",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55564445",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5509468",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5502921",
"text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5466533",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.54644245",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.5448076",
"text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.5445466",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54391384",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54171526",
"text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54118705",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54118705",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5398984",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53935355",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53935355",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.53924096",
"text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end",
"title": ""
},
{
"docid": "a468b256a999961df3957e843fd9bdf4",
"score": "0.53874743",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5379617",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53577393",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.53494817",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.5347875",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.5346792",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5344054",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.53416806",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53265905",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53036004",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5284624",
"text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end",
"title": ""
},
{
"docid": "1e1e48767a7ac23eb33df770784fec61",
"score": "0.5283799",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5256181",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52549016",
"text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end",
"title": ""
},
{
"docid": "fc88422a7a885bac1df28883547362a7",
"score": "0.52492326",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.52462375",
"text": "def action_awareness\n if action_aware?\n if !@options.key?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52388823",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52388823",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.52384317",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.5233074",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52307343",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.52247876",
"text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.5221976",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.52215284",
"text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end",
"title": ""
},
{
"docid": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.5215321",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213458",
"text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.5209029",
"text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end",
"title": ""
},
{
"docid": "2aba2d3187e01346918a6557230603c7",
"score": "0.5206747",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.52043396",
"text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end",
"title": ""
},
{
"docid": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5203811",
"text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end",
"title": ""
},
{
"docid": "d56f4ec734e3f3bc1ad913b36ff86130",
"score": "0.5202598",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.52015066",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51961863",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51961863",
"text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"title": ""
},
{
"docid": "7fca702f2da4dbdc9b39e5107a2ab87d",
"score": "0.5190015",
"text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end",
"title": ""
},
{
"docid": "063b82c93b47d702ef6bddadb6f0c76e",
"score": "0.5179595",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.5177569",
"text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5163597",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.51522565",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.51422286",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.5142005",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.5140699",
"text": "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",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.51397085",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.5134159",
"text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end",
"title": ""
},
{
"docid": "f2ac709e70364fce188bb24e414340ea",
"score": "0.5115907",
"text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5113603",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.51112026",
"text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51074827",
"text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend",
"title": ""
},
{
"docid": "f04fd745d027fc758dac7a4ca6440871",
"score": "0.5105795",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.50995123",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.5096676",
"text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end",
"title": ""
},
{
"docid": "b2a4ff1f0080ca2a1e6e22f77f907573",
"score": "0.50926304",
"text": "def commit\n if valid?\n callback_process = setup(controller)\n controller.after_filter callback_process, :only => action_name\n controller\n else\n Innsights::ErrorMessage.log(\"#{controller_name} class has no valid method #{action_name}\")\n end\n end",
"title": ""
}
] |
2b86a46d0dcde20806f720599ee25ab2
|
initializes with an empty knowledge array
|
[
{
"docid": "6f42d145a74ff2698cf82398bfa37aa1",
"score": "0.80397236",
"text": "def initialize\n @knowledge = []\n end",
"title": ""
}
] |
[
{
"docid": "2f368da001237407e71ea138dfdc8e11",
"score": "0.86959696",
"text": "def initialize\n @knowledge = [] # initialize with an empty array\n end",
"title": ""
},
{
"docid": "efa0df5dc94c680f86b6205b8960c3a1",
"score": "0.84588593",
"text": "def initialize\n @knowledge = [] # initializes with instance variable set to empty array\n end",
"title": ""
},
{
"docid": "cae2db1d1ed7637e101e413ead6003a1",
"score": "0.8375987",
"text": "def initialize\n\t\t@knowledge = []\n\tend",
"title": ""
},
{
"docid": "8c0d996b735d1bcbd760e12c9a8c5909",
"score": "0.8135495",
"text": "def initialize \n @knowledge = [] \n end",
"title": ""
},
{
"docid": "0e8fc497092f7857a3c8b0015edd3b00",
"score": "0.7252028",
"text": "def initialize\n\t\t\t@o_lex, @q_lex, @train = [], [], []\n\t\tend",
"title": ""
},
{
"docid": "680358cbd214bcf972851a9f7d556f80",
"score": "0.6728685",
"text": "def initialize\n @array = []\n end",
"title": ""
},
{
"docid": "8d2ddbdab2d0effffa36cc7a31e93916",
"score": "0.66718316",
"text": "def initialize()\n @node = Array.new\n end",
"title": ""
},
{
"docid": "3db3d852fafbc59030584377bd63c211",
"score": "0.66637176",
"text": "def initialize\n @kudomons, @trainers = Array.new, Array.new\n end",
"title": ""
},
{
"docid": "13e74c56c151cbb0bf4189198bb8a62c",
"score": "0.662891",
"text": "def initialize\n @model = Array.new\n\t @predicates = ValueSet.new\n\t @neg_predicates = ValueSet.new\n\t @indexed_predicates = ValueSet.new\n\t @indexed_neg_predicates = ValueSet.new\n\t @owners = Array.new\n @parents = Hash.new { |h, k| h[k] = Array.new }\n @children = Hash.new { |h, k| h[k] = Array.new }\n\tend",
"title": ""
},
{
"docid": "0ac1581513f24850edddb0950e01bc24",
"score": "0.6541805",
"text": "def initialize\n @array = []\n end",
"title": ""
},
{
"docid": "079cb47a799a9f839d327873cca3b3cc",
"score": "0.6459074",
"text": "def initialize\n @ary = []\n end",
"title": ""
},
{
"docid": "aaa351a9d7d8269138c51a20cf89d461",
"score": "0.64254",
"text": "def init_empty\n @records = []\n end",
"title": ""
},
{
"docid": "acec92f72453631dec5c7f3c8fd8bed9",
"score": "0.6425033",
"text": "def init_empty\n @records = []\n end",
"title": ""
},
{
"docid": "f5b2a5c7cc6d13ee9ccbb149df791ba8",
"score": "0.64119655",
"text": "def initialize(arr)\n\t\tarr ||= []\n\t\t@set = arr\n\tend",
"title": ""
},
{
"docid": "df5cc6b49b6fa3ef50029f281260f726",
"score": "0.63210887",
"text": "def init_empty\n super\n no_items = 0\n end",
"title": ""
},
{
"docid": "55a901162b2653dcf2b3047d1e75ab08",
"score": "0.6315914",
"text": "def initialize arr = []\n super arr\n end",
"title": ""
},
{
"docid": "55a901162b2653dcf2b3047d1e75ab08",
"score": "0.6315914",
"text": "def initialize arr = []\n super arr\n end",
"title": ""
},
{
"docid": "e8b531fbe8e573c6be6e01dd88f1d908",
"score": "0.6314075",
"text": "def initialize(array); end",
"title": ""
},
{
"docid": "1f430f0f4c1a079dc034fbc5d0b88c65",
"score": "0.62918425",
"text": "def initialize\n @data = []\n end",
"title": ""
},
{
"docid": "ad3d7742aa68be0f2bec61276042ea97",
"score": "0.6269834",
"text": "def initialize\n super()\n @elements = []\n end",
"title": ""
},
{
"docid": "4029923a2bd7498f66ac78601914f2f4",
"score": "0.62677413",
"text": "def initialize(opts={})\n # Hash of arrays that looks like this:\n #\n # {\n # :philosophy => [[file_name, array_of_words], ...]\n # :physics => ...,\n # ...\n # }\n @all_books = load_books(:training)\n end",
"title": ""
},
{
"docid": "5978725a99f715743821957fed28987e",
"score": "0.62497294",
"text": "def initialize()\n\t \t# loading or not loading should be the key here.\n @products = Array.new\n end",
"title": ""
},
{
"docid": "7f4f2ec821c6e80519a8c5944d331e08",
"score": "0.6241834",
"text": "def init\n @articles = []\n end",
"title": ""
},
{
"docid": "11db6cc765bb8fcf4e7075dd9c3e0471",
"score": "0.62350804",
"text": "def initialize()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "083779b1f448007f887c560d1e829105",
"score": "0.6221024",
"text": "def initialize(input_arr=[])\n @internal_arr = []\n @input_arr = []\n end",
"title": ""
},
{
"docid": "59985ea921757ccb1567166f44e1f822",
"score": "0.6216275",
"text": "def initialize \n @Questions_list = []\n end",
"title": ""
},
{
"docid": "f3dd55c79375c3b81c3e33fda9ff12fe",
"score": "0.62078553",
"text": "def initialize()\n\n # array of LA obj\n @analyzers = Array.new\n\n # a number to record highest word frequenct, initialize to nil\n @highest_count_across_lines = nil\n\n # array of LA obj filter with word frequency, initialize to nil\n @highest_count_words_across_lines = nil\n end",
"title": ""
},
{
"docid": "8ba292229a1660ff4e7b2bb77cb2a321",
"score": "0.62024397",
"text": "def court_initialization\n self.court = Array.new(3) { Array.new(3) { 0 } }\n end",
"title": ""
},
{
"docid": "1615c671de457ed6ca43411a5bcc3e31",
"score": "0.6193125",
"text": "def initialize(size); end",
"title": ""
},
{
"docid": "1615c671de457ed6ca43411a5bcc3e31",
"score": "0.6193125",
"text": "def initialize(size); end",
"title": ""
},
{
"docid": "bd3884452d57d465d637683ddc124d66",
"score": "0.61915684",
"text": "def initialize q\n @question = q\n \n @words = []\n @lemmas = []\n @pos = []\n @ners = []\n end",
"title": ""
},
{
"docid": "bd3239ad3c67d53d5974e1fd4c713729",
"score": "0.61915314",
"text": "def initialize()\n @items = Array.new()\n end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.61783737",
"text": "def initalize; end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.61783737",
"text": "def initalize; end",
"title": ""
},
{
"docid": "c41b8fb611c34b271e3c462c37962e4f",
"score": "0.6173153",
"text": "def initialize\n @elements = []\n end",
"title": ""
},
{
"docid": "c41b8fb611c34b271e3c462c37962e4f",
"score": "0.6173153",
"text": "def initialize\n @elements = []\n end",
"title": ""
},
{
"docid": "c41b8fb611c34b271e3c462c37962e4f",
"score": "0.6173153",
"text": "def initialize\n @elements = []\n end",
"title": ""
},
{
"docid": "3b63b62f36011b53c183824e76621ad1",
"score": "0.61622685",
"text": "def initialize\n @container = [];\n end",
"title": ""
},
{
"docid": "e36f13307ce3e9da155d6b3b972ea45e",
"score": "0.6161683",
"text": "def initialize # construtor method\n @items = []\n end",
"title": ""
},
{
"docid": "f8092bc3d150b9f69648ac7ee54650be",
"score": "0.6157225",
"text": "def initialize(size = 0, baseIndex = 0) #default value of zero\r\n\t\tinit(size, nil) #what is this init function?\r\n\t\t@baseIndex = baseIndex #instance variable that is changed for each array\r\n\tend",
"title": ""
},
{
"docid": "9155efe0e480de8ed6bcf79d54ce5c59",
"score": "0.6156026",
"text": "def initialize(words = Array.new)\n @words = words\n end",
"title": ""
},
{
"docid": "737043d95caec5d97804d03a1bad307d",
"score": "0.6147901",
"text": "def initialize\n data = Array.new\n location = nil\n end",
"title": ""
},
{
"docid": "a57829ce1a3f57668b9166308705ab69",
"score": "0.61463165",
"text": "def initialize\n @data = []\n end",
"title": ""
},
{
"docid": "943cd0a11fd2c95e7581b7d7b1b552e2",
"score": "0.6145069",
"text": "def initialize()\n @iterations = 3\n @wordlist = []\n @doclist = []\n @logger = Log4r::Logger.new(self.class.to_s)\n @logger.add('default')\n @topic_change_rate = SClust::Util::WeightedMovingAverage.new(0.05, 0.0)\n @word_prob_avg = SClust::Util::WeightedMovingAverage.new(0.05, 0.0)\n @doc_prob_avg = SClust::Util::WeightedMovingAverage.new(0.05, 0.0)\n\n # Used for inverse document frequency values.\n @document_collection = SClust::Util::DocumentCollection.new()\n \n # Array the same size as @wordlist but stores the document object at index i\n # that produced @wordlist[i].\n @word2doc = []\n \n self.topics = 10\n end",
"title": ""
},
{
"docid": "435735604c818451dfb91e70ad4ed4f1",
"score": "0.61426556",
"text": "def initialize\n empty!\n end",
"title": ""
},
{
"docid": "435735604c818451dfb91e70ad4ed4f1",
"score": "0.61426556",
"text": "def initialize\n empty!\n end",
"title": ""
},
{
"docid": "435735604c818451dfb91e70ad4ed4f1",
"score": "0.61426556",
"text": "def initialize\n empty!\n end",
"title": ""
},
{
"docid": "2a18f1788894a9a5414e25de44027056",
"score": "0.61259407",
"text": "def initialize\n #que inicialice la variables de instancia \"words\" a un Hash vacio\n #words = Hash.new()\n @words = {}\n end",
"title": ""
},
{
"docid": "e2909eb645541a819533b7a275f26601",
"score": "0.6105071",
"text": "def initialize\r\n @questions = []\r\n @question_answer = []\r\n @user_answer = []\r\n end",
"title": ""
},
{
"docid": "556824093c8d7aa2df94638bb1a10d2b",
"score": "0.6093511",
"text": "def initialize # :notnew:\n\t\t\tsuper( Array )\n\n\t\t\t@additional_expectations << all( be_a Hash )\n\n\t\t\t@expected_ids = nil\n\t\t\t@collection_ids = nil\n\t\t\t@extra_ids = nil\n\t\t\t@missing_ids = nil\n\t\t\t@order_enforced = false\n\t\tend",
"title": ""
},
{
"docid": "a54f94aca0ae04a44963f8ecf174f1c8",
"score": "0.6083556",
"text": "def empty\n new(EMPTY_ARRAY)\n end",
"title": ""
},
{
"docid": "d140a20266170592e17c59ef9de829a0",
"score": "0.60814756",
"text": "def initialize\n @activity = \"collective punishment\"\n @students = [] #initialize for array to be empty\n end",
"title": ""
},
{
"docid": "fe93a1f7d0d3c51d807763d712310e08",
"score": "0.608043",
"text": "def initialize\n super([])\n end",
"title": ""
},
{
"docid": "15ee0cce41256b879d0a2b10d17f754f",
"score": "0.6076113",
"text": "def initialize(leaf_size = 1, data)\n @model = Learner.build_tree(leaf_size, data)\n end",
"title": ""
},
{
"docid": "b276c444576d160ca90785b3f6e4ec39",
"score": "0.6066149",
"text": "def initialize\r\n \r\n @shapes = Array.new\r\n \r\n end",
"title": ""
},
{
"docid": "bbac64250990f945c21dff934789ca8e",
"score": "0.60587627",
"text": "def initialize\n @items = Array.new\n end",
"title": ""
},
{
"docid": "a43618fedeaf9097c088a898f34bb9d6",
"score": "0.60544354",
"text": "def initialize(tolkenized_docs)\n\t\t@docs = tolkenized_docs\n\t\t@lexicon = {}\n\t\t@docs.each { |doc| self.add_to_lexicon(doc) }\n\tend",
"title": ""
},
{
"docid": "fa40bf8dc49524fc7cb201be888a2713",
"score": "0.60468775",
"text": "def initialize \n @documentList = Array.new \n # Reference to every Term of every Document \n @termInDocCountMap = Hash.new\n @dataPath = nil\n end",
"title": ""
},
{
"docid": "519919851dbd009b89e4f8cd0915b72b",
"score": "0.6042337",
"text": "def initialize()\n @analyzers = Array.new()\n end",
"title": ""
},
{
"docid": "e9210e74215d09d12c00f1ecda603742",
"score": "0.60291857",
"text": "def initialize( * )\n\t\tsuper\n\t\t@samples = []\n\t\t@sample_size = DEFAULT_SAMPLE_SIZE\n\t\t@counter = 0\n\tend",
"title": ""
},
{
"docid": "87181c295e57b6333b0f7593aabc00de",
"score": "0.6029132",
"text": "def initialize(input_arr=[])\n @internal_arr = []\n # Fill in the rest of the initialize method here.\n # What should you do with each element of the incoming array?\n end",
"title": ""
},
{
"docid": "1b94b1617911dac61a376510e1d128c2",
"score": "0.60226595",
"text": "def initialize\n @nodes = []\n end",
"title": ""
},
{
"docid": "02094d094baa0a59e02700b98bba3bb3",
"score": "0.60088104",
"text": "def __initialize__\n # We don't need the nanny checking our symbols\n @records = MIN_SIZE\n @bins = Tuple.new(MIN_SIZE)\n @count = 0\n end",
"title": ""
},
{
"docid": "ae526a7c7e6b1343f593e4712dd51630",
"score": "0.60062635",
"text": "def initalize\n end",
"title": ""
},
{
"docid": "54fc80fd5c75dccb5e37fd947bdc19e2",
"score": "0.6002261",
"text": "def init_as_empty!\n raise(ArgumentError, \"Already initialized!\") if(loaded?)\n @items = []\n @loaded = true\n end",
"title": ""
},
{
"docid": "e6e618e09acccae5996bfd268b03c377",
"score": "0.6002221",
"text": "def initialize\n\t\t@meditations = []\n\tend",
"title": ""
},
{
"docid": "f1f0c0e0ed9ab34a40693ef4139ae882",
"score": "0.600054",
"text": "def initialize()\n setAnswers\n end",
"title": ""
},
{
"docid": "97de454b68808e2fa110bfab8d9bae77",
"score": "0.5999857",
"text": "def initialize(input_arr=[])\n @internal_arr = []\n\n # Fill in the rest of the initialize method here.\n # What should you do with each element of the incoming array?\n end",
"title": ""
},
{
"docid": "fa2bdc14e592cffbedf1ceb3d269749b",
"score": "0.5999589",
"text": "def initialize\n\t\t@arr_contr = []\n\tend",
"title": ""
},
{
"docid": "0631b0a642f5630f0592ef9bcbc8f9ef",
"score": "0.5997931",
"text": "def initialize(content=nil)\n @content = []\n end",
"title": ""
},
{
"docid": "0631b0a642f5630f0592ef9bcbc8f9ef",
"score": "0.5997931",
"text": "def initialize(content=nil)\n @content = []\n end",
"title": ""
},
{
"docid": "691fa840cb4f8523e2cad4fcbd3b6211",
"score": "0.59943223",
"text": "def initialize\n\t\t@node_array = []\n\t\t@root = nil\n\t\t@updated = false\n\tend",
"title": ""
},
{
"docid": "6660b0f09a3bc3b13212e2d3907e8e63",
"score": "0.5984886",
"text": "def intialize\n @condiments = [:nutella, :cheese, :fruit, :sprinkles, :onions, :ketchup, :chips, :mustard]\n end",
"title": ""
},
{
"docid": "8217cefe8f5b4e31b54f638415d4479a",
"score": "0.59774804",
"text": "def new_discovered_array\n @synthetis_discovered = {1 => {}, 2 => {}, 3 => {}}\n end",
"title": ""
},
{
"docid": "ad8038b21f86d76acc542d8b8e96203c",
"score": "0.5975673",
"text": "def initialize(name)\n @name = name\n @@all << self #tells the program what to add to the empty array\n end",
"title": ""
},
{
"docid": "de4bf9ed21946309244fd37c580a5ba4",
"score": "0.5975235",
"text": "def initialize(input_arr = [])\n @internal_arr = input_arr\n # Fill in the rest of the initialize method here.\n # What should you do with each element of the incoming array?\n end",
"title": ""
},
{
"docid": "ff4459e313313df74b1fdcf69402f210",
"score": "0.5961087",
"text": "def initialize\r\n @hand = [] # Create empty hand array\r\n end",
"title": ""
},
{
"docid": "e1330f1aadcbb9e104a6c2f8cb01bfa9",
"score": "0.5951513",
"text": "def initialize\n @words = {}\n end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.5949281",
"text": "def initialize() end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.5949281",
"text": "def initialize() end",
"title": ""
},
{
"docid": "40f700c096d31faf125204b5eba72416",
"score": "0.5947116",
"text": "def initialize\r\n self.activities = Array.new\r\n end",
"title": ""
},
{
"docid": "e132398948ea5735910d920c2fafa473",
"score": "0.5931209",
"text": "def initialize(text)\n\t\t@corpus = {}\n\t\tadd text\n\tend",
"title": ""
},
{
"docid": "471fb14f9ceeb79e9c5d07f0db17b4a5",
"score": "0.5929017",
"text": "def initialize\n clear\n end",
"title": ""
},
{
"docid": "471fb14f9ceeb79e9c5d07f0db17b4a5",
"score": "0.5929017",
"text": "def initialize\n clear\n end",
"title": ""
},
{
"docid": "ab4ec3287d38cbdfd27ef12d9c30099d",
"score": "0.59281707",
"text": "def initialize(size)\r\n\t\t@table = Array.new(size)\r\n\tend",
"title": ""
},
{
"docid": "85eb25f517b81ed4885060b51894845d",
"score": "0.59219027",
"text": "def initialize\n #used to assign node ids\n @counter = 1;\n @nodes = []\n end",
"title": ""
},
{
"docid": "1522243ee75401e7e469a36511abc191",
"score": "0.5920391",
"text": "def initialize(args={})\n super\n @items = []\n @index = nil\n @labels = true\n @index = 0\n end",
"title": ""
},
{
"docid": "bd7a2d5ab08e2ae22d74ae9654b6a8f5",
"score": "0.59185827",
"text": "def initialize\n @nodes = []\n end",
"title": ""
},
{
"docid": "ddafc4ff4581cd95ede0e4ef371599e6",
"score": "0.5917054",
"text": "def initialize corpus_file_name\n @noun = \"NN\"\n @verb = \"VB\"\n @adjective = \"JJ\"\n @corpus_file_name = corpus_file_name\n @array_of_sentences = build_array_of_sentences @corpus_file_name\n @collocations = Collocations.new\n end",
"title": ""
},
{
"docid": "1c8fe69ea55a6a160361310078d2f38d",
"score": "0.5915294",
"text": "def initialize(size=0)\r\n\t\t@array = []\r\n\t\t@size = size\r\n\t\t@num_elements = 0\r\n\t\tif size >0\r\n\t\t\t@array[size-1] = nil\r\n\t\telsif size < 0\r\n\t\t raise \"Error: size must be >= 0\"\r\n\t\tend\r\n\tend",
"title": ""
},
{
"docid": "a23a438608bc396718b2e31d31448228",
"score": "0.5909546",
"text": "def initialize (array)\n\t\t@alimentos = array\n\tend",
"title": ""
},
{
"docid": "4d37ce23a2f7221b832f4c95ff72f1ab",
"score": "0.5909418",
"text": "def initialize\n \t@milkshake = []\n end",
"title": ""
},
{
"docid": "253fe2046447862c3b8affe4d78c212e",
"score": "0.5904777",
"text": "def initialize(*args, &blck)\n\t\t @array = Array.new(*args, &blck)\n\t\tend",
"title": ""
},
{
"docid": "27272963349359e706ed193978dbe903",
"score": "0.5898552",
"text": "def after_initialize\n\t\t# set types default to empty Array\n\t\tself.types = Array.new if self.types.nil?\n\t\t# set windows default to empty Array\n\t\tself.windows_of_exposure = Array.new if self.windows_of_exposure.nil?\n\t\t# set assessments default to empty Array\n\t\tself.exposure_assessments = Array.new if self.exposure_assessments.nil?\n\t\t# set forms_of_contact default to empty Array\n\t\tself.forms_of_contact = Array.new if self.forms_of_contact.nil?\n\t\t# set locations_of_use default to empty Array\n\t\tself.locations_of_use = Array.new if self.locations_of_use.nil?\n\t\t# set frequencies_of_contact default to empty Array\n\t\tself.frequencies_of_contact = Array.new if self.frequencies_of_contact.nil?\n\t\t# set frequencies_of_use default to empty Array\n\t\tself.frequencies_of_use = Array.new if self.frequencies_of_use.nil?\n\t\t# set durations_of_use default to empty Array\n\t\tself.durations_of_use = Array.new if self.durations_of_use.nil?\n\n\n\t\t# set doses_assessed default to empty Array\n\t\tself.doses_assessed = Array.new if self.doses_assessed.nil?\n\n\n\tend",
"title": ""
},
{
"docid": "5902e2681fb13c5644e7dbfc1d089f9e",
"score": "0.58977485",
"text": "def initialize\n \t@books = []\n end",
"title": ""
},
{
"docid": "d07d160f933b77c8977dc2726ead467e",
"score": "0.58916575",
"text": "def initialize()\n @analyzers = Array.new\n end",
"title": ""
},
{
"docid": "60c4bf793e26d1149a2e364d3b314aec",
"score": "0.58775824",
"text": "def initialize\n self.items = []\n end",
"title": ""
},
{
"docid": "cd5089d5dfc07f36b5348512e4d7d7df",
"score": "0.58728147",
"text": "def initialize()\n @books = []\n end",
"title": ""
},
{
"docid": "05c4798d7d70529bf9f7ed05b4c3acc2",
"score": "0.5869639",
"text": "def initialize\n @songs = Array.new # song objects\n end",
"title": ""
},
{
"docid": "748bd7b5149abf972e7b72dfbb61e623",
"score": "0.58626693",
"text": "def initialize\t\n\t\tend",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "19ef87bfccd4952b5745d598541c3187",
"score": "0.0",
"text": "def nivelriesgo_params\n params.require(:nivelriesgo).permit(:nombrenivelriesgo, :fechaingresonivriesgo)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
069c62255e2a447772e52ee0d9bfb1d4
|
DELETE /image/:id ADMIN PRIV deletes image based on url id
|
[
{
"docid": "87fb40134d67cac4743609fa9148b6f8",
"score": "0.8022269",
"text": "def destroy\n image = Image.find_by_hash(params[:id])\n if image.nil?\n return render json: {status: \"Image Doesn't exist\"}, status: 400\n end\n image.file.purge\n image.delete\n render json: {status: \"Image deleted\"}\n end",
"title": ""
}
] |
[
{
"docid": "ed6d19dd7bb6c59efdf56b76eecedbb1",
"score": "0.8339274",
"text": "def delete_image\n\t\timage = Image.find(params[:id])\n\t\timage.destroy\n\n\t\tredirect_to admins_path\n\tend",
"title": ""
},
{
"docid": "e33f242b37af43369183ed6142762c65",
"score": "0.8108745",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n @image.delete_img(@image.name)\n \n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "baf17f1e881919d804874b54d7552004",
"score": "0.8077397",
"text": "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "95956fb0100b6b1601f05e5e9805b413",
"score": "0.80721664",
"text": "def delete\n@image = Image.find(@params['id'])\n@image.destroy\nredirect :action => :index\nend",
"title": ""
},
{
"docid": "8e911b1a5d8964b2e3d3b8ce2c8449be",
"score": "0.7989344",
"text": "def destroy\n json_respond compute().delete_image(params[:imageID])\n end",
"title": ""
},
{
"docid": "3e8fd6cda007fc23bbf554e0b92ad3dd",
"score": "0.7957554",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "96aecaa24a2cb4971df5f59226ad2420",
"score": "0.7929403",
"text": "def delete_image\n ext = \".\" + \"#{params[:format]}\"\n file_name = \"#{Rails.root}/public/images/#{params[:poi_id]}_images/#{params[:file_name]}#{ext}\"\n File.delete(file_name) if File.file?(file_name)\n redirect_to show_images_path(params[:poi_id])\n end",
"title": ""
},
{
"docid": "bb1d8c657628ed49f7543d839a5d74ae",
"score": "0.7923712",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "d1bf143e8d2595438228d99d62b31e6d",
"score": "0.79160744",
"text": "def delete\n render json: Image.delete(params[\"id\"])\n end",
"title": ""
},
{
"docid": "748b558ec7527245ab8f21a266654723",
"score": "0.7899739",
"text": "def delete\n data = Storm::Base::SODServer.remote_call '/Storm/Image/delete',\n :id => @id\n data[:deleted]\n end",
"title": ""
},
{
"docid": "862fec5022e8c12d798679c3219fa3ca",
"score": "0.7859566",
"text": "def destroy\n \n # find the image with params[:id]\n @image = Image.find(params[:id])\n \n #delete the image\n @image.destroy\n\n respond_to do |format|\n \n format.html { redirect_to images_url }\n format.json { head :no_content }\n \n end\n \n end",
"title": ""
},
{
"docid": "59de02f98d543e5389a10a8879c450a4",
"score": "0.7859402",
"text": "def destroy\n @image = Image.find_by(id: params[:id])\n @image.destroy\n redirect_to images_path\n end",
"title": ""
},
{
"docid": "2f7830f5845c7566b9b80ae39815da8a",
"score": "0.7851174",
"text": "def destroy\n @myimage = Myimage.get(params[:id])\n \n if File.exist?(@myimage.image_path + @myimage.image_filename)\n \t File.delete(@myimage.image_path + @myimage.image_filename) #original image file\n File.delete(@myimage.image_path + @myimage.image_thumb_filename) #thumbnail image file \t \n \tend\n \t\n @myimage.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_myimages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "2f7830f5845c7566b9b80ae39815da8a",
"score": "0.7851174",
"text": "def destroy\n @myimage = Myimage.get(params[:id])\n \n if File.exist?(@myimage.image_path + @myimage.image_filename)\n \t File.delete(@myimage.image_path + @myimage.image_filename) #original image file\n File.delete(@myimage.image_path + @myimage.image_thumb_filename) #thumbnail image file \t \n \tend\n \t\n @myimage.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_myimages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e63b071b032694eb7f89ea1c31242ef2",
"score": "0.7849631",
"text": "def delete\n if @identifier && @identifier['image_id'].present?\n connection.delete_foto(@identifier['image_id'])\n end\n end",
"title": ""
},
{
"docid": "a15324f63aae85e0a95d110087fe9c56",
"score": "0.78433657",
"text": "def destroy\n Image.find(params[:id]).destroy\n render :update do |page|\n page[\"image_#{params[:id]}\"].remove\n end\n end",
"title": ""
},
{
"docid": "077ec86ad6bb53080347df9496bb5822",
"score": "0.78144777",
"text": "def destroy\n authorize @thing, :remove_image?\n @thing_image.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "9c64ea887b9355f475ddd727c39b5f63",
"score": "0.7770348",
"text": "def destroy\n id = params[:id] \n @image = @prank.images.find(id).destroy\n respond_to do |format|\n format.html { redirect_to(prank_images_path(@prank)) }\n end\n end",
"title": ""
},
{
"docid": "a5fffbb6673f06399416006c4837be58",
"score": "0.77673626",
"text": "def destroy\n @image = Image.find(params[:id])\n begin\n File.delete(Rails.root.join('public', 'images', @image.name))\n rescue\n logger.warning \"Unable to delete file @{image.name}\"\n end\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "41e30086e3032b82db73731f2030c33e",
"score": "0.77500856",
"text": "def delete\n @image = find_image\n @image.destroy\n render json: { success: true }\n end",
"title": ""
},
{
"docid": "1b9daa72f04f13ce8be46f5afa8db7af",
"score": "0.7742642",
"text": "def destroy\n @image = current_user.images.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f4121ecb074623c2513de262c1f7128b",
"score": "0.7739695",
"text": "def destroy\n @image = Image.editable_by(current_user).find_by_guid(params[:id])\n return not_found if !@image\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_user_path) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e0d5a0eeed8c6c73ae200a9436de9052",
"score": "0.7738691",
"text": "def delete_image\n if request.post? == false\n render :json => { :message => \"Error\" }\n return\n end\n image = Image.new\n image.byId( params[ :image_id ] )\n collection = Collection.new\n collection.byId( params[ :collection_id ] )\n collection.delete( :images, image.urn )\n render :json => { \n :message => \"Success\", \n :collection => collection.all \n }\n end",
"title": ""
},
{
"docid": "8b78863064dbee2a2b3cc93ae97b8957",
"score": "0.7736933",
"text": "def delete_image\n image = Image.find_by_id(params[:id])\n image.remove_asset = true\n image.save\n CarrierWave.clean_cached_files!\n render :nothing => true\n end",
"title": ""
},
{
"docid": "fcabeed4e2bcd5ad254c043d540c49a0",
"score": "0.7729342",
"text": "def delete_image_attachment\n User.delete_image_attachment(params)\n end",
"title": ""
},
{
"docid": "acd7dfcce33fea5eb7aca7b622b93057",
"score": "0.77286494",
"text": "def delete\n image = Image.delete_image(params[:id]) # Delete an existing image\n\n if image != nil # If the image was deleted successfully\n response = { content: image, message: \"Image has been deleted successfully\" } # Return the corresponding image\n\n render json: response, status: 200\n else # If the image was not destroyed\n response = { error: \"Image not found\" }\n\n render json: response, status: 404 # Return 'not found'\n end\n end",
"title": ""
},
{
"docid": "551dfc8ba408f6bccc6642201f825520",
"score": "0.7720064",
"text": "def destroy(id)\n if id.kind_of? Imgur::Image\n id = id.hash\n end\n\n raise 'Please provide a valid image identificator' if id.nil? or !id.kind_of? String or id == '' or !!(id =~ /[^\\w]/)\n \n hsh = process_response(delete(\"/images/#{id}\"))\n \n hsh[hsh.keys.first]['message'] == 'Success' #returns true or false\n end",
"title": ""
},
{
"docid": "a8bb3c0a4b1edf77a7f17171f23eaf74",
"score": "0.7714344",
"text": "def delete_image\n \t@image_user = PhotoUser.find(params[:image_id])\n \t@image_user.remove_image = true\n \t@image_user.destroy\n \t\n \trender :nothing => true\n end",
"title": ""
},
{
"docid": "5237818f7ef5aebf0e48ea9208afce3f",
"score": "0.7704408",
"text": "def delete_image\r\n @clinic_case = @topic.clinic_cases.find(params[:clinic_case_id])\r\n @image_id = params[:image_id].to_i\r\n respond_to do |format|\r\n if @clinic_case.images[@image_id].purge()\r\n update_hash_after_delete()\r\n format.html { redirect_to [@topic, @clinic_case], notice: 'Imagem do caso clínico foi excluído com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { redirect_to [@topic, @clinic_case] }\r\n format.json { render json: @clinic_case.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "e2df40a8cb1dfee3c0cace109ccdf086",
"score": "0.76917773",
"text": "def delete_image\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n begin\n image = Image.find(params[:image_id])\n\n @item = Item.find(image.item_id)\n\n unless @item.check_user_auth(@login_user, 'w', true)\n raise t('msg.need_to_be_owner')\n end\n\n image.destroy\n\n @item.update_attribute(:updated_at, Time.now)\n\n rescue => evar\n Log.add_error(request, evar)\n end\n\n render(:partial => 'ajax_item_image', :layout => false)\n end",
"title": ""
},
{
"docid": "f13ae94eb942c76ecfbb972aaeb0f5c8",
"score": "0.7678559",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to current_user }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6467f771b1373852373c5f9ad4658329",
"score": "0.7677787",
"text": "def destroy\n @image = @site.images.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_images_url(@site)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "865f089cc3b98e27a1b660e4d891a1e9",
"score": "0.76712275",
"text": "def destroy\n @image = Image.find(params[:id])\n\n @image.destroy\n \n respond_to do |format|\n format.html { redirect_to(params[:redirect_to] || images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "23a768c361ecbc093383a9c58cb63918",
"score": "0.766948",
"text": "def destroy\n id = params[:id] \n @image = @album.images.find(id).destroy\n respond_to do |format|\n format.html { redirect_to(prank_album_images_path(@prank, @album)) }\n end\n end",
"title": ""
},
{
"docid": "3eaecd4b1d8f8fdc279add7e0848d4f0",
"score": "0.7665316",
"text": "def image_delete_with_post\n @post = Post.find(params[:id])\n @image = @post.destroy\n end",
"title": ""
},
{
"docid": "8d8f521dfe040af252a2a0523662e327",
"score": "0.7661001",
"text": "def destroy\n @image = @current_account.images.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ef70dee4ad6b44b4f46f670d918752db",
"score": "0.764496",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to @image.user, notice: 'image was successfully destroyed.'\n end",
"title": ""
},
{
"docid": "6143d404754635ea3d1e920cd77b25ba",
"score": "0.7634392",
"text": "def destroy\n File.delete(\"public/#{@image.full_path}\")\n @image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url, notice: '画像及び画像情報は正常に削除されました。' }\n end\n end",
"title": ""
},
{
"docid": "d8f13a92e936ff95747b46e495819c7c",
"score": "0.76337034",
"text": "def destroy\n# @image = Image.find(image_id)\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Images deleted' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fad5ef792c753f94c5854708a7789fff",
"score": "0.7627674",
"text": "def destroy\n\t\t@image = Image.find(params[:id])\n\t\t@image.destroy\n\t\tredirect_to images_path\n\tend",
"title": ""
},
{
"docid": "6cc61551b7017bbf7772f9874d8fd477",
"score": "0.76070255",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n respond_with(@image, :status => :deleted, :location => images_path)\n end",
"title": ""
},
{
"docid": "2e553bbddcbaf576225a78506a397abb",
"score": "0.76064694",
"text": "def destroy\n @image = Image.find_by(params[:id], created_by: \"#{current_user.id}\")\n\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7845e9edd898e7d77a5bd6e6166d273d",
"score": "0.7588819",
"text": "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f5ca7ba6bb09997e68d2ae6fec4b56a0",
"score": "0.7588416",
"text": "def destroy\n authorize @image\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f5ca7ba6bb09997e68d2ae6fec4b56a0",
"score": "0.7588416",
"text": "def destroy\n authorize @image\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6665cd0645759f43dd3af461f2c6a83c",
"score": "0.758559",
"text": "def destroy\n File.delete(\"public/img/members/#{name}\")\n @image.destroy\n redirect_to account_images_path, notice: t('notice.deleted',{model: t('activerecord.models.image')})\n end",
"title": ""
},
{
"docid": "8d7a2865f05c53c1e5661485427be0cd",
"score": "0.7584595",
"text": "def destroy\n @banner = Banner.find(params[:id])\n file = \"#{Rails.root}/public/banners/#{params[:id]}.jpg\"\n File.delete(file) if FileTest.exist?(file)\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_banners_url }\n end\nend",
"title": ""
},
{
"docid": "2149ab2e9c051ff5c76b83811e741b34",
"score": "0.75767404",
"text": "def destroy\n @image = find_or_goto_index(Image, params[:id].to_s)\n return unless @image\n\n next_state = nil\n # decide where to redirect after deleting image\n if (this_state = find_query(:Image))\n query_params_set(this_state)\n this_state.current = @image\n next_state = this_state.next\n end\n delete_and_redirect(next_state)\n end",
"title": ""
},
{
"docid": "350ab0470b44b76dd11908e364b08d9f",
"score": "0.75674427",
"text": "def destroy\n\t\timg = GuardarioImage.find(params[:id])\n\t\timg.destroy\n\n\t\trender :json => img\n\tend",
"title": ""
},
{
"docid": "375b0473dd661f87996fc56687c71092",
"score": "0.7565938",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "375b0473dd661f87996fc56687c71092",
"score": "0.7565938",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4cad81f6531309dc9e65f89d290b390",
"score": "0.75651765",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2495b694a771867e86a9064b2aed962",
"score": "0.75637823",
"text": "def delete_approved_image\n @poi = Poi.find(params[:id])\n \n ext = \".\" + \"#{params[:format]}\"\n file_name = \"#{Rails.root}/public/images/#{params[:id]}_images/user_images/approved/#{params[:file_name]}#{ext}\"\n File.delete(file_name) if File.file?(file_name)\n \n redirect_to show_approved_images_path(@poi), notice: ' Image was successfully removed.'\n end",
"title": ""
},
{
"docid": "d56949fe7cce541b8e2f4424089f5f14",
"score": "0.75607103",
"text": "def destroy\n @image = @post.images.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c640d8c5aa04ab560b340edbb572d2a2",
"score": "0.75498074",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.json { render json: { id: params[:id] } }\n format.html { redirect_to images_url }\n end\n end",
"title": ""
},
{
"docid": "130f008269c2858746fb3967ccb57550",
"score": "0.7549218",
"text": "def delete_image(image_id)\n response, status = BeyondApi::Request.delete(@session, \"/shop/images/#{image_id}\")\n\n handle_response(response, status, respond_with_true: true)\n end",
"title": ""
},
{
"docid": "130f008269c2858746fb3967ccb57550",
"score": "0.7549218",
"text": "def delete_image(image_id)\n response, status = BeyondApi::Request.delete(@session, \"/shop/images/#{image_id}\")\n\n handle_response(response, status, respond_with_true: true)\n end",
"title": ""
},
{
"docid": "5c53bdf3f55656e01eb20b357d937459",
"score": "0.7548651",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5c53bdf3f55656e01eb20b357d937459",
"score": "0.7548651",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5c53bdf3f55656e01eb20b357d937459",
"score": "0.7548651",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5c53bdf3f55656e01eb20b357d937459",
"score": "0.7548651",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "548a677ac73f4ea01c0d11f350c1af50",
"score": "0.75413275",
"text": "def destroy\n @img_url.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "e0f0485a7dd0b1b473758f019f0d45d9",
"score": "0.7540473",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0fdeb4a2c7f50348bc09109756e7e6f7",
"score": "0.753977",
"text": "def destroy image_id\n response = @connection.delete \"/v1/images/#{image_id}\"\n\n Struct::ImageDestroy.new response.code == \"200\"\n end",
"title": ""
},
{
"docid": "285ffb4efa8f4f22fb36e180d8022016",
"score": "0.75383294",
"text": "def destroy\r\n @image = Image.find(params[:id])\r\n \r\n @image.destroy\r\n flash[:notice] = \"Successfully destroyed image.\"\r\n redirect_to @image.imovel\r\n end",
"title": ""
},
{
"docid": "bb82ecd902a9cf09f4d0d2f955664b6c",
"score": "0.75367093",
"text": "def destroy\n @image = Image.find(params[:id])\n @deleteId = @image.id\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n format.js\n end\n end",
"title": ""
},
{
"docid": "64b89aa82673517f850aeea9660f502e",
"score": "0.75091463",
"text": "def destroy\n @image_file = ImageFile.find(params[:id])\n @image_file.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_image_files_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "989e824b8032b2d1dfd3802f2ab2cd66",
"score": "0.7506593",
"text": "def destroy\n @photo = Photo.find(params[:id])\n @photo.remove_image! if @photo.image_url \n @photo.destroy\n @photos = Photo.all\n\n\n respond_to do |format|\n flash[:notice] = \"Photo bien supprimée\"\n format.html\n end\n end",
"title": ""
},
{
"docid": "369990fef61faab4232ed55847eaa44f",
"score": "0.75008744",
"text": "def destroy\n\t\tif logged? \n\t\t@image = Image.find(params[:id])\n\t\tnews_id = @image.news_id\n\t\t@image.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to edit_news_path(news_id) }\n\t\t format.json { head :no_content }\n\t\tend\n\t\tend\n else\n\t\tunloggedRedirect\n\tend",
"title": ""
},
{
"docid": "8331706fd5bf11a0066eb801e7c5881f",
"score": "0.7493849",
"text": "def delete_image\n \t@image_stock = PhotoStock.find(params[:image_id])\n \t@image_stock.remove_image = true\n \t@image_stock.destroy\n \t\n \trender :nothing => true\n end",
"title": ""
},
{
"docid": "8753879104b232865a94fa65b865607d",
"score": "0.7490213",
"text": "def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_imagens_path }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9e08153173ebba4a0a513f0c83de6fed",
"score": "0.7484761",
"text": "def delete_image\n \t@image_panier = PhotoPanier.find(params[:image_id])\n \t@image_panier.remove_image = true\n \t@image_panier.destroy\n \t\n \trender :nothing => true\n end",
"title": ""
},
{
"docid": "1b3de5193ea55bafacb00aa323dc8f49",
"score": "0.746804",
"text": "def destroy_image # :norobots:\n\n # All of this just to decide where to redirect after deleting image.\n @image = Image.find(params[:id])\n next_state = nil\n if this_state = find_query(:Image)\n set_query_params(this_state)\n this_state.current = @image\n next_state = this_state.next\n end\n\n if !check_permission!(@image.user_id)\n redirect_to(:action => 'show_image', :id => @image.id,\n :params => query_params)\n else\n @image.log_destroy\n @image.destroy\n Transaction.delete_image(:id => @image)\n flash_notice(:runtime_image_destroy_success.t(:id => params[:id]))\n if next_state\n redirect_to(:action => 'show_image', :id => next_state.current_id,\n :params => set_query_params(next_state))\n else\n redirect_to(:action => 'list_images')\n end\n end\n end",
"title": ""
},
{
"docid": "43562e3caf005fa15fb7e916754970d0",
"score": "0.74618095",
"text": "def remove(post_id)\n request(:delete, \"images/#{post_id}\")\n end",
"title": ""
},
{
"docid": "3e0e9cba1ee27bbd5bd44785154aba10",
"score": "0.74461",
"text": "def delete_image\n @entity = Entity.find(params[:entity])\n @entity.photo = nil\n @entity.save\n params[:id]=@entity.id\n redirect_to :back\n end",
"title": ""
},
{
"docid": "216da3b6c5850a4fbe8230ef01b08ef5",
"score": "0.7425444",
"text": "def destroy\n @picture = Picture.find(params[:id])\n @picture.remove_image!\n @picture.remove_image = true\n @picture.destroy\n\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cfa1dc72c34f6cdbf7ef08dc7413fee3",
"score": "0.742267",
"text": "def destroy\n p = Photo.find_by({ :id => params[:id] })\n p.delete\n\n redirect_to(\"/\")\n end",
"title": ""
},
{
"docid": "64098cecfd31131049af312ad4470858",
"score": "0.7420444",
"text": "def destroy\n image = Image.find(params[:id])\n image.destroy\n render json: {message: \"Image successfully destroyed!\"}\n end",
"title": ""
},
{
"docid": "b7dccfac5d40b7209c20023d917a773a",
"score": "0.7420355",
"text": "def destroy\n @imagen = Imagen.find(params[:id])\n @imagen.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_imagens_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "dfc5c9da57c14a866aa791542992de46",
"score": "0.7419095",
"text": "def destroy\n @viewimage.destroy\n # @id=@viewimage\n # @path= \"#{Rails.root}/uploads/viewimage/image/#{@id}\"\n # if File.exist?(@path)\n # File.delete(@path)\n # end\n respond_to do |format|\n format.html { redirect_to viewimages_url, notice: 'Viewimage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1a6d65c4e1f743d880143c361d1c08a8",
"score": "0.7395262",
"text": "def destroy\n @get_image = GetImage.find(params[:id])\n @get_image.destroy\n\n respond_to do |format|\n format.html { redirect_to get_images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "45dd784ff9d06f4a06b98fec762299d9",
"score": "0.73949283",
"text": "def destroy\n authorize! :destroy, @admin_image\n @admin_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4332904028f7741d52d317e61e2fadbf",
"score": "0.7389681",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n flash[:notice] = 'Image was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to my_images_url }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6b434cad663e3356ad4a0b3dee761a42",
"score": "0.7383683",
"text": "def destroy\n @image = Image.find(params[:id])\n @image.status = -1\n @image.save\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7a3ac80c04cab925159a6de20ed2f08a",
"score": "0.73833954",
"text": "def destroy\n @user_image = current_user.user_images.find(params[:id])\n if @user_image\n \n @user_image.destroy\n\n respond_to do |format|\n format.html { redirect_to userimages_url }\n format.json { head :no_content }\n end\n else\n redirect_ro userimages_url,:alert => \"Invalid action\"\n end\n end",
"title": ""
},
{
"docid": "1cfecced7373565e8d8999648f19bca2",
"score": "0.73784804",
"text": "def destroy\n\t\timg = FormIrrImage.find(params[:id])\n\t\timg.destroy\n\n\t\trender :json => img\n\tend",
"title": ""
},
{
"docid": "5e6759ab9e97d22228890a477b21ca3c",
"score": "0.7373474",
"text": "def destroy\n @image_datum = ImageDatum.find(params[:id])\n @image_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_image_data_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6ea80ed6edfc6b35013388e1843bf6ad",
"score": "0.73727906",
"text": "def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to user_images_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "faf62209d14d0eeb03da871a011c658c",
"score": "0.7370899",
"text": "def destroy\n\n @imagable = @image.imagable\n @image.destroy\n\n notify_user(:notice, 'Image was successfully removed.')\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "64f668e5dffb40aa532c39dd52fda570",
"score": "0.73690844",
"text": "def destroy\n @userexp = UserExp.find(params[:id])\n file = \"#{Rails.root}/public/user_exps/#{params[:id]}.jpg\"\n File.delete(file) if FileTest.exist?(file)\n @userexp.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_user_exps_url }\n end\nend",
"title": ""
}
] |
19ee8287f7e783d837192c204574b38a
|
show a juxta sbs view of the specified OCR result vs ground truth
|
[
{
"docid": "e917d90c1b172c4f7835ac7de51e6578",
"score": "0.0",
"text": "def show\n @result_id = params[:result]\n @work_id = params[:work]\n @batch_id = params[:batch]\n work = Work.find(@work_id)\n @work_title = work.wks_title\n batch_job = BatchJob.find(@batch_id)\n @batch = \"#{batch_job.id}: #{batch_job.name}\"\n @page_num = params[:page]\n\n # see if a collation exists for this result vs GT\n collation = JuxtaCollation.where(:page_result_id => @result_id).first\n if collation.nil?\n # create a new collation if one doesn't exist.\n # status will be created\n collation = JuxtaCollation.new\n\t\t collation.page_result_id = @result_id\n\n\t\t collation.save!\n end\n\n # Create collation and load visualization\n begin\n \n # upload sources, create witnesses & sets and collate result \n if collation.status == \"error\" || collation.status == \"uninitialized\"\n create_visualization( collation ) \n end\n \n # update the last accessed time\n collation.last_accessed = Time.now\n collation.save!\n \n # generate the visualization\n get_side_by_side_visualization(collation)\n \n rescue RestClient::Exception => rest_error\n collation.status = \"error\"\n collation.save!\n render :text => rest_error.response, :status => rest_error.http_code\n rescue Exception => e\n collation.status = \"error\"\n collation.save!\n render :text => e, :status => :internal_server_error\n end\n end",
"title": ""
}
] |
[
{
"docid": "fc4668c2e97e4a50f481e3be1bb4d6fb",
"score": "0.6217311",
"text": "def image_as_text\n `gocr -i ./OCR_is_cool.png 2>/dev/null`\n end",
"title": ""
},
{
"docid": "68164fa9cb1a690856a42e9c26c9ea3d",
"score": "0.6202913",
"text": "def ocr_with_mistakes\n \n end",
"title": ""
},
{
"docid": "a79ae9120ac894d3cd48acec0c687cc6",
"score": "0.6053874",
"text": "def print_viselitsa(errors)\n puts @status_image[errors]\n end",
"title": ""
},
{
"docid": "b9194c3a1b4057a1017ec661d3755766",
"score": "0.57905054",
"text": "def ocr(image)\n image.save_image('test.png')\n tesse = Tesseract::Engine.new {|e|\n e.language = :eng\n e.page_segmentation_mode = 10\n e.whitelist = '0123456789'\n }\n return tesse.text_for('test.png').strip()\nend",
"title": ""
},
{
"docid": "7c1e820712a6afd52e76e5f09230ea54",
"score": "0.574673",
"text": "def showResults()\n\t\t@results.each() { |result|\n\t puts(\"[+] With the supplied indicators, #{result.figure} would have a #{result.projection}% chance of winning #{result.event}\");\n \t}\n\tend",
"title": ""
},
{
"docid": "8c0e6b36ec7581350a84668b43014fa3",
"score": "0.5693623",
"text": "def index2\n\t\tpath = Rails.root + \"public/uploads/image012.jpg\"\n\t\timage = RTesseract.new(path, :lang => \"por\")\n\t\t@text = image.to_s\n\t\tflash[:ocr] = @text\n\t\tredirect_to 'http://localhost:3000/bills/2'\n\tend",
"title": ""
},
{
"docid": "d4d82551d5a32a4ea9378ec02c7ac861",
"score": "0.56590605",
"text": "def show_result(result); end",
"title": ""
},
{
"docid": "d4d82551d5a32a4ea9378ec02c7ac861",
"score": "0.56590605",
"text": "def show_result(result); end",
"title": ""
},
{
"docid": "3f8eff21ef1bfd96c5f9304386b3239a",
"score": "0.5637799",
"text": "def to_s\n @images.each do |img|\n tess = RTesseract.new('', :lang => @lang)\n tess.from_blob(img.to_blob {self.format = 'jpg';\n self.depth = 8;\n self.quality = 95 } )\n puts tess.to_s\n end\n end",
"title": ""
},
{
"docid": "e0365ba76d045e06c63a4ed284f1cceb",
"score": "0.56089365",
"text": "def recognize_text_on_pic(pic_location = nil)\n img = process_image(pic_location)\n # tess = RTesseract.new(img, lang: 'eng')\n rec_text = ocr_proc(img).text # recognize\n debug rec_text.gsub(/\\n/, '\\n')\n rec_text\n end",
"title": ""
},
{
"docid": "57ad161ab7ade5d3f931fee410aca487",
"score": "0.56008595",
"text": "def run_test entry, path\n img = \"#{path}#{entry[0]}.png\"\n result = LibOCR.ocr_read_image $ocr, img\n if result == entry[1]\n $pass += 1\n else\n $fail += 1 \n puts \"FAIL: #{img} expected=\\\"#{entry[1]}\\\" actual=\\\"#{result}\\\"\".red\n end\nend",
"title": ""
},
{
"docid": "da52f35b5c677c837b5f33bd49b34bf4",
"score": "0.559793",
"text": "def run_ocr \n @values.each_with_index do |symbol, index|\n if !symbol.is_a? String\n file = \"/tmp/crop#{@time}_#{index}.png\"\n t = %x[tesseract #{file} out -l eng+equ -psm 10 digits]\n sym_val = `cat out.txt`.strip\n\n @ocr_values << (sym_val.empty? ? \"?\" : sym_val) ## ? if empty, the value if it isn't!\n else\n @ocr_values << symbol\n end\n end\n\n ## create a temporary string so that we can add Float() around the parts that are doing integer division\n ## we do not do this in the segment because it would then display it on the app screen\n tmpstr = \"\"\n @ocr_values.each { |value| tmpstr << value }\n tmpstr.gsub!( \"(\", \"Float(\" )\n tmpstr.gsub!( \"=\", \"==\" )\n tmpstr.gsub!( \"x\", \"*\" )\n tmpstr.gsub!( \"X\", \"*\" )\n\n ## rescue if eval fails\n begin\n eval_value = eval(tmpstr)\n rescue SyntaxError, NameError => invalid\n eval_value = \"Equation can't be evaluated\"\n rescue StandardError => err\n eval_value = \"Equation can't be evaluated\"\n end\n \n ## debugging\n puts \"ocr values to string:\" + @ocr_values.join(\"\")\n puts tmpstr\n puts \"the eval value: #{eval_value}\"\n if eval_value.is_a? Fixnum\n @ocr_values << \"= #{sprintf(\"%g\", eval_value)}\" ## pretty up the text. This removes the .0 at the end of a whole number\n else \n @ocr_values << \"= #{eval_value}\"\n end\n end",
"title": ""
},
{
"docid": "8d350b11e9348415c6575ceab3633bf2",
"score": "0.55802625",
"text": "def show\n if request.post? then\n @answer = params[:answer]\n @ansck = @answer.chars\n p @ansck\n @correct =@writing.correct\n @corck = @correct.chars\n p @corck\n n = @correct.length\n @judge =[]\n @point =0\n for i in 0..n-1\n if @ansck[i] == @corck[i]\n @judge.push(@ansck[i])\n else\n @judge.push(\"_\")\n @point +=1\n end\n end\n p @judge.join\n p @point\n if @answer == @correct\n @dec =\"b(≧∇≦)正解!\"\n elsif @point < 3\n @dec =\"(・Δ・)おしい\"\n else\n @dec =\"Σ( ̄ロ ̄;)残念!\"\n end\n end\n end",
"title": ""
},
{
"docid": "7022d31de7ec3a7b87a733cb291809e3",
"score": "0.5563768",
"text": "def show_result\n\t\t\tputs \"\\n\"\n\t\t\tputs \"\\t Choice 1 \\t Choice 2\\t Choice 3\\t Choice 4\"\n\t\t\tputs \"-\" * 70\n\t\t\tputs \"Guess |\\t#{@guess[0]}\\t #{@guess[1]}\\t\\t #{@guess[2]}\\t\\t #{@guess[3]}\"\n\t\t\tputs \"Result |\\t#{@hint[0]} \\t #{@hint[1]} \\t #{@hint[2]} \\t #{@hint[3]}\"\n\t\t\tputs \"\\n\"\n\tend",
"title": ""
},
{
"docid": "58c02dc1c5cba07e4e9cbb8447c0ad22",
"score": "0.5548639",
"text": "def preview_text\n res = result\n [label, res.strip] unless res.nil? || res.empty?\n end",
"title": ""
},
{
"docid": "cf5cdc62c0dfe28bb2976191d935346f",
"score": "0.55422646",
"text": "def pv\n Rubyvis\nend",
"title": ""
},
{
"docid": "541b0fa5110dd237b2e7a7a4e464cc64",
"score": "0.554162",
"text": "def process!(image)\n case image\n when String\n image = OpenCV::IplImage.load(image)\n end\n \n img = image.BGR2GRAY\n # img = img.threshold(150, 230, CV_THRESH_BINARY)\n img = img.threshold(150, 70, CV_THRESH_BINARY)\n \n Thread.new { window.show(img) } \n img.save_image(@tempfile.to_s)\n \n tesseract = Tesseract::Process.new(@tempfile)\n @raw_text = tesseract.process!\n \n @store.set(\"raw_text\", @raw_text)\n currtext = @store.get(\"text\") || []\n t = currtext << self.text\n \n @store.set(\"text\", t)\n \n return t\n end",
"title": ""
},
{
"docid": "d77caf9e63b56e05a8f288eec3aba8a5",
"score": "0.55044377",
"text": "def show_results\n translated = @position.map_win(@board.win) # board array index positions in human-friendly positions\n @console.output_board(@board.game_board, $x_score, $o_score)\n @console.output_results(@x_won, @o_won, translated, @round, @mark, @move)\n end",
"title": ""
},
{
"docid": "fb1f9e831da509e09f962c8ca2285563",
"score": "0.54934114",
"text": "def display\n print_result case\n when @test.errored then 'E'.yellow\n when @test.passed then '.'.green\n when @test.failed then 'F'.red\n end\n end",
"title": ""
},
{
"docid": "11c348206867c208d009a68837236999",
"score": "0.5459516",
"text": "def test_display_results\n assert_output(\"After 527 days Prospector #667 returned to San Fransisco with:\\n\\t0 ounces of gold.\\n\\t0 ounces of silver.\\n\\tHeading home with $0.00\\n\") {@p.display_results 667, 527, 0, 0}\n \n end",
"title": ""
},
{
"docid": "2ade9281cf1327b6d601533f2b827313",
"score": "0.54576784",
"text": "def show_voc \n\t\tresult = Voc.find_details(params[:id])\n\t\t@voc = result.at(0) \n\t\t@vocs_syn_de = result.at(1)\t\t\t \n\t\t@vocs_syn_tib = result.at(2)\n\t\t@t = \"\" #WylieConverter.convert(@voc.wylie) \t\n\t\trender :layout => false\n\tend",
"title": ""
},
{
"docid": "e7737006db9b0567f58509884c03e61b",
"score": "0.54539454",
"text": "def show\n if @measurement.media_body == \"[0, 0, 0]\" || @measurement.media_body == \"[1, 1, 1]\"\n @result = 'perla'\n elsif @measurement.media_body == \"[0, 0, -1]\" || @measurement.media_body == \"[1, 0, -1]\" || @measurement.media_body == \"[1, 0, -2]\" || @measurement.media_body == \"[1, 1, -1]\" || @measurement.media_body == \"[1, -1, 1]\" || @measurement.media_body == \"[1, 1, -2]\" || @measurement.media_body == \"[2, 0, -2]\"\n @result = 'rubí'\n elsif @measurement.media_body == \"[0, 0, 1]\" || @measurement.media_body == \"[-1, 0, 1]\" || @measurement.media_body == \"[-1, 0, 2]\" || @measurement.media_body == \"[-1, -1, 1]\" || @measurement.media_body == \"[0, -1, 2]\" || @measurement.media_body == \"[-1, -1, 2]\" || @measurement.media_body == \"[-1, -1, 3]\" || @measurement.media_body == \"[-1, -2, 2]\" || @measurement.media_body == \"[2, 0, 1]\" || @measurement.media_body == \"[-2, 0, 2]\"\n @result = 'ámbar'\n elsif @measurement.media_body == \"[1, 0, 0]\" || @measurement.media_body == \"[1, -1, -1]\" || @measurement.media_body == \"[2, 0, -1]\" || @measurement.media_body == \"[2, -1, -1]\" || @measurement.media_body == \"[2, 1, -2]\" || @measurement.media_body == \"[3, -2, -1]\"\n @result ='topacio'\n elsif @measurement.media_body == \"[-1, 0, 0]\" || @measurement.media_body == \"[-1, 1, 1]\" || @measurement.media_body == \"[-2, 1, 1]\"\n @result ='esmeralda'\n elsif @measurement.media_body == \"[0, -1, 0]\" || @measurement.media_body == \"[0, -1, 1]\" || @measurement.media_body == \"[0, -2, 1]\" || @measurement.media_body == \"[0, -2, 2]\" || @measurement.media_body == \"[1, -1, 0]\" || @measurement.media_body == \"[1, -2, 1]\" || @measurement.media_body == \"[2, -2, 1]\"\n @result ='lapislázuli'\n elsif @measurement.media_body == \"[1, 2, -3]\" || @measurement.media_body == \"[0, 1, 0]\" || @measurement.media_body == \"[0, 1, -1]\" || @measurement.media_body == \"[0, 1, -2]\" || @measurement.media_body == \"[0, 2, -1]\" || @measurement.media_body == \"[0, 2, -2]\" || @measurement.media_body == \"[-1, 1, 0]\" || @measurement.media_body == \"[-1, 1, -1]\" || @measurement.media_body == \"[-1, 2, 0]\" || @measurement.media_body == \"[-1, 2, -1]\" || @measurement.media_body == \"[1, 2, -2]\" || @measurement.media_body == \"[-1, 2, -2]\" || @measurement.media_body == \"[-1, 3, -2]\" || @measurement.media_body == \"[-2, 1, 0]\" || @measurement.media_body == \"[-2, 2, 0]\" || @measurement.media_body == \"[-2, 2, -1]\"\n @result ='amatista'\n else\n @result ='No existe'\n end\n end",
"title": ""
},
{
"docid": "1515689aced17ad65e133408c4704e82",
"score": "0.5449403",
"text": "def show_result\n puts \"\\n\"\n puts \"\\t Choice 1 \\t Choice 2\\t Choice 3\\t Choice 4\"\n puts \"-\" * 70\n puts \"Guess |\\t#{@guess[0]}\\t #{@guess[1]}\\t\\t #{@guess[2]}\\t\\t #{@guess[3]}\"\n puts \"Result |\\t#{@hint[0]} \\t #{@hint[1]} \\t #{@hint[2]} \\t #{@hint[3]}\"\n puts \"\\n\"\n end",
"title": ""
},
{
"docid": "133af225f040e338ec865f39e487764a",
"score": "0.5443768",
"text": "def outjet_textualism(prickmedainty_trudgen)\n end",
"title": ""
},
{
"docid": "0253b99a0772a00929bdce73dcd122ef",
"score": "0.54235744",
"text": "def test_positive_silver_found\n assert_output(\"\\tFound 1 ounce of silver in Sutter Creek.\\n\") { @l.display_findings(1, 0) }\n end",
"title": ""
},
{
"docid": "f10a086a48a260f0c93a0f3df23dfb8a",
"score": "0.54208994",
"text": "def visuel\n\n puts \"Visualisation du plateau de jeu\"\n puts \" 1 2 3\"\n puts \"A #{@case1.valeur} | #{@case2.valeur} | #{@case3.valeur} \" \n puts \" ---|---|---\"\n puts \"B #{@case4.valeur} | #{@case5.valeur} | #{@case6.valeur} \"\n puts \" ---|---|---\"\n puts \"C #{@case7.valeur} | #{@case8.valeur} | #{@case9.valeur} \"\n puts\n\n end",
"title": ""
},
{
"docid": "b78d9ee82e4ced4430a668b64d4d8d98",
"score": "0.54016757",
"text": "def display(results, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "21553ec7ed175454724ef34aba29e7df",
"score": "0.5374737",
"text": "def displaygameanalysis\n\t\t\t@output.puts \"Analysis of game.\"\n\t\tend",
"title": ""
},
{
"docid": "ffb2948d56b37e42f00f7417ab43ceb5",
"score": "0.5367502",
"text": "def show(display = true)\n emergencyclosegks\n sleep 0.5\n type = ENV['GKS_WSTYPE']\n case type\n when 'svg'\n data = File.read(\"#{ENV['GKS_FILEPATH']}.svg\")\n IRuby.display(data, mime: 'image/svg+xml') if display\n when 'png', '322', '140'\n data = File.read(\"#{ENV['GKS_FILEPATH']}.png\")\n IRuby.display(data, mime: 'image/png') if display\n when 'jpg', '321', '144'\n data = File.read(\"#{ENV['GKS_FILEPATH']}.jpg\")\n IRuby.display(data, mime: 'image/jpeg') if display\n when 'gif', '130'\n data = File.read(\"#{ENV['GKS_FILEPATH']}.gif\")\n IRuby.display(data, mime: 'image/gif') if display\n when 'webm', 'ogg', 'mp4', 'mov'\n require 'base64'\n mimespec = if type == 'mov'\n 'movie/quicktime'\n else\n \"video/#{type}\"\n end\n data = File.binread(\"#{ENV['GKS_FILEPATH']}.#{type}\")\n if display\n IRuby.display(\n \"<video autoplay controls><source type=\\\"#{mimespec}\\\" \" \\\n \"src=\\\"data:#{mimespec};base64,#{Base64.encode64(data)}\\\">\" \\\n '</video>',\n mime: 'text/html'\n )\n end\n end\n data unless display\n end",
"title": ""
},
{
"docid": "2555e5f09ffc0302a212968b5d054581",
"score": "0.53550875",
"text": "def make_text(labels_drink, vision)\n\tbrand_avaliable = 0\n\tlabels_avaliable = 0\n\n\tvision[\"web\"].each do |entityWeb|\n\t\tlabels_drink[\"brands\"].each do |label|\n\t\t\tif entityWeb[\"description\"].downcase.include?(label[\"name\"].downcase)\t\t\n\t\t\t\tbrand_avaliable += 1\n\t\t\tend\n\t\tend\n\t\tlabels_drink[\"labels\"].each do |label|\n\t\t\tif entityWeb[\"description\"].downcase.include?(label[\"name\"].downcase)\t\t\n\t\t\t\tlabels_avaliable += 1\n\t\t\tend\n\t\tend\n\tend\n\n\tvision[\"labels\"].each do |labelVis|\n\t\tlabels_drink[\"labels\"].each do |label|\n\t\t\tif labelVis[\"description\"].downcase.include?(label[\"name\"].downcase)\t\t\n\t\t\t\tlabels_avaliable += 1\n\t\t\tend\n\t\tend\n\tend\n\n\tif brand_avaliable + labels_avaliable == 0\n\t\t\"Não achamos \\xF0\\x9F\\x8D\\xBA ...\"\t\t\n\telse\n\t\t\"Tem \\xF0\\x9F\\x8D\\xBA \\n\"\n\tend\nend",
"title": ""
},
{
"docid": "ebec52d6ca02a40e2cc5a79270bbdecb",
"score": "0.534772",
"text": "def test_positive_gold_found\n assert_output(\"\\tFound 1 ounce of gold in Sutter Creek.\\n\") { @l.display_findings(0, 1) }\n end",
"title": ""
},
{
"docid": "4bc4e688853a85c09c689f35fadcf072",
"score": "0.52988076",
"text": "def print_result(result, description)\n printer = RubyProf::FlatPrinter.new(result)\n print \"#{'-' * 50} #{description}\\n\"\n printer.print($stdout)\nend",
"title": ""
},
{
"docid": "38527fd60222853f079fe2b0843b26b6",
"score": "0.5297736",
"text": "def display\n Nonograms::Display.new(@results, @horizontal, @vertical)\n end",
"title": ""
},
{
"docid": "e70df4eee5c3067cc3153ed4e023c3a4",
"score": "0.52823377",
"text": "def draw_tactic_overview\n end",
"title": ""
},
{
"docid": "f78a6c33dd70bc04a54866b0bf7809ba",
"score": "0.52820474",
"text": "def game_victory\n \"You made it!!!!!!\\n\".colorize(:blue).each_char { |c| putc c; $stdout.flush; sleep 0.1 }\n sleep(2.0)\n scenic_view\n sleep(0.7)\n \"\\n!You survived the Zombie Apocalypse! Off to the pub (coming soon in Zombie Trail 2.0)\\n\".colorize(:black).colorize(:background => :red).each_char { |c| putc c; $stdout.flush; sleep 0.06 }\n end",
"title": ""
},
{
"docid": "55c53ed9f26a3a0a10be27b5a6514ddd",
"score": "0.5278503",
"text": "def text(results, color=true)\n require 'colored' if color\n\n results.map do |r|\n\n word = r[:word]\n upvotes = r[:upvotes]\n downvotes = r[:downvotes]\n\n if (color)\n word = word.bold\n upvotes = upvotes.to_s.green\n downvotes = downvotes.to_s.red\n end\n\n votes = \"#{upvotes}/#{downvotes}\"\n definition = tab(fit(r[:definition], 75)).join(\"\\n\")\n example = tab(fit(r[:example], 75)).join(\"\\n\")\n\n s = ''\n\n s << \"* #{word} (#{votes}):\\n\"\n s << \"\\n\"\n s << definition\n s << \"\\n\\n Example:\\n\"\n s << example\n s << \"\\n\\n\"\n\n end.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "e8720ad891f1f9691e33a8b8b27f996b",
"score": "0.52745366",
"text": "def turn_result\n puts \"matches: #{exact_matches}\"\n puts \"color matches: #{color_matches(get_code_remainder, get_guess_remainder)}\"\n end",
"title": ""
},
{
"docid": "127c7288bda5a8067d8f220ec85a0439",
"score": "0.52649206",
"text": "def rave\n rant = @bill ? bill : local.unseen(@unseen).random\n Output.new(rant, @show_images)\n end",
"title": ""
},
{
"docid": "a7419b21b229052186cd0011d088dc31",
"score": "0.5261914",
"text": "def virus_effects \r\n puts \"#{predicted_deaths} #{speed_of_spread} \"\r\n end",
"title": ""
},
{
"docid": "002393c7d3f15a90a0d84a1551c8542d",
"score": "0.5258576",
"text": "def print_result(result, description)\n printer = RubyProf::FlatPrinter.new(result)\n print \"#{'-' * 50} #{description}\\n\"\n printer.print(STDOUT)\nend",
"title": ""
},
{
"docid": "1cff5130e546b9c8b88fd00bd2cf87af",
"score": "0.52456343",
"text": "def virus_effects\n display_report\n end",
"title": ""
},
{
"docid": "bf94fc70f8bfc3ad01f3b321536a5b1f",
"score": "0.5240434",
"text": "def outcome_text\n \"Lichamelijk functioneren: #{evaluate[:estimate][0].round(1)} (#{evaluate[:se][0].round(1)})\\nVermoeidheid: #{evaluate[:estimate][1].round(1)} (#{evaluate[:se][1].round(1)})\\nVermogen om aandeel te hebben in sociale rollen en activiteiten: #{evaluate[:estimate][2].round(1)} (#{evaluate[:se][2].round(1)})\\nImpact van COPD-gerelateerde klachten: #{evaluate[:estimate][3].round(1) }(#{evaluate[:se][3].round(1)})\"\n end",
"title": ""
},
{
"docid": "371a36c30a971fec9d4ab002c8b887b8",
"score": "0.5238565",
"text": "def print_result()\n \tString.disable_colorization = true if (@no_color)\n \tputs \"X #{@operation} Y\".yellow\n case\n when (@radix)\n puts \"X\"; print_all_radixes(@x)\n \tif @y != nil\n \t\tputs \"Y\" \n \tprint_all_radixes(@y) \n end\n interactive()\n else\n puts \"\\t---------------------------------------\".green\n print \"X:\\t\\t\".yellow; print \"#{@x}\\n\" \n if (@y != nil) \n print \"Y:\\t\\t\".yellow; print \"#{@y}\\n\"\n end\n print \"Solution:\\t\".yellow; print \"#{@ans}\\n\" \n interactive()\n end\n end",
"title": ""
},
{
"docid": "be45796dbe5a72db46241eebcc4fc849",
"score": "0.52374107",
"text": "def nsfw?(file = \"expertvagabond/2013-08-10_c17elIPOWV.jpg\")\n image_path = @bucket_facade.make_gcs_url_from_path file\n\n response = @client.safe_search_detection image: image_path\n\n response.responses.each do |res|\n safe_search = res.safe_search_annotation\n\n puts \"Adult: #{safe_search.adult}\"\n puts \"Spoof: #{safe_search.spoof}\"\n puts \"Medical: #{safe_search.medical}\"\n puts \"Violence: #{safe_search.violence}\"\n puts \"Racy: #{safe_search.racy}\"\n end\n end",
"title": ""
},
{
"docid": "1b949067801173ee8e397cbca4087658",
"score": "0.5236068",
"text": "def cat?\n labels = []\n labelText = \"\"\n project_id = \"tigrasha\"\n image_annotator = Google::Cloud::Vision::ImageAnnotator.new\n file_name = self.image.url\n response = image_annotator.label_detection image: file_name\n response.responses.each do |res|\n puts \"Labels:\"\n res.label_annotations.each do |label|\n puts label.description\n labels << label.description\n labelText += (label.description + \": \" + label.score.to_s + \"\\n\")\n end\n \n if labels.include?(\"Cat\")\n labelText += \"かわいいネコちゃんですね!\"\n else\n labelText += \"ネコじゃないよね?\"\n end\n end\n\n return labelText\n end",
"title": ""
},
{
"docid": "7cd92741074b697077dadd755b74b5f3",
"score": "0.52348495",
"text": "def show\n\t@client = OpenCPU.client\t\n\t@mark = @client.prepare :markdownapp, 'rmdtext', data: {text: @rscript.code}\t\n end",
"title": ""
},
{
"docid": "8fe27728137eba3c80937dac95550a8d",
"score": "0.52339387",
"text": "def testDisplay\n latex = Latex.new(\"test/script/initIntTest.cookie\", false)\n tokenModel = Struct.new(:id,:value,:pos)\n testtoken = [\n tokenModel.new(:cookint,\"cookint\",1),\n tokenModel.new(:space,\" \",2),\n tokenModel.new(:id,\"cookie\",3),\n tokenModel.new(:space,\" \",4),\n tokenModel.new(:equal,\"=\",5),\n tokenModel.new(:space,\" \",6),\n tokenModel.new(:int,\"4\",7)\n ]\n latex.lex()\n\n v1 = \"\"\n testtoken.each {|token| v1 += \"#{token}\\n\"}\n v2 = latex.to_s\n\n assert_equal v1.to_s ,v2.to_s\n end",
"title": ""
},
{
"docid": "81cac01cdd0b2dc8f6118f21851fc5a0",
"score": "0.5231218",
"text": "def label_aliquots \r\n show do \r\n title \"Label aliquots\"\r\n aliquotsLabeled = 0\r\n operations.group_by { |op| op.input(CELLS).item }.each do |batch, grouped_ops|\r\n if grouped_ops.size == 1\r\n check \"Label the electrocompetent aliquot of #{grouped_ops.first.input(CELLS).sample.name} as #{aliquotsLabeled + 1}.\"\r\n else\r\n check \"Label each electrocompetent aliquot of #{grouped_ops.first.input(CELLS).sample.name} from #{aliquotsLabeled + 1}-#{grouped_ops.size + aliquotsLabeled}.\"\r\n end\r\n aliquotsLabeled += grouped_ops.size\r\n end\r\n note \"If still frozen, wait till the cells have thawed to a slushy consistency.\"\r\n warning \"Transformation efficiency depends on keeping electrocompetent cells ice-cold until electroporation.\"\r\n warning \"Do not wait too long\"\r\n image \"Actions/Transformation/thawed_electrocompotent_cells.jpg\"\r\n end\r\n end",
"title": ""
},
{
"docid": "a7ef6a3252e65891cd5bdca31987aa18",
"score": "0.52283204",
"text": "def show\n mut_pos = @annotation.mutations_positions.take\n @pos = 'chr' + VcfTools.chrom_to_s(mut_pos.position.chr) + \":\" + mut_pos.position.pos.to_s\n @ref = mut_pos.mutation.ref\n @alt = mut_pos.mutation.alt\n @gene_name = @annotation.gene.name\n @sig = @annotation.clinical_significance.name\n @updated_date = @annotation.updated_at\n p_vcf = @annotation.patients_vcf_file\n @patient = p_vcf.patient unless p_vcf.nil?\n\n if !@annotation.review_status.nil?\n @status = @annotation.review_status.name\n end\n if @annotation.user.username == 'Clinvar'\n @comment = 'SCV: ' + @annotation.scv + ', ClinVar version: ' + @annotation.version\n else\n @comment = @annotation.comment\n end\n end",
"title": ""
},
{
"docid": "051af6f42848db8212bd5e4d041984d5",
"score": "0.5221957",
"text": "def display_assessment(result)\n @io.puts (result)\n end",
"title": ""
},
{
"docid": "6f708aedbf99d71d0a46b887131d11c1",
"score": "0.52101624",
"text": "def show\r\n\t@count=0 \t\t # to count the favourable outcomes\r\n\t@i=0 \t\t # initialising a counter\r\n\trequire 'distribution' # using the gem\r\n\t@normal1 = Distribution::Normal.rng(@prediction.rating1.to_f,@prediction.volatility1.to_f)\r\n\t@normal2 = Distribution::Normal.rng(@prediction.rating2.to_f,@prediction.volatility2.to_f)\r\n\t# creating two arrays with the normally distributed values for respective players with mean as rating and standard devaition as volatility\r\n\t@norm1_distribution = 10_000.times.map {@normal1.call.to_f}\t\r\n\t@norm2_distribution = 10_000.times.map {@normal2.call.to_f}\r\n\twhile @i<10000 do\r\n\t\tif @norm1_distribution[@i]>@norm2_distribution[@i]\r\n\t\t\t@count=@count+1\t\t\t\t\t#incrementing favourable outcomes\r\n\t\tend\r\n\t\t@i=@i+1\r\n\tend\r\n\t@percent1=(@count)/100 # % for 1st player\r\n\t@percent2=100-@percent1 # % for 2nd player\r\n end",
"title": ""
},
{
"docid": "0221951d9f427bc4d4b40c7120af7e44",
"score": "0.5202407",
"text": "def show_game_result\n if @board.check_result.downcase == @players[0].short_marker\n puts \"#{@players[0].name.bold_yellow} is the winner!\"\n elsif board.check_result.downcase == @players[1].short_marker\n puts \"#{@players[0].name.bold_yellow} is the winner!\"\n else\n puts \"The game is a tie.\"\n end\n end",
"title": ""
},
{
"docid": "b576d6385ab8718f0e2e10397acbd149",
"score": "0.5199672",
"text": "def images_to_strings\n puts \"Preparing quiz...\"\n puts \"\"\n fact = Greeting.new\n fact.random_fact\n @questions = RTesseract.new(@questions_image).to_s\n @answers = RTesseract.new(@answers_image).to_s\n end",
"title": ""
},
{
"docid": "01d17e39fb764f8bc1149f0f8e52be13",
"score": "0.51965094",
"text": "def display_victory\n @viewer.display_victory\n end",
"title": ""
},
{
"docid": "d90dee3fbeb6938fdfdcc687a299c9e3",
"score": "0.5187857",
"text": "def render(backgroundImageUrl)\n\n background = Magick::Image.read(backgroundImageUrl).first\n\n \n\n croppedImg = background.crop(0,0,128,28)\n\n \n\n text = Magick::Draw.new\n\n text.annotate(croppedImg, 128, 28, 0, 0, @question) {\n\n self.gravity = Magick::SouthGravity\n\n self.pointsize = 24\n\n self.stroke = 'transparent'\n\n self.fill = '#0000A9'\n\n self.font_weight = Magick::BoldWeight\n\n }\n\n \n\n croppedImg = croppedImg.blur_image\n\n return croppedImg.to_blob\n\n end",
"title": ""
},
{
"docid": "c5cea078fda345ac72287c4458282421",
"score": "0.5181601",
"text": "def out\n puts_image\n puts @rant['text']\n puts footer\n end",
"title": ""
},
{
"docid": "de00bc5e8fd9752e0bb20ed367229bc5",
"score": "0.5176501",
"text": "def show\n @sensei = checksensei\n end",
"title": ""
},
{
"docid": "841e4c9abb7a0f9b15baf56485f2f609",
"score": "0.51741105",
"text": "def puts_image\n return unless @show_images\n return unless @rant['image']\n\n Catpix.print_image(@rant['image'],\n resolution: 'low',\n limit_x: 0.4,\n limit_y: 0.4)\n end",
"title": ""
},
{
"docid": "0e55c94f8b2dca4650c55819f7ddd608",
"score": "0.5170534",
"text": "def show_result(started_at)\n @h.restore_mode\n total_chars = @sentences.join.size\n accuracy = \"#{((total_chars - @total_errors) * 100.0 / total_chars).round(2)}%\"\n elapsed_minutes = (Time.now - started_at)/60\n total_words = @sentences.join.split(' ').size\n # wpm = \"#{total_words/elapsed_minutes.to_f} WPM\"\n ccpm = \"#{((total_chars)/elapsed_minutes.to_f).floor/5} WPM / #{((total_chars)/elapsed_minutes.to_f).floor} CPM\"\n\n print \"These are your results:\\n\", :bold\n print \"Total time: #{elapsed_minutes} minutes\\n\", :bold\n print \"Character count: #{total_chars}\\n\", :bold\n print 'Speed: ', :blue\n print ccpm, :bold\n print ' '\n print 'Accuracy: ', :green\n print accuracy, :bold\n print ' '\n print 'Errors: ', :red\n print \"#{@total_errors}/#{total_chars}\", :bold\n if @h.ask(\"\\n\\nDo you want to play again? [y,n]\", [\"y\", \"n\"]) == \"y\"\n # The logic ahead allows us to support starting from a letter or a level indistictively and\n # continue with the next levels and letters as expected\n if @introduce_letter\n @level_number = @level.next_level(@introduce_letter)\n if @level_number == 1\n # If they only know one letter, don't make them repeat it. Introduce one more instead\n @introduce_letter = @level.next_letter(1)\n else\n @introduce_letter = nil\n end\n elsif @level_number\n @introduce_letter = @level.next_letter(@level_number)\n end\n play!\n end\n end",
"title": ""
},
{
"docid": "8a7a7deb1f5459b4e48d06b22a16ae9c",
"score": "0.5169285",
"text": "def example_passed(example)\n # if MacOS.version >= :lion\n output.print ([' 🍺 ',' 🙌 ', ' 😍 '].sample).colorize(:background => :green)\n # else\n # output.print [' YAY ', ' YAAASS ', ' NICE '].sample\n # end\n end",
"title": ""
},
{
"docid": "d6e2cf452ee1fbf80384042c168657a4",
"score": "0.5156095",
"text": "def display_search_results matched = []\n matched.each do |vid|\n status = (vid.completed ? \"C\" : \"P\")\n file_path = vid.file_path.gsub(ENV['HOME'], '~') if vid.completed\n\n success vid.nice_title, \"#{\"%3d\" % vid[:score]}pts. [#{status}]\"\n info file_path, \"\" if file_path\n end\n end",
"title": ""
},
{
"docid": "9d238c238bd0a5ed0d3f0a1539b31cf4",
"score": "0.5155467",
"text": "def test_display_no_findings\n \tassert_output(\"\tFound no precious metals in Sutter Creek\\n\") {@p.display_findings 0, 0, 0}\n end",
"title": ""
},
{
"docid": "36c66ecf772fefb167bb28e00cd2b6d4",
"score": "0.51457125",
"text": "def virus_effects\n print predicted_deaths\n print speed_of_spread\n end",
"title": ""
},
{
"docid": "7b9b2a27c3e4817b3610c85e0c02ab33",
"score": "0.51432794",
"text": "def show\n if @training.studies\n puts \">>studia\"\n render \"show_studia\"\n else\n puts \">>szkolenia\"\n render \"show_szkolenie\"\n end\n end",
"title": ""
},
{
"docid": "831d0ebacbdbf1100ff7d25426f0b2f5",
"score": "0.5139761",
"text": "def display\n @fname ||= \"/tmp/vips_image_#{Time.now.to_i}.jpg\"\n write_to_file(@fname)\n IRuby.display(Magick::Image.read(@fname)[0])\n end",
"title": ""
},
{
"docid": "9722ff8da6564a4cd05ee8491b6e76be",
"score": "0.51318944",
"text": "def display_results_for(document)\n puts \"Document: #{document.id} => labeled class: #{document.klass}, classified class: #{document.classified_klass}, probability: #{document.probability}\"\n end",
"title": ""
},
{
"docid": "3e49ba70d13b2d78ccda0fba1c0371fd",
"score": "0.5118238",
"text": "def view\n view_dvi\n end",
"title": ""
},
{
"docid": "7a2b4dec42264f3519004dff39a7d859",
"score": "0.51162535",
"text": "def scanned_image\n scanned_covenant\n end",
"title": ""
},
{
"docid": "f177748e930c7b1a537906a132a4141e",
"score": "0.51050967",
"text": "def vortex_and_centrifuge\n show do\n title \"Vortex and centrifuge\"\n \n check \"Wait one minute for the primer to dissolve in TE.\" if operations.length < 7\n check \"Vortex each tube on table top vortexer for at least 30 seconds and then quick spin for 2 seconds on table top centrifuge.\"\n end \n end",
"title": ""
},
{
"docid": "dfa3b14b725870962ceb3a32edb4e8f0",
"score": "0.5102656",
"text": "def test_no_metal_found\n assert_output(\"\\tFound no precious metals in Sutter Creek.\\n\") { @l.display_findings(0, 0) }\n end",
"title": ""
},
{
"docid": "37933509466e945543ed71edc7a6c88d",
"score": "0.50963384",
"text": "def pipette_glycerol\n show do \n title \"Pipette Glycerol into Cryo Tubes\"\n \n check \"Take #{operations.length} Cryo #{\"tube\".pluralize(operations.length)}\"\n check \"Label each tube with the printed out labels\"\n check \"Pipette 900 uL of 50 percent Glycerol into each tube.\"\n warning \"Make sure not to touch the inner side of the Glycerol bottle with the pipetter.\"\n end\n end",
"title": ""
},
{
"docid": "96e1709d63dcf810545a526bbde57052",
"score": "0.5093401",
"text": "def game_status\n if gameboard_complete\n puts \"YOU WON!\".colorize(:white)\n exit\n elsif @guess_count >= 6\n new_image = Cactus.new\n puts new_image.show_ascii(6)\n puts \"You lost... the correct answer was\\n\".colorize(:white)\n puts \" \" * 16 + \"#{@word.upcase.colorize(:white)} \\n\\n\"\n exit\n end\n end",
"title": ""
},
{
"docid": "5f397278ef67039c3dc43c6ea2b84f7e",
"score": "0.50740695",
"text": "def testing_ui\n @output = StringIO.new\n def @output.winsize\n [20, 9999]\n end\n\n cork = Cork::Board.new(out: @output)\n def cork.string\n out.string.gsub(/\\e\\[([;\\d]+)?m/, \"\")\n end\n cork\nend",
"title": ""
},
{
"docid": "5f397278ef67039c3dc43c6ea2b84f7e",
"score": "0.50740695",
"text": "def testing_ui\n @output = StringIO.new\n def @output.winsize\n [20, 9999]\n end\n\n cork = Cork::Board.new(out: @output)\n def cork.string\n out.string.gsub(/\\e\\[([;\\d]+)?m/, \"\")\n end\n cork\nend",
"title": ""
},
{
"docid": "6d45176216c8667dd9149e44881423cd",
"score": "0.5071808",
"text": "def test_both_found\n assert_output(\"\\tFound 2 ounces of gold and 3 ounces of silver in Sutter Creek.\\n\") { @l.display_findings(3, 2) }\n end",
"title": ""
},
{
"docid": "9285c6971f5b74d8b9755790bc35026b",
"score": "0.50644755",
"text": "def testing_ui\n @output = StringIO.new\n def @output.winsize\n [20, 9999]\n end\n\n cork = Cork::Board.new(out: @output)\n def cork.string\n out.string.gsub(/\\e\\[([;\\d]+)?m/, '')\n end\n cork\nend",
"title": ""
},
{
"docid": "71f160d8c24b1ef5f56d0af67e5fc17c",
"score": "0.5058419",
"text": "def output(results)\n puts \"File checked: #{results[:file]}\"\n puts \"Range: #{results[:range]}\"\n puts \"Palindromes: #{results[:count]}\"\n puts '========================'\n puts\n end",
"title": ""
},
{
"docid": "c3512b6f235cebf51713915e2788cef8",
"score": "0.50574714",
"text": "def draw_train(train)\n\tputs \"Here is your train:\"\n\ttrain.each do |key,index|\n\t\tprint \"#{index[:picture]*index[:number]}\"\n\tend\nend",
"title": ""
},
{
"docid": "0f8a80f8914121592c5ff129cf60c83f",
"score": "0.50573075",
"text": "def render_results_to_textbuffer(results, buffer)\n\t\tlast_word_id = nil\n\n\t\tresults.each { |result|\n\t\t\t# We can have many results with the same base word\n\t\t\t# (we expect them to be sorted by word or word_id)\n\t\t\tif last_word_id != result[:word_id]\n\t\t\t\t#\n\t\t\t\tword = SpanishWord.find(result[:word_id])\n\t\t\t\tdefinitions = word.english_words\n\n\t\t\t\t# blank line *between* different words (not before the first)\n\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\") unless last_word_id.nil?\n\n\t\t\t\t# show base word (\"hablar\")\n\t\t\t\tbuffer.insert(buffer.end_iter, word.word, 'header')\n\n\t\t\t\t# show word type (\"v.\")\n\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + WORD_TYPE_NAMES[word.type] + '.', 'word-type')\n\n\t\t\t\t# show definition(s) in a comma-separated list (\"to speak, to talk\")\n\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + definitions.map { |definition| definition['word'] }.join(\", \") + \"\\n\", 'definition')\n\t\t\tend\n\n\t\t\tif result[:word_type] == WORD_TYPE_VERB\n\t\t\t\t# show verb table for infinitives\n\t\t\t\tif result[:verb_tense] == VERB_TENSE_INFINITIVE\n\t\t\t\t\t# for each tense (past perfect, etc.)\n\t\t\t\t\tTENSE_NAMES.each_index { |tense|\n\t\t\t\t\t\tnext if TENSE_SHOW[tense] == false\t# some tenses aren't so useful...\n\n\t\t\t\t\t\t# show tense name (\"Past Perfect\")\n\t\t\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\" + TENSE_NAMES[tense] + \"\\n\", 'tense')\n\n\t\t\t\t\t\t# for each person (yo, tu, el, ...)\n\t\t\t\t\t\tVERB_PERSON_NAMES.each_index { |person|\n\t\t\t\t\t\t\tnext if VERB_PERSON_SHOW[person] == false\t\t# skip \"vosotros\" based on user settings\n\n\t\t\t\t\t\t\t# show conjugation\n\t\t\t\t\t\t\t# attempt to load irregular conjugation (only irregulars are stored in the DB)\n\t\t\t\t\t\t\tirregular_conjugation = SpanishVerbConjugation.where(:word_id => result[:word_id], :tense => tense, :person => person).first\n\t\t\t\t\t\t\tif irregular_conjugation\n\t\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, irregular_conjugation.conjugation.to_s, 'indent', 'irregular-conjugation')\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t# this verb is regular in this tense\n\t\t\t\t\t\t\t\tconjugation = conjugate(word.word, tense, person)\n\t\t\t\t\t\t\t\tnext if conjugation.nil?\t# some tenses (eg. gerund) don't have all persons\n\t\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, conjugation, 'indent', 'regular-conjugation')\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + VERB_PERSON_NAMES[person], 'person') if VERB_PERSON_NAMES[person] != ''\n\t\t\t\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t# not an infinitive\n\t\t\t\t\t# show the tense (\"past simple tense tú form\")\n\t\t\t\t\tbuffer.insert(buffer.end_iter, '↳ ' + TENSE_NAMES[result[:verb_tense]] + ' tense', 'word-details')\n\t\t\t\t\tbuffer.insert(buffer.end_iter, ' ' + VERB_PERSON_NAMES[result[:verb_person]] + ' form', 'word-details') if VERB_PERSON_NAMES[ result[:verb_person] ] != ''\n\t\t\t\t\tbuffer.insert(buffer.end_iter, \"\\n\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tlast_word_id = result[:word_id]\n\t\t}\n\tend",
"title": ""
},
{
"docid": "f20d5032962021d66639f67e2a810f29",
"score": "0.5056496",
"text": "def template()\n # template to position ocr text over the image\n # - logic adapted from readux\n # TODO: pull template out into a separate file?\n %{\n <% for line in self.lines %>\n <div class=\"ocr-line <% if line.word_zones.empty? %>ocrtext<% end %>\" <% if line.id %>id=\"<%= line.id %>\"<% end %>\n <%= line.css_style %>>\n <% for zone in line.word_zones %>\n <div class=\"ocr-zone ocrtext\" <%= zone.css_style %>>\n <%= zone.begin_annotation_data %>{% raw %}<%= zone.annotated_text %>{% endraw %}<%= zone.end_annotation_data %>\n </div>\n <% end %>\n <% if line.word_zones.empty? %>\n <%= line.begin_annotation_data %>{% raw %}<%= line.annotated_text %>{% endraw %}<%= line.end_annotation_data %>\n <% end %>\n </div>\n <% end %>\n <% for img_highlight in self.image_highlight_zones %>\n <span class=\"annotator-hl image-annotation-highlight\"\n data-annotation-id=\"<%= img_highlight.annotation_id %>\"\n <%= img_highlight.css_style %>>\n <a href=\"#<%= img_highlight.annotation_id %>\"\n name=\"hl-<%= img_highlight.annotation_id %>\" class=\"to-annotation\"></a>\n\n </span>\n <% end %>\n }\n end",
"title": ""
},
{
"docid": "6bce40710d56be37b1d739543f565873",
"score": "0.50552803",
"text": "def view\n result && result.raw\n end",
"title": ""
},
{
"docid": "ddc216d906abdc4506531bf8aa2fab66",
"score": "0.50541794",
"text": "def virus_effects\r\n puts \"#{@state} will lose #{predicted_deaths} people in this outbreak and will spread across the state in #{speed_of_spread} months.\\n\\n\" \r\n end",
"title": ""
},
{
"docid": "49b9f11038e12585a35ab00e9f08372a",
"score": "0.50468236",
"text": "def show_normal(result)\n array = []\n unless result[:supported]\n # If current value is present but NO supported value, it is immutable.\n result[:supported] = [result[:current]]\n end\n result[:supported].each_with_index do |v, i|\n if v == result[:current]\n array << \" => #{v} \"\n elsif result[:available].include? v\n array << \" * #{v} \"\n else\n array << \" x #{v}\"\n end\n end\n print_array_in_columns(array, 120, 10, 5)\n end",
"title": ""
},
{
"docid": "c494f37b41a608e0a7c33b84bb508c39",
"score": "0.50382334",
"text": "def virus_effects\n print_report \n end",
"title": ""
},
{
"docid": "b56aea89cc4199235ae7635bbb8e4f7d",
"score": "0.50376654",
"text": "def print_answer\n @ysize.times do |y|\n @xsize.times do |x|\n if hint_cell?(x,y)\n print hint_data(x,y)\n # print \"O \"\n else\n c = @model[cvar(x,y)].to_b\n if c\n print \"* \"\n else\n print \"# \"\n end\n end\n\n next if x == @xsize - 1\n if @model[hvar(x,y)].to_b\n print \"-\"\n else\n print \" \"\n end\n end\n print \"\\n\"\n\n next if y == @ysize-1\n @xsize.times do |x|\n if @model[vvar(x,y)].to_b\n print \"| \"\n else\n print \" \"\n end\n end\n\n print \"\\n\"\n end\n end",
"title": ""
},
{
"docid": "385c963ce3773f5fa2ff24a522b206d6",
"score": "0.5035394",
"text": "def tell_fortune()\r\n print \"The answer is \" + $prediction + \". \\n\\n: \"\r\n end",
"title": ""
},
{
"docid": "dd6aa98ece6241968904093b56980355",
"score": "0.5033086",
"text": "def preview; end",
"title": ""
},
{
"docid": "dd6aa98ece6241968904093b56980355",
"score": "0.5033086",
"text": "def preview; end",
"title": ""
},
{
"docid": "dd6aa98ece6241968904093b56980355",
"score": "0.50315475",
"text": "def preview; end",
"title": ""
},
{
"docid": "85555304e9821815673eef99dde30f92",
"score": "0.50314623",
"text": "def verbose_result(w, x, y, z)\n return w + '/' + x + ' = ' + y + '/' + z\nend",
"title": ""
},
{
"docid": "b8feabedcf0ec01deb6919b308adb9df",
"score": "0.50253856",
"text": "def plate_preheating \r\n show do \r\n title \"Pre-heat plates\"\r\n note \"Retrieve the following plates, and place into still #{operations[0].input(\"Plasmid\").sample.properties[\"Transformation Temperature\"].to_i} C incubator.\" \r\n grouped_by_marker = operations.running.group_by { |op|\r\n op.input(INPUT).sample.properties[\"Bacterial Marker\"].upcase\r\n }\r\n grouped_by_marker.each do |marker, ops|\r\n check \"#{ops.size} LB + #{marker} plates\"\r\n end\r\n image \"Actions/Plating/put_plate_incubator.JPG\"\r\n end\r\n end",
"title": ""
},
{
"docid": "32c12097ce08dcbd6fe598ef0be386ed",
"score": "0.5022351",
"text": "def render_ris_texts(documents)\n documents.map { |doc|\n doc.export_as(:ris) if doc.exports_as?(:ris)\n }.compact.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "4b5e4ef9a5d5c35433e1f08b15047729",
"score": "0.501881",
"text": "def virus_effects\n #predicted_deaths\n #speed_of_spread\n puts \"#{@state} will lose #{predicted_deaths} people in this outbreak and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end",
"title": ""
},
{
"docid": "bc6c8794320231e20498f49abb59a3b0",
"score": "0.5013588",
"text": "def show\n if @pasv.ref_file.attached?\n @ref_file_preview = preview_blob @pasv.ref_file\n end\n\n if @pasv.query_file.attached?\n @query_file_preview = preview_blob @pasv.query_file\n end\n\n # run the program\n outdir = @pasv.run_pasv_cli\n\n if outdir\n send_file generate_tgz(outdir), filename: 'pasv_output.tar.gz'\n end\n end",
"title": ""
},
{
"docid": "bbddeab408012e95c5886a702bd08c54",
"score": "0.50068676",
"text": "def precipitate_in_isopropanol\n show do\n title \"Precipitate DNA in Isopropanol\"\n\n check \"Add 1 #{MICROLITERS} of glycogen to each tube.\"\n check \"Add 600 #{MICROLITERS} isopropanol to each tube.\"\n note \"Mix by inverting each tube several times.\"\n note \"Centrifuge at 13,000 g for 10 minutes at room temperature.\"\n end\n end",
"title": ""
},
{
"docid": "87ae83a9e7313b49bb99caadfb02e571",
"score": "0.5006114",
"text": "def virus_effects\n predicted_deaths\n speed_of_spread\n print_data\n end",
"title": ""
},
{
"docid": "d4773f7f748124d23e59047fd8ba16e4",
"score": "0.5006028",
"text": "def show\n string = ''\n if(params[:cr1])\n string+='a'\n end\n if(params[:cr2])\n string+='b'\n end\n\n if(params[:cr3])\n string+='c'\n end\n\n if(params[:cr4])\n string+='d'\n end\n\n if(params[:cq1])\n string = params[:cq1]\n end\n\n @a=0\n if(@bollywood.ans == string)\n @a=1\n # else\n # @a=2\n end\n end",
"title": ""
},
{
"docid": "d4773f7f748124d23e59047fd8ba16e4",
"score": "0.5006028",
"text": "def show\n string = ''\n if(params[:cr1])\n string+='a'\n end\n if(params[:cr2])\n string+='b'\n end\n\n if(params[:cr3])\n string+='c'\n end\n\n if(params[:cr4])\n string+='d'\n end\n\n if(params[:cq1])\n string = params[:cq1]\n end\n\n @a=0\n if(@bollywood.ans == string)\n @a=1\n # else\n # @a=2\n end\n end",
"title": ""
},
{
"docid": "e3aa5849560426c0ea85c43fd8258752",
"score": "0.5003221",
"text": "def output\n <<-OUTPUT\n#{@official.output}\n#{@bolsa.output}\n#{@blue.output}\n\n- Gap bolsa......blue: #{gap_bolsa_percent}%\n- Gap official...blue: #{gap_official_percent}%\n\nInformation source:\n#{@config.base_url}\n OUTPUT\n end",
"title": ""
},
{
"docid": "bdc8862156657134ebbf4aab2c93e48f",
"score": "0.50031096",
"text": "def log_result(result, label, error_msg)\n if result\n puts \"#{label.ljust(25)} \\u{2705}\"\n else\n puts \"#{label.ljust(25)} \\u{274C} - #{error_msg}\"\n end\nend",
"title": ""
},
{
"docid": "c0f03bae9545d72f6354ebb5916fcf4f",
"score": "0.5002791",
"text": "def preview(url)\n puts \"...in color? (yes/no)\"\n answer = gets.chomp.downcase\n num_frames = @gifm.frames.count\n frames = num_frames.times.map {|f| \"images/frame#{f}.jpg\"}\n if answer == \"yes\"\n frames.cycle.first(num_frames * 2).each do |frame|\n a = AsciiArt.new(frame)\n puts \"\\e[H\\e[2J\"\n puts a.to_ascii_art(color: true,\n width: 70)\n sleep 0.03\n end\n elsif answer == \"no\"\n frames.cycle.first(num_frames * 2).each do |frame|\n a = AsciiArt.new(frame)\n puts a.to_ascii_art\n end\n else\n preview(url)\n end\n delete_frames\n puts \"\\e[H\\e[2J\"\n browser_choice(url)\n end",
"title": ""
}
] |
534d32ba48ef75c4b8b992a05ac7ade9
|
def winner(board) result=nil if won?(board) won?(board).select do |pos| if board[pos[0]] == "X" result= "X" elsif board[pos[0]] == "O" result= "O" end 1st if end do end 2nd if result end def changed winner board to this below:
|
[
{
"docid": "ac955b5206cf00af95fd52300a99598d",
"score": "0.0",
"text": "def winner(board)\n if position = won?(board)\n board[position.first]\n end\nend",
"title": ""
}
] |
[
{
"docid": "5cc9216f8a605d5ccd9eb6131c0d7ea6",
"score": "0.89140666",
"text": "def winner(board)\n\twinning_player = won?(board)\n\nif !winning_player\n\t\treturn nil\n\tend\n\n\twinning_player.each do |i|\n\t\tif board[i] == \"X\"\n\t\t\treturn \"X\"\n\t\telsif board[i] == \"O\"\n\t\t\treturn \"O\"\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "937d4a9457ebf67b6cc30bc69af35549",
"score": "0.8893919",
"text": "def winner(board)\n if won?(board) != false && over?(board) && !draw?(board)\n if board[won?(board)[0]] == \"X\" && board[won?(board)[1]] == \"X\" && board[won?(board)[2]] == \"X\"\n return \"X\"\n elsif board[won?(board)[0]] == \"O\" && board[won?(board)[1]] == \"O\" && board[won?(board)[2]] == \"O\"\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "3ba931f5753d1c24ec9bf95630dd284a",
"score": "0.8891992",
"text": "def winner(board) \n winning_array = won?(board)\n if won?(board)\n if board.at(winning_array[0]) === \"X\" \n return \"X\" \n elsif board.at(winning_array[0]) === \"O\"\n return \"O\"\n end\n end\n return nil\nend",
"title": ""
},
{
"docid": "418820acff13734c755f14fb30f53852",
"score": "0.8889402",
"text": "def winner(board)\n if won?(board)\n win_combination = won?(board)\n \n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n winning_positions = [board[win_index_1], board[win_index_2], board[win_index_3]]\n \n if winning_positions.all? {|position| position == \"X\"}\n return \"X\"\n elsif winning_positions.all? {|position| position == \"O\"}\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "f395b5f27f7de01dfd3bb35b9633a4d3",
"score": "0.8867507",
"text": "def winner(board)\n WIN_COMBINATIONS.each do|win_combination|\n position_1=board[win_combination[0]]\n position_2=board[win_combination[1]]\n position_3=board[win_combination[2]]\n if position_1==\"X\"&&position_2==\"X\"&&position_3==\"X\"\n return \"X\"\n else\n if position_1==\"O\"&&position_2==\"O\"&&position_3==\"O\"\n return \"O\"\n else\n false\n end\n end\nend\nreturn nil\nend",
"title": ""
},
{
"docid": "206b4891e31c70c1050030e3a5031760",
"score": "0.88131136",
"text": "def winner(board)\n index = won?(board)\n if won?(board) && index == \"X\"\n return \"X\"\n elsif won?(board) && index == \"O\"\n return \"O\"\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "0ecd7c293c79b53813fa74df3aee253c",
"score": "0.8802139",
"text": "def winner(board)\n WIN_COMBINATIONS.detect do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 ==\"X\"\n return \"X\"\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 ==\"O\"\n return \"O\"\n else\n nil\n end\n end\n\nend",
"title": ""
},
{
"docid": "5ad9c6ae2bf90178a6ce6deca1a106e4",
"score": "0.87767833",
"text": "def winner(board)\n win = won?(board)\n if (!win)\n return nil\n elsif (board[win[0]] == \"O\")\n return \"O\"\n else\n return \"X\"\n end\nend",
"title": ""
},
{
"docid": "348b97cdf8f63b261e3145ce165e1bae",
"score": "0.8767087",
"text": "def winner(board)\n win_combination = won?(board)\n if won?(board) == nil\n return nil\n end\n spot_1 = win_combination[0]\n spot_2 = win_combination[1]\n spot_3 = win_combination[2]\n\n spot_1_value = board[spot_1]\n spot_2_value = board[spot_2]\n spot_3_value = board[spot_3]\n\n if spot_1_value == \"X\" && spot_2_value == \"X\" && spot_3_value == \"X\"\n winner = \"X\"\n elsif spot_1_value == \"O\" && spot_2_value == \"O\" && spot_3_value == \"O\"\n winner = \"O\"\n else\n winner = nil\n end\n return winner\nend",
"title": ""
},
{
"docid": "348b97cdf8f63b261e3145ce165e1bae",
"score": "0.8767087",
"text": "def winner(board)\n win_combination = won?(board)\n if won?(board) == nil\n return nil\n end\n spot_1 = win_combination[0]\n spot_2 = win_combination[1]\n spot_3 = win_combination[2]\n\n spot_1_value = board[spot_1]\n spot_2_value = board[spot_2]\n spot_3_value = board[spot_3]\n\n if spot_1_value == \"X\" && spot_2_value == \"X\" && spot_3_value == \"X\"\n winner = \"X\"\n elsif spot_1_value == \"O\" && spot_2_value == \"O\" && spot_3_value == \"O\"\n winner = \"O\"\n else\n winner = nil\n end\n return winner\nend",
"title": ""
},
{
"docid": "2fff2ac4c187fdc47240886ef840e26a",
"score": "0.87607026",
"text": "def winner(board)\n\n if won?(board) != nil\n winner_arr_firstindex = won?(board)[0]\n if board[winner_arr_firstindex] == \"X\"\n return \"X\"\n elsif board[winner_arr_firstindex] == \"O\"\n return \"O\"\n end\n end\n\nend",
"title": ""
},
{
"docid": "b9b36b4ac1b0752dc27026b9ad3cb451",
"score": "0.87472063",
"text": "def winner(board)\n if board == [\"X\", \" \", \" \", \" \", \"X\", \" \", \" \", \" \", \"X\"]\n return \"X\"\n\n elsif board == [\"X\", \"O\", \" \", \" \", \"O\", \" \", \" \", \"O\", \"X\"]\n return \"O\"\n\n elsif board == [\"X\", \"O\", \" \", \" \", \" \", \" \", \" \", \"O\", \"X\"]\n return\n end\nend",
"title": ""
},
{
"docid": "3af57f0bcea0b71547077bfd0128c76e",
"score": "0.87471837",
"text": "def winner(board)\n #return token x or o that won the game\n \n if ( won?(board) )\n position_array = []\n (won?(board)).each do |element|\n position_array << board[element]\n end\n choice_X = position_array.all? do|element|\n element == \"X\"\n end\n if (choice_X )\n return \"X\"\n else\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "25ba3f26acee970b00a84ed2cc3ba89e",
"score": "0.87460965",
"text": "def winner(board)\n return nil if !(won?(board))\n return \"X\" if board[won?(board)[0]] == \"X\"\n return \"O\" if board[won?(board)[0]] == \"O\"\nend",
"title": ""
},
{
"docid": "a06f170669128baf01d08f767fdd2ab1",
"score": "0.8742903",
"text": "def winner(board)\n if won?(board) == false\n return nil\n end \n #get winning combos\n WIN_COMBINATIONS.each do |win_combo|\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n #get board values\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n #WHO IS THE WIINER?\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return \"X\"\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return \"O\"\n end\n end\n end",
"title": ""
},
{
"docid": "04240855c9b5f685734bf4a17905de24",
"score": "0.8736367",
"text": "def winner(board)\n won = won?(board)\n if won != false\n if board[won[0]] == \"X\"\n return \"X\"\n elsif board[won[0]] == \"O\"\n return \"O\"\n end\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "5ef35cc5e8128cb64a656663280cf33e",
"score": "0.8727207",
"text": "def winner(board)\n WIN_COMBINATIONS.detect do |win_combo|\n if (board[win_combo[0]]) == \"X\" && (board[win_combo[1]]) == \"X\" && (board[win_combo[2]]) == \"X\"\n return \"X\"\n elsif (board[win_combo[0]]) == \"O\" && (board[win_combo[1]]) == \"O\" && (board[win_combo[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\nend",
"title": ""
},
{
"docid": "ae89d61ee3fcfce2aab52a2b7666b0df",
"score": "0.87253827",
"text": "def winner(board)\n a = won?(board)\n if a\n if board[a[0]] == \"X\"\n \"X\"\n else\n \"O\"\n end\n else\n nil\n end\nend",
"title": ""
},
{
"docid": "e7cfda67091c1d971fd53f94b9b1d3f0",
"score": "0.8714829",
"text": "def winner(board)\n checkwinner = []\n checkwinner = won?(board)\n if won?(board) == false\n return nil\n else\n if board[checkwinner[0]] == \"X\"\n return \"X\"\n else\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "776c1a10c1a194c04e9044a6d9aa46f7",
"score": "0.86954343",
"text": "def winner(board)\n #setting the index of the win into a variable, win\n win = won?(board)\n #now returning nil if there is no winner\n if won?(board) == false\n return nil\n #all indexes should have the same token for a win, so we're only checking the first\n elsif board[win[0]] == \"X\" && won?(board) != false\n return \"X\"\n elsif board[win[0]] == \"O\" && won?(board) != false\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "adaa61e57a13eb5d02a98e5b23884deb",
"score": "0.8692072",
"text": "def winner(board)\n if won?(board) == false\n return nil\n end\n #get winning combos\n WIN_COMBINATIONS.each do |win_combo|\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n #get board values\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n #WHO IS THE WIINER?\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return \"X\"\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return \"O\"\n end\n end\n end",
"title": ""
},
{
"docid": "480000f953ba885317317f018c468335",
"score": "0.8685412",
"text": "def winner(board)\n if won?(board)\n winning_play = won?(board)\n first_play = winning_play[0]\n if board[first_play] == \"X\"\n \"X\"\n elsif board[first_play] == \"O\"\n \"O\"\n end\n else\n nil\n end\n\nend",
"title": ""
},
{
"docid": "3afe3cfb48e11dbf0d579495ba045aea",
"score": "0.86792594",
"text": "def winner\n WIN_COMBINATIONS.each do |win|\n if [@board[win[0]], @board[win[1]], @board[win[2]]] == [\"X\", \"X\", \"X\"]\n return \"X\"\n elsif [@board[win[0]], @board[win[1]], @board[win[2]]] == [\"O\", \"O\", \"O\"]\n return \"O\"\n end\n end\n return nil\n end",
"title": ""
},
{
"docid": "10b186ec91bfc7a5d0d26a5704eee937",
"score": "0.8670607",
"text": "def winner(board)\n if won?(board)\n winning_play = won?(board)\n first_play = winning_play[0]\n if board[first_play] == \"X\"\n \"X\"\n elsif board[first_play] == \"O\"\n \"O\"\n end\n else\n nil\n end\nend",
"title": ""
},
{
"docid": "161964296b3b361e1f8951c0f1efe5bb",
"score": "0.86692995",
"text": "def winner(board)\n board_return = won?(board)\n if board_return.class == Array\n if board[board_return[0]] == \"X\"\n return \"X\"\n else\n return \"O\"\n end\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "7a9947075f23c66685c1b884fb3615fe",
"score": "0.86483186",
"text": "def winner\r\n index = []\r\n index = won?\r\n if index == false\r\n return nil\r\n else\r\n if @board[index[0]] == \"X\"\r\n return \"X\"\r\n else\r\n return \"O\"\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "343fde707f9b074b43976df0ed0dcc93",
"score": "0.86199635",
"text": "def winner (board)\n index = []\n index = won?(board)\n if index == false\n return nil\n else\n if board[index[0]] == \"X\"\n return \"X\"\n else\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "343fde707f9b074b43976df0ed0dcc93",
"score": "0.86199635",
"text": "def winner (board)\n index = []\n index = won?(board)\n if index == false\n return nil\n else\n if board[index[0]] == \"X\"\n return \"X\"\n else\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "e9b18c905095318d1785da0832951bd6",
"score": "0.86165804",
"text": "def winner(board)\n if won?(board) == false\n return nil\n end\n\n a = won?(board)\n\n if board[a[0]] == \"X\"\n return \"X\"\n else \n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "e9b18c905095318d1785da0832951bd6",
"score": "0.86165804",
"text": "def winner(board)\n if won?(board) == false\n return nil\n end\n\n a = won?(board)\n\n if board[a[0]] == \"X\"\n return \"X\"\n else \n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "bd74b25ecad9cee868f583cc998ef1f5",
"score": "0.8611046",
"text": "def winner(board)\n\n won = won?(board) != false\n\n all_X = board.select {|token| token == 'X'}\n all_O = board.select {|token| token == 'O'}\n number_of_X = all_X.length\n number_of_O = all_O.length\n\n if ( won )\n if (number_of_X > number_of_O)\n return\"X\"\n elsif (number_of_X < number_of_O)\n return \"O\"\n end\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "ccad14b4ba7b83515aa43890d4c5c2e1",
"score": "0.85932964",
"text": "def winner(board)\n if won?(board)!=false\n victory = won?(board)\n if board[victory[0]] == \"X\"\n \"X\"\n else\n \"O\"\n end \n end \nend",
"title": ""
},
{
"docid": "3209589896c63cef2756c1c48f9440c5",
"score": "0.85910374",
"text": "def winner\n WIN_COMBINATIONS.detect do |co|\n if @board[co[0]] == \"X\" && @board[co[1]] == \"X\" && @board[co[2]] == \"X\"\n return \"X\"\n elsif @board[co[0]] == \"O\" && @board[co[1]] == \"O\" && @board[co[2]] == \"O\"\n return \"O\"\n else\n nil\n end\n end\n end",
"title": ""
},
{
"docid": "890b6b2895f635a00a57078fc99f3bbd",
"score": "0.85885423",
"text": "def winner\n WIN_COMBINATIONS.detect do |win|\n if (@board[win[0]]) == \"X\" && (@board[win[1]]) == \"X\" && (@board[win[2]]) == \"X\"\n return \"X\"\n elsif (@board[win[0]]) == \"O\" && (@board[win[1]]) == \"O\" && (@board[win[2]]) == \"O\"\n return \"O\"\n else\n nil\n end\n end\nend",
"title": ""
},
{
"docid": "0a438827e387d9e4eaae688c72eff8b9",
"score": "0.85797507",
"text": "def winner\n if !!won? && @board[won?[0]] == \"X\"\n \"X\"\n elsif !!won? && @board[won?[0]] == \"O\"\n \"O\"\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "13218da129729bb3370ea75f4ccc1451",
"score": "0.85789573",
"text": "def winner(board)\n win=[]\n WIN_COMBINATIONS.each do |x|\n if board[x[0]] == \"X\" && board[x[1]] == \"X\" && board[x[2]] == \"X\"\n then win = [x[0], x[1], x[2]]\n return \"X\"\n elsif board[x[0]] == \"O\" && board[x[1]] == \"O\" && board[x[2]] == \"O\"\n then win = [x[0], x[1], x[2]]\n return \"O\"\n end\n end\n nil\nend",
"title": ""
},
{
"docid": "35e90db4bf9914ade73dea160035825f",
"score": "0.85755163",
"text": "def who_is_winner(board)\n winner = nil\n winning_cases = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]\n winning_cases.each do |c|\n if ((board[c[0]] == 'o' || board[c[0]] == 'x') && \n\tboard[c[0]] == board[c[1]] && board[c[0]] == board[c[2]])\n winner = board[c[0]]\n end\n end\n winner\nend",
"title": ""
},
{
"docid": "469f6cd22253a7471ca1220475e5bce2",
"score": "0.8566274",
"text": "def winner(board)\n i = 0\n WIN_COMBINATIONS.each{|win_combination|\n if board[win_combination[0]] == \"X\" && board[win_combination[1]] == \"X\" && board[win_combination[2]] == \"X\"\n i +=1\n return \"X\"\n elsif board[win_combination[0]] == \"O\" && board[win_combination[1]] == \"O\" && board[win_combination[2]] == \"O\"\n i +=1\n return \"O\"\n end\n }\n if i == 0\n return nil\n end\nend",
"title": ""
},
{
"docid": "437fe42c32e6f69db2153f8326f3485d",
"score": "0.8565373",
"text": "def winner(board)\n won?(board)\n if $x == \"X\"\n return $x\n elsif $x == \"O\"\n return $x\n elsif $x == nil\n return nil\n end\nend",
"title": ""
},
{
"docid": "b6cc52005fce7926301221ad9160e657",
"score": "0.85652614",
"text": "def winner\n \twinning_player = won?\n\n if !winning_player\n \t\treturn nil\n \tend\n \twinning_player.each do |i|\n \t\tif @board[i] == \"X\"\n \t\t\treturn \"X\"\n \t\telsif @board[i] == \"O\"\n \t\t\t return \"O\"\n \t\tend\n \tend\n end",
"title": ""
},
{
"docid": "171d7cc1b9d046d532e1022f232113ff",
"score": "0.8562078",
"text": "def winner(board)\n winner = nil \n WIN_COMBINATIONS.each do |token|\n if token.all? {|index| board[index] == \"X\"}\n winner = \"X\"\n \n elsif token.all? {|index| board[index] == \"O\"}\n winner = \"O\"\n end \n end \n winner \nend",
"title": ""
},
{
"docid": "68617a235b6bb4c50f31f4acc3715289",
"score": "0.8550081",
"text": "def winner\n WIN_COMBINATIONS.each do |win|\n win_1 = @board[win[0]]\n win_2 = @board[win[1]]\n win_3 = @board[win[2]]\n if win_1 == \"X\" && win_2 == \"X\" && win_3 == \"X\"\n return \"X\"\n elsif win_1 == \"O\" && win_2 == \"O\" && win_3 == \"O\"\n return \"O\"\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "3917ca67d8827173779f0f24034a37e7",
"score": "0.85494184",
"text": "def winner(board)\n store_person = winner_function(board)\n store_combo = won?(board)\n if store_combo == false\n return nil\n elsif store_person == \"X\"\n return \"X\"\n elsif store_person == \"O\"\n return \"O\"\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "951d244abe7f7d937a5f1b33a1f9810d",
"score": "0.8529307",
"text": "def winner(board)\n if draw?(board)\n return nil\n end\n if won?(board)\n count_x=board.count(\"X\")\n count_o=board.count(\"O\")\n if count_x > count_o\n return \"X\"\n else\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "027fe2873495c18640d640eef1d40335",
"score": "0.8527248",
"text": "def winner\n if !won?\n return nil\n elsif @board[won?[0]] == \"X\"\n \"X\"\n elsif @board[won?[0]] == \"O\"\n \"O\"\n end\n end",
"title": ""
},
{
"docid": "a99312239983f80f4faa9606bf124f0e",
"score": "0.8520686",
"text": "def winner(board)\n iindex = []\n index = won?(board)\n if index == false\n return nil\n else\n if board[index[0]] == \"X\"\n return \"X\"\n else\n return \"O\"\n end\n end\nend",
"title": ""
},
{
"docid": "17d4a0bd3e80e350ae305131945e5cea",
"score": "0.8515079",
"text": "def winner\n if (over?)\n if (@board[won?[0]] == \"X\")\n return \"X\"\n else\n return \"O\"\n end\n else\n end\n end",
"title": ""
},
{
"docid": "49d2a7668af37f5b292d4b5c5e8f66b0",
"score": "0.8507506",
"text": "def winner(board)\nsub_array = won?(board)\n if !won?(board)\n return nil\n elsif board[sub_array[1]] == \"X\"\n return \"X\"\n elsif board[sub_array[1]] == \"O\"\n return \"O\"\n end\nend",
"title": ""
},
{
"docid": "22405822b139f76332158383db4c639c",
"score": "0.84869695",
"text": "def winner\n if won?\n new_win_combo = won?\n if @board[new_win_combo[0]] == \"X\" && @board[new_win_combo[1]] == \"X\" && @board[new_win_combo[2]] == \"X\"\n return \"X\"\n elsif @board[new_win_combo[0]] == \"O\" && @board[new_win_combo[1]] == \"O\" && @board[new_win_combo[2]] == \"O\"\n return \"O\"\n end\n end\n end",
"title": ""
},
{
"docid": "476043d6988734673fec3f71fb89b072",
"score": "0.8479924",
"text": "def winner(board)\n if won?(board)\n combo = WIN_COMBINATIONS.detect{|win_array| win_array.all?{|spot| board[spot] == \"X\"} || win_array.all?{|spot| board[spot] == \"O\"}}\n answer = board[combo[0]]\n end\nend",
"title": ""
},
{
"docid": "1e1671adb64ce7721980986398039ba8",
"score": "0.8478255",
"text": "def winner\n if won?\n WIN_COMBINATIONS.any? do |wc|\n if board.cells[wc[0]] == \"X\" && board.cells[wc[1]] == \"X\" && board.cells[wc[2]] == \"X\"\n return \"X\"\n elsif board.cells[wc[0]] == \"O\" && board.cells[wc[1]] == \"O\" && board.cells[wc[2]] == \"O\"\n return \"O\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f7e229023f64cc3b3c3eb91f421af5cd",
"score": "0.84749544",
"text": "def winner\n win_combination = won?\n if win_combination == false\n nil\n elsif @board[win_combination[0]] == \"X\"\n return \"X\"\n elsif @board[win_combination[0]] == \"O\"\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "de0d454de7a1937004211f0e93144194",
"score": "0.8463689",
"text": "def winner\n if winner = won? == false\n return nil\n else\n win_token = @board[won?[0]]\n end\n if win_token == \"X\"\n return \"X\"\n elsif win_token == \"O\"\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "e86cf43fa174e576f832146a7459bd4a",
"score": "0.8462708",
"text": "def winner\n if won? == false\n return nil\n else\n win_index = won?\n if @board.cells[win_index[0]] == \"X\"\n return \"X\"\n elsif @board.cells[win_index[0]] == \"O\"\n return \"O\"\n end\n end\n end",
"title": ""
},
{
"docid": "0c15cfec310da1ac4bd8ac922b0b7981",
"score": "0.8432694",
"text": "def winner\n if won?\n win_combination = won?\n \n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n winning_positions = [@board[win_index_1], @board[win_index_2], @board[win_index_3]]\n \n if winning_positions.all? {|position| position == \"X\"}\n return \"X\"\n elsif winning_positions.all? {|position| position == \"O\"}\n return \"O\"\n end\n end\n end",
"title": ""
},
{
"docid": "a15bf1d34fc1c52e898d32ed52117478",
"score": "0.8425508",
"text": "def check_winner(board)\n WINNING_LINES.each do |line|\n if board[line[0]] == 'X' && board[line[1]] == 'X' && board[line[2]] == 'X'\n return \"Player\"\n elsif board[line[0]] == 'O' && board[line[1]] == 'O' && board[line[2]] == 'O'\n return \"Computer\"\n end\n end \n return nil\nend",
"title": ""
},
{
"docid": "bb0e4588622e5ac29f7ffeb11739ea7a",
"score": "0.841344",
"text": "def winner(board)\n # if won?(board)\n # puts board.count{|move| move == \"X\"} > board.count{|move| move == \"O\"} ?\n # \"Congratulations X!\" : \"Congratulations O!\"\n # else\n WIN_COMBINATIONS.each do |combo|\n if combo.all?{|j| board[j] == \"X\"}\n puts \"Congratulations X!\"\n return \"X\"\n end\n if combo.all?{|j| board[j] == \"O\"}\n puts \"Congratulations O!\"\n return \"O\"\n end\n end\n nil\nend",
"title": ""
},
{
"docid": "7394c3631272430f59c1828c49dc1ab4",
"score": "0.8397632",
"text": "def check_for_winner\n win_locs = [[1,2,3], [4,5,6], [7,8,9], [1,4,7], [2,5,8], [3,6,9],[1,5,9],[3,5,7]]\n win_locs.each do |loc|\n if @board.get_value_at_location(loc[0]) == 'X' \\\n && @board.get_value_at_location(loc[1]) == 'X' \\\n && @board.get_value_at_location(loc[2]) == 'X'\n return \"Player\"\n end\n if @board.get_value_at_location(loc[0]) == 'O' \\\n && @board.get_value_at_location(loc[1]) == 'O' \\\n && @board.get_value_at_location(loc[2]) == 'O'\n return \"Computer\"\n end \n end\n return nil\n end",
"title": ""
},
{
"docid": "88198117ed70b04a3c4f8bf90267a684",
"score": "0.8386383",
"text": "def winner_check(board)\n if (board.values_at(1, 2, 3) == [\"x\", \"x\", \"x\"] || board.values_at(4, 5, 6) == [\"x\", \"x\", \"x\"] || \n \t board.values_at(7, 8, 9) == [\"x\", \"x\", \"x\"] || board.values_at(1, 4, 7) == [\"x\", \"x\", \"x\"] || \n \t board.values_at(2, 5, 8) == [\"x\", \"x\", \"x\"] || board.values_at(3, 6, 9) == [\"x\", \"x\", \"x\"] || \n \t board.values_at(1, 5, 9) == [\"x\", \"x\", \"x\"] || board.values_at(3, 5, 7) == [\"x\", \"x\", \"x\"])\n return \"player\"\n elsif (board.values_at(1, 2, 3) == [\"o\", \"o\", \"o\"] || board.values_at(4, 5, 6) == [\"o\", \"o\", \"o\"] || \n \t board.values_at(7, 8, 9) == [\"o\", \"o\", \"o\"] || board.values_at(1, 4, 7) == [\"o\", \"o\", \"o\"] || \n \t board.values_at(2, 5, 8) == [\"o\", \"o\", \"o\"] || board.values_at(3, 6, 9) == [\"o\", \"o\", \"o\"] || \n \t board.values_at(1, 5, 9) == [\"o\", \"o\", \"o\"] || board.values_at(3, 5, 7) == [\"o\", \"o\", \"o\"])\n return \"computer\"\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "d73141d52fe98898b65a4df5e9f6cb75",
"score": "0.83441305",
"text": "def findWinner\n #this describes a winning scenerio vertically or horizontally\n # X X X X\n # & X\n # X\n\n (0..2).each do |i|\nif @board[i][0] == @board[i][1] & @board[i][1] == @board[i][2]\n return @board[i][0] unless @board[0][i] == \" \"\n\n\nelsif @board[0][i] == @board[1][i] && @board[1][i] == @board[2][i]\n return @board[0][i] unless @board[0][i] == \" \"\n\nend\nend\n\n#the following chunk of code will describe the below winning scenario for the 'x' player\n# X X\n# X & X\n# X X\n\nif ( @board[0][0] == @board[1][1] && @board[1][1] == @board[2][2] ) ||\n ( @board[0][2] == @board[1][1] && @board[1][1] == @board[2][0] )\n return @board[1][1] unless @board[1][1] == \" \"\n end\n\n#Next we'll describe what will happen in the below tie scenario \n# X 0 X\n# X 0 X\n# 0 X 0\n\n\nreturn 'C' unless isTie\n\nreturn false\nend",
"title": ""
},
{
"docid": "aa953d99c8e2631e562754a3de2f07db",
"score": "0.8339331",
"text": "def winner\n save = won?\n if save == false\n return nil\n end\n if @board[save[0]] == \"X\"\n return \"X\"\n elsif @board[save[0]] == \"O\"\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "f1b483ff6f60aa9bb07c0e0ed0737280",
"score": "0.83341277",
"text": "def winner(board)\n\tif won?(board)\n\t\tboard[won?(board)[0]]\n end\nend",
"title": ""
},
{
"docid": "6b2a3d92f1296014bd78381c8345795b",
"score": "0.83323854",
"text": "def winner\n WIN_COMBINATIONS.each do|sub_array|\n winner_1 = sub_array[0]\n winner_2 = sub_array[1]\n winner_3 = sub_array[2]\n\n won_1 = @board[winner_1]\n won_2 = @board[winner_2]\n won_3 = @board[winner_3]\n\n if won_1 == \"X\" && won_2 == \"X\" && won_3 == \"X\"\n return \"X\"\n\n elsif won_1 == \"O\" && won_2 == \"O\" && won_3 == \"O\"\n return \"O\"\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "f7e28130c860092026c994a8fdd7737c",
"score": "0.83268225",
"text": "def winner(board)\n if won?(board) != nil\n won = won?(board)\n return board[won[0]]\n end\n end",
"title": ""
},
{
"docid": "d8606fd3e10679ea28fba9940a5ab1c9",
"score": "0.83251745",
"text": "def winner\n winner = \"no one\"\n board = state_of_piece\n black_moves = []\n red_moves = []\n if team_missing_piece == \"team black\"\n return \"Team Red Wins!\"\n elsif team_missing_piece == \"team red\"\n return \"Team Black Wins!\"\n elsif team_missing_piece == \"everyone is present\"\n board.each_with_index do |row, row_index|\n row.each_with_index do |piece, column_index|\n if piece != nil && piece&.first == \"B\"\n black_moves << [possible_moves(piece, row_index, column_index), piece]\n end\n if piece != nil && piece&.first == \"R\"\n red_moves << [possible_moves(piece, row_index, column_index), piece]\n end\n end\n end\n black_moves = black_moves.select { |move| move[0] == true}\n if black_moves.blank?\n winner = \"Team Red Wins!\"\n end\n red_moves = red_moves.select { |move| move[0] == true}\n if red_moves.blank?\n winner = \"Team Black Wins!\"\n end\n end\n return winner\n end",
"title": ""
},
{
"docid": "a9790947748ee1e42198f782b9afb0ea",
"score": "0.8323669",
"text": "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n else\n end\nend",
"title": ""
},
{
"docid": "861526e6972c1d3cecedc119b3e18b5e",
"score": "0.83193654",
"text": "def winner\n if won? != nil\n winner_arr_firstindex = won?[0]\n @board[winner_arr_firstindex] == \"X\" ? \"X\" : \"O\"\n end\nend",
"title": ""
},
{
"docid": "9c353391828b24702a43bf4d8552dc5e",
"score": "0.8306771",
"text": "def winner(board)\n if won?(board)\n arr_1 = won?(board)\n x = arr_1[0]\n return board[x]\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "1a3c832917d4c8bbb8af5e7a5c9d8fe8",
"score": "0.8305316",
"text": "def winner(board)\n no_combinations = true\n WIN_COMBINATIONS.each do |combination|\n if combination1 = board[combination[0]] == \"X\" && board[combination[1]] == \"X\" && board[combination[2]] == \"X\"\n no_combinations = false\n return \"X\"\n elsif combination2 = board[combination[0]] == \"O\" && board[combination[1]] == \"O\" && board[combination[2]] == \"O\"\n no_combinations = false\n return \"O\"\n end\n end\n if no_combinations == true\n return nil\n end\nend",
"title": ""
},
{
"docid": "bbe76bb341aee3c9c8277efbeb4801b3",
"score": "0.8302029",
"text": "def winner(board)\n if won?board\n if board[won?(board)[0]] == \"X\"\n puts \"X is the winner!\"\n return \"X\"\n elsif board[won?(board)[0]] == \"O\"\n puts \"O is the winner!\"\n return \"O\"\n end # end if..else statement\n else !won?(board)\n nil ###this nil is returned outside the if..elsif statement, which is inside the if won?board statement\n end # end if won?board statement\nend",
"title": ""
},
{
"docid": "1a13ef30d54e89fbfb7b07b59ba3f81b",
"score": "0.82952774",
"text": "def winner\n save = won?\n if save == false\n return nil\n end\n if board.cells[save[0]] == \"X\"\n return \"X\"\n elsif board.cells[save[0]] == \"O\"\n return \"O\"\n end\n end",
"title": ""
},
{
"docid": "4c76b5dfe15d7817ed70f540fc004393",
"score": "0.8286003",
"text": "def winner(board)\n\nif won?(board)\n return board[won?(board)[0]]\nend\nend",
"title": ""
},
{
"docid": "1a1cdc89da99e3a1c608b0df844ff48d",
"score": "0.82823706",
"text": "def winner(board)\n \n winning_combo = won?(board)\n\n if winning_combo != false\n\n return board[winning_combo[0]]\n \n else\n \n return nil\n \n end\n\nend",
"title": ""
},
{
"docid": "604642e01575772a9917e254d63ca71d",
"score": "0.82800704",
"text": "def winner()\n if won?()\n win_combo=won?() # 3 indices - all x or all o\n return @board[win_combo[0]] # win_combo[0] has the first index of the winning combo\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "f6ec797e99a1dc47660ef0eb376baae9",
"score": "0.8279439",
"text": "def winner\n if won? == false\n return nil\n end\n #get winning combos\n WIN_COMBINATIONS.each do |win_combo|\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n #get board values\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n #WHO IS THE WIINER?\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return \"X\"\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return \"O\"\n end\n end\n end",
"title": ""
},
{
"docid": "44fed6710fa2550226d3d2ed8a464b91",
"score": "0.8271134",
"text": "def winner(board)\n if over?(board)\n board[won?(board)[0]]\n end\n end",
"title": ""
},
{
"docid": "78d82d896d1b012bffa7226c4d209b99",
"score": "0.8268959",
"text": "def winner(board)\n win_combo = won?(board)\n if win_combo\n winner = board[win_combo[0]]\n return winner\n end\nend",
"title": ""
},
{
"docid": "08d687267170b7029e266b98130ae438",
"score": "0.82641333",
"text": "def winner(board)\n if winner = won?(board)\n board[won?(board)[0]]\n end\nend",
"title": ""
},
{
"docid": "8a76326f4f931fca6f82c860e98026c6",
"score": "0.8261331",
"text": "def winner(board)\n if combo = won?(board)\n char = board[combo[0]]\n return char\n elsif draw?(board) || !over?(board)\n return nil\n end\nend",
"title": ""
},
{
"docid": "b14efaaf203d1ef6b3540ece9dbe3db3",
"score": "0.8259307",
"text": "def won?(board)\n WIN_COMBINATIONS.each do |x|\n if board[x[0]] == \"X\" && board[x[1]] == \"X\" && board[x[2]] == \"X\"\n champ = \"X\"\n return x\n elsif board[x[0]] == \"O\" && board[x[1]] == \"O\" && board[x[2]] == \"O\"\n return x\n end\n end\n return\nend",
"title": ""
},
{
"docid": "d75cfc5d41a84d8daabfe009f049ff33",
"score": "0.8250043",
"text": "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n else\n nil\n end\nend",
"title": ""
},
{
"docid": "619581e1caa473c3250a44bb5e2b1b5a",
"score": "0.8244738",
"text": "def winner(board)\n #This shcekc to see if there is a winner and if so it returns who that winner is\n if won?(board)\n winning_combo = won?(board)\n board[winning_combo[0]]\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "f47d7e3e0361b55e98aa1e08372041dc",
"score": "0.8242036",
"text": "def winner(board)\n win_combo = won?(board)\n if !win_combo\n nil\n else\n board[win_combo[0]]\n\n end\nend",
"title": ""
},
{
"docid": "f47d7e3e0361b55e98aa1e08372041dc",
"score": "0.8242036",
"text": "def winner(board)\n win_combo = won?(board)\n if !win_combo\n nil\n else\n board[win_combo[0]]\n\n end\nend",
"title": ""
},
{
"docid": "422c0f66e36d4dd6f43a936e36717efe",
"score": "0.8241238",
"text": "def winner(board)\n WIN_COMBINATIONS.each do |combo|\n position = combo[0]\n position_2 = combo[1]\n position_3 = combo[2]\n\n cell = board[position]\n cell_2 = board[position_2]\n cell_3 = board[position_3]\n\n if cell == cell_2 && cell_2 == cell_3 && position_taken?(board, position)\n # if won?(board) == true\n return \"#{cell}\"\n end\n end\n else\n return nil\n end",
"title": ""
},
{
"docid": "4949ca4a96ed101459ed02f23fe91b73",
"score": "0.82187897",
"text": "def winner(board)\n if won_var?(board, \"X\") != nil\n return \"X\"\n elsif won_var?(board, \"O\") != nil\n return \"O\"\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "962bf7d497f9c4810ebf11ab04a9754e",
"score": "0.8217554",
"text": "def winner(board)\n board[won?(board)[0]] if won?(board)\n #don't need hard returns-- ruby will return implicitly. Also don't need an else-- by default,\n # will return nil if the condition you posed evaulates to false. So, only need if statement without\n # else/false-- this is how you would do that, in one line.\nend",
"title": ""
},
{
"docid": "7e8b6379f33c513edc61244bcebbc618",
"score": "0.82100433",
"text": "def winner(board)\n if won?(board)\n return board[won?(board)[0]]\n\n end\n\nend",
"title": ""
},
{
"docid": "b8cb7fb65ba4144d1f8577789135f172",
"score": "0.8207935",
"text": "def winner(board)\n if(over?(board))\n win_combo = won?(board)\n if(win_combo != nil)\n return board[win_combo[0]]\n end\n end\n return nil\nend",
"title": ""
},
{
"docid": "87255cf005fe81bb2b0e808afeabd3b5",
"score": "0.82070947",
"text": "def winner(board)\n win = won?(board)\n win ? board[win[0]] : nil\nend",
"title": ""
},
{
"docid": "87255cf005fe81bb2b0e808afeabd3b5",
"score": "0.82070947",
"text": "def winner(board)\n win = won?(board)\n win ? board[win[0]] : nil\nend",
"title": ""
},
{
"docid": "37d6ba983d3f136019669cd3f650a97c",
"score": "0.82067764",
"text": "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n else\n nil\n end\nend",
"title": ""
},
{
"docid": "4a2acf6c384fe22c80a26cf2d9a8e2e9",
"score": "0.820381",
"text": "def winner_function(board)\n winning_combo = 0\n winning_person = 0\n WIN_COMBINATIONS.each do |combo_array|\n win_index_1 = combo_array[0]\n win_index_2 = combo_array[1]\n win_index_3 = combo_array[2]\n\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n winning_combo = combo_array\n winning_person = \"X\"\n\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n winning_combo = combo_array\n winning_person = \"O\"\n end\n end\n if winning_combo != 0\n return winning_person\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "e045d01d182ced36f1f72f041652987f",
"score": "0.81980664",
"text": "def winner\n result = won?\n if result\n @board[result[0]]\n end\nend",
"title": ""
},
{
"docid": "833c4a28e90b211ec0087cdf09d3ec72",
"score": "0.81948024",
"text": "def winner(board)\n if won?(board)\n winnerchar = won?(board)\n return board[winnerchar[0]]\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "673e2af6b0ec3dea8598f379cdfc391e",
"score": "0.81935376",
"text": "def winner\n\n # winning = self.board.cells.combination(3).to_a\n winning = WIN_COMBINATIONS.map do |win_arrays|\n win_arrays.map do |y|\n self.board.position(y)\n end\n end \n\n @winz = \"\"\n\n if winning.include?([\"O\", \"O\", \"O\"])\n @winz = \"O\"\n elsif winning.include?([\"X\", \"X\", \"X\"])\n @winz = \"X\"\n else\n @winz = nil\n end\n\n @winz\n# winning.each do |x|\n# if (x == [\"O\", \"O\", \"O\"]) || (x == [\"X\", \"X\", \"X\"])\n# winz << x \n# else \n# winz << nil \n# end \n# end \n\n# winz.compact!.flatten!\n# winz[0]\n\nend",
"title": ""
},
{
"docid": "be45bcc7507f7fdeca386df9944558af",
"score": "0.818822",
"text": "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n end\nend",
"title": ""
},
{
"docid": "be45bcc7507f7fdeca386df9944558af",
"score": "0.818822",
"text": "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n end\nend",
"title": ""
},
{
"docid": "be45bcc7507f7fdeca386df9944558af",
"score": "0.818822",
"text": "def winner(board)\n if won?(board)\n board[won?(board)[0]]\n end\nend",
"title": ""
},
{
"docid": "b5da244886baecc9f416231eadb80f48",
"score": "0.81822014",
"text": "def winner()\n if won?()\n indexes = won?()\n return board[indexes[0]]\n else \n return nil \n end\nend",
"title": ""
},
{
"docid": "3ae40e9a1c3798e38973b103a215fc1c",
"score": "0.81812805",
"text": "def winner( board )\n if won?( board )\n return board[ won?( board )[0] ]\n else\n return nil\n end\nend",
"title": ""
}
] |
45247b17c151ee3ad28ec75825e926d1
|
Write a method that takes an arbitrary matrix and rotates it 90 degrees clockwise as shown above.
|
[
{
"docid": "d92a28b0a9c97e2d6f746da7694b338a",
"score": "0.69338053",
"text": "def rotate90(array)\n matrix_width = array[0].size\n matrix_height = array.size\n new_matrix_width = matrix_height\n new_matrix_height = matrix_width\n results_array = []\n m = 0\n\n new_matrix_height.times do \n results = []\n n = -1\n \n array.count.times do \n results << array[n][m]\n n -=1\n end\n\n results_array << results\n m += 1\n end\n\n results_array\nend",
"title": ""
}
] |
[
{
"docid": "3068988ed7bfdae094963bcc5e2d03c8",
"score": "0.8179925",
"text": "def rotate_matrix(matrix)\n \nend",
"title": ""
},
{
"docid": "2a980dccc469fefe82e59814b13ffe65",
"score": "0.815899",
"text": "def rotate_matrix(matrix, direction)\n if direction == 'clockwise'\n rotate_cw(matrix)\n else\n rotate_countercw(matrix)\n end\nend",
"title": ""
},
{
"docid": "60c74b533e8ada0c9af1aca02bcd7df0",
"score": "0.81176025",
"text": "def rotate_matrix matrix, direction\n return clockwise(matrix) if direction == \"clockwise\"\n return counter_clockwise(matrix) if direction == \"counter-clockwise\"\nend",
"title": ""
},
{
"docid": "c97fe89c3c2d495b871ad325e26fd422",
"score": "0.7815317",
"text": "def rotate90(matrix)\n matrix.transpose.map(&:reverse)\nend",
"title": ""
},
{
"docid": "68716fa13d9e3fb64158f3f2ecc75a3e",
"score": "0.77377367",
"text": "def rotate matrix, direction\n direction == 'counter-clockwise' ? matrix.transpose.reverse : matrix.transpose.map(&:reverse)\nend",
"title": ""
},
{
"docid": "78d3eca440a09047b4f48dcb3de6acdb",
"score": "0.7730004",
"text": "def rotate90(matrix)\n number_of_rows = matrix.size\n number_of_columns = matrix.first.size\n rotated_matrix = []\n \n number_of_columns.times do |column_number|\n new_row = []\n (number_of_rows - 1).downto(0) do |row_number|\n new_row << matrix[row_number][column_number]\n end\n rotated_matrix << new_row \n end\n \n rotated_matrix\nend",
"title": ""
},
{
"docid": "212659884a448b81a7a541466abdb6ef",
"score": "0.76839775",
"text": "def rotate(matrix)\n rotated_by_90 = []\n matrix.transpose.each {|row| rotated_by_90 << row.reverse}\n rotated_by_90\nend",
"title": ""
},
{
"docid": "93d08018de16a23b5c9b249f8a3d3776",
"score": "0.76693064",
"text": "def rotate90(matrix)\n columns = matrix.size\n rows = matrix.first.size\n r_row = []\n r_matrix = []\n\n 0.upto(matrix.first.size - 1) do |y|\n r_row = []\n 0.upto(matrix.size - 1) do |x|\n r_row << matrix[x][y]\n end\n r_matrix << r_row.reverse\n end\n r_matrix\nend",
"title": ""
},
{
"docid": "b7db6b2e06508e810e7b5711ab90a1eb",
"score": "0.7606295",
"text": "def rotate(matrix)\n matrix.replace(matrix.reverse.transpose)\nend",
"title": ""
},
{
"docid": "71a897f6f7a9b52816d2122132feb712",
"score": "0.7600348",
"text": "def rotate(matrix)\n p matrix.reverse.transpose\nend",
"title": ""
},
{
"docid": "a5272f68e50b9c83c43b572dc02acb75",
"score": "0.7579881",
"text": "def rotate90(matrix)\n new_matrix = []\n \n # determine number of columns, that is new number of rows, and vice versa\n 0.upto(matrix[0].length - 1) {|row|\n new_row = []\n (matrix.length - 1).downto(0) {|col|\n new_row << matrix[col][row]\n }\n new_matrix << new_row\n }\n new_matrix\nend",
"title": ""
},
{
"docid": "37931f127d99fee0c781fe7f1c6c4e81",
"score": "0.75716484",
"text": "def rotate90(matrix)\n rotated = []\n row_idx = 0\n until row_idx == matrix.first.size\n new_row = []\n matrix.reverse_each { |row| new_row << row[row_idx] }\n rotated << new_row\n row_idx += 1\n end\n rotated\nend",
"title": ""
},
{
"docid": "61a60e984679e4697915c35e297dc79c",
"score": "0.7558631",
"text": "def rotate_by_90(matrix)\n\tmatrix_rotated = []\n\tcolumn_index = matrix.size - 1\n\twhile column_index >= 0\n\t\trow = []\n\t\t(0..matrix.size - 1).each do |row_index|\n\t\t\trow << matrix[row_index][column_index]\n\t\tend\n\t\tmatrix_rotated << row\n\t\tcolumn_index -= 1\n\tend\n\tmatrix_rotated\nend",
"title": ""
},
{
"docid": "6e22b7d527551d054648fbbc8c31667f",
"score": "0.7555961",
"text": "def rotate90(matrix)\n new_matrix = Array.new(matrix[0].size) {Array.new}\n matrix.reverse_each.with_index do |ar, new_col|\n ar.each_index do |new_row|\n new_matrix[new_row][new_col] = ar[new_row]\n end\n end\n new_matrix\nend",
"title": ""
},
{
"docid": "2865e45ffee82b1b84341b7acdd6e165",
"score": "0.7541531",
"text": "def rotate_by_90_in_place(matrix)\n\tn = matrix.size\n\t# rotation must be done n/2 times = number of layers\n\t(0..((n / 2) - 1)).each do |layer| # this loop goes diagnolly\n\t\t(layer..n - 2 - layer).each do |row_index| \t# this loop goes across elements in the column\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# you don't have to go till n -1 since last elemnt already done cyclically\n\t\t\tmatrix = run_element_replacement(matrix, row_index, layer)\n\t\tend\n end\n matrix\nend",
"title": ""
},
{
"docid": "c2fde164a6c94e3c2a5eee49374d456b",
"score": "0.7472837",
"text": "def rotate90(matrix)\n new_array = []\n matrix.first.length.times { new_array << [] }\n matrix.reverse.each do |arr|\n arr.each_with_index { |e, i| new_array[i] << e }\n end\n new_array\nend",
"title": ""
},
{
"docid": "5bff53cc168e46d6571d90cab177018e",
"score": "0.74593776",
"text": "def rotate90(matrix)\n matrix.each_with_object([]) do |arr, new_matrix|\n arr.each_with_index do |value, index|\n new_matrix.fetch(index) rescue new_matrix << []\n new_matrix[index].unshift(value)\n end\n end\nend",
"title": ""
},
{
"docid": "db2c9975f488347e43dac6d2f73efdf5",
"score": "0.7446167",
"text": "def rotate_matrix(mat)\n mat.reverse!\n mat.transpose\nend",
"title": ""
},
{
"docid": "bf3f7d448b8f87578fbcbd5a76f17dba",
"score": "0.742067",
"text": "def rotate_degrees(matrix, degrees)\n return puts\"Not a valid degree: #{degrees}\" unless degrees % 90 == 0\n n = degrees / 90\n return matrrix if n == 4 || n == 0\n temp = matrix\n result = nil\n n.times do |_|\n result = rotate90(temp)\n temp = result\n end\n result\nend",
"title": ""
},
{
"docid": "c7c063cb998fd0b0f8f8e9d7feb05b14",
"score": "0.7412928",
"text": "def rotate_90_deg_left!(matrix)\n transposed_matrix = matrix.transpose\n raise IndexError.new('Given matrix is not a square matrix') if transposed_matrix.length != matrix.length\n transposed_matrix.reverse\nend",
"title": ""
},
{
"docid": "092053975b105f94ff08b7dd99637ec6",
"score": "0.73628587",
"text": "def rotate_clockwise!; end",
"title": ""
},
{
"docid": "2d5037af090895ad61d6e2fc744c349d",
"score": "0.73624986",
"text": "def rotate(matrix)\n limit = matrix.length / 2\n limit -= 1 if matrix.length.odd?\n m = matrix.length - 1\n (0..limit).each do |i|\n (i..m - 1 - i).each do |j|\n matrix[i][j], matrix[m - j][i], matrix[m - i][m - j], matrix[j][m - i] = matrix[m - j][i], matrix[m - i][m - j], matrix[j][m - i], matrix[i][j]\n end\n end\n nil\nend",
"title": ""
},
{
"docid": "83107e45e6233b0a083a4b290edf46ad",
"score": "0.7350076",
"text": "def clockwise_rotate(matrix)\n result = []\n\n (0 ... matrix[0].size).each do |i|\n row = []\n\n (matrix.size - 1).downto(0) do |j|\n row << matrix[j][i]\n end\n\n result << row\n end\n\n result\nend",
"title": ""
},
{
"docid": "8e316ff8c115f0686ee7a6f39d8d75c5",
"score": "0.7307481",
"text": "def rotate90(matrix)\n rows = []\n row_size = matrix[0].size # new row size is old column size\n row_size.times do |row|\n rows[row] = matrix.map { |old_column| old_column[row] }.reverse\n end\n rows\nend",
"title": ""
},
{
"docid": "a672964d75c4af995ad79bf24e9ce482",
"score": "0.7291149",
"text": "def rotate_matrix(array_of_arrays) #rotate 90 degrees clockwise\n array_of_arrays.transpose.map(&:reverse)\nend",
"title": ""
},
{
"docid": "7526dfc2832fea0b99793c424a17e267",
"score": "0.7286743",
"text": "def rotate_clockwise; end",
"title": ""
},
{
"docid": "6932e10b88593461940aed50ed8fe7a6",
"score": "0.7279472",
"text": "def rotate_matrix(matrix)\n return matrix if matrix.length == 1\n\n (matrix.length / 2.0).ceil.times do |layer|\n rotate_layer(matrix, layer)\n end\n matrix\nend",
"title": ""
},
{
"docid": "59f875aa86b7ab0d4ee993cc05710cf2",
"score": "0.7193496",
"text": "def rotateClockwise(matrix)\n # Transpose the matrix and reverse each individual array\n return matrix.transpose.map! { |array| array.reverse! }\nend",
"title": ""
},
{
"docid": "fc7dd690f0d4769760f797df4949c604",
"score": "0.7192086",
"text": "def rotate_matrix_in_place\n # We only need to loop over 1/4th of the numbers because rotate_position rotates all four numbers.\n\n # Because the matrix is rotating in place, only go over the first half of the rows.\n # The second half will be rotated by rotate_position as we rotate the first half. \n (@matrix.length / 2).floor.times do |row|\n # The number of columns to rotate per row number is equal to N - 1 - (2 * row_number).\n # Each column gets offset by how many row's we've seen because the numbers in the left most columns\n # have already been rotated by previous iterations\n (@matrix.length - 1 - 2 * row).times do |num_cols|\n offset = row\n rotate_position(row, offset + num_cols)\n end\n end\n self\n end",
"title": ""
},
{
"docid": "a6849d8407c8606ab880bc8b64f52768",
"score": "0.7169985",
"text": "def rotate(matrix)\n size = matrix.size\n max_index = size - 1\n\n # Flip diagonal\n size.times do |i| # O(n*n)\n (i..max_index).each do |j|\n matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]\n end\n end\n\n pp matrix\n\n # Flip horizontal\n size.times do |i|\n (size / 2).times do |j|\n matrix[i][j], matrix[i][max_index - j] = matrix[i][max_index - j], matrix[i][j]\n end\n end\nend",
"title": ""
},
{
"docid": "b2cf039562e6dd68a038adc78207d69c",
"score": "0.71687084",
"text": "def rotate( matrix )\n t = Marshal.load( Marshal.dump( self ) )\n t.rotate!( matrix )\n return t\n end",
"title": ""
},
{
"docid": "12f83735ad1a20fcb6693c724cf24209",
"score": "0.71484846",
"text": "def rotate180(matrix)\n matrix.reverse.map(&:reverse)\nend",
"title": ""
},
{
"docid": "a9712e7d89090d1af837b5db96c5f044",
"score": "0.7124356",
"text": "def rotate90(matrix)\n\ttransposed_array = []\n\ttemp_array = []\n\tcounter = 0\n\tloop do\n\t\tmatrix.reverse_each do |array|\n\t\t\ttemp_array.push(array[counter])\n\t\tend\n\t\ttransposed_array.push(temp_array)\n\t\ttemp_array = []\n\t\tcounter += 1\n\t\tbreak if counter == matrix[0].length\n\tend\n\tp transposed_array\nend",
"title": ""
},
{
"docid": "a51430672291278a78a7674f5f86ccc9",
"score": "0.70586896",
"text": "def rotate_matrix\n len = @matrix.length - 1\n new_matrix = Array.new(len + 1) { Array.new(len + 1) }\n 0.upto(len) do |col|\n len.downto(0) do |row|\n new_matrix[col][len - row] = @matrix[row][col]\n end\n end\n Matrix.new new_matrix\n end",
"title": ""
},
{
"docid": "74ef785cd819b80df9e79166585f63b0",
"score": "0.70111",
"text": "def rotate90(matrix_input)\n input_column = 0\n input_row = 0\n return_column = matrix_input.length - 1\n matrix2 = Array.new(matrix_input[0].size){Array.new(matrix_input.size)}\n loop do\n loop do\n matrix2[input_column][return_column] = matrix_input[input_row][input_column]\n input_column += 1\n break if input_column > matrix_input[0].size - 1\n end\n input_row += 1\n input_column = 0\n return_column -= 1\n break if input_row > matrix_input.length - 1\n end\n matrix2\nend",
"title": ""
},
{
"docid": "6d407d86780e9c010d6290af7950f7dc",
"score": "0.6995594",
"text": "def rotate_matrix(matrix)\n rotated = []\n matrix.length.times do\n rotated << []\n end\n matrix.each_with_index do |row,i|\n row.each_with_index do |square,j|\n rotated_x = row.length - 1 - j\n rotated_y = i\n rotated[rotated_x][rotated_y] = matrix[i][j]\n end\n end\n rotated\nend",
"title": ""
},
{
"docid": "d27083d204b08517460a90e19911e91e",
"score": "0.6995576",
"text": "def rotate_counter_clockwise; end",
"title": ""
},
{
"docid": "41dd1be24ceeaffc6cc4560d14362ce5",
"score": "0.6993477",
"text": "def make_rotated(matrix)\n matrix_size = matrix.length - 1\n new_matrix = Array.new(matrix.length) { Array.new }\n (0..matrix_size).each do |row|\n (0..matrix_size).each do |col|\n new_matrix[col] << matrix[row][col]\n end\n end\n new_matrix\nend",
"title": ""
},
{
"docid": "28a2fd561801d5690cb9f00a125aa0a5",
"score": "0.69348973",
"text": "def rotate(matrix)\n length = matrix.length\n rotated_matrix = Array.new(length) { Array.new(length) { nil } }\n\n matrix.each_with_index do |row, i|\n row.each_with_index do |_col, j|\n rotated_matrix[length - 1 - j][i] = matrix[i][j]\n end\n end\n\n rotated_matrix\n end",
"title": ""
},
{
"docid": "7d3509cd16bfc6db6d7a23601e07c101",
"score": "0.6929775",
"text": "def rotate_matrix(matrix)\n n = matrix.size-1\n for layer in 0..n/2\n first = layer\n last = n-1-layer\n for i in first..last\n offset = i - first\n tmp = matrix[first][i]\n matrix[first][i] = matrix[last-offset][first]\n matrix[last-offset][first] = matrix[last][last]\n end\n end \nend",
"title": ""
},
{
"docid": "b886c0a8e171258e5968ebe5198fcfd1",
"score": "0.6875993",
"text": "def rotateMatrix(matrix)\n res = []\n matrix.each_with_index do |row, i|\n row.each_with_index do |_item, j|\n res[j] = [] unless res[j]\n res[j][matrix.length - 1 - i] = matrix[i][j]\n end\n end\n res\nend",
"title": ""
},
{
"docid": "0152a5be474b0b63d6858e1e02f7054a",
"score": "0.6863841",
"text": "def matrixRotation(matrix, r)\n resultMatrix = Array.new($m) { |_| Array.new($n) }\n\n (0..$m-1).each do |row|\n (0..$n-1).each do |col|\n x,y = computeOffset col, row, r\n puts [matrix[row][col], row, col, y, x].inspect\n resultMatrix[y][x] = matrix[row][col]\n end\n end\n\n printMatrix resultMatrix\nend",
"title": ""
},
{
"docid": "0558b8793dad9908249c9225144fbd40",
"score": "0.6859213",
"text": "def rotate_matrix(matrix)\n n = matrix.length\n \n (n / 2).times do |j|\n (j..n-2-j).each do |i|\n top = matrix[j][i]\n matrix[j][i] = matrix[n-1-i][j] # copy left half into top half\n matrix[n-1-i][j] = matrix[n-1-j][n-1-i] # bottom to left\n matrix[n-1-j][n-1-i] = matrix[i][n-1-j] # right to bottom\n matrix[i][n-1-j] = top # top to right\n end\n end\n\n return matrix\nend",
"title": ""
},
{
"docid": "3bcf095a982b72929df7cdfc4aa9b8ca",
"score": "0.68527734",
"text": "def rotate matrix, angle, x, y, z\n CATransform3DRotate(matrix, angle, x, y, z)\n end",
"title": ""
},
{
"docid": "807f21f7837c39af14e88cc1c5998802",
"score": "0.6846745",
"text": "def rotate_matrix(matrix)\n arr = []\n matrix.length.times do |i|\n sub = []\n\n matrix.each do |array|\n sub << array[i]\n end\n\n arr << sub.reverse\n end\n arr\nend",
"title": ""
},
{
"docid": "807f21f7837c39af14e88cc1c5998802",
"score": "0.6846745",
"text": "def rotate_matrix(matrix)\n arr = []\n matrix.length.times do |i|\n sub = []\n\n matrix.each do |array|\n sub << array[i]\n end\n\n arr << sub.reverse\n end\n arr\nend",
"title": ""
},
{
"docid": "2930d15596716a3a4e61c92ac30f2da0",
"score": "0.6785937",
"text": "def rotate(matrix)\n width = matrix.length\n transform = Hash.new\n\n width.times do |y|\n width.times do |x|\n transform[[x, width-1-y]] = matrix[y][x]\n end\n end\n\n transform\nend",
"title": ""
},
{
"docid": "927f79bcd36473e409937ce00575a91a",
"score": "0.67445636",
"text": "def rotate_matrix(matrix)\n n = matrix.length\n\n (n/2).times do |layer|\n final = n - layer - 1\n (layer..final-1).each do |i|\n offset = i - layer\n # save top\n top = matrix[layer][i]\n # left to top\n matrix[layer][i] = matrix[final - offset][layer]\n # bottom to left\n matrix[final - offset][layer] = matrix[final][final - offset]\n # right to bottom\n matrix[final][final - offset] = matrix[i][final]\n # top to right\n matrix[i][final] = top\n end\n end\n\n return matrix\nend",
"title": ""
},
{
"docid": "e0da3576e9751d50581842bb8ee55bbf",
"score": "0.6742302",
"text": "def rotate_clockwise\n rotate(1)\n end",
"title": ""
},
{
"docid": "8c78640891abc72a1b4fb843b512a2d0",
"score": "0.67166334",
"text": "def rotate_2(matrix)\n len = matrix.length\n return matrix if len < 1\n rotated_matrix = Array.new(matrix[0].length) {Array.new(len)}\n matrix.each_with_index do |row, row_index|\n row.each_with_index do |col, col_index|\n rotated_matrix[row_index][col_index] = matrix[len - col_index - 1][row_index]\n end\n end\n rotated_matrix\nend",
"title": ""
},
{
"docid": "d74267c4f6aa0388d3443622201dcb1f",
"score": "0.6705149",
"text": "def rotate_matrix mtr\n # mtr is an array or arrays\n n = mtr.size\n ans = []\n n.times { ans << [] }\n\n mtr.each_with_index do |row, i|\n row.each_with_index do |num, j|\n ans[j][n-i-1] = num\n end\n end\n\n return ans\nend",
"title": ""
},
{
"docid": "30dc40119dabf006e905c006f758f38b",
"score": "0.67029613",
"text": "def rotate_matrix(matrix)\n n = matrix.length\n\n (n/2).times do |layer|\n final = n - 1 - layer\n\n (layer..final-1).each do |i|\n offset = i - layer\n\n # Saving the top layer\n top = matrix[layer][i]\n\n # Left to top\n matrix[layer][i] = matrix[final - offset][layer]\n \n # Bottom to left\n matrix[final - offset][layer] = matrix[final][final - offset]\n\n # Right to bottom\n matrix[final][final - offset] = matrix[i][final]\n\n # Top to right\n matrix[i][final] = top\n end\n end\n\n return matrix\nend",
"title": ""
},
{
"docid": "3e487fba51b1882686725736b6157c87",
"score": "0.66942215",
"text": "def rotate_90(grid)\n rot_grid = grid.dup.map(&:dup)\n grid.length.each do |i|\n grid.length.each do |j|\n rot_grid[i][j] = grid[j][i]\n end\n end\n rot_grid\nend",
"title": ""
},
{
"docid": "ad11393e4af714aeb150b959ad956451",
"score": "0.66825956",
"text": "def rotate(matrix)\n n = matrix.length\n (0..(n / 2) - 1).each do |layer|\n last = (n - 1) - layer\n (layer..last - 1).each do |i|\n offset = i - layer\n top = matrix[layer][i]\n # left -> top\n matrix[layer][i] = matrix[last - offset][layer]\n # bottom -> left\n matrix[last - offset][layer] = matrix[last][last - offset]\n # right -> bottom\n matrix[last][last - offset] = matrix[i][last]\n # top -> right\n matrix[i][last] = top # matrix[last - offset][layer]\n end\n end\n matrix\nend",
"title": ""
},
{
"docid": "55f951063241d1840042b2c94e434cf9",
"score": "0.6648379",
"text": "def rotate_matrix(matrix)\n new_arr = Array.new(matrix.length, [])\n matrix.each_with_index do |row, row_idx|\n row.each_with_index do |element, ele_idx|\n new_idx = matrix.length - 1 - row_idx\n new_arr[ele_idx][new_idx] = element\n end\n end\n new_arr\nend",
"title": ""
},
{
"docid": "b6dd90a72966ec2b40c16e54ddced14e",
"score": "0.6622174",
"text": "def rotate_left(arr)\n mirror_board_horizontal(arr).transpose\nend",
"title": ""
},
{
"docid": "db3143b93916758d66c2b3aaac101fe9",
"score": "0.65830284",
"text": "def rotate(matrix)\n n = matrix.length\n ans = Array.new(n){Array.new(n,0)}\n for i in 0...n do\n for j in 0...n do\n ans[i][j] = matrix[n-1-j][i]\n end\n end\n for i in 0...n do\n for j in 0...n do\n matrix[i][j] = ans[i][j]\n end\n end\n return nil\nend",
"title": ""
},
{
"docid": "802606fd108266a3a4653299a0fac9d7",
"score": "0.6576675",
"text": "def rotateMatrix(matrix)\n edge = matrix.length - 1\n pix = nil # p is pixel to be moved\n toRow = nil # new row\n toCol= nil # new col\n i = 0\n while(i < matrix.length - 1)\n j = 0\n row = 0\n col = i\n temp = nil# holds replaced pixel\n while (j < 4)\n pix = temp === nil ? matrix[row][col] : temp # first move or continued\n toRow = col; # columns turn to rows,\n toCol = edge - row; # rows become columns caluclated by lengt of row - row index\n temp = matrix[toRow][toCol]\n matrix[toRow][toCol] = pix\n row = toRow\n col = toCol\n j+=1\n end\n i+=1\n end\n return matrix\nend",
"title": ""
},
{
"docid": "5ec440024ae3d9b245d8958d4de48618",
"score": "0.6563951",
"text": "def rot90\n rot :d90\n end",
"title": ""
},
{
"docid": "89531acf96e893ec2f19f34eb95a82e0",
"score": "0.6529579",
"text": "def rotate_matrix(old_matrix)\n new_matrix = old_matrix.map(&:dup)\n old_matrix.each_with_index do |line, line_i|\n line.each_with_index do |el, el_i|\n new_matrix[el_i][-(line_i + 1)] = el\n end\n end\n new_matrix\nend",
"title": ""
},
{
"docid": "9e521149a859dc8ca9b6dbf51eb64eec",
"score": "0.6519623",
"text": "def rotate90(arr)\n col_size = arr.size # the number of rows in the original array\n row_size = arr[0].size # the number of cols in the original array\n new_arr = Array.new(row_size) { Array.new(col_size) } # creates a nil-filled row_size by col_size array\n # p new_arr\n arr.each_with_index do |sub_arr, row|\n sub_arr.each_index do |col|\n # sub_arr.each_with_index do |value, col|\n # p \"#{sub_arr}, #{row}, #{value}, #{col}\"\n # new_arr[row_size - 1 - col][row] = sub_arr[col] # rotates -90deg\n new_arr[col][col_size - 1 - row] = sub_arr[col] # rotates +90deg\n end\n end\n new_arr\nend",
"title": ""
},
{
"docid": "7dcb17f0203dfc6e2d5f818fa32d4a86",
"score": "0.65116",
"text": "def rotate(angle)\n \n end",
"title": ""
},
{
"docid": "5cf62e921185ee94220a683a0adab6db",
"score": "0.6413367",
"text": "def rotate(matrix)\n # 4 groups of two\n a = 0\n b = 2\n c = 2\n 2.times do |num|\n matrix[num][c], matrix[c][b], matrix[b][a], matrix[a][num] = matrix[a][num], matrix[num][c], matrix[c][b], matrix[b][a]\n b -=1\n end\n p matrix\nend",
"title": ""
},
{
"docid": "8aafe8c662b38384fd174e428eff5ae0",
"score": "0.6411314",
"text": "def rotate(angle, around_x=0, around_y=0); end",
"title": ""
},
{
"docid": "3b9a4020113918c7a8c12b0752681e2c",
"score": "0.64076763",
"text": "def rotateMatrix(mat)\n n = mat.size\n # Consider all squares one by one \n 0.upto(n/2) do |x|\n \n # Consider elements in group \n # of 4 in current square \n x.upto(n-x-1) do |y|\n \n # store current cell in temp variable \n temp = mat[x][y] \n\n # move values from right to top \n mat[x][y] = mat[y][n-1-x]\n\n # move values from bottom to right \n mat[y][n-1-x] = mat[n-1-x][n-1-y] \n\n # move values from left to bottom \n mat[n-1-x][n-1-y] = mat[n-1-y][x] \n\n # assign temp to left \n mat[n-1-y][x] = temp \n end\n end\n mat\nend",
"title": ""
},
{
"docid": "e448538136b5ac3763ed4a9ed2a84230",
"score": "0.64026105",
"text": "def rotate_right(arr)\n mirror_board_horizontal(arr.transpose)\nend",
"title": ""
},
{
"docid": "6325629a6e62e98ee6637d346f760ab7",
"score": "0.6388783",
"text": "def rotate(angle, x = nil, y = nil, z = nil)\n z ||= 1.0 if OpenGL::App.use2D\n if block_given?\n matrix do\n glRotatef(angle.to_f, x || 0.0, y || 0.0, z)\n yield\n end\n else\n glRotatef(angle.to_f, x || 0.0, y || 0.0, z)\n end\n end",
"title": ""
},
{
"docid": "3003ab97f63cf2bf8cbfcf96a997715c",
"score": "0.634279",
"text": "def rotation_matrix(x,y,z,t)\n return Matrix.rows([\n [ x*x*(1-cos(t))+cos(t), y*x*(1-cos(t))-z*sin(t), z*x*(1-cos(t))+y*sin(t) ],\n [ x*y*(1-cos(t))+z*sin(t), y*y*(1-cos(t))+cos(t), z*y*(1-cos(t))-x*sin(t) ],\n [ x*z*(1-cos(t))-y*sin(t), y*z*(1-cos(t))+x*sin(t), z*z*(1-cos(t))+cos(t) ]\n ])\nend",
"title": ""
},
{
"docid": "775466a815ed877dd38f0f86eb2eeced",
"score": "0.6340937",
"text": "def rotate_90_in_place(array)\n print_array(array)\n process(array, 0, array.length-1, array[0][array.length-1])\n print_array(array)\nend",
"title": ""
},
{
"docid": "7d14d30cc1a417aada6d090ae827b936",
"score": "0.63328606",
"text": "def rotate1(input_array)\n # TODO\nend",
"title": ""
},
{
"docid": "86d0fd1acafa9fa05824d0d1ae8f64fa",
"score": "0.6304229",
"text": "def rotate_counterclockwise\n rotate(-1)\n end",
"title": ""
},
{
"docid": "738b2a8d0492212628dae623f1bf50ce",
"score": "0.6284148",
"text": "def rotate(counterclockwise = false)\n if counterclockwise\n @heading == 0 ? @heading = 3 : @heading -= 1\n else\n @heading == 3 ? @heading = 0 : @heading += 1\n end\n end",
"title": ""
},
{
"docid": "5a26bf6ac4ff5da3a46e7a1c39f0e4f9",
"score": "0.6273831",
"text": "def rotate_matrix(data)\n new_data = []\n row_size = data.size\n column_size = data[0].size\n \n (0...column_size).each do |i|\n tmp = []\n (0...row_size).each do |j|\n tmp << data[j][i]\n end\n new_data << tmp\n end\n new_data\nend",
"title": ""
},
{
"docid": "12920fb71c2d32fcab72e9af0c85c1cc",
"score": "0.62589455",
"text": "def rotate_Z(angle)\n sinA = if angle.respond_to? :sin\n angle.sine\n else\n Math.sin(angle*Math::PI/180)\n end\n cosA = if angle.respond_to? :cos\n angle.cos\n else\n Math.cos(angle*Math::PI/180)\n end\n \n mat = Matrix[[cosA, -1*sinA, 0],[sinA, cosA, 0], [0,0,1]]\n rotate(mat) \n end",
"title": ""
},
{
"docid": "40bef32452194db7ef6d4fd118320bf4",
"score": "0.6248435",
"text": "def get_mtx_rotated_90 mtx_in, h_original, w_original\n h_out = w_original\n w_out = h_original\n \n out = Array.new(h_out) { Array.new(w_out) { 0 } }\n\n mtx_in.each_with_index do |row_in, i|\n col_out = w_out - 1 - i\n\n row_in.each_with_index do |cell_in, j|\n out[j][col_out] = cell_in\n end\n end\n\n return out\nend",
"title": ""
},
{
"docid": "0a3c23cfe638a7eb3d5b248b6253c39a",
"score": "0.621733",
"text": "def rotate_matrix(arr)\n \n idx1 = 0\n\n while idx1 < arr.size / 2\n idx2 = idx1\n last = arr.size - idx1 - 1 \n while idx2 < last\n offset = idx1 - idx2\n top = arr[idx1][idx2]\n arr[idx1][idx2] = arr[last - offset][idx1]\n\n idx2 += 2\n end\n idx1 += 1\n end\nend",
"title": ""
},
{
"docid": "9015d5ca8a060ba9b57716f468223291",
"score": "0.6211617",
"text": "def rotate_3(matrix)\n len = matrix.length\n layer = 0\n while layer < len / 2\n first_column_layer = layer\n last_column_layer = len - layer - 1\n\n # Iterate from first_column_layer to last_column_layer\n col = first_column_layer\n while col < last_column_layer\n offset = col - first_column_layer\n top = matrix[first_column_layer][col]\n # move the value from bottom left to top\n matrix[first_column_layer][col] = matrix[last_column_layer - offset][first_column_layer]\n #\n matrix[last_column_layer - offset][first_column_layer] = matrix[last_column_layer][last_column_layer - offset]\n\n matrix[last_column_layer][last_column_layer - offset] = matrix[col][last_column_layer]\n\n matrix[col][last_column_layer] = top\n\n col += 1\n end\n layer += 1\n end\n matrix\nend",
"title": ""
},
{
"docid": "0d9df8233b83b9e3ae90e997a99661af",
"score": "0.62114596",
"text": "def rotate(input)\n\nend",
"title": ""
},
{
"docid": "05de944420efdba164bb1f40eff8ff67",
"score": "0.6208451",
"text": "def rotate(orientation); end",
"title": ""
},
{
"docid": "a3c15f3c3735a32ed71c1598b9d38025",
"score": "0.62054574",
"text": "def rotate!(angle)\n self.shape = self.shape.transpose.collect{|row| row.reverse} if angle % 90 == 0\n self.shape = self.shape.collect{|row| row.reverse}.reverse if angle % 180 == 0\n end",
"title": ""
},
{
"docid": "535f97d30c36ca4847273b6e0d5c946e",
"score": "0.6200054",
"text": "def rotate_counter_clockwise(game)\n # Transpose flips array, need to swap rows\n to_2d_array(game).transpose.reverse.reduce(&:+)\n end",
"title": ""
},
{
"docid": "f4c8447b36133f503aeee8204642ed7a",
"score": "0.6194606",
"text": "def rotate(matrix, rank)\n outerlayer = 0;\n i = rank;\n offset = rank\n # while( i > 1) do\n temp = nil\n 0.upto(i-2) do |j|\n top = matrix[outerlayer,j]\n temp = top\n p top\n #left to top\n matrix[outerlayer,j] = matrix[offset -1 - j,outerlayer]\n p matrix[offset -1 - j,outerlayer]\n #bottom to right\n matrix[offset -1 - j,outerlayer] = matrix[offset -1,offset -1 - j]\n p matrix[offset -1,offset -1 - j]\n #right to bottom\n matrix[offset -1,offset -1 - j] = matrix[j, offset - 1]\n p matrix[j, offset - 1]\n #top to right\n matrix[j, offset - 1] = temp\n end\n i = rank/2\n offset -= 1\n outerlayer += 1\n # end\n\nend",
"title": ""
},
{
"docid": "5c2642cca78a25ad36c8404eececcd06",
"score": "0.6188791",
"text": "def leftRotation(a, d)\n # Complete this function\n a.rotate(d)\nend",
"title": ""
},
{
"docid": "b10f5a7656ea4914f55d854145ac0815",
"score": "0.6167375",
"text": "def rotate_matrix_r_p mtr\n # mtr is an array of arrays\n n = mtr.size - 1\nend",
"title": ""
},
{
"docid": "20b8c30a49f8ba84ad63f8fcfc2aa1f7",
"score": "0.61623526",
"text": "def rotate dir = \"LR\"\n orient dir\n end",
"title": ""
},
{
"docid": "21d913c5bfee29391b9f7d4e0a384734",
"score": "0.6158753",
"text": "def rotate_180\n \trotate_clockwise\n \trotate_clockwise\n end",
"title": ""
},
{
"docid": "e82ebb4ae2b911c65e33351963f4c93a",
"score": "0.6153582",
"text": "def rotate(vect); end",
"title": ""
},
{
"docid": "e82ebb4ae2b911c65e33351963f4c93a",
"score": "0.6153582",
"text": "def rotate(vect); end",
"title": ""
},
{
"docid": "71a02692ee2480513babb9d62fcb5369",
"score": "0.61460394",
"text": "def rotate90(array)\n result = []\n (0...array[0].size).each do |sub_array|\n new_line = []\n (0...array.size).each do |index|\n new_line.unshift(array[index][sub_array])\n end\n result << new_line\n end\n result\nend",
"title": ""
},
{
"docid": "cf20eaaa25f8296bb19d40200a4e05c8",
"score": "0.61444265",
"text": "def rotate2(input_array)\n # TODO\nend",
"title": ""
},
{
"docid": "c21a9a5f02ff678f5170622bbd0f5318",
"score": "0.6140083",
"text": "def rotate_right!; end",
"title": ""
},
{
"docid": "5c7fe3c1f14f12bc17c252af66b6cc5f",
"score": "0.6130545",
"text": "def rotate_clockwise\n @view = VIEWS.invert[view]\n end",
"title": ""
},
{
"docid": "7287884cc021bfb828b1128ad60b9315",
"score": "0.61289644",
"text": "def rotate(degrees)\n # returns self\n throw NotImplementedError\n end",
"title": ""
},
{
"docid": "54ebfe6e239f23e37e6fefcb9686e1a8",
"score": "0.61060506",
"text": "def rotate_180!; end",
"title": ""
},
{
"docid": "016d96663d5ff65d0c4bf0f6fe8f6d5e",
"score": "0.6078723",
"text": "def my_rotate(rotates = 1)\n\nend",
"title": ""
},
{
"docid": "204278a9f72f22edff6d9d082abf9eda",
"score": "0.60720754",
"text": "def rotLeft(a, d) \n a.rotate(d) \nend",
"title": ""
},
{
"docid": "9a485fff1ac7a7b5ef5ded24e0e21475",
"score": "0.6067755",
"text": "def array_rotation arr, num\n arr.rotate(num)\nend",
"title": ""
},
{
"docid": "df32c6776c53be9881de5ebbd59be53f",
"score": "0.60604477",
"text": "def rotation(theta) ; ; end",
"title": ""
},
{
"docid": "86276dc506c572162b87019b67049376",
"score": "0.605864",
"text": "def rotate!(degrees, center)\n # Your code goes here...\n end",
"title": ""
},
{
"docid": "8a40ceaaef449d84aa92c9b03bcb337a",
"score": "0.60582197",
"text": "def rotate_matrix(matrix_str)\n matrix = matrix_str.split(\"\\n\").collect{|row| row.split(\" \")}\n no_rows = matrix.length\n no_columns = matrix.first.length\n rotated_matrix = []\n (1..no_columns).each do |i|\n rotated_matrix.push(matrix.collect{|row| row[no_columns - i]})\n end\n return rotated_matrix.collect{|row| row.join(\" \")}.join(\"\\n\")\nend",
"title": ""
}
] |
606739802322a218c6b13b8218b34470
|
GET /linhkiens GET /linhkiens.json
|
[
{
"docid": "21ff9e6050e80fa08e5e87b069f28efc",
"score": "0.0",
"text": "def index\n @linhkiens = Linhkien.all\n @linhkien = Linhkien.new\n respond_to do |format|\n format.html\n format.csv { send_data @linhkiens.to_csv }\n format.xls # { send_data @products.to_csv(col_sep: \"\\t\") }\n end\n end",
"title": ""
}
] |
[
{
"docid": "688e633a6b97b8030ee2748163a90321",
"score": "0.65362304",
"text": "def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"title": ""
},
{
"docid": "3ad6a5770f00879ce356dcc78673513d",
"score": "0.6517679",
"text": "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"title": ""
},
{
"docid": "cee5c6426bb966478dc2d38c8b97ddec",
"score": "0.64856803",
"text": "def set_linhkien\n @linhkien = Linhkien.find(params[:id])\n end",
"title": ""
},
{
"docid": "874bda9f6fd0625698c395c5d5843d06",
"score": "0.6269766",
"text": "def show\n @kennel_litter = KennelLitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kennel_litter }\n end\n end",
"title": ""
},
{
"docid": "63c73df5de253f9d6bba4a4e5900572f",
"score": "0.62330985",
"text": "def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end",
"title": ""
},
{
"docid": "77631537650af85bcabcb86b0a7f512e",
"score": "0.6231533",
"text": "def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"title": ""
},
{
"docid": "0ed5e8a86ecc74f7254ce00e02ca5415",
"score": "0.6182964",
"text": "def show\n @lei = Lei.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lei }\n end\n end",
"title": ""
},
{
"docid": "64e5a0f81e9dfe05f2cf776bc3418a61",
"score": "0.6109398",
"text": "def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end",
"title": ""
},
{
"docid": "c91e501b19318bcce4b6a422824abf1d",
"score": "0.60798717",
"text": "def index\n @losts = Lost.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @losts }\n end\n end",
"title": ""
},
{
"docid": "611ecf3bca7834074b02f15bb000f5c2",
"score": "0.6075082",
"text": "def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"title": ""
},
{
"docid": "fb6b7001c88c156e4a9e764ba13f69b1",
"score": "0.60456645",
"text": "def index\n @illnesses = Illness.all\n\n render json: @illnesses\n end",
"title": ""
},
{
"docid": "e7454af3ccf112ad0d077e4a48d5de3f",
"score": "0.60125446",
"text": "def show\n @konyu_rireki = KonyuRireki.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konyu_rireki }\n end\n end",
"title": ""
},
{
"docid": "e5daf12e1a50aea1597180867335639d",
"score": "0.6009368",
"text": "def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end",
"title": ""
},
{
"docid": "551daf8aae4b62fddef40f44e36802c5",
"score": "0.6002547",
"text": "def show\n @litter = Litter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litter }\n end\n end",
"title": ""
},
{
"docid": "cf778a566e51d6c713b89a94e8616943",
"score": "0.59743154",
"text": "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end",
"title": ""
},
{
"docid": "9b94d8f3313fe9154f5d86a11f0b5cb7",
"score": "0.5968263",
"text": "def index\n @lids = Lid.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lids }\n end\n end",
"title": ""
},
{
"docid": "352b3b30d2cd0ce78d386a5c0c28bdf1",
"score": "0.5955786",
"text": "def index\n # if we have plan to use paginate\n # @kinofilms = Kinofilm.paginate :page => params[:page], :order => 'id DESC'\n @kinofilms = Kinofilm.all\n @kinofilm = Kinofilm.new\n respond_with(@kinofilms, :location=>kinofilms_path )\n end",
"title": ""
},
{
"docid": "80ec9eadb45ee74efe3b6b240ef28fa2",
"score": "0.5955345",
"text": "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end",
"title": ""
},
{
"docid": "da6fbd159095527bc05fff4f3f644d2c",
"score": "0.5945623",
"text": "def show\n @kisalli = Kisalli.find_by_key(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kisalli }\n end\n end",
"title": ""
},
{
"docid": "982279a36ab9b2a8c66668f7787f49d9",
"score": "0.5938701",
"text": "def show\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koti }\n end\n end",
"title": ""
},
{
"docid": "0a97dfc5f9fb90f6a3038c0ac575f83b",
"score": "0.5934064",
"text": "def index\n @kids = Kid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kids }\n end\n end",
"title": ""
},
{
"docid": "c4a5fac8ea55251d67b26c2bfd9aa157",
"score": "0.593155",
"text": "def show\n @webling = Webling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webling }\n end\n end",
"title": ""
},
{
"docid": "6adbb777326c33484aeb17c6effc25d6",
"score": "0.59181476",
"text": "def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end",
"title": ""
},
{
"docid": "0bcb417ff81b2eb2d4fd2a071b0b161d",
"score": "0.5906885",
"text": "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"title": ""
},
{
"docid": "ff2d7b6b9c4335fc2d8daea3c1bc82f3",
"score": "0.58946526",
"text": "def index\n @lomeins = Lomein.all\n end",
"title": ""
},
{
"docid": "ad33b1d5a795f61dfd82b6b33c0b46bb",
"score": "0.5878068",
"text": "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"title": ""
},
{
"docid": "20622ac8b4506aaa0c28c398583c6f04",
"score": "0.5866166",
"text": "def index\n\n @metro_lines = MetroLine.all\n\n render json: @metro_lines\n\n end",
"title": ""
},
{
"docid": "a98a40049b92f7d2ac290102890cd282",
"score": "0.5860137",
"text": "def index\n @innings = Inning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @innings }\n end\n end",
"title": ""
},
{
"docid": "14b9b4bf00a66c93d89bcb5f4b5e19a0",
"score": "0.5853",
"text": "def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end",
"title": ""
},
{
"docid": "c7b21f43126991d37f83e574a2aab9dd",
"score": "0.5852878",
"text": "def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"title": ""
},
{
"docid": "3ae52c6cc06150d64530ced74bb05f2a",
"score": "0.5847289",
"text": "def index\n render json: Loan.all\n end",
"title": ""
},
{
"docid": "0c65c0a81d245f227bdfafbb178f015e",
"score": "0.5831011",
"text": "def show\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sklad }\n end\n end",
"title": ""
},
{
"docid": "86ac0b07d19a58a7b17af21d27b65509",
"score": "0.5822493",
"text": "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"title": ""
},
{
"docid": "348e25b1b1ffd221532273d3b4aa3f61",
"score": "0.5819856",
"text": "def show\n @airlin = Airlin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @airlin }\n end\n end",
"title": ""
},
{
"docid": "eaff858e0e8fa7d234284bbfba507916",
"score": "0.5817666",
"text": "def create\n @linhkien = Linhkien.new(linhkien_params)\n\n respond_to do |format|\n if @linhkien.save\n format.html { redirect_to @linhkien, notice: 'Linhkien was successfully created.' }\n format.json { render :show, status: :created, location: @linhkien }\n else\n format.html { render :new }\n format.json { render json: @linhkien.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85612051b503b67b9d8ca197e43cf93d",
"score": "0.58120257",
"text": "def index\n @krishes = Krish.all\n end",
"title": ""
},
{
"docid": "c1656232b16a2048742c04658d96466d",
"score": "0.5791906",
"text": "def show\n @kitten = Kitten.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitten }\n end\n end",
"title": ""
},
{
"docid": "f198e2bfcbbb4f803bea590e9c291c89",
"score": "0.57914996",
"text": "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"title": ""
},
{
"docid": "aac5d9128d153d8e74ee8e68149f9744",
"score": "0.5782441",
"text": "def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"title": ""
},
{
"docid": "fdb2ca8bec930113738bf73fdc0dc196",
"score": "0.5773398",
"text": "def index\n @laws = Law.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"title": ""
},
{
"docid": "4d3e536fa5b371ed7164e1d4a9a4c3d2",
"score": "0.57607937",
"text": "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"title": ""
},
{
"docid": "6eed3aa5ab78c24729c3ef7f433d06e6",
"score": "0.5749868",
"text": "def index\n @line_stations = LineStation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_stations }\n end\n end",
"title": ""
},
{
"docid": "a2d26786e046419fef4f42acd6d56bfa",
"score": "0.5744089",
"text": "def show\n @kalplan_tltle = KalplanTltle.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kalplan_tltle }\n end\n end",
"title": ""
},
{
"docid": "a7f4e1b747173f4f98f5eca0feb28fe6",
"score": "0.5720056",
"text": "def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end",
"title": ""
},
{
"docid": "fe77898fadfd17ac6ebee8fad557951f",
"score": "0.57192063",
"text": "def index\n @illnesses = Illness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illnesses }\n end\n end",
"title": ""
},
{
"docid": "c18917235d4406dde4395fd4ed227873",
"score": "0.5717989",
"text": "def show\n @hasil = Hasil.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hasil }\n end\n end",
"title": ""
},
{
"docid": "9e01629b8387d5f27b2175962d27db9e",
"score": "0.5715164",
"text": "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"title": ""
},
{
"docid": "e8b37d7aaf9278e24b89dc28b583adfe",
"score": "0.5714899",
"text": "def show\n @leye = Leye.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leye }\n end\n end",
"title": ""
},
{
"docid": "cb174f3e9a675ef7e2229b09a733c86c",
"score": "0.5707574",
"text": "def show\n @sleuths = HTTParty.get('https://webservice.wikipathways.org/findPathwaysByText?query=' + @sleuth.ext_gene + '&species=homo+sapiens&format=json',\n :headers =>{'Content-Type' => 'application/json'} )\n @pubs = HTTParty.get('https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&retmode=json&term='+ @sleuth.ext_gene,\n :headers =>{'Content-Type' => 'application/json'} )\n end",
"title": ""
},
{
"docid": "53da193da878899df04020af03b0e7e1",
"score": "0.57068896",
"text": "def index\n @luteins = Lutein.all\n end",
"title": ""
},
{
"docid": "e97ddd7c7f947dddd994748f319af1cf",
"score": "0.57063895",
"text": "def index\n @lienthemes = Lientheme.all\n end",
"title": ""
},
{
"docid": "c9f52aae32e8673abb5f0877d426f3c4",
"score": "0.570434",
"text": "def show\n @kansei_buhin = KanseiBuhin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kansei_buhin }\n end\n end",
"title": ""
},
{
"docid": "f02aa9b985121800218390754b2964fb",
"score": "0.5703846",
"text": "def show\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotele }\n end\n end",
"title": ""
},
{
"docid": "bc727ce72a6188c933f9410bfb34b35e",
"score": "0.5700757",
"text": "def index\n @liners = Liner.all\n end",
"title": ""
},
{
"docid": "4c1773df569909a2c052afd3711d6cb3",
"score": "0.57003593",
"text": "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end",
"title": ""
},
{
"docid": "cba2f1d1ede3660339ec5a45ef6a5279",
"score": "0.5685224",
"text": "def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"title": ""
},
{
"docid": "00f0585919b1a8706a4cf1ca96fa6b04",
"score": "0.56780523",
"text": "def show\n @invent_journal_line = InventJournalLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invent_journal_line }\n end\n end",
"title": ""
},
{
"docid": "bcbf585338f1851fa899faff5bb7f384",
"score": "0.56771713",
"text": "def show\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lore }\n end\n end",
"title": ""
},
{
"docid": "c65ad967a4da201764d5287b3d926e25",
"score": "0.56743497",
"text": "def show\n @illness = Illness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illness }\n end\n end",
"title": ""
},
{
"docid": "b48ee511e5be71a3efff6bd95ea45cbd",
"score": "0.56733763",
"text": "def index\n @knihy = Kniha.all\n end",
"title": ""
},
{
"docid": "d5609de866eb00a1361f5ef9b904cd35",
"score": "0.5658252",
"text": "def index\n @liasons = Liason.all\n end",
"title": ""
},
{
"docid": "d88bf6975358f0976c3c31d6f70ef334",
"score": "0.5656993",
"text": "def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end",
"title": ""
},
{
"docid": "a94c6d1abc463931e3cc6f92cd9a82b1",
"score": "0.5656395",
"text": "def trainings\n render json: @plan.trainings\n end",
"title": ""
},
{
"docid": "348ca480c46fe9db002aab343c259e65",
"score": "0.56528914",
"text": "def linhkien_params\n params.require(:linhkien).permit(:ten, :loai, :price, :tondau, :nhap, :xuat, :toncuoi)\n end",
"title": ""
},
{
"docid": "6d7a52d8ddc19bc0c86d90720313eb19",
"score": "0.5650921",
"text": "def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"title": ""
},
{
"docid": "7bf278041bd23f7564ff918e871cb1cc",
"score": "0.56465644",
"text": "def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"title": ""
},
{
"docid": "df42c3bcbdb6d3530a8967bfb5666dd2",
"score": "0.5637854",
"text": "def show\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lich_su_binh_bau }\n end\n end",
"title": ""
},
{
"docid": "9f01fd3222cb96c7d5755632affc6fe8",
"score": "0.563515",
"text": "def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"title": ""
},
{
"docid": "bbc2d27dc447c3acdfcb8006ca9dfadc",
"score": "0.56198436",
"text": "def show\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format| \n format.json { render json: @giang_vien }\n end\n end",
"title": ""
},
{
"docid": "558663d698c462546ac169f55aa1636a",
"score": "0.56191885",
"text": "def index\n @online_students = OnlineStudent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @online_students }\n end\n end",
"title": ""
},
{
"docid": "77989b6095eb558f7af86e9afdb5f2db",
"score": "0.5619186",
"text": "def index\n @loves = Love.all\n render json: @loves\n end",
"title": ""
},
{
"docid": "d04c44c6e27b7a751240ca36bb418bdd",
"score": "0.56167495",
"text": "def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end",
"title": ""
},
{
"docid": "d18bf8005cb6c9b84e367361b0dad562",
"score": "0.5616429",
"text": "def show\n @kullanici = Kullanici.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kullanici }\n end\n end",
"title": ""
},
{
"docid": "1a2c4a3a6bfee877a6217c84740a4406",
"score": "0.5611926",
"text": "def index\n # if we have plan to use paginate\n # @kinodoms = Kinodom.paginate :page => params[:page], :order => 'id DESC'\n @kinodoms = Kinodom.all\n @kinodom = Kinodom.new\n respond_with(@kinodoms, :location=>kinodoms_path )\n end",
"title": ""
},
{
"docid": "a7e1875c56f509e23e406fbf96155a87",
"score": "0.56022084",
"text": "def index\n @ketamines = Ketamine.all\n end",
"title": ""
},
{
"docid": "a3081c8cec82b1471251d7c0af972e55",
"score": "0.56018776",
"text": "def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end",
"title": ""
},
{
"docid": "59b5ab2b8f7040389c99185a978c3dda",
"score": "0.55998355",
"text": "def index\n @lights = Light.all\n\n render json: @lights\n end",
"title": ""
},
{
"docid": "31382a74a978d17fbbb1c9b352dd03c1",
"score": "0.5593502",
"text": "def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end",
"title": ""
},
{
"docid": "8913f673373a460f837fcfa6ba0ff354",
"score": "0.558096",
"text": "def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end",
"title": ""
},
{
"docid": "7fc574adb823264bf95b43f797e41cd4",
"score": "0.5580428",
"text": "def index\n @l_inks = LInk.all\n end",
"title": ""
},
{
"docid": "744590103d729c6df3624da3880794c9",
"score": "0.55744994",
"text": "def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end",
"title": ""
},
{
"docid": "9d94f849f30cccd60e41f8b93e9d8f6d",
"score": "0.5568518",
"text": "def index\n @wigs = Wig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wigs }\n end\n end",
"title": ""
},
{
"docid": "d2c62e81a801ab4e4531768959bebe29",
"score": "0.5561505",
"text": "def index\n @linehauls = Linehaul.all\n end",
"title": ""
},
{
"docid": "f2b6465b959e00a2f7f0d10ede272f3c",
"score": "0.5559934",
"text": "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end",
"title": ""
},
{
"docid": "519198608870334ec6a6d2e8eca03bec",
"score": "0.55558974",
"text": "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"title": ""
},
{
"docid": "87b03f2c94f360ff7180b03d547b83ed",
"score": "0.55553085",
"text": "def show\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lector }\n end\n end",
"title": ""
},
{
"docid": "252d68572942f3839b78d300e389b656",
"score": "0.5555029",
"text": "def index\n @limes = Lime.all\n end",
"title": ""
},
{
"docid": "3acfdffda7a82dac7e4f39b5d33ad80f",
"score": "0.5554015",
"text": "def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end",
"title": ""
},
{
"docid": "2c5fadbede95362df580dca9355a671d",
"score": "0.55533147",
"text": "def index\n @tenkis = Tenki.all\n end",
"title": ""
},
{
"docid": "d96d4fe3e5002692c840430a177d1adb",
"score": "0.5549048",
"text": "def show\n @trainer = Trainer.find(params[:id])\n\n render json: @trainer.as_json(only: [:name], include: [:trainees])\n end",
"title": ""
},
{
"docid": "626394db22b7c4f294bb2041fe6bc534",
"score": "0.5547191",
"text": "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"title": ""
},
{
"docid": "92c4b93908d51b78009cd649dd60baaf",
"score": "0.5546287",
"text": "def show\n @witch = Witch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @witch }\n end\n end",
"title": ""
},
{
"docid": "cb60fb75644823386903719d7dd9a3f0",
"score": "0.5545231",
"text": "def show\n @medium = OnlineResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @online_resource }\n format.ris\n end\n end",
"title": ""
},
{
"docid": "6d08556f37c700e118844e9297cf2856",
"score": "0.55358434",
"text": "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"title": ""
},
{
"docid": "6d08556f37c700e118844e9297cf2856",
"score": "0.55358434",
"text": "def show\n @trail = Trail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trail }\n end\n end",
"title": ""
},
{
"docid": "8a15018ed6755e0b28dd3f1dfa77b7f9",
"score": "0.553423",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"title": ""
},
{
"docid": "8a15018ed6755e0b28dd3f1dfa77b7f9",
"score": "0.553423",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"title": ""
},
{
"docid": "8a15018ed6755e0b28dd3f1dfa77b7f9",
"score": "0.553423",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"title": ""
},
{
"docid": "8a15018ed6755e0b28dd3f1dfa77b7f9",
"score": "0.553423",
"text": "def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @line_items }\n end\n end",
"title": ""
},
{
"docid": "1a3e1e8ba0435bac5c76c485b7e11229",
"score": "0.5533524",
"text": "def index\n @lifelines = Lifeline.all\n end",
"title": ""
},
{
"docid": "f5010b4a4d2a3d10d2a46d4d90e0673d",
"score": "0.5533037",
"text": "def show\n render json: @wellist\n end",
"title": ""
}
] |
9cca9646c75260b7ee1ccfff73b3c3db
|
added 20130423 pet owner is inviting a dog walker opposite of above
|
[
{
"docid": "f9f853995fd784ba8968f5a02dcc5e71",
"score": "0.0",
"text": "def pet_owner_inviting_dogwalker\n logger.debug(\"pet_owner_inviting_dogwalker start\")\n @invitation = Invitation.new(params[:invitation])\n # work around: setting the device's unique user id (uuid) to ip_address\n @invitation.verify_email_sent_at = Time.zone.now\n \n #@invitation.existing_user = known_user(params[:invitation][:email])\n @known_user_being_invited = Person.where(:email => params[:invitation][:invitee_email], :status => 'active mobile').first\n if @known_user_being_invited\n @invitation.existing_user = 'true'\n else \n @invitation.existing_user = 'false'\n end\n logger.debug(\"pet_owner_inviting_dogwalker debug a : @invitation.existing_user = \" + @invitation.existing_user)\n # check for duplicate invitation - want to avoid badgering\n @duplicate = Invitation.where(:invitee_email => params[:invitation][:invitee_email], :invitor_email => @invitation.invitor_email).first\n if @duplicate\n @duplicate.request_count += 1\n @duplicate.save\n if (@duplicate.request_count < 3)\n Spawnling.new do\n UserMailer.pet_owner_inviting_dogwalker(@invitation.invitor_email, @duplicate).deliver\n end\n end \n elsif @invitation.save\n logger.debug(\"pet_owner_inviting_dogwalker debug b : @invitation.save\")\n Spawnling.new do\n UserMailer.pet_owner_inviting_dogwalker(@invitation.invitor_email, @invitation).deliver\n logger.info(\"pet_owner_inviting_dogwalker debug b1 : UserMailer finished\")\n end\n end\n #logger.debug(\"pet_owner_inviting_dogwalker end\")\n @invitations = Invitation.where(:invitor_email => @invitation.invitor_email, :status => 'invited')\n render json: @invitations, :layout => false\n end",
"title": ""
}
] |
[
{
"docid": "91184812c6ad46c5fe6dd2c205cfe488",
"score": "0.65373796",
"text": "def walk_dogs\n Dog.all.each do |dog|\n if dog.owner == self\n dog.mood = \"happy\"\n end\n end \n end",
"title": ""
},
{
"docid": "4ac858a19e91e962f429e96e5b23cb24",
"score": "0.6228047",
"text": "def happy_walker?\n @dog_walker.favorite_breed == @dog.breed \n end",
"title": ""
},
{
"docid": "f0d0ca1f3313478c2fff820c7cd67c6c",
"score": "0.62013125",
"text": "def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.6176723",
"text": "def anchored; end",
"title": ""
},
{
"docid": "43d36486fa2541c30dc26f90e423e017",
"score": "0.61609095",
"text": "def underdog\n\t if home_team != favorite\n\t home_team\n\t else\n\t visitor_team\n\t end\n\tend",
"title": ""
},
{
"docid": "fc6ade5ec80023cde40f8aa5391c68b5",
"score": "0.6110141",
"text": "def walk_dogs #walks the dogs which makes the dogs' moods happy\n # dog = Dog.new(\"Daisy\")\n # owner.pets[:dogs] << dog\n # owner.walk_dogs\n # expect(dog.mood).to eq(\"happy\")\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end",
"title": ""
},
{
"docid": "853e0c6e843b0757d0b26d4337436341",
"score": "0.60553575",
"text": "def walk_dogs\n @pets[:dogs][0].mood=(\"happy\")\n end",
"title": ""
},
{
"docid": "06b284a85c524f4a33b3c8ae0947c53f",
"score": "0.60483146",
"text": "def silly_adjective; end",
"title": ""
},
{
"docid": "067db91d51ae7f260bf3127c1b366c5c",
"score": "0.6000205",
"text": "def walk_dogs\n self.pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end",
"title": ""
},
{
"docid": "d6dd51556d07a23d58e0280181d4e8c5",
"score": "0.597289",
"text": "def walk_dogs\n self.pets.each do |family, type|\n if family.to_s == \"dogs\"\n type.each do |individual|\n individual.mood = \"happy\"\n end\n end\n end\nend",
"title": ""
},
{
"docid": "7941a605c78d7f494ec3aeb08aca6900",
"score": "0.59353447",
"text": "def walk\n return false if (@captives > 0 and captives_close and warrior.feel(get_bomb_direction).captive?) or # Captives needs to be rescued, dont walk away\n count_unit_type(:Sludge) > 5\n message = nil\n walk_to = nil\n if check_for_a_bomb and @bomb_optimal_direction != false\n message = \"Walking to captive with the bomb optimal direction to direction #{@bomb_optimal_direction}\"\n walk_to = @bomb_optimal_direction\n elsif @captives > 0 and check_for_a_bomb and !warrior.feel(:forward).enemy?\n message = \"Walking to get the captive with a bomb to direction #{get_bomb_direction}\"\n walk_to = get_bomb_direction\n elsif @captives > 0 and warrior.look(:forward)[1].to_s.to_sym == :\"Thick Sludge\" and count_unit_type(:\"Thick Sludge\") > 1\n message = \"Walking to avoid sludges to direction #{@captives_direction[0]}\"\n walk_to = :right\n elsif @enemies_binded < 3 and @captives > 0 and !enemies_close\n message = \"Walking to rescue captives to direction #{@captives_direction[0]}\"\n walk_to = @captives_direction[0]\n elsif !under_attack and warrior.listen.empty?\n message = \"Walking to the stairs to direction #{warrior.direction_of_stairs}\"\n walk_to = warrior.direction_of_stairs\n elsif !under_attack and !enemies_close\n message = \"Walking to closest unit to direction #{warrior.direction_of(warrior.listen.first)}\"\n walk_to = warrior.direction_of(warrior.listen.first)\n end\n if walk_to != nil\n if message != nil\n puts message\n end\n return warrior.walk! walk_to\n end\n return false\n end",
"title": ""
},
{
"docid": "f90c32981d0052fc811fe8ffddedd4cd",
"score": "0.5933665",
"text": "def potion; end",
"title": ""
},
{
"docid": "9031970492afe5c3bacdd31263dcb99a",
"score": "0.59262234",
"text": "def execute actor, target=[nil]\n def himher thing\n multiple = thing.count > 1 \n\n if multiple \n return \"them\"\n end\n\n case thing[0]\n when Player then \"him\"\n when ItemFacade then \"it\"\n else \"\"\n end\n end\n room_msg, self_msg, vict_msg = @ofound.dup, @found.dup, @tfound.dup\n\n\n if target.include?(actor) # if they're the same person then it's an auto\n target = [actor]\n room_msg = @oauto.dup\n self_msg = @auto.dup\n vict_msg = nil\n elsif target[0] == nil\n room_msg = @onoarg.dup\n self_msg = @noarg.dup\n vict_msg = nil\n end\n room_msg.gsub!(\"$n\", \"<%=other.peek(actor)%>\")\n room_msg.gsub!(\"$N\", \"<%=other.peek(if arg[0].include?(other) then arg[0]-[other]+['You'] else arg[0] end)%>\")\n room_msg.gsub!(\"$m\", himher([actor]))\n room_msg.gsub!(\"$M\", himher(target))\n\n self_msg.gsub!(\"$M\", himher(target))\n self_msg.gsub!(\"$m\", himher([actor]))\n if target\n self_msg.gsub!(\"$N\", actor.peek(target))\n end\n actor.view(\"#G\"+self_msg+\"#n\" + ENDL)\n \n room_msg.untaint\n if target[0]\n if target.count > 1 \n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor], \"#G\"+room_msg+\"#n\", target)\n else\n actor.in_room.display([:visual, \"other.can_see?(actor) || other.can_see?(arg[0])\"], actor, [actor, *target], \"#G\"+room_msg+\"#n\", target)\n target.each do |one_targ|\n vm = vict_msg.dup\n vm.gsub!(\"$n\", one_targ.peek(actor))\n one_targ.view(\"#G\"+vm+ \"#n\" + ENDL)\n end\n end\n else\n puts room_msg\n actor.in_room.display([:visual, \"other.can_see?(actor)\"], actor, [actor], \"#G\"+room_msg+\"#n\", \"\")\n end\n end",
"title": ""
},
{
"docid": "ee727fae1366dd31f1e3af5cbc06b434",
"score": "0.59183306",
"text": "def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end",
"title": ""
},
{
"docid": "beb9ef561d603ac7c7d6c9a88d83224a",
"score": "0.5915553",
"text": "def walk_dogs\n self.dogs.each {|dog| dog.mood = \"happy\"}\n end",
"title": ""
},
{
"docid": "025123699f62e5cb782ef8c75a52e1e9",
"score": "0.5904602",
"text": "def walk_dogs\n self.dogs.each{|dog|\n dog.mood = \"happy\"\n }\n end",
"title": ""
},
{
"docid": "ad28a7d70ce8f7be624bb3edcfd55ddf",
"score": "0.5893557",
"text": "def walk_pet(pet_name, owner_name)\n puts \"#{owner_name} takes his pet #{pet_name} on a walk\"\nend",
"title": ""
},
{
"docid": "f29d93611c93e92e3677fdc37102ab2b",
"score": "0.58921665",
"text": "def walk_dogs \n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end \n end",
"title": ""
},
{
"docid": "cc64ef78dd6f0e23f3926a10b65f9573",
"score": "0.5877142",
"text": "def walk_dogs\n @pets[:dogs].each { |dog| dog.mood = \"happy\"}\n end",
"title": ""
},
{
"docid": "631de4f9117386cfe8a4f3c771a406d4",
"score": "0.5871191",
"text": "def walk_dogs\n @pets[:dogs].each {|dog| dog.mood = \"happy\"}\n end",
"title": ""
},
{
"docid": "e8f607fb6269c2e44d85d3917be99687",
"score": "0.58633035",
"text": "def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end",
"title": ""
},
{
"docid": "722f86b3275633298f891883d6ce886d",
"score": "0.5860845",
"text": "def walk_dogs\n self.pets[:dogs].map do |dogs|\n dogs.mood = \"happy\"\n end\n end",
"title": ""
},
{
"docid": "608af4f0b2a8a28958927b92f930662b",
"score": "0.58598953",
"text": "def walk \n puts \"Hmm.. not in a mood to walk...\"\n super # parent 'walk' method\n end",
"title": ""
},
{
"docid": "46e6ade2579b26b999a9ecbcb4dc196a",
"score": "0.5845506",
"text": "def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@name} deflects the attack.\"\r\n @hitpoint += damage\r\n end\r\n end\r\n @hitpoint -= damage\r\n end",
"title": ""
},
{
"docid": "ee7200353f64fb5b3b07b0d8ca4a5c98",
"score": "0.5824575",
"text": "def walk_dogs\n pets[:dogs].each do |dog|\n dog.mood = \"happy\"\n end\n end",
"title": ""
},
{
"docid": "e30525254d608b7f505e9f8a36e1f6fa",
"score": "0.57921946",
"text": "def walk_dogs\n\n self.dogs.each do |dog|\n dog.mood = \"happy\"\n end\n end",
"title": ""
},
{
"docid": "2109263e08f8d9c52aec4a92d21765c6",
"score": "0.5740422",
"text": "def phase_3(player, bots)\r\n puts \" ----------------------- \"\r\n puts \" -- TOUR ENNEMI -- \"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n i = 0\r\n bots.each do |bot|\r\n if i > 0 && bot.life_points > 0\r\n bot.attacks(player)\r\n end\r\n i += 1\r\n end\r\nend",
"title": ""
},
{
"docid": "7fffec8a33dcbaa15b26ba5a90a78744",
"score": "0.5711352",
"text": "def attacks(other_player) \n puts \"Le joueur #{@name} attaque le joueur #{other_player.name}.\"\n other_player_damage = compute_damage\n\n puts \"Il lui inflige #{other_player_damage} points de dommages.\"\n other_player.gets_damage(other_player_damage)\n end",
"title": ""
},
{
"docid": "67448581f4a91c0ea71f1c50ec095a20",
"score": "0.5690392",
"text": "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}.\"\n # On récupère le nombre de points de dommage correspondant au lancer de dé via la méthode compute_damage\n damage_points = compute_damage\n puts \"Il lui inflige #{damage_points} points de dommage.\"\n # Ces points de dommage sont infligés à player. Si player n'a plus de points de vie, le programme affiche qu'il est mort.\n player.get_damage(damage_points)\n end",
"title": ""
},
{
"docid": "071e26d2bee12e4e076488b3d224afad",
"score": "0.5647716",
"text": "def taking_damage_action\n if @warrior.feel(:backward).empty? && @health < 10\n @warrior.walk!(:backward)\n elsif @warrior.feel.empty?\n @warrior.walk!\n elsif @warrior.feel.enemy?\n @warrior.attack!\n end\n end",
"title": ""
},
{
"docid": "30cf8f233bd86c0c55b94e4352bd9dd9",
"score": "0.5630664",
"text": "def handle_victory(entity)\n type(\"You defeated the #{entity.name}!\\n\")\n super(entity)\n print \"\\n\"\n end",
"title": ""
},
{
"docid": "349750320d7800eb91090957e97f32e5",
"score": "0.5619433",
"text": "def attack_use\n puts \"\"\n puts \"#{@type.name.upcase} MOVES ARE POWERFUL AGAINST:\"\n @type.super_effective.each_with_index {|other_type, index| puts \"#{index+1}. #{other_type.name}\"}\n end",
"title": ""
},
{
"docid": "10ea1e355a70df32b8122117a249f1e7",
"score": "0.5619338",
"text": "def worn_or_wielded? item\n object = @inventory.find item\n return false if object.nil?\n\n pos = position_of object\n\n return false if object.nil?\n\n if [:left_wield, :right_wield, :dual_wield].include? pos\n return \"You will need to unwield #{object.name} first.\"\n else\n return \"You will need to remove #{object.name} first.\"\n end\n end",
"title": ""
},
{
"docid": "d76beeecc0b44c3e36b1d11910f8c0ff",
"score": "0.56071424",
"text": "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}\"\n \tdamage = compute_damage\n \tputs \"Il lui inflige #{damage} points de dommage\"\n \tplayer.gets_damage(damage)\n end",
"title": ""
},
{
"docid": "99cca7271f8e02a7ca8a36040df2515a",
"score": "0.56065875",
"text": "def summoner_spell; end",
"title": ""
},
{
"docid": "0b85ab8a62cb0ead8902beeef09d86c9",
"score": "0.5602398",
"text": "def opponent_of(pet)\n raise \"#{pet} was not in this contest\" unless in_contest?(pet)\n return challenger if pet.id != challenger.id\n challenged\n end",
"title": ""
},
{
"docid": "e55ee3a0830beef5740748516b802d53",
"score": "0.56003284",
"text": "def love_pet\n puts \"#{@name} loves their pet #{pet.name} so much.\"\n end",
"title": ""
},
{
"docid": "8e339fb5d381c9a27ea9c4b189d68841",
"score": "0.55688393",
"text": "def emotional_adjective; end",
"title": ""
},
{
"docid": "ef6036a281df0023af8f9974aa23edd2",
"score": "0.5563045",
"text": "def test_consumes_a_victim\n werewolf = Werewolf.new(\"Josh\")\n victim = Victim.new\n assert_equal :alive, victim.status\n assert_equal 0, werewolf.victims\n werewolf.change!\n werewolf.feed(victim)\n assert_equal 1, werewolf.victims\n assert_equal :dead, victim.status\n\n end",
"title": ""
},
{
"docid": "fa2b4035076a67ad9544aecc24026e7d",
"score": "0.5551533",
"text": "def drink_potion\n if @potions > 0\n @stats[:strength] = @orig_stats[:strength]\n @potions -= 1\n end\n end",
"title": ""
},
{
"docid": "5e0190bff5c596ac8f80310ed471c3d1",
"score": "0.5546322",
"text": "def walks\n Walk.all.select { |walk_instance| walk_instance.dog == self }\n end",
"title": ""
},
{
"docid": "e7bc0c936bff1a0c7c550b3a390271f0",
"score": "0.5546175",
"text": "def miss_overdrive(user)\n if user.actor? and !self.actor?\n user.overdrive += user.overdrive_gain['Miss']\n elsif self.actor? and not user.actor?\n self.overdrive += self.overdrive_gain['Eva']\n end \n end",
"title": ""
},
{
"docid": "d6a850854619ac4e7885c4488c93ffd3",
"score": "0.5542682",
"text": "def walks\n Walk.all.select {|walk_instance| walk_instance.dog_walker == self}\n end",
"title": ""
},
{
"docid": "b12796fc526d3138dea7c05d7f71b515",
"score": "0.5541026",
"text": "def acting_for_entity(entity)\n return entity if entity.player?\n return entity.owner if entity.owner.player?\n\n acting = @players.find { |p| !director?(p) }\n acting || @players.first\n end",
"title": ""
},
{
"docid": "8ee8ca9106b30c22dc0872078a945ca1",
"score": "0.55369633",
"text": "def attack(troops)\n troops + self.level * troops\n end",
"title": ""
},
{
"docid": "eb111f1fb32bc31204771f35c9524a9d",
"score": "0.5536268",
"text": "def most_interesting_man_in_the_world; end",
"title": ""
},
{
"docid": "ca31f0bbc0e005a34f649b5c33313860",
"score": "0.55294836",
"text": "def tongue_twister; end",
"title": ""
},
{
"docid": "cbecee40486ac8f3f2665bb450ef5225",
"score": "0.5517602",
"text": "def walk_dogs\n Dog.all.collect do |dogs|\n dogs.mood=\"happy\"\n end\n end",
"title": ""
},
{
"docid": "747e131078cbe1746804b9733e3a4e35",
"score": "0.55123186",
"text": "def ingverb; end",
"title": ""
},
{
"docid": "1b5c3f4db7be17cf6d4997d3a3324ed0",
"score": "0.5512068",
"text": "def attacks (player)\n damage = compute_damage\n\n puts \">>> Le joueur #{self.name} attaque le joueur #{player.name}\"\n\n puts \">>> Il lui inflige #{damage} points de dommages\"\n\n # Give damages to the \"player\" in argument\n player.gets_damage(damage)\n end",
"title": ""
},
{
"docid": "902c06dd9eeedbc4d8b7c4961ffbab3f",
"score": "0.55099607",
"text": "def look_around(warrior)\n @attack_type = \"melee\"\t# default the action as melee (just walking around)\n\twarrior_sight = warrior.look\t# gather info on warrior's surroundings\n\twarrior_sight.each { |object|\t\n\t\tif object.to_s == \"nothing\"\n\t\t\tnext\n\t\telse\n\t\t\tkey = object.to_s\n\t\t\t@attack_type = @@action_map[key.to_sym]\t\t# set action based on what object the warrior has to deal with\n\t\t\tbreak\n\t\tend\n\t}\n\ttake_action(warrior)\n end",
"title": ""
},
{
"docid": "7ca299c9ef72df3c783964f1b2298b19",
"score": "0.5508294",
"text": "def dogs\n Dog.doggies.select { |dogs| dogs.owner == self }\n end",
"title": ""
},
{
"docid": "1d7107b396abe8148dea661d07c1384f",
"score": "0.5494026",
"text": "def another_pet\n\t\tputs \"Would you like to see another pet?\"\n\t\tanswer = gets.chomp.downcase\n\t\tcase answer \n\t\t\twhen \"yes\" then adopt(Pet.new)\n\t\t\twhen \"no\"\n\t\t\t\tputs \"Here is a copy of your adoption records.\"\n\t\t\t\tputs $record_keeper\n\t\t\telse\n\t\t\t\tputs \"Pardon?\"\n\t\t\t\tanother_pet\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3c2bc8c25c560a93e25d2a9fda79c1ff",
"score": "0.5492946",
"text": "def dogs\nDog.all.find_all do |dog|\n dog.owner == self\nend\n\nend",
"title": ""
},
{
"docid": "7f8ab34241952cb7a8a77e20b63d112f",
"score": "0.5490681",
"text": "def witcher; end",
"title": ""
},
{
"docid": "d7dd27e8e905c2c4f45653c7e59ebec3",
"score": "0.54875445",
"text": "def indefinite_reflexive_pronoun\n return \"itself\"\n end",
"title": ""
},
{
"docid": "21e150be61e026934c3b95f6e0161696",
"score": "0.54824966",
"text": "def monster; end",
"title": ""
},
{
"docid": "21e150be61e026934c3b95f6e0161696",
"score": "0.54824966",
"text": "def monster; end",
"title": ""
},
{
"docid": "1c8e1bf8da8204f121d318712c1883c3",
"score": "0.54747957",
"text": "def dog_walkers # ex: dog_instance.dog_walkers\n dog_walkers_array = self.walks.map { |walk_instance| walk_instance.dog_walker }\n dog_walkers_array.uniq\n end",
"title": ""
},
{
"docid": "25fb26a04faaa48e7cec2ad922a61ec6",
"score": "0.5472287",
"text": "def walk_dogs\n dogs.map {|dog| dog.mood = \"happy\"}\n end",
"title": ""
},
{
"docid": "1a774d81b83124bba8ea5306af237466",
"score": "0.5472221",
"text": "def dogs \n dogs = self.walks.map {|walk| walk.dog}\n dogs.uniq\n end",
"title": ""
},
{
"docid": "799d1771b8ac28561a76ded9f391e830",
"score": "0.54659176",
"text": "def i_hit(others, velocity); end",
"title": ""
},
{
"docid": "24c89c49b8b4364f684043dcf8d4ac80",
"score": "0.5459184",
"text": "def attacks(player)\n\t\tputs \"#{@name} attaque #{player.name} !\"\n\t\tdamage = compute_damage\n player.gets_damage(damage)\n \n\t\tif player.life_points > 0\n\t\tputs \"#{@name} lui inflige #{damage} points de dommage.\\n\\n\"\n\t\telse \n\t\t\tputs \"Oups, #{player.name} c'est fait décapité...\\n\\n\"\n end\n\n end",
"title": ""
},
{
"docid": "4eac9a888f8255945c5eda4662a4117a",
"score": "0.54457617",
"text": "def silly_adjective\n fetch('creature.bird.silly_adjectives')\n end",
"title": ""
},
{
"docid": "af502b688426d80737acba270c5e15d5",
"score": "0.54361707",
"text": "def chasing_squirrels(dogs)\n dogs.map! do |individual_dog|\n individual_dog[:position] += 5\n individual_dog\n end\n return dogs\nend",
"title": ""
},
{
"docid": "331391cfcd7d7e6f1ce4be80f38ea007",
"score": "0.54318786",
"text": "def attack(target)\n\n #check to see if there is any target\n if target == nil\n puts \"Invite some friends to play this awesome game.\".blue\n\n else\n #print fighting for the user\n\n puts Artii::Base.new.asciify \"Fight\"\n\n\n\n ###methods for determining probability of victory\n ###and damage to the opponent or current user#####\n\n #if the characters have the same attack power\n if self.power == target.power\n\n #if the player wins the battle\n if rand > 0.5\n\n #reduce the target's hp by 10\n target.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #see if the target is still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a greater attack power than that of the target\n elsif self.power > target.power\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand < (0.4 + ((self.power - target.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-5*(self.power - target.power))\n\n #print outcome of the battle\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n end\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-10)\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player has a lower attack power than that of the target\n else\n\n #if the player wins the battle\n #calculation based on distance between the attack powers\n #of the player and target\n if rand > (0.45 + ((target.power - self.power).to_f/4))\n\n #reduce hp of the target\n target.update_hp(-2*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Defeated #{target.name}\".green.on_light_blue.bold\n puts \"#{self.name} HP: #{self.hp}\"\n\n #check if target still alive\n if target.hp > 0\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n\n #if the player loses the battle\n #reduce the player's hp\n else\n self.update_hp(-3*(-self.power + target.power))\n\n #display outcome of the battle to the player\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n puts \"#{self.name} Has Lost Battle to #{target.name}\".black.on_light_red\n puts \"#{self.name} HP: #{self.hp}\"\n puts \"#{target.name} HP: #{target.hp}\"\n puts \"$$$$$$$$$$$$$$$$$$$$$$$$$$$\".blink\n end\n end\n end\n end",
"title": ""
},
{
"docid": "80aa0233d2b38b12e50aa540efad2eec",
"score": "0.5429816",
"text": "def attacks(attacked_player)\n # puts player1.name \n # print \"attacks\"\n # puts \"#{attacked_player}\"\n attacked_player.gets_damage(compute_damage)\n # puts \"He loses #{compute_damage} points\"\n end",
"title": ""
},
{
"docid": "e3ab71eee1ab4ef1feaa3b94b677299a",
"score": "0.54269826",
"text": "def fight(p1, p2)\n while p1.isAlive && p2.isAlive\n p1.hit(p2)\n p2.hit(p1)\n p1.wpnhit(p2)\n p2.wpnhit(p1)\n show_info(p1, p2)\nend\n\nif p1.isAlive\n puts \"#{p1.name} WON!!\"\nelsif p2.isAlive\n puts \"#{p2.name} WON!!\"\nelse\n puts \"TIE!!\"\nend\nend",
"title": ""
},
{
"docid": "1e767d79d780581ca5ca3aaa4df9e539",
"score": "0.5423231",
"text": "def make_damage(a_point)\n \tmsj = 'hit'\n\tship = ship_at(a_point)\n\tship.get_hit(a_point)\n\tif(ship.state() == 'sink')\n\t\tremove_to_the_fleet(ship)\n\t\tmsj = 'sink'\n\tend\n\tmsj\t\n end",
"title": ""
},
{
"docid": "71e1e38938a0476bb40de69b00fc7d64",
"score": "0.54112417",
"text": "def discardHiddenTreasure(t)\n \n end",
"title": ""
},
{
"docid": "e65cbb088edb0a2cdd20b0d41f495296",
"score": "0.5398105",
"text": "def victor\n return @attack_initiator if @attack_initiator.soldiers_alive.count > 0\n return @other_army if @other_army.soldiers_alive.count > 0\n end",
"title": ""
},
{
"docid": "ec439a72cb525d62a873de354cab7ed6",
"score": "0.5396537",
"text": "def on_player_walk\n for actor in members\n if actor.slip_damage?\n actor.hp -= 1 if actor.hp > 1 # Poison damage\n $game_map.screen.start_flash(Color.new(255,0,0,64), 4)\n end\n if actor.auto_hp_recover and actor.hp > 0\n actor.hp += 1 # HP auto recovery\n end\n end\n end",
"title": ""
},
{
"docid": "5f12163ff4a20c81c0a4aea8bce4cd90",
"score": "0.53958386",
"text": "def walk\n if @legs > 0\n @speed = @speed + (0.2 * @legs)\n else\n raise TypeError, \"This dog don't exist.\"\n end\n end",
"title": ""
},
{
"docid": "9db7da192bf94983c1cf9681e90fd95a",
"score": "0.5394369",
"text": "def slip_damage_effect\n # Set damage\n self.damage = self.maxhp / 10\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Subtract damage from HP\n self.hp -= self.damage\n # End Method\n return true\n end",
"title": ""
},
{
"docid": "f2a993413c5018d4e75df1d3781c84ba",
"score": "0.53892654",
"text": "def attacks(player)\r\n puts \"#{@name} attaque le joueur #{player.name}\"\r\n player.gets_damage(compute_damage)\r\n end",
"title": ""
},
{
"docid": "21dc392c994fb2fc34443761320f60bf",
"score": "0.5378938",
"text": "def get_best_side_to_the_bomb\n return false if !check_for_a_bomb\n @captive_unit = nil\n @enemy_unit = nil\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking? #Captive with bomb found\n if warrior.feel(warrior.direction_of(unit)).empty? or warrior.feel(warrior.direction_of(unit)).captive?\n puts \"Captive is accesible to the #{warrior.direction_of(unit)}\"\n return warrior.direction_of(unit)\n elsif warrior.feel(warrior.direction_of(unit)).enemy? or warrior.feel(warrior.direction_of(unit)).stairs?\n @enemy_unit = unit\n Directions.each do |dir|\n return dir if warrior.feel(dir).empty? and !warrior.feel(dir).wall? and\n !warrior.feel(dir).stairs? and dir != warrior.direction_of(@enemy_unit)\n !is_oposite_direction(dir, warrior.direction_of(unit)) \n end\n end\n end \n end\n return false\n end",
"title": ""
},
{
"docid": "22ba0b76001234459aad3036e697e4e7",
"score": "0.5375426",
"text": "def punch(player_name)\n\t # we change the life (hp) of our adversary, and we can because of the hp accessor ! \n\t player_name.hp = player_name.hp - 10\n\n\tend",
"title": ""
},
{
"docid": "15b73063798170df914c3aae2e8844d8",
"score": "0.53575265",
"text": "def soft_ace\n # softy method refactor for when an ace is played\nend",
"title": ""
},
{
"docid": "74d5b4b6e340a8f7d524e1884e322532",
"score": "0.53525484",
"text": "def spouse; end",
"title": ""
},
{
"docid": "7b18e541992917cdaebe26517fcfa82a",
"score": "0.5348804",
"text": "def sell_pets #Owner can sell all its pets, which make them nervous\n # fido = Dog.new(\"Fido\")\n # tabby = Cat.new(\"Tabby\")\n # nemo = Fish.new(\"Nemo\")\n # [fido, tabby, nemo].each {|o| o.mood = \"happy\" }\n # owner.pets = {\n # :dogs => [fido, Dog.new(\"Daisy\")],\n # :fishes => [nemo],\n # :cats => [Cat.new(\"Mittens\"), tabby]\n # }\n # owner.sell_pets\n # owner.pets.each {|type, pets| expect(pets.empty?).to eq(true) }\n # [fido, tabby, nemo].each { |o| expect(o.mood).to eq(\"nervous\") }\n pets.each do |type, animals|\n animals.each do |animal|\n animal.mood = \"nervous\"\n end\n animals.clear\n end\n end",
"title": ""
},
{
"docid": "b01f9a9d40a3eae399ea91e72e4dd9f0",
"score": "0.53480965",
"text": "def ranged_weapon; end",
"title": ""
},
{
"docid": "35c4c922e26d4381d95af7f16795ea2f",
"score": "0.5347123",
"text": "def create_Warrior(ant)\n ant.type = \"warrior\"\n\n #warrior ant kills enemy ants.\n def ant.kill(enemy)\n meadow = Meadow.instance\n cell = meadow.meadow[@x][@y]\n\n if enemy.anthill != @anthill && enemy != self\n\n if enemy.type == \"warrior\"\n enemy.anthill.numb_Warriors -= 1\n elsif enemy.type == \"builder\"\n enemy.anthill.numb_Builders -= 1\n else\n if enemy.anthill.numb_Foregers > 1\n enemy.anthill.numb_Foregers -= 1\n end\n end\n\n cell.ants.delete(enemy)\n @anthill.numb_antKills += 1\n\n end\n\n\n\n end\n\n #Warrior ant wins against enemy anthill and deletes them from the game.\n def ant.delete_Hill(enemyhill)\n if enemyhill != @anthill\n @anthill.numb_colonyKills += 1\n Meadow.instance.totalHills -= 1 \n enemyhill = nil #hill is destroyed.\n #puts \"#{@anthill.name} destroys #{}\"\n end\n end\n\n @numb_Warriors += 1\n ant\n end",
"title": ""
},
{
"docid": "cdd16ea92eae0350ca313fc870e10526",
"score": "0.53435415",
"text": "def who_we_are\r\n end",
"title": ""
},
{
"docid": "b59b0f75530c86c588c46c28c3f9a25e",
"score": "0.53354335",
"text": "def feedPet\n @pet.eat\n end",
"title": ""
},
{
"docid": "e27a04c207ebef6fcdda6cd166bfdc31",
"score": "0.53347576",
"text": "def continue\n\n inventory_with_leisure = expected_inventory.dup\n inventory_with_leisure[:leisure] = 1\n\n inventory_with_fishing = expected_inventory.dup\n # TODO: DRY up this logic with Person#catch_fish\n inventory_with_fishing[:fish] += @skills[:fish]\n\n #p '@'*88\n #p inventory_with_fishing\n #p rank_potential_inventory(inventory_with_fishing)\n #p '@'*88\n #p inventory_with_leisure\n #p rank_potential_inventory(inventory_with_leisure)\n #p '@'*88\n if rank_potential_inventory(inventory_with_fishing) < rank_potential_inventory(inventory_with_leisure)\n catch_fish\n @last_activity = :catch_fish\n else\n @last_activity = :leisure\n end\n\n\n eat # or starve\n end",
"title": ""
},
{
"docid": "990cd3f43b9170cd6224a3e37b013dfb",
"score": "0.5332045",
"text": "def give_pet_up_to_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets - 1\n @pets.delete(animal_name)\n shelter_instance_name.animals[animal_name] = animal_instance_name\n end",
"title": ""
},
{
"docid": "9e1628b1dd153f487f68d7dc232a76ec",
"score": "0.533119",
"text": "def troop; end",
"title": ""
},
{
"docid": "be6663271cf91a269cfdabf55a4bb4ca",
"score": "0.53293943",
"text": "def cheats\n win if @gilbert.x > 2995 && @gilbert.y == 846.5\n end",
"title": ""
},
{
"docid": "03de5832d27a617660d757cdd1ae0330",
"score": "0.5327979",
"text": "def its_like_chicago\n assert @voted[msg.sender] && msg.value >= 1.ether\n @voted[msg.sender] = false\nend",
"title": ""
},
{
"docid": "cad2c623cc17f0c55d04c793915f0515",
"score": "0.5327968",
"text": "def hit_stay\n\t@players.each_key {\n\t\t|player|\n\t\t\tplayer_hit_or_stay(player)\t\t\t\n\t}\n\nend",
"title": ""
},
{
"docid": "72ede5a6a508382dfb7db2476470b9f6",
"score": "0.53265506",
"text": "def poisonAllPokemon(event=nil)\n for pkmn in $Trainer.ablePokemonParty\n next if pkmn.hasType?(:POISON) || pkmn.hasType?(:STEEL) ||\n pkmn.hasAbility?(:COMATOSE) || pkmn.hasAbility?(:SHIELDSDOWN) || pkmn.hasAbility?(:IMMUNITY)\n pkmn.status!=0\n pkmn.status = 2\n pkmn.statusCount = 1\n end\nend",
"title": ""
},
{
"docid": "a9a686a8b5a6af755a987c0cdee1286b",
"score": "0.5325353",
"text": "def dogs\n Dog.all.select do |dog_instance|\n dog_instance.owner == self \n end\n end",
"title": ""
},
{
"docid": "9085d1c84a4b380173f15a67a571877e",
"score": "0.53244287",
"text": "def bark(visitor)\n puts \"My dog is barking at #{visitor}\"\n end",
"title": ""
},
{
"docid": "2cdd3b1a482b0524ee4b656bff401853",
"score": "0.5323237",
"text": "def humanplayer_attack_selected_bots(x)\n human_damage = @human_player.compute_damage\n @enemies[x].gets_damage(human_damage)\n puts \"#{@human_player.name} inflige #{human_damage} point(s) de dégât au bots #{x + 1}\" # #####\n if @enemies[x].life_points <= 0 \n puts \"- le bots #{@enemies[x].name} est mort\"\n kill_player(x)\n end\n #show_bots_state\n end",
"title": ""
},
{
"docid": "3c351c7bdc36efb256c3d430048e6b42",
"score": "0.5322233",
"text": "def attack_effect(attacker)\n # Clear critical flag\n self.critical = false\n # First hit detection\n hit_result = (rand(100) < attacker.hit)\n # If hit occurs\n if hit_result == true\n # Calculate basic damage\n atk = [attacker.atk - self.pdef / 2, 0].max\n self.damage = atk * (20 + attacker.str) / 20\n # Element correction\n self.damage *= elements_correct(attacker.element_set)\n self.damage /= 100\n # If damage value is strictly positive\n if self.damage > 0\n # Critical correction\n if rand(100) < 4 * attacker.dex / self.agi\n self.damage *= 2\n self.critical = true\n end\n # Guard correction\n if self.guarding?\n self.damage /= 2\n end\n end\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Second hit detection\n eva = 8 * self.agi / attacker.dex + self.eva\n hit = self.damage < 0 ? 100 : 100 - eva\n hit = self.cant_evade? ? 100 : hit\n hit_result = (rand(100) < hit)\n end\n # If hit occurs\n if hit_result == true\n # State Removed by Shock\n remove_states_shock\n # Substract damage from HP\n self.hp -= self.damage\n # State change\n @state_changed = false\n states_plus(attacker.plus_state_set)\n states_minus(attacker.minus_state_set)\n # When missing\n else\n # Set damage to \"Miss\"\n self.damage = \"Miss\"\n # Clear critical flag\n self.critical = false\n end\n # End Method\n return true\n end",
"title": ""
},
{
"docid": "d98a3852cd4238ee39091ae74dee5388",
"score": "0.530918",
"text": "def dog_name\n end",
"title": ""
},
{
"docid": "b66a9037c68e3b6f677f562ba16d5f4e",
"score": "0.5308289",
"text": "def dogs\n Dog.all.select {|d| d.owner == self}\n end",
"title": ""
},
{
"docid": "cdd48e993d9fc36406e93b8c844a4fd6",
"score": "0.53043073",
"text": "def spell; end",
"title": ""
},
{
"docid": "54277890c1c509695a4da56d790e0fa5",
"score": "0.5296365",
"text": "def is_shooting_target(look)\n @target = false\n @captive_infront = false\n look.each do |element|\n if element.to_s == \"Thick Sludge\"\n @target = false\n break\n elsif element.to_s == \"Wizard\" or element.to_s == \"Archer\"\n # puts \"We found a target to shoot for...\"\n @target = true\n break\n elsif element.to_s == \"Captive\"\n @captive_infront = true\n break\n end\n end\n return @target && !@captive_infront\n end",
"title": ""
},
{
"docid": "109cab5cff9f4f14f28509487bf2e333",
"score": "0.52958643",
"text": "def resolve_possessive_pronoun(target)\n if target == self\n return \"your\".freeze\n end\n if can_see?(target)\n return target.possessive_pronoun\n else\n return target.indefinite_possessive_pronoun\n end\n end",
"title": ""
},
{
"docid": "bc23326417f194d3ceaad9c43a632111",
"score": "0.5295682",
"text": "def enchantment; end",
"title": ""
}
] |
864d7d11376af4c82d5899b9c19b9c51
|
Wrap the response or error, or raise an exception if configured
|
[
{
"docid": "8c1c2f09fb74b45a0fe16f0d1b56fbd7",
"score": "0.6342452",
"text": "def request(&block)\n Johac::Response.new(yield)\n rescue => e\n @config.raise_exceptions ? (raise e) : Johac::Response.new(e)\n end",
"title": ""
}
] |
[
{
"docid": "07e6bdb873ae01254583aeecaf1ff78b",
"score": "0.7174023",
"text": "def wrap_response_or_fail_unless_success!(response)\n case response.status\n when 200...300\n Response.new(response).tap do |wrapped_response|\n fail UnexpectedResponseError, response.body unless wrapped_response.valid?\n end\n when 400...500\n fail ClientError.new response.body, response\n when 500...600\n fail ServerError.new response.body, response\n else\n fail Error, \"Response was neither a success, nor within http status 400...600. Response was: '#{response.inspect}'.\"\n end\n end",
"title": ""
},
{
"docid": "ae2221d19429b67c3e99d6109be6c2e8",
"score": "0.70736074",
"text": "def wrap_soap_errors\n response = yield\n handle_message_for_response(response)\n response.body\n rescue => error\n handle_error(error)\n end",
"title": ""
},
{
"docid": "3c54b69085f86175f604956ec757117f",
"score": "0.68967015",
"text": "def wrap_error\n begin\n Success(yield)\n rescue Ebay::RequestError => e\n Failure(e)\n end\n end",
"title": ""
},
{
"docid": "f0e303a923cf365f94286fd56f02cc8a",
"score": "0.6836803",
"text": "def wrap(response)\n raise_throttling_error(response) if response.status == 429\n return failure(response) if response.status >= 300\n\n catch_upload_errors(response)\n success(response)\n end",
"title": ""
},
{
"docid": "847d8c4e7341d6493a731e5979b62335",
"score": "0.6821345",
"text": "def raise_with_response( response )\n raise Error.new( Error::UNKNOWN, 'Unknown error' )\n end",
"title": ""
},
{
"docid": "17dab32f2bd8cc7e1536702c3c5876ac",
"score": "0.67930615",
"text": "def respond_or_raise(error)\n status = nil\n\n begin\n raise error\n rescue ActiveRecord::RecordNotFound\n status = :not_found\n rescue FetchLimitExceededError\n status = :forbidden\n rescue ActiveRecord::RecordInvalid, DetailedArgumentError\n status = :bad_request\n rescue ActionView::Template::Error\n # Any errors from within a template are wrapped in this type.\n # Dispatch based on the unwrapped type.\n # If we fail to dispatch, keep the ActionView::Template::Error object.\n begin\n return respond_or_raise(error.original_exception)\n rescue\n raise error\n end\n end\n\n respond_with_error(error, :status => status)\n end",
"title": ""
},
{
"docid": "a4e7fcb19ee063917c05e13ec0efaf1f",
"score": "0.668423",
"text": "def maybe_error_response(&block)\n begin\n yield\n rescue RestClient::RequestTimeout => ex\n raise ex\n rescue RestClient::Exception => ex\n ex.response\n end\n end",
"title": ""
},
{
"docid": "dd9e55170ac0e2437f9a00845842771a",
"score": "0.6636583",
"text": "def handle_response(response)\n return super(response)\n rescue ActiveResource::ClientError => exc\n begin\n # ugly code to insert the error_message into response\n error_message = \"#{format.decode response.body}\"\n if not error_message.nil? or error_message == \"\"\n exc.response.instance_eval do ||\n @message = error_message\n end\n end\n ensure\n raise exc\n end\n end",
"title": ""
},
{
"docid": "75bf6a345bf9bbd0a5c12dce5bf43a0b",
"score": "0.6618023",
"text": "def wrapped_exception; end",
"title": ""
},
{
"docid": "e6dfa51a5a9f1c5589adbc1d7c958ebe",
"score": "0.659598",
"text": "def method_missing(name, *args, &block)\n if response && response.respond_to?(name)\n response.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n rescue Rack::Test::Error # no response yet\n super(name, *args, &block)\n end",
"title": ""
},
{
"docid": "e6dfa51a5a9f1c5589adbc1d7c958ebe",
"score": "0.659598",
"text": "def method_missing(name, *args, &block)\n if response && response.respond_to?(name)\n response.send(name, *args, &block)\n else\n super(name, *args, &block)\n end\n rescue Rack::Test::Error # no response yet\n super(name, *args, &block)\n end",
"title": ""
},
{
"docid": "421e4bf24fa168d4fed90b95f03f112e",
"score": "0.6594484",
"text": "def handle_failure(res)\n case\n when res.respond_to?(:to_str)\n @response.body = [res]\n when res.respond_to?(:to_ary)\n res = res.to_ary\n if Fixnum === res.first\n if res.length == 3\n @response.status, headers, body = res\n @response.body = body if body\n headers.each { |k, v| @response.headers[k] = v } if headers\n elsif res.length == 2\n @response.status = res.first\n @response.body = res.last\n else\n raise TypeError, \"#{res.inspect} not supported\"\n end\n else\n @response.body = res\n end\n when res.respond_to?(:each)\n @response.body = res\n when (100...599) === res\n @response.status = res\n end\n\n if (new_body = error_block!(@response.status))\n @response.body = new_body\n end\n body @response.body\n end",
"title": ""
},
{
"docid": "9d2e035d94cf8674b32d8bfae1c09757",
"score": "0.65911466",
"text": "def fixup_response( response )\n\t\tresponse = super\n\n\t\t# Ensure the response is acceptable; if it isn't respond with the appropriate\n\t\t# status.\n\t\tunless response.acceptable?\n\t\t\tbody = self.make_not_acceptable_body( response )\n\t\t\tfinish_with( HTTP::NOT_ACCEPTABLE, body ) # throw\n\t\tend\n\n\t\treturn response\n\tend",
"title": ""
},
{
"docid": "2703f334b9589b2eab19c5289842b368",
"score": "0.65582174",
"text": "def safe\n yield\n rescue RestClient::ExceptionWithResponse => err\n return err.response\n end",
"title": ""
},
{
"docid": "2703f334b9589b2eab19c5289842b368",
"score": "0.65582174",
"text": "def safe\n yield\n rescue RestClient::ExceptionWithResponse => err\n return err.response\n end",
"title": ""
},
{
"docid": "8f0c322c6b6c20e9081756795fa31530",
"score": "0.6515901",
"text": "def safe\n yield\n rescue RestClient::ExceptionWithResponse => e\n e.response\n end",
"title": ""
},
{
"docid": "5a60242ce902ced60b0f2f868b58f484",
"score": "0.6493915",
"text": "def wrap_response(env, response)\n return response unless should_wrap_response?(env, response)\n rs = {\n :success => is_successful_http_status_code?(response[0]),\n :responded_at => Time.now.utc,\n :version => parse_api_version(env),\n :location => request_path(env),\n :body => create_payload(response[2])\n }\n response[2] = [ rs.to_json ]\n\n # Let Rack compute the content-length\n #response[1][\"Content-Length\"] = response[2][0].length.to_s\n response[1].delete(\"Content-Length\")\n # TODO: support an option to allow user to emit original status codes\n \n # if there is an error, then respond with a 200\n # so browser promises return as success responses\n # instead of errors\n response[0] = 200 unless rs[:success]\n response\n end",
"title": ""
},
{
"docid": "f2b96bb0802c7f706a9a28a94738ab42",
"score": "0.6474823",
"text": "def wrap_response(result)\n # failure is the custom prop we add in the ResponseResultMiddleware\n return Failure(result.env[:failure]) if result&.env&.[](:failure)\n\n return Failure(result) unless result.success?\n\n Success(result)\n end",
"title": ""
},
{
"docid": "51e8f0fb8ec317ae49ad8f4fa06ed065",
"score": "0.64269197",
"text": "def safe(response)\n result = yield\n response.body = result\n rescue => ex\n raise unless catch_all?\n response.status = 400\n response.body = { \"error\" => \"#{ex.class}: #{ex.message}\" }\n end",
"title": ""
},
{
"docid": "b2b1615e1de700b5b1cb46ac4795194c",
"score": "0.6416618",
"text": "def handle_response(response) # :nodoc:\n case response.code\n when 400\n raise BadRequest.new response.parsed_response\n when 401\n raise Unauthorized.new\n when 403\n raise Forbidden.new response.parsed_response\n when 404\n raise NotFound.new response.body\n when 400...500\n raise ClientError.new response.parsed_response\n when 500...600\n raise ServerError.new response.body\n else\n response\n end\n end",
"title": ""
},
{
"docid": "c16924a310b9e315d269ce8cde4bd7da",
"score": "0.63649666",
"text": "def wrap(method, additional_headers={}, &block)\n puts \"#{@url} wrap(#{method})\" if @@debug\n response = maybe_error_response do\n send(method, additional_headers, &block)\n end\n return parsed_response(response)\n end",
"title": ""
},
{
"docid": "b361838d14a83ebbe053bc1ee11f4c84",
"score": "0.63626117",
"text": "def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 410\n raise(ResourceGone.new(response))\n when 412\n raise(PreconditionFailed.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 429\n raise(TooManyRequests.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "ac367cbd878e71168e610909677603c3",
"score": "0.63458157",
"text": "def with_error_trap\n begin\n obj=yield\n obj[:success]=true\n obj\n rescue\n obj={:success=>false, :error=>$!.to_s}\n end\n\n respond_to do |fmt|\n fmt.json { render :json=>obj }\n end\n end",
"title": ""
},
{
"docid": "2a4034129d2906e2442015e26ce377a9",
"score": "0.63344264",
"text": "def handle_response(response)\n case response.code.to_i\n when 200...299\n response\n when 300..399\n raise Redirection.new(@request, response)\n when 400\n raise BadRequest.new(@request, response)\n when 401\n raise UnauthorizedAccess.new(@request, response)\n when 403\n raise ForbiddenAccess.new(@request, response)\n when 404\n raise ResourceNotFound.new(@request, response)\n when 405\n raise MethodNotAllowed.new(@request, response)\n when 409\n raise ResourceConflict.new(@request, response)\n when 410\n raise ResourceGone.new(@request, response)\n when 422\n raise ResourceInvalid.new(@request, response)\n when 401...500\n raise ClientError.new(@request, response)\n when 500...600\n raise ServerError.new(@request, response)\n else\n raise ResponseError.new(\n @request, response, \"Unknown response code: #{response.code}\"\n )\n end\n end",
"title": ""
},
{
"docid": "219bbac7c84bf15a090c9c2443b4870f",
"score": "0.63112104",
"text": "def handle_response(response)\n case response.code.to_i\n when 301,302\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "219bbac7c84bf15a090c9c2443b4870f",
"score": "0.63112104",
"text": "def handle_response(response)\n case response.code.to_i\n when 301,302\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "918c2a02f4b2300ede56eee097747d90",
"score": "0.6302666",
"text": "def return_error_or_body(response)\n if response.status / 100 == 2\n response.body\n else\n raise Checkdin::APIError.new(response.status, response.body)\n end\n end",
"title": ""
},
{
"docid": "81902c84a8ab9f01244fca4f368e4657",
"score": "0.63020205",
"text": "def handle_response(response)\n unless response.valid?\n if response.status >= 400 && response.status < 500\n raise ArgumentError.new(\"Invalid request: #{response.body}\")\n elsif response.status >= 500 && response.status < 600\n raise RuntimeError.new(response.body)\n else\n raise RuntimeError.new(\"Unaccepted http code: #{response.status}\")\n end\n end\n\n response\n end",
"title": ""
},
{
"docid": "86c073149e7e7fb468e2d42f841bda92",
"score": "0.6299558",
"text": "def handle_response(response, request, result, &block)\n case response.code\n when 200..207\n response.return!(request, result, &block)\n when 301..307\n response.follow_redirection(request, result, &block)\n when 400\n raise BadRequestError.new(result.body)\n when 401\n raise AuthenticationError.new(result.body)\n when 404\n raise NotFoundError.new(result.body)\n when 409\n raise ConflictError.new(result.body)\n when 422\n raise Error.new(result.body)\n when 402..408,410..421,423..499\n response.return!(request, result, &block)\n when 500..599\n raise Error.new(result.body)\n else\n response.return!(request, result, &block)\n end\n end",
"title": ""
},
{
"docid": "9506317efc9a52fc485833229d3d33de",
"score": "0.62895626",
"text": "def handle_response(response)\n case response.code.to_i\n when 301,302\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 410\n raise(ResourceGone.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "e51b1404d6ab667a4c9d12d768089817",
"score": "0.6283502",
"text": "def handle_response(response)\n case response.code.to_i\n when 200...400\n response\n when 404\n raise(ResourceNotFound.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "f6032ff6a4a52e0256221003c1636d67",
"score": "0.627619",
"text": "def response\n @response ||= send_http_request\n rescue *server_errors => e\n @response ||= e\n end",
"title": ""
},
{
"docid": "2fe1c6fc56c6fc91bb75e98ed47fe96b",
"score": "0.6274105",
"text": "def render_for_api_request(content_type, wrapper)\n response = nil\n\n if RescueRegistry.handles_exception?(wrapper.exception)\n # Ideally `render_for_api_request` would be split up so we could avoid some duplication in RescueRegistry\n begin\n response = RescueRegistry.response_for_debugging(content_type, wrapper.exception, traces: wrapper.traces)\n rescue Exception => e\n # Replace the original exception (still available via `cause`) and let it get handled with default handlers\n wrapper = ActionDispatch::ExceptionWrapper.new(wrapper.backtrace_cleaner, e)\n end\n end\n\n if response\n render(*response)\n else\n # One of the following is true:\n # - No handler for the exception\n # - No response for content_type\n # - An exception while generating the response\n # In any case, we go with the default here.\n super(content_type, wrapper)\n end\n end",
"title": ""
},
{
"docid": "6909461e4ac49913ceb449bd145eff61",
"score": "0.62672234",
"text": "def handle_response(response)\n case response.status\n when 400\n raise Error, \"Your request was malformed. #{response.body['error']}\"\n when 401\n raise Error, \"You did not supply valid authentication credentials. #{response.body['error']}\"\n when 403\n raise Error, \"You are not allowed to perform that action. #{response.body['error']}\"\n when 404\n raise Error, \"No results were found for your request. #{response.body['error']}\"\n when 429\n raise Error, \"Your request exceeded the API rate limit. #{response.body['error']}\"\n when 500\n raise Error, \"We were unable to perform the request due to server-side problems. #{response.body['error']}\"\n when 503\n raise Error,\n \"The server is currently unable to handle the request due to a temporary overloading or maintenance of the\n server. #{response.body['error']}\"\n end\n\n response\n end",
"title": ""
},
{
"docid": "36ee10b8c566283aa9221771a2aab5d4",
"score": "0.62612814",
"text": "def invoke\n res = catch(:halt) { yield }\n\n if String === res or Fixnum === res\n res = [res]\n end\n if Array === res and Fixnum === res.first\n @response.status = res.shift\n @response.body = res.pop if res.size > 0\n @response.headers.merge!(*res) if res.size > 0\n elsif res.respond_to? :each\n @response.body = res\n end\n end",
"title": ""
},
{
"docid": "9b570b5795b549402962f5a1f4ebd22a",
"score": "0.6256859",
"text": "def handle_response(response)\n case response.status\n when 400\n raise Error, \"Your request was malformed. #{response.body['error']}\"\n when 401\n raise Error, \"You did not supply valid authentication credentials. #{response.body['error']}\"\n when 403\n raise Error, \"You are not allowed to perform that action. #{response.body['error']}\"\n when 404\n raise Error, \"No results were found for your request. #{response.body['error']}\"\n when 429\n raise Error, \"Your request exceeded the API rate limit. #{response.body['error']}\"\n when 500\n raise Error, \"We were unable to perform the request due to server-side problems. #{response.body['error']}\"\n when 503\n raise Error, \"You have been rate limited for sending more requests per second. #{response.body['error']}\"\n end\n\n response\n end",
"title": ""
},
{
"docid": "72582c4c61e4ad6963a8147e05700522",
"score": "0.6246784",
"text": "def handle_response(response)\n case response.code.to_i\n when 301, 302 then raise(Redirection.new(response))\n when 200...400 then response\n when 400...500 then raise(ClientError.new(response))\n when 500...600 then raise(ServerError.new(response))\n else raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "80efe81976e3adef9d218f2e7305a73a",
"score": "0.62446177",
"text": "def check_response(res, options)\n if res.status >= 200 && res.status <= 299\n if(options[:mashify] && res.body.instance_of?(Hash))\n Hashie::Mash.new(res.body)\n else\n res.body\n end\n elsif [404, 410].include? res.status\n err_str = \"Error processing request: (#{res.status})! #{res.env[:method]} URL: #{res.env[:url]}\"\n err_str << \"\\n Resp Body: #{res.body}\"\n raise RequestError::NotFound.new(res), err_str\n else\n err_str = \"Error processing request (#{res.status})! #{res.env[:method]} URL: #{res.env[:url]}\"\n err_str << \"\\n Resp Body: #{res.body}\"\n raise RequestError.new(res), err_str\n end\n end",
"title": ""
},
{
"docid": "60b9e5477bdb2c4cd6b32c98b5522c5b",
"score": "0.6242059",
"text": "def handle_response(response) # :nodoc:\n case response.status\n when 400\n raise BadRequest.new response.parsed\n when 401\n raise Unauthorized.new\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new response.parsed\n when 500...600\n raise ServerError.new\n else\n case response.body\n when ''\n true\n when is_a?(Integer)\n response.body\n else\n response.parsed\n end\n end\n end",
"title": ""
},
{
"docid": "b559ba1882603b6d1d644a91faa5e42a",
"score": "0.6241068",
"text": "def invoke(&block)\n res = catch(:halt) { instance_eval(&block) }\n return if res.nil?\n\n case\n when res.respond_to?(:to_str)\n @response.body = [res]\n when res.respond_to?(:to_ary)\n res = res.to_ary\n if Fixnum === res.first\n if res.length == 3\n @response.status, headers, body = res\n @response.body = body if body\n headers.each { |k, v| @response.headers[k] = v } if headers\n elsif res.length == 2\n @response.status = res.first\n @response.body = res.last\n else\n raise TypeError, \"#{res.inspect} not supported\"\n end\n else\n @response.body = res\n end\n when res.respond_to?(:each)\n @response.body = res\n when (100...599) === res\n @response.status = res\n end\n\n res\n end",
"title": ""
},
{
"docid": "626848f9164cb838a41225e04db507c2",
"score": "0.62273175",
"text": "def failure_response(response)\n response\n end",
"title": ""
},
{
"docid": "e3d057db3128f71c1c261e9276be0f24",
"score": "0.6222567",
"text": "def method_missing(name, *args, &block)\n if response && response.respond_to?(name)\n response.send(name, *args, &block)\n else\n super\n end\n rescue Rack::Test::Error\n super\n end",
"title": ""
},
{
"docid": "84235b8e4020e366b94668daa04eefd7",
"score": "0.62055117",
"text": "def bad_response(response)\n if response.class == HTTParty::Response\n raise ResponseError, response\n end\n raise StandardError, \"Unknown error\"\n end",
"title": ""
},
{
"docid": "cfccd00fff330eed82cafa51c6b594de",
"score": "0.6204511",
"text": "def handle_response(response)\n case response.code\n when 200..299\n response\n else\n if response.request.format == :json\n raise ServiceError.new(\n code: response['error']['code'],\n message: response['error']['message']\n )\n else\n raise NetError.new(\n code: response.code,\n message: response.response.message\n )\n end\n end\n end",
"title": ""
},
{
"docid": "e0ac0596d279f63a181d6e9d8797caaa",
"score": "0.6172027",
"text": "def response(env)\n env.logger.error('You need to implement response')\n raise Goliath::Validation::InternalServerError.new('No response implemented')\n end",
"title": ""
},
{
"docid": "4d0a76e680e2e6d49f66a52a7e4a041e",
"score": "0.61524796",
"text": "def error!(body, code = 500)\n response.status = code\n response.body = body unless body.nil?\n raise The_App.const_get(\"HTTP_#{code}\")\n end",
"title": ""
},
{
"docid": "5ac8d1b027d434b2be8b35360efbfccc",
"score": "0.6144432",
"text": "def wrap(key, request, response)\n\t\t\t\t\tif request.head? and body = response.body\n\t\t\t\t\t\tunless body.empty?\n\t\t\t\t\t\t\tConsole.logger.warn(self) {\"HEAD request resulted in non-empty body!\"}\n\n\t\t\t\t\t\t\treturn response\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tunless cacheable_request?(request)\n\t\t\t\t\t\tConsole.logger.debug(self) {\"Cannot cache request!\"}\n\t\t\t\t\t\treturn response\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tunless cacheable_response?(response)\n\t\t\t\t\t\tConsole.logger.debug(self) {\"Cannot cache response!\"}\n\t\t\t\t\t\treturn response\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\treturn Body.wrap(response) do |response, body|\n\t\t\t\t\t\tif proceed_with_response_cache?(response)\n\t\t\t\t\t\t\tkey ||= self.key(request)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tConsole.logger.debug(self, key: key) {\"Updating miss!\"}\n\t\t\t\t\t\t\t@store.insert(key, request, Response.new(response, body))\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend",
"title": ""
},
{
"docid": "9bc7b335670bda5df5ba21213f707533",
"score": "0.6139886",
"text": "def raise_exception_or_error_response(exception, status_code)\n if raise_exceptions?\n raise exception\n else\n bail status_code, exception.message\n end\n end",
"title": ""
},
{
"docid": "c6e5780fbab6cc9fbbada865360a5bab",
"score": "0.6138961",
"text": "def handle_response(response)\n case response.code.to_i\n when 301,302\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 410\n raise(ResourceGone.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "e3a8ca16e5c7c2d3ea24b5ec848e90c4",
"score": "0.61388594",
"text": "def api_unwrap(response, request={})\n data = JSON.parse(response.body) rescue nil\n if [200, 201, 202].include? response.response.code.to_i\n raise StandardError.new('Please update your Teambox') unless response.has_key?('type')\n if data['type'] == 'List'\n ResultSet.new(self, request, data['objects'], data['references'])\n else\n Teambox.create_model(data['type'], data, ResultSet.new(self, request, [], []))\n end\n else\n error_list = data ? data['errors'] : {'type' => 'UnknownError', 'message' => data}\n error_list['type'] = error_list['type'][0] if error_list['type'].is_a? Array\n error_list['message'] = error_list['message'][0] if error_list['message'].is_a? Array\n raise APIError.new(response.response.code, error_list)\n end\n end",
"title": ""
},
{
"docid": "18d7a2fabcbf28e58e118c2edb22abb9",
"score": "0.61338747",
"text": "def handle_request_error_or_return_result\n begin\n req = EM::HttpRequest.new(url, @request_opts).aget pioneer.http_opts\n if pioneer.headers\n req.headers{\n pioneer.headers.call(req)\n }\n end\n @response = EM::Synchrony.sync req\n rescue => e\n @error = \"Request totaly failed. Url: #{url}, error: #{e.message}\"\n pioneer.logger.fatal(@error)\n if pioneer.respond_to? :if_request_error\n return pioneer.if_request_error(self)\n else\n raise Pioneer::HttpRequestError, @error\n end\n end\n handle_response_error_or_return_result\n end",
"title": ""
},
{
"docid": "ef2bc66d686e4e70ff16ed0b94f2a724",
"score": "0.6120568",
"text": "def invoke\n res = catch(:halt) { yield }\n res = [res] if Integer === res or String === res\n if Array === res and Integer === res.first\n res = res.dup\n status(res.shift)\n body(res.pop)\n headers(*res)\n elsif res.respond_to? :each\n body res\n end\n nil # avoid double setting the same response tuple twice\n end",
"title": ""
},
{
"docid": "3b4f1a9d5d7b1bae89cde97d18a45f1e",
"score": "0.6119698",
"text": "def invoke\n res = catch(:halt) { yield }\n res = [res] if Fixnum === res || String === res\n if Array === res && Fixnum === res.first\n res = res.dup\n status(res.shift)\n body(res.pop)\n headers(*res)\n elsif res.respond_to? :each\n body res\n end\n nil # avoid double setting the same response tuple twice\n end",
"title": ""
},
{
"docid": "3c5eb4d347f090bd88a3471dedb9c233",
"score": "0.61154133",
"text": "def failsafe_response(fallback_output, status, originating_exception = nil)\n yield\n rescue Exception => exception\n begin\n log_failsafe_exception(status, originating_exception || exception)\n body = failsafe_response_body(status)\n fallback_output.write \"Status: #{status}\\r\\nContent-Type: text/html\\r\\n\\r\\n#{body}\"\n nil\n rescue Exception => failsafe_error # Logger or IO errors\n $stderr.puts \"Error during failsafe response: #{failsafe_error}\"\n $stderr.puts \"(originally #{originating_exception})\" if originating_exception\n end\n end",
"title": ""
},
{
"docid": "6eefe003a9f1ccaea4eb55fcdfe9a122",
"score": "0.6111462",
"text": "def call\n if !has_redirection_or_error_status? && has_link_for_current_action? && has_link_of_media_type_json?\n case\n when has_body? && !has_json_content_type?\n raise InvalidResponseContentType\n when !valid?\n raise InvalidResponseType, validator.errors\n end\n end\n end",
"title": ""
},
{
"docid": "3fd3261440af479aeea3fb357df971e4",
"score": "0.610778",
"text": "def bad_response(response, _params = {})\n if response.class == HTTParty::Response\n raise HTTParty::ResponseError, response\n end\n\n raise StandardError, 'Unknown error'\n end",
"title": ""
},
{
"docid": "b182f1b792270c0b0a3b1ff869ce51d8",
"score": "0.6107686",
"text": "def wrap_reply(options = DEFAULT_OPTIONS)\n if options[:require_tenant] && Hippo::Tenant.current.nil?\n return json_reply(\n { success: false, message: \"invalid address\",\n errors: { address: 'invalid' } }\n )\n end\n response = { success: false, message: \"No response was generated\" }\n log_request\n if options[:with_transaction]\n Hippo::Model.transaction do\n response = yield || {success: false}\n # This is quite possibly a horrible idea.\n # It enables test specs to reset the db state after a request\n if !Hippo.env.production? && request.env['HTTP_X_ROLLBACK_AFTER_REQUEST']\n Hippo::Model.connection.rollback_db_transaction\n end\n end\n else\n response = yield\n end\n if false == response[:success]\n status(406)\n end\n json_reply response\n end",
"title": ""
},
{
"docid": "7e6fd965936ef51d025c3aa0dd5db781",
"score": "0.6106076",
"text": "def return_error_or_body(response, response_body)\n response.status == 200 ? response_body : response.body\n end",
"title": ""
},
{
"docid": "f1c64d96b5d75f9a32f557b583c72adf",
"score": "0.6105683",
"text": "def check_for_special_response_errors(response)\n end",
"title": ""
},
{
"docid": "e2a24bb4ab7f35933971a2c2d0f74731",
"score": "0.61029446",
"text": "def check_response!(response)\n unless response_ok?(response)\n raise Southwest::RequestError, \"There was an error making the request. It returned a status of #{status(response)}. Response:\\n#{response}\"\n end\n end",
"title": ""
},
{
"docid": "5b755945ebb9c801e1190285081d0de6",
"score": "0.60995275",
"text": "def raise_error_or_return_true(response)\n response.is_a?(RuntimeError) ? raise(response) : true\n end",
"title": ""
},
{
"docid": "29f2ce648cd7d71a34aabd365eb123ab",
"score": "0.6097962",
"text": "def request(body)\n response = clean_response(super)\n \n if success?(response)\n response\n else\n raise Error.new(body, response)\n end\n end",
"title": ""
},
{
"docid": "8cb60b245f2ccb50ae090136b5f2ecd7",
"score": "0.60864496",
"text": "def handle_response(res)\n json = JSON.parse(res.body)\n case res\n when Net::HTTPOK\n json\n else\n error = (HTTP_CODE_TO_ERRORS_MAP[res.code] || RequestError).new(json[\"errorMessage\"])\n error.business_code = json[\"code\"]\n raise error\n end\n end",
"title": ""
},
{
"docid": "26f92424240355b0da859bb99581a3fb",
"score": "0.6079288",
"text": "def validate_response( response )\n return response if response and response.code == \"200\"\n \n error_message = response.body rescue nil\n raise ApiOperationError.new( error_message )\n end",
"title": ""
},
{
"docid": "a307f701c132fe90b504525408957b5c",
"score": "0.60774225",
"text": "def check_and_wrap_response(&rest_method_func)\n response = rest_method_func.call\n \n if Response::ErrorHandler.check_for_session_expiried(response)\n # re-logging user and repeating request\n OsUtil.print_warning(\"Session expired: re-establishing session & re-trying request ...\")\n @cookies = Session.re_initialize\n response = rest_method_func.call\n end\n \n response_obj = Response.new(response)\n \n # queue messages from server to be displayed later\n #TODO: DTK-2554: put in processing of messages Shell::MessageQueue.process_response(response_obj)\n response_obj\n end",
"title": ""
},
{
"docid": "b6b5a48be338e252c01d4ae557cb9110",
"score": "0.6066923",
"text": "def execute_with_rescues\n Response.from_faraday(yield)\n rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e\n raise ConnectionError, e.message\n rescue Faraday::ClientError => e\n response = Response.from_hash(e.response)\n raise APIError.new(response[:message], response: response)\n end",
"title": ""
},
{
"docid": "e79e592e0d2cb408267a4ac31033963c",
"score": "0.6061212",
"text": "def exc_msg_and_response(exc, response = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "9ed50fc9deabe4d9d06f97a9597ecaf8",
"score": "0.60585475",
"text": "def fail_or_return_response_body(code, body, headers)\n error = error(code, body, headers)\n fail(error) if error\n if @request_method == :patch || @request_method == :delete\n true\n else\n symbolize_keys(body.parse)\n end\n end",
"title": ""
},
{
"docid": "9a68b5f4145b5885207b3836fe430a1b",
"score": "0.6035444",
"text": "def wrap_response(response)\n\t\t\t\tif body = response.body\n\t\t\t\t\tresponse.body = Parser.new(body)\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "80c95cb784c91160b6403b81275e661b",
"score": "0.60349447",
"text": "def render_bad_request\n @response = Sana::ResponseHelper.bad_request\n end",
"title": ""
},
{
"docid": "833c74fe382fb6e4719b76e28ba0793d",
"score": "0.60296655",
"text": "def invoke(&block) #:nodoc:\n res = super\n case\n when res.kind_of?(Symbol)\n sinatra_warn \"Invoking the :#{res} helper by returning a Symbol is deprecated;\",\n \"call the helper directly instead.\"\n @response.body = __send__(res)\n when res.respond_to?(:to_result)\n sinatra_warn \"The to_result convention is deprecated.\"\n @response.body = res.to_result(self)\n end\n res\n end",
"title": ""
},
{
"docid": "d44c88be35dac38e6e4b933da05af533",
"score": "0.60294497",
"text": "def handle_response_error_or_return_result\n if response.error\n @error = \"Response for #{url} get an error: #{response.error}\"\n pioneer.logger.error(@error)\n if pioneer.respond_to? :if_response_error\n return pioneer.if_response_error(self)\n else\n raise Pioneer::HttpResponseError, error\n end\n end\n handle_status_or_return_result\n end",
"title": ""
},
{
"docid": "897343ac179608bfc96a98742f42440b",
"score": "0.6027099",
"text": "def handle_response(response, opts = {})\n case response.code\n when 200..207\n if opts[:raw]\n response.body\n else\n decode_response_body(response.body)\n end\n when 401\n raise QTest::AuthorizationError, response.body\n else\n raise QTest::Error, response.body\n end\n end",
"title": ""
},
{
"docid": "6ffafe8aa34c857e2f2c54432ffb2cf0",
"score": "0.6026665",
"text": "def handle(response, resource = {})\n @response = response\n\n raise if resource.nil?\n\n case response.code\n when 200..299\n success(response, resource)\n when 400\n bad_request\n when 404\n not_found\n when 403\n unauthorized\n when 422\n unprocessable_entity\n when 424\n failed_dependency\n when 500..599\n server_error\n else\n raise Trusona::RequestError, readable_error\n end\n end",
"title": ""
},
{
"docid": "a3ce19aaaa46e073100b4c9934f4f911",
"score": "0.6024316",
"text": "def wrapper_for_route(route)\n self.response_wrappers[route] || Decamp::Response::Generic\n end",
"title": ""
},
{
"docid": "10fa2a82f3969e832673d841e2527c58",
"score": "0.6007911",
"text": "def error_response(error = {})\n status = error[:status] || options[:default_status]\n message = error[:message] || options[:default_message]\n headers = { Grape::Http::Headers::CONTENT_TYPE => content_type }\n headers.merge!(error[:headers]) if error[:headers].is_a?(Hash)\n backtrace = error[:backtrace] || error[:original_exception]&.backtrace || []\n original_exception = error.is_a?(Exception) ? error : error[:original_exception] || nil\n rack_response(format_message(message, backtrace, original_exception), status, headers)\n end",
"title": ""
},
{
"docid": "506c3745404581fd1b004ee2275798f2",
"score": "0.6001384",
"text": "def response\n Response.new(self).render\n rescue TemplateNotFound => e\n raise e if config.raise_errors\n respond_with_error(500)\n rescue FileNotFound => e\n raise e if config.raise_errors\n respond_with_error(404)\n end",
"title": ""
},
{
"docid": "03637098824feaaed0e29c92f1db90ec",
"score": "0.59986013",
"text": "def invoke(&block)\n res = catch(:halt, &block)\n\n res = [res] if (Integer === res) || (String === res)\n if (Array === res) && (Integer === res.first)\n res = res.dup\n status(res.shift)\n body(res.pop)\n headers(*res)\n elsif res.respond_to? :each\n body res\n end\n nil # avoid double setting the same response tuple twice\n end",
"title": ""
},
{
"docid": "7780f440e904b044727ea44e80e9e6e6",
"score": "0.59792864",
"text": "def rack_response(error, code = 500)\n Rack::Response.new({\n error: error\n }.to_json, code).finish\nend",
"title": ""
},
{
"docid": "a07f1fdc3e76780ba8a5f80797d6737a",
"score": "0.59700865",
"text": "def wrap(r)\n return r if Response === r\n\n Response.new(r.question_public_id, r.answer_public_id, r.response_group, r.value).tap do |rf|\n rf.wrapped_response = r\n rf.resolve_model\n end\n end",
"title": ""
},
{
"docid": "f153161dd6e7d2b09aa2ebe5a40b148e",
"score": "0.59688246",
"text": "def handle_response(response)\n case response.code.to_i\n when 301,302\n raise(ConnectionError.new(response, \"Redirection response code: #{response.code}\"))\n when 200...400\n response\n else\n raise(ConnectionError.new(response, \"Connection response code: #{response.code}\"))\n end\n end",
"title": ""
},
{
"docid": "98a651f4662f07ce083a7bca3cb443ce",
"score": "0.59677577",
"text": "def handle_response(response)\n return if response.code.in? [200, 201, 204]\n fail Errors::JIRA::Unauthorized if response.code == 401\n fail Errors::JIRA::NotFound if response.code == 404\n fail Errors::JIRA::UnknownError, \"status: #{response.code}, content: #{response.body})\"\n end",
"title": ""
},
{
"docid": "eac83f4147dd2aaef6f9108254140b99",
"score": "0.595818",
"text": "def wrap_error(message)\n { error: message }\nend",
"title": ""
},
{
"docid": "eac83f4147dd2aaef6f9108254140b99",
"score": "0.595818",
"text": "def wrap_error(message)\n { error: message }\nend",
"title": ""
},
{
"docid": "cdb6dd8f9cd0c12855ce708739b7c86b",
"score": "0.59431475",
"text": "def should_wrap_response?(env, response)\n client_request = is_supported_content_type? request_accept(env)\n server_response = response_should_be_json? response\n server_response || client_request\n end",
"title": ""
},
{
"docid": "35d46284a5ec6a6747419fded01a6f0b",
"score": "0.5937344",
"text": "def error_response(error, fallback = nil, meth: nil)\n meth ||= calling_method\n if modal?\n failure_status(error, meth: meth)\n else\n re_raise_if_internal_exception(error)\n flash_failure(error, meth: meth)\n redirect_back(fallback_location: fallback || default_fallback_location)\n end\n end",
"title": ""
},
{
"docid": "7186ea06e6b8d40184c94a5e752f645b",
"score": "0.59353036",
"text": "def bad_response(response, params={})\n puts params.inspect\n if response.class == HTTParty::Response\n raise HTTParty::ResponseError, response\n end\n raise StandardError, 'Unknown error'\n end",
"title": ""
},
{
"docid": "daa213dbce82caa4663be78a514f9e8a",
"score": "0.593328",
"text": "def return! request = nil, result = nil, & block\n if (200..207).include? code\n self\n elsif [301, 302, 307].include? code\n unless [:get, :head].include? args[:method]\n raise Exceptions::EXCEPTIONS_MAP[code].new(self, code)\n else\n follow_redirection(request, result, & block)\n end\n elsif code == 303\n args[:method] = :get\n args.delete :payload\n follow_redirection(request, result, & block)\n elsif Exceptions::EXCEPTIONS_MAP[code]\n raise Exceptions::EXCEPTIONS_MAP[code].new(self, code)\n else\n raise RequestFailed.new(self, code)\n end\n end",
"title": ""
},
{
"docid": "5480e8eb4cd50477335563f2d83a81b5",
"score": "0.59331363",
"text": "def response\r\n ActionDispatch::ExceptionWrapper.rescue_responses[class_name]\r\n end",
"title": ""
},
{
"docid": "485e1e8fdcaa296d269811d22a9e4384",
"score": "0.5932527",
"text": "def set_http_response_with_error(status, length, remote:)\n set_http_response(status, length)\n type = remote ? 'http_request_error' : 'http_response_error'\n case status.to_i\n when 429\n cause = Cause.new(stack: caller, message: 'Got 429', type: type)\n set_error(error: true, remote: remote, throttle: true, cause: cause)\n when 400..499\n cause = Cause.new(stack: caller, message: 'Got 4xx', type: type)\n set_error(error: true, remote: remote, cause: cause)\n when 500..599\n cause = Cause.new(stack: caller, message: 'Got 5xx', type: type)\n set_error(fault: true, remote: remote, cause: cause)\n else\n # pass\n end\n end",
"title": ""
},
{
"docid": "ca35da1d06733de4d7a6d40eadb3bc18",
"score": "0.592903",
"text": "def handle_response(response)\n status = response['status']\n\n if status == 'OK'\n response\n elsif status == 'ZERO_RESULTS'\n raise(NotFoundError)\n elsif CLIENT_CONNECTION_ERROR.include?(status)\n raise(ClientConnectionError, \"Google connection error: #{status}\")\n elsif response.blank?\n raise(EmptyResponseError)\n else\n raise(UnknownError)\n end\n end",
"title": ""
},
{
"docid": "838c3d439e2839e837ede29d455be58f",
"score": "0.5914135",
"text": "def wrapper(&block)\n begin\n self.http_response = block.call(self)\n self.http_data = OpenStruct.new( MultiJson.load(self.http_response.body) )\n self.http_code = self.http_response.code\n rescue => e\n self.http_data = OpenStruct.new( error: e )\n self.http_code = nil\n raise e\n end\n end",
"title": ""
},
{
"docid": "ab966b7b74ec81240cd0caddfdb9bf5e",
"score": "0.5908175",
"text": "def send_bad_request_response\n\t\tthrow :halt, [ 400, 'Bad Request' ]\n\tend",
"title": ""
},
{
"docid": "ea438b3163f8b8caf3dab59fe6ba1641",
"score": "0.5908165",
"text": "def catch_errors(response_class)\n yield\n rescue APIError => e\n response_class.new(error_code: e.error_code)\n rescue ConnectionError => e\n response_class.new(error_code: ErrorCode[:broker_not_available])\n rescue Error => e\n response_class.new(error_code: ErrorCode[:unknown_error])\n end",
"title": ""
},
{
"docid": "e47473bccf9820cea47e703d9ff21ccd",
"score": "0.5900028",
"text": "def handle_response(response)\n case response.code.to_i\n when 301,302\n raise \"Redirect\"\n when 200...400\n response\n when 400\n raise \"Bad Request\"\n when 401\n raise \"Unauthorized Access\"\n when 403\n raise \"Forbidden Access\"\n when 404\n raise \"Rescoure not found\"\n when 405\n raise \"Method not allowed\"\n when 409\n raise RequestError.new(\"Rescource conflict\")\n when 422\n raise RequestError.new(\"Resource invalid\")\n when 401...500\n raise \"Client error\"\n when 500...600\n raise RequestError.new(\"Server error\")\n else\n raise \"Unknown response: #{response.code.to_i}\"\n end\n end",
"title": ""
},
{
"docid": "03b17a783baddde44a267b95b6eab067",
"score": "0.589596",
"text": "def adapter_response(resp)\n if resp[:error]\n resp\n else\n { result: resp }\n end\n end",
"title": ""
},
{
"docid": "2cea80159c7134cc3f4e6713ef9d3bc6",
"score": "0.5894086",
"text": "def centralize_response(response, status_code, serializer = nil, serializer_params = {})\n if status_code == :ok\n manage_good_response(response, serializer, serializer_params)\n else\n manage_bad_response(response[:error], status_code)\n end\n end",
"title": ""
},
{
"docid": "9d2f0f3e81539fa7801c110294e472a6",
"score": "0.5875564",
"text": "def wrap_response(response)\n return response if !response.is_a?(Hash) || response['exception']\n\n finders = []\n\n @resources.each do |resource|\n resource = resource_set.find(resource)\n name = resource.resource_name\n relation_uri = response[name]\n\n response[name] = \\\n if relation_uri\n finders << name\n lambda { resource.wrap_response agent.get(relation_uri) }\n else nil\n end\n end\n\n @collections.each do |resource|\n resource = resource_set.find(resource)\n name = resource.collection_name\n query = response[name]\n\n response[name] = \\\n unless query.empty?\n finders << name\n lambda { resource.wrap_responses agent.get(query) }\n else query\n end\n end\n\n wrapper = @response_wrapper.new(response)\n\n finders.each do |finder|\n old_method = wrapper.method(finder)\n wrapper.define_singleton_method(finder) do\n old_method.call.call\n end\n end\n\n wrapper\n end",
"title": ""
},
{
"docid": "018debd9b6a8cb6eb0ba4feb7318b60d",
"score": "0.58659893",
"text": "def handle_response(response)\n\t\t\tLog.debug{ \"Response: #{response.code}, #{response.body}\" }\n\t\t\tcase response\n\t\t\twhen Net::HTTPNotFound\n\t\t\t\traise Jenkins2::NotFoundError, response\n\t\t\twhen Net::HTTPBadRequest\n\t\t\t\traise Jenkins2::BadRequestError, response\n\t\t\twhen Net::HTTPServiceUnavailable\n\t\t\t\traise Jenkins2::ServiceUnavailableError, response\n\t\t\twhen Net::HTTPInternalServerError\n\t\t\t\traise Jenkins2::InternalServerError, response\n\t\t\twhen Net::HTTPClientError, Net::HTTPServerError # 4XX, 5XX\n\t\t\t\tresponse.value\n\t\t\telse\n\t\t\t\tresponse\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "bc5d9136507e404db9df54801451dd9d",
"score": "0.58609205",
"text": "def handle_request( request )\n\t\tself.log.debug \"[:errors] Wrapping request in custom error-handling.\"\n\t\tresponse = nil\n\n\t\t# Catch a finish_with; the status_response will only be non-nil\n\t\tstatus_response = catch( :finish ) do\n\n\t\t\t# Provide our own exception-handling and translate them into server errors\n\t\t\tbegin\n\t\t\t\tresponse = super\n\t\t\trescue => err\n\t\t\t\tself.log.error \"%s: %s %s\" % [ err.class.name, err.message, err.backtrace.first ]\n\t\t\t\terr.backtrace[ 1..-1 ].each {|frame| self.log.debug(' ' + frame) }\n\n\t\t\t\tfinish_with(\n\t\t\t\t\tstatus: HTTP::SERVER_ERROR,\n\t\t\t\t\tmessage: err.message,\n\t\t\t\t\theaders: {},\n\t\t\t\t\tbacktrace: err.backtrace,\n\t\t\t\t\texception: err\n\t\t\t\t)\n\t\t\tend\n\t\t\tnil\n\t\tend\n\n\t\t# If the app or any plugins threw a finish, look for a handler for the status code\n\t\t# and call it if one is found.\n\t\tresponse = self.handle_status_response( request, status_response ) if status_response\n\n\t\treturn response\n\tend",
"title": ""
}
] |
3aebccf8da6e7a67a5ab3e71b7e7ac02
|
The name of the class.
|
[
{
"docid": "2dd7dfa592df4024edcf3054f12e6b69",
"score": "0.0",
"text": "def class_name\n @test_case['classname']\n end",
"title": ""
}
] |
[
{
"docid": "9c45a91e242793f6464edd469a1349ba",
"score": "0.8684521",
"text": "def class_name\n name.camelcase\n end",
"title": ""
},
{
"docid": "54d861539fb3fd8f638cd5976996a0ec",
"score": "0.862049",
"text": "def class_name\n @class_name\n end",
"title": ""
},
{
"docid": "fa18892e25599ce233cd073fc6c9d2ec",
"score": "0.85469353",
"text": "def class_name\n @class_name ||= self.class.name\n end",
"title": ""
},
{
"docid": "9f953154334287a1204e342b7417e864",
"score": "0.85269815",
"text": "def class_name\n @class_name ||= self.name.split(/::/).last.downcase\n end",
"title": ""
},
{
"docid": "8f478cff2980f0db37e58bda81f4c1da",
"score": "0.8510707",
"text": "def class_name\n name.split('-').last.freeze\n end",
"title": ""
},
{
"docid": "8d9cfcb6fc14ff825ecc8effc51d67e7",
"score": "0.8479737",
"text": "def name\n @name ||= klass.name.gsub(/.*::/, '').underscore\n end",
"title": ""
},
{
"docid": "30a2101faa41739749666be11266319a",
"score": "0.8474417",
"text": "def class_name\n name.camelize\n end",
"title": ""
},
{
"docid": "30a2101faa41739749666be11266319a",
"score": "0.8474417",
"text": "def class_name\n name.camelize\n end",
"title": ""
},
{
"docid": "5ffb25bb6de398db660b368b95ed323b",
"score": "0.8472279",
"text": "def class_name\n @class_name ||= derive_class_name\n end",
"title": ""
},
{
"docid": "c6c8e3703a752f6f0e1c721954dc0824",
"score": "0.8459007",
"text": "def classname\n name.split(\"::\")[1..-1].join(\"::\")\n end",
"title": ""
},
{
"docid": "df6ce5dfa330616857a1d04ae0c40a25",
"score": "0.84253913",
"text": "def class_name\n name.split('::').last\n end",
"title": ""
},
{
"docid": "28031a7dc548b5e7bb4c17dc4a470a46",
"score": "0.84031427",
"text": "def class_name\n @class_name ||= (self[:class_name] || classify).sub(/^::/,\"\")\n end",
"title": ""
},
{
"docid": "3c36c6bffa6e7b2284e36c2cbf1141c1",
"score": "0.8377122",
"text": "def name\n @name ||= @cls.name\n end",
"title": ""
},
{
"docid": "93318b6f277a27a00670061551eca038",
"score": "0.8348404",
"text": "def classname\n @name\n end",
"title": ""
},
{
"docid": "93318b6f277a27a00670061551eca038",
"score": "0.8348404",
"text": "def classname\n @name\n end",
"title": ""
},
{
"docid": "8c6ae2aeb30a1e791dd88c655760478d",
"score": "0.8323996",
"text": "def class_name\n assert_exists\n return @o.invoke(\"className\")\n end",
"title": ""
},
{
"docid": "101c31dd60fdeb940624bdbbdc35e297",
"score": "0.8311661",
"text": "def class_name\n name.classify\n end",
"title": ""
},
{
"docid": "06492e31274900b6f8c1f09cab5b5bad",
"score": "0.8297047",
"text": "def class_name\n self.class.to_s.split(\"::\").last.downcase\n end",
"title": ""
},
{
"docid": "facabd3bb8fa280cee5833c9a7bdd767",
"score": "0.8295091",
"text": "def class_name\n self.class.to_s.split('::').last.downcase\n end",
"title": ""
},
{
"docid": "504b7c28dab819bf43e2c66d725d38a3",
"score": "0.8249736",
"text": "def class_name\n self.class.name.split(\"::\").last.downcase\n end",
"title": ""
},
{
"docid": "a0d5160b99a616932634f214baba9350",
"score": "0.8246762",
"text": "def get_class_name\n\t\treturn self.class.name\n\tend",
"title": ""
},
{
"docid": "09ad5edd901493db4c78ddf1ebd43f90",
"score": "0.8234744",
"text": "def class_name\n\t\t\t\tself.class.name.split('::').last\n\t\t\tend",
"title": ""
},
{
"docid": "430a013746e95f654773d41c6a37acc3",
"score": "0.82166374",
"text": "def full_class_name\n class_name\n end",
"title": ""
},
{
"docid": "c99928d6ca900e5c937f88692010825f",
"score": "0.8212875",
"text": "def class_name\n self.class.to_s.split('::').last\n end",
"title": ""
},
{
"docid": "fdc48c4c2c907cf0e257345409dc4b75",
"score": "0.8211461",
"text": "def class_name\n @name.camelize\n end",
"title": ""
},
{
"docid": "3cfb4748144652950a6bd2dbd6c7de08",
"score": "0.8208561",
"text": "def class_name\n self.to_s.split(\"::\").last\n end",
"title": ""
},
{
"docid": "f2db1268fe00ce50f677c8f6b644d240",
"score": "0.8192623",
"text": "def class_name(name = nil)\n self.class_name = name if name\n self.class_name = (prefix + \".\" + to_s) unless @class_name\n @class_name \n end",
"title": ""
},
{
"docid": "9b77145880944c0004575511fe2c6a7f",
"score": "0.81901145",
"text": "def class_name\n name.sub('.', ' ').sub(':', ' pseudo-class-').strip\n end",
"title": ""
},
{
"docid": "f80792723fdbcb1895cf0423ad20fc50",
"score": "0.8188794",
"text": "def class_name\n self.class.name.split(\"::\").last\n end",
"title": ""
},
{
"docid": "6ba1225466cd9b29614ac2bbb72afd7d",
"score": "0.8187855",
"text": "def class_name\n return $data_classes[@class_id].name\n end",
"title": ""
},
{
"docid": "75da5cc796d12817901565a86cb5061c",
"score": "0.81791556",
"text": "def class_name\n \"\"\n end",
"title": ""
},
{
"docid": "f7569bfd5f737664bbed7179a083aec2",
"score": "0.817549",
"text": "def class_name\n self.class.name.split('::').last\n end",
"title": ""
},
{
"docid": "a3905004d8b87979b863d637e59de247",
"score": "0.81651956",
"text": "def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end",
"title": ""
},
{
"docid": "4351f97b4f37ab6cafe43ca767e9e8e6",
"score": "0.8164028",
"text": "def classname\n self.class.to_s.split(\"::\")[1].capitalize\n end",
"title": ""
},
{
"docid": "4351f97b4f37ab6cafe43ca767e9e8e6",
"score": "0.8164028",
"text": "def classname\n self.class.to_s.split(\"::\")[1].capitalize\n end",
"title": ""
},
{
"docid": "4d990abb8697e1050a5cf18ca0361b08",
"score": "0.8158455",
"text": "def class_name\n return self.class.name.split('::').last\n end",
"title": ""
},
{
"docid": "a5f4815c60f1f558a2b61b3f54ca78a5",
"score": "0.8097421",
"text": "def clname\n\t\t\t@className\n\t\tend",
"title": ""
},
{
"docid": "bc940b943adb2abc7e8121005cb898f0",
"score": "0.8084456",
"text": "def class_name\n @class_name\n end",
"title": ""
},
{
"docid": "c98ec0bcbb34643bbc97b50171b6c7ac",
"score": "0.8059237",
"text": "def full_class_name\n end",
"title": ""
},
{
"docid": "ea255bf3e9b3e9ccf5ca289af373eb83",
"score": "0.80331534",
"text": "def class_name(name)\n @class_name = name\n end",
"title": ""
},
{
"docid": "00889a92c1b2e4092561a830b5b0a296",
"score": "0.80115867",
"text": "def classname\n self.class.name.split(\"::\")[-1]\n end",
"title": ""
},
{
"docid": "1ecf802fec39d5e3279a0f2a07da0266",
"score": "0.7990428",
"text": "def class_name(clazz)\n clazz.name.to_s =~ /([A-Za-z0-9_]+)$/\n $1.to_sym\n end",
"title": ""
},
{
"docid": "536cfd3212bd929cf727f2257bee2393",
"score": "0.79829824",
"text": "def name\n @name ||= self.class.non_namespaced_name\n end",
"title": ""
},
{
"docid": "30ec52a89bf133466eb0fdb540c3d082",
"score": "0.7973671",
"text": "def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end",
"title": ""
},
{
"docid": "d25da90ef209082d408e5495937cc2e7",
"score": "0.795457",
"text": "def bare_class_name\n name.split('::').last\n end",
"title": ""
},
{
"docid": "905a9399483a4a968411d091a78281f2",
"score": "0.7945168",
"text": "def name_and_class\n [name, self['class']].compact.join('.')\n end",
"title": ""
},
{
"docid": "28443d7446e723ca05cb94a5c3ebb324",
"score": "0.79441994",
"text": "def class_name; end",
"title": ""
},
{
"docid": "28443d7446e723ca05cb94a5c3ebb324",
"score": "0.79441994",
"text": "def class_name; end",
"title": ""
},
{
"docid": "28443d7446e723ca05cb94a5c3ebb324",
"score": "0.79441994",
"text": "def class_name; end",
"title": ""
},
{
"docid": "28443d7446e723ca05cb94a5c3ebb324",
"score": "0.79441994",
"text": "def class_name; end",
"title": ""
},
{
"docid": "28443d7446e723ca05cb94a5c3ebb324",
"score": "0.79441994",
"text": "def class_name; end",
"title": ""
},
{
"docid": "44a209d71813f20f2581a112c2a182ae",
"score": "0.79389954",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "44a209d71813f20f2581a112c2a182ae",
"score": "0.79389954",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "4e5a177728d11d0897041f75e0bf67b4",
"score": "0.79223645",
"text": "def class_name\n self.class.class_name\n end",
"title": ""
},
{
"docid": "4e5a177728d11d0897041f75e0bf67b4",
"score": "0.79223645",
"text": "def class_name\n self.class.class_name\n end",
"title": ""
},
{
"docid": "4e5a177728d11d0897041f75e0bf67b4",
"score": "0.79223645",
"text": "def class_name\n self.class.class_name\n end",
"title": ""
},
{
"docid": "4d9dd7d04c240d541b580867441ef3f4",
"score": "0.79193103",
"text": "def class_name\n @class_name ||= options[:class_name] || derive_class_name\n end",
"title": ""
},
{
"docid": "c3178288f52acaa8e685ef0f7d3fcbb8",
"score": "0.7916419",
"text": "def name\n self.class.name.split('::').last.downcase\n end",
"title": ""
},
{
"docid": "c6a4b0f556e2f5501b46a88203a09d79",
"score": "0.79138076",
"text": "def name()\n self.class.name.split(\"::\").last().downcase()\n end",
"title": ""
},
{
"docid": "07a6c445acdf8ebd839e5c38a4ce072f",
"score": "0.79064673",
"text": "def class_name\n attribute 'class'\n end",
"title": ""
},
{
"docid": "22f12159a0eb41089ed09a70cc3878f1",
"score": "0.7905239",
"text": "def class_name\n @class_name ||= type.underscore.classify\n end",
"title": ""
},
{
"docid": "eaf263dc33d242cb184086d6814313f6",
"score": "0.79049665",
"text": "def class_name?; end",
"title": ""
},
{
"docid": "631e5df81cb5d908ca592dc8ac609c25",
"score": "0.78980887",
"text": "def name\n self.class.name.to_s.split('::').last\n end",
"title": ""
},
{
"docid": "9b5f529168f982ad904a37038480a969",
"score": "0.7896143",
"text": "def klass_name\n self.class.to_s.split('::').last\n end",
"title": ""
},
{
"docid": "969d275292f167ac07d89fc9f352a4b1",
"score": "0.7889202",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "969d275292f167ac07d89fc9f352a4b1",
"score": "0.7889202",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "969d275292f167ac07d89fc9f352a4b1",
"score": "0.7889202",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "969d275292f167ac07d89fc9f352a4b1",
"score": "0.7889202",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "969d275292f167ac07d89fc9f352a4b1",
"score": "0.7889202",
"text": "def name\n self.class.name\n end",
"title": ""
},
{
"docid": "f538c0462e48ec38c40b809357458198",
"score": "0.78885335",
"text": "def name\n self.class::NAME\n end",
"title": ""
},
{
"docid": "841502d4f483417526efa2e8b1981a14",
"score": "0.78861225",
"text": "def class_name\n return @class_name unless @class_name.nil?\n @class_name = _root.type_ids[class_idx].type_name\n @class_name\n end",
"title": ""
},
{
"docid": "841502d4f483417526efa2e8b1981a14",
"score": "0.78861225",
"text": "def class_name\n return @class_name unless @class_name.nil?\n @class_name = _root.type_ids[class_idx].type_name\n @class_name\n end",
"title": ""
},
{
"docid": "262eb15573ad76684803afa55384bce5",
"score": "0.7885727",
"text": "def get_class_name\n \"#{ file_name }\".chop.capitalize\n end",
"title": ""
},
{
"docid": "405ad21760ed7761ae5d1bff67be2b15",
"score": "0.7874315",
"text": "def class_name\n enclosing_names.join('::')\n end",
"title": ""
},
{
"docid": "de226e99826db1ee29a6ab193335c60e",
"score": "0.7872383",
"text": "def class_name(klass)\n return klass.name.split(\"::\").last\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.7871846",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "34ee3176df7480bd0f36985ff83abd7a",
"score": "0.78716195",
"text": "def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "58f52ef712a97e4d45bfeb557e245a87",
"score": "0.78672296",
"text": "def name\n self.class.name.split('::').last.capitalize\n end",
"title": ""
},
{
"docid": "bd58e88517a8bc4cf0001e30b3f964a3",
"score": "0.7866747",
"text": "def class_name\r\n r = \"\"\r\n up = true\r\n each_byte do |c|\r\n if c == 95\r\n if up\r\n r << \"::\"\r\n else\r\n up = true\r\n end\r\n else\r\n m = up ? :upcase : :to_s\r\n r << (c.chr.send(m))\r\n up = false\r\n end\r\n end\r\n r\r\n end",
"title": ""
},
{
"docid": "740ac278e292f1ba2c62ee41902e3c90",
"score": "0.7855604",
"text": "def class_name\n Heroics.camel_case(name)\n end",
"title": ""
},
{
"docid": "740ac278e292f1ba2c62ee41902e3c90",
"score": "0.7855604",
"text": "def class_name\n Heroics.camel_case(name)\n end",
"title": ""
},
{
"docid": "fc93902655683a222368c012054685f6",
"score": "0.78419596",
"text": "def classname\n name.tr('-','_').split('_').map {|x| x.capitalize}.join\n end",
"title": ""
},
{
"docid": "050466f937720015410450cab561e343",
"score": "0.7836775",
"text": "def class_name\n [scope, @klass.name.split(\"::\").last].join(\".\")\n end",
"title": ""
},
{
"docid": "050466f937720015410450cab561e343",
"score": "0.7836775",
"text": "def class_name\n [scope, @klass.name.split(\"::\").last].join(\".\")\n end",
"title": ""
},
{
"docid": "1ac69cb3b8b28fb5e83ca3a5da567b1c",
"score": "0.7831503",
"text": "def name\n @name ||= ['', *@module_path, @class_name] * '::'\n end",
"title": ""
},
{
"docid": "73f520fde1cd6710cb51197fc2ceea17",
"score": "0.78305364",
"text": "def current_class_name\n @klass.to_s\n end",
"title": ""
},
{
"docid": "441415a58917c7607bdaaad1ac457160",
"score": "0.782997",
"text": "def class_name\n @class_name ||= -(options[:class_name] || derive_class_name).to_s\n end",
"title": ""
},
{
"docid": "eea706af305a9d0ae9cf370db2ab2e35",
"score": "0.7815853",
"text": "def class_name\n [scope.presence, @klass.name.split('::').last].compact.join('.')\n end",
"title": ""
},
{
"docid": "30dad7f6c52ef21d3f3dd32dc3940adb",
"score": "0.7789347",
"text": "def class_name\n fetch('games.world_of_warcraft.class_names')\n end",
"title": ""
},
{
"docid": "2425153f7c9372f0a9b9897f2541e669",
"score": "0.77888864",
"text": "def class_name\n self.class == Class ? self.name : self.class.name\n end",
"title": ""
},
{
"docid": "89cf94c8cedd92a6a92fa7ab1c4d6596",
"score": "0.7788671",
"text": "def name\n self.class.to_s.gsub(/^.*::/, \"\")\n end",
"title": ""
},
{
"docid": "3098b062ff58ec29cd63d9188e3ca1ee",
"score": "0.778455",
"text": "def clazz_name\n my_class.to_s\n end",
"title": ""
},
{
"docid": "0695c0f5e3fe75bdb3150d5eb5e2561c",
"score": "0.77767515",
"text": "def class_name\n File.expand_path caller[0].split(\":\")[0]\n end",
"title": ""
},
{
"docid": "793f91f5ed66fecce41d7ed9725b15b1",
"score": "0.7773341",
"text": "def class_name\n I18n.t(self.class.to_s)\n end",
"title": ""
},
{
"docid": "1904ea0586b1205432265c69c981a809",
"score": "0.7770459",
"text": "def name\n\t\t\treturn self.class.name.gsub(/[^a-zA-Z0-9]+/, '-')\n\t\tend",
"title": ""
}
] |
9a9bea319d3bf575c08bb43d2c66b2ce
|
Returns the case if the alg solves the pattern and nil otherwise
|
[
{
"docid": "007124d0e1bbae00fbed0b2ff9257420",
"score": "0.78597397",
"text": "def alg_case_for_pattern(alg, pattern)\n casee = @reverse_engineer.find_case(alg)\n casee && pattern.match?(casee) ? casee : nil\n end",
"title": ""
}
] |
[
{
"docid": "823c8886c3aaebd4d1b43ca12ea37736",
"score": "0.61251724",
"text": "def solved?(board)\n solve(board).last\nend",
"title": ""
},
{
"docid": "ad3f876e85faf15ad90ce3cbe24dcc0c",
"score": "0.61042684",
"text": "def solution\n return nil\n end",
"title": ""
},
{
"docid": "1d3f631a52f2bf35ed307ce8d6044ba7",
"score": "0.59575737",
"text": "def next_solve\n rs = RegexSolver.new(@board, @rack, @lookUp)\n end",
"title": ""
},
{
"docid": "10c1e05ceda9578a9b4e4c2f1c33eec6",
"score": "0.5931716",
"text": "def solved?(board)\n return true if solve(board)\n false\nend",
"title": ""
},
{
"docid": "08c96e956b12a40f8a833eda3a9e8e0c",
"score": "0.5868243",
"text": "def solve\n final = lambda{|x| x[:right] == [:cabra,:lobo,:repollo] ||\n x[:right] == [:lobo,:repollo,:cabra] ||\n x[:right] ==[:cabra,:repollo,:lobo]}\n result = self.path(self, final)\n if result.nil?\n puts \"El problema no tiene solucion\"\n else\n puts \"El resultado al problema es\"\n puts result\n end\n end",
"title": ""
},
{
"docid": "bcc02f663c16ed50cf29f4fb473dbd1a",
"score": "0.5818388",
"text": "def solved?\n\n end",
"title": ""
},
{
"docid": "8fdcc3df4ba87c252a35ba5aca3e2572",
"score": "0.57328314",
"text": "def solution\n @solution ||= solve!\n end",
"title": ""
},
{
"docid": "a4949b51eb8476a9e5672824814fe27b",
"score": "0.5700626",
"text": "def solve\n solve_1(0)\n end",
"title": ""
},
{
"docid": "e3a3beda4a541c8f29459255f445fde8",
"score": "0.56793034",
"text": "def solve\n [:win, :block, :fork, :block_fork, \n :center, :opposite_corner, :empty_corner, :empty_side].each do |step|\n move = @heuristic.send(step)\n return move if move\n end\n\n raise \"No possible moves to play!\"\n end",
"title": ""
},
{
"docid": "c1ca7fdc54a4236d947104f5583e687f",
"score": "0.5679068",
"text": "def solve\n while !solved?\n unless @strategies.find { |s| s.solve }\n # if the grid gets to a stage where none of the strategies could solve it, there is no solution to it\n fail NoSolutionError\n end\n end\n end",
"title": ""
},
{
"docid": "2346a87e035bf476b684fb6cd5e7650c",
"score": "0.56380934",
"text": "def fuzzy_match(mask, piece)\n return 0 if !mask || mask == '*' # || !piece\n return 1 if mask == piece\n nil\n end",
"title": ""
},
{
"docid": "a909318ce32434ea7e8cac4891ea8772",
"score": "0.56299746",
"text": "def solve!\n i = 1\n while (true)\n if is_solved?\n return i #Found exit in i steps.\n else\n result = floodfill_with_inefficient_magic!\n if result.nil?\n return nil #No new steps reached this turn, exit unreachable.\n else\n i += 1\n end\n end\n end\n end",
"title": ""
},
{
"docid": "50b05853cd5c74c75553bd52fb602e9f",
"score": "0.5589423",
"text": "def solve(board)\n solve_with_basic_logic(board)\n solve_with_advanced_logic(board) if !solved?(board)\n solve_with_educated_guessing(board) if !solved?(board)\nend",
"title": ""
},
{
"docid": "ae1f56158e682b14a3a5992378f0c43d",
"score": "0.55861425",
"text": "def solved?(board)\nend",
"title": ""
},
{
"docid": "ae1f56158e682b14a3a5992378f0c43d",
"score": "0.55861425",
"text": "def solved?(board)\nend",
"title": ""
},
{
"docid": "ae1f56158e682b14a3a5992378f0c43d",
"score": "0.55861425",
"text": "def solved?(board)\nend",
"title": ""
},
{
"docid": "bc826ba7feb99f80448a8e98ada72371",
"score": "0.5568226",
"text": "def solve(piece, row, col, used)\n tmp = @pieces[piece] \n for i in 0..7\n remove_piece(piece+1)\n used[piece] = false\n \n if i == 4\n tmp = tmp.get_mirror\n end\n tmp = tmp.rotate\n \n put = put_piece(tmp,piece,row,col)\n \n if put\n used[piece] = true\n if solution?\n return true\n end\n# show_board\n# puts\n \n for j in 0..used.size-1\n c = find_free_place\n if not used[j] \n if solve(j,c.row,c.col,used)\n return true\n end\n end\n \n end\n end\n end\n remove_piece(piece + 1)\n used[piece] = false\n \n end",
"title": ""
},
{
"docid": "b34cf084f260465c2ea4ad161fe2b891",
"score": "0.5561697",
"text": "def is_solution(state)\n state == $final\nend",
"title": ""
},
{
"docid": "c69bfd01151922ab3c109faada868a5b",
"score": "0.55606854",
"text": "def solve\n end",
"title": ""
},
{
"docid": "b2f78988324998d84518103ed298ee94",
"score": "0.55544186",
"text": "def solve(puzz)\n candidate_values = [] # pairs: [tile,value,cost]\n # examine candidates\n puzz.each_index do |y|\n row = puzz[y]\n row.each_index do |x|\n tile = puzz[y][x]\n cur_mask = tile.value_mask\n cur_val = 1\n while cur_mask > 0 do\n if cur_val & 1 > 0\n cur_cost = tile.cost_to_place(cur_val)\n candidate_values << [tile,cur_val,cur_cost]\n # puts \"cost of #{cur_val} => (#{tile.x},#{tile.y}) is #{cur_cost}\"\n end\n cur_val = cur_val+1\n cur_mask = cur_mask >> 1\n end\n end\n end\n # puts candidate_values.inspect\n if candidate_values.length == 0\n success(puzz)\n else\n while candidate_values.length > 0 do\n # puts \"choose a good candidate to set the value on\"\n candidate_values.sort! {|one,two| one[2] <=> two[2] }\n # puts candidate_values.inspect\n next_puz = copy_puzz(puzz)\n chosen = candidate_values.shift\n begin\n next_puz[chosen.y][chosen.x].value = chosen[1]\n solve(next_puzz)\n rescue\n puts \"learned that #{chosen[1]} does NOT go at #{chosen[0].x},#{chosen[0].y}\"\n puzz[chosen[0].y][chosen[0].x].mask(~(1<<(chosen[1]-1)))\n end\n end\n end\n panic(puzz)\nend",
"title": ""
},
{
"docid": "23c97d6de88c7cc6cd2dc60f078f40a9",
"score": "0.55128896",
"text": "def solve\n end",
"title": ""
},
{
"docid": "36733ef14fbfbfa20b4853cb17c4e9e4",
"score": "0.5499987",
"text": "def solver?(cell)\n\t\n\t\t# Go thru each possible candidate value, evaluating if the selected candidate is\n\t\t# possible for the cell and if the resulting branch solves\n\t\tcell.candidates.each do |candidate|\n\t\t\tcell.try_value = candidate\n\t\t\t@message = \"Testing cell ##{cell.index} with #{candidate}\\n#{cell.candidates} available\"\n\t\t\tself.to_s\n\t\t\t\n\t\t\t# If the current cell is last in the @cells array, check only the validity of the candidate.\n\t\t\tif cell != @cells.last \n\t\t\t\tif candidate_is_valid?(cell) and solver?(next_cell(cell))\n\t\t\t\t\n\t\t\t\t\t# This cell has been solved - set value and return true back up the state space\n\t\t\t\t\t#cell.set_value = candidate\n\t\t\t\t\treturn true\n\t\t\t\t\t\n\t\t\t\telse\t\n\t\t\t\t\t\n\t\t\t\t\t# The cell has not been solved, restore it to nil (it must not affect other decisions)\n\t\t\t\t\tcell.try_value = nil\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif candidate_is_valid?(cell)\n\t\t\t\t\t# This is the base case where there are no other cells to check, so we can send true\n\t\t\t\t\t# back up the recursion levels \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\n\t\t\t\n\t\tend\n\t\t\n\t\t# If all candidates have been evaluated without success, this branch has failed; need to backtrack\n\t\treturn false\n\t\t\t\n\tend",
"title": ""
},
{
"docid": "a84ddabf7caeaf779ac47222c80d8e39",
"score": "0.549703",
"text": "def solved?(board)\n row_solve?(board) && column_solve?(board)\nend",
"title": ""
},
{
"docid": "55133317e5cad50b14b5f5b0b8f49495",
"score": "0.54910314",
"text": "def solvable(board)\n # Gets parity and blank position\n parity, blank = get_parity_and_blank(board.flatten)\n\n # Checks based on parity and blank position if it is solvable\n check_parity_and_blank(parity, blank)\n end",
"title": ""
},
{
"docid": "fe759522d3767f451600fd89ed6921f4",
"score": "0.5486521",
"text": "def solve\n find_possible_solutions\n recursively_test_possible_solutions\n\n if !solved?\n # check and guess...?\n end\n end",
"title": ""
},
{
"docid": "163894c57853710c850a802d154e72bd",
"score": "0.54842395",
"text": "def solve\n @brute = nil\n solved = catch :solved do\n unsolved.times { single }\n true\n end\n abort \"No solution\" unless solved\n end",
"title": ""
},
{
"docid": "fab8e76d86701e016c7e9a0b68818d45",
"score": "0.54760516",
"text": "def solve!\n end",
"title": ""
},
{
"docid": "7e3c8035b4c573c3b5db886af2464fee",
"score": "0.5458425",
"text": "def solution?\n @position == @length**2\n end",
"title": ""
},
{
"docid": "90f3d2bd8ad2b91e1b3e6a6727ae89a1",
"score": "0.5440516",
"text": "def first_solution(csp)\n each_solution(csp) { |solution|\n return solution\n }\n nil\n end",
"title": ""
},
{
"docid": "f444d4cfbff483f247cab1653d23e3c9",
"score": "0.5431764",
"text": "def solution\n # The maze can't be changed, so it only needs to be solved once (lazy evaluation)\n @solution ||= solve\n end",
"title": ""
},
{
"docid": "f799bd028eb338c00434c79d7e69ad91",
"score": "0.5419724",
"text": "def solve\n result = search(@desk.clone,0) \n if result == :failed\n puts \"Failed to find solution\"\n else\n puts \"Solution found\\n\"\n end\n end",
"title": ""
},
{
"docid": "61d50c2e196ae34ec569d27260199cda",
"score": "0.54190844",
"text": "def solve\n abstract\n end",
"title": ""
},
{
"docid": "40e9e319968b343eaa9f032aad67d282",
"score": "0.5403917",
"text": "def solved?(board)\n board.chars.sort.join == SOLUTION\nend",
"title": ""
},
{
"docid": "c3caa79c96f1e473f1a7b6ba78dd05d8",
"score": "0.53997684",
"text": "def match?; @match; end",
"title": ""
},
{
"docid": "ad1ea14f98bb848393888d071debe7a8",
"score": "0.53923285",
"text": "def solve(board_string)\nend",
"title": ""
},
{
"docid": "ad1ea14f98bb848393888d071debe7a8",
"score": "0.53923285",
"text": "def solve(board_string)\nend",
"title": ""
},
{
"docid": "ac66c4b0213294120a2ca29e8e7779c4",
"score": "0.5369223",
"text": "def solve_one_case( gcjcase )\n start_of_case = Time.now.to_f\n gcjcase.solve\n $iolog.puts( \"case #{gcjcase.index} Elapsed:#{(1000*(Time.now.to_f-start_of_case)).to_i} ms\" )\n end",
"title": ""
},
{
"docid": "a352353d5c4031faa7784ef6829d6883",
"score": "0.53674835",
"text": "def pattern; @iterations.first.pattern; end",
"title": ""
},
{
"docid": "d166033ed152e152c559179af907cc73",
"score": "0.5363784",
"text": "def solvable?\n end",
"title": ""
},
{
"docid": "68eb91701d4887b104e08350c689a37a",
"score": "0.5350004",
"text": "def solved?(board)\n\t\tif board.include?('0')\n\t \treturn false\n\t else\n\t \treturn true\n\t end\n\tend",
"title": ""
},
{
"docid": "184eb24a3917e72016dee9494b63c036",
"score": "0.5332522",
"text": "def check_fit( direction, x, y, word )\r\n position = 0 # Initial position setting for slicing letters from the word\r\n case direction # Case select for the 8 different directions\r\n when 0 # If the direction is 0 ( word is printed N )\r\n if ( x - word.length ) > 0 # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n x -= 1 # Moves the current position to the previous row ( N )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing N )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( N ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( N )\r\n end\r\n\r\n when 1 # If the direction is 1 ( word is printed NE )\r\n if ( x - word.length ) > 0 && ( y + word.length ) < @grid_size # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n x -= 1 # Moves the current position to the previous row ( N )\r\n y += 1 # Moves the current position to the next column ( E )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing NE )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( NE ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( NE )\r\n end\r\n\r\n when 2 # If the direction is 2 ( word is printed E )\r\n if ( y + word.length ) < @grid_size # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n y += 1 # Moves the current position to the next column ( E )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing E )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( E ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( E )\r\n end\r\n\r\n when 3 # If the direction is 3 ( word is printed SE )\r\n if ( y + word.length ) < @grid_size && ( x + word.length ) < @grid_size # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n x += 1 # Moves the current position to the next row ( S )\r\n y += 1 # Moves the current position to the next column ( E )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing SE )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( SE ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( SE )\r\n end\r\n\r\n when 4 # If the direction is 4 ( word is printed S )\r\n if ( x + word.length ) < @grid_size # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n x += 1 # Moves the current position to the next row ( S )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing S )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( S ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( S )\r\n end\r\n\r\n when 5 # If the direction is 5 ( word is printed SW )\r\n if ( x + word.length ) < @grid_size && ( y - word.length ) > 0 # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n x += 1 # Moves the current position to the next row ( S )\r\n y -= 1 # Moves the current position to the previous column ( W )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing SW )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( SW ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( SW )\r\n end\r\n\r\n when 6 # If the direction is 6 ( word is printed W )\r\n if ( y - word.length ) > 0 # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n y -= 1 # Moves the current position to the previous column ( W )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing W )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( W ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( W )\r\n end\r\n\r\n when 7 # If the direction is 7 ( word is printed NW )\r\n if ( x - word.length ) > 0 && ( y - word.length ) > 0 # Checks to see if the word will fit on the puzzle grid\r\n while position < word.length # If word will fit on puzzle grid, counter starts at the first letter and continues until end of the word\r\n if @answer_grid[ x ][ y ] == @placeholder_char || @answer_grid[ x ][ y ] == word.slice( position ) # Checks to see if the sliced letter will be place on a usable position on the puzzle grid. Usable position\r\n # is a placeholder character or the same letter\r\n position += 1 # Increment counter to the next letter in the word\r\n x -= 1 # Moves the current position to the previous row ( N )\r\n y -= 1 # Moves the current position to the previous column ( W )\r\n else # If the position on the grid doesn't contain a placeholder character or the same letter\r\n return false # it returns false. The word will not fit on the puzzle grid using this direction ( printing NW )\r\n end\r\n end # If the word successfully fits on the puzzle grid with this direction ( NW ) it returns true so\r\n return true # the program knows to place the word at this location and print it in this direction ( NW )\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "2a9c8b3a0020cc524d1bbc832d793241",
"score": "0.5331981",
"text": "def solve\n raise EstadoError.new(\"Las condiciones dadas en los parametros del estado. Fallan, no puede ni comenzar!\") unless self.check\n goal = LCR.new(:right,[],[:repollo,:cabra,:lobo])\n p = lambda { |x| x == goal }\n path(self,p).each { |m| puts m ;puts \" ↓\"}\n return\n end",
"title": ""
},
{
"docid": "379fd5ee06bba552a4daae6b36eb52f9",
"score": "0.53286844",
"text": "def searched_case_statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 166 )\n return_value = SearchedCaseStatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n searched_case_statement_start_index = @input.index\n\n root_0 = nil\n string_literal957 = nil\n string_literal959 = nil\n plsql_expression958 = nil\n seq_of_statements960 = nil\n\n tree_for_string_literal957 = nil\n tree_for_string_literal959 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 914:4: ( 'WHEN' plsql_expression 'THEN' seq_of_statements )+\n # at file 914:4: ( 'WHEN' plsql_expression 'THEN' seq_of_statements )+\n match_count_248 = 0\n while true\n alt_248 = 2\n look_248_0 = @input.peek( 1 )\n\n if ( look_248_0 == T__63 )\n alt_248 = 1\n\n end\n case alt_248\n when 1\n # at line 914:6: 'WHEN' plsql_expression 'THEN' seq_of_statements\n string_literal957 = match( T__63, TOKENS_FOLLOWING_T__63_IN_searched_case_statement_5774 )\n if @state.backtracking == 0\n\n tree_for_string_literal957 = @adaptor.create_with_payload( string_literal957 )\n @adaptor.add_child( root_0, tree_for_string_literal957 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_plsql_expression_IN_searched_case_statement_5776 )\n plsql_expression958 = plsql_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, plsql_expression958.tree )\n end\n string_literal959 = match( T__109, TOKENS_FOLLOWING_T__109_IN_searched_case_statement_5778 )\n if @state.backtracking == 0\n\n tree_for_string_literal959 = @adaptor.create_with_payload( string_literal959 )\n @adaptor.add_child( root_0, tree_for_string_literal959 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_seq_of_statements_IN_searched_case_statement_5780 )\n seq_of_statements960 = seq_of_statements\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, seq_of_statements960.tree )\n end\n\n else\n match_count_248 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(248)\n\n\n raise eee\n end\n match_count_248 += 1\n end\n\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 success = true\n\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__, 166 )\n memoize( __method__, searched_case_statement_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"title": ""
},
{
"docid": "a5209ecc1ab22af8bd4f73644516a0fd",
"score": "0.53265035",
"text": "def solve! ##This needs to work with the finding posibilities\n counter_row = 0\n counter_column = 0\n while ((counter_row < 82) && (counter_column < 82))\n\n #binding.pry\n answer = @comp_board[counter_row][counter_column] - @stack\n\n if answer.length == 1\n @comp_board[counter_row][counter_column] = answer[0].to_i # <- these are whats sposed to be returned\n end\n end\n counter_row += 1\n counter_column += 1\n @comp_board\n end",
"title": ""
},
{
"docid": "a8eea3388b224215171c9a1b698e739d",
"score": "0.53070366",
"text": "def solved?\n solved = true\n 0.upto(@side-1) do |x|\n 0.upto(@side-1) do |y|\n 0.upto(@side-1) do |z|\n solved &&= points[x][y][z] || occupied.include?([x,y,z]) || goal == [x,y,z]\n end\n end\n end\n solved\n end",
"title": ""
},
{
"docid": "f28b2d2b7947856bf098a6937848fb14",
"score": "0.53057384",
"text": "def solved?\n return true if @free_point == nil\n return false\n end",
"title": ""
},
{
"docid": "2485ad4dd0f927a1de8daa69d71ef471",
"score": "0.52940327",
"text": "def solve\n begin\n find_all_candidates \n execute_strategy\n end while @single_candidates_found > 0 && @puzzle.solved? == false\n\n if !@puzzle.solved?\n puts \"could not solve\"\n puts \"assigned #{@total_values_assigned}\"\n end\n\n puts @puzzle.to_s\n end",
"title": ""
},
{
"docid": "b6a533d319134b11c3c7cef4c9b80a0c",
"score": "0.5292689",
"text": "def solve\n\n # If the puzzle is solved, we're done.\n if solved?\n return true\n end\n\n # If not, select the next empty cell.\n unknown = unsolvedCells.first\n\n # If it has no possible values, the puzzle is inconsistent. \n if unknown.possibleValues.empty?\n # We made a mistake and have to backtrack.\n return false\n end\n\n # Try every possible value.\n unknown.possibleValues.shuffle.each do |value|\n unknown.value = value\n if solve() == true\n return true\n else\n unknown.value = 0\n end\n end\n\n # If none of the possible values worked, we made a mistake even further back\n # and have to backtrack more.\n return false\n end",
"title": ""
},
{
"docid": "867680164d4a85fbc25412a9a1bd983e",
"score": "0.526796",
"text": "def solved? \n\t\n @guess == @answer ? true : false\n\tend",
"title": ""
},
{
"docid": "1ab8063e708c7d6e0d1023dc18dd81cb",
"score": "0.5261014",
"text": "def solve_by_logic\n\n no_edits_this_run = false\n\n until no_edits_this_run\n\n min_candidates_n = min_candidates = nil\n no_edits_this_run = true\n\n each_empty_cell do |_, n|\n\n candidates = candidates_for_cell(n)\n\n case candidates.length\n when 0\n # there are no candidates!?\n # .. the board must be impossible to solve\n raise ImpossibleBoard\n when 1\n # there's only one candidate!?\n # ..that's the only possible value\n # that the cell can have.\n # so fill it in\n @board[n] = candidates.first\n no_edits_this_run = false\n else\n\n # only save the candidates if we need them for later\n if no_edits_this_run && (min_candidates.nil? || (candidates.length < min_candidates.length))\n min_candidates = candidates\n min_candidates_n = n\n end\n\n end\n\n end\n\n end\n\n # return the index of the cell with the least number candidates\n # and the possible candidates\n # if the board is solved, return (nil, nil)\n return min_candidates_n, min_candidates\n\n end",
"title": ""
},
{
"docid": "feaf3e1417a72e5f601820b7aca6077a",
"score": "0.52599764",
"text": "def is_solved?\n @guts =~ /AB|BA|A#{\".\" * (@width - 1)}B|B#{\".\" * (@width - 1)}A/\n end",
"title": ""
},
{
"docid": "498efa7cd5ca135aff406019b30907b5",
"score": "0.5246215",
"text": "def df_solve(vertical, horizontal)\n solvable = true\n while move_df(vertical, horizontal) != [nil, nil]\n\n end\n\nend",
"title": ""
},
{
"docid": "03d68adb4945371cb1cefa90f460c779",
"score": "0.52439517",
"text": "def solvable?\n !solution.empty?\n end",
"title": ""
},
{
"docid": "ef7f2224b35e8d56cfc7d92a3d46a21d",
"score": "0.5238815",
"text": "def solve\n if validator.solved?\n values_matrix # <= solved matrix\n elsif validator.valid?\n process_queue_of_next_iterations # <= solved matrix or false\n else\n false # <= false\n end\n end",
"title": ""
},
{
"docid": "690beaab090f0f593a481cf5283741cb",
"score": "0.523379",
"text": "def case_expression\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 160 )\n return_value = CaseExpressionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n case_expression_start_index = @input.index\n\n root_0 = nil\n string_literal928 = nil\n string_literal932 = nil\n simple_case_expression929 = nil\n searched_case_expression930 = nil\n else_case_expression931 = nil\n\n tree_for_string_literal928 = nil\n tree_for_string_literal932 = nil\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return return_value\n end\n root_0 = @adaptor.create_flat_list\n\n\n # at line 896:4: 'CASE' ( simple_case_expression | searched_case_expression ) ( else_case_expression )? 'END'\n string_literal928 = match( T__142, TOKENS_FOLLOWING_T__142_IN_case_expression_5618 )\n if @state.backtracking == 0\n\n tree_for_string_literal928 = @adaptor.create_with_payload( string_literal928 )\n @adaptor.add_child( root_0, tree_for_string_literal928 )\n\n end\n # at line 896:11: ( simple_case_expression | searched_case_expression )\n alt_239 = 2\n look_239_0 = @input.peek( 1 )\n\n if ( look_239_0 == LPAREN || look_239_0.between?( PLUS, QUOTED_STRING ) || look_239_0.between?( ID, DOUBLEQUOTED_STRING ) || look_239_0.between?( T__57, T__58 ) || look_239_0 == T__100 || look_239_0.between?( T__110, T__111 ) || look_239_0.between?( T__116, T__117 ) || look_239_0 == T__140 || look_239_0 == T__142 )\n alt_239 = 1\n elsif ( look_239_0 == T__63 )\n alt_239 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 239, 0 )\n end\n case alt_239\n when 1\n # at line 896:13: simple_case_expression\n @state.following.push( TOKENS_FOLLOWING_simple_case_expression_IN_case_expression_5622 )\n simple_case_expression929 = simple_case_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, simple_case_expression929.tree )\n end\n\n when 2\n # at line 896:38: searched_case_expression\n @state.following.push( TOKENS_FOLLOWING_searched_case_expression_IN_case_expression_5626 )\n searched_case_expression930 = searched_case_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, searched_case_expression930.tree )\n end\n\n end\n # at line 896:65: ( else_case_expression )?\n alt_240 = 2\n look_240_0 = @input.peek( 1 )\n\n if ( look_240_0 == T__115 )\n alt_240 = 1\n end\n case alt_240\n when 1\n # at line 896:67: else_case_expression\n @state.following.push( TOKENS_FOLLOWING_else_case_expression_IN_case_expression_5632 )\n else_case_expression931 = else_case_expression\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, else_case_expression931.tree )\n end\n\n end\n string_literal932 = match( T__54, TOKENS_FOLLOWING_T__54_IN_case_expression_5637 )\n if @state.backtracking == 0\n\n tree_for_string_literal932 = @adaptor.create_with_payload( string_literal932 )\n @adaptor.add_child( root_0, tree_for_string_literal932 )\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n success = true\n\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__, 160 )\n memoize( __method__, case_expression_start_index, success ) if @state.backtracking > 0\n\n end\n \n return return_value\n end",
"title": ""
},
{
"docid": "e4c574538a8f0eee4438ea0a9d2b98e0",
"score": "0.5232813",
"text": "def solution\n return self if self.solved? \n return nil if self.unsolvable?\n\n pinch = self.find_pinch\n return nil if pinch.nil?\n values = self.possible_values(pinch[0], pinch[1])\n \n values.each do |value|\n b = Sodoku.new\n b.copy_board(self)\n b.set(pinch[0], pinch[1], value)\n b.settle\n if b.valid? && b.solved?\n return b\n end\n\n # not solved; recurse.\n solution = b.solution\n if !solution.nil? && solution.valid?\n return solution\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "92c206ab2394a517bcf5b9fba197ed23",
"score": "0.522945",
"text": "def solve(board_string)\n board_string.length.times do |elm_idx|\n next if board_string[elm_idx] != 0\n possible_values = find_posssible_values(board_string, elm_idx)\n\n possible_values.each do |idx|\n board_string[elm_idx] = idx\n # solve(board_string)\n if solve(board_string)\n return [board_string, true]\n end\n end\n board_string[elm_idx] = 0\n return false\n\n end\n return [board_string, true]\n\nend",
"title": ""
},
{
"docid": "9a31d246b30c2407d39299b9597426c0",
"score": "0.5225764",
"text": "def solved?\n @solved\n end",
"title": ""
},
{
"docid": "19a422f41da51a04d2e7fb1243957675",
"score": "0.52247226",
"text": "def solved?\n self.each_cell do |_,_,cell|\n return false if cell == :_\n end\n return true\n end",
"title": ""
},
{
"docid": "c303faeded2b565ef11ba94d7a52ed49",
"score": "0.52211815",
"text": "def solved?\n\t\t\tself == @word\n\t\tend",
"title": ""
},
{
"docid": "0f3175b231fa53a3c544e70863036f29",
"score": "0.52029574",
"text": "def find_matching_tile(unknown)\n @solution.each do |(x, y), soln|\n [NORTH, EAST, SOUTH, WEST].each do |direction|\n # skip if already something here\n dx, dy = case direction\n when NORTH then [0, 1]\n when EAST then [-1, 0]\n when SOUTH then [0, -1]\n when WEST then [1, 0]\n end\n next if @solution.key?([x + dx, y + dy])\n\n # try each unplaced tile in each orientation to see if it could be\n # placed next to `soln`\n unknown.each.with_index do |tile, i|\n [false, true].each do |hflip|\n [false, true].each do |vflip|\n [false, true].each do |transpose|\n if tile.edge(direction, hflip, vflip, transpose) == soln[:edges][(direction + 2) % 4]\n # match!\n return [i, x + dx, y + dy, hflip, vflip, transpose]\n end\n end\n end\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "9ca6a1045545f227728b6d2ddff116ea",
"score": "0.51972455",
"text": "def solved?(board)\n partial = false\n return true if board.all? { |row| row.join.chars.sort.join == \"123456789\" } &&\n board.transpose.all? { |col| col.join.chars.sort.join == \"123456789\" } &&\n make_squares_transpose(board).all? { |sq| sq.join.chars.sort.join == \"123456789\" }\n partial\nend",
"title": ""
},
{
"docid": "388f383df2c41ed0ac3243fb3a9c00c6",
"score": "0.5195617",
"text": "def solved?\t\t\n b = true\n @problem.myH.each do |x|\n b = b && x.guessed?\n if !b\n return b\n end\n end\n return b\n end",
"title": ""
},
{
"docid": "ea21c94edcc2c83e31aceb2e9a3ad17d",
"score": "0.519351",
"text": "def require_then?(in_pattern_node); end",
"title": ""
},
{
"docid": "a498ba9b92fbde77b7c6a250d60009d8",
"score": "0.5190576",
"text": "def optimal_plan?\n return sufficient_for_optimal? if nonsingular_plan?\n sufficient_for_optimal? ? true : nil\n end",
"title": ""
},
{
"docid": "ad11e5418f93ae3c9a280b7750f9de40",
"score": "0.5184097",
"text": "def solved?\n value != 0\n end",
"title": ""
},
{
"docid": "3667cee657b6c7e9e4e851555765a5bf",
"score": "0.5178719",
"text": "def judgement(board)\n\tcase \n\twhen @board[0] == @board[1] && @board[0] == @board[2] && @board[1] == @board[2] && true\n\t\tgame_result = true\t\t\n\twhen @board[3] == @board[4] && @board[4] == @board[5] && @board[3] == @board[4] && true\n\t\tgame_result = true\n\twhen @board[6] == @board[7] && @board[7] == @board[8] && @board[6] == @board[8] && true\n\t\tgame_result = true\t\t\n\twhen @board[0] == @board[3] && @board[0] == @board[6] && @board[3] == @board[6] && true\n\t\tgame_result = true\n\twhen @board[1] == @board[4] && @board[4] == @board[7] && @board[1] == @board[7] && true\n\t\tgame_result = true\n\twhen @board[2] == @board[5] && @board[2] == @board[8] && @board[5] == @board[8] && true\n\t\tgame_result = true\n\twhen @board[0] == @board[4] && @board[0] == @board[8] && @board[4] == @board[8] && true\n\t\tgame_result = true\n\twhen @board[2] == @board[4] && @board[2] == @board[6] && @board[4] == @board[6] && true\n\t\tgame_result = true\n\telse\n\t\tgame_result = false\t\n\tend\nend",
"title": ""
},
{
"docid": "e7df3241e223f4461d01a34d2bc6c15f",
"score": "0.51709276",
"text": "def solved?\n return false unless @board[-1][-1] == 0\n @board == goal_state\n end",
"title": ""
},
{
"docid": "7cfc58d4d82d8f0a5225e6a6bb0eeb2b",
"score": "0.51671517",
"text": "def solve(board)\n board = board.clone # make a local copy, we don't want to modify the actual board\n\n # this is the cell with the fewest possible candidates\n # note that if SudokuBoard#scan solved the board then i = j = candidates = nil\n i, j, candidates = board.scan\n\n if board.solved? # if the board is solved\n puts board # print it\n return\n else # otherwise, there're still empty cells\n # need to resort to brute force\n # take the cell with the smallest no. of possible candidates\n candidates.each do |candidate| # and try each one of them in turn\n board.board[i][j] = candidate # substitute the cell with a candidate\n begin\n # try to recursevely solve the board with the guessed value in place\n # this will either lead to a valid solution or raise an Impossible exception\n return solve(board)\n rescue Impossible # if the board is impossible..\n next # go to the next guess\n end\n end\n\n raise Impossible # none of the guesses worked... go back?\n end\nend",
"title": ""
},
{
"docid": "ddb5d1995db50a018bb00d3b7c727d45",
"score": "0.51592374",
"text": "def solution?\n @solutions.first.solution?\n end",
"title": ""
},
{
"docid": "f2abdba17471996a9d3de89cd7c65a3a",
"score": "0.5148404",
"text": "def check_answer(answer)\n answer == @solution\n end",
"title": ""
},
{
"docid": "cfddaebe50241f87b19538073d96f403",
"score": "0.5126751",
"text": "def solved?\n !@grid.nil? && @grid.missing.zero?\n end",
"title": ""
},
{
"docid": "29425ced421e997130717250b52ef56c",
"score": "0.5119467",
"text": "def solve!\n v = Valuation.new(@atoms)\n s = State.new(@clauses)\n vnew = dp1(s,v)\n if vnew == nil\n puts \"DavisPutnam: No solution. Impossible sentences.\"\n @atoms = []\n return nil\n end\n @atoms = vnew.atoms\n end",
"title": ""
},
{
"docid": "3bf52a310e75d562f241d5f4a37d4ecf",
"score": "0.5118803",
"text": "def wrong_attempt?(grid, attempt)\n if attempt.match?(/[^a-z]/)\n return \"not an english word\"\n elsif attempt.empty?\n return \"you didnt give any input, man\"\n elsif not_in_grid?(grid, attempt)\n return \"not in the grid\"\n elsif not_in_dictionary_api?(attempt)\n return not_in_dictionary_api?(attempt)\n end\n return nil\nend",
"title": ""
},
{
"docid": "58a668dcdb75f2969bced219b6fef98c",
"score": "0.5109159",
"text": "def solved?\n solved_rows? && solved_cols? && solved_squares?\n end",
"title": ""
},
{
"docid": "0a9b6da26d50d7c20e6893c6c1406d4f",
"score": "0.51090467",
"text": "def optimal?\n end",
"title": ""
},
{
"docid": "9c6ce4b6e9a81c9d3f9cc78bef0cc1c3",
"score": "0.51037127",
"text": "def visit_pattern(node, end_label)\n case node\n when AryPtn\n length_label = iseq.label\n match_failure_label = iseq.label\n match_error_label = iseq.label\n\n # If there's a constant, then check if we match against that constant\n # or not first. Branch to failure if we don't.\n if node.constant\n iseq.dup\n visit(node.constant)\n iseq.checkmatch(CheckMatch::VM_CHECKMATCH_TYPE_CASE)\n iseq.branchunless(match_failure_label)\n end\n\n # First, check if the #deconstruct cache is nil. If it is, we're going\n # to call #deconstruct on the object and cache the result.\n iseq.topn(2)\n deconstruct_label = iseq.label\n iseq.branchnil(deconstruct_label)\n\n # Next, ensure that the cached value was cached correctly, otherwise\n # fail the match.\n iseq.topn(2)\n iseq.branchunless(match_failure_label)\n\n # Since we have a valid cached value, we can skip past the part where\n # we call #deconstruct on the object.\n iseq.pop\n iseq.topn(1)\n iseq.jump(length_label)\n\n # Check if the object responds to #deconstruct, fail the match\n # otherwise.\n iseq.event(deconstruct_label)\n iseq.dup\n iseq.putobject(:deconstruct)\n iseq.send(YARV.calldata(:respond_to?, 1))\n iseq.setn(3)\n iseq.branchunless(match_failure_label)\n\n # Call #deconstruct and ensure that it's an array, raise an error\n # otherwise.\n iseq.send(YARV.calldata(:deconstruct))\n iseq.setn(2)\n iseq.dup\n iseq.checktype(CheckType::TYPE_ARRAY)\n iseq.branchunless(match_error_label)\n\n # Ensure that the deconstructed array has the correct size, fail the\n # match otherwise.\n iseq.push(length_label)\n iseq.dup\n iseq.send(YARV.calldata(:length))\n iseq.putobject(node.requireds.length)\n iseq.send(YARV.calldata(:==, 1))\n iseq.branchunless(match_failure_label)\n\n # For each required element, check if the deconstructed array contains\n # the element, otherwise jump out to the top-level match failure.\n iseq.dup\n node.requireds.each_with_index do |required, index|\n iseq.putobject(index)\n iseq.send(YARV.calldata(:[], 1))\n\n case required\n when VarField\n lookup = visit(required)\n iseq.setlocal(lookup.index, lookup.level)\n else\n visit(required)\n iseq.checkmatch(CheckMatch::VM_CHECKMATCH_TYPE_CASE)\n iseq.branchunless(match_failure_label)\n end\n\n if index < node.requireds.length - 1\n iseq.dup\n else\n iseq.pop\n iseq.jump(end_label)\n end\n end\n\n # Set up the routine here to raise an error to indicate that the type\n # of the deconstructed array was incorrect.\n iseq.push(match_error_label)\n iseq.putspecialobject(PutSpecialObject::OBJECT_VMCORE)\n iseq.putobject(TypeError)\n iseq.putobject(\"deconstruct must return Array\")\n iseq.send(YARV.calldata(:\"core#raise\", 2))\n iseq.pop\n\n # Patch all of the match failures to jump here so that we pop a final\n # value before returning to the parent node.\n iseq.push(match_failure_label)\n iseq.pop\n when VarField\n lookup = visit(node)\n iseq.setlocal(lookup.index, lookup.level)\n iseq.jump(end_label)\n end\n end",
"title": ""
},
{
"docid": "8548501c641cec245d57081602e9d343",
"score": "0.5102941",
"text": "def match(fact)\n _match(pattern,fact)\n end",
"title": ""
},
{
"docid": "c5f6ffb14d298d069f3cfb276f328509",
"score": "0.51000756",
"text": "def solved?\n !@grid.nil? && @grid.missing == 0\n end",
"title": ""
},
{
"docid": "51a866c8c4bdabbbd9f1f7d0c0174011",
"score": "0.5099798",
"text": "def solve!\n solve_position(0, 0)\n end",
"title": ""
},
{
"docid": "dbbfc5cc19cfedf6f126275e28a2ca7e",
"score": "0.5098586",
"text": "def solved?(challenge, solution)\n decrypt(challenge) == solution\n end",
"title": ""
},
{
"docid": "28f552cea9b687789100d5c2f0c5ff6f",
"score": "0.50945747",
"text": "def is_solved?(matrix)\n !has_null?(matrix) &&\n rows_solved?(matrix) &&\n columns_solved?(matrix) &&\n diagonals_solved?(matrix)\nend",
"title": ""
},
{
"docid": "7d2bc546ed92f3540d768f3edecdeee3",
"score": "0.50937104",
"text": "def dispatch_best_first\n (1..@capacities.values.size).each do |n|\n @capacities.values.combination(n).each do |value_combination|\n return true if check_combination value_combination\n end\n end\n\n closest_match_or_all\n end",
"title": ""
},
{
"docid": "5543761ca6d6b76308ca1909ceb4fafe",
"score": "0.50931513",
"text": "def solvable?\n self.initial_segments.detect { |s| s.solvable? } ? true : false\n end",
"title": ""
},
{
"docid": "b376717365045d8cf780ce6c2eebaea3",
"score": "0.5089884",
"text": "def solve_each_case( cases )\n cases.each{ |c| solve_one_case(c) }\n end",
"title": ""
},
{
"docid": "f90fc2c064a9ad52e49f373cf46c65e8",
"score": "0.5088976",
"text": "def solve( puzzle )\n\tixs = (0...9).to_a.product((0...9).to_a)\n\tixs.each {|xy|\n\t\tcands = candidates(xy[0],xy[1],puzzle)\n\t\tif cands.size == 1\n\t\t\tpuzzle[xy[0]][xy[1]] = cands[0]\n\t\tend\n\t\tcands = candidates2(xy[0],xy[1],puzzle)\n\t\tif cands.size == 1\n\t\t\tpuzzle[xy[0]][xy[1]] = cands[0]\n\t\tend\n\t}\t\n\tmin = ixs.inject {|a,b|\n\t\ta_candidates = candidates(a[0],a[1],puzzle)\n\t\tb_candidates = candidates(b[0],b[1],puzzle)\t\n\t\tif a_candidates.size == 0 then b\n\t\telsif b_candidates.size == 0 then a\n\t\telse (a_candidates.size < b_candidates.size) ? a : b end\n\t}\n\tcandidates(min[0],min[1],puzzle).each {|c|\n\t\ttest = Marshal.load(Marshal.dump(puzzle))\n\t\ttest[min[0]][min[1]] = c\n\t\tresult = solve(test)\n\t\tif check(result)\n\t\t\treturn result\n\t\tend\n\t}\t\n\treturn puzzle\nend",
"title": ""
},
{
"docid": "ca8dcfe18fbd2448b61315c80274e51d",
"score": "0.50872904",
"text": "def brute_force\n\n # First narrow the board down.\n calculate_options\n\n # Navigate each cell\n board.each do |row, col, value|\n\n # If we see and empty cell:\n if value == 0\n\n # Navigate each option\n options[row, col].each do |an_option|\n\n # Save the state of the board, this is\n # necessary because calculate_options()\n # mangles the board.\n old_board = Board.new( board )\n \n # Try this option\n board[row, col] = an_option\n\n # Recurse\n return true if brute_force\n \n # No solution. Revert to saved board\n # and try the next option.\n @board = old_board\n end\n\n break\n end\n\n end\n\n # Did we solve it?\n return true if board.valid? \n false\n end",
"title": ""
},
{
"docid": "8dadebb254eed87144defdbb1a9233f6",
"score": "0.5086497",
"text": "def solve(input)\n input\nend",
"title": ""
},
{
"docid": "88586b0858c7c24654c8ce5905f86854",
"score": "0.5084253",
"text": "def possible_match(info, choice)\n\ti = 0\n\twhile i < choice.length\n\t\t# puts 'from posssible, team is ' + team[0]\n\t\tif match_check(info, choice[i]) == 0\n\t\t\treturn 0\n\t\telsif (choice.length == 1) && (info[i] == choice[0])\n\t\t\treturn 1\n\t\telse\n\t\t\ti += 1\n\t\tend\n\tend\n\treturn 1\nend",
"title": ""
},
{
"docid": "83ceb72705868524002f27d1593a6c09",
"score": "0.5082005",
"text": "def detect_pattern(src, kind)\n retval = \n case kind\n when Symbol\n src.method(kind).call\n when Proc\n src.instance_eval(kind)\n when Method\n src.call\n else\n raise \"don't know how to detect pattern #{src.inspect} / #{kind.inspect}\"\n end\n retval ? kind : nil\n end",
"title": ""
},
{
"docid": "0e4cdaf8115fea4f6767ce17f2cd2326",
"score": "0.5080537",
"text": "def solution?\n board = Board.new(@arr)\n @arr.all? && board.valid?\n end",
"title": ""
},
{
"docid": "4cbd68cb5f7b2ad064e99897f437798f",
"score": "0.5080228",
"text": "def find_solution\n\t\tprint \"Finding Solution\\n\"\n\t\tsolution = @maze_solver.find_path\n\t\tif solution\n\t\t\tprint \"There is a path through the maze\\n\"\n\t\t\tprint \"Printing the path\\n\"\n\t\t\t@maze_solver.print_path\n\t\telse\n\t\t\tprint \"There is no path\\n\"\n\t\tend\n\t\treturn solution\n\tend",
"title": ""
},
{
"docid": "3cc46a9ce2d32e38ed48dab72b1751bf",
"score": "0.507559",
"text": "def solve_2\n grammatic_time = Time.now\n grammatic = Grammatic.new(@rules, @terminals)\n pp \"Gramatic bilding: #{Time.now - grammatic_time}\"\n\n found_correct = 'ababababbbaaaaaaababbbbbbbbabbab'\n\n # res = AlgorithmCYK.new(grammatic, found_correct).call\n # pp res\n\n # byebug\n\n # res\n\n # algorithm_time = Time.now\n # res = AlgorithmCYK.new(grammatic, 'aaaabbaaaabbbbaaaaababba').call\n # pp \"Algorithm time: #{Time.now - algorithm_time}\"\n # res\n\n # bababbabaabaaababbbaabab\n # aaababbbaaabbbaaaaabbbab\n # aabaaaaabbbabaababaaaaab\n # bbaababbbbababbaaaababaa\n # baaaaaaabbaabbbbbaabaaba\n # bbabbaaaaaaabaaaaabbabbb\n # aabbaababababbabbaabbaba\n # ababaaabaabaabbbbaaaabba\n # abaaaaaabbbababbbaaaabba\n\n sorted = @messages.sort_by(&:size)\n # byebug\n\n # assert_equal true, AlgorithmCYK.new(grammatic, 'ababbb').call\n # assert_equal true, AlgorithmCYK.new(grammatic, 'abbbab').call\n # assert_equal true, AlgorithmCYK.new(grammatic, 'abbbab').call\n\n res = sorted.each_with_index.sum do |message, index|\n # # check = AlgorithmCYK.new(grammatic, message).call\n # # byebug\n # # check == true ? 1 : 0\n\n # puts \"\\n\\n\\n\"\n # pp message\n # puts \"One to go... #{index + 1}\"\n ress = AlgorithmCYK.new(grammatic, message).call ? 1 : 0\n pp [message, ress]\n ress\n end\n\n res\n\n # pp @rules\n # result\n end",
"title": ""
},
{
"docid": "bd7fe0e990ad3b2fc20ed3af65333e62",
"score": "0.5075455",
"text": "def find_equation(arr)\n result = arr.pop\n operators = ['+', '-', '*', '/'].repeated_permutation(arr.length - 1)\n operators.each do |op|\n eq = calc arr, op\n return eq if eval(eq) == result\n end\n puts 'no equation'\nend",
"title": ""
},
{
"docid": "ab1ad25b50ea2551eea83fb2787371e4",
"score": "0.50730217",
"text": "def next\n move = best_move\n case move.last.length\n when 1\n a = @arr.map.with_index do |e, i|\n if @empty_fields.include?(i)\n free_nums = possibilities[i]\n free_nums.first if free_nums.length == 1\n else\n e\n end\n end\n return self.class.new a\n when 0\n return :unsolvable\n else\n return :too_hard\n end\n end",
"title": ""
},
{
"docid": "aa898575d3601d23b94ce4e5659020b6",
"score": "0.50705314",
"text": "def eval_case(cdr,local)\n\t\tcheck_argc(cdr,1,true) # 1+\n\t\tkey,rest=pair_divide(cdr)\n\t\tkey=sobj_eval_sym(key,local)\n\t\twhile rest.type!=NULL\n\t\t\tde,rest=pair_divide(rest)\n\t\t\tdata,exprs=pair_divide(de)\n\t\t\tif((data==make_symbol(\"else\") && rest.type==NULL) ||\n\t\t\t\t list_contains(key,data))\n\t\t\t\treturn eval_begin(exprs,local)\n\t\t\tend\n\t\tend\n\t\treturn make_undef()\n\tend",
"title": ""
},
{
"docid": "dcd4aa501d0830e1ed1420aaab376883",
"score": "0.5069459",
"text": "def solve_current\n check_result = check_entries\n if !check_result[:discrepencies].empty?\n return\n end\n result = solve(Puzzle.new(self.get_current_grid))\n if !result\n JOptionPane.showMessageDialog(nil, \"No solution exists from this point!\")\n else\n color_differences(@color_map, result.grid, Color::GREEN)\n @current_puzzle = result\n end\n end",
"title": ""
},
{
"docid": "84992aade03aa73ebbdab9feb93f9655",
"score": "0.5067959",
"text": "def check_result\n plan = BasisPlan.simple_init(task.kappa, task.basis_indexes)\n plain_task = Tasks::Simplex.new(task.task, plan, task.sign_restrictions)\n plain_task.optimal_plan?\n end",
"title": ""
},
{
"docid": "b7d6adbb2f84750315335302b6aca227",
"score": "0.50643176",
"text": "def solve_no_priority(inp)\n init(inp)\n if @err != SUCCESS\n solution = { errCode: @err }\n elsif @fuzzy.empty? and @arranged.length <= 2\n solution = shortest_path(@inp['locationList'])\n elsif @fuzzy.empty?\n solution = fit_schedule\n else\n solution = general_search\n end\n format(solution)\n return solution\n end",
"title": ""
},
{
"docid": "b0d092f2db4e8bcd86c1144ab928fc3c",
"score": "0.50627387",
"text": "def solve\n\n counter = 0\n while counter < @max_steps\n\n # Choosing the queen to evaluate.\n position = @csp.choose_queen\n row = position[0]\n column = position[1]\n\n # Generating the violation array for the row.\n violation_array = []\n @csp.board[row].each_with_index do |n, index|\n violation_array << @csp.check_violations([row, index])\n end\n\n # Finding the case with lesser violations.\n best = 10 * @csp.m\n violation_array.each do |n|\n best = n if n <= best\n end\n\n # Finding the indexes of the best cases.\n best_index = []\n violation_array.each_with_index do |n, index|\n best_index << index if n == best\n end\n\n # Choosing one of the indexes randomly\n final_index = best_index[rand(best_index.length - 1)]\n\n # Moving the queen to the new best position\n @csp.board[row][column] = 0\n @csp.board[row][final_index] = 1\n\n counter += 1\n\n end\n\n end",
"title": ""
}
] |
101fdb3ea93e81fe64d8f77182b2acc2
|
! because method calls save method...
|
[
{
"docid": "8b0e94075900adfc85f9ec5305bf9ca6",
"score": "0.0",
"text": "def make_vip!\n self.add_role :VIP\n self.invitation_limit = 10\n self.save\n end",
"title": ""
}
] |
[
{
"docid": "c9584bff3624f8ea714cb0237a667edf",
"score": "0.7807171",
"text": "def save!; end",
"title": ""
},
{
"docid": "aca52100a0ae677212c2946c9a6dcc3b",
"score": "0.7750843",
"text": "def save!\n _save(false)\n end",
"title": ""
},
{
"docid": "506427d2d56839f78e51362ddd64ac54",
"score": "0.7657604",
"text": "def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end",
"title": ""
},
{
"docid": "d4608cf9f45dafcaf6f5ef874cdd2a4e",
"score": "0.7591482",
"text": "def save!\r\n end",
"title": ""
},
{
"docid": "40584d317fda3673dfaff44e08643bfd",
"score": "0.7566915",
"text": "def save\n save! unless do_not_save\n end",
"title": ""
},
{
"docid": "40584d317fda3673dfaff44e08643bfd",
"score": "0.7566915",
"text": "def save\n save! unless do_not_save\n end",
"title": ""
},
{
"docid": "8ac71778b426cc50d41e03784035acf2",
"score": "0.7543349",
"text": "def save!\n end",
"title": ""
},
{
"docid": "8ac71778b426cc50d41e03784035acf2",
"score": "0.7541847",
"text": "def save!\n end",
"title": ""
},
{
"docid": "8ac71778b426cc50d41e03784035acf2",
"score": "0.7541847",
"text": "def save!\n end",
"title": ""
},
{
"docid": "03269e87d38e5330f3c17faf8e538787",
"score": "0.7476362",
"text": "def save!\n self.save || raise(ActiveRecord::RecordNotSaved.new(nil, self))\n end",
"title": ""
},
{
"docid": "2d14721fbe3d56eb8afc9fabfd2df205",
"score": "0.7466079",
"text": "def save!\nend",
"title": ""
},
{
"docid": "d4e8a21ae73cab3767c990f628d8099a",
"score": "0.7418288",
"text": "def save\n self.save! rescue false\n end",
"title": ""
},
{
"docid": "d4e8a21ae73cab3767c990f628d8099a",
"score": "0.7418288",
"text": "def save\n self.save! rescue false\n end",
"title": ""
},
{
"docid": "d4e8a21ae73cab3767c990f628d8099a",
"score": "0.7418288",
"text": "def save\n self.save! rescue false\n end",
"title": ""
},
{
"docid": "965c5bc16551fbfe4eba08bc01527fc8",
"score": "0.74169385",
"text": "def save\n super save\n end",
"title": ""
},
{
"docid": "965c5bc16551fbfe4eba08bc01527fc8",
"score": "0.74169385",
"text": "def save\n super save\n end",
"title": ""
},
{
"docid": "b62e3e138142de460c0d29fe2a805ffb",
"score": "0.7392142",
"text": "def save; true; end",
"title": ""
},
{
"docid": "b62e3e138142de460c0d29fe2a805ffb",
"score": "0.7392142",
"text": "def save; true; end",
"title": ""
},
{
"docid": "7bec57e8f17b522907c2c24ebac2a8f6",
"score": "0.73804486",
"text": "def save ; end",
"title": ""
},
{
"docid": "7bec57e8f17b522907c2c24ebac2a8f6",
"score": "0.73804486",
"text": "def save ; end",
"title": ""
},
{
"docid": "fb9d10f3f70b5533687dcf0a1062cc66",
"score": "0.7364022",
"text": "def save!\n\nend",
"title": ""
},
{
"docid": "792023394504d78801a972feb5dc7a1a",
"score": "0.73633397",
"text": "def save!\n self\n end",
"title": ""
},
{
"docid": "ede6923121bf410a0c61ce2f35621d61",
"score": "0.7357532",
"text": "def save\n \n end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e8af8e216821b936b27fe4e3e2d106ff",
"score": "0.73445845",
"text": "def save; end",
"title": ""
},
{
"docid": "e1e066351bb59aaf4f76108f2b5a549f",
"score": "0.7328604",
"text": "def save!\n true\n end",
"title": ""
},
{
"docid": "716adf370a023ea5ffc79f58194340ce",
"score": "0.73178875",
"text": "def save!\n _save(:save!)\n end",
"title": ""
},
{
"docid": "40bfed53462d6583e45339203fc4de95",
"score": "0.7293943",
"text": "def save!(*)\n super.tap do\n changes_applied\n end\n end",
"title": ""
},
{
"docid": "40bfed53462d6583e45339203fc4de95",
"score": "0.7293943",
"text": "def save!(*)\n super.tap do\n changes_applied\n end\n end",
"title": ""
},
{
"docid": "40bfed53462d6583e45339203fc4de95",
"score": "0.7293943",
"text": "def save!(*)\n super.tap do\n changes_applied\n end\n end",
"title": ""
},
{
"docid": "e239d108f4bbd8231fa5540bfc98ffae",
"score": "0.72892725",
"text": "def save!\n save(nil)\n end",
"title": ""
},
{
"docid": "c689522e2216cf93bceaee658ede115b",
"score": "0.7208979",
"text": "def save!\n save(true) || raise(OperationFailed)\n end",
"title": ""
},
{
"docid": "c9a2d13b02011dc45e8185d31fa5d5ac",
"score": "0.7172469",
"text": "def save\n false\n end",
"title": ""
},
{
"docid": "a3bde47495dda22107fbe893e66ebd03",
"score": "0.71431065",
"text": "def save\r\n #TODO\r\n end",
"title": ""
},
{
"docid": "629192988bec8faeb65312d2de275b4b",
"score": "0.7141275",
"text": "def save\n super\n end",
"title": ""
},
{
"docid": "207f5af97baf4c1f6732ab98a0340694",
"score": "0.7128377",
"text": "def will_save; end",
"title": ""
},
{
"docid": "207f5af97baf4c1f6732ab98a0340694",
"score": "0.7128377",
"text": "def will_save; end",
"title": ""
},
{
"docid": "2d14d77e23a9ebc87b8ecf48a5d2f037",
"score": "0.71215934",
"text": "def save\n\t\tsuper\n\tend",
"title": ""
},
{
"docid": "d922efc78b74a477d99f8789efb7640c",
"score": "0.7100842",
"text": "def save\n return(false) unless self.changed?\n self.save!\n end",
"title": ""
},
{
"docid": "7f8bf9a062b4ac74eab41da10debd222",
"score": "0.70960194",
"text": "def dirty!; end",
"title": ""
},
{
"docid": "4bef560cbf1df56cf46a2491a1d56484",
"score": "0.7084292",
"text": "def save\n _save(true)\n end",
"title": ""
},
{
"docid": "dde33956056cfe1db6732fcbceaaf7c4",
"score": "0.70770997",
"text": "def save\n temp = eval(self.class.name.to_s + \".find(\" + self.id.to_s + \")\") unless self.new_record? ## moze to zmienic, zeby nie odwolywac sie dodatkowo do bazy ? ;)\n\n @method = \"Create\" unless !self.new_record? ## ustawienie akcji na create, jesli nowy rekord\n\n changes = self.changes\n changes.delete \"updated_at\"\n\n wrk1 = self.changed?\n wrk2 = !self.new_record?\n wrk3 = super\n\n (\n archiving temp unless !(wrk1 & wrk2 & wrk3)\n create_blank self, changes unless !((wrk1 | !wrk2) & wrk3)\n ) unless !(changes.size > 0)\n\n wrk3\n end",
"title": ""
},
{
"docid": "86a5f9184d3a08409bb09045e63233f6",
"score": "0.705852",
"text": "def persisted?; false end",
"title": ""
},
{
"docid": "86a5f9184d3a08409bb09045e63233f6",
"score": "0.705852",
"text": "def persisted?; false end",
"title": ""
},
{
"docid": "86a5f9184d3a08409bb09045e63233f6",
"score": "0.705852",
"text": "def persisted?; false end",
"title": ""
},
{
"docid": "e554fa81bae2d08e99de71f658ccd85d",
"score": "0.70523304",
"text": "def save\n _save\n end",
"title": ""
},
{
"docid": "9e4a4baa8e65688796b70fc5f66b7c96",
"score": "0.70483154",
"text": "def save\n check_complete\n super\n end",
"title": ""
},
{
"docid": "a6d2170d36bdb30da5214f14ad09b4dd",
"score": "0.7038421",
"text": "def save!\n save || raise(ArgumentError, 'failed to save!')\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "14ffd5116ca8c4041256c2a31f38b066",
"score": "0.7037807",
"text": "def save()\n super\n end",
"title": ""
},
{
"docid": "58b3123867bb8a650f4c883dbdbf24b6",
"score": "0.7009724",
"text": "def save \n @saved = true\n end",
"title": ""
},
{
"docid": "78a464c1b4a4eb7cead065ea83d6f779",
"score": "0.700758",
"text": "def save\n # .....\n end",
"title": ""
},
{
"docid": "87c34e7837f168804e069d20327b88d7",
"score": "0.69982284",
"text": "def save\n end",
"title": ""
},
{
"docid": "87c34e7837f168804e069d20327b88d7",
"score": "0.69982284",
"text": "def save\n end",
"title": ""
},
{
"docid": "87c34e7837f168804e069d20327b88d7",
"score": "0.69982284",
"text": "def save\n end",
"title": ""
},
{
"docid": "87c34e7837f168804e069d20327b88d7",
"score": "0.69982284",
"text": "def save\n end",
"title": ""
},
{
"docid": "87c34e7837f168804e069d20327b88d7",
"score": "0.69982284",
"text": "def save\n end",
"title": ""
},
{
"docid": "9545dabd223e4fb0b6678fef76f0d32e",
"score": "0.69924575",
"text": "def saved_changes?; end",
"title": ""
},
{
"docid": "f781a46cf1331e7b2333ada6c4e08301",
"score": "0.69922984",
"text": "def save\n if !self.class.all.include?(self)\n self.class.all << self \n end\n end",
"title": ""
},
{
"docid": "1f8410075c7713ba9e7b0b15660b4b73",
"score": "0.699063",
"text": "def activerecord_before_save\n save\n end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.698478",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.698478",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.698478",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.698478",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "6d59d014cabf3859c699419783231b15",
"score": "0.698478",
"text": "def persisted?; end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "f4ca7c331218635f65035f93a3c9e5a1",
"score": "0.6984107",
"text": "def save\n end",
"title": ""
},
{
"docid": "e5c713425011e30122c646a08b5b803a",
"score": "0.6967833",
"text": "def persisted?; false; end",
"title": ""
},
{
"docid": "e5c713425011e30122c646a08b5b803a",
"score": "0.6967833",
"text": "def persisted?; false; end",
"title": ""
},
{
"docid": "e5c713425011e30122c646a08b5b803a",
"score": "0.6967833",
"text": "def persisted?; false; end",
"title": ""
},
{
"docid": "a46c3355bb6fedc79be3732a8d80d40b",
"score": "0.6962196",
"text": "def save_without_auditing\n without_auditing { save }\n end",
"title": ""
},
{
"docid": "9132dff4adaf6a1aaf44c8a08dbf3927",
"score": "0.69611096",
"text": "def _save\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "333b2b354627eeb85cc40dc9cf286696",
"score": "0.69500107",
"text": "def save\n commit(false)\n end",
"title": ""
},
{
"docid": "08bf54e61f6300bfdf51cea1d66c5e59",
"score": "0.69420576",
"text": "def save\n true\n end",
"title": ""
},
{
"docid": "08bf54e61f6300bfdf51cea1d66c5e59",
"score": "0.69420576",
"text": "def save\n true\n end",
"title": ""
},
{
"docid": "945d406a8f2a8cb1fbb2070817889949",
"score": "0.6940543",
"text": "def did_save; end",
"title": ""
},
{
"docid": "459498cb335c99675d54a3639227c1f6",
"score": "0.69264024",
"text": "def save\n self.save!\n end",
"title": ""
},
{
"docid": "773d235e6831cbc1e0c91b3e53eb8f03",
"score": "0.6916234",
"text": "def save!(*) #:nodoc:\n super.tap do\n @previously_changed = changes\n @changed_attributes.clear\n end\n end",
"title": ""
}
] |
162c0622b6006a3919e35520c62baea8
|
obtain a detailed printable version of the constraint return (String) detailed string representing the constraint
|
[
{
"docid": "cc2f52954a4b955230a33bbf56c32b23",
"score": "0.0",
"text": "def display\n return \"#{@type} (#{@value})\"\n end",
"title": ""
}
] |
[
{
"docid": "4ad9e82a019c8bdcc6cd0f6e642d4420",
"score": "0.76352406",
"text": "def to_s\n \"#{@source} #{@description} #{@target} (#{@constraint})\"\n end",
"title": ""
},
{
"docid": "d4bf75da5bbd99a73c03e7f59bb84ce4",
"score": "0.7454387",
"text": "def to_s\n viol_s = ' '\n @constraints.each do |c|\n viols_c = if @violations.key?(c) # if c has a violation count\n get_viols(c)\n else\n '?'\n end\n viol_s += \" #{c}:#{viols_c}\"\n end\n output_s = @output.to_s\n \"#{@input} --> #{output_s} #{viol_s}\"\n end",
"title": ""
},
{
"docid": "d23de6a5796b9dc34f2c711d80e2f7f3",
"score": "0.7047749",
"text": "def pretty_constraint\n unless @pretty_constraint\n raise UnexpectedValueError, \"Link #{self} has been misconfigured and had no pretty constraint given.\"\n end\n @pretty_constraint\n end",
"title": ""
},
{
"docid": "f00fe4f2c856cd1b933a4e18fc82d660",
"score": "0.68269634",
"text": "def inspect\n node_constrains = @node.type_constrains @node_env\n \"#{name} :: (#{constrains_str node_constrains}) => \" + (signature node_constrains)\n end",
"title": ""
},
{
"docid": "f4ff6be3a273bce010b93bcb6e56eed8",
"score": "0.6755321",
"text": "def inspect\n str = OneGadget::Helper.hex(value)\n str += effect ? \" #{effect}\\n\" : \"\\n\"\n unless constraints.empty?\n str += \"#{OneGadget::Helper.colorize('constraints')}:\\n \"\n str += merge_constraints.join(\"\\n \")\n end\n str.gsub!(/0x[\\da-f]+/) { |s| OneGadget::Helper.colorize(s, sev: :integer) }\n OneGadget::ABI.all.each do |reg|\n str.gsub!(/([^\\w])(#{reg})([^\\w])/, \"\\\\1#{OneGadget::Helper.colorize('\\2', sev: :reg)}\\\\3\")\n end\n \"#{str}\\n\"\n end",
"title": ""
},
{
"docid": "871b0b84716657e2f9143d38c9ccdb29",
"score": "0.6622129",
"text": "def odk_constraint\n exps = []\n exps << \". #{minstrictly ? '>' : '>='} #{casted_minimum}\" if minimum\n exps << \". #{maxstrictly ? '<' : '<='} #{casted_maximum}\" if maximum\n exps.empty? ? nil : \"(\" + exps.join(\" and \") + \")\"\n end",
"title": ""
},
{
"docid": "5256b4b449e852b7eb6b0f490900d2af",
"score": "0.6528548",
"text": "def message\n if @constraint_error.message =~ /#{@field}/\n @constraint_error.message\n else\n \"#{@constraint_error.message} for field :#{@field}\"\n end\n end",
"title": ""
},
{
"docid": "d725ec40342b7feb79075cd095413efe",
"score": "0.6518664",
"text": "def constraint\n @constraint\n end",
"title": ""
},
{
"docid": "e0be49c4c2f6e4707a00886b38d63a30",
"score": "0.6509938",
"text": "def to_s\n\n\t\t\"{#{name}; aliases=#{aliases.join(', ')}; values_range=[ #{values_range.join(', ')} ]; default_value='#{default_value}'; help='#{help}'; required?=#{required?}; required_message=#{required_message}; constraint=#{constraint}; extras=#{extras}}\"\n\tend",
"title": ""
},
{
"docid": "2f00440d77eb38c6a6a8c1c50a182036",
"score": "0.64861554",
"text": "def constraint_label\n label\n end",
"title": ""
},
{
"docid": "bdae5e2aac73faf0abd6d8f1556ba9b5",
"score": "0.64744735",
"text": "def to_s\n \"#{name} #{clean_requirements}\"\n end",
"title": ""
},
{
"docid": "b91bb52ca639e65fa7c8eb4150e0db1e",
"score": "0.6462477",
"text": "def human_name\n \"约束\"\n end",
"title": ""
},
{
"docid": "34b71a46b5807f413c6b4722544ac18a",
"score": "0.6461744",
"text": "def pretty_string(source_package)\n \"#{source_package.pretty_string} #{@description} #{@target} #{@constraint.pretty_string}\"\n end",
"title": ""
},
{
"docid": "57153d80336ffab5fbe45bf49322be9c",
"score": "0.6460376",
"text": "def to_s\n name_str = @name\n children_str = (@children.nil?) ? '' : @children.to_s\n constraints_str = (@constraints.nil?) ? '' : @constraints.to_s\n name_str + children_str + constraints_str\n end",
"title": ""
},
{
"docid": "17b8e5a88bc06ed3e8cf8d621ec3be09",
"score": "0.6439028",
"text": "def to_s\n rule.inspect\n end",
"title": ""
},
{
"docid": "17b8e5a88bc06ed3e8cf8d621ec3be09",
"score": "0.6439028",
"text": "def to_s\n rule.inspect\n end",
"title": ""
},
{
"docid": "b1e59b52ae3b966c7c1426215ef771d2",
"score": "0.6402055",
"text": "def constrains_str(constrains)\n associate_constrain_and_name(\n remark_constrains_name(\n invert_constrains(constrains)))\n .map { |pair| pair.join(' ') }.join(', ')\nend",
"title": ""
},
{
"docid": "b2c3112be9136ed9ca94a1ded503faf9",
"score": "0.6278669",
"text": "def to_s\n str = requirements.map(&:to_s).join(\" \" + @op.to_s + \" \").to_s\n str = \"( \" + str + \" )\" if negative || requirements.size > 1\n str = \"!\" + str if negative\n str\n end",
"title": ""
},
{
"docid": "64bedb32eb76169b49f5a4bd463c91fa",
"score": "0.61969167",
"text": "def inspect\n\t\t\treturn %{#<%s:0x%0x %s(%s) < %s \"%s\" MUST: %p, MAY: %p>} % [\n\t\t\t\tself.class.name,\n\t\t\t\tself.object_id / 2,\n\t\t\t\tself.name,\n\t\t\t\tself.oid,\n\t\t\t\tself.sup_oid,\n\t\t\t\tself.desc,\n\t\t\t\tself.must_oids,\n\t\t\t\tself.may_oids,\n\t\t\t]\n\t\tend",
"title": ""
},
{
"docid": "ee2d7b92f7a9107709496ff6394291a9",
"score": "0.6183527",
"text": "def to_s(constraints = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "8d5916e9ed2aea3e23a5b46fdea0113e",
"score": "0.61608124",
"text": "def describe(value)\n \"#{negate ? 'none' : 'all'} of [#{CH.constraint_string(constraints, value)}]\"\n end",
"title": ""
},
{
"docid": "2625d3f64ac73428d4ed838ab4ae991e",
"score": "0.61174",
"text": "def constraints() return @constraints end",
"title": ""
},
{
"docid": "99aa34d1853275ddc8504004f7aaed49",
"score": "0.610861",
"text": "def constraint_list\n @constraints\n end",
"title": ""
},
{
"docid": "99aa34d1853275ddc8504004f7aaed49",
"score": "0.61084265",
"text": "def constraint_list\n @constraints\n end",
"title": ""
},
{
"docid": "19f361886672f83ed170d44380280dd3",
"score": "0.609919",
"text": "def to_s\n\t\t\"\\nName = #{@name}, \\nLevel = #{@level}, \\nBadConsequence: #{@bad}, \\nPrize: #{@prize}\"\n\tend",
"title": ""
},
{
"docid": "08d50e76c20886b3e361658a8bd5d2ad",
"score": "0.6050597",
"text": "def to_string(constraints = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "7c45a30babbff788785455dae46bbc3b",
"score": "0.60497653",
"text": "def to_s\n @subject_prefix + \":\" + @subject + \" \" + @pred_prefix + \":\" + @pred + \" \" + \"\\\"\" + @object + \"\\\"\"\n end",
"title": ""
},
{
"docid": "b6bb70e33cc0233b4862ae280e4eb195",
"score": "0.60295457",
"text": "def constraints; end",
"title": ""
},
{
"docid": "b6bb70e33cc0233b4862ae280e4eb195",
"score": "0.60295457",
"text": "def constraints; end",
"title": ""
},
{
"docid": "b6bb70e33cc0233b4862ae280e4eb195",
"score": "0.60295457",
"text": "def constraints; end",
"title": ""
},
{
"docid": "adfadca4956a0d20e9e8fd7def9124ad",
"score": "0.5997733",
"text": "def inspect\n %(#<#{self.class} schema=#{schema.inspect} rules=#{rules.inspect}>)\n end",
"title": ""
},
{
"docid": "51904ea270d3f3adb709214b8b0cfae1",
"score": "0.5971842",
"text": "def inspect\n \"(#{@lower.inspect} #{@lower_cond} #{@x.inspect} #{@upper_cond} #{@upper.inspect})\"\n end",
"title": ""
},
{
"docid": "f2f548c11777bfc2b2499c6f601debcf",
"score": "0.596985",
"text": "def constraint\n @constraint ||= metadata.constraint\n end",
"title": ""
},
{
"docid": "b36525c72cf584f518d2a12d3958c580",
"score": "0.594611",
"text": "def translate(problem)\n code = ''\n problem.constraints.each do |constraint|\n expression = constraint.expression\n if expression.is_a? Yarpler::Models::Expression\n code << 'constraint' + NEWLINE\n code << TAB + MinizincExpressionTranslator.new.translate(expression, problem) + NEWLINE + ';' + DOUBLE_NEWLINE\n else\n # @TODO exception!\n end\n end\n code\n end",
"title": ""
},
{
"docid": "0125ae1578c0be2f3cf85653913f217d",
"score": "0.5895201",
"text": "def inspect\n if @rules.size == 1\n \"#{@name}:-#{@rules.first.inspect}\"\n else\n @rules.each_with_object([\"#{@name}:-\"]) do |rule, lines|\n lines << rule.inspect\n end.join(\"\\n\")\n end\n end",
"title": ""
},
{
"docid": "00ec72a14ce2efbfcb24f8afd4ae95bb",
"score": "0.5882642",
"text": "def to_s\n text = \"#{@name}\\n\"\n text << \"#{@cost}\\n\" unless @cost.empty?\n text << \"#{@supertype} \" if @supertype\n text << @type\n text << \" -- #{@subtypes.join(' ')}\" if not @subtypes.nil? and @subtypes.any?\n text << \"\\n\"\n text << \"#{@power}/#{@toughness}\\n\" unless @power.nil? and @toughness.nil?\n text << \"#{@text}\\n\" unless @text.empty?\n text << \"#{@expansion}-#{@rarity}\\n\"\n end",
"title": ""
},
{
"docid": "e9b7f2c7022c0beabaea707d71606bff",
"score": "0.58611006",
"text": "def inspect\n \"#{self.conditions_set.inspect} -> #{ self.edges.empty? ? 'end' : self.edges.to_a.map{|e| e.inspect}.join(', ')}\"\n end",
"title": ""
},
{
"docid": "da5834a463f4cd15dcf0f3631dd00101",
"score": "0.5815372",
"text": "def to_s\n \"#{@name} #{@url} #{@risk} #{@description} #{@solution} #{@reference}\"\n end",
"title": ""
},
{
"docid": "e3f6cc1661eb46309321a3779b337d08",
"score": "0.58124644",
"text": "def inspect\n\t\tto_s\n\tend",
"title": ""
},
{
"docid": "166116c12653772617e198a7d71237fd",
"score": "0.5799005",
"text": "def to_s\n \"(#{@x} #{@cond_repr} #{@y})\"\n end",
"title": ""
},
{
"docid": "a604b22ca171e56d82f92c50571298e6",
"score": "0.57757497",
"text": "def to_s\n return concept.name + \": \" + attributes.collect{|name,value|\n next if value.nil? or value == \"\" or name !~ /value/\n case name\n when \"value_coded\"\n answer_concept.name\n when \"value_drug\"\n drug.name\n else\n value.to_s\n end\n }.compact.join(\", \")\n end",
"title": ""
},
{
"docid": "8fef96debdc5b1b84e097f2a491300fb",
"score": "0.57754236",
"text": "def to_s\n des = \"p#{self.prime}G#{self.generator}H#{self.public_value}\"\n \n if (self.membership_proof)\n des += \" #{self.membership_proof.to_s}\"\n end\n \n return des\n end",
"title": ""
},
{
"docid": "acdbab1357d42eb66f798c6686c3fd20",
"score": "0.5774347",
"text": "def to_s\n \"#{ @rule.name }: #{ @lexeme.inspect[1..-2] }\"\n end",
"title": ""
},
{
"docid": "ae975571cad8c561b034410eabbee7d6",
"score": "0.5773741",
"text": "def to_s\n return concept.name + \": \" + attributes.collect{|name,value|\n next if value.nil? or value == \"\" or name !~ /value/\n case name\n when \"value_coded\"\n answer_concept.name\n when \"value_drug\"\n drug.name\n else\n value.to_s\n end\n }.compact.join(\", \")\n end",
"title": ""
},
{
"docid": "9d72d05fe697106d47b4d9738658e8da",
"score": "0.5747917",
"text": "def constraint\n @constraint ||= options[:metadata].constraint\n end",
"title": ""
},
{
"docid": "7ad40078bf3b91530c7769cb365b2bc7",
"score": "0.57459694",
"text": "def inspect\n str = Inspect.dashed_line(self.class, 1)\n self.class.class_eval { @attributes }.each do |attr|\n str << Inspect.inspect_asn1_attribute(attr, self[attr], 1)\n end\n str\n end",
"title": ""
},
{
"docid": "009ac6b71f20002aef284d978651d09e",
"score": "0.5745052",
"text": "def to_s()\n return dotted_rule.to_s + \" | #{origin}\"\n end",
"title": ""
},
{
"docid": "59322325dd3c5b30bef376f90dab4b4e",
"score": "0.5740595",
"text": "def constrainable_label\n constrainable.try(:constrainable_label) || 'Name Missing'\n end",
"title": ""
},
{
"docid": "b8f48e169ccd4523fc4bd9bdba13f621",
"score": "0.57297844",
"text": "def to_s\n \"Rules->type:#{type}, amount:#{amount}, value:#{value}, code:#{code}\"\n end",
"title": ""
},
{
"docid": "2b0f3afe191dc8f5213a2a558dd08e62",
"score": "0.57296157",
"text": "def verifiable_info\n { 'Confirmation name': saint_name }\n end",
"title": ""
},
{
"docid": "3e601f1805d50100120ced9babe4ca93",
"score": "0.5723182",
"text": "def to_s\n if self.attributes? then\n \"%-20p [ %-20s ]\" % [name, attributes.join(',')]\n else\n \"#{name.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "f796b724fb980eddda8558b863dd9688",
"score": "0.5722095",
"text": "def to_s\n name.ljust(15) + \"\\t\" +\n type + \" \" + \n size + \"\\t:= \" + \n value + \"\\t\" +\n comment +\n \"\\n\"\n end",
"title": ""
},
{
"docid": "e2134e979c51044a25ada0755f8d4531",
"score": "0.57118154",
"text": "def to_s\n \"#{@subject} #{comparator_string} #{@value}\"\n end",
"title": ""
},
{
"docid": "c3dd962ed8f9c9c751e4c6d38a707b9f",
"score": "0.57022154",
"text": "def to_s\n \"rule #{name.inspect}, node_class: #{node_class}\\n\\t\"+\n \"#{variants.collect {|v|v.to_s}.join(\"\\n\\t\")}\"\n end",
"title": ""
},
{
"docid": "5ca82985a3b732c4cfada7d6d0ddfb9d",
"score": "0.5697259",
"text": "def to_s\n \"#{@source}:#{@target}\\n#{costs}\"\n end",
"title": ""
},
{
"docid": "3a8404031a989aec5784f00eb5f4a215",
"score": "0.56807077",
"text": "def pretty_to_s\n \"#{self.lemma}[#{self.rod_id}] : #{self.type.name} #{self.paradigm.code}\\n\" +\n self.paradigm.pretty_to_s(self.word_forms.map{|f| f && f.value})\n end",
"title": ""
},
{
"docid": "4a720c8bf91f2618a5e2fc7ffd26cd9f",
"score": "0.5676592",
"text": "def to_s\n prefix = \"#{production.lhs} => \"\n text_values = production.rhs.map(&:to_s)\n if position.negative?\n text_values << '.'\n else\n text_values.insert(position, '.')\n end\n suffix = text_values.join(' ')\n\n prefix + suffix\n end",
"title": ""
},
{
"docid": "6d8631e81ca089833e5855da30ea8b81",
"score": "0.5675487",
"text": "def inspect\n res = \"Hit: #{@subject_id.ljust(10)} #{@ident.to_s.rjust(4)} #{@align_len.to_s.rjust(2)} #{@mismatches.to_s.rjust(2)} #{@gaps.to_s.rjust(2)} #{@q_beg.to_s.rjust(5)} #{@q_end.to_s.rjust(5)} #{@s_beg.to_s.rjust(5)} #{@s_end.to_s.rjust(5)} #{@e_val.to_s.rjust(5)} #{@bit_score.to_s.rjust(5)} #{@reversed.to_s.rjust(5)}\"\n res += \" #{@score.to_s.rjust(5)} #{@acc.ljust(10)} #{@definition.ljust(10)} #{@q_frame.to_s.rjust(2)} #{@s_frame.to_s.rjust(2)} #{@full_subject_length.to_s.rjust(5)} #{@q_seq}.#{@s_seq}.#{@q_len}.#{@s_len}\"\n\n return res\n end",
"title": ""
},
{
"docid": "3f6bb30a0edfc87ec4ba708086d98cff",
"score": "0.56742597",
"text": "def to_s\n @rules.to_s\n end",
"title": ""
},
{
"docid": "3bd5fe0b0aa2b93c5b04b8a9222c1f60",
"score": "0.56734544",
"text": "def constraint_list\n list = []\n list << @nolong\n list << @wsp\n list << @ml\n list << @mr\n list << @idstress\n list << @idlength\n list << @culm\n list\n end",
"title": ""
},
{
"docid": "6184e28b2a40bd19638a31693273b70b",
"score": "0.56618404",
"text": "def to_s\n label.to_s + ':' + rule.embed\n end",
"title": ""
},
{
"docid": "43c77b14298648b096d94635f07e6782",
"score": "0.5645337",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "43c77b14298648b096d94635f07e6782",
"score": "0.5645337",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "43c77b14298648b096d94635f07e6782",
"score": "0.5645337",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "43c77b14298648b096d94635f07e6782",
"score": "0.5645337",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "6ba0d2c17aa61188ddc4def2cd41569d",
"score": "0.5644967",
"text": "def getConstrs; end",
"title": ""
},
{
"docid": "92175452657e51c44591a1c7015b72fd",
"score": "0.56440246",
"text": "def inspect\n to_s!\n end",
"title": ""
},
{
"docid": "2d07d4c173baa0c17c07af426f44e521",
"score": "0.56418544",
"text": "def col_constraints\n lines = []\n\n 1.upto @size do |c|\n cells = (1..@size).map { |r| \"C#{r}#{c}\" }.join(\", \")\n lines << \"Col#{c} = [#{cells}],\"\n end\n\n lines.join \"\\n\"\n end",
"title": ""
},
{
"docid": "9f38011c56a5b40794afc64cdf340211",
"score": "0.5639351",
"text": "def inspect\n str = ''\n @variables.each_value do |value|\n str << \"\\t#{value}\\n\"\n str << value.inspect\n end\n # Return the string.\n str\n end",
"title": ""
},
{
"docid": "d6f80d969bb362ac1c56a68ed4333ca6",
"score": "0.56297505",
"text": "def inspect\n string = \"#<#{self.class.name}:#{self.object_id} \"\n fields = [:subject].map{|field| \"#{field}=\\\"#{self.send(field)}\\\"\"}\n string << fields.join(\", \") << \">\"\n end",
"title": ""
},
{
"docid": "b32af0239121b324caca78e1f907cadc",
"score": "0.56265086",
"text": "def to_s\n Semantic.assert_exists(*variables)\n return \"#{Indentation.get}#{@string};\" if @inline\n @string\n end",
"title": ""
},
{
"docid": "14e840fd0e8451ed8c1a12a0677cfeba",
"score": "0.5621998",
"text": "def dec_string index\n result = [\"BLOCK #{index}\"]\n @constraints.each do | constraint |\n result << constraint.lp_name\n end\n\n result.join(\"\\n\")\n end",
"title": ""
},
{
"docid": "16373f9647bc9fd7d7deb76be737241d",
"score": "0.5620131",
"text": "def to_s\n t = @terminals.map{ |term, rule| rule.to_s }.join(\"\\n\")\n prods_str = ->(ps) { ps.map{ |p| p.rhs_str }.join(\" | \") }\n p = @productions.map{ |n, ps| \"#{n} -> \" + prods_str.call(ps) }.join(\"\\n\")\n \"#{t}\\n#{p}\"\n end",
"title": ""
},
{
"docid": "780d467e14cca790f8dea595b63c0792",
"score": "0.5619795",
"text": "def inspect\n \"\"\n end",
"title": ""
},
{
"docid": "780d467e14cca790f8dea595b63c0792",
"score": "0.5619795",
"text": "def inspect\n \"\"\n end",
"title": ""
},
{
"docid": "2ac3b0ff0e98c936044616be83ec04ab",
"score": "0.5605982",
"text": "def satisfy\n return ''\n end",
"title": ""
},
{
"docid": "798d6a8d111343bf7c588961c8d09dca",
"score": "0.56041557",
"text": "def inspect\r\n \"Field #{name}|#{type}|#{required}|#{min_length}-#{max_length}|#{validation} <#{@content}>\"\r\n end",
"title": ""
},
{
"docid": "798d6a8d111343bf7c588961c8d09dca",
"score": "0.56041557",
"text": "def inspect\r\n \"Field #{name}|#{type}|#{required}|#{min_length}-#{max_length}|#{validation} <#{@content}>\"\r\n end",
"title": ""
},
{
"docid": "69b5b55dc5edb23b21fc287e3e5e1fa0",
"score": "0.56026965",
"text": "def raw_constraints\n explicit? ? [] : content.strip.split(\"\\n\")\nend",
"title": ""
},
{
"docid": "638cbab6d2a2fcdb99c1eed555a1b79f",
"score": "0.56015694",
"text": "def to_s\n '(assertion) ' + super\n end",
"title": ""
},
{
"docid": "401f358ebe286a567ef44fa6a98ed9b0",
"score": "0.56008554",
"text": "def inspect\n toString\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "a3bb605ae4f5f4cdd5ea7c4a486f796a",
"score": "0.5598855",
"text": "def to_s\n inspect\n end",
"title": ""
},
{
"docid": "35d35c4b449a0c149fde8d8968f20e5f",
"score": "0.5593694",
"text": "def to_s\n \"#{@name}\\t#{@tsc}\\t#{@fields.join('\\t')}\"\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "f8c58eb15f6f14b88f4cfe3ef5f9b5c2",
"score": "0.5588972",
"text": "def inspect\n to_s\n end",
"title": ""
},
{
"docid": "b3a7a3527c748c5d5cc5d12bdd735a2e",
"score": "0.55843955",
"text": "def pretty_string\n [\n \"Rule:\\t\\t#{rule}\",\n \"Protocol:\\t#{protocol}\",\n \"Action:\\t\\t#{action}\",\n \"CIDR Block:\\t#{cidr_block}\",\n if ports then \"Ports:\\t\\t#{ports}\" end,\n if icmp_type then \"ICMP Type:\\t#{icmp_type}\" end,\n if icmp_code then \"ICMP Code:\\t#{icmp_code}\" end,\n ].reject(&:nil?).join(\"\\n\")\n end",
"title": ""
},
{
"docid": "c14ac0159f7d53ca304a4947e60fde7c",
"score": "0.55825984",
"text": "def to_s\n [ super.chop,\n \"@model=#{@model},\", \n \"@tagger=#{@tagger},\", \n \"@lattice=#{@lattice},\", \n \"@libpath=\\\"#{@libpath}\\\",\",\n \"@options=#{@options.inspect},\", \n \"@dicts=#{@dicts.to_s},\", \n \"@version=#{@version.to_s}>\" ].join(' ')\n end",
"title": ""
},
{
"docid": "68fb3ab8f11d7083dae278e279ffd830",
"score": "0.5580079",
"text": "def to_str\n inspect\n end",
"title": ""
},
{
"docid": "f24c6828229b20e0d0a3ce6e3f6f20e9",
"score": "0.5578604",
"text": "def inspect\n\t\tself.to_s.inspect\n\tend",
"title": ""
}
] |
e9a434b416dbaad406b114d35947228e
|
fetch the json for the given url and retun an Array of Result objects. if block is given, each json hash is yielded to it before creating the Result object return nil or false to exclude it from the returned results (i.e. when checking for updates).
|
[
{
"docid": "767c717061654cc30232b60b59a5489f",
"score": "0.8386839",
"text": "def fetch_json(url, &block)\n require 'net/http'\n require 'json'\n\n resp = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(resp.body)\n\n return [] unless json.has_key?(KEY) \n return [] unless (jrs = json[KEY]).is_a?(Array)\n return [] if jrs.empty?\n\n results = []\n\n jrs.threaded_each do |jr|\n result = block_given? ? (yield jr) : jr\n results << Result.new(result) if result\n end\n\n results\n end",
"title": ""
}
] |
[
{
"docid": "e70694980426cddd42272f6291ebc5e3",
"score": "0.6918611",
"text": "def fetch_all_with_url(url, options = {}, &block)\n use_callback = block_given?\n App.delegate.api_client.get(url) do |response, status_code|\n if response.present?\n records = fetch_all_with_attributes(response, save_associations: options[:save], &block)\n else\n records = []\n end\n block.call(records, status_code, response) if use_callback\n end\n end",
"title": ""
},
{
"docid": "49f43c2e3ee3609df19559e12b06f5c4",
"score": "0.6248108",
"text": "def fetch(&block)\n link = @url\n\n until link.nil?\n document = retrieve(link)\n results = parse(document)\n link = results[:nextpage]\n entries = results[:entries]\n\n yield entries if block_given?\n end\n @results\n end",
"title": ""
},
{
"docid": "03e9a15e3b8cd50b482aff84dba408c0",
"score": "0.61397046",
"text": "def fetch_with_url(url, options = {}, &block)\n use_callback = block_given?\n api_client.get(url) do |data, status_code|\n if data.present?\n fetch_with_attributes(data, save_associations: options[:save], &block)\n end\n block.call(data, status_code, data) if use_callback\n end\n end",
"title": ""
},
{
"docid": "b4988c2f414ecc3ab46e11b19499f756",
"score": "0.61079395",
"text": "def perform(no_block=false, &block)\n\n @results = {} if not @results.empty?\n\n @clients.each do |client|\n @threads << Thread.new do\n\n loop do\n break if @reqs.empty?\n (key, url) = @reqs.shift\n client.url = url\n client.http_get\n if block then\n yield(key, client.body_str)\n else\n @results[key] = client.body_str\n end\n end\n\n end\n end\n\n return {} if no_block\n\n join()\n return true if block\n\n ret = @results\n @results = {}\n return ret\n end",
"title": ""
},
{
"docid": "40a0de3c43b62e1aabd5330d68d13861",
"score": "0.6076975",
"text": "def fetch\n @results = []\n @http.start unless @http.started?\n @pairs.each do |pair|\n uri = URI(format(self.class.const_get(:ENDPOINT), pair))\n request = Net::HTTP::Get.new(uri)\n\n with_retry Net::HTTPBadResponse, JSON::ParserError do\n @results << [pair, JSON.parse(@http.request(request)&.body)]\n end\n end\n self\n end",
"title": ""
},
{
"docid": "62e567826e9d2b00a6de90f76502a5e1",
"score": "0.58444154",
"text": "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end",
"title": ""
},
{
"docid": "38d1482c582291bd9075577544535b79",
"score": "0.57969093",
"text": "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"title": ""
},
{
"docid": "cde191b8715a0d6eadddd881f4afa98c",
"score": "0.5762408",
"text": "def fetch\n @start = Time.now\n @result = get @url\n @stop = Time.now\n\n if @result.code.to_i == 200\n @body = @result.parser\n end\n\n return @result.code.to_i < 400 ? true : false\n\n rescue Exception => ex\n @result = FakeResult.new\n $stderr.puts \"Ex: #{ex.message}\"\n return false\n\n rescue Patron::TimeoutError, Timeout::Error => ex\n @stop = Time.now\n @result = FakeResult.new\n @result.code = \"timeout\"\n\n return false\n\n end",
"title": ""
},
{
"docid": "ef9dcb9d5c1c1826dea2221d7d2879fd",
"score": "0.57080126",
"text": "def each\n loop do\n data = fetch\n\n if data\n yield data\n else\n break\n end\n end\n end",
"title": ""
},
{
"docid": "f2c2ed3c4411368629b818dd7e1e8e81",
"score": "0.56953865",
"text": "def get_vacancies( urls )\n vacancies = []\n urls.each do |url|\n vacancies << parse_json( url )\n end\n\n return vacancies\nend",
"title": ""
},
{
"docid": "890baabd9c73006a0db788f68f74d523",
"score": "0.56805116",
"text": "def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"title": ""
},
{
"docid": "33a85a2ef4237bba5e3244d22ae0ef7b",
"score": "0.56688446",
"text": "def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"title": ""
},
{
"docid": "ef61e2b6c5160a6d723c42284d1df842",
"score": "0.563604",
"text": "def return_result(url)\n json_file = open(url) { |f| f.read }\n JSON.parse(json_file)\n end",
"title": ""
},
{
"docid": "1fd9e6c0292f9490a5e41d9a2fadd09c",
"score": "0.55821955",
"text": "def while_results(&block)\n loop do\n results = get![:results]\n break if results.nil? || results.empty?\n results.each(&block)\n end\n end",
"title": ""
},
{
"docid": "02f853780d3d576ab54ce4d84d62016c",
"score": "0.5543431",
"text": "def fetch_data(api_url)\n JSON.parse(RestClient.get(api_url))\nend",
"title": ""
},
{
"docid": "798d872eb75b3970e27ead0988622670",
"score": "0.55317473",
"text": "def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"title": ""
},
{
"docid": "764c7fcf794bde6dd14868fbe3e767fd",
"score": "0.55277044",
"text": "def each_resource(url, offset = 0, &block)\n return enum_for(:each_resource, url) unless block_given?\n return unless url\n\n response = params(offset: offset).get(path: url).json\n\n resources = response.fetch(@array_key.to_sym)\n current_count = response.fetch(:offset) + response.fetch(:limit)\n\n resources&.each { |value| yield value } # rubocop:disable Style/ExplicitBlockArgument\n\n if resources.empty?\n reset_params\n return\n end\n\n each_resource(url, current_count, &block)\n end",
"title": ""
},
{
"docid": "bfc2d028721ad8c0661f81414cc2b6c1",
"score": "0.55221504",
"text": "def fetch_all(options = {}, &block)\n use_callback = block_given?\n url = self.new.sync_url(options[:method] || :get, options)\n\n fetch_all_with_url url, options do |records, status_code, response|\n records.each(&:save) if options[:save]\n block.call(records, status_code, response) if use_callback\n end if !url.blank?\n end",
"title": ""
},
{
"docid": "b36e83eea4e66540d4c3d55092e88e67",
"score": "0.5504743",
"text": "def fetch\n infos = []\n client.search(url, query).take(limit).each do |result|\n response = Hashie::Mash.new(result.to_hash)\n infos << store_info(response)\n end \n infos.reject(&:blank?)\n #TODO: Exception need to handled\n rescue Twitter::Error\n Rails.logger.error(\"Twitter fetch throwing error check the connection\")\n end",
"title": ""
},
{
"docid": "950822bfea5da1b5c7af57c8ce7dade3",
"score": "0.54833657",
"text": "def fetch_result(&block)\n if block_given?\n return @cue_list.select(&block)\n else\n return @cue_list\n end\n end",
"title": ""
},
{
"docid": "dfb900f76802e49568b7ff59e9e82949",
"score": "0.54680276",
"text": "def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'].gsub(/^#{landing_page_url}/, ''),\n name: org_name(item: item),\n sort_name: item['name'],\n url: item.fetch('links', []).first,\n language: org_language(item: item),\n fundref: fundref_id(item: item),\n abbreviation: item.fetch('acronyms', []).first\n }\n end\n results\n end",
"title": ""
},
{
"docid": "a64633059cba4874fa51d5349341d313",
"score": "0.5455022",
"text": "def fetch_from_url(url)\n codes = extract_codes(url)\n\n return false if codes.none?\n fetch_from_code(codes.last)\n end",
"title": ""
},
{
"docid": "a5ea3c24d584d9e893c0060364e8eabe",
"score": "0.5417886",
"text": "def api_get_json(url, page, o = {})\n u = absolute_url(url)\n\n options = {}.merge(o)\n options[:_page] = page if page.is_a? Integer\n resp = []\n\n time_taken = Benchmark.measure do\n while u\n json = get_json(u, options)\n result = json['result']\n\n resp.concat(result['items']) unless item_endpoint?(page)\n resp = result['primaryTopic'] if item_endpoint?(page)\n\n u = (fetch_all?(page) || fetch_more?(o, resp)) && more?(result)\n options.delete(:_page) if u\n end\n end\n\n Rails.logger.debug(\"Completed remote JSON LDA execution in: #{time_taken}\")\n resp\n end",
"title": ""
},
{
"docid": "ba7cea281ffac73c825e73d6488aee87",
"score": "0.5408812",
"text": "def queryurlTable\n @conn.exec( \"SELECT * FROM urls\" ) do |result|\n result.each do |row|\n yield row if block_given?\n end\n end\n end",
"title": ""
},
{
"docid": "7255e465a5dc3057776289373a52af12",
"score": "0.53963214",
"text": "def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"title": ""
},
{
"docid": "23f2a39ca476ccb0205c2ec13dba13ab",
"score": "0.5340094",
"text": "def get_while(request_uri, &block)\n url = base_uri + request_uri\n index = 0\n json = nil\n\n check = ->{\n uri = URI.parse(url)\n uri.query ||= \"\"\n uri.query += \"&index=#{index}&wait=60s\"\n logger.debug(\"GET #{uri}\")\n\n response = http_request(:get, uri)\n index = response['x-consul-index'].to_i\n\n json = parse_body(response)\n\n block.(json)\n }\n\n while check.()\n end\n\n json\n end",
"title": ""
},
{
"docid": "6e32d72d893db972d77f57422ed8ae78",
"score": "0.53325534",
"text": "def parse_fetched_json(json_from_url)\n JSON.parse(json_from_url)\n end",
"title": ""
},
{
"docid": "245227dc1953ec286fd60427039e5b09",
"score": "0.53296757",
"text": "def run_and_get_json_result(url)\n r = @w.get_request url\n result = r.result\n result_as_json = JSON.parse result\n puts \"url: #{url} result: \"+result_as_json.inspect unless TRACE == FalseClass\n result_as_json\n end",
"title": ""
},
{
"docid": "0b64b4852e01df312a848ce7c7162c48",
"score": "0.5294787",
"text": "def fetch(options = {})\n url = build_url(options)\n puts \"Getting #{url}\"\n\n json = get_response(url)\n\n if self.is_json?\n data = JSON.parse(json)\n else\n data = XmlSimple.xml_in(json)\n end\n\n # TODO: Raise hell if there is a problem\n\n collection = OpenCongressApi::Collection.build(json_result(data))\n collection.map!{|result| format_result(result)}\n end",
"title": ""
},
{
"docid": "5fe4238fd63d089946b8e7417ebd2183",
"score": "0.529305",
"text": "def get_wrapper(url, headers)\n [parse_response(RestClient.get(resource + url, headers)), true]\n rescue RestClient::Exception => e\n [parse_error(e.response), false]\n end",
"title": ""
},
{
"docid": "9e56dd2b58713644780a3c8ce3676a74",
"score": "0.5290211",
"text": "def exec_request\n @urls.map { |url| fetch(url) }\n end",
"title": ""
},
{
"docid": "c013f5aefd18305d9ffc7e277c98f10c",
"score": "0.5289339",
"text": "def get(urls)\n if urls.nil? or urls.empty? then\n return {}\n end\n\n urls = [urls] if not urls.kind_of? Array\n urls.each_with_index do |url, i|\n @reqs[i] = url.to_s\n end\n\n results = perform()\n\n ret = []\n (0..results.size-1).each do |i|\n ret << results[i]\n end\n\n return ret\n end",
"title": ""
},
{
"docid": "990a4e607294d895e4ddb57cf7902ce4",
"score": "0.52812636",
"text": "def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend",
"title": ""
},
{
"docid": "e1c9ace8b172ab400aa5cbac81bb444c",
"score": "0.5267616",
"text": "def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"title": ""
},
{
"docid": "420cf52ee3450154cd341e43e1aea4d4",
"score": "0.52433884",
"text": "def all(options = {})\n response = client.get(base_path, options)\n\n return parse(response) unless block_given?\n\n yield response\n end",
"title": ""
},
{
"docid": "20015d709a6c3d4d2795466154d92876",
"score": "0.5236054",
"text": "def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'],\n name: item['name'],\n url: item.fetch('links', []).first,\n domain: org_website(item: item),\n country: org_country(item: item),\n abbreviation: item.fetch('acronyms', []).first,\n types: item.fetch('types', []),\n aliases: item.fetch('aliases', []),\n acronyms: item.fetch('acronyms', []),\n labels: item.fetch('labels', [{}]).map { |lbl| lbl[:label] }.compact\n }\n end\n results\n end",
"title": ""
},
{
"docid": "178088724458b0a9bd572f02fb14d6d6",
"score": "0.52191275",
"text": "def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend",
"title": ""
},
{
"docid": "18f6eb270eefb6ec8afdb2ea71770a2e",
"score": "0.51982856",
"text": "def analyze(url)\n\n\t#Preparing to call RESTapi and json results\n\tbase_uri = \"https://api.ssllabs.com/api/v2\"\n\tfanalyzeuri = URI.parse(\"#{base_uri}/analyze?host=#{url}&startNew=on\")\n\tanalyzeuri = URI.parse(\"#{base_uri}/analyze?host=#{url}\")\n fhttp = Net::HTTP.new(fanalyzeuri.host,fanalyzeuri.port)\n http = Net::HTTP.new(analyzeuri.host,analyzeuri.port)\n\n\t#Using SSL\n\tfhttp.use_ssl = true\n\tfhttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\thttp.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t#Receiving JSON\n\tfrequest = Net::HTTP::Get.new(fanalyzeuri.request_uri)\n fresponse = fhttp.request(frequest)\n\trequest = Net::HTTP::Get.new(analyzeuri.request_uri)\n\tresponse = fhttp.request(request)\n\n\t#Parsing JSON\n\tresult = JSON.parse(fresponse.body)\n\n\t#Waiting for endpoints to generate\n\tuntil result.has_key?(\"endpoints\")\n\t\t\tresponse = fhttp.request(request)\n\t\t\tresult = JSON.parse(response.body)\n\t \t\tsleep(2)\n\tend\n\n\t#Waiting for ipaddresses to populate\n\tresult[\"endpoints\"].each_index do |i|\n\t\tuntil result[\"endpoints\"][i].has_key?(\"ipAddress\")\n\t\t\tresponse = fhttp.request(request)\n\t\t\tresult = JSON.parse(response.body)\n\t\t\tsleep(5)\n\n\t\tend\n\n\t\t#Check for status if ready\n\t\tuntil result[\"endpoints\"][i][\"statusMessage\"] == \"Ready\"\n\t\t\tresponse = fhttp.request(request)\n\t\t\tresult = JSON.parse(response.body)\n\t\t\tsleep(30)\n\t\tend\n\tend\n\treturn result\nend",
"title": ""
},
{
"docid": "c38a15502798f3c2373afc7c8f91da05",
"score": "0.5194265",
"text": "def fetch(&block)\n block.call(true, 20)\n end",
"title": ""
},
{
"docid": "72ee9766c4f2a8cf7b90026eb9dff0b5",
"score": "0.5192654",
"text": "def scrape(&block)\n page = @scraper.get(@config.target_url)\n rows = page.css(@config.rows_selector)\n\n content = rows.map do |row|\n yield(row)\n end\n\n JSON.pretty_generate(content)\n end",
"title": ""
},
{
"docid": "7a8881316e3c790cb31e8af057f09526",
"score": "0.5183924",
"text": "def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend",
"title": ""
},
{
"docid": "a98d8e51957646dc08e340950d0ede5e",
"score": "0.5176305",
"text": "def send_get(url)\r\n result = @client.get(self.target_uri(url))\r\n raise \"Invalid status #{result.http_status} from server #{@host}:#{@port}\" if(result.http_status != '200')\r\n if block_given?\r\n yield(result.http_body)\r\n else\r\n result.http_body\r\n end\r\n end",
"title": ""
},
{
"docid": "f24fe82c7cfe1bda2e28695a79f7aa56",
"score": "0.51700646",
"text": "def json_to_results(json)\n json.map do |jr|\n uri = URI(jr['url'])\n # ignore the query string, since it may have some randomness\n uri.query = nil\n Result.new(project.name, jr['confidence'], jr['risk'], uri.to_s, jr['param'], jr['alert'])\n end\n end",
"title": ""
},
{
"docid": "ab8436daf68c61199f59c8c0849f6577",
"score": "0.51647526",
"text": "def fetch(url, options={})\n fetcher = Hubberlyzer::Fetcher.new(url, options)\n if url.is_a? Array\n response_body = fetcher.fetch_pages\n else\n response_body = fetcher.fetch_page\n end\n end",
"title": ""
},
{
"docid": "6b9c0185d3cad3c3dc3273be2e34fa31",
"score": "0.51467",
"text": "def fetch\n curl = build_curl_easy\n curl.perform\n feed = process_curl_response(curl)\n Feedtosis::Result.new(curl, feed)\n end",
"title": ""
},
{
"docid": "85d43f3f028761f2a07853b404d33966",
"score": "0.51378447",
"text": "def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"title": ""
},
{
"docid": "f803e941321f6ffc00ecd14e72d28e8d",
"score": "0.5137178",
"text": "def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end",
"title": ""
},
{
"docid": "401445537b3798ce7af1e597bc05d2b5",
"score": "0.5101611",
"text": "def bulk_APIrequests(uri_end, request_type, hash_arr)\r\n\tif(hash_arr.length>0) then\r\n\t\thash_arr.each_slice(99) do |x|\r\n\t\t\tjson = JSON.generate({uri_end => x})\r\n\t\t\t#puts json\r\n\t\t\tres = make_API_request(uri_end,request_type,json)\r\n\t\tend\r\n\telse puts \"No data for #{request_type.capitalize} in array\" end\r\nend",
"title": ""
},
{
"docid": "eb7f4717813900e13c52198c33c25258",
"score": "0.5099895",
"text": "def build_statuses(url)\n @statuses = {}\n @failure_found = false\n open(url) do |f|\n json = JSON.parse(f.read)\n json['results'].each do |result|\n @statuses.key?(result['dockertag_name']) || @statuses[result['dockertag_name']] = result['status']\n @failure_found = true if @statuses[result['dockertag_name']] < 0\n end\n end\n @statuses\n end",
"title": ""
},
{
"docid": "b3990e80d40fd779e6af033702574673",
"score": "0.50992584",
"text": "def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"title": ""
},
{
"docid": "66e5934dfb9dbff37b95592ac9f14fc7",
"score": "0.5072776",
"text": "def each_url(&block)\n urls.each do |url|\n yield url, handlers[url].first, handlers[url].last\n end\n end",
"title": ""
},
{
"docid": "8444f6e6718732c8b2a7463940e90dc8",
"score": "0.5063656",
"text": "def hit(uris)\n uris.map do |u|\n response =\n if u.kind_of? String\n Net::HTTP.get(URI.parse(u))\n else\n url = URI.parse(u[0])\n Net::HTTP.new(url.host, url.port).start {|h| h.request(u[1]) }\n end\n\n assert response, \"Didn't get a response: #{u}\"\n response\n end\nend",
"title": ""
},
{
"docid": "990f8bf72db33e95bd304bcd11a4b7fa",
"score": "0.5058047",
"text": "def getAll(url)\n exchanges = []\n begin\n open(url) do |d|\n json = JSON.parse(d.read)\n json.each do |a|\n exchanges << a\n end\n end\n return true, exchanges\n end\n rescue SocketError => e\n return false, \"Could not connect to the API\"\nend",
"title": ""
},
{
"docid": "3cc71f01a061febd5adb8b0fe31aafea",
"score": "0.50551134",
"text": "def assert_cacheable_jsonapi_get(url, cached_classes = :all)\n assert_nil JSONAPI.configuration.resource_cache\n\n assert_jsonapi_get url\n non_caching_response = json_response.dup\n\n cache = ActiveSupport::Cache::MemoryStore.new\n\n warmup = with_resource_caching(cache, cached_classes) do\n assert_jsonapi_get url, \"Cache warmup GET response must be 200\"\n end\n\n assert_equal(\n non_caching_response.pretty_inspect,\n json_response.pretty_inspect,\n \"Cache warmup response must match normal response\"\n )\n\n cached = with_resource_caching(cache, cached_classes) do\n assert_jsonapi_get url, \"Cached GET response must be 200\"\n end\n\n assert_equal(\n non_caching_response.pretty_inspect,\n json_response.pretty_inspect,\n \"Cached response must match normal response\"\n )\n assert_equal 0, cached[:total][:misses], \"Cached response must not cause any cache misses\"\n assert_equal warmup[:total][:misses], cached[:total][:hits], \"Cached response must use cache\"\n end",
"title": ""
},
{
"docid": "19acc1006dca426fd787c5f0c4736038",
"score": "0.50481015",
"text": "def fetch()\n @result = open(@url,@headers)\n end",
"title": ""
},
{
"docid": "50216aab1ab0fcea8ed09ec555557b27",
"score": "0.5047755",
"text": "def fetch(options = {})\n\n url = build_url(options)\n\n puts \"this is the url #{url}\"\n puts \"these are the options #{options}\"\n\n json = get_response(url)\n\n puts json.to_yaml\n\n data = JSON.parse(json)\n\n #puts \"dump data after parse: #{data.to_yaml}\"\n\n # Check to see if the api returned an error\n raise ApiError.new(data['details'],url) if data.has_key?('problem')\n\n\n if !options[:id]\n\n puts \"in options\"\n\n collection = RMeetup::Collection.build(data)\n\n #puts \"value of collection:#{collection.to_yaml}\"\n\n # Format each result in the collection and return it\n collection.map!{|result| format_result(result)}\n\n return collection\n else\n puts \"not in options\"\n return data\n\n end\n\n\n end",
"title": ""
},
{
"docid": "46fbe612aeccd917efe32d1a87018009",
"score": "0.50405014",
"text": "def fetch!(&block)\n object_versions do |object_version|\n fetch_object(object_version, &block)\n end\n\n @pool.wait(:done)\n end",
"title": ""
},
{
"docid": "702f245dd752749d3dd1687d00ac4386",
"score": "0.502006",
"text": "def fetch(url, headers={})\n @url_cache ||= Hash.new\n return @url_cache[url] if @url_cache.has_key?(url)\n\n uri = URI.parse(url)\n\n path = uri.path == \"\" ? \"/\" : uri.path\n\n req = Net::HTTP::Get.new(path)\n res = Net::HTTP.start(uri.host, uri.port) {|http|\n http.request(req)\n }\n\n @url_cache[url] = res\n \n return res\n end",
"title": ""
},
{
"docid": "8d71550dba114aa1242bc212c4703bc5",
"score": "0.50171626",
"text": "def execute_for_json(result = {}, &block)\n begin\n yield(result)\n rescue => e\n logger.error e.message + \"\\n \" + e.backtrace.join(\"\\n \")\n \n result[:error] = {\n :message => e.message,\n :description => e.backtrace[0]\n }\n end\n return result;\n end",
"title": ""
},
{
"docid": "789be1cd0aa857a899c563d45f93df0d",
"score": "0.50096714",
"text": "def fetch_results!\n raise NoTargets if targets.empty?\n\n targets.uniq!\n\n puts 'searching the AUR...'\n results = Rpc.new(:multiinfo, *targets).call\n\n # we need the results in the order of our targets (so dependencies\n # are installed first). unfortunately, the rpc returns results\n # alphabetically. assumption is the reordering done here is\n # cheaper than making per-target rpc calls.\n targets.each do |target|\n if result = results.detect {|r| r.name == target}\n @results << result\n else\n raise NoResults.new(target)\n end\n end\n end",
"title": ""
},
{
"docid": "5982fd270b401969fd277095dcb6fa91",
"score": "0.5008227",
"text": "def parse_json(json, &block)\n instantiate_classes_in_parsed_json(JSON.parse(json), &block)\n end",
"title": ""
},
{
"docid": "5167a2e3107ad198c97343f586529eb4",
"score": "0.50072616",
"text": "def run_fetcher(*args, &block)\n server = nil\n done = false\n last_exception = nil\n results = []\n EM.run do\n begin\n server = MockHTTPServer.new({:Logger => @logger}, &block)\n EM.defer do\n begin\n args.each do |source|\n results << source.call()\n end\n rescue Exception => e\n last_exception = e\n end\n done = true\n end\n timer = EM.add_periodic_timer(0.1) do\n if done\n timer.cancel\n timer = nil\n EM.next_tick do\n EM.stop\n end\n end\n end\n EM.add_timer(FETCH_TEST_TIMEOUT_SECS) { @logger.error(\"timeout\"); raise \"timeout\" }\n rescue Exception => e\n last_exception = e\n end\n end\n\n # stop server, if any.\n (server.shutdown rescue nil) if server\n\n # reraise with full backtrace for debugging purposes. this assumes the\n # exception class accepts a single string on construction.\n if last_exception\n message = \"#{last_exception.message}\\n#{last_exception.backtrace.join(\"\\n\")}\"\n if last_exception.class == ArgumentError\n raise ArgumentError, message\n else\n begin\n raise last_exception.class, message\n rescue ArgumentError\n # exception class does not support single string construction.\n message = \"#{last_exception.class}: #{message}\"\n raise message\n end\n end\n end\n\n return 1 == results.size ? results[0] : results\n end",
"title": ""
},
{
"docid": "79cd51cd1e9ca85013b7b8ca7d6a2ab4",
"score": "0.50026685",
"text": "def get_parsed_response(url, query)\n # Use HTTParty gem to make a get request\n response = HTTParty.get(url + query)\n # Parse the resulting JSON so it's now a Ruby Hash\n parsed = JSON.parse(response.body)\n # Return nil if we got no results from the API.\n parsed['status'] != 'ZERO_RESULTS' ? parsed : nil\nend",
"title": ""
},
{
"docid": "ba2d8ad664a6fc1bf6603a0eef4b9d24",
"score": "0.50016665",
"text": "def list_cloudcasts(cloudcasts_url, breaker = nil)\n begin\n cloudcasts_result = JSON.parse(RestClient.get cloudcasts_url)\n cloudcasts_url = cloudcasts_result[\"paging\"].nil? ? nil : cloudcasts_result['paging']['next']\n cloudcasts_data = cloudcasts_result[\"data\"]\n\n cloudcasts_data.map do |cloudcast_data|\n cloudcast = Mixcloud::Cloudcast.new 'http://api.mixcloud.com/' + cloudcast_data['key']\n\n yield cloudcast\n end\n\n end while !cloudcasts_url.nil?\nend",
"title": ""
},
{
"docid": "512de37d0c665e686c33cbabd1edccf2",
"score": "0.4997613",
"text": "def each(&block)\n Fetcher.new(self).each(&block)\n end",
"title": ""
},
{
"docid": "d20f927f3aa5b104e157738efb6d5a4b",
"score": "0.49973077",
"text": "def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end",
"title": ""
},
{
"docid": "1a772c1e9e4e676817c0795888f6539b",
"score": "0.498586",
"text": "def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\") # got from course notes. It consists of a secure form of getting webpage content.\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n \n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.inspect\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.inspect\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e.inspect\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"title": ""
},
{
"docid": "b1835d9cd9b7d56818f81d856d6ebf93",
"score": "0.498175",
"text": "def investigate\n puts \"\\nRequesting JSON from #{url} and testing\"\n tests.each_pair do |test, block|\n print \" - #{test}\\n\"\n check test, block\n end\n summary\n exit_status\n end",
"title": ""
},
{
"docid": "391e68ddc7eb9ea7b8fe15c62354258f",
"score": "0.4979797",
"text": "def run\n scraper = ThreatDetector::Scraper.new options\n\n fetch_feeds.map do |item|\n next unless valid_feed?(item)\n\n scraper.for(item['name'], item['url'])\n scraper.parse_and_save_entries\n\n yield(item, scraper) if block_given?\n item.slice('name', 'url', 'source')\n end.compact\n end",
"title": ""
},
{
"docid": "a9112483ceb9a5d22de56c4b7ac8816b",
"score": "0.49786863",
"text": "def run_and_get_ruby_result(url)\n r = @w.get_request url\n logger.debug \"ragrr: request status: #{r.meta_status}\"\n if (r.meta_status != 200)\n logger.debug \"#{self.class.to_s}:#{__method__}:#{__LINE__}: run_and_get_ruby_result: get_request: #{url}\"\n end\n result = r.result\n result_as_ruby = JSON.parse result\n result_as_ruby\n end",
"title": ""
},
{
"docid": "83fe0b4545594b040704e6116e5ab11c",
"score": "0.497612",
"text": "def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\")\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"title": ""
},
{
"docid": "0f9c4ede7b6696f34aa3ffcc48dadf08",
"score": "0.4972919",
"text": "def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend",
"title": ""
},
{
"docid": "0e9110aa70fcb0f2a84c22db8bad34ee",
"score": "0.49721217",
"text": "def get_json(address)\n data = download_json(address)\n return nil if data.nil?\n return parse_json(data)\nend",
"title": ""
},
{
"docid": "e06fb8e96e1adcdb8a23a57b98f9153a",
"score": "0.49479276",
"text": "def async_result(url:)\n AsyncResult.new(url: url)\n end",
"title": ""
},
{
"docid": "560e1e6171564faf6f46c34c034bbb1b",
"score": "0.4939073",
"text": "def results\n return error if error?\n return response if response?\n end",
"title": ""
},
{
"docid": "1f1a09b1ba6febf243915ee83b47b9ed",
"score": "0.49388018",
"text": "def fetch(options = {}, &block)\n use_callback = block_given?\n method = options[:method] || :get\n url = sync_url(method, options)\n\n will_fetch_model = !url.blank?\n will_fetch_associations = options.fetch(:associations, true)\n will_fetch_associations = false unless has_associations_to_fetch?(options)\n\n fetch_with_url url, options do |data, status_code|\n save if options[:save]\n block.call(data, status_code, data) if use_callback && !will_fetch_associations\n end if will_fetch_model\n\n fetch_associations(options) do |data, status_code|\n # run callback only if it wasn't run on fetch\n block.call(data, status_code, data) if use_callback\n end if will_fetch_associations\n end",
"title": ""
},
{
"docid": "7f6350619e20f58e21a85c245941ca3f",
"score": "0.49306145",
"text": "def fetch_apis_asynchronously \n threads = []\n threads << Thread.new { @resp1 = RestClient.get 'https://reqres.in/api/unknown' }\n threads << Thread.new { @resp2 = RestClient.get 'https://reqres.in/api/products' }\n threads.each { |thr| thr.join } \n end",
"title": ""
},
{
"docid": "23e2264c5e6fbe1a44c2665ae87f1346",
"score": "0.4921927",
"text": "def call(**params)\n url = construct_url(**full_params(params))\n\n @client.get(url).yield_self do |response|\n guard_errors!(response)\n self.class.parse(response.body)\n end\n rescue API::Error\n raise # Not catching in the next block\n rescue StandardError => e\n raise unless url\n raise API::Error, \"#{e.class} at #{url}: #{e.message}\"\n end",
"title": ""
},
{
"docid": "b3b47395c18576191b8b7deb34e9426a",
"score": "0.49199918",
"text": "def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end",
"title": ""
},
{
"docid": "142e30fd032384a9be2379ae4927a900",
"score": "0.4916122",
"text": "def all(resource, options = {}, &block)\n if options[:query] && options[:query][:page]\n raise \"Don't pass 'page' to Itemlogic#all, use Itemlogic#resource_single_page\"\n end\n\n page = 0\n results = []\n begin\n result = fetch_single_page(page, resource, options)\n if resource['screenshot']\n results = result\n break\n end\n if result == false\n break\n end\n if result['code'] && result['code'].to_s != '200'\n next\n end\n page_count = result['page_count'].to_i\n page = result['page'].to_i\n page_results = result['results'] || result['body'] || []\n if block\n page_results.each(&block)\n else\n results.concat(page_results)\n end\n end while page && page < page_count\n if block\n return true\n else\n return results\n end\n end",
"title": ""
},
{
"docid": "eb04c61768f8d323d322c376a69ca6ad",
"score": "0.49071854",
"text": "def each(&block)\n each_element(block) if @json_hash\n end",
"title": ""
},
{
"docid": "73445c8d105c06a9147901622ef2785a",
"score": "0.4905701",
"text": "def fetch\n fetch_response.results\n end",
"title": ""
},
{
"docid": "cdcfc82700c515ada4b49a53177d24e1",
"score": "0.49029365",
"text": "def get_coin_data(url, key)\n begin\n response = RestClient.get url\n json_response = JSON.parse(response)\n if (!json_response['result'])\n logger.error 'ERROR OBJECT AT ' + url\n logger.error json_response['error'][0]\n return nil\n elsif (key != '') \n return json_response['result'][key]\n else\n # otherwise return w/o looking for a key\n return json_response['result']\n end\n\n rescue => error\n # if there was an http error, then show it - however return an empty array, so there is something there\n logger.error 'error retrieving url ------------------ ' + url\n logger.error error\n return nil\n end\n end",
"title": ""
},
{
"docid": "5428ec04180b394a2ee02b49e3b448ad",
"score": "0.48994356",
"text": "def run_json_http_request\n uri = URI.parse @json_url\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n # set up request\n request = Net::HTTP::Get.new uri.request_uri\n \n # get response, convert to hash\n response = http.request request\n response_hash = JSON.parse response.body\n end",
"title": ""
},
{
"docid": "0bf18f8187ec797bede9b85991e8c4a0",
"score": "0.4899109",
"text": "def fetch_result\n connection = @client.connection\n response = connection.get do |req|\n req.url RESULT_BASE\n req.params['test'] = test_id\n req.params['pagespeed'] = 1\n end\n response_body = HashieResponse.new(JSON.parse(response.body))\n response_body.data.status_code = response_body.statusCode\n response_body.data.status_text = response_body.statusText\n @result = response_body.data\n end",
"title": ""
},
{
"docid": "dda2eeb10d5cbcb1a2da2d0b530ca44d",
"score": "0.4897882",
"text": "def fetch\n def get_response url\n self.status = response = nil\n begin\n uri = URI.parse(url)\n if uri.host &&\n uri.port &&\n (http = Net::HTTP.new(uri.host, uri.port)) &&\n (request = Net::HTTP::Get.new(uri.request_uri))\n response = http.request(request)\n self.status = response.code.to_i\n else # Invalid URL\n self.status = 400\n end\n rescue Exception => e\n # If the server doesn't want to talk, we assume that the URL is okay, at least\n case e\n when Errno::ECONNRESET\n self.status = 401\n else\n self.status = -1 # Undifferentiated error during fetch, possibly a parsing problem\n end\n end\n response\n end\n\n # get_response records the status of the last HTTP access in self.status\n tried = {}\n next_try = url\n until tried[next_try]\n tried[next_try] = true\n response = get_response next_try\n case status\n when 200\n return response.body\n when 301, 302 # Redirection\n next_try = response.header[\"location\"]\n when 401 # Unauthorized\n next_try.sub! /^https/, 'http'\n end\n end\n end",
"title": ""
},
{
"docid": "274706b77c80ba33a960d27cdee590f1",
"score": "0.48937422",
"text": "def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"title": ""
},
{
"docid": "b4e2d2402154488ccc520a3871d3e158",
"score": "0.48916662",
"text": "def fetch_process(uri)\n case r = fetch(uri)\n when Net::HTTPSuccess\n process_result(r.body)\n else\n r.error!\n end\nend",
"title": ""
},
{
"docid": "054385c41fc40bcdc84d7216e6d02020",
"score": "0.4888415",
"text": "def fetch_listings(format=nil)\n result = nil\n raw = fetch_raw(format)\n case self.format\n when 'xml'\n # parse xml raw\n result = XmlSimple.xml_in raw, { 'ForceArray' => false, 'AttrPrefix' => true }\n when 'json'\n result = JSON.parse(raw)\n end\n result = raw unless result\n result\n end",
"title": ""
},
{
"docid": "6f34e5982b7a00f830fac189235a2d00",
"score": "0.48853394",
"text": "def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\")\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n \n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"title": ""
},
{
"docid": "6f34e5982b7a00f830fac189235a2d00",
"score": "0.48853394",
"text": "def fetch(url, headers = {accept: \"*/*\"}, user = \"\", pass=\"\")\n response = RestClient::Request.execute({\n method: :get,\n url: url.to_s,\n user: user,\n password: pass,\n headers: headers})\n return response\n \n rescue RestClient::ExceptionWithResponse => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue RestClient::Exception => e\n $stderr.puts e.response\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\n rescue Exception => e\n $stderr.puts e\n response = false\n return response # now we are returning 'False', and we will check that with an \\\"if\\\" statement in our main code\nend",
"title": ""
},
{
"docid": "d58ad236f3f4b1187bbd3655281fa631",
"score": "0.4875991",
"text": "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"title": ""
},
{
"docid": "ecbf204b584bacdb7f8e0ee23693fd11",
"score": "0.4875441",
"text": "def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"title": ""
},
{
"docid": "3c4df394b4955c817076b10420852ebc",
"score": "0.48727605",
"text": "def request(url, expires_in)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(url)\n return [] if response.status != 200\n JSON.parse(response.to_s.force_encoding(\"utf-8\"))\n end",
"title": ""
},
{
"docid": "260b2bd5a14541524a9473a094858454",
"score": "0.48725933",
"text": "def each_json_spec(&block)\n Data.each(json_spec_path, &block)\n end",
"title": ""
},
{
"docid": "c5e57c24d46a50a286e51fa352bfe84d",
"score": "0.4872336",
"text": "def each &block\n @json_data['users'].each{ |user| yield( User.new(user) )}\n end",
"title": ""
},
{
"docid": "879c6d03be361e88bb89b1a0142863fb",
"score": "0.4863774",
"text": "def each(&block)\n return [] if total_items == 0\n @response['items'].each do |item|\n block.call(Item.new(item))\n end\n end",
"title": ""
},
{
"docid": "bf83a871eea413f53f8af7e2129d2a76",
"score": "0.486256",
"text": "def results\n fetch unless @results\n @results\n end",
"title": ""
},
{
"docid": "bcbfb2ffed47fb4aea9481a205e686ac",
"score": "0.48593608",
"text": "def get_data(flag, url)\n data = \"\"\n response = 0\n if flag == true\n response = RestClient.get(url)\n data = JSON.load response\n end\n return data\nend",
"title": ""
},
{
"docid": "30dd3805b1ba34601df9d0a646a5822e",
"score": "0.48582998",
"text": "def fetch(base_url)\n return if @screenshots # already fetched\n\n url = with_steam_page_param(base_url)\n Mechanize.new.get(url) do |html|\n @screenshots = yield(html)\n end\n end",
"title": ""
}
] |
e99ec8a5d03a891c41870de6a17ff087
|
the operational funds provided by the donation => for project donations: tip total original cc fee amount + however much of that was covered by the project => for nonproject donations: net amount + tip total original cc fee amount
|
[
{
"docid": "a5c478a61e1711992918f14e04f9552e",
"score": "0.691216",
"text": "def net_ce_amount_in_dollars\n if self.project\n if self.net_project_amount_in_cents > 0\n MoneyConversion.cents_to_dollars( self.current_tip_amount_in_cents - self.fee_amount_in_cents + self.current_project_fee_amount_in_cents)\n else\n MoneyConversion.cents_to_dollars(self.net_amount_in_cents - self.fee_amount_in_cents)\n end\n else\n MoneyConversion.cents_to_dollars(self.net_amount_in_cents - self.fee_amount_in_cents + (self.net_amount_in_cents * self.current_tip_percentage / 100).floor)\n end\n end",
"title": ""
}
] |
[
{
"docid": "6acc2d04676bff767746663a4e49a728",
"score": "0.7490225",
"text": "def stripe_donation_total\n donations.via_stripe.executed.map(&:calculate_total_per_nonprofit).sum\n end",
"title": ""
},
{
"docid": "7d52da2e2d202d0017928c32bb3ba9d7",
"score": "0.72207844",
"text": "def outstanding_amount\n total_cost - paid_amount\n end",
"title": ""
},
{
"docid": "9bdf38ca4dca0c4e44f5404d78e0cd88",
"score": "0.7107589",
"text": "def total_projectmeal_fee\n\t\tsession[:svc] = stripe_vendor_charges # Might as well set the session\n\t\tfee = 0\n\t\tsession[:svc].each do |key, array|\n\t\t\tfee = fee + array[:fee]\n\t\tend\n\t\treturn fee\n\tend",
"title": ""
},
{
"docid": "c5112a9f44b2288d46afc56bb9652eff",
"score": "0.7036532",
"text": "def unpaid_donations_sum_in_cents\n sum = 0\n sum = donations.unpaid.empty? ? 0 : donations.unpaid.map(&:amount_in_cents).sum\n sum = credit_pitches.unpaid.empty? ? 0 : credit_pitches.unpaid.map(&:amount_in_cents).sum.to_f\n end",
"title": ""
},
{
"docid": "82c76a4263a6a98378ec36567b1f008b",
"score": "0.701553",
"text": "def funding\n @funding ||= investments.pluck(:amount).reduce(:+) || 0\n end",
"title": ""
},
{
"docid": "17a03589f8b2b22443ac37219b5f08e0",
"score": "0.6996442",
"text": "def operating_funds\n \n amount * (pcnt_operating_assistance / 100.0)\n \n end",
"title": ""
},
{
"docid": "a03c7aa86e804a36f2ee9ff2612aed80",
"score": "0.6978666",
"text": "def funding\n @funding ||= investments.pluck(:amount).reduce(:+)\n end",
"title": ""
},
{
"docid": "fed596e9b7b28b6225cf3a3e337181ce",
"score": "0.6927791",
"text": "def calculate_fee\n if stripe?\n # Stripe::Charge.retrieve(id: stripe_charge_id, expand: ['balance_transaction'])\n ((calculate_total * STRIPE_FEE_PERCENT) + STRIPE_FEE_FIXED).round(2)\n else\n # NetworkForGood::CreditCard.get_fee(Nonprofit.last)[:total_add_fee].to_d\n (amount * NFG_FEE_PERCENT).round(2)\n end\n end",
"title": ""
},
{
"docid": "6a9265dda5e59930e99bc9e8797632d4",
"score": "0.6915889",
"text": "def total\n cost_lines.unpaid.sum(:amount) + cost_lines.paid.sum(:real_amount)\n end",
"title": ""
},
{
"docid": "7d9a170c3ce2bdb8d2fdb8e25d2feb62",
"score": "0.69112045",
"text": "def funding_difference\n total_cost - total_funds\n end",
"title": ""
},
{
"docid": "7cdbfc8a6435aeda3d3e2ffb5e30d0c2",
"score": "0.68955046",
"text": "def total_donations\n self.donations.inject(0){|t,d| t += d.amount}\n end",
"title": ""
},
{
"docid": "a0c8261e69ede080d3e7f0e3f9b775d0",
"score": "0.68627805",
"text": "def total_funds\n federal_funds + state_funds + local_funds\n end",
"title": ""
},
{
"docid": "23a61ab332cac5209bccd9e1b674a290",
"score": "0.6836772",
"text": "def total_funds_required_to_close\n line_i -\n subordinate_lien_amount.to_f -\n seller_paid_closing_costs_amount.to_f -\n ((loan_general.nil? or loan_general.purchase_credit_amount.nil?) ? 0 : loan_general.purchase_credit_amount) -\n net_loan_disbursement_amount\n end",
"title": ""
},
{
"docid": "cd657b395530c01a057a53f832c0438b",
"score": "0.6835649",
"text": "def total_cash_needed\n\t\t(cash_purchase? ? purchase_price : loans.map(&:down_payment).reduce(:+)) + closing_costs + estimated_repairs + loans.map(&:points_payment).reduce(:+)\n\tend",
"title": ""
},
{
"docid": "7ae721d51d88549ab81477b1a87185ad",
"score": "0.68294364",
"text": "def total_amount\n grn_items.collect(&:total_amount).inject(:+) + other_charges.to_f\n end",
"title": ""
},
{
"docid": "70dd1ff95634f22b99468b70feb99639",
"score": "0.6821404",
"text": "def total_total\n remb_depense_total + net_total\n end",
"title": ""
},
{
"docid": "68c5a16453509cf32d915bb6cc53ec2c",
"score": "0.67989695",
"text": "def contract_variable_cost\n contract_variable_cost = 0\n contracts_as_buyer.each do |c|\n contract_variable_cost += c.amount\n end\n contract_variable_cost\n end",
"title": ""
},
{
"docid": "e4e9c338b3d0005cd9ef24f043a64877",
"score": "0.6794512",
"text": "def funds_owed\n Referral.where(referred_by: self.id,\n confirmed: true, revoked: false, fee_paid: false)\n .map(&:fee).reduce(:+) || 0\n end",
"title": ""
},
{
"docid": "f3729d144df9d36bb749fb471c71e0d7",
"score": "0.6791644",
"text": "def total_funds\n funding_rounds.inject(0) {|sum, funding| sum + funding.investment}\n end",
"title": ""
},
{
"docid": "ffcef940ffac6c1159c2a43410f253d4",
"score": "0.67814016",
"text": "def unpaid_donations_sum_in_cents\n donations.unpaid.empty? ? 0 : donations.unpaid.map(&:amount_in_cents).sum\n end",
"title": ""
},
{
"docid": "af4007067d3c346b7cd67fa99c6b6be8",
"score": "0.6775424",
"text": "def donations_sum\n amount = 0\n amount += donations.map(&:amount).sum unless donations.blank?\n amount += @new_donations.map(&:amount).sum unless @new_donations.blank?\n amount += spotus_donation[:amount] unless spotus_donation.nil? || spotus_donation[:amount].nil?\n amount\n end",
"title": ""
},
{
"docid": "f3bab928ee014a69eb92b2c32932e32c",
"score": "0.676904",
"text": "def total_donation\n donations.sum('amount')\n end",
"title": ""
},
{
"docid": "c488a2b792a71c96e0f651e2fbb2044c",
"score": "0.6768358",
"text": "def total_funds\n investment_rounds.inject{|sum,investment| sum + investment}\n end",
"title": ""
},
{
"docid": "6423f2e428c59aab2f892aa8fc7858e3",
"score": "0.6743185",
"text": "def indirect_cost_total\n total = 0.0\n\n self.line_items.each do |li|\n if li.service.one_time_fee\n total += li.indirect_costs_for_one_time_fee\n else\n total += li.indirect_costs_for_visit_based_service\n end\n end\n\n return total\n end",
"title": ""
},
{
"docid": "039d2fcc21c4e3a4623c85961b4390b6",
"score": "0.67401916",
"text": "def bill\n\t\trounded = ((@principal_balance + @interest) * 100).round / 100.0\n\t\t@interest = 0.0\n\t\treturn \"Total payment due: $%.2f\" % rounded\n\tend",
"title": ""
},
{
"docid": "f089eb7ecac10da48f0f2bbf8f3a7ff1",
"score": "0.67268276",
"text": "def balance\n amount_paid - amount_due\n end",
"title": ""
},
{
"docid": "79d9999c07c4ca0b311352ec4bc6defb",
"score": "0.6722543",
"text": "def net_amount\n if amount < FIRST_SECTION\n amount * (1 - FIRST_SECTION_FEE)\n elsif amount < SECOND_SECTION\n amount * (1 - SECOND_SECTION_FEE)\n else\n amount * (1 - THIRD_SECTION_FEE)\n end\n end",
"title": ""
},
{
"docid": "976d35eec347a8a2f92bb2fa8ee520e6",
"score": "0.6722121",
"text": "def network_relative_cost\n net_cost = 0\n net_cost += self.company.net_cost\n self.company.contracts_as_buyer.each do |c|\n if c.service_provider.total_actual_launches == 0\n operator_investment = 1 / c.service_provider.buyers.size\n else\n operator_investment = c.launches_made.to_f / c.service_provider.total_actual_launches.to_f\n end\n net_cost += c.service_provider.net_cost * operator_investment\n c.service_provider.contracts_as_buyer.each do |s|\n if s.service_provider.total_actual_launches == 0\n service_investment = 1 / s.service_provider.buyers.size\n else\n service_investment = (s.launches_made.to_f * operator_investment) / s.service_provider.total_actual_launches.to_f\n end\n net_cost += s.service_provider.net_cost * service_investment\n end\n end\n net_cost\n end",
"title": ""
},
{
"docid": "136f2c37544f2513342f5bec1a93a367",
"score": "0.6714995",
"text": "def total_funds\n find_amount = fundings.map{|funding| funding.investment}\n find_amount.inject{|sum, el| sum + el}\n end",
"title": ""
},
{
"docid": "bc57e2039542dd1cbf21d69513b96b58",
"score": "0.67030305",
"text": "def total_amount_paid\n paid_items.map(&:cost).inject(:+).to_f\n end",
"title": ""
},
{
"docid": "486e81714e08930b110782ca40675452",
"score": "0.6698681",
"text": "def balance\n (deliveries.delivered.unpaid.map(&:total).sum - buy_backs.map(&:total).sum)\n end",
"title": ""
},
{
"docid": "fb1082274c8d8dd5ec378625dbe5d3d4",
"score": "0.6689531",
"text": "def total_funds\n funding_rounds.reduce(0) {|total, funding_round| total + funding_round.investment}\n end",
"title": ""
},
{
"docid": "875ffd0bb01b76993b14535e5a7debe4",
"score": "0.66841114",
"text": "def total_paid\n self.total_due - self.total_outstanding\n end",
"title": ""
},
{
"docid": "6b597709a40e3aaa65021ca405105745",
"score": "0.6668563",
"text": "def fund_progress\n progress = (self.donations.sum(:amount) / self.fund_amount) * 100\n end",
"title": ""
},
{
"docid": "66f3c1d906ddedc937c996ff8b71f2df",
"score": "0.66590005",
"text": "def funds\n\t\tMoney.new(funds_cents, currency)\n\tend",
"title": ""
},
{
"docid": "0d4f8a2a2c5f91c9372a9bc92e105fee",
"score": "0.6656627",
"text": "def stripe_fee\n ((to_charge * stripe_percent) + (Settings.fees.stripe).round)\n end",
"title": ""
},
{
"docid": "7cb68a94c65b986b8ee945c14f1e1068",
"score": "0.6656089",
"text": "def calculate_total_per_nonprofit\n (total_minus_fee / donation_nonprofits.count.to_d).floor(2)\n end",
"title": ""
},
{
"docid": "fca91595d5ce933e90dcea3700e089bd",
"score": "0.66518646",
"text": "def debt\n owed_total - payment.to_f\n end",
"title": ""
},
{
"docid": "8af9288d31ceb88fe3da12a39f4d3e05",
"score": "0.6646533",
"text": "def provisional_total_cost\n # feels like the bodies of this conditional could be dried up\n if number_of_express_deliveries < 2 # could this be a method?\n (number_of_express_deliveries * EXPRESS_DELIVERY_COST) + (number_of_standard_deliveries * STANDARD_DELIVERY_COST)\n else\n (number_of_express_deliveries * DISCOUNTED_EXPRESS_DELIVERY_COST) + (number_of_standard_deliveries * STANDARD_DELIVERY_COST)\n end\n end",
"title": ""
},
{
"docid": "ea03d5dc59161b035d74cb4d14e0ec19",
"score": "0.6642793",
"text": "def this_total_costs\n item_costs + worker_costs + tool_costs + vehicle_costs + subcontractor_costs\n end",
"title": ""
},
{
"docid": "dad45bafe59dae05e244583711874c07",
"score": "0.66377527",
"text": "def profit\n total_before_tax - total_cost\n end",
"title": ""
},
{
"docid": "98d0779377f010e26962cf1d40e71e4b",
"score": "0.663511",
"text": "def total_funds\n funding_rounds.reduce(0) {|sum, round| sum += round.investment }\n end",
"title": ""
},
{
"docid": "0ffd07effc97fe85701b83bfd832946e",
"score": "0.6634472",
"text": "def base_total( ipn )\n discount = params[ :discount ] || 0\n \n ipn.gross.to_money - params[ :mc_shipping ].to_money - params[ :tax ].to_money + discount.to_money\n end",
"title": ""
},
{
"docid": "9448c91d8b732e98d946e16340f0d62c",
"score": "0.6631544",
"text": "def cost_for_purchaser\n cost - contributions.sum(:amount)\n end",
"title": ""
},
{
"docid": "9448c91d8b732e98d946e16340f0d62c",
"score": "0.6631544",
"text": "def cost_for_purchaser\n cost - contributions.sum(:amount)\n end",
"title": ""
},
{
"docid": "1b0df0c67ebb36b2d45878aa19a0e4d2",
"score": "0.6621326",
"text": "def net_amount\n (gross_amount - tax_amount - discount).round(2)\n end",
"title": ""
},
{
"docid": "94bb64b55fb3665abeeb5fcf01ac2052",
"score": "0.6618347",
"text": "def benefits\n revenue_figure.to_i - total_charge_dj.to_i - charge_others.to_i - charge_communication.to_i\n end",
"title": ""
},
{
"docid": "1d83e5e73d952ac31b95afc8db1e4f75",
"score": "0.6617428",
"text": "def total_due\n total - paid\n end",
"title": ""
},
{
"docid": "6af837a8f0bc9c6c27855a74e30dcf64",
"score": "0.66082984",
"text": "def total_payoff\n return @balance + @interest\n end",
"title": ""
},
{
"docid": "9e78d8b9856eb8050906f740e8072a75",
"score": "0.65982884",
"text": "def total_funds\n array = specific_funding_rounds.map {|round| round.investment }\n array.sum\n end",
"title": ""
},
{
"docid": "5edba711d5d3af2f0f7a259154ad4910",
"score": "0.6586475",
"text": "def total_payment \n self.cash_amount + self.voluntary_savings_withdrawal_amount \n end",
"title": ""
},
{
"docid": "dc8926e7d6b2ab14becdba43b146d05f",
"score": "0.6582169",
"text": "def non_operating_funds\n amount - operating_funds\n end",
"title": ""
},
{
"docid": "d03517092414dfcb3373371384b907a4",
"score": "0.6581382",
"text": "def debt\n subtotal - _normed_balance\n end",
"title": ""
},
{
"docid": "95cbdfc19550015ce920ee71e6bf25f0",
"score": "0.6581306",
"text": "def total_amount_paid\n Money.new(paid_items.map(&:cost).inject(:+))\n end",
"title": ""
},
{
"docid": "4110509475af71d0801362d30a0f1c08",
"score": "0.6578359",
"text": "def total_funds\n investment = funding_rounds.map do |round|\n round.investment\n end\n investment.sum\n end",
"title": ""
},
{
"docid": "7f36c86d1a25e7dc033ef19a497b958a",
"score": "0.65758425",
"text": "def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end",
"title": ""
},
{
"docid": "8546982cf2fd2093e4a493eaab2ce405",
"score": "0.6562994",
"text": "def donated_sum\n\t\tdonated.sum(\"amount * (artist_percentage / 100)\").to_f.round(2)\n\tend",
"title": ""
},
{
"docid": "f1004f31edf70d42a4c617d1c75e535b",
"score": "0.6562648",
"text": "def commission_fee\n 0.1\n end",
"title": ""
},
{
"docid": "a4747122543e611ef2e813c30c158e9a",
"score": "0.65601426",
"text": "def total_to_pay_without_discounts\n sub_total + tax_total + total_shipping\n end",
"title": ""
},
{
"docid": "f7ff1c3da1a17327f51328079b1f60ca",
"score": "0.6555249",
"text": "def calculate_final_expense_amount\n #if self.billable_type == 2 || self.accounted_for_type == 8\n if !self.is_billable || self.is_internal\n self.final_expense_amount = 0.0\n elsif self.billing_method_type == 3\n self.final_expense_amount = self.final_expense_amount\n elsif self.billing_method_type == 4\n if self.markup && self.markup > 0\n self.final_expense_amount = self.expense_amount + ((self.markup * self.expense_amount)/100)\n else\n self.billing_method_type = 1\n self.final_expense_amount = self.expense_amount\n end\n else\n if self.billing_percent && self.billing_percent > 0\n self.final_expense_amount = self.expense_amount - ((self.billing_percent * self.expense_amount)/100)\n else\n self.billing_method_type = 1\n self.final_expense_amount = self.expense_amount\n end\n end\n #self.final_expense_amount\n end",
"title": ""
},
{
"docid": "d7b85dcf7ba741571b3d442091b33c9d",
"score": "0.65499246",
"text": "def ticket_payment()\n array_tickets = self.films\n tickets = array_tickets.map do |c|\n c.price\n end\n ticket_sum = tickets.sum\n return @funds - ticket_sum\n\n end",
"title": ""
},
{
"docid": "f4f581a27c2ed6e9abe2b733cb0c9630",
"score": "0.65446824",
"text": "def amount\n self.net_amount+self.taxes_amount\n end",
"title": ""
},
{
"docid": "99d2eba3b13a9d9524b119516c916567",
"score": "0.6543508",
"text": "def amount_raised\n gift_card_amount + donation_amount\n end",
"title": ""
},
{
"docid": "86a99159282012b3ab97370026c5b9f1",
"score": "0.6541056",
"text": "def total_funds\n self.all_funding_rounds.map {|fundinground| fundinground.investment }.sum\n end",
"title": ""
},
{
"docid": "68455f056e7a40da8d9c20dc1964b0a8",
"score": "0.65409863",
"text": "def total_levelup_payment_to_apply_including_tip\n [0, total_amount_after_discount - @gift_card_credit_available].max\n end",
"title": ""
},
{
"docid": "35df7d2068f6ed5c8028337016fdd601",
"score": "0.65373796",
"text": "def benefit_total\r\n benefit_light + benefit_hvac + benefit_env\r\n end",
"title": ""
},
{
"docid": "6c85d1c04c6444db345ae70673df2bda",
"score": "0.65324",
"text": "def closetgroupie_fee\n (total_without_shipping * CLOSET_GROUPIE_PERCENTAGE) + (items.size * CLOSET_GROUPIE_FLAT_FEE)\n end",
"title": ""
},
{
"docid": "c9c14691381b70b66953f4d4c2dbf5cb",
"score": "0.6521203",
"text": "def paid_total\n components.reject {|c| c.kind == 'bonus'}.reduce(SpookAndPuff::Money.zero){|a, c| a + c.total}\n end",
"title": ""
},
{
"docid": "1f238fd0da4d0d5067025ffd588717b5",
"score": "0.6512686",
"text": "def total_price\n df = self.delivery_fee\n if df == 0\n df = Order.get_delivery_fee(self.user)\n end\n restaurant_price + tax_price + df - coupon_discount - money_from_account\n end",
"title": ""
},
{
"docid": "1dd1c2f46fc96be5da8a9f08af52efbc",
"score": "0.65099996",
"text": "def membership_discount_total\n membership_fixed_total + membership_percent_total\n end",
"title": ""
},
{
"docid": "7bab31018c59e5600e335cef587b068f",
"score": "0.65089095",
"text": "def sum_total\n self.donations.map do |donation|\n donation.amount\n end.sum\n end",
"title": ""
},
{
"docid": "1844b0f6b03e4ee4e0e9fec0b85a2c53",
"score": "0.65055084",
"text": "def remaining_invoice_balance\n invoices.includes(:invoice_items, :charges, :coupon).to_a.sum(&:remaining_cost)\n end",
"title": ""
},
{
"docid": "e8b2e9dd619c55d893dcc5dbc070c07d",
"score": "0.6502712",
"text": "def net_amount; debit; end",
"title": ""
},
{
"docid": "de7f04c220c451efd7c8624efa56ae3a",
"score": "0.65000665",
"text": "def total_with_grat( amount )\r\n amount + tip_amount( amount )\r\nend",
"title": ""
},
{
"docid": "6bc1c0ab4e2c6f54147947addf441498",
"score": "0.64958096",
"text": "def funding\n 0\n end",
"title": ""
},
{
"docid": "a351acd7656d5b952ed9a212a643479c",
"score": "0.64913815",
"text": "def total\n amount\n # net #+ net_tax\n end",
"title": ""
},
{
"docid": "e3c83d18891b8382d1753a6de2b55d47",
"score": "0.648829",
"text": "def total\n all_charges.sum(:amount_cents) - all_refunds.sum(:amount_cents)\nend",
"title": ""
},
{
"docid": "86d0862eeaafff7b13fc6f5cd630035e",
"score": "0.6487757",
"text": "def total_funds\n self.funding_round.investment.sum = total_funds\n puts total_funds\n end",
"title": ""
},
{
"docid": "a859855eef3c92981796c8ba12f2a972",
"score": "0.64870197",
"text": "def client_fee\n client_fee_amount # + client_fee_gst\n end",
"title": ""
},
{
"docid": "484a0971e99ca9d84d4c246238677131",
"score": "0.64866877",
"text": "def total_project_cost_cents_invoiced\n profiles = self.payment_profiles.includes(:invoice_item).select { |p| p.invoice_item.present? }\n profiles.sum(&:expected_cost_cents)\n end",
"title": ""
},
{
"docid": "9a9ea9f7da766e9860cf1b804e7fd306",
"score": "0.6471203",
"text": "def donation_amount\n DonationDetail\n .joins(:item)\n .where(items: {\n seller_id: id,\n refunded: false\n })\n .sum(:amount)\n end",
"title": ""
},
{
"docid": "444faf0327af66a543902ec8f96c6e7f",
"score": "0.64639086",
"text": "def total_costs\n item_costs + worker_costs + tool_costs + vehicle_costs + subcontractor_costs + suborder_costs\n end",
"title": ""
},
{
"docid": "b0efa8268c8150c01f8d301cfbe7afea",
"score": "0.64578855",
"text": "def cost\n commission = [self.payment/10.0, MTURK_COMMISSION_MINIMUM].max\n return (self.payment + commission) * tasks.size\n end",
"title": ""
},
{
"docid": "dd3c31edc4dfd9856288fa437cc059f2",
"score": "0.64559466",
"text": "def dni_total(_project, _office)\n if _office.nil?\n delivery_note_items.where('delivery_note_items.project_id in (?)',_project).select('SUM(delivery_note_items.quantity * delivery_note_items.cost) dni_t')\n else\n delivery_note_items.joins(:project).where('delivery_note_items.project_id in (?) AND projects.office_id = ?',_project, _office).select('SUM(delivery_note_items.quantity * delivery_note_items.cost) dni_t')\n end\n end",
"title": ""
},
{
"docid": "6f9ebc710b9b92db95964c30497a699e",
"score": "0.6450767",
"text": "def total_funds_raised\n result = 0\n breakpoints.each do |bp|\n total = bp.value_in_cents * bp.contributions.count\n result += total\n end\n result\n end",
"title": ""
},
{
"docid": "9ad9a9f512d4dab7208c2f98f3112c23",
"score": "0.64488363",
"text": "def total_funds\n self.find_startup.reduce(0) {|sum, n| sum + n.investment}\n end",
"title": ""
},
{
"docid": "1b2d7a5341e8c0b1b623c78a6624496c",
"score": "0.64485425",
"text": "def total_funds\n \n num_funding_rounds.map { |total| total.amount }.sum\n\n end",
"title": ""
},
{
"docid": "e6cfd4cc5194d44d9aea48a53d2173b5",
"score": "0.64453775",
"text": "def cash_up\n total = 0\n items.each { |item| total += item.price if item.sold? }\n\n provision = if total > 19 \n Calculator.round_base(total * event.provision / 100, 0.5)\n else\n 0\n end\n\n fee = total > 19 ? event.fee : 0\n\n payback = total - provision + fee\n\n [total, provision, fee, payback] \n end",
"title": ""
},
{
"docid": "5735e1c144cea5333e2922ff2ab791f7",
"score": "0.6441895",
"text": "def contract_revenue\n contract_revenue = 0\n contracts_as_supplier.each do |c|\n contract_revenue += c.amount\n end\n contract_revenue\n end",
"title": ""
},
{
"docid": "87e3d0335b9ce87bacda343d021b7e6e",
"score": "0.64358354",
"text": "def compute_commission\n base = @price * 0.3\n assistance_fee = 100 * rental_days\n remaining = base / 2 - assistance_fee\n {insurance_fee: base / 2, assistance_fee: assistance_fee, drivy_fee: remaining}\n end",
"title": ""
},
{
"docid": "5fd7e6f0a722b85eb986e5fb554b2c97",
"score": "0.6434281",
"text": "def net_transfer_amount\n self.transfer_amount - self.transaction_fee.abs if self.transfer_amount\n end",
"title": ""
},
{
"docid": "07984a354e49698c32fbdcd0a20d0cc9",
"score": "0.643392",
"text": "def actual_balance\n # sum inbound\n # sum successful outbound\n # return inbound - outbound # FIXME: replace outbound transfer sum with more efficient query, change to sum transfer totals directly\n inbound_transfers.sum(:amount) - Transfer.where(disbursement: disbursements, status:'successful').sum(:amount) * 1.005\n end",
"title": ""
},
{
"docid": "6a50223c59085c14ed3c7bc83e0ef640",
"score": "0.6433674",
"text": "def balance\n crewmanships.collect(&:price).map {|p| p[:amount] }.inject{|sum,x| sum + x }\n end",
"title": ""
},
{
"docid": "abaa6c10b19aae7c19ff63db82ddc9e4",
"score": "0.64336544",
"text": "def calculate_total\n bill_amount + calculate_tip\n end",
"title": ""
},
{
"docid": "ea9796c5cac54fe8dec022917a113994",
"score": "0.64290404",
"text": "def profit\n # base_profit - outrage + marketing.\n end",
"title": ""
},
{
"docid": "7b4823226e927d95d82068b24b89f966",
"score": "0.6427787",
"text": "def total_price_with_discount_and_extra_costs\n total_price_with_discount + shipping_cost # taxes are included in the discount price\n end",
"title": ""
},
{
"docid": "f75632c8ec5357434033a2bb1996a2f3",
"score": "0.6424111",
"text": "def payoff_quote\n balance + interest_total\n end",
"title": ""
},
{
"docid": "cdcdca905f7f6ea2fb97d4c5518de16b",
"score": "0.64222133",
"text": "def total_funds\n (fundings.map {|f| f.investment}).sum\n end",
"title": ""
},
{
"docid": "1ce80034cacda994fe6d9ae6ddb764ac",
"score": "0.6422125",
"text": "def fees_owing\n registrations.unpaid.map(&:fee).sum\n end",
"title": ""
},
{
"docid": "739b9ebedb9b2b12662c2079719e7ef8",
"score": "0.6418425",
"text": "def non_disbursed_fund\n # return BigDecimal(\"0\") if not self.is_loan_disbursed?\n start_fund - disbursed_fund \n end",
"title": ""
}
] |
79b80bd40d5323259eb6bf14b4209b9e
|
Calls Sqs::JaquMessage and Sqs::UserMessage with submitted form data Returns an array of message IDs
|
[
{
"docid": "ad1032dc40665fab70f48dd74eb9123d",
"score": "0.60134155",
"text": "def send_emails(form)\n [Sqs::JaquMessage, Sqs::UserMessage].map { |klass| klass.call(contact_form: form) }\n end",
"title": ""
}
] |
[
{
"docid": "a2c8b9c6a2fa13f1a9507a08aadeffd1",
"score": "0.5658666",
"text": "def message_ids; end",
"title": ""
},
{
"docid": "e0db2c13b032f84e6159c9ab748596cf",
"score": "0.5563906",
"text": "def process_request_message(processor, sqs_message)\n message = Mimi::Messaging::Message.new(\n deserialize(sqs_message.body),\n deserialize_headers(sqs_message)\n )\n method_name = message.headers[:__method]\n reply_to = message.headers[:__reply_queue_url]\n if reply_to\n response = processor.call_query(method_name, message, {})\n response_message = Mimi::Messaging::Message.new(\n response,\n __request_id: message.headers[:__request_id]\n )\n deliver_query_response(reply_to, response_message)\n else\n processor.call_command(method_name, message, {})\n end\n end",
"title": ""
},
{
"docid": "324c84b63d06c58c873607c78b387e1c",
"score": "0.5550603",
"text": "def smssignup\n # this is where surveys and new signups land.\n wufoo = WuParty.new(ENV['WUFOO_ACCOUNT'], ENV['WUFOO_API'])\n wufoo.forms\n\n session['counter'] ||= 0\n session['fieldanswers'] ||= {}\n session['fieldquestions'] ||= {}\n session['phone_number'] ||= PhonyRails.normalize_number(params[:From]) # Removing +1 and converting to integer\n session['contact'] ||= 'EMAIL'\n session['errorcount'] ||= 0\n session['formid'] ||= ''\n session['fields'] ||= ''\n session['form_length'] ||= 0\n session['form_type'] ||= ''\n session['end_message'] ||= ''\n\n message_body = params['Body'].strip\n sms_count = session['counter']\n fields = ''\n # if (session[\"formid\"].is_a?(String) )\n # @form = wufoo.form(session[\"formid\"])\n # fields = @form.flattened_fields\n # end\n\n @incoming = TwilioMessage.new\n @incoming.message_sid = params[:MessageSid]\n @incoming.date_sent = params[:DateSent]\n @incoming.account_sid = params[:AccountSid]\n @incoming.from = params[:From]\n @incoming.to = params[:To]\n @incoming.body = params[:Body].strip\n @incoming.status = params[:SmsStatus]\n @incoming.error_code = params[:ErrorCode]\n @incoming.error_message = params[:ErrorMessage]\n @incoming.direction = 'incoming-twiml'\n @incoming.save\n\n @twiliowufoo = TwilioWufoo.where('twilio_keyword = ? AND status = ?', params[:Body].strip.upcase, true).first\n\n message = 'Initial message'\n\n if message_body == '99999'\n message = 'You said 99999'\n session['counter'] = -1\n session['fieldanswers'] = {}\n session['fieldquestions'] = {}\n session['contact'] = 'EMAIL'\n session['errorcount'] = 0\n session['formid'] = ''\n session['fields'] = ''\n session['form_length'] = 0\n session['form_type'] ||= ''\n session['end_message'] ||= ''\n elsif @twiliowufoo && session['counter'].zero?\n session['formid'] = @twiliowufoo.wufoo_formid\n @form = wufoo.form(@twiliowufoo.wufoo_formid)\n fields = @form.flattened_fields\n session['form_length'] = fields.length\n message = (fields[session['counter']]['Title']).to_s\n message = to_gsm0338(message)\n session['form_type'] = @twiliowufoo.form_type\n session['end_message'] = @twiliowufoo.end_message\n elsif !@twiliowufoo && session['counter'].zero?\n message = 'I did not understand that. Please re-type your keyword.'\n session['counter'] -= 1\n\n elsif sms_count < (session['form_length'] - 2)\n @form = wufoo.form(session['formid'])\n fields = @form.flattened_fields\n id_to_store = fields[sms_count - 1]['ID']\n session['fieldanswers'][id_to_store] = message_body\n message = (fields[sms_count]['Title']).to_s\n message = to_gsm0338(message)\n # If the question asked for an email check if response contains a @ and . or a skip\n if fields[session['counter'] - 1]['Title'].include? 'email address'\n if !(params['Body'] =~ /.+@.+\\..+/) && !(params['Body'].upcase.include? 'SKIP')\n message = \"Oops, it looks like that isn't a valid email address. Please try again or text 'SKIP' to skip adding an email.\"\n session['counter'] -= 1\n end\n # If the question is a multiple choice using single letter response, check for single letter\n elsif fields[session['counter'] - 1]['Title'].include? 'A)'\n # if !( params[\"Body\"].strip.upcase == \"A\")\n if !(params['Body'].strip.upcase =~ /A|B|C|D|E/)\n if session['errorcount'].zero?\n message = 'Please type only the letter of your answer. Thank you!'\n session['counter'] -= 1\n session['errorcount'] += 1\n elsif session['errorcount'] == 1\n message = 'Please type only the letter of your answer or type SKIP. Thank you!'\n session['counter'] -= 1\n session['errorcount'] += 1\n else\n session['errorcount'] = 0\n end\n else\n session['errorcount'] = 0\n end\n\n elsif fields[session['counter'] - 1]['Title'].include? 'receive notifications'\n session['contact'] = 'TEXT' if params['Body'].upcase.strip == 'TEXT'\n end\n\n elsif sms_count == (session['form_length'] - 2)\n @form = wufoo.form(session['formid'])\n fields = @form.flattened_fields\n session['fieldanswers'][fields[sms_count - 1]['ID']] = message_body\n session['fieldanswers'][fields[sms_count]['ID']] = session['phone_number']\n session['fieldanswers'][fields[sms_count + 1]['ID']] = session['form_type']\n @form.submit(session['fieldanswers'])\n if session['form_type'] == 'signup'\n message = ENV['SIGNUP_SMS_MESSAGE']\n message = ENV['SIGNUP_EMAIL_MESSAGE'] if session['contact'] == 'EMAIL'\n else\n message = if !session['end_message'].empty?\n to_gsm0338(session['end_message'])\n else\n 'Thank you. You have completed the form.'\n end\n end\n # Reset session so that the texter can respond to future forms\n session['counter'] = -1\n session['fieldanswers'] = {}\n session['fieldquestions'] = {}\n session['contact'] = 'EMAIL'\n session['errorcount'] = 0\n session['formid'] = ''\n session['fields'] = ''\n session['form_length'] = 0\n session['form_type'] ||= ''\n session['end_message'] ||= ''\n else\n message = ENV['SIGNUP_ERROR_MESSAGE']\n # else\n\n # #message = session[\"counter\"]\n # message = \"2\"\n # #message = session[\"fields\"]\n # session[\"counter\"] = -1\n # session[\"fieldanswers\"] = Hash.new\n # session[\"fieldquestions\"] = Hash.new\n # session[\"contact\"] = \"EMAIL\"\n # session[\"errorcount\"] = 0\n end\n\n # @incoming.save\n twiml = Twilio::TwiML::Response.new do |r|\n r.Message message\n end\n respond_to do |format|\n format.xml { render xml: twiml.text }\n end\n session['counter'] += 1\n end",
"title": ""
},
{
"docid": "43589e7939e6011602e7fc4a2d5b725f",
"score": "0.5503719",
"text": "def message_ids\n return @message_ids\n end",
"title": ""
},
{
"docid": "43589e7939e6011602e7fc4a2d5b725f",
"score": "0.5503719",
"text": "def message_ids\n return @message_ids\n end",
"title": ""
},
{
"docid": "a3b6157aafe1e0de8689d450a7c2fa79",
"score": "0.5487924",
"text": "def message_params\n params[:message]\n end",
"title": ""
},
{
"docid": "e999c2c070941e67af22f567c67ac58d",
"score": "0.54727083",
"text": "def message_params\n params[:message]\n end",
"title": ""
},
{
"docid": "f2e89c38babc3023873f387b7bc3341e",
"score": "0.5470328",
"text": "def run(form)\n survey_type = form[:survey_type]\n resno_gen = ResnoGenerator.new(form[:resno_kind], form[:resno_single], form[:resno_list])\n id_gen = IDGenerator.new(form[:id_kind], form[:id], form[:id_list], form[:id_incr_start])\n addr_gen = AddressGenerator.new(form[:addr_kind], form[:addr_strategy], form[:addr_single], form[:addr_preset], form[:addr_list], form[:addr_file])\n count = form[:count].nil? ? addr_gen.length : form[:count].to_i\n date_gen = DateGenerator.new(form[:due_date_kind], form[:due_date_set], form[:due_date_hours_ahead], form[:due_date_days_ahead])\n contact_gen = ContactGenerator.new(form[:contact_name], form[:contact_surname], form[:contact_email], form[:contact_phone_number])\n additional_properties = AddProps.hash_props(form[:additional_properties])\n request_gen = RabbitCreateGenerator.new(survey_type = survey_type,\n resno_gen = resno_gen,\n id_gen = id_gen,\n addr_gen = addr_gen,\n date_gen = date_gen,\n contact_gen = contact_gen,\n additional_properties = additional_properties,\n count = count)\n request_ids = []\n send = form[:send]\n (1..count).each do |i|\n request = request_gen.generate\n p \"Sending message: #{request}\"\n send_one(request)\n request_ids << request[:jobIdentity]\n end\n return request_ids.join(',')\n end",
"title": ""
},
{
"docid": "fd3383414d815cde56bd5a3f307ac692",
"score": "0.5411363",
"text": "def execute()\n # Use the Message Template Name parameter to retrieve and add the\n # MessageTemplateInstanceID to the @field_values hash.\n @field_values['MessageTemplateInstanceID'] = get_message_template_id(\n @parameters['message_template_name'], @parameters['application_name'])\n log format_hash(\"Message Record Field Values:\", @field_values)\n\n # Create the entry and only return the instanceId field value\n entry = @@remedy_forms['KS_MSG_Message'].create_entry!(\n :field_values => @field_values, :fields => ['instanceId']\n )\n \n # Build the results xml that will be returned by this handler.\n results = <<-RESULTS\n <results>\n <result name=\"Instance Id\">#{escape(entry['instanceId'])}</result>\n </results>\n RESULTS\n log \"Results: \\n#{results}\"\n\n # Return the results String\n return results\n end",
"title": ""
},
{
"docid": "2fb2c808ca516ca70646191194a7607d",
"score": "0.53614396",
"text": "def submit_message(phone, text, from = 'test')\n call(\"submit_message\", {:from => from, :to => phone, :text => text})\n end",
"title": ""
},
{
"docid": "c73081706f4c24d82d82763039a56f5e",
"score": "0.5352858",
"text": "def send_messages\n \nif params[:f1] != nil || params[:f2] != nil || params[:f3] != nil || params[:f4] != nil || params[:f5] != nil || params[:groupCheckBox] != \"false\" then\n \n addresses = ''\n invalidaddresses = ''\n params[:address].each do |p|\n if (p.match('^\\d{10}$'))\n addresses += 'Addresses=tel:' + p + '&'\n elsif (p.scan('/^[^@]*@[^@]*\\.[^@]*$/'))\n addresses += 'Addresses=' + p + '&'\n else\n invalidaddresses += p\n end\n end\n \n att_idx = 0\n\n @split = \"----=_Part_0_#{((rand*10000000) + 10000000).to_i}.#{((Time.new.to_f) * 1000).to_i}\"\n @contents = []\n\n result = \"Content-Type: application/x-www-form-urlencoded; charset=UTF-8\"\n result += \"\\nContent-Transfer-Encoding: 8bit\"\n result += \"\\nContent-Disposition: form-data; name=\\\"root-fields\\\"\"\n result += \"\\nContent-ID: <startpart>\"\n result += \"\\n\\n\"\n \n if params[:address].length > 0\n result += \"#{addresses}\" + 'Subject='+ \"#{params[:subject]}\" + '&Text='+ \"#{params[:message]}\" + '&Group='\"#{params[:groupCheckBox]}\"\n end\n\n result += \"\\n\\n\"\n @contents << result\n \n [ params[:f1], params[:f2], params[:f3], params[:f4], params[:f5] ].each do |param|\n if param\n temp = param[:tempfile]\n file = File.open(temp.path, \"rb\")\n \n result = \"Content-Disposition: form-data; name=\\\"#{param[:name]}\\\"; filename=\\\"#{param[:filename]}\\\"\"\n result += \"\\nContent-Type: #{param[:type]}\"\n result += \"\\nContent-ID: #{param[:type]}\"\n result += \"\\nContent-Transfer-Encoding: binary \"\n @file_contents = File.read(file.path)\n attachment = @file_contents\n\n result += \"\\n\\n#{attachment}\"\n result += \"\\n\"\n\n @contents << result\n\n file.close\n att_idx += 1\n end\n end\n \n mimeContent = \"--#{@split}\\n\" + @contents.join(\"--#{@split}\\n\") + \"--#{@split}--\\n\"\n \n RestClient.post \"#{settings.FQDN}/rest/1/MyMessages\", \"#{mimeContent}\", :Authorization => \"Bearer #{session[:mobo_access_token]}\", :Accept => 'application/json', :Content_Type => 'multipart/related; type=\"application/x-www-form-urlencoded\"; start=\"<startpart>\"; boundary=\"' + @split + '\"' do |response, request, code, &block|\n @mmsresp = response\n end\n \n if @mmsresp.code == 200\n session[:mms_id] = JSON.parse(@mmsresp)[\"Id\"]\n @mms_id = session[:mms_id]\n else\n @mms_send_error = @mmsresp\n session[:mms_error_id] = @mms_send_error\n end\n \nelse\n\n addresses = ''\n invalidaddresses = ''\n params[:address].each do |p|\n if (p.match('^\\d{8}$'))\n addresses += 'Addresses=short:' + p + '&'\n elsif (p.match('^\\d{10}$'))\n addresses += 'Addresses=tel:' + p + '&'\n elsif (p.scan('/^[^@]*@[^@]*\\.[^@]*$/'))\n addresses += 'Addresses=' + p + '&'\n else\n invalidaddresses += p\n end\n end\n \n if params[:address].length > 0\n result = \"#{addresses}\" + 'Subject='+ \"#{params[:subject]}\" + '&Text='+ \"#{params[:message]}\" + '&Group=false'\n end\n \n RestClient.post \"#{settings.FQDN}/rest/1/MyMessages\", \"#{result}\", :Authorization => \"Bearer #{session[:mobo_access_token]}\", :Content_Type => 'application/x-www-form-urlencoded' do |response, request, code, &block|\n @smsresp = response\n end\n \n if @smsresp.code == 200\n session[:sms_id] = JSON.parse(@smsresp)[\"Id\"]\n @sms_id = session[:sms_id]\n else\n @sms_send_error = @smsresp\n session[:sms_error_id] = @sms_send_error \n end\n end\n erb :mobo\nend",
"title": ""
},
{
"docid": "b650750c01bad2a27e060ee3719c730d",
"score": "0.5327684",
"text": "def create\n\n @v1_question = V1::Question.new(question_params.except(:message))\n @v1_message = @v1_question.build_message question_params[:message].except(:employee_ids)\n\n if question_params[:message][:employee_ids] === 'all'\n\n # If :employee_ids param is 'all', send to the whole company's mobile directory\n @v1_message.employee_ids = @v1_message.company.employee_ids\n else\n\n # :employees_ids is a string list of ids ('1,2,3'), convert it into an array\n @v1_message.employee_ids = question_params[:message][:employee_ids].split(\",\").map { |s| s.to_i }\n end\n @v1_message.save\n @v1_question.message_id = @v1_message.id\n\n if @v1_question.save\n send_sms_messages\n render json: @v1_question, status: :created, location: @v1_question\n else\n render json: @v1_question.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "555614dd9cd524b98b9f1b76c8465076",
"score": "0.53093904",
"text": "def sendMessage message, recipients, from = nil, enqueue = nil, bulkSMSMode = nil, retryDurationInHours = nil\n\t\t\t# binding.pry\n\t\t\tpost_body = {\n\n\t\t\t\t'username' => @username, \n\t\t\t\t'message' => message, \n\t\t\t\t'to' => recipients\n\t\t\t}\n\t\t\tif from != nil\n\t\t\t\tpost_body['from'] = from\n\t\t\tend\n\t\t\tif enqueue != nil\n\t\t\t\tpost_body['enqueue'] = enqueue\n\t\t\tend\n\t\t\tif bulkSMSMode != nil\n\t\t\t\tpost_body['bulkSMSMode'] = bulkSMSMode\n\t\t\tend\n\t\t\tif retryDurationInHours != nil\n\t\t\t\tpost_body['retryDurationInHours'] = retryDurationInHours\n\t\t\tend\n\t\t\t\n\t\t\tresponse = executePost(getSmsUrl(), post_body)\n\t\t\t# binding.pry\n\t\t\tif @response_code == HTTP_CREATED\n\t\t\t\tmessageData = JSON.parse(response,:quirks_mode=>true)[\"SMSMessageData\"]\n\t\t\t\trecipients = messageData[\"Recipients\"]\n\t\t\t\t\n\t\t\t\tif recipients.length > 0\n\t\t\t\t\treports = recipients.collect { |entry|\n\t\t\t\t\t\tStatusReport.new entry[\"number\"], entry[\"status\"], entry[\"cost\"], entry[\"messageId\"]\n\t\t\t\t\t}\n\t\t\t\t\t# binding.pry\n\t\t\t\t\treturn reports\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\traise AfricasTalkingGatewayException, messageData[\"Message\"]\n\t\t\t\t\n\t\t\telse\n\t \t\t\traise AfricasTalkingGatewayException, response\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "e6015718428e2251d22ff924d98d0405",
"score": "0.5237276",
"text": "def set_MessageIDs(value)\n set_input(\"MessageIDs\", value)\n end",
"title": ""
},
{
"docid": "4bc5ae732169a676b62e827c3a7d3acf",
"score": "0.5227327",
"text": "def get_message_ids\n\t\tids = []\n\t\t@messages.each do |message|\n\t\t\tids << message.id\n\t\tend\n\t\treturn ids\n\tend",
"title": ""
},
{
"docid": "cc94b27d5afae5e5e11c2a793d10c8a7",
"score": "0.5185567",
"text": "def obtain_message_from_queue\n\t\tsqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])\n\t\tresp = sqs.receive_message(queue_url: ENV['AWS_SQS_ORIGINAL_VIDEOS'], max_number_of_messages: 1)\n\t\treturn resp.messages\n\tend",
"title": ""
},
{
"docid": "cc94b27d5afae5e5e11c2a793d10c8a7",
"score": "0.5185567",
"text": "def obtain_message_from_queue\n\t\tsqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])\n\t\tresp = sqs.receive_message(queue_url: ENV['AWS_SQS_ORIGINAL_VIDEOS'], max_number_of_messages: 1)\n\t\treturn resp.messages\n\tend",
"title": ""
},
{
"docid": "8247d21316428780c2b43f7e69533597",
"score": "0.5185306",
"text": "def message_params\n params.require(:message).permit(:msg_type, :body, :user_ids, :active, :from_user_id)\n end",
"title": ""
},
{
"docid": "30b4a0aacc64a56e9471fc79d571973b",
"score": "0.5146119",
"text": "def message_params\n params.require(:message).permit(:from_name, :from_email, :subject, :body_html, :is_public, :status, contact_ids: [])\n end",
"title": ""
},
{
"docid": "2e058d2c6bc220e1d64843beade82b84",
"score": "0.51353025",
"text": "def process_messages\n execute_sql_query(\n 'select * from messages where processed = 0 and direction = \\'in\\';'\n ).each do |msg|\n execute_sql_statement(\n 'update messages set processed = \\'1\\' ' \\\n \"where id = '#{msg[0]}';\"\n )\n activate(payload: msg[3], flag: msg[2])\n end\n end",
"title": ""
},
{
"docid": "172beb2dc3f644b08822c06472549d3f",
"score": "0.51307327",
"text": "def index\n # byebug\n # .... riiiiiight. Get the messages from Message where recipient_id = user_id. \n # .... maybe it's time to get global props somehow? \n #get the message_id's from message_recipients\n #where recipient_id = user\n user_messages = []\n user_groups = UserGroup.where(user_id: User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])).pluck(:group_id)\n user_groups.each do |grp| \n message_ids = MessageRecipient.where(recipient_group_id: grp)\n messages = Message.where(id: message_ids.map{|msg_id| msg_id[\"message_id\"]})\n user_messages.push([grp, message_ids, messages])\n end\n # @message_ids=MessageRecipient.where( recipient_id: retrieve_message_params[:userId] )\n # User.find(retrieve_message_params[:userId])\n #for each message_id, add the message\n # @message_ids.map{|mid| mid[\"message_id\"]}\n # @messages=Message.where(id: @message_ids.map{|mid| mid[\"message_id\"]})\n \n render json: {messages: user_messages}\n end",
"title": ""
},
{
"docid": "aab5e4ed2555bc508ba1ba198f8bac95",
"score": "0.5130632",
"text": "def send_message (queue, content)\n\n queue = resolve_queue(queue)\n\n params = {}\n params[\"Action\"] = \"SendMessage\"\n params[\"MessageBody\"] = content\n params[\"QueueName\"] = queue.name\n \n doc = do_action :get, queue.host, \"/#{queue.name}\", params\n\n SQS::get_element_text(doc, '//MessageId') # This is to verify if MessageId exists in the response. \n \n return true # Not return MessageId anymore as MessageId is not reusable anywhere else in SQS API 2008-01-01\n end",
"title": ""
},
{
"docid": "2b5bb19eace1b0217331029ded3765e4",
"score": "0.51246715",
"text": "def send_multiple(messages)\n responses=[]\n Net::HTTP.start(Service.bulksms_gateway(@country), MESSAGE_SERVICE_PORT) do |http|\n messages.each do |msg|\n payload = [@account.to_http_query, msg.to_http_query].join('&')\n resp = http.post(MESSAGE_SERVICE_PATH, payload)\n responses << Response.parse(resp.body)\n end\n end\n responses\n end",
"title": ""
},
{
"docid": "7d49f37a9382a7b3f4a4d33abf2a701f",
"score": "0.51157576",
"text": "def personal_mail_message_bodies(opts = { :ids => [] })\n args = postfields(opts)\n h = compute_hash(args.merge(:url => @@personal_mail_message_bodies_url))\n return h if h\n just_xml = true\n xml = process_query(Reve::Classes::MailMessage, opts[:url] || @@personal_mail_message_bodies_url,just_xml,args)\n results = {}\n xml.search(\"//rowset/row\").each do |el| \n results[el.attributes['messageID']] = el.inner_text\n end\n results\n end",
"title": ""
},
{
"docid": "a492616d7834ef1ccfd76d3800f4b419",
"score": "0.51121205",
"text": "def message_params\n params.fetch(:message, {})\n end",
"title": ""
},
{
"docid": "a492616d7834ef1ccfd76d3800f4b419",
"score": "0.51121205",
"text": "def message_params\n params.fetch(:message, {})\n end",
"title": ""
},
{
"docid": "b329e5024ceb2d1b3f56826b764305ad",
"score": "0.50850624",
"text": "def job_id_from_sqs_message(message)\n bodyvars = JSON.parse(message.body)\n if bodyvars[\"Type\"] == \"Notification\"\n messagevars = JSON.parse(bodyvars[\"Message\"])\n if (messagevars[\"Action\"] == \"ArchiveRetrieval\" || messagevars[\"Action\"] == \"InventoryRetrieval\") && messagevars[\"StatusCode\"] == \"Succeeded\"\n jobid = messagevars[\"JobId\"]\n puts \"Found Job ID: #{jobid}\"\n return jobid\n else\n puts \"Not a message of interest\"\n end\n else\n puts \"Not a notification\"\n end\n return nil\nend",
"title": ""
},
{
"docid": "016a6814b991ae44a192f7bf4eba27ca",
"score": "0.5082393",
"text": "def message\n params['message']\n end",
"title": ""
},
{
"docid": "f2d6361f4285c38a69ca88c6cd8025b2",
"score": "0.5075669",
"text": "def send_request(message, data, even_if_busy = false)\n request = form_request(message)\n request_id = request.first\n @data[request_id] = data\n if send_message(request, even_if_busy)\n request_id\n else\n @data.delete request_id\n false\n end\n end",
"title": ""
},
{
"docid": "4fdbd9660305ad6b00d5f25e26315909",
"score": "0.5067576",
"text": "def message_params\n params[:message][:user_id] = current_user.id\n params[:message][:from] = Figaro.env.twilio_from\n params.require(:message).permit!\n end",
"title": ""
},
{
"docid": "69a5ea55e7b1d57f8d3484f968a5e14d",
"score": "0.5061542",
"text": "def set_message\n @subject = params[:post_description]\n @recipientid = params[:post_userid]\n end",
"title": ""
},
{
"docid": "b8e6eafe98c6998f3c0d27a3c617b5ff",
"score": "0.5043181",
"text": "def build_message(*args)\n options = args.extract_options!\n Queued::Services::AmazonSqs::Message.new(self, options[:id], options[:body])\n end",
"title": ""
},
{
"docid": "9121058f95dbd7c4aff8fc34b4371b84",
"score": "0.5038005",
"text": "def call\n if @message.body.casecmp('verify').zero?\n VerifyPerson.new(@message.from).call\n elsif @message.body.casecmp('cancel form').zero?\n CancelForm.new(@message.sms_form).call\n elsif @message.body.casecmp('submit form').zero?\n SubmitForm.new(@message.sms_form).call\n elsif @message.sms_form\n HandleForm.new(@message).call\n elsif (form = Form.find_by(twilio_keyword: @message.body.downcase))\n StartForm.new(@message, form).call\n elsif (user = @message.previous_message&.user)\n user.update(unread_messages: user.unread_messages + 1)\n else\n SMS.send @message.from, 'I did not understand that. Please re-type your keyword.'\n end\n end",
"title": ""
},
{
"docid": "6b738506f3bf4fc6b1652b4fa87f493c",
"score": "0.5037768",
"text": "def request_sms\n\t \tsender = params[:From]\n\t \treceiver = params[:From]\n\t \tmessages_array = []\n\t sms_receiver = TextMessage.new #Class TextMessage is on lib folder \n\t sms_receiver.body = \"\" \n\t sms_receiver.from = \"+18316847481\" #twilio number\n\t sms_receiver.to = receiver\n\t messages_array[0] = sms_receiver\n\t #splits the received message\n\t instructions = params[:Body].upcase.split('/')\n\t \tcase instructions[0]\n\t \t#TODO: Pin\n\t \twhen \"REQUEST\"\n\t \t\t#request number\n\t \t\t#instruction: request/mom/email/pin\n\t \t\tuser = User.where(\"lower(email) = ? AND pin = ?\", instructions[2].downcase,instructions[3]).first\n\t \t\tif user\n\t \t\t\tcontact = user.contacts.where(\"lower(name) = ?\", instructions[1].downcase).first\n\t \t\t\tsms_receiver.body = \"Hello #{user.name} the number of #{instructions[1]} is #{contact.phone}; Remember to delete the messages for security\"\n\t \t\telse\n\t \t\t\tsms_receiver.body = \"Sorry the email or pin are wrong!\"\n\t \t\tend\t\t\n\t \telse\n\t\t\t#send SMS\n\t\t\t#instruction: mom/body/email/pin\n\t\t\tif instructions.size == 4\n\t\t\t\tuser = User.where(\"lower(email) = ? AND pin = ?\", instructions[2].downcase,instructions[3]).first\n\t\t\t\tif user\n\t\t \t\t\tcontact = user.contacts.where(\"lower(name) = ? \", instructions[0].downcase).first\n\t\t\t\t\tsms_receiver.body = \"the message was sent to the phone number of #{instructions[0]} which is #{contact.phone}; Remember to delete the messages for security\"\n\t\t\t\t\tsms_sender = TextMessage.new\n\t\t sms_sender.body = instructions[1].downcase\n\t\t sms_sender.from = \"+18316847481\"\n\t\t sms_sender.to = contact.phone\n\t\t messages_array[1] = sms_sender\t\n\t\t \t\telse\n\t\t \t\t\tsms_receiver.body = \"Sorry the email or pin are wrong!\"\n\t\t \t\tend\t\n\t\t \telse\n\t\t \t\tsms_receiver.body = \"Wrong instruction!\"\n\t\t \tend\n\t\t\t\n\t \tend\n\t \tresponse = \"\"\n\t account_sid = ENV['TWILIO_ACCOUNT_SID']\n\t auth_token = ENV['TWILIO_TOKEN']\n\t @client = Twilio::REST::Client.new account_sid, auth_token \n\t messages_array.each do |message|\n\t @client.account.messages.create(\n\t :from => message.from,\n\t :to => message.to,\n\t :body => message.body\n\t ) \n\t response = \"Sent message to #{message.from}\"\n\t end\n\t render xml: response\n\t end",
"title": ""
},
{
"docid": "749e51b5c9e2187dc5c42439e64e4013",
"score": "0.50370175",
"text": "def run_me\n region = \"us-west-2\"\n queue_name = \"my-queue\"\n entries = [\n {\n id: \"Message1\",\n message_body: \"This is the first message.\"\n },\n {\n id: \"Message2\",\n message_body: \"This is the second message.\"\n }\n ]\n\n sts_client = Aws::STS::Client.new(region: region)\n\n # For example:\n # 'https://sqs.us-west-2.amazonaws.com/111111111111/my-queue'\n queue_url = \"https://sqs.\" + region + \".amazonaws.com/\" +\n sts_client.get_caller_identity.account + \"/\" + queue_name\n\n sqs_client = Aws::SQS::Client.new(region: region)\n\n puts \"Sending messages to the queue named '#{queue_name}'...\"\n\n if messages_sent?(sqs_client, queue_url, entries)\n puts \"Messages sent.\"\n else\n puts \"Messages not sent.\"\n end\nend",
"title": ""
},
{
"docid": "4c1e91e5b2c9aec806e3390d95b9cc89",
"score": "0.50334144",
"text": "def sent_messages\n mailbox_messages('sent')\n end",
"title": ""
},
{
"docid": "70836566f811f7de879300138228b8ad",
"score": "0.5030021",
"text": "def sendMessage *args\n options=fill_args [\n :projectid,:messagetext,:userid,:username\n ],[\n :projectid,:messagetext\n ],*args\n if options[:username]==nil && options[:userid]==nil\n raise \"Username or userid is required\"\n end\n if options[:username]!=nil && options[:userid]!=nil\n raise \"Both username and userid is not allowed\"\n end\n request \"/Message/sendMessage.json\", options\n end",
"title": ""
},
{
"docid": "97ff0504b728b33fc72f9cdb5fbc240f",
"score": "0.50247324",
"text": "def send_bulk (phones, message, time_schedualed = nil)\n # Adjust Parameters\n recipients = []\n phone_numbers = phones.split(\",\")\n phone_numbers.each do |phone|\n recipients.push(Normalizer.normalize_number(phone))\n end\n message = Normalizer.normalize_message(message)\n\n # Initialize Request\n http = Net::HTTP.new('api.unifonic.com', 80)\n path = base_path(\"Messages/SendBulk\")\n headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }\n\n # Add Body Parameters to request\n body = \"AppSid=#{api_key}&Recipient=\"\n\n # Add Recipents to body attributes\n recipients.each_with_index do |phone, index|\n body += phone\n if index != (recipients.count - 1)\n body += \",\"\n end\n end\n\n body += \"&Body=#{message}\"\n body += \"&SenderID=#{sender_phone}\" unless sender_phone.nil?\n body += '&TimeScheduled=#{time_schedualed}' unless time_schedualed.nil?\n \n # Send Call Request\n response = http.post(path, body, headers)\n response_body = JSON.parse(response.body)\n\n if response.code.to_i == 200 && !response_body[\"data\"].nil? \n return { messages: response_body[\"data\"][\"Messages\"], \n status: response_body[\"data\"][\"Status\"], \n number_of_units: response_body[\"data\"][\"NumberOfUnits\"],\n cost: response_body[\"data\"][\"Cost\"],\n currency_code: response_body[\"data\"][\"CurrencyCode\"],\n balance: response_body[\"data\"][\"Balance\"],\n recipient: response_body[\"data\"][\"Recipient\"],\n time_created: response_body[\"data\"][\"TimeCreated\"],\n code: 0 }\n else\n result = ErrorCode.get_error_code(response_body[\"errorCode\"]) \n\n return result \n end \n end",
"title": ""
},
{
"docid": "c5a3a672aeb89aee151b70548fe38629",
"score": "0.5021885",
"text": "def multiple_text_sms(smss)\n params = {\n :messages => []\n }\n smss.each { |sms|\n params[:messages].push({\n :from => sms.from,\n :to => sms.to,\n :text => sms.text\n })\n }\n\n is_success, result = execute_POST( \"/sms/1/text/multi\", params )\n\n convert_from_json(SimpleSMSAnswer, result, !is_success)\n end",
"title": ""
},
{
"docid": "8e0a87f1a2f5d246e7ad210c8f57649c",
"score": "0.5020377",
"text": "def message_params\n params.require(:message).permit(:subject,\n :body,\n :user_id,\n { :person_ids => [] })\n end",
"title": ""
},
{
"docid": "2421972604cda116b5ae168ef6a162a4",
"score": "0.50192857",
"text": "def sms_message_params\n params.require(:sms_message).permit(:user_id, :message, :send_to_option, { sub_unit_ids: [] }, { user_ids: [] })\n end",
"title": ""
},
{
"docid": "2025dce3137fd0de4d6c4a885ef69b5a",
"score": "0.50188416",
"text": "def send_message_to_unsubmitted_or_submitted_users_for_quiz(course_id,id,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n # verify existence of params\n raise \"course_id is required\" if course_id.nil?\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :course_id => course_id,\n :id => id\n )\n\n # resource path\n path = path_replace(\"/v1/courses/{course_id}/quizzes/{id}/submission_users/message\",\n :course_id => course_id,\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:post, path, query_params, form_params, headers)\n response\n \n end",
"title": ""
},
{
"docid": "9c13477e8b61d832ab80d7ab95f2770d",
"score": "0.5013637",
"text": "def save_messages(requested_by)\n msg_refno = ''\n success = call_ok?(:secure_message_create, request_save(requested_by)) do |response|\n break if response.blank?\n\n msg_refno = response[:msg_refno]\n end\n [success, msg_refno]\n end",
"title": ""
},
{
"docid": "f60089668e625d7444a5a9fdca150506",
"score": "0.50118107",
"text": "def handle_multi_recipients\n return if self.recipient_ids.blank?\n for user_id in self.recipient_ids\n m = Message.new(:subject => self.subject, :body => self.body)\n m.recipient_id, m.recipient_type = user_id, self.recipient_types\n m.sender = self.sender\n m.system_message = true if self.system_message\n m.save\n end\n end",
"title": ""
},
{
"docid": "9242991df05732a919e2ee8fc93cf34b",
"score": "0.50053245",
"text": "def mailq\n mailq = runcmd(@mailq)\n \n messages = Array.new\n msg = nil\n \n mailq.each do |m|\n if m =~ /^\\s*(.+?)\\s+(.+?)\\s+(.+-.+-.+) (<.*>)/\n msg = {}\n msg[:recipients] = Array.new\n msg[:frozen] = false\n \n msg[:age] = $1\n msg[:size] = $2\n msg[:msgid] = $3\n msg[:sender] = $4\n \n msg[:frozen] = true if m =~ /frozen/\n elsif m =~ /\\s+(\\S+?)@(.+)/ and msg\n msg[:recipients] << \"#{$1}@#{$2}\"\n elsif m =~ /^$/ && msg\n messages << msg\n msg = nil\n end\n end\n \n messages\n end",
"title": ""
},
{
"docid": "ce191817d904baa3b72a23595ccef7f3",
"score": "0.49926746",
"text": "def receive_messages\n resp = @sqs.receive_message(\n message_attribute_names: PIPE_ARR,\n queue_url: @settings[:consuming_sqs_queue_url],\n wait_time_seconds: @settings[:wait_time_seconds],\n max_number_of_messages: @settings[:max_number_of_messages]\n )\n resp.messages.select do |msg|\n # switching whether to transform the message based on the existance of message_attributes\n # if this is a raw SNS message, it exists in the root of the message and no conversion is needed\n # if it doesn't, it is an encapsulated messsage (meaning the SNS message is a stringified JSON in the body of the SQS message)\n begin\n logger.debug('[transport-snssqs] msg parse start')\n unless msg.key? 'message_attributes'\n # extracting original SNS message\n json_message = ::JSON.parse msg.body\n logger.debug('[transport-snssqs] msg parsed from JSON')\n # if there is no Message, this isn't a SNS message and something has gone terribly wrong\n unless json_message.key? 'Message'\n logger.info('[transport-snssqs] msg body without SNS Message received')\n next\n end\n # replacing the body with the SNS message (as it would be in a raw delivered SNS-SQS message)\n msg.body = json_message['Message']\n msg.message_attributes = {}\n # discarding messages without attributes, since this would lead to an exception in subscribe\n unless json_message.key? 'MessageAttributes'\n logger.info('[transport-snssqs] msg body without message attributes received')\n next\n end\n # parsing the message_attributes\n json_message['MessageAttributes'].each do |name, value|\n msg.message_attributes[name] = Aws::SQS::Types::MessageAttributeValue.new\n msg.message_attributes[name].string_value = value['Value']\n msg.message_attributes[name].data_type = 'String'\n end\n end\n logger.debug('[transport-snssqs] msg parsed successfully')\n msg\n rescue ::JSON::JSONError => e\n logger.info(e)\n end\n end\n rescue Aws::SQS::Errors::ServiceError => e\n logger.info(e)\n end",
"title": ""
},
{
"docid": "63fa417dee28fb9df03cc2c25954e20c",
"score": "0.49840346",
"text": "def to_gcloud_messages message_ids #:nodoc:\n msgs = @messages.zip(Array(message_ids)).map do |arr, id|\n Message.from_gapi \"data\" => arr[0],\n \"attributes\" => jsonify_hash(arr[1]),\n \"messageId\" => id\n end\n # Return just one Message if a single publish,\n # otherwise return the array of Messages.\n if @mode == :single && msgs.count <= 1\n msgs.first\n else\n msgs\n end\n end",
"title": ""
},
{
"docid": "63fa417dee28fb9df03cc2c25954e20c",
"score": "0.49840346",
"text": "def to_gcloud_messages message_ids #:nodoc:\n msgs = @messages.zip(Array(message_ids)).map do |arr, id|\n Message.from_gapi \"data\" => arr[0],\n \"attributes\" => jsonify_hash(arr[1]),\n \"messageId\" => id\n end\n # Return just one Message if a single publish,\n # otherwise return the array of Messages.\n if @mode == :single && msgs.count <= 1\n msgs.first\n else\n msgs\n end\n end",
"title": ""
},
{
"docid": "332a17578101b4109608e7b3dffbeee8",
"score": "0.49730933",
"text": "def find_messages\n @box = @boxes.find { |box| @mailbox =~ /#{box}/ } # TODO: needs more work\n raise unless @box\n @email = @flag[@box]\n raise unless @email\n return [answered_in_curr, wrote_in_curr, responses_in_curr].flatten\n end",
"title": ""
},
{
"docid": "6ed39eecc5343f2385d66e764093efdf",
"score": "0.49592155",
"text": "def uploadnumbers\n phone_numbers = []\n message1 = params.delete(:message1)\n message2 = params.delete(:message2)\n message1 = to_gsm0338(message1)\n message2 = to_gsm0338(message2) if message2.present?\n messages = Array[message1, message2]\n smsCampaign = params.delete(:twiliowufoo_campaign)\n infile = params[:file].read\n contentType = params[:file].content_type\n\n if contentType == 'text/csv'\n CSV.parse(infile, headers: true, header_converters: :downcase) do |row|\n if row['phone_number'].present?\n # @person << row\n Rails.logger.info(\"[TwilioMessagesController#sendmessages] #{row}\")\n phone_numbers.push(row['phone_number'])\n else\n flash[:error] = \"Please make sure the phone numbers are stored in a column named 'phone_number' in your CSV.\"\n break\n end\n end\n Rails.logger.info(\"[TwilioMessagesController#sendmessages] messages #{messages}\")\n Rails.logger.info(\"[TwilioMessagesController#sendmessages] phone numbers #{phone_numbers}\")\n phone_numbers = phone_numbers.reject { |e| e.to_s.blank? }\n @job_enqueue = Delayed::Job.enqueue SendTwilioMessagesJob.new(messages, phone_numbers, smsCampaign)\n if @job_enqueue.save\n Rails.logger.info(\"[TwilioMessagesController#sendmessages] Sent #{phone_numbers} to Twilio\")\n flash[:notice] = \"Sent Messages: #{messages} to Phone Numbers: #{phone_numbers}\"\n else\n Rails.logger.error('[TwilioMessagesController#sendmessages] failed to send text messages')\n flash[:error] = 'Failed to send messages.'\n end\n else\n flash[:error] = 'Please upload a CSV instead.'\n end\n respond_to do |format|\n format.html { redirect_to '/twilio_messages/sendmessages' }\n end\n end",
"title": ""
},
{
"docid": "43a4cea65cfb2ef0dd8cc8ffd51dd503",
"score": "0.49546745",
"text": "def create\n recievers = params[:message][:receiver].split(',')\n recievers.each do |r|\n current_user.send_message( User.find( r ), params[:message][:subject],\n params[:message][:body], params[:message][:uploads_attributes] )\n end\n respond_to do |format|\n format.html { redirect_to( user_messages_path, :notice => 'Message was successfully created.') }\n format.js\n format.xml { render :xml => @message, :status => :created, :location => @message }\n end\n end",
"title": ""
},
{
"docid": "6d6c631dce487447d9ca8ea8d923f40d",
"score": "0.4949054",
"text": "def question_ids\n # Parse payload\n if self.payload\n json = JSON.parse(self.payload)['question_ids']\n else\n []\n end\n end",
"title": ""
},
{
"docid": "5e47214d755075e282a504b6d0c6820e",
"score": "0.49458635",
"text": "def message_params\n params.require(:message).permit(:content, :id, :user_id, recipient_list_ids: [])\n end",
"title": ""
},
{
"docid": "b65d98875c1e913ab3c197f48189b5c6",
"score": "0.49424383",
"text": "def create\n @recipients = Array.new\n if params[:_recipients].present?\n params[:_recipients].split(\",\").each do |recp_id|\n recp = User.find_by_id(recp_id)\n next if recp.nil?\n @recipients << recp\n end\n end\n @receipt = current_user.send_message(@recipients, params[:body], params[:subject])\n if (@receipt.errors.blank?)\n @conversation = @receipt.conversation\n flash[:notice]= t('mailboxer.sent')\n redirect_to conversation_path(@conversation, :box => :sentbox)\n else\n render :action => :new\n end\n end",
"title": ""
},
{
"docid": "f7e75599a2a0e16e8ae171907e2e9ba0",
"score": "0.49323347",
"text": "def message_processor_params\n params[:message_processor]\n end",
"title": ""
},
{
"docid": "05032ea8e7f5c53d33abeb65812bdb0e",
"score": "0.49207467",
"text": "def processMessage\n \t\tlogger.info \"Loading sms_handler processMessage\"\n \t\ttext = params[:text]\n \t\tlogger.debug \"Received text message: #{text.inspect}\"\n \t\tsender = params[:sender]\n \t\tlogger.debug \"Received sender number: #{sender.inspect}\"\n \t\t#First determine if phone-number is valid - https://www.debuggex.com - test regex her\n \t\t#Husk at i Rails skal ^ og $ erstattes af henholdsvis \\A og \\z. Ellers virker det ikke\n \t\t#Regel: Vi tillader forskelige formater når de kommer direkte fra gatewayen. Senere laves de om\n \t\t#i klasse-metoden for member så alle telefonnumre er med +45. Det er vigtigt at alle telefonnumre\n \t\t#er fuldstændig ens i databasen.\n \t\tif text.present? && sender.present? \n \t\t\tlogger.debug \"Sender number and text present. Proceeding....\"\n \t\t\ttext = text.downcase\n \t\t\tlogger.debug \"Text message downcased: #{text.inspect}\"\n \t\t\tsender = sender.strip\n \t\t\tlogger.debug \"Sender stripped for whitespaces: #{sender.inspect}\"\n\n \t\t\tlogger.debug \"Checking if incoming phone number is valid\"\n \t\t\tif SMSUtility::SMSFactory.validate_phone_number_incoming?(sender) #/\\A(45|\\+45|0045)?[1-9][0-9]{7}\\z/.match(sender)\n\t \t\t\tlogger.debug \"Incoming phone number valid\"\n\n\t \t\t\tlogger.debug \"Trying to determine type of message: opt-in or opt-out\"\n\t \t\t\tif text.downcase.include? \"stop\"\n\t \t\t\t\tlogger.debug \"Opt-out request received. Calling stopStoreSubscription method..background process\"\n\t \t\t\t\tSMSUtility::BackgroundWorker.new.delay.stopStoreSubscription(sender, text)\n\t \t\t\telsif text.downcase.include? \"nej\"\n\t \t\t\t\tlogger.debug \"Invalid signup from people under 18 years old. Member must be deleted\"\n\t \t\t\t\tSMSUtility::BackgroundWorker.new.delay.stopStoreSubscriptionMinor(sender, text)\t\n\t \t\t\telse\n\t \t\t\t\tlogger.debug \"Opt-in request received. Calling signupMember method...background process\"\n\t \t\t\t\tSMSUtility::BackgroundWorker.new.delay.signupMember(sender, text)\n\t \t\t\tend\n\t \t\telse\n\t \t\t\tlogger.fatal \"Error: Incoming phone number not valid\"\n\t \t\t\tlogger.debug \"Error: Incoming phone number not valid\"\n\t \t\t\tMessageError.create!(recipient: sender, text: text, error_type: \"invalid_phone_number\")\n\t \t\tend\n \t\telse\n \t\t\tlogger.fatal \"Error: Missing phone number or text\"\n\t \t\tlogger.debug \"Error: Missing phone number or text\"\n \t\t\tMessageError.create!(recipient: sender, text: text, error_type: \"missing_attributes\")\n \t\t\t#Default response with OK status\n \t\tend\n \t\t#Return this no matter what\n \t\trender :nothing => true, :status => :ok \t\n \tend",
"title": ""
},
{
"docid": "ae2746d4236ee54dfdf55a3dbc8c92ff",
"score": "0.49201626",
"text": "def create\n @bad_recipients = []\n @good_recipients = []\n params[:message][:to].split(',').map!(&:strip).uniq.each do |login|\n @message = Message.new(params[:message])\n @message.sender = @user\n @message.recipient = User.find_by_login(login)\n if @message.save\n UserMailer.deliver_message_notification(@message)\n @good_recipients << login\n else\n @bad_recipients << login\n end\n end\n\n respond_to do |format|\n format.js\n end\n end",
"title": ""
},
{
"docid": "7e4f1ba64e24bbdb8135933dd84aa0cd",
"score": "0.49191317",
"text": "def create\n @recievers = params[:message][:receiver_ids]\n @recievers = @recievers.split(\", \") if @recievers\n rec_ids = Array.new\n @recievers.each do |rec|\n rec_ids = User.find(:first,:conditions=>[\"username=?\",rec])\n send_message(params[:message][:sender_id],rec_ids.id,params[:message][:message]) if !rec_ids.nil? and !rec_ids.is_admin?\n Notifier.msg_mail_to_user(@message).deliver if rec_ids and !rec_ids.is_admin? and @message.save\n end if @recievers\n #@message = Message.new(params[:message])\n #\n respond_to do |format| \n format.js \n end \n end",
"title": ""
},
{
"docid": "941d6b61551d201eb97a086b1983b8fe",
"score": "0.49141887",
"text": "def multiple_utf8_sms(smss)\n params = {\n :text => {\n :uri => \"/sms/1/text/multi\",\n :messages => []\n },\n :binary => {\n :uri => \"/sms/1/binary/multi\",\n :messages => []\n }\n }\n smss.each { |sms|\n usage = self.compute_sms_usage(sms.text)\n if usage[:format] == :gsm7 then\n params[:text][:messages].push({\n :from => sms.from,\n :to => sms.to,\n :text => sms.text\n })\n else\n text_array = sms.text.force_encoding('utf-8').codepoints.map { |c| sprintf('%02x', c) }\n params[:binary][:messages].push({\n :from => sms.from,\n :to => sms.to,\n :binary => {\n :hex => text_array.join(' '),\n :dataCoding => 8,\n :esmClass => 0\n }\n })\n end\n }\n\n results = []\n if params[:text][:messages].length > 0 then\n is_success, result = execute_POST( params[:text][:uri] , params[:text][:messages] )\n results.push(convert_from_json(SimpleSMSAnswer, result, !is_success))\n else\n results.push(nil)\n end\n\n if params[:binary][:messages].length > 0 then\n is_success, result = execute_POST( params[:binary][:uri] , params[:binary][:messages] )\n results.push(convert_from_json(SimpleSMSAnswer, result, !is_success))\n else\n results.push(nil)\n end\n return results\n end",
"title": ""
},
{
"docid": "4cd00fbc2b12b6554a9ae34a9e13cd5b",
"score": "0.49131483",
"text": "def _incoming_message\n @_incoming_message ||= []\n end",
"title": ""
},
{
"docid": "866637d32e143a01970adf1cb2e5d0be",
"score": "0.491037",
"text": "def reply\n Rails.logger.info params\n\n message = params[:Body]\n phone = params[:From][2..-1]\n\n if message.downcase.starts_with?(\"remove\")\n # Remove\n unsubscribe(phone)\n elsif message.downcase.starts_with?(\"add\")\n # Add [id]\n institutions = message.scan(/\\d+/)\n subscribe_to_institutions(phone, institutions)\n elsif message.downcase.starts_with?(\"near me\") or message.downcase.starts_with?(\"nearby\")\n # Near me | Nearby\n zip = params[:FromZip]\n m = nearZip(zip)\n send_message([phone], m)\n elsif message.downcase.starts_with?(\"near\")\n # Near [zipcode]\n zips = message.downcase.scan(/\\d{5}/)\n zips.each do |zip|\n m = nearZip(zip)\n send_message([phone], m)\n end\n elsif message.downcase.starts_with?(\"capacity\")\n # Capacity [id]\n id = message.downcase.scan(/\\d+/)\n if id.present?\n m = capacity(id)\n else\n m = \"It appears you're missing an id. Example: 'capacity 10'\"\n end\n send_message([phone], m)\n else\n m = []\n m << \"Unfortunately I don't understand how to process: \"\n m << message + \"\\n\\n\"\n m << \"I understand the following:\"\n m << \"nearby | near me - Shows locations within your zipcode\"\n m << \"near [zipcode] - Shows locations within the given zipcode\"\n m << \"capacity [id] - Shows the current capacity of the given institution\"\n m << \"add [id] - Subscribes to the institution with that ID\"\n m << \"remove - Removes you from all subscriptions\"\n send_message([phone], m.join(\"\\n\\n\"))\n end\n head :ok, content_type: \"text/html\"\n end",
"title": ""
},
{
"docid": "9fd2bef11ca3db9f5bb99218a6355699",
"score": "0.4906574",
"text": "def sent_requests\n\tsession[:user_info_id] = current_user.id\n\tif request.post?\n\t\tif params[:user_ids]\n\t\t\tFriend.update_all(\"request_status ='Pending'\", \"id in (#{params[:user_ids].join(',')})\") \n\t\t\tfor id in params[:user_ids]\n\t\t\t\tuser_info_id=Friend.find(id).user_friend_id\n\t\t\t Notifier::deliver_sent_request(find_user_info(user_info_id).email)\n\t\t\tend\n\t\t\tflash[:notice]=\"Requests sent successfully \"\n\t\telse\n\t\t\tflash[:notice]=\"please select the checkbox.\"\n\t\tend\n\tend\n\t@requests=Friend.requests(current_user.id, false).paginate(:page=>params[:page], :per_page=>7)\n check_for_active_tab\n end",
"title": ""
},
{
"docid": "87ff52c80cc76522276a90e7749471f2",
"score": "0.49033487",
"text": "def generate_bulk_message_request(message)\n\n message_json = generate_base_message(message)\n message_json.to_email_address.push(AddressJson.new(\"%%DeliveryAddress%%\", \"%%RecipientName%%\"))\n message_json.merge_data = populate_merge_data(message.global_merge_data, message.to_recipient)\n\n messages_json = []\n messages_json.push(message_json)\n\n InjectionRequest.new(@server_id, @api_key, messages_json)\n\n end",
"title": ""
},
{
"docid": "b44e0a06d64934909d075f31f4489920",
"score": "0.48997107",
"text": "def user(*jids)\n Log.logger.debug(\"Received call for user method\")\n fetch_stdin\n unless jids.kind_of?(Array)\n Log.logger.error(\"Throwing ArgumentError because Jids is not an array.\")\n raise ArgumentError, \"Jids needs to be an Array got #{jids.class}\"\n end\n\n check_messagequeue\n\n Message.batch do\n jids.each do |jid|\n Message.message_to_user(jid)\n end\n end\n end",
"title": ""
},
{
"docid": "7a3fe14482c0bd039e9a162f0ec0f99c",
"score": "0.48978823",
"text": "def inbox_messages_ids\n parameters = { userId: @user_id, labelIds: 'INBOX' }\n parameters[:pageToken] = @next_page if @next_page\n\n result = @api_client.execute!(\n api_method: @gmail.users.messages.list,\n parameters: parameters\n )\n\n @next_page = result.next_page_token\n result.data.messages.map(&:id)\n end",
"title": ""
},
{
"docid": "7825d92401de9ec863a112ba521c9807",
"score": "0.48963973",
"text": "def message_posted(message)\n @title = 'MESSAGGIO INVIATO'\n redmine_headers 'Project' => message.project.identifier,\n 'Topic-Id' => (message.parent_id || message.id)\n message_id message\n references message.parent unless message.parent.nil?\n recipients(message.recipients)\n cc((message.root.watcher_recipients + message.board.watcher_recipients).uniq - @recipients)\n subject acronym(nil) << \"[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}\"\n body :message => message,\n :message_url => url_for(message.event_url)\n render_multipart('message_posted', body)\n end",
"title": ""
},
{
"docid": "ce0f42bab508896f9be12fc4fbaa6494",
"score": "0.48946118",
"text": "def reciever\n if params[:sender].nil? || params[:text].nil? \n raise ActiveRecord::RecordInvalid\n else\n sender = User.find_by(email: params[:sender])\n if sender\n recievers = sender.get_recipient_send_message(params[:text]).pluck(:email).uniq\n json_response({success: true, recipients: recievers, count: recievers.size}, :ok)\n else\n raise ActiveRecord::RecordNotFound\n end\n end\n end",
"title": ""
},
{
"docid": "b7a5c69761b8883d7f3cebf7b01d8bb5",
"score": "0.48936087",
"text": "def emailconform\n userid = params[:userid]\n #text = params[:text]\n msg = Array.new\n if !userid.nil?\n #u = User.find_by_id(userid)\n Email.user_conform(userid).deliver\nmsg={\"message\"=>\"Message successfully sent!\"}\n else\n @msg={\"message\"=>\"please provide values..\"}\n end # for if\n render :json =>msg\n end",
"title": ""
},
{
"docid": "a6b4379e8c0ee619ac80773bbef6bd23",
"score": "0.48888907",
"text": "def get_message_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/message_fields\")\n end",
"title": ""
},
{
"docid": "ee9f4d04351b403e57653d174491bee1",
"score": "0.4886108",
"text": "def message_params\n params.require(:message).permit(:text, :contact_id, :incoming, :user_id)\n end",
"title": ""
},
{
"docid": "e1e76f0fb9cade3a0e5c9fd422bb67ca",
"score": "0.48834467",
"text": "def message_params\n params.require(:message).permit(:body, :priority, :recipient_ids)\n end",
"title": ""
},
{
"docid": "1141f4fe5d503a52fffe7ad4bf66f654",
"score": "0.487754",
"text": "def send_messages(options)\n data = @api.do_request(\"POST\", get_base_api_path() + \"/messages/send_batch\", options)\n return data\n end",
"title": ""
},
{
"docid": "1141f4fe5d503a52fffe7ad4bf66f654",
"score": "0.487754",
"text": "def send_messages(options)\n data = @api.do_request(\"POST\", get_base_api_path() + \"/messages/send_batch\", options)\n return data\n end",
"title": ""
},
{
"docid": "925823fdcb3f7ac00e1a8b6c36e5ea07",
"score": "0.4877188",
"text": "def message_params\n params.require(:message).permit(:subject, :body, :user_id, :recipient_id)\n end",
"title": ""
},
{
"docid": "88f9a4477deb1a5af888c0e368172857",
"score": "0.48760962",
"text": "def render\n _form onSubmit: self.sendMessage do\n _input.chatMessage! value: @message\n end\n end",
"title": ""
},
{
"docid": "a87a3738507936c7cc586f8522da3430",
"score": "0.48734337",
"text": "def process_incoming_message\r\n\t response = \"\"\r\n\t sid = (params[:screen] || \"1\").to_i\r\n screen = Screen.find_or_create_by_id(sid)\r\n\t phone_num = params[:phone_number]\r\n\t body = params[:body]\r\n\t \r\n\t if phone_num && body\r\n \t displayed = true\r\n \t user = User.find_or_initialize_by_phone_num(:phone_num => phone_num, :on_list => false)\r\n\r\n if user.new_record? || user.update_expired_seq_num\r\n # New record or new session\r\n user.save!\r\n displayed = false\r\n response = MSG_WELCOME.gsub('[ID]', user.seq_num.to_s)\r\n \r\n # This is an unusual case, but we cover it as it may appear in debugging / demoing.\r\n # Usually the first thing we see from new phones is the Keyword.\r\n response = \"\" if ALL_COMMANDS.include?(body.downcase.strip)\r\n else\r\n case body.downcase\r\n when CMD_SUBSCRIBE\r\n user.update_attribute(:on_list, true)\r\n displayed = false\r\n response = MSG_SUBSCRIBE\r\n when CMD_HELP\r\n displayed = false\r\n response = MSG_HELP if user.on_list\r\n when CMD_UNSUBSCRIBE\r\n displayed = false\r\n if user.on_list\r\n user.update_attribute(:on_list, false)\r\n response = MSG_UNSUBSCRIBE\r\n end\r\n else\r\n # Normal message\r\n if Message::personal?(body)\r\n recipient = Message::recipient(body)\r\n if recipient.nil?\r\n displayed = false\r\n else\r\n body = Message::textual_body(body)\r\n send_message(recipient.phone_num, \"#{user.seq_num}: #{body}\", screen)\r\n end\r\n end\r\n end\r\n end\r\n\r\n \t message = Message.create(:body => body, :user => user, :displayed => displayed, :screen => screen, :recipient => recipient)\r\n\r\n \t logger.error(\"Saving of the message errored: #{message.errors.inspect}\") if message.new_record?\r\n\t end\r\n\t \r\n\t render :text => set_storename(response, screen.name)\r\n end",
"title": ""
},
{
"docid": "9ef42d5ba5fc3469ab7bd0c579703d85",
"score": "0.4873359",
"text": "def send_text_message params\n params.map { |key, value| params[key] = value.to_json.to_s if value.class.to_s == Hash.name }\n params.merge!(\n {Action: 'SendSms',\n Version: '2017-05-25',\n RegionId: 'cn-hangzhou'})\n JSON.parse request params\n\n end",
"title": ""
},
{
"docid": "b08ebe69bf406312a71ee581efa62cd0",
"score": "0.48652107",
"text": "def submit_request(request_message)\n request_message.reply_to_address = @reply_address\n request_message.generate_user_id unless request_message.user_id\n @producer.send(request_message)\n request_message.user_id\n end",
"title": ""
},
{
"docid": "5646ee64a3ba08245a879419ca5376e9",
"score": "0.48610982",
"text": "def perform\n # Instantiate a Twilio client\n client = Twilio::REST::Client.new(ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'])\n\n Rails.logger.info \"[TwilioSender#perform] Send #{messages} to #{phone_numbers}\"\n if phone_numbers.present?\n\n phone_numbers.uniq!\n Rails.logger.info \"[TwilioSender#perform] Send #{messages} to unique numbers - #{phone_numbers}\"\n phone_numbers.reject! { |e| e.to_s.blank? }\n Rails.logger.info \"[TwilioSender#perform] Send #{messages} to real numbers - #{phone_numbers}\"\n else\n Rails.logger.warn \"[TwilioSender#perform] phone_numbers is nil - #{phone_numbers}\"\n end\n phone_numbers.each do |phone_number|\n phone_number = phone_number.strip.gsub('+1', '').delete('-')\n messages.each do |message|\n if message.present?\n begin\n message = message.strip\n\n @outgoing = TwilioMessage.new\n @outgoing.to = phone_number.gsub('+1', '').delete('-')\n @outgoing.body = message\n @outgoing.from = ENV['TWILIO_SURVEY_NUMBER'].gsub('+1', '').delete('-')\n @outgoing.wufoo_formid = smsCampaign\n @outgoing.direction = 'outgoing-survey'\n @outgoing.save\n\n phone_number = '+1' + phone_number.strip.gsub('+1', '').delete('-')\n\n # Create and send an SMS message\n @message = client.account.messages.create(\n from: ENV['TWILIO_SURVEY_NUMBER'],\n to: phone_number,\n body: message\n )\n @outgoing.message_sid = @message.sid\n @outgoing.save\n Rails.logger.info(\"[Twilio][SendTwilioMessagesJob] #{phone_number}\")\n rescue Twilio::REST::RequestError => e\n @outgoing.error_message = e.message\n @outgoing.save\n Rails.logger.warn(\"[Twilio][SendTwilioMessagesJob] had a problem. Full error: #{@outgoing.error_message}\")\n end\n end\n sleep(1) # for twilio rate limiting, I presume.\n end\n end\n end",
"title": ""
},
{
"docid": "b814a47db0198d6b0d2114d77409e611",
"score": "0.48598576",
"text": "def handle_inbound_sms(to, from)\n body = MessageRequest.new\n body.application_id = MESSAGING_APPLICATION_ID\n body.to = [from]\n body.from = to\n body.text = \"The current date-time is: \" + Time.now.to_f.to_s + \" milliseconds since the epoch\"\n begin\n $messaging_client.create_message(MESSAGING_ACCOUNT_ID, body: body)\n rescue Exception => e\n puts e\n end\nend",
"title": ""
},
{
"docid": "dc1e003aa650fe0886a62818e1781c03",
"score": "0.4853699",
"text": "def user_message_params\n params.fetch(:user_message, {})\n end",
"title": ""
},
{
"docid": "1e8df60d463ad78c170c381f48d3487d",
"score": "0.48481438",
"text": "def emailconform\n userid = 157#params[:userid]\n text = params[:text]\n @msg = Array.new\n if !userid.nil?\n #u = User.find_by_id(userid)\n Email.user_conform(userid).deliver\n@msg[0]={\"message\"=>\"Please check the email for conformation!!\"}\n else\n @msg[0]={\"message\"=>\"please provide values..\"}\n end # for if\n render :json => @msg\n end",
"title": ""
},
{
"docid": "eef2564fb6c815eff56fb92f0e5b9887",
"score": "0.48427856",
"text": "def receive(params)\n # first authenticate the request so that not just anybody can send messages to our API\n # unless params[\"username\"] == configatron.isms_incoming_username && params[\"password\"] == configatron.isms_incoming_password\n # raise Sms::Error.new(\"Authentication error receiving from #{service_name}\")\n # end\n\n smses = []\n\n # now parse the xml\n begin\n doc = XML::Parser.string(params[\"XMLDATA\"]).parse\n\n # loop over each MessageNotification node\n messages = doc.root.find(\"./MessageNotification\")\n\n # get the info for each message\n messages.each do |message|\n from = message.find_first(\"SenderNumber\").content\n body = message.find_first(\"Message\").content\n date = message.find_first(\"Date\").content\n time = message.find_first(\"Time\").content\n\n # throw out pesky TIMESETTINGS_LOOP_BACK_MSGs\n next if body =~ /TIMESETTINGS_LOOP_BACK_MSG/i\n\n # isms should be in UTC. date format is YY/MM/DD. we add 20 to be safe. time is HH:MM:SS.\n sent_at = Time.zone.parse(\"20#{date} #{time} UTC\")\n\n smses << Sms::Message.create(:from => from, :body => body, :sent_at => sent_at, :adapter_name => service_name)\n end\n\n rescue XML::Parser::ParseError\n raise Sms::Error.new(\"Error parsing xml from #{service_name}\")\n end\n\n return smses\n end",
"title": ""
},
{
"docid": "12279d7ec5d4b700d2ae9c3da50facc3",
"score": "0.48352185",
"text": "def message_params(*keys)\n \tfetch_params(:message, *keys)\n \tend",
"title": ""
},
{
"docid": "cc8674fe9b270207bb451cb4d14630bd",
"score": "0.48351428",
"text": "def process_sqs_message(vault, message)\n puts \"Process SQS Message: #{message.body}\"\n jobid = job_id_from_sqs_message(message)\n unless jobid.nil?\n puts \"Restore job_id: #{jobid}\"\n restore_target = Time.now.strftime(\"%Y%m%d%H%M.restore\")\n restore_archive_from_jobid(vault, jobid, restore_target)\n end\nend",
"title": ""
},
{
"docid": "e1bc8fc3b25e83df98fbb9e6fed609e6",
"score": "0.48335722",
"text": "def send_sms_all\n user_phones = User.where(:subscribed => true).pluck(:phone)\n message = params[:message]\n account_sid = ENV[\"TWILIO_ACCOUNT_SID\"] \n auth_token = ENV[\"TWILIO_AUTH_TOKEN\"]\n\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n user_phones.each do |number|\n @client.account.messages.create ({:to => \"+1\"+\"#{number}\",\n :from => \"+19143686886\",\n :body => \"#{message}\"})\n end\n redirect_to '/admin/dashboard', :flash => { :success => \"Your message sent!\" }\n\n rescue Twilio::REST::RequestError => e\n puts e.message\n end",
"title": ""
},
{
"docid": "1a38cb10342af9d3adaddb5349cfd0ac",
"score": "0.4833124",
"text": "def sms_params\n\n end",
"title": ""
},
{
"docid": "9245cbae8e9aa4432e4ce1dfa1373de0",
"score": "0.48325458",
"text": "def get_driver_messages\n method = \"getDriverMessages\"\n hash = post_request(method)\n \n end",
"title": ""
},
{
"docid": "1eba836db887ebf3ae8ce28fca338a5d",
"score": "0.4830122",
"text": "def message_params\n params.permit(:identity, :inner_envelope, :sig_recipient,:timestamp, :sig_message, :message_id)\n end",
"title": ""
},
{
"docid": "25c0740315334ee942c8a0cb0defeb66",
"score": "0.48288026",
"text": "def validate_patient_state_and_queue(message, message_type)\n AppLogger.log(self.class.name, \"Validating messesage of type [#{message_type}]\")\n # job = JobBuilder.new(message_type.to_s.gsub(\"Message\", \"Job\")).job\n message_type = {message_type => message}\n result = StateMachine.validate(message_type, request.uuid, token)\n\n raise Errors::RequestForbidden, \"Incoming message failed patient state validation: #{result}\" if result != 'true'\n\n queue_name = Rails.configuration.environment.fetch('queue_name')\n logger.debug \"Patient API publishing to queue: #{queue_name}...\"\n Aws::Sqs::Publisher.publish(message, request.uuid, queue_name)\n # job.perform_later(message)\n end",
"title": ""
},
{
"docid": "69cc582fcf73a704c4217b11e992dcb0",
"score": "0.48279214",
"text": "def delete\n\t\t@user = logged_in_user\n\t\tif (params[:ids])\n\t\t\tparams[:ids].each do |id|\n\t\t\t\t@message = Message.find(id).get_first_message\n\t\t\t\t@usermessages = UserMessage.find(:all, :conditions=>[\"message_id=? and user_id=?\",@message.id, @user.id])\n\t\t\t\t@usermessages.each {|um| um.destroy}\n\t\t\tend\n\t\t\tflash[:notice] = 'Messages Deleted'\n\t\telse\n\t\t\tflash[:notice] = 'Please first select the message/s you want to delete.'\n\t\tend\n\t\tredirect_to(messages_url)\n\tend",
"title": ""
},
{
"docid": "a2b5be6197f53d3bf1531f34482220ae",
"score": "0.48216036",
"text": "def message_params(msg)\n {\n message: {\n body: msg.body,\n user_id: msg.user_id,\n targetable_id: msg.targetable_id,\n targetable_type: msg.targetable_type\n }\n }\n end",
"title": ""
},
{
"docid": "b4478a692ff3324d215f0cba0a27a9ec",
"score": "0.48205388",
"text": "def delete\n\t\tresponse = {:success => true}\n\n\t\tif params[:message_ids].nil?\n\t\t\tresponse[:success] = false\n\t\telse\n\t\t\tresponse[:success] = Message.update_all(\"sender_deleted = 1\", [\"user_id = ? AND id IN (?)\", current_user.id, params[:message_ids]])\n\t\t\tresponse[:success] = true && Message.update_all(\"recipient_deleted = 1\", [\"recipient_id = ? AND id IN (?)\", current_user.id, params[:message_ids]])\n\t\tend\n\n\t\trespond_to do |wants|\n\t\t\twants.js {\n\t\t\t\trender :json => response\n\t\t\t\treturn\n\t\t\t}\n\t\t\twants.html {\n\t\t\t\treturn\n\t\t\t}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "088411cccad893ec2644c54e4a8908c4",
"score": "0.48194522",
"text": "def send_message(json_msg)\n res = post(\"message/custom/send\",{},json_msg.to_s)\n return MultiJson.load(res.body)\n end",
"title": ""
},
{
"docid": "d892726615434eed84bd5abcb929476b",
"score": "0.48183364",
"text": "def get_save_in_progress\n sip_model\n .select(:form_id)\n .where('form_id LIKE ?', \"%#{HEALTH_CARE_FORM_PREFIX}%\")\n .where(user_uuid: user.uuid)\n .to_a\n end",
"title": ""
},
{
"docid": "cb4846235831642571ac64ee0f0f51da",
"score": "0.48157606",
"text": "def send_msg\n if request.post?\n #TODO: check that sender_id is the same as the current user_id\n @message = Message.factory!(params[:type], params[:message])\n if (@message.sender != @user)\n render_error(\"You can only send messages on behalf of yourself.\")\n else\n @receiver_ids = ActiveSupport::JSON.decode(params[:receivers])\n @receiver_ids.each do |r|\n p = Person.find(r)\n if p\n @message.people << p\n end\n end\n @message.save\n render :text => \"yays!\", :status => :created\n end\n else\n render_error(\"Request type not supported. Expected POST.\", nil) \n end\n end",
"title": ""
},
{
"docid": "d10d6722dded89b63de5f923df1bdc5b",
"score": "0.481233",
"text": "def process_message(message)\n end",
"title": ""
},
{
"docid": "61e1158926ed2a2ec92d98456e6243ff",
"score": "0.4809851",
"text": "def message_params\n params.require(:body)\n end",
"title": ""
},
{
"docid": "a95e0740dfd811e937beac18f9993198",
"score": "0.48092192",
"text": "def index\n #\n # A big hack - but we have to make sure that there is a job that will process mails\n #\n if Delayed::Job.all.where( 'handler like \"%Trawl%\"').count < 1\n TrawlMailAccountsJob.new.perform\n end\n if Delayed::Job.all.where( 'handler like \"%Watch%\"').count < 1\n WatchJobbersJob.new.perform\n end\n #\n messages = Message.arel_table\n jobbers = Jobber.arel_table\n jobber_exp = messages.join(jobbers).on(messages[:msg_from].eq(jobbers[:email]).or(messages[:msg_to].eq(jobbers[:email])))\n unless params[:q].blank?\n query_string = \"%#{params[:q]}%\"\n @messages = Message.joins(jobber_exp.join_sources).where(messages[:title].matches(query_string).or(messages[:msg_from].matches(query_string)).or(messages[:msg_to].matches(query_string)).or(messages[:body].matches(query_string)).or(jobbers[:name].matches(query_string))).uniq.order(created_at: :desc)\n else\n @messages = params[:all]=='true' ? Message.answered.joins(jobber_exp.join_sources).uniq.order( created_at: :desc) : Message.unseen.joins(jobber_exp.join_sources).uniq.order( created_at: :desc)\n end\n\n\n\n\n authorize Message\n end",
"title": ""
},
{
"docid": "d5febca1a482ab3c80bf58e48660a4ec",
"score": "0.47969207",
"text": "def received_request_message_params\n params.fetch(:received_request_message, {})\n end",
"title": ""
}
] |
fda847f74d3a2fdd8fa5b5aee5b4d3ef
|
if there are an filter defined for given column, create and return a filter instance built upon given HTTP params.
|
[
{
"docid": "72b588c3d524e5388d7c3620f0b5dba4",
"score": "0.6879714",
"text": "def filter? column, params\n return unless params\n return unless filter = @filters[column]\n instance = FilterInstance.new filter, params\n instance.val\n end",
"title": ""
}
] |
[
{
"docid": "039b5df4291e7304138830ad068502b2",
"score": "0.6287593",
"text": "def add_filter col, val, opts={}\n col = self.class.sql_sub(col)\n val = self.class.sql_sub(val)\n if col.to_s.empty? || val.to_s.empty?\n raise LimeExt::Errors::LimeDataFiltersError, 'Error adding filter'\n end\n @dataset_stale = true\n filters.push(opts.merge({:col=>col, :val=>val})).uniq!\n filter_names.push(opts[:name]||val)\n return self\n end",
"title": ""
},
{
"docid": "51be9450866bdae51c2972b195363f14",
"score": "0.62809664",
"text": "def add_filter_params column, value\n value = value.to_s\n unless column.is_a? Array\n column = [column]\n end\n\n column = column.map &:to_s\n column.prepend 'filter'\n has_filter = column.inject(index_params) { |memo, v|\n memo && memo[v]\n } == value\n\n deleted_params = index_params.deep_dup\n column.inject(deleted_params) { |memo, v|\n if memo.nil?\n nil\n elsif column.last == v\n memo.delete v\n else\n memo[v]\n end\n }\n with_params = index_params.deep_dup\n column.inject(with_params) { |memo, v|\n if memo.nil?\n nil\n elsif column.last == v\n memo[v] = value\n else\n memo[v] ||= {}\n memo[v]\n end\n }\n\n [has_filter, deleted_params, with_params]\n end",
"title": ""
},
{
"docid": "589f46ac86693f76b4855686ed5ef036",
"score": "0.6243937",
"text": "def build_filter(action, filter_num, column, value)\n if action == :add\n if not session[:num_filters].nil?\n session[:num_filters] += 1\n session[:filter_index] += 1\n else\n session[:num_filters] = 1\n session[:filter_index] = 1\n end\n filter_num = session[:filter_index]\n end\n \n if action == :delete\n operand = sql_value = nil\n session[:num_filters] -= 1 unless session[:num_filters].nil? \n else \n operand, sql_value = get_operand_and_value(column, value)\n end\n \n store_filter(filter_num, column, sql_value, operand)\n conditions = rebuild_filter_conditions\n end",
"title": ""
},
{
"docid": "2ffe964914371cb5a8d54cc1e4c80a4f",
"score": "0.6215007",
"text": "def filter_instance column_name\n column_name = column_name.to_sym\n return @custom_filter_options[column_name] if @custom_filter_options && @custom_filter_options.has_key?( column_name )\n\n klass = case type = filter_type( column_name )\n when :belongs_to: AutoAdmin::AssociationFilterSet\n when :has_one: AutoAdmin::AssociationFilterSet\n when :has_many: AutoAdmin::MultiAssociationFilterSet\n when :has_and_belongs_to_many: AutoAdmin::MultiAssociationFilterSet\n when :datetime: AutoAdmin::DateFilterSet\n else\n const = type.to_s.camelcase + 'FilterSet'\n if AutoAdmin.const_defined?( const )\n AutoAdmin.const_get( const )\n else\n AutoAdmin::EmptyFilterSet\n end\n end\n\n klass.new( self, reflect_on_association( column_name ) || find_column( column_name ) ) {|col| find_column(col) }\n end",
"title": ""
},
{
"docid": "ca7db8f338e38e47b84423c2c3be14e2",
"score": "0.62120044",
"text": "def filter!(param_name, col_name, operator, val)\n return self unless val\n @params.merge!(param_name => val)\n add_conditions! [{\n key: col_name,\n operator: operator,\n value: \"%{#{param_name}}\"\n }]\n end",
"title": ""
},
{
"docid": "4d37d3783617ec8214cbbe2d925e5728",
"score": "0.61836326",
"text": "def filter(resource, filterable_fields: [], ignore_unknown_fields: true)\n # parse the request parameter\n if params[:filter].is_a?(Hash) ||\n defined?(Rails) && Rails.version.to_i >= 5 && params[:filter].is_a?(ActionController::Parameters)\n @filter = params[:filter]\n filterable_fields = filterable_fields.map(&:to_s)\n\n # deal with each condition\n @filter.each_pair do |field, condition|\n # bypass fields that aren't be abled to filter with\n next if filterable_fields.present? && !filterable_fields.include?(field)\n\n # escape string to prevent SQL injection\n field = resource.connection.quote_string(field)\n\n next if ignore_unknown_fields && resource.columns_hash[field].blank?\n field_type = resource.columns_hash[field] && resource.columns_hash[field].type || :unknown\n\n # if a function is used\n if func = condition.match(/(?<function>[^\\(\\)]+)\\((?<param>.*)\\)/)\n\n db_column_name = begin\n raise if ActiveRecord::Base.configurations[Rails.env]['adapter'] != 'mysql2'\n \"`#{resource.table_name}`.`#{field}`\"\n rescue\n \"\\\"#{resource.table_name}\\\".\\\"#{field}\\\"\"\n end\n\n case func[:function]\n when 'not'\n values = func[:param].split(',')\n values.map!(&:to_bool) if field_type == :boolean\n resource = resource.where.not(field => values)\n\n when 'greater_than'\n resource = resource\n .where(\"#{db_column_name} > ?\",\n func[:param])\n\n when 'less_than'\n resource = resource\n .where(\"#{db_column_name} < ?\",\n func[:param])\n\n when 'greater_than_or_equal'\n resource = resource\n .where(\"#{db_column_name} >= ?\",\n func[:param])\n\n when 'less_than_or_equal'\n resource = resource\n .where(\"#{db_column_name} <= ?\",\n func[:param])\n\n when 'between'\n param = func[:param].split(',')\n resource = resource\n .where(\"#{db_column_name} BETWEEN ? AND ?\",\n param.first, param.last)\n\n when 'like'\n resource = resource\n .where(\"lower(#{db_column_name}) LIKE ?\",\n func[:param].downcase)\n\n when 'contains'\n resource = resource\n .where(\"lower(#{db_column_name}) LIKE ?\",\n \"%#{func[:param].downcase}%\")\n\n when 'null'\n resource = resource.where(field => nil)\n\n when 'blank'\n resource = resource.where(field => [nil, ''])\n end\n\n # if not function\n else\n values = condition.split(',')\n values.map!(&:to_bool) if field_type == :boolean\n resource = resource.where(field => values)\n end\n end\n end\n\n return resource\n end",
"title": ""
},
{
"docid": "776be6a22b1846cc4c364ee689cbbd90",
"score": "0.601999",
"text": "def build_from_params(params)\n if params[:fields] || params[:f]\n self.filters = {}\n add_filters(params[:fields] || params[:f], params[:operators] || params[:op], params[:values] || params[:v])\n else\n available_filters.keys.each do |field|\n add_short_filter(field, params[field]) if params[field]\n end\n end\n self\n end",
"title": ""
},
{
"docid": "5399f49bade8ffe7d7fb5572164601eb",
"score": "0.60000575",
"text": "def make_new_params(params, filters, columns)\n h = {\n :filters => filters.join(','),\n :columns => columns.join(','),\n }\n filters.each do |code|\n row = FILTERS.select { |f| f[:code] == code }.first\n row[:codes].each { |p| h[p] = params[p] }\n end\n h.delete_if { |k, v| v.blank? }\n end",
"title": ""
},
{
"docid": "0421bdde80d6d19d9237f0262b156fb1",
"score": "0.5961297",
"text": "def filter_build(col, condition, param)\n { range: { col => { condition => @@options[param].to_cents } } } if @@options[param].present?\n end",
"title": ""
},
{
"docid": "f3644d5835341f95064dc8d3bd5eabb7",
"score": "0.5926076",
"text": "def with_param_filters(params = {}, whitelist = nil)\n return where(nil) unless params.any?\n \n # Populate whitelist\n params = params.stringify_keys.except('action', 'controller')\n tbl = self.klass.table_name\n cols = self.klass.column_names\n whitelist = self.klass.column_names unless whitelist\n \n # Go through each param and get the real\n # operator. Keep if an actual column and part\n # of the whitelist\n sql_chain = []\n sql_values = []\n params.each do |param,value|\n # Skip param if hash\n next if value.kind_of?(Hash)\n \n real_param = param.dup\n real_str_op = \"=\"\n \n # Sort to get longest string first\n WITH_PARAMS_MAPPING.keys.sort { |a,b| b.length <=> a.length }.each do |str_op|\n if real_param.gsub!(str_op,'')\n real_str_op = WITH_PARAMS_MAPPING[str_op]\n break\n end\n end\n \n if whitelist.include?(real_param) && cols.include?(real_param)\n sql_chain.push(\"#{tbl}.#{real_param} #{real_str_op} ?\")\n \n real_value = value\n # Automatically parse iso8601 dates\n if real_value =~ /\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}/\n real_value = Time.iso8601(value).utc\n end\n \n sql_values.push(real_value)\n else\n return where(\"1 = 2\")\n end\n end\n \n if sql_chain.any?\n return where(sql_chain.join(\" AND \"), *sql_values)\n else\n return where(nil)\n end\n end",
"title": ""
},
{
"docid": "534e358e5140292d5d627811f0684546",
"score": "0.59246564",
"text": "def filter(params = nil)\n Bsm::Constrainable::FilterSet.new self, params\n end",
"title": ""
},
{
"docid": "4ae2da404f8785d61c85ef2a641a4ce2",
"score": "0.59049654",
"text": "def parse_filter\n @conditions ||= []\n %w( name ).each do |column|\n param_key = ( column + \"_filter\" ).to_sym\n if params[ param_key ] && params[ param_key ].length > 0 \n field = field_of_interest( column )\n @conditions << ActiveRecord::Base.send( :sanitize_sql_array, [ \"LOWER(#{ column.pluralize }.#{ field }) LIKE ?\", '%' + params[ param_key ].clean_query_string + '%' ] ) if ( !field.nil? && params[ param_key ].clean_query_string.length > 0 )\n end\n end\n end",
"title": ""
},
{
"docid": "443c53a44544abdc3fae7f5e302ba387",
"score": "0.5872933",
"text": "def build_filters\n\n return unless configurable?\n return if @filters_opted == false\n\n types = {\n 'string' => true,\n 'text' => 'string',\n 'boolean' => true,\n 'date' => true,\n 'date_time' => true,\n 'time' => true,\n }\n selector(ORMUtils.properties(model), @filters_opted, @filters_ignored).\n map { |n, t| types[t] == true ? [n, t] : [n, types[t]] if types[t] }.compact.\n each { |c| filter *c }\n end",
"title": ""
},
{
"docid": "7b173b50614e467f3b109cd10f985e41",
"score": "0.58531195",
"text": "def make_filter(value, columns_mapped_to)\n raise Persistence::UnsupportedOperation\n end",
"title": ""
},
{
"docid": "f03ff3487e2cb69032786125e5e6492a",
"score": "0.5821197",
"text": "def make_filter(value, columns_mapped_to=nil)\n {@column_qualified => value && value.id}\n end",
"title": ""
},
{
"docid": "4b7bfdf1b18f55563415db2c66738961",
"score": "0.5784909",
"text": "def initialize(params, model)\n key = SomaticsFilter::Query::ParamNames[:filter]\n search_key = SomaticsFilter::Query::ParamNames[:search]\n columns_key = SomaticsFilter::Query::ParamNames[:columns]\n\n @model = model \n if params[key] && params[key].is_a?(String) && (saved_query = SomaticsFilter::SavedQuery.find_by_id(params[key].to_i))\n if params[:_delete]\n saved_query.destroy\n else\n @search_params = saved_query.search_params\n @column_params = saved_query.column_params\n end\n else\n @search_params = (params[key][search_key] rescue {})\n @column_params = (params[key][columns_key] rescue [])\n if default_query = SomaticsFilter::SavedQuery.default_query_of(@model.model_name.to_s)\n @search_params = default_query.search_params if @search_params.blank?\n @column_params = default_query.column_params if @column_params.blank?\n end\n end\n \n # Always initial fragments for filter by using available filters of model\n @fragments = @model.available_filters.inject({}) {|h, filter| h[filter.field_name] = filter.to_fragment; h}\n @search_params ||= {}\n @search_params.each do |field_name, options|\n next unless @fragments[field_name]\n @fragments[field_name].is_set = options[SomaticsFilter::Query::ParamNames[:is_set]]\n @fragments[field_name].operator = options[SomaticsFilter::Query::ParamNames[:operator]]\n @fragments[field_name].value = options[SomaticsFilter::Query::ParamNames[:value]]\n @fragments[field_name].value1 = options[SomaticsFilter::Query::ParamNames[:value1]]\n @fragments[field_name].value2 = options[SomaticsFilter::Query::ParamNames[:value2]]\n end\n \n @column_params ||= []\n @available_columns = @model.available_columns - @column_params\n @selected_columns = @column_params\n \n if params[key] && !params[key][:save].blank?\n if params[key][:save][:default] && (default_query = SomaticsFilter::SavedQuery.default_query_of(@model.model_name.to_s))\n default_query.update_attributes({\n :search_params => @search_params,\n :column_params => @column_params\n })\n else\n SomaticsFilter::SavedQuery.create({\n :name => params[key][:save][:name] || 'Default',\n :default => !!params[key][:save][:default],\n :query_class_name => @model.model_name.to_s,\n :search_params => @search_params,\n :column_params => @column_params\n })\n end\n end\n end",
"title": ""
},
{
"docid": "da5f2b530a48f82e5581d16e14fd6603",
"score": "0.5781993",
"text": "def build_filter (workitem)\n\n filter = FilterDefinition.new\n\n # filter attributes\n\n type = lookup_downcase_attribute(:type, workitem)\n closed = lookup_downcase_attribute(:closed, workitem)\n\n filter.closed = (type == 'closed' or closed == 'true')\n\n add = lookup_downcase_attribute(:add, workitem)\n remove = lookup_downcase_attribute(:remove, workitem)\n\n filter.add_allowed = (add == 'true')\n filter.remove_allowed = (remove == 'true')\n\n # field by field\n\n raw_expression_children.each do |rawchild|\n\n add_field(filter, rawchild, workitem)\n end\n\n filter\n end",
"title": ""
},
{
"docid": "a4af13f9ad363ea37a925c9b2b72f42e",
"score": "0.57613426",
"text": "def get_generated_filters\n filters = []\n @columns.each do |column|\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_eql\",\n \"{{#{@table_name}.#{column.name}}} = #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_like\",\n \"{{#{@table_name}.#{column.name}}} LIKE #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_lt\",\n \"{{#{@table_name}.#{column.name}}} < #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n filters << ::Schema::Mapping::Filter.new(\"#{column.name}_gen_filter_gt\",\n \"{{#{@table_name}.#{column.name}}} > #{::Schema::Mapping::Filter::VARIABLE_REPLACE_STRING}\", self.table_name)\n end\n \n @relations.each do |relation|\n filters << ::Schema::Mapping::Filter.new(\"#{relation.name}_exists\",\n \"{{#{relation.to_table}.#{relation.to_model.get_primary_column.name}}} IS NOT NULL\")\n end\n \n return filters\n end",
"title": ""
},
{
"docid": "4d2351895b683f26695d335e8603260d",
"score": "0.57568324",
"text": "def add_filter(column, value)\n has_filter, deleted_params, with_params = add_filter_params column,value\n\n if has_filter\n link_to \"<i class='fa fa-filter'></i>\".html_safe, deleted_params\n else\n link_to \"<i class='fa fa-filter show-on-hover'></i>\".html_safe, with_params\n end\n end",
"title": ""
},
{
"docid": "da4d5d163349158b4cc47c87fccb80fd",
"score": "0.5722262",
"text": "def build_filter\n if @filter && !@filter.empty?\n filters = @filter.map { |key, value| construct_es_query_term key, value }\n if filters.length == 1\n @es_query[\"query\"] = filters.first\n else\n @es_query[\"query\"] =\n {\n bool: {\n must: filters\n }\n }\n end\n end\n self\n end",
"title": ""
},
{
"docid": "9ebcddb2212a70067e2324861c1e2d54",
"score": "0.5702281",
"text": "def get_params_from_request\n self.per_page = (params[\"per_page_#{self.name}\"] || self.per_page).to_i\n self.page = (params[\"page_#{self.name}\"] || self.page).to_i\n self.sort = params[\"sort_#{self.name}\"] ? params[\"sort_#{self.name}\"].split('_').pop.to_i : self.sort\n self.sort_direction = params[\"sort_direction_#{self.name}\"] || self.sort_direction\n\n self.columns.each_with_index do |col, col_index|\n col.filter_value = params[\"filter_#{self.name}_#{col_index}\"]\n if params[\"filter_#{self.name}_#{col_index}_from\"] or params[\"filter_#{self.name}_#{col_index}_to\"]\n col.filter_value = params[\"filter_#{self.name}_#{col_index}_from\"].to_s + DataGrid.range_separator +\n params[\"filter_#{self.name}_#{col_index}_to\"].to_s\n end\n end\n end",
"title": ""
},
{
"docid": "5bfd6d87c539af0c9284eb87d0565b1b",
"score": "0.56821716",
"text": "def filter_by *columns; @columns_for_filter = ensure_columns_are_filterable!(columns); end",
"title": ""
},
{
"docid": "ceb5be42a96257bbac69e8bca4a6b5b0",
"score": "0.56624514",
"text": "def initialize(col_id, filter_type, options = {})\n RestrictionValidator.validate 'FilterColumn.filter', FILTERS, filter_type\n # Axlsx::validate_unsigned_int(col_id)\n self.col_id = col_id\n parse_options options\n @filter = Axlsx.const_get(Axlsx.camel(filter_type)).new(options)\n yield @filter if block_given?\n end",
"title": ""
},
{
"docid": "05f57fb6ca37cb5c403867262201fd6c",
"score": "0.56545615",
"text": "def initialize(col_id, filter_type, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "438e266c1474390a6daeb47373cd7e77",
"score": "0.56481844",
"text": "def default_filter filter, request\n\t@db = filter(filter) unless !find_filters(request).empty?\nend",
"title": ""
},
{
"docid": "c5c3e8264b8eeb8500ea718e642100d6",
"score": "0.5637239",
"text": "def create_filter\n build_filter.save if filter.nil?\n end",
"title": ""
},
{
"docid": "d6c46ba542634a5e896d4d01f8270e32",
"score": "0.558992",
"text": "def build_turbo_filter_query_from_params(session_name)\n if params[:f]\n filters = if session[session_name]\n session[session_name][:filters] = session[session_name][:filters].select { |k,v| params[:f].reject(&:blank?).include?(k) }\n else\n {}\n end\n @turbo_filter_query.filters = filters\n @turbo_filter_query.add_filters(params[:f], params[:operators] || params[:op], params[:values] || params[:v])\n end\n end",
"title": ""
},
{
"docid": "b99726d75b4d47bf008d7c1f6888a4c7",
"score": "0.5556429",
"text": "def apply_dynamic_filter()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Tables::Item::Columns::Item::Filter::ApplyDynamicFilter::ApplyDynamicFilterRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"title": ""
},
{
"docid": "289b3b0734682c7848fe439bb4e43d0b",
"score": "0.55498993",
"text": "def filters\n columns_for_filter.map { |col| filter_instance( col ) }\n end",
"title": ""
},
{
"docid": "d089053e33d5a08490c067bebe585b63",
"score": "0.55370665",
"text": "def make_filter(_value, _columns_mapped_to)\n fail Hold::UnsupportedOperation\n end",
"title": ""
},
{
"docid": "bb4bb6afaf34fe70be2026cee8b612b8",
"score": "0.5524467",
"text": "def create_filter(user, filter)\n make_request(:post, \"/user/#{user}/filter\", content: filter)['filter_id']\n end",
"title": ""
},
{
"docid": "146417967f05b29fb32918b69afc19af",
"score": "0.5512604",
"text": "def add_filter_params\n params[:filter] = {} if params[:filter] == nil\n return {'filter[working_field]' => h(params[:filter][:working_field]),'filter[region]' => h(params[:filter][:region]), 'filter[job_level]' => h(params[:filter][:job_level])}\n end",
"title": ""
},
{
"docid": "f1778f09b01f6ba20769cbfe2f6dabaa",
"score": "0.5500584",
"text": "def create\n @filter = Filter.new(filter_params)\n # If the user is not logged in, save this filter to a session and send them to get authenticated\n save_record @filter\n end",
"title": ""
},
{
"docid": "bc345fdbc7e8a957b7f5b4dd97321ffe",
"score": "0.5495991",
"text": "def where conditions\n spawn.tap do |proxy|\n proxy.current_params[:filters] ||= {}\n proxy.current_params[:filters].merge! conditions\n end\n end",
"title": ""
},
{
"docid": "37de53bb0594b8887be90526ce59824c",
"score": "0.5493776",
"text": "def add(filter_type, filter_name, columns, options = {}, defaults = {})\n filter_class = (\"ListFilters::#{filter_type.to_s.camelize}Filter\").constantize\n filter = filter_class.new(filter_name, columns, options, defaults)\n @set << filter # unless @set.any? {|f| f.filter == filter.filter}\n end",
"title": ""
},
{
"docid": "671ce4e3a53d899656fa3f8b4f2fbfc7",
"score": "0.5492159",
"text": "def filter name, operator, value\n Filter.new name, operator, value\n end",
"title": ""
},
{
"docid": "75b77b3fcec973ee1572cc14df1060e4",
"score": "0.5483823",
"text": "def filter_cql_from_params\n filter_cql_class.new(filter_keys_with_values, blocked_id_cql).to_cql\n end",
"title": ""
},
{
"docid": "25d2b7031be2f647a1bd25464c5cde60",
"score": "0.5479139",
"text": "def create_filter(user_id, filter_params, **params)\n query = {}\n query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)\n\n user_id = ERB::Util.url_encode user_id.to_s\n\n request(:post, client_api_latest, \"/user/#{user_id}/filter\", body: filter_params, query: query)\n end",
"title": ""
},
{
"docid": "98b5b61576953ef046e10f7480c698d9",
"score": "0.547857",
"text": "def filter(opts = {})\n build(db.filter(opts))\n end",
"title": ""
},
{
"docid": "1ab1603a459e282d6f3014291d73ed49",
"score": "0.54650176",
"text": "def filter &block\n if block_given?\n @filter = Filter.new self\n @filter.instance_eval(&block) if block\n end\n return @filter\n end",
"title": ""
},
{
"docid": "709bdfc88c7ca36f37a30f1befbc6fb6",
"score": "0.5456929",
"text": "def filter\n filters_available.each do |filter|\n send(\"filter_by_#{filter}\", @params[filter]) if @params[filter].present?\n end\n filter_price\n merge\n end",
"title": ""
},
{
"docid": "9b106470fffbd9c432bff449e72d15de",
"score": "0.5447343",
"text": "def filters row = nil\n @filters.inject({}) do |filters, filter|\n static_filters, proc = filter\n filters.merge(static_filters) if static_filters.is_a?(Hash)\n if (filter = proc.call(row) rescue nil).is_a?(Hash)\n filters.merge filter\n end\n end\n end",
"title": ""
},
{
"docid": "2053f0fcb0fd0429113710f8280793fe",
"score": "0.54441434",
"text": "def create\n filter = Filter.new({\n :service_id => params[:service_id],\n :severity => params[:severity],\n :fingerprint => params[:fingerprint],\n :scanner => params[:scanner],\n :description => params[:description],\n :detail => params[:detail],\n :file => params[:file],\n :line => params[:line],\n :code => params[:code]\n })\n\n if filter.valid?\n filter.save\n filter.filter_existing!\n render(:json => filter.to_json)\n else\n render(:json => {error: filter.errors[:base]}, :status => 409)\n end\n end",
"title": ""
},
{
"docid": "7357509bfe9a2084307e12f42a8ef973",
"score": "0.54423517",
"text": "def api_filter(params)\n # Initial preproccessing--convert symbols to keys, etc...\n params = API.preprocess params\n\n api_validate params\n \n dataset = self\n dataset = dataset.api_tags params\n dataset = dataset.api_include params\n dataset = dataset.api_serialize params\n dataset = dataset.api_sort params\n dataset = dataset.api_limit params\n dataset = dataset.api_offset params\n dataset = dataset.api_apply_filter params\n\n # Return dataset\n dataset\n end",
"title": ""
},
{
"docid": "e8b0929a919f8a3c11fb51330abea599",
"score": "0.5441183",
"text": "def create_dynamic_filter\n UniquePageViews.new_dynamic_filter(name, path)\n end",
"title": ""
},
{
"docid": "38c634975a8ede678a0533dd5ff09d65",
"score": "0.54379183",
"text": "def with_filter(filter)\n tags, path_params = filter.tags, filter.path_params\n\n scope = self\n scope = scope.distinct.joins(TAGS_JOIN).where(TAGS_WHERE, tags) unless\n tags.blank?\n scope = scope.where(PARAMS_WHERE, params_values(path_params)) unless\n path_params.blank?\n\n scope\n end",
"title": ""
},
{
"docid": "32471887b21c09882ef0688941e1a00a",
"score": "0.5415131",
"text": "def createFilters(user)\n\t\t\tuser.filters.create(filtertype: \"Basketball\")\n\t\t\tuser.filters.create(filtertype: \"Tennis\")\n\t\t\tuser.filters.create(filtertype: \"Gym\")\n\t\t\tuser.filters.create(filtertype: \"Badminton\")\n\t\t\tuser.filters.create(filtertype: \"Jogging\")\n\t\t\tuser.filters.create(filtertype: \"Others\")\n\t\t\treturn user\n\t\tend",
"title": ""
},
{
"docid": "7ca73c8c0a29aa52cca0c52f0fa7bf4a",
"score": "0.53950965",
"text": "def search(scope, filters, dynamic_column:, column_types:)\n expect! filters => [nil, Hash]\n expect! dynamic_column => ID_REGEXP\n\n filters.each_key do |key|\n expect! key => [Symbol, String]\n expect! key.to_s => ID_REGEXP\n end\n\n return scope if filters.nil? || filters.empty?\n\n # some filters try to match against existing columns, some try to match\n # against the \"tags\" JSONB column - and they result in different where\n # clauses in the Simple::SQL scope (\"value = <match>\" or \"tags->>value = <match>\").\n static_filters, dynamic_filters = filters.partition { |key, _| static_filter?(column_types, key) }\n\n scope = apply_static_filters(scope, static_filters, column_types: column_types)\n scope = apply_dynamic_filters(scope, dynamic_filters, dynamic_column: dynamic_column)\n scope\n end",
"title": ""
},
{
"docid": "7504986fdfb9e1e4d68ebeb930cd44e2",
"score": "0.5394512",
"text": "def condition filter\n raise RowFilterError, \"Filter type must be ConditionFilter\" unless filter.instance_of? ConditionFilter\n add filter\n end",
"title": ""
},
{
"docid": "c7c1ab015ddc6cf6104966b1d213a9d6",
"score": "0.53942865",
"text": "def prepare_query_params(filters, params)\n return {} unless filters\n query_params = {}\n @filters = []\n filters.each do |i, fi|\n ph = fi['placeholder'].to_sym\n type = fi['type']\n val = params.has_key?(ph) ? params[ph] : fi['default_value']\n if ph && type\n filter_obj = get_filter_object fi['type'], fi['placeholder'], val\n filter_obj.value = val\n if filter_obj.validate\n query_params[ph] = filter_obj.format val\n else\n query_params[ph] = filter_obj.get_default_value\n end\n\n filterX = fi\n filterX['control_type'] = filter_obj.control_type\n @filters << filterX\n end\n end\n query_params\n end",
"title": ""
},
{
"docid": "6d99850623c3c70d47733a8fb0d8a57f",
"score": "0.5386383",
"text": "def where name_or_filter, operator = nil, value = nil\n @grpc.filter ||= Google::Cloud::Datastore::V1::Filter.new(\n composite_filter: Google::Cloud::Datastore::V1::CompositeFilter.new(\n op: :AND\n )\n )\n if name_or_filter.is_a? Google::Cloud::Datastore::Filter\n @grpc.filter.composite_filter.filters << name_or_filter.to_grpc\n else\n @grpc.filter.composite_filter.filters << \\\n Google::Cloud::Datastore::Filter.new(name_or_filter, operator, value).to_grpc\n end\n\n self\n end",
"title": ""
},
{
"docid": "52555abbcd830ee3d3dbaf1c472318d0",
"score": "0.53862166",
"text": "def columns\n @columns ||= SimpleTypedList.new FilterColumn\n end",
"title": ""
},
{
"docid": "52555abbcd830ee3d3dbaf1c472318d0",
"score": "0.53862166",
"text": "def columns\n @columns ||= SimpleTypedList.new FilterColumn\n end",
"title": ""
},
{
"docid": "e6a4d1a812d93e6c94403c4e68e54299",
"score": "0.53831315",
"text": "def add_filter(*args)\n raise ArgumentError, \"wrong number of arguments (#{args.length} for 2..3)\" if args.length != 2 and args.length != 3\n\n field = args.shift.to_sym\n self.fields[field] = [] unless self.fields.has_key?(field)\n\n if args.length == 1\n self.fields[field] << args.first\n else\n self.fields[field] << { operator: args.first, value: args.last }\n end\n\n self\n end",
"title": ""
},
{
"docid": "3e208a71f6098dd6af05e8ec5ec9218a",
"score": "0.53679246",
"text": "def build_where(filters)\n conditions = []\n space_arel = Space.arel_table\n space_type = Space.space_types[filters[:type]]\n\n conditions << space_arel[:space_type].eq(space_type) if space_type\n conditions << space_arel[:name].matches(wildcard(filters[:name])) if filters[:name]\n conditions << space_arel[:created_at].matches(wildcard(filters[:created_at])) if filters[:created_at]\n conditions << space_arel[:updated_at].matches(wildcard(filters[:updated_at])) if filters[:updated_at]\n conditions << space_arel[:description].matches(wildcard(filters[:description])) if filters[:description]\n conditions.reduce(nil) do |where, condition|\n where ? where.and(condition) : condition\n end\n end",
"title": ""
},
{
"docid": "2af011ed45674d741f0d42ad4fd2313f",
"score": "0.5355963",
"text": "def filterable(&block)\n if @action.errors['FilterError'].nil?\n error 'FilterError', \"An error has occurred while processing filters for this action\", :attributes => {:issue_code => \"A more specific issue code\", :issue_message => \"A more specific message about the issue\"}\n end\n\n if @action.params[:filters].nil?\n param :filters, \"A hash of filters to apply to results\", :type => Hash, :default => {}\n end\n dsl = FilterableDSL.new(@action)\n dsl.instance_eval(&block)\n end",
"title": ""
},
{
"docid": "17d69f1415070930a2567a8a019d81f8",
"score": "0.5354423",
"text": "def get_filter_object(type, placeholder, value)\n fo = eval(\"ChaiIo::Filter::#{type.capitalize}\").new\n fo.value = value\n fo\n end",
"title": ""
},
{
"docid": "29f8844ea4d5a364f020fb356c1bb537",
"score": "0.5350889",
"text": "def add_column(col_id, filter_type, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "6ff3f1f2f74cb2fbf24c383cba88f5bb",
"score": "0.5345887",
"text": "def filter_param(klass)\n return nil if params['filter'].blank?\n Filter.parse(params[\"filter\"], klass)\n end",
"title": ""
},
{
"docid": "6a4cddfea9e2180573e2da43f8cc404d",
"score": "0.5345779",
"text": "def define_filtered_attr_writer(attribute, filter)\n define_method(\"#{attribute}=\") do |value|\n result =\n case filter\n when Symbol\n value.respond_to?(filter) ? value.send(filter) : value\n when Regexp\n value.respond_to?(:gsub) ? value.gsub(filter, '') : value\n when Proc\n filter.call(value)\n else # nil\n end\n\n if defined?(super)\n super(result)\n else\n # Required for non-column attributes:\n instance_variable_set(\"@#{attribute}\".to_sym, result)\n write_attribute(attribute.to_sym, result)\n end\n end\n end",
"title": ""
},
{
"docid": "dbb9ce7d14bdec54b27fb1c633867015",
"score": "0.53381217",
"text": "def append_sort_filters\n sort_keys = [ :budget, :popularity, :rent, :date_added, :current_valuation, :dream_price, :status_last_updated, :building_number, :last_sale_price, \n :status_last_updated, :price, :sale_price ]\n inst = self\n sort_key = @filtered_params[:sort_key].to_sym rescue nil\n if sort_keys.include? sort_key\n sort_order = @filtered_params[:sort_order] || \"asc\"\n inst = inst.append_field_sorting(sort_key,sort_order)\n inst = inst.append_exists_filter(sort_key)\n end\n inst\n end",
"title": ""
},
{
"docid": "dbb9ce7d14bdec54b27fb1c633867015",
"score": "0.53381217",
"text": "def append_sort_filters\n sort_keys = [ :budget, :popularity, :rent, :date_added, :current_valuation, :dream_price, :status_last_updated, :building_number, :last_sale_price, \n :status_last_updated, :price, :sale_price ]\n inst = self\n sort_key = @filtered_params[:sort_key].to_sym rescue nil\n if sort_keys.include? sort_key\n sort_order = @filtered_params[:sort_order] || \"asc\"\n inst = inst.append_field_sorting(sort_key,sort_order)\n inst = inst.append_exists_filter(sort_key)\n end\n inst\n end",
"title": ""
},
{
"docid": "2235de21cbf5de86ea8651590a23aa0e",
"score": "0.5337392",
"text": "def filter(filtering_params)\n\t\t\tresults = self.where(nil)\n\t\t\tfiltering_params.each do |key, value|\n\t\t\t\tresults = results.public_send(key, value) if value.present?\n\t\t\tend\n\t\t\tresults\n\t\tend",
"title": ""
},
{
"docid": "711c16922c27d7999b201977ba612eac",
"score": "0.53230023",
"text": "def filter(table_name, column_name, proc)\n\n # Raise an error if the filter is not being performed on the main table or one of the tables that have been joined\n unless (@table.name == table_name && @table.columns.include?(column_name)) ||\n (@joins.include?(table_name) && @joins[table_name].columns.include?(column_name))\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError.new('A join was performed on a dataset without a matching table or column.')\n end\n\n # Raise an error if the proc is not a valid proc\n unless proc.class == Proc && proc.arity == 1\n require './src/exceptions/InvalidDataSetError'\n raise InvalidDataSetError.new('The proc used to filter a dataset was not a valid Proc.')\n end\n\n # Save the filter\n @filters << {table_name: table_name, column_name: column_name, proc: proc}\n\n # Rebuild the dataset\n fetch\n end",
"title": ""
},
{
"docid": "67a147e49e36ee8d7ab4774db7c1e0f3",
"score": "0.5320851",
"text": "def add_filter(permitted = [])\n @filter = JsonApiServer::Filter.new(request, model, permitted)\n self\n end",
"title": ""
},
{
"docid": "08155451867cbe51d52ad29b789eea4a",
"score": "0.532002",
"text": "def filter(params={}, conn=:and)\n return clone(Filter.new(params, conn).filters)\n end",
"title": ""
},
{
"docid": "eecbe36b49119bcefa498ca8a2eb6d00",
"score": "0.5311536",
"text": "def build_filter_conditions\n return nil\n end",
"title": ""
},
{
"docid": "0701a59caf158273ee70c120b32350b5",
"score": "0.5310826",
"text": "def add_filter(filter_argument = nil, &filter_proc)\n filters << parse_filter(filter_argument, &filter_proc)\n end",
"title": ""
},
{
"docid": "2c82270ba0978d49a655788e57c8905a",
"score": "0.5303699",
"text": "def filter? column\n return @val if column == @setup.column\n @setup.controller.saint.filter? column, @params\n end",
"title": ""
},
{
"docid": "5a53787f848cd6f13c93910acd27cac6",
"score": "0.5299378",
"text": "def query_filters=(_arg0); end",
"title": ""
},
{
"docid": "7f1083b80eccd4449d0c8d9123a91cef",
"score": "0.52906805",
"text": "def filter(filters = {})\n @query_params[:filter].merge!(filters)\n self\n end",
"title": ""
},
{
"docid": "bbf0eb01c331852fa8b71de5bd326f20",
"score": "0.5290647",
"text": "def query\n process_filter(params)\n end",
"title": ""
},
{
"docid": "db7b67589c5a255219fca805f6c51dcb",
"score": "0.5288443",
"text": "def filter_column(col, expression)\n raise \"Must call autofilter before filter_column\" unless @autofilter_area\n\n col = prepare_filter_column(col)\n\n tokens = extract_filter_tokens(expression)\n\n raise \"Incorrect number of tokens in expression '#{expression}'\" unless tokens.size == 3 || tokens.size == 7\n\n tokens = parse_filter_expression(expression, tokens)\n\n # Excel handles single or double custom filters as default filters. We need\n # to check for them and handle them accordingly.\n if tokens.size == 2 && tokens[0] == 2\n # Single equality.\n filter_column_list(col, tokens[1])\n elsif tokens.size == 5 && tokens[0] == 2 && tokens[2] == 1 && tokens[3] == 2\n # Double equality with \"or\" operator.\n filter_column_list(col, tokens[1], tokens[4])\n else\n # Non default custom filter.\n @filter_cols[col] = Array.new(tokens)\n @filter_type[col] = 0\n end\n\n @filter_on = 1\n end",
"title": ""
},
{
"docid": "3142c1c0c5c454088cb5d0d312fa0b17",
"score": "0.52869713",
"text": "def filter_on(field, existing_scope = nil)\n # If the user is providing a scope, we don't want to inadvertently use something broken\n unless existing_scope.nil? then raise unless self.respond_to?(existing_scope.to_sym) end\n\n filter_field = existing_scope || field_to_scope_name(field)\n # FIXME: There has to be a more elegant way to do this.\n # Register the field with the class var\n class_variable_set(:@@filteron, class_variable_get(:@@filteron) << filter_field)\n # Create the scope if one doesn't exist\n if (existing_scope.nil?)\n scope filter_field, ->(field_arg) { where(field.to_sym => (field_arg)) }\n end\n end",
"title": ""
},
{
"docid": "8523d8b6850d297b2bf8edd49b97361a",
"score": "0.5280422",
"text": "def add_column(col_id, filter_type, options = {})\n columns << FilterColumn.new(col_id, filter_type, options)\n columns.last\n end",
"title": ""
},
{
"docid": "8523d8b6850d297b2bf8edd49b97361a",
"score": "0.5280422",
"text": "def add_column(col_id, filter_type, options = {})\n columns << FilterColumn.new(col_id, filter_type, options)\n columns.last\n end",
"title": ""
},
{
"docid": "09962bd18d4fc699e7d54f00768e0964",
"score": "0.5279639",
"text": "def build_conditions_from_filters(supplied_filters = {})\n \t filters = supplied_filters.clone\n # Process the filters a bit\n filters.each do |key,val|\n \t # Automatically wrap '%%' around filter values where that filter is using LIKE\n if self::FILTER_MAPPINGS[key] =~ /LIKE/\n filters[key] = \"%#{filters[key]}%\"\n end\n # If an active record object is passed in as a filter value, use its id instead\n if val.kind_of? ActiveRecord::Base\n filters[key] = val.id\n end\n # Allow price search in pounds etc. rather than cents/pence\n if key == :price_from or key == :price_to\n filters[key] = val.to_f * 100\n end\n end\n sql_filters = filters.map {|key,val| self::FILTER_MAPPINGS[key]}\n [(['1=1'] + sql_filters).join(' AND '), filters] \n end",
"title": ""
},
{
"docid": "e2dcf4013393535ded58123c4102cab4",
"score": "0.52747774",
"text": "def get_filter_object(type, placeholder, value)\n ChaiIo::Filter::Base.get_instance type, placeholder, value\n end",
"title": ""
},
{
"docid": "b76c9174831b7a8906186b9266969f61",
"score": "0.5274489",
"text": "def filter_conditions\n if params[:filter]\n generate_filter_conditions\n else\n []\n end\n end",
"title": ""
},
{
"docid": "9a963b2d280e39c32f575e00e76ae2fa",
"score": "0.5268324",
"text": "def apply_custom_filter()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Tables::Item::Columns::Item::Filter::ApplyCustomFilter::ApplyCustomFilterRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"title": ""
},
{
"docid": "9e8a10ecacca26e3a681607b4b9c0c69",
"score": "0.5247823",
"text": "def default_column_filter(name, value)\n prefix = name.split('_')[0]\n model_klass = model_for_param_prefix prefix\n name = name.gsub(\"#{prefix}_\", '') unless model_klass == self.class.filtered_class\n\n return nil unless attrs = model_klass.columns_hash[name]\n return nil if value.nil?\n\n case attrs.type\n when :integer\n value.to_i\n when :decimal\n value.to_f\n when :datetime\n Chronic.parse(value.to_s)\n when :string\n value.to_s\n when :boolean\n value.to_b\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "5a7ce324b9467d1e1508f4477cb646f5",
"score": "0.52436286",
"text": "def get_filter\n end",
"title": ""
},
{
"docid": "5a7ce324b9467d1e1508f4477cb646f5",
"score": "0.52436286",
"text": "def get_filter\n end",
"title": ""
},
{
"docid": "f12eca3e669338e004b572aa0b6a7fc5",
"score": "0.5234727",
"text": "def filter_column(col, expression)\n raise \"Must call autofilter before filter_column\" unless @autofilter_area\n\n col = prepare_filter_column(col)\n\n tokens = extract_filter_tokens(expression)\n\n unless tokens.size == 3 || tokens.size == 7\n raise \"Incorrect number of tokens in expression '#{expression}'\"\n end\n\n tokens = parse_filter_expression(expression, tokens)\n\n # Excel handles single or double custom filters as default filters. We need\n # to check for them and handle them accordingly.\n if tokens.size == 2 && tokens[0] == 2\n # Single equality.\n filter_column_list(col, tokens[1])\n elsif tokens.size == 5 && tokens[0] == 2 && tokens[2] == 1 && tokens[3] == 2\n # Double equality with \"or\" operator.\n filter_column_list(col, tokens[1], tokens[4])\n else\n # Non default custom filter.\n @filter_cols[col] = Array.new(tokens)\n @filter_type[col] = 0\n end\n\n @filter_on = 1\n end",
"title": ""
},
{
"docid": "ac7ac13706d9c39052e77b10d35c06d1",
"score": "0.52321965",
"text": "def get_filter\n\n end",
"title": ""
},
{
"docid": "bab71d37cf32686bc98c1e19de6238fa",
"score": "0.5231617",
"text": "def filter_params(view_column) #:nodoc:\n column_name = view_column.attribute_name_fully_qualified_for_all_but_main_table_columns\n if @status[:f] && @status[:f][column_name]\n @status[:f][column_name]\n else\n {}\n end\n end",
"title": ""
},
{
"docid": "d1bc47c35f0d408cec65285c75d8b276",
"score": "0.522198",
"text": "def filter_params(view_column) #:nodoc:\n column_name = view_column.attribute_name_fully_qualified_for_all_but_main_table_columns\n if @status[:f] and @status[:f][column_name]\n @status[:f][column_name]\n else\n {}\n end\n end",
"title": ""
},
{
"docid": "fc97e73b139d5da3a3b099b5ec06f34e",
"score": "0.52134824",
"text": "def with(attribute, value)\n @client.filters << Riddle::Client::Filter.new(attribute.to_s, value,\n false)\n end",
"title": ""
},
{
"docid": "38321459107fbb523ab30c3cb711718a",
"score": "0.52115154",
"text": "def search(params)\n filter(params[:filter_column], params[:filter_value])\n .ordering(params[:order_column], params[:order])\n .page(params[:page])\n .per(params[:per])\n end",
"title": ""
},
{
"docid": "c40149131453bc50f0d016a0c2437dc6",
"score": "0.5207248",
"text": "def filter(name, type = :default, **options, &block)\n klass = type.is_a?(Class) ? type : FILTER_TYPES[type]\n raise ConfigurationError, \"filter class #{type.inspect} not found\" unless klass\n\n position = Datagrid::Utils.extract_position_from_options(filters_array, options)\n filter = klass.new(self, name, options, &block)\n filters_array.insert(position, filter)\n\n datagrid_attribute(name) do |value|\n filter.parse_values(value)\n end\n end",
"title": ""
},
{
"docid": "6e248db5c370527c8926c3ca5f0d8316",
"score": "0.5204793",
"text": "def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end",
"title": ""
},
{
"docid": "82aad704f239d88797855c7c663295f9",
"score": "0.5200061",
"text": "def where(filter)\n @wheres << filter\n end",
"title": ""
},
{
"docid": "066b43f248706bffd03124991c6b2342",
"score": "0.51979333",
"text": "def filter_params\n params[:filter]\n end",
"title": ""
},
{
"docid": "ca673d7f019c70876821559449808e72",
"score": "0.51954573",
"text": "def addFilter(filter, type)\n if filter.size > @filterLengthMaximum\n error \"Your filter exceeds the maximum length of #{@filterLengthMaximum}.\"\n end\n if @filters.where(user_id: @user.id).count > @filterCountMaximum\n error \"You have too many filters (#{filterCountMaximum}).\"\n end\n\n #check if it is a valid regular expression first\n begin\n @database[\"select 1 where '' ~* ?\", filter].all\n @filters.insert(user_id: @user.id, filter: filter, release_filter_type: type)\n rescue Sequel::DatabaseError => exception\n error \"DBMS error: #{exception.message.chop}\"\n end\n\n return\n end",
"title": ""
},
{
"docid": "cadeb46af0d75b87f804590644b9a903",
"score": "0.51943314",
"text": "def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end",
"title": ""
},
{
"docid": "dc5ef8874acda269fa665307f0d0b302",
"score": "0.5194065",
"text": "def get_filter_object(type, placeholder, value)\n ChaiIo::Filter::Base.get_instance type, placeholder, value\n end",
"title": ""
},
{
"docid": "a47e9021e3ebcab43e8e1ffb388c1c70",
"score": "0.5190096",
"text": "def filter filter_name, *values\n filters = @filters.dup\n filters << { :name => filter_name, :values => values.flatten }\n collection_with(:filters => filters)\n end",
"title": ""
},
{
"docid": "a47e9021e3ebcab43e8e1ffb388c1c70",
"score": "0.5190096",
"text": "def filter filter_name, *values\n filters = @filters.dup\n filters << { :name => filter_name, :values => values.flatten }\n collection_with(:filters => filters)\n end",
"title": ""
},
{
"docid": "cd504fed86e129fd6ed62557a2f5b798",
"score": "0.51858985",
"text": "def filter_hash\n @filter_hash ||= filter_hash_from_params || voo.filter || default_filter_hash\n end",
"title": ""
},
{
"docid": "4fac016a5899d748cd15b0ce4cc141fe",
"score": "0.5184416",
"text": "def filter_by(*args, &filter)\n\t\t\t\tfilter = Filters[args.shift] unless filter\n\t\t\t\traise ArgumentError, \"Unknown Filter #{name} and no block given\" unless filter\n\t\t\t\t@filters << [filter, args]\n\t\t\tend",
"title": ""
}
] |
da218f827daf39db7362e4ec1f799172
|
Show all manager invoices to manager. Show relevant invoices to interpreters and customers.
|
[
{
"docid": "080abfc8c2ad694491e0e38ea2c35e35",
"score": "0.70439297",
"text": "def index\n if current_user && !current_user.manager?\n @manager_invoices = current_user.manager_invoices.paginate(page: params[:page]).order(start_date: :desc)\n elsif (user_logged_in? && current_user.manager?)\n # Manager Search\n if params[:search]\n manager_search\n else\n @manager_invoices = ManagerInvoice.paginate(page: params[:page]).order(start_date: :desc)\n end\n elsif customer_logged_in?\n @manager_invoices = []\n @customer_jobs = current_customer.jobs\n @customer_jobs.each do |customer_job|\n customer_job.manager_invoices.each do |manager_invoice|\n @manager_invoices.push manager_invoice\n end\n end\n # @manager_invoices = @manager_invoices.paginate(page: params[:page]).order(start_date: :desc)\n end\n end",
"title": ""
}
] |
[
{
"docid": "48f148bf09e2fb5cd15c1cec04fb8ea9",
"score": "0.7202437",
"text": "def show\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "fb801de0a7f51cbce17c8b43c8420ae9",
"score": "0.66611606",
"text": "def show\n @invoices = Invoice.all\n @invoice = Invoice.new\n\n @matters = @client.matters\n @matter = Matter.new\n\n @payment = Payment.all\n @payment = Payment.new\n\n @prestations = Prestation.all\n @prestation = Prestation.new\n end",
"title": ""
},
{
"docid": "87d6cfdbed55f9ddac60d6ec948397a7",
"score": "0.66473144",
"text": "def list_invoices\n opts = { customer_id: current_customer.id }\n\n list(Invoice, opts)\n end",
"title": ""
},
{
"docid": "3dc2efc7d25deb586ec3225ddfbe3c84",
"score": "0.6554309",
"text": "def invoices\n @invoices = xero_client.accounting_api.get_invoices(current_user.active_tenant_id).invoices\n @invoice = xero_client.accounting_api.get_invoice(current_user.active_tenant_id, @invoices.first.invoice_id)\n end",
"title": ""
},
{
"docid": "40857f20fb2836af54b3702ef33677e0",
"score": "0.6545036",
"text": "def index\n @invoices = current_user.invoices.all\n end",
"title": ""
},
{
"docid": "e5d99520d201591b5a89952631c8a6e7",
"score": "0.64767015",
"text": "def index\n @invoices = current_user.invoices\n end",
"title": ""
},
{
"docid": "101fe8e7ceac3ed84b6c164333f9dcb8",
"score": "0.64393914",
"text": "def list_invoices\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Invoices\"\n @filters_display = \"block\"\n \n @locations = Location.find(:all, :conditions => {:company_id => @company.id}, :order => \"name ASC\")\n @divisions = Division.find(:all, :conditions => {:company_id => @company.id}, :order => \"name ASC\")\n \n if(params[:location] and params[:location] != \"\")\n @sel_location = params[:location]\n end\n \n if(params[:division] and params[:division] != \"\")\n @sel_division = params[:division]\n end\n \n if(@company.can_view(getUser()))\n if(params[:ac_customer] and params[:ac_customer] != \"\")\n @customer = Customer.find(:first, :conditions => {:company_id => @company.id, :name => params[:ac_customer].strip})\n \n if @customer\n @invoices = Invoice.paginate(:page => params[:page], :conditions => {:company_id => @company.id, :customer_id => @customer.id}, :order => \"id DESC\")\n else\n flash[:error] = \"We couldn't find any invoices for that customer.\"\n redirect_to \"/companies/invoices/#{@company.id}\"\n end\n elsif(params[:customer] and params[:customer] != \"\")\n @customer = Customer.find(params[:customer])\n \n if @customer\n @invoices = Invoice.paginate(:page => params[:page], :conditions => {:company_id => @company.id, :customer_id => @customer.id}, :order => \"id DESC\")\n else\n flash[:error] = \"We couldn't find any invoices for that customer.\"\n redirect_to \"/companies/invoices/#{@company.id}\"\n end\n elsif(params[:location] and params[:location] != \"\" and params[:division] and params[:division] != \"\")\n @invoices = Invoice.paginate(:page => params[:page], :conditions => {:company_id => @company.id, :location_id => params[:location], :division_id => params[:division]}, :order => \"id DESC\")\n elsif(params[:location] and params[:location] != \"\")\n @invoices = Invoice.paginate(:page => params[:page], :conditions => {:company_id => @company.id, :location_id => params[:location]}, :order => \"id DESC\")\n elsif(params[:division] and params[:division] != \"\")\n @invoices = Invoice.paginate(:page => params[:page], :conditions => {:company_id => @company.id, :division_id => params[:division]}, :order => \"id DESC\")\n else\n if(params[:q] and params[:q] != \"\")\n fields = [\"description\", \"comments\", \"code\"]\n\n q = params[:q].strip\n @q_org = q\n\n query = str_sql_search(q, fields)\n\n @invoices = Invoice.paginate(:page => params[:page], :order => 'id DESC', :conditions => [\"company_id = ? AND (#{query})\", @company.id])\n else\n @invoices = Invoice.paginate(:page => params[:page], :conditions => {:company_id => @company.id}, :order => \"id DESC\")\n @filters_display = \"none\"\n end\n end\n else\n errPerms()\n end\n end",
"title": ""
},
{
"docid": "75218097aae349e82a025ed51447bf1e",
"score": "0.64301455",
"text": "def invoices\n @meta_title = I18n.t 'meta_title.m_invoices'\n @user = User.find(session[:user_id])\n end",
"title": ""
},
{
"docid": "b380c137dbf7d86aba52b9b685271593",
"score": "0.6376059",
"text": "def show\n @line_item = LineItem.new\n invoice = Invoice.find(params[:id])\n @lineitems_invoices = invoice.line_items\n end",
"title": ""
},
{
"docid": "32199e2d722d7227b42c5f754c4ad9be",
"score": "0.6375507",
"text": "def index\n\t@invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "4a0fb9f0b0c73d5fa7332b4f13815f8c",
"score": "0.63752466",
"text": "def show\n @invoice = Invoice.find(params[:id])\n if @user_options.admin_account_group?\n @invoice = nil unless @user_options.account_group.invoices.include?(@invoice)\n else\n @invoice = nil unless @current_user.invoices.include?(@invoice)\n end\n\t\tif @invoice.nil?\n\t\t\tredirect_to invoices_url\n\t\t\treturn\n\t\tend\n\t\t@account = @invoice.client.account\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n\t\t\tformat.pdf { prawnto :inline => true }\n end\n end",
"title": ""
},
{
"docid": "8c6240c0accac38f1b16ee112757cb25",
"score": "0.63720125",
"text": "def invoices\n @invoices ||= Jortt::Client::Invoices.new(self)\n end",
"title": ""
},
{
"docid": "8c6240c0accac38f1b16ee112757cb25",
"score": "0.63720125",
"text": "def invoices\n @invoices ||= Jortt::Client::Invoices.new(self)\n end",
"title": ""
},
{
"docid": "f51eb7c9bd987231522769e8a8042348",
"score": "0.63407093",
"text": "def invoices\r\n InvoicesController.instance\r\n end",
"title": ""
},
{
"docid": "3383366bbd63f998cbf5710d162f8035",
"score": "0.6334953",
"text": "def show\n \t@user = User.find(@invoice.user_id)\n\t@client = Client.find_by_id(@invoice.client_id)\n\t@currency = Currency.find_by_id(@invoice.currency_id)\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "42c929eff694eab1cbda263d6e081d56",
"score": "0.6334875",
"text": "def index\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "df3b3c0b996c826cd159ee1aa5ec1cfd",
"score": "0.6328931",
"text": "def index\n @invoices = Invoice.all.decorate\n\n respond_to do |format|\n format.html\n end\n end",
"title": ""
},
{
"docid": "20f14b701deaea152b8d524a9167100b",
"score": "0.6322465",
"text": "def invoice_print\n @sales = Sale.all\n \n @previous_month = Time.now.months_since(-2).strftime(\"%B\")\n\n # pee kat tat month mhar shi khat tal customer tway\n @mycustomers = Invoice.where(:thismonth => @previous_month)\n # nit la twuin mhar shi khat tat customer tway\n @ranges = Invoice.where(created_at: (Time.now.months_since(-1))..Time.now).pluck(:customer_name)\n\n @noti_invoices = @mycustomers.where.not({ customer_name: @ranges})\n\n @customers = Customer.all\n @invoices = Invoice.where(:invoice_status => \"aok\").where(:payment_type => nil)\n end",
"title": ""
},
{
"docid": "b4c31babdaf4e43c2e27590096d2caca",
"score": "0.6315145",
"text": "def index\n @invoices = Invoice.where(user_id: current_user.id).all\n end",
"title": ""
},
{
"docid": "8a9a5243ad8ccf5bd614b8af5368d286",
"score": "0.6295447",
"text": "def index\n @detail_invoices = DetailInvoice.all\n end",
"title": ""
},
{
"docid": "26098cc43e3bec501fb2047b7e7e7009",
"score": "0.62554085",
"text": "def index\n if params[:client_id]\n @client = Client.find(params[:client_id])\n @invoices = @client.invoices.all\n else\n @invoices = Invoice.all\n end\n end",
"title": ""
},
{
"docid": "3a6ce2d114c597f418f1b057974338ab",
"score": "0.6229798",
"text": "def index\n @invoices = Invoice.all\n @customers = Customer.all\n end",
"title": ""
},
{
"docid": "56b89eb678f55bdfd4f83efc1f4f8925",
"score": "0.6197205",
"text": "def index\n @invoices = @project.invoices\n end",
"title": ""
},
{
"docid": "56b89eb678f55bdfd4f83efc1f4f8925",
"score": "0.6197205",
"text": "def index\n @invoices = @project.invoices\n end",
"title": ""
},
{
"docid": "0a2f17219a9f8f5a8ae53313752c3bfb",
"score": "0.6190429",
"text": "def index\n @invoices = Invoice.includes(:line_items)\n end",
"title": ""
},
{
"docid": "4ab6d9c0d51525e49a6abf718addf35f",
"score": "0.61894083",
"text": "def invoices\n # Get all Invoices where:\n # 1) AUTHORSED Invoices\n # 2) where amount due > 0\n # 3) modified in the last year\n get_one_opts = { \n statuses: [XeroRuby::Accounting::Invoice::AUTHORISED],\n where: { amount_due: '>0' },\n if_modified_since: (DateTime.now - 1.year).to_s,\n }\n @invoice = xero_client.accounting_api.get_invoices(current_user.active_tenant_id, get_one_opts).invoices.first\n # Get all Contacts where:\n # 1) Is a Customer\n # 2) AND also Supplier\n contact_opts = {\n where: {\n is_customer: '==true',\n is_supplier: '==true',\n }\n }\n @contacts = xero_client.accounting_api.get_contacts(current_user.active_tenant_id, contact_opts).contacts\n # Get the Invoices where:\n # 1) Invoice Contact is one of those customers/suppliers\n get_all_opts = {\n contact_ids: [@contacts.map{|c| c.contact_id}]\n }\n @invoices = xero_client.accounting_api.get_invoices(current_user.active_tenant_id, get_all_opts).invoices\n end",
"title": ""
},
{
"docid": "4113c116abb85b1dca0d929142a4fc8a",
"score": "0.61826646",
"text": "def show\n @breadcrumb = 'read'\n @invoice = Invoice.find(params[:id])\n @bill = @invoice.bill\n @items = @invoice.invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"title": ""
},
{
"docid": "968eaae5da50a66a6b8779c2baa924e2",
"score": "0.6171331",
"text": "def invoices\n @invoices ||= InvoiceProxy.new(self)\n end",
"title": ""
},
{
"docid": "968eaae5da50a66a6b8779c2baa924e2",
"score": "0.616998",
"text": "def invoices\n @invoices ||= InvoiceProxy.new(self)\n end",
"title": ""
},
{
"docid": "1791f31c4549488e40b1373a82cfa101",
"score": "0.6165166",
"text": "def index\n if @user_options.admin_account_group?\n @invoices = @user_options.account_group.invoices\n else\n @invoices = @current_user.invoices_for_account_group(@user_options.account_group)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"title": ""
},
{
"docid": "660fa27d48e9b7598dc64d0b2a2d57cb",
"score": "0.6163715",
"text": "def show\n @breadcrumb = 'read'\n @invoice = Invoice.find(params[:id])\n @bill = @invoice.bill\n @items = @invoice.invoice_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n # manually handle authorization\n authorize! :show, @invoice\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"title": ""
},
{
"docid": "2b8ad5c0fdf4d7e6f77a01204321aad7",
"score": "0.61620843",
"text": "def show\n @epsadmin_invoice = Invoice.where(:invoice_number => params[:invoice_number]).first\n @history_records = Invoice.where(:id => @epsadmin_invoice.id).first.history_tracks\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@merchant.first_name}\", epsadmin_merchant_path(@merchant.merchant_uniq_id)\n add_breadcrumb \"Invoices\", epsadmin_merchant_invoices_path\n respond_to do |format|\n format.html\n format.json { render json: @epsadmin_invoice}\n end\n end",
"title": ""
},
{
"docid": "f4f697ed471bc665612267fc7877774e",
"score": "0.6157033",
"text": "def all\n if owner.is_a?(Economic::Debtor)\n owner.get_current_invoices\n else\n response = request(:get_all)\n handles = response.values.flatten.collect { |handle| Entity::Handle.build(handle) }\n get_data_for_handles(handles)\n\n self\n end\n end",
"title": ""
},
{
"docid": "b9656bf61d32c2649ccf300cb8291778",
"score": "0.6155314",
"text": "def index\n @companies = Company.find(:all, :conditions => {:user_id => getUserId()}, :order => \"name\")\n @path = 'invoices'\n @pagetitle = \"Invoices\"\n end",
"title": ""
},
{
"docid": "5447376988db38157dd623fabee679af",
"score": "0.6137894",
"text": "def show\n @invoice = Invoice.where('id = ? and client_id in (?)', params[:id], current_user.company.clients.all.collect(&:id)).first\n \n not_found and return unless @invoice\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n format.pdf { render :layout => false }\n end\n end",
"title": ""
},
{
"docid": "3c75f80e8aa398424f3626897b93ae72",
"score": "0.6132532",
"text": "def invoices\n self.user.invoices.where(:client_id => self.id.to_s)\n end",
"title": ""
},
{
"docid": "589650958008971072afb7d974768e20",
"score": "0.6130908",
"text": "def show\n @invoice = Invoice.find(params[:id])\n @current_items = @invoice.invoice_items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"title": ""
},
{
"docid": "2acfb53679154a341530e46b1289247f",
"score": "0.6128142",
"text": "def invoices\n invoices = @resource.links.invoices.embedded.invoices\n InvoicesCollection.new(invoices)\n end",
"title": ""
},
{
"docid": "0bcfd815e59496ac73e74ee60a95e517",
"score": "0.6122969",
"text": "def show\n @invoice = Invoice.find(params[:id])\n @customer = @invoice.customer\n end",
"title": ""
},
{
"docid": "0ac215a137cbf4826d559a9df19d8a6f",
"score": "0.61044425",
"text": "def index\n @rental_invoices = RentalInvoice.all\n end",
"title": ""
},
{
"docid": "4c158b98acae3eee7040da0b989b418d",
"score": "0.6101982",
"text": "def set_invoice\n @invoice = Invoice.find(params[:id])\n\n @clients = Client.find_by_sql(\"SELECT * FROM clients\")\n end",
"title": ""
},
{
"docid": "7e3ceeef24d4402e72765c583c9cb8f5",
"score": "0.609958",
"text": "def index\n @iinvoices = Iinvoice.all\n end",
"title": ""
},
{
"docid": "9ed80f5009788a5dc82d99f345278847",
"score": "0.6089238",
"text": "def invoice(invoice_maker = DefaultInvoice::InvoiceMaker.new)\n invoice_maker.make_invoice_of(self)\n end",
"title": ""
},
{
"docid": "c016840b5f25c9ba4004616b8ade9016",
"score": "0.60832024",
"text": "def index\n @invoice_lines = InvoiceLine.all\n end",
"title": ""
},
{
"docid": "2185d0458df8abfa70de7a827077e165",
"score": "0.6079691",
"text": "def index\n @invoices = @company.invoices\n\n \n skip_authorization\n end",
"title": ""
},
{
"docid": "c4528eb8c9a19c16fc22804c7e26a6ac",
"score": "0.606431",
"text": "def show\n @invoice = Invoice.find(params[:id])\n @title = \"Client Invoices\"\n @object = @invoice.invoiceable_type.classify.constantize.find(@invoice.invoiceable_id)\n @object.selector = @invoice.invoiceable_type == \"Provider\" ? Selector::PROVIDER : Selector::GROUP\n @back_index = true\n @display_sidebar = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"title": ""
},
{
"docid": "00e9e3e00df923f967ece81c168f1212",
"score": "0.6062333",
"text": "def show\n @managers = @office.managers\n @agents = @office.agents\n end",
"title": ""
},
{
"docid": "3d80f28a4e76fb2e1d34566947a36b97",
"score": "0.6041469",
"text": "def generate_invoice\n # showing the item menu\n blue_print\n # calculating discount based on customer type\n self.total_discount.calculate_discount(self)\n # print final invoice\n print_final_invoice\n end",
"title": ""
},
{
"docid": "5ec9cf1c517f5dcf500ac6de959c7427",
"score": "0.6038896",
"text": "def invoice_list\n Stripe::Invoice.list({\n customer: @user,\n limit: 1,\n })\n end",
"title": ""
},
{
"docid": "aa0056ea35a8e70b6707abcd674b44fd",
"score": "0.6023756",
"text": "def index\n @invoices = current_user.invoices.all\n flash.now[:notice] = 'U heeft nog geen facturen toegevoegd' if @invoices.empty?\n end",
"title": ""
},
{
"docid": "62b4bf6b448a02e4d6c9be85142dfcfd",
"score": "0.6023412",
"text": "def index\n if (@matriculation.nil? == false)\n json_response(@matriculation.invoices)\n else\n json_response(Invoice.all)\n end\n end",
"title": ""
},
{
"docid": "aeba38d817add8e0663e555aa0381e9d",
"score": "0.60209227",
"text": "def index\n @contractorinvoices = Contractorinvoice.all\n end",
"title": ""
},
{
"docid": "f843fd4f0fc38b0d2eb8911f1d933740",
"score": "0.60035753",
"text": "def all(options = { page: 1, page_size: 10 })\n response = JSON.parse(@client.get('Invoices', options).body)\n invoices = response.key?('Items') ? response['Items'] : []\n invoices.map { |attributes| Unleashed::Invoice.new(@client, attributes) }\n end",
"title": ""
},
{
"docid": "88d683204a7bd2dfcc51722c1690516c",
"score": "0.6000023",
"text": "def show\n @invoices_current_year = @client.total_invoices_current_year_by_month\n @amount_total_invoices_by_year = @client.amount_total_invoices_by_year\n @most_invoiced_people = @client.most_invoiced_people(5)\n end",
"title": ""
},
{
"docid": "c9f3b96c0236e7417d106f42a7059230",
"score": "0.5993371",
"text": "def show\n if params[:company_id]\n @company = Company.find(params[:company_id])\n @invoice = Invoice.find(params[:id])\n else\n \n @invoice = Invoice.find(params[:id])\n render 'invoices/show'\n end\n \n skip_authorization\n end",
"title": ""
},
{
"docid": "8fd7ec24bf8b5167a435df6eda677f37",
"score": "0.59932685",
"text": "def show\n @invoice = @customer.invoices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"title": ""
},
{
"docid": "4eee59527b66c9af7a143c2c917bdd8f",
"score": "0.5990299",
"text": "def index\n @invoices = @registration.invoices\n end",
"title": ""
},
{
"docid": "466b099cf241d22a3dfea1f314cf29ab",
"score": "0.5986732",
"text": "def index\n # @invoices = Invoice.all\n if ( user_signed_in? ) && ( !current_user.is_staff? )\n @invoices = current_user.invoices.where([\"status = ?\", true])\n else\n @invoices = Invoice.joins(:invoicedetails).joins(:projects).where([\"projects.user_id = ?\", current_user.id])\n end\n end",
"title": ""
},
{
"docid": "d4dab47c1d081516d22f253a2f9cad6c",
"score": "0.59854573",
"text": "def show\n\t\t@invoice = Invoice.find(params[:id])\n\t\t@relation = @invoice.project_user_relation\n\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @invoice }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b33f29941302bc6e95dc535a991155ac",
"score": "0.59802586",
"text": "def index\n @user = User.find(current_user.id)\n @invoices = @user.invoices\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end",
"title": ""
},
{
"docid": "40816b07df43f74dca4492969000f006",
"score": "0.5977945",
"text": "def index\n @invoices = current_user.invoices.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end",
"title": ""
},
{
"docid": "c6c85d68c4654cbbb2d6f1df3869eb30",
"score": "0.5966759",
"text": "def show\n @invoice_details = @invoice.invoice_details\n end",
"title": ""
},
{
"docid": "f3d1c16ad3ee1a433757462de70e2b19",
"score": "0.5965819",
"text": "def show\n #@invoice = Invoice.find(params[:id])\n end",
"title": ""
},
{
"docid": "3a496c3ae8ec80ea7e63ae8e4ab04cb2",
"score": "0.5959883",
"text": "def index\n @invoice_articles = InvoiceArticle.all\n end",
"title": ""
},
{
"docid": "c64f234e2c358dfb68a5325dd619d681",
"score": "0.5955432",
"text": "def show\n\n if Counter::Application.config.printinvoices\n \tputs \"Executing:\" + (Counter::Application.config.acrordcmd % params[:id])\n \tsystem(Counter::Application.config.acrordcmd % params[:id])\n \tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end",
"title": ""
},
{
"docid": "9ac9ec6969b3e1faecda883083f81f01",
"score": "0.5950346",
"text": "def index\n if current_user.admin?\n @invoices = Invoice.all\n else\n @invoices = current_user.invoices.all\n end \n @login = current_user.email\n @LABEL = { Pendiente: \"warning\", Pagada: \"success\", Denegada: \"danger\" }\n end",
"title": ""
},
{
"docid": "e847feff724b086a6adecc55d5ceea7b",
"score": "0.5950344",
"text": "def all(options = {})\n #client.request(:get, '/invoices.json', options)\n CollectionProxy.new(client, \"invoices\", \"invoices.json\", options)\n end",
"title": ""
},
{
"docid": "7fe9c5098454ea1bc6c7c302a6d5de73",
"score": "0.5943589",
"text": "def index\n @invoice_items = InvoiceItem.all\n end",
"title": ""
},
{
"docid": "d83d1231b2bc2e2a685cbf66e10eb533",
"score": "0.5943449",
"text": "def invoice_lines\n get_invoice_lines_from_invoices(@export.invoices.select { |i| i.type == :invoice })\n end",
"title": ""
},
{
"docid": "03c4c3edb97e674425d4dd6cbe9cff29",
"score": "0.59415036",
"text": "def index\n @per_page = params[:per_page] || Invoice.per_page || 20\n @q = Invoice.ransack(params[:q])\n @invoices = @q.result.by_store(current_store.id).active.order('id desc').paginate(:page => params[:page], :per_page => @per_page)\n end",
"title": ""
},
{
"docid": "ce3dbdf3aedd160a0d8c13611df33ff9",
"score": "0.59367985",
"text": "def invoices\n @invoices ||= InvoicesApi.new @global_configuration\n end",
"title": ""
},
{
"docid": "87add6a83eef091a5c97894b98d9348c",
"score": "0.59341526",
"text": "def index\n @invoice_line_items = InvoiceLineItem.all\n end",
"title": ""
},
{
"docid": "7c707a40ccb8c28d1d3a9634b997c908",
"score": "0.593233",
"text": "def index\n if is_adm?\n @invoices = Invoice.all\n else\n @invoices = Invoice.where(\"sid = ? AND bill_end_date < ?\", current_user_id, Time.now)\n end\n end",
"title": ""
},
{
"docid": "bdbc9b086b1a2842040098a157aa9a8e",
"score": "0.5932",
"text": "def index\n @innovators = Innovator.all\n end",
"title": ""
},
{
"docid": "d82d7f3bfa25d273bace7fe5bcff8f81",
"score": "0.5923491",
"text": "def show_invoices\n data = {\n invoices: @subscription.invoices\n }\n\n render json: data\n end",
"title": ""
},
{
"docid": "2b681c18c3e7d3c783db0d32c38c40c2",
"score": "0.5918177",
"text": "def set_invoice\n # @invoice = Invoice.find(params[:id])\n # unless current_user.nil?\n @invoice = Invoice.where('id = ? and client_id in (?)', params[:id], current_user.company.clients.all.collect(&:id)).first\n #end\n end",
"title": ""
},
{
"docid": "23d71cba26d6c1061701f9bcd370aee9",
"score": "0.5918044",
"text": "def index\n @outgoinginvoices = Outgoinginvoice.all\n end",
"title": ""
},
{
"docid": "d97799c3c3d6c2c6ff6bba5f35a4c36f",
"score": "0.5916727",
"text": "def invoices\n @invoices ||= InvoicesApi.new config\n end",
"title": ""
},
{
"docid": "a8d4935ab6ddc326bd4c9f99113f075d",
"score": "0.5916564",
"text": "def new\n @title = \"Client Invoices\"\n respond_to do |format|\n if params[:provider_id]\n @object = Provider.find(params[:provider_id])\n @name = @object.provider_name\n @object.selector = Selector::PROVIDER\n set_provider_session @object.id, @object.provider_name\n elsif params[:group_id]\n @object = Group.find(params[:group_id])\n @name = @object.group_name\n @object.selector = Selector::GROUP\n set_group_session @object.id, @object.group_name\n else\n format.html { redirect_to invoices_path, notice: \"A Provider or Group must first be selected.\" }\n end\n @invoice = @object.invoices.new(:created_user => current_user.login_name)\n\n # sort the invoice_details by provider, patient, dos\n # use sort_by because this is all in memory\n # @invoice.invoice_details.sort_by!{|x| [x.provider_name, x.patient_name, x.dos] }\n\n @invoice_method = InvoiceCalculation::METHODS\n @payment_terms = Invoice::PAYMENT_TERMS\n @display_sidebar = true\n @back_index = true\n\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"title": ""
},
{
"docid": "21645bbdddb02c0d973644a248c8dee1",
"score": "0.5904219",
"text": "def list_invoices\n\n @pagetitle = \"Notas \"\n \n @invoices = Credit.all.order('id DESC').paginate(:page => params[:page])\n\n\n\n if params[:search]\n @invoices = Credit.search(params[:search]).order('id DESC').paginate(:page => params[:page])\n else\n @invoices = Credit.all.order('id DESC').paginate(:page => params[:page]) \n end\n\n \n end",
"title": ""
},
{
"docid": "a829bcedb0093fc424e4752b57308945",
"score": "0.5896929",
"text": "def index\n authorize(:invoice)\n @invoices = Invoice.all\n end",
"title": ""
},
{
"docid": "6e07c3bb699f45da0d0d33f1f5834e39",
"score": "0.58855337",
"text": "def show\n @invoice = Invoice.find(params[:id]).includes(:invoice_items => :items)\n end",
"title": ""
},
{
"docid": "eca7108f5def2e70afcb3678fe9fa0d4",
"score": "0.5882238",
"text": "def index\n require 'will_paginate/array'\n\n authorize Invoice\n\n @invoices = apply_scopes(Invoice).valid.all\n\n if current_user.client?\n @invoices = @invoices.by_belongings([current_user.id])\n end\n\n respond_with do |format|\n format.html\n format.json { render json: InvoicesDatatable.new(view_context, @invoices) }\n format.js\n end\n\n end",
"title": ""
},
{
"docid": "de9abb4079ace45ee2e278cac2139966",
"score": "0.586952",
"text": "def show\n @invoices = @division.invoices\n @receipts = @division.receipts\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @division }\n end\n end",
"title": ""
},
{
"docid": "db034971d1ba9fb25109b19275d8535d",
"score": "0.58655334",
"text": "def index\n @invoices = current_airport.invoices.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 15)\n end",
"title": ""
}
] |
0f7a0aaab4e362b5443b8eabb981a12f
|
Determines whether a URL is allowed by the robot policy.
|
[
{
"docid": "0b5d03f2d0c734acc58856a02954bdcc",
"score": "0.8410151",
"text": "def robot_allowed?(url)\n if @robots\n @robots.allowed?(url)\n else\n true\n end\n end",
"title": ""
}
] |
[
{
"docid": "998bd4b2b6bede71473657fd1fae53d5",
"score": "0.8198622",
"text": "def robots_allowed?(uri); end",
"title": ""
},
{
"docid": "54e5f0f645425da2eb312ac5c071d1ee",
"score": "0.7725434",
"text": "def domain_is_allowed?(url)\n true\n end",
"title": ""
},
{
"docid": "54e5f0f645425da2eb312ac5c071d1ee",
"score": "0.7725434",
"text": "def domain_is_allowed?(url)\n true\n end",
"title": ""
},
{
"docid": "f062f57b3fa27646e9f50034d230ef1c",
"score": "0.7513678",
"text": "def allows?(uri)\n return true if everyone_allowed_everywhere?\n return false if noone_allowed_anywhere\n return true if current_agent_allowed?(uri) \n end",
"title": ""
},
{
"docid": "85d5623cae0af91f67b022c165dbfaa8",
"score": "0.74736065",
"text": "def robot_txt_allowed?(url)\n if @use_robot_txt\n Robotstxt.allowed?(url, '*') rescue nil\n else\n true\n end\n end",
"title": ""
},
{
"docid": "463188bc20413f459f52728483116527",
"score": "0.73903906",
"text": "def allowed(link)\n @opts[:obey_robots_txt] ? @robots.allowed?(link) : true\n rescue\n false\n end",
"title": ""
},
{
"docid": "463188bc20413f459f52728483116527",
"score": "0.73903906",
"text": "def allowed(link)\n @opts[:obey_robots_txt] ? @robots.allowed?(link) : true\n rescue\n false\n end",
"title": ""
},
{
"docid": "103a2573b1a412ff5727348ad1fbb71c",
"score": "0.7379344",
"text": "def allowed(link)\n @opts[:obey_robots_txt] ? @robots.allowed?(link) : true\n rescue\n false\n end",
"title": ""
},
{
"docid": "92083fbe8c7e305590872e0d45e1be28",
"score": "0.7302325",
"text": "def allowed?(request)\n case\n when allow_path?(request) then true\n when allow_agent?(request) then true\n when whitelisted?(request) then true\n when blacklisted?(request) then false\n else nil # override in subclasses\n end\n end",
"title": ""
},
{
"docid": "40c713ac201b699da84a5a6fbb94a092",
"score": "0.72449464",
"text": "def allowed(link)\n @opts[:obey_robots_txt] ? @robots.allowed?(link) : true\n end",
"title": ""
},
{
"docid": "9928408610c46ba560ee0c6d8cb452f4",
"score": "0.71732914",
"text": "def allowed?(var)\n\t\t\tis_allow = true\n\t\t\turl = URI.parse(var)\n\t\t\tquerystring = (!url.query.nil?) ? '?' + url.query : ''\n\t\t\turl_path = url.path + querystring\n\t\t\t\n\t\t\t@rules.each {|ua|\n\t\t\t\t\n\t\t\t\tif @robot_id == ua[0] || ua[0] == '*' \n\t\t\t\t\t\n\t\t\t\t\tua[1].each {|d|\n\t\t\t\t\t\t\n\t\t\t\t\t\tis_allow = false if url_path.match('^' + d ) || d == '/'\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t}\n\t\t\tis_allow\n\t\tend",
"title": ""
},
{
"docid": "83567bb44bf5cee4a94b1a806721deff",
"score": "0.6927289",
"text": "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",
"title": ""
},
{
"docid": "09edac0c32ae61b998679363610353e6",
"score": "0.6831269",
"text": "def url_allowlist; end",
"title": ""
},
{
"docid": "6a315dfb4b08128c15c9095df34f7c6b",
"score": "0.6802932",
"text": "def allows_redirect?\n [\n %r{cyberduck}i,\n %r{konqueror}i\n ].any? do |regexp|\n (request.respond_to?(:user_agent) ? request.user_agent : request.env['HTTP_USER_AGENT']).to_s =~ regexp\n end\n end",
"title": ""
},
{
"docid": "d2f5333e18484828109425c9740cbb63",
"score": "0.6750179",
"text": "def everyone_allowed_everywhere?\n # the robots.txt was empty or not found at all\n # in either case, this site is open for all bots\n return true if @perms.empty? \n \n # check to see if there's a rule to allow everything\n return true if @perms['*'] && @perms['*']['allow'].find {|r| r == '/'}\n \n # if the disallow is blank, then nothing is blocked\n return true if @perms['*'] && @perms['*']['disallow'].find {|r| r == ''}\n \n false\n end",
"title": ""
},
{
"docid": "02b4fccd11ea65b6b144e876acd729e7",
"score": "0.6724092",
"text": "def allowed?(request)\n case\n when whitelisted?(request) then true\n when blacklisted?(request) then false\n else true # override in subclasses\n end\n end",
"title": ""
},
{
"docid": "4c715b99e842d00109945c945cf6b9b0",
"score": "0.65903836",
"text": "def current_agent_allowed?(uri)\n # be a good net citizen and set your user-agent!\n if @user_agent.nil? || @user_agent.empty?\n # log to logger that the user agent wasn't set\n log('*'*5 + ' ROBOTO: cannot determine if your bot is allowed since you did not ser the user-agent. \n Set it in the open_r options hash like so\n \\'user-agent\\' => \\'YOUR BOT\\'s NAME\\' and try again.')\n return false\n end\n \n # This will also bring us the user-agent * (for everyone) and any matches we find\n user_agents = @perms.keys.select {|k| (@user_agent == k) || (@user_agent.include?(k.gsub(/(\\*.*)/, ''))) }\n user_agents.each do |ua|\n @perms[ua]['disallow'].each do |r|\n return true if r == ''\n return false if r == '/' || uri.include?(r) || uri.include?(r.gsub(/\\*/, ''))\n end\n end\n \n # the uri isn't specifially disallowed for this user-agent \n # so let it through\n true\n end",
"title": ""
},
{
"docid": "f30905c693c5e3f38183921d7a2f963d",
"score": "0.6572073",
"text": "def publicly_available?\n return false unless access_rights.present?\n\n access_rights.none? do |value|\n value == 'deny' || %w[allow:icus allow:pdus].include?(value)\n end\n end",
"title": ""
},
{
"docid": "0842b93f26502b47dd320b56ea4d032c",
"score": "0.65560484",
"text": "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",
"title": ""
},
{
"docid": "976cb6c095a68ae79b4961a442638133",
"score": "0.6523916",
"text": "def request_allowed?(request)\n true\n end",
"title": ""
},
{
"docid": "4a131a8a9a84fe4a339aabe3836cd704",
"score": "0.6505366",
"text": "def visit_url?(link)\n @url_rules.accept?(link)\n end",
"title": ""
},
{
"docid": "2599685299cbf0c1b26f201b0c61a930",
"score": "0.64452225",
"text": "def valid?\n (uri.host =~ LINK_REGEX || uri.host =~ LINK_IP_REGEX) ? true : false\n end",
"title": ""
},
{
"docid": "1185eaaa1ed26aeb47c197062b9a0a4d",
"score": "0.6444006",
"text": "def allowed?(request)\n whitelisted?(request) && !blacklisted?(request) && meets_quota?\n end",
"title": ""
},
{
"docid": "99fe79db00c5f7fa0c99b48793fa587c",
"score": "0.64416397",
"text": "def url_active?\n begin\n response = Net::HTTP.get_response URI.parse(self.url)\n active_status = %w(200 301 302)\n active_status.include? response.code\n rescue\n false\n end \n end",
"title": ""
},
{
"docid": "8186d6ed3dc7a169cfde9c0704cd03da",
"score": "0.6423748",
"text": "def url_accessibility(url)\n open(url).status.last == 'OK'\n rescue ::SocketError, Timeout::Error, Errno::ECONNREFUSED, OpenURI::HTTPError\n false\n end",
"title": ""
},
{
"docid": "3a058320813873518542eeed317494dd",
"score": "0.64086264",
"text": "def allowed?(request)\n name = request.call.intern\n namespace = request.handler.intern\n method = request.method.intern\n\n read\n\n if @rights.include?(name)\n return @rights[name].allowed?(request.name, request.ip)\n elsif @rights.include?(namespace)\n return @rights[namespace].allowed?(request.name, request.ip)\n end\n false\n end",
"title": ""
},
{
"docid": "f4ee48bcb705125a9e02f96debc4965c",
"score": "0.6396079",
"text": "def accessed_from_website?\n res = false\n \n referer = request.env['HTTP_REFERER']\n unless referer.nil? || referer.match(\"^#{Conf.base_uri}\").nil?\n res = true\n end\n \n return res\n end",
"title": ""
},
{
"docid": "f4ee48bcb705125a9e02f96debc4965c",
"score": "0.6396079",
"text": "def accessed_from_website?\n res = false\n \n referer = request.env['HTTP_REFERER']\n unless referer.nil? || referer.match(\"^#{Conf.base_uri}\").nil?\n res = true\n end\n \n return res\n end",
"title": ""
},
{
"docid": "0ff20080cd8560133805f4c8fc42d155",
"score": "0.6393252",
"text": "def good_resource?(url)\n if rx_url\n !(url.to_s !~ rx_url)\n else\n true\n end\n end",
"title": ""
},
{
"docid": "63b9ca592dd669c2c5952f6e08b36e99",
"score": "0.6356457",
"text": "def valid_url?\n @url =~ URI::regexp\n end",
"title": ""
},
{
"docid": "eec3a3180d8d04080def6b09c99ecef8",
"score": "0.6337064",
"text": "def is_blacklisted?\n errors.add(:url, \"is blacklisted\") if BlacklistUrl.is_listed?(self.url)\n end",
"title": ""
},
{
"docid": "88c5ea09e4b25b8e0a13e20571afc776",
"score": "0.6333957",
"text": "def is_url?\n path =~ URL_PATHS\n end",
"title": ""
},
{
"docid": "9d20862ca9e82a5a35405fae4613f49e",
"score": "0.6320602",
"text": "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"title": ""
},
{
"docid": "9d20862ca9e82a5a35405fae4613f49e",
"score": "0.6320602",
"text": "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"title": ""
},
{
"docid": "9d20862ca9e82a5a35405fae4613f49e",
"score": "0.6320602",
"text": "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"title": ""
},
{
"docid": "4a7567b76c401ee2741d0c129ea00944",
"score": "0.6297927",
"text": "def invalid_url?(url)\n url.include? 'hurl.it'\n end",
"title": ""
},
{
"docid": "b0c1ec8fc991052253161ecf59976b81",
"score": "0.62944454",
"text": "def off_site?(url)\n url !~ /^\\// # urls not starting with a /\n end",
"title": ""
},
{
"docid": "01a9836bb01a2632b7e837a0e253b919",
"score": "0.6277549",
"text": "def allowed?\n allowed\n end",
"title": ""
},
{
"docid": "384856429a3e4aefdb4cb0dd0da21bd0",
"score": "0.6272796",
"text": "def all_valid?\n valid_url?\n end",
"title": ""
},
{
"docid": "4cb24b83c963ddb9398bea19bae10374",
"score": "0.62519956",
"text": "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"title": ""
},
{
"docid": "4cb24b83c963ddb9398bea19bae10374",
"score": "0.62519956",
"text": "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"title": ""
},
{
"docid": "4cb24b83c963ddb9398bea19bae10374",
"score": "0.62519956",
"text": "def url_valid?(url)\n url = URI.parse(url) rescue false\n url.kind_of?(URI::HTTP) || url.kind_of?(URI::HTTPS)\n end",
"title": ""
},
{
"docid": "bce1bfc8f062d5024694cfb56283a38c",
"score": "0.6251187",
"text": "def url_ok(url)\n return url =~ URI::ABS_URI\n end",
"title": ""
},
{
"docid": "414cab832973b00afa62f0ec6544c731",
"score": "0.6249857",
"text": "def verify_page?\n current_url.include?('Google')\n end",
"title": ""
},
{
"docid": "e51ed3c6452e0c48f202a20f92c8758b",
"score": "0.624907",
"text": "def is_url_secured(url)\n url = url.downcase\n if !url.include?(\"https\") && !url.include?(\"http\")\n Logger.warning(\"Using 'is_url_secured' on a url that doesn't have a http(s):// attachment.\")\n end\n return url.include? \"https\"\nend",
"title": ""
},
{
"docid": "dd475e0671afb4ad06be8e995aa69ffa",
"score": "0.6242157",
"text": "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",
"title": ""
},
{
"docid": "8a81f53e10193fa67b0a986bbec22078",
"score": "0.6241893",
"text": "def has_website?\n !url.blank?\n end",
"title": ""
},
{
"docid": "f6c821cf1e1dace8c072ff3b38337c34",
"score": "0.6239206",
"text": "def allowed_request\n !((request.remote_ip =~ /127\\.0\\.0\\.1/).nil? && (request.remote_ip =~ /128\\.128\\./).nil? && (request.remote_ip =~ /10\\.19\\./).nil?)\n end",
"title": ""
},
{
"docid": "17b3b79e24641abbb611680961ef0045",
"score": "0.6224257",
"text": "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",
"title": ""
},
{
"docid": "9187fc453f7a594bd6a0d5216c902075",
"score": "0.6212738",
"text": "def domain_allowed?(domain)\n ALLOWED_SITES.include?(domain)\n end",
"title": ""
},
{
"docid": "1f8a102fb55de0a6b68d0e92b88bd1af",
"score": "0.6204902",
"text": "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",
"title": ""
},
{
"docid": "0d9d0a841cf5d3bc280f66c0b56c7625",
"score": "0.61944276",
"text": "def valid_url?\n !Sailpoint.config.url.blank?\n end",
"title": ""
},
{
"docid": "b6c0b89a27ddcd104d3a57f54d40701e",
"score": "0.6166984",
"text": "def is_valid_url?\n (@url =~ URI::DEFAULT_PARSER.make_regexp) != nil\n end",
"title": ""
},
{
"docid": "ab3180329c82877f6b8d1111597d0623",
"score": "0.6158317",
"text": "def is_enable_direct_url\n return @direct_url != nil && @direct_url == \"true\"\n end",
"title": ""
},
{
"docid": "76f17c9d64687cb5a39e4f010034851e",
"score": "0.61564076",
"text": "def url?\n !urn?\n end",
"title": ""
},
{
"docid": "680f6731acfe547c3fd47ab5faec3a58",
"score": "0.6140624",
"text": "def accepts_outcome_url?\n accepted_outcome_types.member?('url')\n end",
"title": ""
},
{
"docid": "25e1407ef7299f1f06341657217203ec",
"score": "0.6134522",
"text": "def whitelisted?(request)\n false\n end",
"title": ""
},
{
"docid": "e0352d544149f7ec9d0c9a135fbf3c49",
"score": "0.61266476",
"text": "def page_url_is_correct\n ( current_url =~ self.class.page_url_validation_value ) !=nil\n end",
"title": ""
},
{
"docid": "5b81fb1c18568b4c6c2cbf7a860882ca",
"score": "0.6115143",
"text": "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",
"title": ""
},
{
"docid": "98735ecbdbd61a5e7cebda9cb418646e",
"score": "0.60900533",
"text": "def allowed?\n true\n # AccessControl.allowed_controllers(current_user.profile.label, current_user.profile.modules).include?(params[:controller])\n end",
"title": ""
},
{
"docid": "a83e43b30464b276062cabf342db76ff",
"score": "0.6080141",
"text": "def allowed?\n true\n end",
"title": ""
},
{
"docid": "a83e43b30464b276062cabf342db76ff",
"score": "0.6080141",
"text": "def allowed?\n true\n end",
"title": ""
},
{
"docid": "9856766cc0dd1ce44a69bfed1385bb48",
"score": "0.6070644",
"text": "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",
"title": ""
},
{
"docid": "e0d56f4b3d7afddc014cf92f1d4d9d4e",
"score": "0.60554403",
"text": "def use_oauth_for_url?(url)\n Tim::ImageFactory::Base.use_oauth? and\n url.include?(Tim::ImageFactory::Base.config[:site])\n end",
"title": ""
},
{
"docid": "b30a6d64c0bd3e46a062127d7da05f9d",
"score": "0.60515803",
"text": "def proxy_is_allowed?\n if(ENV['no_proxy'])\n ENV['no_proxy'].to_s.split(',').map(&:strip).none? do |item|\n File.fnmatch(item, [uri.host, uri.port].compact.join(':'))\n end\n else\n true\n end\n end",
"title": ""
},
{
"docid": "f449de3c58f84be79113a35a841e6be5",
"score": "0.6041302",
"text": "def valid_url?(url)\n uri = URI.parse(url)\n uri.kind_of?(URI::HTTP)\n rescue URI::InvalidURIError\n false\n end",
"title": ""
},
{
"docid": "014122b5717338df29c0e4d5adba899e",
"score": "0.6039597",
"text": "def url_allowlist=(_arg0); end",
"title": ""
},
{
"docid": "8dae7870625568381fa4493ba9fb9451",
"score": "0.60343957",
"text": "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",
"title": ""
},
{
"docid": "073e39d4ada0518dbc4fad4bea86e999",
"score": "0.6020548",
"text": "def is_url_valid_www(url)\n return url.include? \"www.\"\nend",
"title": ""
},
{
"docid": "7a2fb43b249ea592712c5e644b4afd51",
"score": "0.6016845",
"text": "def allowed?\n true\n end",
"title": ""
},
{
"docid": "1a34d1647f909bbeb7d7aafeb5f9e59e",
"score": "0.59998435",
"text": "def url?\n !url.nil?\n end",
"title": ""
},
{
"docid": "62a242232d1c00ed73a4d22539d0b427",
"score": "0.5996377",
"text": "def robot?\n user_agent = self.headers[\"User-Agent\"]\n escaped_bots = GentleREST::HttpRequest.robots.map do |bot|\n Regexp.escape(bot)\n end\n bots_regexp = Regexp.new(\n \"(#{escaped_bots.join(\"|\")})\", Regexp::IGNORECASE)\n return !!(user_agent =~ bots_regexp)\n end",
"title": ""
},
{
"docid": "393f30f0142333fc01e4a64f0f6008b5",
"score": "0.59902346",
"text": "def uri_eligible?(uri)\n eligible = uri =~ /#{Regexp.escape(@config[:base_url])}/\n debug \"Islandora uri eligible: #{uri}\" if eligible\n eligible\n end",
"title": ""
},
{
"docid": "c80558b41be110fabf89b3173e2bcad2",
"score": "0.5985318",
"text": "def is_valid_url?(url)\n if (url =~ /\\A#{URI::DEFAULT_PARSER.make_regexp}\\z/) == 0\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "afe3e6ab049929f3d4f6a4a1958ab5d5",
"score": "0.5952892",
"text": "def url_whitelisted_by_spec?(url, spec)\n parsed_url = url\n begin\n parsed_url = URI.parse(url) unless parsed_url.kind_of?(URI)\n rescue URI::InvalidURIError\n return false\n end\n\n parsed_spec = spec.kind_of?(URI) ? spec : URI.parse(spec)\n\n # Don't include 'host' yet, we check that special for wildcards. \n part_list = [:scheme, :userinfo, :port, :path, :query, :fragment]\n\n # special handling for hosts to support trailing period as wildcard\n spec_host = parsed_spec.host\n\n if spec_host && spec_host.start_with?(\".\")\n return false unless (parsed_url.host && parsed_url.host.ends_with?(spec_host) || parsed_url.host == spec_host.slice(1..-1))\n elsif spec_host && (! spec_host.empty?)\n # just check it normally below\n part_list << :host\n end\n\n\n # Other parts, just match if spec part is not empty\n part_list.each do |part|\n spec_part = parsed_spec.send(part).to_s\n if (! spec_part.nil?) && (! spec_part.empty?) && \n (parsed_url.send(part).to_s != spec_part )\n return false\n end\n end\n\n # If we got this far without a return false, we're good. \n return true\n end",
"title": ""
},
{
"docid": "d2ecd88136488b3b333f922d9aa73a6e",
"score": "0.59487087",
"text": "def restricted?\n pages.any? && pages.not_restricted.blank?\n end",
"title": ""
},
{
"docid": "d2ecd88136488b3b333f922d9aa73a6e",
"score": "0.59487087",
"text": "def restricted?\n pages.any? && pages.not_restricted.blank?\n end",
"title": ""
},
{
"docid": "d2ecd88136488b3b333f922d9aa73a6e",
"score": "0.59487087",
"text": "def restricted?\n pages.any? && pages.not_restricted.blank?\n end",
"title": ""
},
{
"docid": "c49027051cb5b6855f58860f28933e99",
"score": "0.5947023",
"text": "def is_url?\n self =~ /^#{URI::regexp}$/\n end",
"title": ""
},
{
"docid": "d55744fdb492c0664454737ac5d3c02d",
"score": "0.59448975",
"text": "def supports?(url)\n return @service_types.member?(url)\n end",
"title": ""
},
{
"docid": "f2795515ca0098331e2dfcdef86cb754",
"score": "0.5942026",
"text": "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",
"title": ""
},
{
"docid": "232ff69d3c685550b7689219d48a78d0",
"score": "0.59403723",
"text": "def url?(url)\n assert_type(url, String) # This includes Wgit::Url's.\n query = { url: url }\n retrieve(URLS_COLLECTION, query, limit: 1).any?\n end",
"title": ""
},
{
"docid": "373b70c414e35aa7c816a9364f101204",
"score": "0.5939407",
"text": "def valid?\n Wgit::Url.valid?(self)\n end",
"title": ""
},
{
"docid": "75a18c3daada68702a0c185f148d9e67",
"score": "0.59190494",
"text": "def restricted?\n page.restricted?\n end",
"title": ""
},
{
"docid": "d80e9fde838cb858b9984e539675736f",
"score": "0.59153825",
"text": "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",
"title": ""
},
{
"docid": "359c9da158ca0fa9dea5d14ad8782558",
"score": "0.5915371",
"text": "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",
"title": ""
},
{
"docid": "80974097cef60505c01eb32a3455f2c8",
"score": "0.59094334",
"text": "def real_url?\n url && url.present? && url != \"#\"\n end",
"title": ""
},
{
"docid": "24815895f9dcd2f3b96a377e09ec1b82",
"score": "0.58954185",
"text": "def secondary_url?\n case url\n when %r!pixiv\\.net/stacc!i\n true\n when %r!pixiv\\.net/fanbox!i\n true\n when %r!twitter\\.com/intent!i\n true\n when %r!lohas\\.nicoseiga\\.jp!i\n true\n when %r!(?:www|com|dic)\\.nicovideo\\.jp!i\n true\n when %r!pawoo\\.net/web/accounts!i\n true\n when %r!www\\.artstation\\.com!i\n true\n when %r!blogimg\\.jp!i, %r!image\\.blog\\.livedoor\\.jp!i\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "5b984186187efffb1fd513790e09fb2a",
"score": "0.5884687",
"text": "def a_domain_we_care_about?(url)\n begin\n !@domains.select { |domain| URI.parse(url).host == domain.host }.empty?\n rescue\n !@domains.select { |domain| url.gsub(/https*:\\/\\//,'').starts_with?(domain.host) }.empty?\n end\n end",
"title": ""
},
{
"docid": "f5b8988243693af2a7d1e551fd9ae9e2",
"score": "0.58833724",
"text": "def run?(blacklist, whitelist)\n ((@address.scheme == 'http') || (@address.scheme == 'https')) && (!match?(blacklist) || match?(whitelist))\n end",
"title": ""
},
{
"docid": "2e04e9f01f895ab5b770eec5607742c1",
"score": "0.5866538",
"text": "def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end",
"title": ""
},
{
"docid": "1dfe106947f717a6463cd733dd6f0212",
"score": "0.58631176",
"text": "def url_provided?\n @url = params[:url]\n @url.present? && @url.strip\n end",
"title": ""
},
{
"docid": "0e757d0df3a64e9e53edcc2ec32e976f",
"score": "0.58607954",
"text": "def allowed?(*_)\n true\n end",
"title": ""
},
{
"docid": "8584c3d8eca3925fbd1fa58448cb375c",
"score": "0.58604944",
"text": "def open_to_public?\n request.subdomains.first != 'admin'\n end",
"title": ""
},
{
"docid": "08e709b4e9dcc30748d16ea2ac057255",
"score": "0.58570707",
"text": "def visit_urls\n @url_rules.accept\n end",
"title": ""
},
{
"docid": "5776d640ec48780d574bbb2f3c45f3b5",
"score": "0.58549553",
"text": "def skip_url(url)\n # domains to skip\n # www.britannica.com - sometimes has ad window that overlays. \n # www.montereybayaquarium.org - redirects to itself, which requires back twice to return to search results\n # www.livescience.com - causes intermittent timeouts.\n urls = [\n 'www.britannica.com', 'www.montereybayaquarium.org', 'www.livescience.com'\n ]\n for u in urls\n return true if url.include? u\n end\n return false\n end",
"title": ""
},
{
"docid": "e77ca2d2572964d2ffe99fbe241f0660",
"score": "0.58498496",
"text": "def blacklisted?(request)\n false\n end",
"title": ""
},
{
"docid": "e9224d4e74fab065eb0db1c692afce0a",
"score": "0.58477837",
"text": "def include?(url)\n @urls.empty? || !!@urls.detect{ |u| u =~ url }\n end",
"title": ""
},
{
"docid": "c17534da7adbb7aeedc4965570598b64",
"score": "0.58350646",
"text": "def allowed_http?\n port_protocol_allowed('80')\n end",
"title": ""
},
{
"docid": "61cbb6b9ffe5bcfbf51c47eb2f35338d",
"score": "0.58277386",
"text": "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",
"title": ""
}
] |
cd987d1ad14f591e5d9a081c238caa5d
|
PATCH/PUT /home_tests/1 PATCH/PUT /home_tests/1.json
|
[
{
"docid": "8d5b67c69a5368fdd48e36a134ee48e6",
"score": "0.6431215",
"text": "def update\n respond_to do |format|\n if @home_test.update(home_test_params)\n format.html { redirect_to @home_test, notice: 'Home test was successfully updated.' }\n format.json { render :show, status: :ok, location: @home_test }\n else\n format.html { render :edit }\n format.json { render json: @home_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "765f860f9a42473cc91d620dc9d2fba2",
"score": "0.66635376",
"text": "def update\n @testspec = Testspec.find(params[:id])\n\n respond_to do |format|\n if @testspec.update_attributes(params[:testspec])\n format.html { redirect_to @testspec, notice: 'Testspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "376770d4daf61e7c7c7d4873be1c38b4",
"score": "0.66484857",
"text": "def test_should_update_status_post_via_API_JSON\r\n get \"/logout\"\r\n put \"/status_posts/1.json\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :success\r\n end",
"title": ""
},
{
"docid": "452a3e52d07987fb95c1b8288f231819",
"score": "0.6645682",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to tests_path, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6767b5d92a33d6ab83bd211f357530a3",
"score": "0.66278505",
"text": "def update\n @one_test = OneTest.find(params[:id])\n\n respond_to do |format|\n if @one_test.update_attributes(params[:one_test])\n format.html { redirect_to @one_test, notice: 'One test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b5edb8a9b2cad14c7874c5f42c5809e9",
"score": "0.6581048",
"text": "def test_put_user\n json_data = '{\"name\":\"test\", \"last_name\":\"test\", \"document\" : \"098\"}'\n put '/users/4', json_data\n assert_equal 204, last_response.status, 'Código de respuesta incorrecto'\n end",
"title": ""
},
{
"docid": "815ebfee242765e5ca9d57a9ea9454e4",
"score": "0.6556617",
"text": "def update\n respond_to do |format|\n if @testjson.update(testjson_params)\n format.html { redirect_to @testjson, notice: 'Testjson was successfully updated.' }\n format.json { render :show, status: :ok, location: @testjson }\n else\n format.html { render :edit }\n format.json { render json: @testjson.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a42899b731c2847d8bfc32f88a9c3897",
"score": "0.65468735",
"text": "def update\n respond_to do |format|\n if @api_test.update(api_test_params)\n format.html { redirect_to @api_test, notice: \"Api test was successfully updated.\" }\n format.json { render :show, status: :ok, location: @api_test }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @api_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e6e669e62db0cc75dd66ea308ba94c43",
"score": "0.65134114",
"text": "def update\n @selftest = Selftest.find(params[:id])\n\n respond_to do |format|\n if @selftest.update_attributes(params[:selftest])\n format.html { redirect_to @selftest, notice: 'Selftest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selftest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d4d3f86da849cf29576cc3b0af5c6ce",
"score": "0.64697707",
"text": "def update\n @rest_test = RestTest.find(params[:id])\n\n respond_to do |format|\n if @rest_test.update_attributes(params[:rest_test])\n format.html { redirect_to(@rest_test, :notice => 'RestTest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rest_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7cbe3d0b7c06b198a3ef73005f23b61",
"score": "0.64543164",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7cbe3d0b7c06b198a3ef73005f23b61",
"score": "0.6453538",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "06b3c00c2b87131cce7645df13c14497",
"score": "0.6453141",
"text": "def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0ee5caa5646efb93468e4238119dccda",
"score": "0.6442116",
"text": "def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "005738a907c9d329217273c06601e3c1",
"score": "0.64289165",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to project_test_path(@test.project, @test), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "148fff36c8391c64ee6e8ea22dac0b74",
"score": "0.6339456",
"text": "def update\n @test123 = Test123.find(params[:id])\n\n respond_to do |format|\n if @test123.update_attributes(params[:test123])\n format.html { redirect_to @test123, notice: 'Test123 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test123.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "126b51ffe038cd20a27f8fd6e1f33fe2",
"score": "0.6332962",
"text": "def test_should_update_blog_post_via_API_JSON\r\n get \"/logout\"\r\n put \"/blog_posts/1.json\", :api_key => 'testapikey',\r\n :blog_post => {:title => 'API Test Post',\r\n :body => 'API Test Body',\r\n :published => true,\r\n :featured => false,\r\n :summary => 'Blog Post Summary',\r\n :url => 'http://www.apiblogpost.com',\r\n :guid => '22222' }\r\n assert_response :success\r\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95652140452d336cc8486661669434ca",
"score": "0.63318855",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7751d0064cde485007b3d4612ec087a0",
"score": "0.63249415",
"text": "def update\n @specimen_test = SpecimenTest.find(params[:id])\n\n respond_to do |format|\n if @specimen_test.update_attributes(params[:specimen_test])\n format.html { redirect_to @specimen_test, notice: 'Specimen test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specimen_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a0d1031bfb21655341b05b11fc87bbb4",
"score": "0.63234746",
"text": "def update\n respond_to do |format|\n if @new_test.update(new_test_params)\n format.html { redirect_to @new_test, notice: 'New test was successfully updated.' }\n format.json { render :show, status: :ok, location: @new_test }\n else\n format.html { render :edit }\n format.json { render json: @new_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ba7b6a7995475899422df9c1f83dea67",
"score": "0.6304035",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: \"Test was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41bcf640040797655476590109a46f54",
"score": "0.6299053",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to [:backend, @test], notice: 'Test actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: [:backend, @test] }\n else\n format.html { render :edit }\n format.json { render json: [:backend, @test.errors], status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d0b07ff82a38d758bfa5d235c1ad8ab",
"score": "0.6287631",
"text": "def update\n @lab_test = LabTest.find(params[:id])\n\n respond_to do |format|\n if @lab_test.update_attributes(params[:lab_test])\n format.html { redirect_to client_lab_tests_path(@client), notice: t(:lab_test_saved) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "43a3e41164d419ce581b5dfe157f2c63",
"score": "0.6266781",
"text": "def update\n respond_to do |format|\n if @boot_test.update(boot_test_params)\n format.html { redirect_to @boot_test, notice: 'Boot test was successfully updated.' }\n format.json { render :show, status: :ok, location: @boot_test }\n else\n format.html { render :edit }\n format.json { render json: @boot_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1d43c7171b58d540c4bed82ab4b3c15c",
"score": "0.62603617",
"text": "def update\n @smoke_test = SmokeTest.find(params[:id])\n\n respond_to do |format|\n if @smoke_test.update_attributes(params[:smoke_test])\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully updated.') }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "86551651ffd65dd264aeafa7d287402c",
"score": "0.6239532",
"text": "def test_edit_contact_with_valid_email\n get_contacts_request\n url = @url_base + \"/api/v1/user/contact/\" + @contact['id'].to_s\n @response = RestClient.put(url, \n {\n :contact => {\n :first_name => \"edited name\", \n :last_name => \"edited last name\"\n }\n },\n {\n \"Content-Type\" => \"application/json\",\n \"X-User-Email\" => \"test@test.com\"\n })\n assert_equal 200, @response.code\n end",
"title": ""
},
{
"docid": "aea7e1e9abcb84227f48d1df67ad3f45",
"score": "0.62377834",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to admin_problem_path(@test.problem), notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "163456cc6d31867d82847cc9fbab796a",
"score": "0.6200677",
"text": "def update\n respond_to do |format|\n if @testapp.update(testapp_params)\n format.html { redirect_to @testapp, notice: 'Testapp was successfully updated.' }\n format.json { render :show, status: :ok, location: @testapp }\n else\n format.html { render :edit }\n format.json { render json: @testapp.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c2fd6b2b457890c5fc01632683f195d4",
"score": "0.6195944",
"text": "def api_tests\n @testcase = \"apt_test\"\n empty_db_tests\n\n data = { \"id\" => \"test_p1\" }.to_json\n assertEqual(put_json(\"/proposals\", data), [\"{}\", 200], \"Failed to API create proposal: test_p1\", \"Success: create test_p1 proposal\")\n\n assertEqual(put_json(\"/proposals/fred\", data)[1], 404, \"Failed to API create with bad URL proposal: test_p1\", \"Success: create test_p1 proposal with bad url\")\n\n assertEqualTimes(\"get_json(\\\"/proposals\\\")\", [[\"test_p1\"], 200], \"Failed to API get proposals: test_p1\", \"Success: list of proposals with test_p1\", 60)\n\n response = get_json(\"/proposals/test_p1\")\n assertEqual(response[1], 200, \"Failed to show test_p1\", \"Success: getting test_p1\")\n\n assertEqual(post_json(\"/proposals/test_p1\", response[0].to_json), [\"{}\", 200], \"Failed to edit test_p1\", \"Success: editting test_p1\")\n \n response[0][:fred] = \"bad\"\n assertEqual(post_json(\"/proposals/test_p1\", response[0].to_json), [\"key 'fred:' is undefined.\\n\", 400], \"Failed to fail editting test_p1\", \"Success: failed to edit test_p1\")\n\n assertEqual(delete_json(\"/proposals/test_p1\"), [\"{}\", 200], \"Failed to API delete proposal: test_p1\", \"Success: delete test_p1 proposal\")\n assertEqual(delete_json(\"/proposals/test_p1\"), [\"Error, could not delete proposal.\", 404], \"Failed to API delete proposal: missing test_p1\", \"Success: not finding to delete test_p1 proposal\")\n\n data = { \"id\" => \"test_p2\" }.to_json\n assertEqual(put_json(\"/proposals\", data), [\"{}\", 200], \"Failed to API create proposal: test_p2\", \"Success: create test_p2 proposal\")\n assertEqual(post_json(\"/proposals/commit/test_p2\", \"\"), [\"{}\", 200], \"Failed to commit test_p2\", \"Success: created committing test_p2\")\n\n assertEqualTimes(\"get_json(\\\"/proposals\\\")\", [[\"test_p2\"], 200], \"Failed to API get proposals: test_p2\", \"Success: list of proposals with test_p2\", 60)\n assertEqualTimes(\"get_json(\\\"/\\\")\", [[\"test_p2\"], 200], \"Failed to API get: test_p2\", \"Success: list with test_p2\", 60)\n\n response = get_json(\"/test_p2\")\n assertEqual(response[1], 200, \"Failed to show test_p2\", \"Success: getting test_p2\")\n\n assertEqual(delete_json(\"/test_p2\"), [\"{}\", 200], \"Failed to API delete: test_p2\", \"Success: delete test_p2\")\n assertEqual(delete_json(\"/test_p2\"), [\"\", 404], \"Failed to API delete: missing test_p2\", \"Success: delete missing test_p2\")\n\n assertEqual(delete_json(\"/proposals/test_p2\"), [\"{}\", 200], \"Failed to API delete proposal: test_p2\", \"Success: delete test_p2 proposal\")\n\n empty_db_tests\nend",
"title": ""
},
{
"docid": "b623e37ed2f0f02c07ad30f6e0dbfe92",
"score": "0.6183423",
"text": "def update\n @test_detail = TestDetail.find(params[:id])\n\n respond_to do |format|\n if @test_detail.update_attributes(params[:test_detail])\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b623e37ed2f0f02c07ad30f6e0dbfe92",
"score": "0.6183423",
"text": "def update\n @test_detail = TestDetail.find(params[:id])\n\n respond_to do |format|\n if @test_detail.update_attributes(params[:test_detail])\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab3b3a4bf813ad66312d6ecd7c48bc3a",
"score": "0.61734533",
"text": "def update\n @test_master = TestMaster.find(params[:id])\n\n respond_to do |format|\n if @test_master.update_attributes(params[:test_master])\n format.html { redirect_to @test_master, notice: 'Test master was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6745b3e9d4693a9a8bb1e345735e07d0",
"score": "0.6164322",
"text": "def update\n respond_to do |format|\n if @test_example.update(test_example_params)\n format.html { redirect_to @test_example, notice: 'Test example was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_example }\n else\n format.html { render :edit }\n format.json { render json: @test_example.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b30ad8fc74389aee1ed232ba4b50c39",
"score": "0.6146486",
"text": "def update\n @testing = Testing.find(params[:id])\n @testing.tested_at = DateTime.now\n @testing.tested_by = current_user\n @testing.save\n respond_to do |format|\n if @testing.update_attributes(params[:testing])\n format.html { redirect_to session[:original_uri], notice: 'Testing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testing.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cda6d0be186d9746264ee0b1fc5fbb6e",
"score": "0.61456597",
"text": "def update\n @test_model = TestModel.find(params[:id])\n\n respond_to do |format|\n if @test_model.update_attributes(params[:test_model])\n format.html { redirect_to @test_model, notice: 'Test model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca9fd5f1d76d6a1a8f9b0a89c64e0aa5",
"score": "0.61444676",
"text": "def post_update(params)\n @client.post(\"#{path}/update\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"title": ""
},
{
"docid": "d5eaea298e64625a71a15a970f3b75ed",
"score": "0.6141045",
"text": "def patch *args\n make_request :patch, *args\n end",
"title": ""
},
{
"docid": "4e5707cb695d861fccdafda4214e1a12",
"score": "0.6137927",
"text": "def update\n respond_to do |format|\n if @test01.update(test01_params)\n format.html { redirect_to @test01, notice: 'Test01 was successfully updated.' }\n format.json { render :show, status: :ok, location: @test01 }\n else\n format.html { render :edit }\n format.json { render json: @test01.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f44fe604c4e10b3102e43c9d68a20f35",
"score": "0.61329603",
"text": "def update\n @newtest = Newtest.find(params[:id])\n\n respond_to do |format|\n if @newtest.update_attributes(params[:newtest])\n format.html { redirect_to @newtest, :notice => 'Newtest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @newtest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6b0be60e189c74130ab5353574bbda66",
"score": "0.6126135",
"text": "def update\n respond_to do |format|\n if @lab_test.update(lab_test_params)\n format.html { redirect_to lab_tests_path, notice: 'Lab test was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_test }\n else\n format.html { render :edit }\n format.json { render json: @lab_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a10fb1882b7ad1f7a12b84c4c7ea70d4",
"score": "0.61184424",
"text": "def update\n @testbed = Testbed.find(params[:id])\n\n respond_to do |format|\n if @testbed.update_attributes(params[:testbed])\n format.html { redirect_to @testbed, notice: 'Testbed was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testbed.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3d5cd5326441a26c4766e729b7258a5b",
"score": "0.61174244",
"text": "def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4c84c9060e0779a1cf5ff7541b968e1",
"score": "0.61170304",
"text": "def update\n respond_to do |format|\n if @test_model.update(test_model_params)\n format.html { redirect_to @test_model, notice: 'Test model was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_model }\n else\n format.html { render :edit }\n format.json { render json: @test_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "25c89aa1abccf22101604c152270a195",
"score": "0.6116998",
"text": "def update_test_specs\n assignment = record\n content = nil\n if params[:specs].is_a? ActionController::Parameters\n content = params[:specs].permit!.to_h\n elsif params[:specs].is_a? String\n begin\n content = JSON.parse params[:specs]\n rescue JSON::ParserError => e\n render 'shared/http_status', locals: { code: '422', message: e.message }, status: :unprocessable_entity\n return\n end\n end\n if content.nil?\n render 'shared/http_status',\n locals: { code: '422',\n message: HttpStatusHelper::ERROR_CODE['message']['422'] },\n status: :unprocessable_entity\n else\n AutotestSpecsJob.perform_now(request.protocol + request.host_with_port, assignment, content)\n end\n rescue ActiveRecord::RecordNotFound => e\n render 'shared/http_status', locals: { code: '404', message: e }, status: :not_found\n rescue StandardError => e\n render 'shared/http_status', locals: { code: '500', message: e }, status: :internal_server_error\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.6112495",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "b4cc3ee2207b39abaf779a6078bbaf3a",
"score": "0.6112495",
"text": "def patch\n PATCH\n end",
"title": ""
},
{
"docid": "408376db709087681aee93388fa484d6",
"score": "0.6111685",
"text": "def update\n respond_to do |format|\n if @mock_test.update(mock_test_params)\n format.html { redirect_to @mock_test, notice: 'Mock test was successfully updated.' }\n format.json { render :show, status: :ok, location: @mock_test }\n else\n format.html {\n @class_rooms_array = get_class_room_array\n @subjects_array = get_subjects_array\n render :edit\n }\n format.json { render json: @mock_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0fc5ce227fc4037ae5c82522e1f31750",
"score": "0.6106722",
"text": "def update\n @fred_test = FredTest.find(params[:id])\n\n respond_to do |format|\n if @fred_test.update_attributes(params[:fred_test])\n format.html { redirect_to @fred_test, notice: 'Fred test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "09f3c8d45c569e5a8ba9ee9a2032a8cc",
"score": "0.6084744",
"text": "def update\n @load_test = LoadTest.find(params[:id])\n\n respond_to do |format|\n if @load_test.update_attributes(params[:load_test])\n format.html { redirect_to @load_test, notice: 'Load test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @load_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "50f50168a6e573b6d56a53675a6a7be1",
"score": "0.6083331",
"text": "def update\n @user_test = UserTest.find(params[:id])\n\n respond_to do |format|\n if @user_test.update_attributes(params[:user_test])\n format.html { redirect_to @user_test, notice: 'User test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7509d1c645323835efacfad42594c53b",
"score": "0.6083314",
"text": "def update\n @back_bone_test = BackBoneTest.find(params[:id])\n\n respond_to do |format|\n if @back_bone_test.update_attributes(params[:back_bone_test])\n format.html { redirect_to @back_bone_test, notice: 'Back bone test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @back_bone_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "898161302843a58df405e40cb41db2a8",
"score": "0.6082544",
"text": "def update\n @testmodel = Testmodel.find(params[:id])\n\n respond_to do |format|\n if @testmodel.update_attributes(params[:testmodel])\n format.html { redirect_to @testmodel, notice: 'Testmodel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "039734f2895c3acab43a63e3b4b1ce9e",
"score": "0.6081504",
"text": "def update\n respond_to do |format|\n if @testing.update(testing_params)\n format.html { redirect_to @testing, notice: 'Testing was successfully updated.' }\n format.json { render :show, status: :ok, location: @testing }\n else\n format.html { render :edit }\n format.json { render json: @testing.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "713161fe04801b44f5b9cdb91a95fe89",
"score": "0.6069714",
"text": "def test_put\n request = Http::Request.new('PUT', '/file2', {}, 'hello')\n\n response = self.request(request)\n\n assert_equal(201, response.status, \"Incorrect status code received. Full response body: #{response.body_as_string}\")\n\n assert_equal(\n 'hello',\n @server.tree.node_for_path('file2').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('hello')}\\\"\"]\n },\n response.headers\n )\n end",
"title": ""
},
{
"docid": "199c5a562017f67b957c1c76a3e9cbdb",
"score": "0.6069368",
"text": "def test_update\n\n division = Division.find(divisions(:std).id)\n division.name = 'WD-40'\n\n put(:update, {:division => division.attributes}, cathy_admin_session)\n assert_equal('Division ' + division.name + ' was successfully updated.',\n flash['notice'])\n assert_redirected_to(:action => 'edit', :id => division.id)\n assert_equal('WD-40', division.name)\n \n end",
"title": ""
},
{
"docid": "f0686f191a0def3b6c3ad6edfbcf2f03",
"score": "0.6066658",
"text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n )\n end",
"title": ""
},
{
"docid": "d186e0f2f03aa92acfb582ce29fdf7af",
"score": "0.60634756",
"text": "def update\n @mytest = Mytest.find(params[:id])\n\n respond_to do |format|\n if @mytest.update_attributes(params[:mytest])\n format.html { redirect_to @mytest, notice: 'Mytest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mytest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6e500cb76bff41458855a2a1866c6bb6",
"score": "0.6060513",
"text": "def update\n @status_test = StatusTest.find(params[:id])\n\n respond_to do |format|\n if @status_test.update_attributes(params[:status_test])\n format.html { redirect_to @status_test, notice: 'Status test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "02f653eefb43464cd2f7ed71d0a5cef7",
"score": "0.6057477",
"text": "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "02436b1b06a23143872cec41bd307b5c",
"score": "0.6055704",
"text": "def update\n @tests = Tests.find(params[:id])\n\n respond_to do |format|\n if @tests.update_attributes(params[:tests])\n flash[:notice] = 'Tests was successfully updated.'\n format.html { redirect_to tests_url(@tests) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tests.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "4a78d1097ea752ef5308e0d7dc866156",
"score": "0.60548735",
"text": "def update\n respond_to do |format|\n if @automated_test.update(automated_test_params)\n format.html { redirect_to @automated_test, notice: 'Automated test was successfully updated.' }\n format.json { render :show, status: :ok, location: @automated_test }\n else\n format.html { render :edit }\n format.json { render json: @automated_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e33e987641c9cc931b4bd51362337b7f",
"score": "0.6049614",
"text": "def update\n respond_to do |format|\n if @testmodel.update(testmodel_params)\n format.html { redirect_to @testmodel, notice: 'Testmodel was successfully updated.' }\n format.json { render :show, status: :ok, location: @testmodel }\n else\n format.html { render :edit }\n format.json { render json: @testmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e33e987641c9cc931b4bd51362337b7f",
"score": "0.6049614",
"text": "def update\n respond_to do |format|\n if @testmodel.update(testmodel_params)\n format.html { redirect_to @testmodel, notice: 'Testmodel was successfully updated.' }\n format.json { render :show, status: :ok, location: @testmodel }\n else\n format.html { render :edit }\n format.json { render json: @testmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "545dadbe32aa3d9d0edf1d22293783fc",
"score": "0.60472333",
"text": "def test_put_existing\n request = Http::Request.new('PUT', '/file1', {}, 'bar')\n\n response = self.request(request)\n\n assert_equal(204, response.status)\n\n assert_equal(\n 'bar',\n @server.tree.node_for_path('file1').get\n )\n\n assert_equal(\n {\n 'X-Sabre-Version' => [Version::VERSION],\n 'Content-Length' => ['0'],\n 'ETag' => [\"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"]\n },\n response.headers\n )\n end",
"title": ""
},
{
"docid": "2058abc7401dbd111929d43963dd4183",
"score": "0.6042012",
"text": "def update\n @two_test = TwoTest.find(params[:id])\n\n respond_to do |format|\n if @two_test.update_attributes(params[:two_test])\n format.html { redirect_to @two_test, notice: 'Two test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @two_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "117576a0cf1ee1ec60bb846284bacdab",
"score": "0.60382736",
"text": "def update\n if @testing.update(testing_params)\n @testings = Testing.all\n render json: {success: true, testings: @testings}\n else\n render json: {success: false, testing_errors: @testing.errors, status: :unprocessable_entity}\n end\n end",
"title": ""
},
{
"docid": "4ee10854385270d63ecb51b897fe63de",
"score": "0.60375386",
"text": "def update\n respond_to do |format|\n if @test_object.update(test_object_params)\n format.html { redirect_to @test_object, notice: 'Test object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "af9aedd4f428a2c26c3fd57798526020",
"score": "0.6034944",
"text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end",
"title": ""
},
{
"docid": "796120fee694c70a5c06a73cf301f19f",
"score": "0.60226405",
"text": "def updatepracticetest\n @practice_test = GlobalPracticeTest.find(params[:id])\n\n respond_to do |format|\n if @practice_test.update_attributes(params[:global_practice_test])\n format.html { redirect_to global_exam_root_url, notice: 'Practice test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "704c74a2b1ee88f08a0bb2ede5c7c05d",
"score": "0.601928",
"text": "def update\n respond_to do |format|\n if @newtest.update(newtest_params)\n format.html { redirect_to @newtest, notice: 'Newtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @newtest }\n else\n format.html { render :edit }\n format.json { render json: @newtest.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6f577e8c968077d1ab6fc06591f443f1",
"score": "0.60126287",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.js\n else\n format.js { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.6012586",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "fa16209f5ac39ae638cdf45c17fd5f18",
"score": "0.6012586",
"text": "def rest_patch(path, options = {}, api_ver = @api_version)\n rest_api(:patch, path, options, api_ver)\n end",
"title": ""
},
{
"docid": "2dcb40af24b4f547d848c823c836f928",
"score": "0.6011186",
"text": "def update \n xss_test\n respond_to do |format|\n if @test.update(test_params) \n format.html { redirect_to @test, success: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit, warning: 'Fields can\\'t be blank.' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b7f405ad366001245655be4c668f1bb1",
"score": "0.6006138",
"text": "def update\n @testobject = Testobject.find(params[:id])\n\n respond_to do |format|\n if @testobject.update_attributes(params[:testobject])\n format.html { redirect_to @testobject, notice: 'Testobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testobject.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "01c050d66c497d12a69b53bfc1ef3292",
"score": "0.6005885",
"text": "def update\n respond_to do |format|\n if @test_case.update(test_case_params)\n format.html { redirect_to [:admin, @test_case], notice: 'Test was successfully saved.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0c1a09a9d20ee815b5c9f998eda70b44",
"score": "0.60054564",
"text": "def patch(path, params = {}, options = {})\n options[:content_type] ||= :json\n options[:Authorization] = \"simple-token #{self.access_token}\"\n RestClient.patch(request_url(path), params.to_json, options)\n end",
"title": ""
},
{
"docid": "8c26adf9378ef5eecde3659bd28c738f",
"score": "0.59953433",
"text": "def update\n respond_to do |format|\n if @test_taker.update(test_taker_params)\n format.html { redirect_to @test_taker, notice: 'Test taker was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_taker }\n else\n format.html { render :edit }\n format.json { render json: @test_taker.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3c940f44fe931dfb074f7896b7d81423",
"score": "0.59768903",
"text": "def update\n @teststep = Teststep.find(params[:id])\n\n respond_to do |format|\n if @teststep.update_attributes(params[:teststep])\n format.html { redirect_to @teststep, notice: 'Teststep was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teststep.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dbf33a3a7e7ff6178056bd7f884186e5",
"score": "0.5973325",
"text": "def update\n respond_to do |format|\n if @test_suite.update(test_suite_params)\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_suite }\n else\n format.html { render :edit }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bcc939c813e0a9336f36af3d9ebe0825",
"score": "0.59631217",
"text": "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to quiz_test_path(@quiz, @test), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "360fade54c7af7b2322f5eb18104e9eb",
"score": "0.595133",
"text": "def update\n if @testset.update(testset_params)\n render :show, status: :ok\n else\n render json: @testset.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "47abb2cddfa1a665018f717cdaaa4164",
"score": "0.5946096",
"text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end",
"title": ""
},
{
"docid": "17f0e1827178b2ec5e09b3d84d4edd3b",
"score": "0.5942502",
"text": "def update\n @test_specification = TestSpecification.find(params[:id])\n\n respond_to do |format|\n if @test_specification.update_attributes(params[:test_specification])\n format.html { redirect_to(@test_specification, :notice => 'Test specification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_specification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4cd1aba26fc09b6b985d2551b84bc070",
"score": "0.59397215",
"text": "def update\n respond_to do |format|\n if @automated_test.update(automated_test_params)\n format.html { redirect_to @automated_test, notice: 'Automated test was successfully updated.' + edit_automated_test_path.to_s }\n format.json { render :show, status: :ok, location: @automated_test }\n else\n format.html { render :edit }\n format.json { render json: @automated_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e1fb63e01e4a7aa7cf0deb38c53a0f26",
"score": "0.593769",
"text": "def update\n respond_to do |format|\n if @solution.update(solution_params)\n params[:solution][:test_runs].each do |test_run|\n @solution.test_runs.create(test_run)\n end\n\n format.html { redirect_to @solution, notice: 'Solution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7c20b10f10e95babb03f0263a899742a",
"score": "0.592722",
"text": "def update\n respond_to do |format|\n if @test_me.update(test_me_params)\n format.html { redirect_to @test_me, notice: 'Test me was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_me }\n else\n format.html { render :edit }\n format.json { render json: @test_me.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a36bb357107dea78524a988adcaf371e",
"score": "0.59187067",
"text": "def update\n\t\trespond_to do |format|\n\t\t\tif @testimony.update(testimony_params)\n\t\t\t\tformat.html { redirect_to @testimony, notice: 'Testimony 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: @testimony.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "dbe737a9b526c6ce839721cccca37a38",
"score": "0.591807",
"text": "def test_should_update_picture\n put :update, :id => 1, :picture => { }\n assert_response :redirect\n end",
"title": ""
},
{
"docid": "3b64be1d763d5ffeade8911d2ab0bfd9",
"score": "0.5917222",
"text": "def update\n @teams_test = TeamsTest.find(params[:id])\n\n respond_to do |format|\n if @teams_test.update_attributes(params[:teams_test])\n format.html { redirect_to @teams_test, notice: 'Teams test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teams_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2abe58b3848b2366f3eedd27554acc86",
"score": "0.5915209",
"text": "def update\n update_params.merge(updated_by: current_user)\n if @spec.update(update_params)\n head :no_content\n else\n render json: @spec.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "bd7274a522757f2fd4c18e86ab113022",
"score": "0.5914657",
"text": "def update\n if @test_guide_basic.update(test_guide_basic_params)\n render status: :ok, json: @test_guide_basic\n else\n self.send(:edit)\n end\n end",
"title": ""
}
] |
2f421fe52d563ad5754fc901d937dcf4
|
=begin rdoc Is this certificate valid at this point in time. Note this only checks if it is valid with respect to time. It is important to realize that it does not check with any CRL or OCSP services to see if the certificate was revoked. =end
|
[
{
"docid": "16ed173c8cda8679881ac5d387118086",
"score": "0.0",
"text": "def valid?(time=Time.now.utc)\n time>not_before && time<self.not_after\n end",
"title": ""
}
] |
[
{
"docid": "15b4005c92accf0b601c44d2b0d7dc78",
"score": "0.761151",
"text": "def check_cert_expiring\n cert = certificate_get\n expire_date = cert.not_after\n\n now = Time.now\n # Calculate the difference in time (seconds) and convert to hours\n hours_until_expired = (expire_date - now) / 60 / 60\n\n if hours_until_expired < resource[:regenerate_ttl]\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "eb24b608aa822df83497f6dcfbe9381c",
"score": "0.7324734",
"text": "def valid_duration?(cert_obj)\n cert_obj.not_before < Time.now.utc && cert_obj.not_after > Time.now.utc\n end",
"title": ""
},
{
"docid": "26c4cd40d979dfe4d3cf19fe83a8bee5",
"score": "0.73012024",
"text": "def check_cert_revoked\n cert_serial = cert_serial_get\n api_path = '/v1' + resource[:secret_engine] + '/cert/' + cert_serial\n\n headers = {\n 'X-Vault-Token' => resource[:api_token],\n }\n\n response = send_request('GET', api_path, nil, headers)\n\n # Check the revocation time on the returned cert object\n if response['data']['revocation_time'] > 0\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "45af188687a17a5998de375fc69ad91c",
"score": "0.7010743",
"text": "def check_cert_revoked(serial_number)\n response = read_cert(format_serial_number(serial_number))\n # Check the revocation time on the returned cert object\n response['data']['revocation_time'] > 0\n end",
"title": ""
},
{
"docid": "da3ae71eaf6709938e947b6a52f3f517",
"score": "0.69037306",
"text": "def expired?\n return if missing?\n\n validity < (reference_time - time)\n end",
"title": ""
},
{
"docid": "902895b89e0e59b75d2315ccfcd166a3",
"score": "0.67808187",
"text": "def certified?\n return self.certified_at.present?\n end",
"title": ""
},
{
"docid": "c3d107a435784d7e37a111b6c23a0abd",
"score": "0.6676402",
"text": "def cache_valid?(certificate_entry)\n return false if certificate_entry.nil?\n\n (Time.now <= (certificate_entry[:timestamp] + CERTIFICATE_CACHE_TIME))\n end",
"title": ""
},
{
"docid": "f3b02eb2572e66f6b7831d0ecb21cdff",
"score": "0.66078717",
"text": "def is_valid?\n \tDateTime.now < self.expires_at\n end",
"title": ""
},
{
"docid": "68f7c4441db77c77633018d3e06be187",
"score": "0.66030276",
"text": "def cert_need_renewal?(cert_file, renew_before_expiry)\n resp = true\n cert_content = ::File.exist?(cert_file) ? File.read(cert_file) : cert_file\n begin\n cert = OpenSSL::X509::Certificate.new cert_content\n rescue ::OpenSSL::X509::CertificateError\n return resp\n end\n\n unless cert.not_after <= Time.now + 3600 * 24 * renew_before_expiry\n resp = false\n end\n\n resp\n end",
"title": ""
},
{
"docid": "a7f0c7eb30cacc9e7b645c69acccc051",
"score": "0.65812296",
"text": "def is_valid?\n DateTime.now < self.expires_at\n end",
"title": ""
},
{
"docid": "ffd9fef957bc13d3d79ebeee421c59b5",
"score": "0.64901143",
"text": "def needs_renewal?\n file_name = Gitlab['nginx']['ssl_certificate']\n return false unless File.exist? file_name\n\n cert = OpenSSL::X509::Certificate.new File.read(file_name)\n\n cert.issuer.to_s =~ LETSENCRYPT_ISSUER && cert.not_after < Time.now\n end",
"title": ""
},
{
"docid": "6465f142243050a500c53df3346706da",
"score": "0.6410748",
"text": "def check_validity\n if @expires_at == nil\n raise OAuthSessionError, \"Expiration not properly initialized.\"\n end\n if @expires_at < Time.new\n if not do_refresh\n raise OAuthSessionError, \"Token could not be refreshed.\"\n end\n end\n return true\n end",
"title": ""
},
{
"docid": "d56984dafaa692a6a76d4a842f357fd3",
"score": "0.63979",
"text": "def token_expired?\r\n begin\r\n conditions_element = REXML::XPath.first(document,\"/p:Response/a:Assertion/a:Conditions\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\r\n raise SA1012Exception if conditions_element.nil?\r\n raise SA1003Exception if conditions_element.attribute('NotBefore') and Time.now.utc < Time.parse(conditions_element.attribute('NotBefore').value)\r\n raise SA1004Exception if conditions_element.attribute('NotOnOrAfter') and Time.now.utc >= Time.parse(conditions_element.attribute('NotOnOrAfter').value)\r\n rescue RuntimeError => exp\r\n Rails.logger.error \"#{exp.class} - #{exp.message}\"\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"title": ""
},
{
"docid": "03e880479ce08eb79519321cfb5c4ce8",
"score": "0.6373989",
"text": "def expired?\r\n return Time.now > self.created_on + @@validity_time\r\n end",
"title": ""
},
{
"docid": "849b7c92dfb18e095eb9bf3e81d46137",
"score": "0.63528746",
"text": "def valid?\n valid_at?(Time.now)\n end",
"title": ""
},
{
"docid": "57c47d32caf13afd19c38ab2111f1a10",
"score": "0.6261646",
"text": "def verify_expiration; end",
"title": ""
},
{
"docid": "57c47d32caf13afd19c38ab2111f1a10",
"score": "0.6261646",
"text": "def verify_expiration; end",
"title": ""
},
{
"docid": "168ff0febf07f3b5a97d350b72b67049",
"score": "0.6244859",
"text": "def valid?\n ns_timer && ns_timer.valid?\n end",
"title": ""
},
{
"docid": "cea37840bd10f3f6e28622ff89b51178",
"score": "0.62404156",
"text": "def expired?\n not valid?\n end",
"title": ""
},
{
"docid": "8d0e78f43ad54f3f9179377f9f5c9be7",
"score": "0.62116694",
"text": "def keys_valid (full_profile_name)\n # Check if we actually need to be refreshing this token (if this data is already set)\n # Amazon uses (or close enough to) the rfc3339 datetime standard\n unless @token_data[full_profile_name].nil?\n expire_time = DateTime.rfc3339(@token_data[full_profile_name]['expiration'])\n current_time = DateTime.now\n # This is to allow us to renew them within 10minutes of them expiring\n if (expire_time - 600) < current_time and expire_time > current_time\n puts \"Within 10min of expiration. Allowing early renew.\"\n return false\n elsif expire_time > current_time\n # Then we are good to go\n return true\n else\n # The keys are expired (i.e not valid)\n return false\n end\n end\nend",
"title": ""
},
{
"docid": "e587a3db36389dfdf05b796c83beeecc",
"score": "0.6210899",
"text": "def verification_token_valid?\n (self.verification_sent_at + 4.hours) > Time.now.utc\n end",
"title": ""
},
{
"docid": "9b2dfef92734976acb0a4c5b4a952292",
"score": "0.62105584",
"text": "def expired?\n can_expire? && @expiry < Time.now.to_i\n end",
"title": ""
},
{
"docid": "f1eb7a2695ed6eb1e356e90bb7741ac5",
"score": "0.6180893",
"text": "def expired?\n Time.now > valid_until\n end",
"title": ""
},
{
"docid": "f96dd9e018b49eeff69da0cda2a7525f",
"score": "0.61650044",
"text": "def expired_time? time\n time + self.class.ttl_in_seconds.to_i < Time.now\n end",
"title": ""
},
{
"docid": "505dc618f1c52c000b8748858daa5dfa",
"score": "0.61442894",
"text": "def valid?\n valid_until > Time.now.to_i\n end",
"title": ""
},
{
"docid": "7eb49934d84b6fb5ab48f55cedd55c8f",
"score": "0.6136806",
"text": "def expired?\n Time.now - @created_time > @ttl\n end",
"title": ""
},
{
"docid": "5cc145516b16250d07a565c15a0c1e76",
"score": "0.6132611",
"text": "def expires_on\n expiry_date = nil\n dates = %x{echo \"#{self.certificate}\" | openssl x509 -noout -dates}\n dates.each_line do |date_line|\n logger.debug(\"DEBUG >> Date line: #{date_line}\")\n if date_line =~ /^notAfter=/\n expiry_date = date_line.gsub('notAfter=', '').to_time\n end\n end\n expiry_date\n end",
"title": ""
},
{
"docid": "f360394a1c7fb8da758e81b053ef5c61",
"score": "0.61087584",
"text": "def validate\n now = Time.now\n\n # Check start time and end time of certificates\n @cert_chain.each do |cert|\n if cert.not_before > now || cert.not_after < now\n raise \"Certificate not valid. Current time is #{now.localtime}\"\n end\n end\n\n begin\n # Validate the proxy certifcates\n signee = @cert_chain[0]\n\n check_crl(signee)\n\n @cert_chain[1..-1].each do |cert|\n if !((signee.issuer.to_s == cert.subject.to_s) &&\n (signee.verify(cert.public_key)))\n raise \"#{signee.subject} with issuer #{signee.issuer} \" \\\n \"was not verified by #{cert.subject}\"\n end\n\n signee = cert\n end\n\n # Validate the End Entity certificate\n if !@options[:ca_dir]\n raise \"No certifcate authority directory was specified.\"\n end\n\n begin\n ca_hash = signee.issuer.hash.to_s(16)\n ca_path = @options[:ca_dir] + '/' + ca_hash + '.0'\n\n ca_cert = OpenSSL::X509::Certificate.new(File.read(ca_path))\n\n if !((signee.issuer.to_s == ca_cert.subject.to_s) &&\n (signee.verify(ca_cert.public_key)))\n raise \"#{signee.subject} with issuer #{signee.issuer} \" \\\n \"was not verified by #{ca_cert.subject}\"\n end\n\n signee = ca_cert\n end while ca_cert.subject.to_s != ca_cert.issuer.to_s\n rescue\n raise\n end\n end",
"title": ""
},
{
"docid": "65f58a5f2b3622f70efbe2d8d473078e",
"score": "0.60882795",
"text": "def valid_expiry_date?\n return true if self.cc_expiry.blank?\n \n # check format\n return false unless self.cc_expiry.match(/^\\d{4}$/)\n \n # check date is not in past\n year, month = self.cc_expiry[2..3].to_i, self.cc_expiry[0..1].to_i\n year += (year > 79) ? 1900 : 2000\n\n \t\t# CC is still considered valid during the month of expiry,\n \t\t# so just compare year and month, ignoring the rest.\n \t\tnow = DateTime.now\n return ((1..12) === month) && DateTime.new(year, month) >= DateTime.new(now.year, now.month)\n end",
"title": ""
},
{
"docid": "2029d32df72f8a0674edc62c18da8055",
"score": "0.60878295",
"text": "def signature_is_valid?\n validate_signature(doc, certificate, :normal)\n end",
"title": ""
},
{
"docid": "8f4c51d16f8efe7ec0d6db2016f89cbd",
"score": "0.6087148",
"text": "def expired?\n @expiry_time < Time.now\n end",
"title": ""
},
{
"docid": "c56c1067076af2ff8a032ba65cf4159a",
"score": "0.6081246",
"text": "def expired?\n expires_at && expires_at <= Time.now\n end",
"title": ""
},
{
"docid": "6b790e484986d02f9ddc72ecea78f091",
"score": "0.6079064",
"text": "def expired?\n can_expire? && (self.expires_in + self.time_created) < Time.now.to_i\n end",
"title": ""
},
{
"docid": "22eaf430a5b89bbad489e0c5844b8b05",
"score": "0.6068374",
"text": "def expired?\n expires_at.to_time <= Time.now.utc\n end",
"title": ""
},
{
"docid": "22eaf430a5b89bbad489e0c5844b8b05",
"score": "0.6068374",
"text": "def expired?\n expires_at.to_time <= Time.now.utc\n end",
"title": ""
},
{
"docid": "15d57ada4b969e4145bce56b515045e2",
"score": "0.6056969",
"text": "def session_valid?\n @session_expiry_time > Time.now if @session_expiry_time\n end",
"title": ""
},
{
"docid": "73491196eaff69fa0325657d1575b597",
"score": "0.6056315",
"text": "def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end",
"title": ""
},
{
"docid": "6a88041b7d224070f98400fba0e9a344",
"score": "0.6053564",
"text": "def request_expired?\n parsed_timestamp < request_expires_at\n end",
"title": ""
},
{
"docid": "a9d9386c443d2fc59f1f7a2f5733ac82",
"score": "0.60499215",
"text": "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"title": ""
},
{
"docid": "a9d9386c443d2fc59f1f7a2f5733ac82",
"score": "0.60499215",
"text": "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end",
"title": ""
},
{
"docid": "aa8d52e679136b8b0eddb3b60e9c6388",
"score": "0.6048163",
"text": "def expired?\n false\n end",
"title": ""
},
{
"docid": "cdc5b866e73b325e6ece529d2b1f7fa2",
"score": "0.6046547",
"text": "def expired?\n if (self.last_retrieved == nil)\n return true\n elsif (self.time_to_live < 30.minutes)\n return (self.last_retrieved + 30.minutes) < Time.now.gmtime\n else\n return (self.last_retrieved + self.time_to_live) < Time.now.gmtime\n end\n end",
"title": ""
},
{
"docid": "d9d5fdfc0e1a799b6f7af60531fa583e",
"score": "0.60331136",
"text": "def session_valid?\n @session_expiry_time > Time.now if @session_expiry_time\n end",
"title": ""
},
{
"docid": "828d96b5f2b8c946c98f1b18db0b25fb",
"score": "0.60304505",
"text": "def expired?\n self.class.ttl_in_seconds && self.class.rates_expiration <= Time.now\n end",
"title": ""
},
{
"docid": "e4e4f5e9d78448370e7263383f7160e4",
"score": "0.60254776",
"text": "def expired?\n return false unless expires_at\n expires_at < Time.now\n end",
"title": ""
},
{
"docid": "7e6cdf893ab25c37a09716425984b509",
"score": "0.6024254",
"text": "def expired?\n lifetime_in_days = time_in_seconds(@lifetime)\n @born + lifetime_in_days < DateTime.now\n end",
"title": ""
},
{
"docid": "b44cdf16081578245184cb261e094647",
"score": "0.60111874",
"text": "def still_valid?\n if Time.now - self.Date < 7 * 24 * 3600 #7 days\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "73d6f30de28c57520b10ffe16710459b",
"score": "0.6008236",
"text": "def expired?\n Time.now > self.to_be_expired_at\n end",
"title": ""
},
{
"docid": "be952025872d5a8b19d8275a0ac216a1",
"score": "0.6006196",
"text": "def expired?(key)\n rec = @hash[key]\n !rec.nil? && rec[:start] < Time.now - rec[:lifetime]\n end",
"title": ""
},
{
"docid": "8d52457da9234cc303348fc84b6e1b32",
"score": "0.6003374",
"text": "def should_refresh?\n @certificates.nil? || @certificates.empty? || @certificates_expire_at < Time.now\n end",
"title": ""
},
{
"docid": "50170cb353144660d7ee1f8aa8714800",
"score": "0.5988233",
"text": "def expired?\n self.expires_at && Time.now > self.expires_at\n end",
"title": ""
},
{
"docid": "5130d26c36cea5ef9165b0c78b597b1d",
"score": "0.5987636",
"text": "def certificate_valid?\n return false if (certificates || []).count == 0\n certificates.each do |c|\n if Spaceship::Portal::Certificate.all(mac: mac?).collect(&:id).include?(c.id)\n return true\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "80ab4fabef32c6bc75c11db029493ffd",
"score": "0.5985166",
"text": "def access_expired? (time = Time.current)\n access_expires_at && time > access_expires_at\n end",
"title": ""
},
{
"docid": "5d07136ca873dd5b475a389f7eb93e94",
"score": "0.59830624",
"text": "def time_expired?\n (Time.now - @duration) > @start_time\n end",
"title": ""
},
{
"docid": "0d1312d1891cf6867a23ba4b1dcecf97",
"score": "0.59810704",
"text": "def valid_service_learning_waiver_on_file?\n return false if service_learning_risk_paper_date.nil?\n return false if Time.now - service_learning_risk_paper_date < 0 # in the future\n return false if Time.now - service_learning_risk_paper_date > ((eval(CONSTANTS[:service_learning_risk_lifetime]) rescue nil) || 3.months)\n true\n end",
"title": ""
},
{
"docid": "e0a7e2ce189f4d4e9aa07815bcb5b551",
"score": "0.5980837",
"text": "def expired?\n Time.now > self.deadline\n end",
"title": ""
},
{
"docid": "aef899cd9dfa91639ac5a7e317f223aa",
"score": "0.59770477",
"text": "def _update_check_needed\n (Time.now - @last_update_check) > UPDATE_VALID_PERIOD\n end",
"title": ""
},
{
"docid": "6fbd28f6d0cf4a7e8e5b1552955e9c89",
"score": "0.59745675",
"text": "def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end",
"title": ""
},
{
"docid": "faf87e564022c50bb1a1676bd5971ab6",
"score": "0.5970206",
"text": "def expired?\n DateTime.now.utc >= self.expires_at\n end",
"title": ""
},
{
"docid": "cd3e94ed725e3247645f2c8a7d489928",
"score": "0.59678334",
"text": "def expired?\n expires_at && Time.now > expires_at\n end",
"title": ""
},
{
"docid": "dd8b58eac7b245860f98f76a739bd658",
"score": "0.59594625",
"text": "def can_expire?\n return !!@expiry\n end",
"title": ""
},
{
"docid": "c520efbe4d1f65d7810203bb9b44239c",
"score": "0.59586084",
"text": "def expired?\n @expires_at <= Time.now\n end",
"title": ""
},
{
"docid": "6c90a3c92d0dbd4ac27c307d69d7f3f5",
"score": "0.595669",
"text": "def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end",
"title": ""
},
{
"docid": "fdd65d63b5550fdeea3ea36503517a29",
"score": "0.5955776",
"text": "def has_valid_date?\n self.time_event < Time.now.advance(days: 1)\n end",
"title": ""
},
{
"docid": "cb57c27485a2a16d6ba1f1bb42b060d6",
"score": "0.59512234",
"text": "def valid?(certificate_thumbprint)\n cert_validate(certificate_thumbprint)\n end",
"title": ""
},
{
"docid": "3c96bc4b09e2bf051fa7a5baef203bff",
"score": "0.59506047",
"text": "def expired?\n Time.now > @expiration if @expiration\n end",
"title": ""
},
{
"docid": "9b52115a9df6d96c9c46973ba45c720b",
"score": "0.595059",
"text": "def expired?\n return @expired\n end",
"title": ""
},
{
"docid": "703596a4919e9c58e17c9580ebec168e",
"score": "0.59465057",
"text": "def expired?\n return true if expires - Time.now <= 0\n return false\n end",
"title": ""
},
{
"docid": "7d1da7cbbf0c4e9406a1baac66e1948e",
"score": "0.594544",
"text": "def valid?\n return false if @event_time.nil?\n return true\n end",
"title": ""
},
{
"docid": "1cc17abbf1298ec430f2a46dc52c888b",
"score": "0.59430856",
"text": "def expired?\n expires? && (expires_at < Time.now.to_i)\n end",
"title": ""
},
{
"docid": "1126aa04b60a00701f748dfb577520e9",
"score": "0.5938729",
"text": "def expired?\n Time.now > expiration if expiration\n end",
"title": ""
},
{
"docid": "1a21bfe3304537c7a624389b70ae17b1",
"score": "0.5931574",
"text": "def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end",
"title": ""
},
{
"docid": "856226ee673c429d0f3f2b873f0ae896",
"score": "0.5929244",
"text": "def token_valid?(client_nonce, token)\n gen_time, _dontcare = encryptor(client_nonce).decode(token)\n\n time_diff = Time.now - Time.at(time_to_block(gen_time))\n time_diff < valid_interval && time_diff > 0\n rescue ArgumentError\n false\n end",
"title": ""
},
{
"docid": "46f617541b3df17794544eed1153d3a5",
"score": "0.59282404",
"text": "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end",
"title": ""
},
{
"docid": "46f617541b3df17794544eed1153d3a5",
"score": "0.59282404",
"text": "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end",
"title": ""
},
{
"docid": "11925babe16c1cd46cc3cf4b6cfdc51f",
"score": "0.5918886",
"text": "def check_deadline\n true\n end",
"title": ""
},
{
"docid": "716cfad4554fe1548f5e470986f2136b",
"score": "0.59161186",
"text": "def expired?\n return false if @expires_in.nil?\n @start_time + Rational(@expires_in - @refresh_timeout, 86400) < DateTime.now\n end",
"title": ""
},
{
"docid": "d566e7d99ff84d859a53a559c5899f8e",
"score": "0.59153223",
"text": "def expired?\n Time.current >= expires_at\n end",
"title": ""
},
{
"docid": "74789f275de2954010e62958f5a6988f",
"score": "0.5910809",
"text": "def expired?\n expiration_date <= Time.now\n end",
"title": ""
},
{
"docid": "42b5d93d84b4c5bff91049bba1d3cfba",
"score": "0.59067976",
"text": "def expired?\n self.expires_on? and self.expires_on < Time.now\n end",
"title": ""
},
{
"docid": "67c6b2d2e6df94038b9cb7cbf85f4a13",
"score": "0.59019727",
"text": "def expired?\n @expired\n end",
"title": ""
},
{
"docid": "dacf4944cd82fed4059a540577b7455c",
"score": "0.59012955",
"text": "def valid_at\n metadata[:valid_at]\n end",
"title": ""
},
{
"docid": "2ac4f655378def61f7376d97b56f57cd",
"score": "0.59004796",
"text": "def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end",
"title": ""
},
{
"docid": "2ac4f655378def61f7376d97b56f57cd",
"score": "0.59004796",
"text": "def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end",
"title": ""
},
{
"docid": "09fd689adac7d31bcadb488de6f3c052",
"score": "0.58951974",
"text": "def expired?\n end",
"title": ""
},
{
"docid": "8d591db8fba376773cf20fd98ce184d4",
"score": "0.58950657",
"text": "def expired?(now)\n @expires_at <= now\n end",
"title": ""
},
{
"docid": "728c79486cd6ce7ea28622e993c5ccfa",
"score": "0.58909327",
"text": "def expired?\n self.expired = false unless self.deadline > DateTime.now\n end",
"title": ""
},
{
"docid": "be14249632d3766ad2cc7f4416f10488",
"score": "0.5879179",
"text": "def check_if_expired\n return Graphics.frame_count > @expire_at\n end",
"title": ""
},
{
"docid": "0651ad4e5d51beba2a19f3668a133fb3",
"score": "0.5873959",
"text": "def key_validity_seconds(rnp_key)\n rnp_key.json[\"expiration\"]\n end",
"title": ""
},
{
"docid": "0bda3c2c6e0604ab51022f56461f2539",
"score": "0.58708847",
"text": "def expired?\n age > ttl\n end",
"title": ""
},
{
"docid": "0bda3c2c6e0604ab51022f56461f2539",
"score": "0.58708847",
"text": "def expired?\n age > ttl\n end",
"title": ""
},
{
"docid": "9193bdcb61146d81e2d501cfc4e0aba4",
"score": "0.58672845",
"text": "def is_expired?\n \t\n\tresult = false\n \t\t\n\tsubscription_count_services_ids = SounzService.subscription_count_services.map{|ss| ss.sounz_service_id}\n\t\t\n\tif (!self.expiry_date.blank? && self.expiry_date < Time.now) || ((subscription_count_services_ids.include?self.sounz_service_id) && self.loan_count.to_i < 1)\n\t result = true\n\tend\n \n\treturn result\n end",
"title": ""
},
{
"docid": "7636427b8265ba993210f538617f230f",
"score": "0.5866948",
"text": "def expired?\n !expires_at.nil? && Time.now >= expires_at\n end",
"title": ""
},
{
"docid": "adf5c244fd38d5245a2c544667c15dc0",
"score": "0.5837006",
"text": "def expiration_date_valid?\n expiration_date.is_a? Date\n end",
"title": ""
},
{
"docid": "d92d5313cdefcaa945335ce82e79c9fc",
"score": "0.5829835",
"text": "def has_time_to_solve?\n self.expires_at ? Time.now.utc + self.time_to_solve < self.expires_at : true\n end",
"title": ""
},
{
"docid": "d92d5313cdefcaa945335ce82e79c9fc",
"score": "0.5829835",
"text": "def has_time_to_solve?\n self.expires_at ? Time.now.utc + self.time_to_solve < self.expires_at : true\n end",
"title": ""
},
{
"docid": "ede1fc3326fa331e481e0dca216e6cec",
"score": "0.5827291",
"text": "def expired?\n DateTime.now > @expires\n end",
"title": ""
},
{
"docid": "beda4c6b942d2aac0028163b139c5132",
"score": "0.58258826",
"text": "def expired?\n expires? && (Time.now > expires_at)\n end",
"title": ""
},
{
"docid": "8201a9df542b581d49ab774657bc592e",
"score": "0.5822969",
"text": "def verified?\n verification_token.blank? && verified_at.present?\n end",
"title": ""
},
{
"docid": "9cf2f2a91ef53458b8c5588e8797f434",
"score": "0.5816781",
"text": "def expired?\n Time.now > @expires\n end",
"title": ""
},
{
"docid": "89c7d14bac392d3bf77c9aa397390d56",
"score": "0.5814587",
"text": "def expired?\n\n end",
"title": ""
}
] |
17a2ea4ef6d13e3acf10fea9076f52fd
|
line to distinguish exercise output 2. Write a method that accepts an array and then asked the user which number in the array they want and test with your months array So when a user inputs 8, they should get "September" Remember to change your input to an integer
|
[
{
"docid": "93c119d4add1d0c5021e952bb8afc172",
"score": "0.81521106",
"text": "def get_month_name(array)\r\n\tputs \"Choose a number from 0 to 12\"\r\n\tinput = $stdin.gets.chomp\r\n\tinput = input.to_i\r\n\r\n\tresult = case input\r\n\t\twhen 1..12 then array[input]\r\n\t\telse \"Not a valid month\"\r\n\tend\r\nend",
"title": ""
}
] |
[
{
"docid": "cf88a1aa197bb7bc9532e4a1abba8a3c",
"score": "0.7167459",
"text": "def getMonth()\n\tprint \"Enter a month (1 = Jan): \"\n\tretVal = gets().to_i()\n\t\n\tif (1..12).include?(retVal) then\n\t\treturn retVal;\n\telse\n\t\tputs \"Invalid. Month must be between 1 and 12. Got: #{retVal}\"\n\t\treturn getYear()\n\tend\nend",
"title": ""
},
{
"docid": "67c1d97d1e7a60f08d4f5ea4614b9505",
"score": "0.6706508",
"text": "def strMonthOf monthNumber\n monthArr = ['January', 'February', 'March', 'April',\n 'May', 'June', 'July', 'August',\n 'September', 'October', 'November', 'December']\n return monthArr[monthNumber - 1]\nend",
"title": ""
},
{
"docid": "7ffeb568837aedd66a1fc046c5736134",
"score": "0.66853005",
"text": "def shows_by_month\n puts \"Choose month by number, abbreviation, or name (1 = jan = january).\"\n\n month = gets.chomp\n month =~ /quit/i ? abort(\"Goodbye.\") : month = month_to_i(month)\n\n if Date.valid_date?(1999, month, 1)\n shows = CurtainCallSeattle::Show.get_shows_by_month(month)\n if shows.size > 0\n puts \"\"\n print_shows_with_index(shows)\n choose_show_description(shows)\n else\n puts \"No shows for that month\".colorize(:yellow)\n end\n\n else\n puts \"Sending you back to the previous choices.\"\n shows_by_date\n end\n\n shows_by_month\n end",
"title": ""
},
{
"docid": "20d0908b91bedb5ddfaf051f191e0457",
"score": "0.659884",
"text": "def birthMonth(month_test)\n\tmonths_array = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n\tputs \"What month were you born in?\"\n\tmonth = month_test\n\tif months_array.include?(month) == true\n\t\tmonth.class\n\telse\n\t\tfalse\n\tend\nend",
"title": ""
},
{
"docid": "3270ead01bbe8d4baf58b6f81ccd0a9f",
"score": "0.6493411",
"text": "def test_month_array_Jan_2013_Tuesday\n m = Month.new(1, 2013)\n expected = \"[ , , 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]\"\n assert_equal expected, m.create_month_string\n end",
"title": ""
},
{
"docid": "08459b714672692868548ab19cd8e7a4",
"score": "0.64280033",
"text": "def monthsYear(month)\n month_name = \"\"\n\n case month\n when \"jan\"\n month_name = \"January\"\n when \"feb\"\n month_name = \"february\"\n when \"march\"\n month_name = \"march\"\n when \"apr\"\n month_name = \"april\"\n when \"may\"\n month_name = \"may\"\n when \"jun\"\n month_name = \"june\"\n when \"july\"\n month_name = \"july\"\n when \"aug\"\n month_name = \"august\"\n when \"sep\"\n month_name = \"september\"\n when \"oct\"\n month_name = \"october\"\n when \"nov\"\n month_name = \"November\"\n when \"dec\"\n month_name = \"December\"\n else\n puts \"invalid month name\"\n end\nend",
"title": ""
},
{
"docid": "d361ea057cc7261142f5e87ac9dd7fe4",
"score": "0.6391204",
"text": "def calander(number)\r\n case number \r\n when 1\r\n return \"January\"\r\n when 2\r\n return \"Febuary\"\r\n when 3\r\n return \"March\"\r\n when 4\r\n return \"April\"\r\n when 5\r\n return \"May\"\r\n when 6\r\n return \"June\"\r\n when 7\r\n return \"July\"\r\n when 8 \r\n return \"August\"\r\n when 9\r\n return \"September\"\r\n when 10\r\n return \"October\"\r\n when 11\r\n return \"November\"\r\n when 12\r\n return \"December\"\r\n \r\nelse \r\n return \"invalid number\"\r\n end\r\n\r\nend",
"title": ""
},
{
"docid": "7a4f10e25c7cb999e06433c26cc6cd42",
"score": "0.6385901",
"text": "def cohort_validation(month)\n checks = [\"January\", \"February\",\"March\", \"April\", \"May\", \"June\",\n \"July\", \"August\", \"September\", \"October\", \"November\",\n \"December\", \"\"]\n until checks.include?(month) == true\n puts \"Please enter a valid month\"\n month = STDIN.gets.delete!(\"\\n\").capitalize\n end\n month\nend",
"title": ""
},
{
"docid": "5c7146d856481a6629a417f055a3edf3",
"score": "0.63840455",
"text": "def run\n new_month = Month.new(@month, @year)\n month_string = []\n new_month.padding.times do \n month_string << \" \"\n end\n \n if @month == FEB\n (1 .. new_month.feb?(@year)).each do |i|\n month_string << space_single(i)\n end\n else\n (1 .. MONTH_LENGTH[(MONTH_INDEX[zeller_offset(@month)- ZELLER_MONTH_OFFSET]).to_sym]).each do |i|\n month_string << space_single(i)\n end\n end\n return month_string\n end",
"title": ""
},
{
"docid": "d065685ebf09343d5ba4f713daeb6cbc",
"score": "0.6370209",
"text": "def test_maximum_month_and_year_to_input\n skip\n output = `./cal.rb 12 3000`\n expected = <<EOS\n December 3000\nSu Mo Tu We Th Fr Sa\n 1 2 3 4 5 6\n 7 8 9 10 11 12 13\n14 15 16 17 18 19 20\n21 22 23 24 25 26 27\n28 29 30 31\n\nEOS\n assert_equal expected, output\n end",
"title": ""
},
{
"docid": "7c9d18588396845e840df827116df066",
"score": "0.63500947",
"text": "def test_minium_month_and_year_to_input\n skip\n output = `./cal.rb 01 1800`\n expected = <<EOS\n January 1800\nSu Mo Tu We Th Fr Sa\n 1 2 3 4\n 5 6 7 8 9 10 11\n12 13 14 15 16 17 18\n19 20 21 22 23 24 25\n26 27 28 29 30 31\n\nEOS\n assert_equal expected, output\n end",
"title": ""
},
{
"docid": "31862563cc54f3ed7ff889baf6b7a3ca",
"score": "0.6326456",
"text": "def month(*args)\n raise ::ArgumentError, 'not an integer' unless args.all? { |arg| arg.is_a?(::Integer) }\n\n matching(*args, &:month)\n end",
"title": ""
},
{
"docid": "3b495e6dbd66d432495b052a13a676b2",
"score": "0.63082093",
"text": "def number_to_short_month_name(month_number)\n\n case month_number\n\n when 1\n first_month_string = \"Jan\"\n\n when 2\n second_month_string = \"Feb\"\n\n when 3\n third_month_string = \"Mar\"\n\n when 4\n fourth_month_string = \"Apr\"\n\n when 5\n fifth_month_string = \"May\"\n\n when 6\n sixth_month_string = \"Jun\"\n\n when 7\n seventh_month_string = \"Jul\"\n\n when 8\n eigth_month_string = \"Aug\"\n\n when 9\n ninth_month_string = \"Sep\"\n\n when 10\n tenth_month_string = \"Oct\"\n\n when 11\n eleventh_month_string = \"Nov\"\n\n when 12\n twelfth_month_string = \"Dec\"\n\n else\n result = \"Enter a number between 1-12\"\n end\nend",
"title": ""
},
{
"docid": "8a3df745edbef7780009c38e745579ed",
"score": "0.62741727",
"text": "def number_to_full_month_name(month)\n\nif(month ==1)\n month = \"January\"\nelsif (month == 3)\n month =\"March\"\nelsif(month == 9)\n month = \"September\"\n end\nreturn month\nend",
"title": ""
},
{
"docid": "aeb3f5750eab271e4ca05e81846a7fd6",
"score": "0.6250748",
"text": "def what_month(number)\n number = number.to_s\n months = {\n \"1\" => \"January\", \n \"2\" => \"February\",\n \"3\" => \"March\", \n \"4\" => \"April\", \n \"5\" => \"May\", \n \"6\" => \"June\", \n \"7\" => \"July\", \n \"8\" => \"August\", \n \"9\" => \"September\", \n \"10\" => \"October\", \n \"11\" => \"November\", \n \"12\" => \"December\"\n }\n return months[number] \n end",
"title": ""
},
{
"docid": "751f1c9905834ffd7dbb8946c6799b3f",
"score": "0.6235712",
"text": "def choose_month_for(parcel_number)\n months = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]\n index = @beginning_month - 1 + parcel_number\n if index >= 12\n months[index - 12]\n else\n months[index]\n end\n end",
"title": ""
},
{
"docid": "b2c788fb950a56acbeff53f6b8a987d4",
"score": "0.62247455",
"text": "def test_month_of_january\n skip\n output = `./cal.rb 01 2011`\n expected = <<EOS\n January 2011\nSu Mo Tu We Th Fr Sa\n 1\n 2 3 4 5 6 7 8\n 9 10 11 12 13 14 15\n16 17 18 19 20 21 22\n23 24 25 26 27 28 29\n30 31\n\nEOS\n assert_equal expected, output\n end",
"title": ""
},
{
"docid": "5d4868b78b68554e3b3ce4d4af046926",
"score": "0.6184853",
"text": "def get_month(month)\n if month == 1\n return \"Jan\"\n elsif month == 2\n return \"Feb\"\n elsif month == 3\n return \"Mar\"\n elsif month == 4\n return \"Apr\"\n elsif month == 5\n return \"May\"\n elsif month == 6\n return \"Jun\"\n elsif month == 7\n return \"Jul\"\n elsif month == 8\n return \"Aug\"\n elsif month == 9\n return \"Sep\"\n elsif month == 10\n return \"Oct\"\n elsif month == 11\n return \"Nov\"\n else\n return \"Dec\"\n end\n end",
"title": ""
},
{
"docid": "efecd59ea273e4e12ed030fd4403986a",
"score": "0.61624295",
"text": "def number_to_full_month_name(result)\n\ncase result\n when 1\n p \"January\"\n when 3\n p \"March\"\n when 9\n p \"September\"\nend\nend",
"title": ""
},
{
"docid": "912242b9090a1cfa20578612cf242140",
"score": "0.61390185",
"text": "def test_should_return_month_as_array_index\n assert_equal Month[3], Month.march\n end",
"title": ""
},
{
"docid": "30b0ec61d6f67e32d34ca6c62764f2c4",
"score": "0.6106416",
"text": "def shows_by_date\n\n puts \"1. Shows by month?\"\n puts \"2. Shows playing in a date range?\"\n\n input = gets.chomp\n\n case input\n when \"1\"\n shows_by_month\n when \"2\"\n shows_by_date_range\n when /quit/i\n abort (\"Goodbye.\")\n else\n start\n end\n\n end",
"title": ""
},
{
"docid": "cb50aa32a495b165382b9d6f441acfa7",
"score": "0.60943145",
"text": "def month\n { 1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul',\n 8 => 'Aug', 9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec' }\nend",
"title": ""
},
{
"docid": "aa7cd9ee3c930320c5ea0664a0a34916",
"score": "0.608883",
"text": "def month(input) = (day_of_year(input) - 1) / 30 + 1",
"title": ""
},
{
"docid": "92ee18f715827bba65f63b63e651713f",
"score": "0.60747844",
"text": "def get_cohort\n months = [:January, :February, :March, :April, :May, :June, :July, :August,\n :September, :October, :November, :December]\n\n puts \"Please enter the cohort you will be joining\".center(65)\n cohort = gets.chomp.to_sym.capitalize\n\n if !cohort.empty? && months.include?(cohort)\n return cohort\n elsif !cohort.empty? && !months.include?(cohort)\n puts \"Please enter a valid cohort\".center(65)\n cohort = gets.chomp.to_sym.capitalize\n elsif cohort.empty?\n cohort = :November\n end\n cohort\nend",
"title": ""
},
{
"docid": "7571d46d75ead22bf677fa505363a766",
"score": "0.6074551",
"text": "def cohort_display\n puts \"Do you want to select which cohort is displayed? Y/N\".center(@margins)\n puts \"If you don't, all of them will be displayed\".center(@margins)\n option = STDIN.gets.chomp\n #if yes, select a month\n if option.upcase == \"Y\"\n return [input_cohort]\n #if no, return the sorted array\n elsif option.upcase == \"N\"\n return @choosen_cohort\n #else, goes to the previous step\n else\n puts \"Wrong argument, try again\"\n cohort_display\n end\nend",
"title": ""
},
{
"docid": "d2a6e39f6850398c45e3cdd6c01194f1",
"score": "0.6073998",
"text": "def test_08_month_layout\n cal = Month.new(9,2012)\n layout = []\n layout << \" September 2012 \"\n layout << \"Su Mo Tu We Th Fr Sa\"\n layout << \" 1\"\n layout << \" 2 3 4 5 6 7 8\"\n layout << \" 9 10 11 12 13 14 15\"\n layout << \"16 17 18 19 20 21 22\"\n layout << \"23 24 25 26 27 28 29\"\n layout << \"30\"\n assert_equal(layout,cal.print_month)\n end",
"title": ""
},
{
"docid": "6981ecb2be0d61e531dbe2a00ed6f92e",
"score": "0.60577524",
"text": "def enter_student_cohort\n puts 'Enter cohort, default is January'\n cohort = ''\n months = %w[january february march april may june july august september october november december]\n while cohort == '' do\n input = STDIN.gets.chomp.downcase\n if months.include?(input)\n return input\n elsif input == ''\n return 'january'\n else\n puts 'Month has typo, try again'\n end\n end\nend",
"title": ""
},
{
"docid": "e9c9b3da6599818677eae7fb023521f8",
"score": "0.6015392",
"text": "def months; end",
"title": ""
},
{
"docid": "e9c9b3da6599818677eae7fb023521f8",
"score": "0.6015392",
"text": "def months; end",
"title": ""
},
{
"docid": "f150707054af2efbeed907e97b237eab",
"score": "0.60114324",
"text": "def get_cohort\n months = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\"]\n while true\n puts \"What is their cohort?\"\n cohort = STDIN.gets.chomp\n if cohort == \"\"\n cohort = :november\n break\n elsif months.include?(cohort)\n cohort = cohort.to_sym\n break\n else\n puts \"Please try that again\"\n end\n end\n cohort\nend",
"title": ""
},
{
"docid": "d26c99aba9b69647ae0092fa89207d27",
"score": "0.60077864",
"text": "def italian_month(x)\n case x\n when 1\n return 'gennaio'\n when 2\n return 'febbraio'\n when 3\n return 'marzo'\n when 4\n return 'aprile'\n when 5\n return 'maggio'\n when 6\n return 'giugno'\n when 7\n return 'luglio'\n when 8\n return 'agosto'\n when 9\n return 'settembre'\n when 10\n return 'ottobre'\n when 11\n return 'novembre'\n when 12\n return 'dicembre'\n else\n return ''\n end\n end",
"title": ""
},
{
"docid": "07cabb60556588eef27d234aad3abdcb",
"score": "0.59936774",
"text": "def number_to_short_month_name(month)\n if(month ==1)\n month = \"Jan\"\nelsif (month == 4)\n month =\"Apr\"\nelsif (month == 10)\n month = \"Oct\"\nend\nreturn month\nend",
"title": ""
},
{
"docid": "239e488acd3f86e6acb477e783cb7827",
"score": "0.5987644",
"text": "def month_word(m)\n case m\n when 1\n \"Jan\"\n when 2\n \"Feb\"\n when 3\n \"Mar\"\n when 4 \n \"Apr\"\n when 5 \n \"May\"\n when 6 \n \"Jun\"\n when 7 \n \"Jul\"\n when 8 \n \"Aug\"\n when 9 \n \"Sep\"\n when 10 \n \"Oct\"\n when 11\n \"Nov\"\n when 12\n \"Dec\"\n else\n \"\"\n end\n end",
"title": ""
},
{
"docid": "f2d4224e81b544be2f58a854cedf2b88",
"score": "0.59398913",
"text": "def get_calendar_for_month_year(month, year)\n puts \" \"+get_month_name_and_number(month)+\" \"+year\nend",
"title": ""
},
{
"docid": "3f1017f8ae7758a3a86bf695c04b8ba9",
"score": "0.59360194",
"text": "def getMonth(value)\n\t\tmonths = [\"Begin\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n\t\tif value > 0 and value < 13\n\t\t\treturn months[value]\n\t\telse\n\t\t\treturn \"Unknown Month\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "baca5295006b8b729d7a18dd6608ed17",
"score": "0.59258884",
"text": "def valid_month?(month)\n if month < 1 || month > 12\n incorrect_selection\n end\n end",
"title": ""
},
{
"docid": "31ce065eb187c779de195bd5a44d507f",
"score": "0.59188265",
"text": "def number_to_short_month_name(month_num)\n if (month_num == 1)\n return \"Jan\"\n elsif (month_num == 4)\n return \"Apr\"\n elsif (month_num == 10)\n return \"Oct\"\n\n end\nend",
"title": ""
},
{
"docid": "05ad5e8f388fbc932f4baa9437570f8e",
"score": "0.5890611",
"text": "def number_to_full_month_name(month_number)\n case month_number\n when 1\n return \"January\"\n when 2\n return \"February\"\n when 3\n return \"March\"\n when 4\n return \"April\"\n when 5\n return \"May\"\n when 6\n return \"June\"\n when 7\n return \"July\"\n when 8\n return \"August\"\n when 9\n return \"September\"\n when 10\n return \"October\"\n when 11\n return \"November\"\n when 12\n return \"December\"\n else\n return \"This number is not valid\"\n end\nend",
"title": ""
},
{
"docid": "6f512cf46c451f1d515695d4b9750c4b",
"score": "0.5884291",
"text": "def month; end",
"title": ""
},
{
"docid": "6f512cf46c451f1d515695d4b9750c4b",
"score": "0.5884291",
"text": "def month; end",
"title": ""
},
{
"docid": "6f512cf46c451f1d515695d4b9750c4b",
"score": "0.5884291",
"text": "def month; end",
"title": ""
},
{
"docid": "08f3bcbd55b5edde72dd22afe16ab884",
"score": "0.5868811",
"text": "def add_cohort\n cohort_arr = {1 => :January, 2 => :February, 3 => :March, 4 => :April, 5 => :May, \n 6 => :June, 7 => :July, 8 => :August, 9 => :Septmeber, 10 => :October, 11 => :November, 12 => :December, 13 => :tbc}\n puts \"Enter month (1 to 12) of the cohort to join: \"\n num = gets.strip.to_i\n if cohort_arr.has_key?num\n cohort = cohort_arr[num]\n else\n puts \"\\nYou made a typo. Default cohort 'tbc' assigned.\"\n cohort = cohort_arr[13]\n end\n cohort\nend",
"title": ""
},
{
"docid": "846aa138de31b2358b0c6cb42b607811",
"score": "0.58684266",
"text": "def gather_cohort\n puts \"#{@name}'s cohort:\"\n @cohort = STDIN.gets.chomp.capitalize.to_sym\n @cohort = :November if @cohort.empty?\n until @months.include? @cohort\n puts \"Please enter a valid month\"\n @cohort = STDIN.gets.chomp.capitalize.to_sym\n end\nend",
"title": ""
},
{
"docid": "8310f96e781f49103b3f405394507687",
"score": "0.586685",
"text": "def months; Integer.new(to_h[:mo] * (to_h[:si] ? -1 : 1)); end",
"title": ""
},
{
"docid": "0e00130c4069221752e5db8a63489a16",
"score": "0.5857261",
"text": "def get_cohort_info\n puts \"Student's cohort:\"\n cohort = STDIN.gets.chomp\n # if no cohort was entered then default meaning is November\n if cohort.empty?\n cohort = \"November\"\n end\n # checks that cohort is a month (12 possible months)\n until [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"].include? cohort do\n puts \"You have mispelled the month of student's cohort, please enter on of the following months (spelling matters) - January, February, March, April, May, June, July, August, September, October, November, December, or empty string to assign it to November: \"\n cohort = STDIN.gets.chomp\n # user can enter empty input to assign cohort to November (default)\n if cohort.empty?\n return cohort = \"November\"\n end\n end\n return cohort\nend",
"title": ""
},
{
"docid": "82215ebba9204f08091f70858b01917b",
"score": "0.5851509",
"text": "def get_month(month_number)\n return Date::MONTHNAMES[month_number]\nend",
"title": ""
},
{
"docid": "2844e104b28a07908512fd679d8e1fde",
"score": "0.58486176",
"text": "def number_to_full_month_name(num)\n month_name = \"\"\n# or return\n case num\n when 1\n month_name = \"January\"\n when 2\n month_name = \"February\"\n when 3\n month_name = \"March\"\n when 9\n month_name = \"September\" \n end\n\n return month_name\nend",
"title": ""
},
{
"docid": "3788443841a58692c2a7bd820da0a2de",
"score": "0.5845968",
"text": "def standardize_month\n unless params[\"month\"].nil?\n params[\"month\"] = params[\"month\"].split(\",\").map(&:to_i)\n end\n end",
"title": ""
},
{
"docid": "0eb34b84455592cf69565ec2dc6d6fb4",
"score": "0.58442104",
"text": "def month= num\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "9fe6c8e6539f87b8506176c7bf9fdcae",
"score": "0.5840024",
"text": "def list_all_months(*a)\r\n\ta.each do |a|\r\n\t\t\"#{a}\"\r\n\tend\r\nend",
"title": ""
},
{
"docid": "cbaa40a69f67034f2fbdb8841bbf0e69",
"score": "0.58363473",
"text": "def input_students\n students = []\n months = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n \n while true\n puts \"Please enter the name of the student\"\n name = gets.chomp\n puts \"Please enter the cohort month\"\n input = gets.chomp.capitalize\n cohort = input.length > 0 ? input : \"November\"\n while !months.include?(cohort)\n puts \"Enter a valid month\"\n cohort = gets.chomp.capitalize\n end\n students << {name: name, cohort: cohort.to_sym}\n puts \"Now we have #{students.count} students\" if students.count > 1\n puts \"Now we have #{students.count} student\" if students.count == 0\n puts \"Would you like to enter another student? (y/n)\"\n choice = gets.chomp\n break if choice == \"n\"\n end\n\n students\nend",
"title": ""
},
{
"docid": "91341568f5430a2754bf90d63bfce940",
"score": "0.5821683",
"text": "def age_to_months\n puts \"Whats your age in years\"\n years = gets.chomp.to_i\n puts \"You are #{years * 12} months old.\"\nend",
"title": ""
},
{
"docid": "a8d8eb8bfea2f460fde265e665d53809",
"score": "0.58070683",
"text": "def english_month(x)\n case x\n when 1\n return 'January'\n when 2\n return 'February'\n when 3\n return 'March'\n when 4\n return 'April'\n when 5\n return 'May'\n when 6\n return 'June'\n when 7\n return 'July'\n when 8\n return 'August'\n when 9\n return 'September'\n when 10\n return 'October'\n when 11\n return 'November'\n when 12\n return 'December'\n else\n return ''\n end\n end",
"title": ""
},
{
"docid": "5f89401244a31985b5c5eaf699233861",
"score": "0.5804866",
"text": "def number_to_short_month_name(number)\n case\n when number == 1\n return \"Jan\"\n when number == 4\n return \"Apr\"\n when number == 10\n return \"Oct\"\n end\nend",
"title": ""
},
{
"docid": "e529752fa2717c4f538a6d1c45c36987",
"score": "0.57984996",
"text": "def check_report(a, b)\n if (a - 1) == b\n 'month_selected'\n else\n 'month_plain'\n end \n end",
"title": ""
},
{
"docid": "aef22215f67e25ad10efab62ba038eb0",
"score": "0.5788176",
"text": "def capital_expenditure_month(month=nil,year=nil)\n capital_expenditure_sub_method('month')\n end",
"title": ""
},
{
"docid": "f875b350b1235d833e403565a48d620b",
"score": "0.57874507",
"text": "def set_month(month)\n case month\n when \"01\"\n month = \"January\"\n when \"02\"\n month = \"February\"\n when \"03\"\n month = \"March\"\n when \"04\"\n month = \"April\"\n when \"05\"\n month = \"May\"\n when \"06\"\n month = \"June\"\n when \"07\"\n month = \"July\"\n when \"08\"\n month = \"August\"\n when \"09\"\n month = \"September\"\n when \"10\"\n month = \"October\"\n when \"11\"\n month = \"November\"\n when \"12\"\n month = \"December\"\n end \n \n end",
"title": ""
},
{
"docid": "5cd0bd1d9f0124f06a14127c011900d1",
"score": "0.5783754",
"text": "def parse_month(month)\n lower = month.downcase\n if lower =~ /^jan/\n @month = 1\n elsif lower =~ /^feb/\n @month = 2\n elsif lower =~ /^mar/\n @month = 3\n elsif lower =~ /^apr/\n @month = 4\n elsif lower =~ /^may/\n @month = 5\n elsif lower =~ /^jun/\n @month = 6\n elsif lower =~ /^jul/\n @month = 7\n elsif lower =~ /^aug/\n @month = 8\n elsif lower =~ /^sep/\n @month = 9\n elsif lower =~ /^oct/\n @month = 10\n elsif lower =~ /^nov/\n @month = 11\n elsif lower =~ /^dec/\n @month = 12\n else\n raise \"Invalid month: #{month}\"\n end\n end",
"title": ""
},
{
"docid": "d826dbe101502c0a9ac35bb2f488340e",
"score": "0.577658",
"text": "def nextTerm(input)\n\n tmpMonth = input.month\n if (tmpMonth >= 1 && tmpMonth <=5)\n \"Summer \" + input.year.to_s\n else if (tmpMonth >=6 && tmpMonth <=8)\n \"Fall \" + input.year.to_s\n else if (tmpMonth >=9 && tmpMonth <=12)\n \"Winter \" + (input.year + 1).to_s\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b43f6f36274732dfb56dda902631747c",
"score": "0.57752514",
"text": "def not_month(*args)\n raise ::ArgumentError, 'not an integer' unless args.all? { |arg| arg.is_a?(::Integer) }\n\n not_matching(*args, &:month)\n end",
"title": ""
},
{
"docid": "f67b6e4cf1909bf04529367fe40166f9",
"score": "0.57702446",
"text": "def input_students\n students = []\n months = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\n \n while true\n puts \"Please enter the name of the student\"\n name = gets.strip\n puts \"Please enter the cohort month\"\n input = gets.strip.capitalize\n cohort = input.length > 0 ? input : \"November\"\n while !months.include?(cohort)\n puts \"Enter a valid month\"\n cohort = gets.strip.capitalize\n end\n students << {name: name, cohort: cohort.to_sym}\n puts \"Now we have #{students.count} students\" if students.count > 1\n puts \"Now we have #{students.count} student\" if students.count == 0\n puts \"Would you like to enter another student? (y/n)\"\n choice = gets.strip\n break if choice == \"n\"\n end\n\n students\nend",
"title": ""
},
{
"docid": "9878d1ccfedc51823c0184a842de2157",
"score": "0.57673013",
"text": "def month\n return if release.size < 5\n Date.strptime(release, '%Y-%m').month\n end",
"title": ""
},
{
"docid": "8e4e8653b0aabbfe86eca273638a3690",
"score": "0.57661766",
"text": "def number_to_full_month_name(month_num)\nmonth = month_num\ncase month\n when 1\n return \"January\"\n when 3\n return \"March\"\n when 9\n return \"September\"\n end\nend",
"title": ""
},
{
"docid": "b82800ca8667aa3df9d5392561b5f98e",
"score": "0.57514554",
"text": "def month_list\n\t\tmonth_list = Array.new\n\t\tmonth_list[0] = [\"1\", \"Jan\"]\n\t\tmonth_list[1] = [\"2\", \"Feb\"]\n\t\tmonth_list[2] = [\"3\", \"Mar\"]\n\t\tmonth_list[3] = [\"4\", \"Apr\"]\n\t\tmonth_list[3] = [\"5\", \"May\"]\n\t\tmonth_list[3] = [\"6\", \"Jun\"]\n\t\tmonth_list[3] = [\"7\", \"Jul\"]\n\t\tmonth_list[3] = [\"8\", \"Aug\"]\n\t\tmonth_list[3] = [\"9\", \"Sep\"]\n\t\tmonth_list[3] = [\"10\", \"Oct\"]\n\t\tmonth_list[3] = [\"11\", \"Nov\"]\n\t\tmonth_list[3] = [\"12\", \"Dec\"]\n\n\t\tmonth_list\n\t\t#will return array like this [[\"Mr\", \"Mr\"], [\"Ms\", \"Ms\"], [\"Mrs\", \"Mrs\"]] \n\tend",
"title": ""
},
{
"docid": "2c4152a3214383553f8c8705e03da3d7",
"score": "0.5749524",
"text": "def adjustMonth(matrix,column)\n\n matrix.each{|key,array|\n case array[column]\n when \"jan\"\n array[column] = 1\n when \"feb\"\n array[column] = 2\n when \"mar\"\n array[column] = 3\n when \"apr\"\n array[column] = 4\n when \"may\"\n array[column] = 5\n when \"jun\"\n array[column] = 6 \n when \"jul\"\n array[column] = 7\n when \"aug\"\n array[column] = 8\n when \"sep\"\n array[column] = 9\n when \"oct\"\n array[column] = 10\n when \"nov\"\n array[column] = 11\n when \"dec\"\n array[column] = 12\n end\n }\n return matrix\nend",
"title": ""
},
{
"docid": "ac7ee3f6c3709d2632da225ea7d98df1",
"score": "0.5737721",
"text": "def month\n end",
"title": ""
},
{
"docid": "ac7ee3f6c3709d2632da225ea7d98df1",
"score": "0.5737721",
"text": "def month\n end",
"title": ""
},
{
"docid": "2a7128ade7fba7bb9810b09be458f8d2",
"score": "0.57357204",
"text": "def month_choices(month_names = settings.default_month_names)\n month_names.map.\n with_index { |month, idx| [month, idx] }.\n tap { |arr| arr.shift }\n end",
"title": ""
},
{
"docid": "2a7128ade7fba7bb9810b09be458f8d2",
"score": "0.57357204",
"text": "def month_choices(month_names = settings.default_month_names)\n month_names.map.\n with_index { |month, idx| [month, idx] }.\n tap { |arr| arr.shift }\n end",
"title": ""
},
{
"docid": "0920503f2b82385cf02206bae67332b0",
"score": "0.57284963",
"text": "def bimonth\n case month\n when (1..2)\n 1\n when (3..4)\n 2\n when (5..6)\n 3\n when (7..8)\n 4\n when (9..10)\n 5\n when (11..12)\n 6\n end\n end",
"title": ""
},
{
"docid": "b48208e608dcf2a277c02b51b45c7c27",
"score": "0.57250106",
"text": "def month(code)\n # We use the helper method from 'date' to give us the month name as a string\n return Date::MONTHNAMES[code.to_i]\nend",
"title": ""
},
{
"docid": "e2ab226ae71627bc75f84f434ab09b0a",
"score": "0.57205445",
"text": "def display(month = \"\", year = \"\", data = [])\n\t\t\t\n\t\t\tif month = \"\" || month.is_a?\n\t\t\t\tmonth = Time.now.month\n\t\t\tend\n\t\t\t\n\t\t\tif year == \"\" || year.is_a?\n\t\t\t\tyear = Time.now.year\n\t\t\tend\n\t\t\t\n\t\t\tif month.size == 1\n\t\t\t\tmonth = \"0#{month}\"\n\t\t\tend\n\t\t\t\n\t\t\tif year.size == 1\n\t\t\t\tyear = \"200#{year}\"\n\t\t\telsif year.size == 2\n\t\t\t\tyear = \"20#{year}\"\n\t\t\tend\n\t\t\t\n\t\t\tajusted_days = ajust_date(month, year)\n\t\t\tmonth = ajusted_days[:month]\n\t\t\tyear = ajusted_days[:year]\n\t\t\t# Total days in a month\n\t\t\tnumber_of_days = total_days(month, year)\n\t\t\t\n\t\t\t# Set the starting day of the week\n\t\t\t\n\t\t\tstart_days = {:sunday => 0, :monday => 1, :tuesday => 2, :wednesday => 3, :thursday => 4, :friday => 5, :saturday => 6}\n\t\t\t\n\t\t\tstart_day = start_days[@start_day].nil? ? 0 : start_days[@start_day]\n\t\t\t\n\t\t\t# Set the starting day number\n\t\t\tdate = Time.mktime(Time.now.year, Time.now.month, 1, 12, 0, 0) # Time.local(Time.now.year, Time.now.month, 12)\n\t\t\tday = start_day + 1 - date.wday\n\t\t\t\n\t\t\twhile day > 1\n\t\t\t\tday -= 7\n\t\t\tend\n\t\t\t\n\t\t\tcurrent_year = Time.now.year\n\t\t\tcur_month = Time.now.month\n\t\t\tcurrent_day = Time.now.day\n\t\t\t\n\t\t\tcurrent_month = (current_year == year && cur_month == month) ? true : false\n\t\t\t\n\t\t\t@temp = @template == \"\" ? default_template : @template # Generating the template data array\n\t\t\t\n\t\t\t# Build the table\n\t\t\tout = \"#{@temp['table-open']}\"\n\t\t\t\n\t\t\tout += \"#{@temp['heading-row-start']}\\n\"\n\t\t\t\n\t\t\t# previous month link\n\t\t\t\n\t\t\tif @next_prev\n\t\t\t\t@next_prev_url = @next_prev_url.gsub(\"/(.+?)\\\\*$/\", \"\\\\1/\")\n\t\t\n\t\t\t\taj_date = ajust_date(month - 1, year)\n\t\t\t\tout += @temp['heading-previous-cell'].gsub(\"{previous-url}\", \"#{@next_prev_url}#{aj_date[:year]}-#{aj_date[:month]}\\n\")\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\t\t# Heading containing the month/year\n\t\t\tcol_span = @show_next_prev ? 5 : 7\n\t\t\t\n\t\t\t@temp[\"heading-title-cell\"] = @temp[\"heading-title-cell\"].gsub(\"{colspan}\", col_span.to_s)\n\t\t\t@temp[\"heading-title-cell\"] = @temp[\"heading-title-cell\"].gsub(\"{heading}\", \"#{month_name(month).to_s} #{year.to_s}\")\n\t\t\t\n\t\t\tout += \"#{@temp[\"heading-title-cell\"]}\\n\"\n\t\t\t\n\t\t\t# next month link\n\t\t\t\n\t\t\tif @show_next_prev\n\t\t\t\t@next_prev_url = @next_prev_url.gsub(\"/(.+?)\\\\*$/\", \"\\\\1/\")\n\t\t\t\t\n\t\t\t\taj_date = ajust_date(month + 1, year)\n\t\t\t\tout += @temp['heading-next-cell'].gsub(\"{next-url}\", \"#{@next_prev_url}#{aj_date[:year]}-#{aj_date[:month]}\\n\")\n\t\t\tend\n\t\t\t\n\t\t\tout += \"\\n#{@temp['heading-row-end']}\\n\"\n\t\t\t\n\t\t\t# Write the cells containging the days of the week\n\t\t\t\n\t\t\tout += \"\\n#{@temp['week-row-start']}\\n\"\n\t\t\t\n\t\t\tdays_names = name_of_the_days()\n\t\t\t\n\t\t\t7.times do | i |\n\t\t\t\tout += @temp['week-day-cell'].gsub(\"{week-day}\", days_names[(start_day + i) % 7])\n\t\t\tend\n\t\t\t\n\t\t\tout += \"\\n#{@temp['week-row-end']}\\n\"\n\t\t\t\n\t\t\t# Build the main body of the calendar\n\t\t\t\n\t\t\twhile day <= number_of_days \n\t\t\t\t\n\t\t\t\tout += \"\\n#{@temp['cal-row-start']}\\n\"\n\t\t\t\t\n\t\t\t\t7.times do | i |\n\t\t\t\t\tout += current_month && day == current_day ? @temp['cal-cell-start-today'] : @temp['cal-cell-start']\n\t\t\t\t\t\n\t\t\t\t\tif day > 0 && day <= number_of_days\n\t\t\t\t\t\tif data[day]\n\t\t\t\t\t\t\t# cell with content\n\t\t\t\t\t\t\ttemp = current_month && day == current_day ? @temp['cal-cell-content-today'] : @temp['cal-cell-content']\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# if there is more than on event per day\n\t\t\t\t\t\t\tif data[day].is_a?(Array)\n\t\t\t\t\t\t\t\tmore_events = \"\"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdata[day].each do | key |\n\t\t\t\t\t\t\t\t\tmore_events += \"<p class=\\\"more\\\">• #{key}</p>\"\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\tout += temp.gsub(\"{day}\", day.to_s).gsub(\"{content}\", more_events)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tout += temp.gsub(\"{day}\", day.to_s).gsub(\"{content}\", data[day].to_s)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t# cell with no content\n\t\t\t\t\t\t\ttemp = current_month && day == current_day ? @temp['cal-cell-no-content-today'] : @temp['cal-cell-no-content'] \n\t\t\t\t\t\t\tout += temp.gsub(\"{day}\", day.to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tout += @temp['cal-cell-blank'] # blank cells\n\t\t\t\t\tend\n\t\t\t\t\tout += current_month && day == current_day ? \"#{@temp['cal-cell-end-today']}\" : \"#{@temp['cal-cell-end']}\"\n\t\t\t\t\tday = day + 1\n\t\t\t\tend\n\t\t\t\tout += \"\\n#{@temp['cal-row-end']}\\n\"\n\t\t\tend\n\t\t\tout += \"\\n#{@temp['table-close']}\"\n\t\tend",
"title": ""
},
{
"docid": "ee4b426b6392d61a203c834caa944aee",
"score": "0.57125205",
"text": "def january?\n month == \"January\"\n end",
"title": ""
},
{
"docid": "b70a95d3d27d1731b8fa9c84e39fb60d",
"score": "0.5706777",
"text": "def number_to_full_month_name(n)\n n = n - 1\n month = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"]\nreturn month[n]\nend",
"title": ""
},
{
"docid": "e598866f87a9efbdfa8e33cf6e6a9a6d",
"score": "0.5702752",
"text": "def december?\n month == \"December\"\n end",
"title": ""
},
{
"docid": "6c314b0fce03f19ad55de6c0925d3407",
"score": "0.5696071",
"text": "def total_month_input_output(year, month)\n total_month_input(year, month) + total_month_output(year, month)\n end",
"title": ""
},
{
"docid": "d18ec2a6735ed54461d6542fb74a25a0",
"score": "0.5695046",
"text": "def number_to_full_month_name(number)\n return case number\n when 1\n \"January\"\n when 3\n \"March\"\n when 4\n \"April\"\n when 9\n \"September\"\n when 10\n \"October\"\n end\nend",
"title": ""
},
{
"docid": "8de268d97a35f732065027ca0307a49a",
"score": "0.5692435",
"text": "def input_students\n puts \"Please enter the name and cohort of each student\"\n puts \"To finish, just hit return twice\"\n name = gets.chomp\n # create an empty array\n students = []\n # cohort defaults to July is user doesn't enter a month \n \n # while the name is not empty, repeat this code\n while !name.empty? do # As long as the user enters input\n puts \"Please enter the student's cohort\" \n cohort = gets.chomp\n cohort = \"march\" if cohort == \"\"\n puts \"Please enter a valid month\" if cohort != /\"january|January|february|February|\n March|march|April|april|May|may|June|june|July|july|August|august|September|september|October|\n october|November|november|December|december\"/\n # add the student hash to the array\n students << {name: name, cohort: cohort.to_sym}\n if students.count == 1\n puts \"Now we have #{students.count} student\"\n puts \"Please enter the name of the student\"\n puts \"To finish, just hit return twice\"\n elsif students.count > 1\n puts \"Now we have #{students.count} students\"\n puts \"Please enter the name of the student\"\n puts \"To finish, just hit return twice\"\n end\n # get another name from the user\n name = gets.chomp \n end\n # return the array of students\n students\nend",
"title": ""
},
{
"docid": "82d7189f3ad9fd6f02080cbbf12c7354",
"score": "0.5687276",
"text": "def verifyStrMonth strMonth\n monthArr = ['january', 'february', 'march', 'april',\n 'may', 'june', 'july', 'august',\n 'september', 'october', 'november', 'december']\n index = monthArr.index(strMonth.downcase)\n return index + 1 if index != nil\n return 0\nend",
"title": ""
},
{
"docid": "de90339600108596e49403bb4c13f668",
"score": "0.56780714",
"text": "def applicable_month?(current_date, time_diff)\n case self.month\n # every.2.months\n when /\\Aevery\\.(\\d+)\\.months?\\z/i\n return true if time_diff[:month] % $1.to_i == 0\n\n # jun\n when /\\A(#{MONTHS.join('|')})\\z/i\n return true if (Rule::MONTHS.index($1) + 1) == current_date.month\n\n # jun-sep\n when /\\A(#{MONTHS.join('|')})-(#{MONTHS.join('|')})\\z/i\n return true if current_date.month.between?(Rule::MONTHS.index($1) + 1, Rule::MONTHS.index($2) + 1)\n\n # every.2.months\n when /\\Aevery\\.(\\d+)\\.months?\\z/i\n if self.month && !self.month.empty?\n return true if time_diff[:month] % $1.to_i == 0\n else\n return true\n end\n\n # month.4\n when /\\Amonth\\.(\\d+)\\z/i\n if self.month && !self.month.empty?\n return true if time_diff[:month] == $1.to_i\n else\n return true\n end\n\n # month.4-month.6\n when /\\Amonth\\.(\\d+)-month\\.(\\d+)\\z/i\n if self.month && !self.month.empty?\n return true if time_diff[:month] >= $1.to_i and time_diff[:month] <= $2.to_i\n else\n return true\n end\n\n # 1\n when /\\A(\\d+)\\z/i\n if self.month && !self.month.empty?\n return true if time_diff[:month] == $1.to_i\n else\n return true\n end\n\n # 2015-2020\n when /\\A(\\d+)-(\\d+)\\z/i\n if self.month && !self.month.empty?\n return true if time_diff[:month] >= $1.to_i and time_diff[:month] <= $2.to_i\n else\n return true\n end\n end\n\n false\n end",
"title": ""
},
{
"docid": "639699900dda06c5e705bd23ca2a5048",
"score": "0.5673016",
"text": "def localized_month_name(m)\n m = Integer(m)\n (1..12).include? m or raise ArgumentError, \"#{m.inspect} is not valid\"\n t(\"date.month_names\")[m]\n end",
"title": ""
},
{
"docid": "e0d084c7a285d354c348ce0346ff4cf1",
"score": "0.56556696",
"text": "def monthly_report(db)\n\tputs \"What month would you like a report for? (1-12)\"\n\tmonthly_input = gets.chomp.to_i\n\tuntil monthly_input <= 12 && monthly_input >= 1\n\t\tputs \"Please insert a number between 1 and 12.\"\n\t\tmonthly_input = gets.chomp.to_i\n\tend \n\tmonthly_report_loop(@db, monthly_input)\n\tputs @line\n\tputs \"MONTLY REPORT:\"\n\tputs \"Monthly Sales: $#{@sales_z}\"\n\tputs \"Monthly Total Tips: $#{@total_tips_z}\"\n\tputs \"Monthly Total Hours Worked: #{@hours_worked_z}\"\n\tmain_menu #sends user back to main menu\nend",
"title": ""
},
{
"docid": "d0a0a1727aee61f8ad7f61979522b4bb",
"score": "0.564328",
"text": "def input_students\n puts 'Please enter the name of the student. Hit enter if no students'\n# create an empty array\n students = []\n# get the first name\n name = gets.chomp\n# get the month of the cohort\n puts 'Please enter the month of the cohort (first 3 letters)'\n cohort = gets.chomp.capitalize.to_sym\n# Checking the spelling\n# define the months to account for spelling error with user input\n months = [:Jan, :Feb, :Mar, :Apr, :May, :Jun, :Jul, :Aug, :Sep, :Oct, :Nov, :Dec]\n# If the cohort is not empty (i.e. user has inputtted) and the input is not in\n# the months array\n if !cohort.empty? && !months.include?(cohort)\n# keep asking and get the input but break when the input is correct\n loop do\n puts 'Incorrect spelling. Please enter the month of the cohort (first 3 letters)'\n cohort = gets.chomp.capitalize.to_sym\n break if months.include?(cohort)\n end #<- end for my loop\n end #<- end for my if that checks spelling\n# while the name is not empty, repeat this code\n while !name.empty? do\n#if the cohort is empty, add \"unknown\"\n if cohort.empty?\n cohort = :unknown\n end # <- the end to my if cohort empty\n# while the name is not empty, add the student hash to the array\n students << { name: name, cohort: cohort }\n# if only one student, singularize the puts statement\n if students.length == 1\n puts \"We have #{students.count} student\"\n else\n puts \"Now we have #{students.count} students\"\n end # <- this is the end for the if/else\n# get another name and cohort from the user\n puts 'Please enter the name of the student. Hit enter if no further students'\n name = gets.chomp\n# don't ask for the cohort if the name is empty here\n if name.empty?\n break\n end\n puts 'Please enter the month of the cohort (first 3 letters).'\n cohort = gets.chomp.capitalize.to_sym\n if !cohort.empty? && !months.include?(cohort)\n# keep asking and get the input but break when the input is correct\n loop do\n puts 'Incorrect spelling. Please enter the month of the cohort (first 3 letters)'\n cohort = gets.chomp.capitalize.to_sym\n break if months.include?(cohort)\n end #<- end for my loop\n end #<- end for my if that checks spelling\n end # <- this is the end for the while/do\n# return the array of students\n students\nend",
"title": ""
},
{
"docid": "c7464a816e168991712dd82a01391dcd",
"score": "0.56358385",
"text": "def posted_within\n puts 'Posted within: any time period [hit enter], the last day [1], the last week [2], the last month [3].'\n x = gets.chomp # x temporarily holds the number entered by user\n if x.eql?('1')\n 'day'\n elsif x.eql?('2')\n 'week'\n elsif x.eql?('3')\n 'month'\n else\n ''\n end\nend",
"title": ""
},
{
"docid": "e1d4e0c2e3b57d88621fa5cd5ea018be",
"score": "0.56331974",
"text": "def month_name(i)\r\n ApplicationHelper.month_name(i)\r\n end",
"title": ""
},
{
"docid": "7d89b4817c2a5ac66b81ee081bbb73f3",
"score": "0.5628022",
"text": "def semester\n (month < 7) ? 1 : 2\n end",
"title": ""
},
{
"docid": "721ea635ed679ded36db5a33c0076624",
"score": "0.5625384",
"text": "def test_for_invalid_month_argument\n output = `./cal.rb 2014`\n expected = <<EOS\nDate not in acceptable format/range\nEOS\n assert_equal expected, output\n end",
"title": ""
},
{
"docid": "3d5057df102bec83103c38e154f9b5a1",
"score": "0.5624148",
"text": "def number_to_full_month_name(month)\n\n case(month)\n when 1\n return \"January\"\n when 2\n return \"February\"\n when 3\n return \"March\"\n when 4\n return \"April\"\n when 5\n return \"May\"\n when 6\n return \"June\"\n when 7\n return \"July\"\n when 8\n return \"August\"\n when 9\n return \"September\"\n when 10\n return \"October\"\n when 11\n return \"November\"\n when 12\n return \"December\"\n end\nend",
"title": ""
},
{
"docid": "a3e6aca26dd1b007d45e202832850df4",
"score": "0.5623354",
"text": "def number_to_full_month_name(month_num)\n case month_num\n when 1\n return \"January\"\n when 2\n return \"February\"\n when 3\n return \"March\"\n when 4\n return \"April\"\n when 5\n return \"May\"\n when 6\n return \"June\"\n when 7\n return \"July\"\n when 8\n return \"August\"\n when 9\n return \"September\"\n when 10\n return \"October\"\n when 11\n return \"November\"\n when 12\n return \"December\"\n end\nend",
"title": ""
},
{
"docid": "242531172efc78b5533533952117e2d3",
"score": "0.5621723",
"text": "def parse_months\n raise 'Implementation Pending'\n end",
"title": ""
},
{
"docid": "e6cd3ba53dc2d1e333a0270c22adb7da",
"score": "0.5617235",
"text": "def number_to_short_month_name(month_num)\nshrt_month = month_num\ncase shrt_month\n when 1\n return \"Jan\"\n when 4\n return \"Apr\"\n when 10\n return \"Oct\"\n end\nend",
"title": ""
},
{
"docid": "fad10fd8b9a934c1115c48700a82e50c",
"score": "0.56162524",
"text": "def validate_month(month)\n month >= 1 && month <= 12\nend",
"title": ""
},
{
"docid": "d8cea5d40963bb1cca81e846c4bc455d",
"score": "0.5610969",
"text": "def month()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "0dcf2147111764db6d818fa2e12bc01d",
"score": "0.56104326",
"text": "def number_to_short_month_name (number)\n case number\n when 1\n \"Jan\"\n when 4\n \"Apr\"\n when 10\n \"Oct\"\n end\nend",
"title": ""
},
{
"docid": "4cb0fe61e227b2fdefa65436141f1b22",
"score": "0.56063193",
"text": "def all_month; end",
"title": ""
},
{
"docid": "4cb0fe61e227b2fdefa65436141f1b22",
"score": "0.56063193",
"text": "def all_month; end",
"title": ""
},
{
"docid": "683d93144500553cb3b1e5ab62f50c31",
"score": "0.56023407",
"text": "def months\n (1..12).to_a\n end",
"title": ""
},
{
"docid": "0f6e34496aaeafa2b2246006fc454be8",
"score": "0.5601201",
"text": "def bimestre\n case self.month\n when 1..2 then 1\n when 3..4 then 2\n when 5..6 then 3\n when 7..8 then 4\n when 9..10 then 5\n when 11..12 then 6\n end\n end",
"title": ""
},
{
"docid": "aa896cf89f7c26b5eb5e8dd40ffb826a",
"score": "0.5600754",
"text": "def in_months; end",
"title": ""
},
{
"docid": "aa896cf89f7c26b5eb5e8dd40ffb826a",
"score": "0.5600754",
"text": "def in_months; end",
"title": ""
}
] |
b03668022942aad2e136db661f48c4e9
|
Grants privileges on schemas. You can specify multiple schemas, roles and privileges all at once using Arrays for each of the desired parameters. See PostgreSQLGrantPrivilege for usage.
|
[
{
"docid": "564490086b0d2785e79cb8cad5a9fdee",
"score": "0.81287736",
"text": "def grant_schema_privileges(schemas, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :schema, schemas, privileges, roles, options, :ignore_schema => true).to_sql\n end",
"title": ""
}
] |
[
{
"docid": "96a44a7192cbb6b065864598fb2054f7",
"score": "0.6882244",
"text": "def grant_privileges(username=false, database=false, *privileges)\n grant_or_revoke_privileges('GRANT', username, database, privileges)\n end",
"title": ""
},
{
"docid": "96a44a7192cbb6b065864598fb2054f7",
"score": "0.6882244",
"text": "def grant_privileges(username=false, database=false, *privileges)\n grant_or_revoke_privileges('GRANT', username, database, privileges)\n end",
"title": ""
},
{
"docid": "07796d3f9745a7b0ee738060c34ce7b7",
"score": "0.6846612",
"text": "def grant_tablespace_privileges(tablespaces, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :tablespace, tablespaces, privileges, roles, options).to_sql\n end",
"title": ""
},
{
"docid": "379ab243164ad79f06bb38667114a017",
"score": "0.6647293",
"text": "def grant_database_privileges(databases, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :database, databases, privileges, roles, options).to_sql\n end",
"title": ""
},
{
"docid": "e79e2885cf01c8bb7b5b7958a904b2de",
"score": "0.6168389",
"text": "def revoke_schema_privileges(schemas, privileges, roles, options = {})\n execute PostgreSQLRevokePrivilege.new(self, :schema, schemas, privileges, roles, options, :ignore_schema => true).to_sql\n end",
"title": ""
},
{
"docid": "99e359b87ca5d8f546f0750c29fac51a",
"score": "0.6065647",
"text": "def grant_or_revoke_privileges(statement, username, database, privileges)\n preposition = (statement.downcase == 'revoke' ? 'FROM' : 'TO')\n username ||= app_credentials[:user]\n database ||= app_schema\n privileges = Jetpants.mysql_grant_privs if privileges.empty?\n privileges = privileges.join(',')\n commands = []\n \n Jetpants.mysql_grant_ips.each do |ip|\n commands << \"#{statement} #{privileges} ON #{database}.* #{preposition} '#{username}'@'#{ip}'\"\n end\n commands << \"FLUSH PRIVILEGES\"\n commands = commands.join '; '\n mysql_root_cmd commands, schema: true\n Jetpants.mysql_grant_ips.each do |ip|\n verb = (statement.downcase == 'revoke' ? 'Revoking' : 'Granting')\n target_db = (database == '*' ? 'globally' : \"on #{database}.*\")\n output \"#{verb} privileges #{preposition.downcase} '#{username}'@'#{ip}' #{target_db}: #{privileges.downcase}\"\n end\n end",
"title": ""
},
{
"docid": "1345c87cf110821df9c28532e69dc443",
"score": "0.5988493",
"text": "def grant_or_revoke_privileges(statement, username, database, privileges)\n preposition = (statement.downcase == 'revoke' ? 'FROM' : 'TO')\n username ||= app_credentials[:user]\n database ||= app_schema\n privileges = Jetpants.mysql_grant_privs if privileges.empty?\n privileges = privileges.join(',')\n commands = ['SET SESSION sql_log_bin = 0']\n\n Jetpants.mysql_grant_ips.each do |ip|\n commands << \"#{statement} #{privileges} ON #{database}.* #{preposition} '#{username}'@'#{ip}'\"\n end\n commands << \"FLUSH PRIVILEGES\"\n commands = commands.join '; '\n mysql_root_cmd commands\n Jetpants.mysql_grant_ips.each do |ip|\n verb = (statement.downcase == 'revoke' ? 'Revoking' : 'Granting')\n target_db = (database == '*' ? 'globally' : \"on #{database}.*\")\n output \"#{verb} privileges #{preposition.downcase} '#{username}'@'#{ip}' #{target_db}: #{privileges.downcase} (only on this node -- not binlogged)\"\n end\n end",
"title": ""
},
{
"docid": "7ab6ea013518cbaaa6580ca96fcb3033",
"score": "0.59338367",
"text": "def grant_function_privileges(function_prototypes, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :function, function_prototypes, privileges, roles, options, :quote_objects => false).to_sql\n end",
"title": ""
},
{
"docid": "c96bf3029ad77ee23ea1f34dcc3a8684",
"score": "0.5886629",
"text": "def grant_sequence_privileges(sequences, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :sequence, sequences, privileges, roles, options).to_sql\n end",
"title": ""
},
{
"docid": "0fb95862d825add50046fe4015690e7a",
"score": "0.5827532",
"text": "def grant(*roles)\n raise NotImplementedError, \"Subclasses must implement `grant`.\"\n end",
"title": ""
},
{
"docid": "4516e416485d43b6acd411afd1ba007d",
"score": "0.5734487",
"text": "def grant_user_db_sql(new_resource)\n sql = \"GRANT #{new_resource.privileges.join(', ')} ON DATABASE \\\\\\\"#{new_resource.database}\\\\\\\" TO \\\\\\\"#{new_resource.create_user}\\\\\\\";\"\n psql_command_string(new_resource, sql)\n end",
"title": ""
},
{
"docid": "4516e416485d43b6acd411afd1ba007d",
"score": "0.5734487",
"text": "def grant_user_db_sql(new_resource)\n sql = \"GRANT #{new_resource.privileges.join(', ')} ON DATABASE \\\\\\\"#{new_resource.database}\\\\\\\" TO \\\\\\\"#{new_resource.create_user}\\\\\\\";\"\n psql_command_string(new_resource, sql)\n end",
"title": ""
},
{
"docid": "03b19657bcc3121d9bb41b166325de6b",
"score": "0.5732376",
"text": "def grant_privileges(connection)\n identified_by = if worker_database_config[:password]\n %{identified by %s} % connection.quote(worker_database_config[:password])\n else\n \"\"\n end\n sql = %{grant all on #{worker_database}.* to %s@'localhost' #{identified_by} ; } % \n connection.quote(worker_database_config[:username])\n\n connection.execute sql\n end",
"title": ""
},
{
"docid": "6302e9621fbdfec65ee9e6bd3571d655",
"score": "0.5661839",
"text": "def grant_admin_permissions_for_all_groups(admin_user, admin_password)\r\n Group.roots.each do |group|\r\n self.permissions.create(:group => group, :mode => \"ADMIN\",\r\n :admin_user => admin_user, :admin_password => admin_password)\r\n end\r\n end",
"title": ""
},
{
"docid": "364ff9a9abd420471c46277253c6dc63",
"score": "0.56485474",
"text": "def db_client_grant_all\n @database.query(\"GRANT ALL PRIVILEGES ON #{db_name}.* TO '#{db_user}'@'#{db_host}'\")\n end",
"title": ""
},
{
"docid": "480f6c8119f9c6618464392b55a54bea",
"score": "0.5635273",
"text": "def create_user_grant(database, user, permissions)\n \n sql = \"GRANT #{permissions} ON `#{database}`.* TO #{full_name(user)}\"\n \n display_command(sql) if @show \n \n begin\n @dbh.query(sql) if @run\n flush_privileges\n return true\n rescue => e\n display_error(e) if @debug\n return false\n end\n\n end",
"title": ""
},
{
"docid": "a80cc301084d19afac9074a8ddf02448",
"score": "0.5580406",
"text": "def grant_view_privileges(views, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :view, views, privileges, roles, options, :named_object_type => false).to_sql\n end",
"title": ""
},
{
"docid": "d5bec25fc98e1658d20e6b23a98e9080",
"score": "0.5504097",
"text": "def grant_language_privileges(languages, privileges, roles, options = {})\n execute PostgreSQLGrantPrivilege.new(self, :language, languages, privileges, roles, options).to_sql\n end",
"title": ""
},
{
"docid": "681a8eba26bf2ae48e7509e52e9200de",
"score": "0.54852366",
"text": "def grant_role_membership(roles, role_names, options = {})\n sql = \"GRANT \"\n sql << Array.wrap(roles).collect { |r| quote_role(r) }.join(', ')\n sql << ' TO '\n sql << Array.wrap(role_names).collect { |r| quote_role(r) }.join(', ')\n sql << ' WITH ADMIN OPTION' if options[:with_admin_option]\n execute(\"#{sql};\")\n end",
"title": ""
},
{
"docid": "8e18a18f056519c22dc9e6472f933953",
"score": "0.5473563",
"text": "def grants; end",
"title": ""
},
{
"docid": "8e18a18f056519c22dc9e6472f933953",
"score": "0.5473563",
"text": "def grants; end",
"title": ""
},
{
"docid": "8e18a18f056519c22dc9e6472f933953",
"score": "0.5473563",
"text": "def grants; end",
"title": ""
},
{
"docid": "f671c1dc0077c8ac8c44d544f9639d9b",
"score": "0.5407587",
"text": "def alter_schema_owner(schema, role)\n execute(\"ALTER SCHEMA #{quote_schema(schema)} OWNER TO #{quote_role(role)};\")\n end",
"title": ""
},
{
"docid": "6566afc7681578a08f40f4ba4ee3fdbd",
"score": "0.54027677",
"text": "def insert_roles_and_permissions_permissions\n create_permission(6, 'CanEditAllRoles')\n create_permission(7, 'CanEditAllPermissions')\n add_permission_to_super_admin(6)\n add_permission_to_super_admin(7)\nend",
"title": ""
},
{
"docid": "4e1c22d307145ea5c6c0734390ff41a0",
"score": "0.5395182",
"text": "def grantable_privileges\n return [] if !self.is_grant?\n return [self.privilege] if self.class_name == 'any'\n klass = self.target_class\n return klass.declared_privileges + [:any] if self.privilege == :any\n return [self.privilege] + klass.sg_priv_to_implied_privs[self.privilege]\n end",
"title": ""
},
{
"docid": "cd81dda33891a12f5827f924c2ce088e",
"score": "0.537442",
"text": "def grant_ctxapp\n @sys_conn = ActiveRecord::ConnectionAdapters::OracleEnhancedConnection.create(SYS_CONNECTION_PARAMS)\n @sys_conn.exec \"GRANT CTXAPP TO #{DATABASE_USER}\"\n rescue\n nil\n end",
"title": ""
},
{
"docid": "96f1b17eb518f273c837b157c2603cda",
"score": "0.5342265",
"text": "def create_permissions\n if user_groups.include?('admin_group') || user_groups.include?('gis_cataloger')\n can [:new, :create], ActiveFedora::Base\n end\n end",
"title": ""
},
{
"docid": "528e1377e25243b6a4f4edb849d08a18",
"score": "0.5341854",
"text": "def create_schema_authorization(name, options = {})\n sql = 'CREATE SCHEMA'\n\n if options.key?(:if_not_exists)\n ActiveRecord::PostgreSQLExtensions::Features.check_feature(:create_schema_if_not_exists)\n\n sql << ' IF NOT EXISTS' if options[:if_not_exists]\n end\n\n sql << \" AUTHORIZATION #{quote_role(name)}\"\n\n execute(\"#{sql};\")\n end",
"title": ""
},
{
"docid": "fcfd3f5a45b2513f538097502a70e915",
"score": "0.5268773",
"text": "def grants=(_arg0); end",
"title": ""
},
{
"docid": "a2ad32e3570a167a52f011e1b169c1ae",
"score": "0.5253292",
"text": "def revoke_tablespace_privileges(tablespaces, privileges, roles, options = {})\n execute PostgreSQLRevokePrivilege.new(self, :tablespace, tablespaces, privileges, roles, options).to_sql\n end",
"title": ""
},
{
"docid": "0bed0ba00e7945247ad59ac0d46adcdd",
"score": "0.52501565",
"text": "def grant( *args )\n @grant += args.map(&:to_s).map(&:upcase)\n \n self\n end",
"title": ""
},
{
"docid": "e4c1609408e6e18a04c253ae495b3695",
"score": "0.52463067",
"text": "def grant_materialized_view_privileges(materialized_views, privileges, roles, options = {})\n ActiveRecord::PostgreSQLExtensions::Features.check_feature(:materialized_views)\n\n execute PostgreSQLGrantPrivilege.new(self, :materialized_view, materialized_views, privileges, roles, options, :named_object_type => false).to_sql\n end",
"title": ""
},
{
"docid": "bb8d66085489ee1688cd17f3d0150e2e",
"score": "0.5216178",
"text": "def everyone_can_deposit_everywhere\n AdminSet.all.each do |admin_set|\n next if Hyrax::PermissionTemplateAccess\n .find_by(permission_template_id: admin_set.permission_template.id,\n agent_id: 'registered',\n access: 'deposit',\n agent_type: 'group')\n\n admin_set.permission_template.access_grants.create(agent_type: 'group', agent_id: 'registered', access: 'deposit')\n deposit = Sipity::Role.find_by!(name: 'depositing')\n admin_set.permission_template.available_workflows.each do |workflow|\n workflow.update_responsibilities(role: deposit, agents: Hyrax::Group.new('registered'))\n end\n end\n end",
"title": ""
},
{
"docid": "03d5c801af2e10ccb9662a3e196d2e35",
"score": "0.5199604",
"text": "def set_raster_privileges(role_name = nil)\n database = @user.in_database(as: :superuser)\n return unless database.table_exists?('raster_overviews')\n # Postgis lives at public schema, so raster catalogs too\n catalogs_schema = SCHEMA_PUBLIC\n queries = [\n \"GRANT SELECT ON TABLE \\\"#{catalogs_schema}\\\".\\\"raster_overviews\\\" TO \\\"#{CartoDB::PUBLIC_DB_USER}\\\"\",\n \"GRANT SELECT ON TABLE \\\"#{catalogs_schema}\\\".\\\"raster_columns\\\" TO \\\"#{CartoDB::PUBLIC_DB_USER}\\\"\"\n ]\n target_user = role_name || @user.database_public_username\n unless @user.organization.nil?\n queries << \"GRANT SELECT ON TABLE \\\"#{catalogs_schema}\\\".\\\"raster_overviews\\\" TO \\\"#{target_user}\\\"\"\n queries << \"GRANT SELECT ON TABLE \\\"#{catalogs_schema}\\\".\\\"raster_columns\\\" TO \\\"#{target_user}\\\"\"\n end\n @queries.run_in_transaction(queries, true)\n end",
"title": ""
},
{
"docid": "422ad2a68f2fc6d36f1010638a038df3",
"score": "0.5192132",
"text": "def permission_grants=(value)\n @permission_grants = value\n end",
"title": ""
},
{
"docid": "422ad2a68f2fc6d36f1010638a038df3",
"score": "0.5192132",
"text": "def permission_grants=(value)\n @permission_grants = value\n end",
"title": ""
},
{
"docid": "8e71dede156997b53179989c2100f577",
"score": "0.518712",
"text": "def schemas_whitelist\n @schemas_whitelist ||= Torque::PostgreSQL.config.schemas.whitelist +\n (@config.dig(:schemas, 'whitelist') || [])\n end",
"title": ""
},
{
"docid": "6000ca2ff2b85df325b1668e79693e82",
"score": "0.5184782",
"text": "def grants\n data.grants\n end",
"title": ""
},
{
"docid": "6000ca2ff2b85df325b1668e79693e82",
"score": "0.5184782",
"text": "def grants\n data.grants\n end",
"title": ""
},
{
"docid": "ddb7e1f762cef656d3e03f1d34f1f0cd",
"score": "0.51561356",
"text": "def add_user (hosts, username, password, grant, databases, tables)\n\t\n\t# as default, allow access to all tables\n\ttables << '*' if tables.empty?\n\t\n\t# convert to array\n\thosts = [hosts] if not hosts.is_a? Array\n\tdatabases = [databases] if not databases.is_a? Array\n\t\n\tdatabases.each do |database|\n\t\tif database != '*'\n\t\t\tcreate_database database\n\t\tend\n\tend\n\t\n\t# create users and grant access\n\thosts.each do |host|\n\t\tdatabases.each do |database|\n\t\t\ttables.each do |table|\n\t\n\t\t\t\t# add user\n\t\t\t\texecute 'add-user' do\n\t\t\t\t\tuser 'root'\n\t\t\t\t\tcommand <<-EOF\nHOME=/root\nmysql -e \"GRANT #{grant} ON #{database}.#{table} TO '#{username}'@'#{host}' IDENTIFIED BY '#{password}';\"\nEOF\n\t\t\t\tend\n\t\t\n\t\t\t\t# grant usage to database\n\t\t\t\tif database != '*' and grant == 'USAGE'\n\t\t\t\t\texecute 'grant privileges on database' do\n\t\t\t\t\t\tuser 'root'\n\t\t\t\t\t\tcommand <<-EOF\nHOME=/root\nmysql -e \"GRANT ALL PRIVILEGES ON #{database}.#{table} TO '#{username}'@'#{host}';\"\nEOF\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\t\n\tflush_privileges\nend",
"title": ""
},
{
"docid": "73201924f3860afdb746acbd76cb8c3f",
"score": "0.5140541",
"text": "def grantable_privileges_for_class(klass)\n return [] if !self.is_grant?\n return [] if self.class_name != 'any' && self.class_name != klass.name\n return klass.declared_privileges + [:any] if self.privilege == :any\n return [self.privilege] + klass.sg_priv_to_implied_privs[self.privilege]\n end",
"title": ""
},
{
"docid": "85b13467e697f11b00f97575de467dd0",
"score": "0.5128577",
"text": "def create_postgres_database_commands(config)\n create_cmd = %(CREATE DATABASE \"#{config[:database]}\" WITH TEMPLATE=template0 ENCODING='UTF8')\n cmds = []\n unless config[:user].blank?\n create_cmd << %( OWNER=\"#{config[:user]}\")\n cmds << [%(CREATE ROLE \"#{config[:user]}\" LOGIN PASSWORD '#{config[:password]}'), false]\n end\n cmds << [create_cmd, true]\n end",
"title": ""
},
{
"docid": "5f58daf893955afa16f7ee2b2a225625",
"score": "0.50913537",
"text": "def configure_database\n set_pgversion\n\n set_database_search_path\n\n grant_user_in_database\n\n set_statement_timeouts\n\n # INFO: Added to everyone because eases migration of normal users to org owners\n # and non-org users just don't use it\n set_user_as_organization_member\n\n if @user.database_schema == SCHEMA_PUBLIC\n setup_single_user_schema\n else\n setup_organization_user_schema\n end\n\n create_function_invalidate_varnish\n grant_publicuser_in_database\n end",
"title": ""
},
{
"docid": "419cca0d46cefe4baac2c7bbc2237884",
"score": "0.5081971",
"text": "def grant_access(permissions)\n all_opsworks_arns = @client.describe_permissions({:stack_id => stack_id})[:permissions].collect{|p| p[:iam_user_arn]}\n\n permissions.each do |user, p|\n matching_arns = all_opsworks_arns.select{ |arn| arn.end_with? \"user/#{user}\" }\n\n if matching_arns.empty?\n puts \"Warning! Could not find user '#{user}' in OpsWorks, so permissions could not be granted.\"\n else \n arn = matching_arns.first\n puts \"granting stack permissions for user #{arn} ...\" if @verbose\n @client.set_permission({\n :stack_id => stack_id,\n :allow_ssh => p['ssh'],\n :allow_sudo => p['sudo'],\n :iam_user_arn => arn\n })\n end\n end\n end",
"title": ""
},
{
"docid": "f3625adb83f4e19fb377bcdf163d9e38",
"score": "0.5063008",
"text": "def grant_full_access\n permissions = @client.describe_permissions({:stack_id => stack_id})[:permissions]\n permissions.each do |perm|\n puts \"granting stack permissions for user #{perm[:iam_user_arn]} ...\" if @verbose\n @client.set_permission({\n :stack_id => stack_id,\n :allow_ssh => true,\n :allow_sudo => true,\n :iam_user_arn => perm[:iam_user_arn]\n })\n end\n end",
"title": ""
},
{
"docid": "6ead3582337aa7919c7f475f466aa93e",
"score": "0.5045444",
"text": "def grant_superuser(user)\n return false if self.superuser?(user)\n self.interpreter.log.info(PNOTE+\"Granted superuser rights to PostgreSQL user: #{user}\")\n self.fetch(\"alter user #{user} createuser\") if self.interpreter.writing?\n return true\n end",
"title": ""
},
{
"docid": "457942c60d6659a6ce50bfa9e7c8b42e",
"score": "0.5045039",
"text": "def grant_workflow_roles_for_all_admin_sets!\n AdminSet.find_each do |admin_set|\n Hyrax::Workflow::PermissionGrantor\n .grant_default_workflow_roles!(permission_template: admin_set.permission_template)\n end\n end",
"title": ""
},
{
"docid": "f11ec7c9d7feb68bee2c4ad1ca6f5bbf",
"score": "0.5029742",
"text": "def setup_organization_user_schema\n reset_user_schema_permissions\n reset_schema_owner\n set_user_privileges_at_db\n set_user_as_organization_member\n rebuild_quota_trigger\n\n # INFO: organization privileges are set for org_member_role, which is assigned to each org user\n if @user.organization_owner?\n setup_organization_owner\n end\n end",
"title": ""
},
{
"docid": "b974157e97c373c274de250f79ef73e8",
"score": "0.50279766",
"text": "def oauth2_permission_grants=(value)\n @oauth2_permission_grants = value\n end",
"title": ""
},
{
"docid": "b974157e97c373c274de250f79ef73e8",
"score": "0.50279766",
"text": "def oauth2_permission_grants=(value)\n @oauth2_permission_grants = value\n end",
"title": ""
},
{
"docid": "94bb632dd42e2a3e30136eea8c71de1f",
"score": "0.5025205",
"text": "def grants(*others)\n others.each do |name|\n r = Role.first_or_create(:name => name)\n r.granted_by = self.state\n r.parent = self.state if r.parent_id == 1\n # subtle workaround: dm-is-nested sets parent_id automatically to root. \n # parent_id will be 1 (root) if this is a new record. so set it together with grant\n r.save\n end\n self.state = Role.first(:name => others.last)\n self\n end",
"title": ""
},
{
"docid": "6faef2d5279b9aa22d0504a691930e5e",
"score": "0.50099844",
"text": "def setup_single_user_schema\n set_user_privileges_at_db\n rebuild_quota_trigger\n end",
"title": ""
},
{
"docid": "9736f234ae1b763ba6f85cdf580b6d3b",
"score": "0.49829653",
"text": "def access_grants_attributes\n [\n { agent_type: Hyrax::PermissionTemplateAccess::GROUP, agent_id: Ability.admin_group_name, access: Hyrax::PermissionTemplateAccess::MANAGE },\n { agent_type: Hyrax::PermissionTemplateAccess::GROUP, agent_id: Ability.registered_group_name, access: Hyrax::PermissionTemplateAccess::DEPOSIT }\n ]\n end",
"title": ""
},
{
"docid": "544971633ea93f6cddca4d8dd49b24c6",
"score": "0.49829313",
"text": "def create_schema\n self.class.connection.execute(\"create schema tenant#{id}\")\n scope_schema do\n load Rails.root.join(\"db/schema.rb\")\n self.class.connection.execute(\"drop table #{self.class.table_name}\")\n connection.execute(\"drop table sessions\")\n YAML.load(ENV['ROLES']).each do |role|\n Role.find_or_create_by(name: role)\n end\n end\n end",
"title": ""
},
{
"docid": "d0d10b0dd0073e0b274ec7b61630ce0a",
"score": "0.49703342",
"text": "def revoke_database_privileges(databases, privileges, roles, options = {})\n execute PostgreSQLRevokePrivilege.new(self, :database, databases, privileges, roles, options).to_sql\n end",
"title": ""
},
{
"docid": "f85f6704800e45325ffc4a03d2e20e01",
"score": "0.495775",
"text": "def raise_privileges(uid, gid)\n if uid and gid\n Process::UID.grant_privilege(uid)\n Process::GID.grant_privilege(gid)\n end\n end",
"title": ""
},
{
"docid": "7f680c4b77a6068ce6ffdb5ccabf6645",
"score": "0.4933113",
"text": "def groups(*target_groups)\n target_groups.each do |target_group_name|\n grant_rights_on_group(target_group_name)\n end\n end",
"title": ""
},
{
"docid": "c7ead6d9f9a36a26d359ea382bdd8cde",
"score": "0.49257356",
"text": "def grants( target)\n # todo: include from elsewhere. gah.\n grants = \"98d0fc99-37ae-4e51-997e-04c6d9b74637\"\n Edge.create!(:edge_type => Edge.types[:grants_grant], :end1 => self.uuid, :end2 => target.uuid)\n end",
"title": ""
},
{
"docid": "a979ea83cc4c1595eab1259e352fb2a8",
"score": "0.49161658",
"text": "def user_defined_schemas_sql\n conditions = []\n conditions << <<-SQL if schemas_blacklist.any?\n nspname NOT LIKE ANY (ARRAY['#{schemas_blacklist.join(\"', '\")}'])\n SQL\n\n conditions << <<-SQL if schemas_whitelist.any?\n nspname LIKE ANY (ARRAY['#{schemas_whitelist.join(\"', '\")}'])\n SQL\n\n <<-SQL.squish\n SELECT nspname\n FROM pg_catalog.pg_namespace\n WHERE 1=1 AND #{conditions.join(' AND ')}\n ORDER BY oid\n SQL\n end",
"title": ""
},
{
"docid": "5f57b6e84a289a930f603057d302c4a1",
"score": "0.4914877",
"text": "def provision_user(user, roles, relations = {})\n roles.each do |role|\n if relations.empty?\n if role.is_a? Array\n user.add_role *role\n else\n user.add_role role\n end\n else\n if role.is_a? Array\n user.add_role *role, relations\n else\n user.add_role role, relations\n end\n end\n end\n user\nend",
"title": ""
},
{
"docid": "1551eb791e2a3880c441589ef78af9d6",
"score": "0.49105883",
"text": "def tables_granted(params = {})\n table = table_grants\n table.project('*')\n table.order(\"#{params[:order]} #{params[:direction]}\") if params[:order]\n table.take(params[:limit]) if params[:limit]\n table.skip(params[:offset]) if params[:offset]\n\n @user.in_database.execute(table.to_sql).map { |t| OpenStruct.new(t) }\n end",
"title": ""
},
{
"docid": "e80bdcd99a7ec103345c5681aa646e23",
"score": "0.4909017",
"text": "def configure_database\n set_database_search_path\n\n grant_user_in_database\n\n set_statement_timeouts\n\n # INFO: Added to everyone because eases migration of normal users to org owners\n # and non-org users just don't use it\n set_user_as_organization_member\n\n if @user.database_schema == SCHEMA_PUBLIC\n setup_single_user_schema\n else\n setup_organization_user_schema\n end\n\n create_function_invalidate_varnish\n grant_publicuser_in_database\n end",
"title": ""
},
{
"docid": "5a7e8b6870450dcb6ac911b71429f4bb",
"score": "0.49074894",
"text": "def setup_organization_user_schema\n # WIP: CartoDB/cartodb-management#4467\n # Avoid mover reseting permissions. It's been moved to callers. Look for \"WIP: CartoDB/cartodb-management#4467\"\n # reset_user_schema_permissions\n reset_schema_owner\n set_user_privileges_at_db\n set_user_as_organization_member\n rebuild_quota_trigger\n\n # INFO: organization privileges are set for org_member_role, which is assigned to each org user\n if @user.organization_owner?\n setup_organization_owner\n create_ghost_tables_event_trigger\n end\n\n if @user.organization_admin?\n grant_admin_permissions\n end\n\n # Rebuild the geocoder api user config to reflect that is an organization user\n install_and_configure_geocoder_api_extension\n install_odbc_fdw\n end",
"title": ""
},
{
"docid": "9952888486b39b9c5c91da71badf5ee2",
"score": "0.4905067",
"text": "def set_schema(schema)\n execute(\"SET SCHEMA #{schema}\")\n end",
"title": ""
},
{
"docid": "95bc9247a2ec4554a229d68cdfdb1dfc",
"score": "0.49033684",
"text": "def create_admin_in_tenant(tenant)\n user = self\n tenant.scope_schema do\n tenant_admin = User.create(\n :first_name => user.first_name, \n :last_name => user.last_name, \n :email => user.email, \n :encrypted_password => user.encrypted_password,\n :company_name => user.company_name,\n :tenant_id => tenant.id,\n :stripe_token => @stripe_token\n )\n tenant_admin.add_role(\"admin\")\n tenant_admin.save(:validate=> false)\n end\n end",
"title": ""
},
{
"docid": "dd4db30a46bc41dc6f0e7c3d060a9587",
"score": "0.49026823",
"text": "def add_grant!(permission, grantee)\n add_grant(permission, grantee)\n set_grants\n end",
"title": ""
},
{
"docid": "e5773f313440c6805ccbc6dfd0177fa4",
"score": "0.48754805",
"text": "def allow *symbol, on: []\n op *symbol, @GRANT_SYMBOL, on\n end",
"title": ""
},
{
"docid": "eb6c208e0ff9ab12691d3012dc4162a4",
"score": "0.4864489",
"text": "def user_defined_schemas\n query_values(user_defined_schemas_sql, 'SCHEMA')\n end",
"title": ""
},
{
"docid": "5f86154319d7920262787b23077eafa8",
"score": "0.4860778",
"text": "def update_grants(region, bucket_name, grants)\n S3.client(region).put_bucket_acl({\n bucket: bucket_name,\n access_control_policy: {\n grants: grants.values.map(&:to_aws).flatten,\n owner: S3.full_bucket(bucket_name).acl.owner\n }\n })\n end",
"title": ""
},
{
"docid": "a93bc4c0f72363c139b0d9fd33fa641d",
"score": "0.483575",
"text": "def grant role:, members:\n existing_binding = bindings.find { |b| b.role == role }\n if existing_binding\n existing_binding.members.concat Array(members)\n existing_binding.members.uniq!\n else\n bindings << Binding.new(role, members)\n end\n nil\n end",
"title": ""
},
{
"docid": "29294c1fa88031e4c73afb3a1f21e891",
"score": "0.4817743",
"text": "def grant_admin(admin_user, admin_password)\r\n self.transaction do \r\n # Need to make sure we're not resetting the password.\r\n self.password = nil\r\n self.is_admin = true\r\n self.permissions.delete_all\r\n grant_admin_permissions_for_all_groups(admin_user, admin_password)\r\n self.save\r\n end\r\n end",
"title": ""
},
{
"docid": "42e7b7cd9c254d60592cec164fd56d3c",
"score": "0.48006135",
"text": "def schemas\n sql = \"SELECT nspname FROM pg_namespace WHERE nspname !~ '^pg_.*' order by nspname\"\n connection.query(sql).flatten\n end",
"title": ""
},
{
"docid": "68dd847b83941d67e66d636e26bb8732",
"score": "0.47740167",
"text": "def allow(*fields)\n expand_schema(\"allow\",*fields)\n end",
"title": ""
},
{
"docid": "2dd60385a840d399cbb711349fbfcd31",
"score": "0.47563016",
"text": "def set_permissions_for(roles, activity_symbol_array)\n permissions = self.class.generate_permissions_for roles, activity_symbol_array\n permissions.each(&:save!)\n end",
"title": ""
},
{
"docid": "55edabd39463250e9f1b93e01ad40fd1",
"score": "0.4748397",
"text": "def can_grant_permissions?\n roles.include? Role.find_by(name: constant(\"user_role_types.grant_permissions\"))\n end",
"title": ""
},
{
"docid": "e87f7ddba94280b4d4c95e2393f4a42f",
"score": "0.47466725",
"text": "def create\n possible_options = [:createdb, :createrole, :inherit, :superuser, :login]\n options_to_add = possible_options.map {|o|\n # Set all role attributes on or off, disregarding PostgreSQL\n # defaults, so that the role is exactly as prescribed in the\n # manifest.\n (if resource[o] == :true then '' else 'NO' end) + o.to_s.upcase\n }.join(' ')\n # SQL injection defense: the resource name is validated for content and\n # length before we inject it; the name is provided by admins, not users.\n sql = \"CREATE ROLE #{resource[:name]} #{options_to_add}\"\n _exec_sql sql, []\n # now grant specified roles to the new role\n self.grant_roles= resource[:grant_roles]\n end",
"title": ""
},
{
"docid": "3a2d48467ed06e9c25b0e7e231ea60b4",
"score": "0.47444",
"text": "def create_organization_user(org)\n org_user = \"org#{org.id}\"\n\n # This conditional accommodates the current hosting environment which requires the role to be set up separately.\n if Rails.env.production?\n <<~SQL\n BEGIN;\n GRANT CONNECT ON DATABASE #{db_connection.current_database} TO #{org_user};\n GRANT USAGE ON SCHEMA public TO #{org_user};\n GRANT SELECT ON TABLE animals TO #{org_user};\n GRANT SELECT ON TABLE cohorts TO #{org_user};\n GRANT SELECT ON TABLE enclosures TO #{org_user};\n GRANT SELECT ON TABLE facilities TO #{org_user};\n GRANT SELECT ON TABLE locations TO #{org_user};\n GRANT SELECT ON TABLE measurement_events TO #{org_user};\n GRANT SELECT ON TABLE measurement_types TO #{org_user};\n GRANT SELECT ON TABLE measurements TO #{org_user};\n GRANT SELECT ON TABLE mortality_events TO #{org_user};\n GRANT SELECT ON TABLE operations TO #{org_user};\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO #{org_user};\n COMMIT;\n SQL\n else\n <<~SQL\n BEGIN;\n CREATE ROLE #{org_user} LOGIN PASSWORD '#{org_db_password(org)}';\n GRANT CONNECT ON DATABASE #{db_connection.current_database} TO #{org_user};\n GRANT USAGE ON SCHEMA public TO #{org_user};\n GRANT SELECT ON TABLE animals TO #{org_user};\n GRANT SELECT ON TABLE cohorts TO #{org_user};\n GRANT SELECT ON TABLE enclosures TO #{org_user};\n GRANT SELECT ON TABLE facilities TO #{org_user};\n GRANT SELECT ON TABLE locations TO #{org_user};\n GRANT SELECT ON TABLE measurement_events TO #{org_user};\n GRANT SELECT ON TABLE measurement_types TO #{org_user};\n GRANT SELECT ON TABLE measurements TO #{org_user};\n GRANT SELECT ON TABLE mortality_events TO #{org_user};\n GRANT SELECT ON TABLE operations TO #{org_user};\n ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO #{org_user};\n COMMIT;\n SQL\n end\n end",
"title": ""
},
{
"docid": "30d93b0dab8b492df810c63d9dcae0c1",
"score": "0.47433245",
"text": "def create_schema schema_name\n execute \"CREATE SCHEMA #{schema_name}\"\n end",
"title": ""
},
{
"docid": "7e6f0eae62aa1512ff0baaefd55cc744",
"score": "0.47353747",
"text": "def custom_permissions\n can [:index, :read], Press\n can [:read], SubBrand\n\n # press admin\n can :manage, Role, resource_id: @user.admin_roles.pluck(:resource_id), resource_type: 'Press'\n\n # monograph.press is a String (the subdomain of a Press)\n can :create, Monograph do |m|\n @user.admin_presses.map(&:subdomain).include?(m.press)\n end\n\n can :manage, SubBrand do |sb|\n admin_for?(sb.press)\n end\n\n can :update, Press do |p|\n admin_for?(p)\n end\n\n grant_platform_admin_abilities\n end",
"title": ""
},
{
"docid": "78457d986ddd79176d55504a3fdfbde8",
"score": "0.47334674",
"text": "def test_grant_queries\n\n all_my_blogs = []\n base_flags = { :owner_firm => firms(:dubuque) }\n\n with_test_role_for_unprivileged_guy do |luser, role|\n\n subrole = Role.create! :name => 'subrole'\n role.update! :parent_role => subrole\n\n ssrole = Role.create! :name => 'ssrole'\n subrole.update! :parent_role => ssrole\n\n target_roles = [role, subrole, ssrole]\n\n [ luser, users(:lucy), users(:ricky) ].each do |user|\n flags = base_flags.merge :owner => user\n [ :ricardo, :dubuque ].each do |firm_name|\n flags[:owner_firm] = firms(firm_name)\n flags[:name] = \"blog \" + Blog.count.to_s\n blog = Blog.create flags\n all_my_blogs << blog\n end\n end\n\n perms_sets = \n [[all_my_blogs.select { |blog| blog.owner == users(:lucy) },\n blog_post_permission( :target_owner => users(:lucy))],\n\n [all_my_blogs.select { |blog| blog.owner_firm == firms(:ricardo) },\n blog_post_permission( :target_owner_firm => firms(:ricardo))\n ],\n\n [all_my_blogs.select { |blog| blog.owner == luser },\n blog_post_permission( :target_owned_by_self => true ) ],\n\n [[ blogs(:mertz_blog) ],\n blog_post_permission( :target => blogs(:mertz_blog) )]]\n\n # Slap copies of all permissions onto an irrelevant role\n # to make sure that it's only the roles (and their permissions)\n # assigned to *our* user that make a difference...\n\n perms_sets.each do |perms_set|\n roles(:ricardo_twiddler).permissions << perms_set.last.dup\n end\n\n # Actual tests:\n\n perms_sets.each do |perms_set|\n target_roles.each do |trole|\n assert_grant_queries_work_one_perm :post, luser, trole, \n perms_set.first, perms_set.last\n assert_users_permitted_works_one_perm :post, luser, trole, \n perms_set.first, perms_set.last, all_my_blogs\n end\n end\n\n perms_sets.each_with_index do |perms_set_a, i|\n perms_sets.each_with_index do |perms_set_b, j|\n if i != j\n target_roles.each do |trole|\n assert_perms_work_in_combination :post, luser, trole,\n perms_set_a.first + perms_set_b.first,\n [ perms_set_a.last, perms_set_b.last ]\n end\n end\n end\n end\n\n end\n\n end",
"title": ""
},
{
"docid": "e4385d1a40c49084dcbf2cdbc8fa8075",
"score": "0.47322738",
"text": "def setup_gis(config_)\n # Initial setup of the database: Add schemas from the search path.\n # If a superuser is given, we log in as the superuser, but we make sure\n # the schemas are owned by the regular user.\n username_, su_username_, su_password_, has_su_ = get_su_auth(config_)\n ::ActiveRecord::Base.establish_connection(config_.merge('schema_search_path' => 'public', 'username' => su_username_, 'password' => su_password_))\n conn_ = ::ActiveRecord::Base.connection\n search_path_ = get_search_path(config_)\n quoted_username_ = ::ActiveRecord::Base.connection.quote_column_name(username_)\n auth_ = has_su_ ? \" AUTHORIZATION #{quoted_username_}\" : ''\n search_path_.each do |schema_|\n exists = schema_.downcase == 'public' || conn_.execute(\"SELECT 1 FROM pg_catalog.pg_namespace WHERE nspname='#{schema_}'\").try(:first)\n conn_.execute(\"CREATE SCHEMA #{schema_}#{auth_}\") unless exists\n end\n\n script_dir_ = config_['script_dir']\n postgis_extension_ = config_['postgis_extension']\n if script_dir_ || postgis_extension_\n postgis_schema_ = search_path_.include?('postgis') ? 'postgis' : (search_path_.last || 'public')\n if script_dir_\n # Use script_dir (for postgresql < 9.1 or postgis < 2.0)\n conn_.execute(\"SET search_path TO #{postgis_schema_}\")\n conn_.execute(::File.read(::File.expand_path('postgis.sql', script_dir_)))\n conn_.execute(::File.read(::File.expand_path('spatial_ref_sys.sql', script_dir_)))\n elsif postgis_extension_\n # Use postgis_extension (for postgresql >= 9.1 and postgis >= 2.0)\n postgis_extension_ = 'postgis' if postgis_extension_ == true\n postgis_extension_ = postgis_extension_.to_s.split(',') unless postgis_extension_.is_a?(::Array)\n postgis_extension_.each do |extname_|\n if extname_ == 'postgis_topology'\n raise ArgumentError, \"'topology' must be in schema_search_path for postgis_topology\" unless search_path_.include?('topology')\n conn_.execute(\"CREATE EXTENSION #{extname_} SCHEMA topology\")\n else\n conn_.execute(\"CREATE EXTENSION #{extname_} SCHEMA #{postgis_schema_}\")\n end\n end\n end\n if has_su_\n conn_.execute(\"GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA #{postgis_schema_} TO #{quoted_username_}\")\n conn_.execute(\"GRANT ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA #{postgis_schema_} TO #{quoted_username_}\")\n\n postgis_version = conn_.execute( \"SELECT #{postgis_schema_}.postgis_version();\" ).first[ 'postgis_version' ]\n if postgis_version =~ /^2/\n conn_.execute(\"ALTER VIEW #{postgis_schema_}.geometry_columns OWNER TO #{quoted_username_}\")\n conn_.execute(\"ALTER VIEW #{postgis_schema_}.geography_columns OWNER TO #{quoted_username_}\")\n else\n conn_.execute(\"ALTER TABLE #{postgis_schema_}.geometry_columns OWNER TO #{quoted_username_}\")\n end\n conn_.execute(\"ALTER TABLE #{postgis_schema_}.spatial_ref_sys OWNER TO #{quoted_username_}\")\n end\n end\nend",
"title": ""
},
{
"docid": "7b7a26c02f00e8ede8251b5bfcc9c419",
"score": "0.4728956",
"text": "def grant_all!\n @all_permissions=true\n end",
"title": ""
},
{
"docid": "b44ad1a7887cd6f09f361bc89a8ff2b5",
"score": "0.47278264",
"text": "def schemas(stream)\n # Don't create \"public\" schema since it exists by default.\n schema_names = PgPower::Tools.schemas - [\"public\", \"information_schema\"]\n schema_names.each do |schema_name|\n schema(schema_name, stream)\n end\n stream << \"\\n\"\n end",
"title": ""
},
{
"docid": "c288006a9e4ae3cf82c70af011d525a6",
"score": "0.4721571",
"text": "def alter_function_schema(name, *args)\n raise ArgumentError.new(\"Expected 2-3 arguments\") unless args.length.between?(1, 2)\n\n options = args.extract_options!\n set_schema = args.pop\n arguments = args.pop\n\n execute PostgreSQLFunctionAlterer.new(self, name, arguments, :set_schema => set_schema).to_s\n end",
"title": ""
},
{
"docid": "33a34f9dc6f9e04e55716fd0956d541e",
"score": "0.471282",
"text": "def declare_privilege *args\n args.each do |arg| \n if !arg.is_a?( Symbol )\n raise ArgumentError, \n \"Attempt to declare #{arg.inspect}, not a symbol, \" +\n \"as a privilege\"\n end\n unless declared_privileges.include?( arg )\n write_inheritable_array( :declared_privileges, [arg] )\n end\n end\n end",
"title": ""
},
{
"docid": "2eb917bc7f420e177c6ff369a028b49a",
"score": "0.47121137",
"text": "def test_allows\n\n User.as( users( :universal_grant_guy )) do\n\n # XXX need to test combinations of these...\n\n simple_allow_test users(:lucy), \n { :target_owner => users(:lucy) },\n { :owner => users(:lucy) },\n { :owner => users(:fred) }\n \n simple_allow_test users(:lucy), \n { :target_owner_firm => firms(:dubuque) },\n { :owner_firm => firms(:dubuque) },\n { :owner_firm => firms(:mertz) }\n\n simple_allow_test users(:lucy), \n { :target_owned_by_self => true },\n { :owner => users(:lucy) },\n { :owner => users(:fred) }\n\n # one_permission targets are, regrettably, a special case...\n\n perm = blog_post_permission :target => blogs(:mertz_blog),\n :role => roles(:ricardo_twiddler)\n\n with_access_granting_tweaks( perm ) do |msg|\n assert perm.allows?(blogs(:mertz_blog),:post,users(:fred))\n end\n\n with_access_blocking_tweaks( perm ) do |msg|\n assert !perm.allows?(blogs(:mertz_blog),:post,users(:fred))\n end\n\n other_blog = Blog.create :name => \"Ricardo blog\"\n\n assert !perm.allows?( other_blog, :post, users(:fred) )\n\n end\n\n end",
"title": ""
},
{
"docid": "707606f5f36e5fbb59724a5b93e1e7fa",
"score": "0.47052383",
"text": "def update_grants(bucket_name, grants)\n S3.client.put_bucket_acl({\n bucket: bucket_name,\n access_control_policy: {\n grants: grants.values.map(&:to_aws).flatten,\n owner: S3.full_bucket(bucket_name).acl.owner\n }\n })\n end",
"title": ""
},
{
"docid": "66876f626fa3d0208ed1fc33771e33e8",
"score": "0.4698444",
"text": "def allow(*roles)\n return roles\n end",
"title": ""
},
{
"docid": "03ce50e752745f7626a9e1a68523d09b",
"score": "0.46931466",
"text": "def grant_all\n @_granted = all_permissions\n end",
"title": ""
},
{
"docid": "fadf8a185eca4867104e2f55d0164938",
"score": "0.4688099",
"text": "def grant_admin\n update_attribute(:admin, true)\n update_attribute(:approved, true)\n end",
"title": ""
},
{
"docid": "59808eec75cfb42d0deff92631915765",
"score": "0.46866614",
"text": "def grant_all_to(user)\n return false if user.nil? && !user.is_a?(MySQL::User)\n MysqlAdapter.execute \"GRANT ALL ON #{name}.* TO #{user.name}@'#{user.host}'\"\n true\n rescue Mysql::Error\n false\n end",
"title": ""
},
{
"docid": "d22d881f7aacde5b898be76065b21289",
"score": "0.4684748",
"text": "def schemas(stream)\n # Don't create \"public\" schema since it exists by default.\n schema_names = PgSaurus::Tools.schemas - [\"public\", \"information_schema\"]\n schema_names.each do |schema_name|\n schema(schema_name, stream)\n end\n stream << \"\\n\"\n end",
"title": ""
},
{
"docid": "7daf1faa7209a1a6650e64713852a3fd",
"score": "0.4683497",
"text": "def setup_single_user_schema\n set_user_privileges_at_db\n rebuild_quota_trigger\n create_ghost_tables_event_trigger\n end",
"title": ""
},
{
"docid": "e1a33572f3cd53a524590210d22d56c1",
"score": "0.46826357",
"text": "def create_server_admins_global_group_in_bifrost(users_authz_id)\n @server_admins_authz_id = create_group_in_authz(bifrost_superuser_id)\n %w{create read update delete}.each do |permission|\n # grant server admins group permission on the users container,\n # as the erchef superuser.\n grant_authz_object_permission(permission, \"groups\", \"containers\", users_authz_id,\n server_admins_authz_id, superuser_authz_id)\n # grant superuser actor permissions on the server admin group,\n # as the bifrost superuser\n grant_authz_object_permission(permission, \"actors\", \"groups\", server_admins_authz_id,\n superuser_authz_id, bifrost_superuser_id)\n end\n\n # Grant server-admins read permissions on itself as the bifrost superuser.\n grant_authz_object_permission(\"read\", \"groups\", \"groups\", server_admins_authz_id,\n server_admins_authz_id, bifrost_superuser_id)\n end",
"title": ""
},
{
"docid": "9b0462e58b11a2114c02e42adb37b3e1",
"score": "0.46809694",
"text": "def check_permission(conn, username, role)\n\n select_sql = \"select * from DBA_ROLE_PRIVS where GRANTEE='#{username}' and GRANTED_ROLE='#{role}'\"\n select_stmt = conn.create_statement\n response = select_stmt.execute_query select_sql\n\n throw 'User dont have permission for this action' if response.empty?\n end",
"title": ""
},
{
"docid": "028008b8fe440f44d2f15a40ffd03c9a",
"score": "0.46796194",
"text": "def change_privileges\n Process.egid = @opts[:group] if @opts[:group_given]\n Process.euid = @opts[:user] if @opts[:user_given]\n end",
"title": ""
},
{
"docid": "32a39873babf658bef08e0e77223f9bb",
"score": "0.46766603",
"text": "def set_admin(params)\n if Storey.schema_exists?(params[:schema])\n Apartment::Database.switch(params[:schema])\n @roles = [{name: 'admin'},\n {name: 'Giám đốc'},\n {name: 'Thư ký'},\n {name: 'Kiểm soát vé'},\n {name: 'Nhân viên bán vé'},\n {name: 'Tài xế'},\n {name: 'Tiếp viên'},\n {name: 'Thủ Kho'},\n {name: 'Kế toán'},\n {name: 'Nhân sự'}]\n Role.create(@roles)\n user = User.create!(\n username: 'admin',\n email: params[:email], password: '12344321'\n )\n\n # Send Mail to user\n # Do it later\n end\n end",
"title": ""
},
{
"docid": "898c2dc1e0c66d14342869275beceb55",
"score": "0.46718898",
"text": "def grant_aliases(hash)\n aliases = read_inheritable_attribute(:grant_alias_hash) || Hash.new{|h,k| h[k] = []}\n aliased = read_inheritable_attribute(:aliased_grants) || {}\n hash.each_pair do |grant, allows|\n [*allows].each do |allowed|\n aliases[allowed.to_sym] << grant.to_sym\n aliased[grant.to_sym] = allowed.to_sym\n move_policies(grant, allowed)\n end\n end\n write_inheritable_attribute(:grant_alias_hash, aliases)\n write_inheritable_attribute(:aliased_grants, aliased)\n end",
"title": ""
},
{
"docid": "43f8784db890777e9abd840f1f3ddc79",
"score": "0.46697915",
"text": "def create_server_admins_global_group_in_bifrost(users_authz_id)\n @server_admins_authz_id = create_group_in_authz(bifrost_superuser_id)\n %w(create read update delete).each do |permission|\n # grant server admins group permission on the users container,\n # as the erchef superuser.\n grant_authz_object_permission(permission, 'groups', 'containers', users_authz_id,\n server_admins_authz_id, superuser_authz_id)\n # grant superuser actor permissions on the server admin group,\n # as the bifrost superuser\n grant_authz_object_permission(permission, 'actors', 'groups', server_admins_authz_id,\n superuser_authz_id, bifrost_superuser_id)\n end\n\n # Grant server-admins read permissions on itself as the bifrost superuser.\n grant_authz_object_permission('read', 'groups', 'groups', server_admins_authz_id,\n server_admins_authz_id, bifrost_superuser_id)\n end",
"title": ""
},
{
"docid": "42cbcdf0913d843121e1ecf08a6bce5b",
"score": "0.46691576",
"text": "def grant_admin\n update_attributes(:admin => true)\n update_attributes(:approved => true)\n end",
"title": ""
}
] |
3ea12e0ecce4eb6c2d88bf87f8446bee
|
The maximum number of blocks that this endpoint wants to process before needing a rekey. source://netssh//lib/net/ssh/transport/state.rb50
|
[
{
"docid": "2e852129685a7118977f1820a526510b",
"score": "0.6702317",
"text": "def max_blocks=(_arg0); end",
"title": ""
}
] |
[
{
"docid": "cc00ff5512a13690536e0e895df4241d",
"score": "0.7375075",
"text": "def block_size\n\t\t25\n\tend",
"title": ""
},
{
"docid": "4109f78ce726c5300ba27252aaeabe84",
"score": "0.7261358",
"text": "def block_size; end",
"title": ""
},
{
"docid": "1683972834fb478797e557e3096aee1d",
"score": "0.7110955",
"text": "def remote_maximum_packet_size; end",
"title": ""
},
{
"docid": "1039761d0e60fe369f509455672f1d7c",
"score": "0.7022037",
"text": "def max_blocks; end",
"title": ""
},
{
"docid": "f744ca3f54feab54dd8accb51eba8a69",
"score": "0.68256146",
"text": "def max_packet_size(endpoint_number); end",
"title": ""
},
{
"docid": "1fbb2fa5222209557680f94c7d58b6c9",
"score": "0.6804196",
"text": "def max_packets; end",
"title": ""
},
{
"docid": "6ad6122f5bd435232366e64e26f202a8",
"score": "0.67835844",
"text": "def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end",
"title": ""
},
{
"docid": "425d63b9651e15846694325ed165c513",
"score": "0.6716118",
"text": "def block_size\n self[:block_size]\n end",
"title": ""
},
{
"docid": "e4f828c132f19fd72b97c93d53beafe8",
"score": "0.66619873",
"text": "def def_block_size\n 16384\n end",
"title": ""
},
{
"docid": "bdd8259c0798a1550e0b0c2925321808",
"score": "0.64838576",
"text": "def block_length()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "bdd8259c0798a1550e0b0c2925321808",
"score": "0.64838576",
"text": "def block_length()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "2109f4a05720d4cdcc36514c2547617d",
"score": "0.6472118",
"text": "def local_maximum_packet_size; end",
"title": ""
},
{
"docid": "a0b6f42152a4a27f246201d3b47ef286",
"score": "0.64500695",
"text": "def block_length\n 1\n end",
"title": ""
},
{
"docid": "dd501922f37ab3530a4b87fed85dbd46",
"score": "0.6368097",
"text": "def max_buffer_size; end",
"title": ""
},
{
"docid": "40353bf0390b2723971b52b6df2d61d9",
"score": "0.6365091",
"text": "def block_size()\n # KB MB\n 4 * 1024 * 1024\n end",
"title": ""
},
{
"docid": "330a9b0c04feb660f67a5de8f9e869e1",
"score": "0.6341561",
"text": "def max_iso_packet_size(endpoint_number); end",
"title": ""
},
{
"docid": "cc51b6bdb60e24f4fa008ec5279ef851",
"score": "0.63222605",
"text": "def block_count\n request('getblockcount')\n end",
"title": ""
},
{
"docid": "889ca969337ca253be64007f563e318d",
"score": "0.62535805",
"text": "def connection_pool_maximum_size\n super\n end",
"title": ""
},
{
"docid": "e9bcf61de78ac12c2b55dbbb8462a1e7",
"score": "0.62311304",
"text": "def min_size()\n AUTHENTICATION_CONTINUE_MIN_SIZE\n end",
"title": ""
},
{
"docid": "4ca99bb469fa735b999f4f11c9bd4485",
"score": "0.62172043",
"text": "def block_size\n 1_048_576\n end",
"title": ""
},
{
"docid": "b20bcb01a6954c4d9ed6c815acc7c333",
"score": "0.61525476",
"text": "def block_size\n 1_048_576\n end",
"title": ""
},
{
"docid": "5674244ceaea4d761b9410bf96d486d4",
"score": "0.6138698",
"text": "def maxbytes\n @maxbytes ||= File.read('/proc/sys/kernel/keys/maxbytes').strip.to_i\n end",
"title": ""
},
{
"docid": "3b74eb3bd25c091e6372fda84e69b2c5",
"score": "0.6123645",
"text": "def blksize() end",
"title": ""
},
{
"docid": "17be3905e63b490fbe31d4db81d215f6",
"score": "0.6112211",
"text": "def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end",
"title": ""
},
{
"docid": "f03292f8d9ca65a989f47edc8c828089",
"score": "0.60657495",
"text": "def block_reference_count; end",
"title": ""
},
{
"docid": "bcf569277d6bde4e79f03fce6a3fba24",
"score": "0.6064934",
"text": "def block_size\n check_valid\n md.block_size\n end",
"title": ""
},
{
"docid": "976f89abf79972a31d5da661600425de",
"score": "0.6060092",
"text": "def max_length\n @executor.getMaximumPoolSize\n end",
"title": ""
},
{
"docid": "e7bf718a4c6fcfc569d1bc9ff9496ced",
"score": "0.60424435",
"text": "def max_packets=(_arg0); end",
"title": ""
},
{
"docid": "308fb67b858f371f0ecab6c0192bae52",
"score": "0.6037879",
"text": "def maximum_hash_buffer_size\n super\n end",
"title": ""
},
{
"docid": "e8f7c075c18f5ce4a0cc89d48705f8fc",
"score": "0.60047704",
"text": "def max_command_length; end",
"title": ""
},
{
"docid": "78fabf69a5f6590af5cc13f09a93a27c",
"score": "0.60002166",
"text": "def getblockcount\n request :getblockcount\n end",
"title": ""
},
{
"docid": "03763c775b7a8cc34bc2f3ece316d325",
"score": "0.5976058",
"text": "def chunk_size\n 4096\n end",
"title": ""
},
{
"docid": "54b389996840a8717e1b6b4b3f3e9aaf",
"score": "0.59749365",
"text": "def max_size; end",
"title": ""
},
{
"docid": "33f069d447c79152d822068973063ae8",
"score": "0.59715605",
"text": "def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end",
"title": ""
},
{
"docid": "f1d76f4c19f330f525cd7a12a7d871b9",
"score": "0.59700584",
"text": "def pool_capacity; end",
"title": ""
},
{
"docid": "52c60581a199c411a5c525ed97de97aa",
"score": "0.59348667",
"text": "def max_size()\n AUTHENTICATION_REPLY_MAX_SIZE\n end",
"title": ""
},
{
"docid": "53340328e982d2005baf7a3fb288df73",
"score": "0.5930076",
"text": "def required_space\n # Start with our cached default generated size\n space = 300\n\n # Reliability adds 10 bytes for recv error checks\n space += 10\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "53340328e982d2005baf7a3fb288df73",
"score": "0.5930076",
"text": "def required_space\n # Start with our cached default generated size\n space = 300\n\n # Reliability adds 10 bytes for recv error checks\n space += 10\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "061bf549cb83a47ac138c09ca6c0edd3",
"score": "0.5919849",
"text": "def entry_size; BLOCK_SIZE; end",
"title": ""
},
{
"docid": "061bf549cb83a47ac138c09ca6c0edd3",
"score": "0.5919849",
"text": "def entry_size; BLOCK_SIZE; end",
"title": ""
},
{
"docid": "5dd7a4747f2b4dcdaa57c458f82f7e99",
"score": "0.5902856",
"text": "def getblockcount\n coind.getblockcount\n end",
"title": ""
},
{
"docid": "1bd19623ae1fa8121612193afc454bab",
"score": "0.5889596",
"text": "def server_sizelimit\n @connection.opt[:sizelimit]\n end",
"title": ""
},
{
"docid": "70d06261fec495cc66e5afc493fe151a",
"score": "0.5875977",
"text": "def chunk_size\n @connection.chunk_size\n end",
"title": ""
},
{
"docid": "07c783c05469664f39eb505d170e0164",
"score": "0.5873512",
"text": "def rekey_limit; end",
"title": ""
},
{
"docid": "a649ff21da6383a52e680c1817db2d37",
"score": "0.58598447",
"text": "def maximum_limit\n 100\n end",
"title": ""
},
{
"docid": "ac9e4401795a58ea541ba6d2ae812e80",
"score": "0.58594406",
"text": "def max_recv_speed_large=(value)\n Curl.set_option(:max_recv_speed_large, value_for(value, :int), handle)\n end",
"title": ""
},
{
"docid": "d780b340bdbff5613afd06f5ad96507d",
"score": "0.58455116",
"text": "def last_peer_count\n\t\t\t@last_peer_count ||= 50\n\t\tend",
"title": ""
},
{
"docid": "bb2f6f5566d70763be285592ac2abe3b",
"score": "0.583955",
"text": "def max_retry\n 5\n end",
"title": ""
},
{
"docid": "4bf214d9d2281d1835945622d0f578f0",
"score": "0.58334106",
"text": "def retry_limit\n @retry_limit ||= backoff_strategy.length\n end",
"title": ""
},
{
"docid": "aaa95997e4c5bb418930c498b4841f10",
"score": "0.5826489",
"text": "def item_max; 64; end",
"title": ""
},
{
"docid": "fa22ca29772771065fd8a32fdc08fb84",
"score": "0.5825979",
"text": "def def_max_loops\n 1024\n end",
"title": ""
},
{
"docid": "2c1896c17e44b25fa69f1d966b4265b0",
"score": "0.5808235",
"text": "def block_count; @data[17].to_i; end",
"title": ""
},
{
"docid": "4aa0d4ee959f6f8ac03996d0d64b9ede",
"score": "0.58017933",
"text": "def max_chunk_size=(size)\n case size.to_s.downcase\n when 'wan'\n @max_chunk_size = 1420\n when 'lan'\n @max_chunk_size = 8154\n else\n @max_chunk_size = size.to_int\n end\n end",
"title": ""
},
{
"docid": "e979af33bf93a5ded3a2df4ac974aee8",
"score": "0.5794069",
"text": "def max_size()\n ACCOUNTING_REQUEST_MAX_SIZE\n end",
"title": ""
},
{
"docid": "bf1b4d8c030df00b15e2de657428b82e",
"score": "0.5792122",
"text": "def max_file_buffer=(bytes); end",
"title": ""
},
{
"docid": "8d6745b97ed960429beb0d85b569d8fa",
"score": "0.5785765",
"text": "def largest_length\n @executor.getLargestPoolSize\n end",
"title": ""
},
{
"docid": "b3a2ea49ca1272ac0151619dfc75d3cd",
"score": "0.57708114",
"text": "def poll_max_retries\n 3\n end",
"title": ""
},
{
"docid": "52999ea1beb91145c7743f0000ac1199",
"score": "0.5768733",
"text": "def erlang_process_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.proc_used<.proc_total*.8'`\n end",
"title": ""
},
{
"docid": "6c8c16aef249118497c51fa02fbd974b",
"score": "0.57657033",
"text": "def max_retries\n @max_retries ||= options[:max_retries] || seeds.size\n end",
"title": ""
},
{
"docid": "27b4545a7fca6ad1a96319604df6bde8",
"score": "0.57640743",
"text": "def connection_pool_minimum_size\n super\n end",
"title": ""
},
{
"docid": "786af66ce8c22987db3d5daada3f771c",
"score": "0.5756334",
"text": "def max_file_buffer\n @agent.max_file_buffer\n end",
"title": ""
},
{
"docid": "7321d71fd6835ba9dcea57835ec76ca7",
"score": "0.5748064",
"text": "def remote_maximum_window_size; end",
"title": ""
},
{
"docid": "b686644487710fb4a4961983ab807283",
"score": "0.5747786",
"text": "def pool_size\n @pool.pool_size\n end",
"title": ""
},
{
"docid": "ea9c51a35382921e9d8369a6bd23cc3e",
"score": "0.5747142",
"text": "def max_file_buffer; end",
"title": ""
},
{
"docid": "ea9c51a35382921e9d8369a6bd23cc3e",
"score": "0.5747142",
"text": "def max_file_buffer; end",
"title": ""
},
{
"docid": "b4beb5fa4199f2e52f047b880e253a7f",
"score": "0.57429993",
"text": "def max_attempts\n 5\n end",
"title": ""
},
{
"docid": "01b60ec690dbddfaf731778c73c7ae93",
"score": "0.5727502",
"text": "def specific_max_size(number); end",
"title": ""
},
{
"docid": "5f021a251b7c09b660e41a7afd09f6c1",
"score": "0.5724664",
"text": "def max_queue_count()\n @max_queue_count\n end",
"title": ""
},
{
"docid": "86b50e907f105cada62dacf7c823a18b",
"score": "0.5723574",
"text": "def worker_pool_size; end",
"title": ""
},
{
"docid": "d6b3903dfd25123cbce7a2bb9e620a44",
"score": "0.5716628",
"text": "def storage_pool_size\n @storage_pool_size ||= 20\n end",
"title": ""
},
{
"docid": "d6b3903dfd25123cbce7a2bb9e620a44",
"score": "0.5716628",
"text": "def storage_pool_size\n @storage_pool_size ||= 20\n end",
"title": ""
},
{
"docid": "1445593c4984a144cf358ef7bfe03391",
"score": "0.57127714",
"text": "def nr_chunks\n ENV['NR_CHUNKS'] ? ENV['NR_CHUNKS'].to_i : 10\n end",
"title": ""
},
{
"docid": "9837f550812ada2ce456d56d0d9bebfc",
"score": "0.5710625",
"text": "def maximum_frame_size\n\t\t\t\t@remote_settings.maximum_frame_size\n\t\t\tend",
"title": ""
},
{
"docid": "e6839632b0c3974fc458135be117fd45",
"score": "0.5693647",
"text": "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",
"title": ""
},
{
"docid": "dcb4f37f2e33ba4ecebf193a371d5f97",
"score": "0.56935483",
"text": "def set_connection_pool_maximum_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end",
"title": ""
},
{
"docid": "9e1795adbc1c384d26d8d66bd6c34fda",
"score": "0.5686229",
"text": "def max_buffer_size=(_arg0); end",
"title": ""
},
{
"docid": "3a924ce124f4733121a9b5e9ab5d65dc",
"score": "0.5685673",
"text": "def waitlist_size\n @queue.size\n end",
"title": ""
},
{
"docid": "44967ac864a5aff42c4113a4991119c9",
"score": "0.56707066",
"text": "def max\n start_addr + size - 1\n end",
"title": ""
},
{
"docid": "65b4d80a2a2f08f9af6254f271908d86",
"score": "0.56663716",
"text": "def max_allowed_packet\n NO_MAX_PACKET\n end",
"title": ""
},
{
"docid": "883acb2327f8aa2337913c2f54891592",
"score": "0.5656753",
"text": "def block_size\n session.chosen_service.duration rescue session.business.services.first.duration\n end",
"title": ""
},
{
"docid": "f631c7ee09b2147aeb8d5b68d602a7a8",
"score": "0.56532",
"text": "def max_size\n 1\n end",
"title": ""
},
{
"docid": "9f7547096ea4293b01e7b2aad07cc501",
"score": "0.5636541",
"text": "def maxkeys\n @maxkeys ||= File.read('/proc/sys/kernel/keys/maxkeys').strip.to_i\n end",
"title": ""
},
{
"docid": "c39b98166a513c93a1a1c35acf515a8f",
"score": "0.5618759",
"text": "def size\n @size ||= begin\n block_count * block_size unless block_count.nil? || block_size.nil?\n end\n end",
"title": ""
},
{
"docid": "e743db4ec70e3b526662bd9833e60889",
"score": "0.56120646",
"text": "def chunk_size()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "a96d32edaea257f1158da0662f465609",
"score": "0.5609762",
"text": "def maximum_queued_data_size\n super\n end",
"title": ""
},
{
"docid": "ebce20af89768c9821cfd39c4f504018",
"score": "0.5607128",
"text": "def max_retries\n MAX_RETRIES + (@invalid_signature_error && @invalid_path_error ? 1 : 0)\n end",
"title": ""
},
{
"docid": "27e5cbd6e0c3cf4fe15fa89296137dff",
"score": "0.5605691",
"text": "def patch_hard_limit_bytes\n Gitlab::CurrentSettings.diff_max_patch_bytes\n end",
"title": ""
},
{
"docid": "049b10e54261307612cb0928dbef3ea2",
"score": "0.55955875",
"text": "def getblockcount\n @api.request 'getblockcount'\n end",
"title": ""
},
{
"docid": "190062b7ce7f35f21fb348f9d0408408",
"score": "0.557795",
"text": "def max_size\n @group.max_size\n end",
"title": ""
},
{
"docid": "fcbbfbadd9d09781c2ee39863fe0a501",
"score": "0.55777127",
"text": "def waiting_size\n @waiting.size\n end",
"title": ""
},
{
"docid": "24fac2aa699033c3e1c0b2f07c1568c2",
"score": "0.55734026",
"text": "def max_send_speed_large=(value)\n Curl.set_option(:max_send_speed_large, value_for(value, :int), handle)\n end",
"title": ""
},
{
"docid": "3c49e4a5e693f66ab547756bbaf507e7",
"score": "0.55726004",
"text": "def connection_limit\n super\n end",
"title": ""
},
{
"docid": "3c49e4a5e693f66ab547756bbaf507e7",
"score": "0.55726004",
"text": "def connection_limit\n super\n end",
"title": ""
},
{
"docid": "3c49e4a5e693f66ab547756bbaf507e7",
"score": "0.55726004",
"text": "def connection_limit\n super\n end",
"title": ""
},
{
"docid": "808ba5e2cff51d8cb637815e665e5418",
"score": "0.5572158",
"text": "def file_descriptors_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.fd_used<.fd_total*.8'`\n end",
"title": ""
},
{
"docid": "109007df2e5d8e7c8691749b20464865",
"score": "0.5542849",
"text": "def limit\n components.fetch(:size)\n end",
"title": ""
},
{
"docid": "b0ffc1b6f590482e285d0ed5a628662d",
"score": "0.55395204",
"text": "def maximum_requests\n super\n end",
"title": ""
},
{
"docid": "06430669cd8eff94e301aef9c4d95bab",
"score": "0.5533203",
"text": "def length\n @executor.getPoolSize\n end",
"title": ""
},
{
"docid": "cfc97a769696da22c5f95150be2e1c37",
"score": "0.5530236",
"text": "def get_max_interactions\n return @snps.length-1\n end",
"title": ""
},
{
"docid": "47d7789ffcb87c33105a4ae9287375db",
"score": "0.5512478",
"text": "def max_retries\n @max_retries ||= DEFAULT_MAX_RETRY_ATTEMPTS\n end",
"title": ""
}
] |
d0669b056a10612f450faa31f8b469ab
|
If class method, returns target method's name prefixed with double colons. If instance method, then returns target method's name prefixed with hash character.
|
[
{
"docid": "9798767fdbee61e7cc982d6a6c358b86",
"score": "0.5948668",
"text": "def name\n \"::#{target}\"\n end",
"title": ""
}
] |
[
{
"docid": "4fcbcc8a0c43647bf12229903dedaa0f",
"score": "0.75379646",
"text": "def calc_full_method_name(class_name, method_name)\n mn = method_name.to_s\n class_name + \n (if mn =~ /^.*\\.(.*)$/\n '.' + $1 # class method\n else\n '#' + mn # instance method\n end)\n end",
"title": ""
},
{
"docid": "e121790cbdf36b645d03b47f9248160d",
"score": "0.73191184",
"text": "def _method_name(klass)\n klass.to_s.downcase.gsub(\"::\", \"_\")\n end",
"title": ""
},
{
"docid": "f76fc8a73140fe1b968f513068b0840b",
"score": "0.7288196",
"text": "def method_name\n if method.is_a?(Method) # A singleton method?\n # The method owner is the singleton class of the class. Sadly, the\n # the singleton class has no name; hence we try to construct the name\n # from its to_s description.\n klass_name = method.owner.to_s.gsub(/#<(.*?):(.*)>/, \"\\\\2\")\n \"#{klass_name}.#{method.name}\"\n else\n \"#{method.owner}##{method.name}\"\n end\n end",
"title": ""
},
{
"docid": "37409042515bd2c6fa271b6d56c84a07",
"score": "0.7175859",
"text": "def method\n @method ||= self.class.to_s.split(\"::\").last.\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"title": ""
},
{
"docid": "e2e0b1cea3b7820b7800e92cf1a1bf26",
"score": "0.70441043",
"text": "def method_full_name\n defined_class_s = defined_class.to_s\n is_module_class_method = defined_class_s.start_with?('#<Class:')\n if is_module_class_method\n defined_class_s.gsub!(/^#<Class:/, '').delete!('>')\n \"#{defined_class_s}.#{method_id}\"\n elsif module_method?\n \"#{defined_class}##{method_id}\"\n else\n instance_method = !(_self.class == Class)\n instance_method ?\n \"#{defined_class}##{method_id}\" :\n \"#{_self}.#{method_id}\"\n end\n end",
"title": ""
},
{
"docid": "ac1e1b8cef75d2baf36a1251555a6f90",
"score": "0.7000061",
"text": "def name\n @method.name.to_s\n end",
"title": ""
},
{
"docid": "4b883cc85cf20017db1992aa5a13df87",
"score": "0.69890857",
"text": "def method_name\n @method.to_s.split('/').last.to_s\n end",
"title": ""
},
{
"docid": "f35f97f4e9e04d94df91d98b753bcb4b",
"score": "0.696324",
"text": "def name\n \"#{@method_name}(#{self.class.name})\"\n end",
"title": ""
},
{
"docid": "383e4e93643285a336e0cf8dd36f8390",
"score": "0.689344",
"text": "def name\n @method.name\n end",
"title": ""
},
{
"docid": "5c185bbc9500342cd60ebd2bae6a17b6",
"score": "0.687417",
"text": "def method_name; self.class.name.split('::')[-1]; end",
"title": ""
},
{
"docid": "024e933a7baf68ee575d52189d3eb31b",
"score": "0.68130475",
"text": "def method_name\n return @method_name if defined? @method_name\n\n @method_name = protocol_name.downcase.gsub('::', '_')\n end",
"title": ""
},
{
"docid": "86b29c7d5839c5a27f1f3ae5285c4d8e",
"score": "0.6763893",
"text": "def ruby_name_for_method(method)\n return \"<no method>\" if method.nil?\n method.resource.controller.name + \"#\" + method.method\n end",
"title": ""
},
{
"docid": "d9e5623dbd97ad106e6c63e9ed446750",
"score": "0.67187905",
"text": "def method_name(method)\n return nil if method.nil?\n if method.singleton\n i = method.full_name.rindex('::') \n method.full_name[0...i] + '.' + method.full_name[i+2..-1]\n else\n method.full_name\n end\n end",
"title": ""
},
{
"docid": "90f27fa9036efbef6d44ec544b341189",
"score": "0.6713515",
"text": "def moniker(method)\n :\"__#{method}__#{@object.__id__}\"\n end",
"title": ""
},
{
"docid": "c71d2d86ddc3f44d37b8507997ba7196",
"score": "0.6697914",
"text": "def name\n to_property!(__method__)\n end",
"title": ""
},
{
"docid": "18ec8d3aeb88a209fe0af72ce97e998c",
"score": "0.6695257",
"text": "def hook_method_name(target_method, prefix, suffix)\n target_method = target_method.to_s\n\n case target_method[-1,1]\n when '?' then \"#{prefix}_#{target_method[0..-2]}_ques_#{suffix}\"\n when '!' then \"#{prefix}_#{target_method[0..-2]}_bang_#{suffix}\"\n when '=' then \"#{prefix}_#{target_method[0..-2]}_eq_#{suffix}\"\n # I add a _nan_ suffix here so that we don't ever encounter\n # any naming conflicts.\n else \"#{prefix}_#{target_method[0..-1]}_nan_#{suffix}\"\n end\n end",
"title": ""
},
{
"docid": "e901f9de990659391a31be3b4f363dcd",
"score": "0.66844714",
"text": "def method\n @method.to_sym\n end",
"title": ""
},
{
"docid": "bfdf630f3e914c396b8141133a7ffea2",
"score": "0.6681204",
"text": "def method_name #:nodoc:\n @method_name ||= begin\n m = \"_#{identifier_method_name}__#{@identifier.hash}_#{__id__}\"\n m.tr!('-', '_')\n m\n end\n end",
"title": ""
},
{
"docid": "07327355267c77f611e3e04235b6f190",
"score": "0.6617352",
"text": "def ruby_method_name\n (self[:type][0..3].downcase + '_' + self[:name].underscore).to_sym\n end",
"title": ""
},
{
"docid": "20cc9f0736e2217f69bf55f1f0522d88",
"score": "0.6568999",
"text": "def method_name\n name\n end",
"title": ""
},
{
"docid": "2470e9633de473281681a510f75a0497",
"score": "0.6567155",
"text": "def method\n @method.to_sym\n end",
"title": ""
},
{
"docid": "07177c3fbce979a005a0e6422f833438",
"score": "0.65468144",
"text": "def method\n @method ||= self.class.to_s.split('::').last.camelize(:lower)\n end",
"title": ""
},
{
"docid": "dc097f7dfdad3dd6cdd54869e1448587",
"score": "0.653547",
"text": "def method_name\n name_segments.last\n end",
"title": ""
},
{
"docid": "d9e3bc442f4b6f5b6e0a433cff3d03b7",
"score": "0.6534985",
"text": "def method_name\n METHOD_PREFIX + hash_key\n end",
"title": ""
},
{
"docid": "e5d804f23d3d066794d0d341e7d898c8",
"score": "0.65039384",
"text": "def ruby_method_for(clazz)\n command_name_of(clazz).gsub(/[:\\-]/, '_').to_sym\n end",
"title": ""
},
{
"docid": "311a552c93a916feedc9d7a4db15ed99",
"score": "0.65024686",
"text": "def method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"title": ""
},
{
"docid": "23914ceb1d670a376aca6567023b7d3b",
"score": "0.64603674",
"text": "def method_name\n name\n end",
"title": ""
},
{
"docid": "f694f85024efa64a555b25b74989b415",
"score": "0.64426106",
"text": "def method_name\n deface_hash = Deface::Override.digest(:virtual_path => @virtual_path)\n\n #we digest the whole method name as if it gets too long there's problems\n \"_#{Digest::MD5.new.update(\"#{deface_hash}_#{method_name_without_deface}\").hexdigest}\"\n end",
"title": ""
},
{
"docid": "e7cfbf2987f94e4cd215936fa232d5c9",
"score": "0.6432097",
"text": "def method_name\n @method_name ||= name.to_s.downcase.gsub(\"-\", \"_\") unless name.nil?\n end",
"title": ""
},
{
"docid": "1fbd3ad1c5b06c391f5c07ebe41dfefb",
"score": "0.6421375",
"text": "def method_name\n @raw[1].to_s\n end",
"title": ""
},
{
"docid": "962168434021368e25577d6c57e6e638",
"score": "0.642011",
"text": "def extract_method_name\n check_type :call\n self[2]\n end",
"title": ""
},
{
"docid": "9f68da00ad58750623d599b598271ec0",
"score": "0.64179605",
"text": "def method_name\n name\n end",
"title": ""
},
{
"docid": "c48f716c42f9842f906468893376e18f",
"score": "0.63952446",
"text": "def method_symbol; end",
"title": ""
},
{
"docid": "cef3ecf6142d16d50c9ff2401c32f861",
"score": "0.637594",
"text": "def qualify_method_name(method)\n if method.owner.singleton_class?\n class_name = singleton_method_owner_name(method)\n [ class_name, '.', method.name ]\n else\n [ method.owner.name, '#', method.name ]\n end\n end",
"title": ""
},
{
"docid": "845d67a6034dc78cc806822bcc3bbc5c",
"score": "0.6375376",
"text": "def method_suffix\n method_name_parts[:suffix]\n end",
"title": ""
},
{
"docid": "e0108f9d6757d8499876dfb4c25abce5",
"score": "0.63471377",
"text": "def point_name_from_method(method)\n match = /#<[^:]+: ([^.#(]+)(?:\\(([^)]+)\\))?(\\.|#)([^>]+)>/.match(method.inspect.to_s)\n class_name = match[2].nil? ? match[1] : match[2]\n \"#{class_name}#{match[3]}#{match[4]}\"\n end",
"title": ""
},
{
"docid": "76556b97a8c9b5cffc860e7cee3bd346",
"score": "0.63264817",
"text": "def method_name\n \"#{service_key}.#{@method_key}\"\n end",
"title": ""
},
{
"docid": "9272b9bf0c922a8544a0a6283e110b1e",
"score": "0.6322048",
"text": "def get_name(method)\n \"#{method.receiver.class.service_name}/#{camelize(method.name.to_s)}\"\n end",
"title": ""
},
{
"docid": "84d331a54cf803e5b6498dd359580b3c",
"score": "0.6309146",
"text": "def build_method_name\n \"#{METHOD_PREFIX}#{super}\"\n end",
"title": ""
},
{
"docid": "953e285558244e9a4c342497d5cc71df",
"score": "0.628431",
"text": "def to_class_name\n meth_name = self.to_method_name\n meth_name.gsub!(/\\/(.?)/) { \"#{$1.upcase}\" }\n meth_name.gsub!(/(?:^|_)(.)/) { $1.upcase }\n meth_name\n end",
"title": ""
},
{
"docid": "450d7254f14796fa945b6d1a1faec046",
"score": "0.62731886",
"text": "def current_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"title": ""
},
{
"docid": "859b98ada401022042a4e1f631a28250",
"score": "0.6272748",
"text": "def current_method_name\n caller[0].match(/`([^']+)/).captures[0].to_sym\n end",
"title": ""
},
{
"docid": "c876559770194c0a2be849ac4530b7d1",
"score": "0.6271872",
"text": "def method_name\n @name\n end",
"title": ""
},
{
"docid": "a41f9d8a74e9135b63cc74db047c12c1",
"score": "0.62453103",
"text": "def name\n return @method_name.to_s.sub(/^test_/, \"\")\n end",
"title": ""
},
{
"docid": "680a07e0e8e9c678e111e427ce51dfb5",
"score": "0.6239546",
"text": "def method_name\n __name__\n end",
"title": ""
},
{
"docid": "3558310916b844d97b5c975bd594df2a",
"score": "0.623884",
"text": "def name\n @name || (@method_name.kind_of?(String) ? @name = @method_name : @method_name.to_s).upcase\n end",
"title": ""
},
{
"docid": "361a0ec3ba61ddd7ac1ecb2a18f9e0ba",
"score": "0.6238769",
"text": "def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"title": ""
},
{
"docid": "afc31d6bf2891160f7afaa362e33cea0",
"score": "0.6217724",
"text": "def current_method_name\n caller(1).first.scan(/`(.*)'/)[0][0].to_s\n end",
"title": ""
},
{
"docid": "b78bf81aab5614e31b87c3011a7e435e",
"score": "0.62097335",
"text": "def method_name\n send_node.method_name\n end",
"title": ""
},
{
"docid": "6ca15ad314f9713342128bdd8a82b1cf",
"score": "0.6197136",
"text": "def action_name\n method_name.gsub ACTION_SUFFIX, ''\n end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "a265fe5e200ae985db3fc3d804b9fd77",
"score": "0.6172076",
"text": "def method_name; end",
"title": ""
},
{
"docid": "342056a0e738d7114d52b2e40df4d980",
"score": "0.6152421",
"text": "def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end",
"title": ""
},
{
"docid": "c2dddc00063800b6ac549d52cedcd407",
"score": "0.61486626",
"text": "def method_name\n unless self.method_line?\n return nil\n end\n\n words = self.strip.split(/ /)\n words[1]\n end",
"title": ""
},
{
"docid": "28ea0215c1f0e6e3eda4ce68d827929f",
"score": "0.61470777",
"text": "def method_name\n double_injection.method_name\n end",
"title": ""
},
{
"docid": "71a6d6a017cb5865bc75e0e4ca6f4b3e",
"score": "0.61407495",
"text": "def full_name\n @full_name ||= \"#{@klass}.#{@method_name}\"\n end",
"title": ""
},
{
"docid": "f911a256d551ca828b08792bc113d500",
"score": "0.6134948",
"text": "def extract_command_name(command)\n re = self.class.prefix_regexp\n if command =~ re\n method_name = command.gsub(re, \"\").underscore.to_sym\n return method_name if exposed_methods.include?(method_name)\n end\n end",
"title": ""
},
{
"docid": "f5a6fac9283202451aa6d658e9074f0e",
"score": "0.607013",
"text": "def method_name(value = nil)\n @method_name = value if !value.nil?\n @method_name\n end",
"title": ""
},
{
"docid": "55d7510378f989ff3d3d26f6deca65c0",
"score": "0.6068918",
"text": "def make_method_name(method)\n # should do more, but will add them as errors occur\n method.gsub(/-/,\"_\")\n end",
"title": ""
},
{
"docid": "b6085714ab1d05b6fb3ac6781eedf0ee",
"score": "0.6067988",
"text": "def command_name(klass=self)\n klass.class.name.split('::')[2].\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n gsub('_', ' ').downcase\n end",
"title": ""
},
{
"docid": "3a2128a93284724560ed6b39688f4547",
"score": "0.60569495",
"text": "def method_name(queue=nil); @method_name; end",
"title": ""
},
{
"docid": "14b0d5495219edbaac0259ecc7ee515f",
"score": "0.6051527",
"text": "def method_name \n collected[:method_name]\n end",
"title": ""
},
{
"docid": "3898e9cac4335e1ebb71d599da2ec91a",
"score": "0.6041695",
"text": "def method_name\n return @method_name unless @method_name.nil?\n @method_name = _root.string_ids[name_idx].value.data\n @method_name\n end",
"title": ""
},
{
"docid": "f2f083f1a7f08124043732e74dd70c59",
"score": "0.6031592",
"text": "def full_method_name(nested_level=0)\n # Note: caller_locations() is equivalent to caller_locations(1).\n # caller_locations(0) from this method would also contain the information of\n # this method full_method_name() itself, which is totally irrelevant.\n sprintf(\"%s#%s\", self.class.to_s, caller_locations()[nested_level].label)\n end",
"title": ""
},
{
"docid": "f7646768dea41b47dff05c57c1121534",
"score": "0.60218054",
"text": "def create_method_name(method)\n return '' unless method && (method.is_a?(String) || method.is_a?(Symbol))\n\n method.to_s.split('_').map.with_index do |string, i|\n i == 0 ? string : string.capitalize\n end.join\n end",
"title": ""
},
{
"docid": "d39288b2de42f08082fe26619a8d26d3",
"score": "0.60079736",
"text": "def context_name_for(method)\n :\"__#{machine.name}_#{name}_#{method}_#{@context.object_id}__\"\n end",
"title": ""
},
{
"docid": "c7f8a09a2ec7ace587596503e3a61019",
"score": "0.5986407",
"text": "def method_name\n node_parts[1]\n end",
"title": ""
},
{
"docid": "314f5b9b712988aa81db735bcbbcf0ec",
"score": "0.59862995",
"text": "def method(method_name)\n method_name.to_s + '_from'\n end",
"title": ""
},
{
"docid": "8f0696ce4d2db2368ccc031261a56de0",
"score": "0.597612",
"text": "def name(method_or_value)\n return method_or_value unless method_or_value.is_a?(Symbol)\n @object.class.human_attribute_name(method_or_value.to_s)\n end",
"title": ""
},
{
"docid": "1e8c5f77abd112dd29551e786a274619",
"score": "0.5971764",
"text": "def target_method(target)\n \"#{target}_versions\"\n end",
"title": ""
},
{
"docid": "d4b65add5dd60c67ccaa8044338bda9f",
"score": "0.5939758",
"text": "def getter_method_name\n name.to_sym\n end",
"title": ""
},
{
"docid": "6861469f1bc3df3896b52eec9d3840a0",
"score": "0.59360737",
"text": "def static_method_name(method_name); end",
"title": ""
},
{
"docid": "9afe3bba9094e90557ed1924d423dc00",
"score": "0.59352064",
"text": "def instance_method_names\n @instance_method_names ||= method_names.to_a[21..27].to_h\n end",
"title": ""
},
{
"docid": "383fdfc85ffb39dd5143afad3804a5bf",
"score": "0.59116334",
"text": "def specialize_method_name( name )\n return \"#{name}#{self.class.name.split(\"::\")[-1].gsub(/[A-Z]/){|s| \"_#{s.downcase}\"}}\".intern\n end",
"title": ""
},
{
"docid": "8bc3904a2c1c0e8996c91cfbc2ab9ac8",
"score": "0.59103537",
"text": "def method_symbol\n HTTP_METHOD_LOOKUP[method]\n end",
"title": ""
},
{
"docid": "c73d987d82f3f165047a7552994447e6",
"score": "0.59020704",
"text": "def method_prefix\n if singleton_class?\n if Module === singleton_instance # rubocop:disable Style/CaseEquality\n \"#{WrappedModule.new(singleton_instance).nonblank_name}.\"\n else\n \"self.\"\n end\n else\n \"#{nonblank_name}#\"\n end\n end",
"title": ""
},
{
"docid": "73c4d3986245a38482208e1a9f142c9a",
"score": "0.589976",
"text": "def method_name(e)\n e.to_s.split('`')[1].split('=')[0]\n end",
"title": ""
},
{
"docid": "679b36bbe2e30e3b7548282c5b1d8c3f",
"score": "0.5871434",
"text": "def method_names()\n @method_details.collect( &:name )\n end",
"title": ""
},
{
"docid": "f5190c44e75345554d3e6f6cec45625f",
"score": "0.5847835",
"text": "def get_method_name(name)\n method_name = name.gsub(/ /, '_')\n unless method_name.upcase == method_name\n method_name.downcase!\n end\n method_name\n end",
"title": ""
}
] |
06e8c1488e40d5fe4cfec61e4f402912
|
Baseline implementation for the set_node_template REST call
|
[
{
"docid": "09a257c961f3b169e07d6a23102b3efd",
"score": "0.75369865",
"text": "def set_node_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_node_template_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"title": ""
}
] |
[
{
"docid": "d6d4c749036f531a4b9e66ab7eae5bdf",
"score": "0.7075593",
"text": "def set_node_template request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::SetNodeTemplateNodeGroupRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/nodeGroups/#{request_pb.node_group}/setNodeTemplate\"\n body = request_pb.node_groups_set_node_template_request_resource.to_json\n\n result_json = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::Operation.decode_json result_json[:body], { ignore_unknown_fields: true }\n end",
"title": ""
},
{
"docid": "106429ecb14854bdb28ce33b52fdc432",
"score": "0.67401534",
"text": "def update\n # Find and set template for this node if given.\n # TODO: Refactor this!\n # Something like @node.templates_for(current_user).find(params[:node][:template_id])\n # that uses a single SQL query and throws a RecordNotFound exception if the template is not\n # available to the given user. Maybe we can use the scope_out plugin or something similar.\n if params[:node] && params[:node][:template_id]\n if params[:node][:template_id] == 'inherit'\n params[:node][:template] = nil\n elsif @node.find_available_templates_for(current_user).map(&:id).include?(params[:node][:template_id].to_i)\n params[:node][:template] = @node.find_available_templates_for(current_user).find { |t| t.id == params[:node][:template_id].to_i }\n else\n raise ActiveRecord::RecordNotFound\n end\n params[:node].delete(:template_id)\n end\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.xml { head :ok }\n format.json { render :json => { :success => 'true' } }\n else\n format.xml { render :xml => @node.errors.to_xml, :status => :unprocessable_entity }\n format.json { render :json => { :errors => @node.errors.full_messages }.to_json, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d1a5e305968cdca1790f290ebead26bd",
"score": "0.66092294",
"text": "def set_template_xml\n doc = ::Nokogiri::XML request.body.read\n if !doc.xpath(\"//base_image/template\").empty?\n params[:base_image][:template] = { :xml => doc.xpath(\"//base_image/template\").children.to_s}\n end\n end",
"title": ""
},
{
"docid": "0c8c37e508ac681a2548d1241b84da4f",
"score": "0.6426541",
"text": "def set_node_template_vars(values)\n @Eth_Etherbase = values['geth']['Eth_Etherbase']\n @Node_UserIdent = values['geth']['Node_UserIdent']\n @Node_DataDir = values['geth']['Node_DataDir']\n @Node_HTTPPort = values['geth']['Node_HTTPPort']\n @Node_WSPort = values['geth']['Node_WSPort']\n @NodeP2P_ListenAddr = values['geth']['NodeP2P_ListenAddr']\n @NodeP2P_DiscoveryAddr = values['geth']['NodeP2P_DiscoveryAddr']\n @Dashboard_Port = values['geth']['Dashboard_Port']\n @Dashboard_Refresh = values['geth']['Dashboard_Refresh']\n @replicas = values['k8s']['replicas']\n return\nend",
"title": ""
},
{
"docid": "745a2bc433807026eea01ff9d71045fe",
"score": "0.63299084",
"text": "def set_node_template_vars(values)\n @Eth_Etherbase = values[\"geth\"][\"Eth_Etherbase\"]\n @Eth_MinerThreads = values[\"geth\"][\"Eth_MinerThreads\"]\n @Node_UserIdent = values[\"geth\"][\"Node_UserIdent\"]\n @Node_DataDir = values[\"geth\"][\"Node_DataDir\"]\n @Node_HTTPPort = values[\"geth\"][\"Node_HTTPPort\"]\n @Node_WSPort = values[\"geth\"][\"Node_WSPort\"]\n @NodeP2P_ListenAddr = values[\"geth\"][\"NodeP2P_ListenAddr\"]\n @NodeP2P_DiscoveryAddr = values[\"geth\"][\"NodeP2P_DiscoveryAddr\"]\n @Dashboard_Port = values[\"geth\"][\"Dashboard_Port\"]\n @Dashboard_Refresh = values[\"geth\"][\"Dashboard_Refresh\"]\n @nodePort_rpc = values[\"k8s\"][\"nodePort_rpc\"]\n @nodePort_ipc = values[\"k8s\"][\"nodePort_ipc\"]\n @replicas = values[\"k8s\"][\"replicas\"]\n return\nend",
"title": ""
},
{
"docid": "67fcd88f8927046bce6cdb760d55866a",
"score": "0.63023144",
"text": "def create_node_template\n template \"node.rb\", \"app/models/#{file_path}.rb\"\n end",
"title": ""
},
{
"docid": "f219976f24eb609e1982d4131a4cf53c",
"score": "0.6119077",
"text": "def create_template\n self.template = \"template 14231\" # need self here b/c if don't have it, ruby will set a local variable template to 'template 14231' instad of setting the instance variable using the setter method\n end",
"title": ""
},
{
"docid": "eb0abf27d05dc4611623e614fbd0f519",
"score": "0.6115073",
"text": "def add_to_template( template )\n\t\t\tsuper\n\t\t\tself.subnodes.each do |node|\n\t\t\t\ttemplate.install_node( node )\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "4d1a4f6ed20983e8f9ff1f9f17db7c2e",
"score": "0.6113703",
"text": "def add_to_template( template )\n\t\t\ttemplate.install_node( self )\n\t\tend",
"title": ""
},
{
"docid": "8b03eb2bc26bc1adee2d794fd9dcf86b",
"score": "0.60682917",
"text": "def create_template\n self.template = \"template 14231\"\n end",
"title": ""
},
{
"docid": "64bc7382523b32557afcd4ac59e4e562",
"score": "0.5955475",
"text": "def create_template\n \n end",
"title": ""
},
{
"docid": "af1088f67ba22f2676313d5f9a94e34d",
"score": "0.59070975",
"text": "def set_template\n @template = TemplateElement.find(params[:id])\n end",
"title": ""
},
{
"docid": "3b8d666a8ddb39b7fffb28b0a6c58da0",
"score": "0.58976465",
"text": "def set_instance_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_set_instance_template_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end",
"title": ""
},
{
"docid": "65dae3a0822e2a7803a8c5d7c8646709",
"score": "0.58846754",
"text": "def add_to_template( template ) # :nodoc:\n\t\tself.subnodes.each do |node|\n\t\t\ttemplate.install_node( node )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "638cc69d1eb5625775a07c9d8e19f5d4",
"score": "0.5861849",
"text": "def template(template)\n @template = template\n end",
"title": ""
},
{
"docid": "49221f4ec4b93f64bf63f971fae0d858",
"score": "0.58588254",
"text": "def set_nodes_contents\n set_node(\"CustomerId\", @customer_id)\n set_node(\"Timestamp\", Time.now.iso8601)\n set_node(\"Environment\", @environment)\n set_node(\"SoftwareId\", \"Sepa Transfer Library version #{VERSION}\")\n set_node(\"Command\", @command.to_s.split(/[\\W_]/).map {|c| c.capitalize}.join)\n\n case @command\n\n when :get_certificate\n set_node(\"Service\", @service)\n set_node(\"Content\", Base64.encode64(@content))\n set_node(\"HMAC\", Base64.encode64(@hmac).chop)\n when :download_file_list\n set_node(\"Status\", @status)\n set_node(\"TargetId\", @target_id)\n set_node(\"FileType\", @file_type)\n when :download_file\n set_node(\"Status\", @status)\n set_node(\"TargetId\", @target_id)\n set_node(\"FileType\", @file_type)\n set_node(\"FileReference\", @file_reference)\n when :upload_file\n set_node(\"Content\", Base64.encode64(@content))\n set_node(\"FileType\", @file_type)\n set_node(\"TargetId\", @target_id)\n end\n end",
"title": ""
},
{
"docid": "1f255dd9e38eb4ef61fd08bf66d18d2b",
"score": "0.5857261",
"text": "def set_instance_template request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_set_instance_template_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "2cc62ebe547cfba4c3e173a0408f7d43",
"score": "0.5840703",
"text": "def populate_template_root(node)\n namespaces = node.namespaces\n template_doc.root = template_doc.create_element(node.name, namespaces)\n node.attributes.each do |k,v|\n next if namespaces.key?(k)\n # Kludge to handle schemaLocation namespace disappearing\n case k\n when 'schemaLocation'\n template_doc.root.set_attribute('xsi:%s' % k, v)\n else\n template_doc.root.set_attribute(k, v)\n end\n end\n end",
"title": ""
},
{
"docid": "015d0f413f610b48485a2e79abde118a",
"score": "0.5822574",
"text": "def template_setup; end",
"title": ""
},
{
"docid": "722549ed4cb9334706d04f4e29b33b89",
"score": "0.58218855",
"text": "def template=(value)\n @template = value\n end",
"title": ""
},
{
"docid": "722549ed4cb9334706d04f4e29b33b89",
"score": "0.58218855",
"text": "def template=(value)\n @template = value\n end",
"title": ""
},
{
"docid": "bfde40c0a059f2355913c1c297a3cc6d",
"score": "0.5813944",
"text": "def set_template\n # TODO What if this folder is empty? What if it doesn't exist?\n @template = Template.new(params[:path])\n end",
"title": ""
},
{
"docid": "cba5ecb490132655d50a4dd0a005bb0f",
"score": "0.58103615",
"text": "def create_template\n @template = \"template 14231\"\n end",
"title": ""
},
{
"docid": "854f9be79853bb824b8223d3f5db0543",
"score": "0.5761919",
"text": "def template=(template)\n @template = template\n end",
"title": ""
},
{
"docid": "94784461dad0eb14ab677f1b7371c4fd",
"score": "0.57383966",
"text": "def template\n @template ||= ElastiCache.template({:name => @name, :node_type => @node_type, :cache_security_group_names => @cache_security_group_names, :engine => @engine, :node_count => @node_count})\n end",
"title": ""
},
{
"docid": "381fc7129171e7efbcb23752dc78d0b1",
"score": "0.5737483",
"text": "def autogen_node(type, node_name, node, node_index); end",
"title": ""
},
{
"docid": "a471cb92f5e0e1e39fde6521a56f62cf",
"score": "0.573672",
"text": "def set_nodes_contents\n set_node(\"CustomerId\", @customer_id)\n set_node(\"Timestamp\", (@timestamp || Time.now).iso8601)\n set_node(\"Environment\", @environment)\n set_node(\"SoftwareId\", \"Sepa Transfer Library version #{VERSION}\")\n set_node(\"Command\",\n @command.to_s.split(/[\\W_]/).map {|c| c.capitalize}.join)\n\n case @command\n when :get_certificate\n set_node(\"Service\", @service)\n set_node(\"Content\", Base64.encode64(@content))\n set_node(\"HMAC\", Base64.encode64(@hmac).chop)\n when :download_file_list\n set_node(\"Status\", @status)\n set_node(\"TargetId\", @target_id)\n set_node(\"FileType\", @file_type)\n if @start_date\n set_node(\"StartDate\", @start_date && @start_date.strftime(\"%Y-%m-%d\"))\n else\n @ar.at_css('StartDate').remove\n end\n if @end_date\n set_node(\"EndDate\", @end_date && @end_date.strftime(\"%Y-%m-%d\"))\n else\n @ar.at_css('EndDate').remove\n end\n when :download_file\n set_node(\"Status\", @status)\n set_node(\"TargetId\", @target_id)\n set_node(\"FileType\", @file_type)\n set_node(\"FileReference\", @file_reference)\n when :upload_file\n set_node(\"Content\", Base64.encode64(@content))\n set_node(\"FileType\", @file_type)\n set_node(\"TargetId\", @target_id)\n end\n end",
"title": ""
},
{
"docid": "44105a774d5b69096daea32dc28cca37",
"score": "0.57031476",
"text": "def set_root_template(root_template)\n self['properties'] = root_template['properties'].clone\n self['rootTemplateUri'] = root_template['uri']\n end",
"title": ""
},
{
"docid": "f53828bd0864876060e6d3646563f81d",
"score": "0.569792",
"text": "def node=(node)\n create_node[:node] = node\n end",
"title": ""
},
{
"docid": "d8a4bfc67996c6c8d43eadfaff13d782",
"score": "0.5697305",
"text": "def template_setup\n end",
"title": ""
},
{
"docid": "ae32c1e59db3cd7b6f9b0f5330d6f9d5",
"score": "0.56958133",
"text": "def node= node\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "415c9ad18f4aee99443db761539b8bef",
"score": "0.5683322",
"text": "def reset_template\n @template = @roda_class.create_template(@opts, @template_opts)\n end",
"title": ""
},
{
"docid": "e90d2a4012d4d19e71c2c1141dad2897",
"score": "0.56591284",
"text": "def template; end",
"title": ""
},
{
"docid": "e90d2a4012d4d19e71c2c1141dad2897",
"score": "0.56591284",
"text": "def template; end",
"title": ""
},
{
"docid": "e90d2a4012d4d19e71c2c1141dad2897",
"score": "0.56591284",
"text": "def template; end",
"title": ""
},
{
"docid": "fb8b683395c9e23080aa2dd931a8fc5f",
"score": "0.5644504",
"text": "def render_node(node)\n puts \"[Chef2Wiki]\\tWorking for node #{node}...\"\n @data = node_data(node)\n templates[\"node\"].result(binding)\n end",
"title": ""
},
{
"docid": "22159d95f4b701a41bc35334452588a3",
"score": "0.56333447",
"text": "def Template=(v)",
"title": ""
},
{
"docid": "25d7bba81a0947ed7b78553a9cc5945c",
"score": "0.5603157",
"text": "def node\n if @node.nil?\n raise NoNodeDataProvidedToTemplatePlugin\n end\n @node\n end",
"title": ""
},
{
"docid": "3aaf23dd5fcd89c7745d615c4b0ba4b8",
"score": "0.55836296",
"text": "def set_template\n @template = @template_page.try(:template)\n @template ||= Templates::Template.find(params[:template_id])\n end",
"title": ""
},
{
"docid": "244d040596639919a3d0402ad44f46d3",
"score": "0.5582641",
"text": "def insert_from_template(parent_node, new_values, template)\n ng_xml_will_change!\n # If template is a string, use it as the template, otherwise use it as arguments to xml_builder_template\n unless template.instance_of?(String)\n template_args = Array(template)\n if template_args.last.kind_of?(Hash)\n template_opts = template_args.delete_at(template_args.length - 1)\n template_args << template_opts\n end\n template_args = OM.pointers_to_flat_array(template_args,false)\n template = self.class.terminology.xml_builder_template( *template_args )\n end\n\n #if there is an xpath element pointing to text() need to change to just 'text' so it references the text method for the parent node\n template.gsub!(/text\\(\\)/, 'text')\n\n builder = Nokogiri::XML::Builder.with(parent_node) do |xml|\n new_values.each do |builder_new_value|\n builder_new_value = builder_new_value.gsub(/'/, \"\\\\\\\\'\") # escape any apostrophes in the new value\n if matchdata = /xml\\.@(\\w+)/.match(template)\n parent_node.set_attribute(matchdata[1], builder_new_value)\n else\n builder_arg = eval('\"'+ template + '\"') # this inserts builder_new_value into the builder template\n eval(builder_arg)\n end\n end\n end\n return parent_node\n end",
"title": ""
},
{
"docid": "a1477c580a2085fe6ca9f76e6754d531",
"score": "0.55777305",
"text": "def set_request_template\n @request_template = RequestTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "598c55c9951f4fc588e648be8ebaa9a3",
"score": "0.55747837",
"text": "def create_compute_collection_transport_node_template_with_http_info(compute_collection_transport_node_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.create_compute_collection_transport_node_template ...\"\n end\n # verify the required parameter 'compute_collection_transport_node_template' is set\n if @api_client.config.client_side_validation && compute_collection_transport_node_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_transport_node_template' when calling NetworkTransportApi.create_compute_collection_transport_node_template\"\n end\n # resource path\n local_var_path = \"/compute-collection-transport-node-templates\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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(compute_collection_transport_node_template)\n auth_names = ['BasicAuth']\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 => 'ComputeCollectionTransportNodeTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#create_compute_collection_transport_node_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "1cb2a89456debee0cd2436e66ccdb0c0",
"score": "0.5571651",
"text": "def set_ServerTemplate(value)\n set_input(\"ServerTemplate\", value)\n end",
"title": ""
},
{
"docid": "1cb2a89456debee0cd2436e66ccdb0c0",
"score": "0.5571651",
"text": "def set_ServerTemplate(value)\n set_input(\"ServerTemplate\", value)\n end",
"title": ""
},
{
"docid": "609e293c5ecf9356057d489bba10ce8d",
"score": "0.55537254",
"text": "def set_site_template\n @site_template = Network.find(params[:network_id]).site_template\n end",
"title": ""
},
{
"docid": "fb4113b15f82f6058bce22c41245a8c2",
"score": "0.5553379",
"text": "def template=(v); end",
"title": ""
},
{
"docid": "2c937449941e5617bac0b0afd347860b",
"score": "0.55528736",
"text": "def perform\n\n source_node_id = options['source_node']\n row_index = options['row_index']\n row_content = options['row_content']\n status = \"Reifying data from row #{row_index} of node #{source_node_id}: #{row_content}\"\n template = MappingTemplate.find(options['mapping_template'])\n pool = Pool.find(options[\"pool\"])\n\n at(5, 100, \"Loaded model and template. Reifying fields.\")\n created = []\n template.model_mappings.each do |model_tmpl|\n model = Model.find(model_tmpl[:model_id])\n vals = {}\n model_tmpl[:field_mappings].each do |map|\n next unless map[:field]\n if letter?(map[:source])\n field_index = map[:source].ord - 65\n else\n field_index = map[:source].to_i\n end\n vals[map[:field]] = row_content[field_index]\n end\n n = Node.new(:data=>vals)\n n.spawned_from_node_id = source_node_id\n n.model = model\n n.pool = pool\n n.save!\n created << n\n end\n completed(\"Created node #{created.map {|n| n.persistent_id}}\")\n end",
"title": ""
},
{
"docid": "6173d4987bbb3db57929bb2d74aee44f",
"score": "0.5542881",
"text": "def xml_template\n build_xml( hash_template )\n end",
"title": ""
},
{
"docid": "0072d74ca581af2b28b0401e150b085b",
"score": "0.55279285",
"text": "def add_to_template( template )\n\t\t#self.log.debug \"Installing an include's subnodes\"\n\n\t\tif @identifier\n\t\t\ttemplate.install_node( self )\n\t\t\ttemplate.send( \"#{@identifier}=\", @subtemplate )\n\t\t\ttargetTemplate = @subtemplate\n\t\telse\n\t\t\ttargetTemplate = template\n\t\tend\n\n\t\t@nodes.each do |node|\n\t\t\ttargetTemplate.install_node( node )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2950d7115623efb49fbfa91e3f26fe20",
"score": "0.5523646",
"text": "def node_init(node); end",
"title": ""
},
{
"docid": "6cfcd3041202f86d67f63e168f27c7fe",
"score": "0.5521013",
"text": "def set_rel_template\n @rel_template = RelTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "31fcba75f2a30e2ec05196e66f864171",
"score": "0.5519395",
"text": "def render_with_template_doc(node)\n doc = template_doc.clone\n # Use document fragment to clone the node itself\n doc.root << doc.fragment(node.outer_xml).children.first\n doc.to_xml\n end",
"title": ""
},
{
"docid": "30535a8c8dbb33bdc222f19b3cf0bb6a",
"score": "0.55164427",
"text": "def set_base_template\n @base_template = BaseTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "6eee71e31af4a2e54fd3edc3f6bb7708",
"score": "0.5508743",
"text": "def ajax_set_default_template\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # Access current template being edited\n template = EmailTemplate.find(params[:id])\n\n template.html = params[:html]\n template.style_type = 1\n\n template.put('', {\n :html => template.html,\n :style_type => template.style_type\n })\n\n @app.put('', {\n :default_template => params[:html],\n :has_def_template => 1\n })\n\n\n response = {\n :success => true\n }\n\n # Return JSON response\n render json: response\n\n\n end",
"title": ""
},
{
"docid": "3057583962e9275599dafda6fcde7461",
"score": "0.55057675",
"text": "def setup_template\n ruby_block 'reload_node_volumes' do\n block do\n node.run_state['time_machine_volumes'] << rendered_config.to_h\n end\n # Tells the template to render itself at the end of the chef run,\n # so it knows about all the volumes configured on this node,\n # including those configured by this run.\n #\n notifies :create, 'template[afp.conf]', :delayed\n end\n end",
"title": ""
},
{
"docid": "b46a01121b9bc26f5f49eba014469c90",
"score": "0.54986364",
"text": "def initialize(*)\n super\n @template = @opts[:template]\n end",
"title": ""
},
{
"docid": "741f8c9f7dd176cbb49d636411fe624e",
"score": "0.5492729",
"text": "def node=(_arg0); end",
"title": ""
},
{
"docid": "741f8c9f7dd176cbb49d636411fe624e",
"score": "0.5492729",
"text": "def node=(_arg0); end",
"title": ""
},
{
"docid": "741f8c9f7dd176cbb49d636411fe624e",
"score": "0.5492729",
"text": "def node=(_arg0); end",
"title": ""
},
{
"docid": "741f8c9f7dd176cbb49d636411fe624e",
"score": "0.5492729",
"text": "def node=(_arg0); end",
"title": ""
},
{
"docid": "741f8c9f7dd176cbb49d636411fe624e",
"score": "0.5492729",
"text": "def node=(_arg0); end",
"title": ""
},
{
"docid": "a961a6c9436683b3bc4225759497b52e",
"score": "0.5491691",
"text": "def create_template\n %x(touch #{self.template_path})\n end",
"title": ""
},
{
"docid": "32786bc7f62949e0614a150ebbc10478",
"score": "0.54906803",
"text": "def parameterized_nodes\r\n params = {\r\n method: :get,\r\n url: '/parameters/nodes'\r\n }\r\n request(params).perform!\r\n end",
"title": ""
},
{
"docid": "3973f42e9b1249ae80c17ae6c64c08b3",
"score": "0.5485669",
"text": "def update_compute_collection_transport_node_template_with_http_info(template_id, compute_collection_transport_node_template, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.update_compute_collection_transport_node_template ...\"\n end\n # verify the required parameter 'template_id' is set\n if @api_client.config.client_side_validation && template_id.nil?\n fail ArgumentError, \"Missing the required parameter 'template_id' when calling NetworkTransportApi.update_compute_collection_transport_node_template\"\n end\n # verify the required parameter 'compute_collection_transport_node_template' is set\n if @api_client.config.client_side_validation && compute_collection_transport_node_template.nil?\n fail ArgumentError, \"Missing the required parameter 'compute_collection_transport_node_template' when calling NetworkTransportApi.update_compute_collection_transport_node_template\"\n end\n # resource path\n local_var_path = \"/compute-collection-transport-node-templates/{template-id}\".sub('{' + 'template-id' + '}', template_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(compute_collection_transport_node_template)\n auth_names = ['BasicAuth']\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 => 'ComputeCollectionTransportNodeTemplate')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NetworkTransportApi#update_compute_collection_transport_node_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "ef3ee57db02129c5ad536d2424966f4a",
"score": "0.5484998",
"text": "def templates=(_arg0); end",
"title": ""
},
{
"docid": "8048c60ae80cf495aeea0e72aab69e4e",
"score": "0.5479314",
"text": "def node_template_attrs\n [\"node\"] +\n self_data.keys +\n nodes_custom_fields.inject([]) do |a, field|\n a << \"node.#{field.machine_name}\"\n end +\n nodes_custom_fields.inject([]) do |a, field|\n a << field.to_recipe['machine_name']\n end\n end",
"title": ""
},
{
"docid": "182a2fbecc2dbc1bdccd40ed7e893e05",
"score": "0.5478061",
"text": "def on_create_node( nodeclass )\n\t\t\n\tend",
"title": ""
},
{
"docid": "328ada5064097940c4e0310d1b1a3546",
"score": "0.5457947",
"text": "def transloadit_assembly_update_template!(template, context, options)\n options[:template_id] = template\n end",
"title": ""
},
{
"docid": "295dd98650a0879a0bc3a3086ed4b5b8",
"score": "0.544538",
"text": "def set_instance_template request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/regions/#{request_pb.region}/instanceGroupManagers/#{request_pb.instance_group_manager}/setInstanceTemplate\"\n body = request_pb.region_instance_group_managers_set_template_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"title": ""
},
{
"docid": "dee0b04de5083dac5ed48632a5a53e5f",
"score": "0.5444581",
"text": "def set_instance_template request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instanceGroupManagers/#{request_pb.instance_group_manager}/setInstanceTemplate\"\n body = request_pb.instance_group_managers_set_instance_template_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"title": ""
},
{
"docid": "a3349b6c3b860d8ae07fb01ae31ba8aa",
"score": "0.54444593",
"text": "def add_virtual_machine template\n\t\t\ttemplate_link = \"\"\n\t\t\ttemplate[\"link\"].each do |link|\n\t\t\t\ttemplate_link = link if link[\"rel\"] = \"edit\"\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\tbuilder = Nokogiri::XML::Builder.new do |xml|\n\t\t\t\txml.virtualMachine {\n\t\t\t\t\txml.link(:rel => \"virtualmachinetemplate\", :href => template_link[\"href\"], :title => template_link[\"title\"])\n\t\t\t\t}\n\t\t\tend\n\n\t\t\tVirtualMachine.new Api.post(link_info(:virtualmachines)[\"href\"], builder.to_xml, {:content_type => \"application/vnd.abiquo.virtualmachine+xml\"}).body[\"virtualMachine\"]\n\t\tend",
"title": ""
},
{
"docid": "e53c44dbdeb8f3e38fbc77bf45ac2920",
"score": "0.54313326",
"text": "def deploy\n deployed_nodes = []\n n_nodes = cardinality - nodes.size\n\n return [deployed_nodes, nil] if n_nodes == 0\n\n @body['last_vmname'] ||= 0\n\n template_id = @body['vm_template']\n template = OpenNebula::Template.new_with_id(template_id,\n @service.client)\n\n if @body['vm_template_contents']\n extra_template = @body['vm_template_contents'].dup\n\n # If the extra_template contains APPEND=\"<attr1>,<attr2>\", it\n # will add the attributes that already exist in the template,\n # instead of replacing them.\n append = extra_template\n .match(/^\\s*APPEND=\\\"?(.*?)\\\"?\\s*$/)[1]\n .split(',') rescue nil\n\n if append && !append.empty?\n rc = template.info\n\n if OpenNebula.is_error?(rc)\n msg = \"Role #{name} : Info template #{template_id};\" \\\n \" #{rc.message}\"\n\n Log.error LOG_COMP, msg, @service.id\n @service.log_error(msg)\n\n return [false, 'Error fetching Info to instantiate' \\\n \" VM Template #{template_id} in Role \" \\\n \"#{name}: #{rc.message}\"]\n end\n\n et = template.template_like_str('TEMPLATE',\n true,\n append.join('|'))\n\n et = et << \"\\n\" << extra_template\n\n extra_template = et\n end\n else\n extra_template = ''\n end\n\n extra_template << \"\\nSERVICE_ID = #{@service.id}\"\n extra_template << \"\\nROLE_NAME = \\\"#{@body['name']}\\\"\"\n\n # Evaluate attributes with parent roles\n evaluate(extra_template)\n\n n_nodes.times do\n vm_name = @@vm_name_template\n .gsub('$SERVICE_ID', @service.id.to_s)\n .gsub('$SERVICE_NAME', @service.name.to_s)\n .gsub('$ROLE_NAME', name.to_s)\n .gsub('$VM_NUMBER', @body['last_vmname'].to_s)\n\n @body['last_vmname'] += 1\n\n Log.debug LOG_COMP,\n \"Role #{name} : Trying to instantiate \" \\\n \"template #{template_id}, with name #{vm_name}\",\n @service.id\n\n vm_id = template.instantiate(vm_name, on_hold?, extra_template)\n\n deployed_nodes << vm_id\n\n if OpenNebula.is_error?(vm_id)\n msg = \"Role #{name} : Instantiate failed for template \" \\\n \"#{template_id}; #{vm_id.message}\"\n\n Log.error LOG_COMP, msg, @service.id\n @service.log_error(msg)\n\n return [false, 'Error trying to instantiate the VM ' \\\n \"Template #{template_id} in Role \" \\\n \"#{name}: #{vm_id.message}\"]\n end\n\n Log.debug LOG_COMP, \"Role #{name} : Instantiate success,\" \\\n \" VM ID #{vm_id}\", @service.id\n node = {\n 'deploy_id' => vm_id\n }\n\n vm = OpenNebula::VirtualMachine.new_with_id(vm_id,\n @service.client)\n rc = vm.info\n\n if OpenNebula.is_error?(rc)\n node['vm_info'] = nil\n else\n hash_vm = vm.to_hash['VM']\n vm_info = {}\n vm_info['VM'] = hash_vm.select {|v| VM_INFO.include?(v) }\n\n node['vm_info'] = vm_info\n end\n\n @body['nodes'] << node\n end\n\n [deployed_nodes, nil]\n end",
"title": ""
},
{
"docid": "fa6911ed8da32fe6a7b81bea27bee308",
"score": "0.54292285",
"text": "def create_node(node_number, config, shell_script = nil)\n ip_address = \"#{@net_prefix}.#{100 + node_number}\"\n config.vm.define \"node-#{node_number}\" do |node|\n node.vm.hostname = \"node-#{node_number}\"\n node.vm.network 'private_network', ip: ip_address\n node.vm.provision :shell, inline: shell_script if shell_script\n end\n { ip: ip_address }\nend",
"title": ""
},
{
"docid": "b51d1178203fa4105097d90173b4fea4",
"score": "0.5416453",
"text": "def create\n # PS-441 & PS-306 legacy field no longer used\n params[:node].delete(:virtual_client_ids) if params[:node][:virtual_client_ids]\n params[:node].delete(:virtual_parent_node_id) if params[:node][:virtual_parent_node_id]\n # If the user didn't specify an operating system id then find or\n # create one based on the OS info they did specify.\n if !params[:node].include?(:operating_system_id)\n if params.include?(:operating_system)\n params[:node][:operating_system_id] = find_or_create_operating_system().id\n end\n end\n # If the user didn't specify a hardware profile id then find or\n # create one based on the hardware info they did specify.\n if !params[:node].include?(:hardware_profile_id)\n params[:node][:hardware_profile_id] = find_or_create_hardware_profile().id\n end\n # If the user didn't specify a status id then find or\n # create one based on the status info they did specify.\n # If they didn't specify any status info then default to\n # 'setup'.\n if !params[:node].include?(:status_id)\n status = nil\n if params.include?(:status) and !params[:status][:name].blank?\n status = Status.find_or_create_by_name(params[:status][:name].to_s)\n else\n status = Status.find_or_create_by_name('setup')\n end\n params[:node][:status_id] = status.id\n end\n \n # If the user included outlet names pull them out for later application\n outlet_names = nil\n if params[:node].include?(:outlet_names)\n outlet_names = params[:node][:outlet_names]\n params[:node].delete(:outlet_names)\n end\n\n if params[:node].include?(:virtualmode)\n virtual_guest = true\n params[:node].delete(:virtualmode)\n end\n\n @node = Node.new(params[:node])\n\n respond_to do |format|\n if @node.save\n # If the user specified some network interface info then handle that\n # We have to perform this after saving the new node so that the\n # NICs can be associated with it.\n virtual_guest ? process_network_interfaces(:noswitch) : process_network_interfaces\n process_storage_controllers\n # If the user specified a rack assignment then handle that\n process_rack_assignment\n # If the user included outlet names apply them now\n if outlet_names\n @node.update_outlets(outlet_names)\n end\n # Process percent_cpu metrics\n process_utilization_metrics if (params[\"utilization_metric\"])\n\t# Process volumes\n\tprocess_volumes if (params[\"volumes\"])\n\tprocess_name_aliases if (params[\"name_aliases\"])\n \n flash[:notice] = 'Node was successfully created.'\n format.html { redirect_to node_url(@node) }\n format.js { \n render(:update) { |page| \n \n # Depending on where the Ajax node creation comes from\n # we do something slightly different.\n if request.env[\"HTTP_REFERER\"].include? \"node_racks\"\n page.replace_html 'create_node_assignment', :partial => 'shared/create_assignment', :locals => { :from => 'node_rack', :to => 'node' }\n page['node_rack_node_assignment_node_id'].value = @node.id\n end\n \n page.hide 'new_node'\n \n # WORKAROUND: We have to manually escape the single quotes here due to a bug in rails:\n # http://dev.rubyonrails.org/ticket/5751\n page.visual_effect :highlight, 'create_node_assignment', :startcolor => \"\\'\"+RELATIONSHIP_HIGHLIGHT_START_COLOR+\"\\'\", :endcolor => \"\\'\"+RELATIONSHIP_HIGHLIGHT_END_COLOR+\"\\'\", :restorecolor => \"\\'\"+RELATIONSHIP_HIGHLIGHT_RESTORE_COLOR+\"\\'\"\n \n }\n }\n format.xml { head :created, :location => node_url(@node) }\n else\n format.html { render :action => \"new\" }\n format.js { render(:update) { |page| page.alert(@node.errors.full_messages) } }\n format.xml { render :xml => @node.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1c268d3fefdf832cbedbab0f01c16caf",
"score": "0.5413306",
"text": "def set_template\n @template = Template.find(params[:id])\n end",
"title": ""
},
{
"docid": "46155e2ae639a362fa9554c4bed17925",
"score": "0.5410994",
"text": "def use_template(template)\n @template = template\n end",
"title": ""
},
{
"docid": "2b0fae370efeb1fb2381b765ae374c46",
"score": "0.53972137",
"text": "def render_contents( template, scope )\n\t\t\tres = super\n\t\t\tself.render_subnodes( res, template, scope )\n\t\tend",
"title": ""
},
{
"docid": "fe7afe96c1c279dfcd788d0f74fbeb2d",
"score": "0.5396501",
"text": "def postTemplate(template)\n\t\t\tbegin\n\t\t\t\tputs \"Uploading the template to the server... (please be patient)\".green\n\t\t\t\t#response = Typhoeus::Request.new(\n #\"#{@server}/api/templates/\",\n # { :method => :post,\n # :headers => { \"Authorization\" => \"Token #{@token}\", :accept => \"application/json\" },\n # :body => { :image_uri => { :file => File.new(\"#{template[\"local_uri\"]}\", 'rb') },\n\t\t\t\t#\t\t\t:name => template[\"name\"],\n # :description => template[\"description\"],\n\t\t\t\t#\t\t\t:type => template[\"type\"],\n # :node_archs => template[\"node_archs\"],\n # :is_active => true\n # },\n #}\n \t#).run\n\t\t\t\tresponse = RestClient.post \"#{@server_restclient}/api/templates/\",\n\t\t\t\t\t{\n\t\t\t\t\t\t\t:image_uri => File.new(\"#{template[\"local_uri\"]}\", 'rb'), \n\t\t\t\t\t\t\t:name => template[\"name\"], \n\t\t\t\t\t\t\t:description => template[\"description\"],\n\t\t\t\t\t\t\t:type => template[\"type\"],\n\t\t\t\t\t\t\t:node_archs => template[\"node_archs\"],\n\t\t\t\t\t\t\t:is_active => template[\"is_active\"]\n\t\t\t\t\t\t}, \n\t\t\t\t\t\t{\t\n\t\t\t\t\t\t\t:accept => :json,\n\t\t\t\t\t\t\t\"Authorization\" => \"Token #{@token}\"\n\t\t\t\t\t\t}\n\n\t\t\t\tputs \"POST a template '#{template[\"name\"]}' with response code #{response.code}\".green\n\t\t\t\treturn getTemplate(template['name'])\n\t\t\trescue RestClient::Exception => e\n \t\t\t\traise \"POST a template failed: #{e.response}\"\n\t\t\trescue => e\n\t\t\t\traise \"POST a templatess failed: #{e.message}\"\n\t\t\t\traise \"POST a templates failed: #{e.response}\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "29a0cba79452a0913564f27c274f1c82",
"score": "0.53964293",
"text": "def set_configuration\n @cluster_template = ClusterTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "f9520de13928ef659f40507726614755",
"score": "0.53924173",
"text": "def configure_node(settings, config); end",
"title": ""
},
{
"docid": "c0c1aae5861fc9041eb5879da64a137a",
"score": "0.53851855",
"text": "def document_template=(value)\n @document_template = value\n end",
"title": ""
},
{
"docid": "c41fbf8e30070f1dc0965511d30c2d39",
"score": "0.53812003",
"text": "def set_node\n # TODO check security issue. Someone can send any id here\n @node = Node.find(params[:id])\n end",
"title": ""
},
{
"docid": "d5bc452b17aed6493a283fc6a38593e0",
"score": "0.5375389",
"text": "def test__set_node_attributes\n end",
"title": ""
},
{
"docid": "2cf3192aeeb6b7a3d1cca7cd1fc26ad9",
"score": "0.53750926",
"text": "def template_id=(value)\n @template_id = value\n end",
"title": ""
},
{
"docid": "584e8f9803ada0b7a8735065b30db366",
"score": "0.5369285",
"text": "def set_node\n @node = begin\n Node.find(params[:id])\n rescue Mongoid::Errors::DocumentNotFound => ex\n end\n setup_node_properties @node\n end",
"title": ""
},
{
"docid": "154a73cf82ef9ad540cea703f8ea824b",
"score": "0.5369118",
"text": "def node\n create_node[:node]\n end",
"title": ""
},
{
"docid": "b5705ee3f867f8276701dbca169d0d41",
"score": "0.53684413",
"text": "def set_test_template\n @test_template = TestTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "73c6b09c765a4b95a88e7204b958adc3",
"score": "0.53675103",
"text": "def node=(_); end",
"title": ""
},
{
"docid": "73c6b09c765a4b95a88e7204b958adc3",
"score": "0.53675103",
"text": "def node=(_); end",
"title": ""
},
{
"docid": "73c6b09c765a4b95a88e7204b958adc3",
"score": "0.53675103",
"text": "def node=(_); end",
"title": ""
},
{
"docid": "73c6b09c765a4b95a88e7204b958adc3",
"score": "0.53675103",
"text": "def node=(_); end",
"title": ""
},
{
"docid": "73c6b09c765a4b95a88e7204b958adc3",
"score": "0.53675103",
"text": "def node=(_); end",
"title": ""
},
{
"docid": "73c6b09c765a4b95a88e7204b958adc3",
"score": "0.53675103",
"text": "def node=(_); end",
"title": ""
},
{
"docid": "a93b47b30c99f8cfddfb04000da0526f",
"score": "0.5366282",
"text": "def update\n # PS-441 & PS-306 legacy field no longer used\n if params[:node]\n params[:node].delete(:virtual_client_ids) if params[:node][:virtual_client_ids]\n params[:node].delete(:virtual_parent_node_id) if params[:node][:virtual_parent_node_id]\n end\n\n xmloutput = {}\n xmlinfo = [\"\"]\n @node = @object\n\n # If the user is just setting a value related to one of the\n # associated models then params might not include the :node\n # key. Rather than check for and handle that in multiple\n # places below just stick in the key here.\n if !params.include?(:node)\n params[:node] = {}\n end\n\n # If the user didn't specify an operating system id but did specify\n # some operating system data then find or create an operating\n # system based on the info they did specify.\n if !params[:node].include?(:operating_system_id)\n # FIXME: This should allow the user to specify only the field(s)\n # they want to change, and fill in any missing fields from the\n # node's current OS. I.e. if the user just wanted to change the\n # OS version they shouldn't have to also specify the variant,\n # architecture, etc.\n if params.include?(:operating_system)\n params[:node][:operating_system_id] = find_or_create_operating_system().id\n end\n end\n # If the user didn't specify a hardware profile id but did specify\n # some hardware profile data then find or create a hardware\n # profile based on the info they did specify.\n if !params[:node].include?(:hardware_profile_id)\n # FIXME: This should allow the user to specify only the field(s)\n # they want to change, and fill in any missing fields from the\n # node's current hardware profile.\n if params.include?(:hardware_profile)\n params[:node][:hardware_profile_id] = find_or_create_hardware_profile().id\n end\n end\n # If the user didn't specify a status id but did specify a status name\n # then find or create a status based on the name.\n if !params[:node].include?(:status_id)\n if params.include?(:status) and !params[:status][:name].blank?\n status = Status.find_or_create_by_name(params[:status][:name].to_s)\n params[:node][:status_id] = status.id\n end\n end\n\n if params[:node][:virtualarch]\n if params[:node][:virtualmode]\n if params[:node][:virtualmode] == 'guest'\n virtual_guest = true\n # use switch ip & port info to find out who the vm host is\n vmhost = find_vm_host\n unless vmhost.nil?\n if vmhost.virtual_host?\n # does node belong to ANY vmvirt_assignment? (can only belong to ONE at any time as a guest)\n results = VirtualAssignment.find(:all,:conditions => [\"child_id = ?\", @node.id])\n if results.empty?\n xmlinfo << \"Virtual assignment to #{vmhost.name} doesn't exist. Creating...\"\n VirtualAssignment.create( :parent_id => vmhost.id, :child_id => @node.id)\n else\n xmlinfo << \"#{@node.name} already assigned to virtual host #{results.first.virtual_host.name}.\\n - Skipping vm guest assignment registration.\"\n end\n else\n xmlinfo << \"Found vmhost (#{vmhost.name}) but not registered in nventory as a vmhost.\\nCancelled virtual assignment\"\n end\n else\n xmlinfo << \"Was unable to find a vmhost associated to the switch and switch port.\"\n end\n elsif params[:node][:virtualmode] == 'host'\n # register all guest vms from value passed from cli\n if params[:vmguest].kind_of?(Hash)\n vmguests = params[:vmguest]\n # clear this out of hash or will try to register a non-existing table column\n # try to find each node if exists in nventory, if does then see if virtual assign exists to this vm host, if not create it\n vmguests.keys.each do |vmguest|\n vmresults = Node.find(:all,:conditions => [\"name like ?\",\"#{vmguest}%\"])\n if vmresults.size == 1\n vmnode = vmresults.first\n # Update fs size if diff\n vmnode.update_attributes(:vmimg_size => vmguests[vmguest][\"vmimg_size\"].to_i) \n vmnode.update_attributes(:vmspace_used => vmguests[vmguest][\"vmspace_used\"].to_i) \n # Check if a virtual machine assignment (host <=> guest) previously exists\n vmassign_results = VirtualAssignment.find(:all,:conditions => [\"child_id = ?\", vmnode.id])\n if vmassign_results.size > 1\n xmlinfo << \"#{vmguest} already registered to MULTIPLE vm hosts\\n (Illegal registration!) Should only belong to one vm assignment at any given time.\"\n elsif vmassign_results.size == 1\n xmlinfo << \"#{vmguest} already registered to vmhost #{vmassign_results.first.virtual_host.name}\\n - Skipping vm guest assignment registration.\"\n elsif vmassign_results.empty?\n xmlinfo << \"#{vmguest} not registered to vmhost #{@node.name}. Registering...\"\n VirtualAssignment.create(\n :parent_id => @node.id,\n :child_id => vmnode.id)\n end\n elsif vmresults.size > 1\n xmlinfo << \"#{vmguest}: More than 1 nodes found with that name. Unable to register.\"\n elsif vmresults.empty?\n xmlinfo << \"#{vmguest}: No nodes found with that name. Unable to register\"\n end\n end\n end # if params[:vmguest] == Hash\n end\n params[:node].delete(:virtualmode)\n end\n end\n\n process_blades(params[:blades]) if params[:blades]\n process_chassis(params[:chassis]) if params[:chassis]\n \n # If the user specified some network interface info then handle that\n if params[:format] == 'xml'\n # if it's xml request we want to output whether we found a switch port or not. \n # ideally xmloutput should be used for other steps in this other than just process_network_interfaces,\n # however, we'll start with this for now.\n virtual_guest ? (xmlinfo << process_network_interfaces(:noswitch)) : (xmlinfo << process_network_interfaces)\n else\n virtual_guest ? process_network_interfaces(:noswitch) : process_network_interfaces\n end\n process_storage_controllers\n # If the user specified a rack assignment then handle that\n process_rack_assignment\n # If the user included outlet names apply them now\n if params[:node].include?(:outlet_names)\n @node.update_outlets(params[:node][:outlet_names])\n params[:node].delete(:outlet_names)\n end\n # Process percent_cpu metrics\n process_utilization_metrics if (params[\"utilization_metric\"])\n xmloutput[:info] = xmlinfo.join(\"\\n\").to_s \n # Process volumes\n process_volumes if (params[\"volumes\"])\n process_name_aliases if (params[\"name_aliases\"])\n\n priorstatus = @node.status\n respond_to do |format|\n if @node.update_attributes(params[:node])\n email_status_update(params,priorstatus) if MyConfig.notifications.status_update\n flash[:notice] = 'Node was successfully updated.'\n format.html { redirect_to node_url(@node) }\n format.xml { render :xml => xmloutput.to_xml }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5184ac500943d3631a58feb958bdb987",
"score": "0.5365866",
"text": "def before_rendering( template )\n\t\tst = template\n\n\t\twhile st = st._enclosing_template\n\t\t\tsurrogate = template.class.new( self.subnodes )\n\n\t\t\t# :TODO: Does appending to the attribute make more sense?\n\t\t\tst._attributes[ self.name ] = surrogate\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d7490b352333e85e1c3987262c42c988",
"score": "0.5362103",
"text": "def setup_template(variables={})\n variables[:template_name] ||= self.template_name\n Glass::Template.new(variables).render_self\n end",
"title": ""
},
{
"docid": "900f2894b193d0f61dde433d7ad7211d",
"score": "0.5354456",
"text": "def set_template\n @template = ProposalTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "a5206ef3818eae22f76dc5724ac5a255",
"score": "0.53518134",
"text": "def override_template_root(org, with, context = Base::Visitor)\n template_ext(org, context)[:root] = with.to_s\n end",
"title": ""
},
{
"docid": "2514ffe1e4e2cf01b8b13c830f61efcb",
"score": "0.5349959",
"text": "def set_train_template\n @train_template = TrainTemplate.find(params[:id])\n end",
"title": ""
},
{
"docid": "b140586391454874f04bfb4408df4d0d",
"score": "0.5347035",
"text": "def template=(template)\n if template\n self.layout = template\n self.style = template\n end\n end",
"title": ""
}
] |
9946550adcf689ca2b8bea0389b1b882
|
We override respond_to so that we respond to the normal object models as well as accept the method_missing utilized names as well. If it's in +respondable_methods+, we return true.
|
[
{
"docid": "5d93c9f9ae28cbdc03a90d48fa3b1ec6",
"score": "0.0",
"text": "def respond_to_missing?(method_name, include_private = false) #:nodoc:\n components = method_name.to_s.split('_')\n tense_method = components[0..5].join('_').to_sym\n\n return false unless @tense_list.nil? || @tense_list.include?( tense_method.to_s )\n\n if components.length > 6\n tb = self.send(tense_method)\n vector_call = components[6..-1].join('_').to_sym\n tb.class.instance_method(vector_call)\n end\n\n end",
"title": ""
}
] |
[
{
"docid": "10257f9ff3e35108c4ff5af873a33901",
"score": "0.82389826",
"text": "def respond_to_missing?(*args)\n @object.respond_to?(*args) || super\n end",
"title": ""
},
{
"docid": "f8c1ae9c9aa6ecfd4a3afbe83904fdde",
"score": "0.81053156",
"text": "def respond_to_missing?(method_name, include_all = false)\n object.respond_to?(method_name, include_all) || super\n end",
"title": ""
},
{
"docid": "7f4fc43a4439993c2116bd0a2713aaee",
"score": "0.79459804",
"text": "def respond_to?(method)\n @obj.respond_to?(method) || super\n end",
"title": ""
},
{
"docid": "4adc805c2dc3a0cdc696ce3b205bf757",
"score": "0.77958316",
"text": "def respond_to_missing?(method_name, *rest) # include_all=false\n to_s.respond_to?(method_name, *rest) || super\n end",
"title": ""
},
{
"docid": "73487ffd624146af98885e0bd9c04e61",
"score": "0.7710361",
"text": "def respond_to?(method_name)\n super || begin\n model = self.model\n\n model.respond_to?(method_name) if model\n end\n end",
"title": ""
},
{
"docid": "3bee754db95e9c7d5f947477591a3038",
"score": "0.76316255",
"text": "def respond_to?(method, include_private = false)\n super || model.respond_to?(method) || relationships.key?(method)\n end",
"title": ""
},
{
"docid": "25ae24483867ada720dbf0d345fa2ddf",
"score": "0.76028556",
"text": "def respond_to?(_name, _include_all = true)\n true\n end",
"title": ""
},
{
"docid": "84fd65e8d27ffc0586346b50e522190f",
"score": "0.7597274",
"text": "def respond_to?(*args, **kwargs)\n method_name = args.first\n return false if method_name == :to_model\n\n super\n end",
"title": ""
},
{
"docid": "699bc56e0ba8a4f55956a0fced574d45",
"score": "0.75818276",
"text": "def respond_to?(method, include_private = false)\n super || model.public_methods(false).map { |m| m.to_s }.include?(method.to_s) || relationships.has_key?(method)\n end",
"title": ""
},
{
"docid": "302803ea12013adf871a3d66e6205119",
"score": "0.7579407",
"text": "def respond_to_missing?(_method_name, _include_all); end",
"title": ""
},
{
"docid": "b22b6b03f2935c7f027f4a2f882a0524",
"score": "0.7530687",
"text": "def respond_to_missing?(*args)\n method_name = args[0]\n return true if @attributes.key?(method_name)\n\n load_ar_object\n @klass_object.respond_to?(*args)\n end",
"title": ""
},
{
"docid": "38d040f400720f53a2183745ed520ebc",
"score": "0.7491786",
"text": "def respond_to_missing?(*_)\n true\n end",
"title": ""
},
{
"docid": "cd324369861f603fd5029ed18c9f4142",
"score": "0.7476906",
"text": "def respond_to?(name, include_all = false)\n super || @inner.respond_to?(name)\n end",
"title": ""
},
{
"docid": "baeebf275bf42908ed6b9c7bfbc25b5c",
"score": "0.74757326",
"text": "def respond_to_missing?(method_name, *)\n to_h.key?(method_name.to_s)\n end",
"title": ""
},
{
"docid": "2e2374b03e52302fc82b2de27910bfef",
"score": "0.74685377",
"text": "def respond_to_missing?(*_args); super; end",
"title": ""
},
{
"docid": "4eea42cd6c7e78999d66f3db92aaed52",
"score": "0.7464658",
"text": "def respond_to_missing?(method_name, *args)\n super\n end",
"title": ""
},
{
"docid": "b8fad540df69976ab32ea92c33e32f89",
"score": "0.74601144",
"text": "def respond_to_missing?(name, include_private = false)\n object.respond_to?(name, include_private)\n end",
"title": ""
},
{
"docid": "21f255abd81716caf709c4421ed2e27e",
"score": "0.7457567",
"text": "def respond_to_missing?(name, include_private = false)\n object.respond_to?(name, include_private)\n end",
"title": ""
},
{
"docid": "c37ed2c350bc69ed8290cd7b0e838ef7",
"score": "0.74461055",
"text": "def respond_to?(method_name)\n true\n end",
"title": ""
},
{
"docid": "c37ed2c350bc69ed8290cd7b0e838ef7",
"score": "0.74461055",
"text": "def respond_to?(method_name)\n true\n end",
"title": ""
},
{
"docid": "4051f24c905ebf6d3788e2559ae3cd8a",
"score": "0.74281365",
"text": "def respond_to_missing?(method_name, include_private = false)\n Response.instance_methods(false).include?(method_name) || Array.instance_methods(false).include?(method_name) || super\n end",
"title": ""
},
{
"docid": "2e6746480cdfb2883d5a6030632809de",
"score": "0.7422514",
"text": "def respond_to?(method)\n return true if valid_type?(method)\n super\n end",
"title": ""
},
{
"docid": "c41fb27bd1c9bd846d9da405a64876e5",
"score": "0.7411334",
"text": "def respond_to?(method_sym, include_private = false)\n puts \"--- controller#respond_to called with '#{method_sym}'\"\n puts \"--- current actions: #{actions.join(',')}\"\n\n if actions.include?(method_sym.to_s) # =~ /^find_by_(.*)$/\n true\n else\n super\n end\n end",
"title": ""
},
{
"docid": "33806fdd6847971e7a853dfc89342e8e",
"score": "0.739503",
"text": "def respond_to?(method_name, *arguments, &block)\n !!method_name.to_s.match(/(post|get|put|patch|delete)/) || super\n end",
"title": ""
},
{
"docid": "33806fdd6847971e7a853dfc89342e8e",
"score": "0.739503",
"text": "def respond_to?(method_name, *arguments, &block)\n !!method_name.to_s.match(/(post|get|put|patch|delete)/) || super\n end",
"title": ""
},
{
"docid": "da0a35960b1ef98e5b8209e43795fcbc",
"score": "0.7391224",
"text": "def respond_to?(method_name, include_private = false)\n super || data.respond_to?(method_name, include_private)\n end",
"title": ""
},
{
"docid": "b87778e5e5050984bf378b8f9e1c1684",
"score": "0.7385564",
"text": "def respond_to?(name, all=false)\n method_name?(name) || super\n end",
"title": ""
},
{
"docid": "a2df76de82e69e186e79258d7b66e8af",
"score": "0.7376457",
"text": "def respond_to_missing?(method_id, _include_private)\n resource.respond_to?(method_id) || super\n end",
"title": ""
},
{
"docid": "31deed5a96fea8cfa55df1ecbea6e888",
"score": "0.7366822",
"text": "def respond_to?(name,include_all=false)\n respond_to_missing?(name,include_all)\n end",
"title": ""
},
{
"docid": "6c6a7f1a8ca20c431e59211fb7c852d4",
"score": "0.7353803",
"text": "def respond_to?(method)\n true\n end",
"title": ""
},
{
"docid": "6c6a7f1a8ca20c431e59211fb7c852d4",
"score": "0.7353803",
"text": "def respond_to?(method)\n true\n end",
"title": ""
},
{
"docid": "b7fac1d221b23429b60e4932a8009bae",
"score": "0.7346535",
"text": "def respond_to?(m, include_all = false)\n respond_to_missing?(m, include_all)\n end",
"title": ""
},
{
"docid": "0ea8ced1931601fe5ccf45837d16bb65",
"score": "0.7337321",
"text": "def respond_to_missing?(method, include_private = false)\n resource.respond_to?(method.to_s)\n end",
"title": ""
},
{
"docid": "fd0cda5045c6511290ee48e48b2c7d6e",
"score": "0.733702",
"text": "def respond_to_missing? method, *args, &block\n respond? method, class_methods\n end",
"title": ""
},
{
"docid": "fdb15c4b6b8ff2a02847be544b98860b",
"score": "0.7332017",
"text": "def respond_to?(method, all = false)\n return true if method == :acts_as_string?\n return true if %i[inspect to_date to_f to_i to_numeric to_number to_s to_time].include? method\n return @object.respond_to?(method, all) if @object\n false\n end",
"title": ""
},
{
"docid": "d659e48793ab0a25748618007948e1c1",
"score": "0.7327511",
"text": "def respond_to?(name)\n [].respond_to?(name) || methods.include?(name)\n end",
"title": ""
},
{
"docid": "ed1036ded298ed5c24c0049dc2e35461",
"score": "0.73179877",
"text": "def respond_to? meth, include_private=false\n if(matches? meth)\n return true\n else\n super\n end\n end",
"title": ""
},
{
"docid": "ed1036ded298ed5c24c0049dc2e35461",
"score": "0.73179877",
"text": "def respond_to? meth, include_private=false\n if(matches? meth)\n return true\n else\n super\n end\n end",
"title": ""
},
{
"docid": "d0171725e1f48adf91d01080f5a5e360",
"score": "0.7314614",
"text": "def respond_to?(*args)\n super || @behaviors.last.respond_to?(*args)\n end",
"title": ""
},
{
"docid": "ec8974dc0047aec5b3ff06a5432d886b",
"score": "0.73055285",
"text": "def respond_to_missing?(*several_variants)\n super\n end",
"title": ""
},
{
"docid": "ec8974dc0047aec5b3ff06a5432d886b",
"score": "0.73055285",
"text": "def respond_to_missing?(*several_variants)\n super\n end",
"title": ""
},
{
"docid": "ec8974dc0047aec5b3ff06a5432d886b",
"score": "0.73055285",
"text": "def respond_to_missing?(*several_variants)\n super\n end",
"title": ""
},
{
"docid": "e5a559f817ce1bf01f1f25e91ba50e12",
"score": "0.7302378",
"text": "def respond_to_missing?(method, include_all)\n \"\".respond_to?(method, include_all)\n end",
"title": ""
},
{
"docid": "4c0519d6c789b2e32ed664039af272a6",
"score": "0.7302195",
"text": "def respond_to?(_method, include_all = false)\n true\n end",
"title": ""
},
{
"docid": "fd9525c044feeea5506173ad93c3edab",
"score": "0.73014647",
"text": "def respond_to?(method_name)\n return true if method_name.to_s =~ COLLECTION_METHOD_NAMES_PATTERN\n super\n end",
"title": ""
},
{
"docid": "a52a7ccff6ed341118fabc993349189e",
"score": "0.7300254",
"text": "def respond_to_missing?(method_name, include_super)\n !!(method_name.to_s =~ /\\?$/ || super || send(method_name))\n rescue NoMethodError\n false\n end",
"title": ""
},
{
"docid": "772fc55b31dabcb36e196ab8aebf228b",
"score": "0.7295033",
"text": "def respond_to?(name, include_private = false)\n [].respond_to?(name, include_private) ||\n klass.respond_to?(name, include_private) || super\n end",
"title": ""
},
{
"docid": "2450f96ed3d31f543adf00d12e610f70",
"score": "0.7294303",
"text": "def respond_to?(method, *)\n super || forwardable?(method)\n end",
"title": ""
},
{
"docid": "2450f96ed3d31f543adf00d12e610f70",
"score": "0.7294303",
"text": "def respond_to?(method, *)\n super || forwardable?(method)\n end",
"title": ""
},
{
"docid": "7734459411b2f4a1b4a559a25831eb7a",
"score": "0.7288007",
"text": "def respond_to_missing?(method, include_all = false)\n handles?(method) || super(method, include_all)\n end",
"title": ""
},
{
"docid": "6662e261da445b8538e82bdb00bcd5eb",
"score": "0.7286678",
"text": "def respond_to_missing?(method, include_all)\n find_name(method) || @hash.respond_to?(method, include_all)\n end",
"title": ""
},
{
"docid": "52e0058ae7d27f79d95058006574de35",
"score": "0.7284656",
"text": "def respond_to?(name, *)\n self[name] ? true : false\n end",
"title": ""
},
{
"docid": "43b05f1a82c92964e2acbd86e99f3c81",
"score": "0.7278615",
"text": "def respond_to_missing?(_method_name, _include_private = false)\n true\n end",
"title": ""
},
{
"docid": "668e9073ac033c6bca1adc657a145af1",
"score": "0.7269576",
"text": "def respond_to?(_)\n true\n end",
"title": ""
},
{
"docid": "3c2ca79b4f8d8133f1285798e45ed79c",
"score": "0.72677207",
"text": "def respond_to?(name, include_private = false)\n [].respond_to?(name, include_private) || super\n end",
"title": ""
},
{
"docid": "92909404bbe36d2f398b1d24d45eb1aa",
"score": "0.72655296",
"text": "def respond_to_missing?(_, _ = false)\n true # responds to everything, always\n end",
"title": ""
},
{
"docid": "92909404bbe36d2f398b1d24d45eb1aa",
"score": "0.72655296",
"text": "def respond_to_missing?(_, _ = false)\n true # responds to everything, always\n end",
"title": ""
},
{
"docid": "104c0b899e9a783870e94b7f6d8a05cc",
"score": "0.72614795",
"text": "def respond_to?(method_name)\n return true if @associations.respond_to? method_name\n super\n end",
"title": ""
},
{
"docid": "f78816340fbcc8898a71035dae12e870",
"score": "0.7251599",
"text": "def respond_to_missing?( message, include_priv=false )\n\t\treturn self.obj.respond_to?( message, include_priv )\n\tend",
"title": ""
},
{
"docid": "3902ed0dc1c07c0a9c66997bf8cfefc7",
"score": "0.7249955",
"text": "def respond_to_missing?(method_name, include_private = false)\n\t\tpost.respond_to?(method_name, include_private) || super\n\tend",
"title": ""
},
{
"docid": "8bce3e599fc0f1339b5d5f2cc3eedf89",
"score": "0.72327864",
"text": "def respond_to?(method)\n include?(method) || super\n end",
"title": ""
},
{
"docid": "96b9dca87693c7e69ebe941d2b37f014",
"score": "0.7231824",
"text": "def respond_to?(method_name, include_private = false)\n true\n end",
"title": ""
},
{
"docid": "5a3a79751d3b1587bee49ca40d9d65f1",
"score": "0.7227986",
"text": "def respond_to?(method, include_private = false)\n @owner.respond_to?(@prefix.to_s + method.to_s) || super\n end",
"title": ""
},
{
"docid": "1f15bb178c18149a58a2e1bc6c909837",
"score": "0.7208313",
"text": "def respond_to_missing?(method_name, include_all = false)\n property_name = get_property_name_from_method(method_name, include_all)\n # property_name is not nil if the method is supported\n !property_name.nil?\n end",
"title": ""
},
{
"docid": "e80c873cbab9b9c529a91dfbdbd0fece",
"score": "0.7208258",
"text": "def respond_to?(method_name)\n return false if method_name == :to_model\n\n super\n end",
"title": ""
},
{
"docid": "e80c873cbab9b9c529a91dfbdbd0fece",
"score": "0.7208258",
"text": "def respond_to?(method_name)\n return false if method_name == :to_model\n\n super\n end",
"title": ""
},
{
"docid": "e80c873cbab9b9c529a91dfbdbd0fece",
"score": "0.7208258",
"text": "def respond_to?(method_name)\n return false if method_name == :to_model\n\n super\n end",
"title": ""
},
{
"docid": "e80c873cbab9b9c529a91dfbdbd0fece",
"score": "0.7208258",
"text": "def respond_to?(method_name)\n return false if method_name == :to_model\n\n super\n end",
"title": ""
},
{
"docid": "dc9d81ed56f3bcac71368c8c4c7fa2d7",
"score": "0.7196817",
"text": "def should_respond?\n true\n end",
"title": ""
},
{
"docid": "a8999864ccd28686bae22e4493ee6bd8",
"score": "0.7194706",
"text": "def respond_to_missing?(method_name, include_private = false)\n response.respond_to?(method_name) || super\n end",
"title": ""
},
{
"docid": "8d2b449cc52f298e5c78f1c566027be5",
"score": "0.71878254",
"text": "def respond_to_missing?(method_name, include_private = false)\n METHODS_ALLOWED.include?(method_name.to_s) || super\n end",
"title": ""
},
{
"docid": "1b6d0a15904f67f3454b1c87c05b8cc6",
"score": "0.71868455",
"text": "def respond_to?(meth)\n return true if has_key?(meth)\n super\n end",
"title": ""
},
{
"docid": "33023d2c27c483c9efe25198300f9517",
"score": "0.7179304",
"text": "def respond_to_missing?(method_name, include_super)\n !!finder?(method_name) || super\n end",
"title": ""
},
{
"docid": "d5d7fb59c33e793a4821f3e9b8b3a1a3",
"score": "0.715747",
"text": "def respond_to_missing?(method_name, include_private = false)\n method_name.to_s.include?('response') || super\n end",
"title": ""
},
{
"docid": "7e2a07249423af8c3e3f9a54d740402e",
"score": "0.7156235",
"text": "def respond_to?(name) \n if super\n true\n else\n presentee.respond_to?(name)\n end\n end",
"title": ""
},
{
"docid": "8d23cd65e6c3a2ef3cee21deed03a989",
"score": "0.7154271",
"text": "def respond_to_missing?(method_name, include_private = false)\n valid?(method_name) || super\n end",
"title": ""
},
{
"docid": "d7f32a8fdca886390ffed4ab737c467a",
"score": "0.7153414",
"text": "def respond_to?(method)\n true\n end",
"title": ""
},
{
"docid": "74e46f6dc2ed0ea862a82ffe5fab92eb",
"score": "0.7146752",
"text": "def respond_to?(method_name, include_private = false)\n super\n end",
"title": ""
},
{
"docid": "aedab3082b638bb729a105ecab37f33c",
"score": "0.71434075",
"text": "def respond_to?(method_name)\n instance_methods.include?(method_name)\n end",
"title": ""
},
{
"docid": "71aee836e1a74905f669d4e231b0c6c0",
"score": "0.71406054",
"text": "def respond_to_missing?(m, include_private = false)\n @object.respond_to?(m, include_private)\n end",
"title": ""
},
{
"docid": "5dfd29a47495d2e8cd92f8ee053dc4ca",
"score": "0.71346956",
"text": "def respond_to?(method, include_private = false) #:nodoc:\n\t\t\t\tsuper || action_methods.include?(method.to_s)\n\t\t\tend",
"title": ""
},
{
"docid": "61418a87adf99dc7313d2d6c45537ad2",
"score": "0.71339375",
"text": "def respond_to_missing?(method, include_all = false)\n @data.respond_to?(method, include_all) || @data.key?(method)\n end",
"title": ""
},
{
"docid": "df05f1fe9c97adc235af6e2ed1d573e4",
"score": "0.7113563",
"text": "def respond_to_missing?(_method, _include_private = false)\n true\n end",
"title": ""
},
{
"docid": "40b2dcff6cf6966fd79b6ca7116c493f",
"score": "0.71052265",
"text": "def respond_to_missing?(method_name, include_private = false)\n options.any? { |o| o.key == method_name.to_s.chop } || super\n end",
"title": ""
},
{
"docid": "3a47ce4dcc52520151940f88c1e0f5a7",
"score": "0.7093128",
"text": "def respond_to?(symbol, include_private=false) \n super if respondable_methods.nil?\n super if respondable_methods.empty?\n self.respondable_methods.grep(Regexp.new %Q/^#{symbol}$/).empty? ?\n super : true\n end",
"title": ""
},
{
"docid": "9466337f0d86112a4a34d4fdc2ca3b7d",
"score": "0.7084252",
"text": "def respond_to?(name, include_private=false)\n super || @host.respond_to?(name)\n end",
"title": ""
},
{
"docid": "f86bf3371cac3ccc2a0bc42efc4601bf",
"score": "0.70826656",
"text": "def respond_to_missing?(method_name, include_private = false)\n method_name[0] == '_' || LOCAL_METHODS.include?(method_name) ? super : true\n end",
"title": ""
},
{
"docid": "e8a8b5cf8264b87de4487f938e9090d3",
"score": "0.70818067",
"text": "def respond_to?(method_name)\n super || rpc_methods.include?(method_name.to_sym)\n end",
"title": ""
},
{
"docid": "0c8e784895868dcf79aab5ab2adea999",
"score": "0.7078007",
"text": "def respond_to_missing?(method, include_private = false)\n %i[_attributes _embedded _links].each do |target|\n return true if send(target).respond_to?(method, include_private)\n end\n false\n end",
"title": ""
},
{
"docid": "6c1358d883051f832bc109a2a3f751a7",
"score": "0.70675856",
"text": "def respond_to?\n true\n end",
"title": ""
},
{
"docid": "55a9bee9806432cec5d92c121259700a",
"score": "0.70657474",
"text": "def respond_to?(method)\n presented_attribute?(method) || super\n end",
"title": ""
},
{
"docid": "87bbe54f96d1e77723bfb7f9902c0220",
"score": "0.70618254",
"text": "def respond_to method, *args\n respond_to?(method) ? send(method, *args) : nil\n end",
"title": ""
},
{
"docid": "20c62cc314196dc4a55a82caf052dff9",
"score": "0.7061042",
"text": "def respond_to_missing?(method_name, *args)\r\n return true if method_name.match(/(.*)\\=$/)\r\n\r\n return true if klass_attr.key?(method_name.to_sym)\r\n\r\n super(method_name, args)\r\n end",
"title": ""
},
{
"docid": "79e87be2b1783491f0554721349a7198",
"score": "0.7055516",
"text": "def respond_to?(method, *)\n return super unless (method.to_s == 'to_hash') || (method.to_s == 'to_ary')\n\n data.respond_to? method\n end",
"title": ""
},
{
"docid": "d9a6f60095bb104f4472135d806b197f",
"score": "0.70549965",
"text": "def respond_to?(method, *args)\n return true if AVAILABLE_FIELDS.include?(method.to_s)\n super(method)\n end",
"title": ""
},
{
"docid": "d9a6f60095bb104f4472135d806b197f",
"score": "0.70549965",
"text": "def respond_to?(method, *args)\n return true if AVAILABLE_FIELDS.include?(method.to_s)\n super(method)\n end",
"title": ""
},
{
"docid": "31fdfd01288e77a06645984e4e8b29ab",
"score": "0.7054668",
"text": "def respond_to_missing?(mtd)\n drb_object.respond_to?(mtd) ? true : super\n end",
"title": ""
},
{
"docid": "085a9e47e45fcff2307c2e1e9414f486",
"score": "0.70492345",
"text": "def respond_to?(method)\n super || @string.respond_to?(method) || handler.respond_to?(method) ||\n (method.to_s =~ /(.*)!/ && handler.respond_to?($1)) || false\n end",
"title": ""
},
{
"docid": "d85e0a60382241867adf4c6effd2b948",
"score": "0.70487005",
"text": "def respond_to_missing?(_)\n true\n end",
"title": ""
},
{
"docid": "ddfcac2ce2682d5977d2cf9d13583c73",
"score": "0.70453334",
"text": "def respond_to?(name, include_private = false)\n desires.key?(name.to_s) || super\n end",
"title": ""
},
{
"docid": "630d17df23142911185f2441e4c3958e",
"score": "0.70445454",
"text": "def respond_to?(name)\n @hash.include?(name) || super(name)\n end",
"title": ""
}
] |
a0ea784f0a66bf7ac39ca1723c8bf935
|
For purposes of the DH Leipzig/Maryland/etc. research groups (be able to use To Pan, etc.) the CSV files must comply with CITE CTS. The specs are at
|
[
{
"docid": "359a1337532659af7ba26f7923b8f469",
"score": "0.0",
"text": "def cts_csv_writeline(madhab, tafseer, line_no, opts = {nospecialchars: false})\n # @hash contents example:\n #\n # {\"position_sura\"=>1,\n # \"position_aaya\"=>1,\n # \"position_madhab\"=>1,\n # \"position_tafsir\"=>1,\n # \"meta_title\"=>\"تفسير جامع البيان في تفسير القرآن\",\n # \"meta_author\"=>\"الطبري\",\n # \"meta_year\"=>\"310\",\n # \"aaya\"=>\"بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ\",\n # \"text\"=>\n # \"<section><p>القول فـي تأويـل { بِسْمِ }.\n return unless urn = encode_urn(line_no)\n outname = \"%03d-%03d.csv\" % [madhab, tafseer]\n optname = (opts.map {|k,v| k if v}).compact.join(',')\n outpath = File.join(@outpath, 'csv', ['cts+aaya', optname].reject {|i| i.empty?}.join('_'))\n text = @hash['text']\n text = remove_specialchars(text) if opts[:nospecialchars]\n values = [urn, text, @hash['aaya']]\n outfile = File.join(outpath, outname)\n FileUtils.mkdir_p(outpath)\n write_header = !(File.file?(outfile))\n header = ['urn', 'text', 'aaya']\n CSV.open(outfile, 'ab') do |csv|\n if write_header\n csv << header\n else\n csv << values\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "5e49b51e00e2ddf6bb5dc31834a4ffa3",
"score": "0.6169401",
"text": "def process_ce_data_file (input_filename, output_filename)\n\t#Check if the input file is xls. If so, change to CSV\n\tif input_filename.include? \"xls\"\n\t\tcsv_filename = input_filename.gsub \"xls\", \"csv\"\n\t\tce_tsv_to_csv(input_filename, csv_filename)\n\t\tinput_filename = csv_filename\n\tend\n\n\tCSV.open(output_filename, \"wb\") do |csv|\n\t\t# Create Header Row\n\t\tcsv << [\"Date\",\n\t\t\t\t\"Widget Impressions\",\n\t\t\t\t\"Lead Request Users\",\n\t\t\t\t\"Lead Users\",\n\t\t\t\t\"Leads\",\n\t\t\t\t\"Clickout Impressions\",\n\t\t\t\t\"Clickouts\",\n\t\t\t\t\"Lead Revenue\",\n\t\t\t\t\"Clickout Revenue\",\n\t\t\t\t\"Total Revenue\",\n\t\t\t\t\"Landing Page\",\n\t\t\t\t\"Source\",\n\t\t\t\t\"Campaign ID\",\n\t\t\t\t\"Device\",\n\t\t\t\t\"Device2\",\n\t\t\t\t\"Keyword\",\n\t\t\t\t\"Match\",\n\t\t\t\t\"Ad ID\",\n\t\t\t\t\"Ad Page\",\n\t\t\t\t\"Ad Top/Side\",\n\t\t\t\t\"Ad Position\",\n\t\t\t\t\"Network\",\n\t\t\t\t\"Widget Location\",\n\t\t\t\t\"Organic\",\n\t\t\t\t\"Original Source\"]\n\t\t# For each row from Campus Explorer CSV File\n\t\tcounter = 0\n\t\tCSV.foreach(input_filename, :headers => true, :return_headers => false, :encoding => 'windows-1251:utf-8') do |row|\n\t\t\t# Process the utm_campaign string as passed through from Source Code into separate values in their own cells\n\t\t\tsource_data = process_source_code row[\"Source Code\"]\n\t\t\tcounter += 1\n\t\t\t# Is there data?\n\t\t\tif has_campusexplorer_data? row\n\t\t\t\t# Write ALL values out to processed CSV file\n\t\t\t\tcsv << [row[\"Grouping\"],\n\t\t\t\t\t\trow[\"Widget Impressions\"],\n\t\t\t\t\t\trow[\"Lead Request Users\"],\n\t\t\t\t\t\trow[\"Lead Users\"],\n\t\t\t\t\t\trow[\"Leads\"],\n\t\t\t\t\t\trow[\"Clickout Impressions\"],\n\t\t\t\t\t\trow[\"Clickouts\"],\n\t\t\t\t\t\trow[\"Unreconciled Publisher Lead Revenue\"],\n\t\t\t\t\t\trow[\"Unreconciled Publisher Clickout Revenue\"],\n\t\t\t\t\t\trow[\"Unreconciled Publisher Total Revenue\"],\n\t\t\t\t\t\tsource_data[:lp],\n\t\t\t\t\t\tsource_data[:source],\n\t\t\t\t\t\tsource_data[:campaign_id].gsub(\"]\",\"\"),\n\t\t\t\t\t\tsource_data[:device],\n\t\t\t\t\t\tsource_data[:device2],\n\t\t\t\t\t\tsource_data[:keyword],\n\t\t\t\t\t\tsource_data[:match],\n\t\t\t\t\t\tsource_data[:ad_id],\n\t\t\t\t\t\tsource_data[:ad_page],\n\t\t\t\t\t\tsource_data[:ad_top_side],\n\t\t\t\t\t\tsource_data[:ad_position],\n\t\t\t\t\t\tsource_data[:network],\n\t\t\t\t\t\tsource_data[:widget_location],\n\t\t\t\t\t\tsource_data[:organic],\n\t\t\t\t\t\trow[\"Source Code\"]\n\t\t\t\t\t\t]\n\t\t\tend\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "5a4b29730259921e483f18d025b4c0de",
"score": "0.61250037",
"text": "def get_valid_csv\n return get_csv_file('valid_csv.csv')\n end",
"title": ""
},
{
"docid": "66fd9626c64cf7fb46cd2cc74aa48c0f",
"score": "0.61205006",
"text": "def get_valid_csv_massive\n return get_csv_file('valid_csv_mega_massive.csv')\n end",
"title": ""
},
{
"docid": "7b138c73a0bb973bfc989a7aa3432606",
"score": "0.6028475",
"text": "def check_subject_info_file(info_file, nColumns)\n # Function: check_subject_info_file\n # Purpose:\n # Loop thru a given subject info CSV file and check whether it's\n # somewhat structurally sound, by ensuring that each line contains the\n # required number of values.\n #\n # does the info file appear to be CSV -- check the file extension\n info_file = File.expand_path(info_file)\n info_file_ext = File.extname(info_file)\n info_file_basename = File.basename(info_file, info_file_ext)\n if ( info_file_ext != '.csv' ) then\n puts sprintf(\"\\n*** Error: Control file [%s] needs to be in .csv format, with the appropriate file extension\", info_file)\n puts opts\n exit\n end\n\n # file exists and is a regular file?\n if ( !File.exists?(info_file) || !File.file?(info_file) ) then\n puts sprintf(\"\\n*** Error: The subject information file [%s] is not readable\", info_file)\n puts opts\n exit\n end\n\n # does each row have the expected number of fields?\n csv = File.open(info_file, 'r')\n csv.each_with_index{ |row, ndx|\n row.chomp!\n # is this a comment line? (i.e., starts with a hash?)\n next if row[0].to_s.eql?(\"#\")\n\n csv_parts = row.split(',')\n #p csv_parts\n #puts sprintf(\"csv_parts has got %d parts\", csv_parts.length)\n\n # end of file?\n if ( csv_parts.length == 0 ) then break end\n\n if ( csv_parts.length != nColumns ) then\n puts sprintf(\"\\n*** Error: Subject info file [%s] line %d contains incorrect number of fields.\", info_file, ndx+1)\n puts sprintf(\"*** There should be %d fields, but I see %d\", nColumns, csv_parts.length)\n puts row\n exit\n end\n }\n csv.close\n end",
"title": ""
},
{
"docid": "4e603c5172ca8dcb5f34baffc7edf390",
"score": "0.5950286",
"text": "def csv_data_fields\n case @first_line_string\n when /Date,Type,Sort Code,Account Number,Description,In,Out,Balance/ # Old Lloyds Bank Format\n [:date, :type, :sc, :ac, :description, :deposit, :withdrawal, :balance]\n when /Transaction Date,Transaction Type,Sort Code,Account Number,Transaction Description,Debit Amount,Credit Amount,Balance/ # 2013 Lloyds Bank Format, NB they are using debit and credit as if the account is an equity account (when of course a bank account is really an asset)\n [:date, :type, :sc, :ac, :description, :withdrawal, :deposit, :balance]\n when /Date,Date entered,Reference,Description,Amount/ # Lloyds Credit Card statement\n [:date, :dummy, :dummy, :description, :withdrawal]\n when /date,description,type,user,expensetype,withdrawal,withdrawal/\n [:date,:description,:type,:dummy,:dummy, :withdrawal, :withdrawal]\n when /Datum,Transaktion,Kategori,Belopp,Saldo/ # Nordea.se privat, Belopp is positive when the asset increases\n [:date,:description,:dummy,:deposit,:balance]\n when /Bokföringsdag;Belopp;Avsändare;Mottagare;Namn;Rubrik;Saldo;Valuta/ # Nordea new\n [:date,:deposit,:dummy,:dummy,:dummy,:description,:balance,:dummy]\n when /Bokföringsdatum,Transaktionsreferens,Mottagare,Belopp,Valuta/ # Forex.se privat, Belopp is positive when the asset increases\n [:date,:description,:dummy,:deposit,:dummy]\n when /Datum,Text,Belopp/ #Ecster Credit Card\n [:date,:description,:deposit]\n when /Effective Date,Entered Date,Transaction Description,Amount,Balance/ #QudosBank new format the first field is blank\n [:dummy,:date,:description,:deposit,:balance]\n when /Effective Date,Entered Date,Transaction Description,Amount/ #QudosBank, the first field is blank\n [:dummy,:date,:description,:deposit]\n when /Date,Amount,Currency,Description,\"Payment Reference\",\"Running Balance\",\"Exchange Rate\",\"Payer Name\",\"Payee Name\",\"Payee Account Number\",Merchant/ #TransferWise\n [:date,:deposit,:dummy,:description,:dummy,:balance,:dummy,:dummy,:dummy,:dummy,:dummy]\n when /\"TransferWise ID\",Date,Amount,Currency,Description,\"Payment Reference\",\"Running Balance\",\"Exchange From\",\"Exchange To\",\"Exchange Rate\",\"Payer Name\",\"Payee Name\",\"Payee Account Number\",Merchant,\"Total fees\"/ #TransferWise New\n [:dummy,:date,:deposit,:dummy,:description,:description2,:balance,:dummy,:dummy,:dummy,:dummy,:dummy,:dummy,:dummy,:dummy]\n else\n raise \"unknown data format for #@id: #@first_line_string, #{@data.slice(0,[4,@data.size].min)}\"\n end\n end",
"title": ""
},
{
"docid": "09e913333b4a909e6dde2d1aa5ec2146",
"score": "0.5931032",
"text": "def test_incorrect_csv\r\n\t\tassert_raise(ArgumentError.new(\"The number of factors in the CSV file doesn't correspond to the specified value\")) {IPOAlgorithm.new(3,[3,5,5],File.dirname(__FILE__)+\"/incorrect_file.csv\")}\r\n\t\tassert_raise(ArgumentError.new(\"The number of levels doesn't correspond to the specified values\")) {IPOAlgorithm.new(3,[3,4,5],File.dirname(__FILE__)+\"/input_file.csv\")}\r\n\tend",
"title": ""
},
{
"docid": "2beaaaad6b90f5358b1afb17c7d299fc",
"score": "0.58962643",
"text": "def extract_the_data(csvfile,project)\r\n success = true\r\n n = 0\r\n @data_lines.each do |line|\r\n n = n + 1\r\n #p \"processing line #{n}\"\r\n @record = CsvRecord.new(line)\r\n success, message = @record.extract_data_line(self, csvfile, project, n)\r\n #success,message = @record.add_record_to_appropriate_file(location,self,csvfile,project,n) if success.present?\r\n project.write_messages_to_all(message,true) if !success\r\n success = true\r\n end\r\n message = \"Your new file has (#{csvfile.unique_locations.length}) different batches ie a different county/place/church or register type. This creates complexities that should be avoided. We strongly urge you to reconsider the content of the file. <p>\"\r\n project.write_messages_to_all(message, true) if\r\n csvfile.unique_locations.length.present? && csvfile.unique_locations.length > 1\r\n return success, n\r\n end",
"title": ""
},
{
"docid": "d74a53d4ef5ed8acee9a29c3a4b5badc",
"score": "0.589491",
"text": "def rules_conditions_audit_data\n load_csv_data './features/files/AuditRulesConditions.csv'\nend",
"title": ""
},
{
"docid": "321c7217f87f7f1adc836a624c0d48fd",
"score": "0.5876227",
"text": "def get_invalid_csv_no_header\n return get_csv_file('invalid_csv_only_header.csv')\n end",
"title": ""
},
{
"docid": "3cb9b7185c6df0888c5ad7a143f66121",
"score": "0.58365345",
"text": "def get_invalid_csv_no_purchaser\n return get_csv_file('invalid_csv_invalid_purchaser.csv')\n end",
"title": ""
},
{
"docid": "b48fb5f0335ff250ae9e5eb4b90daaa6",
"score": "0.5827103",
"text": "def filter_formatted_enrollments(csv_fname, instr_fname, regex_filter = //)\n # Create csv with 'filtered' pre-appended to '.csv' substring\n filtered_csv = csv_fname.gsub(/\\.csv/, \"filtered.csv\")\n File.open(filtered_csv, 'w') do |file|\n # set row num to 0 to keep track of headers\n row_num = 0\n current = get_current_courses(instr_fname)\n # for each row\n puts \"Filtering #{csv_fname}\"\n CSV.foreach(csv_fname) do |row|\n # the line is initialized as an empty string\n line = \"\"\n # Skip the row if not a valid\n # or skip in-filter OU_code,\n # or skip if the header\n # or skip if not within the INSTR SET of current/future courses\n if row[3].nil? || row_num > 0 && (row[3] !~ regex_filter) || (!current.include? row[3][4..-1])\n row_num += 1\n next\n end\n # for values not filtered from above ^\n # for all of these values\n row[0..-1].each do |value|\n # If it a UTC date time value, then parse as Time.\n if value =~ /\\b[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]*Z\\b/ # if the value is UTC formatted\n line << \"\\\"#{Time.parse(value)}\\\"\"\n elsif value == row[-1] # if its the last value in the row\n line << \"\\\"#{value}\\\"\" # then dont put a comma at the end.\n else # not the last value in the row,\n line << \"\\\"#{value}\\\",\" # throw a comma after the value\n end\n end\n file.write(line + \"\\n\") # append this line to the csv\n row_num += 1 # increment the row number\n end\n end\nend",
"title": ""
},
{
"docid": "c090418cbb6eca140e5134f2b9cbeba7",
"score": "0.5824063",
"text": "def validate_csv\n mycsv = CSV.new(@csv, headers: true).read\n raise 'Invalid CSV - wrong headers' unless \\\n %w(Title URL Example\\ search).all? \\\n { |header| mycsv.headers.include? header }\n end",
"title": ""
},
{
"docid": "47d15b4f54339526fa0a3c12fba63686",
"score": "0.58080786",
"text": "def test_invalid_csv\n user_csv = \"test_files/user_invalid.csv\" \n business_csv = \"test_files/biz_invalid.csv\" \n\n filter = RecordFilter.new\n filter.create(user_csv, business_csv)\n filter.calc_stats()\n #filter.output\n \n ## Test invalid CSV\n if (filter.well_formed_rec_cnt == 6 && filter.malformed_rec_cnt == 10 &&\n filter.biz_rec_cnt == 3 && filter.user_rec_cnt == 0 && filter.total_rec_cnt == 16)\n @test_passed = @test_passed + 1\n else\n @test_failed = @test_failed + 1\n puts \"Invalid CSV Test Failed\"\n end\n end",
"title": ""
},
{
"docid": "508474bb64fadca8eaed4452efc1ced0",
"score": "0.57954913",
"text": "def csv_import(csv_file)\n\t\t\t\trequire \"csv\"\n\t\t\t\tCSV.foreach(csv_file) do |row|\n\n\t\t\t\t\tcase row[0]\n\n\t\t\t\t\twhen /PTR|^[A]$|AAAA/\n\t\t\t\t\t\treport_host(row[2])\n\n\t\t\t\t\t\t# Since several hosts can be tied to one IP, specially those that are vhosts\n\t\t\t\t\t\t# or are behind a balancer the names are saved as notes.\n\t\t\t\t\t\tframework.db.report_note({\n\t\t\t\t\t\t\t\t:host => row[2],\n\t\t\t\t\t\t\t\t:ntype => \"dns.info\",\n\t\t\t\t\t\t\t\t:data => \"A #{row[1]}\",\n\t\t\t\t\t\t\t\t:update => :unique_data\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\twhen /NS/\n\t\t\t\t\t\treport_host(row[2])\n\t\t\t\t\t\treport_service(\"dns\", \"udp\", 53, row[2])\n\t\t\t\t\t\tframework.db.report_note({\n\t\t\t\t\t\t\t\t:host => row[2],\n\t\t\t\t\t\t\t\t:port => 53,\n\t\t\t\t\t\t\t\t:proto => \"udp\",\n\t\t\t\t\t\t\t\t:ntype => \"dns.info\",\n\t\t\t\t\t\t\t\t:data => \"NS #{row[1]}\"\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\twhen /SOA/\n\t\t\t\t\t\treport_host(row[2])\n\t\t\t\t\t\treport_service(\"dns\", \"udp\", 53, row[2])\n\t\t\t\t\t\tframework.db.report_note({\n\t\t\t\t\t\t\t\t:host => row[2],\n\t\t\t\t\t\t\t\t:port => 53,\n\t\t\t\t\t\t\t\t:proto => \"udp\",\n\t\t\t\t\t\t\t\t:type => \"dns.info\",\n\t\t\t\t\t\t\t\t:data => \"NS #{row[1]}\"\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\twhen /MX/\n\t\t\t\t\t\treport_host(row[2])\n\t\t\t\t\t\treport_service(\"smtp\", \"tcp\", 25, row[2])\n\t\t\t\t\t\tframework.db.report_note({\n\t\t\t\t\t\t\t\t:host => row[2],\n\t\t\t\t\t\t\t\t:port => 25,\n\t\t\t\t\t\t\t\t:proto => \"tcp\",\n\t\t\t\t\t\t\t\t:type => \"dns.info\",\n\t\t\t\t\t\t\t\t:data => \"MX #{row[1]}\"\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\twhen /SRV/\n\t\t\t\t\t\tsrv_info = []\n\t\t\t\t\t\tsrv_info = row[1].strip.scan(/^_(\\S*)\\._(tcp|udp|tls)\\./)[0]\n\t\t\t\t\t\tport = row[4].strip.to_i\n\t\t\t\t\t\tif srv_info[1] == \"tls\"\n\t\t\t\t\t\t\tproto = \"tcp\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tproto = srv_info[1]\n\t\t\t\t\t\tend\n\t\t\t\t\t\treport_host(row[2])\n\t\t\t\t\t\treport_service(srv_info[0], proto, port, row[2])\n\t\t\t\t\t\tframework.db.report_note({\n\t\t\t\t\t\t\t\t:host => row[2],\n\t\t\t\t\t\t\t\t:port => port,\n\t\t\t\t\t\t\t\t:proto => proto,\n\t\t\t\t\t\t\t\t:type => \"dns.info\",\n\t\t\t\t\t\t\t\t:data => \"SRV #{row[3]}\"\n\t\t\t\t\t\t\t})\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "d8a6864df9bf3e4ab088e036aa4a9c7b",
"score": "0.5793514",
"text": "def validateCSV(path)\r\n\tcsv = CSV.read(path)\r\n\tcsv.each do |row|\r\n\t\tif(row.length != 3)\r\n\t\t\treturn false\r\n\t\tend\r\n\tend\r\n\treturn true\r\nend",
"title": ""
},
{
"docid": "afa579c3321099349638bfe09d1af975",
"score": "0.57869387",
"text": "def test_interview_csv\n user_csv = \"test_files/users.csv\" \n business_csv = \"test_files/businesses.csv\" \n\n filter = RecordFilter.new\n filter.create(user_csv, business_csv)\n filter.calc_stats()\n #filter.output\n \n ## Test Interview CSV Files\n if (filter.well_formed_rec_cnt == 11 && filter.malformed_rec_cnt == 5 &&\n filter.biz_rec_cnt == 3 && filter.user_rec_cnt == 6 && filter.total_rec_cnt == 16 &&\n filter.bad_user_records[0].malformed_message[0] == \"ERROR: INVALID BUSINESS NAME\" &&\n filter.bad_user_records[1].malformed_message[0] == \"ERROR: INVALID EMAIL\" &&\n filter.bad_user_records[2].malformed_message[0] == \"ERROR: COMPANY NAME DOESN'T EXIST\" &&\n filter.bad_business_records[0].malformed_message[0] == \"ERROR: INVALID NAME\" &&\n filter.bad_business_records[1].malformed_message[0] == \"ERROR: INVALID EMAIL\")\n @test_passed = @test_passed + 1\n else\n @test_failed = @test_failed + 1\n puts \"Interview Test Failed\"\n end\n end",
"title": ""
},
{
"docid": "d83b52a7e22f66ec9ed97f0939353ec1",
"score": "0.5769907",
"text": "def initialize(csv, original_filename, club)\n @creation_time=Time.now\n @original_filename=original_filename\n\n # Parse the header (an empty file will yield [])\n reader=CSV::Reader.create(csv)\n header_row=reader.shift\n\n # Build the column index hash\n columns={}\n header_row.each_with_index { |column, index|\n case column.strip\n when /^nachname$/i then columns[:last_name ]=index\n when /^vorname$/i then columns[:first_name ]=index\n when /^medical gültig bis$/i then columns[:medical_validity ]=index\n when /^medical prüfen$/i then columns[:check_medical_validity ]=index\n when /^bemerkungen$/i then columns[:comments ]=index\n when /^vereins-id$/i then columns[:club_id ]=index\n when /^vereins-id_alt$/i then columns[:old_club_id ]=index\n end\n }\n\n # Make sure that all required columns are present\n @missing_columns=[]\n @missing_columns << \"Nachname\" if !columns.has_key? :last_name\n @missing_columns << \"Vorname\" if !columns.has_key? :first_name\n return unless @missing_columns.empty?\n\n # Build the entry list\n @entries=[]\n reader.each { |row|\n next if row.empty? || row==[nil]\n\n # Empty values in the row are returned as nil by the CSV\n # parser. However, we want them to be \"\", so we can distinguish\n # them from values not specified at all. We also strip the\n # values at this point.\n row.map! { |value| (value || \"\").strip }\n\n # Columns which do not exist in the file will have a column\n # index of nil. We want the values from these columns to read\n # as nil. Columns not present in a row will also be nil.\n def row.[](index)\n return nil if index.nil?\n super(index)\n end\n\n entry=Entry.new\n # Values for non-existing (nil) columns yields nil (see the\n # monkey patch above).\n entry.last_name = row[columns[:last_name ]]\n entry.first_name = row[columns[:first_name ]]\n entry.medical_validity_text = row[columns[:medical_validity ]]\n begin\n entry.medical_validity = parse_date(entry.medical_validity_text)\n rescue ArgumentError\n entry.medical_validity = nil\n end\n entry.check_medical_validity_text = row[columns[:check_medical_validity ]]\n if entry.check_medical_validity_text.blank?\n entry.check_medical_validity = false\n else\n entry.check_medical_validity = entry.check_medical_validity_text.to_b # nil if not recognized\n end\n entry.comments = row[columns[:comments ]]\n entry.club_id = row[columns[:club_id ]]\n entry.old_club_id = row[columns[:old_club_id ]]\n entry.club=club\n\n @entries << entry\n }\n end",
"title": ""
},
{
"docid": "effc54ebffac58975f1dcac63eaee083",
"score": "0.5762178",
"text": "def compose( f )\n @rows = 0\n @flag = false\n @qdl_filespec = qdl_filespec= filename.gsub(\".csv\", \".txt\")\n\n qc = []\n dir = get_options.directory\n\n # Open the output file\n fout = File.open( @qdl_filespec, 'w' )\n \n # Read and handle each row of the file\n CSV.foreach( f ) do |row| \n\n @rows = @rows + 1\n\n # Comments, show if -v then next row if comment or blank\n # Join items in row to make reading it easier\n # Skip blank or comment row\n next if row.empty?\n puts row[0] if row[0].include?('#') and get_options[:verbose]\n next if row[0].include?('#')\n\n puts row.to_s if get_options[:verbose]\n # strip out double quote characters \n row.each do |r|\n r.to_Qdl unless r.nil?\n end\n\n # capture the Quandl code and skip line\n if row[0].is_a? String and row[0].include? \"Quandl:\"\n #@qc << row[1] \n @qc ||= row[1] \n next\n end\n \n # Safety Precaution: make sure Dataset exists\n @existsDS = createDS unless @existsDS\n\n # HDR row (MASK)\n # turn on flag if a string and value of first word is 'Date'\n # Remove nil elements in row using .compact!\n # Then compose the output line as '|' columns\n if row[0].is_a? String and row[0] == \"Date\"\n @flag = !@flag\n set_selection_list row\n row.compact!\n fout.puts [\"Quandl Code\", \"Date\", row[1..row.count]].join('|')\n next\n end\n\n # skip line until either 'Quandl:' or 'Date'\n unless @flag\n next\n end\n\n # this is data so construct the Quandl structured row and put in fl\n begin\n dt = row[0].gsub('/','-')\n rescue\n puts \"Invalid date: #{dt}; skipped row.\"\n next\n end\n \n # construct output row as array joined with '|'\n # we have Date, nil, nil, PMT, ... TCE, nil, ... nil, nil...\n # we want 0,3,9\n # to get Date|PMT|TCE\n\n @line = []\n @selection.each_with_index { |i| @line << row[i] }\n fout.puts [@qc, @line].join(\"|\")\n\n end #CSV\n fout.close\n\n end",
"title": ""
},
{
"docid": "6656b89dd9ac08658eaacf48545a1f34",
"score": "0.5733981",
"text": "def importCSV(retail_plan, file)\r\n\r\n # Using Dynamic usage_charge_types get from ChargeFactory.charge_types.\r\n # Downside is may loss concrete_charge from real invoice csv file, if the charge name of csv cant be found in retail plan\r\n @usage_charge_types = ChargeFactory.charge_types\r\n\r\n self.file = file.original_filename\r\n self.retail_plan_id = retail_plan.id\r\n meters = []\r\n perMeterFlag = true\r\n uom = nil\r\n CSV.foreach(file.path) do |content|\r\n self.start_date = content[1] if content[0]!= nil && content[0].downcase == \"start date\" \r\n self.end_date = content[1] if content[0]!= nil && content[0].downcase == \"end date\" \r\n self.distribution_loss_factor = content[1].to_f/100 if content[0]!= nil && content[0].downcase == \"distribution loss factor\"\r\n self.marginal_loss_factor = content[1].to_f/100 if content[0]!= nil && content[0].downcase == \"marginal loss factor\"\r\n uom = content[1] if !content.blank? && content[0]!= nil && content[0].downcase == \"unit of measurement\" && !content[1].blank?\r\n meters.push(content[1]) if content[0]!= nil && content[0].downcase == \"meter identifier\"\r\n perMeterFlag = false if content[0]!= nil && content[0].downcase == \"maximum demand\"\r\n self.total = content[3] if content[0] == nil && content[1] == nil && content[2] == nil && content[3]!=nil\r\n \r\n if(!content.blank? && content[0]!=nil && content[0].downcase.in?(@usage_charge_types))\r\n charge_factory = retail_plan.charge_factories.where(\"lower(name) = ?\", content[0].downcase).take\r\n invoice_rate = nil\r\n\r\n #call import_concrete_charge in charge_factory to import concrete charges\r\n concrete_charge = charge_factory.import_concrete_charge self, content[3]\r\n if content[2]!=nil\r\n invoice_rate = content[2] if content[0] == \"SREC Charge\" || content[0] == \"LRET Charge\" || content[0] == \"ESC Charge\"\r\n if !invoice_rate.nil? && !invoice_rate.index('%').nil? \r\n invoice_rate = invoice_rate.to_f/100\r\n end\r\n end\r\n if perMeterFlag\r\n concrete_charge.store_attributes content[0], meters.last, content[2], content[3], uom, content[1], nil, invoice_rate\r\n elsif content[0] == \"Supply Charge\"\r\n concrete_charge.store_attributes content[0], meters, content[2], content[3], uom, nil, nil, invoice_rate, content[1]\r\n else\r\n concrete_charge.store_attributes content[0], meters, content[2], content[3], uom, content[1], nil, invoice_rate\r\n end\r\n end\r\n end\r\n \r\n return self\r\n end",
"title": ""
},
{
"docid": "223be79e41e3de48781b0d4e1e4bf30f",
"score": "0.5727374",
"text": "def download\n \n #columns for csv are:\n #0 - section ref\n #1 - subsection ref \n #2 - clausetype_id \n #3 - clause \n #4 - subclause \n #5 - clausetitle text \n #6 - clauseline \n #7 - txt1 text \n #8 - txt2 text\n #9 - txt3 text \n #10 - txt4 text \n #11 - txt5 text \n #12 - txt6 text\n #13 - linetype \n \n speclines = Specline.joins(:clause => [:clauseref]).where('project_id = ? AND clauserefs.subsection_id = ?', params[:project_id], params[:subsection_id]).order('clauserefs.clausetype_id, clauserefs.clause, clauserefs.subclause, clause_line') \n \n #load CSV\n require 'csv'\n \n \n filename =\"#{specline.clause.clauseref.subsection.section.ref << specline.clause.clauseref.subsection.ref}_template_#{Date.today.strftime('%d%b%y')}\"\n csv_data = FasterCSV.generate do |csv|\n \n #set headers\n csv << ['section', 'subsection', 'clausetype', 'clause', 'subclause', 'clausetitle', 'clauseline', 'txt1', 'txt2', 'txt3', 'txt4', 'txt5', 'txt6', 'linetype_id']\n \n speclines.each do |specline| \n \n line=[]\n\n #include full reference for each line\n line[0] = specline.clause.clauseref.subsection.section.ref\n line[1] = specline.clause.clauseref.subsection.ref\n line[2] = specline.clause.clauseref.clausetype_id\n line[3] = specline.clause.clauseref.clause\n line[4] = specline.clause.clauseref.subclause\n line[6] = specline.clauseline\n \n #only include text where it exists\n if [1,2].include?(specline.linetype)\n line[5] = specline.clause.clausetitle.text\n else\n if specline.txt1 != 1\n line[7] = specline.txt1.text\n end\n if specline.txt2 != 1\n line[8] = specline.txt2.text\n end\n if specline.txt3 != 1\n line[9] = specline.txt3.text\n end\n if specline.txt4 != 1\n line[10] = specline.txt4.text\n end\n if specline.txt5 != 1\n line[11] = specline.txt5.text\n end\n if specline.txt6 != 1\n line[12] = specline.txt6.text\n end \n end\n \n line[13] = specline.linetype\n \n csv << line \n end \n end\n \n send_data csv_data,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :disposition => \"attachment; filename=#{filename}.csv\"\n \n end",
"title": ""
},
{
"docid": "98f32253d236565568ad415592c0d15c",
"score": "0.57240987",
"text": "def validate_csv\n mycsv = CSV.new(@csv, headers: true).read\n raise 'Invalid CSV - wrong headers' unless \\\n ['Title', 'URL', 'Example search'].all? \\\n { |header| mycsv.headers.include? header }\n end",
"title": ""
},
{
"docid": "99f0ad0becf0c9cc73f9ef5a07a00d0d",
"score": "0.5712151",
"text": "def check_csv_availability\n uri = URI('https://www.cvs.com/immunizations/covid-19-vaccine.vaccine-status.WA.json?vaccineinfo')\n\n # Create client\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n # Create Request\n req = Net::HTTP::Get.new(uri)\n # Add headers\n req.add_field \"User-Agent\", \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Firefox/87.0\"\n # Add headers\n req.add_field \"Accept\", \"*/*\"\n # Add headers\n req.add_field \"Accept-Language\", \"en-US,en;q=0.5\"\n # Add headers\n req.add_field \"Accept-Encoding\", \"gzip\"\n # Add headers\n req.add_field \"Referer\", \"https://www.cvs.com/immunizations/covid-19-vaccine?icid=cvs-home-hero1-banner-1-link2-coronavirus-vaccine\"\n # Add headers\n req.add_field \"Connection\", \"keep-alive\"\n # Add headers\n req.add_field \"Cookie\", \"QuantumMetricSessionLink=https://cvs.quantummetric.com/#/users/search?autoreplay=true&qmsessioncookie=f9bed6a1b4a9b6a1b0900cea99380544&ts=1617531607-1617618007; pe=p1; akavpau_vp_www_cvs_com_vaccine=1617575354~id=338a08b41c27635676064f7192f62501; bm_sz=9DB9CEEB07A70017445822C765D5EA10~YAAQbY0duIp4HXJ4AQAAAfr3ngvzvbbk2zdOcySKX8auJYyKVyuAokPPpdJ/RQv5sDbLS+5wgyVlq4SXIVxBA3bRk14mMUDHSSYnbjgpcJQzPvcq4CLLLnBg8OpoWrpSG8CeFarYL3e0vw1sYQh1z6kY9eBJCPm1Cgzm1u5/j/h4DeSdDHhzr7ZxaHU=; _abck=17C5282FCB5A069BFD5DC1FFF669402D~0~YAAQbY0duCZ5HXJ4AQAAEL74ngUYH6MDYi2DpnherHxSbMgQA9jcJS9getZsfI8zxo9/XyxogSgRA5PHj2q/Ix5Nas079Pyjd5lAyFVGuAu5hG/2UUuM/lHv3z7brf4bJvhFn1KUenX6VNqFaqmJ+N6L/6LFLJWkvGptjmKkq/NV7Lfep4aZLxlYsV6c4tb98R0q1YnUYIjkMgGcLO855Bf2Sh2BkldkYS9dqBUp6UJ4gn+jREjC0xzuRgLIHhP8YH3meqkE0x+j/t75h+DQX/wTDKutQHeG5GSRd42gNa3dLOpPqNklyJRrdfoxHuVOo1rGbtzc/+FhMvAtL+OlIhrXxW/Cr4ERy2WpC6RYodQrpnPbVvzNH0/r4emzFaVtrFuEEoU16ewz9sYAvP/XSgu7JjyK2w==~-1~-1~-1; acctdel_v1=on; adh_new_ps=on; adh_ps_pickup=on; adh_ps_refill=on; buynow=off; sab_displayads=on; dashboard_v1=off; db-show-allrx=on; disable-app-dynamics=on; disable-sac=on; dpp_cdc=off; dpp_drug_dir=off; dpp_sft=off; getcust_elastic=on; echomeln6=on; enable_imz=on; enable_imz_cvd=on; enable_imz_reschedule_instore=on; enable_imz_reschedule_clinic=off; flipp2=on; gbi_cvs_coupons=true; ice-phr-offer=off; v3redirecton=false; mc_cloud_service=on; mc_hl7=on; mc_home_new=on; mc_ui_ssr=off-p0; mc_videovisit=on; memberlite=on; pauth_v1=on; pivotal_forgot_password=off-p0; pivotal_sso=off-p0; pbmplaceorder=off; pbmrxhistory=on; ps=on; refill_chkbox_remove=off-p0; rxdanshownba=off; rxdfixie=on; rxd_bnr=on; rxd_dot_bnr=on; rxdpromo=on; rxduan=on; rxlite=on; rxlitelob=off; rxm=on; rxm_phone_dob=on; rxm_demo_hide_LN=off; rxm_phdob_hide_LN=on; rxm_rx_challenge=off; s2c_akamaidigitizecoupon=on; s2c_beautyclub=off-p0; s2c_digitizecoupon=on; s2c_dmenrollment=off-p0; s2c_herotimer=off-p0; s2c_newcard=off-p0; s2c_papercoupon=on; s2c_persistEcCookie=on; s2c_rewardstrackerbctile=on; s2c_rewardstrackerbctenpercent=on; s2c_rewardstrackerqebtile=on; s2c_smsenrollment=on; s2cHero_lean6=on; sft_mfr_new=on; sftg=on; show_exception_status=on; v2-dash-redirection=on; ak_bmsc=FB4CFEC5B1A1E14C317BF9167E37B36FB81D8D6DA55B0000623B6A60B0CBF668~plidsSJJJ7GN7WF5FZqcosTf3uG6Rz9CRO/tNpZ9+D0CRreJn63NJebWsMM5fgd1rt7wEe/04SVVnCkeETJumq/xm9JRlFTQGspHhZPOgKcIbpuRTeW1ZCKpdkcGzMBB5Zopp1gdjQymseqYPrJxT9k+ujKdh1OGkMqx2ULD3MYguAqts60ht6TtFQmMwTQWPihRvJy1/GmnALo1cRGyrwN21BCGgO6ryEv+px42NOojc=; akavpau_vp_www_cvs_com_vaccine_covid19=1617575354~id=338a08b41c27635676064f7192f62501; akavpau_www_cvs_com_general=1617575225~id=246ebd0497b0844c5e7216e4662c95d5; utag_main=v_id:01789ef7fbd7008066309b26bf4000052004100f00b78$_sn:1$_ss:0$_pn:2%3Bexp-session$_st:1617576644856$ses_id:1617574755287%3Bexp-session$vapi_domain:cvs.com; AMCV_06660D1556E030D17F000101%40AdobeOrg=-330454231%7CMCIDTS%7C18722%7CMCMID%7C85814830259861187162681185144282307413%7CMCAAMLH-1618179556%7C9%7CMCAAMB-1618179556%7C6G1ynYcLPuiQxYZrsz_pkqfLG9yMXBpb2zX5dvJdYQJzPXImdj0y%7CMCOPTOUT-1617581956s%7CNONE%7CMCAID%7CNONE%7CMCSYNCSOP%7C411-18729%7CvVersion%7C3.1.2; bm_sv=86992FBF99645ED952CC7EDB9342F70D~mQGKGygD+u+AH+KUWcvhYTNrv0ipQn/8CsftnWWwcCofLaMN3falzWr3oe2FpZaiplDtNn5jDn0venT7ZRQmBSrMbeukZUhCP/CS0cMJQHMvJ8R1twUsP/TkjXcBwb+f0vo389Y/3Lhr1duca5L/wA==; mt.v=2.1345809911.1617574755556; mt.sc=%7B%22i%22%3A1617574755816%2C%22d%22%3A%5B%5D%7D; DG_IID=4FBD168B-8513-3597-845D-775B5F93A559; DG_UID=61350DF3-15F8-3462-8456-E7FC44ED34F4; DG_ZID=21625240-7EC4-3707-BD0D-0F813032AB8C; DG_ZUID=BCABC9F2-4DC2-352E-B107-4563EDA3FCB3; DG_HID=1B3F759E-3C41-3FA0-826D-ABA1D2CE90D0; DG_SID=174.21.8.11:sLtBQsU4aUy1g91uILSWFEXb0mKlPqu1Cni5v3JFcyE; _4c_mc_=272c0175-6f7a-46de-8405-3c99339d1653; RT=\\\"z=1&dm=cvs.com&si=fcbd1dbc-8b52-4643-9db5-9a7c59db153c&ss=kn3q8sq9&sl=7&tt=29t&bcn=%2F%2F173e2514.akstat.io%2F&ld=153s&nu=y37ejeaq&cl=1xk2\\\"; AMCVS_06660D1556E030D17F000101%40AdobeOrg=1; QuantumMetricSessionID=f9bed6a1b4a9b6a1b0900cea99380544; QuantumMetricUserID=c895516e4c8116fe855701dd999e9a0e; gpv_p10=www.cvs.com%2Fimmunizations%2Fcovid-19-vaccine; s_cc=true; gpv_e5=cvs%7Cdweb%7Cimmunizations%7Ccovid-19-vaccine%7Cpromo%3A%20covid-19%20vaccines%20in%20washington%20modal; s_sq=%5B%5BB%5D%5D; mt.cem=210307-Rx-Immunization-COVIDvax_1405672 - B-Iteration/-new-tab; mt.mbsh=%7B%22fs%22%3A1617574789124%2C%22sf%22%3A1%2C%22lf%22%3A1617574789124%7D; qmexp=1617576644819; _group1=quantum; CVPF=CT-USR; gbi_sessionId=ckn3q9xbx00002a9b2dwzql75; gbi_visitorId=ckn3q9xbx00012a9ba531f29f; _gcl_au=1.1.1300913512.1617574808\"\n # Add headers\n req.add_field \"Pragma\", \"no-cache\"\n # Add headers\n req.add_field \"Cache-Control\", \"no-cache\"\n # Add headers\n req.add_field \"Te\", \"Trailers\"\n\n # Fetch Request\n res = http.request(req)\n JSON.parse(res.body)\nrescue StandardError => e\n puts \"HTTP Request failed (#{e.message})\"\nend",
"title": ""
},
{
"docid": "42b60c8390d99c4e8750be8ce3f54a2d",
"score": "0.5694618",
"text": "def setupDemandListFromFile_csv(_file)\n raise \"not implemented yet.\"\n end",
"title": ""
},
{
"docid": "cdecbaac9f89f20d97f587d1ef5a32fa",
"score": "0.56719464",
"text": "def load_csv\n line_num = 1\t\t# Count all lines. Assume header on first line\n FasterCSV.foreach(@era_year_csv, FCSV_OPTS) {|line|\n line_num += 1\n next if line.to_s.chomp.empty?\n\n MANDATORY_CSV_IN_FIELDS.each{|field|\n unless line[field]\n STDERR.printf \"ERROR: Mandatory field '%s' is empty in file '%s' in line:\\n\", field.to_s, @era_year_csv\n STDERR.printf \"[Line %d] %s\\n\", line_num, line.to_s.chomp\n exit 3\n end\n }\n if @collections.has_key?(line[:item_hdl])\n STDERR.printf \"ERROR: Item-handle '%s' has been repeated in file '%s'\\n\", line[:item_hdl], @era_year_csv\n exit 4\n end\n @collections[ line[:item_hdl] ] = [ line[:col_owner_hdl] ]\t# Mandatory owning collection\n if line[:col_others_hdl]\t\t\t\t\t# Optional other collections\n line[:col_others_hdl].split(VALUE_DELIMITER).each{|col_hdl|\n @collections[ line[:item_hdl] ] << col_hdl\n }\n end\n }\n verify_collections\n end",
"title": ""
},
{
"docid": "03582bffdf30eec38532874dc2d5e0ca",
"score": "0.56680924",
"text": "def assert_course_entry(line_number, line, constraints)\n # Extract data fields from tab-separated CSV\n data = line.split(\"\\t\")\n # Check the entry against the file header\n return assert_course_header(data) if line_number == 1\n # Check the entry's file operation\n assert_course_entry_operation(data, constraints)\n # Check the course code details\n assert_course_entry_code(data, constraints)\n end",
"title": ""
},
{
"docid": "c815040c30b84946886c7dfd95d78a67",
"score": "0.56673",
"text": "def preprocess_tables(work_dir, dataset)\n suffix = dataset # Either SF1 or Rural/Urban Update (RU) \n # Hoping that the ACS has same data dictionary\n zcta_logrecno = []\n\n # Filter the usgeo2010 file to make life easier and should result in 44,410 records\n go_file = File.join work_dir, \"usgeo2010.csv\"\n FileUtils.rm(go_file)\n go = File.open go_file, \"w\"\n \n gi_file = File.join work_dir, \"usgeo2010.#{dataset}\"\n gi = File.open(gi_file,\"r\") \n raise \"#{gi_file} not found or empty\" unless File.size(gi)\n\n while line = gi.gets do \n next if line[8,3] != SUMLEV # SF1 data dictionary - SUMLEV = 880 for zcta data\n go.puts line\n thisRecno = line[18,7]\n zcta_logrecno << thisRecno # record all the matched records\n end\n \n puts \"#{zcta_logrecno.length} ZCTA records found\"\n rec_min = zcta_logrecno.min\n rec_max = zcta_logrecno.max\n puts \"records between #{rec_min} and #{rec_max}\"\n\n (1..47).each do |i| \n fo = File.join work_dir, \"/us000%02d2010.cs1\" % i\n fcsv = File.open(work_dir + \"/us000%02d2010.csv\" % i,\"w\")\n fi = work_dir + \"/us000%02d\" % i + \"2010.#{dataset}\" \n\n next if File.size?( fi )\n puts \"Filtering file #{fi}\"\n\n `/usr/bin/awk \\'/#{rec_min}/, /#{rec_max}/\\' #{fi} > #{fo}`\n\n # Filter for exact LOGRECNO match only\n\n # csv_array = CSV.read(fo) # read whole file into memory\n # csv_array.each do |inrow|\n # thisRecno = inrow[4] # Make sure this is a string\n\n # if zcta_logrecno.include?(thisRecno) # Really slow, faster to import and join in SQL\n # fcsv.puts inrow.join(',')\n # end\n end\nend",
"title": ""
},
{
"docid": "5d265fcda2b13951322cf4ae020e0dea",
"score": "0.56626236",
"text": "def read_or_fetch_csv\n if @file_text.nil?\n filename = PerDistrict.new.try_sftp_filename('FILENAME_FOR_ED_PLAN_ACCOMMODATIONS_IMPORT')\n return nil if filename.nil?\n @file_text = download_csv_file_text(filename)\n end\n StreamingCsvTransformer.from_text(@log, @file_text)\n end",
"title": ""
},
{
"docid": "cf5493e4a269bc1992e45e7f34b44a8c",
"score": "0.56497705",
"text": "def validate_csv_file(csv_data, selected_company)\n error_arr, save_data = [], []\n line_num = 1\n CSV.foreach(csv_data.path, headers: true) do |row|\n if row[HEADER_EMPLOYEE_NAME].blank? || row[HEADER_EMAIL].blank? || row[HEADER_PHONE].blank?\n error_arr << \"Employee Name can't be blank in line number #{line_num}\" if row[HEADER_EMPLOYEE_NAME].blank?\n error_arr << \"Email can't be blank in line number #{line_num}\" if row[HEADER_EMAIL].blank?\n error_arr << \"Phone number can't be blank in line number #{line_num}\" if row[HEADER_PHONE].blank?\n line_num += 1\n else\n company_policies = row[HEADER_ASSIGNED_POLICIES].split('|')\n save_data << ({name: row[HEADER_EMPLOYEE_NAME], email: row[HEADER_EMAIL], phone: row[HEADER_PHONE], company_id: selected_company, policy_ids: company_policies})\n line_num += 1\n end\n end\n error_arr << 'Data in file is not present' if line_num == 1\n\n return [save_data, error_arr]\n end",
"title": ""
},
{
"docid": "8288fe13753fd4231156a50548e7dc54",
"score": "0.5645916",
"text": "def test_filer_csv_utf8\n path = File.join(fixtures_dir, 'tp_review_sandbox-assignment.csv')\n assert(filer = Typingpool::Filer::CSV.new(path))\n assert(data = filer.read)\n assert_instance_of(Array, data)\n assert_instance_of(Hash, data.first)\n in_temp_dir do |dir|\n path = File.join(dir, 'filer-temp')\n assert(filer2 = Typingpool::Filer::CSV.new(path))\n assert_equal([], filer2.read)\n assert(filer2.write(data))\n assert_equal(Typingpool::Filer.new(filer.path).read, Typingpool::Filer.new(filer2.path).read)\n refute_empty(assignments = filer2.read)\n assert(assignment = assignments.pop)\n assert(assignment['transcript'] = File.read(File.join(fixtures_dir, 'utf8_transcript.txt'), :encoding => 'UTF-8'))\n assignments.push(assignment)\n assert(filer2.write(assignments)) \n refute_empty(filer2.read) #will throw ArgumentError: invalid byte sequence in US-ASCII in degenerate case\n end #in_temp_dir\n end",
"title": ""
},
{
"docid": "7aaf9318ec67798b1bd958c195c25a41",
"score": "0.5633229",
"text": "def get_invalid_csv_invalid_item_description\n return get_csv_file('invalid_csv_invalid_item_description.csv')\n end",
"title": ""
},
{
"docid": "e75d9aabab0fe992c01181ba33b0d4bf",
"score": "0.5605987",
"text": "def fai_lpublishers()\n#Lpublisher.deleteall\t\n \nmieiDati=\"Editori2018-CSVUTF8virgole.csv\"\n\n conta = 1 \n File.new(mieiDati, \"r\").each_line{|line|\n rr=line.chop\n questoRecord = rr.split(';',4)\n creaRecordInDb(questoRecord, true)\n conta += 1\n #exit if conta > MAX_CONTA\n }\n puts \"Dati da file: #{mieiDati}. Records trattati: #{conta-1}.\"\n \nend",
"title": ""
},
{
"docid": "0329f8907ee6c97d733148988b722234",
"score": "0.56050694",
"text": "def validate_csv_headers\n provided = @importer.schema.provided_headers\n\n @importer.commits.map do |commit|\n SubsetFieldValidator.call(\n provided, commit.keys,\n message: \"contains fields which aren't present in the data\"\n )\n end.compact\n end",
"title": ""
},
{
"docid": "3d2728bb48b28ec337a22d26983d6554",
"score": "0.56029034",
"text": "def is_csv?\n self.data_file_name.match(\"(\\.csv)$\")\n end",
"title": ""
},
{
"docid": "5d77ef4591fe655f6e54a8040048e8a6",
"score": "0.5602802",
"text": "def import_csv\n step_names = [\n _('Import_CDR'),\n _('File_upload'),\n _('Column_assignment'),\n _('Column_confirmation'),\n _('Select_details'),\n _('Analysis'),\n _('Fix_clis'),\n _('Create_clis'),\n _('Assign_clis'),\n _('Import_CDR')\n ]\n\n @step = params[:step].try(:to_i) || 0\n @step = 0 if @step > step_names.size || @step < 0\n\n import_csv_page_title(@step, step_names[@step])\n @sep, @dec = Application.nice_action_session_csv(params, session, correct_owner_id)\n\n catch (:done) do\n step = @step\n import_csv_0 if step == 0\n import_csv_1 if step == 1\n import_csv_2 if step == 2\n if step > 2\n check_if_file_in_db\n check_if_filename_in_session\n import_csv_3 if step == 3\n if step > 3\n check_existence_of_calldate_and_billsec\n import_csv_4 if step == 4\n import_csv_5 if step == 5\n import_csv_6 if step == 6\n import_csv_7 if step == 7\n import_csv_8 if step == 8\n import_csv_9 if step == 9\n end\n end\n end\n end",
"title": ""
},
{
"docid": "5b3505186d4624b5f63ed7c26ae83cd2",
"score": "0.5580403",
"text": "def export_as_chicago_citation_txt\n not_implemented('CMOS citation')\n end",
"title": ""
},
{
"docid": "9e8b41bbcd937d001787de9d3cc26c59",
"score": "0.5565364",
"text": "def get_invalid_csv_invalid_merchant_name\n return get_csv_file('invalid_csv_invalid_merchant_name.csv')\n end",
"title": ""
},
{
"docid": "bd3b9a5cdfb8b3055a75785d867252de",
"score": "0.5556233",
"text": "def save_csv_data (a)\n rAddress2 = a[3] ? \"ES\" : nil\n \n #EAGF DIRECT PAYMENTS\n if (a[4] && a[4] > 0)\n amount = a[4]\n scheme = \"ES1\"\n data = [a[1..2],rAddress2,nil,a[3],scheme,amount,nil].flatten!\n $output_file.puts CSV::generate_line(data,:encoding => 'utf-8')\n $id += 1\n end\n #EAGF OTHER PAYMENTS\n if a[5] && a[5] > 0\n amount = a[5]\n scheme = \"ES2\"\n data = [a[1..2],rAddress2,nil,a[3],scheme,amount,nil].flatten!\n $output_file.puts CSV::generate_line(data,:encoding => 'utf-8')\n $id += 1\n end\n #EAFRD PAYMENTS\n if a[6] && a[6] > 0\n amount = a[6]\n scheme = \"ES3\"\n data = [a[1..2],rAddress2,nil,a[3],scheme,amount,nil].flatten!\n $output_file.puts CSV::generate_line(data,:encoding => 'utf-8')\n $id += 1\n end\nend",
"title": ""
},
{
"docid": "e1baad0f8ee19243e0050ce5e964cb2e",
"score": "0.5553481",
"text": "def csvArgError\n\tstring = <<-EOS\n--------------------------------------------------------------------\nBEL2CSV converter\n\nUsage: bel2csv.rb -<args> <files>\n--------------------------------------------------------------------\nCommand-line arguments:\nb: Treat input file as BEL document, use sequentially incremented\n number as BEL ID.\nt: Treat input file as tabulated (CSV), use BEL ID from CSV.\na: Only in combination with t: Do not include sentence ID and PMID \n as passage infons.\nh: Only in combination with t: Don't treat first row as header.\nn: Map entity symbol or ID (field `value`) to unique internal \n BEL identifier (field `BID`). Note: Equivalence files must be \n placed in /equivalence_files and registered in \n `equivalence_files.json`.\nd: Set the CSV field delimiter to `\\\\0` (default is `\"`). Prevents \n double quoting of fields containing double quotes and doesn't \n insert escaping double quotes for the contained double quotes. \n Note: This is not compliant with the RFC 4180 CSV specification.\nk: Don't split pre-terminal abundance functions and entities into relation\n and annotation, represent as single annotation instead.\n--------------------------------------------------------------------\n\tEOS\n\tputs string\n\tabort\nend",
"title": ""
},
{
"docid": "09d922b78683a9fc073ac763e352d770",
"score": "0.55462956",
"text": "def test_file_oneliner\n cfc = CsvFileCleaner(\"oneliner.csv\",\"testoutput.csv\")\n cfc.clean\n assert_equal \"oneliner.csv\",\"testoutput.csv\"\n assert_csv_equal \"oneliner.csv\",\"testoutput.csv\"\n end",
"title": ""
},
{
"docid": "44171de3acf53856ec9c7ed81d9717d3",
"score": "0.5546097",
"text": "def check_csv_columns\n return true unless csv_rows\n\n keys = csv_rows.first.to_h.keys\n excess = keys - permitted_params_for_primary_table.map(&:to_sym)\n if excess.present?\n errors.add 'some columns', 'in the CSV file do not match the table columns. ' \\\n \"Unexpected columns in the CSV file are: #{excess.join(', ')}\"\n return false\n end\n true\n end",
"title": ""
},
{
"docid": "4d1bd0230b19632b32bfcdd2f19986da",
"score": "0.554296",
"text": "def skip_csv_line?(csv_line)\n csv_line[:for_code].length == 2\t# Skip 2 digit FOR codes\n #false\t\t\t\t# Uncomment this line to process all CSV lines\n end",
"title": ""
},
{
"docid": "8e4b3f69d06e6381085f69c796d5c747",
"score": "0.55168116",
"text": "def get_invalid_csv_invalid_merchant_address\n return get_csv_file('invalid_csv_invalid_merchant_address.csv')\n end",
"title": ""
},
{
"docid": "00cc57c95e2910235590a5a71c021160",
"score": "0.550559",
"text": "def csv_tool headers, data\n CSV.open('csvexperimentfile.csv', 'wb') do |csv|\n csv << headers\n\n data.each do |column|\n csv << column\n end\n end\nend",
"title": ""
},
{
"docid": "b9327a0a1de68d5104bfb54918bd968a",
"score": "0.5503964",
"text": "def test_csv\n parser = Dataset::Parser.new(:input => @@text11)\n # assert parser.clean?\n assert_equal(Extractor::CSVExtractor, parser.extractor.class)\n assert_equal(Dataset::Chron::YYYY, parser.chron)\n assert_equal(1, parser.measure_columns.size)\n assert_equal(Dataset::Units::Discrete, parser.columns[1].role.units)\n # assert_equal(3, parser.records.size)\n # series = parser.make_series\n # assert_equal(1, series.size)\n # assert_equal(3, series[0].data.size)\n # assert_equal(Dataset::Units::Discrete, series[0].measure.units)\n\n p2 = Dataset::Parser.new(:input => @@text20)\n assert_equal(Extractor::CSVExtractor, p2.extractor.class)\n\n end",
"title": ""
},
{
"docid": "9134979466d7e80fe7115003a0c81954",
"score": "0.5497985",
"text": "def check_headers(csv_data)\n\n result1=result2=true\n file_headers=csv_data[0].keys.reject(&:blank?).collect(&:downcase)\n #The file doesn't need to have all the metadata values, it just can't have headers that aren't used for metadata or registration\n if file_headers.include?('date') && file_headers.include?('year') # can't have both date and year\n puts \"has both year and date columns\"\n result1=false\n end\n if file_headers.include?('location') && file_headers.include?('state') && file_headers.include?('city') && file_headers.include?('country') # can't have both location and the specific fields\n puts \"has location column as well as specific state,city,country columns\"\n result2=false\n end\n extra_columns = file_headers-get_manifest_section(METADATA).values-get_manifest_section(REGISTER).values-get_manifest_section(OPTIONAL).values\n has_extra_columns = (extra_columns == [])\n puts \"has unknown columns: #{extra_columns.join(', ')}\" unless has_extra_columns\n result3 = has_extra_columns\n\n return (result1 && result2 && result3)\n\n end",
"title": ""
},
{
"docid": "4f910f420f8708b763dbba6d0d1241bd",
"score": "0.5490258",
"text": "def import\n total = 0\n c = 0\n error = ''\n \n # Error handling for wrong filetype\n if File.extname(@file.path) != '.csv' \n error = 'Wrong filetype'\n return [error]\n end\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n first_name = row['First Name']\n last_name = row['Last Name']\n company = row['Company']\n title = row['Job Title']\n street = row['Business Street']\n city = row['Business City']\n state = row['Business State']\n zipcode = row['Business Postal Code']\n country = row['Business Country/Region']\n phone = row['Business Phone']\n mobile_phone = row['Mobile Phone']\n email = row['E-mail Address']\n alt_email = row['E-mail 2 Address']\n blog = row['Web Page']\n notes = row['Notes']\n *leftover = *row.to_hash.values\n \n # leftover array contains all remaining columns of the document, if you need additional values inserted, just address them like shown below \n value1, value2, _ = *leftover\n\n # FFCRM uses Alpha2 codes for countries, try to match here:\n # Using https://github.com/hexorx/countries\n countryCode = ISO3166::Country.find_country_by_name(country)\n countryCode = countryCode.alpha2 if countryCode.present?\n countryCode = country if countryCode.blank?\n\n # Check for duplicates based on first_name, last_name and email\n total += 1\n if Lead.where(first_name: first_name, last_name: last_name, email: email).present?\n c += 1\n\t next # Skip item if duplicate\n end\n\n lead = Lead.new(:title => title, :first_name => first_name, :last_name => last_name,\n :email => email, :blog => blog, :alt_email => alt_email, :company => company, :phone => phone, :mobile => mobile_phone)\n\n # Add Lead\n lead.first_name = \"FILL ME\" if lead.first_name.blank?\n lead.last_name = \"FILL ME\" if lead.last_name.blank?\n lead.access = \"Public\"\n lead.status = \"new\"\n lead.assignee = @assigned if @assigned.present?\n lead.campaign_id = @campaign if @campaign.present?\n lead.save!\n\n # Add Business address to Lead\n address = Address.new(:street1 => street, :city => city, :zipcode => zipcode, :country => countryCode, :addressable_id => lead.id)\n address.addressable_type = 'Lead'\n address.address_type = 'Business'\n address.save!\n\n # Add Comments to Lead\n if notes\n notes = Comment.new(:comment => notes, :user_id => lead.assigned_to, :commentable_id => lead.id)\n notes.commentable_type = 'Lead'\n notes.save!\n end\n \n end\n FileUtils.rm(@file.path)\n [error, total, c]\n end",
"title": ""
},
{
"docid": "54c4cdddd2b0998331e01f285e098502",
"score": "0.5481529",
"text": "def get_invalid_csv_invalid_purchase_count\n return get_csv_file('invalid_csv_invalid_purchase_count.csv')\n end",
"title": ""
},
{
"docid": "b7b750fb8649d91122ec3d8a72a25d95",
"score": "0.54813606",
"text": "def prepare_pre_import\n\n csv = CSV.read(File.open(@csv_file))\n\n @cn_curve = CnCurve.batch_find_or_initialize_by(@batch.id, {\n date: CsvUtility.read_cell(csv, 'M', 4),\n label: CsvUtility.read_cell(csv, 'J', 7)\n })\n unless @cn_curve.can_overwrite @batch.id, @overwrite_batch_id\n raise Gemdata::NoPermissionToOverwrite, \"No permission to override CnCurve from a different batch: #{@cn_curve.to_json}\"\n end\n\n (1..8).each do |n|\n row = n + 10\n @cn_curve.send(\"c_enr_#{n}=\", CsvUtility.read_cell(csv, 'N', row))\n @cn_curve.send(\"n_enr_#{n}=\", CsvUtility.read_cell(csv, 'O', row))\n @cn_curve.send(\"c_percent_#{n}=\", CsvUtility.read_cell(csv, 'P', row))\n @cn_curve.send(\"n_percent_#{n}=\", CsvUtility.read_cell(csv, 'Q', row))\n @cn_curve.send(\"cn_ratio_#{n}=\", CsvUtility.read_cell(csv, 'R', row))\n end\n\n @cn_curve.save!\n\n end",
"title": ""
},
{
"docid": "7e5f4444178f7e467674044c40f5166c",
"score": "0.5476054",
"text": "def write_to_csv (time, platform, browser_name, browser_version, build, counter, num_cases, delay, duration, rate, test_name)\n googledrive_path=\"Google Drive/CODAP @ Concord/Software Development/QA\"\n localdrive_path=\"Documents/CODAP data/\"\n\n if !File.exist?(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\") || $new_file\n CSV.open(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\", \"wb\") do |csv|\n csv<<[\"Time\", \"Platform\", \"Browser\", \"Browser Version\", \"CODAP directory\", \"CODAP Build Num\", \"Test Name\", \"Counter\", \"Num of Cases\", \"Delay (s)\", \"Time Result (ms)\", \"Rate (cases/sec)\"]\n csv << [time, platform, browser_name, browser_version, build, $buildno, test_name, counter, num_cases, delay, duration, rate]\n end\n else\n CSV.open(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\", \"a\") do |csv|\n csv << [time, platform, browser_name, browser_version, build, $buildno, test_name, counter, num_cases, delay, duration, rate]\n end\n end\nend",
"title": ""
},
{
"docid": "7e5f4444178f7e467674044c40f5166c",
"score": "0.5476054",
"text": "def write_to_csv (time, platform, browser_name, browser_version, build, counter, num_cases, delay, duration, rate, test_name)\n googledrive_path=\"Google Drive/CODAP @ Concord/Software Development/QA\"\n localdrive_path=\"Documents/CODAP data/\"\n\n if !File.exist?(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\") || $new_file\n CSV.open(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\", \"wb\") do |csv|\n csv<<[\"Time\", \"Platform\", \"Browser\", \"Browser Version\", \"CODAP directory\", \"CODAP Build Num\", \"Test Name\", \"Counter\", \"Num of Cases\", \"Delay (s)\", \"Time Result (ms)\", \"Rate (cases/sec)\"]\n csv << [time, platform, browser_name, browser_version, build, $buildno, test_name, counter, num_cases, delay, duration, rate]\n end\n else\n CSV.open(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\", \"a\") do |csv|\n csv << [time, platform, browser_name, browser_version, build, $buildno, test_name, counter, num_cases, delay, duration, rate]\n end\n end\nend",
"title": ""
},
{
"docid": "f790c3b21148b95a612bec3e9fb4d4a2",
"score": "0.54748863",
"text": "def import_ffck_from_csv(csv_file, separator = \";\")\n users = {}\n\n header = nil\n File.open(csv_file).each_line do |line|\n if header\n\n # extract data from csv\n data = line.strip.split(separator)\n d = {}\n header.size.times do |i|\n k = header[i]\n v = data[i]\n if v\n d[k] = \"\" unless d[k]\n d[k] += v\n end\n end\n\n # prepare new data\n m = {}\n m[\"uid\"] = d[\"PRENOM\"].downcase + \".\" + d[\"NOM\"].downcase.gsub(\" \",\"-\")\n m[\"gn\"] = d[\"PRENOM\"].capitalize\n m[\"sn\"] = d[\"NOM\"].capitalize\n m[\"cn\"] = m[\"gn\"] + \" \" + m[\"sn\"]\n m[\"displayName\"] = m[\"cn\"]\n m[\"ffckNumber\"] = d[\"CODE ADHERENT\"]\n m[\"birthDate\"] = d[\"NE LE\"].split(\"/\").reverse.join(\"-\")\n m[\"gender\"] = d[\"SEXE\"] == \"H\" ? \"M\" : \"F\"\n m[\"street\"] = d[\"ADRESSE\"].capitalize\n m[\"postalCode\"] = d[\"CODE POSTAL\"]\n m[\"l\"] = d[\"VILLE\"].capitalize\n m[\"homePhone\"] = d[\"TEL\"].gsub(\".\",\"\") unless d[\"TEL\"].blank?\n m[\"telephoneNumber\"] = d[\"AUTRE TEL\"].gsub(\".\",\"\") unless d[\"AUTRE TEL\"].blank?\n m[\"mobile\"] = []\n m[\"mobile\"] << d[\"MOBILE\"].gsub(\".\",\"\") unless d[\"MOBILE\"].blank?\n m[\"mobile\"] << d[\"AUTRE MOBILE\"].gsub(\".\",\"\") unless d[\"AUTRE MOBILE\"].blank?\n m[\"fax\"] = []\n m[\"fax\"] << d[\"FAX\"].gsub(\".\",\"\") unless d[\"FAX\"].blank?\n m[\"fax\"] << d[\"AUTRE FAX\"].gsub(\".\",\"\") unless d[\"AUTRE FAX\"].blank?\n m[\"mail\"] = []\n m[\"mail\"] << d[\"EMAIL\"] unless d[\"EMAIL\"].blank?\n m[\"mail\"] << d[\"AUTRE EMAIL\"] unless d[\"AUTRE EMAIL\"].blank?\n m[\"ffckNumberYear\"] = d[\"DERNIERE LICENCE\"]\n m[\"ffckNumberDate\"] = \"20\" + d[\"PRISE LE\"].split(\"/\").reverse.join(\"-\")\n infos = Hash[ d[\"INFORMATION\"].split(\"&\").map{|s| s.split(\"=\", 2)} ] rescue {}\n m[\"medicalCertificateDate\"] = infos[\"DATECERTIFCK\"].split(\"/\").reverse.join(\"-\") unless infos[\"DATECERTIFCK\"].blank?\n m[\"medicalCertificateDate\"] = infos[\"DATECERTIFAPS\"].split(\"/\").reverse.join(\"-\") unless infos[\"DATECERTIFAPS\"].blank?\n m[\"medicalCertificateType\"] = \"Loisirs\" if infos[\"CERTIFAPS\"] == \"O\"\n m[\"medicalCertificateType\"] = \"Compétition\" if infos[\"CERTIFCK\"] == \"O\"\n m[\"status\"] = \"active\"\n m[\"ffckClubNumber\"] = \"9404\"\n m[\"ffckClubName\"] = \"Joinville Eau Vive\"\n\n # prepare user\n if users[ m[\"uid\"] ].nil?\n u = User.find( m[\"uid\"] ) rescue User.new\n %w(uid gn sn cn displayName ffckNumber birthDate gender street postalCode l \\\n homePhone telephoneNumber mobile fax mail ffckNumberYear ffckNumberDate \\\n medicalCertificateDate medicalCertificateType status \\\n ffckClubNumber ffckClubName).each do |k|\n unless u[k]\n u[k] = m[k] unless m[k].blank?\n end\n end\n u[\"ffckCategory\"] = u.calculate_ffck_category unless u[\"ffckCategory\"]\n u.save!\n users[ u[\"uid\"] ] = u\n end\n\n else\n header = line.strip.split(separator)\n end\n end\n users\nend",
"title": ""
},
{
"docid": "562f7f72d45cfeb1b4817c28a7c962dd",
"score": "0.546376",
"text": "def csv_test_file_name\n\t\t\"tmp/birth_datum_update_test_file.csv\"\n\tend",
"title": ""
},
{
"docid": "ab0551a703948be5015bb78e82a762cc",
"score": "0.5463163",
"text": "def test_basic_96_plate_file_csv_defaults\n input_file = File.join(@test_data_dir, 'map_two_plates.csv')\n # default arguments\n args = [ ]\n\n # Redirect the output to a string\n output = `#{@script} #{args.join(' ')} #{input_file} 2> #{@error_file}`\n\n assert_equal 0, File.size(@error_file)\n\n lines = Array.new\n output.each_line do |line|\n line.chomp!\n lines << line\n end\n assert_equal 192, lines.length\n assert_equal '1,A,1,1A1', lines[0]\n assert_equal '1,A,2,1A2', lines[1]\n assert_equal '2,H,11,95', lines[-2]\n assert_equal '2,H,12,96', lines[-1]\n \n File.delete(@error_file) if File.exists?(@error_file)\n end",
"title": ""
},
{
"docid": "0f27f6d204a26bcc6c0141a197653994",
"score": "0.54601926",
"text": "def test_nil_rows_and_lines_csv\r\n\t # x_123\r\n\t if CSV\r\n\t\t oo = Roo::CSV.new(File.join(TESTDIR,'Bibelbund.csv'))\r\n\t\t oo.default_sheet = oo.sheets.first\r\n\t\t assert_equal 1, oo.first_row\r\n\t end\r\n end",
"title": ""
},
{
"docid": "3338dac5bdc647e41f4f8beffe17bca6",
"score": "0.5452184",
"text": "def export_to_csv(type, projects)\n date = Time.now.strftime(\"%Y-%m-%d\")\n csv_file_path = \"#{type}_projects_#{date}.csv\"\n FileUtils.touch(csv_file_path) unless File.exist?(csv_file_path)\n\n# CSV table header with info about the resulting CDT/DTP projects to be exported into a CSV file.\n csv_headers = [\"title\",\n \"funder\",\n \"type\",\n # \"grant_category\", # do not need it as all grants are of type \"Training Grant\"\n \"start\",\n \"end\",\n \"award_in_pounds\",\n \"lead_org\",\n \"lead_org_dept\",\n \"lead_org_address\",\n \"lead_org_postcode\",\n \"lead_org_region\",\n \"grant_holder_firstname\",\n \"grant_holder_othernames\",\n \"grant_holder_surname\",\n \"gtr_project_reference\",\n \"gtr_url\"]\n\n begin\n CSV.open(csv_file_path, 'w',\n :write_headers => true,\n :headers => csv_headers #< column headers\n ) do |csv|\n projects.each do |project_reference, project_details|\n csv << [project_details[\"title\"],\n project_details[\"funder\"],\n project_details[\"type\"],\n # project_details[\"grant_category\"],\n project_details[\"start\"],\n project_details[\"end\"],\n project_details[\"award_in_pounds\"],\n project_details[\"lead_org\"],\n project_details[\"lead_org_dept\"],\n project_details[\"lead_org_address\"],\n project_details[\"lead_org_postcode\"],\n project_details[\"lead_org_region\"],\n project_details[\"grant_holder_firstname\"],\n project_details[\"grant_holder_othernames\"],\n project_details[\"grant_holder_surname\"],\n project_reference,\n project_details[\"gtr_url\"]]\n end\n end\n puts \"\\n\" + \"#\" * 80 +\"\\n\\n\"\n puts \"Finished writing the #{type} project data into #{csv_file_path}.\"\n puts \"Wrote a total of \" + projects.length.to_s + \" #{type} projects.\"\n rescue Exception => ex\n puts \"\\n\" + \"#\" * 80 +\"\\n\\n\"\n puts \"Failed to get export the #{type} project data into #{csv_file_path}. An error of type #{ex.class} occurred, the reason being: #{ex.message}.\"\n end\nend",
"title": ""
},
{
"docid": "d872e64d4c8dab759bff903b2fd99bb6",
"score": "0.54474676",
"text": "def valid_file_required\n check_if_citation_changed\n # Don't allow access if we don't have a valid file:\n if !session[:valid_upload_file]\n redirect_to(action: \"display_csv_file\")\n return\n end\n end",
"title": ""
},
{
"docid": "750ec9167948eb3292a025dd4e314932",
"score": "0.54472077",
"text": "def importar_registros(csv_doc, campos, usuario_id, institucion, enlace)\n\n linea = 0\n\n WorkerLog.log(\"Leyendo CSV...\")\n\n #barremos lineas de documento\n csv_doc.each do |row|\n linea += 1\n WorkerLog.log(\"Importando Linea #{linea}\")\n\n unless importar_solicitud(row, campos, usuario_id, institucion, enlace)\n WorkerLog.error(\"Error al importar linea #{linea}\")\n break\n end\n\n end #csv_doc.each\n csv_doc.close\n\n end",
"title": ""
},
{
"docid": "9c72ef88471be5d3a53259c1667f433b",
"score": "0.54463285",
"text": "def check_datafile_ok filename\n datafile = File.open(filename, \"r\")\n @new_variables =[]\n\n #first check mime type\n#TODO This will not work on windows since it depends on the unix tool file need to use a different way. Possible begin/rescue it so that\n#failure does not matter\n mimetype = `file --mime -br #{datafile.path}`.gsub(/\\n/,\"\").split(';')[0]\n #TODO not sure if this is really an exhaustive check, should get possible mimes from a list\n if mimetype.index(\"text\") == nil && mimetype.index(\"csv\") == nil && mimetype.index(\"office\") == nil && mimetype.index(\"excel\") == nil\n#TODO This will not work on windows since it depends on the unix tool file need to use a different way. Possible begin/rescue it so that\n#failure does not matter\n possible_mimetype = `file --mime -br #{datafile.path}`\n @datafile_error = \"MethodBox cannot process this file. Is it really a tab, csv or excel file? Checking the mime type revealed this: \" + possible_mimetype\n return false\n end\n \n header = datafile.readline\n #split by tab\n\n if params[:dataset_format] == \"Tab Separated\"\n headers = header.split(\"\\t\")\n separator = \"\\t\"\n else\n headers = header.split(\",\")\n separator = \",\"\n end\n \n #check that there are no empty headers\n headers.collect!{|item| item.strip}\n headers.each do |header|\n if (header.match('([A-Za-z0-9]+)') == nil)\n datafile.close\n @datafile_error = \"There are column headers with empty names or invalid characters\"\n return false\n end\n end\n \n if headers.uniq! == nil\n datafile.close\n return true\n else\n datafile.close\n @datafile_error = \"There are duplicate column headers. Each column header must occur only once.\"\n return false\n end\n \n end",
"title": ""
},
{
"docid": "36655739e3b252113642f55fba3782cb",
"score": "0.54439694",
"text": "def setup\n\t @path = File.expand_path(File.dirname(__FILE__) + \"/../test\")\n @path = @path + \"/\"\n \n # For 1-Dimensional State tables\n\t @valid_csv_files_1d=[@path + TEST1_CSV,@path + TEST4_CSV,@path + TEST10_CSV,@path + TEST9_CSV]\n\t puts @valid_csv_files_1d\n\t @valid_csv_files_states_1d=[2,5,5,5]\n\t @valid_csv_files_transitions_1d=[2,4,4,8]\n\t \n\t # For 2-Dimensional State tables\n\t @valid_csv_files_2d=[@path + TEST1_2d_CSV,@path + TEST4_2d_CSV,@path + TEST10_2d_CSV,@path + TEST9_2d_CSV]\n\t puts @valid_csv_files_2d\n\t @valid_csv_files_states_2d=[2,5,5,5]\n\t @valid_csv_files_transitions_2d=[2,4,4,8]\n\t \n\t # For 1 and 2 Dimensional State tables\n\t @valid_csv_files=@valid_csv_files_1d + @valid_csv_files_2d\n\t puts @valid_csv_files\n\t @valid_csv_files_states=[2,5,5,5,2,5,5,5]\n\t @valid_csv_files_transitions=[2,4,4,8,2,4,4,8]\n\t \n\tend",
"title": ""
},
{
"docid": "b88a482ba3080a4888d933a40effc3e9",
"score": "0.5440208",
"text": "def csv_cap_to_sql\n begin \n if File.exist?(\"report/csv/#{@user}/capture.cap\")\n f = File.open(\"report/csv/#{@user}/capture.cap\",mode=\"r\")\n begin\n while line = f.readline\n lm = line.match /(\\d+\\.\\d+\\.\\d+\\.\\d+);(.+);(\\d+\\.\\d+\\.\\d+\\.\\d+);(.+);(.+)/\n begin\n #@db.execute(\"INSERT INTO capture (ip_source,port_source,ip_dest,port_dest,data)values ( '#{lm[1]}' , '#{lm[2]}' , '#{lm[3]}' , '#{lm[4]}','#{lm[5]}' )\") if lm != nil\n if lm != nil \n ip_source = Base64.encode64(@cipher.cipher(\"#{lm[1]}\"))\n port_source = Base64.encode64(@cipher.cipher(\"#{lm[2]}\"))\n ip_dest = Base64.encode64(@cipher.cipher(\"#{lm[3]}\"))\n port_dest = Base64.encode64(@cipher.cipher(\"#{lm[4]}\"))\n data = Base64.encode64(@cipher.cipher(\"#{lm[5]}\")) \n @db.execute(\"INSERT INTO capture (ip_source,port_source,ip_dest,port_dest,data)values ( '#{ip_source}' , '#{port_source}' , '#{ip_dest}' , '#{port_dest}','#{data}' )\") \n end\n rescue Exception => e\n p \"sql_reader_writer : csv_cap_to_sql #{e}\"\n raise \"error csv cap to sql\"\n end\n end\n rescue EOFError\n File.delete(\"report/csv/#{@user}/capture.cap\")\n printf \"\\nDone storing cap file\\n\"\n \n end\n else\n p \"FILE report/csv/#{@user}/capture.cap nao existe\"\n return false\n end\n return true\n ensure\n if f != nil\n f.close\n end\n\n end\n File.delete(\"report/csv/#{@user}/capture.cap\")\n printf \"\\nDone storing cap file\"\n end",
"title": ""
},
{
"docid": "cf414f17a47b5874581d9185825135f9",
"score": "0.5439648",
"text": "def test_files\n #Test is Crimes and Census CSV FIles are in the folder\n assert( File.exist?(\"crimes.csv\"))\n assert( File.exist?(\"census.csv\")) \n #Test if the code is reading all the lines within a file\n assert_equal( 203, Reader.new.crimes_reader('crimes.csv').length )\n assert_equal( 78, Reader.new.census_reader('census.csv').length)\n end",
"title": ""
},
{
"docid": "121ac0bd7514e3c44a9496e3e61ea350",
"score": "0.543879",
"text": "def process_csv_file(file)\n settings = load_yaml\n model_name = export.model\n all_rows = []\n FasterCSV.foreach(file) do |row|\n all_rows << row.join(',')\n end\n\n header_row = all_rows.first.split(',')\n core_columns = header_row.select{ |row| row.split('|').second.to_s.downcase.tr(' ', '_').camelize.to_s == model_name.to_s }\n associated_columns = header_row - core_columns\n associated_columns=Import.strip_star(associated_columns)\n injected_columns = header_row.select{ |row| row.split('|').second.to_s == \"inject\" }\n associated_columns = associated_columns - injected_columns\n \n [core_columns, associated_columns, injected_columns]\n end",
"title": ""
},
{
"docid": "7d346997c8b6fbee02aef2c3e8b4d8e4",
"score": "0.5426274",
"text": "def valida_version_IUCN(archivo)\n csv_path = Rails.root.join('public', 'IUCN', archivo)\n bitacora.puts 'Nombre científico en IUCN,Categoría en IUCN,Subpoblación,Nombre en CAT,IdCAT,Estatus nombre,IdCAT válido,Nombre válido CAT,mensaje,observación RelNombreCatalogo'\n return unless File.exists? csv_path\n\n CSV.foreach(csv_path, :headers => true) do |r|\n self.row = r\n self.datos = [row['scientificName'], row['redlistCategory'], row['subpopulationName'], nil, nil, nil, nil, nil, nil] # Se inicializa la respuesta vacia\n\n v = Validacion.new\n\n if row['subpopulationName'].present? # Quita la zona del nombre cientifico ... bien IUCN\n v.nombre_cientifico = row['scientificName'].gsub(row['subpopulationName'], '')\n else\n v.nombre_cientifico = row['scientificName']\n end\n\n v.nombre_cientifico = v.nombre_cientifico.gsub('ssp.', 'subsp.')\n v.encuentra_por_nombre\n\n self.validacion = v.validacion\n self.datos[8] = validacion[:msg]\n\n if validacion[:estatus]\n valida_extras # Solo un resultado y al menos fue coincidencia\n else\n if validacion[:taxones].present? # Mas de un resultado\n if datos[8] == 'Existe más de una búsqueda exacta'\n cuantos_encontro = 0\n\n validacion[:taxones].each do |taxon|\n validacion[:taxon] = taxon\n if valida_extras # Encontro el verdadero de entre las coincidencias\n self.datos[8] = 'Búsqueda exacta'\n cuantos_encontro+= 1\n break\n end\n end # End each taxones\n\n sin_coincidencias if cuantos_encontro == 0\n\n else # Si es busqueda similar con multiples coincidencias\n cuantos_encontro = []\n\n validacion[:taxones].each do |taxon| # Descartando los que no son de la categoria o del phylum/division\n validacion[:taxon] = taxon\n next unless misma_categoria?\n next unless mismo_phylum?\n\n cuantos_encontro << taxon\n end # End each taxones\n\n if cuantos_encontro.length == 0\n sin_coincidencias\n elsif cuantos_encontro.length == 1 \n sin_coincidencias\n validacion[:taxon] = cuantos_encontro.first\n self.datos[8] = 'Búsqueda similar'\n valida_extras\n else\n sin_coincidencias\n self.datos[8] = \"Existe más de una búsqueda similar: #{validacion[:taxones].map{ |t| t.scat.catalogo_id }.join('|')}\"\n end\n\n end # End si existe mas de una busqueda exacta con multiples coincidencias\n\n end\n end\n\n bitacora.puts datos.join(',')\n end\n\n bitacora.close\n end",
"title": ""
},
{
"docid": "b76118260d6ad7baefbaccd6645c450b",
"score": "0.5424422",
"text": "def read_other_csvs(directory_name)\n Import.find_all_by_directory_name(directory_name).each do |import| \n if !import.file_name.eql?(METADATA_FILE) \n update_status(import, :in_progress)\n unique_id = import.file_name.split(\".csv\")[0]\n location = Location.find_by_unique_id(unique_id)\n if location.present?\n delete_query = \"DELETE FROM location_data where location_id = #{location.id}\"\n ActiveRecord::Base.connection.execute(delete_query)\n\n CSV.foreach(%(#{directory_name}/#{import.file_name})) do |row|\n date_time = (row[1].to_i * 60) + 1388534400\n Datum.create(:location_id => location.id, :date_time => date_time, :instantaneous_power => row[1])\n update_status(import, :success)\n end\n else\n update_status(import, :failed, \"Location with unique_id #{unique_id} not found\")\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b7adba6ee9ad368f9af9f5fa8fd4b1b6",
"score": "0.5411921",
"text": "def prepare_importing\n @csv_file = prepare_csv_file\n @errors.merge!(columns: 'Failed reading csv') if @csv_file.nil?\n abort_when_error\n end",
"title": ""
},
{
"docid": "dde3ab77d18def5ad6a6e99c3aa3b60f",
"score": "0.54094255",
"text": "def get_invalid_csv_invalid_item_price\n return get_csv_file('invalid_csv_invalid_item_price.csv')\n end",
"title": ""
},
{
"docid": "9251d3458da2ab0d8f19693d7e1fc683",
"score": "0.54082644",
"text": "def process\n return false unless is_valid?\n # Adjustment to support different file formats\n (2..parsed_data.last_row).each do |i|\n row = Hash[[get_headers, parsed_data.row(i)].transpose]\n category = ImportCategory.new(name: row['category']).save\n supplier = ImportSupplier.new(supplier_uid: row['supplier_id'], supplier_name: row['supplier_name']).save\n product = ImportProduct.new(product_uid: row['product_id'], product_title: row['product_title'], price: row['price'], is_active: row['is_active'], category_id: category.id).save\n ProductSupplier.create!(product_id: product.id, supplier_id: supplier.id)\n true\n end\n # CSV.foreach(path, headers: true, encoding:'iso-8859-1:utf-8') do |row|\n # category = ImportCategory.new(name: row['category']).save\n # supplier = ImportSupplier.new(supplier_uid: row['supplier_id'], supplier_name: row['supplier_name']).save\n # product = ImportProduct.new(product_uid: row['product_id'], product_title: row['product_title'], price: row['price'], is_active: row['is_active'], category_id: category.id).save\n # ProductSupplier.create!(product_id: product.id, supplier_id: supplier.id)\n # true\n # end\n rescue CSV::MalformedCSVError => e\n errors[:message] = 'Malformed CSV (' + e.message+ ')'\n false\n rescue Errno::ENOENT => e\n errors[:message] = 'Cannot find the file at the given path (' + e.message + ')'\n false\n rescue ArgumentError => e\n errors[:message] = 'has incorrect encoding. It should be UTF-8 (' + e.message+ ')'\n false\n rescue => e\n errors[:message] = e.message\n puts \"Error raised: #{e.message}\"\n false\n end",
"title": ""
},
{
"docid": "aec2d7049743814ae6c33814ae75037e",
"score": "0.540065",
"text": "def export_as_apa_citation_txt\n not_implemented('APA citation')\n end",
"title": ""
},
{
"docid": "6e2c18ec1c3f5b684e5c1b6d3445efa1",
"score": "0.5400499",
"text": "def create_csv_for_LLR(csv_data)\r\n \r\n csv_string = CSV.open(\"#{$basefile}LLR.csv\", \"wb\") do |csv|\r\n\r\n csv << csv_data.first.keys\r\n csv_data.each do |hash|\r\n csv << hash.values\r\n end\r\n end\r\nend",
"title": ""
},
{
"docid": "f60a13179d9e457b871439a7e7ee352c",
"score": "0.5397432",
"text": "def loan_audit_data\n load_csv_data './features/files/AuditLoanData.csv'\nend",
"title": ""
},
{
"docid": "91b318c460024230c16be37772ebf851",
"score": "0.5394918",
"text": "def consolidate_csv_validations\n attributes = [:csv_file_name, :csv_content_type]\n \n attributes.detect do |name|\n err = errors[name].to_s\n errors.add(:csv, err) unless err.blank?\n end\n \n end",
"title": ""
},
{
"docid": "b6e88ac296721c5ad2420473349626b8",
"score": "0.5394195",
"text": "def write_iif_file_for_renewmax_item_output letter_number\n counter = 0\n CSV.open(\"./output/renewmax_item_output_#{letter_number}.IIF\", \"w\", { col_sep: \"\\t\" }) do |output_csv|\n CSV.foreach(\"./source/price increase.IIF\", { col_sep: \"\\t\", headers: false }) do |csv|\n counter = counter + 1\n \n if counter <= IIF_HEADER_ROWS\n output_csv << csv\n \n elsif csv[1] =~ RENEWMAX_ITEM && letter_number == csv[1][0] && csv[1] !~ HDS_CUSTOMER\n puts \"#{csv[1]}\"\n output_csv << csv\n end\n \n end\n \n end\n\nend",
"title": ""
},
{
"docid": "315b9ea6dd95810bc0de68386fe582af",
"score": "0.53892624",
"text": "def csv_import\n #n = 0\n CSV.foreach(params[:dump][:file].tempfile,:col_sep => ';', :encoding => 'ISO-8859-1') do |row|\n c = SupportRequest.new( :ano => row[0],\n :mes => row[1],\n :processo_numero => row[2],\n :solicitacao_data => row[3],\n :solicitacao_hora => row[4],\n :solicitacao_descricao => row[5],\n :solicitacao_regional => row[6],\n :solicitacao_bairro => row[7],\n :solicitacao_localidade => row[8],\n :solicitacao_endereco => row[9],\n :solicitacao_roteiro => row[10],\n :rpa_codigo => row[11],\n :rpa_nome => row[12],\n :solicitacao_microrregiao => row[13],\n :solicitacao_plantao => row[14],\n :solicitacao_origem_chamado => row[15],\n :latitude => row[16],\n :longitude => row[17],\n :solicitacao_vitimas => row[18],\n :solicitacao_vitimas_fatais => row[19],\n :processo_tipo => row[20],\n :processo_origem => row[21],\n :processo_localizacao => row[22],\n :processo_status => row[23],\n :processo_data_conclusao => row[24])\n \n if row[5] != 'Teste' and row[5] != 'teste' and row[5] != 'TESTE' and row[5] != 'texte'\n c.save\n end\n end\n #redirect_to :action => \"index\" and return\n end",
"title": ""
},
{
"docid": "49e02c1a60be72cfd9a8e3860034afcd",
"score": "0.5383116",
"text": "def import_csv\n require 'csv'\n\n dynamic_header, dynamic_field = if params[:person][:product_id] == '1'\n ['Trường', 'school']\n elsif params[:person][:product_id] == '2'\n ['Mặt hàng', 'merchandise']\n end\n\n csv_selected_columns = [\n 'Họ và tên lót',\n 'Tên',\n 'SĐT',\n dynamic_header,\n 'CMND',\n 'Giới tính',\n 'Ngày sinh'\n ]\n\n db_columns_map = [\n 'last_name',\n 'first_name',\n 'phone',\n dynamic_field,\n 'nic_number',\n 'gender',\n 'birthday'\n ]\n\n person_records = []\n all_person_records_are_valid = true\n error_lines = []\n\n csv = CSV.read(params[:person][:file].path, headers: true)\n arr_nic = csv['CMND'].compact\n\n csv.each_with_index do |row, line|\n hash = {}\n\n row.headers.each_with_index do |header, idx|\n column_idx = csv_selected_columns.find_index(header)\n next unless column_idx\n hash[db_columns_map[column_idx]] = row[idx]\n end\n\n person = hash['nic_number'].present? ? Person.find_or_initialize_by(nic_number: hash['nic_number']) : Person.new\n person.assign_attributes(\n last_name: hash['last_name'],\n first_name: hash['first_name'],\n phone: hash['phone'],\n gender: gender(hash['gender']),\n birthday: hash['birthday'],\n product_id: params[:person][:product_id]\n )\n # Assign value for school or merchandise follow product_id\n person[dynamic_field] = hash[dynamic_field]\n person.owner = current_staff\n person.organization = current_staff.lowest_organization\n\n if person.validate && @service.nic_validate?(person.nic_number, person.product_id) && (person.nic_number.blank? || arr_nic.count(person.nic_number) == 1)\n person_records.push(person)\n else\n all_person_records_are_valid = false\n error_lines << line + 2\n end\n end\n [all_person_records_are_valid, error_lines, person_records]\n end",
"title": ""
},
{
"docid": "43bdb4a34f69ea3b97875cf829c9e598",
"score": "0.5380227",
"text": "def parser f\n # you need to parse them as contribs by date\n datapairs = []\n if File.exists? f\n CSV.foreach(f) do |row|\n if row.is_a? Array\n if row[2].to_f>0\n contrib = 1\n elsif row[2].to_f<=0\n contrib = -1\n end\n unless row[0].include? \"Date\"\n datapairs.push [row[0], contrib]\n end\n end\n end\n end\n # ==== data checked\n return datapairs\nend",
"title": ""
},
{
"docid": "d9817a0fa02837f00770aed620e148b4",
"score": "0.537997",
"text": "def write_to_csv (test_run, time, browser_name, num_trial, num_cases, duration)\n# googledrive_path=\"Google Drive/CODAP @ Concord/Software Development/QA\"\n# localdrive_path=\"Documents/CODAP data/\"\n\n if !File.exist?(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\") || $new_file\n CSV.open(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\", \"wb\") do |csv|\n csv<<[\"Test No.\", \"Time\", \"Browser\", \"Num of Trials\", \"Num of Cases\", \"Duration\"]\n csv << [test_run, time, browser_name, num_trial, num_cases, duration]\n end\n else\n CSV.open(\"#{Dir.home}/#{$dir_path}/#{$save_filename}\", \"a\") do |csv|\n csv << [test_run, time, browser_name, num_trial, num_cases, duration]\n end\n end\nend",
"title": ""
},
{
"docid": "ed6cd700ca4486d95507c0fe6c9a7ba0",
"score": "0.5371916",
"text": "def import_csv_files\n import_proxy = Canvas::SisImport.new\n if @users_csv_filename.blank? || import_proxy.import_users(@users_csv_filename)\n logger.warn 'User import succeeded'\n @term_to_memberships_csv_filename.each do |term_id, csv_filename|\n if csv_filename.present?\n if @batch_mode\n import_proxy.import_batch_term_enrollments(term_id, csv_filename)\n else\n import_proxy.import_all_term_enrollments(term_id, csv_filename)\n end\n end\n logger.warn \"Enrollment import for #{term_id} succeeded\"\n end\n end\n end",
"title": ""
},
{
"docid": "68b05de1dcea1de68267ba394c54e015",
"score": "0.5371603",
"text": "def process_dataset(dataset)\n dataset_file = dataset.uuid_filename\n csv_path = File.join(CSV_FILE_PATH, dataset_file)\n csv_file = File.open(csv_path, \"r\")\n \n #try and guess the encoding of the file so that the headers mean something\n begin\n cd = CharDet.detect(csv_file.readline)\n encoding = cd['encoding']\n rescue\n encoding=\"UTF-8\"\n ensure\n csv_file.close\n end\n if separator == \",\"\n sep = \",\"\n else\n sep =\"\\t\"\n end\n csv_file = File.open(csv_path, \"r:\" + encoding)\n faster_csv_file = FCSV.new(csv_file, :headers=>true, :return_headers=>true, :col_sep=>sep)\n header_line = faster_csv_file.shift\n all_headers = header_line.headers\n #header_line = csv_file.readline\n #header_line.chop!\n #all_headers = header_line.split(separator)\n \n did = dataset.id\n count = all_headers.size\n if count <= 100\n process_part_dataset(dataset, 0, count-1)\n else\n first_column = 0\n last_column = 99\n while first_column < count \n process_part_dataset(dataset, first_column, last_column)\n first_column = last_column + 1\n last_column = last_column + 100\n if last_column >= count\n last_column = count - 1\n end\n end \n end\n end",
"title": ""
},
{
"docid": "952e28fc3d87fcdc41e61f7ec0461edd",
"score": "0.5359609",
"text": "def import_csv_files\n import_proxy = Canvas::SisImport.new\n if @users_csv_filename.blank? || import_proxy.import_users(@users_csv_filename)\n logger.warn(\"User import succeeded\")\n @term_to_memberships_csv_filename.each do |term_id, csv_filename|\n if csv_filename.present?\n case @batch_or_incremental\n when 'batch'\n import_proxy.import_batch_term_enrollments(term_id, csv_filename)\n when 'incremental'\n import_proxy.import_all_term_enrollments(term_id, csv_filename)\n end\n end\n logger.warn(\"Enrollment import for #{term_id} succeeded\")\n end\n end\n end",
"title": ""
},
{
"docid": "952e28fc3d87fcdc41e61f7ec0461edd",
"score": "0.5359609",
"text": "def import_csv_files\n import_proxy = Canvas::SisImport.new\n if @users_csv_filename.blank? || import_proxy.import_users(@users_csv_filename)\n logger.warn(\"User import succeeded\")\n @term_to_memberships_csv_filename.each do |term_id, csv_filename|\n if csv_filename.present?\n case @batch_or_incremental\n when 'batch'\n import_proxy.import_batch_term_enrollments(term_id, csv_filename)\n when 'incremental'\n import_proxy.import_all_term_enrollments(term_id, csv_filename)\n end\n end\n logger.warn(\"Enrollment import for #{term_id} succeeded\")\n end\n end\n end",
"title": ""
},
{
"docid": "e079e48703b62af87b8f3450c1cdc990",
"score": "0.535392",
"text": "def csv_content\r\n if extension == \"csv\" or extension == \"txt\"\r\n delimiter = ','\r\n elsif extension == \"xls\"\r\n delimiter = \"\\t\"\r\n end\r\n if (operation_log_config.details[:sub_total] and operation_log_config.content_layout.downcase == \"by payer\")\r\n if check.batch.client.name.upcase == \"QUADAX\"\r\n csv_content_string = [batch_name,deposit_date,export_date,check_serial_number,aba_routing_number,payer_account_number,check_number,check_date,patient_account_number,page_no,check_amount,sub_total,eft_amount,payer_name,status,image_id,zip_file_name,reject_reason, onbase_name, correspondence, statement_number, harp_source,amount_835].flatten.compact.join(\"#{delimiter}\") + \"\\n\"\r\n else\r\n csv_content_string = [batch_name,deposit_date,export_date,check_serial_number,aba_routing_number,payer_account_number,check_number,check_date,patient_account_number,page_no,check_amount,sub_total,eft_amount,amount_835,payer_name,status,image_id,zip_file_name,reject_reason, onbase_name, correspondence, statement_number, harp_source].flatten.compact.join(\"#{delimiter}\") + \"\\n\"\r\n end\r\n else\r\n if check.batch.client.name.upcase == \"QUADAX\"\r\n csv_content_string = [batch_name,deposit_date,export_date,check_serial_number,aba_routing_number,payer_account_number,check_number,check_date,patient_account_number,page_no,check_amount,eft_amount,payer_name,status,image_id,zip_file_name,reject_reason, onbase_name, correspondence, statement_number, harp_source,amount_835].flatten.compact.join(\"#{delimiter}\") + \"\\n\"\r\n else\r\n csv_content_string = [batch_name,deposit_date,export_date,check_serial_number,aba_routing_number,payer_account_number,check_number,check_date,patient_account_number,page_no,check_amount,eft_amount,amount_835,payer_name,status,image_id,zip_file_name,reject_reason, onbase_name, correspondence, statement_number, harp_source].flatten.compact.join(\"#{delimiter}\") + \"\\n\"\r\n end\r\n end\r\n csv_content_string unless csv_content_string.blank?\r\n end",
"title": ""
},
{
"docid": "af6f91a317dd02834c89e2a94fe5c10b",
"score": "0.5349518",
"text": "def has_csv_content?\n true\n end",
"title": ""
},
{
"docid": "c070ca5d4f8984c7f31a76acf9092b89",
"score": "0.53411",
"text": "def test_invalid_file\r\n\t\tassert_raise(ArgumentError.new(\"It wasn't possible to read from invalid_file.csv file.\")) {IPOAlgorithm.new(3,[3,5,5],\"invalid_file.csv\")}\r\n\tend",
"title": ""
},
{
"docid": "d6deea85458dd17cfe3d1b390d35a628",
"score": "0.5339432",
"text": "def csv_bug_recoverer(bug_id)\n #Creates folder to store files.\n FileUtils.mkdir_p(@@csv_file_location) unless File.directory?(@@csv_file_location)\n \n issue_request = Typhoeus::Request.new(@@csv_url+bug_id.to_s) # make a new request\n \n #Use on_complete to handle http errors with Typhoeus\n issue_request.on_complete do |issue_resp|\n if issue_resp.success?\n parsedData = CSV.parse(issue_resp.body)\n if parsedData.size >= 3 #verify that the response contains rows\n @csv_bugs << parsedData[1]\n end\n else\n @errors << [bug_id,'csv',issue_resp.code]\n end\n end\n issue_request.run\n end",
"title": ""
},
{
"docid": "b778eab16662afd634196a29b454e550",
"score": "0.5338455",
"text": "def read_csv file_path\n csv = CSV.read file_path, headers: :first_row\n csv.headers == CSV_IMPORT_HEADER or raise \"CSV header mismatch\"\n csv.each do |row|\n translations.add :pl, row[0], row[3]\n translations.add :en, row[0], row[4]\n end\n end",
"title": ""
},
{
"docid": "8f33fc4464bbef61932107540ba0335b",
"score": "0.5337427",
"text": "def test_downloadCsvReport\n # Test method directly from the AdWords::Extensions module so that we can\n # use the optional parameter\n generated_csv =\n AdWords::Extensions.downloadCsvReport(nil, nil, File.read(\n File.join(CommonTestUtils::DATA_DIR, 'report_non_ascii.xml')))\n\n expected_csv = File.read(\n File.join(CommonTestUtils::DATA_DIR, 'report_non_ascii.csv'))\n\n # Check if the CSV matches the expected output\n assert_equal(expected_csv.strip, generated_csv.strip,\n 'Generated CSV does not match expected output')\n end",
"title": ""
},
{
"docid": "fa629f26863475176d3eaa23ebbd113a",
"score": "0.5330669",
"text": "def readEquivCSV(equivHash, ns, equiv_file)\n csvTable = CSV.read(\"equivalence_files/\" + equiv_file, {col_sep:\"|\", quote_char:\"\\0\", headers:true})\n map = false\n csvTable.each do |row|\n # Skip non-CSV header\n if !map and row[0] == \"[Values]\"\n map = true\n elsif map\n equivHash[ns][row[0]] = row[1]\n end\n end\nend",
"title": ""
},
{
"docid": "ee170be177d885f78ae0260ab662d366",
"score": "0.5329488",
"text": "def read_or_fetch_csv\n if @file_text.nil?\n filename = PerDistrict.new.try_sftp_filename('FILENAME_FOR_ED_PLAN_IMPORT')\n return nil if filename.nil?\n @file_text = download_csv_file_text(filename)\n end\n StreamingCsvTransformer.from_text(@log, @file_text)\n end",
"title": ""
},
{
"docid": "a82bff8b4871f02b70116b303d015939",
"score": "0.5322675",
"text": "def main\n ARGF.each_line do |line|\n row = CSV.parse_line line\n puts row[0] if row[0] =~ /[0-9]{18}/\n end\nend",
"title": ""
},
{
"docid": "9895e1e0b41ef34e6b09990ef99f089d",
"score": "0.53213763",
"text": "def toCSV(filename)\n\n puts \"toCSV: \" + filename;\n\n csv = \"\";\n ant = \"\";\n ant4hash = \"\";\n dt4hash = \"\";\n first = true;\n lines = `ssh atasys@sonata cat #{filename}*`\n fields = Hash.new();\n dt = \"\";\n rejects = 0;\n fieldHash = initFieldHash();\n lines.each_line do |line|\n \n if(line.start_with?(\"(\") && !line.include?(\"weather\"))\n parts = line.chomp.split(/\\s+/);\n if(parts.length != 7) then next; end\n tempAnt = parts[5][3..-1];\n if(first) \n first = false;\n ant = tempAnt;\n dt = toDatetime(\"#{parts[1]} \" + \"#{parts[2].chop}\\\"\");\n fieldHash['ts'] = dt;\n ant4hash = ant;\n dt4hash = dt;\n fieldHash['ant'] = ant;\n end\n if(ant != tempAnt)\n if(fields.length > 0) \n csvTemp = \"\";\n csvTemp += fieldHash['ts'].to_s + \",\";\n csvTemp += fieldHash['ant'].to_s + \",\";\n csvTemp += fieldHash['state'].to_s + \",\";\n csvTemp += fieldHash['DriveBoxTemp'].to_s + \",\";\n csvTemp += fieldHash['ControlBoxTemp'].to_s + \",\";\n csvTemp += fieldHash['PAXBoxTemp'].to_s + \",\";\n csvTemp += fieldHash['RimBoxTemp'].to_s + \",\";\n csvTemp += fieldHash['ADC01'].to_s + \",\";\n csvTemp += fieldHash['ADC02'].to_s + \",\";\n csvTemp += fieldHash['ADC03'].to_s + \",\";\n csvTemp += fieldHash['ADC04'].to_s + \",\";\n csvTemp += fieldHash['ADC07'].to_s + \",\";\n csvTemp += fieldHash['ADC08'].to_s + \",\";\n csvTemp += fieldHash['ADC09'].to_s + \",\";\n csvTemp += fieldHash['ADC10'].to_s + \",\";\n csvTemp += fieldHash['ADC11'].to_s + \",\";\n csvTemp += fieldHash['CryoRejTemp'].to_s + \",\";\n csvTemp += fieldHash['CryoTemp'].to_s + \",\";\n csvTemp += fieldHash['CryoPower'].to_s;\n csvTemp += \"\\n\";\n csv += csvTemp;\n fieldHash = initFieldHash();\n fields = Hash.new();\n end\n ant = tempAnt;\n dt = toDatetime(\"#{parts[1]} \" + \"#{parts[2].chop}\\\"\");\n ant4hash = ant;\n dt4hash = dt;\n fieldHash['ant'] = ant;\n fieldHash['ts'] = dt;\n if(fields[parts[6]] == nil && isUnique(ant4hash, dt4hash, parts[6]))\n fieldHash[parts[6]] = ('%.2f' % parts[3]);\n fields[parts[6]] = parts[6];\n else\n #puts \"REJECT: \" + ant + \",\" + dt + \",\" + parts[6];\n rejects = rejects + 1;\n end\n else\n if(fields[parts[6]] == nil && isUnique(ant4hash, dt4hash, parts[6]))\n fieldHash[parts[6]] = ('%.2f' % parts[3]);\n fields[parts[6]] = parts[6];\n end\n end\n \n end\n end\n\n puts \"Rejects = \" + rejects.to_s;\n puts \"Total unique fields \" + $uniqueHash.length.to_s;\n return csv;\n\nend",
"title": ""
},
{
"docid": "25c0d412569eb2495d6c3ef7484700e8",
"score": "0.5319986",
"text": "def csv_data_supplied\n errors.add(:csv_data, \"not supplied\") if csv_data.nil?\n end",
"title": ""
},
{
"docid": "25c0d412569eb2495d6c3ef7484700e8",
"score": "0.5319986",
"text": "def csv_data_supplied\n errors.add(:csv_data, \"not supplied\") if csv_data.nil?\n end",
"title": ""
},
{
"docid": "6f34b792ff7609d9b93f14f1ae3d8892",
"score": "0.53159636",
"text": "def create_csv_from_txt(txt_file_path)\n record_lines = []\n File.open(txt_file_path, \"r\") do |f|\n f.each_line do |line|\n details = []\n details << line.split(' ') unless line[0] == 'H'\n details.each do |record|\n record.delete_at(2)\n record[2] = 'F.MASSA' if record[2] == 'F.MASS'\n record[5].gsub!(/,/, '.')\n record_lines << record\n end\n end\n end\n csv_options = { col_sep: ',', force_quotes: true, quote_char: '\"' }\n CSV.open(\"./db/kart_log.csv\", \"wb\", csv_options) do |csv|\n csv << [\"Hora\", \"Codigo\", \"Piloto\", \"Nº Volta\", \"Tempo da Volta\", \"Velocidade média da volta\"]\n record_lines.each {|line| csv << line}\n end\n return \"./db/kart_log.csv\"\nend",
"title": ""
},
{
"docid": "60603a34436280ef9952443c17338e2e",
"score": "0.5315788",
"text": "def has_csv_content?\n false\n end",
"title": ""
},
{
"docid": "1831697ea027b6351f6d699ef78bc1ce",
"score": "0.5314241",
"text": "def assert_course_file(filename, constraints)\n lines = 0\n File.foreach(filename) do |line|\n lines += 1\n assert_course_entry(lines, line.chomp, constraints)\n end\n assert_course_file_properties(lines, constraints)\n end",
"title": ""
},
{
"docid": "11cae42f0bcbce269bf7dfca2e53b213",
"score": "0.52944136",
"text": "def import_courses\n \t\tActiveRecord::Base.transaction do\n\t \t\t(@dataset.first_column..@dataset.last_column).each do |column_index|\n\t\t\t\tcolumn_data = @dataset.column(column_index)\n\t\t\t\tcourse = Course.new(name: column_data[0], description: column_data[1])\n\t\t\t\tsubject = Subject.where(name: column_data[2]).first\n\t\t\t\tif subject\n\t\t\t\t\tfield = nil\n\t\t\t\t\tif column_data[3]\n\t\t\t\t\t\tfield = Field.where(name: column_data[3], subject: subject).first\n\t\t\t\t\t\tif !field\n\t\t\t\t\t\t\traise \"Error! Field '\" + column_data[3] + \"' was not found!\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tcourse.category = field ? field : subject\n\t\t\t\t\t(4..column_data.length).each do |row_index|\n\t\t\t\t\t\tif column_data[row_index]\n\t\t\t\t\t\t\tuser = User.where(email: column_data[row_index])\n\t\t\t\t\t\t\tif !user.empty?\n\t\t\t\t\t\t\t\tcourse.users.push(user)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\traise \"Error! User with e-mail '\" + column_data[row_index] + \"' was not found!\"\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tcourse.save\n\t\t\t\telse\n\t\t\t\t\traise \"Error! Subject '\" + column_data[2] + \"' was not found!\"\n\t\t\t\tend\n\t\t\tend\n\t\tend\n \tend",
"title": ""
},
{
"docid": "4ece3f8425632074a13cb94b1baf6735",
"score": "0.5291294",
"text": "def test_harder_file()\n \tresults = []\n\t data = '\n\t \tYear,Make,Model,Description,Price\n\t\t\t1997,Ford,E350,\"ac, abs, moon\",3000.00\n\t\t\t,,,,\n\t\t\t1999,Chevy,\"Venture \"\"Extended Edition\"\"\",\"\",4900.00\n\t\t\t1999,Chevy,\"Venture \"\"Extended Edition, Very Large\"\"\",,5000.00\n\t\t\t1996,Jeep,Grand Cherokee,\"MUST SELL!\n\t\t\tair, moon roof, loaded\",4799.00\n\t\t\t'\n\t\tf = CSVStream::Reader.new(:string => data)\n\t\tf.read_columns\n\t\tf.set_columns([:integer, :string, :string, :string, :float])\n\t\tbegin\n\t\t\twhile (r = f.row())\n\t\t\t\tresults << r\n\t\t\tend\n\t\trescue CSVStream::CSVStreamEOF => ex\n\t\tend\n\t\tassert results[1].values.all? {|v| v.is_a?(String) ? v == \"\" : v == 0}\n\t\t# Check column access\n\t\tassert_equal results[2][0], results[2][\"Year\"]\n\t\tassert_equal 4900.00, results[2][\"Price\"]\n\n\t\tassert_equal 0, f.stats.get(\"Bad Lines\")\n\t\tassert_equal 6, f.stats.get(\"Lines Processed\")\n\tend",
"title": ""
},
{
"docid": "954cf35024f15a5b561283db6d1a4b84",
"score": "0.5289957",
"text": "def csv_content(check)\n #variable to check the max 6 service line logic while making CSV\n counter = 0\n # String corresponding to one row in CSV\n csv = \"\"\n # Collecting parameter values for the input check object\n batch = check.job.batch\n batchid = batch.batchid\n batch_date = batch.date\n facility = check.job.batch.facility\n lockbox_number = facility.lockbox_number\n # The image type will be EOB in all cases\n image_types = \"EOB\"\n filename = \"\"\n images_for_jobs = check.job.images_for_jobs\n\n unless images_for_jobs.blank?\n filename = images_for_jobs.first.filename\n end\n payer = check.payer\n unless payer.blank?\n payer_name = payer.payer\n end\n\n micr_line_information = check.micr_line_information\n unless micr_line_information.blank?\n aba_routing_number = micr_line_information.aba_routing_number\n end\n check_number = check.check_number\n csv_string = \"\"\n # Querying data for claim and service line details\n csv_query = \"select ins.patient_account_number, ins.patient_first_name,ins.patient_middle_initial,ins.patient_last_name, svc.service_procedure_code, \"\n csv_query += \"svc.date_of_service_from, svc.service_procedure_charge_amount, svc.service_no_covered, ins.patient_identification_code,\"\n csv_query += \"svc.service_deductible, svc.service_co_insurance, svc.service_discount, svc.contractual_amount, svc.service_paid_amount, svc.denied,\"\n csv_query += \"svc.primary_payment, svc.service_co_insurance, svc.service_co_pay, svc.service_deductible, svc.noncovered_code, svc.denied_code, svc.discount_code, \"\n csv_query += \"svc.coinsurance_code, svc.deductuble_code, svc.copay_code, svc.primary_payment_code, svc.contractual_code from service_payment_eobs svc \"\n csv_query += \"inner join insurance_payment_eobs ins on svc.insurance_payment_eob_id = ins.id \"\n csv_query += \"inner join check_informations chk on ins.check_information_id = chk.id \"\n csv_query += \"where chk.id = #{check.id}\"\n csv_records = ServicePaymentEob.find_by_sql(csv_query)\n records_size = csv_records.size\n\n unless csv_records.blank?\n service_procedure_code = []\n date_of_service_from = []\n service_procedure_charge_amount = []\n service_no_covered = []\n service_deductible = []\n co_insurance = []\n service_discount = []\n contractual_amount = []\n service_paid_amount = []\n denied = []\n primary_payment = []\n reason_code_adjustment = []\n csv_records.each do |record|\n service_procedure_code[counter] = record.service_procedure_code\n date_of_service_from[counter] = record.date_of_service_from.strftime(\"%m%d%y\")\n service_procedure_charge_amount[counter] = record.service_procedure_charge_amount\n service_no_covered[counter] = record.service_no_covered\n service_deductible[counter] = record.service_deductible\n co_insurance[counter] = record.service_co_insurance.to_f + record.service_co_pay.to_f\n service_discount[counter] = record.service_discount\n contractual_amount[counter] = record.contractual_amount\n service_paid_amount[counter] = record.service_paid_amount\n denied[counter] = record.denied\n primary_payment[counter] = record.primary_payment\n reason_code_adjustment[counter] = \"\"\n\n unless record.noncovered_code.blank?\n reason_code_adjustment[counter] = record.get_mapped_codes(facility, 'PAYER CODE', 'noncovered') + \";\"\n end\n unless record.denied_code.blank?\n reason_code_adjustment[counter] = reason_code_adjustment[counter] + record.get_mapped_codes(facility, 'PAYER CODE', 'denied') + \";\"\n end\n unless record.discount_code.blank?\n reason_code_adjustment[counter] = reason_code_adjustment[counter] + record.get_mapped_codes(facility, 'PAYER CODE', 'discount') + \";\"\n end\n unless record.coinsurance_code.blank?\n reason_code_adjustment[counter] = reason_code_adjustment[counter] + record.get_mapped_codes(facility, 'PAYER CODE', 'coinsurance') + \";\"\n end\n unless record.deductuble_code.blank?\n reason_code_adjustment[counter] = reason_code_adjustment[counter] + record.get_mapped_codes(facility, 'PAYER CODE', 'deductible') + \";\"\n end\n unless record.primary_payment_code.blank?\n reason_code_adjustment[counter] = reason_code_adjustment[counter] + record.get_mapped_codes(facility, 'PAYER CODE', 'primary_payment') + \";\"\n end\n unless record.contractual_code.blank?\n reason_code_adjustment[counter] = reason_code_adjustment[counter] + record.get_mapped_codes(facility, 'PAYER CODE', 'contractual') + \";\"\n end\n reason_code_adjustment[counter].slice!(reason_code_adjustment[counter].size-1)\n counter += 1\n patient_name = record.patient_first_name + \" \" + record.patient_middle_initial + \" \" + record.patient_last_name\n pat_resposibility = record.service_co_insurance.to_f + record.service_co_pay.to_f + record.service_deductible.to_f\n if counter == 6 || counter == records_size\n #Writing a row for csv file\n csv = [image_types, record.patient_account_number, patient_name, service_procedure_code[0], service_procedure_code[1], service_procedure_code[2], service_procedure_code[3],\n service_procedure_code[4], service_procedure_code[5], date_of_service_from[0], date_of_service_from[1], date_of_service_from[2], date_of_service_from[3],\n date_of_service_from[4], date_of_service_from[5], service_procedure_charge_amount[0], service_procedure_charge_amount[1], service_procedure_charge_amount[2],\n service_procedure_charge_amount[3], service_procedure_charge_amount[4], service_procedure_charge_amount[5], service_no_covered[0],service_no_covered[1],\n service_no_covered[2],service_no_covered[3],service_no_covered[4],service_no_covered[5], payer_name, record.patient_identification_code, service_deductible[0],\n service_deductible[1],service_deductible[2],service_deductible[3],service_deductible[4],service_deductible[5], co_insurance[0], co_insurance[1],\n co_insurance[2], co_insurance[3], co_insurance[4], co_insurance[5], service_discount[0],service_discount[1],service_discount[2],service_discount[3],\n service_discount[4],service_discount[5], contractual_amount[0], contractual_amount[1], contractual_amount[2], contractual_amount[3], contractual_amount[4], contractual_amount[5],\n service_paid_amount[0],service_paid_amount[1] ,service_paid_amount[2], service_paid_amount[3], service_paid_amount[4], service_paid_amount[5], denied[0], denied[1], denied[2],\n denied[3], denied[4], denied[5], primary_payment[0], primary_payment[1], primary_payment[2], primary_payment[3], primary_payment[4], primary_payment[5], aba_routing_number,\n record.patient_account_number, check_number, pat_resposibility, filename, lockbox_number, reason_code_adjustment[0], reason_code_adjustment[1], reason_code_adjustment[2],\n reason_code_adjustment[3], reason_code_adjustment[4], reason_code_adjustment[5], \"\", batchid, batch_date.strftime(\"%m%d%Y\")].join(\",\") + \"\\n\"\n csv_string = csv_string + csv\n break\n end\n\n end\n end\n\n return csv_string unless csv_string.blank?\n end",
"title": ""
},
{
"docid": "4ad0f5bd72f584b17653652c1b1e6594",
"score": "0.5282164",
"text": "def csv?\n text? && extname.downcase == '.csv'\n end",
"title": ""
},
{
"docid": "ef831d29f3e0f33030733124a595b62d",
"score": "0.52730805",
"text": "def header_format_and_csv_wellformedness\n begin\n if csv_object.header_row?\n csv_headers = csv_object.first.fields\n if csv_headers_are_correct?(csv_headers)\n next_row = csv_object.gets\n if next_row.present?\n csv_object.rewind\n true\n else\n errors.add(:input, :empty_csv)\n end\n else\n errors.add(:input, :incorrect_csv_headers)\n end\n else\n fail \"CSV has already been accessed past index 0\"\n end\n rescue ::CSV::MalformedCSVError\n errors.add(:input, :malformed_csv)\n end\n end",
"title": ""
},
{
"docid": "b5aad5def02af7db17e9d0c599f847e3",
"score": "0.52653486",
"text": "def csv?\n @gapi.source_format == \"CSV\"\n end",
"title": ""
}
] |
d210b75dbaa7fdb185d1d5673a4ea5e1
|
DELETE /compinfos/1 DELETE /compinfos/1.json
|
[
{
"docid": "b2f0e52db754091165262f14c3c803b2",
"score": "0.75265044",
"text": "def destroy\n @compinfo.destroy\n respond_to do |format|\n format.html { redirect_to compinfos_url, notice: 'Compinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "345667f1c2c29f83d33dffed83824fcf",
"score": "0.7729029",
"text": "def destroy\n @compinfo = Compinfo.find(params[:id])\n @compinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to compinfos_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "36641f85900fdeacd592614a2b5a426d",
"score": "0.7211216",
"text": "def destroy\n @composante = Composante.find(params[:id])\n @composante.destroy\n\n respond_to do |format|\n format.html { redirect_to composantes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "82326159b0fc68e5838d8bb86765bbba",
"score": "0.70928574",
"text": "def destroy\n @compito.destroy\n respond_to do |format|\n format.html { redirect_to compiti_url, notice: 'Compito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8146e6f459d554584eeb9cde543b53d",
"score": "0.7047399",
"text": "def destroy\n @detalle_compra = DetalleCompra.find(params[:id])\n @detalle_compra.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_compras_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6e2646096b672113aa1e69b31dd400bc",
"score": "0.70342004",
"text": "def destroy\n @compdt.destroy\n respond_to do |format|\n format.html { redirect_to compdts_url, notice: 'Votre commande a bien été supprimée.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0750cdcc29792fd25e69f2bdc4414a70",
"score": "0.6973727",
"text": "def destroy\n @compra = Compra.find(params[:id])\n @compra.destroy\n\n respond_to do |format|\n format.html { redirect_to compras_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0750cdcc29792fd25e69f2bdc4414a70",
"score": "0.6973727",
"text": "def destroy\n @compra = Compra.find(params[:id])\n @compra.destroy\n\n respond_to do |format|\n format.html { redirect_to compras_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7101d3d46c0fd164e6b135b0640c349d",
"score": "0.69687885",
"text": "def destroy\n @comprador = Comprador.find(params[:id])\n @comprador.destroy\n\n respond_to do |format|\n format.html { redirect_to compradores_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5c268c27fd83abaf6ca0e53c0a6dc8b7",
"score": "0.69634944",
"text": "def destroy\n @compra = Compra.find(params[:id])\n @compra.destroy\n\n respond_to do |format|\n format.html { redirect_to compras_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8582c5c902850422eb4700ab0f8656b9",
"score": "0.6961708",
"text": "def destroy\n @comptabilite.destroy\n respond_to do |format|\n format.html { redirect_to comptabilites_url, notice: \"Comptabilite was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5d5d8e15c96b6ee2b13ac8497cf2f4db",
"score": "0.69439965",
"text": "def destroy\n @comit = Comit.find(params[:id])\n @comit.destroy\n\n respond_to do |format|\n format.html { redirect_to comits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b445c184893647d3482f8fbc6a507a52",
"score": "0.69394004",
"text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end",
"title": ""
},
{
"docid": "4b932c771949d69de17409ddd34838ba",
"score": "0.69323534",
"text": "def destroy\n @complejo = Complejo.find(params[:id])\n @complejo.destroy\n\n respond_to do |format|\n format.html { redirect_to(complejos_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "ca947fb5c0f7c08fee960c8b5b0a13fb",
"score": "0.69085443",
"text": "def destroy\n @complaint_detail.destroy\n respond_to do |format|\n format.html { redirect_to complaint_details_url, notice: \"Complaint detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3594bc1447cca54c9402cbc935a93dde",
"score": "0.690438",
"text": "def destroy\n @complaint.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: t(:complaint_succ_delete) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "655341117f52010adba85c65bb6d92a2",
"score": "0.6899258",
"text": "def destroy\n @detalle_compra.destroy\n respond_to do |format|\n format.html { redirect_to @detalle_compra.compra, notice: 'Detalle eliminado.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "17ff544b1a4d2ae409cb44d3a7002a03",
"score": "0.6868159",
"text": "def destroy\n @asistencia_compra.destroy\n respond_to do |format|\n format.html { redirect_to asistencia_compras_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2d3782ce72e8e9f55dc6d3b215f7a82f",
"score": "0.68537474",
"text": "def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4630800dcc0578345e184e18b9adfb6b",
"score": "0.6851246",
"text": "def destroy\n @comite = Comite.find(params[:id])\n @comite.destroy\n\n respond_to do |format|\n format.html { redirect_to comites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "87ec9588e0726c938487778ec8ef10be",
"score": "0.6838874",
"text": "def destroy\n @detalle_compra.destroy\n respond_to do |format|\n format.html { redirect_to detalle_compras_url, notice: 'Detalle compra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "87226cd5bc1a4df215c7d3c30d369b20",
"score": "0.683495",
"text": "def destroy\n @comprador.destroy\n respond_to do |format|\n format.html { redirect_to compradors_url, notice: 'Cadastro removido com sucesso' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ef93a9a96de328278f61b6060605de4d",
"score": "0.6830642",
"text": "def destroy\n @item_compra = ItemCompra.find(params[:id])\n $compra = @item_compra.compra\n @item_compra.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"new\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "37427bff8fc7f2d10c7d5f917cc0a325",
"score": "0.68276036",
"text": "def destroy\n @compromisso.destroy\n respond_to do |format|\n format.html { redirect_to compromissos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7452c4d15daf08108aaa5a1b728adb31",
"score": "0.68259984",
"text": "def destroy\n @json.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "d4f40041b3ac1555fd9c6d95c1260292",
"score": "0.681776",
"text": "def destroy\n @comuna.destroy\n respond_to do |format|\n format.html { redirect_to comunas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "451ac9dc381c2ece50be79915602ed7a",
"score": "0.68115306",
"text": "def destroy\n @comida = Comida.find(params[:id])\n @comida.destroy\n\n respond_to do |format|\n format.html { redirect_to comidas_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "01a963b6dea8c3a309e596f9b9081118",
"score": "0.6809694",
"text": "def destroy\n @comuna = Comuna.find(params[:id])\n @comuna.destroy\n\n respond_to do |format|\n format.html { redirect_to comunas_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9a0ad667aa2dae32f020efa69cc40d18",
"score": "0.68081284",
"text": "def destroy\n @complaintfile.destroy\n respond_to do |format|\n format.html { redirect_to complaint_path(@complaintfile.complaint_id), notice: t(:com_file_succ_delete) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "06a6673aa7567bdf2066989a97cd0f37",
"score": "0.6803354",
"text": "def destroy\n @compra_venta_especial.destroy\n respond_to do |format|\n format.html { redirect_to compra_venta_especials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.67986274",
"text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end",
"title": ""
},
{
"docid": "9680a66eb17e9fe97e11464b69ef26c5",
"score": "0.67869115",
"text": "def destroy\n @com_compra.destroy\n respond_to do |format|\n format.html { redirect_to com_compras_url, notice: 'Compra eliminado correctamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7b109dd00976d1e600a46f6a59f6102b",
"score": "0.67835957",
"text": "def destroy\n @compartido = Compartido.find(params[:id])\n @compartido.destroy\n\n respond_to do |format|\n format.html { redirect_to compartidos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "732f8ed17b6a9a78db93aa8d94748d7c",
"score": "0.67791474",
"text": "def destroy\n @composite = Composite.find(params[:id])\n @composite.destroy\n\n respond_to do |format|\n format.html { redirect_to composites_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7b2ae82cbf79f8932c8395c6c8350f15",
"score": "0.6778004",
"text": "def destroy\n @categorie_comptable = CategorieComptable.find(params[:id])\n @categorie_comptable.destroy\n\n respond_to do |format|\n format.html { redirect_to categorie_comptables_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "39bf47bcfbdcfb9d28a1607980ca3acf",
"score": "0.67684096",
"text": "def destroy\n @lab_anat_cit.destroy\n respond_to do |format|\n format.html { redirect_to lab_anat_cits_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a93a48af2ba999db5701c530f839873d",
"score": "0.67671627",
"text": "def destroy\n @compra_remate.destroy\n respond_to do |format|\n format.html { redirect_to compra_remates_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "861bd22812949b1f87673a4a1bc9397b",
"score": "0.6762718",
"text": "def destroy\n @colaborador = Colaborador.find(params[:id])\n @colaborador.destroy\n\n respond_to do |format|\n format.html { redirect_to colaboradores_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2f8ba6571408340d49bae30492e5ee39",
"score": "0.6762045",
"text": "def destroy\n @che300_info.destroy\n respond_to do |format|\n format.html { redirect_to che300_infos_url, notice: 'Info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b2cca49e7051628b8b15c379c75b384",
"score": "0.6759167",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to compras_url, notice: 'Compra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b2cca49e7051628b8b15c379c75b384",
"score": "0.6759167",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to compras_url, notice: 'Compra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2b2cca49e7051628b8b15c379c75b384",
"score": "0.6759167",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to compras_url, notice: 'Compra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "05fa0ac2c2417648b4e4dddc4ff7c9ae",
"score": "0.67565626",
"text": "def destroy\n @computador = Computador.find(params[:id])\n @computador.destroy\n\n respond_to do |format|\n format.html { redirect_to computadors_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0d50f7320adfa675858c60ec156d1db0",
"score": "0.675557",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to compras_url, notice: \"Compra was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3a5f1215d0d4086e875563a2cda0e4bc",
"score": "0.67538244",
"text": "def destroy\n @pec_complaint = PecComplaint.find(params[:id])\n @pec_complaint.destroy\n\n respond_to do |format|\n format.html { redirect_to pec_complaints_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0ead7a59052106fef396e9189201c39d",
"score": "0.6748996",
"text": "def destroy\n @registro_compra = RegistroCompra.find(params[:id])\n @registro_compra.destroy\n\n respond_to do |format|\n format.html { redirect_to registro_compras_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "851fa67f23470b053f200b56cf5fc847",
"score": "0.6747419",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to compras_url, notice: \"Compra ID #{@compra.id} foi removida com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d4d973137edf782e86fac52ee84315e8",
"score": "0.6745641",
"text": "def destroy\n @comp.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "ec1ab23fdcb4565490bef719f07c1599",
"score": "0.67436856",
"text": "def destroy\n @comake_it.destroy\n respond_to do |format|\n format.html { redirect_to comake_its_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4a53142b6448ac05b68406963f7933a3",
"score": "0.6741497",
"text": "def destroy\n @dec_complaint = DecComplaint.find(params[:id])\n @dec_complaint.destroy\n\n respond_to do |format|\n format.html { redirect_to dec_complaints_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c5e20f26f935e41dfd9c53fee15938ff",
"score": "0.6737771",
"text": "def destroy\n @detalle_curso.destroy\n respond_to do |format|\n format.html { redirect_to detalle_cursos_url, notice: 'Detalle curso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0ee8d29e97037c7ae6e773f480c89d1",
"score": "0.6736445",
"text": "def destroy\n @mon_compte.destroy\n respond_to do |format|\n format.html { redirect_to mon_comptes_url, notice: \"Mon compte was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e2b1bfccd1335e692acd68b2950cf703",
"score": "0.67360145",
"text": "def destroy\n @comm.destroy\n respond_to do |format|\n format.html { redirect_to comms_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1a0fd11b513b0e01e8dfd8a55d16bb04",
"score": "0.6735755",
"text": "def destroy\n @comic = Comic.find(params[:id])\n @comic.destroy\n\n respond_to do |format|\n format.html { redirect_to comics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f01db9d1221be841adc32407d1aaa316",
"score": "0.67321837",
"text": "def destroy\n @info.destroy\n respond_to do |format|\n format.html { redirect_to infos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9d2c0198cfacf9469d23669df7ed366a",
"score": "0.6732154",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to sales_url, notice: 'Compra eliminada' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5f73192c2e615d66100aeab22c2b2202",
"score": "0.6720431",
"text": "def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to do |format|\n format.html { redirect_to conta_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7216e3fdb25c4df08b9fdbae2ffc5fd9",
"score": "0.6719699",
"text": "def destroy\n @compartir.destroy\n respond_to do |format|\n format.html { redirect_to compartirs_url, notice: 'Compartir was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9c4be6fca8c98f28f9cbd7142945d5c2",
"score": "0.67171913",
"text": "def destroy\n @sala_de_computo.destroy\n respond_to do |format|\n format.html { redirect_to sala_de_computos_url, notice: 'Sala de computo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "782e679e323f4b35606ecac50261c49b",
"score": "0.6717084",
"text": "def destroy\n @c_restum.destroy\n respond_to do |format|\n format.html { redirect_to c_resta_url, notice: 'C restum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9c5266293584c643d676d66f16cc3752",
"score": "0.6715931",
"text": "def destroy\n AccDatum.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to acc_data_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d2d75c7b91e1b72b2a2bf5140eaa3056",
"score": "0.671473",
"text": "def destroy\n @info_contacto.destroy\n respond_to do |format|\n format.html { redirect_to info_contactos_url, notice: 'Info contacto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0063393becfeea5760b7e0e3a0f34cc8",
"score": "0.6704178",
"text": "def destroy\n @comunidad.destroy\n respond_to do |format|\n format.html { redirect_to comunidades_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1273268d3bc7a1b7fbe42d203ba7df82",
"score": "0.6702497",
"text": "def destroy\n @compra.destroy\n respond_to do |format|\n format.html { redirect_to compras_url, notice: 'Su compra ha sido cancelada.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b45f9ad14d66ed35cf957a84446d6334",
"score": "0.67018074",
"text": "def destroy\n @centroscomercial.destroy\n respond_to do |format|\n format.html { redirect_to centroscomercials_url, notice: 'Centroscomercial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cfabce378480b0e03e46df020c8c0134",
"score": "0.67008966",
"text": "def destroy\n @comision.destroy\n respond_to do |format|\n format.html { redirect_to comisiones_url, notice: 'Comisión eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4af76fa432b614057068d39ba0cd830d",
"score": "0.669479",
"text": "def destroy\n @comida.destroy\n respond_to do |format|\n format.html { redirect_to comidas_url, notice: 'Comida was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9332d22eec2b423918f3bf3f450ee0b3",
"score": "0.66919744",
"text": "def destroy\n @comapany.destroy\n respond_to do |format|\n format.html { redirect_to comapanies_url, notice: 'Comapany was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "82da1e39d6d3a6bf9f794050a13014eb",
"score": "0.66890955",
"text": "def destroy\n @info.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "a4b9ac4cde609d8f70ede1f47d803bfe",
"score": "0.6688964",
"text": "def destroy\n @complication.destroy\n respond_to do |format|\n format.html { redirect_to complications_url, notice: 'Complication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9ce18e16d669510b9d03b3ffeda60a2e",
"score": "0.668853",
"text": "def destroy\n deletedName = @c14_lab.name\n @c14_lab.destroy\n respond_to do |format|\n format.html { redirect_to c14_labs_url, notice: \"#{deletedName} was deleted.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e6e1bf53a69657a6369b1779744c2aba",
"score": "0.6686877",
"text": "def destroy\n @complaint.destroy\n respond_to do |format|\n format.html { redirect_to complaints_url, notice: 'Queja eliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7963657f0a2acc1ca5a5af2555fe7273",
"score": "0.66807353",
"text": "def destroy\n @mesacompracardapio.destroy\n respond_to do |format|\n format.html { redirect_to mesacompracardapios_url, notice: 'Mesacompracardapio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "773e5d611adeb09776f9c841e1b876cc",
"score": "0.66785216",
"text": "def delete_json(path, params = {}, headers = {})\n json_request(:delete, path, params, headers)\n end",
"title": ""
},
{
"docid": "f878b3ad3bfea21f03ebb8405ec7ed03",
"score": "0.66748166",
"text": "def destroy\n @internacao.destroy\n respond_to do |format|\n format.html { redirect_to internacaos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e7184a6f9289cf68b52198f61d8d7e28",
"score": "0.66736495",
"text": "def destroy\n @compromiso.destroy\n respond_to do |format|\n format.html { redirect_to compromisos_url, notice: 'Compromiso was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ee4dce6bc66d14e69df16f6070fda2fb",
"score": "0.6671012",
"text": "def destroy\n @info = Info.find(params[:id])\n @info.destroy\n\n respond_to do |format|\n format.html { redirect_to infos_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e83b4e58847fd57035f861256b78a3db",
"score": "0.6667454",
"text": "def destroy\n @comprobante = Comprobante.find(params[:id])\n @comprobante.destroy\n\n respond_to do |format|\n format.html { redirect_to(comprobantes_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "26b42bba926481a0d1f138e85763aed3",
"score": "0.66667503",
"text": "def destroy\n @comptype = Comptype.find(params[:id])\n begin\n @comptype.destroy\n end\n respond_to do |format|\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0a8892d66c7fc32d04b88c586d7d4fd7",
"score": "0.6665004",
"text": "def destroy\n @comunity.destroy\n respond_to do |format|\n format.html { redirect_to comunities_url, notice: 'Comunidad eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b057b14448aa4dcebfc86c4bab28889d",
"score": "0.66637546",
"text": "def destroy\n @ativo_circulante_operacional = AtivoCirculanteOperacional.find(params[:id])\n @ativo_circulante_operacional.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_circulante_operacionals_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b1aac85aca666b0315061da2ee323c0c",
"score": "0.66617894",
"text": "def destroy\n @ref_consult_request = RefConsultRequest.find(params[:id])\n @ref_consult_request.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_consult_requests_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3cdade4cf3f0b8d0068d43235c7446e3",
"score": "0.6661789",
"text": "def destroy\n @combi.destroy\n respond_to do |format|\n format.html { redirect_to combis_url, notice: 'Combi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "73a209e625e1a9e4c6bb6e36a999ad27",
"score": "0.66613394",
"text": "def destroy\n @pago_compra.destroy\n respond_to do |format|\n format.html { redirect_to pago_compras_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e8511029129e7fbea63a0a77fb51dfca",
"score": "0.6659569",
"text": "def destroy\n @companium = Companium.find(params[:id])\n @companium.destroy\n\n respond_to do |format|\n format.html { redirect_to(compania_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c44817593d0d1625e7a8166119e73ceb",
"score": "0.6659549",
"text": "def destroy\n @major = Major.find(params[:id])\n @major.destroy\n\n respond_to do |format|\n format.html { redirect_to(majors_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end",
"title": ""
},
{
"docid": "575599d77e158793e65aeb5830f7b2ed",
"score": "0.6658332",
"text": "def destroy\n @liquidacion_comision = LiquidacionComision.find(params[:id])\n @liquidacion_comision.destroy\n\n respond_to do |format|\n format.html { redirect_to liquidacion_comisions_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e44031cfd95b145ba827c81c9f568184",
"score": "0.665658",
"text": "def destroy\n @tipo_de_compra.destroy\n addlog(\"Tipo de compra apagado\")\n respond_to do |format|\n format.html { redirect_to tipos_de_compra_url, notice: 'Tipo de compra apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "df1daef1868400abec2635d341d4343d",
"score": "0.66563267",
"text": "def destroy\n @comptepersonnel.destroy\n respond_to do |format|\n format.html { redirect_to comptepersonnels_url, notice: 'Comptepersonnel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "037313cbc3cbd3a1534791cd4f5a39da",
"score": "0.6655177",
"text": "def destroy\n @comm = Comm.find(params[:id])\n @comm.destroy\n\n respond_to do |format|\n format.html { redirect_to comms_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0eb20250187e8769cc62136bec9de4df",
"score": "0.6653732",
"text": "def destroy\n @combinaison = Combinaison.find(params[:id])\n @combinaison.destroy\n\n respond_to do |format|\n format.html { redirect_to combinaisons_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e5337f16d0bc5aeae0ea02ff7b6f23c1",
"score": "0.665304",
"text": "def destroy\n @compaign = Compaign.find(params[:id])\n @compaign.tasks.each do |task|\n task.destroy\n end\n @compaign.destroy\n\n respond_to do |format|\n format.html { redirect_to compaigns_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "401906ed139d0fe0db1049449623a40b",
"score": "0.6651623",
"text": "def destroy\n @gerente_comercial = GerenteComercial.find(params[:id])\n @gerente_comercial.destroy\n\n respond_to do |format|\n format.html { redirect_to gerente_comercials_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9f099cf649f3becd7a2bc8c74d38e1f8",
"score": "0.6646268",
"text": "def destroy\n @especie_catalogo.destroy\n respond_to do |format|\n format.html { redirect_to especies_catalogo_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c5bebc2c908587820f66ee3b253fde9a",
"score": "0.6646146",
"text": "def destroy\n @complaint.destroy\n respond_to do |format|\n format.html { redirect_to complaints_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0138c1c46aa8ddada9c429c6060b9585",
"score": "0.66436064",
"text": "def destroy\n @cli= @factura.cliente\n @factura.destroy\n respond_to do |format|\n format.html { redirect_to @cli, notice: 'La factura fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3c987188bb481d57edaa5d2a63f9051d",
"score": "0.6643503",
"text": "def destroy\n @lab_complex.destroy\n respond_to do |format|\n format.html { redirect_to lab_complexes_url, notice: 'Lab complex was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2b678aa8d3198d753cf10e9ab02a045",
"score": "0.6642689",
"text": "def destroy\n @coefutum.destroy\n respond_to do |format|\n format.html { redirect_to coefuta_url}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "95b437b3ecabc52b154de3dff16a3bb2",
"score": "0.6641535",
"text": "def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to comics_url, notice: 'Comic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2cdcda3512f958de26586a91d73ebf11",
"score": "0.66412276",
"text": "def destroy\n @cli_sistema.destroy\n respond_to do |format|\n format.html { redirect_to cli_sistemas_url, notice: 'Cli sistema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "95b437b3ecabc52b154de3dff16a3bb2",
"score": "0.6640392",
"text": "def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to comics_url, notice: 'Comic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
04e4bc6a0098d8df48a67b8e220e6fa2
|
Returns units belonging to current order that are not ready to proceed with digitization and would prevent an order from being approved. Only units whose unit_status = 'approved' or 'canceled' are removed from consideration by this method.
|
[
{
"docid": "3d6ffdf0d90ebfa79e8b628b062414c3",
"score": "0.6266042",
"text": "def has_units_being_prepared\n units_beings_prepared = Unit.where(:order_id => self.id).where('unit_status = \"unapproved\" or unit_status = \"condition\" or unit_status = \"copyright\"')\n return units_beings_prepared\n end",
"title": ""
}
] |
[
{
"docid": "12f7cfd5034ecf5b1691a2a0b500ab19",
"score": "0.65789837",
"text": "def get_rented_units\n @units.select { |u| !u.available? }\n end",
"title": ""
},
{
"docid": "a07c20bd641500a5219ae2cf767d2ae3",
"score": "0.6155597",
"text": "def get_rented_units\n @units.select { |unit| not unit.available? }.map { |unit| unit.number }\n\n end",
"title": ""
},
{
"docid": "b7ff43c447656942d54b50672defcf29",
"score": "0.5953045",
"text": "def validate_order_approval\n units_beings_prepared = self.has_units_being_prepared\n if not units_beings_prepared.empty?\n errors[:order_status] << \"cannot be set to approved because units #{units_beings_prepared.map(&:id).join(', ')} are neither approved nor canceled\"\n end\n end",
"title": ""
},
{
"docid": "46b353292dd6c3272ff099a63fb2a508",
"score": "0.59047765",
"text": "def get_available_units\n @units.select { |u| u.available? }\n end",
"title": ""
},
{
"docid": "60d5baf4f25eb5dc06585f0eaf9f5237",
"score": "0.58245736",
"text": "def pending_purchaseorders\n pending_purchaseorders = Array.new\n purchaseorders.each do |purchaseorder|\n pending_purchaseorders << purchaseorder.code unless purchaseorder.status.eql?('compliance_approved')\n end\n pending_purchaseorders\n end",
"title": ""
},
{
"docid": "866dab2ff82f9ebcff64920d9a270739",
"score": "0.5772968",
"text": "def allowed_orders(unit)\n case unit.type\n when \"worker\"\n orders_for_worker(unit)\n else\n rules_hash[\"units\"][unit.type][\"allowed_orders\"]\n end\n end",
"title": ""
},
{
"docid": "274b75f85ebfcb001bf9bc05c1d96bac",
"score": "0.5612334",
"text": "def get_available_units \n @units.select { |unit| unit.available? }.map { |unit| unit.number }\n \n end",
"title": ""
},
{
"docid": "e5475aafcf2fc5af09b1bb8cfdae3eb9",
"score": "0.55548614",
"text": "def not_available_statuses\n (self.class.available_statuses - available_statuses) + [STATUS_RESULT_ANNOUNCED]\n end",
"title": ""
},
{
"docid": "d85eb8c788bdec02f3403629459d202b",
"score": "0.5551447",
"text": "def orders_with_items() orders.select {|o| o.line_items_unshipped_and_uncancelled.any? } end",
"title": ""
},
{
"docid": "ef5f82509e174560c6d5e9a570ca3081",
"score": "0.55501914",
"text": "def incomplete\n find(:all, :conditions => [\"status != ?\", \"Complete\"])\n end",
"title": ""
},
{
"docid": "bddb44632056b2ffc1e024c5e250f5ed",
"score": "0.55290323",
"text": "def units\r\n u = []\r\n @game.nations.each do |nation|\r\n nation.units.select{ |_u| not _u.working_on }.each do |unit|\r\n u << unit if unit.x == @x and unit.y == @y\r\n end\r\n return u if u.length > 0\r\n end\r\n return u\r\n end",
"title": ""
},
{
"docid": "85afa05779f41587ec94719933efa2d1",
"score": "0.5527027",
"text": "def unpaid_items(include_incomplete_registrants: false)\n reis = if include_incomplete_registrants\n registrant_expense_items.includes(:registrant).joins(:registrant).merge(Registrant.active_or_incomplete)\n else\n registrant_expense_items.includes(:registrant).joins(:registrant).merge(Registrant.active)\n end\n reis.free.reject { |rei| rei.registrant.reg_paid? } + reis.where(free: false)\n end",
"title": ""
},
{
"docid": "fb541561c8dff478a0fad48b9c8cc9ed",
"score": "0.5491192",
"text": "def unpaid_items\n reis = registrant_expense_items.joins(:registrant).where(registrants: {deleted: false})\n reis.free.select{ |rei| !rei.registrant.reg_paid? } + reis.where(free: false)\n end",
"title": ""
},
{
"docid": "577cd8357e7f1255be1d905c12bb1cb3",
"score": "0.5488911",
"text": "def uninfecteds\n where(infested: \"Nao\")\n end",
"title": ""
},
{
"docid": "52db4556ddf68f3e929572c4166d3bb5",
"score": "0.54218066",
"text": "def donated\n\t\tdonations.where(\"status != 'returned' AND status != 'failed' AND status != 'revoked'\")\n\tend",
"title": ""
},
{
"docid": "55ffac131e708de13cbba1a19e33c833",
"score": "0.5417655",
"text": "def unavailable_todos\n (completed_recurring_todo_completes.active + incomplete_todo_completes.active)\n end",
"title": ""
},
{
"docid": "55ffac131e708de13cbba1a19e33c833",
"score": "0.5417655",
"text": "def unavailable_todos\n (completed_recurring_todo_completes.active + incomplete_todo_completes.active)\n end",
"title": ""
},
{
"docid": "498babd0645301386d56e3513e66e67c",
"score": "0.5387625",
"text": "def uncompleted_operations\n operations.reject(&:completed?)\n end",
"title": ""
},
{
"docid": "3bb3cb6b1eff6ba7b6371b0806541749",
"score": "0.53555095",
"text": "def unit_select_list(consumable, units_to_keep = [])\n t = []\n for unit in units_to_keep\n if unit.custom?\n t << unit \n else\n t = t + all_food_units.select { |u| u.loose_match?(unit) }\n end\n end\n (all_food_units - to_units(consumable)) | t.uniq\n end",
"title": ""
},
{
"docid": "040fca01a14030a3e7b03193b0bf04cd",
"score": "0.5349305",
"text": "def units_with_records\n LaborRequest.select(:unit_id).distinct.collect { |r| r.unit unless r.unit.nil? }.compact\n end",
"title": ""
},
{
"docid": "e51def873de39cbba9072def9f227afe",
"score": "0.5348154",
"text": "def inactive_mandates\n Rails.logger.info \"[#{self.class.name}] Getting inactive mandates\"\n mandates.reject { |mandate| select_active_statuses(mandate.status) }\n end",
"title": ""
},
{
"docid": "5a9fd122b9bb89805ca374d0cdfc242c",
"score": "0.53352576",
"text": "def index\n @units = Unit.unarchived\n end",
"title": ""
},
{
"docid": "6d657a1f843cafb62299f370a8098e08",
"score": "0.5296913",
"text": "def declined\n where approved: false\n end",
"title": ""
},
{
"docid": "b9f90698d5b66d160ba628dc32bce962",
"score": "0.5296143",
"text": "def scrub!\n units.values.map do |items|\n items.sort!{|x,y| y.version <=> x.version}\n items.uniq!\n end\n self\n end",
"title": ""
},
{
"docid": "9a04ddc4e190aab35950efb00df76cdb",
"score": "0.5272643",
"text": "def show_uncompleted\n uncompleted=[]\n @items.each do |item|\n\t uncompleted << item unless item.completed?\n\t end\n\t uncompleted\n end",
"title": ""
},
{
"docid": "d5bc044a5487639d96a4c81870caaea1",
"score": "0.5269933",
"text": "def enemy_units\n @units.find_all { |u| u.faction != my_faction }\n end",
"title": ""
},
{
"docid": "d5bc044a5487639d96a4c81870caaea1",
"score": "0.5269933",
"text": "def enemy_units\n @units.find_all { |u| u.faction != my_faction }\n end",
"title": ""
},
{
"docid": "195f8e96a14ca8476e76f8feb4c9e596",
"score": "0.5252315",
"text": "def pending_statuses\n required_statuses.select(&:pending?)\n end",
"title": ""
},
{
"docid": "580e013ea1f2c304b1a975a524039ef5",
"score": "0.5241574",
"text": "def units_incomplete\n @data['unitsIncomplete'].try(:to_f)\n end",
"title": ""
},
{
"docid": "3b5d23131b6494687acf3114e334a053",
"score": "0.5237327",
"text": "def get_orders_missing_items\n\t\torders_missing_items = Array.new\n\t\tself.mws_orders.each do |o|\n\t\t\tif o.get_item_quantity_missing > 0 || o.get_item_quantity_ordered == 0\n\t\t\t\torders_missing_items << o\n\t\t\tend\n\t\tend\n\t\treturn orders_missing_items\n\tend",
"title": ""
},
{
"docid": "3b5d23131b6494687acf3114e334a053",
"score": "0.5236975",
"text": "def get_orders_missing_items\n\t\torders_missing_items = Array.new\n\t\tself.mws_orders.each do |o|\n\t\t\tif o.get_item_quantity_missing > 0 || o.get_item_quantity_ordered == 0\n\t\t\t\torders_missing_items << o\n\t\t\tend\n\t\tend\n\t\treturn orders_missing_items\n\tend",
"title": ""
},
{
"docid": "e3f5753467bc9503d113ba0e829d081e",
"score": "0.52349114",
"text": "def ungraded_submission_results\n current_results.where('results.marking_state': Result::MARKING_STATES[:incomplete])\n end",
"title": ""
},
{
"docid": "8ecf2faa37f60a7e383d01b5ff83c2aa",
"score": "0.52245915",
"text": "def orders_for_worker(unit)\n possible_orders = rules_hash[\"units\"][\"worker\"][\"allowed_orders\"]\n possible_orders.each_with_object([]) do |order, allowed_orders|\n unless order_type(order) != \"construction\" ||\n (order_type(order) == \"construction\" &&\n valid_contruction_order?(unit, order))\n next\n end\n allowed_orders << order\n end\n end",
"title": ""
},
{
"docid": "23222a059ce907cecccf849ab6c997cf",
"score": "0.5222692",
"text": "def unfulfilled_line_items\n self.order_line_items.where('status != ?', 'shipped').all\n end",
"title": ""
},
{
"docid": "81c6eab302c8c858ec569636116fc7d4",
"score": "0.52212894",
"text": "def invoices_not_paid\n @invoice_repository.all.reject do |invoice|\n invoice_paid_in_full?(invoice.id)\n end\n end",
"title": ""
},
{
"docid": "81c6eab302c8c858ec569636116fc7d4",
"score": "0.52212894",
"text": "def invoices_not_paid\n @invoice_repository.all.reject do |invoice|\n invoice_paid_in_full?(invoice.id)\n end\n end",
"title": ""
},
{
"docid": "b1fb9825c151f1d7c6771f83c2634112",
"score": "0.51971567",
"text": "def build_unavailable(params)\n ::Quotation.new(\n property_id: params[:property_id],\n unit_id: params[:unit_id],\n check_in: params[:check_in].to_s,\n check_out: params[:check_out].to_s,\n guests: params[:guests],\n available: false\n )\n end",
"title": ""
},
{
"docid": "438d042bb40256f08f6316b9cd6561d1",
"score": "0.5183402",
"text": "def ready_to_approve?\n status = self.units.map(&:unit_status) & ['condition', 'copyright', 'unapproved']\n return status.empty?\n end",
"title": ""
},
{
"docid": "4413b1da4e061066350f0d0fb3feb149",
"score": "0.5181175",
"text": "def active_tasks\n tasks.all({ :status.not => [ :complete, :abandoned ] })\n end",
"title": ""
},
{
"docid": "7dcacb9461e40e613b3b310b98805f26",
"score": "0.51733917",
"text": "def unavailable_apartments\n apartments.reject(&:availability)\n end",
"title": ""
},
{
"docid": "1e41a68ed670f237e9213df7a7bc2d9b",
"score": "0.5172342",
"text": "def index\n @police_units = PoliceUnit.not_deleted\n end",
"title": ""
},
{
"docid": "3a865350a8b04ee6ad491d75f22d1100",
"score": "0.51477355",
"text": "def unpaid_items(lodging_day, include_incomplete_registrants: false)\n registrant_expense_items = RegistrantExpenseItem.where(line_item: lodging_packages_for_day(lodging_day))\n reis = if include_incomplete_registrants\n registrant_expense_items.includes(:registrant).joins(:registrant).merge(Registrant.active_or_incomplete)\n else\n registrant_expense_items.includes(:registrant).joins(:registrant).merge(Registrant.active)\n end\n reis.free.reject { |rei| rei.registrant.reg_paid? } + reis.where(free: false)\n end",
"title": ""
},
{
"docid": "f0bff332d28284910e390f5608416553",
"score": "0.51473325",
"text": "def get_cancelledParties\n if self.admin?\n parties = Party.where(is_cancelled: true).where('scheduled_for >= ?', DateTime.now).order(:scheduled_for)\n elsif self.has_role?(:venue_manager, :any) || self.has_role?(:manager, :any)\n parties = Party.where(organizer_id: self.id, is_cancelled: true).where('scheduled_for >= ?', DateTime.now)\n parties.joins(:party_reservations).where(\"party_reservations.party_id != parties.id\").order(:scheduled_for) \n else\n parties = Party.where(organizer_id: self.id, is_cancelled: true).where('scheduled_for >= ?', DateTime.now)\n parties.joins(:party_reservations).where(\"party_reservations.party_id != parties.id\").order(:scheduled_for)\n end\n end",
"title": ""
},
{
"docid": "8fa3d1a17946a50428f4b36c1e4402ea",
"score": "0.5141974",
"text": "def voting\n\t\t@paidunits = Unit.find(:all,:conditions=>[\"status!='Default'\"])\n\t\t@unpaidunits = Unit.find(:all,:conditions=>[\"status=='Default'\"])\n\t\t@eligibleunits = Array.new\n\t\t@eligibleowners = Array.new\n\t\t@uneligibleowners = Array.new\n\t\t@paidunits.each do |unit|\n\t\t@eligibleunits << unit\n\t\t@eligibleowners << unit.owner\n\t\tend\n\t\t@unpaidunits.each do |unit|\n\t\t@uneligibleowners << unit.owner\n\t\tend\n\t\t#uniq! removes any duplicates\n\t\t@uneligibleowners.uniq!\n\t\t@eligibleunits.uniq!\n\t\t@eligibleowners.uniq!\n\tend",
"title": ""
},
{
"docid": "3764b4ce1f61aec618895ab22b45d50f",
"score": "0.5141385",
"text": "def show_all\n @order_requests = OrderRequest.select {|order_request| order_request.status != \"hidden\"}\n end",
"title": ""
},
{
"docid": "c7ecc738dbffe0dcb068efc0ab30c9f4",
"score": "0.51359296",
"text": "def current_contracts\n\n self.contracts.select { |contract| contract.status != 'COMPLETE' }\n\n end",
"title": ""
},
{
"docid": "8a10e9d9f0294d3d6b39c253b7a3358c",
"score": "0.5128487",
"text": "def incompleted_operations\n operations.reject(&:completed?)\n end",
"title": ""
},
{
"docid": "b23cf1786ecbf8f16e691d4f5f4f3bcc",
"score": "0.5114614",
"text": "def status_not_pending_before_approved\n message = \"Status must not be pending before an admin can approve it.\"\n errors.add(:base, message) if self.pending? and self.status_approved? and\n self.status_approved_changed?\n end",
"title": ""
},
{
"docid": "4eec2bf9e90e0a764379de73d3f0fb0b",
"score": "0.51092666",
"text": "def jobs_with_status status\n # No status filter: return all execept queued\n if status.empty?\n @jobs.reject { |job| job.status == JOB_STATUS_QUEUED }\n\n # Status filtering: only those jobs\n else\n @jobs.select { |job| job.status == status.to_s }\n\n end\n end",
"title": ""
},
{
"docid": "2e196637882e23fc21d5c80427028522",
"score": "0.50971407",
"text": "def uncovered_cases\n @uncovered_cases ||= (\n list = current.units - (target.units + canonical.units)\n list = list.map{ |u| u.namespace }.uniq\n list - canonical_cases\n )\n end",
"title": ""
},
{
"docid": "2724f98b72cfdb2c7d0e08a309736f00",
"score": "0.50859964",
"text": "def delete_all_units(units, killed_by=nil, reason=nil)\n return true if units.blank?\n \n units.group_by { |unit| unit.route_id }.each do\n |route_id, route_units|\n\n unless route_id.nil?\n Route.find(route_id).subtract_from_cached_units!(\n route_units.grouped_counts { |unit| unit.type })\n end\n end\n\n grouped_units = units.group_to_hash { |unit| unit.player_id }\n grouped_units.delete(nil)\n\n location = units[0].location\n Visibility.track_location_changes(location) do\n # Calculate army points before actual units are destroyed to still\n # get transported units.\n army_points = grouped_units.each_with_object({}) do\n |(player_id, player_units), hash|\n\n points = 0\n player_units.each do |unit|\n points += unit.points_on_destroy\n points += unit.units.all.sum(&:points_on_destroy) if unit.stored > 0\n end\n hash[player_id] = points\n end\n\n unit_ids = units.map(&:id)\n # Delete units and other units inside those units.\n where(:id => unit_ids).delete_all\n\n # Remove army points & recalculate population when losing units.\n # We need to recalculate population after deletion from DB.\n grouped_units.keys.each do |player_id|\n points = army_points[player_id]\n player = Player.find(player_id)\n player.recalculate_population\n change_player_points(player, points_attribute, -points)\n end\n\n eb_units = killed_by.nil? ? units : CombatArray.new(units, killed_by)\n\n EventBroker.fire(eb_units, EventBroker::DESTROYED, reason)\n\n true\n end\n end",
"title": ""
},
{
"docid": "583b0315cd941d03d562d518e677e3c8",
"score": "0.5053394",
"text": "def incomplete_tasks\n # TODO: refactor with reject\n incomplete = []\n categories.each { |c| incomplete << c if c.incomplete? }\n incomplete.sort_by { |c| [-c.percent_incomplete, -c.total_min_incomplete] }\n end",
"title": ""
},
{
"docid": "7cd3814a4cdd4a72174575dcffbcd54f",
"score": "0.5048738",
"text": "def unfilled_requests\n doctor.consultation_requests.in_status(:new).order(created_at: :asc)\n end",
"title": ""
},
{
"docid": "2eee3ce5849da23abd9a212f5e879928",
"score": "0.5038702",
"text": "def incomplete_due_reminders\n # self.reminders.select { |reminder| (reminder.is_due? && !reminder.complete && !reminder.checked) }\n self.reminders.where('datetime < ? AND (complete IS NULL OR complete IS FALSE) AND checked IS FALSE', Time.zone.now)\n end",
"title": ""
},
{
"docid": "ebd15eb564a1f19994c542ef013261b2",
"score": "0.50346446",
"text": "def all_that_are_uncompleted\n all_uncomplete = descendants.uncompleted.to_a\n all_uncomplete.prepend self if date_completed.blank?\n all_uncomplete\n end",
"title": ""
},
{
"docid": "f7eb9abb61e253cfa4e97c8ba082ee0a",
"score": "0.5025265",
"text": "def incomplete\n self.by_status(:incomplete)\n end",
"title": ""
},
{
"docid": "b347924342cb76c6f9f887f7af147b10",
"score": "0.5022748",
"text": "def available_units\n # # Get weight measurements\n # weight_units = Measured::Weight.unit_names\n \n # # Get volume measurements\n # volume_units = Measured::Volume.unit_names\n\n # # Combine both arrays\n # all_units = weight_units | volume_units\n\n # Too many extraneous units. Manual list easier.\n all_units = ['gram', 'kg', 'lb', 'oz', 'liter', 'gal', 'qt', 'pt', 'us_fl_oz', 'tsp', 'tbsp', 'cup', 'each'].sort\n return all_units\n\tend",
"title": ""
},
{
"docid": "0b4c040fae50d861711bbeedb3e797b7",
"score": "0.5021073",
"text": "def excluded_states\n [\n RetentionSchedule::STATE_ANONYMISED,\n ]\n end",
"title": ""
},
{
"docid": "025dfafa792edfbd7c040b086dc36deb",
"score": "0.5020731",
"text": "def orders\n #user_orders = Order.where(email: email)#.where.not(status: \"pending\")\n user_orders = Order.where([\"email = ? and status != ?\", email, \"pending\"])\n return user_orders\n end",
"title": ""
},
{
"docid": "fa1cdd97602913afaabb19fc9fc46f25",
"score": "0.49988073",
"text": "def incomplete_tests\n return self.product_tests.select do |test|\n test.reported_results.nil?\n end\n end",
"title": ""
},
{
"docid": "df7f268718a49820a9d2cb93c89f17d2",
"score": "0.49946967",
"text": "def residential_units(status=nil)\n ids = self._get_listings_by_status(self.primary_units, status).ids +\n self._get_listings_by_status(self.primary2_units, status).ids\n ResidentialListing.for_units(ids)\n end",
"title": ""
},
{
"docid": "5e30fa5c1178c7661ec8434932905d63",
"score": "0.49883196",
"text": "def index\n @incomplete_orders = Order.where(status: 'open')\n @complete_orders = Order.where(status: %w[finalized ordered delivered])\n end",
"title": ""
},
{
"docid": "bdc44c3ad140a2390b1649f19e1c0d14",
"score": "0.49844533",
"text": "def getOutstandingOrders(sym = nil, otype = nil, orderID = nil)\n aos = App.EM.broker.getOrderStatus\n aos.delete_if {|os| os.symbol != sym} unless sym.nil?\n aos.delete_if {|os| os.orderStatus != otype} unless otype.nil?\n aos.delete_if {|os| os.orderID != orderID} unless orderID.nil?\n aos\n end",
"title": ""
},
{
"docid": "ce19f6080935c0612887ebbad9075eda",
"score": "0.4974143",
"text": "def prepaid_units\n return @prepaid_units\n end",
"title": ""
},
{
"docid": "bb786e755a8d103a8968cad7dc30d048",
"score": "0.49740794",
"text": "def reserved_tickets\n\t\ttickets.select {|t| t.status == 'reserved'}\n\tend",
"title": ""
},
{
"docid": "a59874b946476495698c4f3432d50ac6",
"score": "0.4969613",
"text": "def list_inactive_items\r\n Models::System.instance.fetch_items_of(self.id).select {|s| !s.is_active?}\r\n end",
"title": ""
},
{
"docid": "c9ee2e561b83aeb4eb10fec49fc65009",
"score": "0.49685532",
"text": "def find_confirmed_unshipped_to_be_cancelled\n find_confirmed_past_handling_by(confirmed_unshipped_cancellation_buffer)\n end",
"title": ""
},
{
"docid": "2d67d0f80ef66b6e870a2e8a819e1d56",
"score": "0.49674052",
"text": "def prepare_select\n @unit_items = UnitItem.where('free = ?', false)\n end",
"title": ""
},
{
"docid": "829e60144134e69ede88d9d62eb475bb",
"score": "0.49667197",
"text": "def in_progress\n order_statuses.any? && (order_statuses.map(&:downcase) & ['creating', 'in progress', 'not_validated', 'validated', 'quoting', 'quoted', 'quoted_with_exceptions', 'submitting', 'submitted_with_exceptions', 'processing', 'processing_with_exceptions', 'cancelling']).any?\n end",
"title": ""
},
{
"docid": "2095c97d16d1cf5c24d020e44c4b8db4",
"score": "0.4957088",
"text": "def processing_processables\n all_statuses.lazy.reject { |status| status[:processed] }\n end",
"title": ""
},
{
"docid": "da3f521fef46cd738804b749061bfe22",
"score": "0.49517637",
"text": "def units(gc)\r\n used = {}\r\n units = []\r\n \r\n self.required_types.each do |type|\r\n # TODO: sort by pc.card.age DESC\r\n gc.player.player_cards(type).each do |pc|\r\n if pc.yellow_tokens - used[pc.id].to_i > 0\r\n \r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "44fef3811ca3efc29ef35e5fc484042c",
"score": "0.49459302",
"text": "def list_undelivered_orders\n orders = @order_repo.undelivered_orders\n @orders_view.display(orders)\n end",
"title": ""
},
{
"docid": "7233a5c094156cdf739cec7662130daa",
"score": "0.49441996",
"text": "def out_of_stock_unfulfilled_line_items\n self.unfulfilled_line_items.select { |li| !li.product.copy_available? }\n end",
"title": ""
},
{
"docid": "27910ba8c4d61b0a701a3f3ddd8e2e98",
"score": "0.49434018",
"text": "def valid_discounts\n adjustments(eligible.map(&:id))\n end",
"title": ""
},
{
"docid": "4b9d93c1f1b8a4440ea1c7adc8285dbc",
"score": "0.49416873",
"text": "def pending_objects\n Order.where(\"shipped_at IS NOT NULL AND invoice_sent_at IS NULL\")\n end",
"title": ""
},
{
"docid": "9c2aea884483ae3422c3bfe4f0f73984",
"score": "0.4938384",
"text": "def unneeded_events\n useful_events = self.useful_events\n\n result = (free_events - useful_events)\n result.delete_if do |ev|\n transactions.any? { |trsc| trsc.find_local_object_for_event(ev) }\n end\n result\n end",
"title": ""
},
{
"docid": "60072766982c9af43899f4aa628c6eae",
"score": "0.49308243",
"text": "def with_units\n self.find_all { |person| person.units.size > 0 }\n end",
"title": ""
},
{
"docid": "60072766982c9af43899f4aa628c6eae",
"score": "0.49308243",
"text": "def with_units\n self.find_all { |person| person.units.size > 0 }\n end",
"title": ""
},
{
"docid": "86298922138b112fc1e25a43e061d6d8",
"score": "0.4924555",
"text": "def unreturned_line_items\n self.uncancelled_and_actionable_line_items.select do |li|\n li.dateBack.nil? && li.copy && !DeathLog::NOT_CUSTOMER_FAULT_IF_NOT_RETURNED.include?(li.copy.death_type_id)\n end\n end",
"title": ""
},
{
"docid": "4ce11e16990ca7125c81f74e8f953134",
"score": "0.49208438",
"text": "def incomplete(selected_tests = select_tests)\n selected_tests.select(&:crashed?)\n end",
"title": ""
},
{
"docid": "a6b1730c8775254fdcf6947fd0dd9492",
"score": "0.4916176",
"text": "def univ_orders_live()\n Order.for_cust(self).for_univ_any.select{ |o| o.live}\n end",
"title": ""
},
{
"docid": "90cc10e31613f69c9144d6acee0a873b",
"score": "0.49112546",
"text": "def clean_orders\n Ccorder.delete_all([\"ordertype = 'unspecified' AND date_added < ?\", Time.now - 12.hours])\n end",
"title": ""
},
{
"docid": "80afd6d98dd85d97070c505a9ba8ab4b",
"score": "0.4906939",
"text": "def units\n if is_root?\n Unit.all\n else\n scope = Unit.scoped\n scope = scope.joins(\"INNER JOIN permissions ON permissions.unit_id = units.id\")\n scope = scope.where(\"(permissions.principal_id = ? AND permissions.principal_type = 'User')\n OR (permissions.principal_id IN (?) AND permissions.principal_type = 'UserGroup')\", \n id, group_ids).uniq \n end\n end",
"title": ""
},
{
"docid": "8cade31581972378b2a48c6925ebd1d7",
"score": "0.49044082",
"text": "def accessible_units\n @accessible_units ||= Unit.accessible_by(current_user)\n end",
"title": ""
},
{
"docid": "5973829e024ad2418bdcd04ce2e7f553",
"score": "0.489953",
"text": "def not_completed\n stories.reject(&:completed?)\n end",
"title": ""
},
{
"docid": "749082870c589339207773369aed8bd9",
"score": "0.48979992",
"text": "def eligible\n actions.select { |action| action.promotion.eligible? order }\n end",
"title": ""
},
{
"docid": "34284fe14185051ea9d679fa94ea4cdf",
"score": "0.48971266",
"text": "def incomplete\n @list_items.select do |list_item|\n !list_item.is_complete?\n end\n end",
"title": ""
},
{
"docid": "e9682432982b937ab9145b06c39222ae",
"score": "0.48934102",
"text": "def non_deleted_campaigns\n campaigns.where('campaigns.status <> :s', s: CAMPAIGN_STATUS_DELETED)\n end",
"title": ""
},
{
"docid": "25ef2e1f89a76f5e7d4b42d57b6fa083",
"score": "0.4885624",
"text": "def unapproved_group_weekly_payments\n result_list = TransactionActivity.where(\n :member_id => self.member_id , \n :loan_type => LOAN_TYPE[:group_loan], # if we have personal-periodic loan... loan type is not a problem any more\n :loan_id => self.group_loan_id, \n :transaction_case => (BASIC_WEEKLY_PAYMENT_START..BASIC_WEEKLY_PAYMENT_END) ,\n :is_approved => false , \n :is_deleted => false, \n :is_canceled => false \n )\n \n if result_list.length == 0 \n result_list = TransactionActivity.where(\n :member_id => self.member_id , \n :loan_type => LOAN_TYPE[:group_loan], # if we have personal-periodic loan... loan type is not a problem any more\n :loan_id => self.group_loan_id, \n :transaction_case => TRANSACTION_CASE[:weekly_payment_only_savings] ,\n :is_approved => false , \n :is_deleted => false, \n :is_canceled => false \n )\n end\n \n return result_list \n end",
"title": ""
},
{
"docid": "02dbdde7f3c2b415cb889d95ea2bbcdb",
"score": "0.48854965",
"text": "def parse_total_units(status)\n if (units = status.try(:[], 'cumulativeUnits')) && (total = units.find { |u| u['type'] && u['type']['code'] == 'Total'})\n total_units = total.try(:[], 'unitsCumulative').to_f\n transfer_units_accepted = total.try(:[], 'unitsTransferAccepted').to_f\n testing_units = total.try(:[], 'unitsTest').to_f\n end\n {\n totalUnits: total_units,\n transferUnitsAccepted: transfer_units_accepted,\n testingUnits: testing_units\n }\n end",
"title": ""
},
{
"docid": "a9508b33d8bb834105b7d3ee1be0297d",
"score": "0.48802537",
"text": "def invalid_status\n [\n {\n 'id' => 'P9S4RFU',\n 'name' => 'External: Appeals',\n 'description' => 'https://github.com/department-of-veterans-affairs/devops/blob/master/docs/External%20Service%20Integrations/Appeals.md',\n 'auto_resolve_timeout' => 14_400,\n 'acknowledgement_timeout' => nil,\n 'created_at' => '2019-01-10T17:18:09-05:00',\n 'status' => 'fine',\n 'last_incident_timestamp' => '2019-03-01T02:55:55-05:00',\n 'teams' => [],\n 'incident_urgency_rule' => {\n 'type' => 'use_support_hours',\n 'during_support_hours' => {\n 'type' => 'constant',\n 'urgency' => 'high'\n },\n 'outside_support_hours' => {\n 'type' => 'constant',\n 'urgency' => 'low'\n }\n },\n 'scheduled_actions' => [],\n 'support_hours' => {\n 'type' => 'fixed_time_per_day',\n 'time_zone' => 'America/New_York',\n 'days_of_week' => [\n 1,\n 2,\n 3,\n 4,\n 5\n ],\n 'start_time' => '09:00:00',\n 'end_time' => '17:00:00'\n },\n 'escalation_policy' => {\n 'id' => 'P6CEGGU',\n 'type' => 'escalation_policy_reference',\n 'summary' => 'Kraken Critical',\n 'self' => 'https://api.pagerduty.com/escalation_policies/P6CEGGU',\n 'html_url' => 'https://dsva.pagerduty.com/escalation_policies/P6CEGGU'\n },\n 'addons' => [],\n 'alert_creation' => 'create_alerts_and_incidents',\n 'alert_grouping' => nil,\n 'alert_grouping_timeout' => nil,\n 'integrations' => [\n {\n 'id' => 'P3SDLYP',\n 'type' => 'generic_events_api_inbound_integration_reference',\n 'summary' => 'Prometheus: Appeals',\n 'self' => 'https://api.pagerduty.com/services/P9S4RFU/integrations/P3SDLYP',\n 'html_url' => 'https://dsva.pagerduty.com/services/P9S4RFU/integrations/P3SDLYP'\n }\n ],\n 'response_play' => nil,\n 'type' => 'service',\n 'summary' => 'External: Appeals',\n 'self' => 'https://api.pagerduty.com/services/P9S4RFU',\n 'html_url' => 'https://dsva.pagerduty.com/services/P9S4RFU'\n }\n ]\nend",
"title": ""
},
{
"docid": "79a97161dd868a2b8a56db895151cda2",
"score": "0.48768386",
"text": "def unit_options(units, selected_unit = nil)\n units\n .map { |u| HashUtils.compact(u) }\n .map { |unit|\n renamed = HashUtils.rename_keys({name_tr_key: :unit_tr_key, selector_tr_key: :unit_selector_tr_key}, unit)\n {\n display: translate_unit(unit[:unit_type], unit[:name_tr_key]),\n value: unit.to_json,\n kind: unit[:kind],\n selected: selected_unit.present? && HashUtils.sub_eq(renamed, selected_unit, :unit_type, :unit_tr_key, :unit_selector_tr_key)\n }\n }\n end",
"title": ""
},
{
"docid": "5dd567675be944a0d7b97a7101534d63",
"score": "0.48764184",
"text": "def all_incomplete_this_month\n due_current_month | incomplete_without_due_date\n end",
"title": ""
},
{
"docid": "519bddf2e185ae160c585e5b1e6e5a44",
"score": "0.48757836",
"text": "def valid_payment_entries\n EntryCollection.new(payment_entries.reject { |e| e.status == CustomerPayment::STATUS_REJECTED })\n end",
"title": ""
},
{
"docid": "ef6fb24ef77d779d30e019f117faaa18",
"score": "0.48702684",
"text": "def unclaimed_taggings\n taggings.all.compact.reject { |t| t.tag.badge? || !t.user_taggings.claimed.empty? }\n end",
"title": ""
},
{
"docid": "ea194af057510cf9e60556ec810b6b7e",
"score": "0.4865995",
"text": "def get_eligible\n yesterday = DateTime.now - 1\n orders = ShopifyAPI::Order.all\n # Orders which have been fulfilled recently.\n orders.select do |order|\n order.fulfillment_status && \n order.fulfillments &&\n order.financial_status == \"paid\" &&\n order.fulfillments.first.status == \"success\" && \n order.fulfillments.first.updated_at < yesterday && \n order.fulfillments.first.updated_at >= @start_date &&\n has_discount_code?(order.note)\n end\nend",
"title": ""
},
{
"docid": "cb85a3b2b40e9df57e2d3b9541342f7c",
"score": "0.48655316",
"text": "def without_drug_orders\n list = []\n @check_orders.each do |record|\n result = ActiveRecord::Base.connection.select_one <<~SQL\n SELECT count(*) as count FROM orders AS art_order\n INNER JOIN drug_order ON drug_order.order_id = art_order.order_id\n AND drug_order.quantity > 0\n where art_order.patient_id = #{record}\n AND art_order.concept_id IN (SELECT concept_id FROM concept_set WHERE concept_set = 1085)\n AND art_order.order_type_id IN (SELECT order_type_id FROM order_type WHERE name = 'Drug order')\n AND art_order.voided = 0\n SQL\n list << record if result['count'].to_i.positive?\n end\n @we_dont_know = list\n @check_orders - list\nend",
"title": ""
},
{
"docid": "41b47ce02085ff043b2f34d8321dd0a6",
"score": "0.48585966",
"text": "def cancel_base_units!(*units)\n @base_units.cancel!(*units)\n initialize_attributes\n end",
"title": ""
},
{
"docid": "1a2e26fc259f75b31b2c741d61db115a",
"score": "0.48543537",
"text": "def rounds_with_non_submitted_poem\n self.all_active_rounds.select do |round|\n !self.poems.find_by(:round_id => round.id).submitted?\n end\n end",
"title": ""
}
] |
b7b85aa55b388b39f933b620af0a393f
|
Problem 2: You have array of integers. Write a recursive solution to determine whether or not the array contains a specific value.
|
[
{
"docid": "bbe60dc9c2c142123deae6763692ab6b",
"score": "0.0",
"text": "def includes?(array, target)\n\treturn false if array.empty?\n\treturn true if array.last == target\n\n\tincludes?(array[0...-1], target)\nend",
"title": ""
}
] |
[
{
"docid": "e92c7b777e5c6cbcf0259b9812c77fea",
"score": "0.7588491",
"text": "def array_42(array)\n return array.include?(42)\nend",
"title": ""
},
{
"docid": "e92c7b777e5c6cbcf0259b9812c77fea",
"score": "0.7588491",
"text": "def array_42(array)\n return array.include?(42)\nend",
"title": ""
},
{
"docid": "bcd58ea66b9a06bbb1269f38ac627672",
"score": "0.7502065",
"text": "def array_42(array)\n array.include?(42)\nend",
"title": ""
},
{
"docid": "b6eba04770ddb0bc8dba5e436bd7d021",
"score": "0.7493316",
"text": "def array_42(numbers_array)\n return numbers_array.include?(42)\nend",
"title": ""
},
{
"docid": "21daf67aad608453bfbe207d1cc10136",
"score": "0.74777436",
"text": "def array_42 (array)\n array.include?(42)\nend",
"title": ""
},
{
"docid": "338b5692414640746684899f80955d2a",
"score": "0.74264085",
"text": "def array_42(array)\n array.include? 42\nend",
"title": ""
},
{
"docid": "99988435a9fe964e56f3d7e01ffbc54a",
"score": "0.73786306",
"text": "def array_42(array)\n array.include?(42) ? true : false\nend",
"title": ""
},
{
"docid": "e92d1ff2faf504aa3d97193c2fbc4456",
"score": "0.7333637",
"text": "def contains(array, val)\n if array.length == 0\n return false\n end\n i = 0\n while i < array.length\n if array[i] == val\n return true\n end\n i += 1\n end\n return false\nend",
"title": ""
},
{
"docid": "2f9a711007d98b7f5a226cc72df80294",
"score": "0.7322174",
"text": "def array_42(a)\n if a.include?(42)\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "d22e68a2227ca4b99e28564a9243eef2",
"score": "0.7314357",
"text": "def array_42(array)\n array.include? (42)\n end",
"title": ""
},
{
"docid": "6187b9df20ceeefe19129e4f4f4fcef4",
"score": "0.7288532",
"text": "def contains?(arr,val)\n ind=0\n while ind < arr.length do\n if arr.include?(val)\n return true\n else\n return false\n ind += 1\n end\n end\nend",
"title": ""
},
{
"docid": "49898fd4843d47eada2c6e8bc203ee41",
"score": "0.72693247",
"text": "def array_42(a)\n\ta.any?{|x| x == 42}\nend",
"title": ""
},
{
"docid": "79e6e6a1f08aeaae3b507bc11cef2ba8",
"score": "0.72557294",
"text": "def include?(array, value)\n !array.select {|num| num == value}.empty?\nend",
"title": ""
},
{
"docid": "f53b0a0be7f75ccea97bf253f6f4bac9",
"score": "0.72525847",
"text": "def found_number_in_array_v2?(array, number)\n found_number = false\n array.each {|item| found_number = true if item == number}\n found_number\nend",
"title": ""
},
{
"docid": "cbdc80eb990457ad1dd49ae5983b598e",
"score": "0.7217717",
"text": "def include?(array, value)\n index = 0\n loop do\n break if index == array.size\n return true if value == array[index]\n index += 1\n end\n false\nend",
"title": ""
},
{
"docid": "cab930074f8d36c3708f482889d3c464",
"score": "0.71525514",
"text": "def check_for_existing_value(array, value)\n return array.include? value\nend",
"title": ""
},
{
"docid": "aa881e5bb34483439299436e84c9ae66",
"score": "0.7124649",
"text": "def include?(array_to_check, value)\n i = 0\n in_array = false\n while i < array_to_check.length\n in_array = true if array_to_check[i] == value\n i += 1\n end\n in_array\nend",
"title": ""
},
{
"docid": "3a84bdf92c998573e43c8ecc6f481298",
"score": "0.70825934",
"text": "def includes?(array, num)\n array.each { |n| return true if num == n} \n false\nend",
"title": ""
},
{
"docid": "58a341b1f8262ce8c7124f085eecc5af",
"score": "0.7074076",
"text": "def search(array, value)\n if array[0] == value\n return true\n elsif array == []\n return false\n else\n return search(array[1..array.length], value)\n end\nend",
"title": ""
},
{
"docid": "3b87e5b03e45f07f096d62af77914af2",
"score": "0.70722765",
"text": "def include?(arr, num)\n\n if arr.empty?\n return arr == num\n else \n arr.find {|element| element == num} == num\n end\n\nend",
"title": ""
},
{
"docid": "600545bff5ccfcfaa05e27bd22ec4af7",
"score": "0.7059601",
"text": "def array_42(array)\n there_is_42 = 0\n array.each do |i|\n if i == 42 \n there_is_42 += 1\n end\n end\n if there_is_42 > 0\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "66b6d28c78b22e17f77558b14a73c41f",
"score": "0.70140487",
"text": "def search(array, value)\n if array.length == 0\n return false\n elsif array.length >= 1 && array[0] == value\n return true\n else\n return search(array[1...array.length], value)\n end\nend",
"title": ""
},
{
"docid": "9b3ed4968d5242f0d3c289442cc1df13",
"score": "0.69940686",
"text": "def contains(value)\n if (@arr.any? {|elem| elem == value})\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "f55e6ca3e4aee4cb57fea4c9f5c4385e",
"score": "0.6992792",
"text": "def search(array, value)\n def search_value(array,array_length,value,index)\n while index < array_length\n if array[index] == value\n return true\n else\n index += 1\n search_value(array,array_length,value,index)\n end\n end\n return false\n end\n\n return false if array.length == 0\n return search_value(array,array.length,value,0)\nend",
"title": ""
},
{
"docid": "1adc024f5fe1945c335a0f24461b89ba",
"score": "0.69864184",
"text": "def include?(array, value)\n p !!array.find_index(value)\nend",
"title": ""
},
{
"docid": "fd48cc765eec7db883f79faa327add5f",
"score": "0.6983109",
"text": "def array_42 (a)\n\ta.include?(42)\nend",
"title": ""
},
{
"docid": "8c6d23ebc42eef5a8af286b19e219d9a",
"score": "0.6982218",
"text": "def array_42(array)\n array.to_a.include? (42)\n end",
"title": ""
},
{
"docid": "6e64b71158f7825f2152931e8e81a038",
"score": "0.6981017",
"text": "def include?(arr, value)\n index = 0\n while index < arr.length\n return true if arr[index] == value\n index += 1\n end\n false\nend",
"title": ""
},
{
"docid": "48d7fa87413b7406b6ee356e18e40a8d",
"score": "0.6980964",
"text": "def include?(array_of_integers, integer)\n array_of_integers.each do |num|\n return true if num == integer\n end\n false\nend",
"title": ""
},
{
"docid": "40a06b7f1bdce12287b321e469095619",
"score": "0.6979447",
"text": "def include?(array, value)\n return false if array.empty?\n value == array.find{|x| x == value}\nend",
"title": ""
},
{
"docid": "e4b2d65037c70c369fdab63066c30671",
"score": "0.69764006",
"text": "def check_for_number(number, array)\n if array.include?(number)\n puts \"This array does include #{number}\"\n else\n puts \"This array does not include #{number}\"\n end\nend",
"title": ""
},
{
"docid": "a21d7afecdcb899a900cd66bf69cfa0e",
"score": "0.6952805",
"text": "def search(array, value)\n if array.length == 0\n return false\n elsif array[0] == value\n return true\n end\n\n return search(array[1...array.length], value)\n \nend",
"title": ""
},
{
"docid": "990f1c348590a12cc3d62fab7802622b",
"score": "0.6950829",
"text": "def search(array, value)\n if array == []\n return false\n end\n if array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "6e34e1baecf7ea88307e391cb3ac248c",
"score": "0.6946937",
"text": "def search_array(array, value)\n puts array.include?(value)\nend",
"title": ""
},
{
"docid": "3fd0f171f9291b07eda092bb9af55c0e",
"score": "0.6937774",
"text": "def search(array, value)\n if array == []\n return false\n end\n\n if array[0] == value\n return true\n end\n\n return search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "136103de381ed72c88ec1ad44a20ef61",
"score": "0.69257396",
"text": "def containsValue(array, val)\n array.each do |item|\n return true if item == val\n end\n\n return false\nend",
"title": ""
},
{
"docid": "fd5cfb4a39fd5113dca97183dbf16edb",
"score": "0.6907201",
"text": "def include?(arr, int)\n arr.each { |element| return true if element == int }\n false\nend",
"title": ""
},
{
"docid": "028f5ce9fa4c77315c573e2846f35a9d",
"score": "0.6906827",
"text": "def search_array(arr, i)\nvalid_input = -1 #this make sures that the count starts from 0\nnilvar = true\narr.each do |integer| #need to iterate through each element of the array\n\tvalid_input +=1 #make sure the indexes increments by 1 level each time array goes through iteration\n\tif arr[valid_input] == i # if the array[valid input] is the same as the array element parameter, the valid input ie the correct index will be printed\n\t\t return valid_input #returns the input\n\t\t nilvar = false #if statement returns the nilvar will turn false\n\telse\n\tend\nend\nif nilvar \n\treturn nil\nelse\nend\nend",
"title": ""
},
{
"docid": "40a25bcb4d4be2c5677bbb2a9a21b3ad",
"score": "0.6902102",
"text": "def search(array, value)\n return false if array == []\n return true if array[0] == value\n return search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "2b06664b8ea282e7076bef0b360738ec",
"score": "0.6901537",
"text": "def include?(arr, num)\n arr.select { |i| i == num }.size > 0\nend",
"title": ""
},
{
"docid": "9983a83b8fd594952b5d6826af3a3ea1",
"score": "0.69012624",
"text": "def include2?(array, search_value)\n for i in 0..array.size - 1\n return true if array[i] == search_value\n end\n false\nend",
"title": ""
},
{
"docid": "a2a11fc73ddee42ad4f215537a639a5d",
"score": "0.6883393",
"text": "def search(array, value)\n if array[0] == value\n return true\n elsif array.length <= 1\n return false\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "d37b158adfab39aa6307f3c84e7e12b1",
"score": "0.6883357",
"text": "def search(array, value, i=0)\n # accepts an unsorted array of integers and an integer value to find and then \n # returns true if the value if found in the unsorted array and false otherwise. \n if array.empty?\n return false\n end\n if array[i] == value\n return true\n elsif array[i+1]\n return search(array, value, i+1)\n else \n return false\n end\n \nend",
"title": ""
},
{
"docid": "9dc053406754a29cdbfce44ee58a3bb4",
"score": "0.6880689",
"text": "def array_42(a)\n return a.any?{|i| i == 42} #marche pas avec a =~ /[42]/\nend",
"title": ""
},
{
"docid": "13d72e2940b8b6ce03e01fe3e48f3013",
"score": "0.68786716",
"text": "def search(array, value)\n if array[0] == value\n return true\n end\n if array.length > 1\n search(array[1..-1], value)\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "3e2cef609ccedc2bfd4ba9c0d83b6d77",
"score": "0.6875131",
"text": "def array_42(var)\n return var.include? 42\nend",
"title": ""
},
{
"docid": "5d5867eedb37854787d3dc7954cc9c9a",
"score": "0.6874107",
"text": "def search(array, value)\n if array.length == 0\n return false\n else\n if array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\n end\nend",
"title": ""
},
{
"docid": "27d5d053048f3f6dbd348c4b459c8946",
"score": "0.68697906",
"text": "def check_if_exist(arr)\n return false if arr.length == 0\n\n arr.each_with_index do |value1, i|\n arr.each_with_index do |value2, j|\n next unless value1 * 2 == value2\n return true unless value1 == 0 && i == j\n end\n end\n false\nend",
"title": ""
},
{
"docid": "c0918cebdc6d1a471b7ee6ef9d66eb09",
"score": "0.6856616",
"text": "def search(array, value)\n if array.length == 0\n return false\n elsif array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "c0918cebdc6d1a471b7ee6ef9d66eb09",
"score": "0.6856616",
"text": "def search(array, value)\n if array.length == 0\n return false\n elsif array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "2a8d05d744c5fdcc6cabfc47b0a26918",
"score": "0.68549883",
"text": "def include?(array , search_val)\n array.any? { |n| n == search_val }\nend",
"title": ""
},
{
"docid": "d0dd16effea9d8585ea77f8f2109115e",
"score": "0.6846803",
"text": "def any?(array) # this won't work with hashes!\n counter = 0\n while counter < array.size\n return true if yield(array[counter])\n counter += 1\n end\n false\nend",
"title": ""
},
{
"docid": "7dadd946b664be5c50613f0cf81f7b5f",
"score": "0.6835336",
"text": "def include?(arr,int)\n arr.any? { |el| el == int } \nend",
"title": ""
},
{
"docid": "f7279e1efb3c09140e4b30048250df57",
"score": "0.6828533",
"text": "def include?(array, value)\n !!array.find_index(value)\nend",
"title": ""
},
{
"docid": "f7279e1efb3c09140e4b30048250df57",
"score": "0.6828533",
"text": "def include?(array, value)\n !!array.find_index(value)\nend",
"title": ""
},
{
"docid": "f7279e1efb3c09140e4b30048250df57",
"score": "0.6828533",
"text": "def include?(array, value)\n !!array.find_index(value)\nend",
"title": ""
},
{
"docid": "f7279e1efb3c09140e4b30048250df57",
"score": "0.6828533",
"text": "def include?(array, value)\n !!array.find_index(value)\nend",
"title": ""
},
{
"docid": "cf0784ec3caff426f98d048a115af93a",
"score": "0.682614",
"text": "def search(array, value)\n return false if array.length == 0\n \n if array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\n \n return false\nend",
"title": ""
},
{
"docid": "c46dcbf7602aaf4371bb6d9f512b39f8",
"score": "0.68246216",
"text": "def search(array, value)\n if array.length == 0\n return false\n elsif value == array[0]\n return true\n else \n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "801f80988b69517b0f09476b81a8074c",
"score": "0.6820579",
"text": "def search(array, value)\n if array.length == 0\n return false\n end\n \n if array.first == value\n return true\n else\n search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "fb916445e4fff30569a6246348f3a8d6",
"score": "0.6820247",
"text": "def include?(array, num_to_search)\n return false if array.length == 0\n index = 0\n loop do\n if array[index] == num_to_search\n return true\n end\n index += 1\n break if index >= array.length\n end\n false\nend",
"title": ""
},
{
"docid": "52f13238dd63d2b71920e44f498deefa",
"score": "0.6819441",
"text": "def search(array, value)\n if array.length == 0\n return false\n end\n\n if array[0] == value\n return true\n end\n\n return search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "bc1a54ef14d98830bd1801ea14e90949",
"score": "0.68151015",
"text": "def search(array, value)\n if array.empty?\n return false\n elsif array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "98fef7e35bbe2bc0b6aa95a23db791de",
"score": "0.6805849",
"text": "def check_array(arr, num)\n\n if arr.include?(num) == true\n puts \"Array includes this number! Rad!\"\n else \n puts \"Array does not include this number, my man.\"\n end \nend",
"title": ""
},
{
"docid": "393a8d892f92a6fe46fe73d96268f732",
"score": "0.68048126",
"text": "def found_number_in_array_v3?(array, number)\n array.each { |item | p \"#{number} was found at index.\" if item == number}\nend",
"title": ""
},
{
"docid": "cd30712eb610192b7b2f204fbfc09349",
"score": "0.67992043",
"text": "def include?(array, value)\n return true if array.count(value) != 0\n false # must evaluate to false otherwise returns nil.\nend",
"title": ""
},
{
"docid": "ed27e06e6a046418826c7c6da9314cad",
"score": "0.6798971",
"text": "def search(array, value)\n if array[0] == value \n return true \n elsif array.length <= 1\n return false \n else \n return search(array[1..-1],value)\n end \nend",
"title": ""
},
{
"docid": "a437c912d6f5f4fe0ffbf1bb983f8793",
"score": "0.67970365",
"text": "def any?(array)\n counter = 0\n while counter < array.size\n if yield(array[counter])\n return true\n else\n counter += 1\n end\n end\n false\nend",
"title": ""
},
{
"docid": "a437c912d6f5f4fe0ffbf1bb983f8793",
"score": "0.67970365",
"text": "def any?(array)\n counter = 0\n while counter < array.size\n if yield(array[counter])\n return true\n else\n counter += 1\n end\n end\n false\nend",
"title": ""
},
{
"docid": "f424199c71a0a8db61f9ddb0207a072f",
"score": "0.67936957",
"text": "def include?(array, value)\n\tinside = false\n\tarray.each do |element|\n\t\tinside = true if element == value\n\tend\n\tinside\nend",
"title": ""
},
{
"docid": "5f6b61cfb6ca1d016585377a817d60d0",
"score": "0.6792926",
"text": "def search(_array, _value)\n if _array.empty?\n false\n else\n search_helper(0, _array, _value)\n end\nend",
"title": ""
},
{
"docid": "730bc5ce9eb2bc7e6e9508c4be787f9a",
"score": "0.67854786",
"text": "def search(array, value)\n if array[0] == nil || array.empty?\n return false\n elsif array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "0e56dfe57f0e77bd620d52ee3addf037",
"score": "0.67836213",
"text": "def check(arr,element)\n arr.include?(element)\nend",
"title": ""
},
{
"docid": "81cfae6f1a75953b590aab58cd5de892",
"score": "0.6781488",
"text": "def search(array, value)\n return false if array.empty?\n\n if array[0] == value\n return true\n else\n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "8e96372930ac46885996512d78691072",
"score": "0.67807937",
"text": "def include?(array, value)\n array.each do |val|\n if val == value\n return true\n end \n end \n false\nend",
"title": ""
},
{
"docid": "043dade3f7738201269b96eb93cc40e2",
"score": "0.6777815",
"text": "def search(array, value)\n return false if array.length == 0\n if array[0] == value\n return true\n else\n search(array[1..-1], value)\n end\n\n # else\nend",
"title": ""
},
{
"docid": "19dd97510b992eae4c2e28809dd47ed3",
"score": "0.67773414",
"text": "def search(array, value)\n return false if array.length == 0\n \n return true if array[0] == value\n \n search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "503b87c6a2865c23a4d998cac3c3fc05",
"score": "0.67737675",
"text": "def array_42 (a =[])\n\treturn a.include?(42)\nend",
"title": ""
},
{
"docid": "ed918cff3853659e44b27935633ff749",
"score": "0.6767949",
"text": "def check_array(nums)\n if(nums[0] == 4 || nums[0] == 7)\n\t\treturn true\n\tend\n\treturn (nums[1] == 4 || nums[1] == 7)\nend",
"title": ""
},
{
"docid": "87830bf5f1b39d8cbfd6eba9c768ddcf",
"score": "0.6766139",
"text": "def search(array, value)\n return false if array.length == 0\n return true if array[0] == value \n return search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "877b38e5a8a34e1bae92ee52d64ea50f",
"score": "0.67645025",
"text": "def include?(array, value)\n array.any? {|x| x == value }\nend",
"title": ""
},
{
"docid": "1e8bab3daf70d5c04502df89b1797edd",
"score": "0.6753603",
"text": "def include?(array, value)\n array.find_index(value) # this locates the index of the value if its in the array, otherwise nil is returned\nend",
"title": ""
},
{
"docid": "3c068f4644c0c22935634a7e890ef27b",
"score": "0.6748851",
"text": "def include?(array, num)\n result = []\n array.each do |item|\n result << item if item == num\n end\n if result.size > 0\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "9c9186d8f99c256a97ec642245f51289",
"score": "0.6747958",
"text": "def search(array, value)\n # raise NotImplementedError, \"Method not implemented\"\n if array.length == 0\n return false\n elsif value == array[0]\n return true\n else \n return search(array[1..-1], value)\n end\nend",
"title": ""
},
{
"docid": "b47feaf446eb9f2a9231f60ea9bacd4f",
"score": "0.6745998",
"text": "def include?(arr, search_value)\n found = false\n index = 0\n\n while !found && index < arr.size\n found = true if arr[index] == search_value\n index += 1\n end\n\n found\nend",
"title": ""
},
{
"docid": "ca9eff2b26c7e4ac9152e46ba7356b6a",
"score": "0.67446506",
"text": "def prac_search(arr, num)\n i = 0\n num_present = false\n while i<arr.length\n if num == arr[i]\n puts i\n num_present = true\n break\n else\n i += 1\n nil\n end\n if i >= arr.length && num_present == false\n p \"Entered value is not present in the array.\"\n end\n end\nend",
"title": ""
},
{
"docid": "b1b56f69a8d00ab13353d2e1dae4b3e2",
"score": "0.6737623",
"text": "def array_42(_arr)\n\t_b = _arr.include?(42)\n\t\n\tp _b\nend",
"title": ""
},
{
"docid": "2c904f5429f11ff048231545310f3e3a",
"score": "0.6735494",
"text": "def include?(arr, value)\n arr.count(value) > 0\nend",
"title": ""
},
{
"docid": "87628ec0f7eb2e64de666f960b8f5b11",
"score": "0.672959",
"text": "def search(array, value)\n return false if !array || array.length == 0\n return true if array[0] == value\n return search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "aca876524a6ef63b3cc3ed5cc02b113b",
"score": "0.6728501",
"text": "def search(array, value)\n if array == nil \n return false\n end\n if array[0] != value\n array.slice!(0)\n end\n return true if value == array[0]\n return false if array.length <= 1\n \n search(array, value)\nend",
"title": ""
},
{
"docid": "899cc5af1a9999aaa5434d2cf14abd71",
"score": "0.6727174",
"text": "def search(array, value)\n if array.length == 0\n return false\n end\n\n def search_helper(array, value ,index = 0)\n # two base cases\n return false if index > array.length - 1\n\n if array[index] == value\n return true\n else\n return search_helper(array, value, index + 1)\n end\n end\n \n return search_helper(array, value, index = 0)\nend",
"title": ""
},
{
"docid": "9447ba2486a5c7455eb0738b4735124e",
"score": "0.67257106",
"text": "def search(array, value)\n return false if array[0] == nil\n \n return true if array[0] == value\n \n search(array[1..-1], value)\nend",
"title": ""
},
{
"docid": "74c8d6ceb75bf7dce1401664d7c74570",
"score": "0.6718895",
"text": "def include?(array, num)\n included = false\n array.each do |element|\n if element == num\n included = true\n end\n end\n included\nend",
"title": ""
},
{
"docid": "ac4d2df83a86273509d45d32bffd0b69",
"score": "0.6716403",
"text": "def include?(array, element)\n index = array.size - 1\n loop do\n return false if index < 0\n return true if array[index] == element\n \n index -= 1\n end\nend",
"title": ""
},
{
"docid": "38519e8b93a41f09a448f95f1163be0e",
"score": "0.6709766",
"text": "def search(array, value)\n if array.count() == 0\n return false\n else\n return array.pop() == value || search(array, value)\n end\nend",
"title": ""
},
{
"docid": "52830b3942a986541d46e6860ec6275d",
"score": "0.6707489",
"text": "def include?(arr, num)\n new_arr = []\n\n arr.each do |item|\n if item == num\n new_arr << item\n end\n end\n if new_arr.empty?\n false\n else\n true\n end\nend",
"title": ""
},
{
"docid": "a04c675820dbf8fc0e9b704f8f133ad6",
"score": "0.67020875",
"text": "def include?(arr, search)\narr.any? { |num| num == search }\nend",
"title": ""
},
{
"docid": "271ce1363db62588baf2cbbb7a63c3c5",
"score": "0.6701226",
"text": "def search(array, value)\n if array.empty?\n return false\n end\n if array[0] == value\n return true\n else\n return search(array[1..array.length - 1], value)\n end\nend",
"title": ""
},
{
"docid": "8af9ec72b0333d364c95fa9bcbcf70fd",
"score": "0.67008466",
"text": "def is_omnipresent(arr, n)\n arr.all? { |a| a.include?(n)}\nend",
"title": ""
},
{
"docid": "6d41fbf7ab25e2323d03db8bce8f96c8",
"score": "0.66980124",
"text": "def bingo?(arr)\n arr.all?{|ele| ele == arr[0]}\nend",
"title": ""
},
{
"docid": "c7d04169e4a9421899779983d5c42efc",
"score": "0.6697817",
"text": "def search(array, value, index = 0 )\n return false if array == []\n return true if array[index] == value \n if (index < array.length) && (array[index] != value)\n return search(array,value,index + 1)\n end\n return false\nend",
"title": ""
}
] |
e947a645d79c991b334d40a2d1d2a67c
|
two part, capture words, use divide and conquer approach
|
[
{
"docid": "0128a91e252352bc47ec1250dc9cbb1d",
"score": "0.0",
"text": "def get_acceptable_words_new(file)\n @words_buffer = []\n File.open(file) do |f|\n f.each_line {|line|\n # grab word, add 1000 words to each Thread to be processed\n # is a single word per line\n @words_buffer << line.downcase.strip\n if @words_buffer.size > 1000\n breakdown(@words_buffer)\n @words_buffer = []\n end\n }\n end\nend",
"title": ""
}
] |
[
{
"docid": "b19c5e1b634459f4ba155ec279970ccd",
"score": "0.6710821",
"text": "def inside_out s\n #..\n word_arr = s.split(' ')\n\n word_arr.each do |word|\n mid = (word.length / 2).floor\n if word.length % 2 == 0\n first = word[0..mid]\n second = word[mid + 1..-1]\n \n temp_word = word.split('')\n temp_word.each do |letter|\n\n end\n end\nend\n\n\n\np inside_out('what time are we climbing up the volcano') #, 'hwta item are we milcgnib up the lovcona'",
"title": ""
},
{
"docid": "2cd808a5244c3a4f69eb7ad1f4829fd9",
"score": "0.66042596",
"text": "def extract_words(a_string)\n result = Array.new\n result_tree = extract_words_1(a_string)\n result << result_tree.map {|node| node.last}.join(' ')\n result_tree = extract_words_2(a_string)\n result << result_tree.map {|node| node.last}.reverse.join(' ')\n\n return result\nend",
"title": ""
},
{
"docid": "9548469502d7226e0f1bdf170865e67f",
"score": "0.6550059",
"text": "def Word(parts); end",
"title": ""
},
{
"docid": "d2b61636176ac9a960cd79552da9765d",
"score": "0.646117",
"text": "def Words(beginning, elements); end",
"title": ""
},
{
"docid": "2567880d237ecae244d2eceab674aa8e",
"score": "0.64525145",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n\nend",
"title": ""
},
{
"docid": "3f740eedc04c2f98f8c1120bc1fd9839",
"score": "0.63937944",
"text": "def get_subwords(word)\n word.underscore.\n gsub(\"_\", \" \").\n gsub(\"-\", \" \").\n split(\" \")\nend",
"title": ""
},
{
"docid": "c832005b001f7d6f9453cebfdac84a3b",
"score": "0.63677555",
"text": "def segment_string(str)\n array = str.split(\"\")\n result_array=[]\n new_array = []\n third_array = []\n string2 = \"\"\n string3 = \"\"\n string4 = \"\"\n word = \"\"\n word2 = \"\"\n until array.empty?\n string2 << array.shift\n if valid_word?(string2)\n word2 = string2.dup\n word = string2.dup\n new_array = array.dup\n until new_array.empty?\n string2 << new_array.shift\n if valid_word?(string2)\n word = string2.dup\n third_array = new_array.dup\n end\n third_array.each do |x|\n string3 << x\n if valid_word?(string3)\n else\n ##go back a step\n new_array.each do |x|\n string4 << x\n if valid_word?(string4) == false\n \n end\n word = word2.dup\n end\n end\n end\n end\n result_array << word\n string2 = \"\"\n word = \"\"\n end\n end\n p result_array\nend",
"title": ""
},
{
"docid": "281046e4763bf5af8f0af5e9d7e403b0",
"score": "0.6292246",
"text": "def extract_words_2(a_string, result=[], backup=0)\n return result if a_string.empty?\n\n words = find_valid_words(a_string, :backward)\n\n unless words.empty?\n result << words\n a_string = a_string.delete_suffix(words.last)\n\n result = extract_words_2(a_string, result)\n else\n if backup < 1\n result, a_string = backtrace_2(result, a_string)\n debug_me{[ :result, :a_string ]}\n result = extract_words_2(a_string, result, backup+1)\n debug_me{[ :result ]}\n else\n unless a_string.empty?\n # puts \"debug: found no words in: #{a_string}\"\n result << [a_string]\n end\n end\n end\n\n return result\nend",
"title": ""
},
{
"docid": "fbd740b3870a30b60d9fc09875bb8a9f",
"score": "0.6285521",
"text": "def _add_span2_GeFrEn(text, word, start_tag, end_tag)\n\n # => REF /#{}/ http://stackoverflow.com/questions/2648054/ruby-recursive-regex answered Apr 15 '10 at 18:48\n r = /#{word.w1}/\n marker = 0\n t1 = start_tag\n t2 = end_tag\n counter = 0\n \n new_text = []\n \n text_split = text.split(\" \")\n \n for i in (0..(text_split.length - 1))\n \n point = (r =~ text_split[i])\n # point = (r =~ text[marker..(text.size - 1)])\n \n if point\n # if r =~ text_split[i]\n \n text_split[i].insert(point, t1)\n \n \n text_split[i].insert(point + t1.size + r.source.size, t2)\n \n new_text << text_split[i]\n # new_text << t1 + text_split[i] + t2\n \n else\n \n new_text << text_split[i]\n \n end#if r =~ text_split[i]\n \n # # => REF =~ http://www.rubylife.jp/regexp/ini/index4.html\n # while r =~ text_split[i][marker..(text_split[i].size - 1)] do\n # # while r =~ text[marker..(text.size - 1)] && counter < maxnum do\n # #debug\n # logout(\"r=\" + r.source)\n# \n # point = (r =~ text[marker..(text.size - 1)])\n# \n # text.insert(marker + point, t1)\n # text.insert(marker + point + t1.size + r.source.size, t2)\n# \n # marker += point + t1.size + r.source.size + t2.size\n# \n # counter += 1\n# \n# \n # end#while r =~ text[marker..(text.size - 1)] && counter < maxnum do\n# \n end#for i in (0..(text_split.length - 1))\n \n return new_text.join(\" \")\n # return text\n \n end",
"title": ""
},
{
"docid": "b7306511402af3ebf75722a3fea86cb6",
"score": "0.62784994",
"text": "def QWords(beginning, elements); end",
"title": ""
},
{
"docid": "3cb85f54b6a7630527dd7dfd472137e1",
"score": "0.62215054",
"text": "def word_chain(target_words, readed_words, index)\n target_words.each_with_index.inject([]) do |acc, (word, target_index)|\n if target_index == target_words.size - 1\n # Last word, we only need to match the first part\n part = readed_words[index].word.split(/\\s/).first\n return unless equal_words?(part, word)\n elsif !equal_words?(readed_words[index].word, word)\n return\n end\n index += 1\n acc << readed_words[index - 1]\n end\n end",
"title": ""
},
{
"docid": "3d6f0e3a3f5a00d38bc39d7a2347ab4a",
"score": "0.61422795",
"text": "def extract_words(string)\n words = []\n (1..3).each do |length| #break the string by half at position 1,2,3\n first = string[0..length]\n second = string[length+1..string.size-1]\n \n if contain?(first.downcase) && contain?(second.downcase)\n words << [first, second]\n end\n end\n\n return words\n end",
"title": ""
},
{
"docid": "269756c28281c5f1b451f42420ae49df",
"score": "0.6108116",
"text": "def _add_span2(text, word, start_tag, end_tag)\n\n # => REF /#{}/ http://stackoverflow.com/questions/2648054/ruby-recursive-regex answered Apr 15 '10 at 18:48\n r = /#{word.w1}/\n marker = 0\n t1 = start_tag\n t2 = end_tag\n counter = 0\n \n # => REF =~ http://www.rubylife.jp/regexp/ini/index4.html\n while r =~ text[marker..(text.size - 1)] do\n # while r =~ text[marker..(text.size - 1)] && counter < maxnum do\n \n point = (r =~ text[marker..(text.size - 1)])\n \n text.insert(marker + point, t1)\n text.insert(marker + point + t1.size + r.source.size, t2)\n \n marker += point + t1.size + r.source.size + t2.size\n \n counter += 1\n \n \n end#while r =~ text[marker..(text.size - 1)] && counter < maxnum do\n \n return text\n \n end",
"title": ""
},
{
"docid": "d966c5c341625f24d921f7608601ff1c",
"score": "0.60862",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n#returns an array with the words starting with 'un' and ending with 'ing'\n text.scan(/un\\w+ing/)\n #text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "cbd4c77986f5982d42fd5efbbab3b7f5",
"score": "0.60709053",
"text": "def word_break_two(word, dict)\n word.length.times do |i|\n prefix = word[0..i]\n suffix = word[i+1..-1]\n return \"#{prefix} #{suffix}\" if \n dict.include?(prefix) && dict.include?(suffix)\n end\n \n nil\nend",
"title": ""
},
{
"docid": "0e73943a9c4472c92f7362d2bf9e5bf5",
"score": "0.6061285",
"text": "def dmetaphone word \n first,second = double_metaphone word\n second || first\nend",
"title": ""
},
{
"docid": "39e623b0b79353885ef9a2df99db4a25",
"score": "0.6057706",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/\\bun\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "b3e444a04ba080a196c83cf959110d3d",
"score": "0.6056312",
"text": "def get_words_from_char_array(final_char_array, result_array, result)\n first_word_array = []\n second_word_array = []\n first_char_array = final_char_array[0]\n second_char_array = final_char_array[1]\n first_word_array = get_word_array(first_char_array)\n second_word_array = get_word_array(second_char_array) unless first_word_array.empty?\n unless first_word_array.empty? && second_word_array.empty?\n first_word_array.each do |word1|\n second_word_array.each do |word2|\n final_word = word1 + word2\n if @@dict_map[final_word]\n result = final_word\n else\n result_array << [word1, word2]\n end\n end\n end\n end\n result\n end",
"title": ""
},
{
"docid": "5bcec2ed66155f7401ccf03296d5f4f7",
"score": "0.6047649",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un\\w+ing/)\nend",
"title": ""
},
{
"docid": "d6effa494b04478c5176dc74111ef2b3",
"score": "0.6041218",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un\\w+ing/)\nend",
"title": ""
},
{
"docid": "fa4ae36b4ff0301c7e7e77863f000e57",
"score": "0.60402167",
"text": "def word_pattern; end",
"title": ""
},
{
"docid": "13ddba704d6b094969fca6dd27e4e508",
"score": "0.6034112",
"text": "def split_words(sym); end",
"title": ""
},
{
"docid": "20030c8a498c1c9e1aea55c65bba0fd2",
"score": "0.6031741",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n # return an array (scan method)\n # find \"un\" string: un\n # match the word that has \"un\" string: \\w+\n # find \"ing\" string at the end of the word (\\b is a word boundary): ing\\b\n text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "1a9c177aa7bf9747bdcc86ac581aa418",
"score": "0.6029104",
"text": "def match_word(word)\n #print 'matching word, ', @stage, \"\\n\"\n syns = PrioritySet.new()\n # can_prefix means you can start/continue a prefix or just start the phrase\n # can_suffix means you've finished matching and can continue the phrase or just start a suffix\n if [:can_prefix, :on_prefix].include? @stage\n new_syn = match_prefix(word)\n syns << new_syn if !new_syn.nil?\n end\n if [:can_prefix, :on_phrase, :can_suffix].include? @stage\n new_syn = match_phrase(word)\n syns << new_syn if !new_syn.nil?\n end\n if [:can_suffix, :on_suffix, :finished].include? @stage\n new_syn = match_suffix(word)\n syns << new_syn if !new_syn.nil?\n end\n return syns\n end",
"title": ""
},
{
"docid": "a1a3a2392f66316905ceefa4bac6eb5f",
"score": "0.6016839",
"text": "def subwords(word, dictionary)\n arr = []\n subwords = []\n i = 0\n while i < word.length\n str = word[i]\n j = i + 1\n while j < word.length\n arr << str\n str += word[j]\n j += 1\n end \n i += 1\n end\n \n dictionary.each do |ele|\n if arr.include?(ele)\n subwords << ele\n end\n end\n\n p arr \n p subwords\n return subwords\n end",
"title": ""
},
{
"docid": "16e70cdf1e1f192eb19118263a276e40",
"score": "0.60126865",
"text": "def munsters_confusing_word_transformation(string)\n string_array = string.upcase!.split(' ').zip\n first_word = string_array[0]\n second_word = string_array[1]\n first_word_letters = first_word.join('').split('')\n second_word_letters = second_word.join('').split('')\n first_word_letters.unshift(first_word_letters[0].downcase)\n first_word_letters.delete_at(1)\n first_word_letters.join('')\n second_word_letters.unshift(second_word_letters[0].downcase)\n second_word_letters.delete_at(1)\n second_word_letters.join('')\n string_array.delete(string_array[0])\n string_array.delete(string_array[0])\n string_array.join(' ')\n puts \"#{first_word_letters.join('')} #{second_word_letters.join('')} #{string_array.join(' ')}\"\nend",
"title": ""
},
{
"docid": "0bc5c2b001ef9023e68b2b294885f9c3",
"score": "0.5998586",
"text": "def split_words\n self.scan SPLIT_REGEX\n end",
"title": ""
},
{
"docid": "59ece8beec13bcaa50053384ce085218",
"score": "0.5995872",
"text": "def oneAndTwoWordStrings(str)\n min_word_length = 3\n \tkeywords = str.split(' ').reject{ |word| word.length < min_word_length }\n \n \tn = keywords.length \n \tnewwords = (0..(n-2)).collect { |i| keywords[i] + \" \" + keywords[i+1] }\n \treturn (keywords + newwords)\n end",
"title": ""
},
{
"docid": "9b92162a6cfe7331a38c99ff60028d7e",
"score": "0.59912884",
"text": "def extract_words_1(a_string, result=[], backup=0)\n return result if a_string.empty?\n\n words = find_valid_words(a_string, :forward)\n\n unless words.empty?\n result << words\n a_string = a_string.delete_prefix(words.last)\n result = extract_words_1(a_string, result)\n else\n if 0 == backup # do only one backtrace\n result, a_string = backtrace(result, a_string)\n result = extract_words_1(a_string, result, backup+1)\n else\n unless a_string.empty?\n # puts \"debug: found no words in: #{a_string}\"\n result << [a_string]\n end\n end\n end\n\n return result\nend",
"title": ""
},
{
"docid": "33a052e61c8403c4fede4abe6118c97a",
"score": "0.5990152",
"text": "def match_stem(result, from_word)\n words = result.string.split(/\\b/)\n result_words = words.dup\n stems = words.map { |word| self.class.stem word.downcase }\n from_stem = from_word.split(/\\b/).map { |w| self.class.stem w }\n stems.each_index do |index|\n next unless stems[index, from_stem.size] == from_stem\n yield words, result_words, index..(index+from_stem.size - 1)\n end\n\n return result_words\n end",
"title": ""
},
{
"docid": "7daf79c73a3e08cc8e70f051e178ad67",
"score": "0.59894145",
"text": "def each_word_pair_cons\n # we operate on 2-word arrays now\n @content.split.each_cons(2) {|array| yield(array[0], array[1]) }\n end",
"title": ""
},
{
"docid": "6ccde9a1eeacaf43acbde3788263c364",
"score": "0.59879655",
"text": "def alternate_words(sentence)\n# this line takes all the chars that are to be excluded, splits them and assigns them to char, then\n# substitutes them with a blank space.\n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char|\n sentence = sentence.gsub(char, ' ')\n end\n# this line takes sentence, splits it into a new array, and assigns the array to words\n words = sentence.split\n# this is an empty array, waiting to be filled:\n return_to = []\n# this line takes the words array, splits it and assigns each object an index number\n words.each_with_index do |word, index|\n# this line adds the word into the return_to array if the index number is even\n return_to << word if index.even?\n end\n return_to\n end",
"title": ""
},
{
"docid": "f1e2be1e2651741f1199c2c66069a401",
"score": "0.59774756",
"text": "def substrings(word, substring_list)\n substring_list.reduce(Hash.new(0)) do |result, substring|\n result[substring] += word.scan(/(?=#{substring})/).count if word.include?(substring)\n result\n end\nend",
"title": ""
},
{
"docid": "33a05eba03efd3ff96497d5883718b57",
"score": "0.5968167",
"text": "def alternate_words (sentence)\n\t# I had to look for that first block. \n\t#I got close but the 2nd sentence was giving me [\"Can\", \"we\", \"get\"] because of '\n\t# and this part of the script array = sentence.scan(/\\w+/) had to be replaced with array = sentence.split for it to work.\n # \n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char|\n sentence = sentence.gsub(char, ' ')\n\tend\n\tarray = sentence.split\n\t# This part was working. Still does. \n\tnew_array=[]\n array.each.with_index do |word, index|\n new_array << word if index.even?\n end\nnew_array\nend",
"title": ""
},
{
"docid": "342868640b5f7c0f084f71938f702504",
"score": "0.5967577",
"text": "def expWords(words)\n expWords = []\n matches = {}\n words.each do |word|\n # compute l dist of each word to all other words\n words.each do |word2|\n # This if statement is kind of unnecessary\n if !matches[word]\n\n dist = ldist(word,word2)\n # if we find a good match we need to group them together / but i also need to go through the counts\n if dist > 0 && dist < 2\n matchWords = matches[word]\n if !matchWords\n matchWords = []\n end\n matchWords.push(word2)\n matches[word] = matchWords\n end\n end\n end\n\n end\n\n return matches\n end",
"title": ""
},
{
"docid": "45c58865f8b6ee4fa94d4876c3763eaa",
"score": "0.59512",
"text": "def next_words(word, words)\n\tnextw=[]\n\twords.each do |w|\n\t\tnextw << w if similar(word,w)\n\tend\n\treturn nextw\nend",
"title": ""
},
{
"docid": "7ac980c607f42a94988c901d1acd22df",
"score": "0.59496856",
"text": "def my_split(sentence)\n\n # make an array of words\n\n # have an results array\n\n results = []\n\n accumulator\n\n sentence.chars\n\nend",
"title": ""
},
{
"docid": "50075826bbda09833303d7629da0bef7",
"score": "0.5947135",
"text": "def fused_lexemes( part1, part2 )\n\n part1 ? part1_lexeme = $lexicon[part1] : part1_lexeme = ''\n part2 ? part2_lexeme = $lexicon[part2] : part2_lexeme = ''\n\n return [part1_lexeme, part2_lexeme].join( ' ' ).strip\n\nend",
"title": ""
},
{
"docid": "8258e20d3846dd2aa958375b1a943f10",
"score": "0.5937632",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un+\\S+ing/)\nend",
"title": ""
},
{
"docid": "608816406a587fae0481faea0417c9a6",
"score": "0.59334046",
"text": "def str_to_match_data(str, index=0)\n words = [ ]\n exclude = [ ]\n is_exclude = false\n\n while str[index]\n case str[index]\n when ?\", ?'\n word, index = get_word(str, index+1, str[index])\n unless word.empty?\n if is_exclude\n exclude.push word\n is_exclude = false\n else\n words.push word\n end\n end\n\n when 32 # space\n is_exclude = false\n\n=begin\n when ?>\n min, index = get_word(str, index+1)\n min = @gui.logic.size_to_nr(min)\n\n when ?<\n max, index = get_word(str, index+1)\n max = @gui.logic.size_to_nr(max)\n=end\n when ?-\n is_exclude = true\n\n else\n word, index = get_word(str, index)\n if is_exclude\n exclude.push word\n is_exclude = false\n else\n words.push word\n end\n end\n\n index += 1\n end\n\n # check if word has upcase letters\n words.collect! do |w|\n [w, /[A-Z]/.match(w)!=nil]\n end\n exclude.collect! do |w|\n [w, /[A-Z]/.match(w)!=nil]\n end\n [words, exclude]\n end",
"title": ""
},
{
"docid": "b03ba061a2d02d3797598bbcbadb73cc",
"score": "0.59312683",
"text": "def combine_splitted_wt(main_doc)\n remove_bookmarks main_doc\n # use highlight tag to get the whole variable string\n # since most variable strings have highlight tag\n main_doc.xpath('//w:highlight').each do |highlight_node|\n # jump to next node if cannot find text node \n next if !highlight_node.parent.next_element\n highlight_text = highlight_node.parent.next_element.content\n if highlight_node.parent.parent.next_element \n if highlight_node.parent.parent.next_element.name == 'r' \n next_highlight_node = highlight_node.parent.parent.next_element.xpath('.//w:highlight').first\n # go around the proofErr node\n elsif highlight_node.parent.parent.next_element.next_element && highlight_node.parent.parent.next_element.next_element.name = 'r'\n next_highlight_node = highlight_node.parent.parent.next_element.next_element.xpath('.//w:highlight').first\n end \n end \n while next_highlight_node\n highlight_text += next_highlight_node.parent.next_element.content\n next_highlight_node.parent.next_element.content = \"\"\n if next_highlight_node.parent.parent.next_element \n next_highlight_node = next_highlight_node.parent.parent.next_element.xpath('.//w:highlight').first\n else \n next_highlight_node = nil \n end \n end \n highlight_node.parent.next_element.content = highlight_text\n end \n end",
"title": ""
},
{
"docid": "b03ba061a2d02d3797598bbcbadb73cc",
"score": "0.59312683",
"text": "def combine_splitted_wt(main_doc)\n remove_bookmarks main_doc\n # use highlight tag to get the whole variable string\n # since most variable strings have highlight tag\n main_doc.xpath('//w:highlight').each do |highlight_node|\n # jump to next node if cannot find text node \n next if !highlight_node.parent.next_element\n highlight_text = highlight_node.parent.next_element.content\n if highlight_node.parent.parent.next_element \n if highlight_node.parent.parent.next_element.name == 'r' \n next_highlight_node = highlight_node.parent.parent.next_element.xpath('.//w:highlight').first\n # go around the proofErr node\n elsif highlight_node.parent.parent.next_element.next_element && highlight_node.parent.parent.next_element.next_element.name = 'r'\n next_highlight_node = highlight_node.parent.parent.next_element.next_element.xpath('.//w:highlight').first\n end \n end \n while next_highlight_node\n highlight_text += next_highlight_node.parent.next_element.content\n next_highlight_node.parent.next_element.content = \"\"\n if next_highlight_node.parent.parent.next_element \n next_highlight_node = next_highlight_node.parent.parent.next_element.xpath('.//w:highlight').first\n else \n next_highlight_node = nil \n end \n end \n highlight_node.parent.next_element.content = highlight_text\n end \n end",
"title": ""
},
{
"docid": "480a43e86340dcfc26311f7e9f52e7e7",
"score": "0.59144133",
"text": "def substrings2 *args\n dictionary = args.last.map { |word| word.downcase }\n strings = args[0..-2].map { |string| string.downcase }\n result_hash = Hash.new(0)\n strings.each do |string|\n dictionary.each do |word|\n result_hash[word] += 1 if string.include?(word) && word.length > 1\n end\n end\n result_hash\nend",
"title": ""
},
{
"docid": "d849d9fddca59a2fcc36a5628e2535f1",
"score": "0.5913866",
"text": "def find_matched_words(pattern, trials)\n matched_word = []\n @words.each do |w|\n if w.length != pattern.length\n next\n end\n match = true\n pattern.each_char.with_index do |c, i|\n if c != '_' and c != w[i]\n match = false\n break\n end\n\n if c == '_' and trials.include? w[i]\n match = false\n break\n end\n end\n matched_word << w if match\n end\n matched_word\n end",
"title": ""
},
{
"docid": "97fd4a7f4b77c95e007162d525e60af8",
"score": "0.5911825",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "a28181b1f485808fe65c6ff139545f2f",
"score": "0.5908939",
"text": "def words\n phrase.split\n end",
"title": ""
},
{
"docid": "1c61fa1692c35d65473bd5c2fcad408f",
"score": "0.59047335",
"text": "def subword_search(word)\n\t\tlength_match_list = @dictionary.find_all {|match| match.length < word.length }\n\t\tword_match_list = length_match_list.find_all {|match| word.chars.sort.join.include?(match.chars.sort.join)}\n\tend",
"title": ""
},
{
"docid": "6eb0397fd1dd89d29b9aef88893479e6",
"score": "0.5900217",
"text": "def process_match(left, right)\n end",
"title": ""
},
{
"docid": "64face08704da88a0e8cebf6fe5bd803",
"score": "0.5896547",
"text": "def mcw(word)\nbeginword = word + \" \"\n#endword = \" \" + word\nputs \"Searching: \" + word\n#-----------------------------------------------------------------\nif value = $bigrams.select { |key, value| key.start_with? beginword}\n\tputs \"Most used phrase starting with \" + word + \" was:\"\n\tp value.max_by{|k,v| v}[0]\n\tp value.max_by{|k,v| v}[1]\n\tvaluetest = value.max_by{|k,v| v}[0]\n\treturnValue = valuetest.gsub(/.*\\s/, '')\n\n\tp returnValue\n\treturn returnValue\nelse\n\tputs \"Error, #{item} not found!\"\nend\n#-----------------------------------------------------------------\n# determines most common word to come before word given\n#if value = $bigrams.select { |key, value| key.end_with? endword}\n#\tputs \"Most used phrase ending with \" + word + \" was:\"\n#\tputs value.max_by{|k,v| v}\n#else\n#\tputs \"Error, #{item} not found!\"\n#end\n#-----------------------------------------------------------------\n\nend",
"title": ""
},
{
"docid": "6e5e9b43169f0efe7cb40c4c1968b345",
"score": "0.5882204",
"text": "def get_matched_substrings(word)\n matched_substrings, length = [], wrong_word.length\n (0...length).each do |start_index|\n (start_index...length).each do |end_index|\n match = word.match(wrong_word[start_index..end_index])\n matched_substrings << match[0] if match\n end\n end\n matched_substrings\n end",
"title": ""
},
{
"docid": "2b28c4f0ad252283878209f8075a47b6",
"score": "0.58746076",
"text": "def decode_chunks(i,t1,t2,pl1,pl2)\n\t\t#The text ends on the middle of strings, truncated words\n\t\tif @xt.size <= i\n\t\t\tfound(pl1,pl2)\n\t\t\treturn\n\t\tend\n\n\t\t#t2 is the end of a word, start looking for another word\n\t\tif t2.terminal?\n\t\t\tself.next_word(i,pl2,pl1,t1)\n\t\tend\n\n\t\t#same with t1\n\t\tif t1.terminal?\n\t\t\tself.next_word(i,pl1,pl2,t2)\n\t\tend\n\n\t\t#advance pointer on t1 and t2\n\t\tt1.children_with(t2,@xt[i]).each do |n1,n2|\n\t\t\tself.decode_chunks(i+1,n1,n2,pl1+n1.state,pl2+n2.state)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3705c4536561627a83f07b0d3425bfab",
"score": "0.5871747",
"text": "def pairs(words, text)\n snippets = [[]]\n words.each_with_index do |e, i|\n next unless e.start_with? text\n pair = snippets.last\n pair << i if pair.size.zero? || pair.size == 1\n snippets[-1] = pair\n snippets << [] if pair.size == 2\n end\n snippets.select { |s| s.size == 2 }\n end",
"title": ""
},
{
"docid": "321aa47ba0a4acfb0c35ca0b41e39d9c",
"score": "0.58632517",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n array = []\n array2 = []\n array = text.split(\" \")\n array2 = array.grep(/\\bun\\w+ing\\b/)\n array2\nend",
"title": ""
},
{
"docid": "5168db176e596e43d3c2ad21856d9899",
"score": "0.58627534",
"text": "def traverse_step(word)\n defn = dict.get_definition(word)\n words = defn.split.map { |w| [w, dict.get_ref_count(w)] } unless defn.nil?\n return defn, words\n end",
"title": ""
},
{
"docid": "2844c730041492e84661de8c6be2b9da",
"score": "0.5858997",
"text": "def staggered_case(multi_word_string)\n word_arr = multi_word_string.split\n modified_arr = word_arr.map do |word|\n return_str = []\n word.split(\"\").each_with_index do |let, ind|\n if ind % 2 == 0\n return_str << let.upcase\n else\n return_str << let.downcase\n end\n end\n return_str.join\n end\n modified_arr.join\" \" \nend",
"title": ""
},
{
"docid": "f99160b2324ae5dae35525d802347836",
"score": "0.58585066",
"text": "def words_after(word)\n shakespeare = File.read(File.dirname(__FILE__) + '/Shakespeare.txt')\n shakespeare.scan(Regexp.new(word + ' (\\w+)')).uniq.flatten\nend",
"title": ""
},
{
"docid": "2d02b3a8f424d557083be303c94656e5",
"score": "0.58527106",
"text": "def subwords(word, dictionary)\n dictionary.select{ |substr|\n word.match(substr)\n }\nend",
"title": ""
},
{
"docid": "5c1cf01ef55585c2c1a9dd9d54fa0ede",
"score": "0.5850545",
"text": "def subwords(text, words)\n s = create_big_subletter_set(text)\n words.select { |word| @subletter_hash[word] <= s }\n end",
"title": ""
},
{
"docid": "ac4d83c4e80fd0e0ad6973be9a7f83a3",
"score": "0.5848528",
"text": "def each_word_pair\n\n words = @content.split\n for i in 0..words.size - 2\n yield(words[i], words[i + 1])\n end\n end",
"title": ""
},
{
"docid": "fdc8ab87b069e84cc18c266a2f1e2c6f",
"score": "0.58473605",
"text": "def convert (snippet, phrase)\n # sort the WORDS array randomly. rand_words is an array of the words in an random order\n rand_words = WORDS.sort_by {rand}\n # craft the class_names array\n class_names = craft_names(rand_words, snippet, /###/, caps=true)\n # craft the other_names array\n other_names = craft_names(rand_words, snippet, /\\*\\*\\*/)\n # craft the param_names array\n param_names = craft_params(rand_words, snippet, /@@@/)\n \n results = []\n \n # \"sentence\": do snippet, then phrase\n [snippet, phrase].each do |sentence|\n # replace all /###/ (stand for class name) with the last element of class_names\n result = sentence.gsub(/###/) {|x| class_names.pop}\n \n # replace all /\\*\\*\\*/ (stands for other names) with the last element of other_names\n result.gsub!(/\\*\\*\\*/) {|x| other_names.pop }\n \n # replace all /@@@/ with the last element of param_names\n result.gsub!(/@@@/) {|x| param_names.pop}\n \n # push the new \"sentence\" (now with the words put in) to the results array\n results.push(result)\n end\n \n return results\nend",
"title": ""
},
{
"docid": "b32e2d43d87e407e4a8a6c856dbde597",
"score": "0.5837582",
"text": "def handle_common_words(word)\n\t\treturn handle_of if word == \"of\"\n\t\treturn handle_and if word == \"and\"\n\t\treturn handle_to if word == \"to\"\n\t\tnil\n\tend",
"title": ""
},
{
"docid": "d65b9146093dc935cbec6d94d9d3c3ee",
"score": "0.5826109",
"text": "def scan\n data_str = $data.join('')\n $words = $words + data_str.split\nend",
"title": ""
},
{
"docid": "01fec65702deee713fe6601895a433fa",
"score": "0.5813669",
"text": "def words_with_part(part)\n words.select { |w| w.include?(part) }\n end",
"title": ""
},
{
"docid": "12e623a429e474055ad3e97f4fb9fc40",
"score": "0.58109105",
"text": "def adjacent_words(word, matches = [])\n @@dict.select do |match|\n if match.length == word.length\n word.length.times do |i| \n matches << match.join('') if word[0...i] + word[i+1..-1] == match.join('')[0...i] + match.join('')[i+1..-1]\n end\n end\n end\n matches.uniq\n end",
"title": ""
},
{
"docid": "459b7d53706b24991085f1e1e61b08d1",
"score": "0.5809025",
"text": "def split_second\n text = \"second\"\n [text[0..2], text[3..-1]]\n\n # option 2\n # text.scan(/.../)\nend",
"title": ""
},
{
"docid": "d1c95310a26dce9269a4b9dd98b03ff2",
"score": "0.58068854",
"text": "def expanded_words(word='')\n word.split(/[\\W_]+/).each do |expanded|\n yield expanded\n end\n end",
"title": ""
},
{
"docid": "440803895ed7d8d07835f75c4113ac66",
"score": "0.5792517",
"text": "def substrings (string, dictionary) # This is our main function, taking a \"string\" parameter that can be a single word, or a sentence of words, and also a \"dictionary\" parameter, which is already defined.\n \n final_array = [] # set an empty array equal to final array to put all the substrings into\n downcase_string = string.downcase # Since this assignment is case insensitive, we want to downcase everything bc it matches with our lowercase alphabet array.\n words_array = downcase_string.split(\" \") # We split our \"string\" parameter that has been downcased, into indiviudal words and put it inside a \"words_array\"\n\n filtered_words_array = [] # set an empty filtered words array to add our filtered words inside\n\n words_array.each do |word1| # Loop through each word (word1) in the words array...\n filtered_words_array.push(filter_words(word1)) # and filter each word, then add it to our filtered words array.\n\n end\n\n filtered_words_array.each do |word2| # Loop through each word (word2) of our filtered words array. Note that we gave each word in this array a different variable, as to not confuse it with the previous \"word\" variable, but these variables are all temporary and reside only within the loop, so we can technically use the same variable for all the loops.\n\n final_array.push(make_substrings(word2)) # Make substrings out of each filtered word and add it into our final array.\n \n end\n\n final_array = final_array.flatten # The final array will have arrays inside arrays, which is hard to work with, so we call the \".flatten\" method, which takes all the array components and puts it inside 1 giant array.\n\n match_substrings(final_array) # Match each dictionary word to each substring within the final array.\n\nend",
"title": ""
},
{
"docid": "0e3baab23dee65571c7d3525c9e97409",
"score": "0.57917714",
"text": "def hunt_for words, sub\n clean_up_listings(sub).select do |title|\n words.map do |word|\n concat = title.values.join(\" \")\n concat.include?(word)\n end.any?\n end\n end",
"title": ""
},
{
"docid": "1db869b0c57a35316d1deb470c219104",
"score": "0.57861376",
"text": "def alternate_words(sentence)\n # return sentence.scan(/[a-zA-Z'`’]+/).select.with_index{|word,i| i%2==0}\n sentence.scan(%r{[^!@$#%^&*()-=_+[]]:;,./<>?\\| ]+}).select.with_index { |_word, i| i.even? }\n\n # split_list = [\" \", \"!\", \"@\", \"$\", \"#\", \"%\", \"^\", \"&\", \"*\", \"(\", \")\", \"-\", \"=\", \"_\", \"+\", \"[\", \"]\", \":\", \";\", \",\", \".\", \"/\", \"<\", \">\", \"?\", \"\\\\\", \"|\"]\n\n # word_array = [sentence]\n\n # split_list.each do |splitter|\n # word_array.collect! do |word|\n # word.split(splitter)\n # end\n # word_array.flatten!\n # end\n\n # return word_array.select.with_index {|word,i| i%2==0}\nend",
"title": ""
},
{
"docid": "abc7834ee42f91120bf3e0063d6ee9c0",
"score": "0.5782993",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n text.split().grep(/\\bun\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "dc825d880ccf699aac5bc39f5f5c0667",
"score": "0.57791424",
"text": "def find_words(filter, words, r = 0.01)\n return [] if words.empty? or filter.clean?(words.join(' '))\n return words if words.length == 1\n n = ([words.length.to_f * optimal_factor(r), 2.0].max).ceil\n slices = Array.new(n) { | i | i * words.length / n } << words.length\n slices[0..-2].zip(slices[1..-1]).inject([]) do | result, (low, high) | result + find_words(filter, words[low...high], r) end\n end",
"title": ""
},
{
"docid": "3e3c2af29458281ff9fd795f47c277de",
"score": "0.5771351",
"text": "def double_words_in_phrase(string)\n string_array = string.split(' ')\n string_array.map { |word| word * 2 }\n string_array.join(' ')\nend",
"title": ""
},
{
"docid": "f8f4a3beb70832945e482f1f140d9c49",
"score": "0.5767234",
"text": "def quick_process_word_list(word_length)\n target_words = []\n other_lengths = []\n IO.foreach(self.wordlist.path) do |word|\n\tword.chomp!.downcase!\n\ttarget_words << word if (word.length == word_length) && (!target_words.include? word)\n\tother_lengths << word if (!word.blank?) && (word.length < word_length - 1) && (!other_lengths.include? word)\n end\n database = []\n other_lengths.each do |other|\n target_words.each do |target|\n \t\tif target.start_with?(other)\n\t\t\tto_concat = { target: target, left: other}\n\t\t\tdatabase << to_concat\n\t\t\tto_concat = nil\n\t\tend\t\n end\n end\n other_lengths.each do |other|\n\ttarget_words.each do |target|\n\t\tif target.end_with?(other)\n\t\t\trecord = database.find {|entry| entry[:target] == target }\n\t\t\tif record\n\t\t\t record[:right] = other if record[:left].length + other.length == word_length\n\t\t\tend\n\t\tend\n\tend\n end\n tmp = database.each.select{|i| i[:right] != nil }\n self.update(result: tmp.map {|str| \"\\\"#{str}\\\"\"}.join(','))\n return database.each.select{|i| i[:right] != nil }\n end",
"title": ""
},
{
"docid": "bd10637dc5ac5bdc6ed1ffebeb0f86d1",
"score": "0.5763457",
"text": "def chop_basic line\n i= 0\n wordlen = 1\n words_index=[]\n words_length=[]\n found_words=[]\n temp_word=nil\n temp_length=0\n\n cr = ChopResult.new\n\n while i < line.length\n while i + wordlen <= line.length #break if try_word over the boundry of a line\n try_word=line[i, wordlen]\n mt=@dict.mt? try_word\n mw=@dict.mw? try_word\n\n if mw #if we match a word, yes-> match tree?{yes-> wordlen++ , no -> found word}, \n temp_word = try_word; temp_length = wordlen; temp_index=i\n if mt\n else\n #found a word, and save output\n if !temp_word.nil?\n found_words << temp_word; words_index << temp_index; words_length << temp_length\n cr.words << temp_word; cr.line_after = cr.line_after + \"|\" + line[temp_index, temp_length]\n i = i + wordlen - 1 ; temp_word = nil\n break\n else\n #bad luck nothing found\n end\n end\n else # not match a word, if match a tree, yes -> \n if mt\n #not match a word, but match a tree, we inc the word length\n else\n #not a tree, not a word\n if !temp_word.nil?\n found_words << temp_word; words_index << temp_index; words_length << temp_length\n cr.words << temp_word; cr.line_after = cr.line_after + \"|\" + line[temp_index, temp_length]\n i = i + temp_length - 1 ; temp_word = nil\n break\n else\n #bad luck nothing found\n cr.line_after = cr.line_after + line[i]\n break #no word, no tree #orpahn char. #TODO take care orphan\n end\n end\n end #end of big if\n wordlen += 1\n end\n # if so we reset wordlen and increment i. and go to next loop\n i+=1; wordlen=1\n \n #end of a line, take care of last word if have\n if !temp_word.nil?\n found_words << temp_word; words_index << temp_index; words_length << temp_length\n cr.words << temp_word; cr.line_after = cr.line_after + \"|\" + line[temp_index, temp_length]\n temp_word = nil\n break\n end\n ##\n end \n\n @words_array = []\n for i in 0..(words_index.length-1)\n if @words_array[words_index[i]].nil?\n @words_array[words_index[i]]=[]\n end\n @words_array[words_index[i]] << words_length[i]\n end\n @words_array\n\n cr\n end",
"title": ""
},
{
"docid": "5ad27ab8d6a47602f8fdac5692094c97",
"score": "0.575487",
"text": "def sort sentence\n result_low = []\n result_high = []\n sentence = sentence.scan(/\\w+/).join(\" \")\n\n sentence.split(\" \").each do |word|\n if word == word.downcase \n result_low << word \n else \n result_high << word\n end\n end\n\n #mejor solucion: (result_low + result_high).join(“ ”) #contactena los arr\n if result_high.empty?\n result_low.sort.join(\" \")\n elsif result_low.empty?\n result_high.sort.reverse.join(\" \")\n else \n result_low.sort.join(\" \") + \" \" + result_high.sort.reverse.join(\" \")\n end\nend",
"title": ""
},
{
"docid": "0e49c741854b0eeb9b642b89742d1a17",
"score": "0.5752637",
"text": "def words_contain_2_words\n start_time = Time.now\n\n File.open(WORDLIST, 'r') do |file|\n file.each_line do |line|\n line = line.strip #line have CR/LF\n if line.size == 6\n words = extract_words(line) #an array or words, each broken down into 2 words\n unless words.empty?\n words.each do |word_set| #each word_set is an array of 2 words\n puts word_set.join('; ') \n end\n end\n end\n end\n end\n puts \"start at: #{start_time}\"\n puts \"end at: #{Time.now}\"\n end",
"title": ""
},
{
"docid": "5d5e085c65a94fc02f06ade86cbe7948",
"score": "0.5751021",
"text": "def medium(str, first_half:true)\n return '' if str.empty?\n decrease_even = first_half ? 1 : 0\n all_words = str.scan(/\\S+/)\n num_words = all_words.size\n medium_word_position = num_words % 2 == 0 ? num_words / 2 - decrease_even : num_words / 2\n all_words[medium_word_position]\nend",
"title": ""
},
{
"docid": "df0e802aadafd5e65a951a5b9b47b4d4",
"score": "0.5750336",
"text": "def words_starting_with_un_and_ending_with_ing(text)\n #scans for beginning with un\n #scans for any word including ing\n #\\b creates a word boundary, to make sure it ENDS with ing\n text.scan(/un\\w+ing\\b/)\nend",
"title": ""
},
{
"docid": "62d2b4ac419bd3a1c709900362da15a9",
"score": "0.57434106",
"text": "def alternate_words(sentence)\n # this will get better when we learn regular expressions :)\n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char| \n sentence = sentence.gsub(char, ' ') #we need to get rid of every 'weird' character, so iterating \n end\t\t\t\t\t\t\t\t\t#over the string and then gsub those char with \" \", we get a\n \t\t\t\t\t\t\t\t\t#string we can work with\n sentence.split.select.with_index do |word, index| #after that we check if index.even? for every word\n word if index.even?\t\t\t\t\t\t\t\t#if it is we say to the program to select those words\n end\t\t\t\t\t\t\t\t\t\t\t\t#select method gives us a new array\nend",
"title": ""
},
{
"docid": "79c703a33fa567858723f7695e22365a",
"score": "0.57426244",
"text": "def finish_phrase(digest_tail, word_list = [])\n return word_list if digest_tail.empty?\n digest_tail.size.downto(1).each do |i|\n sub_str = digest_tail[0..i-1]\n if found(sub_str)\n word_list << sub_str\n return finish_phrase(digest_tail[i..-1], word_list)\n end\n end\n return word_list\n end",
"title": ""
},
{
"docid": "711f56afe6915fb3df3cbd0220b21fe4",
"score": "0.5728926",
"text": "def findSubstrings(words,parts)\n \nz = \"class Trie\n attr_accessor :keys\n def initialize\n @keys = {}\n end\n def add node\n keys[node.val] = node if keys[node.val].nil?\n end\n \n def prefix(arr)\n acc = ''\n n = self\n word = false\n arr.each do |char|\n if n.keys[char]\n n = n.keys[char]\n acc += n.val\n word = acc if n.leaf?\n else\n return word\n end\n end\n word\n end\n\n def insert(word)\n n = self\n word.chars.each do |char|\n if n.keys[char]\n n = n.keys[char]\n else\n n = n.add(Node.new(char))\n end\n end\n n.leaf!\n self\n end\nend\n\n\n\nclass Node\n attr_accessor :keys, :val\n def initialize(val)\n @keys = {}\n @leaf = false\n @val = val\n end\n def leaf!\n @leaf = true\n end\n def leaf?\n @leaf\n end\n def add node\n keys[node.val] = node if keys[node.val].nil?\n end\n \nend\"\neval(z)\n\n\n\n # create Trie\n trie = Trie.new\n parts.each { |x| trie.insert(x)}\n # find replasefor words\n words.map{|w|\n arr = w.chars\n pat = false\n max = \"\"\n (0..arr.size-1).each do |x|\n pat = trie.prefix(arr[x..-1])\n max = pat if pat && max.size < pat.size\n end\n w.sub!(max,\"[#{max}]\") if !max.empty?\n w\n }\nend",
"title": ""
},
{
"docid": "094c56a3dbb06c568ab9dce2866001af",
"score": "0.57243603",
"text": "def bull_match_words(word)\n spell = []\n (0..word.length-1).each do |i|\n (i..word.length-1).each do |j|\n spell.push(word[i..j])\n end\n end\n spell.sort_by(&:length).reverse - word.chars - [word]\n end",
"title": ""
},
{
"docid": "5723e43762f33805ca41f0fa619d0ba1",
"score": "0.5723824",
"text": "def all_word_pairs(str)\n words = str.split(\" \")\n result = []\n\n outer_loop = 0\n while outer_loop < words.length\n inner_loop = outer_loop + 1 ## Alternative to the edge case check\n while inner_loop < words.length\n result << [words[inner_loop], words[outer_loop]] # Could do unless inner_loop == outer_loop and change line 10 to inner_loop = outer_loop\n inner_loop += 1\n end\n outer_loop += 1\n end\n result\nend",
"title": ""
},
{
"docid": "1a5316218ad1d7933e36883426f4fdb4",
"score": "0.57034194",
"text": "def subwords(word, dictionary)\n dictionary.select { |sub| word.include?sub }\nend",
"title": ""
},
{
"docid": "0dc88c11807c4d4f885ddb24da97d6e8",
"score": "0.5700645",
"text": "def split_tags_and_words(tagged_example)\n tags = []\n words = []\n tagged_example.each do |tag,word|\n words << word\n tags << tag\n @tags << tag # add it in case we haven't seen this tag yet.\n end\n return tags, words\n end",
"title": ""
},
{
"docid": "115960aa1f99775c568f037043368e51",
"score": "0.56985295",
"text": "def every_other_word(sentence)\nend",
"title": ""
},
{
"docid": "8aff32765596dd528daf1d7b48255c2c",
"score": "0.56933963",
"text": "def subwords(word, dictionary)\n subs = substrings(word)\n subs.select {|sub| dictionary.include?(sub)}\nend",
"title": ""
},
{
"docid": "623ec91f7037a0e02edb06769f89cde8",
"score": "0.56899816",
"text": "def translate(word)\n if word.start_with?(\"a\", \"e\", \"i\", \"o\")\n new_word = word.split(\"\") << [ \"ay\" ]\n new_word.join\n else\n new_word = word << word[0]\n new_word.delete!(new_word[0])\n second_word = new_word.split(\"\")\n # new_word << [ word[0], \"ay\" ]\n new_word.join\n end\nend",
"title": ""
},
{
"docid": "2640b65d01d5f5d4f9362e458d4cb613",
"score": "0.5685198",
"text": "def word_split(arr)\n word, dictionary = arr.first, arr.last.split(',')\n idx = 0\n while idx < word.size - 1\n left, right = word[0..idx], word[idx + 1..-1]\n if dictionary.include?(left) && dictionary.include?(right)\n return [left, right].join(',')\n end\n idx += 1\n end\n 'not possible'\nend",
"title": ""
},
{
"docid": "f181fb0fc8a8b15bd9268371d54a929b",
"score": "0.56792015",
"text": "def good_match line\n match = /((\\w)(\\w)\\2)/\n puts line\n bits = [[], []]\n line.split(/[\\[\\]]/).each_with_index do |part, i|\n puts \" #{i} #{part}\"\n bits[i%2] << part\n end\n part_twos = bits[1].join('#')\n\n bits[0].each do |str|\n (str.length-2).times do |i|\n str[i,3].scan(match).each do |m|\nputs m.inspect\n return true if m[1] != m[2] && /#{m[2] + m[1] + m[2]}/ =~ part_twos\n end\n end\n end\n\n false\nend",
"title": ""
},
{
"docid": "e69e81fa1f977867180f24ffe7e426a5",
"score": "0.5672673",
"text": "def common_words #the, of, or, and etc\n File.read(\"stop_words.txt\").split(' ')\nend",
"title": ""
},
{
"docid": "eb58daad2eb9493c660f2e1bf4cfa3d3",
"score": "0.56701154",
"text": "def multiple_words (text1, *text2)\r\n if text2 == 0\r\n return \"#{text1} \" + \"#{text1}\"\r\n else\r\n return \"#{text1} \" + \"#{text2}\"\r\n end\r\nend",
"title": ""
},
{
"docid": "e2b5932fd5493967ea781e18a42fce23",
"score": "0.5664884",
"text": "def match(words)\n # use .select to compare each element to instance\n words.select do |word|\n # block will .split each element and .sort then do the same to instance\n # will compare then return any match so to .select\n word.split(\"\").sort == @word.split(\"\").sort\n end\n end",
"title": ""
},
{
"docid": "a6e309138f1f3a770be5c8e4296160c6",
"score": "0.56492937",
"text": "def divide_combine \n dot_saperated_string=$string1.split(\".\")\n words=[\"\"]\n temp_word=\"\"\n index=0\n words_array_index=0\n dot_saperated_string.each do |string|\n words[index]=string.split(\" \")\n words[index].reverse!\n index +=1\n end\n\n print \"\\n\\n After dividing strings and combining array in reverse word sequence: \\n\"\n print words\nend",
"title": ""
},
{
"docid": "df47a848ba2cad9cebdee45c1a48d0a9",
"score": "0.5648114",
"text": "def match(possible_matches)\n possible_matches.keep_if { |element| element.split(\"\").sort == @word.split(\"\").sort }\n end",
"title": ""
},
{
"docid": "38bbbe220c20e00ce211400e975ef461",
"score": "0.5642285",
"text": "def mcw(usTitle)\n rfull = Regexp.new(\"\\\\s?\"+usTitle+\"\\\\s+\"+\"\\\\S+\")\n\tbigram = Bigram.new\n\tx = 0\n\n\twhile x < $song_list.length\n\t\tsplit = Array.new\n\t\tbisong = $song_list[x]\n\t\tif rfull =~ bisong\n\t\t\t#get word after when it comes into the if statement the word does have something that follows it\n\t\t\tfollow = bisong[rfull]\n\t\t\tsplit = follow.split(\" \")\n\t\t\tfollow = split[1]\n\n\t\t\t#adds words that it finds that follow a given word\n\t\t\tbigram.add_word(follow)\n\t\tend\n\t\tx += 1\n\tend\n\treturn bigram.mcw\nend",
"title": ""
},
{
"docid": "0ecc99576fc7e412d8f827b5b340b28f",
"score": "0.56419694",
"text": "def o_words(sentence)\n #sentence = sentence.split(\" \")\n return sentence.split.select { |ele| ele.include?(\"o\") }\nend",
"title": ""
},
{
"docid": "db424d8884749eeceb3efadf0d14cba0",
"score": "0.56381154",
"text": "def alternate_words(string)\n\n# Old attempts to remove some - but not all - punctuation from string before iterating through it\n # substring = string.gsub(/([!@#$%^&*()-=_+|;:\",.<>?])/, '').split.map.to_a\n # substring = string.split.map.to_a\n\n\n finalarray = []\n '!@$#%^&*()-=_+[]:;,./<>?\\\\|'.split(//).each do |char| # Taken from solution due to above attempts not excluding \" ' \" from filter search\n string = string.gsub(char, ' ')\n end\n\n string.split.each_with_index do |word, index| # with_index used instead of counter method (i += 1) to cycle through even/odd numbers\n finalarray << word if index.even?\n end\n finalarray\nend",
"title": ""
},
{
"docid": "04614d60ffdc191d30baa7181679e3d2",
"score": "0.5637753",
"text": "def get_sample_phrase_2\r\n \"the bat in the flat\"\r\n end",
"title": ""
},
{
"docid": "a2307fda8f8d5f2a0aed38a8e9c9ce0f",
"score": "0.5636602",
"text": "def visit_words(node); end",
"title": ""
},
{
"docid": "7e0327a7ab37f48ad5a628a8945a8e2a",
"score": "0.56357586",
"text": "def find_substring(s, words)\n word_numbers = wods.map { |x|\n \n }\nend",
"title": ""
}
] |
3f1058bc887c001269a01b06db03b1e1
|
move is valid if: player enters index within 9cell board array and that cell not already occupied
|
[
{
"docid": "dd9616370870a991b89fc9ec391fe97d",
"score": "0.8161836",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n end\nend",
"title": ""
}
] |
[
{
"docid": "d2963802ed1e1a2837d00683001eb3a0",
"score": "0.8300408",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n end\n end",
"title": ""
},
{
"docid": "9f793e11d8aed0d6a2dddab23ac9648e",
"score": "0.8282922",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index) \n end",
"title": ""
},
{
"docid": "20ce313bcce988dd459fbd04f27a6924",
"score": "0.8279517",
"text": "def valid_move?(board, index)\n if index.to_i >= 0 && index.to_i <8 && position_taken?(board, index) == false\n return true\n end\n end",
"title": ""
},
{
"docid": "b0cdb11cc2f33640a53827c5a90b83cf",
"score": "0.8217085",
"text": "def valid_move?(board = nil, index)\n index.between?(0,8) && !position_taken?(@board, index)\n end",
"title": ""
},
{
"docid": "ba538a889e32ac0bad41fa7fd8b206c3",
"score": "0.8193886",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board,index)\n true\n end\nend",
"title": ""
},
{
"docid": "9e8f9b44bd9adf66ce0cc8150f65cb18",
"score": "0.8193852",
"text": "def valid_move?(board, index)\n end",
"title": ""
},
{
"docid": "bb464b96459f19848e3d785533851f1f",
"score": "0.818279",
"text": "def valid_move?(board, index)\n #if index != nil && index.between?(0,8)\n if index.between?(0,8)\n if !position_taken?(board, index)\n true\n end\n end\nend",
"title": ""
},
{
"docid": "9600a49ffe0b143f402d8c315691a5bc",
"score": "0.81762964",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "9600a49ffe0b143f402d8c315691a5bc",
"score": "0.81762964",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "9600a49ffe0b143f402d8c315691a5bc",
"score": "0.81762964",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "9600a49ffe0b143f402d8c315691a5bc",
"score": "0.81762964",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "9600a49ffe0b143f402d8c315691a5bc",
"score": "0.81762964",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "b18e47be2399f64795ebab71bda64d21",
"score": "0.81740844",
"text": "def valid_move?(board, index)\n potential_move = board[index]\n\n if position_taken?(board, index) || index < 0 || index > 8\n return false\n end\n\n return true\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.81615186",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "7ff2dfc1457315f2866e8204afb44292",
"score": "0.816091",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "cbce85d3ca8835fd09908f25faf7beae",
"score": "0.8159404",
"text": "def valid_move?(board,index)\n if index.between?(0,8)\n if !position_taken?(board, index)\n true\n else\n false\n end\n end\nend",
"title": ""
},
{
"docid": "f54c2cd3d73afa678c60444908c4581c",
"score": "0.81563085",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n return true\n end\nend",
"title": ""
},
{
"docid": "355be16a0538e92bef36942f0fa4ce08",
"score": "0.8152463",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "355be16a0538e92bef36942f0fa4ce08",
"score": "0.8152463",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "e8843d6e6688ecf55ff31512685bb40f",
"score": "0.8152325",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && position_taken?(board, index) == false\n true\n end\nend",
"title": ""
},
{
"docid": "698c4bee99d683227bc717d251233e1f",
"score": "0.8149354",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !(position_taken?(board, index))\nend",
"title": ""
},
{
"docid": "157f51e72879b9b2b9f61be5877a6043",
"score": "0.81479704",
"text": "def valid_move?(board, index)\n if index >= 0 && index <= 8\n position_taken?(board, index)\n else false\n end\nend",
"title": ""
},
{
"docid": "253326b2b43b1842f0c847d629f72bf6",
"score": "0.81456834",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "253326b2b43b1842f0c847d629f72bf6",
"score": "0.81456834",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "957e0d174e40007e1a6593f4aea35ff8",
"score": "0.81453437",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "63d45e20d717832b99e68aa2f2d8124c",
"score": "0.81433",
"text": "def valid_move?(board, index)\n \n if index.between?(0,8) && !position_taken?(board, index)\n true \n end\n \n \n # True for valid move on a empty board\n # true for a valid position on a non empty board\n # returns nil or false for an occupied position\n # returns nil or false for a position that not #on the board\n end",
"title": ""
},
{
"docid": "5987caaaedddb44231ff1641a7a04246",
"score": "0.8143196",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "99e6f6ae7428f797cd54db332fcec68a",
"score": "0.8140931",
"text": "def valid_move?(board, index)\r\n if index.between?(0,8)\r\n if !position_taken?(board, index)\r\n true\r\n end\r\n end\r\nend",
"title": ""
},
{
"docid": "548822558e7c9250a04ae348eb7f9f4e",
"score": "0.81408787",
"text": "def valid_move?(board,index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else false\n end\nend",
"title": ""
},
{
"docid": "5f589ecea8d7944a8f70c8bed6363890",
"score": "0.8140866",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "5f589ecea8d7944a8f70c8bed6363890",
"score": "0.8140866",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "5f589ecea8d7944a8f70c8bed6363890",
"score": "0.8140866",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "d13d637f59ca8383892af514a840c270",
"score": "0.8140385",
"text": "def valid_move?(board, index)\n if( index.between?(0, 8) && !position_taken?(board, index))\n true\n end\n\nend",
"title": ""
},
{
"docid": "88b9fdc9caff09a6988089647e2c1fa4",
"score": "0.8139074",
"text": "def valid_move?(board, index)\r\n if index.between?(0,8)\r\n if !index_taken?(board, index)\r\n true\r\n end\r\n end\r\nend",
"title": ""
},
{
"docid": "b27f71ce692e7b65967611f8c6902f37",
"score": "0.81352997",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n return true\n end\nend",
"title": ""
},
{
"docid": "c7217d9009aef1f04fcea163b351a38f",
"score": "0.81343144",
"text": "def valid_move?(board, index)\nif index.between?(0,8) && !position_taken?(board, index)\n return true\nelse return false\nend\nend",
"title": ""
},
{
"docid": "4441e3a4150ea2c324935a2cf53476af",
"score": "0.8134132",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n return true\n end\nend",
"title": ""
},
{
"docid": "79010dc0ec276db0c2aad08618588942",
"score": "0.81335944",
"text": "def valid_move?(board, index)\n return index.between?(0,8) && !(position_taken?(board, index))\nend",
"title": ""
},
{
"docid": "159c0eb39b3b90fbf5f304c1dde9af81",
"score": "0.81320137",
"text": "def valid_move?(board, index)\nindex.between?(0,8) && !position_taken?(board, index)\nend",
"title": ""
},
{
"docid": "3d545438b8877fe71a4a5aef09a588ad",
"score": "0.8130725",
"text": "def valid_move?(board, index)\n !(position_taken?(board, index) || index<0 || index>8)\nend",
"title": ""
},
{
"docid": "10beb1f3a6778bcf9a348de8b4918f5b",
"score": "0.81302744",
"text": "def valid_move?(board, index)\n if index.between?(0,8)\n if position_taken?(board, index)\n false\n else\n true\n end\n else\n false\n end\nend",
"title": ""
},
{
"docid": "25d359e8af17496f0847e17eb918dbcc",
"score": "0.81302404",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && !position_taken?(board,index)\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "86f358c8f825fc59a61dd4f474ffe398",
"score": "0.8126748",
"text": "def valid_move?(board, index)\r\n index.between?(0,8) && !position_taken?(board, index)\r\nend",
"title": ""
},
{
"docid": "13b91970316fb374527c23794e83ec85",
"score": "0.8124587",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && ! position_taken?(board, index)\n true\n\n else\n false\n\n end\nend",
"title": ""
},
{
"docid": "13b91970316fb374527c23794e83ec85",
"score": "0.8124587",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && ! position_taken?(board, index)\n true\n\n else\n false\n\n end\nend",
"title": ""
},
{
"docid": "ce14b75bcfa9863f523621a67fe51318",
"score": "0.81229585",
"text": "def valid_move?(board,index)\n if index.between?(0,8)\n if !position_taken?(board,index)\n true\n end\n else\n false\n end\nend",
"title": ""
},
{
"docid": "c38b8ffb9579454eb949e9b97adbff80",
"score": "0.81213033",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "9ce1ed42fdb53b2985bea81184ecda0d",
"score": "0.81188005",
"text": "def valid_move?(board,index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "7fb71d4aa7f19251015e07b43912052b",
"score": "0.8118316",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "7fb71d4aa7f19251015e07b43912052b",
"score": "0.8118316",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n true\n else\n false\n end\nend",
"title": ""
},
{
"docid": "e3accd4a31fd39adc230e3168ce69d37",
"score": "0.8118043",
"text": "def valid_move?(board, index)\n if index.between?(0, 8)\n if !position_taken?(board, index)\n true\n else\n false\n end\n end\nend",
"title": ""
},
{
"docid": "4ccfcbc43bd241a909059086c55861b7",
"score": "0.81176394",
"text": "def valid_move?(board, index)\nif index.between?(0,9) && position_taken?(board, index) == false\n return true\nend\nend",
"title": ""
},
{
"docid": "87367ce0535789cfcdd3f5724559678a",
"score": "0.8113529",
"text": "def valid_move?(board, index)\n if index.to_i.between?(0,8) && !position_taken?(board, index.to_i) # for occupied position\n true\n else # for empty position\n false\n end\nend",
"title": ""
},
{
"docid": "295e8fa63c9cf25a8fe773149ab7370c",
"score": "0.81130576",
"text": "def valid_move?(board, index)\n if (index).between?(0,8) && !(position_taken?(board, index))\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "3c825aa69a893eea0a30083bbc965a75",
"score": "0.81105286",
"text": "def valid_move?(board,index) \n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "73225021c9b4663da3fc803d4214ae4e",
"score": "0.8109724",
"text": "def valid_move?(board, index)\n index.between?(0, 8) && !position_taken?(board, index) \nend",
"title": ""
},
{
"docid": "6ec640cd2fc5511acbc8e782730f9eb7",
"score": "0.8106521",
"text": "def valid_move? (board, index)\n if index.between?(0, 8)\n if position_taken?(board, index)\n false\n else\n true\n end\n else\n false\n end\nend",
"title": ""
},
{
"docid": "283b8caa84cd67184e41c38670a5c582",
"score": "0.8106072",
"text": "def valid_move?(board, index)\n if position_taken?(board, index) || index > 8\n false\n else\n true\n end\nend",
"title": ""
},
{
"docid": "83ddb333de1c67ca5848c331020c3485",
"score": "0.8102568",
"text": "def valid_move?(board, index)\n if position_taken?(board, index) == true\n false\n elsif index <= 8 && index >= 0\n true\n end\nend",
"title": ""
},
{
"docid": "b487d082b24ddfe2d07f2093982316fa",
"score": "0.8102251",
"text": "def valid_move?(board, index)\n if index.between?(0,8)\n !position_taken?(board, index)\n else\n false\n end\nend",
"title": ""
},
{
"docid": "b04422b0a6edd079a161cf7d0a58383b",
"score": "0.8101997",
"text": "def valid_move?(board, index)\n if index.between?(0,8) && position_taken?(board, index) == false\n return true;\n else\n return false || nil\n end\nend",
"title": ""
},
{
"docid": "bfa12aa5a9465ff36b8603770a878316",
"score": "0.8101528",
"text": "def valid_move?(board,index)\n index.between?(0,8) && position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "752f1aa355254bdc49fac98d07073068",
"score": "0.8099454",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && position_taken?(board, index) == false\n return true\n else\n return nil\n end\nend",
"title": ""
},
{
"docid": "f02c2bea3f4c6a611a5bd3fef81f6084",
"score": "0.80970216",
"text": "def valid_move?(board,index)\r\n index.between?(0, 8) && !position_taken?(board,index) \r\nend",
"title": ""
},
{
"docid": "d7ecf34747180e59cc344831df817361",
"score": "0.8095302",
"text": "def valid_move?(board, index)\n index.between?(0,8) && !position_taken?(board,index)\nend",
"title": ""
},
{
"docid": "9f253c67a12d9329e25063bbb7165b0a",
"score": "0.80931437",
"text": "def valid_move?(board, index)\n if !position_taken?(board, index) && index.between?(0,8)\n true\n end\nend",
"title": ""
},
{
"docid": "008fa2fb9444fa8d47ed52cad71c94a9",
"score": "0.809207",
"text": "def valid_move?(board,index)\n return (index.between?(0,8) && !position_taken?(board,index))\nend",
"title": ""
},
{
"docid": "3e483712479767b02b253303ca108971",
"score": "0.80877703",
"text": "def valid_move?(board, index)\n if index.between?(0, 8) && !position_taken?(board, index)\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "4c41468665be2faf1ae082a0211f7cb8",
"score": "0.80875283",
"text": "def valid_move?(board, index)\n if position_taken?(board, index)\n return false\n elsif index >=0 && index <= 8\n return true\n end\nend",
"title": ""
},
{
"docid": "574aefdeb9cfb59dd739c77131a25e82",
"score": "0.808519",
"text": "def valid_move? (board, index)\n if index.between?(0,8) && !position_taken?(board, index)\n return true # valid move\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "d0f8c7447c397ffb7b7e63c94cd9d5af",
"score": "0.8083803",
"text": "def valid_move? (board, index)\n if (index).between?(0,8) && !position_taken?(board, index)\n true\n else\n false\n end\nend",
"title": ""
}
] |
c80ba518c2f4f629cc49a34bd252a914
|
For now just one, downloads are big enough as it is and we don't want to annoy travis
|
[
{
"docid": "952be3c4ff561daecbfd9fedf5928def",
"score": "0.624274",
"text": "def test_youtube\r\n #download_test('http://www.youtube.com/watch?v=CFw6s0TN3hY')\r\n download_test_other_tools('http://www.youtube.com/watch?v=9uDgJ9_H0gg') # this video is only 30 KB\r\n end",
"title": ""
}
] |
[
{
"docid": "3b4f9fb641a008a03bd7ac86392c6dbb",
"score": "0.6860243",
"text": "def download_test(url)\r\n before = Dir['*']\r\n assert system(\"ruby bin/viddl-rb #{url} -e\")\r\n new_files = Dir['*'] - before\r\n assert_equal new_files.size, 2\r\n assert File.size(new_files[0]) > 100000\r\n assert File.size(new_files[1]) > 40000\r\n File.unlink(new_files[0])\r\n File.unlink(new_files[1])\r\n end",
"title": ""
},
{
"docid": "64962a4307ba9fd3ad9857c30bf81bac",
"score": "0.65731114",
"text": "def downloads(repo, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "1c872ec94929d06f26643961ef930525",
"score": "0.6419335",
"text": "def download_if_needed\r\n unless File.exist? repository_path\r\n puts `#{download_command}`\r\n end\r\n end",
"title": ""
},
{
"docid": "e491bde95855a8efca42c56c22f91b69",
"score": "0.6336883",
"text": "def download_test(url)\r\n before = Dir['*']\r\n assert system(\"ruby bin/viddl-rb #{url} --extract-audio --quality 360:webm --downloader aria2c\")\r\n new_files = Dir['*'] - before\r\n assert_equal new_files.size, 2\r\n\r\n video_file = new_files.find { |file| file.include?(\".webm\") }\r\n audio_file = new_files.find { |file| file.include?(\".ogg\") }\r\n\r\n assert File.size(video_file) > 100000\r\n assert File.size(audio_file) > 40000\r\n\r\n File.unlink(new_files[0])\r\n File.unlink(new_files[1])\r\n end",
"title": ""
},
{
"docid": "e2ce445fd3acac1fa8a2b6da570df79e",
"score": "0.63242084",
"text": "def download(url, last_to_do)\n file = File.basename(url)\n\n # # Resume an interrupted download or fetch the file for the first time. If\n # # the file on the server is newer, then it is downloaded from start.\n\n sh \"wget -Nc --no-verbose #{url}\"\n # If the local copy is already fully retrieved, then the previous command\n # ignores the timestamp. So we check with the server again if the file on\n # the server is newer and if so download the new copy.\n sh \"wget -N --no-verbose #{url}\"\n sh \"wget -Nc --no-verbose #{url}.md5\"\n sh \"wget -N --no-verbose #{url}.md5\"\n # Immediately download md5 and verify the tarball. Re-download tarball if\n # corrupt; extract otherwise.\n sh \"md5sum -c #{file}.md5\" do |matched, _|\n if !matched\n sh \"rm #{file} #{file}.md5\"; download(url)\n # too many tar instances unzipping the same file clutter the system\n elsif file == last_to_do;\n sh \"tar xfov #{file}\" \n else\n # at least nr and nt tarballs have identical files .?al; unsure of others\n sh \"tar xfov #{file} --exclude='*.?al' --exclude='taxdb*'\"\n end\n end\nend",
"title": ""
},
{
"docid": "f5fb5e751042c75612810979ae781e26",
"score": "0.6247719",
"text": "def download_test(url)\r\n Dir.mktmpdir do |tmp_dir|\r\n Dir.chdir(tmp_dir) do\r\n assert system(\"ruby #{VIDDLRB_PATH} #{url} --extract-audio --quality *:360:webm --downloader aria2c\")\r\n new_files = Dir['*']\r\n assert_equal 2, new_files.size\r\n \r\n video_file = new_files.find { |file| file.include?(\".webm\") }\r\n audio_file = new_files.find { |file| file.include?(\".ogg\") }\r\n\r\n assert File.size(video_file) > 100000\r\n assert File.size(audio_file) > 40000\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "55c52b4699663e69eab3c8313d6d78d1",
"score": "0.61144894",
"text": "def test_youtube\r\n download_test('http://www.youtube.com/watch?v=CFw6s0TN3hY')\r\n download_test_other_tools('http://www.youtube.com/watch?v=9uDgJ9_H0gg') # this video is only 30 KB\r\n end",
"title": ""
},
{
"docid": "fb17cf45b97acc974a77827b4d1415a4",
"score": "0.6097555",
"text": "def download\n sh \"wget --quiet -c #{@source_url} -O #{@cache_file}\"\n end",
"title": ""
},
{
"docid": "22ae527a14d2c1f49519eb48dc332931",
"score": "0.6092884",
"text": "def download url, local_dir, wget_args = \"\"\n #TODO: Can we remove the need for this logic by using the -c option? If yes restructure to have local_file printed from wget using logic from remote_filename\n # This is a good alternative to fixing the erraneous download in remote_filename\n # TODO: Fix double download in remote_filename and then uncomment this.\n local_file = nil\n\n if wget_args == \"\"\n local_file = remote_filename(url, wget_args, local_dir)\n if File.size?( local_file )\n puts \"Skipping #{File.basename(local_file)}\"\n return false\n end\n\n system(\"wget #{wget_args} #{sh_sanitize(url)} -O #{sh_sanitize(local_file)}\")\n else\n # TODO: When remote_filename is fixed rework this logic (by removing this block)\n local_file = remote_filename(url, wget_args, local_dir)\n end\n\n if !(File.size?( local_file ))\n warn \"Download of #{File.basename(local_file)} failed.\"\n if (File.exists?(local_file))\n File.unlink( local_file)\n end\n return false\n end\n\n true\nend",
"title": ""
},
{
"docid": "c7c2eb910c458f239a26c57143124e04",
"score": "0.60892224",
"text": "def dl(file_name)\n\n success = 0\n\n open(file_name, 'wb') do |file|\n success = 1\n file << open($source_repo + file_name).read\n end\n\n return success\n\nend",
"title": ""
},
{
"docid": "058cbc8b58ff38de6506443b14f344cb",
"score": "0.60845387",
"text": "def gen_downloading_in_progress?\n\t\tif(DRIVER == \"firefox\")\n\t\t\t(gen_downloaded_files_names ALL_TYPE_FILES).grep(/\\.part$/).any?\n\t\telse if(DRIVER == \"chrome\")\n\t\t\t(gen_downloaded_files_names ALL_TYPE_FILES).grep(/\\.crdownload$/).any?\n\t\tend\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9652afed3a1dc8da1ebb3f686b764063",
"score": "0.6048089",
"text": "def download_pkg(options,remote_file)\n local_file = File.basename(remote_file)\n if not File.exist?(local_file)\n message = \"Information:\\tFetching \"+remote_file+\" to \"+local_file\n command = \"wget #{remote_file} -O #{local_file}\"\n execute_command(options,message,command)\n end\n return\nend",
"title": ""
},
{
"docid": "77a9510ddd49874a87d4397c90b9ff3a",
"score": "0.6035121",
"text": "def download_update_package\r\n @log.debug \"Donwloading from #{@url_server_name_pkg}...\"\r\n http=Net::HTTP.start(@url_server_name_pkg)\r\n # this call is blocking but it works also with medium files.\r\n # tested on 16Mb file without problems\r\n #resp = http.get(@url_file_name_pkg)\r\n # using iterator\r\n resp = http.request_get(@url_file_name_pkg)\r\n # check if the file was found\r\n case resp\r\n when Net::HTTPSuccess then\r\n @log.debug \"Download OK\"\r\n # download OK\r\n FileUtils.mkdir_p(@out_download_pack_path) unless File.directory? @out_download_pack_path\r\n # url found and downloaded\r\n pack_filename = File.basename(@url_file_name_pkg)\r\n @out_package_down = File.join(@out_download_pack_path,pack_filename)\r\n # store it into a file \r\n File.open(@out_package_down, 'wb'){|f| f << resp.body}\r\n @log.debug \"Download saved on #{@out_package_down}\"\r\n else\r\n raise \"Package to download #{@url_file_name_pkg} not found on server #{@url_server_name_pkg}\"\r\n end\r\n end",
"title": ""
},
{
"docid": "6a5b50fcc533745faea18b228e065073",
"score": "0.6001288",
"text": "def download\n puts repo_get_url\n system(\"curl -o #{app}-repo.tgz '#{repo_get_url}'\")\n end",
"title": ""
},
{
"docid": "038316abb440f9f22d92232429c0c1e3",
"score": "0.59934163",
"text": "def download\n Maven2.download(self) || JCenter.download(self) || Bintray.download(self) || Gradle.download(self) || GradleReleases.download(self) || GradleLocal.download(self) || KotlinEap.download(self) || Torquebox.download(self) || JBoss.download(self) || GeoMajas.download(self)\n end",
"title": ""
},
{
"docid": "063b24fadcf267e87b1410b5a0a5fbf6",
"score": "0.59742165",
"text": "def find_tarball(relver,osname)\n# set the tar ball using environment variable 'BEAKER_release_tarball'\n tarball = ENV['BEAKER_release_tarball']\n #If tarball is not defined, check for one in the build directory\n if ( tarball.nil? or tarball.empty? )\n tarball = Dir.glob(\"build/distributions/#{osname}/#{relver}/x86_64/DVD_Overlay/SIMP*.tar.gz\")[0]\n end\n# If it begins with https: then download it from that URL\n if tarball =~ /https/\n filename = 'SIMP-downloaded-CentOS-7-x86_64.tar.gz'\n url = \"#{tarball}\"\n require 'net/http'\n Dir.exists?(\"spec/fixtures\") || Dir.mkdir(\"spec/fixtures\")\n File.write(\"spec/fixtures/#{filename}\", Net::HTTP.get(URI.parse(url)))\n tarball = \"spec/fixtures/#{filename}\"\n warn(\"Found tarball. Downloaded from #{url}\")\n else\n if not ( tarball.nil? or tarball.empty? )\n if File.exists?(tarball)\n warn(\"Found Tarball: #{tarball}\")\n else\n warn(\"Tarball #{tarball} not found, will use Project repos\")\n #Set tarball to empty so it will use project repos\n tarball = nil \n end\n end\n end \n tarball\nend",
"title": ""
},
{
"docid": "d36ef66aa4d53dfd3928d96a0405064f",
"score": "0.5961583",
"text": "def _down_file(path, url, file_name)\n\n down_cmd = \"cd %s && wget %s -q -O ./%s\" %[path, url, file_name]\n r = system(down_cmd)\n file_path = path + \"/\" + file_name\n\n if FileTest::exists?(file_path) and not FileTest::zero?(file_path)\n Logger.info \"Download succ . file_path : #{file_path} url : #{url}\"\n return ['task_id', 'succ', file_path]\n else\n Logger.fatal \"Download fail. file_path : #{file_path} url : #{url}\"\n return ['task_id', 'fail', file_path]\n end\n end",
"title": ""
},
{
"docid": "098469bb303daf48f698ea33a2c4de90",
"score": "0.59502697",
"text": "def download_installer\n puts pe_installer_url\n unless `curl #{pe_installer_url} -o ./file_cache/installers/#{installer_filename}`\n fail \"Error downloading the PE installer\"\n end\n gzip_installer if PRE_RELEASE\nend",
"title": ""
},
{
"docid": "ea62c21270b6e11397f40eadf255e779",
"score": "0.5943055",
"text": "def downloadable?\n false\n end",
"title": ""
},
{
"docid": "a1d046a41c944db80f1800f8bd2a6518",
"score": "0.59347004",
"text": "def wget_download(prefix, url)\n if !File.exists?(\"#{ prefix }/#{ get_tarball_name url }\") &&\n !File.directory?(\"#{ prefix }/#{ get_version url }\")\n cmd \"wget -P #{prefix} #{url} -o /dev/null\"\n raise \"ERROR: #{url} not found\" if $? != 0\n end\n end",
"title": ""
},
{
"docid": "904f66414e740b3a4a4bd1aa7be2ceb2",
"score": "0.59125984",
"text": "def pull_request_files(repo, number, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "be1621806dd7278a4105b0f47f26be76",
"score": "0.5906372",
"text": "def download\n end",
"title": ""
},
{
"docid": "253b6e2fca9b5bd1241ee903487cb65a",
"score": "0.5905328",
"text": "def test_ultimate_community_fetch_archive\n data = File.read File.join(@hd.get_files_dir, \"communityultimate.zip\")\n assert data.length > 9000000 # Filesize greater than 9Mb\n end",
"title": ""
},
{
"docid": "d322b9d64941dde7e04d58dc384898fb",
"score": "0.5902755",
"text": "def download_to(filename, url, unzip=true, message=\"Downloading #{url}\") \n puts message if DEBUG\n spec = \"org.intalio.tempo.build:#{filename}:zip:1.0\"\n ar = Buildr::artifact(spec)\n download(ar=>url)\n ar.invoke\n File.cp repositories.locate(spec), filename\n unzip2(filename) if unzip\nend",
"title": ""
},
{
"docid": "1af0a9420f773512767821ca65dc38aa",
"score": "0.5900396",
"text": "def download_firmware(model,fw_urls,fw_text,latest_only,counter)\n download_file = \"\"\n wrong_file = \"\"\n existing_file = []\n if !fw_urls[model]\n if $verbose == 1\n puts \"No download URLs for \"+model+\"\\n\"\n end\n return\n end\n patch_url = fw_urls[model][counter]\n patch_text = fw_text[model][counter]\n if patch_url.match(/oracle/)\n (download_url,file_name) = get_oracle_download_url(model,patch_text,patch_url)\n else\n download_url = patch_url\n file_name = File.basename(patch_url)\n end\n if !download_url\n return\n end\n download_dir = $firmware_dir+\"/\"+model.downcase\n download_file = download_dir+\"/\"+file_name\n if !Dir.exist?(download_dir)\n Dir.mkdir(download_dir)\n end\n check_file_type(download_file)\n if !File.exist?(download_file) and !File.symlink?(download_file)\n if $file_list\n existing_file = $file_list.select {|existing_file| existing_file =~ /#{file_name}/}\n end\n if existing_file[0]\n existing_file = existing_file[0]\n dir_name = Pathname.new(download_file)\n dir_name = dir_name.dirname\n if !Dir.exist?(dir_name)\n begin\n Dir.mkdir(dir_name)\n rescue\n puts \"Cannot create directory \"+dir_name\n exit\n end\n end\n if existing_file != download_file\n if $verbose == 1\n puts \"Found \"+existing_file+\"\\n\"\n puts \"Symlinking \"+existing_file+\" to \"+download_file+\"\\n\"\n end\n File.symlink(existing_file,download_file)\n end\n else\n if download_url.match(/oracle/) and download_url.match(/zip$/)\n get_mos_url(download_url,download_file)\n else\n get_download(download_url,download_file)\n end\n end\n else\n if $verbose == 1\n puts \"File \"+download_file+\" already exists\"\n end\n end\n return\nend",
"title": ""
},
{
"docid": "80a31d3d874c0208bef5bababf21a21d",
"score": "0.5897771",
"text": "def download_uri\n \"/downloads/#{version.full_name}.gem\" if version.indexed\n end",
"title": ""
},
{
"docid": "902eb27d4fa49b451411afbcdf594d87",
"score": "0.5889655",
"text": "def download\n # we need this only in the context of the first clone\n # in the context of builds we are not going to notice \n # the user that we are cloning the repo\n if self.virtual_sha.present?\n send_sse( status: \"downloading\")\n #self.update_column(:download_status, \"downloading\")\n end\n\n archive = $github_client.archive_link(self.name, ref: virtual_sha)\n system(\"mkdir -p #{self.local_path}\")\n system(\"curl -L #{archive} > #{self.local_path}.tar.gz\")\n system(\"tar --strip-components=1 -xvf #{self.local_path}.tar.gz -C #{self.local_path}\")\n system(\"rm #{self.local_path}.tar.gz\")\n \n #TODO: fix this & handle with care\n begin\n add_hook #permissions issue\n rescue Exception => e\n puts e.message\n end\n\n send_sse(status: \"downloaded\") if self.virtual_sha.present?\n end",
"title": ""
},
{
"docid": "7af84a3dde8493639b1937be93f95f6f",
"score": "0.5883986",
"text": "def is_downloadable?\n true\n end",
"title": ""
},
{
"docid": "aa2957a8eed3ce7ff9422d93b34042e0",
"score": "0.58699256",
"text": "def CountSizeToBeDownloaded\n ret = 0\n\n # get list of remote repositories\n # consider only http(s) and ftp protocols as remote\n\n # all enabled sources\n repos = Pkg.SourceGetCurrent(true)\n remote_repos = []\n\n Builtins.foreach(repos) do |repo|\n url = Ops.get_string(Pkg.SourceGeneralData(repo), \"url\", \"\")\n scheme = Builtins.tolower(Ops.get_string(URL.Parse(url), \"scheme\", \"\"))\n if scheme == \"http\" || scheme == \"https\" || scheme == \"ftp\"\n Builtins.y2milestone(\"Found remote repository %1: %2\", repo, url)\n remote_repos = Builtins.add(remote_repos, repo)\n end\n end \n\n\n # shortcut, no remote repository found\n if Builtins.size(remote_repos) == 0\n Builtins.y2milestone(\"No remote repository found\")\n return 0\n end\n\n repo_mapping = SrcMapping()\n\n media_sizes = Pkg.PkgMediaPackageSizes\n Builtins.y2debug(\"Media sizes: %1\", media_sizes)\n\n Builtins.foreach(remote_repos) do |repoid|\n repo_media_sizes = Ops.get(\n media_sizes,\n Ops.subtract(Ops.get(repo_mapping, repoid, -1), 1),\n []\n )\n Builtins.foreach(repo_media_sizes) do |media_size|\n ret = Ops.add(ret, media_size)\n end\n end \n\n\n Builtins.y2milestone(\n \"Total size of packages to download: %1 (%2kB)\",\n ret,\n Ops.divide(ret, 1024)\n )\n ret\n end",
"title": ""
},
{
"docid": "6da84a5241ba1fedea850a9c0ba2f9d9",
"score": "0.58673525",
"text": "def download_new_ver\n latest = get_ver_list.max\n local_latest = Dir.glob(\"./#{@cache_dir}/*\").select{ |e| File.directory? e }.map { |v| File.basename(v).to_version }.max \n if !local_latest.nil? && local_latest >= latest \n @latest_version = local_latest\n return puts 'Already latest version of nw.js, let\\'s build!' \n end\n \n @latest_version = latest.to_s\n\n if @latest_version == '0.13.0'\n @latest_version = '0.12.1'\n #@prefix_alpha0 = '-alpha0'\n #@folder_prefix_alpha0 = '/alpha0'\n end\n\n puts 'Latest version of nw.js found: ' + @latest_version\n\n # do each platform\n @platforms.each do |p|\n is_linux = p.start_with?('linux')\n\n # ext name\n ext = is_linux ? 'tar.gz' : 'zip'\n\n # download\n down_url = \"#{@url}v#{@latest_version.to_s}#{@folder_prefix_alpha0}/nwjs-v#{@latest_version.to_s}#{@prefix_alpha0}-#{p}.#{ext}\"\n \n puts \"Downloading #{down_url}\"\n file = download_file down_url, \"cache/#{@latest_version.to_s}/#{p}\"\n \n # extract zip file\n puts\n $stdout.flush\n puts 'Extracting zip/tar files...'\n\n if is_linux \n destination = \"cache/#{@latest_version.to_s}\"\n Gem::Package::TarReader.new( Zlib::GzipReader.open file ) do |tar|\n dest = nil\n tar.each do |entry|\n if entry.full_name == '././@LongLink'\n dest = File.join destination, entry.read.strip\n next\n end\n dest ||= File.join destination, entry.full_name\n if entry.directory?\n File.delete dest if File.file? dest\n FileUtils.mkdir_p dest, :mode => entry.header.mode, :verbose => false\n elsif entry.file?\n FileUtils.rm_rf dest if File.directory? dest\n File.open dest, \"wb\" do |f|\n f.print entry.read\n end\n FileUtils.chmod entry.header.mode, dest, :verbose => false\n elsif entry.header.typeflag == '2' #Symlink!\n File.symlink entry.header.linkname, dest\n end\n dest = nil\n end\n end\n else\n Zip::ZipFile.open(file) do |zip_file|\n zip_file.each do |f|\n f_path = File.join(\"cache/#{@latest_version.to_s}\", f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path) \n end\n end\n end\n\n # remove temp files\n FileUtils.rm_rf \"cache/#{@latest_version.to_s}/#{p}\"\n\n # rename extracted folder \n FileUtils.mv \"cache/#{@latest_version.to_s}/nwjs-v#{@latest_version.to_s}#{@prefix_alpha0}-#{p}\", \"cache/#{@latest_version.to_s}/#{p}\"\n end\nend",
"title": ""
},
{
"docid": "7d9d1cb338e1970a15efe06ec97c46b6",
"score": "0.58650357",
"text": "def start_downloading?(client_name)\n file_name = \"#{default_download_path}/#{client_name}\"\n i = 0\n 15.times do\n break if ( File.size?(file_name).to_i + File.size?(file_name+'.part').to_i ) > 0\n sleep(1)\n end\n return (File.size?(file_name).to_i+File.size?(file_name+'.part').to_i) > 0\n end",
"title": ""
},
{
"docid": "efea22087a57eb0fa1bc850c12437bde",
"score": "0.5864712",
"text": "def dowload_archive( url, dest )\n puts \"downloading #{url} to #{dest}...\"\n worker = Fetcher::Worker.new\n worker.copy( url, dest )\n\n ## print some file stats\n puts \"size: #{File.size(dest)} bytes\"\nend",
"title": ""
},
{
"docid": "eeaa8e64a6c4be91d5c99bb50542d1b3",
"score": "0.586093",
"text": "def download(url)\n file = File.basename(url)\n # Resume an interrupted download or fetch the file for the first time. If\n # the file on the server is newer, then it is downloaded from start.\n sh \"wget -Nc --no-verbose #{url}\"\n # If the local copy is already fully retrieved, then the previous command\n # ignores the timestamp. So we check with the server again if the file on\n # the server is newer and if so download the new copy.\n sh \"wget -N --no-verbose #{url}\"\n\n # Immediately download md5 and verify the tarball. Re-download tarball if\n # corrupt; extract otherwise.\n sh \"wget --no-verbose #{url}.md5 && md5sum -c #{file}.md5\" do |matched, _|\n if !matched\n sh \"rm #{file} #{file}.md5\"; download(url)\n else\n sh \"tar xf #{file}\"\n end\n end\nend",
"title": ""
},
{
"docid": "fa5d067712b492a3ca34b2db97ac6f6b",
"score": "0.5859667",
"text": "def download(repo, id, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "5247ff32fc13f7e3b9083edda2122fe1",
"score": "0.5856862",
"text": "def download_eclipse(eclipse_version)\n # Get the SHA-1 hash to verify\n puts \"*** Getting SHA-1 hash\"\n\n params = { :file => eclipse_version, :type => \"sha1\" }\n uri = URI(SHA_BASE_URL)\n uri.query = URI.encode_www_form(params)\n response = Net::HTTP.get_response(uri)\n check_err(response, \"Cannot download SHA-1 hash\")\n expected_hash = response.body.split.first\n puts \"*** SHA-1 hash is #{expected_hash}\"\n\n # Get a list of mirrors\n puts \"*** Getting list of mirrors\"\n uri = URI(DOWNLOAD_BASE_URL)\n params = { :file => eclipse_version, :protocol => 'http', :format => 'xml' }\n uri.query = URI.encode_www_form(params)\n response = Net::HTTP.get_response(uri)\n check_err(response, \"Cannot download Eclpse mirror list\")\n\n # Choose a random mirror\n mirrors = []\n doc = REXML::Document.new(response.body)\n doc.elements.each(\"mirrors/mirror\") { |e| mirrors << e.attribute(\"url\").to_s }\n puts \"** #{mirrors.size} mirrors\"\n url = mirrors[ Kernel.rand(mirrors.size) ]\n \n # Download the eclipse binary\n puts \"*** Downloading from mirror\"\n puts \"** #{url}\"\n tar_file = File.basename eclipse_version\n run_and_check_err(\"curl #{url} > #{tar_file}\")\n\n # Check the SHA-1 hash\n actual_hash = run_and_check_err(\"shasum #{tar_file}\").split.first\n if expected_hash != actual_hash then\n $stderr.puts \"*** ERROR SHA-1 CHECKSUMS DO NOT MATCH, POSSIBLE MALICIOUS ACTIVITY\"\n $stderr.puts \"#{expected_hash} Expected\"\n $stderr.puts \"#{actual_hash} Hash of downloaded file #{tar_file}\"\n exit 1\n end\n puts \"*** SHA-1 hash passes\"\n\n # Untar downloaded file\n puts \"*** Untaring file to create installation\"\n run_and_check_err(\"tar jxf #{tar_file}\")\n\n puts \"*** Removing tar file\"\n run_and_check_err(\"rm #{tar_file}\")\nend",
"title": ""
},
{
"docid": "dd3a9f9073d03d4e9b43b1414e3bd3e7",
"score": "0.5846992",
"text": "def download()\n clone_res = nil\n if @repo_url.to_s.strip != \"\" \n #puts \"#\" * 40\n #puts \"save location: #{@save_location}\"\n #puts \"repo url: #{@repo_url}\"\n #puts \"%\" * 40\n clone_res = download_repo_from_git(@save_location, @repo_url)\n end\n end",
"title": ""
},
{
"docid": "390b979f3f676c8df1d45f6671f234c5",
"score": "0.5836956",
"text": "def download_files\n if !File.exists?(STATUS_FILE_PATH) or File.mtime(STATUS_FILE_PATH) < Time.now - STATUS_DOWNLOAD_INTERVAL\n download_to_file STATUS_URL, STATUS_FILE_PATH\n end\n\n if !File.exists?(DATA_FILE_PATH) or File.mtime(DATA_FILE_PATH) < Time.now - DATA_DOWNLOAD_INTERVAL\n download_to_file random_data_url, DATA_FILE_PATH\n end\n end",
"title": ""
},
{
"docid": "cdc6fd9a724629ba08264f6926eaeb1e",
"score": "0.5836457",
"text": "def download_price (symbol_local)\n url1 = url_fund_price symbol_local\n dir_fund = $dir_downloads + '/' + symbol_local\n file1 = dir_fund + '/quote.csv'\n file_age = age_of_file file1 # Get age of file\n file_age_max_hours = 20\n # Get size of file (0 if it does not exist)\n file_size = 0\n begin\n file_size = File.stat(file1).size\n rescue\n file_size = 0\n end\n # Number of failures to download file\n n_fail = 0\n n_fail_max = 2\n if (file_age <= file_age_max_hours && file_size == 0) # Skip download\n # puts (\"File is new enough, skipping download\")\n else # Perform download until effort succeeds once or fails too many times\n while ((file_age > file_age_max_hours || file_size == 0) && (n_fail <= n_fail_max))\n begin\n # Provide a random delay of 1 to 2 milliseconds to limit the impact\n # on the upstream server\n t_delay = (1+rand)/1000\n sleep (t_delay) \n open(file1, 'w') do |fo|\n fo.print open(url1).read\n end\n file_size = File.stat(file1).size # Bypassed if download fails\n file_age = age_of_file file1 # Bypassed if download fails\n rescue\n n_fail += 1\n puts (\"Failure #\" + n_fail.to_s())\n puts (\"Download failed, giving up\") if n_fail > n_fail_max\n end\n end\n end\nend",
"title": ""
},
{
"docid": "922f348dca89ddb19bfacb4ba4c6f092",
"score": "0.58108324",
"text": "def test_youtube\r\n download_test('http://www.youtube.com/watch?v=CFw6s0TN3hY')\r\n download_test_net_http('http://www.youtube.com/watch?v=9uDgJ9_H0gg') # this video is only 30 KB\r\n end",
"title": ""
},
{
"docid": "9c97192a4b9bcb1ed0ec0a41eb72656f",
"score": "0.5807217",
"text": "def download_contrail_software\n sh(\"wget -qO - https://github.com/rombie/opencontrail-packages/blob/master/ubuntu1404/contrail.tar.xz?raw=true | tar Jx\")\n sh(\"wget -qO - https://github.com/rombie/opencontrail-packages/blob/master/ubuntu1404/thirdparty.tar.xz?raw=true | tar Jx\")\n sh(\"wget -qO - https://github.com/rombie/opencontrail-packages/blob/master/ubuntu1404/kubernetes.tar.xz?raw=true | tar Jx\")\nend",
"title": ""
},
{
"docid": "69a736853a3b4bf9307fc5427de25530",
"score": "0.578154",
"text": "def download_update(version)\r\n index = download_index(version)\r\n unless index\r\n puts \"No update for this version...\" if version == PSDK_Version\r\n return false\r\n end\r\n index.each do |src, dest|\r\n unless download_file(BASE_URL + \"#{version}/#{src}\", dest)\r\n puts \"Failed to download #{dest}\"\r\n return false\r\n end\r\n end\r\n return true\r\nend",
"title": ""
},
{
"docid": "2961457b14b755cfb798e42cde45cb0c",
"score": "0.5769653",
"text": "def _down_file(path, url, file_name)\n down_cmd = \"cd %s && wget %s -q -O ./%s\" %[path, url, file_name]\n r = system(down_cmd)\n file_path = path + \"/\" + file_name\n if FileTest::exists?(file_path) and not FileTest::zero?(file_path)\n return ['task_id', 'succ', file_path]\n else\n return ['task_id', 'fail', file_path]\n end\n end",
"title": ""
},
{
"docid": "85e3070877fcf3c2826c97f63ebb337d",
"score": "0.5764665",
"text": "def download_count\n web_download_count + api_download_count\n end",
"title": ""
},
{
"docid": "85e3070877fcf3c2826c97f63ebb337d",
"score": "0.5764665",
"text": "def download_count\n web_download_count + api_download_count\n end",
"title": ""
},
{
"docid": "85e3070877fcf3c2826c97f63ebb337d",
"score": "0.5764665",
"text": "def download_count\n web_download_count + api_download_count\n end",
"title": ""
},
{
"docid": "85e3070877fcf3c2826c97f63ebb337d",
"score": "0.5764665",
"text": "def download_count\n web_download_count + api_download_count\n end",
"title": ""
},
{
"docid": "0227ecc33367ba2417b160c87e0bc114",
"score": "0.57630163",
"text": "def http_downloader\n http.timeout(DOWNLOAD_TIMEOUT).max_size(Danbooru.config.max_file_size).use(:spoof_referrer).use(:unpolish_cloudflare)\n end",
"title": ""
},
{
"docid": "f062d10b413f7bd50ae3d4924afe2678",
"score": "0.57629454",
"text": "def download_file (url1, file1, file_age_max_hours)\n file_age = age_of_file file1 # Get age of file\n # Get size of file (0 if it does not exist)\n file_size = 0\n begin\n file_size = File.stat(file1).size\n rescue\n file_size = 0\n end\n # Number of failures to download file\n n_fail = 0\n n_fail_max = 4\n # Skip download if the file exists and is newer than a given age\n if (file_age <= file_age_max_hours && file_size > 0) \n # puts \"File is new enough, skipping download\"\n else # Perform download until effort succeeds once or fails too many times\n while ((file_age > file_age_max_hours || file_size == 0) && (n_fail <= n_fail_max))\n begin\n # Provide a random delay of .1 to .2 seconds to limit the impact\n # on the upstream server\n t_delay = (1+rand)/10\n sleep (t_delay) \n open(file1, 'w') do |fo|\n fo.print open(url1).read\n end\n file_size = File.stat(file1).size # Bypassed if download fails\n file_age = age_of_file file1 # Bypassed if download fails\n rescue\n n_fail += 1\n puts (\"Failure #\" + n_fail.to_s())\n puts (\"Download failed, giving up\") if n_fail > n_fail_max\n end\n end\n end\nend",
"title": ""
},
{
"docid": "e2854f0435e396946541f335f278c674",
"score": "0.5755863",
"text": "def get_pkg_source(source_url,source_file)\n if not File.exist?(\"/usr/bin/wget\")\n message = \"Information:\\tInstalling package wget\"\n command = \"pkg install pkg:/web/wget\"\n execute_command(options,message,command)\n end\n message = \"Information:\\tFetching source \"+source_url+\" to \"+source_file\n command = \"wget #{source_url} -O #{source_file}\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "8ec1d3b08aee4643e1cde281c0f42644",
"score": "0.5746795",
"text": "def find_downloadables file_and_links, fetcher\n file_and_links.map do |file_and_link|\n file_name = file_and_link[\"filename\"]\n\n # mp4 less than 3MB considered as unfinished. Redownload it.\n FileUtils.rm file_name if small_mp4? file_name\n\n next if File.exist? file_name\n\n q, v = file_and_link[\"link\"].split(\"?\").last.split(\"=\")\n [file_name, fetcher.future.fetch(DOWNLOAD_URL, cookie, { q => v })]\n end\n end",
"title": ""
},
{
"docid": "1a0b7680462ac2c401d7b432f97479e4",
"score": "0.57435066",
"text": "def download_file(directory, file)\n when_writing \"downloading #{file}\" do\n cd(directory) do\n system(\"wget -c #{file} || curl -L -C - -O #{file}\")\n end\n end\nend",
"title": ""
},
{
"docid": "360d57ce30fb900bede05ec5e650dbee",
"score": "0.57338846",
"text": "def list_downloads(repo, options = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "214dbde39bff55d38eeaf4cb24b41f4b",
"score": "0.5709616",
"text": "def download_files_from_URLs(agent, target_dir, links, file_in_names, current_link)\n # Open file from web URL, using username and password provided\n\n uri = URI(current_link)\n\n queue = Queue.new\n name_queue = Queue.new\n\n links.map { |url| queue << url }\n file_in_names.map { |name| name_queue << name }\n\n # Concurrent file downloads\n threads = $thread_count.times.map do\n Thread.new do\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n while !queue.empty?\n url = queue.pop\n name = name_queue.pop unless name_queue.empty?\n if (url == nil)\n next\n end\n if(name == \"\")\n # Extract file name using this snippet found on SO\n begin\n name = url.meta['content-disposition'].match(/filename=(\\\"?)(.+)\\1/)[2]\n rescue Exception => e\n name = File.basename(URI.parse(url.to_s).path)\n end\n end\n\n # Skip .ps files as no support for PS exists in textract\n if (File.extname(name) == \".ps\")\n next\n end\n\n # Clear name of garbage and add extension\n name = name.gsub(/[\\/ ]/, \"\").gsub(/[%20]/, \"_\") + \".pdf\"\n if (name.size > 100)\n name = name[0..100]\n end\n\n if (File.exists?(name))\n print \"Skip, #{name} already exists\\n\"\n else\n # Perform a new request for the file\n request = Net::HTTP::Get.new(url)\n request.basic_auth(ENV['IC_USERNAME'], ENV['IC_PASSWORD'])\n\n http.request request do |response|\n case response\n when Net::HTTPRedirection\n # Do Nothing for now\n when Net::HTTPOK\n # Write chunks of file while also reading new chunks, to increase\n # efficiency\n File.open(name, 'w') do |file_out|\n response.read_body do |chunk|\n file_out << chunk\n end\n end\n when Net::HTTPNotFound\n # Do nothing\n when Net::HTTPNetworkAuthenticationRequired\n puts \"Wrong credentials\"\n end\n end\n\n end\n end\n end\n end\n end\n threads.each(&:join)\nend",
"title": ""
},
{
"docid": "1f71676cddffcb02c31b79fff215052e",
"score": "0.57024693",
"text": "def downloaded_files_list\n Rails.logger.info(\" Download path is : #{ENV['TEST_FILE_DOWNLOAD_PATH'].inspect}\")\n downloaded_files = Dir[File.join(ENV.fetch('TEST_FILE_DOWNLOAD_PATH', nil), '*.*').tr('\\\\', '/')]\n Rails.logger.info(\" Download directory contains : #{downloaded_files.inspect}\")\n downloaded_files\nend",
"title": ""
},
{
"docid": "5ce5ec5d4751cd9564e115e6c33e7e82",
"score": "0.56944215",
"text": "def package_website(folder)\n \treturn \"TODO\"\n end",
"title": ""
},
{
"docid": "25f4e48e8931e1715395f9b206bc63b9",
"score": "0.56842995",
"text": "def get_downloads90 name, versions\n $stderr.print \"Get downloads 90 days for #{name}\\n\"\n version_numbers = versions.map { |ver| ver['number'] }\n total = 0\n is_new = true\n version_numbers.each_with_index do |version,i|\n url=\"https://rubygems.org/api/v1/versions/#{name}-#{version}/downloads.yaml\"\n text = Http::get_https_body(url)\n dated_stats = YAML::load(text)\n stats = dated_stats.map { | i | i[1] }\n ver_total90 = stats.inject {|sum, n| sum + n } \n total += ver_total90 if ver_total90;\n date = versions[i][\"created_at\"]\n date.to_s =~ /^(\\d\\d\\d\\d)\\-(\\d\\d)\\-(\\d\\d)/\n t = Time.new($1.to_i,$2.to_i,$3.to_i)\n is_new = false if Time.now - t > 6*7*24*3600 \n break if Time.now - t > 90*24*3600 # skip older\n end\n return total,is_new\nend",
"title": ""
},
{
"docid": "53201c0b5b81263f86bd20185a54d342",
"score": "0.56830364",
"text": "def downloads\n versions.inject 0 do |sum, version|\n sum + version.downloads\n end\n end",
"title": ""
},
{
"docid": "44b7b331b98b2d87e44ddc9eb1085269",
"score": "0.56753725",
"text": "def clean_up_client\r\n Dir.glob(\"#{default_download_path}/mozy*\").each{ |path| File.delete(path) }\r\n Dir.glob(\"#{default_download_path}/*.part\").each{ |path| File.delete(path) }\r\n Dir.glob(\"#{default_download_path}/*.deb\").each{ |path| File.delete(path) }\r\n Dir.glob(\"#{default_download_path}/*.rpm\").each{ |path| File.delete(path) }\r\n Dir.glob(\"#{default_download_path}/*.exe\").each{ |path| File.delete(path) }\r\n Dir.glob(\"#{default_download_path}/*.dmg\").each{ |path| File.delete(path) }\r\n end",
"title": ""
},
{
"docid": "ca9db93475e2c5b0ab6b890aadffec5f",
"score": "0.5672658",
"text": "def wgetSite(url, dir)\n\tputs \"Downloading `\" + url + \"'...\"\n\twgetCmd = \"wget --quiet --recursive --no-clobber --page-requisites --domains #{url} #{url} -P #{dir} -l 2\"\n\tputs \"\\t\" + wgetCmd + \"\\n\\n\"\n\t`#{wgetCmd}`\n\tputs \"Creating output directory...\"\n\trmCmd = \"rm -rf #{'out/' + url + '/'}\"\n\tputs \"\\t\" + rmCmd\n\t`#{rmCmd}`\n\tmkdirCmd = \"mkdir #{'out/' + url + '/'}\"\n\tputs \"\\t\" + mkdirCmd + \"\\n\\n\"\n\t`#{mkdirCmd}`\nend",
"title": ""
},
{
"docid": "f2e34549505b6943c1d66f1465b0ad64",
"score": "0.56682456",
"text": "def download_wordpress\n `wget #{LATEST_WP}`\nend",
"title": ""
},
{
"docid": "e5a1f0c62a3780e7c2e2e1dab4365020",
"score": "0.56613827",
"text": "def download\n # we need this only in the context of the first clone\n # in the context of builds we are not going to notice \n # the user that we are cloning the repo\n if self.virtual_sha.present?\n send_sse( status: \"downloading\")\n #self.update_column(:download_status, \"downloading\")\n end\n\n # clone repo\n ssh_url = self.github_data[\"ssh_url\"]\n Git.clone(ssh_url, download_name, :path => working_dir)\n open\n \n #TODO: fix this & handle with care\n begin\n add_hook #permissions issue\n rescue Exception => e\n puts e.message\n end\n\n send_sse(status: \"downloaded\") if self.virtual_sha.present?\n end",
"title": ""
},
{
"docid": "52e21f53c526e9bda289505a884e8055",
"score": "0.563732",
"text": "def fetch_protos()\n def download(path, name, type, version)\n file = \"#{name}-#{type}-#{version}.jar\"\n puts(\"Downloading #{file} ...\")\n\n m2path = ENV[\"HOME\"] + \"/.m2/repository/#{path}/#{name}-#{type}/#{version}/#{file}\"\n if File.file?(m2path) then\n FileUtils.cp(m2path, file)\n else\n url = \"https://token.jfrog.io/token/libs-release/#{path}/#{name}-#{type}/#{version}/#{file}\"\n open(file, 'wb') do |file|\n file << open(url).read\n end\n end\n file\n end\n\n system(\"rm protos/common/*.proto\")\n system(\"rm -rf protos/external\")\n\n file = download(\"io/token/proto\", \"tokenio-proto\", \"external\", TOKEN_PROTOS_VER)\n system(\"unzip -d protos/external -o #{file} 'gateway/*.proto'\")\n system(\"rm -f #{file}\");\n\n file = download(\"io/token/proto\", \"tokenio-proto\", \"common\", TOKEN_PROTOS_VER)\n system(\"unzip -d protos/common -o #{file} '*.proto'\")\n system(\"unzip -d protos/common -o #{file} 'google/api/*.proto'\")\n system(\"rm -f #{file}\");\n\n file = download(\"io/token/fank\", \"tokenio-fank\", \"proto\", FANK_PROTOS_VER)\n system(\"unzip -d protos -o #{file} '*.proto'\")\n system(\"rm -f #{file}\");\n\n file = download(\"io/token/rpc\", \"tokenio-rpc\", \"proto\", RPC_PROTOS_VER)\n system(\"unzip -d protos -o #{file} '*.proto'\")\n system(\"rm -f #{file}\");\n\nend",
"title": ""
},
{
"docid": "2791531d766b93bfaf79669973b2894a",
"score": "0.56364274",
"text": "def download_openuri()\n #Since there could be thousands of files to fetch, let's throttle the downloading.\n #Let's process a slice at a time, then multiple-thread the downloading of that slice.\n\n begin_time = Time.now\n\n @url_list.each do |item|\n\n p \"Downloading #{item[0]}...\"\n\n File.open(@config.data_dir + \"/\" + item[0], \"wb\") do |new_file|\n # the following \"open\" is provided by open-uri\n\n #if Windows, switch to HTTP from HTTPS\n url = item[1]\n\n open(url, 'rb') do |read_file|\n new_file.write(read_file.read)\n end\n end\n\n end\n\n if @config.uncompress_data == true or @config.uncompress_data == \"1\" then\n uncompress_data\n end\n\n p \"Took #{Time.now - begin_time} seconds to download files. \"\n end",
"title": ""
},
{
"docid": "2550caf26afb102e5930d404e7d149a1",
"score": "0.5624401",
"text": "def fetch_media_wiki(base_url)\n\n #starting with the first page, loop through all plugin pages\n agent = Mechanize.new\n agent.user_agent = Repository::CHROME_USER_AGENT\n outer_page = agent.get(base_url + '/wiki/Special:AllPages/Extension:')\n\n error_log = ErrorLog.new\n\n next_page = ''\n\n begin\n \n current_page = next_page\n \n if(current_page != '')\n agent = Mechanize.new\n agent.user_agent = Repository::CHROME_USER_AGENT\n outer_page = agent.get(base_url + current_page)\n end\n\n outer_page.links.each do |link|\n #see if we are on the last page\n if link.text =~ /^Next page \\(/\n next_page = link.href\n\n #check if we are on a extension\n elsif link.href =~ /\\/wiki\\/Extension:/\n inner_page = agent.get(base_url + link.href)\n\n #start collecting stats on plugins\n results = Array.new(4)\n\n results[0] = link.text #name\n results[2] = base_url + link.href #URL\n results[3] = 'N/A'\n\n begin\n #create a folder for the project\n dir_name = results[0].gsub('/', '.').force_encoding('US-ASCII')\n if File.directory? dir_name\n dir_name = dir_name + '_2'\n end\n Dir.mkdir(dir_name)\n Dir.chdir(dir_name)\n rescue Exception => e\n error_log.report(\"Directory Creation: \" + dir_name +\n \"\\n\\t\\t\" + e.message)\n next\n end\n\n #loop through all links in inner page to find download\n #there exist serveral types of downloads (svn, code on page, etc.)\n inner_page.links.each do |inner_link|\n\n\n #-----------------------------------------------------------\n # start check for subversion\n #-----------------------------------------------------------\n #if files are stored in a subversion repo. w/ web acces\n if (inner_link.text =~ /svn/i || inner_link.text =~ /subversion/i) &&\n !(inner_link.text =~ /browse svn/i || inner_link.text =~ /download from svn/i)\n\n #check if the link has a protocol (external)\n if inner_link.href =~ /:\\/\\//\n svn_url = inner_link.href\n else\n svn_url = base_url + inner_link.href\n end\n\n Repository.retrieve_svn_files(svn_url)\n\n #don't get any more code on this page if we have already\n #collected SVN information\n break\n\n end\n #-----------------------------------------------------------\n # end check for subversion\n #-----------------------------------------------------------\n\n\n\n\n\n\n #-----------------------------------------------------------\n # check for a git-hub accound storage\n #-----------------------------------------------------------\n if( inner_link.href =~ /github\\.com/ )\n\n #there exists a git-hub link\n #go the account and attempt to retrive source files\n #should the assumption be made that this is the code?\n\n end\n #-----------------------------------------------------------\n # end check for git-hub\n #-----------------------------------------------------------\n\n\n\n\n #-----------------------------------------------------------\n # check if form must be submitted to get source\n #-----------------------------------------------------------\n\n #-----------------------------------------------------------\n # end check for form\n #-----------------------------------------------------------\n\n\n\n\n\n #-----------------------------------------------------------\n # check if the code is written on the page\n #-----------------------------------------------------------\n\n #-----------------------------------------------------------\n # end check for code on page\n #-----------------------------------------------------------\n\n\n\n\n #get the version of the plugins (if there is one)\n #define the default if none if found\n results[1] = 'N/A'\n if inner_link.text =~ /last version/i\n #there exists a version.... so get it. lol.\n Hpricot(inner_page.body).search('b').each do |item|\n if item.inner_text =~ /last version/i\n item.parent.parent.parent.search('td').each do |item2|\n if !(item2.inner_text =~ /last version/i)\n results[1] = item2.inner_text\n break\n end\n end\n end\n end\n end\n\n end #end inner page\n\n\n\n #now that we're done with the project, exit the project folder\n Dir.chdir('..')\n\n #write results to file\n write_to_file(results)\n\n\n end\n\n end #end outer page\n\n end while next_page != current_page\n\nend",
"title": ""
},
{
"docid": "430cd07f0766d408ea94e5496349d1c8",
"score": "0.5622669",
"text": "def download_files(cmd, files)\n return if files.nil? or files.empty?\n\n local_path = cmd.bundle_dir\n digest = cmd.load_digest\n files.each do |f|\n\n fetch = true\n if not digest then\n fetch = true\n elsif df = digest[\"files\"].find{ |h| h[\"file\"] == f[\"file\"] } then\n # compare digest w/ stored one if we have it\n fetch = (df[\"digest\"] != f[\"digest\"])\n else\n fetch = true\n end\n\n if not fetch then\n logger.debug { \"skipping: #{f}\" }\n next\n end\n\n logger.debug { \"fetching: #{f}\"}\n\n filename = File.join(local_path, f['file'])\n path = File.dirname(filename)\n if not File.exist? path then\n FileUtils.mkdir_p(path)\n end\n\n Bixby::Repository.fetch_file(cmd, f['file'], filename)\n if f['file'] =~ /^bin/ then\n # correct permissions for executables\n FileUtils.chmod(0755, filename)\n end\n end # files.each\n end",
"title": ""
},
{
"docid": "430cd07f0766d408ea94e5496349d1c8",
"score": "0.5622669",
"text": "def download_files(cmd, files)\n return if files.nil? or files.empty?\n\n local_path = cmd.bundle_dir\n digest = cmd.load_digest\n files.each do |f|\n\n fetch = true\n if not digest then\n fetch = true\n elsif df = digest[\"files\"].find{ |h| h[\"file\"] == f[\"file\"] } then\n # compare digest w/ stored one if we have it\n fetch = (df[\"digest\"] != f[\"digest\"])\n else\n fetch = true\n end\n\n if not fetch then\n logger.debug { \"skipping: #{f}\" }\n next\n end\n\n logger.debug { \"fetching: #{f}\"}\n\n filename = File.join(local_path, f['file'])\n path = File.dirname(filename)\n if not File.exist? path then\n FileUtils.mkdir_p(path)\n end\n\n Bixby::Repository.fetch_file(cmd, f['file'], filename)\n if f['file'] =~ /^bin/ then\n # correct permissions for executables\n FileUtils.chmod(0755, filename)\n end\n end # files.each\n end",
"title": ""
},
{
"docid": "7ac88df0a3c581281bb8cd3b17b4c875",
"score": "0.56178117",
"text": "def package_url\n \"https://github.com/vovayartsev/wkhtmltopdf-installer-ruby/releases/download/#{version}/wkhtmltox-#{version}.#{probe.platform}.#{probe.ext}\"\nend",
"title": ""
},
{
"docid": "574800e57bf1075cc8ff8f7e8b435027",
"score": "0.5615935",
"text": "def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"title": ""
},
{
"docid": "9e9c798c3ff9d8181dc629132ea5e640",
"score": "0.5613109",
"text": "def download\n\n begin_time = Time.now\n\n @url_list.each do |item|\n\n #p \"Downloading #{item[0]}...\"\n\n File.open(@config.data_dir + \"/\" + item[0], \"wb\") do |new_file|\n @http.url = item[1]\n response = @http.GET(true) #These HPT urls are elf-authenticating...\n new_file.write(response.body)\n end\n\n @files_local = @files_local + 1\n\n #p \"Local files: #{@files_local}\"\n\n end\n\n p \"Took #{Time.now - begin_time} seconds to download files. \"\n\n if @config.uncompress_data == true or @config.uncompress_data == \"1\" then\n uncompress_data\n end\n end",
"title": ""
},
{
"docid": "1fb2c6f43a46986a22dc21033c326d32",
"score": "0.5611142",
"text": "def download( url, checksum=nil, size=nil )\n checksum = nil if checksum == ''\n #pkg = File.basename( url )\n #File.open( pkg, \"w+\" ) do |f|\n # f << open( url ).read\n #end\n path = File.join( PKGDIR, File.basename(url) )\n unless checksum?( path, checksum )\n shell \"wget #{url}\"\n else\n puts \" # package found\"\n end\n end",
"title": ""
},
{
"docid": "7fb9f2be39f82578445320346f26abfb",
"score": "0.56100184",
"text": "def download!\n downloadable? && increment!(:access_counter) ? true : false\n end",
"title": ""
},
{
"docid": "ad576ea901b00991e11a76eb0acea0c6",
"score": "0.5609759",
"text": "def get_lib_file( url, save_path )\n FileUtils.makedirs( save_path ) unless File.exists?( save_path )\n\n filename = url.split('/').last\n puts \"\"\n puts \"=> Downloading #{filename} from #{url}\"\n %x{ curl #{url} > #{save_path}/#{filename} }\n\n if filename =~ /\\.zip$/\n %x{ cd #{save_path} && unzip #{filename} }\n File.delete \"#{save_path}/#{filename}\"\n end\nend",
"title": ""
},
{
"docid": "c9ca6671cd98d640f9c1451acbf3d617",
"score": "0.56038517",
"text": "def get_download_url\n \n end",
"title": ""
},
{
"docid": "030f7b01abdb48f3fe31a0c48cec0805",
"score": "0.5603383",
"text": "def download_needed?(task)\n return true if !File.exist?(name)\n\n if snapshot?\n return false if offline? && File.exist?(name)\n return true if update_snapshot? || old?\n end\n\n return false\n end",
"title": ""
},
{
"docid": "c4d8f5b587dbd2570c5608982db6ce4e",
"score": "0.5603347",
"text": "def test_best_release_cck6\n p = Drupid::Project.new('cck', 6)\n p.update_version\n assert_instance_of Drupid::Version, p.version\n assert_equal '6.x-2.9', p.version.long\n assert_equal 6, p.version.core.to_i\n assert_nil p.download_url\n p.update_download_url\n assert_equal 'http://ftp.drupal.org/files/projects/cck-6.x-2.9.tar.gz', p.download_url\n end",
"title": ""
},
{
"docid": "d63c57a2737ae57bf78a6ac0e67baa8a",
"score": "0.5592949",
"text": "def files_to_run; end",
"title": ""
},
{
"docid": "4b394bfccf2960f5ae50b5daa60f1d25",
"score": "0.55855674",
"text": "def pull\n `wget #{@url}`\n end",
"title": ""
},
{
"docid": "fc14e343a098ec75c5b06c779e81d779",
"score": "0.55723584",
"text": "def checkDownloadStatus()\n\t\tif @seeding == true\n\t\t\treturn\n\t\tend\n\t\n\t\tallDownloaded = true\n\t\tfinishedCount=0\n\t\t@piecesList.each{ |piece|\n\t\t\tif piece.complete!=true\n\t\t\t\tallDownloaded = false\n\t\t\telse \n\t\t\t\tfinishedCount+=1\n\t\t\tend\n\t\t}\n\t\t\n\t\tif allDownloaded == true #&& finishedCount == @torrentMetadata[\"info\"][\"pieces\"]\n\t\t\t@piecesList.each{ |piece|\n\t\t\t\tif !piece.checkHash() # Theres a bad piece.\n\t\t\t\t\tputs debugMessage(\"Download complete, but there is fails checksum\")\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t}\n\t\t\ttransferRate = (((@torrent.totalPieces)/(Time.now-@startTime))/1000).to_s\n\t\t\tputs debugMessage(\"Download completed in #{Time.now-@startTime}s [#{transferRate.to_s.gsub(/(\\d)(?=\\d{3}+(\\.\\d*)?$)/, '\\1,')} KB/sec]\")\n\t\t\tputs debugMessage(\"Seed Process Started\")\n\t\t\t \n\t\t\t@seeding = true\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b4e950b9d19f19a8dde0ae48458795c7",
"score": "0.5569117",
"text": "def download_nightly_hermes(react_native_path, version)\n params = \"r=snapshots\\&g=com.facebook.react\\&a=react-native-artifacts\\&c=hermes-ios-debug\\&e=tar.gz\\&v=#{version}-SNAPSHOT\"\n tarball_url = \"http://oss.sonatype.org/service/local/artifact/maven/redirect\\?#{params}\"\n\n destination_folder = \"#{react_native_path}/sdks/downloads\"\n destination_path = \"#{destination_folder}/hermes-ios.tar.gz\"\n\n `mkdir -p \"#{destination_folder}\" && curl \"#{tarball_url}\" -Lo \"#{destination_path}\"`\n return destination_path\nend",
"title": ""
},
{
"docid": "4055734a93d9d800216d3810a2453d8e",
"score": "0.55587757",
"text": "def test_standard_use\n Dinda::GithubApi.perform\n file = Dir.pwd + \"/outputs/braspag-rest-#{Time.now}.txt\"\n\n assert_equal(true, File.file?(file) )\n assert_equal(expected_file_content, File.read(file) )\n\n File.delete(file)\n Fetcher.clear\n end",
"title": ""
},
{
"docid": "8b618faaa85019463dedc59608c93565",
"score": "0.55522877",
"text": "def test_maven_cache\n tar_file = \"#{@tmpdir}/submission.tar\"\n tar_fixture('maven_project', tar_file)\n \n @mc.start_caching_deps(tar_file)\n\n AppLog.debug \"Test task added\"\n\n assert_equal 1, @mc.maven_projects_seen\n assert_equal 1, @mc.daemon_start_count\n \n @mc.wait_for_daemon\n\n check_dep_exists_in_both_images(\"commons-io/commons-io/1.3.2\")\n end",
"title": ""
},
{
"docid": "5773167cdcff0ea8ed43dc6b30587045",
"score": "0.554878",
"text": "def test_best_release_d6\n p = Drupid::Project.new('drupal', 6)\n p.update_version\n assert_instance_of Drupid::Version, p.version\n assert_equal '6.28', p.version.short\n assert_equal 6, p.version.core.to_i\n assert_nil p.download_url\n p.update_download_url\n assert_equal 'http://ftp.drupal.org/files/projects/drupal-6.28.tar.gz', p.download_url\n end",
"title": ""
},
{
"docid": "29ac7164cdb3791ce7e03832ea8016be",
"score": "0.5547664",
"text": "def start_download\n _cmd('startDownload')\n end",
"title": ""
},
{
"docid": "3c002011f39a155a679e8f96c8e33828",
"score": "0.55469537",
"text": "def temp_downloads_path \n \"#{Rails.root}/tmp/downloads\" # These are all the files downloaded\n end",
"title": ""
},
{
"docid": "7a5b14305675c8794fa611fca2870ff9",
"score": "0.554159",
"text": "def download_file(url, path) \n url_base, url_path = url.split('/')[2], '/'+url.split('/')[3..-1].join('/')\n @counter = 0\n \n Net::HTTP.start(url_base) do |http|\n response = http.request_head(URI.escape(url_path))\n length = response['content-length'].to_i\n bar = ProgressBar.create(:format => \"#{File.basename(url)} (#{length/(1024**2)}MB) |%b>%i| %p%% done\")\n\n FileUtils::mkdir_p path\n filename = \"#{path}/#{File.basename(url)}\"\n\n File.open(filename, 'w') do |f|\n http.get(URI.escape(url_path)) do |str|\n f.write str\n @counter += str.length\n bar.progress = @counter * 100 / length \n print bar.to_s + \"\\r\"\n $stdout.flush\n end\n return filename\n end \n end\nend",
"title": ""
},
{
"docid": "03f919d3196f0ae11631af93b96f1301",
"score": "0.55324614",
"text": "def test_source_browser_caches_results_of_next_revisions\n setup_repos('one_add', :use_cached_source_browser_files => false)\n @repos.next_revisions(nil, 100)\n cache_files = Dir[\"#{@source_browser.cache_path}/**/*.yml\"].map do |cache_file|\n cache_file.split(\"#{@source_browser.cache_path}/\").last\n end.sort\n assert_equal ['2/0/0/source_browser_info.yml', '2/1/1/source_browser_info.yml'], cache_files\n end",
"title": ""
},
{
"docid": "b0b8d61c1b7820c9b7cb43322556c836",
"score": "0.5530882",
"text": "def run_pre_fetch_setup\n status = create_required_resources\n return -1 if (status == -1)\n\n if (@options[:scrape_option] == \"d\")\n puts \"Starting Downloads\"\n return\n end\n\n # If scrape option is 'links' and a file path is given\n if (@options[:file_path])\n puts \"Writing To File\"\n\n # Hyphens printed above and below anime name for aesthetic appeal\n hyphens = \"---------------------------------------------------\"\n if (@anime_choice.length + 5 > hyphens.length)\n hyphens = \"#{\"-\" * @anime_choice.length}-----\"\n end\n\n # Write anime name to file\n File.open(@options[:file_path], \"a+\") do |file|\n file.write(hyphens + \"\\n\")\n file.write(@anime_choice + \"\\n\")\n file.write(hyphens + \"\\n\")\n end\n end\n\n return 1\n end",
"title": ""
},
{
"docid": "f529e98392587d29fb56213199563e57",
"score": "0.55247617",
"text": "def download_remote_files\n $l.info \"(#{self.class}) downloading started for #{name.inspect}\"\n\n urls.each do |uri|\n destination = cache_path_for(uri.filename)\n\n if File.exist?(destination)\n $l.info \"#{File.basename(destination)} already exists!\"\n else\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Write out file as we receive it\n File.open(destination, \"w+\") do |f|\n http.request_get(uri.path) do |resp|\n original_length = resp[\"content-length\"].to_f\n remaining = original_length.to_f\n\n resp.read_body do |chunk|\n f.write(chunk)\n remaining -= chunk.length\n print \" #{(100 - (remaining / original_length * 100.0)).round(2)}% downloaded\\r\"\n end\n end\n end\n\n end\n end\n\n puts\n $l.info \"(#{self.class}) downloading finished for #{name.inspect}\"\n end",
"title": ""
},
{
"docid": "e5eec7d34e534c3bd67af28ea5381b92",
"score": "0.55227923",
"text": "def download_index(version)\r\n uri = URI(BASE_URL + \"#{version}/file_index.txt\")\r\n response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, ca_file: './lib/cert.pem') {|http|\r\n http.request(Net::HTTP::Get.new(uri))\r\n }\r\n return nil unless response.code.to_i == 200\r\n parse_index(response.body)\r\nend",
"title": ""
},
{
"docid": "44bec89137d3663658cd87b8a7f776de",
"score": "0.5520054",
"text": "def download(url)\n\t\t@agent.get(url)\n\t\t@page = @agent.page.search('.page') #section a garder et traiter\n\t\t@title = get_folder_title(url)\n\t\tputs_and_write_to_file \"Page : #{@title}\"\n\t\tif(File.directory?(\"#{@title}\")) #to avoid the exception thrown when trying to replace a folder already existant\n\t\t\tFileUtils.rm_rf \"#{@title}\"\n\t\tend\t\n\t\t@page.to_s.scan(/href=\"\\/doku.php\\?id=[^(tag)].*?\"/).each do |page_l|\n\t\t\t\tif(@list_of_wikipages_links.to_s.match(/#{page_l.split(\"id=\").last.to_s.gsub(/\"/,\"\")}/)== nil)\n\t\t\t\t\t\t\t@liste_temp\t<< \"https://dokuwiki.application.ac.centre-serveur.i2/doku.php?id=\" + page_l.split(\"id=\").last.to_s.gsub(/\"/,\"\")\n\t\t\t\t\t\t\t@list_of_wikipages_links << \"https://dokuwiki.application.ac.centre-serveur.i2/doku.php?id=\" + page_l.split(\"id=\").last.to_s.gsub(/\"/,\"\")\n\t\t\t\t\t\n\t\t\t\tend\t\n\n\t\tend\t\n\t\tDir.mkdir(\"#{@title}\")\n\t\tDir.chdir(\"#{@title}\") do\n\t\t\tdownload_images\n\t\t\tdownload_documents\n\t\t\t@light_html = clean_html(@page)\n\t\t\tcreate_html_page\n\t\tend\n\n\trescue Exception => e\n\t\t\tputs_and_write_to_file \"Error : #{e}!\"\n\telse\t\n\t\treturn @light_html\n\tend",
"title": ""
},
{
"docid": "f4d707d9053437ac1d36b68a262872ac",
"score": "0.5509864",
"text": "def downloadable?\n Date.today < max_download_time\n end",
"title": ""
},
{
"docid": "595df53ea097c6a2319092961790c04f",
"score": "0.55050683",
"text": "def download(version = current)\n super\n end",
"title": ""
},
{
"docid": "54cc5e200a204e97f3b0fd4b89113a63",
"score": "0.5501414",
"text": "def main_url\n \"files/README.html\"\n end",
"title": ""
},
{
"docid": "acba59707dd60f4e46d728b213d4ed32",
"score": "0.54934347",
"text": "def process\n #no processing needed for the default case\n #since we'll only give them a download link\n end",
"title": ""
},
{
"docid": "cfb63e2d398899afca77bf9bab0a11ba",
"score": "0.54886353",
"text": "def download_source\n self.source = \"\" if source.nil?\n \n return if source !~ /^http:\\/\\// || !file_ext.blank?\n\n ##################################################################\n # below are the custom changes to upload for different websites #\n # this should be in the local_config.rb #\n # #\n # there should be a check to see if there 'is' an extension, #\n # if there isn't, that means it's using a website page #\n ##################################################################\n\n # for pixiv pictures, fix this. #####################################\n\n pixiv_stuff = true\n if source =~ %r(http://www\\.pixiv\\.net/member_illust\\.php\\?mode=medium&illust_id=\\d+)\n self.original_source = source\n pixiv_stuff = pixiv_download\n end\n\n unless pixiv_stuff\n logger.info(\"----------- final error and hope to return\")\n errors.add :pixiv_pool, \"pool is finish\"\n return false\n end\n\n if source =~ /pixiv\\.net\\/img\\//\n if source =~/(_m|_s)\\.[^\\.]+$/\n ext_end = source[/\\.[^\\.]+$/]\n source.sub!(/(_s|_m)\\.[^\\.]+$/, ext_end)\n end\n\n # Pawsie - right here is the error \n if source[/_big_p/]\n test = Danbooru.http_ping(source)\n if test == \"404\"\n source.gsub!(/_big_p/, \"_p\")\n test = Danbooru.http_ping(source)\n if test == \"404\"\n logger.info(\"----------- final error and hope to return\")\n errors.add :pixiv_pool, \"pool is finish\"\n return false\n end\n end\n end\n end\n\n # for FurAffinity.net\n if source =~ /d\\.facdn\\.net\\/art/ and source =~ /\\.(thumbnail|half)\\./\n source.sub!(/\\.(thumbnail|half)\\./,\".\")\n end\n\n # for DeviantArt.net\n if source =~ /deviantart\\.net/ and source =~ /\\/(150|PRE)\\//\n source.sub!(/\\/(150|PRE)\\//,\"/\")\n end\n\n #######\n # end #\n #######\n\n #######################################\n # this is for the danbooru downloader #\n #######################################\n\n if source =~ %r#/post/show/\\d+#\n from_danbooru\n end\n\n #######\n # end #\n #######\n\n # to save original file name\n self.original_name = source[/[^\\/]*$/]\n\n # to check the number of ext\n num_ext = 0\n \n begin\n Danbooru.http_get_streaming(source) do |response|\n File.open(tempfile_path, \"wb\") do |out|\n response.read_body do |block|\n out.write(block)\n end\n end\n end\n \n if source.to_s =~ /\\/src\\/\\d{12,}|urnc\\.yi\\.org|yui\\.cynthia\\.bne\\.jp/\n self.source = \"Image board\"\n end\n \n return true\n rescue SocketError, URI::Error, SystemCallError => x\n delete_tempfile\n\n # try changing the ext\n if change_ext then retry end\n\n errors.add \"source\", \"couldn't be opened: #{x}\"\n return false\n=begin\n rescue PostMethods::PixivPost::PixivFinish\n delete_tempfile\n \n errors.add \"pixiv_pool\", \"couldn't be opened\"\n return false\n=end\n end\n end",
"title": ""
},
{
"docid": "eaeabb6a735675b27e7e5cf2f33c69bd",
"score": "0.54869246",
"text": "def download(url, dir, type, version = nil, _extras = nil)\n url = url.gsub('%{VERSION}', version) if version\n Dir.chdir File.dirname(dir)\n if File.directory? dir\n warn \"WARNING: path '#{dir}' already exists; aborting download\"\n return dir\n end\n case type\n when :targz\n dl_untar url, dir\n when :gitrepo\n git_clone url, version, dir\n else\n raise \"ERROR: :type is not :targz or :gitrepo (#{dl_info.inspect})\"\n end\n dir\n end",
"title": ""
},
{
"docid": "4f824582d109f666d400f91f8238c047",
"score": "0.54816294",
"text": "def target_files; end",
"title": ""
},
{
"docid": "fd67b43ef2b80028377c3a84da14f803",
"score": "0.54814357",
"text": "def update_download_url\n return unless self.has_version?\n self.fetch_release_history if @release_xml.nil?\n return if @release_xml.nil?\n if @release_xml.at_xpath('/project/releases/release/files/file/variant').nil?\n variant = ''\n else\n variant = \"[variant='profile-only']\"\n end\n v = self.drupal? ? self.version.short : self.version.long\n url_node = @release_xml.at_xpath(\"/project/releases/release[status='published'][version='#{v}']/files/file#{variant}/url\")\n if url_node.nil?\n owarn \"Could not get download URL from http://updates.drupal.org for #{extended_name}\"\n else\n self.download_url = url_node.child.to_s\n end\n end",
"title": ""
},
{
"docid": "f1f34ddbdac4b45b8294b0557b8ceb5c",
"score": "0.5481291",
"text": "def download_command(destination)\n # TODO: sha1sum\n \"mkdir -p #{destination} && #{wget} -q #{url} -P #{destination}\"\n end",
"title": ""
},
{
"docid": "c468b490a5f00752c321c750a6e63d97",
"score": "0.54799724",
"text": "def download_files(target_directory)\n node_total = ENV['CIRCLE_NODE_TOTAL'].to_i\n\n # Create directory if it doesn't exist\n FileUtils.mkdir_p target_directory\n\n if node_total > 0\n # Copy coverage results from all nodes to circle artifacts directory\n 0.upto(node_total - 1) do |i|\n node = \"node#{i}\"\n # Modified because circleCI doesn't appear to deal with artifacts in the expected manner\n node_project_dir = `ssh #{node} 'printf $CIRCLE_PROJECT_REPONAME'`\n from = File.join(\"~/\", node_project_dir, 'coverage', \".resultset.json\")\n to = File.join(target_directory, \"#{i}.resultset.json\")\n command = \"scp #{node}:#{from} #{to}\"\n\n puts \"running command: #{command}\"\n `#{command}`\n end\n end\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "0b36179bff0a18e308d5e7a3acdfbaaa",
"score": "0.0",
"text": "def set_start_male_hammer_throw\n @start_male_hammer_throw = StartMaleHammerThrow.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163821",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045432",
"text": "def action_hook; end",
"title": ""
},
{
"docid": "b8b36fc1cfde36f9053fe0ab68d70e5b",
"score": "0.5945441",
"text": "def run_actions; end",
"title": ""
},
{
"docid": "3e521dbc644eda8f6b2574409e10a4f8",
"score": "0.5916224",
"text": "def define_action_hook; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58894575",
"text": "def actions; end",
"title": ""
},
{
"docid": "bfb8386ef5554bfa3a1c00fa4e20652f",
"score": "0.5834073",
"text": "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",
"title": ""
},
{
"docid": "6c8e66d9523b9fed19975542132c6ee4",
"score": "0.57764685",
"text": "def add_actions; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5702474",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5702474",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "6ce8a8e8407572b4509bb78db9bf8450",
"score": "0.5653258",
"text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"title": ""
},
{
"docid": "1964d48e8493eb37800b3353d25c0e57",
"score": "0.56211996",
"text": "def define_action_helpers; end",
"title": ""
},
{
"docid": "5df9f7ffd2cb4f23dd74aada87ad1882",
"score": "0.54235053",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410683",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410683",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5410683",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53948104",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5378064",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.5356684",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "0e7bdc54b0742aba847fd259af1e9f9e",
"score": "0.53400385",
"text": "def set_actions\n actions :all\n end",
"title": ""
},
{
"docid": "0464870c8688619d6c104d733d355b3b",
"score": "0.53399503",
"text": "def define_action_helpers?; end",
"title": ""
},
{
"docid": "5510330550e34a3fd68b7cee18da9524",
"score": "0.53312254",
"text": "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",
"title": ""
},
{
"docid": "97c8901edfddc990da95704a065e87bc",
"score": "0.53121567",
"text": "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",
"title": ""
},
{
"docid": "4f9a284723e2531f7d19898d6a6aa20c",
"score": "0.52971965",
"text": "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",
"title": ""
},
{
"docid": "210e0392ceaad5fc0892f1335af7564b",
"score": "0.52964705",
"text": "def setup_handler\n end",
"title": ""
},
{
"docid": "83684438c0a4d20b6ddd4560c7683115",
"score": "0.52956307",
"text": "def before_actions(*logic)\n self.before_actions = logic\n end",
"title": ""
},
{
"docid": "a997ba805d12c5e7f7c4c286441fee18",
"score": "0.52587366",
"text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "1d50ec65c5bee536273da9d756a78d0d",
"score": "0.52450675",
"text": "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",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.5237777",
"text": "def action; end",
"title": ""
},
{
"docid": "e34cc2a25e8f735ccb7ed8361091c83e",
"score": "0.5233381",
"text": "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",
"title": ""
},
{
"docid": "635288ac8dd59f85def0b1984cdafba0",
"score": "0.52325714",
"text": "def workflow\n end",
"title": ""
},
{
"docid": "78b21be2632f285b0d40b87a65b9df8c",
"score": "0.52288216",
"text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52229726",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "923ee705f0e7572feb2c1dd3c154b97c",
"score": "0.5218362",
"text": "def process_action(...)\n send_action(...)\n end",
"title": ""
},
{
"docid": "b89a3908eaa7712bb5706478192b624d",
"score": "0.52142864",
"text": "def before_dispatch(env); end",
"title": ""
},
{
"docid": "d89a3e408ab56bf20bfff96c63a238dc",
"score": "0.5207988",
"text": "def setup\n # override and do something appropriate\n end",
"title": ""
},
{
"docid": "7115b468ae54de462141d62fc06b4190",
"score": "0.5206337",
"text": "def after_actions(*logic)\n self.after_actions = logic\n end",
"title": ""
},
{
"docid": "62c402f0ea2e892a10469bb6e077fbf2",
"score": "0.51762295",
"text": "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",
"title": ""
},
{
"docid": "72ccb38e1bbd86cef2e17d9d64211e64",
"score": "0.51745105",
"text": "def setup(_context)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51728606",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "1fd817f354d6cb0ff1886ca0a2b6cce4",
"score": "0.516616",
"text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"title": ""
},
{
"docid": "5531df39ee7d732600af111cf1606a35",
"score": "0.5161016",
"text": "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",
"title": ""
},
{
"docid": "bb6aed740c15c11ca82f4980fe5a796a",
"score": "0.5157393",
"text": "def determine_valid_action\n\n end",
"title": ""
},
{
"docid": "994d9fe4eb9e2fc503d45c919547a327",
"score": "0.5152562",
"text": "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",
"title": ""
},
{
"docid": "b38f9d83c26fd04e46fe2c961022ff86",
"score": "0.51524293",
"text": "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",
"title": ""
},
{
"docid": "199fce4d90958e1396e72d961cdcd90b",
"score": "0.5152397",
"text": "def startcompany(action)\n @done = true\n action.setup\n end",
"title": ""
},
{
"docid": "62fabe9dfa2ec2ff729b5a619afefcf0",
"score": "0.5144533",
"text": "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",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.513982",
"text": "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",
"title": ""
},
{
"docid": "adb8115fce9b2b4cb9efc508a11e5990",
"score": "0.51342106",
"text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5113793",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5113793",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "e1dd18cf24d77434ec98d1e282420c84",
"score": "0.5113671",
"text": "def setup(&block)\n define_method(:setup, &block)\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.51092553",
"text": "def action\n end",
"title": ""
},
{
"docid": "f54964387b0ee805dbd5ad5c9a699016",
"score": "0.51062804",
"text": "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",
"title": ""
},
{
"docid": "35b302dd857a031b95bc0072e3daa707",
"score": "0.50921935",
"text": "def config(action, *args); end",
"title": ""
},
{
"docid": "bc3cd61fa2e274f322b0b20e1a73acf8",
"score": "0.5088855",
"text": "def setup\n @setup_proc.call(self) if @setup_proc\n end",
"title": ""
},
{
"docid": "5c3cfcbb42097019c3ecd200acaf9e50",
"score": "0.5082236",
"text": "def before_action \n end",
"title": ""
},
{
"docid": "246840a409eb28800dc32d6f24cb1c5e",
"score": "0.5079901",
"text": "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",
"title": ""
},
{
"docid": "dfbcf4e73466003f1d1275cdf58a926a",
"score": "0.5066569",
"text": "def action\n end",
"title": ""
},
{
"docid": "36eb407a529f3fc2d8a54b5e7e9f3e50",
"score": "0.5055307",
"text": "def matt_custom_action_begin(label); end",
"title": ""
},
{
"docid": "b6c9787acd00c1b97aeb6e797a363364",
"score": "0.5053106",
"text": "def setup\n # override this if needed\n end",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50499666",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50499666",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "fd421350722a26f18a7aae4f5aa1fc59",
"score": "0.5035068",
"text": "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",
"title": ""
},
{
"docid": "d02030204e482cbe2a63268b94400e71",
"score": "0.50258636",
"text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"title": ""
},
{
"docid": "4224d3231c27bf31ffc4ed81839f8315",
"score": "0.50220853",
"text": "def after(action)\n invoke_callbacks *options_for(action).after\n end",
"title": ""
},
{
"docid": "24506e3666fd6ff7c432e2c2c778d8d1",
"score": "0.5015893",
"text": "def pre_task\n end",
"title": ""
},
{
"docid": "0c16dc5c1875787dacf8dc3c0f871c53",
"score": "0.50134486",
"text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"title": ""
},
{
"docid": "c99a12c5761b742ccb9c51c0e99ca58a",
"score": "0.5001442",
"text": "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",
"title": ""
},
{
"docid": "0cff1d3b3041b56ce3773d6a8d6113f2",
"score": "0.50005543",
"text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"title": ""
},
{
"docid": "791f958815c2b2ac16a8ca749a7a822e",
"score": "0.4998581",
"text": "def setup_signals; end",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.49901858",
"text": "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",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.49901858",
"text": "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",
"title": ""
},
{
"docid": "5aa51b20183964c6b6f46d150b0ddd79",
"score": "0.4986648",
"text": "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",
"title": ""
},
{
"docid": "7647b99591d6d687d05b46dc027fbf23",
"score": "0.49809486",
"text": "def initialize(*args)\n super\n @action = :set\nend",
"title": ""
},
{
"docid": "67e7767ce756766f7c807b9eaa85b98a",
"score": "0.49792925",
"text": "def after_set_callback; end",
"title": ""
},
{
"docid": "2a2b0a113a73bf29d5eeeda0443796ec",
"score": "0.4978855",
"text": "def setup\n #implement in subclass;\n end",
"title": ""
},
{
"docid": "63e628f34f3ff34de8679fb7307c171c",
"score": "0.49685496",
"text": "def lookup_action; end",
"title": ""
},
{
"docid": "a5294693c12090c7b374cfa0cabbcf95",
"score": "0.49656174",
"text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"title": ""
},
{
"docid": "57dbfad5e2a0e32466bd9eb0836da323",
"score": "0.49576473",
"text": "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",
"title": ""
},
{
"docid": "5b6d613e86d3d68152f7fa047d38dabb",
"score": "0.49563017",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4aceccac5b1bcf7d22c049693b05f81c",
"score": "0.4955349",
"text": "def around_hooks; end",
"title": ""
},
{
"docid": "64e0f1bb6561b13b482a3cc8c532cc37",
"score": "0.49536878",
"text": "def setup(easy)\n super\n easy.customrequest = @verb\n end",
"title": ""
},
{
"docid": "2318410efffb4fe5fcb97970a8700618",
"score": "0.4952439",
"text": "def save_action; end",
"title": ""
},
{
"docid": "fbd0db2e787e754fdc383687a476d7ec",
"score": "0.49460214",
"text": "def action_target()\n \n end",
"title": ""
},
{
"docid": "b280d59db403306d7c0f575abb19a50f",
"score": "0.494239",
"text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"title": ""
},
{
"docid": "9f7547d93941fc2fcc7608fdf0911643",
"score": "0.49334687",
"text": "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",
"title": ""
},
{
"docid": "da88436fe6470a2da723e0a1b09a0e80",
"score": "0.49315962",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3",
"score": "0.49266812",
"text": "def default_action; end",
"title": ""
},
{
"docid": "3ba85f3cb794f951b05d5907f91bd8ad",
"score": "0.49261138",
"text": "def setup(&blk)\n @setup_block = blk\n end",
"title": ""
},
{
"docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd",
"score": "0.4925925",
"text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"title": ""
},
{
"docid": "80834fa3e08bdd7312fbc13c80f89d43",
"score": "0.4922542",
"text": "def callback_phase\n super\n end",
"title": ""
},
{
"docid": "f1da8d654daa2cd41cb51abc7ee7898f",
"score": "0.4920779",
"text": "def advice\n end",
"title": ""
},
{
"docid": "6e0842ade69d031131bf72e9d2a8c389",
"score": "0.49173284",
"text": "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",
"title": ""
},
{
"docid": "99a608ac5478592e9163d99652038e13",
"score": "0.49169463",
"text": "def _handle_action_missing(*args); end",
"title": ""
},
{
"docid": "399ad686f5f38385ff4783b91259dbd7",
"score": "0.4916256",
"text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"title": ""
},
{
"docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a",
"score": "0.49162322",
"text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"title": ""
},
{
"docid": "9e264985e628b89f1f39d574fdd7b881",
"score": "0.49156886",
"text": "def duas1(action)\n action.call\n action.call\nend",
"title": ""
}
] |
0fd38535d964c827a13eb3d9ba6f1194
|
Overwritten by subclass Returns an array of [dx, dy] position changes that a piece can make
|
[
{
"docid": "0c13c71e814b8c857e8faaae16bf32ee",
"score": "0.0",
"text": "def move_diffs\n raise NotImplementedError\n end",
"title": ""
}
] |
[
{
"docid": "9fd8375209b7aaf6c3d61965499a28a7",
"score": "0.67549956",
"text": "def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"title": ""
},
{
"docid": "0416f5f2043f4753be8e4f6d16fda013",
"score": "0.65848404",
"text": "def build_obstruction_array(x_end, y_end)\n y_change = y_position - y_end\n x_change = x_position - x_end\n\n # Build array squares which piece must move through\n obstruction_array = []\n if x_change.abs == 0 # If it's moving vertically\n (1..(y_change.abs-1)).each do |i|\n obstruction_array << [x_position, y_position - (y_change/y_change.abs) * i]\n end\n elsif y_change.abs == 0 # If horizontally\n (1..(x_change.abs-1)).each do |i| # 7 times do (0..6).each do\n obstruction_array << [x_position - (x_change/x_change.abs) * i, y_position]\n end\n elsif y_change.abs == x_change.abs #if diagonally\n (1..(y_change.abs-1)).each do |i|\n obstruction_array << [x_position - (x_change/x_change.abs) * i, y_position - (y_change/y_change.abs) * i]\n end\n end\n obstruction_array\n end",
"title": ""
},
{
"docid": "c9ad94a1f334e45c8a2311e80e884ea7",
"score": "0.6532764",
"text": "def new_coord\n [@position, @@move[@direction]].transpose.map { |coord| coord.reduce(:+) }\n end",
"title": ""
},
{
"docid": "a989dbc7c147d16d7e1f80431d54b06e",
"score": "0.63822013",
"text": "def protecting_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_teammate?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend",
"title": ""
},
{
"docid": "a04f201bee1713d8d06d0221813f0511",
"score": "0.6365798",
"text": "def movement(initial_position,dx,dy)\n initial_x = initial_position[0].ord\n initial_y = initial_position[1].to_i\n \n array_positions = []\n for i in 0..dx.length-1\n x = initial_x + dx[i]\n y = initial_y + dy[i]\n position = x.chr + y.to_s\n array_positions.push(position.to_sym)\n end\n return array_positions\n end",
"title": ""
},
{
"docid": "a41b66f5a8f6208978ac4ff16356b6ea",
"score": "0.6322285",
"text": "def position\n [x, y]\n end",
"title": ""
},
{
"docid": "c2d49464fd1fbd783dafbda78079d514",
"score": "0.62967426",
"text": "def generate_children_coordinates(x,y)\n child_coordinates = []\n MOVEMENT_DIFF.each do |dx, dy|\n move = [x+dx, y+dy]\n child_coordinates << move if within_limits?(move)\n end\n child_coordinates\n end",
"title": ""
},
{
"docid": "052b4263d733785ba6f1366a5b93bd4b",
"score": "0.6290216",
"text": "def pos\n [posx, posy]\n end",
"title": ""
},
{
"docid": "b674ef93e05927ddab4ef5958c5351b3",
"score": "0.6283936",
"text": "def all_moves_array(initial_x, initial_y)\n\t\tfinal = []\n\t\tx = initial_x + 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\tx = initial_x - 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\ty = initial_y + 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\ty = initial_y - 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\tfinal\n\tend",
"title": ""
},
{
"docid": "3b24433a8bb836d743dc01767ab2e434",
"score": "0.6248467",
"text": "def field # {{{\n iy = 0\n field = Array.new(3) { |y|\n ix=0\n y = Array.new(3) { |x|\n if move=self.moves.find(:first,:conditions => { :x => ix,:y => iy })\n if move.by_player\n x = 1\n else\n x = 2\n end\n else\n x = 0\n end\n ix+=1\n x\n }\n iy+=1\n y\n }\n end",
"title": ""
},
{
"docid": "54fda0115b44e1b4b583e39906b5e208",
"score": "0.62248534",
"text": "def moves_array\n\t\t@field[1]\n\tend",
"title": ""
},
{
"docid": "6aea4c32439d3309092d003d78c073c2",
"score": "0.6216859",
"text": "def getCoordOf(piece)\n coords = []\n @pieces[piece.colour][piece.class.to_s.to_sym].each do |coord, piece|\n coords << coord\n end\n return coords\n end",
"title": ""
},
{
"docid": "3a966fcfc89baabc6de4834e44904cf5",
"score": "0.6203272",
"text": "def position\n [@x, @y]\n end",
"title": ""
},
{
"docid": "b18bf29048b94616ac81011b4420e6ee",
"score": "0.61892617",
"text": "def position\n\t\t[ @x, @y ]\n\tend",
"title": ""
},
{
"docid": "1976a1ca627b5cb371ff4e32d4db9be9",
"score": "0.6185557",
"text": "def get_moves(pieces)\n\t\tarrPos = [] \n\t\tif team == 1\n\t\t\tarrPos << [@xCord, @yCord + 1] if square_is_open?(pieces, [@xCord, @yCord + 1])\n\t\t\tarrPos << [@xCord, @yCord + 2] if @yCord == 1 && square_is_open?(pieces, [@xCord, @yCord + 2])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord, @yCord - 1] if square_is_open?(pieces, [@xCord, @yCord - 1])\n\t\t\tarrPos << [@xCord, @yCord - 2] if @yCord == 6 && square_is_open?(pieces, [@xCord, @yCord - 2])\n\t\tend\n\t\tarrPos\n\tend",
"title": ""
},
{
"docid": "949353b8f01be957698578ea2f1b0fcb",
"score": "0.6107765",
"text": "def current_pos\n\t\treturn arr = [pos_x, pos_y]\n\tend",
"title": ""
},
{
"docid": "95d16016ecbbb5dd65882f29725f4ae1",
"score": "0.6093352",
"text": "def get_arr_x(x, y) \n x # this coordinate doesn't change\nend",
"title": ""
},
{
"docid": "13f581b68304c97d201ac61670d0a26d",
"score": "0.60730463",
"text": "def possible_moves(x, y, dx, dy)\n return [[x - 1, y], [x, y + 1], [x, y - 1]] if dx > 0\n return [[x + 1, y], [x, y + 1], [x, y - 1]] if dx < 0\n return [[x + 1, y], [x, y + 1], [x - 1, y]] if dy > 0\n [[x + 1, y], [x, y - 1], [x - 1, y]]\n end",
"title": ""
},
{
"docid": "fe9d01598998eede469569398d541693",
"score": "0.6019988",
"text": "def attacking_coordinates(piece_type = 'Queen')\n attacking_pairs(piece_type).map { |pair| pair.map(&:coordinates) }\n end",
"title": ""
},
{
"docid": "a7421c0aa1f47d2e66547c892d44d6f9",
"score": "0.5998805",
"text": "def grow_unblocked_moves_in_dir(dx, dy)\n res = []\n\n row, col = pos \n row += dx\n col += dy\n\n until row < 0 || row > 7 || col < 0 || col > 7\n current_pos = row, col \n if board[current_pos].is_a?(NullPiece)\n res << current_pos \n elsif color != board[current_pos].color \n res << current_pos\n break\n elsif color == board[current_pos].color \n break\n end\n \n row += dx\n col += dy\n end\n res \n\n # get the piece's current row and current column\n\n # starting pos = [0, 0]\n # dir = [0, 1]\n # [0, 0]\n # [0, 1]\n # [0, 2]\n # ... until we go off board or hit a piece\n\n # in a loop:\n # continually increment the piece's current row and current column to generate a new position\n # stop looping if the new position is invalid (not on the board); the piece can't move in this direction\n # if the new position is empty, the piece can move here, so add the new position to the moves array\n # if the new position is occupied with a piece of the opposite color, the piece can move here (to capture the opposing piece), so add the new position to the moves array\n # but, the piece cannot continue to move past this piece, so stop looping\n # if the new position is occupied with a piece of the same color, stop looping\n\n # return the final moves array\n end",
"title": ""
},
{
"docid": "66e8a8ec91c6a38d5b9c8cad4ee8d6be",
"score": "0.59620035",
"text": "def grow_unblocked_moves_dir(dx, dy)\n moves_dir =[]\n i, j = dx, dy\n k = 2\n next_pos = [@pos[0]+dx, @pos[1]+dy]\n while @board.in_bounds?(next_pos) && @board[next_pos].color != self.color\n \n moves_dir << next_pos\n break if @board[next_pos].color != nil\n dx = i * k\n dy = j * k\n k += 1\n next_pos = [@pos[0]+dx, @pos[1]+dy]\n end\n moves_dir\n end",
"title": ""
},
{
"docid": "af259b7c6a55457dc4f812e24b510b6c",
"score": "0.59438664",
"text": "def grow_unblocked_moves_in_dir(dx,dy)\n start_x, start_y = self.pos\n #start for rook white === [7,0]\n # [6,0]\n # [5,0]\n # [4,0]\n # [3,0]\n # [2,0]\n\n dx = -1 #first iteration UP\n dy = 0\n\n\n 1.step do |i|\n start_x += dx\n start_y += dy\n if self.board.rows[start_x][start_y].empty? #[6,0]\n\n end\n # create an array to collect moves\n\n # get the piece's current row and current column\n\n\n # in a loop:\n # continually increment the piece's current row and current column to \n # generate a new position\n # stop looping if the new position is invalid (not on the board); the piece \n # can't move in this direction\n # if the new position is empty, the piece can move here, so add the new \n # position to the moves array\n # if the new position is occupied with a piece of the opposite color, the \n # piece can move here (to capture the opposing piece), so add the new \n # position to the moves array\n # but, the piece cannot continue to move past this piece, so stop looping\n # if the new position is occupied with a piece of the same color, stop looping\n\n # return the final moves array\n end\n \nend",
"title": ""
},
{
"docid": "46d3c6590da13e9a2fbe371e4fcb1b20",
"score": "0.5928492",
"text": "def position\n return [@x, @y, @heading]\n end",
"title": ""
},
{
"docid": "5395e8929ac017cdb8dd8d6c6433ecb4",
"score": "0.58964133",
"text": "def adjust_to_relative_pos(tx,ty)\n x = tx - (self.x - @positions[:current][:x])\n y = ty - (self.y - @positions[:current][:y])\n return x,y\n end",
"title": ""
},
{
"docid": "01960c4273c2e77e0810a36f964eb8d0",
"score": "0.5889455",
"text": "def take_moves(pieces)\n\t\tarrPos = []\n\t\tif team == 1\n\t\t\tarrPos << [@xCord - 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord + 1])\n\t\t\tarrPos << [@xCord + 1, @yCord + 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord + 1])\n\t\telsif team == 2\n\t\t\tarrPos << [@xCord - 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord - 1, @yCord - 1])\n\t\t\tarrPos << [@xCord + 1, @yCord - 1] if square_taken_opponent?(pieces, [@xCord + 1, @yCord - 1])\n\t\tend\n\t\tarrPos\t\n\tend",
"title": ""
},
{
"docid": "6526227d366627a83c5415f2a8105b7f",
"score": "0.5887779",
"text": "def moves\n # create array to collect moves\n final_array = []\n\n\n\n pos = self.move_dirs\n\n pos.each do |optional_pos|\n\n end\n\n # Note do these logics for all the optional positions \n spec_dx = pos[0]\n spec_dy = pos[1]\n\n possible_movements = grow_unblocked_moves_in_dir(spec_dx, spec_dy)\n possible_movements\n # ending\n\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"title": ""
},
{
"docid": "2a27bb5e4ab950545169bffeb6a44643",
"score": "0.586829",
"text": "def moves; [] end",
"title": ""
},
{
"docid": "fa751349549bba49b816119736148ac1",
"score": "0.5865151",
"text": "def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n end",
"title": ""
},
{
"docid": "15206427ea18552da8209f78d2102018",
"score": "0.58629036",
"text": "def move(x, y)\n orig_pos_x = @pos_x\n orig_pos_y = @pos_y\n\n self.pos_x = x\n self.pos_y = y\n\n [@pos_x - orig_pos_x, @pos_y - orig_pos_y]\n end",
"title": ""
},
{
"docid": "b1f0990e9f4ee213d64876674d7a9110",
"score": "0.58603233",
"text": "def calculate_moves(piece, location)\n @x = location[0].to_i\n @y = location[1].to_i\n @possible_moves = []\n\n def add_straight_line_moves(index)\n move = \"#{@x + (index + 1)}#{@y}\" # Right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y + (index + 1)}\" # Up\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y}\" # Left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x}#{@y - (index + 1)}\" # Down\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n def add_diagonal_moves(index)\n move = \"#{@x + (index + 1)}#{@y + (index + 1)}\" # Up right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y - (index + 1)}\" # Down left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x + (index + 1)}#{@y - (index + 1)}\" # Down right\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n move = \"#{@x - (index + 1)}#{@y + (index + 1)}\" # Up left\n @possible_moves << move unless path_blocked?(move) || out_of_bounds?(move) ||\n friendly_piece?(move)\n end\n\n case piece\n\n when \"WhitePawn\"\n # 1 step forward\n move = \"#{@x}#{@y + 1}\"\n @possible_moves << move unless @board[move] != nil \n # Attack forward right\n move = \"#{@x + 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # Attack forward left\n move = \"#{@x - 1}#{@y + 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent \n @possible_moves << move \n end \n # 2 steps forward if its in the starting point\n move = \"#{@x}#{@y + 2}\"\n @possible_moves << move unless @y != 2 || path_blocked?(move) ||\n @board[move] != nil\n\n when \"BlackPawn\"\n # Same moves of the WhitePawn but reversed\n move = \"#{@x}#{@y - 1}\"\n @possible_moves << move unless @board[move] != nil \n \n move = \"#{@x + 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move \n end\n \n move = \"#{@x - 1}#{@y - 1}\"\n if @board[move] != nil && @board[move].team == @current_opponent\n @possible_moves << move\n end\n \n move = \"#{@x}#{@y - 2}\"\n @possible_moves << move unless @y != 7 || path_blocked?(move) || @board[move]\n\n when \"Rook\"\n # 7 is the max distance between squares\n # The method is called 7 times to have a list of all possible targets ready\n 7.times { |index| add_straight_line_moves(index) }\n\n when \"Knight\"\n knight_moves = [[@x + 1, @y + 2], [@x + 2, @y + 1], \n [@x + 2, @y - 1], [@x + 1, @y - 2], \n [@x - 1, @y - 2], [@x - 2, @y - 1], \n [@x - 2, @y + 1], [@x - 1, @y + 2]]\n \n knight_moves.each do |move|\n move = \"#{move[0]}#{move[1]}\" \n @possible_moves << move unless out_of_bounds?(move) || friendly_piece?(move)\n end\n\n when \"Bishop\"\n 7.times { |index| add_diagonal_moves(index) }\n \n when \"Queen\"\n 7.times do |index|\n add_straight_line_moves(index)\n add_diagonal_moves(index)\n end\n \n when \"King\"\n # The King can move only 1 square away so the methods are called just once\n add_straight_line_moves(0)\n add_diagonal_moves(0)\n else\n\n end\n end",
"title": ""
},
{
"docid": "cf736c19f5c3eb67cdd13f17b3382033",
"score": "0.5852704",
"text": "def grow_unblocked_moves_in_dir(dx, dy)\n x, y = @pos\n valid_positions = []\n new_x = x + dx\n new_y = y + dy\n new_pos = [new_x, new_y]\n \n while @board.valid_pos?(new_pos) \n # debugger\n\n next_piece = @board[new_pos]\n if next_piece.empty?\n valid_positions << new_pos\n elsif self.color != next_piece.color\n valid_positions << new_pos\n break\n else\n break\n end\n\n new_x += dx\n new_y += dy\n new_pos = [new_x, new_y] \n \n end\n\n valid_positions\n end",
"title": ""
},
{
"docid": "7cf2e5cdf6598298ed4de713ccdb1f54",
"score": "0.58444923",
"text": "def moves\n directions = MOVE_DIRECTIONS[self.piece_type]\n directions.map do |(dx, dy)|\n x, y = self.position\n [x + dx, y + dy]\n end.select { |coord| on_board?(coord) && not_blocked?(coord) }\n\n # cond = board[[coord]].nil? || board[[coord]].color != self.color\n # opp_cond = !(board[coord].color == self.color)\n # coord = [2,4]\n # [[2,3], nil, [3,4]]\n #(self.board[coord].color != self.color)\n end",
"title": ""
},
{
"docid": "d6e6020048e1d0d3a7c20abf26cb1e95",
"score": "0.58434165",
"text": "def positions\n relative_positions = []\n # As directional positions:\n # -1 = the bug's left\n # 0 = the bug's front\n # 1 = the bug's right\n -1.upto(1) {|i|\n n = i + @direction\n if n >= 4\n n = 0\n end\n relative_positions << n\n }\n # As relative positions:\n # 0 = to the north of the bug\n # 1 = to the east of the bug\n # 2 = to the south of the bug\n # 3 = to the west of the bug\n relative_positions\n # A translation from relative positions to the offsets needed\n # to get the absolute position.\n changes = [\n Point[0, -1], # north (0)\n Point[1, 0], # east (1)\n Point[0, 1], # south (2)\n Point[-1, 0] # west (3)\n ]\n # Calculate the absolute positions.\n result = {}\n relative_positions.each {|p|\n if p < 0\n p = 3\n end\n result[directions[p]] = @position + changes[p]\n }\n result\n end",
"title": ""
},
{
"docid": "ab32a1214bbc0ce8cc4da1a4c4d17e45",
"score": "0.5830604",
"text": "def valid_moves_array(game_id, id)\n piece = Game.find(game_id).pieces.find_by(id: id)\n valid_moves_array = []\n if piece.present? && piece.color == Game.find(game_id).turn\n valid_moves_array = [[piece.x_coordinate, piece.y_coordinate]]\n (0..7).each do |y_target|\n (0..7).each do |x_target|\n valid_moves_array << [x_target, y_target] if piece.valid_move?(x_target, y_target)\n end\n end\n valid_moves_array\n end\n end",
"title": ""
},
{
"docid": "1a7d2dd4ae2e201d76167f7ea2c556ee",
"score": "0.58040565",
"text": "def grow_unblocked_moves_in_dir(dx, dy)\n collected_moves = []\n # debugger\n x, y = @position\n # debugger\n until !@board.valid_pos?([x,y]) # if !@board[new_pos].nil? # add position occupied when you can reference pieces. \n y += dy\n x += dx\n # debugger\n new_pos = [x, y]\n # debugger\n # if !@board[new_pos].nil?\n # if self.color != @board[new_pos].color\n # collected_moves << new_pos\n # end\n # end\n collected_moves << new_pos if @board.valid_pos?(new_pos)\n # debugger\n end\n collected_moves if !collected_moves.empty? \n end",
"title": ""
},
{
"docid": "8215faeac140161b51a7f93a687082f2",
"score": "0.5804038",
"text": "def piece_from(row_index, column_index)\n case direction\n when 'up'\n [row_index, column_index + 1]\n when 'down'\n [row_index, column_index - 1]\n when 'left'\n [row_index - 1, column_index]\n when 'right'\n [row_index + 1, column_index]\n when 'up-right'\n [row_index + 1, column_index + 1]\n when 'up-left'\n [row_index - 1, column_index + 1]\n when 'down-right'\n [row_index + 1, column_index - 1]\n when 'down-left'\n [row_index - 1, column_index - 1]\n when 'double-up'\n [row_index, column_index + 2]\n end\n end",
"title": ""
},
{
"docid": "a6ba3e921bdf507e65b963248ab3d126",
"score": "0.5797311",
"text": "def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end",
"title": ""
},
{
"docid": "9c5fd5d28ae090e0bc41931e56ce8e5d",
"score": "0.57925475",
"text": "def children\n potential_moves = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |ele, j|\n pos = [i, j]\n potential_moves << pos if @board.empty?(pos)\n end\n end\n \n new_mark = self.switch_mark\n potential_moves.map! do |pos|\n new_board = @board.dup \n new_board[pos] = next_mover_mark\n self.class.new(new_board, new_mark, pos)\n end\n \n return potential_moves\n end",
"title": ""
},
{
"docid": "477c85f31d2016d29826621f528e79db",
"score": "0.57820046",
"text": "def update_capture_coord\n return true unless @piece_moving and @piece_moving.kind_of?(Pawn)\n if @piece_moving.is_en_passant_capture( from_coord, to_coord - from_coord , @board)\n self[:capture_coord] = (Position.new(to_coord) + [ - Sides[@piece_moving.side].advance_direction, 0]).to_s\n end\n end",
"title": ""
},
{
"docid": "30fc3cd19ecdb0378f197b2097c398bd",
"score": "0.57703716",
"text": "def new_coords(x,y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end",
"title": ""
},
{
"docid": "d1c11a6ef7d302b05f3075b7a407f815",
"score": "0.57613665",
"text": "def normal_moves\n direction = NORMAL_MOVES[self.color]\n \n [check_validity(direction)]\n \n if pos_valid \n item_at_pos = @board.get_piece(current_row,current_col)\n \n if item_at_pos.nil? || item_at_pos.color != self.color\n [current_row, current_col]\n end\n end\n \nend",
"title": ""
},
{
"docid": "04d8fbd29d00c09c65d2afe4e7d2ff5d",
"score": "0.5754586",
"text": "def pieces_at(x, y)\n @board[x][y]\n end",
"title": ""
},
{
"docid": "4990b279817d3d4a632b20a8c130ddf3",
"score": "0.574131",
"text": "def coords_ahead\n dx = (dir_index - 2).remainder(2).to_i\n dy = (dir_index - 1).remainder(2).to_i\n [posx - dx, posy - dy]\n end",
"title": ""
},
{
"docid": "946284f8296a8f875b28d61d8b52b225",
"score": "0.57386404",
"text": "def rectilinear_obstruction_array(destination_row, destination_col)\n # Store initial variables\n new_row_position = current_row_index\n new_column_position = current_column_index\n obstruction_array = []\n # Determine horizontalincrements\n if new_row_position == destination_row # protector piece is on same row with king\n # begin moving across column positions\n column_increment = destination_col > new_column_position ? 1 : -1\n new_column_position += column_increment\n while (destination_col - new_column_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_column_position += column_increment\n end\n elsif new_column_position == destination_col # protector piece is on same column with king\n # begin moving across row positions\n row_increment = destination_row > new_row_position ? 1 : -1\n new_row_position += row_increment\n while (destination_row - new_row_position).abs > 0\n obstruction_array << [new_row_position, new_column_position]\n new_row_position += row_increment\n end\n end\n # return obstruction array (values will be checked later )\n obstruction_array\n end",
"title": ""
},
{
"docid": "65bddcfdba104d0cc42e041a535efdab",
"score": "0.5737517",
"text": "def possible_jumps\n pos_jumps = [ ]\n row, col = @pos\n move_diffs.each do |row_change, col_change| \n jumped_piece = [row + row_change, col + col_change]\n new_position = [row + (row_change * 2), (col + col_change * 2)]\n unless @grid[jumped_piece].nil? || @grid[jumped_piece].color == @color\n pos_jumps << new_position\n end\n end\n pos_jumps\n end",
"title": ""
},
{
"docid": "02a515850dd103ba4cddcde10d549758",
"score": "0.5729743",
"text": "def coord_array\n _coords.dup\n end",
"title": ""
},
{
"docid": "2513b29f217c2fdc1677b2d2ace99e84",
"score": "0.57261026",
"text": "def insert_piece(piece,x,y) \n piece.points.each { |point| \n #puts \"Inserting #{point[0]},#{point[1]} to #{x},#{y}\" \n @pole[x+point[0]][y-point[1]] = piece.name\n }\n end",
"title": ""
},
{
"docid": "997be99f81375fe12dc08ca7ccd7184c",
"score": "0.5723405",
"text": "def generate_adj_pos (x, y)\n adj_pos = Array.new()\n top_y = position_translate(y) - 1\n bottom_y = top_y + 2\n left_x = position_translate(x) - 1\n right_x = left_x + 2\n new_x = position_translate(x)\n new_y = position_translate(y)\n if valid_edge(top_y, new_x)\n adj_pos.push([x , y - 1])\n end\n if valid_edge(bottom_y, new_x)\n adj_pos.push([x, y + 1])\n end\n if valid_edge(new_y, left_x)\n adj_pos.push([x - 1, y])\n end\n if valid_edge(new_y, right_x)\n adj_pos.push([x + 1, y])\n end\n return adj_pos\n end",
"title": ""
},
{
"docid": "cc7e7d7e532fd25a9fd46022ceb6ca16",
"score": "0.5721613",
"text": "def relative_coords(from, move)\n [from[0] + move[0], from[1] + move[1]]\n end",
"title": ""
},
{
"docid": "5bb6cb988dac6b3a60a6818ab6ecc938",
"score": "0.5718138",
"text": "def coords; {:x => @x, :y => @y} end",
"title": ""
},
{
"docid": "c4f814d3ce0c32ba2ab5da0c4fcfb3ce",
"score": "0.5716204",
"text": "def movements\n @movements ||= {\n \"s\" => -> (x, y, z) { [x, y - 1, z + 1] },\n \"n\" => -> (x, y, z) { [x, y + 1, z - 1] },\n \"ne\" => -> (x, y, z) { [x + 1, y, z - 1] },\n \"se\" => -> (x, y, z) { [x + 1, y - 1, z] },\n \"nw\" => -> (x, y, z) { [x - 1, y + 1, z] },\n \"sw\" => -> (x, y, z) { [x - 1, y, z + 1] },\n }\n end",
"title": ""
},
{
"docid": "f92a9ab2c272a4dad1f8722c37d4913d",
"score": "0.57162005",
"text": "def new_coords(x, y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end",
"title": ""
},
{
"docid": "f10939cc6e04ae6b30d13c772780b39a",
"score": "0.57106394",
"text": "def position\n V[x, y]\n end",
"title": ""
},
{
"docid": "592418d9506d4198cba6a873a1e46755",
"score": "0.5708759",
"text": "def trans(coord)\n\treturn [coord[0]+600, -coord[1]+350]\nend",
"title": ""
},
{
"docid": "45fe3387549faa8ccf8452c5fd808ac0",
"score": "0.5699528",
"text": "def pos=(p0) end",
"title": ""
},
{
"docid": "45fe3387549faa8ccf8452c5fd808ac0",
"score": "0.5699528",
"text": "def pos=(p0) end",
"title": ""
},
{
"docid": "45fe3387549faa8ccf8452c5fd808ac0",
"score": "0.5699528",
"text": "def pos=(p0) end",
"title": ""
},
{
"docid": "45fe3387549faa8ccf8452c5fd808ac0",
"score": "0.5699528",
"text": "def pos=(p0) end",
"title": ""
},
{
"docid": "7d61f54b216860be89ef8c90354bde4a",
"score": "0.56927174",
"text": "def grow_unblocked_moves_in_dir(dx, dy) #(0,1) move one to the right \n # create an array to collect moves\n collected_moves = []\n\n # get the piece's current row and current column\n current_col = self.pos[0]\n current_row = self.pos[1]\n\n move_col = dx\n move_row = dy\n\n # stop looping if the new position is invalid (not on the board); the piece can't move in this direction\n while self.board.valid_pos?([current_col,current_row]) #valid_pos?\n # continually increment the piece's current row and current column to generate a new position\n current_col += move_col\n current_row += move_row\n\n # last round\n if self.board.valid_pos?([current_col,current_row])\n break\n end\n\n # if the new position is empty, the piece can move here, so add the new position to the moves array\n if self.board[current_col][current_row] == nil \n collected_moves << [current_col, current_row]\n end\n # if the new position is occupied with a piece of the opposite color, the piece can move here (to capture the opposing piece),\n # so add the new position to the moves array and stop looping\n if self.board[current_col][current_row].color != self.color\n collected_moves << [current_col, current_row]\n break\n end\n # if the new position is occupied with a piece of the same color, stop looping\n if self.board[current_col][current_row].color == self.color\n break\n end\n\n # return the final moves array\n end\n collected_moves\n end",
"title": ""
},
{
"docid": "26b5ad27a7294ea91db9eced3b9b89c5",
"score": "0.56900805",
"text": "def position\n [ChessBoard.col_index(pos[0]), pos[1].to_i]\n end",
"title": ""
},
{
"docid": "3ebc5e5d551f0ada84322ae31d9ca91d",
"score": "0.5686615",
"text": "def side_moving\n return @piece_moving.side if @piece_moving\n end",
"title": ""
},
{
"docid": "1b78a21b9a93b100b190575648fc01a5",
"score": "0.5680726",
"text": "def position \n\t\treturn @y,@x\n\tend",
"title": ""
},
{
"docid": "4f8db88409add23ced564d870d8cb807",
"score": "0.5676278",
"text": "def get_new_coordinates(choice)\n selected_move = moveset[possible_moves[choice]]\n return x + selected_move[0], y + selected_move[1]\n end",
"title": ""
},
{
"docid": "90a463f21f037f50daa7dee59852b7e3",
"score": "0.56708694",
"text": "def king_coords(side)\n king = game_of_piece.pieces.find_by(type: 'King', color: side)\n [king.x_position, king.y_position]\n end",
"title": ""
},
{
"docid": "19b053e5f533dbff50d8a5c0ddd431ac",
"score": "0.5664263",
"text": "def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"title": ""
},
{
"docid": "335ad7265dbe3e3e37f23e92265f4c21",
"score": "0.565216",
"text": "def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y-1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y-1]\n positions_array << next_position if position_check(next_position)\n positions_array\n end",
"title": ""
},
{
"docid": "45de631269bf24746fd5e6b3854d1a1c",
"score": "0.5650415",
"text": "def position\n [ @x, @y, COMPASS[@orientation].to_s ]\n end",
"title": ""
},
{
"docid": "92bee6a90b8c7cdd590de41f656f62a0",
"score": "0.56469876",
"text": "def paddle_y\n @cr[9]\n end",
"title": ""
},
{
"docid": "03d27e80c3e1b04a108b21ad3d366df2",
"score": "0.56391007",
"text": "def get_piece(pos)\n @grid[pos[0]][pos[1]]\n end",
"title": ""
},
{
"docid": "e4ea5c40b18e37a0d8a2cd9e9769b83e",
"score": "0.5635454",
"text": "def change(move)\n value = self.dup\n value[0] += move[0]\n value[1] += move[1]\n Position.new(value)\n end",
"title": ""
},
{
"docid": "20bbbaafa49a788cabcb3401b891091f",
"score": "0.56294626",
"text": "def translate(x, y)\n [ x - bounds.x, y - bounds.y ]\n end",
"title": ""
},
{
"docid": "b07dd68a6ebaf4d42889ae963025342c",
"score": "0.56237787",
"text": "def calculate_ghost_piece\n # Duplicate the oiece that is in play\n @ghost_piece = @in_play.class.new(@object_array, @window)\n @ghost_piece.position[:x] = @in_play.position[:x]\n @ghost_piece.position[:y] = @in_play.position[:y]\n\n # Change the values of the ghost piece array so that the opacity color can be applied\n @ghost_piece.object_array = @in_play.object_array.map do |row|\n row.map { |cell| cell.zero? ? 0 : cell + 10 }\n end\n\n # Move the ghost piece down as far as it can go\n @ghost_piece.hard_drop(main_piece: false)\n end",
"title": ""
},
{
"docid": "145e66771ecacb9dc5ce32c9ec227776",
"score": "0.5618165",
"text": "def getPossibleFrom move\n possibleFrom = []\n move.board.pieces[move.piece.colour][move.piece.class.to_s.to_sym].each do |coord, piece|\n possibleFrom << coord\n end\n possibleFrom\n end",
"title": ""
},
{
"docid": "beba4cc00eea08d825ba1a90b9f52f6a",
"score": "0.5617646",
"text": "def grow_unblocked_moves_in_dir(dx, dy) #(0,-1)\n current_pos = [ [self.pos[0], self.pos[1]] ] \n until !valid_pos?(current_pos[-1])\n next_pos = [current_pos[-1][0] + dx, current_pos[-1][1] + dy] \n next_tile = self.board[next_pos]\n if next_tile.is_a?(NullPiece)\n current_pos << next_pos\n else\n if next_tile.color != self.color\n current_pos << next_pos\n break\n else\n break\n end\n end\n end\n\n current_pos[1..-1]\n end",
"title": ""
},
{
"docid": "4ebd5335ac6b75b46709ae241db227ba",
"score": "0.5614249",
"text": "def initialize\n @coordinates = Array.new(2)\n @piece = nil\n end",
"title": ""
},
{
"docid": "6a778e8fa72a585cf80efcfc69527609",
"score": "0.5609195",
"text": "def pos_to_a\r\n [ pos.x, pos.y ]\r\n end",
"title": ""
},
{
"docid": "5f401c13899f9da79cc89f4261169ed9",
"score": "0.5608993",
"text": "def en_passant_coords(from)\n pawn = @board.at(from)\n [1, -1].each do |x|\n next_coords = [from[0] + x, from[1]]\n next_piece = @board.at(next_coords)\n if next_piece.class == Pawn && next_piece == @last_piece &&\n next_piece.moves_count == 1 && from[1].between?(3, 4)\n return [from[0] + x, from[1] + pawn.direction]\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "7fab03faae6fdfb9bcc40c4eb02d2d65",
"score": "0.55934787",
"text": "def coords\n [x, y]\n end",
"title": ""
},
{
"docid": "1a8149d401d6dedecf0655e3398e966d",
"score": "0.5588622",
"text": "def get_valid_moves(pos)\n piece = self[pos]\n color = piece.color\n potential_moves = piece.potential_moves\n valid_moves = []\n potential_moves.each do |to_pos|\n if self.valid_move?(pos, to_pos, color)\n valid_moves << to_pos\n end\n end\n valid_moves\n end",
"title": ""
},
{
"docid": "96626696766b6206246d42250db60e02",
"score": "0.5588313",
"text": "def offsets_to_coordinates(offsets, piece, game)\n board = game.board\n coordinates = []\n current_position_index = coord_to_index(piece, board)\n # if current_position_index.nil?\n # byebug\n # end\n\n offsets.each do |offset|\n adjusted_index = current_position_index + offset\n tile = board.keys[adjusted_index].to_s if adjusted_index.between?(0,63)\n coordinates << tile\n end\n\n if coordinates.length == 1\n return coordinates[0]\n else\n return coordinates.compact\n end\n end",
"title": ""
},
{
"docid": "7c96b34a71b788736abb4315e67aceb7",
"score": "0.5586363",
"text": "def grow_unblocked_moves_in_dir(dx, dy)\n cur_x, cur_y = self.position\n moves = []\n loop do\n cur_x, cur_y = cur_x + dx, cur_y + dy\n pos = [cur_x, cur_y]\n\n break unless board.valid_pos?(pos)\n\n if board.[](pos).empty?\n moves << pos\n else\n # can take an opponent's piece\n moves << pos if board[pos].color != color\n\n # can't move past blocking piece\n break\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "b240661724d142628516e8ec23838513",
"score": "0.55863255",
"text": "def piece_at(position)\n row = position[0]\n col = position[1]\n @grid[row][col]\n end",
"title": ""
},
{
"docid": "3e8c7a14adc05954ddc7b235f3c251c6",
"score": "0.5582004",
"text": "def points; end",
"title": ""
},
{
"docid": "3fc584525dc716b7e44d8393ebc87195",
"score": "0.5577118",
"text": "def coordinates\n [@y_location, @x_location]\n end",
"title": ""
},
{
"docid": "8f09e83c4cd4474c2a5154f21867b0e5",
"score": "0.5574812",
"text": "def grow_unblocked_moves_in_dir(dx, dy)\n sx, sy = self.pos[0], self.pos[1]\n ally_color = self.color\n enemy_color = self.color == :white ? :black : :white\n moves = []\n\n until (sx < 0 || sx > 7) || (sy < 0 || sy > 7)\n new_pos = [sx + dx, sy + dy]\n break if new_pos.any? {|coord| !coord.between?(0,7)}\n # stop adding moves if there is an ally piece in the position.\n new_spot = self.board[new_pos]\n break if new_spot.nil? || new_spot.color == ally_color\n # end\n moves << new_pos\n # after adding the position, break if there was an enemy piece in the position.\n break if new_spot.color == enemy_color\n sx += dx\n sy += dy\n\n end\n # Reject the moves that would be off the chess board.\n moves.reject! { |pos| pos.any? { |num| num < 0 || num > 7}}\n moves\n end",
"title": ""
},
{
"docid": "5dd4bba02215c4895291bd7a773a7cfc",
"score": "0.55729103",
"text": "def position(y, x)\n [START[0] + (y * SPACING[0]),\n START[1] + (x * SPACING[1])]\n end",
"title": ""
},
{
"docid": "a338cd3c98bfab7836e6509851cd49c7",
"score": "0.55701697",
"text": "def projected_move\n\t\t\t\traise NotYetPlaced if been_placed.nil?\n\n\t\t\t\t_x = x\n\t\t\t\t_y = y\n\t\t\t\tcase face\n\t\t\t\twhen 'NORTH'\n\t\t\t\t\t_y += 1\n\t\t\t\twhen 'EAST'\n\t\t\t\t\t_x += 1\t\t\t\t\t\n\t\t\t\twhen 'SOUTH'\n\t\t\t\t\t_y -= 1\n\t\t\t\twhen 'WEST'\n\t\t\t\t\t_x -= 1\t\t\t\t\t\n\t\t\t\tend\n\t\t\t\t[_x, _y]\n\t\t\tend",
"title": ""
},
{
"docid": "021e4166abdc2fa51f6bdd5d4b6fa1e5",
"score": "0.5567003",
"text": "def player_position_look_update; end",
"title": ""
},
{
"docid": "dd61ca77a5be484b945d5c975a7bc718",
"score": "0.5565169",
"text": "def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end",
"title": ""
},
{
"docid": "9f0fc50b3526defea6092ee819ac8749",
"score": "0.5564707",
"text": "def movement(row1, col1, board)\n\n possible_moves=Array.new\n if @color==\"white\"\n # checking square in front\n if row1+1<8 && board.get_square(row1+1,col1).occupied==false\n possible_moves <<[row1+1,col1]\n\n #checking 2 squares forward\n if @position==\"initial\" && !board.get_square(row1+2,col1).occupied\n possible_moves <<[row1+2,col1]\n end\n end\n\n # checking attacking squares\n if row1+1<8 && col1-1>=0\n atk_sq1 = board.get_square(row1+1,col1-1)\n\n if atk_sq1.occupied && atk_sq1.piece.color != @color || !atk_sq1.occupied && atk_sq1.en_passanted\n possible_moves <<[row1+1,col1-1]\n end\n end\n if row1+1<8 && col1+1<8\n atk_sq2 = board.get_square(row1+1,col1+1)\n if atk_sq2.occupied && atk_sq2.piece.color != @color || !atk_sq2.occupied && atk_sq2.en_passanted\n possible_moves <<[row1+1,col1+1]\n end\n end\n\n elsif @color==\"black\"\n # checking square in front\n if row1-1>=0 && board.get_square(row1-1,col1).occupied==false\n possible_moves <<[row1-1,col1]\n\n # checking for 2 squares forward\n if @position==\"initial\" && board.get_square(row1-2,col1).occupied==false\n possible_moves <<[row1-2,col1]\n end\n end\n\n # checking attacking squares\n if row1-1>=0 && col1-1>=0\n atk_sq1 = board.get_square(row1-1,col1-1)\n if (atk_sq1.occupied && atk_sq1.piece.color != @color) || (!atk_sq1.occupied && atk_sq1.en_passanted)\n possible_moves <<[row1-1,col1-1]\n end\n end\n if row1-1>=0 && col1+1<8\n atk_sq2 = board.get_square(row1-1,col1+1)\n if (atk_sq2.occupied && atk_sq2.piece.color != @color) || (!atk_sq2.occupied && atk_sq2.en_passanted)\n possible_moves <<[row1-1,col1+1]\n end\n end\n end\n\n #removing moves that go off the board\n possible_moves = possible_moves.select do |a|\n a[0]>=0 && a[0]<8 && a[1]>=0 && a[1]<8\n end\n\n return possible_moves\n\n end",
"title": ""
},
{
"docid": "10ab13c0ff8bc8166e9955830139b395",
"score": "0.55611223",
"text": "def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end",
"title": ""
},
{
"docid": "1f640052c153065f78a594b25cd4d5b0",
"score": "0.55589414",
"text": "def location\n [@posX, @posY, @facing]\n end",
"title": ""
},
{
"docid": "caed5eb190b470ff90c1c4bd1f44318a",
"score": "0.5545346",
"text": "def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend",
"title": ""
},
{
"docid": "c509740437707f8698a27ac88e4ab665",
"score": "0.55445814",
"text": "def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] is the y\n side.each do |test_piece|\n # Run move validation tests on every piece\n next unless test_piece.move_tests(to_x: t, to_y: i[j])\n # if a move passes validations, push the pieces ID and the\n # coordinates of a successful move to the possible_moves array\n possible_moves << [test_piece.id, t, i[j]]\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "fdb1000d4541608be261258a32008106",
"score": "0.5543372",
"text": "def get_poss_moves\n x = @location[0] #x is row\n y = @location[1] #y is column\n\n move_list = [] #quarter circle forward punch\n\n if @colour == \"white\"\n move_list = white_pawn_moves(x,y)\n else\n move_list = black_pawn_moves(x,y)\n end\n\n possible_moves = move_list.select { |e|\n (e[0] >= 0) && (e[0] <= 7) && (e[1] >= 0) && (e[1] <= 7)\n }\n possible_moves\n end",
"title": ""
},
{
"docid": "ce66244b80fcd165ea53b64d5ca083c7",
"score": "0.55413723",
"text": "def corner_points_of_entity(x, y)\n [\n [x, y],\n [x + Entity::WIDTH - 1, y],\n [x, y + Entity::HEIGHT - 1],\n [x + Entity::WIDTH - 1, y + Entity::HEIGHT - 1],\n ]\n end",
"title": ""
},
{
"docid": "31cdae7f2dee71af86e044ae23e1e471",
"score": "0.5533111",
"text": "def moves\n end",
"title": ""
},
{
"docid": "3c740a69769e4c400fee42cb6f6c1173",
"score": "0.55309427",
"text": "def ai\n axes_for_win = @board.axes_for_sum[(@board.n - 1) * @board.xORo_hash[@player.xORo]]\n move = nil\n pos = nil\n if axes_for_win\n [:row, :col, :d].each do |type|\n if move\n break\n end\n if axes_for_win[type]\n axes_for_win[type].each do |axis, present|\n if present\n move = [type, axis]\n break\n end\n end\n end\n end\n end\n\n if move\n if move == :row\n (0...@board.n).each do |i|\n if @board.empty?(move[1], i)\n pos = [move[1], i]\n break\n end\n end\n elsif move[0] == :col\n (0...@board.n).each do |i|\n if @board.empty?(i, move[1])\n pos = [i, move[1]]\n break\n end\n end\n elsif move[1] == 0\n (0...@board.n).each do |i|\n if @board.empty?(i, i)\n pos = [i, i]\n break\n end\n end\n else\n (0...@board.n).each do |i|\n if @board.empty?(i, @board.n - i - 1)\n pos = [i, @board.n - i - 1]\n end\n end\n end\n pos\n else\n possible_pos = []\n (0...@board.n).each do |i|\n (0...@board.n).each do |j|\n if @board.empty?(i, j)\n possible_pos << [i, j]\n end\n end\n end\n pos = possible_pos.sample\n end\n pos\n end",
"title": ""
},
{
"docid": "5055a1af7d80fc440cedcdb1105a454b",
"score": "0.5529112",
"text": "def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"title": ""
},
{
"docid": "f564602a8154c8565a9f1e95b14a5229",
"score": "0.55284214",
"text": "def get_position(full_move)\n full_move[0..1].map { | num | num.to_i - 1 }\n end",
"title": ""
},
{
"docid": "40db2a1193b45c97ee12f1524baff300",
"score": "0.55252284",
"text": "def move_friendly_piece(x,y)\n update_attributes(position_x: x, position_y: y)\n end",
"title": ""
}
] |
26920d77c2084c9626c03c63f4351bbc
|
Metodo para encerrar o evento
|
[
{
"docid": "3759e7e40e7cc15afb0cd033e2867466",
"score": "0.0",
"text": "def bloquea\r\n\r\n #@sivic_professor = SivicProfessor.find(\"#{params[:id]}\")\r\n\r\n @sivic_professor = SivicProfessor.find(params[:id])\r\n\r\n @sivic_professor.update(:DATA_bloqueio => Time.now, :user_bloqueio => current_user.id)\r\n\r\n respond_to do |format|\r\n format.html { redirect_to sivic_professors_path }\r\n format.json { head :no_content }\r\n\r\n end\r\n end",
"title": ""
}
] |
[
{
"docid": "7effd0ae986668c88bd472c58ed8d73f",
"score": "0.7427982",
"text": "def encode_event(exi_event)\n end",
"title": ""
},
{
"docid": "08e58c65890de474706bb96cfd5615cf",
"score": "0.6556125",
"text": "def write( event )\n nil\n end",
"title": ""
},
{
"docid": "f395567b5553c413369d5a6476d6116b",
"score": "0.65386",
"text": "def send_events; end",
"title": ""
},
{
"docid": "b9aebf0a08d859d6f478911d6438ea0c",
"score": "0.63965607",
"text": "def write!( event )\n # Not implemented\n end",
"title": ""
},
{
"docid": "73d6f9710758f420259709cf4a356bf5",
"score": "0.6285456",
"text": "def store_event( event )\n\t\ttime = event.delete( '@timestamp' )\n\t\ttype = event.delete( '@type' )\n\t\tversion = event.delete( '@version' )\n\n\t\tdata = JSON.generate( event )\n\t\theaders = {\n\t\t\ttime: time,\n\t\t\ttype: type,\n\t\t\tversion: version,\n\t\t\tcontent_type: 'application/json',\n\t\t\tcontent_encoding: data.encoding.name,\n\t\t\ttimestamp: Time.now.to_f,\n\t\t}\n\n\t\t@amqp_exchange.value.publish( data, headers )\n\tend",
"title": ""
},
{
"docid": "0e276fcca6b34a031f73b0f330985a8d",
"score": "0.61134875",
"text": "def event; end",
"title": ""
},
{
"docid": "0e276fcca6b34a031f73b0f330985a8d",
"score": "0.61134875",
"text": "def event; end",
"title": ""
},
{
"docid": "0e276fcca6b34a031f73b0f330985a8d",
"score": "0.61134875",
"text": "def event; end",
"title": ""
},
{
"docid": "9817c8b53b00110a90b12a6e13b2af3f",
"score": "0.6098577",
"text": "def send_events=(_arg0); end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "ff1cb32628977acc28cd1a7e6b85541e",
"score": "0.5922929",
"text": "def events; end",
"title": ""
},
{
"docid": "014d091646b3e8435511fd023a47bcb4",
"score": "0.5919997",
"text": "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(map_event(event))\n elsif @format == \"message\"\n event.sprintf(@message)\n else\n encode(map_event(event))\n end\n end",
"title": ""
},
{
"docid": "716b5b021733fe218de0a4aca3da4358",
"score": "0.591803",
"text": "def human_event; end",
"title": ""
},
{
"docid": "05df124ce0981e03bc17a930466f4489",
"score": "0.59172046",
"text": "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n LogStash::Json.dump(map_event(event))\n elsif @format == \"message\"\n event.sprintf(@message)\n elsif @format == \"json_batch\"\n LogStash::Json.dump(event.map {|e| map_event(e) })\n else\n encode(map_event(event))\n end\n end",
"title": ""
},
{
"docid": "5748aa0a0c912e6ed47e8c07f2e065a4",
"score": "0.5886032",
"text": "def event_bus; end",
"title": ""
},
{
"docid": "5748aa0a0c912e6ed47e8c07f2e065a4",
"score": "0.5886032",
"text": "def event_bus; end",
"title": ""
},
{
"docid": "b0e35cea1dbbbe3bf02a802a2fbf1c32",
"score": "0.5770809",
"text": "def events=(_); end",
"title": ""
},
{
"docid": "2089c0a6d1594623dfafbc521c7d05de",
"score": "0.5744889",
"text": "def event_params\n\n\n end",
"title": ""
},
{
"docid": "2deb25ee6441bc558bf9a820ceed9e3b",
"score": "0.5741663",
"text": "def event_body(event)\n # TODO: Create an HTTP post data codec, use that here\n if @format == \"json\"\n documents = []\n document = event.to_hash()\n documents.push(document)\n LogStash::Json.dump(documents)\n elsif @format == \"message\"\n event.sprintf(@message)\n else\n encode(map_event(event))\n end\n end",
"title": ""
},
{
"docid": "2164a080977fd0c5e698006c7b4e315a",
"score": "0.5733969",
"text": "def events\n end",
"title": ""
},
{
"docid": "d43f0173cbb84a4e43d34d423b97e2a6",
"score": "0.57290536",
"text": "def write_events(events)\n @events += @before_write.call(events)\n end",
"title": ""
},
{
"docid": "a86c2a09304964318225c9edecaf4b00",
"score": "0.57258546",
"text": "def to_wires_event; self; end",
"title": ""
},
{
"docid": "916bdaa214ac42662cf9f07a00df6680",
"score": "0.57178885",
"text": "def write( event )\n add_to_buffer event\n self\n end",
"title": ""
},
{
"docid": "98d912d9f7d300fd10dac2bb325a7749",
"score": "0.5716952",
"text": "def create_events\n end",
"title": ""
},
{
"docid": "cef10dd293c7952b3f8a53b42abc0be2",
"score": "0.57074076",
"text": "def event_str\n if (event == nil)\n event_str = \"unknown event\"\n else\n event_str = event.to_s\n end\n event_str\n end",
"title": ""
},
{
"docid": "846efc3ed188877174a2180344ee9e7a",
"score": "0.5656726",
"text": "def processEvent(eventName)\n\tend",
"title": ""
},
{
"docid": "9ee62bc46d51f591a888592794d5a4c5",
"score": "0.5654569",
"text": "def qualified_event; end",
"title": ""
},
{
"docid": "9ee62bc46d51f591a888592794d5a4c5",
"score": "0.5654569",
"text": "def qualified_event; end",
"title": ""
},
{
"docid": "bcdf19de65ea8812c52fda1016eb6944",
"score": "0.56404245",
"text": "def save_event(event_type, timestamp=nil, event)\n retval orchio_put_event(event_type, timestamp, event.to_json), event\n end",
"title": ""
},
{
"docid": "1a00bc6e16cc3d378e7db9846ea096aa",
"score": "0.5615531",
"text": "def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'EventKey' => 'ping', # will send a pong\n }\nend",
"title": ""
},
{
"docid": "b4776e0c908c95aa92ab2e109ba803a0",
"score": "0.55855924",
"text": "def save\n MoxiworksPlatform::Event.update(self.to_hash)\n end",
"title": ""
},
{
"docid": "c59df60f76396ab88b53d4893da47fe5",
"score": "0.5559606",
"text": "def write_code_events file_name, events\n write_events(file_name,[\"commit\",\"committer\",\"status\",\"date\",\"file_name\",\"method_name\",\"method_length\"], events)\nend",
"title": ""
},
{
"docid": "8737ea7887e77750628ffd3c6a54eb69",
"score": "0.5537285",
"text": "def event_context\n {\n service: service,\n category: category,\n name: name,\n data: data,\n timestamp: Time.now.utc,\n uuid: SecureRandom.uuid\n }\n end",
"title": ""
},
{
"docid": "91fbd749a11968635303e61d21013a75",
"score": "0.55281454",
"text": "def event_body(event)\n LogStash::Json.dump(cfapi([event]))\n end",
"title": ""
},
{
"docid": "d171a9cf192fa7d5fdd020dea288091b",
"score": "0.55189687",
"text": "def handle_event(event)\n\n\t\tend",
"title": ""
},
{
"docid": "a6ade7da71c94d2b97a96c89876cb396",
"score": "0.5512253",
"text": "def transmission; end",
"title": ""
},
{
"docid": "5de6629113bfeb01652a4e6f90fb1939",
"score": "0.5511202",
"text": "def serialize_events( events )\n\t\treturn events.map( &SERIALIZE_PIPELINE )\n\tend",
"title": ""
},
{
"docid": "5de6629113bfeb01652a4e6f90fb1939",
"score": "0.5511202",
"text": "def serialize_events( events )\n\t\treturn events.map( &SERIALIZE_PIPELINE )\n\tend",
"title": ""
},
{
"docid": "5ac649b0b18a606e7af5b5ce4f3bda53",
"score": "0.5486943",
"text": "def event\n @event\n end",
"title": ""
},
{
"docid": "11c3f17fd09b00a340024ed96b7ec880",
"score": "0.54777145",
"text": "def event_change\n\t\n\tend",
"title": ""
},
{
"docid": "4d297c4c82f1ecaef384198891aa02e9",
"score": "0.5471337",
"text": "def event_invite(user_event)\n\t headers[\"Custom-header\"] = \"Bar\"\n\t @record = user_event\n\t \tmail(:to => user_event.user.email, :subject => \"Você foi convidado para o Evento #{user_event.event.title}\")\n\tend",
"title": ""
},
{
"docid": "745daf801c003fb7a4f771a00fe1ec0f",
"score": "0.54566944",
"text": "def event_params\n params[:title] = encrypt_param params[:title]\n params.permit(:title, :from, :frequency, :completed, :user_id)\n end",
"title": ""
},
{
"docid": "95af6646ca0073af2be1971c82fb5ced",
"score": "0.5444923",
"text": "def format(logevent)\n end",
"title": ""
},
{
"docid": "996c969d1ae83129c7a1bf324957e01e",
"score": "0.5440486",
"text": "def to_json\n hash = {}\n self.instance_variables.each do |var|\n hash[var.to_s.sub(/^@/, '')] = self.instance_variable_get var\n end\n '{\"event\":' + hash.to_json + '}'\n end",
"title": ""
},
{
"docid": "0f532f1cc3503e90cec125f7e2567a7b",
"score": "0.5424824",
"text": "def create_log_event(level, message, data=nil)\n event = {}\n event[:timestamp] = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S.%6N%z\")\n event[:level] = level\n event[:message] = message\n if data.is_a?(Hash)\n event.merge!(data)\n end\n# MultiJson.dump(event)\n Oj.dump(event)\n end",
"title": ""
},
{
"docid": "c58f15befbe131788d9fd9dae2224eec",
"score": "0.5414202",
"text": "def save\n this_event = FedoraAccessEvent.new\n this_event.pid = pid\n this_event.agent = agent.truncate(254)\n this_event.event = event\n this_event.location = ip_format(ip)\n this_event.event_time = event_time\n this_event.save\n end",
"title": ""
},
{
"docid": "d852e7a708f1571138ef579e0de07558",
"score": "0.54067826",
"text": "def write(chunk)\n body = ''\n chunk.msgpack_each {|(tag,time,record)|\n\n # define index and sourcetype dynamically\n begin\n index = expand_param(@index, tag, time, record)\n sourcetype = expand_param(@sourcetype, tag, time, record)\n event_host = expand_param(@event_host, tag, time, record)\n token = expand_param(@token, tag, time, record)\n rescue => e\n # handle dynamic parameters misconfigurations\n router.emit_error_event(tag, time, record, e)\n next\n end\n log.debug \"routing event from #{event_host} to #{index} index\"\n log.debug \"expanded token #{token}\"\n\n # Parse record to Splunk event format\n case record\n when Integer\n event = record.to_s\n when Hash\n if @send_event_as_json\n event = Yajl::Encoder.encode(record)\n else\n event = Yajl::Encoder.encode(record).gsub(\"\\\"\", %q(\\\\\\\"))\n end\n else\n event = record\n end\n\n sourcetype = @sourcetype == 'tag' ? tag : @sourcetype\n\n # Build body for the POST request\n if !@usejson\n event = record[\"time\"]+ \" \" + Yajl::Encoder.encode(record[\"message\"]).gsub(/^\"|\"$/,\"\")\n body << '{\"time\":\"'+ DateTime.parse(record[\"time\"]).strftime(\"%Q\") +'\", \"event\":\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + @source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n elsif @send_event_as_json\n body << '{\"time\" :' + time.to_s + ', \"event\" :' + event + ', \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n else\n body << '{\"time\" :' + time.to_s + ', \"event\" :\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n end\n\n if @send_batched_events\n body << \"\\n\"\n else\n send_to_splunk(body, token)\n body = ''\n end\n }\n\n if @send_batched_events\n send_to_splunk(body, token)\n end\n end",
"title": ""
},
{
"docid": "47eee87690626d8a8e419a3003ced91d",
"score": "0.53996176",
"text": "def send_event(type, name, id, info)\n message = create_message(:cmdtype => type, :target => @@myName, \n :value => name, :appID => id, :message => info) \n send_message(@@myECAddress, message)\n end",
"title": ""
},
{
"docid": "4c16e35d791399a4f56dfe49f794feef",
"score": "0.5388904",
"text": "def processEvent( client, user, t_event )\n#\t\tclient.room.say(\"Processing Event #{t_event}\")\n if user.id != client.user.id\n $botData['events'].each { |event|\n if event['event'] == t_event\n if event['delivery_method'].to_i == 1\n if event['include_name'].to_i == 0\n client.room.say(event['pre_text'] + event['post_text'])\n else\n client.room.say(event['pre_text'] + user.name + event['post_text'])\n end\n else\n if event['include_name'].to_i == 0\n user.say(event['pre_text'] + event['post_text'])\n else\n user.say(event['pre_text'] + user.name + event['post_text'])\n end\n end\n end\n }\n end\nend",
"title": ""
},
{
"docid": "56d60e6ddfee0be763518502cadcf86b",
"score": "0.5378007",
"text": "def apply(raw_event); end",
"title": ""
},
{
"docid": "38ebc0b0126274df50ffa3f1e455e5a9",
"score": "0.53691113",
"text": "def get_data(event, data={})\n self['event'] = event\n self['properties'] = data \n self['properties']['token'] = @key\n self['properties']['time'] = Time.now.to_i\n \n Base64.encode64(JSON.generate(self))\n end",
"title": ""
},
{
"docid": "d86e1b66459f328bbc0740c2162f0024",
"score": "0.53682005",
"text": "def acknowledged_event(user,event)\n @greeting = \"Hi\"\n @event = event\n mail to: user.email\n end",
"title": ""
},
{
"docid": "4dd7116e4b9248b56fc5b537b8be5ce7",
"score": "0.53672737",
"text": "def send_event\n raise 'send_event must be defined in the child class'\n end",
"title": ""
},
{
"docid": "e7a59f13e5d6eeba14d2f5ae77ae422c",
"score": "0.535955",
"text": "def handle_etf_message(data)\n data = Vox::ETF.decode(data)\n LOGGER.debug { \"Emitting #{OPCODES[data[:op]]}\" } if OPCODES[data[:op]] != :DISPATCH\n\n @session.seq = data[:s] if data[:s]\n op = OPCODES[data[:op]]\n\n emit(op, data)\n end",
"title": ""
},
{
"docid": "585368278ce6c9dfe962847e1567390a",
"score": "0.53539664",
"text": "def save_event(event)\n @events.push(event)\n end",
"title": ""
},
{
"docid": "c3886ee463cb716245080e71e326e865",
"score": "0.53514653",
"text": "def event_types; end",
"title": ""
},
{
"docid": "a981e7d68a4617056fec13a1aab25437",
"score": "0.53457475",
"text": "def create\n @event = Event.new(params[:event])\n @event.admin_key = SecureRandom.hex(4)\n \n respond_to do |format|\n if @event.save\n\n UserMailer.event_confirmation(@event).deliver\n\n format.html { redirect_to @event, notice: \"#{@event.admin}, your #{@event.name} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e34a238f43604da01e08421feff32fd",
"score": "0.53356636",
"text": "def event_params\n params.require(:event).permit(:titre, :description, :prix, :debut, :fin,\n :lieu, :adresse, :cp, :ville, :pays, :reduit, :contact,\n :transport, :photo, :site, :complement)\n end",
"title": ""
},
{
"docid": "787feeda9208c954a62557c79898ecb8",
"score": "0.53312457",
"text": "def decode(data, &block)\n # Creiamo l'evento\n event = LogStash::Event.new\n # Usiamo per il log la codifica UTF-8\n @utf8_charset.convert(data)\n # Se l'encoding non ha avuto successo non andiamo avanti nel parsing, nascerebbero errori\n fail('invalid byte sequence in UTF-8') unless data.valid_encoding?\n\n # Nel caso ci siano caratteri a delimitare l'inizio e alla fine del log, vengono rimossi\n if data[0] == \"\\\"\"\n data = data[1..-2]\n end\n \n # Il log da parsare viene separato in due parti\n unprocessed_data = data.split(': ',2)\n header = unprocessed_data[0]\n # il gsub serve per evitare che in uscita vi siano \"\\\" in corrispondenza dei doppi apici\n message = unprocessed_data[1].gsub(/[\"]/,'')\n\t\n # Lavoriamo sull'header per ricavare i diversi campi\n # La seguente parte di codice trova la data, valutando diversi formati\n date_rule = /\\w{3}\\s+\\d{1,2}\\s+\\d{2,4}\\s+\\d{2}\\:\\d{2}\\:\\d{2}\\s/\n date = header.scan(date_rule)\n if date == [] \n date_rule = /\\d{1,4}[\\/-]\\d{1,2}[\\/-]\\d{1,4}\\s+\\d{2}\\:\\d{2}\\:\\d{2}\\s/ \t\n date = header.scan(date_rule)\n if date == []\n date_rule = /\\w{3}\\s+\\d{1,2}\\s+\\d{2}\\:\\d{2}\\:\\d{2}\\s/\n\tdate = header.scan(date_rule)\n end\n end\n # Nell'evento settiamo la coppia header-valore trovata\n event.set(HEADER_FIELDS[0], date.join(\" \").chomp(\" \"))\n \n # Eliminiamo la data dal messaggio da elaborare\n header.slice! date_rule\n # Leviamo le parentesi quadre per isolare il PID e separiamo gli elementi rimanenti, ponendoli in un array\t\n header_array = header.gsub(/[\\[\\]]/,\" \").split(/ /)\n # Associamo le coppie campo/valore dell'header\n i = 1\n header_array.each do |fields|\n\tunless fields.nil? \n\tevent.set(HEADER_FIELDS[i], fields)\n end \n i = i + 1\n end\n # Verifichiamo che il campo Process sia settato\n unless event.get('Process').nil?\n # Controlla il campo Process per capire se presenta un'info sul processo postfix\n if event.get('Process').include? 'postfix/'\n # Divide il campo Process usando rpartition, che separa rispetto all'ultima occorrenza \t\n split_process = event.get('Process').rpartition('/')\n # Prima parte: postfix\n event.set('Process', split_process[0])\n # Ultima parte: daemon postfix\n\t# (nota: in [1] si trova l'elemento di separazione, in questo caso lo slash) \n event.set('Postfix_daemon',split_process[2])\n end\n end\n\n unless event.get('Host').nil?\n # Controlla il campo Host per vedere se presenta un carattere '<'\n if event.get('Host').include? '<'\n # Leva dal campo host il termine <.> \t\n clean_host = event.get('Host').gsub(/\\<\\d+\\>/,'')\n\t# Aggiorno l'host \n event.set('Host', clean_host)\n end\n end\n\n # Verifichiamo la presente di un Queue ID e lo scriviamo nell'evento \n queue_id = message.scan(QUEUE_REGEXP)\n unless queue_id == []\n event.set(\"Queue_ID\",queue_id.join(\"\").chomp(\":\"))\n message.slice! QUEUE_REGEXP\n end\n # Verifichiamo la presenza di un Message Level e lo scriviamo nell'evento\n msg_level = message.scan(MSG_LEVEL_REGEXP)\n unless msg_level == []\n event.set(\"Message_Level\",msg_level.join(\"\").chomp(\":\"))\n message.slice! MSG_LEVEL_REGEXP\n end\n \n if message && message.include?('=') && event.get('Process').include?('postfix')\n # Leviamo dal messaggio eventuali caratteri di spazio alla fine e all'inizio\n message = message.strip\n # Ricaviamo le diverse coppie key/value del messaggio\n message.scan(KEY_VALUE_SCANNER) do |extension_field_key, raw_extension_field_value|\n # Evitiamo che key con sintassi simile a quella di un array possano creare errori\n extension_field_key = extension_field_key.sub(KEY_ARRAY_CAPTURE, '[\\1]\\2') if extension_field_key.end_with?(']')\n # Controlliamo la presenze di escape sequence e di altri simboli, poi rimuoviamo per evitare problemi in output\n\textension_field_value = raw_extension_field_value.gsub(VALUE_ESCAPE_CAPTURE, '\\1').gsub(/[\"]/,'').gsub(\"\\\\n\",' ')\n\t# Nell'evento settiamo la coppia key-value trovata\n event.set(extension_field_key, extension_field_value.chomp(\",\"))\n end\n # Rimuoviamo dal messaggio le coppie trovate\n message = message.gsub(KEY_VALUE_SCANNER,'')\n end\n \n # Inseriamo quello che rimane del messaggio in un campo dell'evento\n event.set(HEADER_FIELDS[-1], message.strip) unless message == \"\" \n \n # Aggiungiamo il log non parsato\n event.set(\"RAW_MESSAGE\", data)\n \n # Portiamo in uscita l'evento\n yield event\n\n # In caso di errore viene mostrato il seguente messaggio\n rescue => e\n @logger.error(\"Failed to decode Postfix payload. Generating failure event with payload in message field.\", :error => e.message, :backtrace => e.backtrace, :data => data)\n yield LogStash::Event.new(\"message\" => data, \"tags\" => [\"_Postfixparsefailure\"])\n end",
"title": ""
},
{
"docid": "089ee706ed4f602979540ede3fb3e067",
"score": "0.53262407",
"text": "def transmit_event\n # Extract just the old values from change_hash\n old_values = {}\n change_hash.each_pair do |k,v|\n old_values[k] = v[0]\n end\n case source_type\n when \"Instance\"\n if ['running', 'stopped'].include?(status_code)\n # If we look this up through the 'source' association, we end up with it being a stale object.\n instance = Instance.unscoped.find(source_id)\n # If we have a time_last_running, use it; otherwise, we just started and it's not populated yet\n start_time = instance.time_last_running || Time.now\n terminate_time = status_code == 'stopped' ? instance.time_last_stopped : nil\n # Because this is an after-save hook, rescue any possible exceptions -- if for some reason\n # we cannot save the Event, we don't want to abort the Instance update transaction.\n begin\n e = Aeolus::Event::Cidr.new({\n :instance_id => instance.id,\n :deployment_id => instance.deployment_id,\n :image_uuid => instance.image_uuid,\n :owner => instance.owner.username,\n :pool => instance.pool.name,\n :provider => instance.provider_account.provider.name,\n :provider_type => instance.provider_account.provider.provider_type.name,\n :provider_account => instance.provider_account.label,\n :hardware_profile => instance.hardware_profile.name,\n :start_time => start_time,\n :terminate_time => terminate_time,\n :old_values => old_values,\n :action => status_code\n })\n e.process\n rescue Exception => e\n logger.error \"Caught exception trying to save event for instance: #{e.message}\"\n return true\n end\n end\n # There is also a \"summary\" attribute on state changes, but we don't appear to need to check it\n when \"Deployment\"\n if ['some_stopped', 'first_running', 'all_stopped', 'all_running'].include?(status_code)\n deployment = Deployment.unscoped.find(source_id)\n begin\n # TODO - The Cddr method supports a :deployable_id, but we don't implement this at the moment\n e = Aeolus::Event::Cddr.new({\n :deployment_id => deployment.id,\n :owner => deployment.owner.username,\n :pool => deployment.pool.name,\n :provider => (deployment.provider.name rescue \"-nil-\"),\n :provider_type => (deployment.provider.provider_type.name rescue \"-nil-\"),\n :provider_account => (deployment.instances.first.provider_account.label rescue \"-nil-\"),\n :start_time => deployment.start_time,\n :terminate_time => deployment.end_time,\n :old_values => old_values,\n :action => status_code\n })\n e.process\n rescue Exception => e\n logger.error \"Caught exception trying to save event for deployment: #{e.message}\"\n return true\n end\n end\n end\n end",
"title": ""
},
{
"docid": "9ef0d02546eb32ebbcbb3ab8468b08fa",
"score": "0.53257805",
"text": "def persist_event\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "a6249118b763902e8d9e9aeae4b6806d",
"score": "0.53256255",
"text": "def add_events(new_events); end",
"title": ""
},
{
"docid": "7fb370f8ed06e70088fc23bb60a4a6d3",
"score": "0.53201467",
"text": "def event_to_s\n\t\treturn @@event_string_map[self.event]\n\tend",
"title": ""
},
{
"docid": "da309e6e526eedbef69097ba205017ff",
"score": "0.53147227",
"text": "def evento_params\n params.require(:evento).permit(:nome, :descricao, :data, :hora, :curso_id, :usuario_curso_id, :ativo)\n end",
"title": ""
},
{
"docid": "0f072827173f2bd11145e4696547c48a",
"score": "0.5313954",
"text": "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n @event.tickets_remaining = @event.max_tickets\n @contstr = \"New Event \" + @event.title + \" created. Date : \" + @event.start_time.to_s\n \n\n respond_to do |format|\n if @event.save\n Annoucement.create(contents: @contstr, event_id: @event.id, society_id: @event.society_id)\n Join.create(user_id: current_user.id, event_id: @event.id)\n Report.create(event_id: @event.id)\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"title": ""
},
{
"docid": "f22a7bdbf27d9d18f67e3ab6402579fb",
"score": "0.53089225",
"text": "def encode_event_data(event)\n column_names = @dataset_columns.map { |col| col[:name] }\n encode_options = {\n :headers => column_names,\n :write_headers => false,\n :return_headers => false,\n }\n\n csv_data = CSV.generate(String.new, encode_options) do |csv_obj|\n data = event.to_hash.flatten_with_path\n data = data.select { |k, _| column_names.include? k }\n discarded_fields = data.select { |k, _| !column_names.include? k }\n unless discarded_fields.nil? or discarded_fields.length <= 0\n @logger.warn(\"The event has fields that are not present in the Domo Dataset. They will be discarded.\",\n :fields => discarded_fields,\n :event => event)\n end\n\n @dataset_columns.each do |col|\n # Just extracting this so referencing it as a key in other hashes isn't so damn awkward to read\n col_name = col[:name]\n # Set the Upload timestamp if we're into that sort of thing.\n if @upload_timestamp_field and col_name == @upload_timestamp_field\n data[col_name] = Time.now.utc.to_datetime\n elsif @partition_field and col_name == @partition_field\n data[col_name] = Time.now.utc.to_date\n # Set the column value to null if it's missing from the event data\n elsif !data.has_key? col_name\n data[col_name] = nil\n end\n\n # Make sure the type matches what Domo expects.\n if @type_check\n unless data[col_name].nil? or ruby_domo_type_match?(data[col_name], col[:type])\n raise ColumnTypeError.new(col_name, col[:type], data[col_name].class, data[col_name], data)\n end\n end\n end\n\n data = data.sort_by { |k, _| column_names.index(k) }.to_h\n csv_obj << data.values\n end\n csv_data.strip\n end",
"title": ""
},
{
"docid": "2698e4f2f7fa6ad2c39de3b7935931fb",
"score": "0.53016514",
"text": "def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end",
"title": ""
},
{
"docid": "4749b49325a5d7df164aefee2767d5e7",
"score": "0.5301286",
"text": "def collect_unknown(event_name, event_data)\n puts \"unexpected event: #{event_name}\\nstoring event data in #{SQS_CFG['queues'][0]}-moo queue\"\n message = { \n message_body: event_data.to_json,\n message_attributes: {\n event_name: {\n string_value: event_name.to_s,\n data_type: \"String\",\n },\n event_time: {\n string_value: (event_data.dig('metadata', 'event_time') || event_data.dig('data', 0, 'eventTime')).to_s,\n data_type: \"String\",\n },\n }\n }\n Shoryuken::Client.queues(\"#{SQS_CFG['queues'][0]}-moo\").send_message(message)\n # LiveEvents.perform_async(event_data, queue: \"#{SQS_CFG['queues'][0]}-moo\")\nrescue => e\n pp ['moo queue failed, saving payload to file', e, event_name]\n # write event and payload to file\n open('log/payload-cache.js', 'a') do |f|\n f << \"\\n//#{event_name}\\n\"\n f << event_data.to_json\n end\nend",
"title": ""
},
{
"docid": "71661a69a65b85d893bcc7b870edde5b",
"score": "0.5299063",
"text": "def encode_message(message)\n # create context buffer with encode headers\n ctx_buffer = encode_headers(message)\n headers_len = ctx_buffer.bytesize\n # encode payload\n if message.payload.length > MAX_PAYLOAD_LENGTH\n raise Aws::EventStream::Errors::EventPayloadLengthExceedError.new\n end\n ctx_buffer << message.payload.read\n total_len = ctx_buffer.bytesize + OVERHEAD_LENGTH\n\n # create message buffer with prelude section\n buffer = prelude(total_len, headers_len)\n\n # append message context (headers, payload)\n buffer << ctx_buffer.read\n # append message checksum\n buffer << pack_uint32(Zlib.crc32(buffer.read))\n\n # write buffered message to io\n buffer.rewind\n buffer\n end",
"title": ""
},
{
"docid": "6866ab209435564f403dd100db2d1ac0",
"score": "0.5295189",
"text": "def events tcpSock, action\n begin\n tcpSock.write \"Action: Events\\r\\n\"\n tcpSock.write \"EventMask: #{action}\\r\\n\\r\\n\"\n rescue => error\n log \"#{error}\"\n end\nend",
"title": ""
},
{
"docid": "60437e8f0e2934d7cf1287ce6531435f",
"score": "0.5293249",
"text": "def meta_event(type)\n\tm = msg()\t\t# Copy of internal message buffer\n\n\t# Create raw data array\n\t@raw_data = []\n\t@raw_data << META_EVENT\n\t@raw_data << type\n\t@raw_data << @raw_var_num_data\n\t@raw_data << m\n\t@raw_data.flatten!\n\n\tcase type\n\twhen META_SEQ_NUM\n sequence_number((m[0] << 8) + m[1])\n\twhen META_TEXT, META_COPYRIGHT, META_SEQ_NAME, META_INSTRUMENT,\n META_LYRIC, META_MARKER, META_CUE, 0x08, 0x09, 0x0a,\n 0x0b, 0x0c, 0x0d, 0x0e, 0x0f\n text(type, m)\n\twhen META_TRACK_END\n eot()\n\twhen META_SET_TEMPO\n tempo((m[0] << 16) + (m[1] << 8) + m[2])\n\twhen META_SMPTE\n smpte(m[0], m[1], m[2], m[3], m[4])\n\twhen META_TIME_SIG\n time_signature(m[0], m[1], m[2], m[3])\n\twhen META_KEY_SIG\n key_signature(m[0], m[1] == 0 ? false : true)\n\twhen META_SEQ_SPECIF\n sequencer_specific(type, m)\n\telse\n meta_misc(type, m)\n\tend\n end",
"title": ""
},
{
"docid": "7b19c382f790b05d818ee6696bc1716d",
"score": "0.52788866",
"text": "def save\n case event.event_type\n when 'enter' then enter\n when 'leave' then leave\n else logger.info \"Unsupported event_type: #{event.event_type}\"\n end\n end",
"title": ""
},
{
"docid": "a4008073fe22c01d1b2b3944c120792a",
"score": "0.5277009",
"text": "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n respond_to do |format|\n if @event.save\n # イベントのステータスで落選に変更されたら、企業のステータスを選考済みに変更\n if @event.is_passed == 'droped'\n company = Company.find(@event.company_id)\n company.is_active = false\n company.save\n end\n format.html { redirect_to @event, notice: \"イベントの作成に成功しました。\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "53f386344d7722ed871759b2e802929b",
"score": "0.5276506",
"text": "def parsed_event\n event = {\n 'payload' => Yajl::Encoder.encode(payload),\n 'public' => is_public\n }\n\n ['repo', 'actor', 'created_at', 'id', 'org', 'type'].each do |field|\n # Don't include the field in the return event if it's empty.\n value = self.send(field)\n next if value.nil? || value.empty?\n event[field] = value\n end\n\n # Worst. Code. Ever.\n event['other'] = Yajl::Encoder.encode(other) if !other.empty?\n\n return event\n end",
"title": ""
},
{
"docid": "28c32d5ee625a3477a4cdb16bf9b4c52",
"score": "0.5275986",
"text": "def type ; :event ; end",
"title": ""
},
{
"docid": "9ca822c8aa59445cbc16d2c03f35dc2e",
"score": "0.52746326",
"text": "def create\n @evento = Evento.new(params[:evento])\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to @evento, notice: 'Evento fue creado con exito.' }\n format.json { render json: @evento, status: :created, location: @evento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cee1dee0631dd8890ad620496875cb5d",
"score": "0.52740633",
"text": "def to_s\n \"Event Type: #{event_type}, Payload: #{payload}, Settings: #{settings}\"\n end",
"title": ""
},
{
"docid": "5e874e770a9b3a7dfda1f23542106ebf",
"score": "0.5264428",
"text": "def message\n \"#{event.kind}\"\n end",
"title": ""
},
{
"docid": "b6f3536e44e8189cc699608eec829d41",
"score": "0.5259002",
"text": "def event\n params.payload[:event].to_sym\n end",
"title": ""
},
{
"docid": "5892c5afebb79ad0a30a41d088c053dd",
"score": "0.5256262",
"text": "def event=(value)\n @event = convert(value)\n end",
"title": ""
},
{
"docid": "5892c5afebb79ad0a30a41d088c053dd",
"score": "0.5256262",
"text": "def event=(value)\n @event = convert(value)\n end",
"title": ""
},
{
"docid": "4cec1c35c6419248f1478877adc6c9a8",
"score": "0.5255401",
"text": "def event_params\n params.require(:event).permit(:orgn_id, :enom, :edesc, :esdate, :esdate_date, :esdate_hour, :esdate_min, :eedate, :eedate_date, :eedate_hour, :eedate_min, :pafpre, :pafplace, :pays, :ville, :codepostal, :rue, :nrrue, :flyer, :public)\n end",
"title": ""
},
{
"docid": "a658bcb06cde155953f07ee90214a70e",
"score": "0.52539617",
"text": "def event_params\n params.require(:event).permit(:titulo, :descripcion, :fecha_contacto, :nombre_contacto, :numero_contacto, :shop_id, :type_id , :state_id, :user_id)\n end",
"title": ""
},
{
"docid": "453886c5f9598dc636dc2ca58310eea5",
"score": "0.5253626",
"text": "def define_event_helpers; end",
"title": ""
},
{
"docid": "a985fcae98134caefa0534cf2b8f6d53",
"score": "0.52509266",
"text": "def create\n @evento = Evento.new(evento_params)\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to eventos_url, notice: 'El evento fue exitosamente creado.' }\n format.json { render :show, status: :created, location: @evento }\n else\n format.html { render :new }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "59eb3b5a8973cc9af9cbd36212359534",
"score": "0.5240232",
"text": "def event\n valid_events = model_class.state_machine.events.map(&:name)\n valid_events_for_object = @object ? @object.state_transitions.map(&:event) : []\n\n if params[:e].blank?\n errors = t('api.errors.missing_event')\n elsif valid_events_for_object.include?(params[:e].to_sym)\n @object.send(\"#{params[:e]}!\")\n errors = nil\n elsif valid_events.include?(params[:e].to_sym)\n errors = t('api.errors.invalid_event_for_object', :events => valid_events_for_object.join(','))\n else\n errors = t('api.errors.invalid_event', :events => valid_events.join(','))\n end\n\n respond_to do |wants|\n wants.json do\n if errors.blank?\n render :nothing => true\n else\n #error = error_response_method($e10001)\n render :json => errors.to_json, :status => 422\n #render :json => error\n end\n end\n end\n end",
"title": ""
},
{
"docid": "33c097c37b044bb43461144981fb6b0a",
"score": "0.523968",
"text": "def evented\n self.event.gsub('update','updated').gsub('destroy','destroyed').gsub('create','created')\n end",
"title": ""
},
{
"docid": "22348ebd79d657994d5e45c8477d9ee6",
"score": "0.5239453",
"text": "def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"title": ""
},
{
"docid": "ce32fe40e684abb31e3ca6f039bef1d3",
"score": "0.5236015",
"text": "def new_event(event)\n # @greeting = \"Hi\"\n\n\n @greeting = \"Hello \" + ((event.who != \"\") ? (event.who + \",\") : \"there!\")\n @event = event\n\n mail( to: event.email, subject: event.name)\n end",
"title": ""
},
{
"docid": "d63c0cac7f254a983a6faeb0281768c4",
"score": "0.5235129",
"text": "def write(event)\n ls_event= data2logstash_event(event)\n \n sync do\n logstash_device.write(ls_event.to_json+\"\\n\")\n logstash_device.flush\n end\n self\n end",
"title": ""
},
{
"docid": "406a7d0c516d1f27e0a0ca318cd2fa43",
"score": "0.5230396",
"text": "def publish(event_name, data = nil)\n @logger.info \"[#{event_name}] #{data[:key]}\"\n end",
"title": ""
},
{
"docid": "36af67eeedc38d319e3ccbdae6f5a640",
"score": "0.52262986",
"text": "def event_requirement; end",
"title": ""
},
{
"docid": "744c9e237eeb66569b4a8368c87f2cbd",
"score": "0.5220557",
"text": "def events\n # ignore messages from bots!\n\n case params[:type]\n when 'url_verification'\n logger.info \"verifying url\"\n render json: { challenge: params[:challenge] }\n when 'event_callback'\n return unless event_params[:bot_id].nil?\n\n render json: nil\n ProcessSlackMessageJob.perform_later(event_params.as_json)\n\n else\n logger.info '*'*10\n logger.info \"Unknown event type: #{params[:type]}\"\n logger.info params.inspect\n end\n end",
"title": ""
},
{
"docid": "d0304525fcda431f20d31e20141ed70a",
"score": "0.5219814",
"text": "def r_out_msg(event)\n report \"{#{event.target}} <#{@yail.me}> #{event.message}\"\n end",
"title": ""
},
{
"docid": "93f40417cfaa11f859837605a8ce9444",
"score": "0.5219267",
"text": "def magic_out_msg(event)\n privmsg(event.target, event.message)\n end",
"title": ""
}
] |
f7bb618ee1d47b5bceac9f366b2e09ca
|
might need to make it job_postings.find_by_id...
|
[
{
"docid": "6c1a3d10a355003f31aa3723e20a59c6",
"score": "0.0",
"text": "def correct_user\n\t\t@job_posting = current_user.job_posting.find_by_id(params[:id]) #testing if nil.\n\t\tredirect_to root_path if @job_posting.nil?\n\tend",
"title": ""
}
] |
[
{
"docid": "53ce4a99ca176923e88d7779fe4b61c3",
"score": "0.77230114",
"text": "def set_job_posting\n @job_posting = @user.job_postings.where(id: params[:id]).first\n end",
"title": ""
},
{
"docid": "e25d236f164c100a94157bb5a693848c",
"score": "0.7584953",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "5d0f20dc81b1db699f3c3e15e237f22f",
"score": "0.7450513",
"text": "def set_job_posting\n @job_posting = current_user.job_postings.find(params[:id])\n end",
"title": ""
},
{
"docid": "db116365afd983126ca351d0836f802d",
"score": "0.7423767",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "db116365afd983126ca351d0836f802d",
"score": "0.7423767",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "db116365afd983126ca351d0836f802d",
"score": "0.7423767",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "db116365afd983126ca351d0836f802d",
"score": "0.7423767",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "db116365afd983126ca351d0836f802d",
"score": "0.7423767",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "92bce1eca602843dafbeb3ff351111c1",
"score": "0.7259233",
"text": "def set_job_posting\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "8c9373fc608274d810535f7906bdeef6",
"score": "0.7251436",
"text": "def jobpostfeed\n JobPosting.where(\"employer_id = ?\", id)\nend",
"title": ""
},
{
"docid": "3b13297147a44f4a67e05f996fed25aa",
"score": "0.6926606",
"text": "def index\n @job_postings = JobPosting.all\n end",
"title": ""
},
{
"docid": "3b13297147a44f4a67e05f996fed25aa",
"score": "0.6926606",
"text": "def index\n @job_postings = JobPosting.all\n end",
"title": ""
},
{
"docid": "65703fe0f2f5517fa28201fde9e31a76",
"score": "0.6904382",
"text": "def show\n @job_posting = JobPosting.find(params[:id])\n end",
"title": ""
},
{
"docid": "c47b7cd201da78a021c9a0d36a31a537",
"score": "0.6791129",
"text": "def index\n @job_postings = current_user.job_postings\n end",
"title": ""
},
{
"docid": "a37c8ee036fc468ffeb2b25af70f4a16",
"score": "0.66123945",
"text": "def find(id)\n Job.find(id)\n end",
"title": ""
},
{
"docid": "5e567f1a52552278efaf08a46ce18866",
"score": "0.65989715",
"text": "def find( job_id )\n @jobs[job_id]\n end",
"title": ""
},
{
"docid": "7a565eef25033c49d00893928868b351",
"score": "0.655609",
"text": "def index\n @job_postings = JobPosting.includes(:company).all\n end",
"title": ""
},
{
"docid": "6c51dd8ea580903f3e22005524b84643",
"score": "0.6488826",
"text": "def find_job\n\t\t@job = Job.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "fbaaf54083a979518e73833da5887d70",
"score": "0.6467634",
"text": "def set_job_post\n @job_post = JobPost.find(params[:id])\n end",
"title": ""
},
{
"docid": "fbaaf54083a979518e73833da5887d70",
"score": "0.6467634",
"text": "def set_job_post\n @job_post = JobPost.find(params[:id])\n end",
"title": ""
},
{
"docid": "525ed89a3dc63419979630781be2d73a",
"score": "0.6433432",
"text": "def find_job\n\t\t\t@job = Job.find(params[:id])\n\t\tend",
"title": ""
},
{
"docid": "6246c00507d87d1f85da36e39dbe3abd",
"score": "0.63870114",
"text": "def set_job_listing\n @job_listing = JobListing.find(params[:id])\n end",
"title": ""
},
{
"docid": "6246c00507d87d1f85da36e39dbe3abd",
"score": "0.63870114",
"text": "def set_job_listing\n @job_listing = JobListing.find(params[:id])\n end",
"title": ""
},
{
"docid": "61e8b4acb852d89f91846e6fd8cd7aaf",
"score": "0.63742584",
"text": "def set_posting\n @postings = Posting.find(params[:id])\n end",
"title": ""
},
{
"docid": "1509fcdd62d9a474af0133e0c42fce72",
"score": "0.63683265",
"text": "def query_job_post(job_id)\n perform_query(\"&filterColumn1=jobPostingId&filter1=#{job_id}\")\n end",
"title": ""
},
{
"docid": "fe7530449ee2db9066dcfa4a4b88c272",
"score": "0.6323607",
"text": "def index\n @candidates = Candidate.where(job_posting_id: params[:job_posting_id]).paginate(:page => params[:page], :per_page => 15)\n end",
"title": ""
},
{
"docid": "a018f7d18618bd08c9859a3eb5fd7e59",
"score": "0.6270685",
"text": "def set_job_post\n @job_post = JobPost.find(params[:job_post_id])\n end",
"title": ""
},
{
"docid": "91bee531d916f357d93d704a7865c0a1",
"score": "0.625865",
"text": "def set_job\n @get_jobs = Job.friendly.find_by(params[:id])\n end",
"title": ""
},
{
"docid": "acfa5dd87fcdd249a0f86afbd6b41130",
"score": "0.62531006",
"text": "def jobs\n @boat = Boat.find(params[:id])\n @boats = @boat.jobs\n end",
"title": ""
},
{
"docid": "ec3875294cf68861284b250f3bdb39bc",
"score": "0.62460005",
"text": "def index\n @jobpostings = JobPosting.paginate(:page => params[:page], :per_page => 5, :order => 'created_at DESC')\n end",
"title": ""
},
{
"docid": "7ce2283ab85d5def6d1e6b5a3d765e95",
"score": "0.6244489",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "7ce2283ab85d5def6d1e6b5a3d765e95",
"score": "0.6244489",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "70ed8e679886eb85936eb8c44b3331c5",
"score": "0.6232275",
"text": "def set_job\n @job = Job.find_by!(id: params[:id]) \n end",
"title": ""
},
{
"docid": "c98bf45c8e9aa12f588bde563a696efb",
"score": "0.6209916",
"text": "def job_poster(job)\n @poster = Poster.find_by_id(job.poster_id)\n @job_poster = User.find_by_id(@poster.user_id)\n ## return User that matches user_id in Posters database\n @job_poster\n end",
"title": ""
},
{
"docid": "5ad670c0e4c5dcfa52d64f5eab235745",
"score": "0.6197209",
"text": "def set_job\n @job = Job.includes(:crawls).find(params[:id])\n end",
"title": ""
},
{
"docid": "b20a8097a87a1b66c4771b62231d90ef",
"score": "0.6177143",
"text": "def set_job\n @job = Job.find(params[:id])\n # @comment = @job.comments.build\n # @comment = Comment.find(params[:id])\n end",
"title": ""
},
{
"docid": "0cecfe61d12a313f52b682b28303d9ab",
"score": "0.6168496",
"text": "def showjob\n \tif params[:id]\n \t @job = Job.find(params[:id])\n \t @related_jobs = Job.joins(:taggings).where('jobs.id != ?', @job.id).where(taggings: { tag_id: @job.tag_ids }).uniq\n \telse\n redirect_to root_path, notice: 'Job was not found.'\n \tend\n end",
"title": ""
},
{
"docid": "dcf2c33e5cb4988cf0fbadc7a2f30d2e",
"score": "0.61438644",
"text": "def set_job\n @job = Job.where(custom_identifier: params[:id]).or(Job.where(slug: params[:id]))\n not_found if @job.blank?\n @job = @job.decorate.first\n end",
"title": ""
},
{
"docid": "4f927cd246fcce9761691a1bc33fc827",
"score": "0.6138844",
"text": "def set_job\n @job = Job.all.find(params[:id])\n end",
"title": ""
},
{
"docid": "5dc845d41c8c2868171b44f2c1e89e25",
"score": "0.6130901",
"text": "def job_postings\n #Returns set of job postings in order based on parameters\n @job_postings = JobPosting.search(params[:search], params[:column]).order(sort_column(JobPosting, 'title') + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_postings }\n end\n end",
"title": ""
},
{
"docid": "556e51b27dfd17bef70922b2a8c9b855",
"score": "0.6117953",
"text": "def set_job\n # @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "9abf92da21e2452269f1aca45c72df87",
"score": "0.611586",
"text": "def index\n @job_posters = JobPoster.all\n end",
"title": ""
},
{
"docid": "8b40c18adcfaa9617e892353b412961c",
"score": "0.60935235",
"text": "def find_job(id)\n @jobs.select { |j| j.id == id.to_i }.first\n end",
"title": ""
},
{
"docid": "f42b83e692483d982c4acb4e850398bf",
"score": "0.6073253",
"text": "def set_job_posting\n @user = User.find(params[:id])\n end",
"title": ""
},
{
"docid": "85ecf75a69ea2d9a050ea2f87c769873",
"score": "0.60716134",
"text": "def set_job\n @job = @biz.jobs.find(params[:id])\n end",
"title": ""
},
{
"docid": "8d516ef587a0796c13565731928ef587",
"score": "0.6061712",
"text": "def jobs\n Job.where('batch_id = ?', @batch_id)\n end",
"title": ""
},
{
"docid": "dbe812f37ee19de8b21a6223327a46ed",
"score": "0.60551566",
"text": "def set_job\n @business = Business.find(params[:business_id])\n @job = @business.jobs.find(params[:id])\n end",
"title": ""
},
{
"docid": "265e69c0701f9b6f654fc71314801fe5",
"score": "0.60334325",
"text": "def show\n @job_posting = JobPosting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_posting }\n end\n end",
"title": ""
},
{
"docid": "265e69c0701f9b6f654fc71314801fe5",
"score": "0.60334325",
"text": "def show\n @job_posting = JobPosting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_posting }\n end\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "cca9763868483d1b4333d084050a843c",
"score": "0.6030551",
"text": "def set_job\n @job = Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "546d2e9e96ac30f2eeb9d1676e001a47",
"score": "0.6027271",
"text": "def create\n @job_posting = JobPosting.new(params[:job_posting])\n @employers = Employer.find :all\n @working_times = WorkingTime.find :all\n @employment_types = EmploymentType.find :all\n respond_to do |format|\n if @job_posting.save\n flash[:notice] = 'JobPosting was successfully created.'\n format.html { redirect_to(@job_posting) }\n format.xml { render :xml => @job_posting, :status => :created, :location => @job_posting }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @job_posting.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "081070f97affcef1d84534ea9f34ec3c",
"score": "0.60238695",
"text": "def index\n #@job_offers = JobOffer.find_by(id: params[:id])\n @job_offers = JobOffer.where(\"job_request_id = ?\", params[:job_request])\n end",
"title": ""
},
{
"docid": "30572f32925005146dd026237e14b5a9",
"score": "0.60230374",
"text": "def set_job\n @job = Job.find(params[:id]) \n end",
"title": ""
},
{
"docid": "5a4d247971f9c830d91e2f6d0262dfe7",
"score": "0.6007627",
"text": "def index\n @job_listings = JobListing.all\n end",
"title": ""
},
{
"docid": "5a4d247971f9c830d91e2f6d0262dfe7",
"score": "0.6007627",
"text": "def index\n @job_listings = JobListing.all\n end",
"title": ""
},
{
"docid": "bdb20a9f82e6aef93af00c00ac987dbf",
"score": "0.6005089",
"text": "def convert_job_ref_key_to_job_id\n job_publishing_post_entity = Fs2JobPublishingPost.find_by_ref_key(params[:job_ref_key])\n if job_publishing_post_entity\n \n params[:job_id] = job_publishing_post_entity.job_id\n params[:job_publishing_post_id] = job_publishing_post_entity.id\n end\n end",
"title": ""
},
{
"docid": "5027e035604c378982fddb7f009ec084",
"score": "0.5977273",
"text": "def set_job\n @job = Job.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "be570a0eeeb6683851b7bdffdad4d02b",
"score": "0.59703326",
"text": "def index\n @job_postings = JobPosting.order(sort_column + \" \" + sort_direction)\n end",
"title": ""
},
{
"docid": "66762d0cc3f3347f2212569857c59e0c",
"score": "0.5957915",
"text": "def find!( job_id )\n find( job_id ) || raise( \"Cannot find a job with id=#{job_id.inspect}. #{@job_ids_removed.include?(job_id) ? 'Removed.' : ''}\" )\n end",
"title": ""
},
{
"docid": "9f19254ebe9b7d03a0425d3b06527952",
"score": "0.59553885",
"text": "def set_job\n @job = Job.find_by(id: params[:id])\n end",
"title": ""
},
{
"docid": "e611d8e3f9b52e36d45de4a26b09aeff",
"score": "0.5952339",
"text": "def set_job_search_criterion\n @job_search_criterion = JobSearchCriterion.find(params[:id])\n end",
"title": ""
},
{
"docid": "5e41d3a1fb0a893b2eb0796cfa0d44f1",
"score": "0.59516937",
"text": "def fetch(job_or_job_id)\n\n if job_or_job_id.respond_to?(:job_id)\n [ job_or_job_id, job_or_job_id.job_id ]\n else\n [ job(job_or_job_id), job_or_job_id ]\n end\n end",
"title": ""
},
{
"docid": "31abcebb0c3521086a5fdd4dc62b41f2",
"score": "0.5910869",
"text": "def set_job\n @job = Job.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "31abcebb0c3521086a5fdd4dc62b41f2",
"score": "0.5909873",
"text": "def set_job\n @job = Job.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "31abcebb0c3521086a5fdd4dc62b41f2",
"score": "0.5909873",
"text": "def set_job\n @job = Job.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "31abcebb0c3521086a5fdd4dc62b41f2",
"score": "0.5909873",
"text": "def set_job\n @job = Job.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "45f0ea14f28d43bd51a48add5b5303b5",
"score": "0.59093577",
"text": "def set_job\n @job = @project.jobs.find(params[:id])\n end",
"title": ""
},
{
"docid": "793ac233f7e545123ddabb85291075fc",
"score": "0.5897227",
"text": "def set_job\n @job = Job.find_by(id: params[:id])\n raise ActiveRecord::RecordNotFound if @job.nil?\n end",
"title": ""
},
{
"docid": "46c3a6498d8772c597fe94ca498ae025",
"score": "0.5886344",
"text": "def set_job\n @job = Job.find_by(slug: params[:slug])\n end",
"title": ""
},
{
"docid": "bba6c393a6d4e20bd5f406c646d3d5ce",
"score": "0.5885723",
"text": "def set_comment\n @job = Job.find(params[:job_id])\n end",
"title": ""
},
{
"docid": "6764d1d2c0f839ce7a6fdeec0cad5812",
"score": "0.5885326",
"text": "def set_job\n @job = @company.jobs.find(params[:job_id])\n end",
"title": ""
},
{
"docid": "69e0ea021c7b78cdeac9a77d66d9a127",
"score": "0.58845896",
"text": "def set_job\n @job = Job.find_by_id(params[:id])\n end",
"title": ""
},
{
"docid": "6d8a8e8fd3b99e282ca29aa69d9c9456",
"score": "0.5883767",
"text": "def fetch(job_or_job_id)\n\n if job_or_job_id.respond_to?(:job_id)\n [ job_or_job_id, job_or_job_id.job_id ]\n else\n [ job(job_or_job_id), job_or_job_id ]\n end\n end",
"title": ""
},
{
"docid": "e4592bd7ed063bc3c0f19a345c0d2657",
"score": "0.58763725",
"text": "def set_job_post_activity\n @job_post_activity = JobPostActivity.find(params[:id])\n end",
"title": ""
},
{
"docid": "7a0050faa51a4cf9f9efb74b40143b56",
"score": "0.5872599",
"text": "def set_job\n @job = @task.jobs.find(params[:id])\n end",
"title": ""
},
{
"docid": "8520b34412d1bf9bfff087bb4320bea4",
"score": "0.58696824",
"text": "def retrieve_bookmarks\n # todo: what if bookmarked posting was deleted?\n postings = current_user.bookmarks.map { |b| b.to_i }\n # print postings\n # @jobposting = Jobposting.where(\"posting_id = ?\", postings) # note if no bookmarks, will return nil\n @jobposting = Array.new(postings.length) { Jobposting }\n postings.each_with_index do |p,i|\n @jobposting[i] = Jobposting.find_by_posting_id(p) #.paginate(:page => params[:page])\n end\n # @jobposting = Jobposting.find(postings)\n respond_to do |format|\n format.json { render json: { errCode: SUCCESS, value: @jobposting } }\n format.html { render template: \"users/dashboard\" } # not sure which template to use, feel free to edit\n end\n\n end",
"title": ""
},
{
"docid": "d9bdc265a58ee2c8a84cc87c26897fd9",
"score": "0.5853134",
"text": "def set_job\n @job ||= Job.find(params[:id])\n end",
"title": ""
},
{
"docid": "2effc9e481837f75de49daefc8b4f5ad",
"score": "0.58525884",
"text": "def index\n @job_postings = JobPosting.all\n render json: @job_postings\n end",
"title": ""
}
] |
0ab0f66c4b371285718964dc40446363
|
Get the loser names as a string.
|
[
{
"docid": "37926ae292b5d019392bec9fc7918f68",
"score": "0.74731994",
"text": "def getLoserNames\n self.joinNames @loserNames\n end",
"title": ""
}
] |
[
{
"docid": "4082ad0e3443cad7ac9f5ee4e0831786",
"score": "0.70841247",
"text": "def list_names\r\n names = names.map{|name| name[:name]}\r\n last_name = names.pop\r\n return last_name.to_s if names.empty?\r\n \"#{names.join(' , ')}& #{last_name}\" end",
"title": ""
},
{
"docid": "ef69a2fc417ad4a0f235769c3a6af2fc",
"score": "0.70678043",
"text": "def rakazim_names\n @rakazim_names = \"\"\n self.rakazim.each do |r|\n @rakazim_names = @rakazim_names + r.name + \", \"\n end\n return @rakazim_names.chop.chop!\n end",
"title": ""
},
{
"docid": "9ad30de26476267a0a847ffbc79b7fe2",
"score": "0.7003208",
"text": "def to_s\n return \"#{self.names}\"\n end",
"title": ""
},
{
"docid": "a8a3b71862506812be7c71aa568fd553",
"score": "0.687611",
"text": "def get_sellers_or_holders_as_names\n source_agents = get_sellers_or_holders\n source_agents.map{ |a| a.agent ? a.agent.name : \"\" }.join(\" | \")\n end",
"title": ""
},
{
"docid": "3ed61f5de1ff54f60608892cce12e1e3",
"score": "0.6811362",
"text": "def get_usernames\n\t\tnames = []\n\t\t@clients.keys.each do |client|\n\t\t\tnames << client.name.to_s\n\t\tend\n\t\treturn names\n\tend",
"title": ""
},
{
"docid": "6b22f9e45badb1f70b7478bc43ecbe39",
"score": "0.6803641",
"text": "def names\n @names.join(\":\")\n end",
"title": ""
},
{
"docid": "94bde5488ba01c8d8f424bbd5295bbdc",
"score": "0.674045",
"text": "def name\n return \"#{@names}\"\n end",
"title": ""
},
{
"docid": "978b14f57d41e79dbd0e85f20b210eaa",
"score": "0.6695376",
"text": "def occupant_names\n out = []\n self.occupants.each do | occupant |\n out << occupant.brother.full_name\n end\n return out.join(\", \")\n end",
"title": ""
},
{
"docid": "01c067dea69b25041eeaae3b1456b3dc",
"score": "0.6680825",
"text": "def get_selling_agents_as_names\n source_agents = get_selling_agents\n source_agents.map{ |a| a.agent ? a.agent.name : \"\" }.join(\" | \")\n end",
"title": ""
},
{
"docid": "6cb296e8856933db0692e713f04be69e",
"score": "0.6644343",
"text": "def renters\n @retners.map do |renter|\n renter.name\n end.join(', ')\n end",
"title": ""
},
{
"docid": "807e8711c434bca45e1e1d2cb4637d6f",
"score": "0.6642939",
"text": "def roster_names\n @roster.collect.with_index(1) do |player, index| \n \"#{index}. #{player.first_name} #{player.last_name}\"\n end\n end",
"title": ""
},
{
"docid": "64a079b0918c097a44fb7e18597e2238",
"score": "0.6637272",
"text": "def names\n lifters.collect { |lifter| lifter.name}\n end",
"title": ""
},
{
"docid": "57a992302e54c667da6ab405d1e2727e",
"score": "0.6619484",
"text": "def player_names\n players.map {|player| player.name }.join(' vs. ')\n end",
"title": ""
},
{
"docid": "57a992302e54c667da6ab405d1e2727e",
"score": "0.6619484",
"text": "def player_names\n players.map {|player| player.name }.join(' vs. ')\n end",
"title": ""
},
{
"docid": "ab6cf3d7ea179ba628bfe188816bb453",
"score": "0.66049176",
"text": "def name\n lifters.map {|l| l.name}\n end",
"title": ""
},
{
"docid": "758c2eccd7a7bf22084cf74a28cfa1e1",
"score": "0.65798193",
"text": "def surfer_list\n users.map(&:name).join(', ')\n end",
"title": ""
},
{
"docid": "d42d8548966c23e51ce2142353d51c0c",
"score": "0.6575484",
"text": "def usernames\n person.users.collect(&:login).join(\", \") rescue nil\n end",
"title": ""
},
{
"docid": "11dd10666ac0b527de9813ddc8c44f04",
"score": "0.6514625",
"text": "def eles_names\n names = []\n @eles.each do |ele|\n names << ele.name\n end\n\n names\n end",
"title": ""
},
{
"docid": "c1ce9a3f71d62a4be9325df454f90823",
"score": "0.6504426",
"text": "def get_reviewer_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end",
"title": ""
},
{
"docid": "029413caf01bf777d5da384d25eccdde",
"score": "0.6492892",
"text": "def artist_names\n names = \"\"\n self.artists.each do |artist|\n names += \"#{artist.name}, \"\n end\n\n # Remove trailing ,\n names.chomp!(\", \")\n return names\n end",
"title": ""
},
{
"docid": "97b2faf9b78c47fc515f490ac9b0ffbf",
"score": "0.6486867",
"text": "def name\n result = []\n result << self.first_name\n result << self.last_name\n result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ')\n end",
"title": ""
},
{
"docid": "bc2e0cd0b0bd31ddce3df5595dff9662",
"score": "0.64535373",
"text": "def collect_names( persons )\n persons.map{ |person| person.name }.join \", \"\n end",
"title": ""
},
{
"docid": "a24fb3abc8827846c385023168a4d096",
"score": "0.6451073",
"text": "def lifters_name_list\n lifters.map {|l| l.name}\n end",
"title": ""
},
{
"docid": "1b705bff75ece917e81999476e01a168",
"score": "0.6429951",
"text": "def lifter_names\n #get lifters then get their names\n self.lifters.map do |l|\n l.name\n end\n end",
"title": ""
},
{
"docid": "c97677333953480cf0a94b31a91b4d2b",
"score": "0.64068985",
"text": "def all_lifter_names\n self.all_lifters.map do |elements|\n elements.name\n end\n end",
"title": ""
},
{
"docid": "aa2003f0ea1665b62d351a649db35b64",
"score": "0.6404678",
"text": "def names\n @health.names.to_a\n end",
"title": ""
},
{
"docid": "a8dbb78235bc539650eed27572629d64",
"score": "0.6396031",
"text": "def all_names\n return [] unless @json_data['users']\n @json_data['users'].collect { |user| [user['first'], user['last']].join(' ') }\n end",
"title": ""
},
{
"docid": "9f28a4d7492ecaf4643959a12f9669bf",
"score": "0.63894373",
"text": "def members_names\n lifter_gym.map {|l| l.name}\n end",
"title": ""
},
{
"docid": "89a53b0a7c0660686687c5aaaee5a18d",
"score": "0.63739914",
"text": "def names\n return @names\n end",
"title": ""
},
{
"docid": "89a53b0a7c0660686687c5aaaee5a18d",
"score": "0.63739914",
"text": "def names\n return @names\n end",
"title": ""
},
{
"docid": "2a023ad69a0dbb09efb767fa93dfee52",
"score": "0.63736206",
"text": "def names\n map { |s| s.name }\n end",
"title": ""
},
{
"docid": "52ac0231b8c2499647923e44acad3883",
"score": "0.6363492",
"text": "def borrower_names\n names = Array.new\n names.push(login.person.full_name) unless login.person.blank?\n names.push(login.organisation.organisation_name, login.organisation.organisation_abbrev) unless login.organisation.blank?\n\n return names\n end",
"title": ""
},
{
"docid": "2d4f37a061acfb35703b0d5518b74d6f",
"score": "0.6355204",
"text": "def list_names(users)\n return '' if users.nil? or users.size == 0\n users.compact.join(', ')\n end",
"title": ""
},
{
"docid": "69efd1f34af508129d4ab8cc3e41ab50",
"score": "0.63507247",
"text": "def gamer_names(game)\n gn = []\n # game.gamers.sort_by(&:sequence_nbr).each do |g|\n game.gamers.order(:sequence_nbr).each do |g|\n gn << g.user.name\n end\n gn.join(', ')\n end",
"title": ""
},
{
"docid": "4d3e5a68403e935dd7c70d181ea7c121",
"score": "0.63419133",
"text": "def names\n [long] + @alts\n end",
"title": ""
},
{
"docid": "2990c92e9bf2b781eb46ab89df0de194",
"score": "0.63172203",
"text": "def rooms_names()\n names = []\n @@rooms.each do |room|\n names.push room.name\n end\n return names\n end",
"title": ""
},
{
"docid": "ca3a6b23927398ed70576e915440f8e8",
"score": "0.6302585",
"text": "def lifter_names\n all_lifters.map do |this_gyms_lifters|\n this_gyms_lifters.name\n end\n end",
"title": ""
},
{
"docid": "0213a1f8cba1b2124ede349e52511c34",
"score": "0.6291873",
"text": "def name\n names\n end",
"title": ""
},
{
"docid": "935f4e687b7eddffc6d8bab756d3b007",
"score": "0.6289675",
"text": "def lifter_names\n self.lifters.map do |lifter|\n lifter.name\n end\n end",
"title": ""
},
{
"docid": "4e03e49a97693302c11109eed9780bb6",
"score": "0.62887704",
"text": "def getWinnerNames\n self.joinNames @winnerNames\n end",
"title": ""
},
{
"docid": "a9923635ea40651a302e84e20d2dfdb3",
"score": "0.6276438",
"text": "def list_names\n fl = self.list()\n fl.names\n end",
"title": ""
},
{
"docid": "ea4bb37905384220b10b6f8fbc6fc04f",
"score": "0.62667984",
"text": "def lifter_names\n self.lifters.map do |membership|\n membership.lifter.name\n end\n # binding.pry\n end",
"title": ""
},
{
"docid": "1e8fba3b5effee5a92c05de04d1aa6c5",
"score": "0.6265426",
"text": "def lifter_names\n self.lifters.collect{ |lifter| lifter.name }\n end",
"title": ""
},
{
"docid": "55ce9d6b63107aeda9720ffc2e42b3e4",
"score": "0.6263536",
"text": "def lifter_names\n \tlifters.map{|lifter| lifter.name}\n end",
"title": ""
},
{
"docid": "c8a64dff10ebcfe5e28345bb33845e2e",
"score": "0.6263045",
"text": "def lifters_name \n self.lifters.map do |lifter| \n lifter.name \n end \n end",
"title": ""
},
{
"docid": "55912d9276d1f4aa805d5f2e67eb14ce",
"score": "0.6251519",
"text": "def all_names\r\n @all_names\r\n end",
"title": ""
},
{
"docid": "53f0b48a71bba85b8bb94c4086b55740",
"score": "0.62499887",
"text": "def names \n self.lifters.map do |lifter|\n lifter.name \n end \n end",
"title": ""
},
{
"docid": "8e29fc87fb48cfaa9cf454cebc0ccd90",
"score": "0.6229966",
"text": "def persons_as_string\n persons.pluck(:name).join(', ')\n end",
"title": ""
},
{
"docid": "675eaf4c4b71e8fa8d5946bfa17d2e62",
"score": "0.62286544",
"text": "def print_team_names\r\n names = []\r\n @teams.each do |team|\r\n names << team.name \r\n end\r\n return names\r\n end",
"title": ""
},
{
"docid": "6573b88e9efe05b0b329e1b14d80d16a",
"score": "0.62196374",
"text": "def leaser_names\n leasers.map do |l|\n model = l.constantize\n model.leaser_names\n end.flatten\n end",
"title": ""
},
{
"docid": "1e6bd4515ad4db92236889fade487d76",
"score": "0.620058",
"text": "def item_names()\n return items.map { |item| item.name }.join(\", \")\n end",
"title": ""
},
{
"docid": "328cca402cb5591e4ee6afcb5ea68117",
"score": "0.61999637",
"text": "def synonym_name_strs\n result = []\n @all_names.each do |name|\n result += name.synonyms.map(&:display_name) if name.synonym_id\n end\n result\n end",
"title": ""
},
{
"docid": "9024730bef682120fb959e520e18fe9d",
"score": "0.6197687",
"text": "def as_names\n __getobj__.map { |i| i.name }\n end",
"title": ""
},
{
"docid": "d94c2261bcef1a1b11b8a269353da4a8",
"score": "0.6187691",
"text": "def lifter_names\n self.lifters.map {|lifter| lifter.name}\n end",
"title": ""
},
{
"docid": "75d485fce5e187d04afca906e46812ae",
"score": "0.6184541",
"text": "def get_all_names\n names = []\n\n get_all_devices.each do |device|\n names.push(device.element_children[0].text)\n end\n\n names\n end",
"title": ""
},
{
"docid": "1723a96b7b86e5f5e2636fa72fc3dfa5",
"score": "0.6173496",
"text": "def travelers\n if member\n names = \"#{member.short}\"\n spouse_name = member.spouse ? member.spouse.short : \"spouse\" # Use name if spouse is listed in the database, else \"spouse\"\n names << \" & #{spouse_name}\" if with_spouse\n names << \" #{member.last_name}\" \n names << \" w kids\" if with_children \n names << \", with #{other_travelers}\" unless other_travelers.blank?\n return names\n end\n return other_travelers\n end",
"title": ""
},
{
"docid": "fac836b9dced4f827162bbbd4e4e7b68",
"score": "0.6172351",
"text": "def get_buzz_member_names\n user_name = []\n self.buzz_members.order(\"users.first_name asc\").each{|member| user_name << member.user.full_name}\n user_name.join(\" , \")\n end",
"title": ""
},
{
"docid": "1498a5720578f4a3563e1cef543181e6",
"score": "0.6171408",
"text": "def lifter_names\n lifters.map do |lifter|\n lifter.name\n #array of lifters name\n #in order to get to the name of each lifter you have to iterate through the lifter to get the name of the lifter\n end\nend",
"title": ""
},
{
"docid": "7d3874c163e6b1a7f247e02de3016cd4",
"score": "0.61682814",
"text": "def names\n lifters.map { |lifter| lifter.name }\n # Membership.all.select { |gym| gym.lifter == self }\n end",
"title": ""
},
{
"docid": "7de45160b6f2af9167ef92950034bf80",
"score": "0.61682594",
"text": "def names_list(collection)\n collection.map(&:name).join(',') rescue ''\n end",
"title": ""
},
{
"docid": "809af5856165f23798f0eb140335e065",
"score": "0.6148007",
"text": "def lifters_names\n self.lifters.map do |lifter_instance|\n lifter_instance.name \n end\n end",
"title": ""
},
{
"docid": "67a531be53e3cfe817167dfa21490b91",
"score": "0.614437",
"text": "def get_names(snmp = nil)\n snmp = snmp_manager unless snmp\n\n if snmp\n @names.clear\n\n begin\n snmp.walk([OID_LTM_CLIENT_SSL_STAT_NAME]) do |row|\n row.each do |vb|\n @names.push(vb.value)\n end\n end\n rescue Exception => e\n NewRelic::PlatformLogger.error(\"Unable to gather Client SSL Profile names with error: #{e}\")\n end\n\n NewRelic::PlatformLogger.debug(\"Client SSL Profiles: Found #{@names.size}\")\n return @names\n end\n end",
"title": ""
},
{
"docid": "f2b549ea89ae1ea05a95cf0ba54aa92b",
"score": "0.6136381",
"text": "def to_s\n names = name.to_s\n names += \".#{@next_slot}\" if @next_slot\n names\n end",
"title": ""
},
{
"docid": "35a7efe2d23b7f6588b211ff8de9046b",
"score": "0.6133198",
"text": "def get_reported_by_list()\n names = []\n comment_reports.each do |report|\n \t\tuser = User.find_by_id(report.reporter_id)\n \t\tif user\n \t\t\tnames.push(user.fullname)\n \t\telse\n \t\t\tnames.push(\"User not found: #{report.reporter_id}\")\n \t\tend\n end\n return names.join(\", \")\n end",
"title": ""
},
{
"docid": "f312054c29944c515c8841672cef80e2",
"score": "0.61327523",
"text": "def as_names\n __getobj__.map(&:name)\n end",
"title": ""
},
{
"docid": "c8bfca1195dad555e501b5af672feb07",
"score": "0.6131652",
"text": "def get_ead_names\n (self.corpname + self.persname).flatten.compact.uniq.sort\n end",
"title": ""
},
{
"docid": "083e0cf54cd6a8eebf6b893975fa500b",
"score": "0.6120883",
"text": "def get_name\n @lname.to_s + \", \" + @fname.to_s\n # calls to_s on each in case not already String\n end",
"title": ""
},
{
"docid": "ab7f7020a019b4d524ae43d95c1b4345",
"score": "0.61075336",
"text": "def get_institutions_as_names\n source_agents = get_institutions\n source_agents.map{ |a| a.agent ? a.agent.name : \"\" }.join(\" | \")\n end",
"title": ""
},
{
"docid": "efce1889f629fac6e558dcb1b583ce31",
"score": "0.6102506",
"text": "def lifter_names\n self.lifters.map{|lifter| lifter.name}\n end",
"title": ""
},
{
"docid": "8b600fbae1e140cca68341bc64de94c4",
"score": "0.61023235",
"text": "def skill_names \n skills.map { |s| s.name }.join(', ')\n end",
"title": ""
},
{
"docid": "a9eb2d8bf92a3f4f3f29d5268fee79e5",
"score": "0.61000526",
"text": "def names\n map{|x| x.name }\n end",
"title": ""
},
{
"docid": "2e3568e46836d5a1b2843b4ade9178ae",
"score": "0.60990953",
"text": "def to_s() @name end",
"title": ""
},
{
"docid": "5bf20b3b43b6a3c37b186fdb79875cd5",
"score": "0.6089533",
"text": "def peer_names\n execute('peer', 'names').to_a.map(&:to_s)\n end",
"title": ""
},
{
"docid": "e137f6fa9b2719d9578dd9a07d5d3783",
"score": "0.60845464",
"text": "def to_s\n names = node.map do |child|\n if child.kind_of?(String) || child.kind_of?(Symbol)\n child.to_s\n elsif child.respond_to?(:name)\n child.name.to_s\n end\n end\n\n names.compact.uniq.join('_')\n end",
"title": ""
},
{
"docid": "12ca416d57298b6bd1df8891b9c279d3",
"score": "0.6082904",
"text": "def pretty_name\n result = []\n [self.name].each do |field|\n result << field unless field.blank?\n end\n \n return result.join(\", \")\n end",
"title": ""
},
{
"docid": "6d4ddd2bcb64109ccce8fc9d0a1f6fb5",
"score": "0.6072483",
"text": "def name\n result = []\n result << first_name\n result << middle_name\n result << last_name\n result = result.compact.map {|m| m.to_s.strip }.reject {|i| i.empty? }\n return result.join(' ') unless result.empty?\n end",
"title": ""
},
{
"docid": "a231c62d4acf74ed1cfa2246b071a226",
"score": "0.6060189",
"text": "def employee_names(search_position)\n matching_people = @people.select { |person| person.position == search_position}\n\n names = matching_people.map { |person| person.name }\n\n combined_names = names.join(\",\")\n\n return combined_names\n end",
"title": ""
},
{
"docid": "a231c62d4acf74ed1cfa2246b071a226",
"score": "0.6060189",
"text": "def employee_names(search_position)\n matching_people = @people.select { |person| person.position == search_position}\n\n names = matching_people.map { |person| person.name }\n\n combined_names = names.join(\",\")\n\n return combined_names\n end",
"title": ""
},
{
"docid": "8e95edb12265631ec601d05d2ac5d637",
"score": "0.6051442",
"text": "def all_names\n []\n end",
"title": ""
},
{
"docid": "05df13ba10a41f592f25d10fc77fd031",
"score": "0.6050895",
"text": "def user_names\n self.users.order(:last_name).collect(&:name)\n end",
"title": ""
},
{
"docid": "9abaf728b516cc848ccdeca8bcdc32db",
"score": "0.6049049",
"text": "def to_s; name end",
"title": ""
},
{
"docid": "61ea21765570a31b7dfae564760b2178",
"score": "0.60475755",
"text": "def names\n\n get_list['list'].map { |re, pa| re }\n end",
"title": ""
},
{
"docid": "7b127c2f1dc32722ac6f0d3239d5920e",
"score": "0.6044248",
"text": "def traveler_name\n return other_travelers if member_id.nil?\n result = traveler.full_name_short\n if with_spouse\n if member && member.spouse && # There is a spouse listed in the database\n Settings.travel.include_spouse_name_in_list # the setting is on\n result = \"#{member.short} & #{member.spouse.short} #{member.last_name}\" \n else\n result = \"M/M \" + result \n end\n end\n result << \" with #{other_travelers}\" unless other_travelers.blank?\n return result\n end",
"title": ""
},
{
"docid": "42efc7fab2166382acc1469eeb971f43",
"score": "0.6034848",
"text": "def full_name\n (self.ancestors.to_a << self).reverse.map{|a| a.long_name}.join(', ')\n\n end",
"title": ""
},
{
"docid": "e98e5ead0e32f9f363b2ca08f169a84c",
"score": "0.6029415",
"text": "def localized_names\n return @localized_names\n end",
"title": ""
},
{
"docid": "498a22946edaffda20137faab829fb0b",
"score": "0.60283875",
"text": "def get_linked_current_team_names\n linked_list = \"\"\n list = []\n if badges\n badges.includes( :season ).each do |badge|\n if !badge.season.is_season_ended_at\n list.append( badge.team.decorate.get_linked_name )\n end\n end\n linked_list = list.uniq.join(', ')\n else\n linked_list = I18n.t('none')\n end\n linked_list\n end",
"title": ""
},
{
"docid": "9a41982dc57dac54e19e9a2c31c58d4a",
"score": "0.6023842",
"text": "def get_linked_team_names\n linked_list = \"\"\n list = []\n if teams\n teams.uniq.each do |team|\n list.append( team.decorate.get_linked_name )\n end\n linked_list = list.join(', ')\n else\n linked_list = I18n.t('none')\n end\n linked_list\n end",
"title": ""
},
{
"docid": "5e50a73e1e88bf76646975184908b9fa",
"score": "0.6017967",
"text": "def list names\n return '' if names.empty?\n return names.first[:name] if names.size == 1\n return names.map {|nam_hash| nam_hash[:name] }.join(' & ') if names.size == 2\n names[0..-2].map {|nam_hash| nam_hash[:name] }.join(', ') + \" & #{names.last[:name]}\"\nend",
"title": ""
},
{
"docid": "ade76f3fedf9e2dc27c6988c488495ec",
"score": "0.6005091",
"text": "def show_full_name\n result = [ip]\n result << name if name.present?\n result.join(' ')\n end",
"title": ""
},
{
"docid": "6fb557308b447624f25b71141222fcb9",
"score": "0.5994248",
"text": "def player_names\n names = []\n self.groups.each do |g|\n g.players.each { |p| names << p.login }\n end\n names\n end",
"title": ""
},
{
"docid": "a018b46185a032ea2d7f966f50775c7b",
"score": "0.59937257",
"text": "def to_s \n @list.each do |name|\n name.to_s\n end\n end",
"title": ""
},
{
"docid": "eabb7883ccf4bafdba0b354b982f09db",
"score": "0.59934914",
"text": "def usernames\n users.map(&:username)\n end",
"title": ""
},
{
"docid": "a2f3e27dab7421cfdb5b766ff5d6d9b7",
"score": "0.59898216",
"text": "def name\n\t\t[last_name, first_name].compact.join(', ')\n\tend",
"title": ""
},
{
"docid": "29e4d9f2325704ca759169b99a502140",
"score": "0.5987886",
"text": "def to_str\n name\n end",
"title": ""
},
{
"docid": "c87997b17db22a78f37f215bbb35de85",
"score": "0.5986781",
"text": "def to_s\n [name, prename].reject(&:blank?).join(', ')\n end",
"title": ""
},
{
"docid": "8367dfcc700267dc4a481579c1d26d50",
"score": "0.5981207",
"text": "def to_s\n name.to_s\n end",
"title": ""
},
{
"docid": "8367dfcc700267dc4a481579c1d26d50",
"score": "0.5981207",
"text": "def to_s\n name.to_s\n end",
"title": ""
},
{
"docid": "6548c9f436836573417decf53264e208",
"score": "0.5980187",
"text": "def list names\n array = names.map{|i| i[:name]}\n last2 = array.slice!(-2..-1)\n (array.push last2 ? last2.join(\" & \") : last2).compact.join(\", \")\nend",
"title": ""
},
{
"docid": "455faeb05d1a71cacd8238d7942b0cd6",
"score": "0.59775615",
"text": "def lifter_names\n memberships.map do |member|\n member.lifter.name\n end\n end",
"title": ""
},
{
"docid": "f16293b02a8e6aa473c662782bfe28e6",
"score": "0.5976983",
"text": "def tags_as_string\n tag_names.join(', ')\n end",
"title": ""
}
] |
91a3e632c745ada72c92169d2a7b3386
|
PATCH/PUT /game_round_assets/1 PATCH/PUT /game_round_assets/1.json
|
[
{
"docid": "71b57d27cd5893da074cd3c6161566d1",
"score": "0.73499113",
"text": "def update\n respond_to do |format|\n if @game_round_asset.update(game_round_asset_params)\n format.html { redirect_to @game_round_asset, notice: 'Game round asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_round_asset }\n else\n format.html { render :edit }\n format.json { render json: @game_round_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "64b4c5a540fab3ffd7d37f4c1ef60285",
"score": "0.6743439",
"text": "def update\n @game_asset = GameAsset.find(params[:id])\n\n respond_to do |format|\n if @game_asset.update_attributes(params[:game_asset])\n format.html { redirect_to character_path(@game_asset.character), notice: 'Game asset was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5af53471ff55ef34c43a5f170769ad10",
"score": "0.6552774",
"text": "def update\n @game.update(game_params)\n render json: @game, status: 200\n end",
"title": ""
},
{
"docid": "9a1f17279bbc0401866bfda60e139432",
"score": "0.6527067",
"text": "def set_game_round_asset\n @game_round_asset = GameRoundAsset.find(params[:id])\n end",
"title": ""
},
{
"docid": "00347a81973473ec7c110428666182ea",
"score": "0.6510485",
"text": "def update\n @asset = Asset.find(params[:id])\n\n if @asset.update(asset_params)\n head :no_content\n else\n render json: @asset.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "b38c8323f10dfd3ed64147cbe3d89ddb",
"score": "0.6500717",
"text": "def update\n @asset = Asset.find(params[:id])\n if @asset.update_attributes(asset_params)\n head :no_content\n else\n render json: @asset.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0020299494d146ab5b4dcee4f1719c44",
"score": "0.6479602",
"text": "def update\n @game.update!(game_params) # anticipated possible exceptions rescued in BaseController\n render json: @game, status: 200\n end",
"title": ""
},
{
"docid": "0dabd20a6be438b103d9775f4cf3bc0e",
"score": "0.6382613",
"text": "def update!(**args)\n @allow_missing = args[:allow_missing] if args.key?(:allow_missing)\n @assets = args[:assets] if args.key?(:assets)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"title": ""
},
{
"docid": "24667a90ea837de6ed0cb065a06a0d6f",
"score": "0.63774186",
"text": "def update!(**args)\n @assets = args[:assets] if args.key?(:assets)\n end",
"title": ""
},
{
"docid": "487f795db103be0ba02fcff785f088d0",
"score": "0.63330495",
"text": "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to @asset, :notice => 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac1f2af050d966e02007c063f3b7b62d",
"score": "0.6321715",
"text": "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac1f2af050d966e02007c063f3b7b62d",
"score": "0.6321715",
"text": "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac1f2af050d966e02007c063f3b7b62d",
"score": "0.6321715",
"text": "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f0a61a236b9c3b4e3885a331f884733f",
"score": "0.62989634",
"text": "def update\n if @asset.update(asset_params)\n render :show, status: :ok, location: @asset\n else\n render json: @asset.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "79aa1481accede061c600119808d905f",
"score": "0.62976027",
"text": "def save\n Resource.client.update_asset(self)\n end",
"title": ""
},
{
"docid": "c1a2408dcfee7a07d3a0df98985b0e5e",
"score": "0.6284397",
"text": "def update\n respond_to do |format|\n if @asset_scrapping.update(asset_scrapping_params)\n format.html { redirect_to @asset_scrapping, notice: 'Asset scrapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_scrapping }\n else\n format.html { render :edit }\n format.json { render json: @asset_scrapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a96b91d084fa2823592ea7a9cf251f36",
"score": "0.62559265",
"text": "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset }\n else\n format.html { render :edit }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a96b91d084fa2823592ea7a9cf251f36",
"score": "0.62559265",
"text": "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset }\n else\n format.html { render :edit }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a96b91d084fa2823592ea7a9cf251f36",
"score": "0.62559265",
"text": "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset }\n else\n format.html { render :edit }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca80e32e1ab5b34f1f02c5507ae69821",
"score": "0.62519866",
"text": "def update\n @game = Game.find(params[:id])\n\n if @game.update(put_params)\n head :no_content\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "94ae472920d94fb87746fd508e6da67b",
"score": "0.625113",
"text": "def update\n respond_to do |format|\n if @it_asset.update(it_asset_params)\n format.html { redirect_to @it_asset, notice: 'It asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @it_asset }\n else\n format.html { render :edit }\n format.json { render json: @it_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6ed8c03ad41eb782ed6e1aae2aa97c3f",
"score": "0.6242788",
"text": "def update\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: \"Asset was successfully updated.\" }\n format.json { render :show, status: :ok, location: @asset }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1696cb33b03372c60a1050445a1fdba5",
"score": "0.62406653",
"text": "def update\n @uploadgame = Uploadgame.find(params[:id])\n\n respond_to do |format|\n if @uploadgame.update_attributes(params[:uploadgame])\n format.html { redirect_to @uploadgame, notice: 'Uploadgame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uploadgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "726f25aaf6a81681434f9d030f9f232a",
"score": "0.62273055",
"text": "def update\n if @game.update(game_params)\n render json: @game\n else\n render json: @game.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "db95fe589079fd64afc18efed01f3018",
"score": "0.6194348",
"text": "def update\n respond_to do |format|\n if @asset.update_attributes(asset_params)\n format.html { redirect_to user_assets_path }\n format.json { render :show, status: :ok, location: @asset }\n else\n format.html { render :edit }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "457b4f033c78483f2fac4638b448b284",
"score": "0.61652887",
"text": "def update\n @eve_asset = EveAsset.find(params[:id])\n\n respond_to do |format|\n if @eve_asset.update_attributes(params[:eve_asset])\n format.html { redirect_to @eve_asset, notice: 'Eve asset was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @eve_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "791dd12aeb12431b59228486f5b5a862",
"score": "0.61568606",
"text": "def update\n @asset.update_attributes(asset_params)\n end",
"title": ""
},
{
"docid": "8c91aec946d7de6b1e8e7e8509d0cf8b",
"score": "0.6154835",
"text": "def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n end",
"title": ""
},
{
"docid": "3300fe411d170dd9bdf890058d7695b5",
"score": "0.6152109",
"text": "def update\n if @asset_class.update(asset_class_params)\n head :no_content\n else\n render json: @asset_class.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a936adcf82ac4b6df6183237fea402b1",
"score": "0.61519206",
"text": "def update\n @asset = current_user.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a2d876b6bba2b351a34f71635a771bcf",
"score": "0.6132351",
"text": "def update\n authorize! :update, @asset\n\n respond_to do |format|\n if @asset.update(asset_params)\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a0361de3ddc1c256c2d927172eb252de",
"score": "0.6126716",
"text": "def update\n respond_to do |format|\n if @image_asset.update(image_asset_params)\n format.html { redirect_to @image_asset, notice: 'Image asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_asset }\n else\n format.html { render :edit }\n format.json { render json: @image_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "554cb6981663caaefc6f06087d88ba21",
"score": "0.61263716",
"text": "def update_asset asset, key, spec\n collins_client.set_attribute! asset, key, spec.to_json\n end",
"title": ""
},
{
"docid": "dc3db4a413c62a893011afd8c9a10429",
"score": "0.6125062",
"text": "def update\n @assets = Assets.find(params[:id])\n\n respond_to do |format|\n if @assets.update_attributes(params[:assets])\n flash[:notice] = 'Assets was successfully updated.'\n format.html { redirect_to(@assets) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @assets.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "929dfc56ea1767bb5ee599f3afc8a7dc",
"score": "0.61250263",
"text": "def update!(**args)\n @allow_existing = args[:allow_existing] if args.key?(:allow_existing)\n @assets = args[:assets] if args.key?(:assets)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"title": ""
},
{
"docid": "d5f78d24b94a4909acdb6562797e875a",
"score": "0.6108233",
"text": "def edit(*args)\n arguments(args, required: [:owner, :repo, :id]) do\n permit VALID_ASSET_PARAM_NAMES\n end\n\n patch_request(\"/repos/#{arguments.owner}/#{arguments.repo}/releases/assets/#{arguments.id}\", arguments.params)\n end",
"title": ""
},
{
"docid": "182af7b3c9583f5152f9baf0c25eb0a7",
"score": "0.60993505",
"text": "def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @request_id = args[:request_id] if args.key?(:request_id)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end",
"title": ""
},
{
"docid": "3f77c212775137f4d0b6093a3e6e811c",
"score": "0.60811114",
"text": "def game_round_asset_params\n params.require(:game_round_asset).permit(:game_round_id, :game_player_id)\n end",
"title": ""
},
{
"docid": "e4bb230bec372706def86bb85ef0f9af",
"score": "0.60599536",
"text": "def update\n respond_to do |format|\n if @game_round.update(game_round_params)\n format.html { redirect_to @game_round, notice: 'Game round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3453ef519f120f8a02aa20750e86446",
"score": "0.60561377",
"text": "def update_asset\n @asset = Asset.shod(params[:id])\n @asset.update(asset_params)\n @assets ||= Asset.all\n flash[:notice] = t('asset_update')\n end",
"title": ""
},
{
"docid": "029ced26abb7556e56bb839e4b29b246",
"score": "0.6032271",
"text": "def update\n @asset = Asset.find(params[:id])\n\n #Nur Administratoren können die Bildversionen neu erstellen. \n #Das aber dann automatisch durch einmaliges editieren und wieder speichern.\n #if can? :manage, @asset\n #@asset.assetfile.recreate_versions!\n #end\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n # if fotograf do track_activity @issue, 'took a foto'\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: \"form\", action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8fbc70900322a22c26e47bb2a9028a78",
"score": "0.59895533",
"text": "def update\n respond_to do |format|\n if @shot.update(shot_params)\n format.html { redirect_to @shot.game, notice: 'Shot was successfully updated.' }\n format.json { render :show, status: :ok, location: @shot }\n else\n set_values\n format.html { render :edit }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f2e1a2d92615dec6db1ba3446adbeaf7",
"score": "0.598559",
"text": "def update\n respond_to do |format|\n if @asset_proced.update(asset_proced_params)\n format.html { redirect_to @asset_proced, notice: 'Asset proced was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_proced }\n else\n format.html { render :edit }\n format.json { render json: @asset_proced.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bff7c13c2aa79b6a0660ff66f8a422dd",
"score": "0.59807277",
"text": "def update(id, params = {})\n # self.class.put(\n # \"/content_assets/#{id}.json\",\n # :query => { :auth_token => self.auth_token, :content_asset => params }\n # )\n end",
"title": ""
},
{
"docid": "c49588e052b02b6592fcba9b3b355acc",
"score": "0.59773594",
"text": "def update\n if @asset.update(file: asset_params[:file].first)\n respond_modal_with [@app, @asset], location: app_assets_url\n else\n @asset.errors.add(:base, :unprocessable_entity)\n respond_modal_with @asset\n end\n end",
"title": ""
},
{
"docid": "0036f7b76b3ed32ddff3a58450f9e4db",
"score": "0.5962924",
"text": "def update\n @game_object = GameObject.find(params[:id])\n\n respond_to do |format|\n if @game_object.update_attributes(params[:game_object])\n format.html { redirect_to @game_object, notice: 'Game object was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game_object.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b89ee7f82db1a464812385e705cd4d0b",
"score": "0.5958285",
"text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c1b02b6357d879d0b2f1d7ebef6f975d",
"score": "0.59488505",
"text": "def update\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n flash[:notice] = 'Asset was successfully updated.'\n format.html { redirect_to asset_url(@asset) }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "8807670db4fdec61bfea68bc73c3cd96",
"score": "0.5946717",
"text": "def update\n respond_to do |format|\n if @personal_asset.update(personal_asset_params)\n format.html { redirect_to @personal_asset, notice: 'Personal asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dc6267b7f6bc9146c1321f7325997900",
"score": "0.59444475",
"text": "def update(attributes)\n self.title = attributes[:title] if attributes[:title]\n self.description = attributes[:description] if attributes[:description]\n self.file = attributes[:file] if attributes[:file]\n request = Request.new(\n \"/#{ space.id }/assets/#{ id }\",\n {fields: fields_for_query},\n id = nil,\n version: sys[:version]\n )\n response = request.put\n result = ResourceBuilder.new(response, {}, {}).run\n refresh_data(result)\n end",
"title": ""
},
{
"docid": "e93e1500f20938bf167c99ce225254ec",
"score": "0.5939572",
"text": "def update\n respond_to do |format|\n if @secondary_asset.update(secondary_asset_params)\n format.html { redirect_to @secondary_asset, notice: 'Secondary asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @secondary_asset }\n else\n format.html { render :edit }\n format.json { render json: @secondary_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f9f92ec8451bf88efca2fa39b3c00f10",
"score": "0.5939315",
"text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f9f92ec8451bf88efca2fa39b3c00f10",
"score": "0.5939315",
"text": "def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "565b67193f47f997d428daac88f1f436",
"score": "0.5936802",
"text": "def update\n path = params[:path]\n full_path = \"#{BASE_PATH}/#{path}\"\n @asset = Asset.new(\n :filename => File.basename(path), \n :path => path,\n :full_path => full_path, \n :parent_path => path.gsub(/\\/([^\\/]*)\\.([^\\/]*)/, ''),\n :content_type => MIME.check(full_path).to_s,\n :created_at => File.atime(\"#{BASE_PATH}/#{path}\")) \n File.open(full_path,\"w\"){|file| file.puts params[:body]}\n @body = IO.read(full_path)\n \n respond_to do |format|\n flash[:notice] = 'Asset was successfully updated.'\n format.html { render :template => 'admin/assets/edit' }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "446d8450bde7078ccfa16a8998d902d9",
"score": "0.5934401",
"text": "def update\n @game = Game.find(params[:id])\n @game.update(state: params[\"game\"][\"state\"])\n render json: @game, status: 201\n end",
"title": ""
},
{
"docid": "79c52daa44aef311a72d7c2f105f02d7",
"score": "0.59337217",
"text": "def update\n @purple_asset = PurpleAsset.find(params[:id])\n\n respond_to do |format|\n if @purple_asset.update_attributes(params[:purple_asset])\n format.html { redirect_to(@purple_asset, :notice => 'Purple asset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purple_asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e9f3c2c05e4c382803278cacefc7e34",
"score": "0.5933116",
"text": "def update\n @asset = @user.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to(@asset, :notice => 'Asset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5fe29ed9a1eee2f7648405d8a8b45798",
"score": "0.59265536",
"text": "def update!(**args)\n @asset_ids = args[:asset_ids] if args.key?(:asset_ids)\n end",
"title": ""
},
{
"docid": "0a33eec71fa158cf8d5f5c7da1c9410c",
"score": "0.5909095",
"text": "def update\n respond_to do |format|\n if @company_asset.update(company_asset_params)\n format.html { redirect_to @company_asset, notice: 'Company asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_asset }\n else\n format.html { render :edit }\n format.json { render json: @company_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5171a8cc6f593e9cb68331c99fbab443",
"score": "0.5904843",
"text": "def update\n @bettergame = Bettergame.find(params[:id])\n\n respond_to do |format|\n if @bettergame.update_attributes(params[:bettergame])\n format.html { redirect_to @bettergame, notice: 'Bettergame was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bettergame.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "54fe6a3c6e733dce37ccc2f7ef60b098",
"score": "0.59013915",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, :notice => 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @game.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "45f30b6deb596c76b96495c731a4658b",
"score": "0.58913434",
"text": "def update\n @game = Game.find(params[:id])\n @score_by_holes = JSON.parse(params[:score_by_holes])\n\n i = 0\n @score_by_holes.each do |score_by_hole|\n sbh = @game.scores(i).score_by_holes(params[:number_hole] - 1)\n sbh.nb_shots = score_by_hole.nb_shots\n sbh.save\n i += 1\n end\n\n respond_to do |format|\n if @game.save\n format.json { render json: @game, status: :ok }\n else\n format.json { render json: \"{ 'error' : 'Bad parameters, score by hole not added' }\", status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9e4e95cf33f50cb47d25506185d7f1d2",
"score": "0.588904",
"text": "def update\n @game = Game.find(params[:id])\n @game.status = params[:status];\n @game.save\n\n respond_to do |format|\n format.json { render json: @game }\n end\n end",
"title": ""
},
{
"docid": "8e30a08a6321ea1127e941d2f7bd71ca",
"score": "0.5884943",
"text": "def update\n if @asset.update(asset_params)\n respond_with @asset, notice: 'Asset was successfully updated.'\n else \n render :edit\n end\n end",
"title": ""
},
{
"docid": "c4db50ea89cd1fe8027abde60a731792",
"score": "0.58766836",
"text": "def update!(**args)\n @default_asset_id = args[:default_asset_id] if args.key?(:default_asset_id)\n @rules = args[:rules] if args.key?(:rules)\n end",
"title": ""
},
{
"docid": "05810d217e2095d714f7b0ca09d6781e",
"score": "0.5874434",
"text": "def update\n if content_asset_params[:content].present?\n file_name_array = content_asset_params[:name].split('.')\n file = Tempfile.new([file_name_array.first, \".#{file_name_array.last}\"])\n file.write(content_asset_params[:content])\n file.rewind\n file.read\n @asset.attachment = File.open(file.path)\n @asset.save\n file.close\n file.unlink\n end\n @asset.update(asset_params)\n render json: { name: @asset.name, content: @asset.attachment.file&.read || '', id: @asset.id }\n end",
"title": ""
},
{
"docid": "993a3320b4b02415108881139e900c1e",
"score": "0.5874241",
"text": "def update\n params[:section][:existing_asset_attributes] ||= {}\n respond_to do |format|\n if load_single.update_attributes(params[:section])\n flash[:notice] = 'Section was successfully updated.'\n format.html { redirect_to create_update_url }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "531df9c40982bc369705a064b046ebfd",
"score": "0.5873946",
"text": "def update\n\n if @game.update(game_params)\n\n render json: @game,status: :ok\n\n else\n\n render json: {error: true,errors: @game.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"title": ""
},
{
"docid": "1a8917696fa8831569388041f2ed8918",
"score": "0.58681905",
"text": "def update\n @game = Game.find(params[\"id\"])\n \n if @game.state == 'on'\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.json { render json: @game }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.json { render json: @game }\n else \n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end\n \n end",
"title": ""
},
{
"docid": "73e81207363055deb482bc84fcb2f75b",
"score": "0.5866669",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n update_boxing_closeTime(@game)\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "461e035313c5ca2628ec44a4311db684",
"score": "0.5862697",
"text": "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n if params[:remove_photo]\n @asset.photo = nil\n @asset.save\n end\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n @owners = @users = Member.all\n @categories = Category.all\n format.html { render action: \"edit\" }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0e1e1fe0b715529ae0a3932da2f582f1",
"score": "0.5853945",
"text": "def update!(**args)\n @child_asset_id = args[:child_asset_id] if args.key?(:child_asset_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @parent_asset_id = args[:parent_asset_id] if args.key?(:parent_asset_id)\n end",
"title": ""
},
{
"docid": "3e6f4e7085d1c7530e26a7a35d84ec1e",
"score": "0.5851616",
"text": "def update\n @game = Game.find(params[:id].to_i)\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "37ed27f524c9e94608e1501c62866ee6",
"score": "0.5849909",
"text": "def update\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to(@asset, :notice => \"#{@asset} was successfully updated\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5e02138bcb0dff3b0ae194d82e65917b",
"score": "0.5848513",
"text": "def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @compression_format = args[:compression_format] if args.key?(:compression_format)\n @data_format = args[:data_format] if args.key?(:data_format)\n @project_id = args[:project_id] if args.key?(:project_id)\n end",
"title": ""
},
{
"docid": "0920e7818c5e8294ed2d25e8695d500f",
"score": "0.5848134",
"text": "def update\n respond_to do |format|\n if @game.update(game_params)\n format.html { redirect_to @game, notice: 'game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity } \n end\n end\n end",
"title": ""
},
{
"docid": "ceee085b75a2bc843d41125bc193faad",
"score": "0.5846232",
"text": "def update\n @physical_asset = PhysicalAsset.find(params[:id])\n\n respond_to do |format|\n if @physical_asset.update_attributes(params[:physical_asset])\n format.html { redirect_to @physical_asset, notice: 'Physical asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20958657e0fafa6604e49560391c9af2",
"score": "0.58452",
"text": "def update\n @asset = Asset.find(params[:id])\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n format.html { redirect_to(@asset, :notice => 'Asset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e27f4b60f8d52b5f305290b4f8a19019",
"score": "0.58330286",
"text": "def update\n respond_to do |format|\n if @fixedasset.update(fixedasset_params)\n format.html { redirect_to @fixedasset, notice: '更新しました' }\n format.json { render :show, status: :ok, location: @fixedasset }\n else\n format.html { render :edit }\n format.json { render json: @fixedasset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5001babcfed5b3b3b85ac3b5b6f2b834",
"score": "0.5829033",
"text": "def update\n respond_to do |format|\n if @shot.update(shot_params)\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { render :show, status: :ok, location: @shot }\n else\n format.html { render :edit }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15824dc82d9a6e98c313939aa4d606dd",
"score": "0.58254975",
"text": "def update\n # CarrierWave attrs->filename hack\n @collectible.assign_attributes(collectible_params.except(:collectible_file, :json_file))\n @collectible.assign_attributes(collectible_params.slice(:collectible_file, :json_file))\n\n respond_to do |format|\n if @collectible.save\n format.html { redirect_to @collectible, notice: 'Collectible was successfully updated.' }\n format.json { render :show, status: :ok, location: @collectible }\n else\n format.html { render :edit }\n format.json { render json: @collectible.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d7f56c8f53e9ff9f8c006a129fad840b",
"score": "0.5824351",
"text": "def update\r\n @game = Game.find(params[:id])\r\n json = ActiveSupport::JSON.decode(request.raw_post)\r\n logger.debug json\r\n\r\n respond_to do |format|\r\n if @game.update_attributes(params[:game])\r\n format.html { redirect_to(@game, :notice => 'Game 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 => @game.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "dd70fe9da5cfa2905874efd480df9d30",
"score": "0.5823631",
"text": "def update\n respond_to do |format|\n if @scale_game.update(scale_game_params)\n format.html { redirect_to @scale_game, notice: 'Scale game was successfully updated.' }\n format.json { render :show, status: :ok, location: @scale_game }\n else\n format.html { render :edit }\n format.json { render json: @scale_game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2572fb900123dab962d92dfd5cd31505",
"score": "0.5823129",
"text": "def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend",
"title": ""
},
{
"docid": "f3c597d400a9bd6da0010d5482c37c95",
"score": "0.58130497",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f3c597d400a9bd6da0010d5482c37c95",
"score": "0.58130497",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bf10e48141fcc9fbbe63d71d0f38879a",
"score": "0.58124167",
"text": "def update\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n flash[:notice] = 'Asset was successfully updated.'\n format.html { redirect_to(admin_asset_path(@asset)) }\n format.xml { head :ok }\n else\n assign_lovs\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b1fbcf1637258054c24bd3dbff067a85",
"score": "0.5812376",
"text": "def update\n respond_to do |format|\n if @user_asset.update(user_asset_params)\n format.html { redirect_to @user_asset, notice: 'User asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_asset }\n else\n format.html { render :edit }\n format.json { render json: @user_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "29e0664c4eac4337f0b6b2bfc0539a0f",
"score": "0.58114403",
"text": "def update\n respond_to do |format|\n if @nsm_asset.update(nsm_asset_params)\n format.html { redirect_to @nsm_asset, notice: 'Nsm asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @nsm_asset }\n else\n format.html { render :edit }\n format.json { render json: @nsm_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e0428d67881b5bb488ab895c606dab7",
"score": "0.5804306",
"text": "def update\n @game = Game.get(params[:id])\n\n respond_to do |format|\n if @game.update(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "11e74d753d9221ff82a876c97cc67335",
"score": "0.5803821",
"text": "def update\n # if team_season_params.has_key?(:photos_attributes)\n # team_season_params[:photos_attributes].each do |photo|\n # @photo.team_season.photos.each do |photo|\n # photo.update_attributes(main: false)\n # end\n # end\n # end\n respond_to do |format|\n if @team_season.update(team_season_params)\n format.html { redirect_to @team_season, notice: 'Team season was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_season }\n else\n format.html { render :edit }\n format.json { render json: @team_season.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d653e8ae8318f69a06eef424a34acbae",
"score": "0.5802747",
"text": "def update\n @badge = Badge.find(params[:id])\n if @badge.update_attributes(params[:badge])\n if @badge.asset\n @badge.asset.update_attributes({:asset => params[:asset][:file], :attachable_id => @badge.id, :attachable_type => \"badge\"})\n else\n @asset = Asset.new({:asset => params[:asset][:file], :user_id => current_user.id, :attachable_id => @badge.id, :attachable_type => \"badge\"})\n @asset.save\n end\n flash[:notice] = \"Successfully updated badge.\"\n redirect_to admin_badges_path(current_user)\n else\n render :action => 'edit'\n end\n end",
"title": ""
},
{
"docid": "f7cd7da54479281695b722e8169dcc2d",
"score": "0.5802596",
"text": "def update!(**args)\n @background_image_file = args[:background_image_file] if args.key?(:background_image_file)\n @background_image_link = args[:background_image_link] if args.key?(:background_image_link)\n @capabilities = args[:capabilities] if args.key?(:capabilities)\n @color_rgb = args[:color_rgb] if args.key?(:color_rgb)\n @created_time = args[:created_time] if args.key?(:created_time)\n @hidden = args[:hidden] if args.key?(:hidden)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @org_unit_id = args[:org_unit_id] if args.key?(:org_unit_id)\n @restrictions = args[:restrictions] if args.key?(:restrictions)\n @theme_id = args[:theme_id] if args.key?(:theme_id)\n end",
"title": ""
},
{
"docid": "7eda093110ae267350c353dadaa399f0",
"score": "0.5800428",
"text": "def update\n @game = Game.find(params[:id])\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04dbd46c6cc7be362c37e9d5ffb83642",
"score": "0.5799102",
"text": "def update\n if !has_right?(:edit)\n redirect_to :unauthorized\n return\n end\n @asset = Asset.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(params[:asset])\n flash[:notice] = 'Asset was successfully updated.'\n format.html { redirect_to asset_url(@asset) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "48adfca336f9310dd0522d748154958c",
"score": "0.5797315",
"text": "def update\n respond_to do |format|\n if @game_api.update(game_api_params)\n format.html { redirect_to game_game_api_path(game_id: @game.id, id: @game_api.id), notice: 'Game api was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_api }\n else\n format.html { render :edit }\n format.json { render json: @game_api.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "992d46908b2fd167e3f2d938a5a9643f",
"score": "0.57934666",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n # format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b50da65a9adeaa63ab239ed431c17c70",
"score": "0.5790062",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b50da65a9adeaa63ab239ed431c17c70",
"score": "0.5790062",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b50da65a9adeaa63ab239ed431c17c70",
"score": "0.5790062",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b50da65a9adeaa63ab239ed431c17c70",
"score": "0.5790062",
"text": "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
3c9bdfd905ab207d199eee7fa3ea3ae6
|
NOTE: We overwrite what the user's may have indicated as the label for the phone number. If the user responds to an sms on this number, we consider it to be their mobile number
|
[
{
"docid": "5df6af87942cd2c4fe1e000bb0bc7890",
"score": "0.0",
"text": "def responded_to_notification(notification)\n # MARKER - that the value changed\n if notification.is_email? && notification.contact_value != email\n log_event(\"User #{self.log_info} email updated from [#{email || 'null'}] to [#{notification.contact_value}]\")\n self.update_attribute(:email,notification.contact_value)\n elsif notification.is_sms? && notification.contact_value != mobile_number\n log_event(\"User #{self.log_info} mobile_number updated from [#{mobile_number || 'null'}] to [#{notification.contact_value}]\")\n self.update_attribute(:mobile_number,notification.contact_value)\n end\n # update the user's status so we know that he has responded to a notification\n if status == :contact_attempted || status == :initialized\n update_attribute(:status,:contacted) \n end\n end",
"title": ""
}
] |
[
{
"docid": "0be20556171958979a3f28dbe39729ec",
"score": "0.7613219",
"text": "def mobile_phone\n value = format_phone(user_data['mobile_phone'])\n\n set_text('Mobile phone:', 345)\n set_text(value, 345, 'value')\n end",
"title": ""
},
{
"docid": "b0841167834b482aebc7942b21ff4a6a",
"score": "0.70363766",
"text": "def mobile_number\n if self.mobile.empty? then return self.mobile end\n formatted_did = clean_did(self.mobile)\n format_did(formatted_did)\n end",
"title": ""
},
{
"docid": "b0841167834b482aebc7942b21ff4a6a",
"score": "0.70363766",
"text": "def mobile_number\n if self.mobile.empty? then return self.mobile end\n formatted_did = clean_did(self.mobile)\n format_did(formatted_did)\n end",
"title": ""
},
{
"docid": "a28411540def953b109792a362c255d1",
"score": "0.6925817",
"text": "def mobile\n FFaker.numerify(\"#{mobile_phone_number_format}\")\n end",
"title": ""
},
{
"docid": "e302914b85d2b5dddccfb6586d4f3488",
"score": "0.67535466",
"text": "def label\n if self.type == 'phone'\n 'Phone Number'\n else\n 'Email Address'\n end\n end",
"title": ""
},
{
"docid": "74cb586b7c55a4690457a5d52b6f9b63",
"score": "0.67280084",
"text": "def mobile_phone_number\n FFaker.numerify(\"#{mobile_phone_prefix} ### ####\")\n end",
"title": ""
},
{
"docid": "74cb586b7c55a4690457a5d52b6f9b63",
"score": "0.67280084",
"text": "def mobile_phone_number\n FFaker.numerify(\"#{mobile_phone_prefix} ### ####\")\n end",
"title": ""
},
{
"docid": "bdf9ff717cb53629314e4a37081a933d",
"score": "0.6717115",
"text": "def mobile_phone_number\n phone_number\n end",
"title": ""
},
{
"docid": "79e3aff7f1cfd3de333c24f1d4f92b7d",
"score": "0.6709369",
"text": "def mobile_phone_number\n build_phone_number(country_code, mobile_phone_prefix)\n end",
"title": ""
},
{
"docid": "db6faba702d4d1c26211f8f320905a0f",
"score": "0.66537553",
"text": "def phone_number\n respond_to?(:phoneNumber) ? phoneNumber : ''\n end",
"title": ""
},
{
"docid": "f0291895a265edfabe8d500b2c8d8ad7",
"score": "0.66326356",
"text": "def mobile_phone_number\n FFaker.numerify('044 ## #### ####')\n end",
"title": ""
},
{
"docid": "ef3bfe239b42d88708636f1b9834a988",
"score": "0.66100115",
"text": "def format_phone\n\t\tif self.phone.present?\n\t\t\tself.phone = self.phone.gsub(/\\D/, \"\")\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6fe5223dd80a3e0fc15503720ad46f1e",
"score": "0.65839446",
"text": "def format_phone\n if @phone != nil\n @phone = self.phone.scan(/[0-9]/).join\n self.phone = @phone.length == 7 ? ActionController::Base.helpers.number_to_phone(@phone) : \n @phone.length == 10 ? ActionController::Base.helpers.number_to_phone(@phone, area_code: true) :\n @phone\n\n end\n end",
"title": ""
},
{
"docid": "d81d0f527e24eef8e2421d727d656c88",
"score": "0.6577929",
"text": "def mobile_phone=(value)\n @mobile_phone = value\n end",
"title": ""
},
{
"docid": "d81d0f527e24eef8e2421d727d656c88",
"score": "0.6577929",
"text": "def mobile_phone=(value)\n @mobile_phone = value\n end",
"title": ""
},
{
"docid": "d81d0f527e24eef8e2421d727d656c88",
"score": "0.6577929",
"text": "def mobile_phone=(value)\n @mobile_phone = value\n end",
"title": ""
},
{
"docid": "060c92ce35145e8fb194a52c667413d8",
"score": "0.655074",
"text": "def international_mobile_phone_number\n build_phone_number(international_country_code, mobile_phone_prefix)\n end",
"title": ""
},
{
"docid": "eabb0258a91742c2b06d2f46188282c3",
"score": "0.64721453",
"text": "def set_PhoneNumber(value)\n set_input(\"PhoneNumber\", value)\n end",
"title": ""
},
{
"docid": "eabb0258a91742c2b06d2f46188282c3",
"score": "0.64721453",
"text": "def set_PhoneNumber(value)\n set_input(\"PhoneNumber\", value)\n end",
"title": ""
},
{
"docid": "eabb0258a91742c2b06d2f46188282c3",
"score": "0.64711785",
"text": "def set_PhoneNumber(value)\n set_input(\"PhoneNumber\", value)\n end",
"title": ""
},
{
"docid": "eabb0258a91742c2b06d2f46188282c3",
"score": "0.64711785",
"text": "def set_PhoneNumber(value)\n set_input(\"PhoneNumber\", value)\n end",
"title": ""
},
{
"docid": "8c332563922ccf5c295452e1e919bec3",
"score": "0.64523405",
"text": "def format_phone\n if phone\n phone = Phonelib.parse(self.phone)\n phone.national\n end\n end",
"title": ""
},
{
"docid": "db06443267b6a825b7256b5aa5377c98",
"score": "0.6413461",
"text": "def phone_number\n if self.phone.empty? then return self.phone end\n formatted_did = clean_did(self.phone)\n format_did(formatted_did)\n end",
"title": ""
},
{
"docid": "db06443267b6a825b7256b5aa5377c98",
"score": "0.6413461",
"text": "def phone_number\n if self.phone.empty? then return self.phone end\n formatted_did = clean_did(self.phone)\n format_did(formatted_did)\n end",
"title": ""
},
{
"docid": "044db0ece29c6d4f1918762689d9015c",
"score": "0.6399698",
"text": "def format_phone\n if Phoner::Phone.valid? self.phone\n pn = Phoner::Phone.parse phone, :country_code => '1'\n self.phone = pn.format(\"(%a) %f-%l\")\n end\n end",
"title": ""
},
{
"docid": "18c1d33bb43ec53bf4432e3fc97f823a",
"score": "0.6395732",
"text": "def setup_phone\n if is_phone? && value.blank?\n code,number = strip_country_code(field_value)\n self.country_code = code \n self.value = number\n end\n end",
"title": ""
},
{
"docid": "30f12c4e1b03f48b13af933bc796a070",
"score": "0.63701046",
"text": "def phone=(value)\n value.gsub!(/\\D/, '') if value.is_a? String\n super(value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "be852f64fd2a1678f172297edeb0523d",
"score": "0.6359782",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "8210acb93e9aea3830df690ff8745ca6",
"score": "0.6348947",
"text": "def set_phone_number_field(phone_number)\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "ff8fd3a2ab513594bb431fd53379a8d1",
"score": "0.63488615",
"text": "def normalize_phone_number\n # stretch\n end",
"title": ""
},
{
"docid": "e2ef277c6355aa5a47bc46b12be01ab4",
"score": "0.63379955",
"text": "def mobilestr\n ActiveSupport::NumberHelper.number_to_phone(mobile, area_code: :true)\n end",
"title": ""
},
{
"docid": "035ff02a5f915a659aa04161d6e5d4af",
"score": "0.63377625",
"text": "def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"title": ""
},
{
"docid": "edaa2b48a6d767e4315ec9cb4baea5cb",
"score": "0.6332241",
"text": "def contact_i_t_phone_number=(value)\n @contact_i_t_phone_number = value\n end",
"title": ""
},
{
"docid": "2c0fe2347ee615ac0b56f65393c97d08",
"score": "0.6331036",
"text": "def international_phone_number\n case rand(0..1)\n when 0 then international_mobile_phone_number\n when 1 then international_home_work_phone_number\n end\n end",
"title": ""
},
{
"docid": "2c0fe2347ee615ac0b56f65393c97d08",
"score": "0.6331036",
"text": "def international_phone_number\n case rand(0..1)\n when 0 then international_mobile_phone_number\n when 1 then international_home_work_phone_number\n end\n end",
"title": ""
},
{
"docid": "d6a34c184a5556071e20a4a034a90899",
"score": "0.63273853",
"text": "def normalize_phone\n md = /\\A\n (?:[+]\\s*1)?\n [^0-9]* (\\d{3})\n [^0-9]* (\\d{3})\n [^0-9]* (\\d{4})\n [^0-9]*\n \\z/x.match(phone)\n if md\n self.phone = \"+1\" + md[1] + md[2] + md[3]\n end\n end",
"title": ""
},
{
"docid": "6a015d25a62270669f3e8c448909c09a",
"score": "0.63220906",
"text": "def mobile_number_contact_for(contact_user)\n contact_user_id = User.normalize_to_id(contact_user)\n contact_record = sourced_contacts.for(contact_user_id).first and contact_record.details.mobile_phone.not_bad.first\n end",
"title": ""
},
{
"docid": "ab71c6a97d945a51d76b3feaa7f361f5",
"score": "0.63193804",
"text": "def display_name\n \"#{self.dialing_prefix} #{self.mobile_number}\"\n end",
"title": ""
},
{
"docid": "a34201a14e2fd3bb308cad820154c79b",
"score": "0.6318119",
"text": "def phone_number \n\t\t\"1#{self.phone}\"\n\tend",
"title": ""
},
{
"docid": "0582f3f00e43795872134d7987ed70d7",
"score": "0.63106054",
"text": "def phone_format\n self.cus_p_phone = self.cus_p_phone.gsub(/\\D/, '')\n self.cus_a_phone = self.cus_a_phone.gsub(/\\D/, '')\n end",
"title": ""
},
{
"docid": "4f1edc4092b71f1ea263269cc29cb841",
"score": "0.6300533",
"text": "def get_phone_number\n self.user_profile_d360_alt_phone.blank? ? self.user_profile_pri_phone :\n self.user_profile_d360_alt_phone\n end",
"title": ""
},
{
"docid": "5fde3cfc54852eb5403183c72a3f3412",
"score": "0.62669",
"text": "def phone=(value)\n self[:phone] = value.gsub(/[^\\d+x]/, \"\") if value\n end",
"title": ""
},
{
"docid": "8db6142d3ebd02e743ab3e4446994111",
"score": "0.626641",
"text": "def phone=(value)\n super(value.blank? ? nil : value.gsub(/[^\\w\\s]/, ''))\n end",
"title": ""
},
{
"docid": "f74c176a2bfcab6c4848e9b5e22b8610",
"score": "0.6260878",
"text": "def phone_type(phone)\n phone == 'iPhone' ? phone : phone.titleize.downcase\n end",
"title": ""
},
{
"docid": "12f831a4662c70a9e7b948670c90cf7a",
"score": "0.62552387",
"text": "def complete_phone\n phone_ext.blank? ? phone_number : \"#{phone_number} Ext. #{phone_ext}\"\n end",
"title": ""
},
{
"docid": "1861c9e1fac87867f76c63ece456f638",
"score": "0.62532854",
"text": "def home_phone\n value = format_phone(user_data['home_phone'])\n\n set_text('Home phone:', 325)\n set_text(value, 325, 'value')\n end",
"title": ""
},
{
"docid": "79abf3762a9aae0580fb42ee7315bb01",
"score": "0.6248054",
"text": "def phone_number=(value)\n @phone_number = value\n end",
"title": ""
},
{
"docid": "6964139848a60f85a12344f34dde9255",
"score": "0.62411976",
"text": "def normalize_phone_number\n # stretch\n if !self.phone.nil?\n self.phone = self.phone.gsub(/\\)|\\(|-|\\.|,/,\"\")\n self.phone = self.phone.gsub(/1\\d{10}/,self.phone[1..self.phone.length])\n end\n end",
"title": ""
},
{
"docid": "aaada26fc67ff1b3555db77075b04a32",
"score": "0.62381136",
"text": "def phone(user)\n if user.is_a? String\n user\n else\n user.send(:sms_id)\n end\n end",
"title": ""
},
{
"docid": "607f46c8ec9d4592481318fdd7725327",
"score": "0.62230957",
"text": "def format_phone\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n puts \">>>>>>>> formatting self.scphonenumber >>>>>>>>>>>>>>>>>>>>>\"\n puts \"before #{self.scphonenumber}\"\n self.scphonenumber=self.scphonenumber.to_s.gsub(/[^0-9]/, \"\").to_i\n puts \"after #{self.scphonenumber}\"\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n end",
"title": ""
},
{
"docid": "9d9703c15cf96ef9d5d4619c8fd574d4",
"score": "0.6217017",
"text": "def standardized_sms_phone_number\n PhoneParser.normalize(sms_phone_number)\n end",
"title": ""
},
{
"docid": "9d9703c15cf96ef9d5d4619c8fd574d4",
"score": "0.6217017",
"text": "def standardized_sms_phone_number\n PhoneParser.normalize(sms_phone_number)\n end",
"title": ""
},
{
"docid": "6633e33513cb7d7ffce701c2ae357634",
"score": "0.62151915",
"text": "def phone_with_area_code_parent_label(label_name,phone_num,el=browser)\n #2 text fields: (012) and 345-6789\n phone_num.gsub!('-','')\n phone_num.gsub!('(','')\n phone_num.gsub!(')','')\n el.label(:text => /#{label_name}/).wait_until_present\n element=el.label(:text => /#{label_name}/)\n element.parent.text_fields[0].set phone_num[0..2]\n element.parent.text_fields[1].set phone_num[3..9]\n end",
"title": ""
},
{
"docid": "95ef6edbf136d76563fa045ab666d035",
"score": "0.62147444",
"text": "def mobile_phone\n return @mobile_phone\n end",
"title": ""
},
{
"docid": "95ef6edbf136d76563fa045ab666d035",
"score": "0.62147444",
"text": "def mobile_phone\n return @mobile_phone\n end",
"title": ""
},
{
"docid": "95ef6edbf136d76563fa045ab666d035",
"score": "0.62147444",
"text": "def mobile_phone\n return @mobile_phone\n end",
"title": ""
},
{
"docid": "5b9a95af8124e6c9b3c357fa474562f1",
"score": "0.62080204",
"text": "def phone_number\n\t\t\tsender.phone_number\n\t\tend",
"title": ""
},
{
"docid": "31fccc0a82eee1ecb9739613f56e6a3b",
"score": "0.6206175",
"text": "def normalize_phone(phone)\n return unless phone\n\n normalized = Phony.normalize(phone)\n\n # check for (555) 321-4567 style numbers if no explicit country code on original\n if normalized.length == 10 && phone[0] != '+'\n normalized = '1' + normalized\n end\n\n # phony strips out + but twilio wants it\n return '+' + normalized if Phony.plausible?(normalized)\n\n # if we can't do anything smart, do nothing at all\n phone\n end",
"title": ""
},
{
"docid": "f8a05840a9f46ccc6f1e46fe2297e633",
"score": "0.6198646",
"text": "def phone_number\n @phone_number ||= respond_to?(:phoneNumber) && phoneNumber.length > ATTRIBUTE_LENGTH_LIMIT_HACK ? phoneNumber : ''\n end",
"title": ""
},
{
"docid": "19916988c97fab2a55bcf681c3e87964",
"score": "0.61968005",
"text": "def standardized_sms_phone_number\n PhoneParser.normalize(sms_phone_number)\n end",
"title": ""
},
{
"docid": "9c73eb92f0672b53411344844362dc8f",
"score": "0.61962247",
"text": "def phone\n case rand(4)\n when 0 then FFaker.numerify(\"#{phone_format_prefix_8}\")\n when 1 then FFaker.numerify(\"#{phone_format_prefix_7}\")\n when 2 then FFaker.numerify(\"#{phone_format_prefix_6}\")\n when 3 then FFaker.numerify(\"#{phone_format_prefix_5}\")\n end\n end",
"title": ""
},
{
"docid": "ce18e3d7bdebb46af8ec1b40dfee8803",
"score": "0.6183476",
"text": "def phone=(num)\n num.gsub!(/\\D/, '')\n super(num)\n end",
"title": ""
},
{
"docid": "ce18e3d7bdebb46af8ec1b40dfee8803",
"score": "0.6181788",
"text": "def phone=(num)\n num.gsub!(/\\D/, '')\n super(num)\n end",
"title": ""
},
{
"docid": "5969dc60050520255a83b589a588af01",
"score": "0.6180266",
"text": "def clean_phone\n if @normal_phone\n self.phone = @normal_phone.gsub(/[^0-9]/, \"\").to_i\n end\n end",
"title": ""
},
{
"docid": "5b1124066b5397a1b1e0686b49814329",
"score": "0.6168351",
"text": "def phone_number\n case rand(0..1)\n when 0 then mobile_phone_number\n when 1 then home_work_phone_number\n end\n end",
"title": ""
},
{
"docid": "e469887e6b3ed6d5d29cb435344363c5",
"score": "0.61585534",
"text": "def phone_number\n case rand(0..1)\n when 0 then home_work_phone_number\n when 1 then mobile_phone_number\n end\n end",
"title": ""
},
{
"docid": "e469887e6b3ed6d5d29cb435344363c5",
"score": "0.61585534",
"text": "def phone_number\n case rand(0..1)\n when 0 then home_work_phone_number\n when 1 then mobile_phone_number\n end\n end",
"title": ""
},
{
"docid": "d7da860ae8fd2e96e1e96f3bee398b8e",
"score": "0.61569095",
"text": "def phone=(value)\n @phone = value\n end",
"title": ""
},
{
"docid": "d7da860ae8fd2e96e1e96f3bee398b8e",
"score": "0.61569095",
"text": "def phone=(value)\n @phone = value\n end",
"title": ""
},
{
"docid": "d7da860ae8fd2e96e1e96f3bee398b8e",
"score": "0.61569095",
"text": "def phone=(value)\n @phone = value\n end",
"title": ""
},
{
"docid": "d7da860ae8fd2e96e1e96f3bee398b8e",
"score": "0.61569095",
"text": "def phone=(value)\n @phone = value\n end",
"title": ""
},
{
"docid": "fd3cbfd9fc85868f6fa17aa29f7b1bfd",
"score": "0.6154816",
"text": "def set_NewPhone(value)\n set_input(\"NewPhone\", value)\n end",
"title": ""
},
{
"docid": "f2e9022178024a07aebedca3ac772fcd",
"score": "0.6148543",
"text": "def primary_address_mobile_phone=(v)\n @primary_address_mobile_phone = alma_string v\n end",
"title": ""
},
{
"docid": "746e8b4df9dc82ab8cbdc63ca04e5b20",
"score": "0.61452854",
"text": "def mobile_number\n num = self.without_protocol\n num = num[1..-1] if num.length > 0 and num[0].chr == '+'\n num\n end",
"title": ""
},
{
"docid": "1c50ff0da3c568c61f9624b81d9c8876",
"score": "0.61358595",
"text": "def format_phone_number\n self.phone_number = phone_number.gsub(/\\D/, \"\")\n end",
"title": ""
},
{
"docid": "1f07950a8490df25f9348d09fb54f258",
"score": "0.6129548",
"text": "def getalternatephonenumber()\r\n return getvalue(SVTags::PHONE_ALTERNATE)\r\n end",
"title": ""
},
{
"docid": "3d2a65c6024aa08a5707d6b03f636df8",
"score": "0.61282504",
"text": "def set_phone_number\n @phone_number = current_user.phone_number\n end",
"title": ""
},
{
"docid": "69754354733c0fa825f34120ef9c174f",
"score": "0.6126652",
"text": "def chkoutphonenumber_label\n $tracer.trace(__method__)\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-phonefield\")), __method__)\n end",
"title": ""
},
{
"docid": "4465cb31fb3e2cd2fe89cf067b26af8f",
"score": "0.612488",
"text": "def work_phone\n value = format_phone(user_data['work_phone'])\n\n set_text('Work phone:', 365)\n set_text(value, 365, 'value')\n end",
"title": ""
},
{
"docid": "bbfb3428e6b273c3f13ee34185470926",
"score": "0.61217624",
"text": "def review_phone_label\n $tracer.trace(__method__)\n return ToolTag.new(address.className(create_ats_regex_string(\"addr-phonenumber\")), __method__)\n end",
"title": ""
},
{
"docid": "629dff45844f6d5574338806ce1adf03",
"score": "0.6120311",
"text": "def reportable_string_value\n if answer.custom_class_present?(\"phone\")\n self.string_value.scan(/\\d/).join unless self.string_value.blank?\n else\n self.string_value\n end\n end",
"title": ""
},
{
"docid": "3d8f3e23de0f0a9d770524941af5a98b",
"score": "0.61126035",
"text": "def preferred_contact_detail\n return nil if preferred_contact_method.blank?\n if preferred_contact_method == (\"Home Phone\")\n number_to_phone(phone_home)\n elsif preferred_contact_method == (\"Mobile Phone\")\n number_to_phone(phone_mobile)\n elsif preferred_contact_method.include?(\"Email\")\n email\n end\n end",
"title": ""
},
{
"docid": "cd46ced757c63d61624fd581a3977d6d",
"score": "0.6108907",
"text": "def normalize_phone_number\n if phone\n self.phone = phone.delete(\"(),-.\")\n self.phone= phone[1..phone.length-1] if phone.start_with?(\"1\")\n end\nend",
"title": ""
},
{
"docid": "519f030ce57d0924eb4d46a3068d6b1c",
"score": "0.61009103",
"text": "def mobile_or_phone\n errors.add(:base, \"Please specify a mobile, landline number (or both) ↴\") if mobile.blank? && phone.blank?\n end",
"title": ""
}
] |
9ab3c4d9b53bba8b37af9e08f697793d
|
A flexible initializer based on the DataMapper "create factory" design pattern.
|
[
{
"docid": "de39af9a134bdf3af78e6a711409f79f",
"score": "0.0",
"text": "def initialize(opts = {})\n opts.each do |key, value|\n raise \"#{key} is not a variable name in #{self.class.name}\" unless variable_names.include?(key.to_s) || key == :test\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"title": ""
}
] |
[
{
"docid": "9e490c3344ef867c81ac0ec3c45edd22",
"score": "0.64538646",
"text": "def initialize(mappers = {})\n @mappers = mappers\n end",
"title": ""
},
{
"docid": "cd6e982f58d7de302e3f36450db70dc9",
"score": "0.6450601",
"text": "def initialize(options = {})\n super\n @source_factory = options[:source_factory]\n @attractor_factory = options[:attractor_factory]\n end",
"title": ""
},
{
"docid": "cd6e982f58d7de302e3f36450db70dc9",
"score": "0.6450601",
"text": "def initialize(options = {})\n super\n @source_factory = options[:source_factory]\n @attractor_factory = options[:attractor_factory]\n end",
"title": ""
},
{
"docid": "b14d128afa5e3206a02f72df17e1a4d2",
"score": "0.64057404",
"text": "def new\n @data_mapper = DataMapper.new\n end",
"title": ""
},
{
"docid": "8e3629bb42b471c640e3e1bd665bf3b2",
"score": "0.64033836",
"text": "def initialize(*) end",
"title": ""
},
{
"docid": "922ab83836d7ca8af0ff5d054e5c5d4d",
"score": "0.6384154",
"text": "def initialize\n @allow_dynamic_fields = true\n @parameterize_keys = true\n @persist_in_safe_mode = true\n @persist_types = true\n @raise_not_found_error = true\n @reconnect_time = 3\n @use_object_ids = false\n end",
"title": ""
},
{
"docid": "ffef078c1850ae588e1aef809f1c400c",
"score": "0.6374292",
"text": "def create_params_initializer\n\n\t\tend",
"title": ""
},
{
"docid": "255b4bfd84cef33d881f2bd8c12ddf03",
"score": "0.63140345",
"text": "def factory(attrs={})\n factory = self.create! to_params.merge(attrs).values\n end",
"title": ""
},
{
"docid": "d361ababfa791be705bbc5c75f3a85ad",
"score": "0.62823087",
"text": "def initialize(id, data_type, database_id)\n @id = id\n @data_type = data_type\n @database_id = database_id\n self.class.auto_accessors.each { |method|\n instance_variable_set(:\"@#{method}\", Marshal.load(Marshal.dump(data.send(method))))\n }\n end",
"title": ""
},
{
"docid": "fdb7253d7f93d17f96636af3af8f6b42",
"score": "0.6280081",
"text": "def instantiate(data)\n create_from_hash(data)\n end",
"title": ""
},
{
"docid": "fdb7253d7f93d17f96636af3af8f6b42",
"score": "0.6280081",
"text": "def instantiate(data)\n create_from_hash(data)\n end",
"title": ""
},
{
"docid": "8c4bfe693235956f9bf7e5a352a0848d",
"score": "0.62794214",
"text": "def initialize(*args, **kwargs); end",
"title": ""
},
{
"docid": "bdb1966123694c97b929e6dd0a7d76ce",
"score": "0.62536377",
"text": "def define_initializer(record)\n record.send(:define_method, :initialize) do |data = {}|\n restrictions = record.class_variable_get(:@@restrictions)\n data = record.fields.reduce({}) do |memo, field|\n memo[field] = data.fetch(field, restrictions.clone_default(field))\n memo\n end\n restrictions.check_mandatory!(data)\n set_data_hash(data)\n set_values_array(data.values)\n self.freeze\n end\n record\n end",
"title": ""
},
{
"docid": "1b5f0a22356f2ed28a3f910b1f735fbb",
"score": "0.6244435",
"text": "def new_resource(auto_migrate = true, &block)\n resource = Class.new do\n include DataMapper::Resource\n\n storage_names[:default] = 'foo'\n def self.name; 'DataMapperTest::Foo'; end\n\n property :id, DataMapper::Types::Serial\n property :state, String\n\n auto_migrate! if auto_migrate\n end\n resource.class_eval(&block) if block_given?\n resource\n end",
"title": ""
},
{
"docid": "2dcd3cc621c8d79d876411a27dbf48e7",
"score": "0.6231841",
"text": "def initialize(data={}, source = :client)\n @data = {}\n Flareshow::Util.log_info(\"creating #{self.class.name} with data from #{source}\")\n update(data, source)\n @data[\"id\"] = UUID.generate.upcase if source == :client\n end",
"title": ""
},
{
"docid": "75c49409626727b66530f9c83789aaf5",
"score": "0.6219025",
"text": "def create_initialize(repo, atts)\n @repo = repo\n atts.each do |k, v|\n instance_variable_set(\"@#{k}\".to_sym, v)\n end\n self\n end",
"title": ""
},
{
"docid": "75c49409626727b66530f9c83789aaf5",
"score": "0.6219025",
"text": "def create_initialize(repo, atts)\n @repo = repo\n atts.each do |k, v|\n instance_variable_set(\"@#{k}\".to_sym, v)\n end\n self\n end",
"title": ""
},
{
"docid": "75c49409626727b66530f9c83789aaf5",
"score": "0.6219025",
"text": "def create_initialize(repo, atts)\n @repo = repo\n atts.each do |k, v|\n instance_variable_set(\"@#{k}\".to_sym, v)\n end\n self\n end",
"title": ""
},
{
"docid": "c4c797f4e170e07198b939f09207cad2",
"score": "0.620537",
"text": "def construct; end",
"title": ""
},
{
"docid": "8c724de120e977c2530d34ad71748a0c",
"score": "0.620147",
"text": "def initialize(*)\n @map = { }\n super\n end",
"title": ""
},
{
"docid": "a83980d1953a1624afdb6684da64ec09",
"score": "0.6197301",
"text": "def initialize(); end",
"title": ""
},
{
"docid": "255bb7b013a867685f1f0dbe2862430c",
"score": "0.6188248",
"text": "def initialize(data)\n data.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n self.class.send(\n :define_method,\n key.to_sym,\n lambda { instance_variable_get(\"@#{key}\") }\n )\n end\n end",
"title": ""
},
{
"docid": "0564a5a40889306ce2b7fee74b50fa23",
"score": "0.61869943",
"text": "def initialize source = {}\n values = {}\n \n self.class.props( only_primary: true ).values.each do |prop|\n values[prop.key] = prop.create_value self, source\n end\n \n instance_variable_set self.class.metadata.storage.var_name,\n Hamster::Hash.new( values )\n end",
"title": ""
},
{
"docid": "49aac305647df2dab353c27c94979e56",
"score": "0.61826843",
"text": "def initialize # yields self\n @mappings = {}\n @static_values = {}\n @options = {:strict => true}\n @processor = nil\n\n yield self if block_given?\n end",
"title": ""
},
{
"docid": "f9dcb0658d8a189055a4485c1cac2ba0",
"score": "0.6165311",
"text": "def init_property_hash\n super\n map_init(\n :db_instance_class,\n :engine,\n :engine_version,\n :master_username,\n :allocated_storage,\n :multi_az,\n :name => :db_instance_identifier,\n )\n\n if aws_item.endpoint_address\n init :endpoint, \"#{aws_item.endpoint_address}:#{aws_item.endpoint_port}\"\n end\n\n vpc = aws_item.vpc\n\n if raw_aws_item[:vpc_security_groups]\n init :security_groups, raw_aws_item[:vpc_security_groups].collect{ |sg|\n \"#{vpc.tags['Name'] || vpc.vpc_id}:#{vpc.security_groups[sg[:vpc_security_group_id]].name}\"\n }\n end\n\n if raw_aws_item[:db_subnet_group]\n init :subnets, raw_aws_item[:db_subnet_group][:subnets].collect{ |sn|\n vpc.subnets[sn[:subnet_identifier]].tags['Name']\n }\n end\n\n end",
"title": ""
},
{
"docid": "299a9d86c368279be430d6277b83273b",
"score": "0.61406416",
"text": "def initialize(data); end",
"title": ""
},
{
"docid": "299a9d86c368279be430d6277b83273b",
"score": "0.61406416",
"text": "def initialize(data); end",
"title": ""
},
{
"docid": "299a9d86c368279be430d6277b83273b",
"score": "0.61406416",
"text": "def initialize(data); end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.6137817",
"text": "def initialize() end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.6137817",
"text": "def initialize() end",
"title": ""
},
{
"docid": "e5fe649a1eab5dcc89fce3fc9acc8f75",
"score": "0.6134757",
"text": "def initialize_with(*args, &blk)\n @initializiation_args = args\n\n # Remember what args we normally initialize with so we can refer to them when building shared instances.\n\n if defined?(define_singleton_method)\n define_singleton_method :initializiation_args do\n @initializiation_args\n end\n else\n singleton = class << self; self end\n singleton.send :define_method, :initializiation_args, lambda { @initializiation_args }\n end\n\n # Create an `attr_accessor` for each one. Defaults can be provided using the Hash version { :arg => :default_value }\n\n args.each { |a| register_accessor(a) }\n\n define_method(:initialize) { |opts={}|\n parse_opts(opts)\n }\n\n # `#parse_opts` is responsable for getting the `attr_accessor` values prefilled. Since defaults can be specified, it\n # must negotiate Hashes and use the first key of the hash for the `attr_accessor`'s name.\n\n define_method :parse_opts do |opts|\n @rep_options = opts\n blk.call(opts) unless blk.nil?\n self.class.initializiation_args.each do |field|\n name = field.is_a?(Hash) ? field.to_a.first.first : field\n instance_variable_set(:\"@#{name}\", opts[name])\n end\n end\n end",
"title": ""
},
{
"docid": "7eb17e555800da31999b6796d31d50ba",
"score": "0.61338705",
"text": "def initialize(mapping)\n @mapping = mapping\n end",
"title": ""
},
{
"docid": "c906d04b5e08d2c94a0ee57221333720",
"score": "0.6112645",
"text": "def default_factory=(factory); end",
"title": ""
},
{
"docid": "2d72c09a3b00c8f21c797bee2c668178",
"score": "0.61068124",
"text": "def initialize(name:,type:,db:,id:) #This is a keyword. It is used for mass assignment\n\n @id = id\n @name = name\n @type = type\n @db = db\n end",
"title": ""
},
{
"docid": "de3c6646efc2aa290ad8454d39257f5c",
"score": "0.60999835",
"text": "def factory(attrs)\n self.new(attrs)\n end",
"title": ""
},
{
"docid": "6550c1887fe3e084e2425fad3012b3b5",
"score": "0.60990494",
"text": "def pre_initialize ; end",
"title": ""
},
{
"docid": "6550c1887fe3e084e2425fad3012b3b5",
"score": "0.60990494",
"text": "def pre_initialize ; end",
"title": ""
},
{
"docid": "9878bfe484d9ea3cf37cc41f0fece88d",
"score": "0.6089882",
"text": "def initialize(*_)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5ad7c880b36b26db2c7c1af16aa7ad0e",
"score": "0.6083446",
"text": "def initialize(p1, p2 = v2, p3 = v3)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "7cff05b1d14c458d3002432786d3d4f4",
"score": "0.6073325",
"text": "def initialize(*); end",
"title": ""
},
{
"docid": "135838000aa4823c91d07f1feb6c8673",
"score": "0.6060358",
"text": "def initialize()\n initialize_dict()\n end",
"title": ""
},
{
"docid": "7f9aba3da1c7992ef5384e15ae24202f",
"score": "0.60599035",
"text": "def initialize(generator_or_options = {})\n @generator = self.class.prepare_generator generator_or_options\n end",
"title": ""
},
{
"docid": "90da33a30fd1bc176350c8aa4b333e3c",
"score": "0.6058338",
"text": "def initialize(data = {}, definition = self.class.definition, &block)\n raise(ArgumentError.new(\"Invalid input #{data.inspect}\")) unless data.nil? || data.is_a?(Hash)\n replace((deep_hashrize(definition.deep_merge((data || {}).deep_symbolize_keys))))\n deep_defaultize(self)\n (class << self; self; end).class_eval(&block) if block_given?\n end",
"title": ""
},
{
"docid": "9f27627a75a64a9e4559efdae73d118e",
"score": "0.6056221",
"text": "def init_new_with_attrs\n {}\n end",
"title": ""
},
{
"docid": "9b7bb5e2437c437ef0ffde6226b1c78e",
"score": "0.6050437",
"text": "def create_initialize(repo, atts)\n @repo = repo\n atts.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n self\n end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.60376275",
"text": "def init; end",
"title": ""
},
{
"docid": "36d596bc3c56c2a6494e3de153f368e3",
"score": "0.6033838",
"text": "def init(options = {})\n end",
"title": ""
},
{
"docid": "eda530648dd4488d7fa2e9fafc217cfa",
"score": "0.60309607",
"text": "def initialize(factory:, dao:)\n validate_initializer_argument(:dao, dao)\n validate_initializer_argument(:factory, factory)\n @factory = factory\n @dao = dao\n end",
"title": ""
},
{
"docid": "f7e273a024a316649404a9df4d92f1eb",
"score": "0.5998817",
"text": "def initialize\n self.class.attributes.each do |var, type|\n instance_variable_set(\"@#{var}\", Kernel.const_get(type).new) if type\n end\n end",
"title": ""
},
{
"docid": "b69b62e13971ddc1fb42f8f8b205e0cc",
"score": "0.59804046",
"text": "def initializer(name, opts = T.unsafe(nil), &block); end",
"title": ""
},
{
"docid": "2f3962c646ef1a338f61f68f7de71122",
"score": "0.59785223",
"text": "def initialize(**)\n end",
"title": ""
},
{
"docid": "03822b979a4d738f1f5f21b1312afd34",
"score": "0.5976036",
"text": "def initialize_from(values, opts); end",
"title": ""
},
{
"docid": "7a96b5d5c76b8f4158c67156f5fa29fb",
"score": "0.59683806",
"text": "def initialize_from_builder(&block)\n #\n end",
"title": ""
},
{
"docid": "fe22c3c616371c5bd042d12d93292049",
"score": "0.59661835",
"text": "def init_generated_seeding_info\n @regions = nil\n @kommuns = nil\n @business_categories = nil\n\n @address_factory = AddressFactory.new(regions, kommuns)\n\n end",
"title": ""
},
{
"docid": "e3393c98b96c930a7164b56a440967f2",
"score": "0.59541404",
"text": "def obj_initializing(obj,mapping)\n end",
"title": ""
},
{
"docid": "11db6cc765bb8fcf4e7075dd9c3e0471",
"score": "0.5953983",
"text": "def initialize()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "7eba1b2e40c199396ad7d994badf7b56",
"score": "0.59410703",
"text": "def init_with(coder); end",
"title": ""
},
{
"docid": "7eba1b2e40c199396ad7d994badf7b56",
"score": "0.59410703",
"text": "def init_with(coder); end",
"title": ""
},
{
"docid": "71ac8c0cfe8b82ef475de5adff98bee7",
"score": "0.5920996",
"text": "def new(*args)\n args << args.pop.symbolize_keys if args.last.is_a?(Hash)\n instance = super(*args)\n\n instance.instance_variable_set(:@public_params, dry_initializer.public_attributes(instance))\n instance.instance_variable_set(:@params, dry_initializer.attributes(instance))\n\n instance\n end",
"title": ""
},
{
"docid": "058994c56cc5088a4b4c7ea38ca5dcc9",
"score": "0.59093535",
"text": "def initialize(names, values, parent = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "f140b25bc53c5514f2d2c6bd8ea063c0",
"score": "0.5909211",
"text": "def initialize options = {}\n case\n when options[:url]\n initialize_by_url options\n when options[:input_content]\n initialize_by_data options\n end\n end",
"title": ""
},
{
"docid": "73d8fd895a75b55a07597cbfe0ea1c7c",
"score": "0.5908484",
"text": "def init\n \n end",
"title": ""
},
{
"docid": "73d8fd895a75b55a07597cbfe0ea1c7c",
"score": "0.5908484",
"text": "def init\n \n end",
"title": ""
},
{
"docid": "3a9d1666632d6b2bc7f22abed927b0b6",
"score": "0.5905845",
"text": "def initialize(record:, factory:)\n @record = record\n @factory = factory\n end",
"title": ""
},
{
"docid": "2a6459044f130f17796a3e8869d8e3da",
"score": "0.5905324",
"text": "def create *args\n\t\t\treturn Factory[self].new() if args.empty?\n\t\t\treturn Factory[self].new(*args)\n\t\tend",
"title": ""
},
{
"docid": "175bfb4ba6092c15151369b25ec176b9",
"score": "0.5905083",
"text": "def initialize(options = {})\n options.stringify_keys! if options.is_a?(Hash)\n validate_options(options)\n\n all_valid_options.each do |key|\n value = options[key]\n value = true if key == :header_lines && options[key].nil?\n value = true if key == :footer_lines && options[key].nil?\n if key == 'columns' && !options[key].nil? && options[key].kind_of?(Array)\n value = options[key].collect {|a| {'column' => a, 'mappings' => [{'field' => a}]}}\n end\n options[key] && instance_variable_set(\"@#{key}\", value)\n end\n if !@mapping.nil?\n # this is probably wrong - relation should be a join of tables - where i assumed could be 'a'\n instance_variable_set(\"@relation\", @mapping.first.klass.constantize)\n instance_variable_set(\"@columns\", @mapping.first.columns)\n end\n end",
"title": ""
},
{
"docid": "11f3a13d7e3021fceb68b7b593a50a44",
"score": "0.5902171",
"text": "def initialize(&block)\n @entity_mappings = {}\n instance_eval(&block)\n end",
"title": ""
},
{
"docid": "6a468484a093141df451337d04b1372f",
"score": "0.5900594",
"text": "def initialize(*_)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "39e9a59714aadc1c8facc575c76ecc0d",
"score": "0.58980596",
"text": "def initialize(name=nil,&proc)\n self.name = name\n Builder.new(self).instance_eval(&proc)\n end",
"title": ""
},
{
"docid": "3eb912be753bbe9b644c2c1a6cffb2c0",
"score": "0.58975405",
"text": "def initialize\n self.class.defaults.each do |key, val|\n instance_variable_set(\"@#{key}\", val)\n end\n end",
"title": ""
},
{
"docid": "aefe16a618f211408b8e95c457b239ee",
"score": "0.5896853",
"text": "def initialize(params={})\n end",
"title": ""
},
{
"docid": "aefe16a618f211408b8e95c457b239ee",
"score": "0.5896853",
"text": "def initialize(params={})\n end",
"title": ""
},
{
"docid": "693e2ec5635a3f4e391d144fec280198",
"score": "0.58961016",
"text": "def initialize_implementation\n end",
"title": ""
},
{
"docid": "8ff6bf8fe01f53265f8568d2f2753488",
"score": "0.589524",
"text": "def initialize(data)\n @id = data[:id] ? data[:id].to_i : nil \n\n data.delete(:id)\n\n data.each do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end",
"title": ""
},
{
"docid": "0dfd5601300522ca009a653a0520b41a",
"score": "0.5890731",
"text": "def initialize#(data)\n \n end",
"title": ""
},
{
"docid": "7d7bfcd78240120f281a7b27a4cad35f",
"score": "0.58843964",
"text": "def factory!(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], timestamps: true, connection_params: DEFAULT_CONNECTION_PARAMS, &block)\n factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, connection_params: connection_params, &block)\n factory.run!\n end",
"title": ""
},
{
"docid": "f19ec9255820ce8cc462ed2096d11e2d",
"score": "0.5880277",
"text": "def construct_data\n add_properties(:association => @name)\n add_properties(:parent => parent)\n add_properties(@adv_settings, :if_missing)\n add_properties(@shared_properties, :if_missing)\n\n send(@name.to_sym) if @name.respond_to?(:to_sym) && respond_to?(@name.to_sym)\n yield(self) if block_given?\n\n if @properties[:model_class].nil? && !(@options[:without_model_class])\n add_properties(:model_class => auto_model_class)\n end\n end",
"title": ""
},
{
"docid": "d64f36cdbe00d12b6b5e8182df778031",
"score": "0.5880097",
"text": "def init_with_yield &block\n new.tap do |t|\n t.yield_dictionary &block\n end\n end",
"title": ""
},
{
"docid": "ce6d34abf523d45501ca8633a026fce7",
"score": "0.5875126",
"text": "def subclass_initialize\n @fields = get_fields.map! do |name, offset, type|\n if !method_defined?(name)\n\t\t\tdefine_method(name) { self[name] }\n if type.writable? || type < CompoundType\n define_method(\"#{name}=\") { |value| self[name] = value }\n end\n end\n if !singleton_class.method_defined?(name)\n singleton_class.send(:define_method, name) { || type }\n end\n\n [name, type]\n end\n end",
"title": ""
},
{
"docid": "08b9543fd644b8e2af7c4161883bfeeb",
"score": "0.5873838",
"text": "def initialize values = {}\n initialize_props values\n end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5872555",
"text": "def initialize; end",
"title": ""
}
] |
9fe97a7226a08f84b457d105d74638f1
|
we need to change the velocity with the accelerate method Gosu::offset returns the distance between the origin and the point to which you would get if you moved in the specified angle by the specified distance
|
[
{
"docid": "a3aaf120f28ee03462f24b30267329ff",
"score": "0.8247797",
"text": "def accelerate\n @velocity_x += Gosu.offset_x(@angle, ACCELERATION)\n @velocity_y += Gosu.offset_y(@angle, ACCELERATION)\n end",
"title": ""
}
] |
[
{
"docid": "cb00ed3f06c750a7d52575acf7d18f72",
"score": "0.8234004",
"text": "def accelerate\r\n @velx += Gosu.offset_x(@angle,ACCELERATION)\r\n @vely += Gosu.offset_y(@angle,ACCELERATION)\r\n end",
"title": ""
},
{
"docid": "d03294da2a7fe043ea34051ab2fc0bf6",
"score": "0.7387492",
"text": "def accelForward\n @vel_y -= @VELOCITY\n end",
"title": ""
},
{
"docid": "40696b0eafd2e96fcde99ba065ff85c2",
"score": "0.7053706",
"text": "def update\n @vel += acc\n @loc += vel\n # Multiplying by 0 sets the all the components to 0\n @acc *= 0\n\n @osc.update(vel.mag / 10)\n end",
"title": ""
},
{
"docid": "b0deedcb9ae9d1b51f9bf2f920c04359",
"score": "0.7036634",
"text": "def accelBackward\n @vel_y += @VELOCITY\n end",
"title": ""
},
{
"docid": "676e4930cdff72bb962afa498dcba657",
"score": "0.7000957",
"text": "def update\n @velocity += acceleration\n @location += velocity\n @lifespan -= 2.0\n end",
"title": ""
},
{
"docid": "991ba8f809e1989e00d3aaa60e569037",
"score": "0.68713975",
"text": "def move\n\t\t@x += 0\n\t\t@y += @vel\n\tend",
"title": ""
},
{
"docid": "4b926a14a160450383cbe04b4165cd23",
"score": "0.68590003",
"text": "def update\n @vel.add(@acc)\n @loc.add(@vel)\n # Multiplying by 0 sets the all the components to 0\n @acc.mult(0)\n\n @osc.update(@vel.mag/10)\n end",
"title": ""
},
{
"docid": "0d8dafb6f87108d25df561e70e00665b",
"score": "0.6841522",
"text": "def move_forward\n self.velocity_x = Gosu::offset_x(self.angle, 0.5)*self.max_velocity_x\n self.velocity_y = Gosu::offset_y(self.angle, 0.5)*self.max_velocity_y\n end",
"title": ""
},
{
"docid": "d4f8ab06f4c4fccf018f84071d4d0820",
"score": "0.6828268",
"text": "def move\n @x += @vel_x\n @y += @vel_y\n @spin += @vel_spin\n end",
"title": ""
},
{
"docid": "5f4a76a075471d42057d3328f4695664",
"score": "0.68202466",
"text": "def move_position\n @x += @velocity_x\n @y += @velocity_y\n end",
"title": ""
},
{
"docid": "b385dfbee90ffd1166bdfc4aede17325",
"score": "0.6803346",
"text": "def update\n @position[0] += @velocity[0]*@dt\n @position[1] += @velocity[1]*@dt\n @center[0] = @position[0] + @size\n @center[1] = @position[1] + @size\n end",
"title": ""
},
{
"docid": "90741c2e487646bea15a7af72c6701ea",
"score": "0.6783574",
"text": "def update\n @velocity.add(@acceleration)\n @location.add(@velocity)\n @acceleration.mult(0)\n @lifespan -= 2.0\n end",
"title": ""
},
{
"docid": "90741c2e487646bea15a7af72c6701ea",
"score": "0.6783574",
"text": "def update\n @velocity.add(@acceleration)\n @location.add(@velocity)\n @acceleration.mult(0)\n @lifespan -= 2.0\n end",
"title": ""
},
{
"docid": "7ece55c3401e0b226b116a972e51da5e",
"score": "0.67645633",
"text": "def update\n @vel += acc\n @loc += vel\n @lifespan -= 1.0\n end",
"title": ""
},
{
"docid": "e8a7e57c8d333e6137cd9b785004b5a4",
"score": "0.6727537",
"text": "def accelRight\n @vel_x += @VELOCITY\n end",
"title": ""
},
{
"docid": "da6c1310e024e077b7ad3c90cd9d358a",
"score": "0.66819066",
"text": "def velocity= o\n dx, dy = o.x, o.y\n self.m = Math.sqrt(dx*dx + dy*dy)\n self.a = Math.atan2(dy, dx) * R2D\n end",
"title": ""
},
{
"docid": "26610fa6eedbfc2d9adbd0f90a839ecc",
"score": "0.66714746",
"text": "def update\n @loc += vel\n end",
"title": ""
},
{
"docid": "cd1cc9f347ed83cfc138391d73503ca1",
"score": "0.66502416",
"text": "def update\n # Update velocity\n @velocity.add(@acceleration)\n # Limit speed\n @velocity.limit(@maxspeed)\n @location.add(@velocity)\n # Reset accelerationelertion to 0 each cycle\n @acceleration.mult(0)\n end",
"title": ""
},
{
"docid": "e7f659d0af1184b51a460a6bf1f24268",
"score": "0.6568956",
"text": "def update()\n # Update velocity\n @velocity.add(@acceleration)\n # Limit speed\n @velocity.limit(@maxspeed)\n @location.add(@velocity)\n # Reset accelertion to 0 each cycle\n @acceleration.mult(0)\n end",
"title": ""
},
{
"docid": "dd0bf040bbe35867a87acc8a606ae0bc",
"score": "0.6538712",
"text": "def accelLeft\n @vel_x -= @VELOCITY\n end",
"title": ""
},
{
"docid": "c035480f9d125f72b42c68ed0875c902",
"score": "0.6513621",
"text": "def move\n #we're modifying the ship's coordinates based on the velocity calculated in the accelerate method (which is called when we hit 'Up')\n @x += @velocity_x\n @y += @velocity_y\n #we use these to slow down the speed, acting like a friction\n #calculates the rate of acceleration \n @velocity_x *= FRICTION\n @velocity_y *= FRICTION\n # we add conditionals to delimt the edge of the window\n if @x > @window.width - @radius\n @velocity_x = 0\n @x = @window.width - @radius \n end\n if @x < @radius\n @velocity_x = 0\n @x = @radius\n end\n if @y > @window.height - @radius\n @velocity_y = 0\n @y = @window.height - @radius\n end\n end",
"title": ""
},
{
"docid": "724dd12b98b0b7245d28db0cd9911888",
"score": "0.6473541",
"text": "def accelerate(x_accel, y_accel)\n @x_vel = [[@x_vel + x_accel, MAX_VELOCITY].min, -MAX_VELOCITY].max\n @y_vel = [[@y_vel + y_accel, MAX_VELOCITY].min, -MAX_VELOCITY].max\n end",
"title": ""
},
{
"docid": "c3538e2a47192637e70c09b13ad23247",
"score": "0.6473035",
"text": "def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end",
"title": ""
},
{
"docid": "c2d64ebbdc82cfb4f7ff46189ba0eb38",
"score": "0.64299065",
"text": "def move\n x_mov, y_mov = MOVEMENT_VECTORS[@direction]\n\n #add vector to current position\n @x_pos += x_mov\n @y_pos += y_mov\n\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos < 0 || @y_pos < 0\n throw \"fell off plateau, position: [#{@x_pos}, #{@y_pos}]\" if @x_pos > @mars_plateau.max_x || @y_pos > @mars_plateau.max_y\n\n [@x_pos, @y_pos]\n end",
"title": ""
},
{
"docid": "eedea89d3e47430eab04cff4eee995bd",
"score": "0.6421319",
"text": "def accelerate strength = 1.0\n self.speed += self.rotation_vector * strength/SUBSTEPS\n end",
"title": ""
},
{
"docid": "ffa643a2d6d3db0683c2cbe7ab732625",
"score": "0.63854015",
"text": "def tdd_fme_update_move\n @x = $game_map.round_x_with_direction(@x, @direction)\n @y = $game_map.round_y_with_direction(@y, @direction)\n\n @real_x += @velocity_x\n @real_y += @velocity_y\n end",
"title": ""
},
{
"docid": "cad179e1f484d275fc176b34644d28da",
"score": "0.6376852",
"text": "def move\n @x = (@x + @x_velocity) % Window.width\n @y = (@y + @y_velocity) % Window.height\nend",
"title": ""
},
{
"docid": "993c9858f0ed5fca723b42989832e181",
"score": "0.6336552",
"text": "def accel\n @speed += 7\n end",
"title": ""
},
{
"docid": "33988fa5b3aea59cdd9900b241944b4e",
"score": "0.6327668",
"text": "def update_pos( dt )\n @px += @vx * dt\n @py += @vy * dt\n @rect.center = [@px, @py]\n end",
"title": ""
},
{
"docid": "137cc4f183f8595439a1032c54e64b27",
"score": "0.6311181",
"text": "def update_move_arch\n update_zvect\n self.y -= (Math::sin(@index/@div.to_f)*@high/8) \n end",
"title": ""
},
{
"docid": "b8255365313935c734d629112c671b21",
"score": "0.62788576",
"text": "def velocity\n x, y = dx_dy\n V[x, y]\n end",
"title": ""
},
{
"docid": "a64a6a4ae24da48ea65a00aade2c13c6",
"score": "0.626724",
"text": "def update_accel\n user_controlling = false\n if user_controlling\n x, y = 0,0\n x -= 1 if @keys.include?( :left )\n x += 1 if @keys.include?( :right )\n y -= 1 if @keys.include?( :up ) # up is down in screen coordinates\n y += 1 if @keys.include?( :down )\n x *= @accel\n y *= @accel\n # Scale to the acceleration rate. This is a bit unrealistic, since\n # it doesn't consider magnitude of x and y combined (diagonal).\n @ax, @ay = x, y\n else\n @ax, @ay = @accel, @accel\n end\n end",
"title": ""
},
{
"docid": "57ede3c106971b3789b169cf9a83c476",
"score": "0.6252142",
"text": "def accelerate\n @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (20000.0)), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "6e57707b0e6172b0926ed147000c0040",
"score": "0.62448525",
"text": "def move\n\t\t# move 5px to the left\n\t @x = @x - 5\n\t # move up or down based on the Y velocity\n\t @y = @y + @vy\n\tend",
"title": ""
},
{
"docid": "be465abb58c300120dbbadc8e4634df1",
"score": "0.62263423",
"text": "def update_offset\n @offset_counter[1] += 0.01\n @offset_counter[1]=@offset_counter[1]%90\n @offset[1] = 30*Math.sin(@offset_counter[1]);\n @offset_counter[0]+=0.005\n @offset_counter[0]=@offset_counter[0]%90\n @offset[0] = 150*Math.sin(@offset_counter[0]);\n # @offset=[0,0]\n end",
"title": ""
},
{
"docid": "4981c1664c4d42635ac1450983351ca2",
"score": "0.62257737",
"text": "def update_vel_axis( v, a, dt )\n # Apply slowdown if not accelerating.\n if a == 0\n if v > 0\n v -= @slowdown * dt\n v = 0 if v < 0\n elsif v < 0\n v += @slowdown * dt\n v = 0 if v > 0\n end\n end\n # Apply acceleration\n v += a * dt\n # Clamp speed so it doesn't go too fast.\n v = @max_speed if v > @max_speed\n v = -@max_speed if v < -@max_speed\n return v\n end",
"title": ""
},
{
"docid": "6364e2972584d4c2ab00ba1eed03ae78",
"score": "0.62197196",
"text": "def move!\n\t\tbounce! until !will_bounce? #TODO add surroundedness checking\n\t\t@x += @@target_coords[@direction][:dx]\n\t\t@y += @@target_coords[@direction][:dy]\n\tend",
"title": ""
},
{
"docid": "4c413f1e1f12239f243559446ffb8f6c",
"score": "0.62105006",
"text": "def update(width, height)\n # Update velocity\n @velocity += @acceleration\n # Limit speed\n @velocity.set_mag(MAX_SPEED) { @velocity.mag > MAX_SPEED }\n @location += @velocity\n # Reset acceleration to 0 each cycle\n @acceleration *= 0\n @location.x = constrain(location.x, 0, width)\n @location.y = constrain(location.y, 0, height)\n end",
"title": ""
},
{
"docid": "a6f3db7864848ea7ad6d088ef42df3e1",
"score": "0.6205255",
"text": "def move(delta)\n new_x = self.location.x + (self.vel.x * delta)\n new_y = self.location.y + (self.vel.y * delta)\n new_point = Point.new(new_x, new_y)\n self.with_location(new_point)\n end",
"title": ""
},
{
"docid": "cea19cc24ee880c58cc23dbebc557ba6",
"score": "0.61991",
"text": "def accelerate\n self.current_speed += 1 \n end",
"title": ""
},
{
"docid": "a4a2f08fb2f77061a3d8cfdeb91b777d",
"score": "0.61905146",
"text": "def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end",
"title": ""
},
{
"docid": "e9bd11e9d46e5fe763c03d893dc77054",
"score": "0.6172687",
"text": "def update_vel( dt )\n @vx = update_vel_axis( @vx, @ax, dt )\n @vy = update_vel_axis( @vy, @ay, dt )\n end",
"title": ""
},
{
"docid": "0aea4ac52cc9645eacc84d3b92c23a81",
"score": "0.61428094",
"text": "def update\n @vel.mult(0) if not @movable\n @vel.limit(@max_vel)\n @loc.add(@vel)\n @vel.mult(@dumping)\n end",
"title": ""
},
{
"docid": "db192bc0b7c148c705b8468b8f6a0fe3",
"score": "0.61390895",
"text": "def calc_player\n\n # Since acceleration is the change in velocity, the change in y (dy) increases every frame.\n # What goes up must come down because of gravity.\n state.dy += state.gravity\n\n # Calls the calc_box_collision and calc_edge_collision methods.\n calc_box_collision\n calc_edge_collision\n\n # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.\n state.y += state.dy\n state.x += state.dx\n\n # Scales dx down.\n state.dx *= 0.8\n end",
"title": ""
},
{
"docid": "947b3a0b73d049fb5713fb104e46d8ad",
"score": "0.6129941",
"text": "def acceleration(state_object, t)\n k = 10\n b = 1\n (- k * state_object.position) - (b * state_object.velocity)\nend",
"title": ""
},
{
"docid": "190799bc71f5a118f74ddeabe3fa9a59",
"score": "0.6124857",
"text": "def distance_per_frame\r\n 2 ** real_move_speed / 256.0\r\n end",
"title": ""
},
{
"docid": "6f76c3cd7e53ca350d8807234d84e146",
"score": "0.6124687",
"text": "def move_directional_vector args\n dx = 0\n dx += 1 if args.inputs.keyboard.d\n dx -= 1 if args.inputs.keyboard.a\n dy = 0\n dy += 1 if args.inputs.keyboard.w\n dy -= 1 if args.inputs.keyboard.s\n if dx != 0 && dy != 0\n dx *= 0.7071\n dy *= 0.7071\n end\n [dx, dy]\nend",
"title": ""
},
{
"docid": "31680b5646ddefac00a21572666fd58a",
"score": "0.61212355",
"text": "def accelerate(time) \n @velocity += time * @acceleration;\n @velocity = @max_speed if @velocity > @max_speed\n end",
"title": ""
},
{
"docid": "fffcb95505cf8697d84bead695322933",
"score": "0.6104508",
"text": "def accelerate\n @speed = @speed + @accelerator\n end",
"title": ""
},
{
"docid": "d5db04f6b15a1a31bf79df52ddf354a8",
"score": "0.61032236",
"text": "def move\n # Stores change in x and y position based off of vel and current x,y\n newX = @x + @vel_x\n newY = @y + @vel_y\n # Prevents ship from exiting bounds in x along the ship's edge\n if newX >= @image.width and newX <= @window.width-@image.width then\n @x += @vel_x\n end\n # Prevents ship from exiting bounds in y along the ship's edge\n if newY >= @image.height and newY <= @window.height-@image.height then\n @y += @vel_y\n end\n # Slows down the ship if no new input is given\n # Lower values for tighter controls\n @vel_x *= 0.50\n @vel_y *= 0.50\n end",
"title": ""
},
{
"docid": "51f719865448c5664e6d7f7adfd12c8c",
"score": "0.6077638",
"text": "def calc_player\n state.dy += state.gravity # what goes up must come down because of gravity\n calc_box_collision\n calc_edge_collision\n state.y += state.dy # Since velocity is the change in position, the change in y increases by dy\n state.x += state.dx # Ditto line above but dx and x\n state.dx *= 0.8 # Scales dx down\n end",
"title": ""
},
{
"docid": "2461de61b8a2ca78ccfd1fd2f7631273",
"score": "0.60453004",
"text": "def move\n @speed = map1d(total_count, (5..25), (0.1..0.4))\n @speed = (0..10.0).clip speed\n @position[Y] += speed\n @position[Y] = -height if position[Y] > height * 2\n end",
"title": ""
},
{
"docid": "395d2899b53b8df0f81a1fd56def9b89",
"score": "0.60281074",
"text": "def standard_move\n pos.set(x,y)\n tar = move_towards_player\n sep = seperate_from_enemies\n sep.scalar(5.5, '*')\n tar.scalar(4.0, '*')\n apply_force(sep)\n apply_force(tar)\n if acc.x == 0 and acc.y == 0\n return\n else\n vel.add(acc)\n vel.limit(speed)\n end\n pos.add(vel)\n @x = pos.x\n @y = pos.y\n acc.scalar(0, '*')\n end",
"title": ""
},
{
"docid": "ae1284b90a6fea89c36399dc52bbb1e6",
"score": "0.60136926",
"text": "def accelerate\n @speed += 1\n end",
"title": ""
},
{
"docid": "cad9365cbefe1f6d179c874f9b83e1bb",
"score": "0.5996484",
"text": "def move\n @coord_x1 = @coord_x1 + @move_x\n @coord_x2 = @coord_x1 + @radius\n @coord_y1 = @coord_y1 + @slope * @move_x * Math.tan(@ankle)\n @coord_y2 = @coord_y1 + @radius\n @coord_ym = @coord_y1 + @radius/2\n\n #draw()\n end",
"title": ""
},
{
"docid": "efa6a21b3befd2664292f16eeaa4b8ca",
"score": "0.599566",
"text": "def move(direction)\n @x += @velocity if direction == :right\n @x -= @velocity if direction == :left\n end",
"title": ""
},
{
"docid": "59fd69413cc25a67fb50d7ab8169c57c",
"score": "0.5987754",
"text": "def move\n if @vect_acc > 0 || @vect_acc < 0\n if (@vect_acc > 0 && @vect_v < @max_v) || (@vect_acc < 0 && @vect_v > @max_v)\n @vect_v += @vect_acc\n else\n @vect_v = @max_v\n @vect_acc = 0\n end\n end\n vel_x = Gosu.offset_x(@vect_angle, @vect_v)\n vel_y = Gosu.offset_y(@vect_angle, @vect_v)\n can_move_x = true\n can_move_y = true\n new_hitbox = HitBox.new(@hb.x+vel_x, @hb.y, @hb.w, @hb.h)\n $WINDOW.current_map.solid_tiles.each do |tile|\n if tile.hb.check_brute_collision(new_hitbox)\n can_move_x = false\n end\n end\n\n new_hitbox = HitBox.new(@hb.x, @hb.y+vel_y, @hb.w, @hb.h)\n $WINDOW.current_map.solid_tiles.each do |tile|\n if tile.hb.check_brute_collision(new_hitbox)\n can_move_y = false\n end\n end\n\n @hb.y += vel_y if can_move_x || @floater\n @hb.x += vel_x if can_move_y || @floater\n end",
"title": ""
},
{
"docid": "352329836fdb0aa7c6e4ebd17a7adf57",
"score": "0.5983122",
"text": "def update\n\n # First up, if we're not yet aligned with the target angle, turn toward it\n if @angle != @target_angle\n\n # So, should be turning clockwise, or anti?\n gap = @target_angle - @angle\n gap -= 360 if gap > 180\n gap += 360 if gap < -180\n\n if gap.abs > @turn_speed\n @angle += gap.positive? ? @turn_speed : @turn_speed * -1\n else\n @angle += gap\n end\n\n end\n\n # Apply any current thrust\n if @thrusting.positive?\n\n # The delta modifies the vectors\n @vector_x += @angle.vector_x(@delta_v)\n @vector_y += @angle.vector_y(@delta_v)\n\n # And count the thrust down\n @thrusting -= 1\n\n end\n\n # And then add in our current vector\n @x += @vector_x\n @y += @vector_y\n\n # We keep on thrusting until we exceed our previous peak\n velocity = Math::sqrt(@vector_x ** 2 + @vector_y ** 2)\n if velocity < @target_velocity && @thrusting.zero?\n @thrusting = THRUST_DURATION\n @fired = true\n end\n @peak_velocity = velocity if velocity > @peak_velocity\n\n end",
"title": ""
},
{
"docid": "e442704f629a5d373c7a5d8dec0166c7",
"score": "0.5979086",
"text": "def shoot arrow\r\n arrow.x+=arrow.vel_x\r\n arrow.y+=arrow.vel_y\r\n end",
"title": ""
},
{
"docid": "ccb47115dba9b1f371d043e6c3f931e8",
"score": "0.59773487",
"text": "def move_by a, m\n rad = a * D2R\n self.x += Math.cos(rad) * m\n self.y += Math.sin(rad) * m\n end",
"title": ""
},
{
"docid": "0a9efb4f83f5fd485edc767450cfd14b",
"score": "0.59620994",
"text": "def move!(dt, objects = [])\r\n dt = MAX_DT if dt > MAX_DT\r\n @acc = objects.inject(V2D[0,0]) {|acc, o| acc + o.gravity.at(@pos)}\r\n @speed += @acc * dt\r\n objects.each {|o| self.collide_with!(o)}\r\n @pos += @speed * dt\r\n end",
"title": ""
},
{
"docid": "a872d8c100af0f18170f943cd1cf1382",
"score": "0.59487385",
"text": "def y_offset angle, distance\n\t\t\tdistance * Math.cos(angle * Math::PI/180) * -1\n\t\tend",
"title": ""
},
{
"docid": "8d4361ce836ef8f6e7c86674d799b0d8",
"score": "0.5935682",
"text": "def update_move\n return unless @moving\n \n grad = direction(@destx,@desty,self.x,self.y)\n \n if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0\n self.x += Math.cos(grad).abs * @move_speed if self.x < @destx\n self.y += Math.sin(grad).abs * @move_speed if self.y < @desty\n self.x -= Math.cos(grad).abs * @move_speed if self.x > @destx\n self.y -= Math.sin(grad).abs * @move_speed if self.y > @desty\n \n @move_old = Graphics.frame_count\n end\n if @move_speed > 0 # Check if sprite can't reach that point\n self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and\n (@destx - self.x).abs <= @move_speed\n self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and\n (@desty - self.y).abs <= @move_speed\n end\n if self.x == @destx and self.y == @desty\n @moving = false\n end\n end",
"title": ""
},
{
"docid": "7d2f28c36ed134e7fa572b1b7da6b956",
"score": "0.5935127",
"text": "def walk\n @speed = @speed + (0.2 * @legs)\n end",
"title": ""
},
{
"docid": "9935dc71c20d7b210ccdf047fe4c5d65",
"score": "0.5930309",
"text": "def shoot_directional_vector args\n dx = 0\n dx += 1 if args.inputs.keyboard.key_down.right || args.inputs.keyboard.key_held.right\n dx -= 1 if args.inputs.keyboard.key_down.left || args.inputs.keyboard.key_held.left\n dy = 0\n dy += 1 if args.inputs.keyboard.key_down.up || args.inputs.keyboard.key_held.up\n dy -= 1 if args.inputs.keyboard.key_down.down || args.inputs.keyboard.key_held.down\n if dx != 0 && dy != 0\n dx *= 0.7071\n dy *= 0.7071\n end\n [dx, dy]\nend",
"title": ""
},
{
"docid": "0817c6102990a035c275838b6d666465",
"score": "0.5925861",
"text": "def move\n self.speed += random_vector(0.5)\n self.position.x -= window.current_speed/4\n bounce_off_border_y\n on_hitting_x { destroy!; return }\n end",
"title": ""
},
{
"docid": "b4c087150b88675fa07e969b92c131e8",
"score": "0.58651537",
"text": "def change_direction(axis)\n if axis == :x\n @velocity_x *= -1\n elsif axis == :y\n @velocity_y *= -1\n end \n end",
"title": ""
},
{
"docid": "d9bf0efff25ae5cc4059766c10dc33f0",
"score": "0.5863857",
"text": "def update( event )\n dt = event.seconds # Time since last update\n # do nothing else for now\n update_accel\n update_vel( dt )\n update_pos( dt )\n end",
"title": ""
},
{
"docid": "751aded80b1984242d2090f9ee419a08",
"score": "0.58593965",
"text": "def x_offset angle, distance\n\t\t\tdistance * Math.sin(angle * Math::PI/180)\n\t\tend",
"title": ""
},
{
"docid": "ded32b76012b0b50a90d35a40c8f1e27",
"score": "0.5856663",
"text": "def pedal_faster accel\n #Increment speed by the value of the argument\n @speedometer += accel\n #Display updated speed\n speed\n end",
"title": ""
},
{
"docid": "59d872d58cd56f6bcf12a6e7614cf661",
"score": "0.5854441",
"text": "def move_free(aim, speed)\n if aim.is_a? Vector\n x_d = aim.x - @x; y_d = aim.y - @y\n distance = Math.sqrt(x_d**2 + y_d**2)\n\n if distance == 0\n @speed.x = @speed.y = 0\n return\n end\n\n @speed.x = 1.0 * x_d * speed / distance\n @speed.y = 1.0 * y_d * speed / distance\n\n if (@speed.x < 0 and @x + @speed.x <= aim.x) or (@speed.x >= 0 and @x + @speed.x >= aim.x)\n @x = aim.x\n @speed.x = 0\n else\n @x += @speed.x\n end\n\n if (@speed.y < 0 and @y + @speed.y <= aim.y) or (@speed.y >= 0 and @y + @speed.y >= aim.y)\n @y = aim.y\n @speed.y = 0\n else\n @y += @speed.y\n end\n else\n rads = aim * Math::PI / 180\n @speed.x = speed * Math.cos(rads)\n @speed.y = speed * Math.sin(rads)\n @x += @speed.x\n @y += @speed.y\n end\n end",
"title": ""
},
{
"docid": "83c8a00b718a96120add5ad7dadccbf0",
"score": "0.5844382",
"text": "def update\n accelerate(0, 1) if should_fall?\n move\n end",
"title": ""
},
{
"docid": "19e2ed7bb2e8cc14f7214e24676156d4",
"score": "0.58443254",
"text": "def accelerate (rateOfAcceleration)\n @speed = @speed + rateOfAcceleration\n end",
"title": ""
},
{
"docid": "6c16025b451060d81b641ecc0b559554",
"score": "0.5831783",
"text": "def jet_accelerate\n @speed = get_speed * 2\n end",
"title": ""
},
{
"docid": "a11f4b307653a5912b3f4f6c366d3a4e",
"score": "0.58279324",
"text": "def move(direction)\n \n end",
"title": ""
},
{
"docid": "caed5eb190b470ff90c1c4bd1f44318a",
"score": "0.5827083",
"text": "def move\n @coordinates[1] += 1 if @rover_facing == 'N'\n @coordinates[0] += 1 if @rover_facing == 'E'\n @coordinates[1] -= 1 if @rover_facing == 'S'\n @coordinates[0] -= 1 if @rover_facing == 'W'\nend",
"title": ""
},
{
"docid": "4319127ea7a374cc484bdc02300ac112",
"score": "0.58132154",
"text": "def escapeVel( r )\n m = massFromRadius( r )\n return Math::sqrt( (2*G*m)/r )\nend",
"title": ""
},
{
"docid": "8e0d4e7596f9a26e846c81903fe0e36f",
"score": "0.58043784",
"text": "def move\n if @x + @x_vel < 0\n net_move = (-2 * @x) - @x_vel\n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n elsif @x + @x_vel > (1280 - @w)\n net_move = (2 * (1280 - @w - @x)) - @x_vel \n @x += net_move\n @truex += net_move\n @x_vel = -@x_vel\n else\n @truex += @x_vel\n @x += @x_vel\n end\n\n if @y + @y_vel < 0\n net_move = (-2 * @y) - @y_vel\n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n elsif @y + @y_vel > (720 - @h)\n net_move = (2 * (720 - @h - @y)) - @y_vel \n @y += net_move\n @truey += net_move\n @y_vel = -@y_vel\n else\n @truey += @y_vel\n @y += @y_vel\n end\n end",
"title": ""
},
{
"docid": "021e4166abdc2fa51f6bdd5d4b6fa1e5",
"score": "0.58020383",
"text": "def player_position_look_update; end",
"title": ""
},
{
"docid": "0b73f244403d513242ee205e89175432",
"score": "0.5799635",
"text": "def movable_angle_update\n\n # Do we have an angle delta to apply?\n if @movable_delta_angle&.nonzero?\n\n # Apply the delta, normalised to 360 degrees\n @angle = (@angle + @movable_delta_angle) % 360\n\n # If we're eternally spinning, that's all we have to worry about\n return if @movable_spinning\n\n end\n\n end",
"title": ""
},
{
"docid": "ca0f3ac3c2b3c7f05167b0192c099c62",
"score": "0.57980317",
"text": "def move(time_step)\n return if !@running\n @position += @speed*time_step + 0.5*@acc*time_step*time_step\n @speed += @acc*time_step\n clip_speed\n end",
"title": ""
},
{
"docid": "bd8e9c2968d7a2708b883d52e5b60a65",
"score": "0.5796619",
"text": "def move(direction)\n @old = @pos\n @pos += direction\n end",
"title": ""
},
{
"docid": "24248fb877e0da62659a9b097ad8bcf3",
"score": "0.57899237",
"text": "def move\n\t\tcase @car.orientation\n\t\t\twhen 0 \n\t\t\t\t@car.y += 1\n\t\t\twhen 2\n\t\t\t\t@car.y -= 1\n\t\t\twhen 1\n\t\t\t\t@car.x += 1\n\t\t\twhen 3\n\t\t\t\t@car.x -= 1\n\t\tend\n\tend",
"title": ""
},
{
"docid": "991ef102e484ae08c7cad886ff01f65d",
"score": "0.5785453",
"text": "def update_position\n DIMS.values.each { |dim| @position[dim] += @velocity[dim] }\n end",
"title": ""
},
{
"docid": "ed2f82ea02393c71085cb9d5d0818e06",
"score": "0.57720506",
"text": "def escape_velocity\n return Math.sqrt( 2.0 * self.gravitational_parameter / self.radius )\n end",
"title": ""
},
{
"docid": "acf8d3bed2a8b65caded9cfef4d6a0bb",
"score": "0.57669884",
"text": "def distance\n @distance ||= mot_apres.offset - mot_avant.offset\n end",
"title": ""
},
{
"docid": "6ce02ec4ce86a1647b2e832a72603a8f",
"score": "0.5763159",
"text": "def moveUpAndDown(dis)\n vector = getCurrentDirection\n vector.length = dis\n moveTransformation = Geom::Transformation.translation(vector)\n @@componentInstance.transform! moveTransformation\n updateAvatarLocation\n updateTransformation\n updateViewPort\n\n \n\n end",
"title": ""
},
{
"docid": "26c91533f7720d82095d7bf2be35a5c4",
"score": "0.5753673",
"text": "def input_update_movement_controls\n if $program.holding?(:alt)\n speed = @speed / 2.0\n elsif $program.holding?(:shift) && $program.holding?(:ctrl)\n speed = @speed * 10\n elsif $program.holding?(:shift) || $program.holding?(:ctrl)\n speed = @speed * 4\n else\n speed = @speed\n end\n #--------------------------------------\n # Left Right X axis, Camera Position\n if $program.holding?(:move_left)\n @z -= speed\n elsif $program.holding?(:move_right)\n @z += speed\n #--------------------------------------\n # Up Down Y axis, Camera Position\n elsif $program.holding?(:move_up)\n @x -= speed\n elsif $program.holding?(:move_down)\n @x += speed\n #--------------------------------------\n # Vertical Hight change, Camera Position\n # more of a 'turn' then a straif type movment...\n elsif $program.holding?(:move_jump)\n @y -= speed\n elsif $program.holding?(:move_crouch)\n @y += speed\n #--------------------------------------\n end\n end",
"title": ""
},
{
"docid": "333636a0b1bac835d55eb5476c0071f1",
"score": "0.57532674",
"text": "def change_direction_at(player)\n\t$ball.x_speed_reverse\n\n\tif $ball.center[:y] <= player.top\n\t\tif $ball.y_speed > 0 then $ball.y_speed_reverse()\n\t\telse $ball.y_speed_change(-2) end\n\n\telsif $ball.center[:y] <= player.parts[:top]\n\t\t$ball.y_speed_change(-1)\n\n\telsif $ball.center[:y] >= player.parts[:bottom]\n\t\t$ball.y_speed_change(1)\n\n\telsif $ball.center[:y] >= player.bottom\n\t\tif $ball.y_speed < 0 then $ball.y_speed_reverse\n\t\telse $ball.y_speed_change(2) end\n\n\tend\n\nend",
"title": ""
},
{
"docid": "435cd25f4380cf647f5bc245c7a1bcfa",
"score": "0.57508564",
"text": "def walk\n @speed = 2\n end",
"title": ""
},
{
"docid": "a4faf6fba6a108734a9e1740fe349fb0",
"score": "0.5748817",
"text": "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end",
"title": ""
},
{
"docid": "a152a0aaa4309dc0193cfc86adf5dded",
"score": "0.5737408",
"text": "def move(vpoint)\n @position += vpoint\n end",
"title": ""
},
{
"docid": "eb07cbb27dfcea719ad012965cab04dd",
"score": "0.572687",
"text": "def adjust_movement( seconds )\n dir = vec2(1,0).rotate(body.rot)\n\n # Ideal movement (correct direction, same speed as now)\n ideal = dir * body.v.length\n\n # How much of the old vector to keep\n blend = @dir_adjust ** seconds\n\n body.v = body.v * (1 - blend) + ideal * blend\n end",
"title": ""
},
{
"docid": "61300bd9af220e47d86842d481b0e1a8",
"score": "0.5718287",
"text": "def move_dist(deltx, delty)\n @x += deltx\n @y += delty\n normalize\n end",
"title": ""
},
{
"docid": "40af9b629d4f567f3d61afcefe522902",
"score": "0.5707277",
"text": "def move\n case @direction\n when \"N\"\n @y_coord += 1\n when \"S\"\n @y_coord -= 1\n when \"W\"\n @x_coord += 1\n when \"E\"\n @x_coord -= 1\n end\n end",
"title": ""
},
{
"docid": "e0f1b031782cbcec4766cab4162a704b",
"score": "0.5704114",
"text": "def update_move\n update_last_coordinate\n @point.update_move\n update_placement\n move_animation(diff_x, diff_y)\n end",
"title": ""
},
{
"docid": "02c4c0da44e721c4595947154e2d1400",
"score": "0.570383",
"text": "def update(point)\n\t\t# move relative to the initial point\n\t\t\n\t\t@destination = @start + movement_delta(point)\n\tend",
"title": ""
},
{
"docid": "79e968a2b25071a985effc919a19e408",
"score": "0.5696114",
"text": "def step\n @x = @x + @vx\n @y = @y + @vy\n self\n end",
"title": ""
},
{
"docid": "c07fb88ed74ee471a6baff6d3f5e01d1",
"score": "0.5694563",
"text": "def direction(dest_x,dest_y,start_x,start_y)\n \n if @battler.is_a?(Game_Actor)\n if @move_speed == 10\n return (Math.atan2((start_y - dest_y), (start_x - dest_x))+360) % 360\n else\n return (Math.atan2((dest_y - start_y), (dest_x - start_x))+360) % 360\n end\n else\n if @move_speed == 20\n return (Math.atan2((start_y - dest_y), (start_x - dest_x))+360) % 360\n else\n return (Math.atan2((dest_y - start_y), (dest_x - start_x))+360) % 360\n end\n end\n \n end",
"title": ""
},
{
"docid": "540aa49ea5616b33ab83c94227e34edb",
"score": "0.56889975",
"text": "def moving!\n end",
"title": ""
}
] |
4dd2dc9b3429580cbcedf78cdac07e49
|
Deducts tokens from the friend that had accepted the current users request from their group. Only use when request has been accepted
|
[
{
"docid": "7a39aa91e0e19d1e648cd66a49a6b361",
"score": "0.80005187",
"text": "def deduct_tokens_from_friend_user_group_request_was_accepted_from\n if @request.status == 'accepted'\n user = User.find(@request.babysitter_id)\n user.subtract_tokens([@request.group_id], @request)\n end\n end",
"title": ""
}
] |
[
{
"docid": "7d1ff0dfebb5a60d0be740d6f7704499",
"score": "0.73001707",
"text": "def add_tokens_to_current_user_group_request_was_accepted_from\n if @request.status == 'accepted'\n request_group = @request.group_request_was_accepted_by\n current_user.add_tokens(request_group)\n end\n end",
"title": ""
},
{
"docid": "0a3a5e00c83afe437b812b97a406aa0c",
"score": "0.70212483",
"text": "def add_tokens_to_current_user_groups_request_was_made_to\n if @request.status == 'waiting'\n array_of_request_groups = @request.groups_request_was_made_to\n array_of_request_groups.each { |request_group| current_user.add_tokens(request_group)}\n end\n end",
"title": ""
},
{
"docid": "fcf0df6108b5ade63d62b0e22dc012ab",
"score": "0.65861255",
"text": "def deduct_tokens_from_original_request_groups_not_accepted(request)\n selected_group_ids = request.groups_original_request_not_accepted_from\n request.user.subtract_tokens(selected_group_ids, request)\n end",
"title": ""
},
{
"docid": "4c03a5ddce854a5f2e33bd34237f163e",
"score": "0.65045923",
"text": "def deduct_tokens_from_current_user(request)\n current_user.subtract_tokens([request.group_id], request)\n end",
"title": ""
},
{
"docid": "42849de4981ef0af1e1be25b0e241f5a",
"score": "0.6415419",
"text": "def friend_request_groups\n all_request_groups_from_current_users_groups\n only_friend_request_groups( all_request_groups_from_current_users_groups)\n end",
"title": ""
},
{
"docid": "fae74f9121e526bdcd496f34d2a812f4",
"score": "0.62551266",
"text": "def send_request\n user_tokens = request_params[:access_tokens]\n group = Group.find_by(id: request_params[:group_id])\n join_requests = []\n user_tokens.each do |token|\n friend = User.find_by(access_token: token)\n join_requests << friend.group_requests.create_request(request_params, current_user, group)\n end\n render json: join_requests\n end",
"title": ""
},
{
"docid": "ce58b75c452fb5d41f9b8ace179aedf7",
"score": "0.615898",
"text": "def subtract_tokens_from_each_group_selected\n current_user.subtract_tokens(array_of_group_ids_selected, @request)\n end",
"title": ""
},
{
"docid": "197609282282108045cc6bd7b2f5125e",
"score": "0.60475147",
"text": "def awaiting_friend_request_list\n friend_request_arr = []\n\n friends.each do |f|\n if f.friend_request_received?(self)\n friend_request_arr.push(f)\n end\n end\n\n friend_request_arr\n end",
"title": ""
},
{
"docid": "2c45fb69a18be70ec243bab40ce028b6",
"score": "0.6046893",
"text": "def friend_requests\n relations = relationships.by_unaccepted_role(:friends).reject do |relationship|\n role = relationship.find_or_create_role :friends\n role.get_status(self) == RelationshipRole::STATUS_ACCEPTED\n end\n friends = relations.collect(&:users).flatten.uniq\n friends.delete(self)\n friends\n end",
"title": ""
},
{
"docid": "ab28e517223f64106474c756afd9452b",
"score": "0.60108566",
"text": "def check_if_enough_tokens_for_request\n if insufficient_tokens?\n flash.now[:danger] = \"Sorry, you don't have enough tokens in one or more groups. Please alter your selection\"\n render :new\n else\n @request.save\n email_users_of_each_group_selected\n subtract_tokens_from_each_group_selected\n flash[:success] = \"You've organised some well deserved time off!\"\n redirect_to home_path\n end\n end",
"title": ""
},
{
"docid": "fc130be4049982af14752996ea670f03",
"score": "0.60097945",
"text": "def destroy\n @request = Request.find(params[:id])\n \n if @request.status == 'waiting'\n add_tokens_to_current_user_groups_request_was_made_to\n elsif @request.status == 'accepted'\n add_tokens_to_current_user_group_request_was_accepted_from\n deduct_tokens_from_friend_user_group_request_was_accepted_from\n end\n \n Request.destroy(@request.id)\n redirect_to home_path\n end",
"title": ""
},
{
"docid": "69b48c5350655579be2dd46b08343a45",
"score": "0.6008459",
"text": "def requests\n User.where(:id => Friend.select(:friend_id).where(:user_id => id, :accepted => 0).map(&:friend_id))\n end",
"title": ""
},
{
"docid": "0293107591351fb8aa8ffc0232cd1973",
"score": "0.5978336",
"text": "def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id)\n \n=begin \n @users = User.where('id not in (?)',@user.id)\n list = @users.map do |friend_user|\n if @user.id != friend_user.id\n p \"USER: \" + friend_user.name + \"\\n\"\n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n { :id => friend_user.id,\n :name => friend_user.name,\n :username => friend_user.username,\n :facebookUID => auth.uid,\n :confirmed => false,\n :request => false\n }\n end\n end\n=end \n \n @friends = @user.friends\n \n list_friends = @friends.map do |friend|\n if friend.friend_confirm == true\n friend_user = User.find_by_id(friend.friend_id)\n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n { :id => friend_user.id,\n :name => friend_user.name,\n :username => friend_user.username,\n :facebookUID => auth.uid,\n :confirmed => true,\n :request => false\n }\n end\n end\n \n list = list_friends \n \n @friend_requests = Friend.where(:friend_id => @user.id, :friend_confirm => false)\n list_request = @friend_requests.map do |friend|\n friend_user = User.find_by_id(friend.user_id)\n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n { :id => friend_user.id,\n :name => friend_user.name,\n :username => friend_user.username,\n :facebookUID => auth.uid,\n :confirmed => false,\n :request => true\n } \n end\n \n list = list + list_request \n \n auth = Authorization.find_by_user_id_and_provider(@user.id, \"facebook\") \n @graph = Koala::Facebook::API.new(auth.access_token, Rails.application.secrets.omniauth_provider_secret.to_s)\n \n @friends_fb = [] \n if !@graph.nil?\n begin\n friends_fb = @graph.get_connections(\"me\", \"friends\")\n begin \n #logger.info \"\\n @next_page \" + videos.to_yaml\n if !friends_fb.nil? \n #logger.info \"\\n FRIENDS: \" + friends_fb.to_yaml \n count = friends_fb.count\n friends_fb.each do |friend| \n if !friend.nil?\n auth = Authorization.find_by_uid(friend.id) \n if auth\n logger.info \"\\n FRIEND: \" + friend.name.to_yaml \n if !list.map(&:id).include? auth.user.id\n logger.info \"\\n FRIEND add: \" + friend.name.to_yaml \n @friends_fb << auth.user\n end\n end \n end \n end \n end \n end while friends_fb = friends_fb.next_page \n rescue => e\n logger.error \"\\n FACEBOOK FRIENDS RESULT ERROR: \" + e.to_s + \"\\n\"\n end\n end\n p \"MY FB FRIENDS: \" + @friends_fb.to_yaml\n \n list_fb = @friends_fb.map do |friend_user|\n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n { :id => friend_user.id,\n :name => friend_user.name,\n :username => friend_user.username,\n :facebookUID => auth.uid,\n :confirmed => false,\n :request => false\n }\n end\n \n list = list + list_fb \n \n list = list.compact \n list.to_json\n respond_with :friends => list\n \n else\n render :friends => { :info => \"Error\" }, :status => 403\n end \n end",
"title": ""
},
{
"docid": "9752669e267d3054b07253167d2fe48a",
"score": "0.5966025",
"text": "def friend_requests\n received_friendships.map{|friend| friend.user_id if !friend.accepted}.compact\n \n\tend",
"title": ""
},
{
"docid": "7fce6c11c4cb9867787b686cd3ad6345",
"score": "0.596225",
"text": "def credit_tokens_for_groups_no_longer_in_request(original_request, original_groups_in_request)\n tokens_for_old_request = original_request.calculate_tokens_for_request\n groups_no_longer_in_request = original_groups_in_request.reject { |group| group if @request.groups.include? group }\n groups_no_longer_in_request.each { |group| current_user.reallocate_tokens(group, tokens_for_old_request) } if groups_no_longer_in_request.present?\n end",
"title": ""
},
{
"docid": "370490e9d2dd8c37a1184256b48272c0",
"score": "0.59443593",
"text": "def acceptReq\n friend = Parse::Object.new(\"Friends\")\n friend[\"user_id\"] = current_user.id\n friend[\"friend_id\"] = params[:initiator].to_i\n friend.save\n friendB = Parse::Object.new(\"Friends\")\n friendB[\"friend_id\"] = current_user.id\n friendB[\"user_id\"] = params[:initiator].to_i\n friendB.save\n\n #after adding the friend, delete the request\n @requests = Parse::Query.new(\"Requests\").eq(\"initiator\", params[:initiator].to_i).get\n @requests.each do |r|\n if r[\"responder\"] == current_user.id\n r.parse_delete\n end\n end\n redirect_to \"/usersPool\", :notice =>\"You guys are now friends :)\"\n end",
"title": ""
},
{
"docid": "f2bf2e3e2647e492fb17a9b2dfb3a074",
"score": "0.59228706",
"text": "def subtract_tokens(array_of_group_ids, request)\n array_of_group_ids.each do |group_id|\n tokens_requested = tokens_for_request(request)\n user_group_record = UserGroup.find_by(user: self, group_id: group_id)\n updated_tokens = user_group_record.tokens - tokens_for_request(request)\n user_group_record.update_tokens(updated_tokens)\n end\n end",
"title": ""
},
{
"docid": "ba0904873a0d54f840d567f6da36f042",
"score": "0.5921709",
"text": "def friends\n @requests = []\n friend_requests = Friend.where('user_receiver_id = ? AND accepted = ?', session[:user_id], false)\n friend_requests.each do |friend|\n @requests.push(User.find(friend.user_sender_id))\n end\n \n @pending = []\n pending_friends = Friend.where('user_sender_id = ? AND accepted = ?', session[:user_id], false)\n pending_friends.each do |friend|\n @pending.push(User.find(friend.user_receiver_id))\n end\n \n @friends = Friend.where('user_sender_id=?', session[:user_id]).or(Friend.where('user_receiver_id=?', session[:user_id])).where('accepted=?', true)\n \n @friends = []\n friend_sender = Friend.where('user_sender_id = ? AND accepted = ?', session[:user_id], true)\n friend_sender.each do |friend|\n @friends.push(User.find(friend.user_receiver_id))\n end\n friend_receiver = Friend.where('user_receiver_id = ? AND accepted = ?', session[:user_id], true)\n friend_receiver.each do |friend|\n @friends.push(User.find(friend.user_sender_id))\n end\n \n #puts Friend.where('user_sender_id=? AND accepted=?', session[:user_id], true)\n #puts @friends.inspect\n return\n end",
"title": ""
},
{
"docid": "81dff752ba406fd751a379bb130ab10c",
"score": "0.5918106",
"text": "def deduct_tokens_for_new_groups_in_request(original_request, original_groups_in_request)\n tokens_for_new_request = @request.calculate_tokens_for_request\n new_groups_in_request = @request.groups.reject { |group| group if original_groups_in_request.include? group }\n new_groups_in_request.each { |group| current_user.reallocate_tokens(group, -tokens_for_new_request) } if new_groups_in_request.present?\n end",
"title": ""
},
{
"docid": "e807a93f1fc6365cffce097b3fffc56c",
"score": "0.5899881",
"text": "def friendships_to_accept_or_reject\n friends = []\n user_friendship_requests.each do |user|\n friends.push(User.find(user))\n end\n friends\n end",
"title": ""
},
{
"docid": "968df73a566dd32c6ac454519fdf4e37",
"score": "0.58906096",
"text": "def accepted_friend_requests\n self.friend_requests_received.where(confirmed:true).each { |inv| inv.friender_id } + \n self.friend_requests_sent.where(confirmed:true).each { |inv| inv.friended_id }\n end",
"title": ""
},
{
"docid": "d504dc2983ef7915fc5be7f9b5fd3fcc",
"score": "0.58889085",
"text": "def only_friend_request_groups(all_request_groups_from_current_users_groups)\n friends_with_request_groups = all_request_groups_from_current_users_groups.reject { |request_group| request_group.request.user == self}\n request_groups = friends_with_request_groups.select { |request_group| request_group.request.status == 'waiting' && request_group.request.start >= DateTime.now }\n request_groups.sort_by { |request_group| request_group.request[:start] }\n end",
"title": ""
},
{
"docid": "226697a03cf5a2d021e66eca9dedbd7b",
"score": "0.5868069",
"text": "def showFriendsRequest\n @user=User.find_by name: session[:user]\n @friends = FriendshipRequest.where('receiver LIKE ?',\"#{@user.id}\")\n @finalFriends = Array.new\n @friends.each do |friend|\n\n if(DateTime.now > friend.expiration_date.to_date)\n friend.destroy\n else\n finalFriends.push(friend)\n end\n end\n end",
"title": ""
},
{
"docid": "602d86da1626aace9af117ac568bf431",
"score": "0.585268",
"text": "def do_gather_user_tokens\n # Only do this if gather_user_tokens is truthy\n return unless gather_user_tokens == '1'\n tid_emails = lime_survey.lime_tokens.pluck :tid, :email\n return unless tid_emails\n tid_emails = tid_emails - user_assignments.map{|ua|[ua.lime_token_tid, ua.user.email]}\n User.where(:email=>tid_emails.map{|tid, email|email}).each do |user|\n ua = user_assignments.build\n ua.user_id = user.id\n ua.lime_token_tid = tid_emails.find{|tid, email|user.email == email}.first\n ua.save!\n end\n end",
"title": ""
},
{
"docid": "2538b3f6644ce2f7d44aeeb908f8c8ec",
"score": "0.583965",
"text": "def received_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "5db217b3d5f676c355afb0445492058c",
"score": "0.58298945",
"text": "def friends_declined\n friends_already_declined = []\n \n self.declined_requests.each do |decision|\n friends_already_declined << decision.user\n end\n friends_already_declined.uniq! \n friends_already_declined\n end",
"title": ""
},
{
"docid": "3b09c15d68caea24acffe9fff1425186",
"score": "0.5800436",
"text": "def friends\n requested_friends + requesting_friends\n end",
"title": ""
},
{
"docid": "6157ed7552b63bdc2035f1617ba25514",
"score": "0.5788188",
"text": "def requested_friend_requests\n \trequested_friendships.where(accepted: false)\n end",
"title": ""
},
{
"docid": "78218ec896307c78eb813b497f997136",
"score": "0.5771668",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.confirmer unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "e1ad4a2fabacab22ffa02a273eeac64a",
"score": "0.5756206",
"text": "def sent_requests\n friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "a4a7eb53c3d58824b3a38695b705891c",
"score": "0.57419676",
"text": "def friend_requests\n inverted_friendships.map{|friendship| friendship.user if !friendship.status}.compact\n end",
"title": ""
},
{
"docid": "0ea180c208da513350577e04364548c6",
"score": "0.5720425",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "0ea180c208da513350577e04364548c6",
"score": "0.5720425",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "0ea180c208da513350577e04364548c6",
"score": "0.5720425",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "0ea180c208da513350577e04364548c6",
"score": "0.5720425",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "0ea180c208da513350577e04364548c6",
"score": "0.5720425",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "0ea180c208da513350577e04364548c6",
"score": "0.5720425",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end",
"title": ""
},
{
"docid": "aa4178e2f8532e76dec7616199831007",
"score": "0.57180977",
"text": "def requests\n @friendships = current_user.pending_friendships.includes(:friend)\n end",
"title": ""
},
{
"docid": "4d83e01fdd5570de97bdb9e2389758a1",
"score": "0.5701711",
"text": "def delete_friend_request\n if friender.friends_requested.include?(friendee)\n friender.friends_requested.delete(friendee)\n elsif friendee.friends_requested.include?(friender)\n friendee.friends_requested.delete(friender)\n end\n end",
"title": ""
},
{
"docid": "51cf629fc7da921cdde3ade6b16db866",
"score": "0.56951535",
"text": "def recieved_requests\n inverse_friendships.map { |friendship| friendship.user if friendship.status == 'requested' }.compact\n end",
"title": ""
},
{
"docid": "5903892c533269436576200787edaf93",
"score": "0.5688042",
"text": "def friend_request_list\n friend_request_arr = []\n\n inverse_friends.each do |f|\n if self.friend_request_received?(f)\n friend_request_arr.push(f)\n end\n end\n\n friend_request_arr\n end",
"title": ""
},
{
"docid": "59fba5506ff097678a1d9cd3e0dfb4e1",
"score": "0.5659676",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "59fba5506ff097678a1d9cd3e0dfb4e1",
"score": "0.5659676",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "59fba5506ff097678a1d9cd3e0dfb4e1",
"score": "0.5659676",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "59fba5506ff097678a1d9cd3e0dfb4e1",
"score": "0.5659676",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "3b5b4ece189e4e648e1d13189151132a",
"score": "0.5637391",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "3b5b4ece189e4e648e1d13189151132a",
"score": "0.5637391",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "195592c4c093df607680381dfcb93bbf",
"score": "0.5637253",
"text": "def pending\n \tpending_friends | requested_friends\n end",
"title": ""
},
{
"docid": "7c61d98621a44a0d897726ad498682e9",
"score": "0.5631935",
"text": "def send_friend_request\n # Grab an object from params to make life easier\n friend = params[:friend]\n \n # Grab the two users this friend request is referring to\n @user_sender = User.find(session[:user_id])\n @user_receiver = User.where(\"email = '#{friend[:receiver_email]}'\").first\n \n if @user_sender == nil or @user_receiver == nil\n puts \"One of these people don't exist!\"\n return\n end\n \n # Ensure the user isn't adding themselves\n if @user_sender[:email] == @user_receiver[:email]\n puts \"You can't add yourself, silly!\"\n return\n end\n \n # See if this friend request was already sent. If so, do nothing.\n request = Friend.where(\"user_sender_id = #{@user_sender[:id]} and user_receiver_id = #{@user_receiver[:id]}\")\n \n if request.size > 0\n # Obviously do something else, but just return for now.\n puts \"Request already in, not going to process\"\n return\n end\n \n # See if the other user has already sent a request. If so, accept their friend request.\n request = Friend.where(\"user_sender_id = #{@user_receiver[:id]} and user_receiver_id = #{@user_sender[:id]}\")\n \n if request.size > 0\n if request[0][:accepted]\n puts \"Already friends!\"\n return\n else\n request[0][:accepted] = true\n request[0].save\n puts \"Accepted their friend request\"\n return\n end\n end\n \n # If we are here, it is actually a new friend request. Create and save it!\n @friend_request = Friend.new(\n :user_sender_id => @user_sender[:id], \n :user_receiver_id => @user_receiver[:id], \n :accepted => false\n )\n \n @friend_request.save\n \n redirect_to friends_path\n end",
"title": ""
},
{
"docid": "5b182d6624df0632a4f66e55e7fb6a92",
"score": "0.563181",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.acepted }.compact\n end",
"title": ""
},
{
"docid": "c4d561263afeb64feec8025f8bc5dbc5",
"score": "0.5621423",
"text": "def new_suggested_groups \n @groups = current_user.friends.collect(&:groups).compact.flatten.uniq.sort_by {|c| c.updated_at}.reverse\n @joined_groups = current_user.members.where(invitable_type: \"Group\").collect(&:invitable).uniq\n return (@groups.to_a - (@joined_groups + current_user.groups))\n end",
"title": ""
},
{
"docid": "c20a0559fc2c16f1efba80ab043a5635",
"score": "0.56146985",
"text": "def cancel_friend_request(other_user)\n active_friend_requests.find_by(requested_id: other_user.id).delete\n passive_friend_requests.find_by(requestor_id: other_user.id).delete\n end",
"title": ""
},
{
"docid": "ba177b2d0878192065a12f0259062740",
"score": "0.5613806",
"text": "def users_pending_to_accept_my_request(user)\n friendship1 = @friendships.map { |friendship| friendship.friend unless friendship.confirmed }.compact\n friendship1.include?(user)\n end",
"title": ""
},
{
"docid": "7feaea5dda74a122b0e584e9b0013795",
"score": "0.56067044",
"text": "def accepted_friends\n the_friends = []\n user_accepted_friends.each do |friend|\n the_friends.push(User.find(friend))\n end\n the_friends\n end",
"title": ""
},
{
"docid": "fed6bf4fc72465694ff88f210deddf7b",
"score": "0.5605462",
"text": "def reallocate_updated_request_tokens(original_request, original_groups_in_request)\n reallocate_tokens_for_same_groups_in_request(original_request, original_groups_in_request)\n credit_tokens_for_groups_no_longer_in_request(original_request, original_groups_in_request)\n deduct_tokens_for_new_groups_in_request(original_request, original_groups_in_request)\n end",
"title": ""
},
{
"docid": "9b05395df8509e9ef2133cbb1037e5d6",
"score": "0.55950487",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.approved}.compact\n end",
"title": ""
},
{
"docid": "152fd14db4056d1a9f5df2228ad87111",
"score": "0.5581936",
"text": "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end",
"title": ""
},
{
"docid": "0e620068cfd12e8bbe4baf5a3ca00190",
"score": "0.55719304",
"text": "def friendship_request\n logger.debug(\"In function - friendship-request\")\n \n return unless required_params(\n :'kopal.identity' => Proc.new {|x| normalise_kopal_identity(x); true}\n )\n\n logger.info \"Friendship request arrived from #{params[:'kopal.identity']}.\"\n\n @friend = @profile_user.account.all_friends.build :friend_kopal_identity => params[:\"kopal.identity\"]\n\n if @profile_user.account.all_friends.find_by_friend_kopal_identity(@friend.friend_kopal_identity.to_s)\n logger.debug(\"Duplicate friendship request from #{@friend.friend_kopal_identity}\")\n kc_render_or_redirect :mode => 'error', :error_id => \"0x1201\"\n return\n end\n\n #TODO: Try &&ing all statements. Make sure that all of them return !nil/false if success.\n #TODO: Make all of these methods return a Proc, so that they make calling method return\n #on error like <tt>re.call</tt> in OrganiseController#friend. And we don't have\n #to perform check after every call.\n #Example: <tt>fr_fetch_friendship_state().call()</tt> instead of <tt>fr_fetch_friendship_state()<tt>.\n\n @friendship_state_response = fr_fetch_friendship_state\n return if ror_already?\n \n kc_verify_k_connect @friendship_state_response\n return if ror_already?\n \n fr_verify_friendship_state @friendship_state_response\n return if ror_already?\n \n @friend.friendship_key = fr_decrypt_friendship_key @friendship_state_response\n return if ror_already?\n \n @discovery_response = fr_fetch_kopal_discovery\n return if ror_already?\n \n kc_verify_k_connect @discovery_response\n return if ror_already?\n \n kc_verify_kc_discovery @discovery_response \n return if ror_already?\n \n @friend.friend_public_key = @discovery_response.response_hash['kopal.public-key']\n\n @kopal_feed_response = fr_fetch_kopal_feed\n return if ror_already?\n\n kc_verify_k_feed @kopal_feed_response\n return if ror_already?\n\n logger.debug(\"Saving record to database.\")\n begin\n @friend.friend_kopal_feed = Kopal::Feed.new @kopal_feed_response.body_xml\n @friend.friendship_state = 'pending'\n @friend.save!\n rescue Kopal::Feed::FeedInvalid, ActiveRecord::RecordInvalid => e\n kc_render_or_redirect :mode => 'error', :error_id => '0x0000',\n :message => \"Invalid Kopal Feed at #{@kopal_feed_response.response_uri}. \" +\n \"Message recieved - \" + e.message\n return\n end\n logger.debug(\"Finished saving record to database.\")\n \n friendship_state\n end",
"title": ""
},
{
"docid": "f5d7f5975c5e1e5c9a5bbfe12e9ddd56",
"score": "0.5568268",
"text": "def friend_requests\n inverse_friendships.select { |friendship|\n !friendship.confirmed\n }.compact\n end",
"title": ""
},
{
"docid": "682ec285acb3132091653b2c740d71c2",
"score": "0.5565587",
"text": "def pending_friend_requests\n \tpending_friendships.where(accepted: false)\n end",
"title": ""
},
{
"docid": "c69e5495187cc5fdeb7d20ab111fda87",
"score": "0.55432403",
"text": "def outstanding_friend_requests_sent\n self.friend_requests_sent.where(confirmed:false)\n end",
"title": ""
},
{
"docid": "1401182a733e9ba4925337a317351136",
"score": "0.55380386",
"text": "def friends\n friend_list = []\n accepted_friend_requests.each do |inv|\n friend_list.push(inv.friended_id) unless inv.friended_id == self.id\n friend_list.push(inv.friender_id) unless inv.friender_id == self.id\n end\n User.where(id: friend_list)\n end",
"title": ""
},
{
"docid": "d9ccd7d82c8b398cf99c90c0c66092d3",
"score": "0.55314803",
"text": "def create\n get_friends_profile()\n restricted_friends = RestrictedFriend.where(:user_id => current_user.id)\n if restricted_friends.present?\n restricted_friends.each do |restricted_friend|\n restricted_friend.destroy\n end\n end\n if params[\"restricted_friend\"].present? && params[\"restricted_friend\"][\"uid\"].present?\n params[\"restricted_friend\"][\"uid\"].each do |friend_id|\n avail = RestrictedFriend.find_by_uid_and_user_id(friend_id,current_user.id)\n if avail.nil?\n RestrictedFriend.create(:uid => friend_id,:user_id => current_user.id)\n end\n end\n end\n redirect_to \"/restricted_friends/new\"\n end",
"title": ""
},
{
"docid": "558ccd64e8c14276c42f6172d8edcf33",
"score": "0.55149066",
"text": "def outstanding_friend_requests_received\n self.friend_requests_received.where(confirmed:false)\n end",
"title": ""
},
{
"docid": "e22502d49303bd7b3d647ba68f501e64",
"score": "0.551379",
"text": "def make_request_token\n @consumer.get_request_token\n end",
"title": ""
},
{
"docid": "e22502d49303bd7b3d647ba68f501e64",
"score": "0.551379",
"text": "def make_request_token\n @consumer.get_request_token\n end",
"title": ""
},
{
"docid": "854f92639c468080fdbda91d8db832c8",
"score": "0.5505946",
"text": "def pending_for_accept_my_request(user)\n friendship1 = @friendships.map { |friendship| friendship.friend if !friendship.friendship_status }.compact\n friendship1.include?(user)\n end",
"title": ""
},
{
"docid": "8d019b09a181f46001ddcc6bc929880e",
"score": "0.5487062",
"text": "def accept\n user.friendships.create(:friend => requesting_user) and requesting_user.friendships.create(:friend => user) and destroy\n end",
"title": ""
},
{
"docid": "bf4deb471bf38d39907d1a9c9c8f7e83",
"score": "0.54787934",
"text": "def sent_and_got_accepted_by(other_user) #sagab\n \tself.sent_request_to(other_user).accepted.exists?\n\n \t#LEFT HERE FOR REFERENCE\n \t#self.sent_requests.accepted.include?(other_user) \n \t#this is wrong, it checks the friendships for a user\n \t#if i had friends only after accept i could do self.requested_friends.include?(other_user) etc\n \t#here i have to scour the friendships model\n end",
"title": ""
},
{
"docid": "23de84b81ab55394e0f1f432f5b7c942",
"score": "0.5476413",
"text": "def generate_request_token\n token = \"#{(0...3).map { ('a'..'z').to_a[rand(26)] }.join}#{(0...3).map { (0..9).to_a[rand(9)] }.join}\"\n while User.exists?(request_token: token)\n token = \"#{(0...3).map { ('a'..'z').to_a[rand(26)] }.join}#{(0...3).map { (0..9).to_a[rand(9)] }.join}\"\n end\n self.update(request_token: token)\n token\n end",
"title": ""
},
{
"docid": "d987bd027b1c4c5ec5a848d15ea846b4",
"score": "0.5473401",
"text": "def accept\n user.friends << friend\n destroy\n end",
"title": ""
},
{
"docid": "ab3b1b7e310320927425e36df8d5e790",
"score": "0.5471129",
"text": "def accept\n user.friends << friend\n destroy\n end",
"title": ""
},
{
"docid": "2b8791ff2fb7d15feae33428026a483f",
"score": "0.54683435",
"text": "def requests\n user = User.find_by_authentication_token(params[:auth_token])\n friends = user.requested_friendships\n render_jbuilders(friends) do |json,friend|\n friend.to_json json\n end\n end",
"title": ""
},
{
"docid": "82ab9ba552463831d171750d3ae3a599",
"score": "0.5462027",
"text": "def accept\n \tuser.friends << friend\n \tdestroy\n end",
"title": ""
},
{
"docid": "d8efed8dba38fcf09a3fe8bd856f0a3e",
"score": "0.5457266",
"text": "def requests\n friendship_requests.where(accepted: false)\n end",
"title": ""
},
{
"docid": "e0f763d17054df14a40490c2033b7853",
"score": "0.545691",
"text": "def accept\n if @user.requested_friends.include?(@friend)\n Friendship.accept(@user, @friend)\n @user_friends = current_user.friends\n else\n flash[:notice] = \"There has been no friendship request\"\n end\n end",
"title": ""
},
{
"docid": "1133c01c193b0eac80d26aa79c859cf4",
"score": "0.5446846",
"text": "def possible_friends\n User.all - self.requesters - self.requestees-self.friends-User.where(id:self.id)\n end",
"title": ""
},
{
"docid": "dcacde7841f429140ae1c76af38aa6fc",
"score": "0.5440152",
"text": "def add_friend(auth_token, receiver_login, friendship)\r\n return { add_friend: { error: 'Empty fields' }}.to_json if receiver_login.empty? ||\r\n friendship.empty?\r\n\r\n sender = User.first(token: auth_token)\r\n receiver = User.first(login: receiver_login)\r\n\r\n return { add_friend: { error: \"User doesn't exist\" }}.to_json if receiver.nil?\r\n return { add_friend: { error: \"You can't add yourself to friends\" }}.to_json if sender == receiver\r\n return { add_friend: { error: 'User is deleted' }}.to_json if receiver.deleted\r\n\r\n invite_task = receiver.tasks.all(receiver_login: sender.login).last(priority: 4)\r\n\r\n return { add_friend: { error: \"Invite doesn't exist\" }}.to_json if invite_task.nil?\r\n\r\n if friendship == 'true'\r\n sender.friends << receiver\r\n receiver.friends << sender\r\n\r\n if sender.friends.save && receiver.friends.save\r\n add_new_task(sender.token, receiver.login, \"#{sender.firstname} #{sender.lastname} true\", 5)\r\n invite_task.destroy!\r\n { add_friend: { error: 'Success',\r\n login: receiver.login,\r\n firstname: receiver.firstname,\r\n lastname: receiver.lastname }}.to_json\r\n else\r\n add_new_task(sender.token, receiver.login, \"#{sender.firstname} #{sender.lastname} false\", 5)\r\n invite_task.destroy!\r\n { add_friend: { error: 'Success' }}.to_json\r\n end\r\n\r\n else\r\n add_new_task(sender.token, receiver.login, \"#{sender.firstname} #{sender.lastname} false\", 5)\r\n invite_task.destroy!\r\n { add_friend: { error: 'Success' }}.to_json\r\n end\r\n end",
"title": ""
},
{
"docid": "38219b4291e87434609d58118896dbf6",
"score": "0.5433028",
"text": "def validate_token_and_get_receiver\n # CHECK TOKEN VALIDITY\n @token = params[:token]\n @owner_token = params[:owner_token]\n redirect_to(invalid_token_path) && return if User.token_invalid?(@token)\n # WHO IS THE RECEIVER?\n @user = User.find_by_token(@token) # returns user instance\n # get preferences of user requesting the rekos\n @user_preferences = @user.preferences.map { |preference| preference.name }\n end",
"title": ""
},
{
"docid": "5ad360ae78ad020459a4d6d96e5580a5",
"score": "0.5432322",
"text": "def outgoing\n @friendship_requests = FriendshipRequest.where(user: current_user)\n end",
"title": ""
},
{
"docid": "9c61491c53979dcf75127a8526d1a249",
"score": "0.5420913",
"text": "def unaccepted_request_ids\n Friendship.unaccepted.where(friend_id: current_user.id,\n rejected: false).map(&:user_id)\n end",
"title": ""
},
{
"docid": "c6945799a8b37f9c09117104703c83ac",
"score": "0.542001",
"text": "def friend_requests\n inverse_friendships.map { |fr| fr.user unless fr.status }.compact\n end",
"title": ""
},
{
"docid": "8ff57b758ddacb9aebbdffcbe1fab32e",
"score": "0.5416985",
"text": "def all_friends_including_pending\n friends = []\n self.pending_friends.each do |friend|\n friends << friend\n end\n self.inverse_pending_friends.each do |friend|\n friends << friend\n end\n friends + all_friends\n end",
"title": ""
},
{
"docid": "7d2cced8200de2936cbf469b2c8bac5c",
"score": "0.5400622",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.status }.compact\n end",
"title": ""
},
{
"docid": "7d2cced8200de2936cbf469b2c8bac5c",
"score": "0.5400622",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.status }.compact\n end",
"title": ""
},
{
"docid": "7d2cced8200de2936cbf469b2c8bac5c",
"score": "0.5400622",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.status }.compact\n end",
"title": ""
},
{
"docid": "7d2cced8200de2936cbf469b2c8bac5c",
"score": "0.5400622",
"text": "def friend_requests\n inverse_friendships.map { |friendship| friendship.user unless friendship.status }.compact\n end",
"title": ""
},
{
"docid": "0d91920e359ac83e36302b6db12628fc",
"score": "0.53918874",
"text": "def pending\n pending_friends | requested_friendships\n end",
"title": ""
},
{
"docid": "0d91920e359ac83e36302b6db12628fc",
"score": "0.53918874",
"text": "def pending\n pending_friends | requested_friendships\n end",
"title": ""
},
{
"docid": "0d91920e359ac83e36302b6db12628fc",
"score": "0.53918874",
"text": "def pending\n pending_friends | requested_friendships\n end",
"title": ""
},
{
"docid": "0d91920e359ac83e36302b6db12628fc",
"score": "0.53918874",
"text": "def pending\n pending_friends | requested_friendships\n end",
"title": ""
},
{
"docid": "3aa23f895f4dd8966367927cb2691301",
"score": "0.53874403",
"text": "def respond_to_friend_request\n puts params.inspect\n @friend_request = Friend.where('user_sender_id = ? AND user_receiver_id = ?', params[:sender_id], session[:user_id])\n \n if params[:accept]\n puts \"ACCEPTED!\"\n @friend_request[0][:accepted] = true\n @friend_request[0].save\n else\n puts \"DECLINED!\"\n @friend_request[0].destroy\n end\n redirect_to friends_path\n end",
"title": ""
},
{
"docid": "76876107c9c8d279ef3b3cbd05296bc1",
"score": "0.53865606",
"text": "def reallocate_tokens_for_same_groups_in_request(original_request, original_groups_in_request)\n token_difference = @request.calculate_token_difference_between_original_and_old_request(original_request)\n same_groups_in_request = original_groups_in_request.select { |group| group if @request.groups.include? group }\n same_groups_in_request.each { |group| current_user.reallocate_tokens(group, token_difference) } if same_groups_in_request.present?\n end",
"title": ""
},
{
"docid": "dc4d7f42d4dfb440969b3de848494725",
"score": "0.5373137",
"text": "def not_pending\n if user_id.blank?\n return\n end\n if user.incoming_friend_requests.pluck(:user_id).include?(friend_id)\n errors.add(:friend, 'already requested friendship')\n end\n end",
"title": ""
},
{
"docid": "b81ef6c0f51dcc58a1716a63bd381136",
"score": "0.53663296",
"text": "def all_friends_inc_pending\n all_friends | pending \n end",
"title": ""
},
{
"docid": "13c4fe235c7b0cd7d3974ebbb61683e1",
"score": "0.5365319",
"text": "def deny_request\n # NOTE: if I sent request and receiver doesn't processed it - remove request\n # NOTE: if I pressed 'Move to subscribers' button - reject request and leave\n # dreamer in subscribers\n friend_request = current_dreamer.outgoing_friend_requests.find_by receiver: dreamer\n if friend_request\n friend_request.destroy\n elsif current_dreamer.friend_requests.find_by sender: dreamer\n Relations::RejectFriendRequest.call dreamer, current_dreamer\n end\n\n redirect_to :back\n end",
"title": ""
},
{
"docid": "a4b1bb2c925ab04e8ddc98b7940676b6",
"score": "0.5361301",
"text": "def friends\n (\n requested_friends.where(\"friendships.status = 'approved'\") +\n requester_friends.where(\"friendships.status = 'approved'\")\n ).uniq\n end",
"title": ""
},
{
"docid": "e70a5559671c4da0d05d6bdca80dcfc3",
"score": "0.53579056",
"text": "def pending_friendship_requests\n self.friendships.select{|f| pending_friendship_request?(f)}\n end",
"title": ""
},
{
"docid": "7b56fe3c9bbae0c28879f3a307b96ef8",
"score": "0.5354822",
"text": "def request_token\n @token = current_client_application.create_request_token\n\n if @token\n logger.info \"request token params: #{params.inspect}\"\n # request tokens indicate what permissions the client *wants*, not\n # necessarily the same as those which the user allows.\n current_client_application.permissions.each do |pref|\n @token.write_attribute(pref, true)\n end\n @token.save!\n\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"title": ""
},
{
"docid": "06ab4bd63f020b7a726ff418aa68ad54",
"score": "0.5339236",
"text": "def pending_requests\n friendships.map { |friendship| friendship.friend if friendship.status == 'requested' }.compact\n end",
"title": ""
}
] |
c82f99c72dc6b283d6157384bc17538b
|
DELETE /books/1 DELETE /books/1.json
|
[
{
"docid": "c4adc3d901b66237a3dec43afca4433e",
"score": "0.7154986",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Knjiga uspešno izbrisana.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "f20a59ceb31d39f7c2e3a92cdb0d0d0c",
"score": "0.7589208",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to deleted_books_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f7771f37fe32885f557aa9a5c8d185e1",
"score": "0.753586",
"text": "def destroy\n @book.book_identifier.delete rescue nil\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9fa9758463a48052d3a7eb6eeeb73c95",
"score": "0.74579465",
"text": "def destroy\n @book.delete\n respond_to do |format|\n format.html { redirect_to home_path, notice: '' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e8c676ea72f709b9f4708796778f6559",
"score": "0.7443343",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "503f3a0b9608928523635783e76f1733",
"score": "0.7442168",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2df45145f4f30968f748e22b015adb96",
"score": "0.7433348",
"text": "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cb9ce61827d8c894fff013d54c8907e2",
"score": "0.74263483",
"text": "def destroy\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b379b54d38c9d4445b6f52770d858611",
"score": "0.7401031",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1fd863967d9320ae7cbd6b73f410c07c",
"score": "0.7382193",
"text": "def destroy\n @book.delete\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b1454ff2e1cf4931eb0b177f59e405ca",
"score": "0.7309204",
"text": "def delete\n @bookalope.http_delete(@url)\n end",
"title": ""
},
{
"docid": "b1454ff2e1cf4931eb0b177f59e405ca",
"score": "0.7309204",
"text": "def delete\n @bookalope.http_delete(@url)\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.73016214",
"text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end",
"title": ""
},
{
"docid": "584958fde55fd3625f92e7343c77a0d7",
"score": "0.725647",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'El libro se eliminó.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5044056ba69d2169f2fef51bc84d0c6b",
"score": "0.72263396",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to \"http://5.135.175.184/books/\", notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "805be4ba8121b60f67785dd988184b3c",
"score": "0.7222278",
"text": "def delete\n @book = Book.destroy(params[:id])\n respond_with(@book)\n end",
"title": ""
},
{
"docid": "b445c184893647d3482f8fbc6a507a52",
"score": "0.72132546",
"text": "def delete(path, params = {})\n path += '.json'\n res = @connection.delete(path, @header)\n parse_response(res)\n end",
"title": ""
},
{
"docid": "50d89ace0f07f24b5653677c70527727",
"score": "0.72105616",
"text": "def destroy\n @book_whole.destroy\n respond_to do |format|\n format.html { redirect_to book_wholes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8a4d7983e3cf78b16a90537deb5dd9bc",
"score": "0.7205404",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Libro eliminato correttamente' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "31fbcb0e771bbe708bed6ce58783589e",
"score": "0.7203696",
"text": "def destroy\n @add_book.destroy\n respond_to do |format|\n format.html { redirect_to add_books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4e43725e67f825f58efb3a5d06b5de16",
"score": "0.7197159",
"text": "def destroy\n @book.destroy && @book_detail.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0c906a840087c4c5eaa739002193479",
"score": "0.717239",
"text": "def destroy\n @mybook = Mybook.find(params[:id])\n @mybook.destroy\n\n respond_to do |format|\n format.html { redirect_to mybooks_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "35a360e3d2218c2d6d365652891b8e46",
"score": "0.7169134",
"text": "def destroy\n Book.update(params[:id], { :deleted => true} )\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8808ace2077e633ae332478fb9ab998d",
"score": "0.71639913",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to \"http://localhost:3000/books/\", notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2c33d3219ec4f994ef0d6dbc17881b9c",
"score": "0.71589977",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Votre annonce à été détruite !' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9c954688a695d91634bfbe3125f18c1c",
"score": "0.7153242",
"text": "def destroy\n @book_detail.destroy\n respond_to do |format|\n format.html { redirect_to book_details_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a94583aa10cc15ac004a85d2cd26e5c3",
"score": "0.71478397",
"text": "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
8e1d368eee93ea8b2e6d69c1aea46ac9
|
GET /organizations/new GET /organizations/new.xml
|
[
{
"docid": "ece410bb4bd06464a65adf789b1bb4b2",
"score": "0.7719807",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
}
] |
[
{
"docid": "0824b807ef4983f3351b757f1384c98b",
"score": "0.7631869",
"text": "def new\n @organizations = Organization.find(:all)\n @organization_user = OrganizationUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_user }\n end\n end",
"title": ""
},
{
"docid": "930355690fa6688119f6856c724df173",
"score": "0.7573145",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "e5e8c5a792927665f1022e5cb2b67c93",
"score": "0.7376287",
"text": "def new\n @organization = Organization.new\n session[:breadcrumbs].add \"New\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end",
"title": ""
},
{
"docid": "2b43601a356490936f9a72b0d447d075",
"score": "0.73129064",
"text": "def new\r\n @org = Org.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @org }\r\n end\r\n end",
"title": ""
},
{
"docid": "36a968910aba0ddd5a1a1967e2eb950d",
"score": "0.7294905",
"text": "def new\n\t\t@organization = Organization.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @organization }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "755f821058b89f09af87328821be913e",
"score": "0.71885496",
"text": "def new\n @organ = Organ.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organ }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.71479994",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "a823a453a7d2d4a5102d1c4f9c0790d7",
"score": "0.71479994",
"text": "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "1adf10deaeca7b7eb324ef35357f280b",
"score": "0.7101753",
"text": "def new\n @participating_organization = ParticipatingOrganization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @participating_organization }\n end\n end",
"title": ""
},
{
"docid": "30c29f11cdc48570c3a44063e8749cbe",
"score": "0.7099636",
"text": "def new\n @organization_member = OrganizationMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_member }\n end\n end",
"title": ""
},
{
"docid": "9ec2b771b288c12abc6538c52a4b7998",
"score": "0.70981485",
"text": "def new\n @organization_detail = OrganizationDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization_detail }\n end\n end",
"title": ""
},
{
"docid": "75a2d6f2440ee477ac4a52f7287befd3",
"score": "0.7053847",
"text": "def new\n @organization = Organization.new\n @organization.name = params[:name]\n @organization.url = params[:url]\n @organization.homepage_url = params[:homepage_url]\n @organization.address = params[:address]\n\n authorize! :new, @organization\n\n @title = new_action_title\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"title": ""
},
{
"docid": "2deec688fad3898e7f70ae3ccca508d2",
"score": "0.6954005",
"text": "def new\n @organization = Organization.new\n respond_with(@organization)\n end",
"title": ""
},
{
"docid": "91ab82ba5663d65ba9a19f4a03bee961",
"score": "0.6939667",
"text": "def new\n @organiser = Organiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organiser }\n end\n end",
"title": ""
},
{
"docid": "bd6df89f1ac8aa964675e38fdea9d5ba",
"score": "0.68419677",
"text": "def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end",
"title": ""
},
{
"docid": "599e803a1868b05d448f30812559ca28",
"score": "0.683335",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n flash[:notice] = 'Organization was successfully created.'\n format.html { redirect_to(@organization) }\n format.xml { render :xml => @organization, :status => :created, :location => @organization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3518f067b6a4bba3771541665c70a43f",
"score": "0.68051296",
"text": "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"title": ""
},
{
"docid": "d2486ea8917b7440b200450e5f6ebc1d",
"score": "0.6722151",
"text": "def new\n @external_organization = ExternalOrganization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @external_organization }\n end\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.6718631",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.6718631",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.6718631",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.6718631",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "0c50992c52fd13b6ed7da5c59d9327b4",
"score": "0.6718631",
"text": "def new\n @organization = Organization.new\n end",
"title": ""
},
{
"docid": "8f7c0cea00314ff17b90cdc0b924361c",
"score": "0.6714375",
"text": "def create\r\n @org = Org.new(params[:org])\r\n\r\n respond_to do |format|\r\n if @org.save\r\n format.html { redirect_to @org, notice: 'Org was successfully created.' }\r\n format.json { render json: @org, status: :created, location: @org }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @org.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "52fda32511987eede4febc62759ce898",
"score": "0.67027634",
"text": "def new\n @organization = Organization.new\n respond_with @organization\n end",
"title": ""
},
{
"docid": "02fe532d32571cce019182cd9b9b3fba",
"score": "0.6698567",
"text": "def new\n @organisation = Organisation.find(params[:organisation_id])\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @event }\n end\n end",
"title": ""
},
{
"docid": "2b01633e27e2727878e965deeca8ba88",
"score": "0.6683733",
"text": "def new\n @person = @scope.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "23cdde8d4b1a2be0bc3eecca07b39e74",
"score": "0.667709",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"title": ""
},
{
"docid": "d9ec896083d18af703d4518a3b79c931",
"score": "0.6667784",
"text": "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "755195dc5c97a07e7c39f78c5fd60d79",
"score": "0.6666247",
"text": "def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"title": ""
},
{
"docid": "755195dc5c97a07e7c39f78c5fd60d79",
"score": "0.6666247",
"text": "def new\n @repository = Repository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repository }\n end\n end",
"title": ""
},
{
"docid": "0c9f026732585f301bb939ab77576231",
"score": "0.6623879",
"text": "def new\n @namespace = Namespace.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @namespace }\n end\n end",
"title": ""
},
{
"docid": "9c9708c7768e13426f89183d6051de84",
"score": "0.6613848",
"text": "def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "59bd8270ee9a1a7db082a4a68b3884af",
"score": "0.661021",
"text": "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "adbd13b73feb3e202690ac43ac0bc339",
"score": "0.65999407",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "fcdebda20ad37ccb85e08e3745857ad0",
"score": "0.6596609",
"text": "def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end",
"title": ""
},
{
"docid": "fc79df5d583139ad8bc2a80fa38ffdcd",
"score": "0.6594747",
"text": "def new\n @association = Association.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @association }\n end\n end",
"title": ""
},
{
"docid": "52877909562cf01d4dddc2354213ec15",
"score": "0.65865076",
"text": "def new\n @organisation = Organisation.new\n end",
"title": ""
},
{
"docid": "52877909562cf01d4dddc2354213ec15",
"score": "0.65865076",
"text": "def new\n @organisation = Organisation.new\n end",
"title": ""
},
{
"docid": "af65456ad7590d6a16572b3cb5a0037f",
"score": "0.6580551",
"text": "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "9b5e6d12b805f60af1b2b1bdb4cf4a04",
"score": "0.6567074",
"text": "def new\n @organ = Organ.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organ }\n end\n end",
"title": ""
},
{
"docid": "d44b55f8876bb87604dd281ac9fa079b",
"score": "0.6564549",
"text": "def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "90a420e12d05de5687d1b5a16a933f59",
"score": "0.6562301",
"text": "def new\n @research = Research.new\n @page_title = \"Request research from White House 2 members\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @research.to_xml(:except => [:email]) }\n end\n end",
"title": ""
},
{
"docid": "276a30d2bcd4e506fff7024160e2299f",
"score": "0.6554578",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to(locations_url, :notice => \"#{@organisation.to_s} was successfully created.\") }\n format.xml { render :xml => @organisation, :status => :created, :location => @organisation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @organisation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "282324925f8de49d9dd86741aa2149e0",
"score": "0.65378314",
"text": "def new\n\t@user = User.new\n\t@organizations = Organization.all\n end",
"title": ""
},
{
"docid": "cc64be404c957e7b113b48591cfdc794",
"score": "0.6536351",
"text": "def new\n @organization_account = OrganizationAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization_account }\n end\n end",
"title": ""
},
{
"docid": "32d23e457194194ed523de156ee89693",
"score": "0.65345514",
"text": "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "2f56a326d709f05bd3dd9a80c6177034",
"score": "0.6518862",
"text": "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",
"title": ""
},
{
"docid": "50912b64993011455cbf5d7385a7216a",
"score": "0.65158737",
"text": "def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "8162b81283a515526ab50e7fba46a74b",
"score": "0.64880544",
"text": "def new\n @family = Family.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @family }\n end\n end",
"title": ""
},
{
"docid": "5efcc85ce1ef6b746de77e211012417a",
"score": "0.64855456",
"text": "def new\n @organization_profile = OrganizationProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization_profile }\n end\n end",
"title": ""
},
{
"docid": "112cdc2301a0958dc5fc07522d3ca238",
"score": "0.64768034",
"text": "def new\n @building = Building.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @building }\n end\n end",
"title": ""
},
{
"docid": "21a45db0041828210bf9275fe6809683",
"score": "0.6465331",
"text": "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end",
"title": ""
},
{
"docid": "576a96638bef180b7bf04ff47efb273a",
"score": "0.6461598",
"text": "def new\n @organism = Organism.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organism }\n end\n end",
"title": ""
},
{
"docid": "a74e46a1c40993a9ee7623fa4c010966",
"score": "0.64613926",
"text": "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @company }\n end\n end",
"title": ""
},
{
"docid": "719660f9cb901151391a038a82c0e2df",
"score": "0.64613837",
"text": "def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end",
"title": ""
},
{
"docid": "d359afb4702b595eab2a864733b333e5",
"score": "0.6458295",
"text": "def new\n @author_repository = AuthorRepository.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @author_repository }\n end\n end",
"title": ""
},
{
"docid": "9ccf31a80211f3a387720f0c878d451d",
"score": "0.64562714",
"text": "def new\n @person = Person.new\n @person.build_address\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "1fbc8bac6b0a6a21e0f7bba3cc1dacde",
"score": "0.6450717",
"text": "def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration }\n end\n end",
"title": ""
},
{
"docid": "79afafa5d4f1e088e8ae9d87dc144df1",
"score": "0.6442126",
"text": "def new\n @repository = Repository.new\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @repository }\n end\n end",
"title": ""
},
{
"docid": "0076ea509ac48eae26f6f7a0442e71d2",
"score": "0.6439947",
"text": "def new\n \n @personnel = Personnel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personnel }\n end\n end",
"title": ""
},
{
"docid": "8b6c880978f4c4b1ddf93133c409b7db",
"score": "0.64379483",
"text": "def new\n @user = User.new(:organization_id => current_org.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"title": ""
},
{
"docid": "6acfa35c7ab31dc45de64d7f0ac1d2d2",
"score": "0.643772",
"text": "def create\n\t\t@organization = Organization.new(params[:organization])\n\n\t\trespond_to do |format|\n\t\t\tif @organization.save\n\t\t\t\tformat.html { redirect_to(@organization, :notice => 'Organization was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @organization, :status => :created, :location => @organization }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "e163abde056bd2fc3f6c6c875b92c6e7",
"score": "0.6428396",
"text": "def new\n @projection = Projection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @projection }\n end\n end",
"title": ""
},
{
"docid": "774af7384b5ee2a6de982b9f0685c66f",
"score": "0.6427854",
"text": "def new\n @personal_info = PersonalInfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal_info }\n end\n end",
"title": ""
},
{
"docid": "abf6c23654167535f3ba886f613bb95f",
"score": "0.6427161",
"text": "def create\n @organization = Organization.new(params[:organization])\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully created.\" }\n format.json { render json: @organization, status: :created, location: @organization }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.6425708",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.6425708",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "cf89ddf6d919c6907b943d474baa3c25",
"score": "0.64238834",
"text": "def new\n @person = Person.new\n @project = Project.find(params[:project_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"title": ""
},
{
"docid": "bb04f0b6f2f328eab163446904b03fb6",
"score": "0.6419998",
"text": "def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end",
"title": ""
},
{
"docid": "df71876c603cb1bc2cf913b781a4c407",
"score": "0.64174914",
"text": "def new\n @boss = Boss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boss }\n end\n end",
"title": ""
},
{
"docid": "ab78ac2d762ac22f77053e06c1709ed4",
"score": "0.6416065",
"text": "def new\n @node = Node.new\n @node.owner = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "d8ea74214e44961b9d0ea299ddf00ae2",
"score": "0.64103884",
"text": "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end",
"title": ""
},
{
"docid": "da0adb675a5178244a58d4ca296e0c4f",
"score": "0.6397296",
"text": "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end",
"title": ""
},
{
"docid": "954e9f5ea15a937fc5a2c89f00b3398b",
"score": "0.63965213",
"text": "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @geoname }\n end\n end",
"title": ""
},
{
"docid": "b1b7fd456572c0c25d0356323166d745",
"score": "0.63849443",
"text": "def new\n @organization_status = OrganizationStatus.new(organization: @organization)\n respond_with @organization_status\n end",
"title": ""
},
{
"docid": "23b0ee8117f979aa48d315c473fb023a",
"score": "0.6376724",
"text": "def new\n @git_repo = GitRepo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @git_repo }\n end\n end",
"title": ""
},
{
"docid": "99071fcb62fa5db9b5b3e84d82cacb63",
"score": "0.6363875",
"text": "def new\n @town = Town.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town }\n end\n end",
"title": ""
},
{
"docid": "8e39356d232aa9dcc081eb8996a02691",
"score": "0.63616955",
"text": "def new\n authenticate_user!\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"title": ""
},
{
"docid": "254e7c4d22d56c9babb7cb47b3459275",
"score": "0.63561815",
"text": "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end",
"title": ""
},
{
"docid": "3a6d69f216f26460d6b204704447a3c8",
"score": "0.63546777",
"text": "def new\n @territory = Territory.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @territory }\n end\n end",
"title": ""
},
{
"docid": "1e7f2743293e2d2c50c2793fdda02d9c",
"score": "0.6352658",
"text": "def new\n @om_account = OmAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @om_account }\n end\n end",
"title": ""
},
{
"docid": "1f5a0fd7ce82333695a8cb30e0c61499",
"score": "0.635032",
"text": "def new\n @companyprofile = Companyprofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @companyprofile }\n end\n end",
"title": ""
}
] |
442ab6548b9448d5879b3539dec0f011
|
GET /ebooks GET /ebooks.json
|
[
{
"docid": "f6bd3a5b09390b0e33b1b782da693aa8",
"score": "0.0",
"text": "def index\n @ebooks = Ebook.order(\"lower(title)\")\n end",
"title": ""
}
] |
[
{
"docid": "7edce61de4899e8fb9c0b48af820391b",
"score": "0.69153565",
"text": "def index\n @notebooks = Notebook.all\n end",
"title": ""
},
{
"docid": "f4d045c1d882ddc1339a7c97bc909710",
"score": "0.6882247",
"text": "def index\n @ebooks = Ebook.all\n end",
"title": ""
},
{
"docid": "0dcef7df140be07467764e06d44a75c9",
"score": "0.6849716",
"text": "def index\n @books = get_books()\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "60973656e5d53c2355cc3aaa79804fee",
"score": "0.6809515",
"text": "def index\n render json: @books, status: 200\n end",
"title": ""
},
{
"docid": "ec8a6a39a665c3c0058cb986dea89ba0",
"score": "0.66280466",
"text": "def index\n render json: user_shelf.books\n end",
"title": ""
},
{
"docid": "acde8abc995158dc564219083d5a0e82",
"score": "0.6591215",
"text": "def query_notebooks\n Notebook.get(@user, q: params[:q], page: @page, sort: @sort, sort_dir: @sort_dir)\n end",
"title": ""
},
{
"docid": "f81846bd9be478d22a3e59736ba291fc",
"score": "0.65583676",
"text": "def list_notebooks\n noteStoreTransport = Thrift::HTTPClientTransport.new(@note_store_url)\n noteStoreProtocol = Thrift::BinaryProtocol.new(noteStoreTransport)\n noteStore = Evernote::EDAM::NoteStore::NoteStore::Client.new(noteStoreProtocol)\n noteStore.listNotebooks(@account.token)\n end",
"title": ""
},
{
"docid": "43ace69b1ac0ba0b7022de4e1678bbaf",
"score": "0.6557889",
"text": "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "43ace69b1ac0ba0b7022de4e1678bbaf",
"score": "0.6557889",
"text": "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "43ace69b1ac0ba0b7022de4e1678bbaf",
"score": "0.6557889",
"text": "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "4d76321d7f98df82813ba2a970ad84dd",
"score": "0.6519484",
"text": "def index\n @books = Book.all\n\n render json: @books\n end",
"title": ""
},
{
"docid": "c4746dc91005a0d372416b076d43946f",
"score": "0.6510324",
"text": "def index\n @books = Book.all\n render json: @books\n end",
"title": ""
},
{
"docid": "bcd63dc068e55cc931904e6ee3b36b6a",
"score": "0.64964134",
"text": "def query_notebooks\n Notebook.get(@user, q: params[:q], page: @page, per_page: @notebooks_per_page, sort: @sort, sort_dir: @sort_dir, use_admin: @use_admin, show_deprecated: params[:show_deprecated])\n end",
"title": ""
},
{
"docid": "ae11cce5c30a779517b6c6396f1e7de0",
"score": "0.6489392",
"text": "def index\n @lendbooks = Lendbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lendbooks }\n end\n end",
"title": ""
},
{
"docid": "3157cd94e85e2cabd8670d18164a06d0",
"score": "0.64853853",
"text": "def index\n # Show all notebooks of the current user with its notes\n @notebooks = current_user.notebooks\n end",
"title": ""
},
{
"docid": "c11298681f7cf213bcd7741df3ffbd12",
"score": "0.64575744",
"text": "def index\n @books = current_user.books\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "9542d20703ddf184e1ee152f0d078856",
"score": "0.6408683",
"text": "def index\n\t\t@title = \"Books\"\n\n\t\trespond_to do |format|\n\t\t\tformat.html {\n\n\t\t\t} \n\t\t\tformat.json {\n\t\t\t\t@books = Book.all\n\t\t\t}\n\t\t\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "cb4ed5eefdf1702a83001f8b236dabea",
"score": "0.63796395",
"text": "def show\n @books = Books.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @books }\n end\n end",
"title": ""
},
{
"docid": "ba4d17839772ee8313779df34de1c605",
"score": "0.6372108",
"text": "def index\n @bookshelves = Bookshelf.all\n end",
"title": ""
},
{
"docid": "81d60dd2c2fbb9ce3a2077389621438a",
"score": "0.6359282",
"text": "def index\n @books= Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "0d1b7818130fb2fb4b62ae5f1d1e258f",
"score": "0.63323903",
"text": "def index\n @evernote_notebook = EvernoteNotebook.find(1)\n if @evernote_notebook.blank?\n @evernote_notebook = EvernoteNotebook.new\n end\n\n # Set up the NoteStore client\n note_store = get_evernote_notestore\n\n # get evernote notebooks\n @notebooks = notebook_to_hash(note_store.listNotebooks)\n end",
"title": ""
},
{
"docid": "9efcb81c275a4694251e006109fd65c8",
"score": "0.63323677",
"text": "def index\n render json: Book.all\n end",
"title": ""
},
{
"docid": "810861458f2355273b599e4df8f29c8e",
"score": "0.63317674",
"text": "def show\n @notebook = Notebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notebook }\n end\n end",
"title": ""
},
{
"docid": "7c66a8ce83992634be7fae76447561c9",
"score": "0.6268474",
"text": "def listNotebooks\n\t\tputs \"authtoken is\" + session[:authtoken]\n\t\tputs \"***********\"\n\t\tputs EvernoteOAuth::Client.to_s\n\t\tputs \"*********\"\n\t\tclient = EvernoteOAuth::Client.new(consumer_key: \"mauriziocalo\", consumer_secret: \"406c3d9577c1de59\", token: session[:authtoken])\n\t note_store = client.note_store\n \t@notebooks = note_store.listNotebooks\n\n\tend",
"title": ""
},
{
"docid": "9a9df9e82ddf609202fdc1132b353719",
"score": "0.6190423",
"text": "def index\n\t\tkey = 'yElx2dvGSrA7utu7Gyx0Q'\n\t\tsecret = '7BHgX1AqLxtL5tUu70UAFoS3KCojwnSIez7tlk2fM'\n\n\t\tclient = Goodreads::Client.new(:api_key => key, :api_secret => secret)\n \t\t@books = client.search_books(params[:search]);\n @title = \"Browse Books\"\n\tend",
"title": ""
},
{
"docid": "4e178b40c1dcc1ef5fec101d9f7d0eda",
"score": "0.61809605",
"text": "def mybooks\n @mybooks = current_user.books\n @api = ENV['GOODREADS_KEY']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mybooks }\n end\n end",
"title": ""
},
{
"docid": "79e5092d02ff20a13281607fc63b91d9",
"score": "0.61659825",
"text": "def userebooks\r\n if params[:user_id] != nil\r\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\r\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\r\n id = User.find(params[:user_id]).id\r\n puts \"---------------------------------\"\r\n compras = Compra.all(:user_id == params[:user_id])\r\n #compras.each do |compra| \r\n puts compras\r\n # puts compra.user_id\r\n # puts compra.ebook_id\r\n puts \"---------------------------------\"\r\n #end\r\n\r\n array = []\r\n Ebook.find(Compra.where(:user_id == params[:user_id])) do |ebook|\r\n compras.each do |compra|\r\n if compra.ebook_id == ebook.id && compra.user_id == id\r\n array.push(ebook)\r\n end\r\n end \r\n puts ebook.titulo\r\n end\r\n \r\n @ebooks = array\r\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\r\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\r\n\r\n respond_to do |format|\r\n format.html # userebooks.html.erb\r\n format.json { render :json => @ebooks }\r\n end\r\n else\r\n @ebooks = Ebook.all\r\n \r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render :json => @ebooks }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "7e4343abaf36e23c9f20df39c8cef898",
"score": "0.6163541",
"text": "def index\n @biblebooks = Biblebook.all\n\n respond_to do |format|\n format.html\n format.json{ render json: @biblebooks, root: false}\n end\n end",
"title": ""
},
{
"docid": "b6363dc65eee6d7005fa955d75ba723e",
"score": "0.6151376",
"text": "def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { render :json => @books }\n end\n end",
"title": ""
},
{
"docid": "8de874563ae84684a70f98ce82406027",
"score": "0.61181355",
"text": "def fetch_books\n\t\t@response ||= HTTParty.get('https://www.googleapis.com/books/v1/volumes?filter=free-ebooks&q=a')\n\t\n\t\t@books ||= if @response.success?\n\t\t\tJSON.parse(@response.body)['items']\n\t\telse\n\t\t\t[] \n\t\tend\n\tend",
"title": ""
},
{
"docid": "d77c89ab36a5c3510d79dc4023aff7f3",
"score": "0.6098909",
"text": "def index\n @notes = @notebook.notes.all\n render json: @notes\n end",
"title": ""
},
{
"docid": "e9a7bd43cb4c9185592397564d857abd",
"score": "0.6095436",
"text": "def index\n if !params[:id].blank?\n @exercises = Exercise.find_all_by_book_id(params[:id])\n @book = Book.find(params[:id])\n elsif !params[:book_id].blank?\n @exercises = Exercise.find_all_by_book_id(params[:book_id])\n @book = Book.find(params[:book_id])\n elsif !params[:section_id].blank?\n @exercises = Exercise.find_all_by_section_id(params[:section_id])\n @section = Section.find(params[:section_id])\n else\n @exercises = Exercise.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"title": ""
},
{
"docid": "49abef20db0f0aecff520cfd28ebeac0",
"score": "0.608768",
"text": "def index\n # @books = Book.all\n @books = Book.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @books, status: :ok }\n end\n end",
"title": ""
},
{
"docid": "4c6054158e9ae2681e0129e9d30007e3",
"score": "0.6081136",
"text": "def show\r\n @ebook = Ebook.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @ebook }\r\n end\r\n end",
"title": ""
},
{
"docid": "34c6d0b6f32772ea8ae3e1ed3ffda201",
"score": "0.6054268",
"text": "def get_data_from_books_api\n input = get_user_input\n url_to_fetch = URL + input\n RestClient.get(url_to_fetch).body\nend",
"title": ""
},
{
"docid": "0e07bde530e5227b8b02e72c1fc83459",
"score": "0.6052225",
"text": "def readable_notebooks(page=1)\n Notebook.paginate(page: page, per_page: @per_page).readable_by(self)\n end",
"title": ""
},
{
"docid": "0e07bde530e5227b8b02e72c1fc83459",
"score": "0.6052225",
"text": "def readable_notebooks(page=1)\n Notebook.paginate(page: page, per_page: @per_page).readable_by(self)\n end",
"title": ""
},
{
"docid": "aab5f7faaf84eb03755f409de455fbf9",
"score": "0.60484767",
"text": "def show\n @booksale = Booksale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @booksale }\n end\n end",
"title": ""
},
{
"docid": "6fbeb5d969a27a3a4f8b940b4a708a66",
"score": "0.6036547",
"text": "def index\n @user = User.find(session[:userId])\n @books = @user.books\n puts \"Libros de #{@user.username} #{@user.id} #{@user.books}\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end",
"title": ""
},
{
"docid": "4031b4827738557a134b75d4e445eff0",
"score": "0.6033727",
"text": "def index\n @ibook = Ibook.new\n #current user is publisher\n if (current_user && current_user.is?(\"ECP\"))\n @ibooks = current_user.ibooks.desc\n @ipacks = current_user.ipacks\n else\n # This will be the books info hash provided as a response to api call for the user's books\n edutorid = params[\"edutorid\"]\n @ibooks = User.where(:edutorid => edutorid).first.license_sets.map { |ls| ls.ipack.ibooks }.flatten.compact\n end\n respond_to do |format|\n format.html\n # This will be response to API call for the user's books\n format.json { render json: @ibooks.map { |ibook| ibook.book_info_for_user } }\n end\n end",
"title": ""
},
{
"docid": "7feb7e2bc1e9aadb79732ea0586a7641",
"score": "0.59948957",
"text": "def index\n @structures = Structure.find_all_by_book_id(params[:book_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @structures }\n end\n end",
"title": ""
},
{
"docid": "86d335b18c32ce6adf4ab36eabdeefdb",
"score": "0.59892714",
"text": "def index\n @apresentacao_ebooks = ApresentacaoEbook.all\n end",
"title": ""
},
{
"docid": "d96e65789df2ec27a6610ba0eb68fd21",
"score": "0.59745693",
"text": "def index\n #Pagination\n #books= Book.all\n books= Book.limit(limit).offset(params[:offset])\n #Representer to format the response\n render json: BooksRepresenter.new(books).as_json\n #render json: Book.all\n end",
"title": ""
},
{
"docid": "17b6fc22debd82176b715656f5a068a3",
"score": "0.5948841",
"text": "def show\n render json: book\n end",
"title": ""
},
{
"docid": "ad93012f460fe02f9328a1635287d83e",
"score": "0.59482586",
"text": "def index\n documentaries = Documentary.all\n json_response(documentaries)\n end",
"title": ""
},
{
"docid": "1568187e2ce23daaff3e3fa8b499f291",
"score": "0.5946327",
"text": "def show\n render json: @book\n end",
"title": ""
},
{
"docid": "617fad8de8c962f364e823b123990071",
"score": "0.5941439",
"text": "def show\n @notebooks = query_notebooks\n .joins('LEFT OUTER JOIN tags ON notebooks.id = tags.notebook_id')\n .where('tags.tag = ?', @tag.tag_text)\n @notebooks = @notebooks.where(\"deprecated=False\") unless (params[:show_deprecated] && params[:show_deprecated] == \"true\")\n respond_to do |format|\n format.html\n format.json {render 'notebooks/index'}\n format.rss {render 'notebooks/index'}\n end\n end",
"title": ""
},
{
"docid": "cf2244fc39abad20d3735536d24f7f89",
"score": "0.5936532",
"text": "def show\n @books_on_loan = BooksOnLoan.find(params[:id])\n respond_to do |format|\n format.json { render json: @books_on_loan }\n end\n end",
"title": ""
},
{
"docid": "37a49fb6535493306a078a4a6f8e15d4",
"score": "0.5924242",
"text": "def index\n # raise Book.search(params[:q])\n respond_to do |format|\n format.html{@books = Book.ordering.page(params[:page])}\n format.json{\n @books = Book.search(params[:q])\n }\n end\n end",
"title": ""
},
{
"docid": "612d2e738bb31e6ecf0593d0bf059aea",
"score": "0.59225166",
"text": "def notebooks_info\n @notebooks = @user.notebooks\n end",
"title": ""
},
{
"docid": "41f6b6c03821ea3e021464c68aa3a3d0",
"score": "0.592131",
"text": "def show\n render json: @book\n end",
"title": ""
},
{
"docid": "7e9c2518444f619f39e56a5c621968f6",
"score": "0.5889428",
"text": "def index\n if params[:book_id].blank? && params[:id].blank?\n @sections = Section.all\n else\n book_id = params[:id] ? params[:id] : params[:book_id]\n @sections = Section.find_all_by_book_id(book_id)\n @book = Book.find(book_id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end",
"title": ""
},
{
"docid": "34373f4bd33d9ed40691004a8d32666b",
"score": "0.5885926",
"text": "def index\n @books = @list.books\n end",
"title": ""
},
{
"docid": "93d7b36794b96380caa881cc274f58ea",
"score": "0.5881302",
"text": "def show\n render json: MangaBookshelf.find_shelves(params[:id])\n end",
"title": ""
},
{
"docid": "533a4a146243d14773c0defd340b7a54",
"score": "0.58756065",
"text": "def index\n @bibliotecas = Biblioteca.all\n\n respond_to do |format|\n format.html # index11.html.erb\n format.json { render json: @bibliotecas }\n end\n end",
"title": ""
},
{
"docid": "2e309cd1826f323d1973d711d8333431",
"score": "0.58740795",
"text": "def index\n @recipes = Recipe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"title": ""
},
{
"docid": "2e309cd1826f323d1973d711d8333431",
"score": "0.58740795",
"text": "def index\n @recipes = Recipe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"title": ""
},
{
"docid": "2e309cd1826f323d1973d711d8333431",
"score": "0.58740795",
"text": "def index\n @recipes = Recipe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"title": ""
},
{
"docid": "52194eb6deef1572c0f64bf1af13a979",
"score": "0.58707803",
"text": "def index\n @request_books = RequestBook.all\n end",
"title": ""
},
{
"docid": "03d5ed4f076372e8be0a6ae33cb75d4d",
"score": "0.58623",
"text": "def index\n @readers = Reader.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @readers }\n end\n end",
"title": ""
},
{
"docid": "d1fd32b0d2642c306cd77314c993580b",
"score": "0.58610886",
"text": "def index\n \t#find just the books that is saved in user preferences\n @books = current_user.books.all\n\t\trespond_with(@books)\n end",
"title": ""
},
{
"docid": "068461f912e8021968c95f90458db1f9",
"score": "0.58255327",
"text": "def index\n @examples = Example.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"title": ""
},
{
"docid": "4931a53e839e152f6f302685a9f8bb64",
"score": "0.5822044",
"text": "def book\n render :json => Book.find(params[:id]).to_json\n end",
"title": ""
},
{
"docid": "14b64b552e7b629e064355c51460672f",
"score": "0.58219016",
"text": "def index\n @collections = @book_series.collections\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end",
"title": ""
},
{
"docid": "05c2bfef13aa0e26b0dc385d7920a277",
"score": "0.58133006",
"text": "def index\n # @books = Book.all\n @books = Book.paginate(:page => params[:page], :per_page=>10)\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render :json => @books}\n format.json { render :json => BooksDatatable.new(view_context)}\n end\n end",
"title": ""
},
{
"docid": "4b62a803083c6274998f54f563e45e18",
"score": "0.58115983",
"text": "def index\n @provided_books = ProvidedBook.all\n end",
"title": ""
},
{
"docid": "85c6993dd1b60b9c2cd1a92c49c7aecb",
"score": "0.5810931",
"text": "def index\n @scrapbooks = Scrapbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scrapbooks }\n end\n end",
"title": ""
},
{
"docid": "bdb6e9f3c7181fc4d1632af9a7cfe60e",
"score": "0.5801891",
"text": "def show\n @cookbook = Cookbook.find_by!(name: params[:cookbook])\n cookbook_versions = @cookbook.cookbook_versions\n @cookbook_versions_urls = cookbook_versions.map do |version|\n api_v1_cookbook_version_url(@cookbook, version)\n end\n\n @latest_cookbook_version = @cookbook.get_version!('latest')\n @latest_cookbook_version_url = api_v1_cookbook_version_url(@cookbook, @latest_cookbook_version)\n end",
"title": ""
},
{
"docid": "91cc7bc46c135d94befc227f6ec402fb",
"score": "0.578916",
"text": "def show\n @workbook = Workbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @workbook }\n end\n end",
"title": ""
},
{
"docid": "adb456ee289a9308495146b19584c8a0",
"score": "0.57859635",
"text": "def index\n @recipes = Recipe.all\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipes }\n end\n end",
"title": ""
},
{
"docid": "d4d00a84e68cd58c3b624d24af478925",
"score": "0.57831603",
"text": "def index\n @api_books = Api::Book.all.page(params[:page]).per(100)\n end",
"title": ""
},
{
"docid": "712e8bb3b34421835d881db56bcd551c",
"score": "0.5772331",
"text": "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "712e8bb3b34421835d881db56bcd551c",
"score": "0.5772331",
"text": "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "459f0e16747f137b042efb3944079c11",
"score": "0.5770966",
"text": "def index\n @books = Book.order(title: :desc)\n render json: @books\n end",
"title": ""
},
{
"docid": "5e2c42bea4167d9b50652ab6a4903b76",
"score": "0.576717",
"text": "def fetch_books(search_term)\n\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\")\n JSON.parse(response)\nend",
"title": ""
},
{
"docid": "3d2d3e1a102aa64d4a392b701004a710",
"score": "0.5765217",
"text": "def index\n render json: recipes\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "1b276a43a594c4c9abcdd87ac59948ee",
"score": "0.5764428",
"text": "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end",
"title": ""
},
{
"docid": "b700aa8755296049766480b9c640fd4a",
"score": "0.5762141",
"text": "def index\n @books = Book.limit(100).order(:id)\n render json: {status: 'SUCCESS', message: 'Loaded all books', data: @books}, status: :ok\n end",
"title": ""
},
{
"docid": "ea3900512de589a1484fdaeb70d7bf8a",
"score": "0.57595867",
"text": "def index\n @recordbooks = Recordbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recordbooks }\n end\n end",
"title": ""
},
{
"docid": "9264c6d4d9233458b06fef3a820b9b80",
"score": "0.5747211",
"text": "def show\n @books = HTTParty.get \"https://www.googleapis.com/books/v1/volumes?q=#{CityPage.find(params[:id]).city}+expats&key=AIzaSyBi-ieqecE99YvszjWHBtq_eZORbhN-8HQ\"\n @books = JSON.parse @books.body\n p @books[\"items\"][0][\"accessInfo\"][\"webReaderLink\"]\n @books_all = [@books[\"items\"][0],\n @books[\"items\"][1],\n @books[\"items\"][2]\n ]\n\n end",
"title": ""
},
{
"docid": "c1748921c7c0fdb4e337f8b86a3ff798",
"score": "0.57427406",
"text": "def index\n @absences = @employee.absences\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absences }\n end\n end",
"title": ""
},
{
"docid": "1cf7ee6d1060b494988c84b2b11ef5bb",
"score": "0.5742012",
"text": "def index\n @books = Book.order('id desc')\n if request.xhr?\n @books = Book.where(\"name like ?\",\"%#{params[:term]}%\")\n end\n respond_to do |format|\n format.html # index.html.erb\n unless request.xhr?\n format.json { render json: @books }\n else\n format.json { render json: @books.map{|d| Hash[id: d.id,name: d.name]} }\n end\n\n end\n end",
"title": ""
},
{
"docid": "495614be4116ad49a0e386af43db0332",
"score": "0.57399976",
"text": "def index\n @books = Book.all\n end",
"title": ""
},
{
"docid": "7739a3019781e3c211f95fbb44941d4c",
"score": "0.5739211",
"text": "def show\n @author = Author.find(params[:id])\n @books = @author.books\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @author }\n end\n end",
"title": ""
},
{
"docid": "b6dc4e3004aa60c83df7d15875732abe",
"score": "0.57385105",
"text": "def index\n @handbook_document_marks = HandbookDocumentMark.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @handbook_document_marks }\n end\n end",
"title": ""
},
{
"docid": "d859d7cadbbc11c45dab4669d2dc30e4",
"score": "0.573696",
"text": "def index\n @book_lists = BookList.all\n respond_to :html, :json\n end",
"title": ""
},
{
"docid": "4c214c7e8f52caafbd7623a79d621928",
"score": "0.57253706",
"text": "def show\n @ibook = Ibook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ibook }\n end\n end",
"title": ""
},
{
"docid": "140e11a601be50b6d5597151fb82a0f2",
"score": "0.5716868",
"text": "def index\n @ai_books = AiBook.all\n end",
"title": ""
},
{
"docid": "6d79bc24cf5d3b5e22861f58062e1ad3",
"score": "0.5711012",
"text": "def list_books\n @books.each { |book| puts book.title + \" by \" + book.author + \" is \" + book.status + \".\" }\n end",
"title": ""
},
{
"docid": "c39f6e95684c58303b9447c04498e57c",
"score": "0.57105213",
"text": "def list\n @books = Book.all\n end",
"title": ""
},
{
"docid": "4ed50a9dcfbae49fd9b418521674dff1",
"score": "0.57041913",
"text": "def show \n @book = Book.find_by(id: params[:id])\n render json: @book\n\n end",
"title": ""
}
] |
f319f9979b80036d70bb8c195db468db
|
POST /raids POST /raids.xml
|
[
{
"docid": "f13e214e780cfb547e44d8ff47a7d76f",
"score": "0.55009556",
"text": "def create\n\n respond_to do |format|\n if @raid.save\n flash[:notice] = 'Raid was successfully created.'\n format.html { redirect_to(\"/guilds/#{@raid.guild.id}/raids/#{@raid.id}\") }\n format.xml { render :xml => @raid, :status => :created, :location => @raid }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raid.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "2ab02907526d738c4dacf3205469e8a4",
"score": "0.5542402",
"text": "def do_post(host, port)\r\n\tverb = \"POST\"\r\n\treq_URI = \"/raiders\"\r\n\tversion = \"HTTP/1.1\"\r\n\traider = get_raider_info\r\n\trequest = \"#{verb} #{req_URI} #{version}\\r\\n\"\r\n\tresponse = post_request(host, port, request, raider)\r\nend",
"title": ""
},
{
"docid": "f6d5c13c29e0033bf0c138b234d06cbd",
"score": "0.5457819",
"text": "def create\n @going_to_raid = current_user.going_to_raids.build(going_to_raid_params)\n\n respond_to do |format|\n if @going_to_raid.save\n format.html { redirect_to @going_to_raid, notice: 'Going to raid was successfully created.' }\n format.json { render :show, status: :created, location: @going_to_raid }\n else\n format.html { render :new }\n format.json { render json: @going_to_raid.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a55ed7fd45abed92bad155b588e2266b",
"score": "0.54469484",
"text": "def create\n @iqra_rastee = IqraRastee.new(iqra_rastee_params)\n\n respond_to do |format|\n if @iqra_rastee.save\n format.html { redirect_to @iqra_rastee, notice: 'Iqra rastee was successfully created.' }\n format.json { render :show, status: :created, location: @iqra_rastee }\n else\n format.html { render :new }\n format.json { render json: @iqra_rastee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e26c01a4a7b96a8f18b8f69de2aff0b0",
"score": "0.5394997",
"text": "def create\n @plan_raid = current_user.plan_raids.build(plan_raid_params)\n\n respond_to do |format|\n if @plan_raid.save\n format.html { redirect_to :controller => 'going_to_raids', :action => 'new', :plan_raid_id => @plan_raid, notice: 'Created'}\n format.json { render :show, status: :created, location: @plan_raid }\n else\n format.html { render :new }\n format.json { render json: @plan_raid.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d50e28e4b1caceb4efa8667b52752414",
"score": "0.53156185",
"text": "def create\n @raid = @city.raids.build(raid_params)\n\n respond_to do |format|\n if @raid.save\n format.html { redirect_to [:raiding, @player], notice: 'Raid was successfully created.' }\n format.json { render :show, status: :created, location: [@player, @city] }\n else\n format.html { render :new }\n format.json { render json: @raid.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "adbd4063f9795c23205a346f6dfd3f22",
"score": "0.53065753",
"text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end",
"title": ""
},
{
"docid": "f1e8fa0a4311e37792f27da17b730c04",
"score": "0.5302119",
"text": "def create_list(params = {})\n url = \"#{ENV['MAILTRAIN_API_ENDPOINT']}/list?access_token=#{ENV['MAILTRAIN_API_TOKEN']}\"\n RestClient::Request.execute(\n method: :post,\n url: url,\n payload: params,\n headers: {\n accept: :json,\n params: params\n }\n ) do |response, request, result, block|\n case response.code\n when 200\n JSON.parse(response)['data']['id']\n else\n response.return!(&block)\n end\n end\n rescue => e\n Raven.capture_exception(e)\n end",
"title": ""
},
{
"docid": "3a166285a48f965d07c29b33917c087b",
"score": "0.5265468",
"text": "def scan_create(uuid, pid, name, targets)\n payload = {\n :uuid => uuid, \n :settings => {\n :policy_id => pid, \n :name => name,\n #:description => description, \n :use_dashboard => \"true\",\n :text_targets => targets,\n },\n :json => 1\n }.to_json\n http_post(:uri=>\"/scans\", :body=>payload, :fields=>x_cookie, :ctype=>'application/json')\n end",
"title": ""
},
{
"docid": "ef7a0dc0d08131eec75efa34c426c783",
"score": "0.5205067",
"text": "def post_reports(request)\n yaml = request.body.read\n report = PuppetHerald::Models::Report.create_from_yaml yaml\n body = { id: report.id }.to_json\n [201, body]\n end",
"title": ""
},
{
"docid": "cff34b1b6bf7ff5f449ae7e50db8ee7c",
"score": "0.51831424",
"text": "def post(*a) route 'POST', *a end",
"title": ""
},
{
"docid": "a318fea357a4f157da49db8a2440f565",
"score": "0.5182663",
"text": "def create\n RestClient.post \"#{@uri}/api/requests\", @data.to_json, :content_type => :json\n end",
"title": ""
},
{
"docid": "fd5469d0152ed1d73b3cd59fb8b12a07",
"score": "0.5166813",
"text": "def post *args\n make_request :post, *args\n end",
"title": ""
},
{
"docid": "f8a83a1f02ff662cc8dd0ad2b34f95f2",
"score": "0.51603884",
"text": "def post_request\n return \"204\" if self.suppressed?\n uri = URI.parse(\"#{self.base_request_url}/patrons/#{self.patron_id}/holds/requests\")\n\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Authorization\"] = \"Bearer #{self.bearer}\"\n\n request.body = JSON.dump({\n \"recordType\" => \"i\", #TODO: This may change at a later date, but for now we are only doing item requests. KAK.\n \"recordNumber\" => self.record_number.to_i,\n \"pickupLocation\" => self.pickup_location\n })\n $logger.debug \"Posting hold-request: #{request.body} to #{uri}\"\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n read_timeout: 10\n }\n\n begin\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n rescue Exception => e\n $logger.error \"Sierra post_request error: #{e.message}\"\n response = TimeoutResponse.new\n end\n\n $logger.debug \"Sierra Post request response code: #{response.code}, response: #{response.body}\"\n response # returns empty content, either code 204 if success, 404 if not found, or 500 if error, so passing code along.\n end",
"title": ""
},
{
"docid": "c9dfb86c3fcd88fd115da9b748fc603f",
"score": "0.51302534",
"text": "def create\n @raid = Raid.new(raid_params)\n\n if @raid.save\n flash[:notice] = 'Raid was successfully created.'\n respond_with @raid\n else\n render action: :new\n end\n end",
"title": ""
},
{
"docid": "758df64a1cc767959613df5889931e06",
"score": "0.5128105",
"text": "def index\n @raids = Raid.by_date(params[:raid_date]).by_raid_type(params[:raid_type])\n respond_with @raids\n end",
"title": ""
},
{
"docid": "ff64f712ca5c171b73151901dc47c4f6",
"score": "0.511187",
"text": "def postRequest\n assertRequestData\n assertRequestType\n req = Net::HTTP::Post.new(@uri.request_uri)\n req.add_field('Content-Type', 'text/xml')\n req.body = buildXmlRequest\n @response = sendRequest(req)\n return @response\n end",
"title": ""
},
{
"docid": "4f9a11c17d80e023c89772d2e285058c",
"score": "0.5067072",
"text": "def attend\n @rvsp = Rvsp.find_by_activity_id_and_user_id(params[:activity_id], params[:user_id])\n @rvsp.rvsp_status_id = 1\n activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @rvsp.save\n format.json { render :json => generate_json(activity) }\n format.html { redirect_to(:activities, :notice => \"Du er anmld till trningen\") }\n format.xml { render :xml => @rvsp, :status => :attending, :location => :activities }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @rvsp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "613f348b9f3803cab5765e774687faa9",
"score": "0.5001966",
"text": "def create\n @servernode = Servernode.create(servernode_params)\n p = {:servernode => {:name => params[:servernode][:name],\n :status => params[:servernode][:status]}}\n RestClient.post('http://localhost:3000/servernodes',p)\n redirect_to submitforms_path\n end",
"title": ""
},
{
"docid": "75f414341f97103912f767088944b5fb",
"score": "0.49974993",
"text": "def create\n @raider = Raider.new(raider_params)\n\n respond_to do |format|\n if @raider.save\n format.html { redirect_to @raider, notice: 'Raider was successfully created.' }\n format.json { render :show, status: :created, location: @raider }\n else\n format.html { render :new }\n format.json { render json: @raider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6bbbd80a31d000341482179d6c92328d",
"score": "0.49963745",
"text": "def create\n recieve_xml\n end",
"title": ""
},
{
"docid": "727b6e8c60925055bba528512a36c4f0",
"score": "0.49960956",
"text": "def create\n \n current_user.readings.create(:listing_id => params[:listing_id])\n respond_to do |format|\n #need to call create on a listing to increment counter\n format.xml { head :ok }\n end\n \n end",
"title": ""
},
{
"docid": "2433a30ce50fb6a6590a3cd6979725dd",
"score": "0.49839836",
"text": "def index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end",
"title": ""
},
{
"docid": "493bc1894bb343812f30a17b17d08b6e",
"score": "0.49681586",
"text": "def create\n @attendance = Attendance.new(params[:attendance])\n\n respond_to do |format|\n if @attendance.save\n RsvpNotifier.created(@attendance).deliver\n format.html { redirect_to @attendance, :notice => 'RSVP was successfully created.' }\n format.json { render :json => @attendance, :status => :created, :location => @attendance }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @attendance.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d45aecbb19ebf32293139ebe0c7ac83f",
"score": "0.49638247",
"text": "def create(id, member=\"Defaut member\", rating=\"9\", venue_Name=\"Default Venue_Name\", address=\"Default Address\", city=\"Default City\", phone=\"9999999999\" , date=\"\" , comment= \"Default Comment\" )\r\n\r\n\t\txml_req =\t\t\r\n\t\t\t\"<?xml version='1.0' encoding='UTF-8'?>\r\n\t\t\t<review>\r\n\t\t\t\t<Member>#{member}</Member>\r\n\t\t\t\t<Rating>#{rating}</Rating>\r\n\t\t\t\t<Venue-Name>#{venue_Name}</Venue-Name>\r\n\t\t\t\t<Address>#{address}</Address>\r\n\t\t\t\t<City>#{city}</City>\r\n\t\t\t\t<Phone>#{phone}</Phone>\t\t\t\t\r\n\t\t\t\t<Date-of-Visit>date</Date-of-Visit>\r\n\t\t\t\t<Comment>#{comment}</Comment>\t\t\t\t\t\r\n\t\t\t</review>\"\r\n\r\n\t\trequest = Net::HTTP::Post.new(@url)\r\n\t\trequest.add_field \"Content-Type\",\"application/xml\"\r\n\t\trequest.body = xml_req\r\n\r\n\t\thttp = Net::HTTP.new(@uri.host, @uri.port)\r\n\t\tresponse = http.request(request)\r\n\r\n\t\tresponse.body\r\n\tend",
"title": ""
},
{
"docid": "ff0e7431cc4e94a0c35add655d2a0ac4",
"score": "0.49634114",
"text": "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"title": ""
},
{
"docid": "040b1dcc9c0431f2a79f0e6876ea2be5",
"score": "0.49514577",
"text": "def post( path, body = nil )\n body ? length = body.length.to_s : length = '0' \n parse( @access_token.post( DOSSIA_URL + '/dossia-restful-api/services/v3.0' + path, body, { 'Content-Type' => 'application/xml', 'Content-Length' => length } ) )\n end",
"title": ""
},
{
"docid": "3b2cad18ba4eed2a0fbd6f9e0304fc0c",
"score": "0.49506685",
"text": "def add_client_to_harvest(area_name)\nstr = <<EOS\n <client>\n <name>#{area_name}</name>\n <details></details>\n </client> \nEOS\n response = @harvest.request '/clients', :post, str\n define_harvest_clients\n end",
"title": ""
},
{
"docid": "33b3b3ef86060efd1797d50397fa49c8",
"score": "0.494529",
"text": "def do_POST(req, res)\n domain, resource, id, format = parse_request_path(req.path_info)\n attributes = from_xml(resource, req.body)\n attributes['id'] = generate_id(req.body)\n attributes['created-at'] = attributes['updated-at'] = Time.now.iso8601\n\n logger.debug \"Creating item with attributes: #{attributes.inspect}\"\n sdb_put_item(domain, attributes, false)\n\n res.body = to_xml(resource, attributes)\n res['location'] = \"/#{domain}/#{resource}/#{id}.#{format}\"\n res['Content-Type'] = \"application/xml\"\n raise WEBrick::HTTPStatus::Created\n end",
"title": ""
},
{
"docid": "5d9d2e6c7dd27abbd7d48991b484f4a6",
"score": "0.4935535",
"text": "def post(uri, options = {})\n request :post, options\n end",
"title": ""
},
{
"docid": "4db6f90d6540c3f3223d8c7f7a785b9e",
"score": "0.49337575",
"text": "def create\n #RAILS_DEFAULT_LOGGER.debug(\"******** REST Call to CRMS: Creating #{self.class.name}:#{self.id}\")\n #RAILS_DEFAULT_LOGGER.debug(caller[0..5].join(\"\\n\"))\n response = connection.post(collection_path, to_xml, self.class.headers)\n self.id = id_from_response(response) \n save_nested\n load_attributes_from_response(response)\n merge_saved_nested_resources_into_attributes\n response\n end",
"title": ""
},
{
"docid": "aa90f75b683a380a5fd7224733afbf5e",
"score": "0.49307713",
"text": "def create(name=\"Default Name\", published=\"false\", genre=\"music\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <timeline>\r\n <published type='string'>#{published}</published>\r\n <description>#{name}</description>\r\n <genre>#{genre}</genre>\r\n </timeline>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n \r\n response.body \r\n end",
"title": ""
},
{
"docid": "1ca5f2c21af5ddfbbcd53b4ca31817a0",
"score": "0.4924391",
"text": "def post(*args)\n request :post, *args\n end",
"title": ""
},
{
"docid": "8c7321f93ffee4fe968c96acb9907088",
"score": "0.4922537",
"text": "def create\n @raider = Raider.new(raider_params)\n\n respond_to do |format|\n if @raider.save\n @raider.visits << Visit.new(date: Date.today)\n format.html { redirect_to root_url, notice: \"Okay #{@raider.name}, you have successfully registered. Go ride!\" }\n format.json { render :show, status: :created, location: @raider }\n else\n format.html { render :new }\n format.json { render json: @raider.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fbb8eed4a1128b41f019a73a6f70bf18",
"score": "0.49043337",
"text": "def create\n @rider_registration = RiderRegistration.new\n @rider_registration.rider_id = session[:rider]\n p = params[:rider_registration][:entry_ids]\n p ||= []\n entries=p.reject {|e| e.empty?}\n RiderRegistration.transaction do\n entries.each do |i|\n e = Entry.new(:rider_registration_id => @rider_registration.id, :race_id => i, :number => Race.find(i).next_rider_number)\n e.save!\n end\n\n respond_to do |format|\n if @rider_registration.save\n format.html { redirect_to @rider_registration, notice: 'Rider registered.' }\n format.json { render json: @rider_registration, status: :created, location: @rider_registration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rider_registration.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "d9b404c9747534beb653f54c4d90af88",
"score": "0.4903964",
"text": "def submit(stanza)\n @service.context.post(@path, stanza, {})\n end",
"title": ""
},
{
"docid": "fab0b61d59635c6c7ed84df1765a31b4",
"score": "0.4898622",
"text": "def future_reservations\n method = \"futureReservations\"\n post_request(method)\n end",
"title": ""
},
{
"docid": "fab0b61d59635c6c7ed84df1765a31b4",
"score": "0.4898622",
"text": "def future_reservations\n method = \"futureReservations\"\n post_request(method)\n end",
"title": ""
},
{
"docid": "754afec1cfc980bbacbc4bcc552cc892",
"score": "0.48985025",
"text": "def create\n @raum = Raum.new(params[:raum])\n\n respond_to do |format|\n if @raum.save\n format.html { redirect_to @raum, notice: 'Raum was successfully created.' }\n format.json { render json: @raum, status: :created, location: @raum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @raum.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ad9ec5f640494901bf4c38728acc5951",
"score": "0.48983768",
"text": "def send(xml)\n if !@sid\n response = Nokogiri::XML::Document.parse(post(xml.root.to_xml)).root\n else\n body = <<-EOXML\n <body rid='#{@rid}'\n sid='#{@sid}'\n xmlns='http://jabber.org/protocol/httpbind'>\n EOXML\n doc = Nokogiri::XML::Document.parse(body)\n doc.root.add_child(xml.root) if xml.root\n response = Nokogiri::XML::Document.parse(post(doc.root.to_xml)).root.children.first\n @rid += 1\n end\n response\n end",
"title": ""
},
{
"docid": "80f062d71acf7d40fe3841fb694377e0",
"score": "0.48853448",
"text": "def iqra_rastee_params\n params[:iqra_rastee]\n end",
"title": ""
},
{
"docid": "e7cd29059bc807fa2379f0c3b113b2aa",
"score": "0.48800153",
"text": "def create\n @locations = Location.where(\"status <> 'NORMAL'\").order(\"state, township desc\")\n @aid_request = AidRequest.new(aid_request_params)\n @aid_request.code = SecureRandom.hex(3).to_s.upcase.insert(3,\"-\").insert(0,\"R-\")\n\n respond_to do |format|\n if @aid_request.save\n format.html { redirect_to @aid_request, notice: 'Aid request was successfully created.' }\n format.json { render :show, status: :created, location: @aid_request }\n else\n format.html { render :new }\n format.json { render json: @aid_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb2ed4fc95d8a7570b83eddf25a62e4e",
"score": "0.4879503",
"text": "def create\n @rid = Rid.new(params[:rid])\n\n respond_to do |format|\n if @rid.save\n RidsShort.create(rid_id: @rid.id)\n format.html { redirect_to @rid, notice: 'Rid was successfully created.' }\n format.json { render json: @rid, status: :created, location: @rid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rid.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8eace452ebdf95cec8f8a2225b2e1bf2",
"score": "0.4862926",
"text": "def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"title": ""
},
{
"docid": "34e1e4b50caf23220a711ec281f6e6d6",
"score": "0.4860219",
"text": "def create\n @rast = Rast.new(rast_params)\n\n respond_to do |format|\n if @rast.save\n format.html { redirect_to @rast, notice: 'Rast was successfully created.' }\n format.json { render :show, status: :created, location: @rast }\n else\n format.html { render :new }\n format.json { render json: @rast.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6e1d3c2ae441154877bcda9543a80bf3",
"score": "0.48522305",
"text": "def submit(event, args={})\n args[:index] = @name\n @service.request(:method => :POST,\n :resource => [\"receivers\", \"simple\"],\n :query => args,\n :body => event)\n return self\n end",
"title": ""
},
{
"docid": "5df4e2e3cca954116556cd841f113b05",
"score": "0.48480457",
"text": "def post(uri, options = {})\n request :post, uri, options\n end",
"title": ""
},
{
"docid": "5df4e2e3cca954116556cd841f113b05",
"score": "0.48480457",
"text": "def post(uri, options = {})\n request :post, uri, options\n end",
"title": ""
},
{
"docid": "df0b89721aa1e8aa4f619d4260f8141b",
"score": "0.48331907",
"text": "def index\n @raids = @city.raids\n end",
"title": ""
},
{
"docid": "e4a426cba6279943a4b653c8f656441c",
"score": "0.48319867",
"text": "def create\n @spot_raid = current_user.spot_raids.build(spot_raid_params)\n\n respond_to do |format|\n if @spot_raid.save\n # format.js was ised for AJAX\n format.html { redirect_to @spot_raid, notice: 'Spot raid was successfully created.' }\n format.json { render :show, status: :created, location: @spot_raid }\n else\n format.html { render :new }\n format.json { render json: @spot_raid.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "05491c94a8f78da370f94c63a6fa4500",
"score": "0.48186135",
"text": "def destroy\n @raid.destroy\n\n respond_to do |format|\n format.html { redirect_to(raids_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cb4367701293151c3e552d5710d2f4f7",
"score": "0.48096073",
"text": "def new\n @bid = @swarm_request.bids.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end",
"title": ""
},
{
"docid": "afb17ed9b908a26b47a512c0f4fd67ca",
"score": "0.48089135",
"text": "def send_create_post(json)\n uri = URI.parse(\"https://services6.arcgis.com/QKzAuFxgK44hIfg6/ArcGIS/rest/services/Trash_Logger/FeatureServer/0/applyEdits\")\n res=Net::HTTP.post_form(uri, 'f' => 'json', 'adds' => json.to_json)\n\n raise \"Error: Failed POST to arcgis for trash logger: #{res.body}\" if !res.is_a?(Net::HTTPSuccess)\n # finds the object id from the return from arcgis\n res_json=JSON.parse(res.body)\n Rails.logger.debug \"arcgis CREATE POST for trash logger successful\"\n id=res_json[\"addResults\"][0][\"objectId\"]\n end",
"title": ""
},
{
"docid": "e86811de58f0f456d94aee3f94dc0c62",
"score": "0.48088688",
"text": "def create\n @attendance = Attendance.new(params[:attendance])\n\n respond_to do |format|\n if @attendance.save\n flash[:notice] = 'Attendance was successfully created.'\n format.html { redirect_to_target_or_default(@attendance.raid) }\n format.xml { render :xml => @attendance, :status => :created, :location => @attendance }\n else\n format.html { render :controller => \"raid\", :action => \"show\", :id => @attendance.raid.id }\n format.xml { render :xml => @attendance.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9e751a0e32ff90137b37857a9bc99c0",
"score": "0.48064336",
"text": "def post_for_twiml!(path, digits = \"\", is_machine = false)\n @current_path = normalize_redirect_path(path)\n\n # Post the query\n rack_test_session_wrapper = Capybara.current_session.driver \n @response = rack_test_session_wrapper.post(@current_path, \n :format => :xml, \n :CallSid => @root_call.sid, \n :Digits => digits, \n :From => @root_call.from_number, \n :To => @root_call.to_number,\n :AnsweredBy => (is_machine ? \"machine\" : \"human\")\n )\n\n # All Twilio responses must be a success.\n raise \"Bad response: #{@response.status}\" unless @response.status == 200 \n\n # Load the xml\n data = @response.body\n @response_xml = Nokogiri::XML.parse(data) \n set_xml(@response_xml.at_xpath(\"Response\"))\n end",
"title": ""
},
{
"docid": "344f866b56c0ef9541fb58f6de2efbb2",
"score": "0.48006037",
"text": "def create_xmlrpc\n xml = request.body.read\n \n if(xml.empty?)\n error = 400\n return\n end\n \n # Parse xml\n method, arguments = XMLRPC::Marshal.load_call(xml)\n arg = arguments[0]\n response = create_report(arg)\n \n redirect_to retrieve_response_url(iform_xml_feed, :format => 'xml') \n end",
"title": ""
},
{
"docid": "6a0cce2549ec9dbb5feed8963046cbf5",
"score": "0.47977293",
"text": "def post(path, attributes)\n resp = token.post(prefix + path, attributes.to_json, HEADERS)\n end",
"title": ""
},
{
"docid": "2ec6d383425818924e36407f7c79e996",
"score": "0.47962636",
"text": "def add(name, *args)\n# puts \"the home number is \" +args[0]\n home_number = args[0]\n office_number = args[1]\n options = {:body => {:card => \n { :name => name, \n :home_phone => home_number,\n :office_phone => office_number}}}\n self.class.post(\"/cards.xml\",options) #:action => \"create\"\n end",
"title": ""
},
{
"docid": "f3fb316ec3c31d2939c79200d4c80273",
"score": "0.47850218",
"text": "def create(attrs = nil)\n content_type = { \"Content-Type\" => \"application/vnd.ims.lis.v2.lineitem+json\" }\n HTTParty.post(endpoint(@id_token_decoded), body: JSON.dump(attrs), headers: headers(content_type))\n end",
"title": ""
},
{
"docid": "eb33e115bf9ec336c3bbb0b2de70736a",
"score": "0.47821504",
"text": "def sentiment(text)\n RestClient.post \"http://api.datumbox.com/1.0/SentimentAnalysis.json\", {api_key: '', text: text}, {content_type: :json, accept: :json}\nend",
"title": ""
},
{
"docid": "70792743844281b7f62d2b582f602b5e",
"score": "0.47730237",
"text": "def create\n @resena = Resena.new(resena_params)\n\n respond_to do |format|\n if @resena.save\n format.html { redirect_to @resena, notice: 'Resena was successfully created.' }\n format.json { render :show, status: :created, location: @resena }\n else\n format.html { render :new }\n format.json { render json: @resena.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7d594b1173e3dad9cb5c427e56de987b",
"score": "0.47691432",
"text": "def add_to_list\n record_id_container = ''\n record_ids = params[:record_ids].split(',')\n record_ids.each do |r|\n record = 'record=' + r + '&'\n record_id_container = record_id_container + record\n end\n\n list_url = URI.encode('https://catalog.tadl.org/eg/opac/myopac/lists?loc=22;bbid=' + params[:list_id])\n add_to_list_url = URI.encode('https://catalog.tadl.org/eg/opac/mylist/add?loc=22;record=' + record_ids[0])\n post_url = URI.encode('https://catalog.tadl.org/eg/opac/mylist/move?action='+ params[:list_id] +'&loc=22&'+ record_id_container)\n\n agent = login_action(params[:u],params[:pw])\n agent.get(add_to_list_url)\n agent.get(post_url, [], list_url)\n\n respond_to do |format|\n format.json { render :json =>{:message => @post_url}}\n end\n\nend",
"title": ""
},
{
"docid": "b90ca4a7449ed7a448e001bc0cbe08f1",
"score": "0.47659642",
"text": "def post(path, params={})\n RestClient.post request_base+path, params\n end",
"title": ""
},
{
"docid": "26a3f20b44b9f0471a7778f1e8aa7d05",
"score": "0.47494072",
"text": "def rentee_params\n\n params.require(:rentee).permit(:name, :phone, :address, :tokens, :email)\n end",
"title": ""
},
{
"docid": "b44433f1d2cc452273271a7a48ef2cdf",
"score": "0.47488052",
"text": "def save(connection)\n xml = connection.make_xml('TicketCreateRequest')\n xml.add_element(to_xml)\n\n response = connection.execute(xml, '1.2')\n @id = response.attributes['id'].to_i if response.success\n end",
"title": ""
},
{
"docid": "3199172d4065b6003041cf7a5b6aad91",
"score": "0.47460604",
"text": "def post_expense_xml(xml)\n #request header bekommt Content-type = xml\n header \"Content-Type\", \"text/xml\" \n #expense daten werden alsl xml per Post request an den Server gesendet\n post '/expenses', xml\n #es wird erwartet das dies erfolgreich war\n expect(last_response.status).to eq(200)\n\n parsed = Ox.load(last_response.body, mode: :hash)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n #adds an id key to the expense hash, containing the id from the database, after an expense is succesfully stored\n expense.merge('id' => parsed['expense_id'])\nend",
"title": ""
},
{
"docid": "74dc66a58eb7d0d9f52cff4bb2cdeb4e",
"score": "0.47333187",
"text": "def post(options)\n wesabe.post(options)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "6ffdcb2af8e874b04c43a49752fd6aa5",
"score": "0.47267586",
"text": "def post(path, params={})\n request(:post, path, params)\n end",
"title": ""
},
{
"docid": "3da57cfa0f2f90a5ac51af8a3477fa06",
"score": "0.47252023",
"text": "def create\n invitees = params[:user_id]\n @event = current_user.created_events.new(event_params)\n respond_to do |format|\n if @event.save\n invitees.each do |id| \n # binding.pry\n @event.event_invites.create(user_id: id, sender_id: current_user.id)\n @event.invites.create(user_id: id)\n end\n @event.invites.create(user_id: current_user.id, rsvp: \"Attending\")\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d150a70b29ba6a251519dff4d7479c13",
"score": "0.47235417",
"text": "def post(path, **args); end",
"title": ""
},
{
"docid": "0d07d164edece4eacb987410c4ed8f8e",
"score": "0.47222954",
"text": "def add_tenants(params)\n exec_runr_task(params.merge(method: :post, task: \"add_tenants\"))\n end",
"title": ""
},
{
"docid": "546f6e03ff1a30725fb4e1e0a1fb2829",
"score": "0.47214535",
"text": "def create\n request = if receivers.empty?\n Request.post('transactions', api_version, params)\n else\n Request.post_xml('transactions/', nil, credentials, xml_params)\n end\n\n Response.new(request, self).serialize\n end",
"title": ""
},
{
"docid": "16fdf8af49c4ce33055d42d2ca830951",
"score": "0.4716976",
"text": "def post(path, params = {})\n request(:post , path, params)\n end",
"title": ""
},
{
"docid": "e7daef4b336a64f1d50580b22a77e754",
"score": "0.47161156",
"text": "def create\n @rr_rent = RrRent.new(params[:rr_rent])\n @rr_rent.user_id=current_user.id\n respond_to do |format|\n if @rr_rent.save\n flash[:notice] = 'RrRent was successfully created.'\n format.html { redirect_to(@rr_rent) }\n format.xml { render :xml => @rr_rent, :status => :created, :location => @rr_rent }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rr_rent.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "174ed97af5bafe526d35525f411f6e9f",
"score": "0.4700526",
"text": "def send_create_post(json)\n uri = URI.parse(\"https://services6.arcgis.com/QKzAuFxgK44hIfg6/arcgis/rest/services/Pollution_Reporter/FeatureServer/0/applyEdits\")\n res=Net::HTTP.post_form(uri, 'f' => 'json', 'adds' => json.to_json)\n\n raise \"Error: Failed POST to arcgis for pollution report: #{res.body}\" if !res.is_a?(Net::HTTPSuccess)\n # finds the object id from the return from arcgis\n res_json=JSON.parse(res.body)\n Rails.logger.debug \"arcgis CREATE POST successful\"\n id=res_json[\"addResults\"][0][\"objectId\"]\n end",
"title": ""
},
{
"docid": "c4b8ba4273b09ed53e57e2e3ebc0e16d",
"score": "0.4694599",
"text": "def post(options = {})\n request :post, options\n end",
"title": ""
},
{
"docid": "cbe6500a6c4a615eb91cd77d6de2788c",
"score": "0.46899256",
"text": "def post(data, tags_in = {}) ; post_to nil, data, tags_in end",
"title": ""
},
{
"docid": "c7b0fa731fcc89131d24304f9051c6d8",
"score": "0.46895814",
"text": "def send(*attributes)\n request_type = attributes.shift\n generated_xml = generate_xml(request_type, attributes.first)\n RAILS_DEFAULT_LOGGER.debug \"Sent XML: #{generated_xml}\"\n @connection.write generated_xml\n response = @connection.read\n @connection.close\n \n Response.new response\n end",
"title": ""
},
{
"docid": "c85f2d5b543adacf5f611fb628eb3cd1",
"score": "0.46864724",
"text": "def create\n @re_entrant = ReEntrant.new(re_entrant_params)\n\n respond_to do |format|\n if @re_entrant.save\n format.html { redirect_to @re_entrant, notice: 'Re entrant was successfully created.' }\n format.json { render :show, status: :created, location: @re_entrant }\n else\n format.html { render :new }\n format.json { render json: @re_entrant.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a3b74d92fcdd0fbb9df8eed2a58d177b",
"score": "0.46861407",
"text": "def create_scrap\n self.add_scrap\n result = {\"success\" => true, \"message\" => \"Success\"}\n \n respond_to do |format|\n format.xml { render :xml => result } \n format.json { render :json => result }\n end\n end",
"title": ""
},
{
"docid": "8472c2b250a721ea097efc166ffb290d",
"score": "0.4681784",
"text": "def post(path, params={}); make_request(:post, host, port, path, params); end",
"title": ""
},
{
"docid": "9f988d0b7f8256937b66cd6cb0e07b32",
"score": "0.468079",
"text": "def rayon_params\n params.require(:rayon).permit(:label, items_attributes:[:id, :_destroy, :label])\n end",
"title": ""
},
{
"docid": "33d041f5e2f7f1a98bda4abf01f36240",
"score": "0.4676056",
"text": "def create\n @raichand = Raichand.new(params[:raichand])\n\n respond_to do |format|\n if @raichand.save\n format.html { redirect_to(@raichand, :notice => 'Raichand was successfully created.') }\n format.xml { render :xml => @raichand, :status => :created, :location => @raichand }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raichand.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7a4afbb25ee1701c1a799305fa353afd",
"score": "0.4675465",
"text": "def create\n @rayon = Rayon.new(rayon_params)\n\n respond_to do |format|\n if @rayon.save\n format.html { redirect_to @rayon, notice: \"Rayon was successfully created.\" }\n format.json { render :show, status: :created, location: @rayon }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5bf75c80b6c1afd029c4bd2222278299",
"score": "0.46753287",
"text": "def call(env)\n body = names.map {|name| \"<meow>#{name}</meow>\" }.join(\"\\n\")\n\n [200, {\"Content-Type\" => \"application/xml\"}, [body]]\n end",
"title": ""
},
{
"docid": "d178d6d42991576303aa8ab695b27660",
"score": "0.46721417",
"text": "def create\n @account = Account.new(params[:account])\n @account.taxes = Tax.find(params[:tax_ids]) if params[:tax_ids]\n \n respond_to do |format|\n if @account.save\n flash[:notice] = 'Account was successfully created.'\n format.html { redirect_to(@account) }\n format.xml { render :xml => @account, :status => :created, :location => @account }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85e9687d76d21468055c91fe53af2316",
"score": "0.46721083",
"text": "def post(path, params); perform(:post, path, params); end",
"title": ""
},
{
"docid": "c91cd6bfc772affacb040a9c25924e8e",
"score": "0.4669276",
"text": "def create\n @tipos = Tipo.all\n @raca = Raca.new(params[:raca])\n\n respond_to do |format|\n if @raca.save\n flash[:notice] = 'Registro salvo com sucesso.'\n format.html { redirect_to(racas_url) }\n format.xml { render :xml => @raca, :status => :created, :location => @raca }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raca.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "99e652a268befbdea1c727b60cfc982d",
"score": "0.46687776",
"text": "def create\n @residence = Residence.new(params[:residence])\n\n respond_to do |format|\n if @residence.save\n flash[:notice] = 'Residence was successfully created.'\n format.html { redirect_to(@residence) }\n format.xml { render :xml => @residence, :status => :created, :location => @residence }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @residence.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c840df2b574d7e45c9a87240d8f7c240",
"score": "0.46675378",
"text": "def post\n resource.post(request, response)\n end",
"title": ""
},
{
"docid": "c840df2b574d7e45c9a87240d8f7c240",
"score": "0.46675378",
"text": "def post\n resource.post(request, response)\n end",
"title": ""
},
{
"docid": "b8fcd7d464850a7fe3465d563bdc2e70",
"score": "0.4661924",
"text": "def create_assessment() \n new_assessment = assessment(\n \"rand1\", \n [assessment_identification_code(\"Other\",\"Some Identification\")],\n 1\n )\n \n url = REST_URL + 'assessments'\n response = RestClient.post url, new_assessment.to_json, headers\n location = response.headers[:location]\n end",
"title": ""
},
{
"docid": "783edf74afd5b37c2d3c65524cd6679c",
"score": "0.46570462",
"text": "def post(path, params = {})\n request :post, path, params\n end",
"title": ""
},
{
"docid": "440cab89f2a364a380421164ad48ea10",
"score": "0.46522442",
"text": "def post(path, params={}, options={})\n request(:post, path, params, options)\n end",
"title": ""
}
] |
2045924f409616c24ae07193f9c89a5c
|
Remove duplicate message from queue if possible
|
[
{
"docid": "082791f30f7fedba124b96314719a49a",
"score": "0.764498",
"text": "def scrub_duplicate_message(message)\n messages do |collection|\n idx = collection[message.connection.identifier].index do |msg|\n msg.message_id == message.message_id\n end\n if(idx)\n msg = collection[message.connection.identifier].delete_at(idx)\n if(removal_callback)\n consumer.send(removal_callback, [message])\n end\n true\n else\n false\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "423ec797f0dcd16c3c00c081d4533773",
"score": "0.66215926",
"text": "def duplicate?(msg)\n result = super(msg.md5_of_body)\n logger.debug(\"#{self.queue_name}: message is dupe #{msg.message_id}\") if result\n result\n end",
"title": ""
},
{
"docid": "cbbbc91ff61b6141fb27d94042168d53",
"score": "0.65953064",
"text": "def handle_dups_fail(msg)\n if msg['dups']\n msg['dups'].each do |i|\n h = @temp_que_dups.delete(i)\n h.delete('dup')\n @que.unshift(h)\n end\n msg.delete('dups')\n end\n end",
"title": ""
},
{
"docid": "c791640c3e8abd8b9f3ea40e65d5b446",
"score": "0.6569978",
"text": "def swap_if_queued_exists(message)\n if queued_message = get_message(dequeue)\n enqueue(message)\n queued_message\n else\n message\n end\n end",
"title": ""
},
{
"docid": "2d960fe8d8b03c0f2e4670ade994d3d4",
"score": "0.6521156",
"text": "def remove\n @queue.pop\n end",
"title": ""
},
{
"docid": "d0d6a2e89b131de1f6fd2138ce7e559f",
"score": "0.6511561",
"text": "def remove\n @queue.pop\n end",
"title": ""
},
{
"docid": "8331e3953c4a1a509f6c7d6edebe6a2a",
"score": "0.64698076",
"text": "def remove\n @queue.shift\n end",
"title": ""
},
{
"docid": "5101a629e70761e91d0a63f12d7c9b29",
"score": "0.646391",
"text": "def remove_from_queue!\n queue_entry = QueueEntry.last_for self\n return unless queue_entry\n\n queue_entry.left_at = Time.now\n queue_entry.save!\n end",
"title": ""
},
{
"docid": "1a396b23d17863f5c51096ee7c10f122",
"score": "0.643047",
"text": "def delete_queue_message(message)\n _delete_message(message)\n end",
"title": ""
},
{
"docid": "627f80417eb4ef082a669f591648d064",
"score": "0.64052284",
"text": "def requeue_message(delivery_info)\n channel.reject(delivery_info.delivery_tag, true)\n end",
"title": ""
},
{
"docid": "53ccea34429e0096dc795c1bb1e7937c",
"score": "0.6394245",
"text": "def de_queue()\n \n end",
"title": ""
},
{
"docid": "d433b8bdf8c8a5367c3e8b83d38f1f85",
"score": "0.63766646",
"text": "def deq\r\n synchronize { @queue.shift }\r\n end",
"title": ""
},
{
"docid": "54b3c96a05630c957f60a5f5748a78d0",
"score": "0.63748664",
"text": "def remove_duplicates(msgs)\n keep = []\n tail = msgs.clone()\n while tail.size > 0\n keep << tail.shift\n tail.delete_if{|m| m[:body] == keep.last[:body] ? (delete_message(m); true) : false}\n end\n return keep\n end",
"title": ""
},
{
"docid": "7d6edaa4c5f0adb992fe713302756016",
"score": "0.63738555",
"text": "def handle_dups_done(msg, new_state)\n if msg['dups']\n msg['dups'].each do |i|\n h = @temp_que_dups.delete(i)\n new_status = \"duplicate #{gen_full_msg_id(msg)}\"\n write_msg_status(i, new_status, 'que')\n h['status'] = new_state + \" - \" + new_status\n h['state'] = new_state\n store_msg(h, 'que')\n # TODO: refactor this\n basename = File.join(@queue_path, 'que', i)\n RQ::HashDir.inject(basename, File.join(@queue_path, new_state), i)\n end\n msg['dups'] = msg['dups'].map { |i| gen_full_msg_id({'msg_id' => i}) }\n end\n end",
"title": ""
},
{
"docid": "deebb1addcc27d0ca88c214dc4d5418f",
"score": "0.6367942",
"text": "def trimqueue(content)\n \t# Destroy any service requests not taken by someone in the database or that isn't in the queue\n \tServiceRequest.all.each do |exists|\n\t\t\tunless exists.taken || content.include?(\"#{exists.number}\")\n\t\t\t\texists.destroy\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "7b1ab50c8a1fdd18369e89d0ee4f7fcd",
"score": "0.63556474",
"text": "def uniqueinqueue(word, queue)\n\tqueue_dup = Queue.new\n\tdecision = true\n\twhile queue.empty?\n\tword1 = queue.pop\n\t\tif word == word1\t\t#duplicate found\n\t\t\tdecision = false\n\t\tend\n\t\tqueue_dup << word1\n\tend\n\treturn decision\nend",
"title": ""
},
{
"docid": "035dffba8d58a1d0ea10c54312ebb0cd",
"score": "0.63208807",
"text": "def requeue(queue_name, frame)\n @frames[queue_name][:frames] << frame\n ArMessage.create!(:stomp_id => frame.headers['message-id'],\n :frame => frame)\n end",
"title": ""
},
{
"docid": "2b58129fe0387fc8828b4c89c80f2f81",
"score": "0.6307057",
"text": "def purge\n @messages = []\n\n self\n end",
"title": ""
},
{
"docid": "7038c4c716485ce7f9c87a1b76804574",
"score": "0.62713575",
"text": "def requeue\n client.queue( request, shortname => { skip: true } )\n end",
"title": ""
},
{
"docid": "3bd215e1bce9782641f49ff3ece2c560",
"score": "0.6242829",
"text": "def remove(item)\n redis.lrem :queue, 0, encode(item)\n end",
"title": ""
},
{
"docid": "4b733b8612389f2cdecfaf5008a818dc",
"score": "0.6238867",
"text": "def delete_queue_message(queue, opts = {})\n poll(queue, opts) do |msg, stats|\n poller(queue).delete_message(msg)\n throw :stop_polling\n end\n end",
"title": ""
},
{
"docid": "e8d6cb2f69271cd4d65c97919e3d981c",
"score": "0.6231761",
"text": "def remove(queue, item)\n # If this key missed - job not in the recovering queue\n return unless item.transform_keys(&:to_sym).key?(UUID_KEY)\n\n Resque.logger.info('Removing item from the recovering queue. ' \\\n \"Queue: #{queue}. Item: #{item}\")\n Resque.redis.zrem(REDIS_KEY % {queue: queue}, Resque.encode(item))\n item.delete(UUID_KEY) || item.delete(UUID_KEY.to_s)\n end",
"title": ""
},
{
"docid": "825a221a0942ef666c96b4fc02696775",
"score": "0.6226952",
"text": "def check_message_duplication\n # TODO check duplicate message\n # generate hash with message / number\n # check or set at cache\n end",
"title": ""
},
{
"docid": "f4b0162db4368b0d5eb3f0d72bccac1e",
"score": "0.6216696",
"text": "def dequeue\n @mutex.synchronize do\n @cond.wait(@mutex) while @queue.empty?\n\n item = @queue.shift\n @unique.delete(item)\n item\n end\n end",
"title": ""
},
{
"docid": "854552fde5c058e74ea3eb30394fcfee",
"score": "0.6210637",
"text": "def forget(message)\n @mutex.synchronize do\n @recorded.delete message.id\n end\n end",
"title": ""
},
{
"docid": "0070f19b57bff465c0569411afb111d6",
"score": "0.6196125",
"text": "def remove_from_queue(call_id)\r\n @event.each_value {|eventList| eventList.delete_if {|event| event[\"id\"] == call_id}}\r\n end",
"title": ""
},
{
"docid": "733858c209cefd3722722bb2f9737933",
"score": "0.61331177",
"text": "def remove_from_queue(queue,data)\n @redis.lrem(redis_key_for_queue(queue), 0, data)\n end",
"title": ""
},
{
"docid": "5427e73c38e99328dba28b272ef8ab85",
"score": "0.6116895",
"text": "def dispatch_message(message)\n queue = nil\n @mutex.synchronize do\n request_id = message.headers[\"__request_id\"]\n queue = @queues.delete(request_id)\n end\n queue&.push(message)\n end",
"title": ""
},
{
"docid": "baefd3fe1549cd9565e873d5dad52ecb",
"score": "0.6110372",
"text": "def requeue\n self.dequeue; self.queue\n end",
"title": ""
},
{
"docid": "5898f5ff7760e351d1bb08052887eb07",
"score": "0.61024946",
"text": "def requeue_oldest_failed_job\n failed_queue.requeue(0)\n { rescheduled?: true, ok_to_remove?: true }\n rescue Resque::Helpers::DecodeException => e\n # This means we tried to dequeue a job with invalid encoding.\n # We just want to delete it from the queue.\n logger.notify(e)\n { rescheduled?: false, ok_to_remove?: true }\n rescue Exception => e\n logger.notify(e)\n { rescheduled?: false, ok_to_remove?: ok_to_remove?(e.message)}\n end",
"title": ""
},
{
"docid": "abb3e5b202802c6359ca6344c09194e3",
"score": "0.6083179",
"text": "def take_msg(queue)\n msg = queue.reserve\n #by calling ybody we get the content of the message and convert it from yml\n body = msg.ybody\n if block_given?\n yield(body)\n end\n msg.delete\n end",
"title": ""
},
{
"docid": "a1c040c1e4093bc12ffddf4c044a33aa",
"score": "0.6081153",
"text": "def send_message(queue, msg, unique)\n queue.send_message(\n message_body: msg.to_json,\n message_group_id: 'soa_demo',\n message_deduplication_id: 'soa-demo' + unique.hash.to_s\n )\nend",
"title": ""
},
{
"docid": "d21c158940a94e4e17eb8d84458530fc",
"score": "0.6068143",
"text": "def remove_from_queue_list\n puts \"Removing #{@consumer_name} from Queue List\"\n @redis_conn.hdel('decoupled.consumers', @consumer_name)\n end",
"title": ""
},
{
"docid": "bf869ea104e37076df03a073547f8ad1",
"score": "0.6067216",
"text": "def remove_queue(queue)\n super(queue)\n redis.hdel(\"locket:queue_lock_counters\", queue)\n end",
"title": ""
},
{
"docid": "546d1705a58f81a0263c639acfd2348b",
"score": "0.6062167",
"text": "def clear_queue\n if @queue\n while not @queue.empty?\n message = @queue.pop\n p [\"from queue\", message]\n @@ws.send message\n end\n end\n end",
"title": ""
},
{
"docid": "1a852d09b27ce114d2dc16087e33024a",
"score": "0.6061291",
"text": "def remove_que(id)\n @db[:memes].where(id: id).update(queue: false)\n end",
"title": ""
},
{
"docid": "d805e1fd4bb5a1669171946f7451c86d",
"score": "0.6040464",
"text": "def remove_duplicate_receipts receipts\n size = receipts.size\n last = receipts[size-1]\n second_last = receipts[size-2]\n # check if they are the same\n if last.message == second_last.message\n receipts.pop\n end\n receipts\n end",
"title": ""
},
{
"docid": "869615be986259838e71a1877bb3a12f",
"score": "0.6035254",
"text": "def pop_from_queue(queue)\n @redis.lpop(redis_key_for_queue(queue))\n end",
"title": ""
},
{
"docid": "b95b1133d87d3cc60cef0d2a1edbf156",
"score": "0.6026015",
"text": "def purge\n @queues = {}\n end",
"title": ""
},
{
"docid": "f07a75d94629c1b83c2bc24027f61049",
"score": "0.602578",
"text": "def remove_message(id)\n with_queue_control do |control|\n control.remove_message(id)\n end\n end",
"title": ""
},
{
"docid": "35db363b121604002b3604e4d36b2704",
"score": "0.60225636",
"text": "def purge_queue!\n queue.map(&:delete)\n end",
"title": ""
},
{
"docid": "589747ccf2a65215486b175d3517cff2",
"score": "0.60013634",
"text": "def remove_queue(queue)\n log \"removing #{queue}\"\n mongo.remove({:queue => queue.to_s})\n QueueStats.remove(queue)\n end",
"title": ""
},
{
"docid": "37edeb840a9ea0d0a32dc7ae460ceb6a",
"score": "0.5990426",
"text": "def pop\n @messages.pop\n end",
"title": ""
},
{
"docid": "de3876fe11e7b0c2065b9757b2370b94",
"score": "0.5980388",
"text": "def clear_queue(queue_url)\n while (m = pop_message(queue_url)) ; end # delete all messages in queue\n true\n rescue\n on_exception\n end",
"title": ""
},
{
"docid": "d1656758acb6c5520764ccdaf4c4d0e2",
"score": "0.5979806",
"text": "def requeue\n EmailQueue.queue(person, email, application_status, nil, self, contactable)\n end",
"title": ""
},
{
"docid": "dd604f87de0d2d5195bfb051f44f2418",
"score": "0.59779215",
"text": "def flush_queue (queue)\n\n count = 0\n\n loop do\n\n l = get_messages queue, :timeout => 0, :count => 255\n\n break if l.length < 1\n\n l.each do |m|\n m.delete\n count += 1\n end\n end\n\n count\n end",
"title": ""
},
{
"docid": "e866e68c14ffe686ae5fd73c48d3db69",
"score": "0.5973434",
"text": "def unqueue\n queue = Sidekiq::ScheduledSet.new\n queue.each do |job|\n job.delete if job.jid == jid\n end\n end",
"title": ""
},
{
"docid": "ab595e022320a349598af3ec941b131c",
"score": "0.597037",
"text": "def remove(id)\n @@queue.size != 0 ? @@queue.delete(Integer(id)) : 0.to_s\n end",
"title": ""
},
{
"docid": "94dc7d8939030126103bc71f22e32629",
"score": "0.5957097",
"text": "def clear_queue(queue_url)\n while (pop_messages(queue_url, 10).length > 0) ; end # delete all messages in queue\n true\n rescue\n on_exception\n end",
"title": ""
},
{
"docid": "4076d252c752e5eb57d477fdcf934c8b",
"score": "0.595183",
"text": "def remove_current_question_from_queue\n queue_arr = self.queue.split( \",\" )\n queue_arr.delete_at(0) if queue_arr.size > 0\n self.queue = queue_arr.join( \",\" )\n end",
"title": ""
},
{
"docid": "f9c7dbbd0d4214ff8436f677fd244fc5",
"score": "0.59411603",
"text": "def pop(sender)\n @lock.synchronize do\n if @messages.empty?\n @waiting << sender\n nil\n else\n @messages.shift\n end\n end\n end",
"title": ""
},
{
"docid": "d7b94a4caba1d97c7530e572749d434a",
"score": "0.5929456",
"text": "def remove(queue)\n dispatch(:remove, queue)\n end",
"title": ""
},
{
"docid": "3928a871aaeb870e92108e5b42f86713",
"score": "0.59291136",
"text": "def clean_stale!(autosort = true)\n messages.each do |message|\n message.destroy! if message.stale?\n end\n sort! if autosort\n end",
"title": ""
},
{
"docid": "2e7fb6bf2418398ccc8bb87b2eda5a00",
"score": "0.5925936",
"text": "def delete(item)\n original_length = @length\n k = 1\n while k <= @length\n if @queue[k] == item\n swap(k, @length)\n @length -= 1\n sink(k)\n @queue.pop\n else\n k += 1\n end\n end\n @length != original_length\n end",
"title": ""
},
{
"docid": "4f1c30730866e639f9813a691e539158",
"score": "0.5915547",
"text": "def dequeue\n Resque.remove_delayed(SendTweet, self.id)\n end",
"title": ""
},
{
"docid": "c6be9d7122f6f79416b940cb152ac703",
"score": "0.59093064",
"text": "def pop\n @queue.pop\n end",
"title": ""
},
{
"docid": "84993f688118b8ade0388303472cc32e",
"score": "0.5908505",
"text": "def confirm\n @s_queue.pop\n end",
"title": ""
},
{
"docid": "60f52ebf2b57b9a000440f7143820e66",
"score": "0.5903458",
"text": "def requeue(message_id, timeout=0)\n message_id = message_id.message_id if message_id.respond_to?(:message_id)\n distribution.in_flight_lookup(message_id) do |connection|\n distribution.unregister_message(message_id)\n connection.transmit(\n Command::Req.new(\n :message_id => message_id,\n :timeout => timeout\n )\n )\n distribution.failure(connection)\n update_ready!(connection)\n end\n true\n end",
"title": ""
},
{
"docid": "310c7050d2e45368799c7f945add4ccf",
"score": "0.5894565",
"text": "def key_exists?\n old_message = !@store.msetnx(msg_id, :status =>\"incomplete\", :expires => @expires_at.to_i, :timeout => (now + timeout).to_i)\n if old_message\n logger.debug \"Beetle: received duplicate message: #{msg_id} on queue: #{@queue}\"\n end\n old_message\n end",
"title": ""
},
{
"docid": "01f340a8f781f8cfaa9fb888f8dd319a",
"score": "0.5893598",
"text": "def nack(tag, requeue = true)\n Lynr.metrics.add(\"queue.nack:#{name}\" => 1)\n channel.reject(tag, requeue)\n end",
"title": ""
},
{
"docid": "9d47ed5741f74b46bbc0214a064c4911",
"score": "0.5886772",
"text": "def remove_queue(queue)\n queue_response = fraggle.get('/queues')\n unless queue_response.nil?\n queues = decode(queue_response.value)\n queues -= [queue]\n\n fraggle.set('/queues', encode(queues), queue_response.rev)\n end\n\n fraggle.del(\"/queue/#{queue}\")\n end",
"title": ""
},
{
"docid": "b51f766182fa3f64720d38f4a871308d",
"score": "0.5885064",
"text": "def pop(queue)\n doc = mongo.find_and_modify( :query => { :queue => queue.to_s },\n :sort => [[:date, 1]],\n :remove => true )\n return if doc.nil?\n QueueStats.remove_job(queue)\n doc['item']\n rescue Mongo::OperationFailure => e\n return nil if e.message =~ /No matching object/\n raise e\n end",
"title": ""
},
{
"docid": "b52d628e30c0e5a1dfd951548ba4e506",
"score": "0.58850265",
"text": "def move_message(queue_name, id, reject_duplicates = false)\n with_queue_control do |control|\n control.move_message(id, queue_name, reject_duplicates)\n end\n end",
"title": ""
},
{
"docid": "548f61beaf30c565d62e9b14d3c43360",
"score": "0.5878441",
"text": "def remove_from_queue_list\n puts \"Removing #{@consumer_name} from Queue List\"\n @redis_conn.hdel('decoupled.schedulers', @consumer_name)\n end",
"title": ""
},
{
"docid": "f4221e2f8e4687fbf3b684b853080118",
"score": "0.58776593",
"text": "def cull_seen\n if @seen_queue.length > @seen_track_limit\n old_tag = @seen_queue.deq\n @seen_set.delete old_tag\n old_tag\n end\n nil\n end",
"title": ""
},
{
"docid": "f4221e2f8e4687fbf3b684b853080118",
"score": "0.58776593",
"text": "def cull_seen\n if @seen_queue.length > @seen_track_limit\n old_tag = @seen_queue.deq\n @seen_set.delete old_tag\n old_tag\n end\n nil\n end",
"title": ""
},
{
"docid": "5e65f0e7ece717a80ea5239d6c35a809",
"score": "0.58722496",
"text": "def de_queue()\n return false if @queue.size == 0\n @queue.shift\n true\n end",
"title": ""
},
{
"docid": "869b8451863d8e4fe6ed20ac0abbdc20",
"score": "0.5869803",
"text": "def delete\n @redis.del @queue_name\n @redis.keys(\"#{@queue_name}:*\").each do |key|\n @redis.del key\n end\n @redis.srem \"timberline_queue_names\", @queue_name\n end",
"title": ""
},
{
"docid": "a67b7dca9d2fd7d677ced8ea79f1b649",
"score": "0.58677197",
"text": "def remove_queue(queue)\n data_store.remove_queue(queue)\n end",
"title": ""
},
{
"docid": "d64501cd9dc15be88af4a01bd622517d",
"score": "0.5863205",
"text": "def delete\n @queue << \"delete\"\n end",
"title": ""
},
{
"docid": "af3282de8fc79c6d9fe61ae101ff323b",
"score": "0.5860411",
"text": "def remove_from_queue\n invite_request = InviteRequest.find_by_email(self.email)\n invite_request.destroy if invite_request\n end",
"title": ""
},
{
"docid": "f267695bd8c77a01ecd694185d5821bc",
"score": "0.58541864",
"text": "def remove(cmd_id)\n @front_queue << [:remove, cmd_id]\n end",
"title": ""
},
{
"docid": "ab5c6fbfdbca9e5ac549078bcf253002",
"score": "0.58433205",
"text": "def test_pop_last_item_removes_queue\n Resque.push('queue1', 'item')\n Resque.push('queue1', 'item')\n Resque::Plugins::DynamicQueues::Base.activate('group1', 'queue1')\n Resque.pop('queue1')\n assert_equal 1, Resque.queues.size\n assert_equal 1, Resque::Plugins::DynamicQueues::Base.queues('group1').size\n Resque.pop('queue1')\n assert_equal 0, Resque.queues.size\n assert_equal 0, Resque::Plugins::DynamicQueues::Base.queues('group1').size\n end",
"title": ""
},
{
"docid": "338ef7bf7f28ee1fe9fd428a0f60c30e",
"score": "0.58368325",
"text": "def pop()\n @queue.shift\n end",
"title": ""
},
{
"docid": "18541d9596f7f547ac1eefafdeed1655",
"score": "0.58327657",
"text": "def unsubscribe queue_name, message_headers={}\n if @subscriptions[queue_name]\n @subscriptions[queue_name].remove\n if @subscriptions[queue_name].count <= 0\n sub = @subscriptions.delete(queue_name)\n @queues_by_priority[sub.priority].delete(queue_name)\n end\n end\n end",
"title": ""
},
{
"docid": "08a6dbbfd320d09cd898af492c585ac4",
"score": "0.5827374",
"text": "def indicate\n @r_queue.pop\n end",
"title": ""
},
{
"docid": "689b05f112678e8bf6f57d169b57cdd4",
"score": "0.5826403",
"text": "def move_messages(queue_name, filter = nil, reject_duplicates = false)\n with_queue_control do |control|\n control.move_messages(filter, queue_name, reject_duplicates)\n end\n end",
"title": ""
},
{
"docid": "da95ea9af6d993f79445bdb3019fe251",
"score": "0.5823942",
"text": "def purge\n lock do\n @messages = []\n @in_flight = {}\n end\n end",
"title": ""
},
{
"docid": "e51d1555de135205e476372b77fac7ba",
"score": "0.582268",
"text": "def queue_purge(name)\n converting_rjc_exceptions_to_ruby do\n @delegate.queue_purge(name)\n end\n end",
"title": ""
},
{
"docid": "4dd1d2a0f99995cf01dc68df3f96de6b",
"score": "0.5821566",
"text": "def remove(index)\n self.messages[index] = nil\n end",
"title": ""
},
{
"docid": "c9192a1d75ff19e30973023acf323f1e",
"score": "0.58189106",
"text": "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",
"title": ""
},
{
"docid": "5c5d92e1b291ee19f110dfdd3f46b2bf",
"score": "0.58163404",
"text": "def dequeue_entry(queue)\n queue.pop\nend",
"title": ""
},
{
"docid": "489d3e4f613ed779308d7b66ce8bbdfa",
"score": "0.58061296",
"text": "def clear_queue\n ::Redis::Alfred.delete(round_robin_key)\n end",
"title": ""
},
{
"docid": "489d3e4f613ed779308d7b66ce8bbdfa",
"score": "0.58061296",
"text": "def clear_queue\n ::Redis::Alfred.delete(round_robin_key)\n end",
"title": ""
},
{
"docid": "8fbbd1e2defe6fac3f3de62893752a5f",
"score": "0.58056563",
"text": "def requeue_stalled_messages(time)\n stalled_messages(time).inject(0) do |count, message|\n begin\n push(message.data)\n message.destroy\n count + 1\n rescue Errno::ENOENT\n # Could not read message.data\n count\n end\n end\n end",
"title": ""
},
{
"docid": "e56b13db2b5060e37963f075d4a04a5c",
"score": "0.58045197",
"text": "def dequeue_entry(queue)\r\n queue.pop\r\nend",
"title": ""
},
{
"docid": "b20d33d544edceeac3633728ad2f313e",
"score": "0.58004755",
"text": "def pop_item\n self.class.queue.pop\n end",
"title": ""
},
{
"docid": "fedffc0975b0af788a381d8a6bc1bfeb",
"score": "0.5800246",
"text": "def remove_from_store(message_id)\n ArMessage.find_by_stomp_id(message_id).destroy\n end",
"title": ""
},
{
"docid": "5132e10f25c6a6acb1ed614b5e772035",
"score": "0.5796481",
"text": "def dequeue\n @queue.delete_at(0)\n end",
"title": ""
},
{
"docid": "34926f534253c02849bcb78fb660bab0",
"score": "0.57902527",
"text": "def unsubscribe queue_name, message_headers={}\n if @subscriptions[queue_name]\n @subscriptions[queue_name].remove\n @subscriptions.delete(queue_name) if @subscriptions[queue_name].count <= 0\n end\n end",
"title": ""
},
{
"docid": "2cdfddcf335699ca4e32ed5ec7623754",
"score": "0.5785824",
"text": "def found_duplicate?(msg_data)\n return false unless msg_data && msg_data[:queue]\n timeout = self.queue_timeout(msg_data)\n begin\n !@memcached_client.add(msg_data[:id], \"1\",timeout)\n rescue StandardError => e\n if @dupe_on_cache_failure\n Chore.logger.error \"Error accessing duplicate cache server. Assuming message is a duplicate. #{e}\\n#{e.backtrace * \"\\n\"}\"\n true\n else\n Chore.logger.error \"Error accessing duplicate cache server. Assuming message is not a duplicate. #{e}\\n#{e.backtrace * \"\\n\"}\"\n false\n end\n end\n end",
"title": ""
},
{
"docid": "7a7d495df64ecb7de019d0b5ed2c841f",
"score": "0.577765",
"text": "def remove_previous_enques(time)\n Sidekiq.redis do |conn|\n conn.zremrangebyscore(job_enqueued_key, 0, \"(#{(time.to_f - REMEMBER_THRESHOLD)}\")\n end\n end",
"title": ""
},
{
"docid": "dc359f3720efcb16d551d50bdee32c59",
"score": "0.57697475",
"text": "def check_for_duplicate\n # build relation\n rel = Sms::Message.where(:from => @msg.from).where(:body => @msg.body)\n\n # if @msg is saved, don't match it!\n rel = rel.where(\"id != ?\", @msg.id) unless @msg.new_record?\n\n # include the date condition\n rel = rel.where(\"sent_at > ?\", Time.now - DUPLICATE_WINDOW)\n\n # now we can run the query\n raise_decoding_error(\"duplicate_submission\") if rel.count > 0\n end",
"title": ""
},
{
"docid": "789a6b3f027fc82b3f3061cee7666497",
"score": "0.57691646",
"text": "def clear_messages!\n @received_messages = []\n end",
"title": ""
},
{
"docid": "789a6b3f027fc82b3f3061cee7666497",
"score": "0.57691646",
"text": "def clear_messages!\n @received_messages = []\n end",
"title": ""
},
{
"docid": "b5b5f37e656d3e099b272be7c6caf68d",
"score": "0.5768922",
"text": "def remove\n transaction do\n marked_id = \"#{MARKER}#{id}\"\n redis_score = redis.zscore(config.queue, marked_id)\n\n return false unless score.to_i == redis_score.to_i\n\n redis.multi do\n clear_task\n redis.zrem(config.queue, marked_id)\n end\n\n logger.info \"The task \\\"#{id}\\\" is removed from the queue\"\n end\n true\n end",
"title": ""
},
{
"docid": "54a7160c90f3d64236e0f87c22691d59",
"score": "0.5763439",
"text": "def blocking_receive\n @messages.pop\n end",
"title": ""
},
{
"docid": "7b2d91fed0ca9ab0205b5d23205f5be3",
"score": "0.57630247",
"text": "def pop_without_blocking\n @messages.pop(true)\n rescue ThreadError\n # When the Queue is empty calling `Queue#pop(true)` will raise a ThreadError\n nil\n end",
"title": ""
},
{
"docid": "fd5a74c193bc9b85a893419acd784578",
"score": "0.57615125",
"text": "def pop(queue)\n queue = namespace_queue(queue)\n query = {}\n query['delay_until'] = { '$lt' => Time.now } if delayed_queue?(queue)\n #sorting will result in significant performance penalties for large queues, you have been warned.\n item = mongo[queue].find_and_modify(:query => query, :remove => true, :sort => [[:_id, :asc]])\n rescue Mongo::OperationFailure => e\n return nil if e.message =~ /No matching object/\n raise e\n end",
"title": ""
},
{
"docid": "b9d83dd914acc1a30cfd351762c5f6f6",
"score": "0.5758601",
"text": "def dedup_messages(handlers_to_messages, messages)\n all_handler_messages = handlers_to_messages.values.flatten\n messages.reject { |m| all_handler_messages.include?(m) }\n end",
"title": ""
},
{
"docid": "fc039e080b112ab487687eb9e3f5c029",
"score": "0.57572234",
"text": "def pop\n msg = receive\n msg.delete if msg\n msg\n end",
"title": ""
}
] |
33a3c1596ebe37caad2cf2184c7bc1dd
|
PUT /companies/1 PUT /companies/1.xml
|
[
{
"docid": "fa67b730559e3db31fbce477f1bd97cc",
"score": "0.0",
"text": "def update\n\n if current_user\n @company = Company.find(params[:id])\n\n @action = Action.new({:points => 2, :entity_changed => \"company\" , :action => \"update\", :user_id => current_user.id })\n @action.save\n\n @user = User.find(current_user.id)\n @user.points= 2 + @user.points\n @user.save\n\n \n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "75257bcacbc16f7963754f7d8ca9fb70",
"score": "0.7226064",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n \n \n format.xml \n else\n \n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e70404570c307d299544e0a09ac2461",
"score": "0.711198",
"text": "def update_company(id, model) path = \"/api/v2/companies/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"title": ""
},
{
"docid": "1c35f89f4e93251128bbf53c08021b3d",
"score": "0.6907885",
"text": "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end",
"title": ""
},
{
"docid": "79a133d4a92fc45a87b2b673b8059a97",
"score": "0.67867726",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format| \n @company.update_attributes(params[:company])\n format.html { redirect_to(edit_company_path(@company.id)) }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end",
"title": ""
},
{
"docid": "19244f7197f73d30495b46861b66897a",
"score": "0.6770438",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to('/companies/' + @company.id.to_s) }\n format.xml { head :ok }\n else\n flash[:notice] = 'Error encountered on update.'\n format.html { redirect_to('/companies/' + @company.id.to_s) }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "778ab925ad5d1b068128ea6ec9efae58",
"score": "0.6645354",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "778ab925ad5d1b068128ea6ec9efae58",
"score": "0.6645354",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5e6f0e4ecc0a5672ebf9d8f740e75b4",
"score": "0.6638772",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5e6f0e4ecc0a5672ebf9d8f740e75b4",
"score": "0.6638772",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5e6f0e4ecc0a5672ebf9d8f740e75b4",
"score": "0.6638772",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5e6f0e4ecc0a5672ebf9d8f740e75b4",
"score": "0.6638772",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a5e6f0e4ecc0a5672ebf9d8f740e75b4",
"score": "0.6638772",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca9f76d5541cb4e27396c978fcd011ca",
"score": "0.66119486",
"text": "def update\n #@company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ab2c86fb88df7a1979eabf3ea952b51",
"score": "0.6580304",
"text": "def update\n @company_datum = CompanyDatum.find(params[:id])\n\n respond_to do |format|\n if @company_datum.update_attributes(params[:company_datum])\n \n create_company_data_xml unless FileTest.exists?(\"app/data/company_data.xml\")\n update_company_data_xml() \n \n format.html { redirect_to(@company_datum, :notice => 'Company datum was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company_datum.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8328837c00022d0e60c7205802317179",
"score": "0.6564377",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "879781a6eedf1a11ef70fd839271552b",
"score": "0.65097964",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(session[:redirect], :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c1e640583ae25bb6be9aa3515b113f5a",
"score": "0.6485928",
"text": "def update\n @company = Company.find(current_company.id)\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "94c043b26d5e776a8c1e7efcab5165ed",
"score": "0.6431522",
"text": "def update\n @company.update_attributes!(params[:company])\n \n respond_to do |wants|\n flash[:notice] = 'Participant was successfully updated.'\n wants.html { redirect_to(companies_url) }\n wants.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e4c0f6b16cb1110c1c092d97d6badc06",
"score": "0.6414719",
"text": "def update\n Company.transaction do\n begin\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update_attributes(params[:company])\n @company.address.update_attributes(params[:address])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n rescue\n raise ActiveRecord::Rollback\n end\n end\n end",
"title": ""
},
{
"docid": "94487a3563d3aecadbb1f8fff377f6b5",
"score": "0.6337165",
"text": "def update\n @company = Perpetuity[Company].find(params[:id])\n\n params[:company].keys.each do |attribute|\n if attribute == \"address\"\n params[:company][attribute] = Perpetuity[Address].find(params[:company][attribute])\n end\n @company.send(attribute+\"=\",params[:company][attribute])\n end\n Perpetuity[Company].save @company\n\n respond_to do |format|\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "002d7e9ba600333b5b038999d1ff1006",
"score": "0.63056654",
"text": "def update\n @company_contact = CompanyContact.find(params[:id]) \n\n respond_to do |format|\n if @company_contact.update_attributes(params[:company_contact])\n format.html { redirect_to('/companies/'+ @company_contact.company_id.to_s ) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company_contact.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8581201715c06e26aac12b84ab714932",
"score": "0.6304011",
"text": "def update\n @company = Company.find(params[:id])\n\n if @company.update(params[:company])\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "712beaf87373f8ca9a22e98e1bbe3faf",
"score": "0.630273",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to companies_url, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bfd778c3e9ea9c8726709967d0126343",
"score": "0.63004184",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9c4b307881ccfcc0bc4d4c592600a1d4",
"score": "0.6263685",
"text": "def update\n if @company.update(company_params)\n respond_with(@company, location: companies_url, notice: 'Company was successfully updated.')\n else\n respond_with(@company)\n end\n end",
"title": ""
},
{
"docid": "02da5806f51fee0558fad6a9c899d4b8",
"score": "0.6259382",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to edit_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d54dbe5f2f571029eec7e004baac342f",
"score": "0.62479216",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a1067ffde1d80bbac38c696b49cb7afe",
"score": "0.6229191",
"text": "def update\n\t\t@company.update(company_params)\n\tend",
"title": ""
},
{
"docid": "a2a7daa3ac3d1e71728461c467080137",
"score": "0.6226278",
"text": "def update\n @company = current_user.companies.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"title": ""
},
{
"docid": "0026d2544fb96dc9f0da0020ac71cce7",
"score": "0.6225358",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "16981edf8872fec71d1989a89bc64c4e",
"score": "0.6209178",
"text": "def update\n\t\t \t@company = Company.find(params[:id])\n\t\t \t@company.company_name = params[:company][:company_name]\n\t\t \n\t\t respond_to do |format|\n\t\t format.html { redirect_to companies_url }\n\t\t format.json { render :json => @company }\n\t\t end\n\n\t\t end",
"title": ""
},
{
"docid": "f7eb0afd098dfea899c4b8f8caf44aa9",
"score": "0.6189712",
"text": "def update\n @company = Company.find(params[:id])\n\t\n respond_to do |format|\n if @company.update_attributes(params[:Company])\n format.html { redirect_to admin_companies_url, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "820d8f5479546f08d807620d77f470fa",
"score": "0.6171327",
"text": "def update\n @company = Company.find(params[:id])\n \n if @company.update_attributes(params[:company])\n unless params[:key].blank?\n \n redirect_to \"/companies/show?key=#{params[:key]}\"\n else\n redirect_to :action=>\"show\", :id=>params[:id]\n end\n else\n \n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n\n \n end",
"title": ""
},
{
"docid": "96ba29626ded51c94e0f7fa3fc63ad8b",
"score": "0.61683595",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'La empresa se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "960a1c2a9dee0eb21b6701aea286494f",
"score": "0.61629707",
"text": "def set_company\n @api_v1_company = Company.find(params[:id])\n set_json\n end",
"title": ""
},
{
"docid": "a8628a3274f421049d39ca58ccc1ba0a",
"score": "0.6158067",
"text": "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2608002ffdb38f6fde1bde4d2264995a",
"score": "0.6150083",
"text": "def update\n @company_doc = CompanyDoc.find(params[:id])\n\n respond_to do |format|\n if @company_doc.update_attributes(params[:company_doc])\n format.html { redirect_to @company_doc, notice: 'Company doc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bddaf379374aef86d05be789065a4064",
"score": "0.6147407",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { render 'companies/index', notice: \"Ditta #{@company.name} aggiornata.\" }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render 'companies/new', notice: \"Errori nella registrazione.\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "abd6d650e85a75e903c00469a8f28306",
"score": "0.61314934",
"text": "def update\n params\n ['equipment_print_printable_ids', 'material_print_printable_ids', 'service_print_printable_ids',\n 'equipment_online_onlineable_ids', 'material_online_onlineable_ids', 'service_online_onlineable_ids'].each do |cat|\n params[:company][cat] = [] if params[:company][cat].blank?\n end\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_companies_path, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n system \"rake ts:index\"\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ccc7023c5d41877d5c211bc9a435dcd8",
"score": "0.61205804",
"text": "def update\n @fx_company = FxCompany.find(params[:id])\n\n respond_to do |format|\n if @fx_company.update_attributes(params[:fx_company])\n format.html { redirect_to @fx_company, notice: 'Fx company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fx_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "513ac1af3d3275256e14905baafdcbab",
"score": "0.6114799",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'La compania fue editada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c16e8da224c52c856a9283b7f7c163e0",
"score": "0.61107033",
"text": "def update\n @comptype = Comptype.find(params[:comptype][:id])\n\n respond_to do |format|\n if @comptype.update_attributes(params[:comptype])\n format.xml { head :ok }\n end\n end\n end",
"title": ""
},
{
"docid": "4a835862ca9ee1b876cc1a75c455ebb2",
"score": "0.61074215",
"text": "def update\n\n\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: t('companies_controller.companies_update_success') }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72316b119cd82d8b4f91d0a15506ea59",
"score": "0.6092484",
"text": "def update\n respond_to do |format|\n\n unless @company.nil?\n rdf = getJsonld(@company[:content]).to_json\n usdl = getJsonld(@company[:usdl]).to_json\n #puts \"sending to elasticsearch@#{ENV['elastic_search_ip']}\"\n @es_client.index index: 'companies', type: 'rdf', id: @copmany.name, body: rdf\n @es_client.index index: 'companies', type: 'usdl', id: @company.name, body: usdl\n @company.json = rdf\n end\n if @company.update(company_params)\n\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "145ff1d07e9df7da1fe7e6a521f1b7cc",
"score": "0.60762185",
"text": "def update_company(body)\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/v1/companies'\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = build_request_headers()\n\n # Create the HttpRequest object for the call, fetch and wrap the respone in a HttpContext object\n _response, _context = send_moesif(_query_url, _headers, body)\n\n # Global error handling using HTTP status codes.\n validate_response(_context)\n end",
"title": ""
},
{
"docid": "6be19646a1c7b2bae970008f4e3204d6",
"score": "0.60672927",
"text": "def update\n @draft_company_category = DraftCompanyCategory.find(params[:id])\n\n respond_to do |format|\n if @draft_company_category.update_attributes(params[:draft_company_category])\n\n format.xml \n else\n \n format.xml \n end\n end\n end",
"title": ""
},
{
"docid": "bcec653c233ddbd84cefa6026cf4d7fe",
"score": "0.6066002",
"text": "def update\n @company = Company.first\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to '/admin/company', notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb05f296d2f48cede2e4062f872bca53",
"score": "0.6063022",
"text": "def update\n\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "19b0c6fc6277658003c2891c7df68bc4",
"score": "0.60550374",
"text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n #format.json { head :ok }\n format.json {render :json => {:data => @company , :success => true } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c205c6f9979deea7952943063cb07e8b",
"score": "0.6034757",
"text": "def update(attributes)\n response = JSON.parse(@client.patch(\"companies/#{attributes[:id]}\", attributes).body)\n Promisepay::Company.new(@client, response['companies'])\n end",
"title": ""
},
{
"docid": "3900012e9410da3bc356d762c998a559",
"score": "0.60299504",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: \"Company was successfully updated.\" }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3bd9f81a369dae27c8a42557c12f259c",
"score": "0.60279965",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :json => {company: @company}, status: 200 }\n else\n format.json { render json: {errors: @company.errors}, status: 400 }\n end\n end\n end",
"title": ""
},
{
"docid": "560160db7e56c306b917f8c5685762c6",
"score": "0.60258394",
"text": "def update\r\n respond_to do |format|\r\n if @company.update(company_params)\r\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @company }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "03a341b07d0b0bb17233a7b50b274319",
"score": "0.6024199",
"text": "def update\n @company = Company.find(params[:id])\n # code add to services\n @services = Service.where(:id => params[:services])\n #@company.services.destroy_all\n @company.services << @services \n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de84cc71c029abe5f9faba50987fdad6",
"score": "0.60173035",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "275b54b0be8df62614c2fbea5ab4f153",
"score": "0.6014002",
"text": "def update\n @company = Company.find(params[:id])\n @company.logo = params[:company][:logo].read\n @company.logo_content_type = params[:company][:logo].content_type\n @company.name = params[:company][:name]\n respond_to do |format|\n if @company.save()\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "49474de9c03d723ad50046d912423cce",
"score": "0.6008934",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @company }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6ae4ef84958c4662c2c88525a3010316",
"score": "0.600482",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, flash: { success: 'Company was successfully updated.' } }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aea1c2de1cc78b48a1a7e693b0db379c",
"score": "0.60039634",
"text": "def update\n @admin_company = Admin::Company.find(params[:id])\n\n respond_to do |format|\n if @admin_company.update_attributes(params[:admin_company])\n format.html { redirect_to @admin_company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7da62285947a1ca779b6229c23949385",
"score": "0.6003361",
"text": "def update\n\t\trespond_to do |format|\n\t\t\tif @company.update(company_params)\n\t\t\t\tformat.html { redirect_to @company, notice: 'Company 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: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "3a746638f344fbf63acdb8639f9e32e4",
"score": "0.59992963",
"text": "def update\n respond_to do |format|\n if @companydoc.update(companydoc_params)\n format.html { redirect_to @companydoc, notice: 'Companydoc was successfully updated.' }\n format.json { render :show, status: :ok, location: @companydoc }\n else\n format.html { render :edit }\n format.json { render json: @companydoc.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d5c19f90f51e45ac7ec04cae8da104d1",
"score": "0.5989462",
"text": "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to admin_companies_path, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b0bae8aa6a72db29d0f9bf298b72d544",
"score": "0.5984497",
"text": "def update\n # Logic to edit a record and submit to the DB\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "72df2710c0d82716f017abb27076ba7a",
"score": "0.5983226",
"text": "def update\n @companium = Companium.find(params[:id])\n\n respond_to do |format|\n if @companium.update_attributes(params[:companium])\n format.html { redirect_to(@companium, :notice => 'Companium was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @companium.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc23a6045174d9fdbe11a5f6a58a76e0",
"score": "0.5980759",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15022ad48de6ba40372c946c27cc9505",
"score": "0.5969157",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15022ad48de6ba40372c946c27cc9505",
"score": "0.5969157",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15022ad48de6ba40372c946c27cc9505",
"score": "0.5969157",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c54fec48286b5f2a91950ab2e1e04fcb",
"score": "0.59678125",
"text": "def update\n @company = Company.find_by_slug(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca5f8daa7a2b54fd441551c1ce232f7f",
"score": "0.5962363",
"text": "def update_item(companyId, id, model) path = \"/api/v2/companies/#{companyId}/items/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end",
"title": ""
},
{
"docid": "1b27199b0ed5d74b48902e44d5f5bc7d",
"score": "0.59570783",
"text": "def test_it_updates_a_company\n result = Kirus::Company.first.update(name: 'company1')\n\n assert_equal \"company1\", result[:response][\"name\"]\n assert result[:status] == 200\n refute_nil result\n end",
"title": ""
},
{
"docid": "500c7ec4a84f0a69544cc486f957735c",
"score": "0.5954941",
"text": "def update\n\n respond_to do |format|\n # Optionally update the address, if applicable\n if not params[:address].nil?\n if @company.address.nil?\n if not @company.build_address(address_params).save # Try to create a new one\n format.json { render json: @company.address.errors, status: :unprocessable_entity }\n end\n elsif not @company.address.update(address_params) # Try to edit the existing\n format.json { render json: @company.address.errors, status: :unprocessable_entity }\n end\n end\n \n # Add/remove person\n if not params[:person].nil? then\n set_person params[:person][:id]\n action = params[:person][:action]\n if action == 'add'\n @company.people << @person\n elsif action == 'remove'\n @company.people.delete(@person)\n else\n format.json { render json: { :error => \"Invalid Action\" }, status: :unprocessable_entity }\n end\n end\n\n if params[:company].nil? || @company.update(company_params)\n format.json { head :no_content }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28a2e8ff3b9fb4deb017637e40d563cb",
"score": "0.5953143",
"text": "def update\n\t respond_to do |format|\n\t if @company.update(company_params)\n\t format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n\t format.json { render :show, status: :ok, location: @company }\n\t else\n\t format.html { render :edit }\n\t format.json { render json: @company.errors, status: :unprocessable_entity }\n\t end\n\t end\n\t end",
"title": ""
},
{
"docid": "06b35aaabd9f8622bb13108b69b487c1",
"score": "0.59525865",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: t('company.updated') }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e1587ac6f78a8e2b4eb8b786984fe7b",
"score": "0.59491533",
"text": "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to edit_company_path, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eed5cd3ccd608a272866af3970de8942",
"score": "0.5944094",
"text": "def update_company\n begin\n company = Company.find(params[:id])\n if company.update_attributes(JSON.parse(request.raw_post))\n render json: {result: \"OK\"}.to_json\n else\n render json: {result: \"Error\", message: company.errors.full_messages}.to_json\n end\n rescue \n render json: {result: \"Invalid request\"}.to_json\n end \n end",
"title": ""
},
{
"docid": "1394c5115d238a5d7900f5303d385b56",
"score": "0.59392744",
"text": "def update\n @royalty_company = RoyaltyCompany.find(params[:id])\n\n respond_to do |format|\n if @royalty_company.update_attributes(params[:royalty_company])\n format.html { redirect_to(royalty_companies_path, :notice => 'Royalty company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @royalty_company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6075f508cbdbdbe41644742b7bf46b26",
"score": "0.5936492",
"text": "def update\n if @company.update(company_params)\n render :show, status: :ok, location: @company\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"title": ""
}
] |
ddb49ca9c8b25dec42678d06f8086a53
|
Get separate frame from existing image. Image data is passed in a request stream.
|
[
{
"docid": "7d48d9b94bbb1dfdb6547c5a3ec7a062",
"score": "0.68156785",
"text": "def create_image_frame_from_request_body\n puts('Get separate frame from existing image from request body')\n\n frame_id = 1 # Index of the frame\n out_path = nil\n storage = nil # We are using default Cloud Storage\n\n input_stream = File.open(File.join(ImagingBase::EXAMPLE_IMAGES_FOLDER, get_sample_image_file_name), 'r')\n request = AsposeImagingCloud::CreateImageFrameRequest.new(\n input_stream, frame_id, nil, nil, nil, nil, nil, nil, nil, nil, out_path, storage)\n\n puts(\"Call CreateImageFrame with params: frame Id: #{frame_id}\")\n\n updated_image = imaging_api.create_image_frame(request)\n save_updated_image_to_output('SingleFrameFromRequest.djvu', updated_image)\n puts\n end",
"title": ""
}
] |
[
{
"docid": "98a0ee86809c325603567aedc6affcbe",
"score": "0.6078323",
"text": "def create_image_frame_range_from_request_body\n puts('Get separate frame range from existing image from request body')\n\n start_frame_id = 1 # Index of the first frame in range\n end_frame_id = 4 # Index of the last frame in range\n out_path = nil\n storage = nil # We are using default Cloud Storage\n\n input_stream = File.open(File.join(ImagingBase::EXAMPLE_IMAGES_FOLDER, get_sample_image_file_name), 'r')\n request = AsposeImagingCloud::CreateImageFrameRangeRequest.new(\n input_stream, start_frame_id, end_frame_id, nil, nil, nil, nil, nil, nil, nil, nil, out_path, storage)\n\n puts(\"Call CreateImageFrameRange with params: start frame Id: #{start_frame_id}; end frame id: #{end_frame_id}\")\n\n updated_image = imaging_api.create_image_frame(request)\n save_updated_image_to_output('FrameRangeFromRequest.djvu', updated_image)\n puts\n end",
"title": ""
},
{
"docid": "0a364461e8e08beaac1851e4f0426ad0",
"score": "0.60021466",
"text": "def extract\n manipulate! do |img|\n img.frames.second\n end\n end",
"title": ""
},
{
"docid": "0175cfa534ace9c772cf0de99c08f86c",
"score": "0.58973396",
"text": "def read_frame; end",
"title": ""
},
{
"docid": "1f2cc0fc6424d8f9d74820b6ccb430af",
"score": "0.573137",
"text": "def extract_frame_from_raw(frame)\n #@render_frames ||= `#{gnash_binary} #{downloader.filename} -D #{raw_filename} --max-advances #{max_advances} 1 -j 500 -k 500`\n render_frame!(frame)\n\n File.open('rb', raw_filename) do |file|\n file.seek(frame_offset(frame))\n file.read(frame_size)\n end\n end",
"title": ""
},
{
"docid": "77c0bfed53a7f26fef5f398574bf0abb",
"score": "0.5712684",
"text": "def get_image_from_stream(stream_object)\n paths = \"\"\n if ((stream_object/\"img\") != nil)\n (stream_object/\"img\").each do |img|\n paths = paths + '|' + img.attributes['src']\n end\n image_url = paths.split('|')[1]\n image_url = image_url.to_s\n else\n image_url = \"\"\n end\n image_url\nend",
"title": ""
},
{
"docid": "a2a4d4b0247e21f8ca0b6e78b6fd51f1",
"score": "0.5689823",
"text": "def received_frame(frame_data); end",
"title": ""
},
{
"docid": "0ab4f2e926cdf5fa0e8ab1d0070cfe77",
"score": "0.5651945",
"text": "def decode(stream)\n header = stream.gets\n lines = []\n until stream.eof?\n lines << stream.gets\n end\n data = []\n image = nil\n page = nil\n w, h = nil, nil\n y = 0\n comment = ''\n lines.each do |line|\n if line[0] == '#'\n comment << line.chomp.sub(/\\A#/, '')\n next\n end\n if !w\n w , h = line.chomp.split(' ').map { |v| v.to_i }\n next\n end\n # Converts 1 to true, rest to false.\n bits = line.chomp.split('').map { |v| (v == '1') }\n data += bits\n end\n image = Image.new(w, h, :mode => :monochrome, :data => data)\n image.comment = comment\n return image\n end",
"title": ""
},
{
"docid": "7383b544c7ade9a16cedcb80fb2402d1",
"score": "0.56440777",
"text": "def get_image_frame_from_storage\n puts('Get separate frame from existing image in cloud storage')\n\n upload_sample_image_to_cloud\n\n frame_id = 1 # Index of the frame\n folder = ImagingBase::CLOUD_PATH # Input file is saved at the Examples folder in the storage\n storage = nil # We are using default Cloud Storage\n\n request = AsposeImagingCloud::GetImageFrameRequest.new(\n get_sample_image_file_name, frame_id, nil, nil, nil, nil, nil, nil, nil, nil, folder, storage)\n\n puts(\"Call GetImageFrame with params: frame Id: #{frame_id}\")\n\n updated_image = imaging_api.get_image_frame(request)\n save_updated_image_to_output('SingleFrame.djvu', updated_image)\n puts\n end",
"title": ""
},
{
"docid": "04660e16e6fe735739dffd1f841eb85e",
"score": "0.5642627",
"text": "def get_frame(frame_nr = @current_frame)\n remembered_frame_nr = @current_frame\n jump_to_frame(frame_nr)\n frame_image = self.copy\n jump_to_frame(remembered_frame_nr)\n return frame_image\n end",
"title": ""
},
{
"docid": "ece36c6040fc02ab042e6fcfa4c94d20",
"score": "0.56339425",
"text": "def only_first_frame\n manipulate! do |img|\n if img.mime_type.match /gif/\n if img.scene == 0\n img = img.cur_image #Magick::ImageList.new( img.base_filename )[0]\n else\n img = nil # avoid concat all frames\n end\n end\n img\n end\n end",
"title": ""
},
{
"docid": "8cf95af6ec15d2b72f2531e7ffce6de0",
"score": "0.55996525",
"text": "def stream_image\n if Ibox.find(session[:ibox_id])\n @currentIbox = Ibox.find(session[:ibox_id])\n @cameras = @currentIbox.cameras\n autorizado = false\n for i in 0..@cameras.length-1\n if @cameras[i][:id].to_s == params[:id].to_s\n autorizado = true\n break\n end\n end\n if autorizado \n camera = Camera.find(params[:id])\n require 'net/http'\n require 'uri'\n ws = 'http://' + camera.ip + ':' + camera.port\n url = URI.parse(ws)\n if testConnection(params[:id]) == true \n begin\n req = Net::HTTP::Get.new(url.path + '/image/jpeg.cgi')\n req.basic_auth camera.user, camera.password\n res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }\n send_data res.body, :type=> 'image/jpeg' \n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,SocketError => e\n end\n else\n redirect_to view_context.image_path('camara_error.png')\n end\n else\n redirect_to :controller=>\"home\", :action=>\"index\"\n end\n end\n end",
"title": ""
},
{
"docid": "47ce0dce3719060f30d3e9dad74505a1",
"score": "0.55426526",
"text": "def image\r\n @frames[@index]\r\n end",
"title": ""
},
{
"docid": "a842f446453e367762ef045094f152a6",
"score": "0.55022705",
"text": "def png_data(frame)\n File.open(filename(frame), 'rb') { |f| f.read } if renderer.frame_exists?(frame)\n end",
"title": ""
},
{
"docid": "285d1e389e2e2b37f729a0a37a8352c0",
"score": "0.547517",
"text": "def extract_image_frame_properties_from_request_body\n puts('Get separate frame properties of existing image from request body')\n\n frame_id = 1 # Number of a frame\n\n input_stream = File.open(File.join(ImagingBase::EXAMPLE_IMAGES_FOLDER, get_sample_image_file_name), 'r')\n request = AsposeImagingCloud::ExtractImageFramePropertiesRequest.new(input_stream, frame_id)\n\n puts(\"Call ExtractImageFrameProperties with params: frame Id: #{frame_id}\")\n\n response = imaging_api.extract_image_frame_properties(request)\n output_properties_to_file('TiffFramePropertiesFromRequest.tiff', response)\n puts\n end",
"title": ""
},
{
"docid": "6838e85053a6a2e83ae945d82ad559ba",
"score": "0.54697067",
"text": "def get_source_image\n status, headers, body = @app.call(@env.merge(\n \"PATH_INFO\" => @source\n ))\n unless (status >= 200 && status < 300) &&\n (headers[\"Content-Type\"].split(\"/\").first == \"image\")\n throw :halt, [status, headers, body]\n end\n\n @source_headers = headers\n\n if !head?\n if body.respond_to?(:path)\n ::File.open(body.path, 'rb')\n elsif body.respond_to?(:each)\n data = ''\n body.each { |part| data << part.to_s }\n Tempfile.new(::File.basename(@path)).tap do |f|\n f.binmode\n f.write(data)\n f.close\n end\n end\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "27416b08b212d0c3651306c5b1774209",
"score": "0.54646254",
"text": "def image\n @images[@action][@frame_num]\n end",
"title": ""
},
{
"docid": "53dc6fd3fdd508cae47765a9d1fa93d6",
"score": "0.546081",
"text": "def get_source_image\n status, headers, body = @app.call(@env.merge(\n \"PATH_INFO\" => @source\n ))\n\n unless (status >= 200 && status < 300) &&\n (headers[\"Content-Type\"].split(\"/\").first == \"image\")\n throw :halt, [status, headers, body]\n end\n\n @source_headers = headers\n\n if !head?\n if body.respond_to?(:path)\n ::File.open(body.path, 'rb')\n elsif body.respond_to?(:each)\n data = ''\n body.each { |part| data << part.to_s }\n Tempfile.new(::File.basename(@path)).tap do |f|\n f.binmode\n f.write(data)\n f.close\n end\n end\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "45c7a4dbb300c08b59f91d5fe816d996",
"score": "0.54573816",
"text": "def get_image_frame_and_upload_to_storage\n puts('Get separate frame from existing image and upload to cloud storage')\n\n upload_sample_image_to_cloud\n\n frame_id = 1 # Index of the frame\n folder = ImagingBase::CLOUD_PATH # Input file is saved at the Examples folder in the storage\n storage = nil # We are using default Cloud Storage\n\n request = AsposeImagingCloud::GetImageFrameRequest.new(\n get_sample_image_file_name, frame_id, nil, nil, nil, nil, nil, nil, nil, nil, folder, storage)\n\n puts(\"Call GetImageFrame with params: frame Id: #{frame_id}\")\n\n updated_image = imaging_api.get_image_frame(request)\n upload_image_to_cloud('SingleFrame.djvu', updated_image)\n puts\n end",
"title": ""
},
{
"docid": "76f479fb8dce3bd221b4c58b01433523",
"score": "0.54527867",
"text": "def extract_image(entry)\n @sio.pos = entry[:offset]\n raw = @sio.read(entry[:size])\n if png?(raw)\n raw\n else\n bmp = Bitmapper.new(raw, entry)\n bmp.bitmap\n ChunkyPNG::Image.from_rgba_stream(entry[:width], entry[:height], bmp.to_stream)\n end\n end",
"title": ""
},
{
"docid": "c5d07736af5eef9b1d9bed7add3862c0",
"score": "0.53991205",
"text": "def dup_src\n ImageServicesFactory.make_image(from_java_bytes)\n end",
"title": ""
},
{
"docid": "cfb2ed705abff3d40d5c3ba97dff5aed",
"score": "0.53942233",
"text": "def get_frame\n return nil if @stream.eof?\n return nil if @stream.peek(1) == TRAILER\n\n begin\n Frame.parse(@stream, global_color_table)\n rescue => e\n @stream.close\n raise e\n end\n end",
"title": ""
},
{
"docid": "59ba880e9422205f7610d2f191523bd6",
"score": "0.53515834",
"text": "def image_from(src)\n if src.is_a?(ActionController::UploadedStringIO) or \n src.is_a?(ActionController::UploadedTempfile) or\n src.is_a?(File) or\n src.is_a?(Tempfile)\n src.rewind\n data = src.read\n else\n data = src\n end\n \n Magick::Image.from_blob(data).first\n end",
"title": ""
},
{
"docid": "9558853fe621f6c03dfea8db0ab3dd1f",
"score": "0.5325384",
"text": "def frame(image, frame)\n %x{ convert '#{image}' \\\n \\\\( '#{frame}' -resize #{@width}x#{@height}! -unsharp 1.5x1.0+1.5+0.02 \\\\) -flatten \\\n '#{image}' }\n image\n end",
"title": ""
},
{
"docid": "cb16ad7b48fd3982e433dbdf2bc41e32",
"score": "0.53227276",
"text": "def read\n image = @processor.read_with_processor(@source.to_s)\n new_image = yield(image)\n from_blob(new_image.to_blob, File.extname(@source.to_s))\n self\n end",
"title": ""
},
{
"docid": "2ad46433ffb2bf6468c1e5fe6794ef10",
"score": "0.5317866",
"text": "def build_screen_capture\n raw_image_data = member_params[:screen_capture]\n if raw_image_data.present?\n # Create a new tempfile named fileupload\n tempfile = Tempfile.new('fileupload')\n tempfile.binmode\n\n # Get the raw image data and decode it with base64 then write it to the tempfile\n tempfile.write(Base64.decode64(URI::unescape(raw_image_data)[22..-1]))\n tempfile.close\n\n # Create a new uploaded file\n filename = \"#{Digest::MD5.hexdigest(raw_image_data)}.png\"\n @feedback.screen_capture = ActionDispatch::Http::UploadedFile.new(tempfile: tempfile, filename: filename, type: 'image/png')\n end\n end",
"title": ""
},
{
"docid": "f0ab05bffe337a40ab351d0e5669481f",
"score": "0.5316002",
"text": "def receive_image\n bytes_to_read = decode_length(read_int)\n bytes_to_read -= 2**32 if bytes_to_read > 2**31 # unsigned to signed\n raise ProtocolException.new(bytes_to_read) if bytes_to_read < 0\n data = read(bytes_to_read)\n save_image(decode(data))\n end",
"title": ""
},
{
"docid": "d866e0c00b2898100c2d098b11fb8518",
"score": "0.5274749",
"text": "def receive_data(frame); end",
"title": ""
},
{
"docid": "5ca9b5a0219364751560a69e9b0af8c0",
"score": "0.5259655",
"text": "def create_frame\n frames.last.copy\n end",
"title": ""
},
{
"docid": "2eb9f9d00e6b99d8cea7a12c8338f882",
"score": "0.5233904",
"text": "def get_video_frame_from_stream stream\n url = self.twitch.base_url + \"/streams/#{stream}\"\n response = self.twitch.adapter.request('get', url, :headers => {\n 'Client-ID' => self.client_id\n })\n p response\n end",
"title": ""
},
{
"docid": "85543e4f547624527ab46f872a677ab0",
"score": "0.52068645",
"text": "def asset_getframe(args = { }, opts = { })\n\n end",
"title": ""
},
{
"docid": "dad8f457d6e4b63743279688102985c7",
"score": "0.5205417",
"text": "def stream\n rack_response[2]\n end",
"title": ""
},
{
"docid": "41037f6ce7095505f1d77a9ed02c78a8",
"score": "0.5199845",
"text": "def face\n return nil unless image\n Rails.cache.fetch(image) do\n Faraday.head(image).headers[:location] || image\n end\n end",
"title": ""
},
{
"docid": "fa3f38907bf8b2ccf69ef8196af89a82",
"score": "0.5190846",
"text": "def recv_frame\n loop do\n frame = @incoming.next\n if frame.nil?\n recv_bytes\n next\n end\n\n case frame.type\n when :text\n return frame.data\n when :binary\n return frame.data\n when :ping\n send_pong frame.data\n when :pong\n # Ignore pong, since we don't ping.\n when :close\n @socket.close\n @closed = true\n end\n end\n end",
"title": ""
},
{
"docid": "54d39d3de7d89c9fd796497c983a5332",
"score": "0.51782966",
"text": "def recv_frame\n data = ''\n until @sock.eof?\n data << @sock.read(1)\n end\n data\n end",
"title": ""
},
{
"docid": "3cddb1bd5cd1d4780907bb096a929382",
"score": "0.5177055",
"text": "def get_camera_data(pframe)\n get_frame_data(@camera_data, pframe)\n end",
"title": ""
},
{
"docid": "8d771517370ac3769526cb608ab85d8d",
"score": "0.5143904",
"text": "def data\n image_file.rewind\n image_file.read\n end",
"title": ""
},
{
"docid": "15fd8a2a6d0b93f4a2ee7b1d2e1d731a",
"score": "0.514068",
"text": "def frame_obtain\n # Only permit for valid poses & frames\n if @frame != nil\n self.src_rect.set(@height * @frame, 0 , @height, @height)\n end\n end",
"title": ""
},
{
"docid": "868e453021b6fdd1b31f2644d57da064",
"score": "0.51265603",
"text": "def get \n headers['Cache-Control'] = 'public; max-age=259200000' # cache for 100 months\n images = ImageList.new\n\n parts = params[:spec].split('::')\n parts.each do |part| \n size, top, bottom = part.split(':')\n bottom ||= top\n gradient = GradientFill.new(0,0,1,0, \"##{top}\", \"##{bottom}\")\n images << Image.new(1, size.to_i, gradient)\n end\n\n img = images.append(true)\n\n img.format = params[:format]\n render :text => img.to_blob, :content_type => \"image/#{params[:format]}\"\n end",
"title": ""
},
{
"docid": "aeed4674a87c3bd119b9ffdb9fa0483b",
"score": "0.51138544",
"text": "def process_image_request(image_request)\n # Recover the source image URL and the pipeline instructions (all the image ops)\n source_image_uri, pipeline = image_request.src_url, image_request.pipeline\n raise 'Image pipeline has no operators' if pipeline.empty?\n\n # Compute an ETag which describes this image transform + image source location.\n # Assume the image URL contents does _never_ change.\n etag = image_request.cache_etag\n\n # Download/copy the original into a Tempfile\n fetcher = ImageVise.fetcher_for(source_image_uri.scheme)\n source_file = Measurometer.instrument('image_vise.fetch') do\n fetcher.fetch_uri_to_tempfile(source_image_uri)\n end\n file_format = FormatParser.parse(source_file, natures: [:image]).tap { source_file.rewind }\n raise UnsupportedInputFormat.new(\"%s has an unknown input file format\" % source_image_uri) unless file_format\n raise UnsupportedInputFormat.new(\"%s does not pass file constraints\" % source_image_uri) unless permitted_format?(file_format)\n\n render_destination_file = Tempfile.new('imagevise-render').tap{|f| f.binmode }\n\n # Do the actual imaging stuff\n expire_after = Measurometer.instrument('image_vise.render_engine.apply_pipeline') do\n apply_pipeline(source_file.path, pipeline, file_format, render_destination_file.path)\n end\n\n # Catch this one early\n render_destination_file.rewind\n raise EmptyRender, \"The rendered image was empty\" if render_destination_file.size.zero?\n\n render_file_type = detect_file_type(render_destination_file)\n\n [render_destination_file, render_file_type, etag, expire_after]\n ensure\n ImageVise.close_and_unlink(source_file)\n end",
"title": ""
},
{
"docid": "47563ca409d229638f254ef57a2d8cd6",
"score": "0.51059365",
"text": "def decode_png_image_pass(stream, width, height, color_mode, depth, start_pos, decoding_palette); end",
"title": ""
},
{
"docid": "e754056e51d14eddda1dbc9f3e8a0364",
"score": "0.51041335",
"text": "def pop_frame\n if @ancillary_chunks[:fcTL].size > 0 && @ancillary_chunks[:fdAT].size > 0\n frame_control = @ancillary_chunks[:fcTL].pop\n frame_data = @ancillary_chunks[:fdAT].pop\n\n\n n_frames = @ancillary_chunks[:fcTL].size\n n_plays = 0\n data = [n_frames, n_plays].pack(\"N*\")\n actl_chunk = Imgrb::Chunks::ChunkacTL.new(data)\n @ancillary_chunks[:acTL] = [actl_chunk]\n\n @header = @header.to_apng_header(actl_chunk.get_data[0],\n actl_chunk.get_data[1], @bitmap)\n\n #FIXME:\n #SHOULD PROBABLY RETURN THE DATA AS AN ARRAY OF AN IMAGE OBJECT AND SOME\n #FRAME DATA INSTEAD!\n return [frame_data, frame_control]\n else\n return nil\n end\n end",
"title": ""
},
{
"docid": "e27fc7c1fd87fe0821237781116d58ad",
"score": "0.5102869",
"text": "def from_bgr_stream(width, height, stream); end",
"title": ""
},
{
"docid": "8d9a594b871e69da77a07b76a01caf06",
"score": "0.5101185",
"text": "def read\n process_image!\n if options[:preprocess]\n # | / - \\ \n spinner = \"|/-\\\\\"\n text_frames = image.frames.map.with_index do |frame, index|\n print \"Loading frame #{index + 1}/#{image.frames.length}... #{spinner[index % 4]} \\r\"\n if options[:mode] == :color\n convert_to_color(frame.get_pixels)\n else\n convert_to_ascii(frame.get_pixels)\n end\n end\n\n text_frames.each do |text_frame|\n yield text_frame\n end\n else\n image.frames.each do |frame|\n if options[:mode] == :color\n yield convert_to_color(frame.get_pixels)\n else\n yield convert_to_ascii(frame.get_pixels)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "094719faae34d8f7249288feee1665d9",
"score": "0.5097807",
"text": "def from_datastream(ds)\n width = ds.header_chunk.width\n height = ds.header_chunk.height\n color_mode = ds.header_chunk.color\n interlace = ds.header_chunk.interlace\n depth = ds.header_chunk.depth\n\n if width == 0 || height == 0\n raise ExpectationFailed, \"Invalid image size, width: #{width}, height: #{height}\"\n end\n\n decoding_palette, transparent_color = nil, nil\n case color_mode\n when ChunkyPNG::COLOR_INDEXED\n decoding_palette = ChunkyPNG::Palette.from_chunks(ds.palette_chunk, ds.transparency_chunk)\n when ChunkyPNG::COLOR_TRUECOLOR\n transparent_color = ds.transparency_chunk.truecolor_entry(depth) if ds.transparency_chunk\n when ChunkyPNG::COLOR_GRAYSCALE\n transparent_color = ds.transparency_chunk.grayscale_entry(depth) if ds.transparency_chunk\n end\n\n decode_png_pixelstream(ds.imagedata, width, height, color_mode, depth, interlace, decoding_palette, transparent_color)\n end",
"title": ""
},
{
"docid": "1735d4825f7dae26f4c3b6b2a23179cc",
"score": "0.50964147",
"text": "def first_img\n matchData = self.body.match(\n /(http|www).*(png|jpg|jpeg|svg|gif)/\n );\n\n return nil unless matchData\n\n return matchData[0]\n end",
"title": ""
},
{
"docid": "cc8b6070a9bb696f9d989d8fc522c588",
"score": "0.50949144",
"text": "def read_frame\n\t\t\t\tframe = @framer.read_frame(@local_settings.maximum_frame_size)\n\t\t\t\t# puts \"#{self.class} #{@state} read_frame: class=#{frame.class} stream_id=#{frame.stream_id} flags=#{frame.flags} length=#{frame.length} (remote_stream_id=#{@remote_stream_id})\"\n\t\t\t\t# puts \"Windows: local_window=#{@local_window.inspect}; remote_window=#{@remote_window.inspect}\"\n\t\t\t\t\n\t\t\t\treturn if ignore_frame?(frame)\n\t\t\t\t\n\t\t\t\tyield frame if block_given?\n\t\t\t\tframe.apply(self)\n\t\t\t\t\n\t\t\t\treturn frame\n\t\t\trescue GoawayError => error\n\t\t\t\t# Go directly to jail. Do not pass go, do not collect $200.\n\t\t\t\traise\n\t\t\trescue ProtocolError => error\n\t\t\t\tsend_goaway(error.code || PROTOCOL_ERROR, error.message)\n\t\t\t\t\n\t\t\t\traise\n\t\t\trescue HPACK::Error => error\n\t\t\t\tsend_goaway(COMPRESSION_ERROR, error.message)\n\t\t\t\t\n\t\t\t\traise\n\t\t\tend",
"title": ""
},
{
"docid": "9bc0ff05a6fd608c10438e19ff8d0e5b",
"score": "0.5084043",
"text": "def picdata\n first_from_pix :imgdata\n end",
"title": ""
},
{
"docid": "0396d215202475fa65721d83e2421e8c",
"score": "0.50732327",
"text": "def visual_detect_objects_image_from_stream\n puts('Visualize detected object on an image that is passed in a request stream')\n\n method = \"ssd\"\n threshold = 50\n includeLabel = true\n includeScore = true\n allowedLabels = \"cat\"\n blockedLabels = \"dog\"\n color = nil\n outPath = nil\n storage = nil # We are using default Cloud Storage\n input_stream = File.open(File.join(ImagingBase::EXAMPLE_IMAGES_FOLDER, get_sample_image_file_name), 'r')\n\n request = AsposeImagingCloud::CreateVisualObjectBoundsRequest.new(\n input_stream, method, threshold, includeLabel, includeScore, allowedLabels, blockedLabels, color, outPath, storage)\n\n puts(\"Call CreateVisualObjectBoundsRequest with params: method: #{method}, threshold: #{threshold}, includeLabel: #{includeLabel}, includeScore: #{includeScore}; color: #{color}\")\n\n updated_image = imaging_api.create_visual_object_bounds(request)\n save_updated_sample_image_to_output(updated_image, false, \"jpg\")\n puts\n end",
"title": ""
},
{
"docid": "ec5b0208ca038862b0c536db9595a97d",
"score": "0.50680804",
"text": "def decode_png_str_scanline_sub(stream, pos, prev_pos, line_length, pixel_size); end",
"title": ""
},
{
"docid": "d60442988c5f31b1e7b9b284f54ed5f0",
"score": "0.5058345",
"text": "def render_image_data(image_data); render_image(image_data, :data); end",
"title": ""
},
{
"docid": "4d08a81b4b64e197d2880b22317bd00f",
"score": "0.5056383",
"text": "def split_raw_frames\n @raw_output.split('[/FRAME]').take_while { |f|\n f['[FRAME']\n }\n end",
"title": ""
},
{
"docid": "d6833a6370f3ba512c2e706660daaa97",
"score": "0.5045378",
"text": "def frame\n @frame\n end",
"title": ""
},
{
"docid": "10da966eb699704524b46bfd27a16c17",
"score": "0.503972",
"text": "def png_data(frame)\n frame_exists?(frame) ? frame_data(frame) : nil\n end",
"title": ""
},
{
"docid": "cf34428199b288f0a4af21be1f234ad2",
"score": "0.50384706",
"text": "def process_image\n sleep 4 \n @ffmpeg = IO.popen(\"/usr/local/bin/ffmpeg -f image2pipe -vcodec png -r 4 -i imagepipe.png -metadata title=\\\"Test Video\\\" -pix_fmt yuv420p -threads 4 -y output.mp4 >> encoding.log 2>&1\")\n @ffmpeg_pid = @ffmpeg.pid\n outpipe = open(\"imagepipe.png\", 'w')\n while true \n @buffer.format = 'png'\n @buffer.write(outpipe)\n outpipe.flush\n sleep 0.1\n end\n end",
"title": ""
},
{
"docid": "d706495b879e408c4c6e6873212a8ff9",
"score": "0.50362235",
"text": "def decode_png_without_interlacing(stream, width, height, color_mode, depth, decoding_palette); end",
"title": ""
},
{
"docid": "248547b071a0c4f69698056f430dc7c5",
"score": "0.50039274",
"text": "def process_image\n\n end",
"title": ""
},
{
"docid": "53631f6e38066e4dadc9da6c7199b037",
"score": "0.5000803",
"text": "def send_html_with_push stream_id\n # Grab the HTML\n html = Tilt.new(\"index.html.erb\").render\n\n # Set HTML headers\n html_headers = {\n \"status\" => \"200 OK\",\n \"version\" => \"HTTP/1.1\",\n \"Content-Type\" => \"text/html\"\n }\n\n # Initiate the response stream\n syn_reply = SPDY::Protocol::Control::SynReply.new zlib_session: @parser.zlib_session\n send_data syn_reply.create(stream_id: stream_id, headers: html_headers).to_binary_s\n\n # Create server push stream, associated to the request stream\n syn_stream = SPDY::Protocol::Control::SynStream.new zlib_session: @parser.zlib_session\n syn_stream.associated_to_stream_id = stream_id\n\n # Send all the images\n Dir[\"images/*.jpg\"].each_with_index do |img, i|\n # Server push stream ID is an increasing EVEN number\n res_stream_id = 2 * (i + 1)\n\n # Image headers\n img_headers = {\n \"status\" => \"200\",\n \"version\" => \"HTTP/1.1\",\n \"url\" => \"https://localhost:10000/#{img}\",\n \"content-type\" => Rack::Mime.mime_type(File.extname(img))\n }\n\n # Send headers\n send_data syn_stream.create(flags: 2, stream_id: res_stream_id, headers: img_headers).to_binary_s\n\n # Send data\n send_data SPDY::Protocol::Data::Frame.new.create(stream_id: res_stream_id, data: File.binread(img)).to_binary_s\n\n # End response\n send_data SPDY::Protocol::Data::Frame.new.create(stream_id: res_stream_id, flags: 1).to_binary_s\n end\n\n # Send HTML\n send_data SPDY::Protocol::Data::Frame.new.create(stream_id: stream_id, data: html).to_binary_s\n\n # Finish response\n fin = SPDY::Protocol::Data::Frame.new\n send_data fin.create(stream_id: stream_id, flags: 1).to_binary_s\n end",
"title": ""
},
{
"docid": "3f37448ba6ee0854ed755f940826f4ad",
"score": "0.49948144",
"text": "def get_next_frame\n return nil unless @chunk_buffer.size > 7 # otherwise, cannot read the length\n # octet + short\n offset = 3 # 1 + 2\n # length\n payload_length = @chunk_buffer[offset, 4].unpack(AMQ::Protocol::PACK_UINT32).first\n # 4 bytes for long payload length, 1 byte final octet\n frame_length = offset + payload_length + 5\n if frame_length <= @chunk_buffer.size\n @chunk_buffer.slice!(0, frame_length)\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "6c6a87f7d3b014cb8f90f0b77b20199d",
"score": "0.49928972",
"text": "def imagedata; end",
"title": ""
},
{
"docid": "e174f272dfd30e92fde36f1ad4d6fab2",
"score": "0.49805337",
"text": "def get_image\n @image_data = Net::HTTP.get('www.bing.com', @uri)\n end",
"title": ""
},
{
"docid": "5b46d7292a2762fc37c7c69ec9851025",
"score": "0.4976513",
"text": "def frame(id); end",
"title": ""
},
{
"docid": "b57234c28890912a2b9640d96c78b04b",
"score": "0.49545553",
"text": "def toFrame(frame)\n # checks if specified string parameter\n if frame.is_a?(String)\n if frame == \"last\"\n frame = @totalFrames - 1\n else\n frame = 0\n end\n end\n # sets frame\n frame = @totalFrames - 1 if frame >= @totalFrames\n frame = 0 if frame < 0\n @currentIndex = frame\n # draws frame\n @actualBitmap.clear\n x, y, w, h = self.box\n @actualBitmap.stretch_blt(Rect.new(x,y,w,h), @bitmap, Rect.new(@currentIndex*(@width/@scale)+x/@scale, y/@scale, w/@scale, h/@scale))\n end",
"title": ""
},
{
"docid": "5f30df2eb8823dd7bbfd9a948bf2290b",
"score": "0.4948625",
"text": "def only_first_frame\n\t\tmanipulate! do |img|\n \n\t\t\tif img.mime_type.match /gif/\n\t\t\t\timg.collapse!\n\t\t\tend\n\t\t\timg\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1623e142326cc1d25c6034e50edb23c9",
"score": "0.49477687",
"text": "def frames; end",
"title": ""
},
{
"docid": "1623e142326cc1d25c6034e50edb23c9",
"score": "0.49477687",
"text": "def frames; end",
"title": ""
},
{
"docid": "d72f5e2b0f5bc34182404bf168ebffaa",
"score": "0.49350986",
"text": "def get_render_data(pframe)\n get_frame_data(@render_data, pframe)\n end",
"title": ""
},
{
"docid": "baddd7cc9489328fb8ed2c6a1936c783",
"score": "0.49345958",
"text": "def decode_png_image_pass(stream, width, height, color_mode, depth, start_pos, decoding_palette)\n pixels = []\n if width > 0 && height > 0\n\n stream << ChunkyPNG::EXTRA_BYTE if color_mode == ChunkyPNG::COLOR_TRUECOLOR\n pixel_decoder = decode_png_pixels_from_scanline_method(color_mode, depth)\n line_length = ChunkyPNG::Color.scanline_bytesize(color_mode, depth, width)\n pixel_size = ChunkyPNG::Color.pixel_bytesize(color_mode, depth)\n\n raise ChunkyPNG::ExpectationFailed, \"Invalid stream length!\" unless stream.bytesize - start_pos >= ChunkyPNG::Color.pass_bytesize(color_mode, depth, width, height)\n\n pos, prev_pos = start_pos, nil\n for _ in 0...height do\n decode_png_str_scanline(stream, pos, prev_pos, line_length, pixel_size)\n pixels.concat(send(pixel_decoder, stream, pos, width, decoding_palette))\n\n prev_pos = pos\n pos += line_length + 1\n end\n end\n\n new(width, height, pixels)\n end",
"title": ""
},
{
"docid": "b02a1829f91eca2127c51e3ca6e30ca2",
"score": "0.49189395",
"text": "def getFrame?( scene, random, image )\n\n rayTracer = RayTracer.new( scene )\n\n aspect = image.height.to_f / image.width.to_f\n\n # do image sampling pixel loop\n image.height.times do |y|\n image.width.times do |x|\n\n # make sample ray direction, stratified by pixels\n\n # make image plane displacement vector coefficients\n xCoefficient = ((x + random.real64) * 2.0 / image.width ) - 1.0\n yCoefficient = ((y + random.real64) * 2.0 / image.height) - 1.0\n\n # make image plane offset vector\n offset = (@right * xCoefficient) + (@up * (yCoefficient * aspect))\n\n sampleDirection = (@viewDirection +\n (offset * Math.tan(@viewAngle * 0.5))).unitize?\n\n # get radiance from RayTracer\n radiance = rayTracer.getRadiance?( @viewPosition, sampleDirection,\n random )\n\n # add radiance to pixel\n image.addToPixel!( x, y, radiance )\n\n end\n end\n\n end",
"title": ""
},
{
"docid": "e767fbff3c9afd8b748cd109931354e4",
"score": "0.49101838",
"text": "def push_image(stream, img_url)\n post stream, 'imgUrl' => img_url\n end",
"title": ""
},
{
"docid": "79fdd4a7d12dfc1fe77f608fb30d25f4",
"score": "0.49092984",
"text": "def generate_cv\n @position = params['position']\n @image = Base64.encode64(open(session['data']['image']).to_a.join).gsub(\"\\n\", '')\n end",
"title": ""
},
{
"docid": "305bba6f08e4ab0e65c733890a85436c",
"score": "0.4905816",
"text": "def execute\n @frames = Kafka::GetFrameService.new(@topic_name).execute\n JSON.parse(@frames)['image']\n end",
"title": ""
},
{
"docid": "aaca654584ad32c179282c4c475bb762",
"score": "0.48881745",
"text": "def frames=(_arg0); end",
"title": ""
},
{
"docid": "6db34f7058c6b13fc318aa065c700396",
"score": "0.48861763",
"text": "def picture_from_url\n PictureProcessor.new(self).picture_from_url\n end",
"title": ""
},
{
"docid": "d5616ecaf9c8e3545f42b6949f833c8c",
"score": "0.48811704",
"text": "def process_frames\n frame = nil\n process_frame(frame) while frame = @sfr.frames.shift\n end",
"title": ""
},
{
"docid": "7d4a803d4ea380e756f3141e3dfc5646",
"score": "0.4881137",
"text": "def decode_png_str_scanline(stream, pos, prev_pos, line_length, pixel_size)\n case stream.getbyte(pos)\n when ChunkyPNG::FILTER_NONE then # rubocop:disable Lint/EmptyWhen # no-op\n when ChunkyPNG::FILTER_SUB then decode_png_str_scanline_sub(stream, pos, prev_pos, line_length, pixel_size)\n when ChunkyPNG::FILTER_UP then decode_png_str_scanline_up(stream, pos, prev_pos, line_length, pixel_size)\n when ChunkyPNG::FILTER_AVERAGE then decode_png_str_scanline_average(stream, pos, prev_pos, line_length, pixel_size)\n when ChunkyPNG::FILTER_PAETH then decode_png_str_scanline_paeth(stream, pos, prev_pos, line_length, pixel_size)\n else raise ChunkyPNG::NotSupported, \"Unknown filter type: #{stream.getbyte(pos)}!\"\n end\n end",
"title": ""
},
{
"docid": "55a49c75b6b9841f072f692b0057e2c5",
"score": "0.48564714",
"text": "def get_page_image\n work_id = params[:work]\n page_num = params[:num] \n work = Work.find(work_id)\n img_path = get_ocr_image_path(work, page_num)\n img = Magick::Image::read(img_path).first\n img.format = 'PNG'\n send_data img.to_blob, :type => \"image/png\", :disposition => \"inline\", :x_sendfile=>true\n end",
"title": ""
},
{
"docid": "3356ce04079bb9b6e5567b37e1d51635",
"score": "0.48544526",
"text": "def image_data=(data)\n regex = /data:(.*);(.*),/\n realdata = regex.match(data).post_match\n\n # decode data and create stream on them\n io = CarrierStringIO.new(Base64.decode64(realdata))\n\n # this will do the thing (poster is mounted carrierwave uploader)\n self.poster = io\n end",
"title": ""
},
{
"docid": "3356ce04079bb9b6e5567b37e1d51635",
"score": "0.48544526",
"text": "def image_data=(data)\n regex = /data:(.*);(.*),/\n realdata = regex.match(data).post_match\n\n # decode data and create stream on them\n io = CarrierStringIO.new(Base64.decode64(realdata))\n\n # this will do the thing (poster is mounted carrierwave uploader)\n self.poster = io\n end",
"title": ""
},
{
"docid": "8ed1c9a026827c420e036d33c80621eb",
"score": "0.4853348",
"text": "def image_data\n return nil unless image_url\n\n remote_image\n end",
"title": ""
},
{
"docid": "84e1d1e4c1700c2141578094e7811b7c",
"score": "0.4852953",
"text": "def from_rgb_stream(width, height, stream); end",
"title": ""
},
{
"docid": "65b3633eecbbca7a9325035712e6ec19",
"score": "0.48458135",
"text": "def image\n StringIO.new(self.byte_content) if self.byte_content && !self.byte_content.empty?\n end",
"title": ""
},
{
"docid": "2fe11688b7ca07570915410fa5ab4e5f",
"score": "0.4842037",
"text": "def fetch_raw_image_data\n require 'uri'\n require 'net/http'\n uri = URI.parse(google_charts_base_url)\n res = Net::HTTP.post_form(uri,\n Hash[*query_string_values(false).flatten])\n res.code == \"200\" ? res.body : nil\n end",
"title": ""
},
{
"docid": "8cbd8aec65a305d810b7e75f02da8acd",
"score": "0.4836973",
"text": "def getImage\n return @img\n end",
"title": ""
},
{
"docid": "b04b5920e90654f71d32095cd6d34224",
"score": "0.4835318",
"text": "def image(image); Api::get_image(image, self); end",
"title": ""
},
{
"docid": "5a08cc88d832fad08fdbf597880185ec",
"score": "0.48319158",
"text": "def header\n @header unless @header.nil?\n @image.pos=0\n @image.read(100)\n end",
"title": ""
},
{
"docid": "aa142efaff66c279b82097c5d6c661e2",
"score": "0.48136634",
"text": "def decode_png_with_adam7_interlacing(stream, width, height, color_mode, depth, decoding_palette); end",
"title": ""
},
{
"docid": "71607fae98294ae1558c166dc7fa393c",
"score": "0.48067543",
"text": "def image()\n imageIP = URI.parse(sesh :image_ip)\n return Ropenstack::Image.new(imageIP, (sesh :current_token))\n end",
"title": ""
},
{
"docid": "81a27c9bc004fb34c604894642f01f80",
"score": "0.48009154",
"text": "def decode_png_str_scanline(stream, pos, prev_pos, line_length, pixel_size); end",
"title": ""
},
{
"docid": "c6b79d9238e36386df737931f2712601",
"score": "0.47964668",
"text": "def frames\n @frames\n end",
"title": ""
},
{
"docid": "2444ce4febca1e77b9de300487d06a02",
"score": "0.47934192",
"text": "def preview(image)\nend",
"title": ""
},
{
"docid": "8723b0a79ec8f70b4441fa3dda43a6e0",
"score": "0.47909114",
"text": "def frame_at(row_index:)\n frames_within(row_range: row_index..row_index).first\n end",
"title": ""
},
{
"docid": "b9651b8c279331478b1b2a0848fd77a2",
"score": "0.47894347",
"text": "def each_frame(opt={}, &block)\n @reader.each_frame(opt.merge({ :stream => index }), &block)\n end",
"title": ""
},
{
"docid": "211a562a7514ebbbe394e5dc37065345",
"score": "0.47870708",
"text": "def get_frame_for(array)\n if !(f = (array.instance_variable_get(:@isrb_frame)))\n f = ImagePanel.createFrame()\n array.instance_variable_set(:@isrb_frame, f)\n end\n f.enclosingFrame().setVisible(true)\n f\n end",
"title": ""
},
{
"docid": "fb459ac1e438a4a0db1a2b32c8a8ea8f",
"score": "0.47831056",
"text": "def process_picture(post)\n data = StringIO.new(Base64.decode64(post[:picture][:data]))\n data.class.class_eval { attr_accessor :original_filename, :content_type }\n data.original_filename = post[:picture][:filename]\n data.content_type = post[:picture][:content_type]\n params[:post][:picture] = data\n end",
"title": ""
},
{
"docid": "f98c51e6495d36b18e08d1adaab389d2",
"score": "0.4781984",
"text": "def decode_png_image_pass(stream, width, height, color_mode, start_pos = 0)\n \n pixel_size = Color.bytesize(color_mode)\n pixel_decoder = case color_mode\n when ChunkyPNG::COLOR_TRUECOLOR then lambda { |bytes| ChunkyPNG::Color.rgb(*bytes) }\n when ChunkyPNG::COLOR_TRUECOLOR_ALPHA then lambda { |bytes| ChunkyPNG::Color.rgba(*bytes) }\n when ChunkyPNG::COLOR_INDEXED then lambda { |bytes| decoding_palette[bytes.first] }\n when ChunkyPNG::COLOR_GRAYSCALE then lambda { |bytes| ChunkyPNG::Color.grayscale(*bytes) }\n when ChunkyPNG::COLOR_GRAYSCALE_ALPHA then lambda { |bytes| ChunkyPNG::Color.grayscale_alpha(*bytes) }\n else raise ChunkyPNG::NotSupported, \"No suitable pixel decoder found for color mode #{color_mode}!\"\n end\n \n pixels = []\n if width > 0\n \n raise ChunkyPNG::ExpectationFailed, \"Invalid stream length!\" unless stream.length - start_pos >= width * height * pixel_size + height\n \n decoded_bytes = Array.new(width * pixel_size, 0)\n for line_no in 0...height do\n\n # get bytes of scanline\n position = start_pos + line_no * (width * pixel_size + 1)\n line_length = width * pixel_size\n bytes = stream.unpack(\"@#{position}CC#{line_length}\")\n filter = bytes.shift\n decoded_bytes = decode_png_scanline(filter, bytes, decoded_bytes, pixel_size)\n\n # decode bytes into colors\n decoded_bytes.each_slice(pixel_size) { |bytes| pixels << pixel_decoder.call(bytes) }\n end\n end\n \n new(width, height, pixels)\n end",
"title": ""
},
{
"docid": "661912dc65c51e96a64d8f2c2b1e706a",
"score": "0.47799698",
"text": "def frame(id)\n @frames[id]\n end",
"title": ""
},
{
"docid": "eaedf0c65c5844b37f2ec51dd88de069",
"score": "0.47795722",
"text": "def tgtFrame; end",
"title": ""
},
{
"docid": "48fd608871242a9670d83e73f662c1dc",
"score": "0.477763",
"text": "def snapshot\n\t\t\tresponse = @connection.get('snapshot.cgi')\n\t\t\tresponse.success? ? ::MiniMagick::Image.read(response.body) : nil\n\t\tend",
"title": ""
},
{
"docid": "9421aff7b086985118507fea0ff70a7d",
"score": "0.47758448",
"text": "def open_original_image_stream(io, type, &block)\n # First load this from the web to a temp file\n tempfile = File.join(Dir.tmpdir, \"talia_down_#{rand 10E16}.#{type.to_sym}\")\n begin\n File.open(tempfile, 'w') do |fio|\n fio << io.read # Download the file\n end\n assit(File.exist?(tempfile))\n open_original_image_file(tempfile, &block)\n ensure\n FileUtils.rm(tempfile) if(File.exist?(tempfile))\n end\n end",
"title": ""
},
{
"docid": "4a9b73c988d702facaf26daa194baf35",
"score": "0.47707236",
"text": "def server_get_image(server)\n image = data_objects(:image, :ObjectData)\n return image unless image.nil?\n\n image = process_get(:image, server[:image_id])\n\n return Lorj::Data.new if image.nil?\n\n register(image)\n end",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.