query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
number, return the negative of that number. If the number is 0 or negative, return the original number.
def negative(number) number > 0 ? (number * -1) : number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negative(number)\n if number > 0\n -number\n else\n return number\n end\nend", "def negative(number)\n return number if number.negative? || number.zero?\n -number\nend", "def negative(number)\n number > 0 ? -number : number\nend", "def negative(number)\n number > 0 ? -number : number\nend", "def negative(number)\n number <= 0 ? number : number * -1\nend", "def make_numbers_negative(number)\n\tif number <= 0\n\t\treturn number\n\telse\n\t\tconvert = number\n\t\tconvert /= -1\n\tend\nend", "def make_negative(number)\n if number > 0\n number - (-number * -2)\n else\n number\n end\nend", "def negative(number)\n -(number.abs)\nend", "def negative(num)\n\treturn -num unless num <= 0\n\tnum\nend", "def make_negative(number)\n if number > 0\n number - (number.abs * 2)\n else \n number\n end\nend", "def negative(number)\n -number.abs\nend", "def negative(number)\n -number.abs\nend", "def negative(number)\n -number.abs\nend", "def negative(number)\n -number.abs\nend", "def makeNegative(num)\r\n if num >= 0\r\n return num * (-1)\r\n else\r\n return num * 1\r\n end\r\n end", "def not_zero(number)\n if number == 0\n return \"-\"\n else\n return number\n end\n end", "def negative(num)\n return num if num.negative?\n -num\nend", "def negative(num)\n if num.positive?\n -num\n else\n num\n end\nend", "def negative(num)\n return -num if num > 0\n num\nend", "def make_numbers_negative(number)\n new_number = number if number < 0\n new_number = -number if number > 0\n new_number\nend", "def negative(num)\n num > 0 ? -num : num # or -num.abs\nend", "def negative(num)\n num > 0 ? -num : num\nend", "def negative(num)\n num > 0 ? -num : num\nend", "def negative(num)\n num > 0 ? -num : num\nend", "def negative(num)\n num > 0 ? -num : num\nend", "def negative(num)\n\n if num <=0\n num\n else \n num * -1\n end\nend", "def negative(num)\r\n num > 0 ? -num : num \r\nend", "def negative(num)\n num <= 0 ? num : -num\nend", "def negative(num)\n num <= 0 ? num : -num\nend", "def make_numbers_negative(number)\n number.positive? ? -(number) : number\nend", "def make_numbers_negative(number)\n -number.abs\nend", "def negative2(number)\n -number.abs\nend", "def negative(num)\n num < 0 ? num : -num\nend", "def negative(num)\n num < 0 ? num : -1 * num\nend", "def negative(num)\n if num <= 0 \n return num\n else\n return num - (num * 2)\n end\nend", "def make_negative(num)\r\n num > 0 ? -num : num\r\nend", "def negative(num)\n num *= -1 if num > 0\n num\nend", "def neg(num)\n val = Convert(num, :numeric)\n sub(Convert(0, val.type), val)\n end", "def negative(num)\n - num.abs\nend", "def makeNegative(num)\n num < 0 ? num : -num\nend", "def makeNegative(num)\n num > 0 ? num * -1 : num\nend", "def negative(integer)\n integer > 0 ? -integer : integer\nend", "def absolute(number)\n if number < 0\n number = number * -1\n end\n return number\nend", "def negative(num)\n num.positive? ? -num : num\nend", "def make_negative(n)\n -(n.abs)\nend", "def negative(n)\n return n if n <= 0\n -n\nend", "def negative(num)\n # your code goes here\n if num < 0\n return num\n elsif num == 0\n return 0\n else\n return -num\n end\nend", "def negative(integer)\n return integer if integer.negative? || integer == 0\n integer * -1\nend", "def absolute(number)\n if number > 0\n output = number\n else\n output = number * -1\n end\n return output\nend", "def absolute(number)\n if number < 0\n return number * -1\n end\n return number\nend", "def negative(int)\n int <= 0 ? int : -int\nend", "def make_numbers_negative(number)\n number *= -1 if \"++-\"[number <=> 0] == \"+\"\n number\n\n # -number.abs\nend", "def negative(num)\r\n # your code goes here\r\n # abosulte value of any number is +ve\r\n\r\n num.abs*-1\r\nend", "def opposite(number)\n return 0 - number\nend", "def negative(num)\n if num > 0\n p (-num)\n else\n p num\n end\nend", "def make_positive(number)\n if number < 0\n -number\n else\n number\n end\nend", "def opposite(number)\r\n return number * (-1)\r\nend", "def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend", "def absolute(num)\n return -num if is_negative(num)\n return num\nend", "def negative\n abs.flip_sign\n end", "def opposite(number)\n number*-1\nend", "def subtract(input_number)\n $number -= input_number\n return $number\nend", "def negative(int)\n if int.negative? || int == 0\n return int\n else\n return int * -1\n end\nend", "def negative(input)\n input.abs * -1\nend", "def nozero(num)\n num > 0 ? -num : num \nend", "def neg(n1)\n @number = -n1.number\n return self\n end", "def makeNegative(num)\n if(num.to_s.start_with?(\"-\"))\n return num\n else\n return -num\nend\nend", "def reverseNumber(n)\n n.to_s[0] == '-' ? -(n.to_s.reverse.to_i) : n.to_s.reverse.to_i\n # if n.to_s[0] == '-'\n # -(n.to_s.reverse.to_i)\n # else\n # n.to_s.reverse.to_i\n # end\nend", "def negative(num)\n # your code goes here\n puts -(num).abs\n# -1 becomes 1 then multiplied by negative sign equals negative number\n# -1 * (-) = 1; 1 * (-) = -1 \nend", "def is_negative(number)\n if number < 0\n output = true\n else\n output = false\n end\n return output\nend", "def is_negative(number)\n if number < 0 \n return true\n else return false\n end\nend", "def opposite num\n -num\n end", "def is_negative(number)\n output = false\n if number < 0\n output = true\n end\n return output\nend", "def is_absolute(number)\n output= false\n if number > 0\n output= number\n else\n output = number * -1\n end\n return output\nend", "def absolute(numb)\n if numb < 0\n return numb * -1\n end\n return numb\nend", "def negative(num)\n return num<0\nend", "def is_negative(number)\n if number < 0 \n return true\n end\n return false\nend", "def at_least(number)\n -number.to_i - 1\n end", "def non_negative(value)\n result = to_integer(value) or return\n result unless result.negative?\n end", "def subtract (number1, number2)\n number1 - number2\n end", "def -(num)\n self + (-num)\n end", "def subtract(number1, number2)\n number1 - number2\n end", "def abs(x)\n x < 0 ? 0-x : x\n end", "def reverse_sign(an_integer)\n return 0 - an_integer\nend", "def reverse_sign(an_integer)\n return 0 - an_integer\nend", "def negative(input, name: nil)\n negate(input, name: name)\n end", "def negative(input, name: nil)\n negate(input, name: name)\n end", "def absolute(n)\n if n > 0 \n return n\n else\n abs_value = n * (-1)\n end\n return abs_value\nend", "def subtract(number_1, number_2)\n return number_1 - number_2\nend", "def negative(value = (not_set = true))\n return @negative if not_set\n\n @negative = value\n end", "def subtract(n1, n2)\n result = n1 - n2\n result = 0 if result < 0\nend", "def subtract_count_on_hand(num)\n add_count_on_hand((num.to_i * -1))\n end", "def subtract_count_on_hand(num)\n add_count_on_hand((num.to_i * -1))\n end", "def abs(x)\n if x < 0\n -x\n else\n x\n end\n end", "def is_negative(num)\n if num < 0\n return true\n else\n return false\n end\nend", "def negative(num)\n is_neg = false\n if num < 0\n is_neg = true\n end\n return is_neg\nend", "def opposite(x)\n x * -1\nend", "def positive? number\n return number > 0 ? true : false\n end", "def negative?\n value < 0\n end", "def -(numeric)\n map { |v| v.respond_to?(:-) ? v - numeric : v }\n end" ]
[ "0.84400934", "0.82569116", "0.812424", "0.812424", "0.80540895", "0.80276227", "0.8022706", "0.79611444", "0.7944778", "0.7914502", "0.78699344", "0.78699344", "0.78699344", "0.78699344", "0.786686", "0.78650326", "0.78636545", "0.78063285", "0.77588415", "0.77488", "0.77398676", "0.7739835", "0.7739835", "0.7739835", "0.7739835", "0.7723384", "0.7701604", "0.7697169", "0.7697169", "0.7694132", "0.7673167", "0.76634926", "0.7636914", "0.7628083", "0.75943244", "0.75731754", "0.7548108", "0.7544468", "0.7535792", "0.7526137", "0.7518425", "0.7508685", "0.750078", "0.74788624", "0.7468652", "0.74591047", "0.741574", "0.7403177", "0.73702943", "0.7315476", "0.7311471", "0.7303494", "0.7289298", "0.7205396", "0.71426", "0.7139031", "0.7135274", "0.7124336", "0.71058404", "0.71003634", "0.7096546", "0.7092699", "0.7086497", "0.7072505", "0.7044153", "0.69348586", "0.69296145", "0.6875689", "0.6801772", "0.6798295", "0.6752897", "0.6747256", "0.67108697", "0.67102194", "0.6664692", "0.66335356", "0.6626081", "0.66241944", "0.6598469", "0.6584343", "0.65610933", "0.6560081", "0.6528615", "0.65139216", "0.65139216", "0.649502", "0.649502", "0.64666665", "0.64374065", "0.6433946", "0.6406262", "0.6326792", "0.6326792", "0.63208336", "0.6288112", "0.6285525", "0.6281324", "0.6277003", "0.6275966", "0.62577933" ]
0.8133102
2
Returns the size of the deck
def size cards.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n deck.size\n end", "def count\n @deck.size\n end", "def length\n @fulldeck.length # => 52\n end", "def size\n @cards.size\n end", "def size\n @cards.size\n end", "def size\n @cards.size\n end", "def size\n return @cards.length\n end", "def count\n @deck.count\n end", "def length\n cards.length\n end", "def size\n return @cardsShown.length\n end", "def size\n Stal.solve(redis, [\"SCARD\", key])\n end", "def length\n\t\treturn @cards.length\n\tend", "def test_deck_size_fullDeck\n deck = Deck.new\n assert_equal(81, deck.size, \"Expected size of 81.\")\n end", "def test_deck_display_size_fullDeck\n print \"Expected size of 81: Found \"\n Deck.new.display_size\n end", "def get_shoe_size\n return prompt_positive_integer(\"Number of decks at table? [#{Decks::MIN_DECKS}]\", Decks::MIN_DECKS)\n end", "def hand_length\n return @cards_in_hand.length\n end", "def quantity(card)\n external_deck_instances.find_by(card_id: card.id).quantity\n end", "def cards_left\n @deck.length\n end", "def available_cards\n (@deck.size + board.size)\n end", "def get_size(card_name)\n if @sizes\n begin\n size_key = /[<{\\[](.+)[>}\\]]/.match(card_name)[1].to_sym\n if @sizes.has_key? size_key\n size = @sizes[size_key] \n else\n if size_key.to_s.to_i != 0\n size = size_key.to_s.to_i\n else\n size = @sizes[:default]\n end\n end\n rescue Exception => e\n size = @sizes[:default]\n end\n else\n size = (/[<{\\[](\\d+)[>}\\]]/.match(card_name) || DEFAULT_SIZE )[1].to_i\n end\n size\n end", "def test_deck_display_size_emptyDeck\n deck = Deck.new\n 81.times {deck.draw}\n print \"Expected size of 0: Found \"\n deck.display_size\n end", "def no_of_cards\n @cards.length\n end", "def card_quantity(card)\n\t\tExternalDeckInstance.find_by(card_id: card.id).quantity\n\tend", "def count\n return cards.length \n end", "def cards_left\n @deck.length\n end", "def count\n @cards.size\n end", "def count\n @cards.size\n end", "def cards_played_size \n a = @played\n a.delete_if { |key, value| value == nil }\n a.length\n end", "def total_cards\n cards.count\n end", "def count\n @cards.length\n end", "def count\n @cards.length\n end", "def no_of_cards\n @card_list.no_of_cards\n end", "def no_of_cards\n @card_list.no_of_cards\n end", "def no_of_cards\n @card_list.no_of_cards\n end", "def no_of_cards\r\n @card_list.no_of_cards\r\n end", "def no_of_cards\r\n @card_list.no_of_cards\r\n end", "def size\r\n @pack.size\r\n end", "def numCards\n\t\[email protected](0) {|memo, card| memo += card.copies}\n\tend", "def size\n @size \n end", "def size\n @size \n end", "def size\n sku.size * amount\n end", "def cards_in_deck\n Card.where(game_id: @game.id, owner: 0).size\n end", "def test_deck_size_emptyDeck\n deck = Deck.new\n 81.times {deck.draw}\n assert_equal(0, deck.size, \"Expected size of 81.\")\n end", "def test_card_length_equals_card_count \n assert_equal(@deck.cards.length, @deck.count)\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n execute_request(:get, '/size').body.to_i\n end", "def size\n @size.size\n end", "def size\n return @size\n end", "def size\n return @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def size\n @size\n end", "def count\n @cards.count\n end", "def size\n @count\n end", "def size\n @count\n end", "def num_hidden\n @hidden_cards.size\n end", "def size\n return instance_get(:size)\n end", "def size\n end", "def size\n end", "def size\n end", "def d_size\n @desc[:size].to_i\n end", "def cards_needed\n [@size, 5].min\n end", "def size\n @size\n end", "def size; @size end", "def test_deck_card_counts\n print \"\\nOriginal Deck:\\n#{@deck.to_s}\\n\"\n assert_equal(52, @cards.length, \"Num Cards\")\n end", "def size\n @size\n end", "def size\n @players.size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\n end", "def size\r\n\t\t@size\r\n\t\t#el tamaño\r\n\tend" ]
[ "0.94003105", "0.84423864", "0.8125935", "0.80669385", "0.80669385", "0.7955371", "0.79423875", "0.7750547", "0.76502717", "0.7591381", "0.7537148", "0.74552876", "0.744512", "0.73515713", "0.7347998", "0.73432094", "0.7282276", "0.72787035", "0.72439766", "0.7231798", "0.7211512", "0.72014654", "0.71643376", "0.7153436", "0.71388984", "0.7126404", "0.7126404", "0.7120484", "0.70572376", "0.70235044", "0.69459045", "0.6883122", "0.6883122", "0.6883122", "0.685639", "0.685639", "0.68353176", "0.68334", "0.68212736", "0.68212736", "0.6818381", "0.6815278", "0.6786022", "0.6777418", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.67399657", "0.673974", "0.67389125", "0.67335707", "0.67335707", "0.6732028", "0.6732028", "0.6732028", "0.67080104", "0.66757244", "0.66757244", "0.6671917", "0.6664822", "0.6650469", "0.6650469", "0.6650469", "0.66393435", "0.66369987", "0.6633403", "0.6632738", "0.6630307", "0.6625045", "0.66106695", "0.6602462", "0.6602462", "0.6598842", "0.6598842", "0.6598842", "0.6598842", "0.6598842", "0.6598842", "0.6598842", "0.65976614" ]
0.812801
2
Draws last n cards from the deck
def draw(amount = 1) cards.pop(amount) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawCards!(n)\n\t\treturn @cards.pop(n)\n end", "def draw_cards(count)\n self.deck.shift(count)\n end", "def draw_card(number_of_cards)\n for i in 1..number_of_cards\n @hand.push(@deck.pop)\n end\n end", "def draw3more(deck)\n for i in 1..3\n @cardsShown << deck.draw\n end\n end", "def take(n)\n raise Exception.new \"not enough cards\" if n > count\n first_cards = @deck[0...n]\n n.times { @deck.shift }\n first_cards\n end", "def draw\n raise \"not enough cards\" if @cards.empty?\n @cards.shift\n end", "def draw_from(deck)\n cards.concat(deck.take(1))\n end", "def take(n)\n raise ArgumentError.new \"not enough cards\" if n > count\n @deck.shift(n)\n end", "def get_card(deck, n)\n new_card = deck.cards.pop(n)\n cards << new_card\n cards.flatten!\n new_card\n end", "def deal5cards (n)", "def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end", "def drawcard\n @deck.pop\n end", "def take(n)\n raise \"not enough cards\" if n > self.count\n @cards.shift(n)\n end", "def take(n)\n card = cards.shift(n)\n end", "def draw\n @deck.shift\n end", "def draw(deck, count = 1)\n @cards = @cards + deck.deal(count)\n reset_scorable_hand\n end", "def take(n)\n if n > self.count \n raise 'not enough cards'\n end \n ncards = [] \n n.times do \n ncards << cards.shift\n end \n return ncards\n end", "def take(n)\n raise ArgumentError.new('not enough cards') if n > self.count\n @cards.shift(n)\n end", "def draw\n @cards.shift\n end", "def deal(n)\n @dealt = []\n n.times do\n @dealt << @fulldeck.pop\n end\n @dealt\n end", "def deal (n, deck)\n cards = []\n n.times {cards << deck.pop}\n cards\nend", "def draw\n # if there are no more cards in the deck,\n # we readd all of the cards and shuffle\n if self.size == 0\n for suit in suits\n for rank in ranks\n self.push(BlackJackCard.new(rank, suit))\n end\n end\n self.shuffle\n end\n return self.shift\n end", "def take(n)\n @cards.shift(n)\n end", "def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend", "def draw_card\n cards_in_deck = @playing_deck.length - 1\n draw_num = rand(0..cards_in_deck)\n card = @playing_deck[draw_num]\n @playing_deck = @playing_deck - [@playing_deck[draw_num]]\n\n card\n end", "def draw # draw one card at random\n build_deck if cards.empty?\n ndx = (0...cards.size).to_a.sample\n cards.delete_at(ndx)\n end", "def draw()\n hand = @deck.pop(5)\n p hand\n if @deck.length() <= 5\n self.send('generate')\n end\n return hand.join(\" \")\n end", "def draw_four_cards\n cards = DrawnCard.first_four_cards\n cards.each_with_index do |card_number, index|\n if index%2 == 0 #player_cards\n self.drawn_cards.create({user_id: self.user_id, card_number: card_number})\n else #dealer cards\n self.drawn_cards.create({user_id: nil, card_number: card_number})\n end\n end\n self.check_for_stop self.user_id\n end", "def take(n)\n @cards.unshift(n)\n end", "def draw_into(deck)\n card = draw\n deck << card\n card\n end", "def draw\n @cards.pop\n end", "def take_from_deck(number_of_cards)\n @deck_position ||= @deck.each\n cards_taken = 0\n # @hand += @deck_position.take(number_of_cards)\n begin\n number_of_cards.times do |i| \n @hand << @deck_position.next \n cards_taken += 1\n end\n rescue StopIteration => e\n # not good, i know, but there is nothing to do here\n end\n cards_taken\n end", "def test_draw_several_cards\n cards = @deck.draw(4)\n assert_equal(48, @deck.count)\n assert_equal(4, cards.length)\n end", "def draw_card\n self.cards.pop\n end", "def draw_card\n @dwanted.each_with_index{|w,i|\n if w && (@dpile[i][-1] > (@land[i][-1]||0))\n @dpile[i].pop\n return [S.index(i)].pack(\"C\")\n end\n }\n @deckcount-=1\n \"n\"\n end", "def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend", "def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end", "def draw_cards(hand)\n card_count = hand.count\n card_count.times do\n print \" ----- \"\n print ' '\n end\n print \"\\n\"\n card_count.times do\n print \"| |\"\n print ' '\n end\n print \"\\n\"\n card_count.times do |i|\n if hand[i][1] == '10'\n print \"| #{hand[i][1]} |\"\n else\n print \"| #{hand[i][1]} |\"\n end\n print ' '\n end\n print \"\\n\"\n card_count.times do |i|\n print \"| #{hand[i][0]} |\"\n print ' '\n end\n print \"\\n\"\n card_count.times do\n print \"| |\"\n print ' '\n end\n print \"\\n\"\n card_count.times do\n print \" ----- \"\n print ' '\n end\n print \"\\n\"\nend", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def draw\n @deck = Deck.find(params[:id])\n drawed_cards = @deck.draw_five_cards\n render json: {\n cards: drawed_cards,\n deck_id: @deck.id,\n remaining: @deck.card_codes.count\n }\n end", "def deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand([email protected])\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend", "def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end", "def deal_hand\n 3.times do \n @players.each do |player|\n player.hand.draw_card\n end\n end\n end", "def draw\n return @cards.pop\n end", "def build_deck\n @deck = []\n @decks.times do\n @suits.each { |each_suit| @ranks.each { |each_rank| @deck.push(Card.new(each_rank, each_suit)) } }\n end\n end", "def flush_deck (n = 1)\n deck = []\n n.times { deck.concat(generate_deck) }\n\n # swap two random cards (4 * deck.length) times\n (4 * deck.length).times do\n \n i, j = rand(deck.length), rand(deck.length)\n deck[i], deck[j] = deck[j], deck[i]\n end\n deck\nend", "def more_decks deck\n if deck.length == 0\n\n create_deck deck\n shuffle deck\n\n else \n deal_cards deck\n end\n # p deck.length\nend", "def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end", "def repetitions(n)\n @hand.group_by{ |card| card.point }.select { |k, v| v.count == n }\n end", "def build_deck_of_top_n_cards(num_cards, options = {})\n raise ArgumentError, \"num_cards must be an integer\" unless num_cards.class <= Integer\n\n options[:simplified] ||= false\n\n type = options[:simplified] ? \"simplified\" : \"traditional\"\n\n headers = %w[front back]\n output_deck_filename = \"top-#{num_cards}-#{type}-chinese-characters.txt\"\n\n puts \"Generating: #{output_deck_filename}\"\n\n # since there can be multiple entries for some characters, store descriptions onto an\n # hash of arrays keyed by character which we can join together later.\n card_hash = {}\n\n most_common_chinese_characters(options).take(num_cards).each do |pair|\n character = pair[\"character\"]\n description = pair[\"description\"]\n\n card_hash[character] ||= []\n card_hash[character] << description\n end\n\n cards = []\n\n card_hash.each do |character, descriptions|\n cards << {\n \"front\" => character,\n \"back\" => descriptions.join(\"<br /><br />\"),\n }\n end\n\n deck = Anki::Deck.new(card_headers: headers, card_data: cards, field_separator: \"|\")\n\n # ensure output directories exist. there's probably a FileUtils method for this...\n [\"decks\", \"decks/#{type}\"].each do |dir|\n begin\n Dir.mkdir(dir)\n rescue Errno::EEXIST\n end\n end\n\n output_path = \"decks/#{type}/#{output_deck_filename}\"\n deck.generate_deck(file: output_path)\nend", "def createDeck\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\[email protected]!\t\n\tend", "def draw_for(player)\n @cards.shuffle!\n player.cards << @cards.pop\n end", "def pop_cards(num_pops)\r\n #p @deck_todisp.size\r\n num_pops.times{|ix| @deck_todisp.pop}\r\n if @briscola and @card_briscola_todisp and @deck_todisp.size == 0\r\n #if @card_briscola_todisp and @realgame_num_cards == 0\r\n # no more cards on deck, pick the briscola\r\n @card_briscola_todisp.visible = false\r\n end\r\n #p @deck_todisp.size\r\n end", "def create_52_card_deck\n\n end", "def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end", "def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end", "def new_deck(num_decks)\n reset_deck()\n num_decks.times do\n (1..13).each do |num|\n Deck << num.to_s + \" of Hearts\"\n Deck << num.to_s + \" of Diamonds\"\n Deck << num.to_s + \" of Spades\"\n Deck << num.to_s + \" of Clubs\"\n end\n\n Deck.each do |ele|\n if ele[0..1] == \"1 \"\n ele[0..1] = \"A \"\n elsif ele[0..1] == \"11\"\n ele[0..1] = \"J\"\n elsif ele[0..1] == \"12\"\n ele[0..1] = \"Q\"\n elsif ele[0..1] == \"13\"\n ele[0..1] = \"K\"\n end\n end\n end\n shuffle(num_decks)\nend", "def drawCard\n\t\t@hand = @hand.push(@deck.pop)\n\tend", "def draw_random\n @cards.delete_at(Random.new().rand([email protected]))\n end", "def cut\n count = @cards.count\n rnd = Random.rand(count/3)\n cut_point = (count/3 + rnd)\n @cards = @cards.slice(cut_point, count - cut_point) + @cards.slice(0, cut_point)\n end", "def split(how_many = self.count/2)\n Deck.new(@cards.shift(how_many))\n end", "def create_deck(num_decks)\n ## Initializing the card deck\n @num_decks = num_decks\n @cards = SUITE * @num_decks * 4 ## replicate the suite 4 times to form 1 deck, and replicate 1 dec num times to form num decks in the shoe\n @max_deck_mod = @max_deck_mod * @num_decks ## figure out the max modulo, in this impl , i will just repeat cards from 0 ... modulo-1 , 0 ...\n 10.times {@cards.shuffle! } ## Shuffle the shoe 10 times\n @deck_index = 0\n end", "def draw_card\n waiting_to_pick_pile = true\n\n invalid_pile = nil\n while waiting_to_pick_pile\n DisplayManager.prepare_ingame_display\n show_state\n\n puts \"Do you want to draw a new card, or use the top discarded card?\"\n puts InputManager.input_options({ affirmative: 'Draw New Card', negative: 'Take Last Discarded Card' }, invalid_pile)\n invalid_pile = nil\n \n response = InputManager.get\n\n # If player picks the draw pile\n # draw the top card from that pile\n if InputManager.affirmative?(response)\n choose_new_card\n waiting_to_pick_pile = false\n\n # If player picks from discard pile\n # draw top card from that pile\n # player cannot discard this card\n elsif InputManager.negative?(response)\n choose_discard\n waiting_to_pick_pile = false\n else\n invalid_pile = response\n end\n end\n end", "def draw_card\n #change for chapel if no card to draw\n if ! (top_card = deckcards.find_by(library_position: 1))\n shuffle\n top_card = deckcards.find_by(library_position: 1)\n end\n top_card.status = \"hand\"\n top_card.library_position = nil\n top_card.save\n library.each do |library_member|\n library_member.library_position -=1\n library_member.save\n end\n top_card\n end", "def build_deck(ranks, suits)\n deck = []\n ranks.each_with_index do |rank, i|\n suits.each do |suit|\n card = {\n suit: suit,\n rank: rank,\n worth: i\n }\n deck << card\n end\n end\n deck.shuffle\nend", "def play(deck)\r\n\t\twhile hand.hand_value < 17 do\r\n\t\t\tdraw_card(deck.deal_card)\r\n\t\tend\r\n\tend", "def deal\r\n @deck_of_cards.shift\r\n end", "def playcard\n @cards.shuffle.slice!(0,2)\n end", "def count_cut\n last = @deck[-1].to_i\n @deck[-1..-1] = [@deck[0...last], @deck[-1]].flatten\n last.times {@deck.shift}\n @deck\n end", "def generate_deck\n (1..3).to_a.product(@colors, @shapes, @textures).each{|arr| @deck.push(Card.new(arr[0], arr[1], arr[2], arr[3]))}\n @deck.shuffle!\nend", "def initialize(deck)\n @cards_showing = Array.new\n base#just like the deck I want this to be adaptable if we can\n @table_max.times {@cards_showing.push(deck.draw_card)}\n @table_size = @cards_showing.length\n set_warnings\n end", "def create_card(deck)\n card = deck.shuffle.pop\nend", "def build_deck\n# This function builds an array of 52 cards made up of 4 copies of fixed nums with values from 1 to 13\n\t@deck = []\n\tfor num in 1..4\n\t\tfor num in 1..13\n\t\t\[email protected](num)\n\t\tend\n\tend\nend", "def pick\n raise NoMoreCardsException.new(\"Deck is empty\") if cards_left == 0\n @deck.shift\n end", "def deal\n end_round()\n shuffle()\n rounds_dealt = 0\n while rounds_dealt < @hand_size\n @players.each do | player |\n if card = @deck.draw()\n player.hand << card\n else\n return\n end\n end\n rounds_dealt += 1\n end\n end", "def test_deck_shuffle\n 1.upto(3) do |x|\n @deck.shuffle\n print \"\\nShuffled Deck [#{x}]:\\n#{@deck.to_s}\\n\"\n assert_equal(52, @cards.length, \"Num Cards\")\n end\n end", "def initialize(number_of_decks)\n @deck = (SINGLE_DECK * number_of_decks).shuffle\n end", "def take_card\n @deck.shift\n end", "def test_draw_one_card\n cards = @deck.draw\n assert_equal(51, @deck.count)\n assert_equal(1, cards.length)\n end", "def draw(name = @cur_deck_name)\n\n end", "def draw_card\n \"n\"\n end", "def show\n cards = @deck.cards\n cards = cards.where(is_disabled: false)\n @cards = cards.shuffle\n end", "def cut!(index)\n (0..index).each { @cards << @cards.shift }\n self\n end", "def load_card #(draw card?)\n @cards_array.shuffle!.shift\n end", "def deal_hand no_of_cards\n @card_list.deal_hand no_of_cards\n end", "def fill_table(deck)\n while @table_size < @table_max\n if deck.size == 0\n puts \"deck empty\"\n break\n else\n @cards_showing.push(deck.draw_card)\n @table_size += 1\n end\n end\n end", "def reshuffle_deck\n @output.puts ''.center(WIDTH, '-')\n @output.puts 'Shuffling new deck.'\n @output.puts ''.center(WIDTH, '-')\n @game.deck = Gambler::Deck.new\n 3.times { @game.deck.shuffle! }\n end", "def eval_n_cards(cards)\n cards.combination(5).inject(EqClTable.last.code) do |best_code, comb|\n q=eval_5_cards(*comb)\n if q<best_code then q; else best_code; end\n end\n end", "def test_deck_cut\n 1.upto(3) do |x|\n cut_at = rand(51) + 1\n x = @cards[cut_at - 1]\n y = @cards[cut_at]\n @deck.cut(cut_at)\n print \"\\nCut Deck at #{cut_at} [#{x}|#{y}]:\\n#{@deck.to_s}\\n\\n\"\n assert_equal(52, @cards.length, \"Num Cards\")\n assert_equal(@cards[(@cards.length - 1)], x, \"Card Before\")\n assert_equal(@cards[0], y, \"Card After\")\n end\n end", "def deal(number = 1)\r\n raise \"Not enough cards left in the deck!\" if number > @cards.length\r\n [@cards.pop(number)].flatten\r\n end", "def show_top_card\n self.discard(draw)\n end", "def draw_final_card\n @card3 = Card.draw(@card1.id, @card2.id)\n puts \"The next card is the #{@card3}\"\n\n # player wins if card is Joker\n raise Rules::Win::Joker if @card3.joker?\n end", "def shuffle(d)\n puts \"Reshuffling\"\n d.add_to_deck(@cards_showing)\n @cards_showing.clear\n @table_max.times {@cards_showing.push(d.draw_card)}\n @table_size = @cards_showing.length\n end", "def deal_hand no_of_cards\r\n @card_list.deal_hand no_of_cards\r\n end", "def dealHand \n h = Hand.new\n 5.times do \n h.addCard(self.draw)\n end\n return h\n end", "def withdraw(n)\n updatePool\n @pool -= n\n end", "def deal\n @deckOfCards.shift\n end", "def display_deck\n @deck_array.each do |x|\n x.display_card\n end\n end", "def deal(draw_amount, round)\r\n\t@betting_round += 1\r\n\tputs \"Dealer is dealing the #{round}...\"\r\n\tdraw_amount.times {@table.board << @table.deck.draw}\r\n\tputs \"Cards on the board: #{@table.board.join(' ')}\"\r\nend", "def deal_hand no_of_cards\n hand = Hand.new\n no_of_cards.times do\n hand.add pick_random\n end\n hand\n end" ]
[ "0.81865597", "0.8018772", "0.7957726", "0.7911588", "0.725285", "0.7251688", "0.72080594", "0.71938294", "0.7152711", "0.71021986", "0.7042433", "0.6970247", "0.6941676", "0.6932184", "0.69250476", "0.691803", "0.68921643", "0.68679756", "0.68451685", "0.6832259", "0.6823827", "0.68185574", "0.6802299", "0.6801601", "0.6770772", "0.6740901", "0.6717723", "0.66771096", "0.6670948", "0.66314375", "0.6608811", "0.65981567", "0.6547192", "0.65276587", "0.6489323", "0.6451479", "0.6425584", "0.6371151", "0.6347839", "0.63068175", "0.62759185", "0.6267908", "0.62658083", "0.6261495", "0.6258607", "0.62349737", "0.6231231", "0.62208146", "0.6218729", "0.6213874", "0.62065274", "0.6195661", "0.61927956", "0.6173901", "0.61394984", "0.6134072", "0.612735", "0.61248875", "0.61167896", "0.6109078", "0.6107065", "0.6089702", "0.60809714", "0.60759336", "0.60464984", "0.60392225", "0.6039102", "0.6012858", "0.59983134", "0.59974575", "0.59699285", "0.59467316", "0.5934785", "0.59339535", "0.5930523", "0.59303397", "0.5928651", "0.59259516", "0.5918366", "0.59067285", "0.5901184", "0.58929265", "0.5878763", "0.5878084", "0.58750623", "0.58676594", "0.58654344", "0.58528364", "0.58502644", "0.58395445", "0.5833555", "0.5830929", "0.5825791", "0.582567", "0.5824522", "0.58177936", "0.5812848", "0.5812502", "0.58092165", "0.5808585" ]
0.70727247
10
Returns the cards of the deck in a different order
def shuffle! cards.shuffle! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cards(deck)\n\n end", "def order_list\n\t\t@cards = @cards.order(:cmc)\n\tend", "def getCards(aDeck)\n\t\treturn 13.times{self << aDeck.next}\t\n\tend", "def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end", "def sort_cards\n hearts = []\n spades = []\n clubs = []\n diamonds = []\n\n # Sort each card into its corresponding suit array\n @cards.each do |card|\n case card.suit\n when :hearts\n hearts << card\n when :spades\n spades << card\n when :clubs\n clubs << card\n when :diamonds\n diamonds << card\n end\n end\n\n # Cards need to be in descending order, so sort\n # then reverse the arrays\n hearts.sort!.reverse!\n spades.sort!.reverse!\n clubs.sort!.reverse!\n diamonds.sort!.reverse!\n\n # Combine all suit arrays in order\n @cards = hearts + spades + clubs + diamonds\n end", "def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end", "def cards_by_suit\n @cards_by_suit ||= @cards.group_by(&:suit)\n end", "def generate_a_deck\n Card::SUITS.map do |suit|\n Card::RANKS.map do |rank|\n Card.new(suit: suit, rank: rank)\n end\n end.flatten\n end", "def deck_cards\n ranks = [\"A\", 2, 3, 4, 5, 6, 7, 8, 9, 10, \"J\", \"Q\", \"K\" ]\n suits = [ \"hearts\", \"spades\", \"clubs\", \"diamonds\" ]\n deck = []\n players = []\n\n values.each_with_index do |value, index|\n suits.each do |suit|\n deck.push([value,suit])\n end\n end\n return deck.shuffle\nend", "def retrieve_cards(category)\n self.unused_cards = Card.where(category: Category.find_by(name: category)).where.not(id: self.used_cards).pluck(:id).shuffle if self.unused_cards.empty?\n return [Card.find(self.unused_cards[0]), Card.find(self.unused_cards[1])]\n end", "def build_deck\n @deck = []\n @decks.times do\n @suits.each { |each_suit| @ranks.each { |each_rank| @deck.push(Card.new(each_rank, each_suit)) } }\n end\n end", "def return(cards)\n @deck.concat(cards)\n end", "def gen_cards\n # done in a verbose manner so that code is easy to understand\n %w[H D S C].each do |suit|\n @cards.push(Card.new('Ace', suit, 1))\n @cards.push(Card.new('Two', suit, 2))\n @cards.push(Card.new('Three', suit, 3))\n @cards.push(Card.new('Four', suit, 4))\n @cards.push(Card.new('Five', suit, 5))\n @cards.push(Card.new('Six', suit, 6))\n @cards.push(Card.new('Seven', suit, 7))\n @cards.push(Card.new('Eight', suit, 8))\n @cards.push(Card.new('Nine', suit, 9))\n @cards.push(Card.new('Ten', suit, 10))\n @cards.push(Card.new('Jack', suit, 10))\n @cards.push(Card.new('Queen', suit, 10))\n @cards.push(Card.new('King', suit, 10))\n end\n end", "def create_deck\r\n all_cards = []\r\n # Hearts ♥\r\n all_cards << ace_of_hearts = Ace.new('A', 'hearts', \"♥\")\r\n all_cards << king_of_hearts = Card.new('K', 'hearts', 10, \"♥\")\r\n all_cards << queen_of_hearts = Card.new('Q', 'hearts', 10, \"♥\")\r\n all_cards << jack_of_hearts = Card.new('J', 'hearts', 10, \"♥\")\r\n all_cards << ten_of_hearts = Card.new('10', 'hearts', 10, \"♥\")\r\n all_cards << nine_of_hearts = Card.new('9', 'hearts', 9, \"♥\")\r\n all_cards << eight_of_hearts = Card.new('8', 'hearts', 8, \"♥\")\r\n all_cards << seven_of_hearts = Card.new('7', 'hearts', 7, \"♥\")\r\n all_cards << six_of_hearts = Card.new('6', 'hearts', 6, \"♥\")\r\n all_cards << five_of_hearts = Card.new('5', 'hearts', 5, \"♥\")\r\n all_cards << four_of_hearts = Card.new('4', 'hearts', 4, \"♥\")\r\n all_cards << three_of_hearts = Card.new('3', 'hearts', 3, \"♥\")\r\n all_cards << two_of_hearts = Card.new('2', 'hearts', 2, \"♥\")\r\n # Spades ♠\r\n all_cards << ace_of_spades = Ace.new('A', 'spades', \"♠\")\r\n all_cards << king_of_spades = Card.new('K', 'spades', 10, \"♠\")\r\n all_cards << queen_of_spades = Card.new('Q', 'spades', 10, \"♠\")\r\n all_cards << jack_of_spades = Card.new('J', 'spades', 10, \"♠\")\r\n all_cards << ten_of_spades = Card.new('10', 'spades', 10, \"♠\")\r\n all_cards << nine_of_spades = Card.new('9', 'spades', 9, \"♠\")\r\n all_cards << eight_of_spades = Card.new('8', 'spades', 8, \"♠\")\r\n all_cards << seven_of_spades = Card.new('7', 'spades', 7, \"♠\")\r\n all_cards << six_of_spades = Card.new('6', 'spades', 6, \"♠\")\r\n all_cards << five_of_spades = Card.new('5', 'spades', 5, \"♠\")\r\n all_cards << four_of_spades = Card.new('4', 'spades', 4, \"♠\")\r\n all_cards << three_of_spades = Card.new('3', 'spades', 3, \"♠\")\r\n all_cards << two_of_spades = Card.new('2', 'spades', 2, \"♠\")\r\n # Diamonds ♦\r\n all_cards << ace_of_diamonds = Ace.new('A', 'diamonds', \"♦\")\r\n all_cards << king_of_diamonds = Card.new('K', 'diamonds', 10, \"♦\")\r\n all_cards << queen_of_diamonds = Card.new('Q', 'diamonds', 10, \"♦\")\r\n all_cards << jack_of_diamonds = Card.new('J', 'diamonds', 10, \"♦\")\r\n all_cards << ten_of_diamonds = Card.new('10', 'diamonds', 10, \"♦\")\r\n all_cards << nine_of_diamonds = Card.new('9', 'diamonds', 9, \"♦\")\r\n all_cards << eight_of_diamonds = Card.new('8', 'diamonds', 8, \"♦\")\r\n all_cards << seven_of_diamonds = Card.new('7', 'diamonds', 7, \"♦\")\r\n all_cards << six_of_diamonds = Card.new('6', 'diamonds', 6, \"♦\")\r\n all_cards << five_of_diamonds = Card.new('5', 'diamonds', 5, \"♦\")\r\n all_cards << four_of_diamonds = Card.new('4', 'diamonds', 4, \"♦\")\r\n all_cards << three_of_diamonds = Card.new('3', 'diamonds', 3, \"♦\")\r\n all_cards << two_of_diamonds = Card.new('2', 'diamonds', 2, \"♦\")\r\n # Clubs ♣\r\n all_cards << ace_of_clubs = Ace.new('A', 'clubs', \"♣\")\r\n all_cards << king_of_clubs = Card.new('K', 'clubs', 10, \"♣\")\r\n all_cards << queen_of_clubs = Card.new('Q', 'clubs', 10, \"♣\")\r\n all_cards << jack_of_clubs = Card.new('J', 'clubs', 10, \"♣\")\r\n all_cards << ten_of_clubs = Card.new('10', 'clubs', 10, \"♣\")\r\n all_cards << nine_of_clubs = Card.new('9', 'clubs', 9, \"♣\")\r\n all_cards << eight_of_clubs = Card.new('8', 'clubs', 8, \"♣\")\r\n all_cards << seven_of_clubs = Card.new('7', 'clubs', 7, \"♣\")\r\n all_cards << six_of_clubs = Card.new('6', 'clubs', 6, \"♣\")\r\n all_cards << five_of_clubs = Card.new('5', 'clubs', 5, \"♣\")\r\n all_cards << four_of_clubs = Card.new('4', 'clubs', 4, \"♣\")\r\n all_cards << three_of_clubs = Card.new('3', 'clubs', 3, \"♣\")\r\n all_cards << two_of_clubs = Card.new('2', 'clubs', 2, \"♣\")\r\n all_cards\r\nend", "def create_deck\n all_cards = []\n # Hearts ♥\n all_cards << ace_of_hearts = Ace.new('A', 'hearts', \"♥\")\n all_cards << king_of_hearts = Card.new('K', 'hearts', 10, \"♥\")\n all_cards << queen_of_hearts = Card.new('Q', 'hearts', 10, \"♥\")\n all_cards << jack_of_hearts = Card.new('J', 'hearts', 10, \"♥\")\n all_cards << ten_of_hearts = Card.new('10', 'hearts', 10, \"♥\")\n all_cards << nine_of_hearts = Card.new('9', 'hearts', 9, \"♥\")\n all_cards << eight_of_hearts = Card.new('8', 'hearts', 8, \"♥\")\n all_cards << seven_of_hearts = Card.new('7', 'hearts', 7, \"♥\")\n all_cards << six_of_hearts = Card.new('6', 'hearts', 6, \"♥\")\n all_cards << five_of_hearts = Card.new('5', 'hearts', 5, \"♥\")\n all_cards << four_of_hearts = Card.new('4', 'hearts', 4, \"♥\")\n all_cards << three_of_hearts = Card.new('3', 'hearts', 3, \"♥\")\n all_cards << two_of_hearts = Card.new('2', 'hearts', 2, \"♥\")\n # Spades ♠\n all_cards << ace_of_spades = Ace.new('A', 'spades', \"♠\")\n all_cards << king_of_spades = Card.new('K', 'spades', 10, \"♠\")\n all_cards << queen_of_spades = Card.new('Q', 'spades', 10, \"♠\")\n all_cards << jack_of_spades = Card.new('J', 'spades', 10, \"♠\")\n all_cards << ten_of_spades = Card.new('10', 'spades', 10, \"♠\")\n all_cards << nine_of_spades = Card.new('9', 'spades', 9, \"♠\")\n all_cards << eight_of_spades = Card.new('8', 'spades', 8, \"♠\")\n all_cards << seven_of_spades = Card.new('7', 'spades', 7, \"♠\")\n all_cards << six_of_spades = Card.new('6', 'spades', 6, \"♠\")\n all_cards << five_of_spades = Card.new('5', 'spades', 5, \"♠\")\n all_cards << four_of_spades = Card.new('4', 'spades', 4, \"♠\")\n all_cards << three_of_spades = Card.new('3', 'spades', 3, \"♠\")\n all_cards << two_of_spades = Card.new('2', 'spades', 2, \"♠\")\n # Diamonds ♦\n all_cards << ace_of_diamonds = Ace.new('A', 'diamonds', \"♦\")\n all_cards << king_of_diamonds = Card.new('K', 'diamonds', 10, \"♦\")\n all_cards << queen_of_diamonds = Card.new('Q', 'diamonds', 10, \"♦\")\n all_cards << jack_of_diamonds = Card.new('J', 'diamonds', 10, \"♦\")\n all_cards << ten_of_diamonds = Card.new('10', 'diamonds', 10, \"♦\")\n all_cards << nine_of_diamonds = Card.new('9', 'diamonds', 9, \"♦\")\n all_cards << eight_of_diamonds = Card.new('8', 'diamonds', 8, \"♦\")\n all_cards << seven_of_diamonds = Card.new('7', 'diamonds', 7, \"♦\")\n all_cards << six_of_diamonds = Card.new('6', 'diamonds', 6, \"♦\")\n all_cards << five_of_diamonds = Card.new('5', 'diamonds', 5, \"♦\")\n all_cards << four_of_diamonds = Card.new('4', 'diamonds', 4, \"♦\")\n all_cards << three_of_diamonds = Card.new('3', 'diamonds', 3, \"♦\")\n all_cards << two_of_diamonds = Card.new('2', 'diamonds', 2, \"♦\")\n # Clubs ♣\n all_cards << ace_of_clubs = Ace.new('A', 'clubs', \"♣\")\n all_cards << king_of_clubs = Card.new('K', 'clubs', 10, \"♣\")\n all_cards << queen_of_clubs = Card.new('Q', 'clubs', 10, \"♣\")\n all_cards << jack_of_clubs = Card.new('J', 'clubs', 10, \"♣\")\n all_cards << ten_of_clubs = Card.new('10', 'clubs', 10, \"♣\")\n all_cards << nine_of_clubs = Card.new('9', 'clubs', 9, \"♣\")\n all_cards << eight_of_clubs = Card.new('8', 'clubs', 8, \"♣\")\n all_cards << seven_of_clubs = Card.new('7', 'clubs', 7, \"♣\")\n all_cards << six_of_clubs = Card.new('6', 'clubs', 6, \"♣\")\n all_cards << five_of_clubs = Card.new('5', 'clubs', 5, \"♣\")\n all_cards << four_of_clubs = Card.new('4', 'clubs', 4, \"♣\")\n all_cards << three_of_clubs = Card.new('3', 'clubs', 3, \"♣\")\n all_cards << two_of_clubs = Card.new('2', 'clubs', 2, \"♣\")\n all_cards\nend", "def cards\n\t\[email protected] do |card|\n\t\t\tputs card.card\n\t\tend\n\tend", "def build_deck\n CARD_SUITS.product(CARD_VALUES).shuffle\nend", "def my_cards\n index = 0\n @my_cards = []\n @suits.each do |suit|\n (1..13).each do |value|\n card = Card.new(value, suit)\n @my_cards.push(card)\n end\n end\n return @my_cards\n end", "def initialize_deck\n deck = []\n SUIT.each do |suit|\n CARDS.each do |card|\n deck << [suit, card]\n end\n end\n deck.shuffle!\nend", "def cards()\n deck_array = []\n suits = ['C', 'D', 'H', 'S']\n for num in 1..13\n suits.each do |suit|\n case \"#{num}\".to_i\n when 1\n deck_array << \"A#{suit}\"\n @redis.set(\"A#{suit}\", 1)\n when 11\n deck_array << \"J#{suit}\"\n @redis.set(\"J#{suit}\", 10)\n when 12\n deck_array << \"Q#{suit}\"\n @redis.set(\"Q#{suit}\", 10)\n when 13\n deck_array << \"K#{suit}\"\n @redis.set(\"K#{suit}\", 10)\n else\n deck_array << \"#{num}#{suit}\"\n @redis.set(\"#{num}#{suit}\", \"#{num}\")\n end\n end\n end\n deck_array\nend", "def cards\n @cards\n end", "def deck_of_cards\n deck_hash = {h2: 2, h3: 3, h4: 4, h5: 5, h6: 6, h7: 7, h8: 8, h9: 9, h10: 10, hj: 10, hq: 10, hk: 10, ha: 11,\n d2: 2, d3: 3, d4: 4, d5: 5, d6: 6, d7: 7, d8: 8, d9: 9, d10: 10, dj: 10, dq: 10, dk: 10, da: 11,\n s2: 2, s3: 3, s4: 4, s5: 5, s6: 6, s7: 7, s8: 8, s9: 9, s10: 10, sj: 10, sq: 10, sk: 10, sa: 11,\n c2: 2, c3: 3, c4: 4, c5: 5, c6: 6, c7: 7, c8: 8, c9: 9, c10: 10, cj: 10, cq: 10, ck: 10, ca: 11}\nend", "def choose_cards(turn, player)\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n list_of_cards = case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(1)\n end\n else\n list_of_cards = turn.turn_get_cards_from_stack(1)\n end\n list_of_cards.concat(turn.turn_get_cards_from_stack(1))\n end", "def draw_from(deck)\n cards.concat(deck.take(1))\n end", "def deal_cards(deck)\n hands []\n players.each do |player|\n hand = {\n player: = player\n card: = deck.shift\n }\n hands << hand\n end\n hands\n end", "def desk_cards\n desk = []\n self.public_deal.each do |i|\n desk.push(i)\n end\n self.hand_deal.each do |i|\n desk.push(i)\n end\n desk\n end", "def deal_cards(old_deck, num_cards)\n hand = old_deck.sample(num_cards)\n new_deck = old_deck - hand\n return [hand, new_deck]\nend", "def have_new_cards\n cards = []\n suits = [\"♣\", \"♦\", \"♥\", \"♠\"]\n ranks = [\"A\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"J\",\"Q\",\"K\"]\n suits.each do |suit|\n ranks.each do |rank|\n cards << [suit, rank]\n end\n end\n return cards\nend", "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end", "def get_rounds_cards\n # get all the cards from this round's deck\n @cards = self.deck.cards\n end", "def sort_cards\n return @cards.sort_by(&:color)\n self\n end", "def flush_cards(cards)\n\t\thsh = {}\n\t\tcards.each {|c| hsh[c.suit] ||= []; hsh[c.suit] << c}\n\t\tret = []\n\t\thsh.each {|suit, suit_cards| ret = suit_cards if suit_cards.size > ret.size}\n\t\tret.sort_by {|x| x.sort_value}\n\tend", "def show\n cards = @deck.cards\n cards = cards.where(is_disabled: false)\n @cards = cards.shuffle\n end", "def test_sorting_the_deck\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3])\n assert_equal [card_2, card_1, card_3], deck.sorting_the_deck\n end", "def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end", "def sort\n @deck = Deck.find(params[:id])\n \n @cards = []\n @groups = {}\n @handle = @deck.handle\n @deck.cards.each do |card|\n if card.groups.count == 0\n @cards.push card\n else\n group = card.groups.first\n if @groups[group.id].kind_of?(Array)\n @groups[group.id].push card\n else\n @groups[group.id] = [card]\n end\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deck }\n end\n end", "def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend", "def return(cards)\n @deck += cards\n end", "def new_deck(num_decks)\n reset_deck()\n num_decks.times do\n (1..13).each do |num|\n Deck << num.to_s + \" of Hearts\"\n Deck << num.to_s + \" of Diamonds\"\n Deck << num.to_s + \" of Spades\"\n Deck << num.to_s + \" of Clubs\"\n end\n\n Deck.each do |ele|\n if ele[0..1] == \"1 \"\n ele[0..1] = \"A \"\n elsif ele[0..1] == \"11\"\n ele[0..1] = \"J\"\n elsif ele[0..1] == \"12\"\n ele[0..1] = \"Q\"\n elsif ele[0..1] == \"13\"\n ele[0..1] = \"K\"\n end\n end\n end\n shuffle(num_decks)\nend", "def cards_at(indices)\n\t\tcards = []\n\t\tindices.each {|x| cards << @board[x.to_i-1] }\n\t\tcards\n\tend", "def trump_cards\n @cards.select {|c| c.suit == @trump_suit}\n end", "def index\n @cards = @deck.cards\n end", "def shuffleCards!()\n\t\[email protected]!\n\tend", "def sort_cards_by_same_value()\r\n\t\tresult=Array.new\r\n\t\tfor i in 2..14\r\n\t\t\tresult[i]=CardList.new\r\n\t\tend\r\n\t\[email protected]{|x| result[x.get_value].add_card(x)}\r\n\t\treturn result\r\n\tend", "def shuffle\n\t\[email protected]\n\tend", "def test_get_hand_ordered_deck12\n\t\tgame = SetGame.new\n\t\tgame.deck = DECK_ORDERED_12\n\t\tgame.hand = []\n\t\tgame.top_card = 0\n\t\tgame.get_hand\n\t\tassert_equal 12, game.hand.size\n\t\tassert_equal 12, game.top_card\n\t\tassert_equal CARD1, game.hand[0]\n\t\tassert_equal CARD2, game.hand[1]\n\t\tassert_equal CARD3, game.hand[2]\n\t\tassert_equal CARD4, game.hand[3]\n\t\tassert_equal CARD5, game.hand[4]\n\t\tassert_equal CARD6, game.hand[5]\n\t\tassert_equal CARD7, game.hand[6]\n\t\tassert_equal CARD8, game.hand[7]\n\t\tassert_equal CARD9, game.hand[8]\n\t\tassert_equal CARD10, game.hand[9]\n\t\tassert_equal CARD11, game.hand[10]\n\t\tassert_equal CARD12, game.hand[11]\n\tend", "def init_deck\n deck = []\n suits = ['S', 'C', 'D', 'H']\n values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']\n # can also use .product for this, but here's logic behind it for future reference\n suits.each do |suit|\n values.each do |value|\n deck << [suit, value]\n end\n end\n # work on own method for shuffling, here's shortcut, remember bang (!) modifies object\n deck.shuffle!\nend", "def shuffle\r\n @deck_of_cards.shuffle!\r\n end", "def test_sorting_the_deck_large\n card_1 = Card.new(\"4\",\"Hearts\")\n card_2 = Card.new(\"3\", \"Clubs\")\n card_3 = Card.new(\"5\", \"Diamonds\")\n card_4 = Card.new(\"1\",\"Hearts\")\n card_5 = Card.new(\"Jack\", \"Clubs\")\n card_6 = Card.new(\"Ace\", \"Diamonds\")\n card_7 = Card.new(\"7\", \"Diamonds\")\n deck = Deck.new([card_1, card_2, card_3, card_4, card_5, card_6, card_7])\n assert_equal [card_4, card_2, card_1, card_3, card_7, card_5, card_6], deck.sorting_the_deck\n end", "def build_deck(ranks, suits)\n deck = []\n ranks.each_with_index do |rank, i|\n suits.each do |suit|\n card = {\n suit: suit,\n rank: rank,\n worth: i\n }\n deck << card\n end\n end\n deck.shuffle\nend", "def get_card(deck, n)\n new_card = deck.cards.pop(n)\n cards << new_card\n cards.flatten!\n new_card\n end", "def shuffle_card(cards, value, suit)\n suit.each do |ele1|\n value.each do |ele2|\n cards.push(suit: ele1, value: ele2)\n end\n end\n\n cards = cards * 4\n cards.shuffle!\nend", "def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end", "def return(new_cards)\n\n new_cards.each do |card|\n self.deck.push(card)\n end\n\n end", "def shuffle\n @cards.shuffle!\n end", "def createDeck\n deck = []\n for suit in @@cardSuits\n for symbol in @@symbolVals.keys\n if symbol != \"AA\"\n deck << Card.new(symbol, suit)\n end\n end\n end\n\n return deck\n end", "def index\n @cards = @deck.cards.all\n end", "def assemble_deck\n cards = (north_south_tricks + east_west_tricks).map(&:cards)\n BeloteDeck.new cards\n end", "def return(cards)\n @cards.concat(cards)\n end", "def get_card\n all_cards = self.deck.cards\n correct_cards = self.guesses.where(correct: true).map { |guess| guess.card }\n (all_cards - correct_cards).shuffle.sample\n end", "def sort\n @cards.sort\n end", "def getCardArray()\n\t\treturn @cards\n\tend", "def playcard\n @cards.shuffle.slice!(0,2)\n end", "def build_deck\n# This function builds an array of 52 cards made up of 4 copies of fixed nums with values from 1 to 13\n\t@deck = []\n\tfor num in 1..4\n\t\tfor num in 1..13\n\t\t\[email protected](num)\n\t\tend\n\tend\nend", "def return_cards\n @hand = []\n end", "def createDeck\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\[email protected](Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\[email protected]!\t\n\tend", "def shuffle\n @playable_cards = []\n SUITS.each do |suite|\n NAME_VALUES.each do |name, value|\n @playable_cards << Card.new(suite, name, value)\n end\n end\n end", "def shuffle\r\n @cards.shuffle!\r\n end", "def cards(options = { :filter => :open })\n return @cards if @cards\n @cards = Client.get(\"/boards/#{id}/cards\").json_into(Card)\n end", "def get_cards_from_trello\n list = get_doing_list\n return list.cards\n end", "def shuffle\n @cards.shuffle!\n end", "def shuffle\r\n @playable_cards = []\r\n SUITES.each do |suite|\r\n NAME_VALUES.each do |name, value|\r\n @playable_cards << Card.new(suite, name, value)\r\n end \r\n end\r\n puts \"PLAYABLE CARDS\"\r\n end", "def suits\n cards.map(&:suit)\n end", "def index\n @deck_of_cards = DeckOfCard.all\n end", "def sort_by_suit\n \tnew_hand = []\n while @cards.size > 0\n \tpos = 0 # position of minimal card\n \tc = @cards[0] # minimal card\n \[email protected]_with_index do |card, index|\n \t\tc1 = card\n # puts \"c: #{c.inspect} and c1: #{c1.inspect}\"\n # puts \" and c1.suit: #{c1.suit}\"\n \t\tif (c1.suit < c.suit || (c1.suit == c.suit && c1.value < c.value) )\n \t\t\tpos = index\n \t\t\tc = c1\n \t end\n \tend\n\n \tremove_card_at(pos)\n \tnew_hand << c\n end\n\n @cards = new_hand\n end", "def display_deck\n @deck_array.each do |x|\n x.display_card\n end\n end", "def budget_cards(budget)\n budget.cards.uniq\n end", "def shuffle_deck!\n @deck.shuffle\n @deck_position = @deck.each\n end", "def sort\n byebug\n deck = Deck.find(params[:deck])\n cards = deck.cards\n @result = []\n # face_values = {\n # :ace => 1,\n # :jack => 11,\n # :queen => 12,\n # :king => 13\n # }\n\n # steps: \n # Step 1: takes the key and runs it through the face values hash \n # Step 2: if it exist return the value of that key, if doesn't then return the value of the card\n\n # cards.each_key do |card| \n # each_card = card[:value]\n # if each_card\n # #if card \n # else\n # #normal number card\n # end\n \n if params[:sort_suit] && params[:sort_value]\n sort_all = cards.sort_by{|key, value| [value, key]}\n @result << sort_all\n\n elsif params[:sort_suit]\n sort_suit = cards.sort_by{|key, value| value}\n @result << sort_suit\n\n elsif params[:sort_value]\n sort_value = cards.sort_by{|key, value| key}\n @result << sort_value\n end\n render json: @result\n end", "def full_deck\n Game::LANDS.collect do |land|\n (['Inv'] * 3 + (2 .. 10).to_a).collect do |value|\n Game::Card.new(value, land)\n end\n end.flatten\n end", "def shuffle_cards\n n = self.cards.length - 1\n while n > 0\n i = rand(n -= 1 )\n temp = self.cards[i]\n self.cards[i] = self.cards[n]\n self.cards[n] = temp\n # can be written more elegantly like:\n # self.cards[i], self.cards[n] = self.cards[n], self.cards[i]\n end\n self.cards.each do |c|\n puts c.face\n end\n self\n end", "def shuffle\n @deck.sort_by{rand}\n end", "def flip_deck\n if @deck.empty?\n if @recycle_count < @recycle_limit\n @deck = @discard.reverse.collect {|c| c.flip}\n @discard = CardArray.new\n @recycle_count += 1\n else\n nil\n end\n else\n @discard.push @deck.pop\n end\n @discard.first.flip\n end", "def sort\n @cards.sort_by {|card| card.poker_value}\n end", "def deal_cards\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n player.add_card(deck.deal_one)\n dealer.add_card(deck.deal_one)\n end", "def index\n @cards = @tarot.cards.order(number: :asc)\n end", "def deck_creator\n deck = []\n suits = [\"♠\", \"♥\", \"♦\", \"♣\"]\n ranks = [\"A\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"10\", \"J\", \"Q\", \"K\"]\n\n suits.each do |value|\n current_suit = value\n\n ranks.each do |value|\n card = {}\n card[:suit] = current_suit\n card[:rank] = value\n if value === \"A\"\n card[:value] = 1\n elsif [\"J\", \"Q\", \"K\"].include?(value)\n card[:value] = 10\n else\n card[:value] = value.to_i\n end\n\n deck.push(card)\n end\n end\n return deck\nend", "def cards_by_rank(ranks)\n @cards.select { |card| ranks.include?(card.rank) }\n end", "def shuffle_list\n @cardList.shuffle!\n end", "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "def test_get_hand_ordered_deck18\n\t\tgame = SetGame.new\n\t\tgame.deck = DECK_ORDERED_18\n\t\tgame.hand = []\n\t\tgame.top_card = 0\n\t\tgame.get_hand\n\t\tassert_equal 12, game.hand.size\n\t\tassert_equal 12, game.top_card\n\t\tassert_equal CARD1, game.hand[0]\n\t\tassert_equal CARD2, game.hand[1]\n\t\tassert_equal CARD3, game.hand[2]\n\t\tassert_equal CARD4, game.hand[3]\n\t\tassert_equal CARD5, game.hand[4]\n\t\tassert_equal CARD6, game.hand[5]\n\t\tassert_equal CARD7, game.hand[6]\n\t\tassert_equal CARD8, game.hand[7]\n\t\tassert_equal CARD9, game.hand[8]\n\t\tassert_equal CARD10, game.hand[9]\n\t\tassert_equal CARD11, game.hand[10]\n\t\tassert_equal CARD12, game.hand[11]\n\tend", "def what_decks\n\t\tb = Bridge.where(card_id:self.id)\n\t\tdeck_ids = []\n\t\tb.each do |bridge|\n\t\t\tdeck_ids.push(bridge.deck_id)\n\t\tend\n\t\tdeck_list = []\n\t\tdeck_ids.each do |id|\n\t\t\tdeck_list.push(Deck.find(id))\n\t\tend\n\t\treturn deck_list\n\tend", "def create_deck\n\n\tdeck = Array.new\n\tcard_val = Array.new\n\tcard_type = [\"h\",\"d\",\"c\",\"s\"] # Hearts, Diamonds, Clubs, Spades\n\n (2..10).each do |i|\n \tcard_val << i.to_s\n end\n card_val << \"J\" << \"Q\" << \"K\" << \"A\"\n\n for type in card_type\n \tfor val in card_val\n \t\tdeck << val+type\n \tend\n end\n\n return deck\n\nend", "def generate_deck\n (1..3).to_a.product(@colors, @shapes, @textures).each{|arr| @deck.push(Card.new(arr[0], arr[1], arr[2], arr[3]))}\n @deck.shuffle!\nend", "def create_deck\n suit_counter = 0\n value_counter = 0\n deck =[]\n until deck.count == (@valid_suits.count * @valid_values.count)\n deck << Card.new(@valid_suits[suit_counter], @valid_values[value_counter])\n value_counter += 1\n value_counter = 0 if (value_counter == @valid_values.count)\n suit_counter += 1 if (deck.count == (suit_counter + 1) * (@valid_values.count))\n end\n deck\n end", "def deal\n deck = build_deck\n players = create_players\n hands = []\n puts \"Dealing cards...\"\n players.each do |player|\n hand = {\n player: player, card: deck.pop\n }\n hands << hand\n end\n return hands\n end", "def deal\r\n @deck_of_cards.shift\r\n end", "def draw_cards(count)\n self.deck.shift(count)\n end", "def deal\n # pack cards past the default 12 into the begining\n if @cards.length > 12\n # cards still in play past the standard 12 positions\n extra = @cards.last(@cards.length - 12).compact\n # move what can be moved into the standard 12 positions\n @cards = @cards.take(12).map! { |c| c || extra.pop }\n # hopefully extra is empty now, but maybe not\n @cards += extra\n end\n\n # sets is still valid as we haven't modified the combinaion of cards in play\n # do we need to expand the cards in play?\n if(@sets && @sets.none?)\n @cards += Array.new(3)\n end\n \n ## fill any gaps from the deck\n @cards.map! { |x| x || @deck.pop }\n\n # recompute sets\n #@sets = []\n @sets = IsASet.sets @cards.compact\n end", "def shuffle\n shuffled_order = cards.pluck('card_order').shuffle\n counter = 0\n cards.each do |r|\n r.update_attribute(:card_order, shuffled_order[counter])\n counter += 1\n end\n end", "def full_deck\n wild_config = respond_to?(:wild_config) ? self.wild_config : {}\n suits.keys.product(face_values.keys).map do |card_data|\n wild = (wild_config[card_data.second] || []).include?(card_data.first)\n CardDecks::Card.new deck: self, suit: card_data.first, value: card_data.second, wild: wild\n end +\n (self.class.joker_count.times.map do\n CardDecks::Card.new deck: self, suit: :joker, value: :joker, wild: wild_config.has_key?(:joker)\n end)\n end" ]
[ "0.77542835", "0.7496468", "0.7380668", "0.7374169", "0.73601794", "0.73345554", "0.73098147", "0.7277669", "0.7218854", "0.7089644", "0.7041236", "0.7019243", "0.6992009", "0.6986571", "0.6975113", "0.6932877", "0.6930461", "0.69242555", "0.690597", "0.6904038", "0.6900083", "0.68885714", "0.68740714", "0.6861303", "0.68556887", "0.6843804", "0.6831006", "0.6823416", "0.6810552", "0.6787431", "0.676688", "0.6744454", "0.67406785", "0.6740421", "0.6720426", "0.67145234", "0.670323", "0.669446", "0.66860443", "0.66796404", "0.66781634", "0.6669769", "0.6665245", "0.66626054", "0.6656908", "0.66561383", "0.66545475", "0.6648492", "0.6642063", "0.6640462", "0.6632561", "0.66298974", "0.6597073", "0.6595137", "0.659306", "0.6587639", "0.6565403", "0.6561832", "0.6559207", "0.65468717", "0.654194", "0.6539627", "0.6533792", "0.6533263", "0.65272516", "0.6525399", "0.6524877", "0.6518513", "0.65137786", "0.65016615", "0.6501144", "0.64955413", "0.6489297", "0.6489277", "0.6482185", "0.6463424", "0.64583665", "0.6454971", "0.6454354", "0.6446824", "0.64205176", "0.641942", "0.6416505", "0.6416467", "0.64153486", "0.64131963", "0.6412755", "0.64076954", "0.63976693", "0.63894653", "0.63889015", "0.6380416", "0.6376566", "0.6374501", "0.6373657", "0.63708633", "0.63620454", "0.63550884", "0.63480145", "0.6345831", "0.6344949" ]
0.0
-1
Resets the deck to its initial state
def reset! @cards = load_cards end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @cards = Card.suits.keys.map do |suit|\n Card.values.map {|i| Card.new(suit, i)}\n end.flatten\n @dealt = []\n self\n end", "def reset!\n self.cards = CARDS.dup\n end", "def reset!\n @hands.each(&:discard!)\n @cards += @used\n @used = []\n end", "def reset\n # delete all old cards, then reload deck\n cards.each {|card| Card.delete card }\n reload\n # create new cards\n Cardface.all.each do |cf|\n c_new = Card.new :cardface_id => cf.id, :facedown_position => cf.id\n cards << c_new\n c_new.save!\n end\n save!\n end", "def reset\n @hand = []\n @value = nil\n @status = \"unfinished\"\n end", "def reset\n @round = 0\n @turn = 0 \n assign_player_colors\n seat_players\n seed_player_funds\n reset_state_bins\n add_home_state_picks\n pick_who_goes_first\n start_at_first_day\n end", "def reset\n @player_status = \"in\" \n @hands = [] \n @hands_status = [] \n @bets = [] \n @values = [] \n @cur = 0 \n end", "def reset_self\r\n @hole_cards = []\r\n @folded = false\r\n @bet = 0\r\n end", "def shuffle_deck\n if [email protected]?\n @cards = manual_shuffle\n end\n end", "def reset\n @shoe = Shoe.new(7)\n player.hand.clear;\n player.bust = false\n dealer.hand.clear;\n dealer.bust = false\n play\n end", "def clear\n\t\t@save_time = 0.0\n\t\t@top_card = 0\n\t\t@number_of_hint = 0\n\t\t@number_of_correct = 0\n\t\t@number_of_wrong= 0\n\t\t@deck = []\n\t\t@hand = []\n\t\t@username = \"\"\n\t\t@total_hint=0\n\t\t@is_end=false\n\tend", "def reset\n @players.each { |player| player.reset }\n @dealer.reset\n system \"clear\"\n end", "def reshuffle_deck\n @output.puts ''.center(WIDTH, '-')\n @output.puts 'Shuffling new deck.'\n @output.puts ''.center(WIDTH, '-')\n @game.deck = Gambler::Deck.new\n 3.times { @game.deck.shuffle! }\n end", "def shuffle\n @deck.shuffle! # Contents of @deck will be permanently changed\n end", "def reset\n\t\t@hand = Array.new\n\t\t@total = 0\n\tend", "def reset_hand\n @hand = []\n end", "def reset\n @dice_cup.clear\n @number_of_dice = 6\n @farkle_count= 0\n end", "def reset!\n end", "def reset!\n end", "def reset\n end", "def reset\n end", "def reset\n end", "def reset\n end", "def reshuffle\n discard.each do |modifier|\n deck.push modifier\n end\n @discard = []\n shuffle\n end", "def reset\n\n end", "def reset\n end", "def reset\n end", "def reset_discard_pile(deck)\n @cards = []\n @cards << deck.take_card\n while @cards[0].color == 'Wild' || @cards[0].number.is_a?(String)\n deck.cards.unshift(@cards.pop)\n @cards << deck.take_card\n end\n @cards\n end", "def reset!\n initialize\n end", "def clear_hand\n @hand_cards.clear\n @points = 0\n end", "def reset\n # TODO\n end", "def reset\n end", "def reset\n end", "def init_deck\n @deck = Deck.new\nend", "def reset()\n end", "def reset\n @gold, @metal, @stone, @wood = [5, 1, 1, 1]\n @dwarves, @elves, @gnomes = [3, 3, 0]\n @properties, @score = [12, 0]\n\n self\n end", "def reset_state\n @state = nil\n end", "def setup_game\n @deck.shuffle!\n end", "def reset\n self\n end", "def reset\n setup\n end", "def reset\n\n end", "def reset\n set InitialPosition\n end", "def game_init\r\n state(0)\r\n @game_deck.create_new_deck\r\n @player_deck = {}\r\n @dealer_deck = {}\r\n @player.points = 0\r\n @dealer.points = 0\r\n end", "def reset\n \n end", "def update_initial_data\n user.hand.cards = []\n dealer.hand.cards = []\n user.hand.total_score = 0\n dealer.hand.total_score = 0\n self.stop = false\n end", "def reset() end", "def reset\n initialize\n setup\n end", "def reset_hand\n @hand_played = []\n end", "def clear_hand!\n\t\t# restore balances and bet\n\t\t# values in case user forgets\n\t\t# to call win, lose, push etc.\n\t\[email protected] += @bet\n\t\t@bet = 0\n\n\t\t@standing = false\n\t\t@is_split = false\n\t\t@hand = Array.new\n\tend", "def reset\n\t\tend", "def reset_unused!\n @cards += @used\n @used = []\n end", "def reset\n @attempt = 0\n end", "def reset\n # Empty, but subclasses will override this.\n end", "def reset!; end", "def reset!; end", "def reset!; end", "def reset!; end", "def reset(game_id)\n game_state(game_id).reset\n end", "def reset_game\n @cur_board.clear_board\n @cur_board.setup_board\n @turn = 1\n @player_to_move = \"w\"\n end", "def reset_base_card\n new_card = Card.no_mavericks.find_by!(number: self.number, expansion_id: self.expansion.id)\n self.base_card = new_card\n end", "def reset\n dup.reset!\n end", "def reset()\n \n end", "def reset\n each(&:reset)\n self\n end", "def restore_card(card_id)\n update_card(card_id, closed: false)\n end", "def reset\n set(default_preferences)\n end", "def reset!\n tap { set_defaults }\n end", "def reset\n getok 'RSET'\n end", "def reset!\n client.reset!\n end", "def reset\n clear\n @position = 0\n @current_index = 0\n end", "def reset\n invoke_on_reset_callbacks\n self\n end", "def reset!\n instance.reset!\n end", "def reset!\n instance.reset!\n end", "def reset\n @state = :entry\n end", "def reset\n\t\tdo_send('ARST 2')\n\tend", "def shuffle_deck!\n @deck.shuffle\n @deck_position = @deck.each\n end", "def reset\n ::Fiveruns::Dash.sync { @data = blank_data }\n end", "def reset()\n #This is a stub, used for indexing\n end", "def reset()\n #This is a stub, used for indexing\n end", "def initialize_deck\n # Delete the redis user data\n data.reset\n deck = data.create_deck\n Card.all.each do |card|\n # zadd key, score, value\n deck.update_card_interval(interval: 0.second, card_id: card.id)\n end\n end", "def reset_game\n @current_room_id = 9\n find_room_by_id(9).isLocked = true\n find_item_by_id(8).show_item = false\n @inventory.delete(8)\n @talk_id = 18\n end", "def reset\n self.turn = 1\n self.state = ONGOING\n self.board # Triggers default value if necessary.\n self.players\n self.currentPlayer = self.players.first\n board_each do |r,c|\n self.board[r][c] = nil\n changed(true)\n notify_observers U_BOARD, r, c, self.board[r][c]\n end\n binding.pry\n postcondition do\n raise \"Turn should be set to one after reset.\" unless self.turn == 1\n end\n # Let the computer move if necessary.\n computer_actions\n end", "def do_reset\n\t\t\n\t\t\t# Mark state as reset\n\t\t\t@reset = true\n\t\t\t\n\t\t\t# Revert text and palette\n\t\t\tself.text = nil \n\t\t\tself.palette = @palette_normal\t\t\t\n\t\tend", "def reset\n self.base_currency = nil\n self.currency_rates = nil\n end", "def reset\n raise \"Not implemented\"\n end", "def reset!\n @registered_items = self.initial_state.dup\n end", "def reset!\n @registered_items = self.initial_state.dup\n end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end" ]
[ "0.7677289", "0.7619788", "0.7354242", "0.72920626", "0.7029121", "0.70242834", "0.69429487", "0.6933892", "0.6880998", "0.68518317", "0.6824319", "0.6736215", "0.67171663", "0.6687541", "0.66756934", "0.66600865", "0.66305983", "0.66120774", "0.66120774", "0.66015124", "0.66015124", "0.66015124", "0.66015124", "0.65977675", "0.6579449", "0.6575771", "0.6575771", "0.65547067", "0.65380484", "0.6536531", "0.6532146", "0.65200686", "0.65200686", "0.65054077", "0.64996225", "0.64824635", "0.6474495", "0.64692235", "0.64669824", "0.64644706", "0.644363", "0.6435996", "0.6430528", "0.6416408", "0.64094776", "0.64002466", "0.63978976", "0.63894516", "0.63576454", "0.6356404", "0.63543993", "0.6349251", "0.634863", "0.63384384", "0.63384384", "0.63384384", "0.63384384", "0.6336735", "0.63251454", "0.63230276", "0.6319245", "0.63100463", "0.63074744", "0.63058305", "0.63042825", "0.6300668", "0.6300001", "0.62860304", "0.62796557", "0.62786114", "0.62741184", "0.62741184", "0.62653154", "0.6264042", "0.62625957", "0.6259421", "0.6258684", "0.6258684", "0.6248524", "0.62478155", "0.6241094", "0.6238734", "0.62204117", "0.6216504", "0.62027955", "0.62027955", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543", "0.62018543" ]
0.7718841
0
Part 1 Soma os elementos de um array, retorna 0 para array vazio
def sum arr if !arr.empty? soma = 0 arr.each do |elt| ; soma += elt ; end return soma end return 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Array(p0) end", "def get_first_array_elements(body, parts)\n part_count = 0\n parts.each do |part|\n part_count += 1\n body[full_part] = body[full_part][0] if body[full_part].is_a?(Array)\n end\n return body\nend", "def array_start\n []\n end", "def array()\n\t\t@array\n\tend", "def length\n array.first.size\n end", "def index\n @array = [45, 6, 32, 0]\n end", "def array\n @array\n end", "def cambValores arr\n puts arr\n puts 'el nuevo array ahora es....'\n arr = arr.filter{|i| arr.index(i) > 0}\n puts arr\nend", "def load\n\n\t\t#iterate through the array\n\t\ti = 0\n\t\twhile i < @size\n\n\t\t\t#if there is two sequential nils - what would be impossible,\n\t\t\t#given the configuration of the array, but for its end\n\t\t\tif @array[i] == nil && @array[i+1] == nil\n\t\t\t\t#compute the value and return it.\n\t\t\t\treturn (1.0 * i)/ @size\n\t\t\tend\n\n\t\t\ti += 1\n\t\t\t\n\t\tend\n\n\t\t#if it has iterate through the whole array, \n\t\t#it means the number of elements is the same that the size of the array\n\t\treturn 1.0\n\n\tend", "def head\n \t@array[0]\n end", "def test_returns_count\n assert(\n FromArray.new([1, 2, 3]).count == 3\n )\n assert(\n FromArray.new([]).count.zero?\n )\n end", "def lesson_1\n array = [[1,2,3],['a','b','c'],[0,0,0]]\n\n # Display number of array elements\n array.count\n array.length\n\n # Turn multi-dimension array to single dimension\n array.flatten\nend", "def one_rv\n count = 0\n for x in [email protected]\n if @elements[x].remaining_vals.length == 1\n count+=1\n end\n end\n count\n end", "def count_elements(array)\n\nend", "def element_count(array)\n\nend", "def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend", "def first_element_with_array_methods\n @taylor_swift.index (0)\n end", "def get_items\r\n @arr.to_a\r\n end", "def arraysum\n return self.inject(0){|acc,i|acc +i}\n end", "def array_nl()\n #This is a stub, used for indexing\n end", "def first_element(array)\n array[0]\nend", "def [] i\n @array[i]\n end", "def __array__; self; end", "def array\n @@array\n end", "def parts\n unless defined?(@parts)\n @parts = values_array\n @parts.pop while @parts.size > 1 && @parts.last == 0\n end\n @parts\n end", "def first_item(elective_array)\n return elective_array[0]\nend", "def aumentar(array, aumento, desde, hasta)\n arr_filtro = array[desde..hasta] #rango de los datos filtrados\n arr_filtro.map!{|venta_mensual| venta_mensual * aumento}.sum #valor total por el porcentaje de aumento\nend", "def array\n raise \"Not implemented\"\n end", "def size\n \[email protected]\n end", "def test_arrayget_nil_on_nonexistent_index\n collection = Sketchup.active_model.pages\n expected = nil\n result = collection[collection.size]\n assert_equal(expected, result,\n 'Expected does not match result.')\n end", "def element i=0\n @array[i]\n end", "def cust_red(array)\n total = 0 \n array.each_with_index do |el, i|\n total += el \n end \n total\nend", "def _lexist_array(sp, key)\n return 0 if _key_out_of_array(key)\n\n return 1 if sp.length == 0\n\n 1 + self[key].rh_lexist?(sp) if self[key].structured?\n end", "def length\r\n elements.length\r\n end", "def explode arr\n size = arr.map { |i| i.is_a?(Integer) ? i : 0 }.sum\n size.zero? ? \"Void!\" : Array.new(size, arr)\nend", "def converted_arrays; end", "def return_arr_txts\r\n IO.write(\"./DEBUG\", \"docclass=\"[email protected]_s+\" andinfoclass= \"+@@info_past.class.to_s+\"=\"+@@info_past.to_s)\r\n @doc = @@info_past[1]\r\n if @doc[\"doc\"].empty?\r\n return [\"0\"]\r\n else\r\n return @doc[\"doc\"] #retorna os nomes dentro de um Array\r\n end\r\n end", "def calls_array\n a = return_array\n a[1]\n end", "def count_items(elective_array)\n return elective_array.length\nend", "def first_of(array)\n output = array[0]\n return output\nend", "def size\n return @array.size\n end", "def elements; end", "def elements; end", "def elements; end", "def simpleArraySum(ar)\n ar.sum\nend", "def nnz; @elements.size end", "def length\n @elements.length\n #@elements.size \n end", "def empty()\n @arr1.empty?\n end", "def get_elements(array)\n\n elements = []\n if array != nil\n elements = array.to_a\n end\n return elements\n\nend", "def first_of(array)\n return array[0]\nend", "def first_of(array)\n return array[0]\nend", "def returns_array?\n true\n end", "def to_index_array a=[]\n\t\[email protected] do |p|\n\t\t\ta += p[:verts]\n\t\tend\n\t\ta\n\tend", "def simpleArraySum(ar)\n ar.sum\nend", "def get_items\n\t\t@arr\n\tend", "def first(arr)\n return arr[0]\nend", "def rows\n @array\n end", "def size\n to_ary.size\n end", "def using_first(array)\n first_element=array.first\nend", "def retrieve_first_element_from_array(array)\n array[0]\nend", "def size\n @array.length\n end", "def size\n to_ary.size\n end", "def arr\n @custom_cells.each do |c|\n set_custom_cell_val(c)\n end\n @arr.map! { |x| (x == nil) ? 0 : x }\n @arr\n end", "def mabye_one_element_array(ast)\n if ast.is_a?(Array) && ast.size == 1\n ast[0]\n else\n ast\n end\n end", "def custom_first(arr, num_of_elements = 0)\n return arr[0] if num_of_elements == 0\n arr[0, num_of_elements]\nend", "def array(op, len, work) # DK:P297\n\t\t\t\twarn \"array is not implemented\"\n\t\t\tend", "def array\n @angles.first\n end", "def i\n\t\t\tprogram = pop\n\t\t\traise ArgumentError, \"I: first element is not an Array.\" unless program.is_a? Array\n\t\t\t~program\n\t\tend", "def array_total(array)\t\n\tputs \"This list has #{array.length} elements in it\"\nend", "def lengths\n\t\t#NArray.calculate_dimensions(self) # doesn't work for some weird reason\n\t\tdimensions == 1 ? [length] : [length, *self[0].lengths]\n\tend", "def basic_12 (array_process)\n array_process.shift\n array_process.push(0)\nend", "def lcts(array)\nend", "def retrieve_first_element_from_array(array)\n return array[0]\nend", "def number_driver\r\n\t\t@array_translate.length-2\r\n\tend", "def sum(array)\n\t\tsum = 0 #initialise 0 \n\t\tif array.empty? # si tableau vide = rien \n\t\treturn 0 # renvoie 0\n\t\telse # sinon\n\t\tarray.each{|x| sum = sum + x} # tous les elements du tableaux / incremente le code sum\n \t\treturn sum\n\t\tend\n\tend", "def returns_array?\n false\n end", "def returns_array?\n false\n end", "def zero()\n\treturn([0,0,0,0,0,0,0,0,0])\nend", "def element_count()\n return 1\n end", "def to_ary\n\t\t\treturn @elements.to_ary\n\t\tend", "def length_of_array (array)\n array.size\nend", "def value\n result = []\n c = @collection || (0...size).to_a\n r = @rank\n 0.upto(size) do |i|\n r[i] == 1 and result << c[i]\n end\n result\n end", "def get_array\n\t\tsynchronize do\n\t\t\[email protected]_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend", "def length_of_array(array)\n array.length\nend", "def setArr(arr) #=> pierwsza funkcja przypisuje wartosc indeksu plus jeden dla kazdego elementu tablicy\n\n\t(0..arr.length-1).each do |i|\n\n\t\tarr[i] = i + 1\n\n\tend\n\nend", "def size\n as_array ? as_array.length : 0\n end", "def size\n as_array ? as_array.length : 0\n end", "def sum arr\n result = 0\n #Iterate through the length of the array to find the sum of the array elements\n if arr.length > 0 then\n arr.each do |index|\n\tresult += index\n end\n end\n return result\nend", "def check_array(nums)\n if(nums.length >= 2)\n\t\treturn (nums[0] + nums[1])\n\tend\n\tif(nums.length == 1)\n\t\treturn nums[0];\n\tend\n\treturn 0;\n\nend", "def scalar \n\t\t\t@elem[3]\n\t\tend", "def nonzero_element_count\n @row_index.last\n end", "def array?\n false\n end", "def position_array_personne_epenser(journaliste)\n \tputs \"Reponse :\"\n \tputs \"@epenser est sur la ligne #{journaliste.index(\"@epenser\")}\"\n \tputs\nend", "def initialize(array)\r\n @elements = array\r\n\r\n @zero = Zero\r\n end", "def length_of_array(array)\n return array.length\nend", "def array?\n false\n end", "def to_a(length=self.length)\n length == 0 ? [] : self[0, length]\n end", "def array_sum_by_index(arr)\n\nend", "def arrayLength(array)\n puts \"Nombre d'éléments : #{array.length}\"\nend", "def array_length(array)\n\treturn array.length\nend", "def total array\n array.reduce(0, :+)\nend" ]
[ "0.655238", "0.6332136", "0.62203276", "0.60372776", "0.60257393", "0.5957594", "0.5908274", "0.58215123", "0.5799673", "0.57981676", "0.5790108", "0.57866806", "0.57819414", "0.57503223", "0.57440674", "0.5698903", "0.56874263", "0.5668195", "0.56679726", "0.56610996", "0.56454146", "0.56447524", "0.5643915", "0.5638123", "0.5636343", "0.5630252", "0.5621293", "0.5609951", "0.5594714", "0.5593453", "0.5568761", "0.5566574", "0.55598944", "0.5558499", "0.5548701", "0.5543836", "0.5520677", "0.5517722", "0.5498946", "0.5498683", "0.54943496", "0.548608", "0.548608", "0.548608", "0.54550093", "0.5448092", "0.5435542", "0.54138625", "0.5412643", "0.5404404", "0.5404404", "0.5390995", "0.5385934", "0.53853905", "0.5380892", "0.5380637", "0.53801894", "0.5374405", "0.53717554", "0.53713727", "0.5368954", "0.5368922", "0.53684795", "0.53674334", "0.5359591", "0.53592247", "0.534085", "0.53380156", "0.533757", "0.5334509", "0.5324939", "0.5322171", "0.5319375", "0.5313214", "0.53108984", "0.5309904", "0.5309904", "0.53037024", "0.530068", "0.5295629", "0.529468", "0.52937275", "0.5274749", "0.5260231", "0.5252035", "0.5250429", "0.5250429", "0.52466476", "0.52453655", "0.5243787", "0.52382034", "0.5235285", "0.52343076", "0.5228833", "0.5226521", "0.5219443", "0.52170384", "0.5214055", "0.5213718", "0.52127665", "0.52103347" ]
0.0
-1
Soma os dois maiores elementos de um array, retorna 0 para array vazio
def max_2_sum arr if arr.count > 1 arr_ord = arr.sort return arr_ord[-1] + arr_ord[-2] elsif arr.count == 1 return arr[0] else return 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length\n array.first.size\n end", "def test_returns_count\n assert(\n FromArray.new([1, 2, 3]).count == 3\n )\n assert(\n FromArray.new([]).count.zero?\n )\n end", "def arraysum\n return self.inject(0){|acc,i|acc +i}\n end", "def size\n return @array.size\n end", "def size\n \[email protected]\n end", "def cambValores arr\n puts arr\n puts 'el nuevo array ahora es....'\n arr = arr.filter{|i| arr.index(i) > 0}\n puts arr\nend", "def arr\n @custom_cells.each do |c|\n set_custom_cell_val(c)\n end\n @arr.map! { |x| (x == nil) ? 0 : x }\n @arr\n end", "def array()\n\t\t@array\n\tend", "def Array(p0) end", "def index\n @array = [45, 6, 32, 0]\n end", "def array_start\n []\n end", "def size\n to_ary.size\n end", "def array\n @array\n end", "def zero()\n\treturn([0,0,0,0,0,0,0,0,0])\nend", "def size\n @array.length\n end", "def size\n to_ary.size\n end", "def size\n as_array ? as_array.length : 0\n end", "def size\n as_array ? as_array.length : 0\n end", "def array\n @@array\n end", "def sum(array)\n\t\tsum = 0 #initialise 0 \n\t\tif array.empty? # si tableau vide = rien \n\t\treturn 0 # renvoie 0\n\t\telse # sinon\n\t\tarray.each{|x| sum = sum + x} # tous les elements du tableaux / incremente le code sum\n \t\treturn sum\n\t\tend\n\tend", "def sum(array)\n\t\tarray.empty? ? 'vacio' : sum_of_elements(array)\n\tend", "def array\n raise \"Not implemented\"\n end", "def cust_red(array)\n total = 0 \n array.each_with_index do |el, i|\n total += el \n end \n total\nend", "def count\n underlying_array.length\n end", "def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend", "def nonzero_element_count\n @row_index.last\n end", "def test_sum_empty_array\n expected_sum = 0\n assert_equal expected_sum, Stats.sum(Array.new)\n end", "def element_count(array)\n\nend", "def get_items\r\n @arr.to_a\r\n end", "def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend", "def count_elements(array)\n\nend", "def total(array)\n\tanswer=array.inject(0){\n\t\t|sum,i| sum+i\n\t}\n\treturn answer\nend", "def nnz; @elements.size end", "def length\r\n elements.length\r\n end", "def total array\n array.reduce(0, :+)\nend", "def test_computes_sum_of_empty_array\n\t\tassert_equal(0, sum([]))\n\tend", "def value\n result = []\n c = @collection || (0...size).to_a\n r = @rank\n 0.upto(size) do |i|\n r[i] == 1 and result << c[i]\n end\n result\n end", "def array_sum(array)\n\tarray.empty? ? array = 0 : array.reduce(:+)\nend", "def simpleArraySum(ar)\n ar.sum\nend", "def count_items(elective_array)\n return elective_array.length\nend", "def __array__; self; end", "def total(array)\n if array.size !=0\n total_num = 0\n for n in 0...array.size\n value = array[n]\n total_num += value\n end\n return total_num\n end\nend", "def count\n @rarray.length\n end", "def load\n\n\t\t#iterate through the array\n\t\ti = 0\n\t\twhile i < @size\n\n\t\t\t#if there is two sequential nils - what would be impossible,\n\t\t\t#given the configuration of the array, but for its end\n\t\t\tif @array[i] == nil && @array[i+1] == nil\n\t\t\t\t#compute the value and return it.\n\t\t\t\treturn (1.0 * i)/ @size\n\t\t\tend\n\n\t\t\ti += 1\n\t\t\t\n\t\tend\n\n\t\t#if it has iterate through the whole array, \n\t\t#it means the number of elements is the same that the size of the array\n\t\treturn 1.0\n\n\tend", "def sum arr\n if !arr.empty?\n soma = 0\n arr.each do |elt| ; soma += elt ; end\n return soma\n end\n return 0 \nend", "def test_arrayget_nil_on_nonexistent_index\n collection = Sketchup.active_model.pages\n expected = nil\n result = collection[collection.size]\n assert_equal(expected, result,\n 'Expected does not match result.')\n end", "def total(array)\n\t\ttotal = 0\n\t\tfor number in array\n\t\t\ttotal += number\n\t\tend\n\t\treturn total\n\tend", "def simpleArraySum(ar)\n ar.sum\nend", "def total array\n array.inject(0){|sum,x| sum + x }\nend", "def array_total(array)\t\n\tputs \"This list has #{array.length} elements in it\"\nend", "def zeros\n counter = 0\n @l.each_value do |v|\n\tcounter +=1 if v == '0'\n end # do\n counter\n end", "def sumCheck(array)\r\n arraySum = 0\r\n for i in array\r\n arraySum += i\r\n end\r\n return arraySum\r\nend", "def aumentar(array, aumento, desde, hasta)\n arr_filtro = array[desde..hasta] #rango de los datos filtrados\n arr_filtro.map!{|venta_mensual| venta_mensual * aumento}.sum #valor total por el porcentaje de aumento\nend", "def array_nl()\n #This is a stub, used for indexing\n end", "def [] i\n @array[i]\n end", "def arrayLength(array)\n puts \"Nombre d'éléments : #{array.length}\"\nend", "def lesson_1\n array = [[1,2,3],['a','b','c'],[0,0,0]]\n\n # Display number of array elements\n array.count\n array.length\n\n # Turn multi-dimension array to single dimension\n array.flatten\nend", "def one_rv\n count = 0\n for x in [email protected]\n if @elements[x].remaining_vals.length == 1\n count+=1\n end\n end\n count\n end", "def size\n 0\n end", "def size\n 0\n end", "def total_of_array(array)\n array.inject(0) {|sum, i| sum + i }\nend", "def sum arr\n result = 0\n #Iterate through the length of the array to find the sum of the array elements\n if arr.length > 0 then\n arr.each do |index|\n\tresult += index\n end\n end\n return result\nend", "def array_length(array)\n\treturn array.length\nend", "def array_sum(arr)\n if arr.empty?\n 0\n else\n arr.reduce(:+)\nend\nend", "def zero_sum?(array)\nend", "def total_count\n @_total_count || @_original_array.length\n end", "def return_arr_txts\r\n IO.write(\"./DEBUG\", \"docclass=\"[email protected]_s+\" andinfoclass= \"+@@info_past.class.to_s+\"=\"+@@info_past.to_s)\r\n @doc = @@info_past[1]\r\n if @doc[\"doc\"].empty?\r\n return [\"0\"]\r\n else\r\n return @doc[\"doc\"] #retorna os nomes dentro de um Array\r\n end\r\n end", "def length\n @elements.length\n #@elements.size \n end", "def total(array)\n\ttoats = 0\n\tarray.each do |i|\n\t\ttoats = toats + i\nend\nreturn toats\nend", "def empty?\r\n @arr.empty?\r\n end", "def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference = difference1 / 2\n difference.times do \n array << 0\n array << \"0\"\n end\n else\n end\n end\n arrays\n end", "def initialize(array)\r\n @elements = array\r\n\r\n @zero = Zero\r\n end", "def simpleArraySum(ar)\n count = 0\n ar.each {|x| count += x}\n count\nend", "def length_of_array (array)\n array.size\nend", "def namerisuminarray arr \n len = arr.length\n sum = 0\n sum = sum.to_i\n broqch = 0\n \n while broqch <= len - 1\n sum = sum + arr[broqch].to_i\n broqch = broqch + 1\n end\n \n return sum \nend", "def setze_aktive(array_of_indices)\n array_of_indices.to_java(Java::int)\n end", "def length\n array_list.length\n end", "def size\n\t\[email protected]\n\tend", "def terrenos\r\n terreno = 0\r\n @lista_alimentos.each do |i|\r\n terreno += i.terreno\r\n end\r\n return terreno\r\n end", "def empty()\n @arr1.empty?\n end", "def sum(in_array)\n # YOUR CODE HERE\n sumr=0\n if in_array.length == 0\n sumr=0\n elsif \n #Enumerable\n sumr= in_array.reduce(:+)\n end\n\n return sumr\nend", "def element i=0\n @array[i]\n end", "def head\n \t@array[0]\n end", "def length(array)\n index = 0\n while array[index] != nil\n index += 1\n end\n return index\nend", "def test_computes_sum_of_empty_array\n result = @calculator.computes_sum([])\n expected = 0\n assert_equal expected, result\n end", "def to_ary\n\t\t\treturn @elements.to_ary\n\t\tend", "def sum arr\n\ttotal = 0\n\tif arr.size > 0\n\t\ttotal = arr.reduce(:+)\n\tend\n\n\treturn total\nend", "def explode arr\n size = arr.map { |i| i.is_a?(Integer) ? i : 0 }.sum\n size.zero? ? \"Void!\" : Array.new(size, arr)\nend", "def my_solution(array)\n hash = {}\n\n array.each do |element|\n hash[element] = 0 if element > 0\n end\n\n (1..array.size).each do |i|\n return i if hash[i].nil?\n end\nend", "def length\n CF.CFArrayGetCount(self)\n end", "def total(array)\n\tif array.size != 0\n\t\ttotal_num = 0\n\t\tfor n in 0...array.size\n\t\t\tvalue = array[n]\n\t\t\ttotal_num += value\n\t\tend\n\t\treturn total_num\n\tend\nend", "def custom_count(array)\n counter = 0\n array.each do |elem|\n if elem != nil\n counter += 1\n end\n end\n counter\nend", "def totalArray(scoreArr)\n\t#initialize total\n\ttotal = 0\n\t#for each number in array\n\tfor num in scoreArr\n\t\t#add number to total \n\t\ttotal += num\n\tend\n\t#return total\n\treturn total\nend", "def array\n @angles.first\n end", "def length_of_array(array)\n return array.length\nend", "def array_num_total array\r\n i = 0\r\n\tnum_total = 0\r\n\tinteger_array = array.collect { |item| item.to_i }\r\n\twhile i < integer_array.length\r\n\t num_total = integer_array[i] + num_total\r\n\t\ti = i + 1\r\n\tend\r\n num_total\r\nend", "def get_array\n\t\tsynchronize do\n\t\t\[email protected]_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend", "def m\n a.length\n end", "def lengths\n\t\t#NArray.calculate_dimensions(self) # doesn't work for some weird reason\n\t\tdimensions == 1 ? [length] : [length, *self[0].lengths]\n\tend", "def size\n 0\n end", "def length_of_array(array)\n array.length\nend" ]
[ "0.63044745", "0.6272252", "0.6239469", "0.6157792", "0.6141516", "0.61352324", "0.6130367", "0.6127148", "0.6089858", "0.60550934", "0.60275215", "0.59983313", "0.5997854", "0.5979171", "0.5962313", "0.59592086", "0.5947168", "0.5947168", "0.59308636", "0.5891704", "0.58833855", "0.5845501", "0.5837926", "0.5820562", "0.5814925", "0.58029336", "0.57971513", "0.5780279", "0.5775297", "0.57567257", "0.57563055", "0.57421404", "0.57379514", "0.5731988", "0.5725372", "0.5723232", "0.5700467", "0.56950206", "0.56868535", "0.56860024", "0.5681672", "0.56797105", "0.5678977", "0.5670457", "0.5655096", "0.56398773", "0.5637645", "0.56202865", "0.5609084", "0.56070703", "0.55834675", "0.5582472", "0.5574556", "0.5570724", "0.556975", "0.55644065", "0.55598", "0.5555267", "0.55500996", "0.55500996", "0.55333316", "0.55227846", "0.5522258", "0.55162746", "0.55109435", "0.5510824", "0.5510434", "0.5507495", "0.5506816", "0.5506456", "0.5501639", "0.54921263", "0.54906553", "0.548739", "0.5486469", "0.5484901", "0.5482736", "0.5482133", "0.54808813", "0.54779434", "0.54760575", "0.54731244", "0.5461211", "0.54587466", "0.54581887", "0.5458031", "0.5457901", "0.544933", "0.5443632", "0.54324424", "0.54315066", "0.54276437", "0.54253536", "0.5421795", "0.5414039", "0.5407761", "0.5405408", "0.539703", "0.53954184", "0.5394004", "0.53932035" ]
0.0
-1
e.g. Feed, Item, Site, etc. Helpers
def feed_path( feed ) "/feed/#{feed.key}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed_items\n feed_item\n end", "def saw_item(item); end", "def links_feed\n end", "def featured_item(items)\n\n end", "def only_blogs items\n only_ items, :blog\nend", "def item; end", "def item; end", "def item; end", "def item; end", "def item; end", "def type\n return @type if @type\n @type = 'item' if rss.css('item').count > 0\n @type = 'entry' if rss.css('entry').count > 0\n return @type\n end", "def item_type\n self.class.name.singularize.ns_underscore\n end", "def url_for_list(type); end", "def link_of_item(kind)\n\titem = @items.find { |i| i.attributes()[:kind] == kind }\n\tlink_to(kind.capitalize, @site.config()[:base_url] + item.path) unless item.nil?\nend", "def item\n item_type.name.classify.constantize.find(item_id)\n end", "def item; @item; end", "def item; @item; end", "def items\n authors\n end", "def item_endpoint?(page)\n page == :item\n end", "def base_item\n source_item\n end", "def recognized_item_types\n\t\t# , 'DocFile', 'DocImage', 'DocPrivate', 'Path'\n\t\t['Article', 'Document', 'Event', 'Group', 'Page', 'Petition', 'Signature', 'User', 'Weblink']\n\tend", "def links; end", "def links; end", "def item_url(item)\n item.url\n end", "def item_url(item)\n item.url\n end", "def activity_feed_message(activity)\r\n user = activity.user\r\n case activity.item_type\r\n when \"Friendship\"\r\n friendship = activity.item\r\n %(#{user_link(user)} became friends with #{link_to friendship.friend.name, '/users/' + friendship.friend.id.to_s} <span class=\"activity_date\">#{friendship.updated_at.to_s(:event_list)}</span>) \r\n when \"Event\"\r\n event = activity.item\r\n %(#{user_link(user)} added a new event - #{link_to event.name, '/events/'+event.id.to_s} #{activity_date(event)})\r\n when \"User\"\r\n if user\r\n %(#{user_link(user)} joined. #{activity_date(user)})\r\n else\r\n %(A former user joined. #{activity_date(activity)}) \r\n end\r\n when \"Photo\"\r\n if activity.action == 'destroy'\r\n %(<span class=\"activity_text\"><span class=\"activity_user_link\">#{user_link(user)}</span> deleted a photo.</span>#{activity_date(activity)})\r\n else\r\n if activity.item\r\n photo = Photo.find(activity.item.id, :select=>\"id, user_id, filename, parent_id, created_at\")\r\n %(<span class=\"activity_text\"><span class=\"activity_user_link\">#{user_link(user)}</span> uploaded a photo - <a href=\"/photos/#{photo.id}\">#{image_tag(photo.public_filename(:small))}</a>.</span>#{activity_date(photo)})\r\n else\r\n # photo no longer exists, but still need to display upload event for history\r\n %(<span class=\"activity_text\"><span class=\"activity_user_link\">#{user_link(user)}</span> uploaded a photo.</span>#{activity_date(activity)})\r\n end\r\n end \r\n when \"Group\"\r\n group = activity.item\r\n if group\r\n %(A new group was created, #{link_to(group.name, group_url(group))} #{activity_date(group)})\r\n else\r\n %(A new group was created, group no longer exists)\r\n end\r\n when \"BlogPost\"\r\n blog_post = activity.item\r\n if blog_post\r\n %(#{user_link(user)} posted a new blog entry, <a href=\"/blog_posts/#{blog_post.id}\">#{blog_post.title}</a>. #{activity_date(blog_post)})\r\n else\r\n %(#{user_link(user)} posted a new blog entry.) \r\n end\r\n when \"Attendance\"\r\n if activity.item\r\n attendance = activity.item\r\n %(#{user_link(user)} is attending the event, #{link_to attendance.event.name, 'events/' + attendance.event.id.to_s}. #{activity_date(attendance)})\r\n else\r\n # attendance no longer exists, user has canceled\r\n %(#{image_tag(user.profile_photo.public_filename(:small))}#{user_link(user)} signed up for an event, but has since revoked that decision.)\r\n end\r\n when \"Membership\"\r\n membership = activity.item\r\n %(<span class=\"activity_text\"><span class=\"activity_user_link\">#{user_link(user)}</span> joined the group, <a href=\"/groups/#{membership.group.id}\">#{membership.group.name}</a>. </span>#{activity_date(membership)})\r\n when \"ForumPost\"\r\n forum_post = activity.item\r\n %(#{user_link(user)} posted a new message to the forum, <a href=\"/forum_posts/#{forum_post.id}\">#{forum_post.title}</a>. #{activity_date(forum_post)})\r\n when \"JobPost\"\r\n job_post = activity.item\r\n if job_post\r\n %(A new job was posted - #{link_to(job_post.job_title, job_posts_url)}. #{activity_date(job_post)})\r\n else\r\n # the job post has been deleted\r\n %(A new job was posted. #{activity_date(activity)})\r\n end\r\n when \"BookReview\"\r\n book_review = activity.item\r\n %(#{user.name} posted a new review for #{book_review.name}. #{activity_date(book_review)}) \r\n when \"StatusPost\"\r\n status_post = activity.item\r\n %(<span class=\"activity_text\"><span class=\"activity_user_link\">#{user_link(user)}</span> #{EngineyUtil.linkify(status_post.body)}</span>#{activity_date(status_post)})\r\n when \"Link\"\r\n link = activity.item\r\n if link\r\n %(#{user_link(user)} posted a new link #{link_to link.url, link.url} #{activity_date(link)})\r\n else\r\n # the link was deleted\r\n %(#{user_link(user)} posted a new link)\r\n end\r\n when \"Project\"\r\n project = activity.item\r\n if project\r\n %(#{user_link(user)} added a new project #{link_to project.name, project.url} #{activity_date(project)})\r\n else \r\n # the project was deleted\r\n %(#{user_link(user)} added a new project #{activity_date(activity)})\r\n end\r\n when \"Announcement\"\r\n announcement = activity.item\r\n if announcement\r\n %(#{user_link(user)} posted a new announcement, <b>#{announcement.title}</b> #{activity_date(announcement)})\r\n else\r\n %(#{user_link(user)} posted a new announcement #{activity_date(activity)})\r\n end\r\n when \"Classified\"\r\n classified = activity.item\r\n %(#{user_link(user)} posted a new classified, #{link_to classified.title, classified_url(classified)})\r\n else\r\n %(Invalid activity type - #{activity.item_type})\r\n end\r\n end", "def get_crafted_items(index)\n page = get_additional_info(index)\n elements = page.css('.content-body-title a')\n items = []\n\n elements.each do |el|\n href = /item\\/(\\d+)/.match(el['href'])\n id = nil\n\n if (href && href.length > 1)\n items.push(href[1])\n end\n end\n\n items\nend", "def item_link(item)\n if !item.new_record?\n if item.respond_to?(:name)\n content_tag(:li, link_to(item.name, [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:headline)\n content_tag(:li, link_to(item.headline.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n elsif item.respond_to?(:title)\n content_tag(:li, link_to(item.title.truncate(30), [:cms, @available_locale, item]), class: 'current hide-for-small')\n end\n end\n end", "def rss\n render_rss_feed_for Idea.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Ideas',\n :link => url_for(:controller => 'ideas', :action => 'list', :only_path => false),\n :pub_date => :created_at\n },\n :item => {\n :title => :title,\n :description => :formatted_description,\n :link => Proc.new{|idea| url_for(:controller => 'ideas',\n :action => 'show', :id => idea.id)}\n }\n }\n end", "def feed_class(feed)\n return '' if feed.service.blank?\n \n if feed.service.photo?\n \"feed-photos\"\n elsif feed.service.bookmark?\n \"feed-bookmarks\"\n elsif feed.service.video?\n \"feed-videos\"\n elsif feed.service.music?\n \"feed-music\"\n end\n end", "def article_feed\n \tArticle.all\n end", "def getSearchURL itemName, itemType\n itemEncoded = URI.encode itemName\n if itemType == 'title'\n return ROOT_URL + 'find?q=' + itemEncoded + '&' + QPARAMS_TITLE_SEARCH\n end\nend", "def extract_items(content)\n GnewsItemsExtractor.new.get_gnews_items(content)\nend", "def normal_news_link\n normal_link(\"news_#{@news.news_type}\") if @news\n\tend", "def get_blog_posts\n return @items.select { |item| item.identifier.index('/blog/') == 0 && item[:published] }.reverse\nend", "def make_item_list\n end", "def helpers; end", "def helpers; end", "def helpers; end", "def item\n case item_type\n when 'group'\n group\n end\n end", "def item\n case item_type\n when 'group'\n group\n end\n end", "def newsfeed\n Post.newsfeed_for(self)\n end", "def itemtype\n format = self[:format_main_ssim] || []\n genre = self[:genre_ssim] || []\n case\n when genre.include?('Thesis/Dissertation')\n 'http://schema.org/Thesis'\n when genre.include?('Video games')\n 'http://schema.org/VideoGame'\n when format.include?('Equipment')\n 'http://schema.org/Thing'\n when format.include?('Book')\n 'http://schema.org/Book'\n when format.include?('Dataset')\n 'http://schema.org/Dataset'\n when format.include?('Image')\n 'http://schema.org/ImageObject'\n when format.include?('Journal/Periodical')\n 'http://schema.org/Periodical'\n when format.include?('Map')\n 'http://schema.org/Map'\n when format.include?('Music recording')\n 'http://schema.org/MusicRecording'\n when format.include?('Newspaper')\n 'http://bib.schema.org/Newspaper'\n when format.include?('Software/Multimedia')\n 'http://schema.org/SoftwareApplication'\n when format.include?('Sound recording')\n 'http://schema.org/AudioObject'\n when format.include?('Video')\n 'http://schema.org/VideoObject'\n else\n 'http://schema.org/CreativeWork'\n end\n end", "def item_type_path\n self.class.name.pluralize.underscore\n end", "def posts; end", "def item_type\n name.singularize.ns_underscore\n end", "def feed_items(feed_title) \n # update last_viewed_at \n @client.query \"UPDATE feeds SET last_viewed_at = now() where title = '#{e feed_title}'\"\n query = \"SELECT items.title, guid, feed, feed_title, pub_date, word_count, starred, unread from items where items.feed_title = '#{e feed_title}' order by pub_date asc\"\n @client.query(query)\n end", "def extract_related_content\n end", "def initialize_items\n find_printed_items\n find_slug_items\n find_categories\n end", "def all_post\n end", "def feed_items\n # Following users\n following_user_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n # Following Tags\n following_tag_ids = \"SELECT tag_id FROM tag_follows\n WHERE user_id = :user_id\"\n # Following tag's items\n following_tag_item_ids = \"SELECT taggable_id FROM taggings WHERE taggable_type = 'Item' AND tag_id IN (#{following_tag_ids})\"\n # Stocking items\n stocking_item_ids = \"SELECT item_id FROM item_stocks WHERE user_id = :user_id\"\n\n Item.includes(:update_user).where(\"create_user_id IN (#{following_user_ids}) OR update_user_id IN (#{following_user_ids})\n OR create_user_id = :user_id OR update_user_id = :user_id\n OR id IN (#{stocking_item_ids})\n OR id IN (#{following_tag_item_ids})\", user_id: id)\n .where(active: true).limit(20)\n end", "def external_link_inventory # make this an object attribute for every page object, along with base url, and other helpful state info\n []\n end", "def item_class\n item_type&.classify&.constantize\n end", "def entities; end", "def item_name\n issue.title\n end", "def feed_items\n []\n end", "def index\n # Load the latest full blog feed for Frank's blog as per \n @latest_blog_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default?alt=rss')\n \n # Load the latest posts for the Marketing label feed. Labels are case sensitive - Marketing != marketing\n # Please note that the example of the Google website has an error on its label example. The alt=rss comes after\n # the label in the feed URL\n @latest_marketing_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss')\n \n # Load the latest posts for the SQL Converter label feed (space in the tag)\n @latest_sql_converter_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/SQL%20Converter?alt=rss')\n end", "def find item\n\tend", "def my_links\n end", "def news_and_media\n # blank\n end", "def category\n self.item.category\n end", "def collect_news_item(node, data)\n h = Hash[data.keys[2..5].map { |x| [x, node.xpath(data[x]).to_s] }]\n h[\"title\"] = h[\"title\"].gsub(/[^a-zA-Z0-9\\- ]/, \"\")\n h[\"header\"] = h[\"header\"].gsub(/[^a-zA-Z0-9\\- ]/, \"\")\n get_extras(h, node, data)\n end", "def top_news_sources\n\n end", "def gather_feed_items(user = nil)\n if user\n # Notes left on your posts and pictures\n notes_on_your_posts = []\n\n user.posts.each do |post|\n notes_on_your_posts = smush(notes_on_your_posts, post.notes)\n post.pictures.each do |picture|\n notes_on_your_posts = smush(notes_on_your_posts, picture.notes)\n end\n end\n\n # Notes left by people the current user is following\n notes_left_by_followees = []\n\n # Notes left on posts owned by people the current user is following\n notes_left_on_followees_posts = []\n\n # Notes left on pictures owned by people the current user is following\n notes_left_on_followees_pictures = []\n\n # Posts created by people the current user is following\n posts_by_followees = []\n\n # Followings of people the current user is following\n following_followees = []\n\n # People the current user is following, following other people\n followees_following = []\n\n user.followees.each do |followee|\n posts_by_followees = smush(posts_by_followees, followee.posts)\n notes_left_by_followees = smush(notes_left_by_followees, followee.notes)\n\n followee.posts.each do |post|\n notes_left_on_followees_posts = smush(notes_left_on_followees_posts, post.notes)\n post.pictures.each do |picture|\n notes_left_on_followees_pictures = smush(notes_left_on_followees_pictures, picture.notes)\n end\n end\n\n following_followees = smush(following_followees, Follow.find_all_by_followee_id(followee.id, :conditions => \"follower_id <> #{user.id}\"))\n followees_following = smush(followees_following, Follow.find_all_by_follower_id(followee.id, :conditions => \"follower_id <> #{user.id}\"))\n end\n\n # Remove totally blank posts from feed\n posts_by_followees.each do |post|\n if post.title.blank? and post.content.blank? and post.pictures.length == 0\n posts_by_followees.delete(post)\n end\n end\n blavel_posts = User.find_by_login('blavel') ? User.find_by_login('blavel').posts : nil\n posts = smush(posts_by_followees, blavel_posts)\n if posts\n posts = posts.uniq\n end\n\n # Remove notes left by logged in user\n notes = smush(notes_on_your_posts, notes_left_by_followees, notes_left_on_followees_posts, notes_left_on_followees_pictures)\n notes.each do |note|\n if note.user == user\n notes.delete(note)\n end\n end\n notes = notes.uniq\n\n # Add together follows\n following_you = Follow.find_all_by_followee_id(user.id)\n follows = smush(following_you, following_followees, followees_following)\n follows = follows.uniq\n else\n # If no user is specified, return all feed items\n notes = Note.find(:all)\n posts = Post.find(:all)\n follows = Follow.find(:all)\n\n # Remove totally blank posts from feed\n posts.each do |post|\n if post.title.blank? and post.content.blank? and post.pictures.length == 0\n posts.delete(post)\n end\n end\n end\n\n feed_items = smush(notes, posts, follows)\n feed_items.sort! { |x,y| y.created_at <=> x.created_at }\n feed_items = feed_items[0..19]\n\n return feed_items\n end", "def render_feed(type, tag_name)\n raise if !type.instance_of?(Symbol)\n raise if !tag_name.instance_of?(String)\n\n last_modified_date = Post.order(\"updated_at DESC\").first.try(:created_at).try(:to_datetime) || DateTime.now\n tag = Tag.where(:name => tag_name).first\n if !tag\n return render_404\n end\n posts = tag.posts.where(:is_public => true).order(\"sort_id DESC\")\n xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?>\\r\\n\"\n case type\n when :rss\n xml << \"<rss version=\\\"2.0\\\" xmlns:atom=\\\"http://www.w3.org/2005/Atom\\\">\\r\\n\"\n xml << \" <channel>\\r\\n\"\n xml << \" <title>\" + APP_TITLE + \"</title>\\r\\n\"\n if tag.name == \"home\"\n xml << \" <description>\" + APP_DESCRIPTION.encode(:xml => :text) + \"</description>\\r\\n\"\n else\n xml << \" <description>\" + APP_DESCRIPTION.encode(:xml => :text) + \" Category: \" + tag.name + \".</description>\\r\\n\"\n end\n xml << \" <link>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"</link>\\r\\n\"\n xml << \" <pubDate>\" + last_modified_date.to_formatted_s(:rfc822).encode(:xml => :text) + \"</pubDate>\\r\\n\"\n if tag.name == \"home\"\n xml << \" <atom:link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/rss\\\" rel=\\\"self\\\" type=\\\"application/rss+xml\\\" />\\r\\n\"\n else\n xml << \" <atom:link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/rss/\" + tag.name + \"\\\" rel=\\\"self\\\" type=\\\"application/rss+xml\\\" />\\r\\n\"\n end\n for post in posts\n xml << \" <item>\\r\\n\"\n xml << \" <title>\" + post.title.encode(:xml => :text) + \"</title>\\r\\n\"\n xml << \" <description>\" + post.summary.encode(:xml => :text) + \"</description>\\r\\n\"\n xml << \" <link>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"</link>\\r\\n\"\n xml << \" <guid>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"</guid>\\r\\n\"\n xml << \" <pubDate>\" + post.created_at.to_datetime.to_formatted_s(:rfc822).encode(:xml => :text) + \"</pubDate>\\r\\n\"\n xml << \" </item>\\r\\n\"\n end\n xml << \" </channel>\\r\\n\"\n xml << \"</rss>\\r\\n\"\n when :atom\n xml << \"<feed xmlns=\\\"http://www.w3.org/2005/Atom\\\">\\r\\n\"\n xml << \" <title>\" + APP_TITLE + \"</title>\\r\\n\"\n if tag.name == \"home\"\n xml << \" <subtitle>\" + APP_DESCRIPTION.encode(:xml => :text) + \"</subtitle>\\r\\n\"\n else\n xml << \" <subtitle>\" + APP_DESCRIPTION.encode(:xml => :text) + \" Category: \" + tag.name + \".</subtitle>\\r\\n\"\n end\n if tag.name == \"home\"\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/atom\\\" rel=\\\"self\\\" />\\r\\n\"\n else\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/atom/\" + tag.name + \"\\\" rel=\\\"self\\\" />\\r\\n\"\n end\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/\\\" />\\r\\n\"\n xml << \" <id>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + \"/</id>\\r\\n\"\n xml << \" <updated>\" + last_modified_date.to_formatted_s(:rfc3339).encode(:xml => :text) + \"</updated>\\r\\n\"\n for post in posts\n xml << \" <entry>\\r\\n\"\n xml << \" <title>\" + post.title.encode(:xml => :text) + \"</title>\\r\\n\"\n xml << \" <link href=\\\"\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"\\\" />\\r\\n\"\n xml << \" <id>\" + (APP_PROTOCOL + APP_HOST).encode(:xml => :text) + post.canonical_uri.encode(:xml => :text) + \"</id>\\r\\n\"\n xml << \" <updated>\" + post.created_at.to_datetime.to_formatted_s(:rfc3339).encode(:xml => :text) + \"</updated>\\r\\n\"\n xml << \" <summary>\" + post.summary.encode(:xml => :text) + \"</summary>\\r\\n\"\n xml << \" <author>\\r\\n\"\n xml << \" <name>\" + APP_AUTHOR.encode(:xml => :text) + \"</name>\\r\\n\"\n xml << \" <email>\" + APP_EMAIL.encode(:xml => :text) + \"</email>\\r\\n\"\n xml << \" </author>\\r\\n\"\n xml << \" </entry>\\r\\n\"\n end\n xml << \"</feed>\\r\\n\"\n else\n return render_404\n end\n return render :xml => xml\n end", "def search_item_link(item)\n subcategory = item[\"subcategory\"].downcase\n\n if subcategory == \"audio\"\n id = item[\"identifier\"].split(\".\").last\n path = audio_item_path(id: id)\n\n elsif subcategory == \"correspondence & papers\"\n path = correspondence_item_path(id: item[\"identifier\"])\n\n elsif subcategory == \"drill\"\n path = drill_item_path(id: item[\"identifier\"])\n\n elsif subcategory == \"features\"\n id = item[\"identifier\"].split(\".\").last\n path = feature_path(id: id)\n\n elsif subcategory == \"footage\"\n path = footage_clip_path(id: item[\"identifier\"])\n\n elsif subcategory == \"images\"\n path = image_path(id: item[\"identifier\"])\n\n elsif subcategory == \"newspaper\"\n path = newspapers_item_path(id: item[\"identifier\"])\n\n elsif subcategory == \"personal accounts\"\n id = item[\"identifier\"].split(\".\").last\n path = account_path(id: id)\n\n else\n path = item_path(id: item[\"identifier\"])\n end\n\n path\n end", "def list_articles()\n\nend", "def faqs\n end", "def faqs\n end", "def content_type\n if params[:content] == 'before_after'\n @post = @business.before_afters.find_by(slug: params[:content_type])\n elsif params[:content] == 'event'\n @post = @business.events.find(params[:content_type])\n @upcoming_events = @post.event_definition.events.\n where.not(id: @post.id).\n where('occurs_on >= ?', Time.zone.now).\n order(occurs_on: :asc).\n page(1).\n per(4)\n elsif params[:content] == 'event_definition'\n @post = @business.event_definitions.find(params[:content_type])\n elsif params[:content] == 'gallery'\n @post = @business.galleries.find_by(slug: params[:content_type])\n elsif params[:content] == 'offer'\n @post = @business.offers.find_by(slug: params[:content_type])\n elsif params[:content] == 'post'\n @post = @business.posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'quick_post'\n @post = @business.quick_posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'job'\n @post = @business.jobs.find_by(slug: params[:content_type])\n end\n end", "def articles\n\n end", "def content_type\n if params[:content] == 'before_after'\n @post = @business.before_afters.find_by(slug: params[:content_type])\n elsif params[:content] == 'event'\n @post = @business.events.find(params[:content_type])\n @upcoming_events = @post.event_definition.events.\n where.not(id: @post.id).\n where('occurs_on >= ?', Time.zone.now).\n order(occurs_on: :asc).\n page(1).\n per(4)\n elsif params[:content] == 'event_definition'\n @post = @business.event_definitions.find(params[:content_type])\n elsif params[:content] == 'gallery'\n @post = @business.galleries.find_by(slug: params[:content_type])\n elsif params[:content] == 'offer'\n @post = @business.offers.find_by(slug: params[:content_type])\n elsif params[:content] == 'post'\n @post = @business.posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'quick_post'\n @post = @business.quick_posts.find_by(slug: params[:content_type])\n elsif params[:content] == 'job'\n @post = @business.jobs.find_by(slug: params[:content_type])\n elsif params[:content] == \"creation_post\"\n @post = @business.creation_posts.find_by(slug: params[:content_type])\n elsif params[:content] == \"profile_post\"\n @post = @business.profile_posts.find_by(slug: params[:content_type])\n end\n end", "def content_methods; end", "def get_item_general_info(page, da_container, detail_page)\n\n #get td item that contains detail general info\n\n tds = da_container.search('td')\n item_general_info = {}\n item_general_info[:info_url] = get_info_url(page, tds)\n item_general_info[:council_reference] = get_council_reference(tds)\n item_general_info[:comment_url] = get_comment_url(tds)\n item_general_info[:address] = get_address(tds)\n item_general_info[:description] = get_description(detail_page, tds)\n item_general_info[:date_scraped] = get_date_scraped\n return item_general_info\n\nend", "def get_item_general_info(page, da_container, detail_page)\n\n #get td item that contains detail general info\n\n tds = da_container.search('td')\n item_general_info = {}\n item_general_info[:info_url] = get_info_url(page, tds)\n item_general_info[:council_reference] = get_council_reference(tds)\n item_general_info[:comment_url] = get_comment_url(tds)\n item_general_info[:address] = get_address(tds)\n item_general_info[:description] = get_description(detail_page, tds)\n item_general_info[:date_scraped] = get_date_scraped\n return item_general_info\n\nend", "def item;\n @item;\n end", "def link_name\n title\n end", "def initialize(feed, item)\n if (feed.feed_type == \"rss\")\n @feed_title = feed.channel.title\n @title = item.title\n @link = item.link\n @date = parse_time(item.date)\n @content = item.description\n @content = item.content_encoded if item.content_encoded\n @guid = item.guid.content\n @audio = nil\n if item.enclosure\n if item.enclosure.type == \"audio/mpeg\"\n @audio = item.enclosure.url\n elsif item.enclosure.type.start_with? \"image/\" # If there is an image in the enclosure\n unless @content.include? \"<img \" # and no images in the content\n # then include the enclosure image\n @content = \"<img src=\\\"#{item.enclosure.url}\\\" /><br/>\" + @content\n end\n end\n end\n elsif (feed.feed_type == \"atom\")\n @feed_title = feed.title.content\n @title = item.title.content\n @link = item.link.href\n if !item.published.nil?\n @date = parse_time(item.published.content)\n else\n @date = parse_time(item.updated.content)\n end\n if !item.content.nil?\n @content = CGI.unescapeHTML(item.content.to_s)\n else\n @content = CGI.unescapeHTML(item.summary.to_s)\n end\n @guid = item.id.to_s\n @audio = nil # TODO podcast support for Atom feeds?\n end\n end", "def links_for_item(item)\n links = super(item)\n\n links.push({\n 'rel' => 'status',\n 'type' => api_media_type(:g5kitemjson),\n 'href' => uri_to(File.join(resource_path(item['uid']), 'status'))\n })\n links\n end", "def generate_item(item)\n item\n end", "def feed_item(list, title = @config[:title], identifier = '/feed/')\n Nanoc::Item.new(\n '<%= atom_feed(:articles => @item[:list]) %>',\n {:title => title, :extension => 'atom', :list => list},\n identifier\n )\nend", "def fox_item\n @item\n end", "def custom_hook_all(items)\n grouped_by_page = items.group_by do |i|\n \"#{i[:category]}-#{i[:subcategory]}\"\n end\n grouped_by_page.each do |_, pages|\n page_record = {\n category: pages[0][:category],\n hierarchy: pages[0][:hierarchy],\n subcategory: pages[0][:subcategory],\n tagname: 'h1',\n text: nil,\n display_title: \"Go to #{pages[0][:subcategory]}\",\n title: pages[0][:category],\n url: pages[0][:url],\n weight_tag_name: 90,\n weight_order: -1\n }\n items << page_record\n end\n items\n end", "def url\n item_path(object)\n end", "def permalink; end", "def permalink; end", "def feed_icon(activity)\n img = case activity_type(activity)\n when \"StatusUpdate\"\n \"friend_guy.gif\"\n when \"BlogPost\"\n \"note.gif\"\n when \"Entry\"\n \"page_white_edit.png\"\n when \"Comment\"\n \"comment.png\"\n when \"WallComment\"\n parent_type = activity.item.commentable.class.to_s\n case parent_type\n when \"BlogPost\"\n \"comments.gif\"\n when \"Photo\"\n \"comments.gif\"\n when \"Event\"\n \"comments.gif\"\n when \"User\"\n \"wall_post.gif\"\n when \"Group\"\n \"wall_post.gif\"\n when \"NewsItem\"\n \"comments.gif\"\n end\n when \"Friendship\"\n if activity.item.friend.admin?\n \"affiliation.gif\"\n else\n \"friend.gif\"\n end\n when \"ForumPost\"\n \"note.png\"\n when \"Topic\"\n \"discussion.gif\"\n when \"User\"\n \"edit_profile.gif\"\n when \"Gallery\"\n \"gallery.png\"\n when \"Photo\"\n \"photo.gif\"\n when \"Event\"\n \"event.gif\"\n when \"EventAttendee\"\n \"fbpage_add.gif\"\n when \"Group\"\n if activity.owner.class.to_s == \"Group\"\n \"edit_profile.gif\"\n else\n \"group.gif\"\n end\n when \"Membership\"\n \"group.gif\"\n when \"NewsItem\"\n if activity.owner.class.to_s == \"User\"\n \"note.gif\"\n elsif activity.owner.class.to_s == \"Group\"\n \"marketplace.gif\"\n elsif activity.owner.class.to_s == \"Widget\"\n \"notifications.gif\"\n end\n else\n raise \"無法辨識活動類型 #{activity_type(activity).inspect}\"\n end\n image_tag(\"icons/#{img}\", :class => \"icon\")\n end", "def base_feeds\n @base_feeds ||= Feed.order(\"UPPER(feeds.title)\")\n end", "def item_title(item)\n item.title\n end", "def render_entity_item(entity, item)\n entity && item or fail \"no item given for 'render_entity_item'\" \n name = item.name.to_s\n model_value = item.model_value\n template = item.template\n options = item.options || {}\n html_options = item.html_options || {}\n\n case model_value \n when String # name designates attribute of entity defined by the string( model_value ).\n value = entity.send(name) \n when Symbol, Array # a method(Simbol) or Array of a method(Symbol) and its args to apply entity.\n method, *args = *model_value\n value = method == :self ? entity : entity.send(method, *args) \n else\n fail \"'#{model_value} is illegal as model value of entity item.\"\n end\n\n case template\n when nil # template is omitted.\n if value.is_a?(Array) \n render_pure_collection value, :div_id => name, :entity_template => (template || \"#{name}/entity\")\n else\n value\n end\n when String # name of partial template to embed the value \n options ||= {}; html_options ||= {} \n if value.is_a?(Array)\n render_pure_collection value, :div_id => name, :entity_template => template\n else\n render :partial => template, :locals => {:value => value, :options => options, :html_options => html_options}\n end\n when Symbol, Array # apply helper method \n helper_method, *args = *template\n self.send(helper_method, value, *args)\n else\n fail ArgumentError, \"'#{template}' is illegal as template for entity item.\"\n end\n end", "def streamlined_auto_discovery_link_tag()\n return if @syndication_type.nil? || @syndication_actions.nil?\n \n if @syndication_actions.include? params[:action]\n \"<link rel=\\\"alternate\\\" type=\\\"application/#{@syndication_type.downcase}+xml\\\" title=\\\"#{@syndication_type.upcase}\\\" href=\\\"#{params[:action]}/xml\\\" />\"\n end\n end", "def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend", "def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend", "def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend", "def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend", "def only_talks items\n only_ items, :talk\nend", "def rss\n render_rss_feed_for Announcement.find(:all, :order => 'created_at DESC',\n :limit => 10), {\n :feed => {\n :title => 'OpenMind New Announcements',\n :link => announcements_url,\n :pub_date => :created_at\n },\n :item => {\n :title => :headline,\n :description => :formatted_description,\n :link => Proc.new{|announcement| \"#{announcements_url}##{announcement.id}\" }\n }\n }\n end", "def get_more_items\n @items = Item.page(2)\n\tend", "def get_items\n @items\n end", "def ranking_item(model, ranking_type)\n return \"\" if model.blank? || ranking_type.blank?\n item = \"\"\n case ranking_type\n when Toppage::Ranking::Type::TAGS\n item = tag_ranking_item(model) if model.instance_of? Tag\n when Toppage::Ranking::Type::RECOMMENDED_ARTICLES\n item = recommended_article_ranking_item(model) if model.instance_of? Article\n when Toppage::Ranking::Type::FAVORITE_ARTICLES\n item = favorite_article_ranking_item(model) if model.instance_of? Article\n when Toppage::Ranking::Type::ARTICLE_USERS\n item = article_user_ranking_item(model) if model.instance_of? User\n when Toppage::Ranking::Type::FEEDBACK_USERS\n item = feedback_user_ranking_item(model) if model.instance_of? User\n end\n raw item\n end", "def include item\n\tend" ]
[ "0.6706791", "0.6393365", "0.62268436", "0.6208559", "0.61873645", "0.6127472", "0.6127472", "0.6127336", "0.6127336", "0.6127336", "0.5877778", "0.5853885", "0.58315575", "0.5823589", "0.5820171", "0.5819839", "0.5819839", "0.5778131", "0.57364994", "0.56929934", "0.5689447", "0.5670804", "0.5670804", "0.5657277", "0.5657277", "0.563795", "0.5624106", "0.5615459", "0.56119573", "0.56024677", "0.559927", "0.55829793", "0.55760384", "0.55639046", "0.55598086", "0.55496687", "0.5539822", "0.5539822", "0.5539822", "0.55252206", "0.55252206", "0.54962707", "0.5492653", "0.5491045", "0.54722834", "0.5461873", "0.54425335", "0.5438877", "0.5417603", "0.54140854", "0.54139245", "0.5385352", "0.5375447", "0.53733563", "0.5369157", "0.53672403", "0.5361902", "0.5360063", "0.53589344", "0.53554475", "0.53550804", "0.5349764", "0.5348583", "0.5347372", "0.53429675", "0.5342644", "0.5338592", "0.5330465", "0.5330465", "0.5324693", "0.5321037", "0.53188086", "0.53174824", "0.5314569", "0.5314569", "0.53126097", "0.5309971", "0.53051", "0.52944165", "0.528676", "0.5283641", "0.52813315", "0.52794665", "0.52751", "0.5273556", "0.5273556", "0.5270981", "0.52653414", "0.52601606", "0.5258803", "0.5257437", "0.52572376", "0.52572376", "0.52572376", "0.52572376", "0.5255548", "0.52540433", "0.52535415", "0.52526075", "0.5247984", "0.5246129" ]
0.0
-1
p my_min([0, 3, 5, 4, 5, 10, 1, 90]) this is O of n squared
def my_min_improved(arr) min = arr[0] arr.each do |el| min = el if el < min end return min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend", "def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend", "def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend", "def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend", "def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end", "def my_min2(array)\n array.inject { |acc, ele| acc < ele ? acc : ele}\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend", "def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend", "def find_min(nums)\n nums.rotate(rand(1..10)).min\nend", "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend", "def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def my_min_lin(arr) \n arr.inject do |min, num| \n if num < min \n num \n else \n min \n end \n end \nend", "def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def solution(a)\n (0..a.size - 2).map { |i| ( a[0..i].inject(:+) - a[i+1..a.size].inject(:+) ).abs }.min\nend", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(arr)\n arr.inject{|acc, el| el < acc ? acc = el : acc }\nend", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def my_min(array)\n\t\n\tarray.min\n\t\nend", "def min_moves(nums)\n nums.sum - nums.size * nums.min\nend", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend", "def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend", "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend", "def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def check_list_linear(array)\n min = array.first\n array.each do |num|\n min = num if num < min\n end\n min\n end", "def min() end", "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend", "def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(array)\n min = array.first\n array.each {|item| min = item if item <= min}\n return min\nend", "def min(list)\n list.min\nend", "def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend", "def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend", "def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend", "def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend", "def my_min2(arr)\n answer = arr[0]\n arr.each_with_index do |ele, idx|\n if idx != arr.length - 1\n answer = arr[idx] if answer >= arr[idx]\n end\n end\n answer\nend", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def getMinimumCost(k, c)\n c.sort.reverse.map.with_index do |cost, i|\n cost * (1 + i / k)\n end.sum\nend", "def sum_of_two_smallest_numbers(arr)\n arr.min(2).reduce(:+)\nend", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend", "def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend", "def get_min(array)\n return array.inject do |current_min, n|\n if (current_min > n)\n n\n else\n current_min\n end\n end\nend", "def minSum(array, sum=0)\n array.sort!.each.with_index(1) { |n, i| sum += n * array[-i] }\n sum / 2\nend", "def my_min_n2(arr)\n smallest_number = true\n arr.each do |first_el|\n smallest_number = true\n arr.each do |second_el|\n smallest_number = false if second_el < first_el\n end\n return first_el if smallest_number\n end\nend", "def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end", "def smallest_number n1, n2\n [n1, n2].min\nend", "def minuend(num)\n num_arr = []\n\n 1.upto(num) { |n| num_arr << n }\n (num_arr.reduce(:+)) ** 2\nend", "def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend", "def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend", "def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend", "def smallest_range_i(a, k)\n result = a.max - a.min - 2 * k\n result >= 0 ? result : 0\nend", "def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend" ]
[ "0.7378233", "0.73757845", "0.7360287", "0.72964483", "0.72632223", "0.72324157", "0.71904904", "0.70650923", "0.7016497", "0.70115554", "0.699908", "0.699556", "0.69848216", "0.6976887", "0.69636387", "0.69513434", "0.68599117", "0.6849337", "0.6840293", "0.68294907", "0.68277305", "0.6815524", "0.6812399", "0.6800087", "0.6779762", "0.67752665", "0.67734426", "0.6772893", "0.67717373", "0.6737748", "0.6727956", "0.6717291", "0.6712759", "0.67111915", "0.67051846", "0.6684888", "0.66838944", "0.6679272", "0.66731685", "0.66625553", "0.66573715", "0.6656361", "0.664996", "0.66313034", "0.6626503", "0.6616691", "0.6605338", "0.6593366", "0.6593357", "0.65924853", "0.6585557", "0.6583756", "0.6583052", "0.65633225", "0.6559763", "0.6551223", "0.65507996", "0.65499556", "0.654856", "0.6543689", "0.65254813", "0.6521277", "0.65146554", "0.6513303", "0.6512124", "0.6509155", "0.6508135", "0.6507166", "0.65057987", "0.6487274", "0.64871013", "0.6483619", "0.64788836", "0.6475991", "0.6468584", "0.64683443", "0.6466311", "0.64646924", "0.64573413", "0.64535415", "0.6453498", "0.6451119", "0.6450519", "0.644446", "0.643224", "0.6430209", "0.6427702", "0.64108294", "0.6401043", "0.64000607", "0.63983685", "0.63956636", "0.6388583", "0.6377544", "0.6373499", "0.6369593", "0.6364764", "0.6359959", "0.6357944", "0.6348175" ]
0.6695315
35
p my_min_improved([0, 3, 5, 4, 5, 10, 1, 90]) this is O of n
def largest_contiguous_subsum(arr) i = 0 subs = [] while i < arr.length j = i while j < arr.length subs << arr[i..j] j += 1 end i += 1 end return (subs.max {|a, b| a.sum <=> b.sum}).sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend", "def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end", "def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend", "def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend", "def my_min2(array)\n array.inject { |acc, ele| acc < ele ? acc : ele}\nend", "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend", "def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def my_min(arr)\n arr.inject{|acc, el| el < acc ? acc = el : acc }\nend", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend", "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend", "def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend", "def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend", "def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend", "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def my_min2(arr)\n answer = arr[0]\n arr.each_with_index do |ele, idx|\n if idx != arr.length - 1\n answer = arr[idx] if answer >= arr[idx]\n end\n end\n answer\nend", "def my_min_lin(arr) \n arr.inject do |min, num| \n if num < min \n num \n else \n min \n end \n end \nend", "def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def get_min(array)\n return array.inject do |current_min, n|\n if (current_min > n)\n n\n else\n current_min\n end\n end\nend", "def smallest_missing(ints)\n ((1..ints.max + 1).to_a - ints).min\nend", "def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend", "def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend", "def check_list_linear(array)\n min = array.first\n array.each do |num|\n min = num if num < min\n end\n min\n end", "def find_min(nums)\n nums.rotate(rand(1..10)).min\nend", "def solution(a)\n (0..a.size - 2).map { |i| ( a[0..i].inject(:+) - a[i+1..a.size].inject(:+) ).abs }.min\nend", "def first_n_smallest_ms_x(arr, n)\n m = arr.min(n)\n arr.each_with_object([]) {|e,r| r << m.slice!(m.index(e)) if m.include?(e)}\nend", "def find_min_value(array)\n min_element = 10000000\n array.length.times { |index|\n if min_element > array[index]\n min_element = array[index]\n end\n }\n return min_element# Add your solution here\nend", "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def get_min(arr)\n arr.inject do |memo,x|\n if memo < x\n memo\n else\n x\n end\n end\nend", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def getMinimumCost(k, c)\n c.sort.reverse.map.with_index do |cost, i|\n cost * (1 + i / k)\n end.sum\nend", "def first_n_smallest(arr, n)\n arr.each_with_index.min(n).sort_by(&:last).map(&:first)\nend", "def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend", "def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend", "def getMin(arr) \t\n\tminInd = 0\n\tfor i in 1..$n-1 do\n\t\tif (arr[i] < arr[minInd])\n\t\t\tminInd = i\n end \n end \n\treturn minInd\nend", "def my_min2(arr)\n start = 0\n for i in (0...arr.length)\n start = arr[i] if start > arr[i]\n end\n start\nend", "def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend", "def my_min2(arr)\n timestart = Time.now\n smallest = arr[0]\n (1...arr.length).each do |idx|\n smallest = arr[idx] if smallest > arr[idx]\n end\n p (Time.now - timestart) * 1000\n smallest\nend", "def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend", "def min_unfairness (candy, n, k)\n # First, sorting the array\n candy.sort!\n\n # puts candy.inspect\n\n # Initialize with the first and k element \n min = candy[k-1] - candy[0]\n\n # For each subsequential k elements, we have to find the min. unfairness\n for i in 1..(n-k) \n # puts \"i=#{i} n[i+k]=#{candy[i+k-1]} n[i]=#{candy[i]} : #{candy[i+k-1] - candy[i]} | min=#{min}\"\n min = candy[i+k-1] - candy[i] if candy[i+k-1] - candy[i] < min\n end\n\n return min\nend", "def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend", "def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def my_min(arr)\n l = arr.length - 1 # constant\n # min = 0 # is this more efficient than swapping? \n (0...l).each do |i| # n times1\n if arr[i] < arr[i+1] # 1\n arr[i], arr[i+1] = arr[i+1], arr[i] # 1\n end\n end\n\n arr.last # 1\nend", "def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend", "def smallest_range_i(a, k)\n result = a.max - a.min - 2 * k\n result >= 0 ? result : 0\nend", "def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend", "def my_min(arr)\n arr.each do |num|\n return num if arr.select { |other_num| other_num > num }\n end\nend", "def helper(arr, i, mins)\n return mins[i] if mins[i]\n return 0 if i >= arr.length\n return 'fail' if arr[i] == 0\n min = 99999\n\n for j in i+1..i+arr[i]\n jumps_count = helper(arr, j, mins)\n if jumps_count != 'fail' && jumps_count < min\n min = jumps_count + 1\n end\n end\n mins[i] = min\n min\nend", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend", "def min_moves(nums)\n nums.sum - nums.size * nums.min\nend", "def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend", "def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend" ]
[ "0.7334273", "0.7281849", "0.72502804", "0.7223876", "0.7141298", "0.7120812", "0.71145725", "0.7108195", "0.70895696", "0.70615995", "0.70613986", "0.70403975", "0.7039384", "0.70318496", "0.6968392", "0.69553643", "0.6932657", "0.6920475", "0.69008267", "0.68753076", "0.6873151", "0.68614715", "0.6839937", "0.68389004", "0.67920774", "0.67644006", "0.67504436", "0.6723025", "0.67090577", "0.66868323", "0.6653667", "0.66412956", "0.66050833", "0.65911406", "0.65900314", "0.6589192", "0.65821636", "0.6581905", "0.65765476", "0.65707177", "0.65602654", "0.6530385", "0.6522677", "0.65181506", "0.65145105", "0.6514351", "0.6512797", "0.65076417", "0.64911866", "0.649107", "0.6490014", "0.64836264", "0.6470022", "0.6449518", "0.644853", "0.64425707", "0.64406973", "0.64385825", "0.64349025", "0.64299816", "0.64273334", "0.6426637", "0.64138746", "0.64109", "0.6401207", "0.6397183", "0.63934684", "0.6390678", "0.63899434", "0.6387951", "0.63866526", "0.63794655", "0.6376418", "0.6374072", "0.63692266", "0.6359581", "0.63573754", "0.6336737", "0.6335704", "0.63342017", "0.63250536", "0.6324711", "0.63224286", "0.6312122", "0.6308624", "0.63016367", "0.62968296", "0.6288684", "0.6277595", "0.62762153", "0.6262415", "0.62495023", "0.62494916", "0.6247172", "0.6245862", "0.62382275", "0.62381375", "0.62361985", "0.6233161", "0.6230132", "0.6229828" ]
0.0
-1
This is the last step because any failure here wouldn't prevent the other steps from running
def install_javascript_dependencies inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do "\n// Required by Arclight" \ "\n//= require arclight/arclight" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_failed; end", "def failures; end", "def failures; end", "def failures; end", "def step_result; end", "def do_failure; end", "def running_test_step; end", "def run_succeeded; end", "def proceed!; end", "def proceed!; end", "def handle_post_mortem; end", "def post_process; end", "def run_and_raise_on_failure\n # TODO ?\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def after_failed\n end", "def failed?; failed_to_start? || (@success == false) end", "def succeed\n # no-op\n end", "def before_run; end", "def pass; end", "def pass; end", "def done; end", "def precheck\n end", "def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend", "def test_step; end", "def continued_exception; end", "def failure\n end", "def refork; end", "def storage_failure=(_arg0); end", "def ridicule_faultfully_prerevision()\n end", "def final_test\n return unless MiniApivore.all_test_ran?\n\n @errors = MiniApivore.prepare_untested_errors\n assert(@errors.empty?, @errors.join(\"\\n\"))\n\n # preventing duplicate execution\n MiniApivore.runnable_list << \"#{self.class}::#{__method__}_runned\"\n end", "def done?; true end", "def skipped; end", "def run\n raise \"Not implemented for this check.\"\n end", "def done?; end", "def setup_failed(ant)\n end", "def running_test_case; end", "def skipped?; end", "def skipped?; end", "def skipped?; end", "def skipped?; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def failure!\n end", "def fail\n # no-op\n end", "def handle_unsuccessful_instruments_run\n return if @test_suite.nil?\n return if @current_test.nil?\n\n if @restarted_tests[@current_test]\n @test_suite[@current_test].error(\"Illuminator could not get this test to complete\")\n save_junit_test_report\n @current_test = nil\n else\n @restarted_tests[@current_test] = true\n end\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def unsuccessful\n end", "def recover_from_post_processing_failure #:nodoc:\n true\n end", "def run() end", "def read_and_run(access_token, issue_key, issue_id)\n errors = []\n execution_id = 0\n begin \n test_steps = @j2jira.read_test_data(issue_key, issue_id)\n execution_id = @j2jira.new_execution(issue_key, issue_id)\n test_steps.each_with_index do |step, index|\n api_spec_json = JSON.parse(step[\"step\"]) \n errors = @validator.validate_api_spec(api_spec_json)\n return errors unless errors.size.eql?(0)\n api_req_body = step[\"data\"]\n res_schema = step[\"result\"]\n controls = api_spec_json[\"api_spec\"][\"controls\"]\n delay_minutes = controls.nil? ? 0 : controls[\"delay_minutes\"]\n return [] if delay_minutes.eql?(-1)\n puts \"before sleep: #{Time.now}\"\n sleep delay_minutes*60 unless delay_minutes.eql?(0)\n puts \"after sleep #{Time.now}\"\n errs = run_step(access_token, api_spec_json, api_req_body, res_schema)\n errors << \"step #{index} failed with errors: #{errs.join('|')}\" unless errs.size.eql?(0)\n #skip iteration when errors exists in a given step.\n break if errors.size > 0 \n end \n rescue JSON::ParserError => pe\n errors << \"error in test case, please check json format for Test Step, Test Data and Expected Result or the API response\" \n rescue Exception => e \n puts \"exception occured #{e}\"\n errors << \"something went wrong - #{e.message}\"\n ensure\n puts \"do we have errors for the Jira Issue: #{issue_key}? #{errors}\"\n @failed_executions+= 1 unless errors.size.eql?(0)\n @j2jira.update_test_case(execution_id, issue_key, errors) unless execution_id.eql?(0)\n @j2jira.issue_comment(issue_key, errors) \n end \n end", "def failure!\n @count += 1\n end", "def post_setup\n end", "def run_warned; end", "def skipped!; end", "def run\n # Run all the steps below. Stop as soon as one of them returns\n # false or throws an error.\n true &&\n fetch_internal_date_and_size &&\n check_for_really_old_internal_date &&\n check_for_pre_creation_internal_date &&\n check_for_relapsed_internal_date &&\n check_for_big_messages &&\n fetch_uid_envelope_rfc822 &&\n update_user_mark_email_processed &&\n handle_tracer_email &&\n check_for_duplicate_message_id &&\n check_for_duplicate_sha1 &&\n create_mail_log &&\n deploy_webhook &&\n update_daemon_stats\n ensure\n clean_up\n end", "def post_process\n end", "def run_failed(exception)\n super\n Chef::Log.warn(\"<< END >>\")\n end", "def test_steps; end", "def test_steps; end", "def run\n \n end", "def run\n \n end", "def continue_on_error\n @continue_on_error = true\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def storage_failure; end", "def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end", "def checks; end", "def missed?; end", "def run\n run!\n rescue Failure => e\n if context.object_id != e.context.object_id\n raise\n end\n end", "def test_second_take\n\n @dashboard.register_participant :troublemaker, TroubleMaker\n\n pdef = Ruote.define do\n define 'sub0' do\n set '__on_error__' => 'redo'\n end\n sequence :on_error => 'sub0' do\n troublemaker\n end\n end\n\n wfid = @dashboard.launch(pdef)\n r = @dashboard.wait_for(wfid)\n\n assert_equal 'terminated', r['action']\n assert_equal 3, r['workitem']['fields']['_trace'].size\n end", "def step1\n\n end" ]
[ "0.6997873", "0.6466996", "0.6466996", "0.6466996", "0.63887274", "0.6353059", "0.6287806", "0.62694573", "0.6244597", "0.6244597", "0.616333", "0.6131668", "0.60797805", "0.6048473", "0.6048473", "0.6048473", "0.6048473", "0.6048473", "0.6048473", "0.6048473", "0.6048473", "0.6048473", "0.5972244", "0.59721714", "0.59524727", "0.594837", "0.5933724", "0.5933724", "0.5927747", "0.59180355", "0.58978695", "0.58770144", "0.58660954", "0.58591247", "0.5832134", "0.5816146", "0.58095014", "0.57906705", "0.57782704", "0.57616186", "0.5760343", "0.57584214", "0.5756471", "0.574945", "0.57324314", "0.57324314", "0.57324314", "0.57324314", "0.57201123", "0.57197773", "0.5716665", "0.57143205", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.5707575", "0.57056993", "0.56994647", "0.5691904", "0.56661916", "0.56660694", "0.5663947", "0.5663635", "0.5656271", "0.5655313", "0.56536704", "0.56533796", "0.5653024", "0.5653024", "0.56398827", "0.56398827", "0.5639456", "0.56305856", "0.56305856", "0.56305856", "0.56305856", "0.56305856", "0.56305856", "0.56305856", "0.56193405", "0.56131065", "0.5611131", "0.56036025", "0.55985534", "0.5598283", "0.55962014" ]
0.0
-1
Put whatever you need here to initialize the DB conn.
def initialize(hostname="localhost") # localhost is the default if there's no arg @hostname = hostname end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize()\n # calling base constructor\n super()\n\n # trying to connect to database\n begin\n # setting the db configuration file path\n db_config_file_path = \"#{File.dirname(__FILE__)}/db/database.yml\"\n\n # creating a pointer to the file content\n f_db_config = File.open(db_config_file_path, 'r')\n\n # loading the db configuration from the YAML file\n @db_config = YAML.load(f_db_config)\n\n ## setting a global path for the database (only for the sqlite3 database)\n #@db_config[DB_TYPE]['database'] = \"#{File.dirname(__FILE__)}/db/#{@db_config[DB_TYPE]['database']}\"\n\n # actually establishing connection to database through active_record\n @db_conn = ActiveRecord::Base.establish_connection(@db_config[DB_TYPE])\n rescue Exception => e\n # building the error message\n msg = \"Failed to connect to database. Original error message:\\r\\n'#{e.message}'\"\n\n # writing message in console\n puts msg\n\n # raising the exception again\n raise e\n end\n end", "def initialize\n @database = Sequel.connect(ENV['DATABASE_URL'])\n end", "def initialize(dbname = Namey.db_path) \n @db = Sequel.connect(dbname)\n end", "def initialize config\n connect config\n create_table_if_not_exists!\n end", "def initialize(config)\n self.connection = ConnectionExtenders.db_connect config\n self.config = config\n self.manual_primary_keys = {}\n end", "def initialize\n\t\t# Define the database connection to the dentist_book.db SQLite database.\n\t\t@dbConnection = SQLite3::Database.new( \"./../db/dentist_book.db\" )\n\tend", "def initialize(host,user,pass,dbname)\n @mHost = host\n @mUser = user\n @mPassword = pass\n @mDBName = dbname\n\n @mResource = Mysql.new(@mHostname,@mUser,@mPassword,@mDBName)\n puts \"DB Connection Successful. \" \n \n # See if table which insertions occurs exist \n checkifexists\n end", "def initialize(db, opts)\n connect_opts = {\n :host => opts[:host] || 'localhost',\n :port => opts[:port] || 15432,\n :dbname => opts[:database],\n :user => opts[:user],\n :password => opts[:password],\n :hostaddr => opts[:hostaddr],\n :connect_timeout => opts[:connect_timeout] || 20,\n :sslmode => opts[:sslmode]\n }.delete_if{|key, value| value.nil? or (value.respond_to?(:empty?) and value.empty?)}\n\tsuper(connect_opts)\n\n @db = db\n @prepared_statements = {}\n\n if opts[:notice_receiver]\n set_notice_receiver(opts[:notice_receiver])\n else\n # Swallow warnings\n set_notice_receiver{|proc| }\n end\n end", "def initialize(db)\n @db = db\n end", "def initialize(db)\n @db = db\n end", "def initialize_connection(env)\n end", "def initialize(connection_param)\n @conn = if connection_param.class == String\n IBM_DB.connect(connection_param, '', '')\n else # connect using catalog \n IBM_DB.connect(*connection_param)\n end\n\n self.autocommit = true\n @prepared_statements = {}\n end", "def initialize(args)\n @sql = args[:sql] || nil\n \n #Mandatory args:\n req(:required => [:connection_name],\n :args_object => args)\n @dbh = Mysqladmin::Pool.connections[args[:connection_name]][:dbh]\n end", "def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i assume but the check was needed\n if test ?s, db_tmp\n @db = SQLite3::Database.new db_tmp\n else \n puts \"error-> can not open #{db_tmp} for reasing\"\n exit 2\n end\n end", "def initialize( db )\n @db = db\n end", "def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end", "def initialize(db)\n super\n\n @path = @db.opts[:path] if @db.opts[:path]\n @preload_results = true\n\n if @db.opts[:conn]\n @conn = @db.opts[:conn]\n else\n org.sqlite.JDBC\n reconnect\n end\n end", "def initialize(db)\n @db = db\n end", "def initialize(proj)\n tries ||= 3\n @db = Sequel.sqlanywhere(conn_string: Discovery.connect_string(proj))\n rescue LoadError\n puts \"Cannot find SQLAnywhere exes in PATH. Trying from config.yml...\"\n set_lcenv_sybase_path\n retry unless (tries -= 1).zero?\n rescue Exception => e\n raise e\n end", "def connect_to_database\n # If no input parameters are defined then read the database params\n # from the command line or the default ones\n unless @db_params then self.database_params= DB_PARAMS end\n\n PGconn.connect( @db_params[:host],\n @db_params[:port],\n @db_params[:options],\n @db_params[:tty],\n @db_params[:dbname],\n @db_params[:login],\n @db_params[:password] )\n end", "def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n end", "def init_database(client)\n return unless client.is_a? Mysql2::Client\n\n client.query('drop database if exists barcrawldb;')\n\n client.query('CREATE DATABASE IF NOT EXISTS barcrawldb;')\n client.query('USE barcrawldb;')\nend", "def connect_database\n\n\t\t@db = Redis.new\n\n\t\t@db = Redis.connect(\n\t\t\t:db => \"#{Settings.redis.db}\",\n\t\t\t:host => \"#{Settings.redis.host}\",\n\t\t\t:port => Settings.redis.port,\n\t\t\t:password => Settings.redis.password\n\t\t)\n\t\t\n\tend", "def database\n Database.initialize_with(connection)\n end", "def test_DB_initialization\n @fdb = setup\n assert(@fdb.size > 0, \"Database entries not correctly read in\")\n end", "def db_setup\n path_to_db = File.join(File.dirname(__FILE__), \"temp_humidity.db\")\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def initialize(host: nil, port: 5433, username: nil, password: nil, database: nil, interruptable: false, ssl: false, read_timeout: 600, debug: false, role: nil, search_path: nil, timezone: nil, autocommit: false, skip_startup: false, skip_initialize: false, user: nil)\n reset_state\n @notice_handler = nil\n\n @options = {\n host: host,\n port: port.to_i,\n username: username || user,\n password: password,\n database: database,\n debug: debug,\n ssl: ssl,\n interruptable: interruptable,\n read_timeout: read_timeout,\n role: role,\n search_path: search_path,\n timezone: timezone,\n autocommit: autocommit,\n }\n\n boot_connection(skip_initialize: skip_initialize) unless skip_startup\n end", "def configure_database\n\tbegin\n\t @client = Mysql2::Client.new(:host => \"localhost\", :username => \"root\", :password => \"qburst\", :database => \"ruby\")\n\trescue Exception=>e\n\t puts e.message\n\tend\n end", "def connect\n if (@type == \"db2\")\n @config\n Models::Databases::SiteDatabase::Base.setup_connection(@config)\n elsif (@type == \"bops\")\n @config\n Models::Databases::Bops::Base.setup_connection(@config)\n else\n Models::Databases::Dyces::Base.setup_connection(@config)\n end\n\n @connection = @type\n\n Log.instance.debug \"Connected to #@db_url\"\n self\n end", "def setup_connection(conn)\n conn = super(conn)\n conn.extend(Sequel::Swift::Postgres::AdapterMethods)\n conn.db = self\n conn.apply_connection_settings\n conn\n end", "def initialize(params = {})\n @host = params[:host] || 'localhost'\n @port = (params[:port] || 3306).to_i\n @user = params[:username] || 'root'\n @password = params[:password] || 'pwd'\n @database = params[:database] || 'ithingy'\n @adapter = params[:adapter] || 'mysql'\n self.connect\n end", "def connect dbname=nil\n dbname ||= getdbname\n return nil unless dbname\n #$log.debug \"XXX: CONNECT got #{dbname} \"\n $current_db = dbname\n $db = SQLite3::Database.new(dbname) if dbname\n return $db\nend", "def initialize\n #puts \"in initialize of class #{self.class.to_s}\"\n\n @store = get_store\n ActiveRecord::Base.connection = @store\n end", "def setup!\n ActiveRecord::Base.configurations[configuration_name] = db_config\n ActiveRecord::Base.establish_connection(configuration_name).connection\n self\n end", "def make_connection database=nil\n \n self.sql ||= Mysql2::Client.new(:host => \"#{self.url}\", :username => \"username#{self.user_id}\", :password => \"cis400\", :port => 3306, :database=>\"#{database}\")\n end", "def initialize_database\n config = YAML::load(IO.read(Antfarm::Helpers.defaults_file))\n # Database setup based on adapter specified\n if config && config[ANTFARM_ENV] && config[ANTFARM_ENV].has_key?('adapter')\n if config[ANTFARM_ENV]['adapter'] == 'sqlite3'\n config[ANTFARM_ENV]['database'] = Antfarm::Helpers.db_file(ANTFARM_ENV)\n elsif config[ANTFARM_ENV]['adapter'] == 'postgres'\n config[ANTFARM_ENV]['database'] = ANTFARM_ENV\n else\n # If adapter specified isn't one of sqlite3 or postgresql,\n # default to SQLite3 database configuration.\n config = nil\n end\n else\n # If the current environment configuration doesn't specify a\n # database adapter, default to SQLite3 database configuration.\n config = nil\n end\n # Default to SQLite3 database configuration\n config ||= { ANTFARM_ENV => { 'adapter' => 'sqlite3', 'database' => Antfarm::Helpers.db_file(ANTFARM_ENV) } }\n if config[ANTFARM_ENV]['adapter'] == 'postgres'\n DataMapper.setup(:default, \"postgres:///#{config[ANTFARM_ENV]['database']}\")\n else\n DataMapper.setup(:default, \"sqlite3://#{config[ANTFARM_ENV]['database']}\")\n end\n end", "def connect_db\n ActiveRecord::Base.establish_connection($config)\n log(\"Connected to database\")\nrescue => e\n fatal(\"Failed to connect to the database: #{e}\")\n exit\nend", "def initialize\n begin\n @dc=DBI.connect(DATABASE, USERNAME, PASSWORD)\n rescue Exception=>e\n\t\t\t\tputs \"An exception occured in security Component initialize. The Exception is #{e.to_s}\" \n end\n \n \n end", "def initialize(uri)\n @uri = uri\n# create_database_if_missing!\n end", "def connect(*args)\n @@connection = FluidDB::Connection.new(*args)\n end", "def connect\n \n if !self.connected?\n \n # connect to the MySQL server\n @dbh = DBI.connect(\"DBI:Mysql:#{@dataBase}:#{@host}\", \n\t \"#{@user}\", \"#{@password}\")\n @connected=true\n \n end\n end", "def db\r\n @db ||= PG.connect(\r\n host: ENV['HOST'],\r\n user: ENV['USER_NAME'],\r\n password: ENV['PASSWORD'],\r\n dbname: ENV['DATABASE']\r\n )\r\nend", "def child_init( request )\n @conn = PGconn.connect( \"host=localhost dbname=test\" )\n request.server.log_info \"Preconnect done: %p\" % [ @conn ]\n return Apache::OK\n end", "def open_db\n if Config.db =~ /^sqlite:\\/{3}(.+)$/\n dir = File.dirname($1)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end\n\n Sequel.datetime_class = Time\n\n @db = Sequel.connect(Config.db, :encoding => 'utf8')\n @db.test_connection\n\n if trait[:sql_log]\n require 'logger'\n @db.logger = Logger.new(trait[:sql_log])\n end\n\n rescue => e\n Ramaze::Log.error(\"Unable to connect to database: #{e}\")\n exit(1)\n end", "def initialize(db, stmt)\n @db = db\n @stmt = stmt\n end", "def connect\n \n if !self.connected?\n \n # connect to the MySQL server\n \n @dbh = DBI.connect(\"DBI:Mysql:#{@dataBase}:#{@host}\", \n\t \"#{@user}\", \"#{@password}\")\n \n @connected=true\n \n end\n end", "def initialize(database)\r\n @database = database\r\n end", "def initialize(config)\n run_hook(:before_initialize, config)\n\n @config = config\n raise ::SORM::NotConfigured, \"You should configure database path\" unless has_config?\n\n @db = SDBM.open config[:database]\n\n run_hook(:after_initialize, db)\n end", "def initialize(dbName, resetTables=false)\n @crawlerTable = \"crawlerTable\"\n @untappdTable = \"untappdTable\"\n\n @db = SQLite3::Database.new dbName\n resetCrawlerTable if resetTables\n resetUntappdTable if resetTables\n end", "def db_setup\n path_to_db = \"/tmp/temp_humidity.db\"\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def setup\n @dbcount = 1\n @dbids = Array.new\n (0..@dbcount).each do |i|\n @dbids[i] = (0...8).map{('a'..'z').to_a[rand(26)]}.join\n create_or_connect_db(@dbids[i])\n end\n end", "def db_connect\n @dbh and db_close\n puts \"DEBUG: Opening DB\" if $DEBUG\n @dbh = DBI.connect(\"dbi:Pg:#{@database[:database]}:#{@database[:host]}\",\n @database[:user],\n @database[:password])\n end", "def db_connect\n @dbh and db_close\n puts \"DEBUG: Opening DB\" if $DEBUG\n @dbh = DBI.connect(\"dbi:Pg:#{@database[:database]}:#{@database[:host]}\",\n @database[:user],\n @database[:password])\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n @connection_handling = opts[:connection_handling]\n @available_connections = []\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @waiter = ConditionVariable.new\n end", "def initialize\n\t\t\n\t\t@dao = DAO.new 'rpg'\n\n\tend", "def initialize(options={})\n # test db connection\n Todo.count rescue migrate\n puts \"try 'help'\".yellow\n end", "def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end", "def connect_to_db()\n SQLite3::Database.new('db/database.db')\n end", "def initialize\n @client = SQLite3::Database.new 'haunt.db' # Edit that to change loc\n @dbs = []\n @client.execute(\n \"SELECT name FROM sqlite_master WHERE type = \\\"table\\\"\") do |row|\n @dbs << row[0]\n end\n end", "def setup_connection\n db = ENV['DB'].blank?? 'mysql' : ENV['DB']\n\n configurations = YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'spec', 'database.yml'))\n raise \"no configuration for '#{db}'\" unless configurations.key? db\n configuration = configurations[db]\n\n ActiveRecord::Base.logger = Logger.new(STDOUT) if $0 == 'irb'\n puts \"using #{configuration['adapter']} adapter\" unless ENV['DB'].blank?\n\n gem 'sqlite3-ruby' if 'sqlite3' == db\n\n ActiveRecord::Base.establish_connection(configuration)\n ActiveRecord::Base.configurations = { db => configuration }\n #prepare ActiveRecord::Base.connection\n\n unless Object.const_defined?(:QUOTED_TYPE)\n Object.send :const_set, :QUOTED_TYPE, ActiveRecord::Base.connection.quote_column_name('type')\n end\nend", "def connection\n @db = Connection.client\nend", "def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end", "def connect\n @conn = PG.connect(\n :dbname => 'HackerNewsAppDB1',\n :user => 'paul',\n :password => 'password')\n end", "def init_db\n db_filename = './coord_cache.db'\n puts \"Creating db file '#{db_filename}'\" unless File.exist?(db_filename)\n @coord_db = SQLite3::Database.new(db_filename)\n @coord_db.execute('CREATE TABLE IF NOT EXISTS coords ' \\\n '(id INTEGER PRIMARY KEY AUTOINCREMENT, ' \\\n ' osm_id BIGINT, ' \\\n ' lat REAL, ' \\\n ' lon REAL)')\nend", "def setup_db\n return unless File.exist?(\"#{Jets.root}/config/database.yml\")\n\n db_configs = Jets.application.config.database\n # DatabaseTasks.database_configuration for db:create db:migrate tasks\n # Documented in DatabaseTasks that this is the right way to set it when\n # using ActiveRecord rake tasks outside of Rails.\n ActiveRecord::Tasks::DatabaseTasks.database_configuration = db_configs\n\n current_config = db_configs[Jets.env]\n if current_config.blank?\n abort(\"ERROR: config/database.yml exists but no environment section configured for #{Jets.env}\")\n end\n # Using ActiveRecord rake tasks outside of Rails, so we need to set up the\n # db connection ourselves\n ActiveRecord::Base.establish_connection(current_config)\n end", "def setup_database\n require \"sequel\"\n\n options = {\n :max_connections => 16,\n :pool_timeout => 240\n }\n\n database_config = YAML.load_file(\"#{$intrigue_basedir}/config/database.yml\")\n database_host = database_config[$intrigue_environment][\"host\"] || \"localhost\"\n database_port = database_config[$intrigue_environment][\"port\"] || 5432\n database_user = database_config[$intrigue_environment][\"user\"]\n database_pass = database_config[$intrigue_environment][\"password\"]\n database_name = database_config[$intrigue_environment][\"database\"]\n database_debug = database_config[$intrigue_environment][\"debug\"]\n\n if database_pass \n $db = Sequel.connect(\"postgres://#{database_user}:#{database_pass}@#{database_host}:#{database_port}/#{database_name}\", options)\n else\n $db = Sequel.connect(\"postgres://#{database_user}@#{database_host}:#{database_port}/#{database_name}\", options)\n end\n\n $db.loggers << Logger.new($stdout) if database_debug\n\n # Allow datasets to be paginated\n $db.extension :pagination\n Sequel.extension :pg_json_ops\n Sequel.extension :migration\nend", "def init\n if !response_service.admin_view?\n render json: { popup: 'Must be an admin to initialize the database!!' }\n elsif Rails.env.production?\n render json: { popup: 'Can\\'t initialize the production database!!' }\n else\n Answer.delete_all\n Authentication.delete_all\n Expression.delete_all\n Finder.delete_all\n List.delete_all\n Rcpref.delete_all\n Recipe.delete_all\n ImageReference.delete_all\n Referent.delete_all\n Referment.delete_all\n ReferentRelation.delete_all\n ResultsCache.delete_all\n Scraper.clear_all\n Site.delete_all\n TagSelection.delete_all\n Tag.delete_all\n TagOwner.delete_all\n Tagging.delete_all\n TagsCache.delete_all\n Tagset.delete_all\n # User.delete_all\n # UserRelation.delete_all\n Vote.delete_all\n sql = 'DELETE FROM delayed_jobs;'\n ActiveRecord::Base.connection.execute(sql)\n render json: { popup: 'Database is initialized and ready for scraping.' }\n end\n end", "def data_mapper_init db_type = @config.db_type, db_path = @config.db_path, logging = @options.debug # {{{\n # DataMapper::Logger.new( $stdout, :debug ) if( logging )\n\n db_connector = \"#{db_type}://#{Dir.pwd}/#{db_path}\"\n\n @log.message :info, \"We don't have any DataMapper init info, so we will create a new database at #{db_connector.to_s} (JokeMachine)\"\n DataMapper.setup( :default, db_connector )\n\n # DataMapper.auto_migrate! # wipe out existing data\n DataMapper.auto_upgrade! # try to preserve data and insert NULL's if new colums\n DataMapper.finalize\n end", "def connect(dbname, user, auth, attr)\n connection = factory.create_connection\n connection.connection_string = dbname\n connection.open\n return create_database(connection, attr);\n rescue RuntimeError, System::Data::SqlClient::SqlException => err\n raise DBI::DatabaseError.new(err.message)\n end", "def connectDB\n \t#config = YAML.load_file( '/home/ubuntu/DB-Performance-Testing/config/db.yml' )['DB2']\n config = YAML.load_file( @@path + '../config/db.yml' )['DB2']\n\t cstring = \"DATABASE=#{config['db']};HOSTNAME=#{config['hostname']};\"\n\t cstring += \"PORT=#{config['port']};PROTOCOL=#{config['protocol']};UID=#{config['uid']};PWD=#{config['pwd']};\"\n\t @conn = IBM_DB.connect(cstring,\"\",\"\")\n end", "def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end", "def init_example_db\n # Create repos table\n database.create_table :repos do\n primary_key :id\n String :name\n foreign_id :token_id\n end\n\n # Add example repositories\n r = database[:repos]\n r.insert(:name => \"josefwaller/pycatan\")\n r.insert(:name => \"josefwaller/github_dash\")\n r.insert(:name => \"rails/rails\")\n\n # Create tokens table\n database.create_table :tokens do\n primary_key :id\n String :token\n String :name\n end\n\n # Add example token\n t = database[:tokens]\n ENV['GITHUB_DASH_TOKEN'] ||= \"ThisIsAnExampleGithubApiKey\"\n t.insert(:token => ENV['GITHUB_DASH_TOKEN'])\n end", "def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end", "def initialize( *args )\n\t\turi = if args.empty?\n\t\t\t\tWordNet::Lexicon.default_db_uri\n\t\t\telsif args.first.is_a?( String )\n\t\t\t\targs.shift\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\n\t\toptions = WordNet::DEFAULT_DB_OPTIONS.merge( args.shift || {} )\n\n\t\tif uri\n\t\t\tself.log.debug \"Connecting using uri + options style: uri = %s, options = %p\" %\n\t\t\t\t[ uri, options ]\n\t\t\t@db = Sequel.connect( uri, options )\n\t\telse\n\t\t\tself.log.debug \"Connecting using hash style connect: options = %p\" % [ options ]\n\t\t\t@db = Sequel.connect( options )\n\t\tend\n\n\t\t@uri = @db.uri\n\t\tself.log.debug \" setting model db to: %s\" % [ @uri ]\n\n\t\[email protected]_log_level = :debug\n\t\tWordNet::Model.db = @db\n\tend", "def initialize\n #p Dir[\"*.rb\"]\n\n #? what inital set to?\n @current_user = nil\n\n # do these exist beyond the scope of this init function?\n ActiveRecord::Base.logger = Logger.new(File.open('/home/kevin/webdev/ruby/bleater/database/bleater.log', 'w'))\n\n ActiveRecord::Base.establish_connection(\n :adapter => 'sqlite3',\n :database => '/home/kevin/webdev/ruby/bleater/database/bleater.db'\n )\n\n end", "def connect(opts={})\n\n\t\treturn false if not @usable\n\n\t\tnopts = opts.dup\n\t\tif (nopts['port'])\n\t\t\tnopts['port'] = nopts['port'].to_i\n\t\tend\n\n\t\tnopts['pool'] = 256\n\n\t\tbegin\n\t\t\tcreate_db(nopts)\n\n\t\t\t# Configure the database adapter\n\t\t\tActiveRecord::Base.establish_connection(nopts)\n\n\t\t\t# Migrate the database, if needed\n\t\t\tmigrate\n\n\t\t\t# Set the default workspace\n\t\t\tframework.db.workspace = framework.db.default_workspace\n\t\trescue ::Exception => e\n\t\t\tself.error = e\n\t\t\telog(\"DB.connect threw an exception: #{e}\")\n\t\t\tdlog(\"Call stack: #{[email protected]\"\\n\"}\", LEV_1)\n\t\t\treturn false\n\t\tensure\n\t\t\t# Database drivers can reset our KCODE, do not let them\n\t\t\t$KCODE = 'NONE' if RUBY_VERSION =~ /^1\\.8\\./\n\t\tend\n\n\tend", "def initialize(options = {})\n reset_values\n\n @options = {}\n options.each { |key, value| @options[key.to_s.to_sym] = value }\n @options[:port] ||= 5433\n\n @row_style = @options[:row_style] ? @options[:row_style] : :hash\n unless options[:skip_startup]\n startup_connection\n initialize_connection\n end\n end", "def InitializeXMLdb\n end", "def init_database\n\t\tif([email protected]_exists?(:events))\n\t\t\[email protected]_table :events do\n\t\t\t\tprimary_key :id\n\t\t\t\tString :name\n\t\t\t\tString :description\n\t\t\t\tString :date\n\t\t\tend\n\t\tend\n\n\t\tif([email protected]_exists?(:timeslots))\n\t\t\[email protected]_table :timeslots do\n\t\t\t\tString :time\n\t\t\t\tString :parent_table\n\t\t\t\tString :parent_id\n\t\t\tend\n\t\tend\n\n\t\tif([email protected]_exists?(:attendees))\n\t\t\[email protected]_table :attendees do\n\t\t\t\tprimary_key :id\n\t\t\t\tString :name\n\t\t\t\tString :parent_id\n\t\t\tend\n\t\tend\n\tend", "def connect_local\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end", "def makeDBConnection()\n\n if ( !@db_conn.nil? && @db_conn.status == PGconn::CONNECTION_OK)\n return\n end\n\n # trying anyway to release the connection just in case\n closeDBConn()\n\n begin\n @db_conn = PGconn.open(\n :host => @db_conf['host'],\n :port => @db_conf['port'],\n :options => @db_conf['options'],\n :tty => @db_conf['tty'],\n :dbname => @db_conf['dbname'],\n :user => @db_conf['user'],\n :password => @db_conf['password']\n )\n\n @db_conn.prepare(\"mypreparedinsert\", @db_conf['queryinsert'])\n # @db_conn.prepare(\"mypreparedupdate\", @db_conf['queryupdate'])\n\n rescue PGError => e\n $stderr.puts \"ERROR: while connecting to Postgres server, class: #{e.class.name}, message: #{e.message}\"\n\n if @byebye\n return nil\n end\n\n $stderr.puts \"Sleep #{@db_conf['sleep']} seconds and retry\"\n slept = sleep @db_conf['sleep']\n $stderr.puts \"Slept #{slept} seconds\"\n retry\n end\n\n return\n end", "def open_db()\n begin\n # connect to the database\n db_params = {\n host: ENV['host'], # AWS link\n port:ENV['port'], # AWS port, always 5432\n dbname:ENV['dbname'],\n user:ENV['dbuser'],\n password:ENV['dbpassword']\n }\n conn = PG::Connection.new(db_params)\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n end\nend", "def open_db()\n begin\n # connect to the database\n db_params = {\n host: ENV['host'], # AWS link\n port:ENV['port'], # AWS port, always 5432\n dbname:ENV['dbname'],\n user:ENV['dbuser'],\n password:ENV['dbpassword']\n }\n conn = PG::Connection.new(db_params)\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n end\nend", "def connection\n return nil if @dry_run\n raise Mysql::Error, \"Cannot connect without database information\" if @database.nil?\n if !@conn\n @conn = Mysql::new(@database[:host], @database[:user], @database[:password], @database[:database])\n create_pruned_table(@conn)\n end\n @conn\n end", "def initialize_database(database_path = './secrets.db')\n DataMapper.finalize\n\n database_path = File.expand_path database_path\n\n @dm = DataMapper.setup(:default, \"sqlite:///#{database_path}\")\n\n return if File.exist? database_path\n\n SQLite3::Database.new(database_path)\n DataMapper.auto_migrate!\n end", "def initialize_database\n @db = SQLite3::Database.new @database_path\n File.chmod 0600, @database_path\n begin\n @db.execute 'drop table if exists host;'\n @db.execute <<-SQL\n create table host (\n id INT,\n name varchar(254)\n );\n SQL\n sync_host_table\n rescue\n File.unlink @database_path\n raise\n end\n end", "def initialize\n bootstrap_connections unless File.exist?(connections_file)\n load_connections\n end", "def initialize (mdb = nil)\r\n\t\t@mdb = mdb\r\n\t\t@connection = nil\r\n\t\t@data = nil\r\n\t\t@fields = nil\r\n\tend", "def initialize\n @db = Mongo::Client.new(['127.0.0.1:27017'] , :database => 'xdkAmbiente' )\n end", "def initializeORM()\n\t# nothing to do\nend", "def connect_non_hash\r\n db=SQLite3::Database.new(\"db/slutpro.db\")\r\n return db\r\n end", "def make_conn(conn)\n conn.h_conn = @dbm.make_conn(conn.spec)\n end", "def conn\n unless @conn\n # open the database config file\n db_config = YAML.load(ERB.new(File.read(\"config/ourstage_database.yml\")).result )\n database = db_config[environment]['database']\n @conn = EventMachine::Postgres.new(:database => database)\n @conn.setnonblocking(true) # may not be needed? \n end\n @conn\n end", "def initialize(opts = {})\n opts = {\n :host => nil,\n :name => nil,\n :user => nil,\n :password => nil\n }.merge(opts)\n\n @name = opts[:name]\n @host = opts[:host]\n @user = opts[:user]\n @password = opts[:password]\n\n @dbh = Mysql2::Client.new(:host => opts[:host], \n :username => opts[:user], \n :password => opts[:password], \n :database => opts[:name])\n end", "def setup( opts = {} )\n\n @db.disconnect if @db\n\n log = RJack::SLF4J[ \"iudex.da.sequel\" ]\n conf = CONFIG.merge( opts )\n conf = Hooker.merge( [ :iudex, :connect_props ], conf )\n\n conf[ :loggers ] = [ log ] if conf[ :log ]\n\n cstr = ( \"%s://%s/%s?%s\" %\n [ conf[ :adapter ],\n [ conf[ :host ], conf[ :port ] ].compact.join( ':' ),\n conf[ :database ],\n params( conf ) ] )\n\n log.info { \"Connecting: #{cstr}\" }\n log.debug { \"Full Params: #{ conf.inspect }\" }\n\n @db = Sequel.connect( cstr, conf )\n\n end", "def db; end", "def db; end", "def initialize(db, required_host = nil)\n @db = db\n build_host_check(required_host)\n end", "def initialize(opts = \"\", &block)\n raise \"Block required for changes!\" unless block_given?\n\n @schemas = {}\n @handlers = []\n @source = CouchRest.database(opts)\n info = @source.info\n @http = HTTPClient.new\n\n logger.info \"Connected to CouchDB: #{info['db_name']}\"\n\n # Prepare the definitions\n instance_eval(&block)\n end", "def setup\n begin\n create_campaign_table_if_not_exist\n seed_data\n rescue Exception => e\n raise \"Database setup failed with error #{e}\"\n ensure\n @connection.close\n end\n end", "def init!\n @logger = @config = @database_config = nil\n\n load_application_config\n load_database_config\n note \"Loading #{env} environment (#{Ajaila::VERSION})\"\n load_classes\n note \"Establishing database connection\"\n establish_database_connection\n note \"Running auto-upgrade migrations\"\n run_auto_upgrade_migrations\n note \"Application has been initialized\"\n self\n end" ]
[ "0.7427078", "0.7242181", "0.7222761", "0.7080685", "0.7033233", "0.6997479", "0.69647", "0.6934885", "0.6909456", "0.6909456", "0.6896935", "0.68697697", "0.6865477", "0.6854281", "0.6850265", "0.68415785", "0.6816952", "0.6812647", "0.67680484", "0.6763926", "0.676068", "0.6695033", "0.6670918", "0.66695917", "0.66666925", "0.6660203", "0.66494757", "0.66480833", "0.6635636", "0.66267467", "0.6604251", "0.6597749", "0.6595711", "0.6587049", "0.6586736", "0.6581452", "0.6578879", "0.65751356", "0.6571035", "0.6567619", "0.656551", "0.65653586", "0.6562745", "0.65599066", "0.6559178", "0.6551569", "0.65337247", "0.65165406", "0.65132904", "0.65129817", "0.6509431", "0.6507868", "0.6507868", "0.65018445", "0.64950293", "0.64854586", "0.6481699", "0.6481422", "0.64807594", "0.64798945", "0.6477915", "0.6475673", "0.6465928", "0.64479846", "0.64456123", "0.6441656", "0.6439299", "0.6425766", "0.6423332", "0.6415874", "0.6404725", "0.6399067", "0.6394978", "0.63865215", "0.63823134", "0.6379557", "0.63696635", "0.63672626", "0.63649136", "0.6364906", "0.6359888", "0.6356026", "0.6356026", "0.63558817", "0.6354963", "0.63537157", "0.635349", "0.63393086", "0.6338409", "0.63344353", "0.6333017", "0.6318051", "0.63168037", "0.6307181", "0.629825", "0.62945867", "0.62945867", "0.6286975", "0.6285792", "0.6284001", "0.62823445" ]
0.0
-1
setup for list of vehicles
def list_cars puts "===================================================================" Car.print_all puts "===================================================================" puts "\nEnter a number and press 'enter' to pick the desired vehicle." puts "Type 'exit' to quit." puts "\nTo see the cheapest car type 'cheap'." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicles; end", "def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end", "def launch_vehicle; end", "def initialize\n @cars = []\n ready_go\n end", "def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end", "def initialize\n @reservations_list = []\n @block_list = []\n @all_rooms = []\n make_hotel_rooms\n end", "def initialize\n super\n @subsection = 'vehicle-list vehicle-search'\n end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end", "def set_vehicle_info\n @vehicle_info = VehicleInfo.find(params[:id])\n end", "def index\n @vehicle_manufacturers = VehicleManufacturer.order(\"name\")\n @vehicle_manufacturer = VehicleManufacturer.new\n end", "def set_vehicle\n\t\t\t@vehicle = Vehicle.find(params[:id])\n\t\tend", "def update_vehicles vehicle\n if self.vehicle.nil?\n self.create_vehicles vehicle\n else\n self.vehicle.update!(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end\n end", "def index\n @vehicle_type = VehicleType.new\n @vehicle_types = VehicleType.all\n end", "def vehicle\n fetch('final_space.vehicles')\n end", "def set_vehicle(id, params)\n fleet[id] = RoutificApi::Vehicle.new(id, params)\n end", "def create\n @vehicle=Vehicle.find_or_create_by(vehicle_params)\n end", "def initialize\n @vendors = []\n end", "def initialize(params, cars, additional_features)\n @id = params['id']\n @car = cars[params['car_id']]\n @start_date = Date.parse params['start_date']\n @end_date = Date.parse params['end_date']\n @distance = params['distance']\n @commission = Commission.new(self)\n @features = []\n additional_features.each do |feature|\n if feature['rental_id'] == @id\n @features << feature['type']\n end\n end\n end", "def set_vehicle\n @vehicle ||= Vehicle.find_by_id(params[:id])\n end", "def vehicle_index\n @models = vehicle_models\n # session[:vehicle_models] = @models\n end", "def initialize\n @drivers = []\n end", "def initialize \n @model = \"Generic\"\n @wheels = 2 \n @current_speed = 0\n end", "def set_vehicle_model\n @vehicle_model = VehicleModel.find(params[:id])\n end", "def set_vehicle_model\n @vehicle_model = VehicleModel.find(params[:id])\n end", "def initialize(model, name, owner)\n @model = model\n self.name = name\n self.owner = owner\n self.passengers = []\n self.cargo = []\n end", "def index\n @vehicles = Vehicle.all\n end", "def set_vehicle(id)\n @vehicle = Vehicle.find(id)\n end", "def index\n @vehicle_infos = VehicleInfo.all\n end", "def initialize(make, model) #these 2 - make, model - are parameters\n @wheels = 4\n @make = make\n @model = model\n end", "def set_admin_vehicle\n @admin_vehicle = Vehicle.find(params[:id])\n @vehicle_type = @admin_vehicle.vehicle_type\n @utility_id = @admin_vehicle.utility_id\n @italian_type = {parking:'Parcheggi', bike:'Bici', taxi:'Taxi'}\n end", "def autocomplete_params\n # vi = VehicleInformation.where(id: params[:vehicle_id].to_i)\n @vehicle = Vehicle.find_by_plate(params[:vehicle].to_s)#.first\n if @vehicle.nil?\n @vehicle = Vehicle.new\n end\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id]) rescue Vehicle.find(params[:vehicle_id])\n end", "def set_driverslist\n @driverslist = Driverslist.find(params[:id])\n end", "def initialize\n #each item has name and inventory number\n @inventory_list = {strawberry: 6, raspberry: 4, blueberry: 8}\n end", "def init\n\n newCar = Showcar.create(name: \"Reventon\",\n description: \"It was the most expensive Lamborghini road car until the Lamborghini Sesto Elemento was launched, costing two million dollars (~$1.5 million, or ~£840,000). Its top speed was recorded in UAE at 221 miles per hour (355.7 km/h).\",\n photo_link: \"reventon.jpg\")\n newCar.save\n\n newCar = Showcar.create(name: \"Diablo\",\n description: \"The Lamborghini Diablo is a high-performance mid-engined sports car that was built by Italian automaker Lamborghini between 1990 and 2001. It was the first Lamborghini capable of attaining a top speed in excess of 200 miles per hour (320 km/h). After the end of its production run in 2001, the Diablo was replaced by the Lamborghini Murciélago. Diablo means @\\\"devil@\\\" in Spanish.\",\n photo_link: \"diablo.jpg\")\n newCar.save\n\n newCar = Showcar.create(name: \"Veneno\",\n description: \"Lamborthini Veneno is consistently focused on optimum aerodynamics and cornering stability, giving the Veneno the real dynamic experience of a racing prototype, yet it is full homologated for the road.\",\n photo_link: \"veneno.jpg\")\n newCar.save\n\n end", "def index\n @vehicle_categories = VehicleCategory.all\n\t@vehicle_category = VehicleCategory.new\n end", "def vehicle_params\n params.require(:vehicle).permit(:api_id, :api_vehicle_company_id, :number, :status, :ifta, :vin, :make, :model, :year, :license_plate_state, :license_plate_number, :metric_units, :fuel_type, :prevent_auto_odometer_entry, :edl_device_id, :edl_identifier, :edl_model, :api_driver_id, :driver_first_name, :driver_last_name, :driver_username, :driver_email, :driver_internal_id, :driver_status, :driver_role)\n end", "def make\n fetch('vehicle.makes')\n end", "def create\n @vehicle = Vehicle.new()\n\n \n # Populate the basic information from the form\n @vehicle.make = params[:vehicle][:make]\n @vehicle.model = params[:vehicle][:model]\n @vehicle.miles = params[:vehicle][:miles]\n @vehicle.colour = params[:vehicle][:colour]\n @vehicle.image = params[:vehicle][:image]\n @vehicle.owners = params[:vehicle][:owners]\n @vehicle.reg = params[:vehicle][:reg]\n @vehicle.price = params[:vehicle][:price]\n @vehicle.description = params[:vehicle][:description]\n \n myCar = BasicModelCar.new(@vehicle.make, @vehicle.model, @vehicle.miles, @vehicle.colour, @vehicle.image, @vehicle.owners, @vehicle.reg, @vehicle.price, @vehicle.description)\n crashLogger = CrashLogger.instance\n # Add some additional features to our new car\n # the statements could be written inline: params[:newcar][:fireExt].to_s.length > 0 ? myCar = FireExtinguisher.new(myCar) : null\n if params[:vehicle][:NCT].to_s.length > 0 then\n myCar = NCT.new(myCar)\n end\n if params[:vehicle][:Taxed].to_s.length > 0 then\n myCar = Taxed.new(myCar)\n end\n if params[:vehicle][:ExtendedWarranty].to_s.length > 0 then\n myCar = ExtendedWarranty.new(myCar)\n end\n if params[:vehicle][:Crashed].to_s.length > 0 then\n crashLogger.logCrash(@vehicle.reg.to_s)\n end\n \n ##Populate the cost and description information\n @vehicle.price = myCar.getPrice\n @vehicle.description = myCar.getDescription\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_vehicle\n @vehicle = current_user.vehicles.find(params[:id])\n end", "def createVehicle _obj, _args\n \"_obj createVehicle _args;\" \n end", "def addVehicle _obj, _args\n \"_obj addVehicle _args;\" \n end", "def before_GET(req)\n super\n @subsection = 'vehicle-list'\n @title = \"Manage Vehicles\"\n end", "def vehicle_params\n params.require(:vehicle).permit(:name, \n :model_year, \n :make, \n :model, \n :trim_level, \n :body_style, \n :engine_type, \n :milage, \n :vin, \n :notes,\n :image, \n :bought_date, \n :bought_milage, \n :bought_price)\n end", "def setup()\n setupParamListTable(getConf(:paramList)) ;\n super() ;\n end", "def vehicle_params\n params.require(:vehicle).permit( :numberPlate, :driverID_id, :model, :brand, :isFull, :packagesCat1, :packagesCat2, :packagesCat3)\n end", "def vehicle_params\n params.require(:vehicle).permit(:vehicle_model_id, :year, :odometer,\n :license_plate, :engine_number, :drive,\n :chasis_number, :transmission, :engine_type,\n :passenger_capacity, :air_conditioning,\n :airbags_quantity, :door_quantity,\n :steering, :body_type, :comment, :status,\n images: [])\n end", "def setup(params)\n\n\t\t@selected = []\n\t\t@driver = []\n\t\t@errors = []\n\t\t# @output_tmp = Dir.mktmpdir\n\n\tend", "def call\n vehicles = @buyer.buyer_interests.flat_map do |interest|\n coincident_vehicles(interest)\n end\n \n vehicles\n end", "def set_vehicle_equipment\n @vehicle_equipment = VehicleEquipment.find(params[:id])\n end", "def set_load_vehicle\n @load_vehicle = LoadVehicle.find(params[:id])\n end", "def set_list_form\n @states = [{\"name\":\"DISPONIBLE\"},{\"name\":\"OBSOLETO\"}]\n @hometowns = [{\"name\":\"PRODUCCION\"},{\"name\":\"SEGREGADO\"},{\"name\":\"INVENTARIO\"},{\"name\":\"DEVOLUCIONES\"},{\"name\":\"OTROS\"}]\n @dispositions = [{\"name\":\"SOBRANTES\"},{\"name\":\"MOLINO\"}]\n end", "def initialize name \n\t\t@name = name\n\t\t@flights = []\n\tend", "def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end", "def set_driver\n #@vehicle_restriction = VehicleRestriction.find(params[:id])\n @driver_restriction = DriversRestriction.first\n vehicle = @driver_restriction.driver\n #@vehicle = Vehicle.where(@vehicle_restriction.vehicle).first\n end", "def initialize(params)\n setMake(params[:make]);\n setModel(params[:model]);\n setYear(params[:year]);\n commitCar!();\n\n end", "def setup\n @car = Car.new\n end", "def set_vehicel\n @vehicel = Vehicel.find(params[:id])\n end", "def index\n @references_vehicle_drivers = ReferencesVehicleDriver.all\n end", "def vehicle_params\n params.require(:vehicle).permit(:brand, :model, :lowest_price, :highest_price, :image_url, :tag_list)\n end", "def vehicle_params\n params.require(:vehicle).permit(:code, :name, :historic, :speed, :user_id)\n end", "def index\n @vehicle_informations = VehicleInformation.all\n end", "def set_vehicle_type\n @vehicle_type = VehicleType.find(params[:id])\n end", "def vehicle_params\n params.require(:vehicle).permit(:plate, :brand, :model, :string, :doors, :kind, :user_id, :actual_vehicle)\n end", "def set_vehicletype\n @vehicletype = Vehicletype.find(params[:id])\n end", "def activate_cars\n unless self.cars.nil?\n self.cars.each do |car|\n car.ativo = \"#{VEHICLE_STATUS.index 'ON_TRANSIT'}\"\n car.save\n end\n end\n end", "def initialize\n @drivers = Array.new\n end", "def vehicle_params\n params.fetch(:vehicle, {}).permit(:driver_name, :driver_phone_num, :vehicle_num, :license_num, :address_line1, :address_line2, :city, :state, :pincode,:identity_proof,:identity_num)\n end", "def updateVehicleTableWhole()\n @newVehicleList.clear() ;\n @finishedVehicleList.clear() ;\n\n # get vehicle id list\n idList = fetchVehicleIdList() ;\n\n idTable = {} ;\n idList.each{|vId|\n idTable[vId] = vId ;\n if(@vehicleTable[vId].nil?) then\n #length\n newVehicle = newVehicle(vId, {}) ;\n @newVehicleList.push(newVehicle) ;\n\n newVehicle.submitAll() ;\n end\n }\n @vehicleList.each{|vehicle|\n if(vehicle.isOnRoad?() && idTable[vehicle.id].nil?) then\n @finishedVehicleList.push(vehicle) ;\n vehicle.letFinished() ;\n end\n }\n\n return @newVehicleList ;\n end", "def vehicle_params\n # params.require(:vehicle).permit(:ticker, :name, :currency, :last_price)\n params.require(:vehicle).permit(:ticker)\n end", "def initialize (make, model, miles, type, color, year, used)\n\t\t@make = make\n\t\t@model = model\n\t\t@miles = miles\n\t\t@type = type\n\t\t@color = color\n\t\t@year = year\n\t\t@used = used\n\t\tputs \"New car created.\"\n\tend", "def set_reserf\n @reserf = Reserve.find(params[:id])\n @vehicle = @reserf.vehicle\n end", "def vehicle_params\n # inner_price: @currency, outer_price: @currency,\n params.require(:vehicle).permit(:cover, :quantity_adults, :quantity_kids, :position, :deleted_at,\n :date, :time, :seat, :status, {files:[]}, kit: [:quantity, :weight],\n vehicleables_attributes: [:id, :status, :price_inner_cop, :price_inner_usd, :price_outer_cop, :price_outer_usd],\n title: @language, description: @language, includes: @language, conditions: @language)\n end", "def index\n @admin_vehicles = City.find(session[:current_city_id]).utility.vehicles.where(vehicle_type: Vehicle.vehicle_types[params[:vehicle_type]]).page(params[:page]).per(10)\n end", "def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def setup(items)\n\tend", "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "def vehicle_params\n params.require(:vehicle).permit(:veh_reg_no, :category, :name, :desc, :photo, :daily_rate, :color => [], :features => [])\n end", "def create\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n if [email protected]?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to \"/vehicles\", notice: 'El vehículo fue añadido!' }\n format.json { render :index, status: :created, location: @vehicle }\n else\n format.html { render :index}\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize\n @screen = Game_Screen.new\n @interpreter = Game_Interpreter.new(0, true)\n @map_id = 0\n @display_x = 0\n @display_y = 0\n create_vehicles\n end", "def get_vehicle_locations\n route_config unless @route\n @last_time = Time.now if @last_time.nil?\n # TODO handle a route that has no active vehicles, like the 101 during the week\n # TODO do I need to clear sensors that aren't active... e.g. if I'm on a route with 8 buses, then switch to a route with 2, do I somehow clear those sensors I'm not using any more?\n vehicles = Nextbus::Vehicle.all @agency_id, @route_id #, @last_time\n sensor_update \"vehicle_count\", vehicles.size\n vehicles.each.with_index(1){|v, i|\n sensor_update \"vehicle_#{i}_id\", v.id\n sensor_update \"vehicle_#{i}_lat\", lat_factor(v.lat)\n sensor_update \"vehicle_#{i}_lon\", lon_factor(v.lon)\n sensor_update \"vehicle_#{i}_heading\", v.heading\n }\n broadcast \"move_buses\"\n end", "def create\n @admin_vehicle = City.find(session[:current_city_id]).utility.vehicles.new(admin_vehicle_params)\n @vehicle_type = params[:vehicle][:vehicle_type]\n italian_type = {parking:'Parcheggi', bike:'Bici', taxi:'Taxi'}\n respond_to do |format|\n if @admin_vehicle.save\n format.html { redirect_to session['previous_url'] || admin_vehicles_url(vehicle_type: @admin_vehicle.vehicle_type), notice: \"#{italian_type[@vehicle_type.to_sym]} è stato creato con successo.\" }\n format.json { render :show, status: :created, location: @admin_vehicle }\n else\n format.html { render :new }\n format.json { render json: @admin_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize\n @lists = []\n bootstrap\n populate\n end", "def vehicles \n \"vehicles\" \n end", "def new\n @carrier = Carrier.new\n @carrier.vehicles.build\n end" ]
[ "0.71356285", "0.69482875", "0.6406161", "0.6243949", "0.61998963", "0.61825305", "0.61575156", "0.6152966", "0.6152966", "0.6152966", "0.6152966", "0.6152966", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.61162424", "0.6084661", "0.6083518", "0.6080228", "0.60732204", "0.6048124", "0.6018959", "0.60011226", "0.5989085", "0.5895081", "0.5894171", "0.58770776", "0.587299", "0.58551157", "0.58271104", "0.5770088", "0.57696056", "0.57696056", "0.5750269", "0.5741118", "0.5740676", "0.5731037", "0.5726644", "0.5721675", "0.57165563", "0.5706287", "0.5690233", "0.56781566", "0.5672585", "0.56412464", "0.56344295", "0.56341773", "0.56328285", "0.56278217", "0.56174403", "0.56124276", "0.56093", "0.56052405", "0.55979246", "0.5591792", "0.55828613", "0.55705595", "0.55599916", "0.5559712", "0.55545694", "0.5551584", "0.55494076", "0.5548599", "0.5540719", "0.5531609", "0.5530705", "0.5521089", "0.55200744", "0.55183905", "0.5517834", "0.549395", "0.5493765", "0.54891944", "0.5480941", "0.54773146", "0.54559845", "0.5443798", "0.54341614", "0.54316115", "0.5431566", "0.54257125", "0.5420991", "0.54189646", "0.5406526", "0.54035753", "0.5398407", "0.5386731", "0.53852934", "0.53843206", "0.5374999", "0.5371901", "0.5371432", "0.53714067", "0.536892" ]
0.0
-1
Checks if the user logged in is authorized to modify the project
def can_add? project = Project.find(params[:project_id]) if logged_in? user = User.find(session[:user_id]) if user.projects.include?(project) member = project.members.find_by_user_id(user) if (member.member_role.role == "creator" or member.member_role.role == "administrator") return true end end end redirect_to project, :notice => "You're not authorized to modify this project!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_modify?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n if user.projects.include?(project)\n member = project.members.find_by_user_id(user)\n if (member.member_role.role == \"creator\" or member.member_role.role == \"administrator\")\n return true\n end\n end\n end\n redirect_to project, :notice => \"You're not authorized to modify this project!\"\n end", "def authorized_user\n @project = current_user.projects.find_by_id(params[:id])\n if @project.nil?\n flash[:error] = \"You can only edit your own projects.\"\n redirect_to root_path\n end\n end", "def can_edit?(project)\n current_user.id == project.created_by\n end", "def require_permission_edit_or_update\n @project = Project.find(params[:project_id])\n @board = Board.find(params[:id])\n if @board.can_edit_users.where(:id => current_user.id).blank? && current_user.is_admin == false\n redirect_to project_path(@project), flash: { error: \"You do not have permission to do that.\" }\n end\n end", "def check_auth\n if current_user.company_id != @company.id && !current_user.manager? && !current_user.admin?\n redirect_to projects_path, :alert => \"Access denied.\" and return\n end\n end", "def edit\n\t\t@project = Project.find(params[:id])\n authorize @project\n\t\tif !user_signed_in? then\n respond_to do |format|\n\t\t\t\tformat.html { redirect_to edit_user_registration_path }\n\t\t\tend\n\t\telsif [email protected]_by(current_user.id) then\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to projects_url, notice: I18n.t('helpers.settings.plans.errors.no_access_account') }\n\t\t\tend\n\t\tend\n\tend", "def can_access?\n project = Project.find(params[:id])\n \n if logged_in?\n user = User.find(session[:user_id])\n unless user.projects.include?(project) or project.visibility == \"Public\"\n redirect_to root_url, :notice => \"You're not authorized to access this project!\"\n end\n elsif project.visibility != \"Public\"\n redirect_to root_url, :notice => \"You're not authorized to access this project!\"\n end\n end", "def check_if_user_is_project_leader?\n if current_user.id != this_project.project_leader_id;\n render json: [\"Only the Project Lead can edit this project\"]\n end\n end", "def set_project\n @project = Project.find_by!(slug: params[:id])\n\n # rubocop:disable Style/GuardClause\n if @project.user_id != @current_user.id\n render status: :forbidden, json: { error: 'You are not allowed to make this action.' }\n false\n end\n # rubocop:enable Style/GuardClause\n end", "def edit\n return unless find_project!\n return unless find_candidate!\n return if @project.is_admin?(@user)\n\n must_be_project_admin!(@project.id)\n end", "def require_proj_access\n if params[:gr]\n @project ||= Group.find(params[:gr]).project\n else\n @project = Project.find(params[:id] || params[:pr])\n end\n if ((not is_logged?) || current_user.is_public?) && @project.is_private?\n flash_msgs(1, \"Access denied.\")\n redirect_to root_path\n end\n end", "def isAuthorizedUser\n redirect_to groups_path unless current_user.id == @project.user_id\n end", "def authorize\n return_unauthorized unless current_user && current_user.can_modify_user?(params[:id])\n end", "def set_project\n @project = current_user.projects.find(params[:id])\n authorize @project\n end", "def set_project\n @project = Project.includes(:user).find(params[:id])\n if @project.user != current_user\n render plain: '', status: :forbidden\n end\n end", "def check_own_project_and_redirect?\n unless current_user.projects.ids.include? params[:project_id].to_i\n flash[:danger] = 'Access denied. You do not own that project.'\n redirect_to projects_path\n return true\n end\n false\n end", "def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end", "def modifiable_by?(current_user)\n # current_user.all_projects.pluck(:id).include?(self.sticky.project_id)\n sticky.project.modifiable_by?(current_user)\n end", "def update\n\t\t@project = Project.find(params[:id])\n authorize @project\n\t\tif user_signed_in? && @project.editable_by(current_user.id) then\n if @project.update_attributes(params[:project])\n respond_to do |format|\n\t\t\t\t format.html { redirect_to({:action => \"show\", :id => @project.slug, notice: I18n.t('helpers.project.success_update') }) }\n end\n else\n respond_to do |format|\n\t\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n\t\tend\n\tend", "def can_be_modified_by?( user )\n return false if ( user.restricted? )\n return true if ( user.admin? )\n return self.active\n end", "def user_can_edit(user)\n if (self.editor == user) or self.book.project.owner == user or user.id == 1 then\n return true\n else\n return false\n end\n end", "def authorized_to_modify_task?\n current_user.site_admin? || can_view_all_manuscript_managers_for_journal? || can_view_manuscript_manager_for_paper? ||\n allowed_manuscript_information_task? || metadata_task_collaborator? || allowed_reviewer_task? || task_participant?\n end", "def only_create\n if [email protected]_project_create\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n # only admin can change anyone project\n if [email protected]? && params[:owner_id] && params[:owner_id] != @user.id\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n true\n end", "def only_create\n if [email protected]_project_create\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n # only admin can change anyone project\n if [email protected]? && params[:owner_id] && params[:owner_id] != @user.id\n raise Exceptions::GitlabApiException.new(\"Access forbidden for this user\")\n end\n\n true\n end", "def check_membership\n unless @project.member?(current_user.id)\n flash_t_general :error, 'project.not_participating'\n redirect_to panel_projects_path\n return\n end \n end", "def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "def user_is_member\n project = Project.find(params[:project_id])\n unless (current_user.id == project.created_by.id) || (project.users.any? { |u| u.id == current_user.id })\n flash[:error] = \"You are not a member of this project\"\n redirect_to projects_path, notice: 'You are not a member of this project' # halts request cycle\n end\n end", "def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def authenticate_project_owner\n unless current_user && (current_user.admin || current_user.id == @project.user.id)\n redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Permission denied.'\n end\n end", "def authorized?\n #if current_user is nil, return false\n #otherwise, check for authorization\n if current_user\n authorized = false\n\n #if user is admin, return true\n if session[:admin] == true\n authorized = true\n else\n #puts authorized user ids in an array and check against\n #the current_user id\n authorized_users = Array.new\n\n authorized_users.push(@project.user_id)\n @project.collaborators.each do |col|\n authorized_users.push(col.user_id)\n end\n\n authorized_users.each do |user|\n # binding.pry\n if current_user.id == user\n authorized = true\n end\n end\n #authorized user not found\n if !authorized\n false\n end\n end\n\n #return result\n authorized\n else\n #current_user is nil, return false\n false\n end\n end", "def edit\n project_owner = current_user.projects.exists?(params[:id])\n if project_owner\n @project = current_user.projects.find(params[:id])\n else\n redirect_to root_path\n end\n end", "def set_project\n @project = Project.find(params[:id])\n \tauthorize [:admin, @project]\n end", "def edit_authorized(current_user)\n return self.user_id == current_user.id\n end", "def edit_authorized(current_user)\n return self.user_id == current_user.id\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if action is not public, force login\r\n return unless require_login \r\n # admin is always authorized\r\n return true if self.logged_in_user.admin?\r\n # if not admin, check membership permission \r\n @user_membership ||= Member.find(:first, :conditions => [\"user_id=? and project_id=?\", self.logged_in_user.id, @project.id]) \r\n if @user_membership and Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) \r\n return true\t\t\r\n end\t\t\r\n render :nothing => true, :status => 403\r\n false\r\n end", "def set_project\n @project = Project.find(params[:id])\n authorize @project\n end", "def set_editability\n @editable = user_signed_in? && (current_user.member.role.name.eql? \"University Admin\") &&\n current_user.member.institution.id == @course.department.institution.id\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if user not logged in, redirect to login form\r\n unless session[:user]\r\n store_location\r\n redirect_to(:controller => \"account\", :action => \"login\")\r\n return false\r\n end\r\n # if logged in, check if authorized \r\n if session[:user].admin? or Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], session[:user].role_for_project(@project.id) ) \r\n return true\t\t\r\n end\t\t\r\n flash[:notice] = \"Acces denied\"\r\n redirect_to(:controller => \"\")\r\n false\r\n end", "def project_administrator_logged_in?\n User.project_administrator_logged_in?\n end", "def project_administrator_logged_in?\n User.project_administrator_logged_in?\n end", "def user_can_edit\n unless logged_in? and can_edit?\n respond_with_error(\n \"You must have editor permissions to edit this content.\", \n root_path)\n end\n end", "def correct_user_or_admin\n @user = @project.user\n return true if @user.nil?\n redirect_to(root_url) if current_user.nil? ||\n !(current_user?(@user) || current_user.admin?)\n end", "def can_be_modified_by?( user )\n if ( user.admin? )\n true\n elsif ( user.manager? )\n ( user.id == self.user.id ) or ( not self.committed )\n else\n ( user.id == self.user.id ) and ( not self.committed )\n end\n end", "def require_editor_role\n proj_id = \"\"\n if session[:project_id].nil?\n proj_id = params[:project_id].nil? ? params[:id] : params[:project_id]\n else\n proj_id = session[:project_id]\n end\n\n unless (User.current_user_has_study_edit_privilege(proj_id, current_user))\n flash[:notice] = \"You do not have the ability to edit studies for this project. Please contact the project lead if you believe an error has occurred.\"\n redirect_to \"/projects/#{proj_id.to_s}/studies\"\n return false\n end\n end", "def authorize\n super(:projects, projects_url)\n end", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def require_lead_role\n \tproj_id=\"\"\n \tif session[:project_id].nil?\n \t\tproj_id = params[:project_id].nil? ? params[:id] : params[:project_id]\n\t\t else\n\t\t \tproj_id = session[:project_id]\n\t\t end\n\t\t \t \t\n \tunless User.current_user_has_project_edit_privilege(proj_id, current_user) \t\t\n \t\tif User.current_user_has_study_edit_privilege(proj_id, current_user)\n \t\t\tflash[:notice] = \"Your access level does not allow you to edit the project details.\"\n \t\t\tredirect_to \"/projects/\"+proj_id.to_s+\"/studies\"\n \t\telse\n \t\t\tflash[:notice] = \": You have not been granted access to this resource.\"\n \t\t\tredirect_to \"/\"\n \t\tend\n \t\treturn false\n \tend\n end", "def authorized_to_edit?(post)\n post.user == current_user\n end", "def authorized_to_edit?(post)\n post.user == current_user\n end", "def authorized\n\t\tif current_user\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def edit_credentials\n return false unless (current_user.access_level.user_level >= 100) && (current_user.id == @profile.user_id)\n true\n end", "def can_edit?\n allows_current_user_access_to? :edit\n end", "def set_project\n @project = Project.find(params[:id])\n\t if !@current_user.is_admin? && @project.user != @current_user\n\t\t redirect_to not_found_path\n\t end\n\n end", "def revision_authorized?\n authorized_for?(:action => :read)\n end", "def can_edit\n return current_user && (current_user.id == Integer(params[:id]) || current_user.is_admin)\n end", "def can_edit?(current_user_id)\n\t\tif User.find(current_user_id) == creator\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def edit\n if !(current_user.id == @user.id || is_admin?)\n indicate_illegal_request I18n.t('users.not-your-account')\n end\n end", "def can_edit?\n can_write? && (account_is_owner? || account_is_collaborator?)\n end", "def correct_user\n\t\t@project = Project.find(params[:id])\n\t\tredirect_to(root_url) unless current_user.id === @project.owner_id || current_user.admin?\n\trescue ActiveRecord::RecordNotFound\n\t\tredirect_to projects_path\n\tend", "def can_edit?\n head(:forbidden) unless current_user.review_space_admin? || @space.editable_by?(current_user)\n end", "def user_project_admin?\n project = Project.getActive\n admin_emails = project[:data]['adminEmails']\n admin_emails.include?(current_user.email) &&\n (\n !current_user.user_role ||\n current_user.user_role.name != 'admin'\n )\n end", "def editable_by?(user)\n return false if user.blank?\n project.project_users.exists?([\"role IN ('curator', 'manager') AND user_id = ?\", user])\n end", "def correct_user\n @project = Project.find(params[:id])\n redirect_to(projects_path) unless current_user?(@project.user)\n end", "def have_permission?(project, user)\n member = space_memberships.find_by(user: user)\n project.present? && member.lead_or_admin_or_contributor?\n end", "def update #+либо свой, либо админ\n @project = Project.find(params[:id])\n \n if (!current_user.is_admin && @project.author_id != @current_user.id)\n flash[:error] = \"У Вас нет прав на данное действие!\"\n redirect_back_or_default project_path(@project)\n end \n \n if @project.update_attributes(params[:project])\n flash[:notice] = 'Проект успешно обновлён.'\n redirect_to(@project)\n else\n render :action => \"edit\" \n end\n end", "def can_edit?(user)\n user == current_user\n end", "def show\n authorize(@project)\n end", "def editable_by?(usr)\n if wiki.project &&\n wiki.project.module_enabled?('wiki') &&\n wiki.project.module_enabled?('redmine_advanced_wiki_permissions')\n !protected? || usr.wiki_allowed_to?(self, :protect_wiki_pages)\n else\n !protected? || usr.allowed_to?(:protect_wiki_pages, wiki.project)\n end\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def centerleder_access\r\n if current_user.access? :team_new_edit_delete\r\n return true\r\n elsif current_user\r\n puts \"centerleder_access current_user: #{current_user.inspect}\"\r\n flash[:notice] = \"Du har ikke adgang til denne side\"\r\n redirect_to teams_path\r\n else\r\n puts \"centerleder_access NOT LOGGED IN\"\r\n flash[:notice] = \"Du har ikke adgang til denne side\"\r\n redirect_to login_path\r\n end\r\n end", "def editable_by?(project, user=User.current)\n # TODO Manage relay role\n return true if user.admin?\n\n return true if editable\n\n logger.debug \"\\\\=>roles editable_by? project cf #{self.id}/#{self.name} P:#{project.identifier} u:#{user.login}\"\n\n #--------------\n # 1/ User roles\n logger.debug \" =>roles cf roles=#{roles.collect(&:name)}\"\n\n roles_for_project_for_user = user.roles_for_project(project)\n logger.debug \" =>roles roles_for_project_for_user=#{roles_for_project_for_user.collect(&:name)}\"\n\n roles_for_project_for_user_for_cf = roles & roles_for_project_for_user\n\n if roles_for_project_for_user_for_cf.present?\n logger.debug \"/=>roles OK #{roles_for_project_for_user_for_cf.collect(&:name)}\"\n\n return true\n end\n\n #---------------\n # 2/ Relay roles\n if user.respond_to?('relay_roles_for_project')\n relay_roles_for_project_for_user = user.relay_roles_for_project(project, true)\n logger.debug \" =>roles relay_roles_for_project_for_user=#{relay_roles_for_project_for_user.collect(&:name)}\"\n\n relay_roles_for_project_for_user_for_cf = roles & relay_roles_for_project_for_user\n\n if relay_roles_for_project_for_user_for_cf.present?\n logger.debug \"/=>roles OK #{relay_roles_for_project_for_user_for_cf.collect(&:name)}\"\n\n return true\n end\n end\n\n logger.debug \"/=>roles KO\"\n\n false\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def editable_by?(usr)\n (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project)\n end", "def user_project_manager?\n user_logged_in? && current_user.type == 'ProjectManager'\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def update?\n @current_user.permission('Department', :clerk)\n end", "def check_update_permission\n return if owner? || @article.is_public_editable\n redirect_to articles_url\n end", "def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end", "def authorize_as_admin\n unless session[:administrator]\n redirect_to(:controller => \"portfolio\", :action => \"default\", :id => session[:username])\n end\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def authorize_for(controller, action)\r\n User.current.allowed_to?({:controller => controller, :action => action}, @project)\r\n end", "def authorize_for(controller, action)\r\n User.current.allowed_to?({:controller => controller, :action => action}, @project)\r\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def edit_project\n if current_admin.present? || current_client.present?\n @project = Project.find(params[:id])\n else\n redirect_to new_admin_session_path and return\n end \n end", "def authorize_for(controller, action)\n current_user.allowed_to?({ controller: controller, action: action }, @project)\n end", "def mayEdit? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYEDIT ) )\n return true\n end\n end\n end\n return false\n end", "def accessible?\n admin? || owner? || @project.is_open_source?\n end", "def allow_access\n !@current_user.nil?\n end", "def check_admin_rights\n unless logged_in? and current_user.is_admin?\n flash[:error] = \"Permiso denegado\"\n redirect_to '/'\n end\n end", "def self_edit_only\n #if current_user.id != Integer(params[:id]) && !current_user.is_admin\n if !can_edit\n redirect_to user_url, :notice => \"You don't have permission to do that.\"\n else\n end\n end", "def authorized_to_edit?(recipe)\n current_user == recipe.user\n end", "def authorized?\n !current_user.nil? || current_user.is_a?(Administrator)\n end", "def authorized?\n\n current_user && current_user.is_admin?\n end", "def user_can_edit?\n current_user == @list.user\n end", "def edit\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def authorized?\n current_user.login == \"Admin\"\n end", "def authorized?\n if !@extra_page.editable_by? current_user, current_cookbook\n redirect_to sections_path, alert: \"You are not allowed to edit this extra page.\"\n end\n end", "def change_team?\n raise Pundit::NotAuthorizedError, \"must be logged in\" unless user\n user.admin? || (APP_CONFIG.enabled?(\"user_permission.manage_namespace\") &&\n namespace.team.owners.exists?(user.id))\n end", "def can_modify_repository?(tracker)\n response = api(url: \"/repos/#{tracker.full_name}/collaborators/#{login}/permission\")\n json = JSON.parse(response.body).with_indifferent_access\n if ['admin', 'write'].include?(json[:permission])\n return true\n end\n false\n rescue Github::API::Unauthorized\n false\n rescue Github::API::NotFound\n false\n end" ]
[ "0.8410987", "0.8073768", "0.7732395", "0.7507087", "0.74223757", "0.73820734", "0.73510873", "0.7308573", "0.7284115", "0.7282567", "0.72600067", "0.7211678", "0.7165469", "0.7106593", "0.710168", "0.70938843", "0.7072224", "0.7051062", "0.703633", "0.70139915", "0.70057815", "0.69903755", "0.6980577", "0.6980577", "0.6976967", "0.69728106", "0.69728106", "0.69602907", "0.69315124", "0.6927475", "0.69026023", "0.6878782", "0.6868917", "0.6868917", "0.68641657", "0.6862788", "0.6855528", "0.68502", "0.6847164", "0.6847164", "0.6825383", "0.68180496", "0.6808155", "0.6803052", "0.6777664", "0.6718561", "0.67175746", "0.6702602", "0.6702602", "0.6702571", "0.6701629", "0.67003495", "0.669518", "0.66899824", "0.668984", "0.6685844", "0.6666673", "0.665963", "0.6651835", "0.6642315", "0.6632978", "0.66318464", "0.6628255", "0.66251636", "0.66250616", "0.66196537", "0.6604604", "0.66021895", "0.6595565", "0.6592593", "0.65879315", "0.65823823", "0.65823823", "0.65823823", "0.6579166", "0.6570821", "0.65673226", "0.656344", "0.6562777", "0.65603983", "0.655917", "0.65544516", "0.65544516", "0.6537653", "0.6536528", "0.65363127", "0.65356535", "0.65346897", "0.6521751", "0.6517655", "0.6516739", "0.6515783", "0.65137935", "0.6510349", "0.650871", "0.6504846", "0.6502104", "0.6501464", "0.65000135", "0.649973" ]
0.7774453
2
Use callbacks to share common setup or constraints between actions.
def set_author @author = Author.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def author_params params.require(:author).permit(:name, :email_address, :bio, :password, :password_confirmation, :authorization_token, :authorized, :profile_image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Use parser to parse the configmap toml file to a ruby structure
def parseConfigMap begin # Check to see if config map is created if (File.file?(@configMapMountPath)) puts "config::configmap container-azm-ms-agentconfig for agent settings mounted, parsing values" parsedConfig = Tomlrb.load_file(@configMapMountPath, symbolize_keys: true) puts "config::Successfully parsed mounted config map" return parsedConfig else puts "config::configmap container-azm-ms-agentconfig for agent settings not mounted, using defaults" return nil end rescue => errorStr ConfigParseErrorLogger.logError("Exception while parsing config map for agent settings : #{errorStr}, using defaults, please check config map for errors") return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config(config); end", "def load_toml(path)\n ConfigHash.new(TOML.parse(path.read, :symbolize_keys => true))\n end", "def initialize\n @tree = YAML::parse(File.open(CONFIG_FILE))\n end", "def parse(config_file)\n open(config_file) do |f|\n parse_string(f.read, config_file)\n end\n end", "def configure_parser; end", "def parse_file_data\n current_category = nil\n todo_lines = []\n File.open(@config_file) {|fl| todo_lines = fl.readlines() }\n line_count = 0\n todo_lines.each do |todo_line|\n todo_line.strip!.chomp!\n next if todo_line.nil? or todo_line.empty?\n case todo_line\n when /^\\*{1}\\ (.+)?/\n current_category = $1\n line_count = 0\n @todo_container[current_category] ||= []\n when /^(\\*{2,})\\ TODO\\ (.+)?/\n priority = $1.size\n item = OpenStruct.new(:priority => priority, :flag => true, :text => $2,:index => line_count )\n line_count += 1\n @todo_container[current_category] << item\n when /^(\\*{2,})\\ DONE\\ (.+)?/\n priority = $1.size\n item = OpenStruct.new(:priority => priority, :flag => false, :text => $2,:index => line_count )\n line_count += 1\n @todo_container[current_category].push(item)\n end\n end\n end", "def parse(eml:, options: nil, callback: nil)\n # sub_data = eml.gsub!(/\\r\\n?/, \"\")\n lines = eml\n # lines = File.readlines('sample.eml')\n result = {}\n parse_recursively(lines, 0, result, options)\n\n result\n rescue StandardError => e\n print e\n ensure\n print 'Done !'\n end", "def configure!(parser); end", "def parse\n checkArguments\n configContent = File.read(ARGV[0])\n @config = JSON.parse(configContent)\n checkConfig\n end", "def parse_config_file(file)\n return {} unless File.exist?(file)\n\n case File.extname(file)\n when /\\.conf$/i\n parse_conf_file(file)\n when /\\.json$/i\n Oj.load_file(file, mode: :strict, symbol_keys: true)\n when /\\.ya?ml$/i\n begin\n require 'safe_yaml/load'\n SafeYAML.load_file(file) || {}\n rescue LoadError\n # Re-raise with a more descriptive message. This should generally\n # abort the configuration loading.\n raise LoadError.new(%{Could not load the requested resource. Please install the 'safe_yaml' gem via\nBundler or directly, and try loading again.\n})\n end\n end\n end", "def parse_config\n %w(/etc/steel/steel.yml steel.yml).each do |cfg|\n if File.exist?(cfg)\n begin\n y = YAML.load_file(cfg)\n rescue Psych::SyntaxError => e\n error \"[#{e.class}] Failed to parse '#{cfg}'!!\"\n error e.message\n exit 1\n end\n # Merge the contents of the config into @config.\n config.merge!(y)\n end\n end\n end", "def _parse(config_file)\r\n unless File.readable?(config_file)\r\n raise Compass::Error, \"Configuration file, #{config_file}, not found or not readable.\"\r\n end\r\n open(config_file) do |f|\r\n parse_string(f.read, config_file)\r\n end\r\n end", "def buildDfMapFromYaml(filepath,lineproc,useTermRoot=false)\n map = Hash.new\n contentArr = YAML.load_file(filepath)\n contentArr.each do |content|\n content.text.each_line do |line|\n lineproc.call line,map,useTermRoot\n end\n end\n map\n end", "def parse(input)\n taglists = []\n config_hash = {}\n file_hash = {}\n\n input = input.split(\"\\n\")\n section = ''\n input.each do |value|\n if value.match?(%r{^\\[.*\\]})\n section = value.delete('[').delete(']')\n file_hash[section.to_sym] = []\n elsif !value.strip.empty?\n if value.match?(%r{^\\s*#})\n # do nothing as this is a comment\n elsif section && (section != '')\n file_hash[section.to_sym] << value\n else\n raise Puppet::Error, 'Malformed tagmail.conf file'\n end\n end\n end\n\n file_hash[:transport]&.each do |value|\n array = value.split('=')\n array.map(&:strip!)\n config_hash[array[0].to_sym] = array[1]\n end\n\n if file_hash[:tagmap]\n tagmap = file_hash[:tagmap].join(\"\\n\")\n taglists = parse_tagmap(tagmap)\n end\n\n config_hash = load_defaults(config_hash)\n self.class.instance_variable_set(:@tagmail_conf, config_hash)\n taglists\n end", "def parse_input(input_file); end", "def parse_input(input_file); end", "def parse(path)\n YAML.load(File.read(path))\n end", "def parse\n parse_command\n load_config\n finalize_setup\n end", "def read_config_file; end", "def parse_config_file config_path\n File.open(config_path, \"r\") do |file|\n case File.extname(file).delete(\".\")\n when \"json\" then JSON.parse(file.read)\n when \"yml\" then YAML.load_file(file)\n else\n file.close\n raise LoadError, \"Type of file is not supported.\"\n end\n end\n end", "def parse(content)\n TOMLP::Parser.new(content).parse\n end", "def parse(file)\n erb = ERB.new(File.read(file)).result\n if File.extname(file) == '.json'\n @parse = JSON.parse(erb, :symbolize_names => true) || {}\n else\n @parse = YAML.load(erb) || {}\n end\n end", "def parse_file()\n\n if !self.has?()\n return\n end\n\n @logs = {}\n @configs = {}\n current_index = 0\n current_config = {}\n parsing_config = false\n config_script = \"\"\n\n ::IO.foreach(self.path()) do |line|\n line.strip!\n if line.match(/\\}/)\n parsing_config = false\n @configs[current_index] = current_config\n current_config = {}\n current_index += 1\n config_script = \"\"\n\n else\n\n if parsing_config\n config = line.split(/\\s+/, 2)\n config.reject!(&:empty?) # Oh Ruby, why do you have 10 ways to do everything?\n #config[0].strip!\n\n if config[0] == \"postrotate\"\n config_script = config[0]\n current_config[config[0]] = []\n\n else\n\n if config_script != \"\"\n if config[0] == \"endscript\"\n current_config[config_script] << config[0]\n #current_config[config[0]] = \"\"\n config_script = \"\"\n\n else\n #line.strip!\n current_config[config_script] << line\n\n end\n\n else\n val = true\n if config.length == 2\n val = config[1]\n end\n current_config[config[0]] = val\n\n end\n end\n\n else\n logs = line.split(/\\s+/)\n logs.reject! { |c| c.empty? || c == \"{\" } # remove blank entries\n logs.each do |log|\n log.strip!\n @logs[log] = current_index\n end\n\n if line.match(/\\{/)\n parsing_config = true\n end\n\n end\n\n end\n\n\n end # foreach\n\n end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def read_config_file(file); end", "def parse_config \n path = \"#{Rails.root}/config/mebla.yml\"\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def parse_file(filename); end", "def parse\n parse_options\n parse_target\n end", "def read_config filename # {{{\n\n # Pre-condition check\n raise ArgumentError, \"Filename argument should be of type string, but it is (#{filename.class.to_s})\" unless( filename.is_a?(String) )\n\n # Main\n @log.message :debug, \"Loading this config file: #{filename.to_s}\"\n result = File.open( filename, \"r\" ) { |file| YAML.load( file ) } # return proc which is in this case a hash\n result = hashes_to_ostruct( result ) \n\n # Post-condition check\n raise ArgumentError, \"The function should return an OpenStruct, but instead returns a (#{result.class.to_s})\" unless( result.is_a?( OpenStruct ) )\n\n result\n end", "def read_configuration filename\n puts \"Reading configuration from #{filename}\"\n lines=File.readlines(filename)\n cfg={}\n #change in the dir of the file to calculate paths correctly\n cfg_dir=File.dirname(filename)\n lines.each do |l|\n l.gsub!(\"\\t\",\"\")\n l.chomp!\n #ignore if it starts with a hash\n unless l=~/^#/ || l.empty?\n #clean up by trimming whitespaces\n l.gsub!(/\\s*=\\s*/,'=')\n l.gsub!(/\\s*,\\s*/,',')\n #\n if l=~/=$/\n trailing_equals=true\n end\n #split on equals\n fields=l.split('=')\n #more than one part needed\n if fields.size>1\n #the key is the first\n key=fields.first\n #take the key out of the array\n values=fields.drop(1)\n #the value to each key is the values array joined with space\n case key \n when \"include\",\"depend\",\"interface\",\"external\" \n cfg[key]||=[]\n #here we want to handle a comma separated list of prefixes\n incs=values.join\n cfg[key]+=incs.split(',')\n cfg[key].uniq!\n when \"out_dir\",\"base_dir\",\"model\" \n cfg[key]=File.expand_path(File.join(cfg_dir,values.join))\n else\n cfg[key]=values.join('=')\n end#case\n cfg[key]<<'=' if trailing_equals\n else\n puts \"ERROR - Configuration syntax error in #{filename}:\\n'#{l}'\"\n end#if size>1\n end#unless\n end#lines.each\n return cfg\nend", "def as_config\n Configureasy::Config.new self.parse\n end", "def data\n YAML::load_file(files[:config])\n end", "def yaml\n parse_yaml_string(yaml_string(config_file), config_file)\n end", "def find_config(file); end", "def parse_from_file filename\n parse File.open(filename)\n end", "def parse\n parse_file\n self\n end", "def parse_input (input_file)\nend", "def parse_config\n # search upward to find project root\n path = self.root\n if path\n return YAML.load_file(path + '/.version50')\n end\n\n # project root not found\n return false\n end", "def fromFile cfgfile\n\t\tself.out \"from file #{cfgfile}\"\n\t\t# ran data\n\t\tinstance_eval File.read( cfgfile), cfgfile\n\tend", "def parse(content)\n SimpleConfig.new(content).params\n end", "def load_yaml_file file\r\n load_yaml \"parse_file\", file\r\n end", "def config_load(config); end", "def load_map_file map_file\n return YAML.load(map_file.read)\nend", "def load_config(filename)\n yml = YAML.load_file(filename)\n yml.each do |key, value| \n next if key == 'Templates'\n\n if key == 'PackageDirs'\n # PackageDirs.register value\n elsif key == 'AppDirs' \n # ApplicationDirMatcher.register value\n else\n app_matcher.register value\n end \n end\n end", "def read_configurations(file_name = T.unsafe(nil)); end", "def parse_config(\n config_file=File.expand_path(File.join(File.dirname(__FILE__), 'config.yml'))\n)\n require 'yaml'\n config = {\n 'sites' => \"sites\",\n 'webroot_subdir' => \"\",\n 'databases' => \"databases\",\n 'memory' => '2048',\n 'cpus' => '1',\n 'use_nfs' => true,\n 'with_gui' => false,\n 'ip' => \"192.168.50.4\",\n 'box_name' => 'Parrot-Trusty',\n 'varnish_enabled' => false,\n 'local_user_uid' => Process.uid,\n 'local_user_gid' => Process.gid,\n 'forward_solr' => true,\n 'forward_mysql' => true,\n 'forward_varnish' => true,\n 'forward_apache' => true,\n 'forward_https' => true,\n 'forward_dovecot' => true,\n 'solr_port' => 8983,\n 'mysql_port' => 3306,\n 'varnish_port' => 8181,\n 'apache_port' => 8080,\n 'https_port' => 1443,\n 'dovecot_port' => 1143,\n 'drush_version' => 'drush/drush',\n }\n if File.exists?(config_file)\n overrides = YAML.load_file(config_file)\n config.merge!(overrides)\n end\n config\nend", "def yml_config\n return @yml_config if @yml_config\n\n require 'yaml'\n data = File.open(options[:config_path]).read\n\n require 'erb'\n data = ERB.new(data).result(binding)\n\n @yml_config ||= YAML.load(data)\n end", "def parse(eval_ui = false)\n begin\n defaults = @config['defaults']\n\n ################################################################\n # Cluster\n ################################################################\n\n if @config['cluster'].nil?\n @config['cluster'] = { 'name' => @config['name'] }\n end\n\n @config['cluster']['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n @config['cluster']['provision'].merge!(\n defaults['provision']\n )\n end\n\n ################################################################\n # Hosts\n ################################################################\n\n if @config['hosts']\n sections = ['connection', 'provision', 'configuration']\n\n @config['hosts'].map! do |host|\n sections.each do |section|\n data = CONFIG_DEFAULTS[section] || {}\n\n if @config['defaults']\n defaults = @config['defaults'][section]\n end\n\n h_sec = host[section]\n\n # merge defaults with globals\n # and device specific params\n data.merge!(defaults) unless defaults.nil?\n data.merge!(h_sec) unless h_sec.nil?\n\n host[section] = data\n end\n\n host\n end\n end\n\n ################################################################\n # Datastores & Networks\n ################################################################\n\n ['datastores', 'networks'].each do |r|\n next unless @config[r]\n\n @config[r].map! do |x|\n x['provision'] ||= {}\n\n if defaults && defaults.key?('provision')\n x['provision'].merge!(defaults['provision'])\n end\n\n x\n end\n end\n\n # Add provision ID into ARs to evaluate it later\n if @config['networks']\n @config['networks'].each do |vnet|\n next unless vnet['ar']\n\n unless vnet['ar'].is_a? Array\n raise 'ar should be an array'\n end\n\n vnet['ar'].each do |ar|\n ar['provision_id'] = '${provision_id}'\n end\n end\n end\n\n ################################################################\n # User inputs\n ################################################################\n return unless eval_ui\n\n eval_user_inputs\n rescue StandardError => e\n Utils.fail(\"Failed to read configuration: #{e}\")\n end\n end", "def parse_spec_file(task_spec)\n task_spec_metadata = {}\n\n begin\n text = task_spec.read\n text.split(\"\\n\").each do |line|\n line = line.downcase\n\n if line =~ /^\\s*#\\s*(?:yamls|hiera):\\s*(.*)/\n task_spec_metadata[:hiera] = [] unless task_spec_metadata[:hiera].is_a? Array\n task_spec_metadata[:hiera] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*facts:\\s*(.*)/\n task_spec_metadata[:facts] = [] unless task_spec_metadata[:facts].is_a? Array\n task_spec_metadata[:facts] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*(?:skip_yamls|skip_hiera):\\s(.*)/\n task_spec_metadata[:skip_hiera] = [] unless task_spec_metadata[:skip_hiera].is_a? Array\n task_spec_metadata[:skip_hiera] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*skip_facts:\\s(.*)/\n task_spec_metadata[:skip_facts] = [] unless task_spec_metadata[:skip_facts].is_a? Array\n task_spec_metadata[:skip_facts] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*disable_spec/\n task_spec_metadata[:disable] = true\n end\n\n if line =~ /^\\s*#\\s*role:\\s*(.*)/\n task_spec_metadata[:roles] = [] unless task_spec_metadata[:roles].is_a? Array\n roles = line.split /\\s*,\\s*|\\s+/\n task_spec_metadata[:roles] += roles\n end\n\n if line =~ /^\\s*#\\s*run:\\s*(.*)/\n run_record = get_list_of_yamls $1\n if run_record.length >= 2\n run_record = {\n :hiera => run_record[0],\n :facts => run_record[1],\n }\n task_spec_metadata[:runs] = [] unless task_spec_metadata[:runs].is_a? Array\n task_spec_metadata[:runs] << run_record\n end\n end\n end\n rescue\n return task_spec_metadata\n end\n task_spec_metadata\n end", "def parse(config)\n # Setup global section\n section = Section.new('', nil)\n @global = section\n\n prev_indent = 0\n prev_line = ''\n combine = false\n longline = []\n\n config.each_line do |line|\n if @multiline_cmds.any? { |cmd| line =~ /#{cmd}/ }\n longline = []\n combine = true\n end\n if combine\n longline << line\n if line =~ /^\\s*EOF$/ # rubocop:disable Style/GuardClause\n line = longline.join\n combine = false\n else\n next\n end\n end\n\n # Ignore comment lines and the end statement if there\n # XXX Fix parsing end\n next if line.start_with?('!', 'end')\n line.chomp!\n next if line.empty?\n indent_level = line[/\\A */].size / @indent\n if indent_level > prev_indent\n # New section\n section = Section.new(prev_line, section)\n section.parent.add_child(section)\n prev_indent = indent_level\n elsif indent_level < prev_indent\n # XXX This has a bug if we pop more than one section\n # XXX Bug if we have 2 subsections with intervening commands\n # End of current section\n section = section.parent\n prev_indent = indent_level\n end\n # Add the line to the current section\n section.add_cmd(line)\n prev_line = line\n end\n end", "def parse(filename)\n Parser::CurrentRuby.parse(File.open(filename, \"r\").read)\n end", "def config\n\tYAML.load(File.open(\"config.yaml\"))\nend", "def load_yml(filename); end", "def parse_kramdown(file)\n ::Kramdown::Document.new File.readlines(file).join, :input => 'QuickStartParser' \n end", "def compile_town_map(path = \"PBS/townmap.txt\")\r\n nonglobaltypes = {\r\n \"Name\" => [0, \"s\"],\r\n \"Filename\" => [1, \"s\"],\r\n \"Point\" => [2, \"uussUUUU\"]\r\n }\r\n currentmap = -1\r\n rgnnames = []\r\n placenames = []\r\n placedescs = []\r\n sections = []\r\n pbCompilerEachCommentedLine(path) { |line,lineno|\r\n if line[/^\\s*\\[\\s*(\\d+)\\s*\\]\\s*$/]\r\n currentmap = $~[1].to_i\r\n sections[currentmap] = []\r\n else\r\n if currentmap<0\r\n raise _INTL(\"Expected a section at the beginning of the file\\r\\n{1}\",FileLineData.linereport)\r\n end\r\n if !line[/^\\s*(\\w+)\\s*=\\s*(.*)$/]\r\n raise _INTL(\"Bad line syntax (expected syntax like XXX=YYY)\\r\\n{1}\",FileLineData.linereport)\r\n end\r\n settingname = $~[1]\r\n schema = nonglobaltypes[settingname]\r\n if schema\r\n record = pbGetCsvRecord($~[2],lineno,schema)\r\n if settingname==\"Name\"\r\n rgnnames[currentmap] = record\r\n elsif settingname==\"Point\"\r\n placenames.push(record[2])\r\n placedescs.push(record[3])\r\n sections[currentmap][schema[0]] = [] if !sections[currentmap][schema[0]]\r\n sections[currentmap][schema[0]].push(record)\r\n else # Filename\r\n sections[currentmap][schema[0]] = record\r\n end\r\n end\r\n end\r\n }\r\n save_data(sections,\"Data/town_map.dat\")\r\n MessageTypes.setMessages(MessageTypes::RegionNames,rgnnames)\r\n MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames,placenames)\r\n MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions,placedescs)\r\n end", "def load(filename)\n file_content = File.open(filename).read\n TOMLP::Parser.new(file_content).parse\n end", "def parse(config_str)\n config_str += \"\\n\"\n config_str.gsub!(/^\\s*$\\n/, '')\n # ignore leading ! or # (comments)\n config_str.gsub!(/^\\s*[!#].*$\\n/, '')\n if config_str.match(/^ *\\t/)\n highlight_str = config_str.gsub(/\\t/, '[TAB]')\n fail \"Tab character detected in indentation area:\\n\" + highlight_str\n end\n indent_level = config_str.match(/^\\s*/)\n @indent = indent_level.to_s # capture indentation of level\n escaped_indent = Regexp.escape(@indent)\n # Find current configuration mode lines\n @ordered_keys = config_str.scan(/^#{escaped_indent}\\S.*\\n/)\n @ordered_keys.each do |config_line|\n command = config_line.strip\n escaped_cmd = Regexp.escape(config_line)\n submode_string = config_str.match(\n /^(?:#{escaped_cmd})((?:#{escaped_indent}\\s.+\\n)*)/).captures.join\n @configuration[command] = Configuration.new(submode_string)\n end\n end", "def parsed_tree; end", "def parse_config\n @parsed_hash = Settings.load! @config_file\n validate @parsed_hash\n HadoopConfigParser.new(HADOOP_CONF, @log, @debug)\n HBaseConfigParser.new(HBASE_CONF, @log, @debug)\n unless @errors_count == 0\n @log.error \"Number of Errors: #{@errors_count}\"\n @log.error 'Parsing config file ... ' + '[Failed]'.red\n raise(Ankus::Errors::ParseError.new(\"\\rParsing Configuration Failed\".red))\n end\n create_req_files\n @parsed_hash\n rescue Ankus::Errors::ParseError, Ankus::Errors::ParseError::NoKey\n @log.error \"#{$!.message} (#{$!.class})\"\n exit\n rescue\n @log.error \"#{$!.message} (#{$!.class})\"\n puts $@ if @debug\n exit\n end", "def parse(content)\n $Log.info('Start Parsing')\n lines = content.strip.split(/\\r?\\n/)\n root = @root_type.new(@metadata)\n root.build(@metadata, lines)\n root.post_process\n root\n end", "def parse_tf_state(path)\n check_terraform_applied\n\n tf_state = YAML.load(File.read(path))\n tf_output = tf_state[\"modules\"].first[\"outputs\"]\n tf_output.map { |k, v| tf_output[k] = v[\"value\"] }\n\n tf_output\n end", "def parse_config\r\n exec 'parse_config(true);'\r\n self.config_parsed = true\r\n end", "def parse(file_name)\n raise Mongify::ConfigurationFileNotFound, \"File #{file_name} is missing\" unless File.exists?(file_name)\n config = self.new\n config.instance_eval(File.read(file_name))\n config\n end", "def parse\n {:indent => @indent, :command => parse_command}\n end", "def parse_config(config)\n @config = YAML.load_file(config)\n debug_msg(\"CONFIG: #{@config.inspect}\")\nend", "def parse_file(file)\n\n\n File.readlines(file).each do |line|\n command = parse_command(line)\n end\n # File.readlines(file).each do |line|\n # command = parse_command(line)\n # apply_command(command)\n end", "def parse_def_file(filepath)\n\n $runParamsOpen = false; \n $runScopeOpen = false; \n $UpgradesOpen = false; \n \n $WildCardsInUse = false; \n \n rundefs = File.open(filepath, 'r') \n \n rundefs.each do | line |\n \n $defline = line\n $defline.strip! \n $defline.gsub!(/\\!.*$/, '')\n $defline.gsub!(/\\s*/, '')\n $defline.gsub!(/\\^/, '')\n \n if ( $defline !~ /^\\s*$/ ) \n\n case \n # Section star/end in the file \n when $defline.match(/RunParameters_START/i)\n $RunParamsOpen = true; \n \n when $defline.match(/RunParameters_END/i)\n $RunParamsOpen = false; \n \n when $defline.match(/RunScope_START/i)\n $RunScopeOpen = true; \n \n when $defline.match(/RunScope_END/i)\n $RunScopeOpen = false; \n \n when $defline.match(/Upgrades_START/i)\n $UpgradesOpen = true; \n \n when $defline.match(/Upgrades_END/i)\n $UpgradesOpen = false; \n \n else \n \n # definitions \n $token_values = Array.new\n $token_values = $defline.split(\"=\")\n \n\n \n if ( $RunParamsOpen && $token_values[0] =~ /archetype-dir/i ) \n # Where are our .h2k files located?\n \n $gArchetypeDir = $token_values[1] \n \n \n end\n \n \n if ( $RunParamsOpen && $token_values[0] =~ /run-mode/i ) \n # This does nothing only 'mesh' supported for now!!!\n $gRunDefMode = $token_values[1] \n \n if ( ! ( $gRunDefMode =~ /mesh/ || $gRunDefMode =~ /parametric/ ) ) then \n fatalerror (\" Run mode #{$gRunDefMode} is not supported!\") \n end \n \n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /rulesets/i ) \n # Rulesets that can be applied. \n $gRulesets = $token_values[1].to_s.split(\",\")\n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /archetypes/i ) \n \n # archetypes - \n $gArchetypes = $token_values[1].to_s.split(\",\")\n \n \n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /locations/i ) \n \n # locations - \n $gLocations = $token_values[1].to_s.split(\",\")\n \n end \n \n if ( $UpgradesOpen ) \n \n option = $token_values[0]\n choices = $token_values[1].to_s.split(\",\")\n \n debug_out \" #{option} len = #{choices.grep(/\\*/).length} \\n\" \n \n if ( choices.grep(/\\*/).length > 0 ) then \n \n $WildCardsInUse = true \n \n end \n \n $gRunUpgrades[option] = choices\n\n $gOptionList.push option \n \n \n end \n \n\n end #Case \n \n end # if ( $defline !~ /^\\s*$/ ) \n \n end # rundefs.each do | line |\n\n \n # Check to see if run options contians wildcards \n \n \n if ( $WildCardsInUse ) then \n \n if ( ! $gOptionFile =~ /\\.json/i ) then \n fatalerror (\"Wildcard matching is only supported with .json option files\") \n end \n \n fOPTIONS = File.new($gOptionFile, \"r\") \n if fOPTIONS == nil then\n fatalerror(\" Could not read #{filename}.\\n\")\n end\n \n $OptionsContents = fOPTIONS.read\n fOPTIONS.close \n \n $JSONRawOptions = JSON.parse($OptionsContents)\n $OptionsContents = nil\n \n $gRunUpgrades.keys.each do |key| \n debug_out( \" Wildcard search for #{key} => \\n\" )\n \n \n \n \n $gRunUpgrades[key].clone.each do |choice| \n \n debug_out (\" ? #{choice} \\n\") \n \n if ( choice =~ /\\*/ ) then \n \n $pattern = choice.gsub(/\\*/, \".*\") \n \n debug_out \" Wildcard matching on #{key}=#{$pattern}\\n\" \n \n # Matching \n \n $SuperSet = $JSONRawOptions[key][\"options\"].keys\n \n $gRunUpgrades[key].delete(choice) \n\n $gRunUpgrades[key].concat $SuperSet.grep(/#{$pattern}/)\n \n \n end \n \n end \n \n \n end \n \n $JSONRawOptions = nil \n \n end \n\n \n \n \n # What if archetypes are defined using a wildcard? \n \n \n \n \n \n\nend", "def parse\n end", "def load_yaml(filename); end", "def pluggable_parser; end", "def parse; end", "def parse; end", "def parse; end", "def parse (file)\n File.open(file.path, \"r\") do |file|\n # read each char and use state\n tokens = Array.new\n state = TokenStates::TEXT_STATE\n input = \"\"\n last_newline = 0\n while file.eof? == false\n case state\n when TokenStates::TEXT_STATE\n #puts \"TEXT_STATE\"\n input = file.getc\n if input == \"<\"\n state = TokenStates::COMMAND_OPEN_STATE\n elsif input == \"\\n\"\n last_newline = file.pos\n else\n if tokens.length == 0 || tokens.last.class != Whip::TextToken\n tokens.push(Whip::TextToken.new(file.pos))\n end\n end\n when TokenStates::COMMAND_OPEN_STATE\n #puts \"COMMAND_OPEN_STATE\"\n pos = file.pos\n input += file.getc\n input += file.getc\n input += file.getc\n input += file.getc\n if input == \"<!--$\"\n state = TokenStates::COMMAND_NAME_STATE\n if tokens.last.class != Whip::CommandToken\n tokens.last.ends = pos\n end\n tokens.push(Whip::CommandToken.new(pos))\n tokens.last.indent = pos - last_newline - 1\n input = \"\"\n else\n state = TokenStates::TEXT_STATE\n if tokens.length == 0\n tokens.push(Whip::TextToken.new(pos))\n end\n end\n when TokenStates::COMMAND_NAME_STATE\n #puts \"COMMAND_NAME_STATE\"\n input += file.getc\n if input[-1] == \" \"\n state = TokenStates::COMMAND_ARGUMENT_START_STATE\n tokens.last.name = input[0...-1]\n input = \"\"\n end\n when TokenStates::COMMAND_ARGUMENT_START_STATE\n #puts \"COMMAND_ARGUMENT_START_STATE\"\n input = file.getc\n if input == '\"'\n state = TokenStates::COMMAND_ARGUMENT_STATE\n input = \"\"\n end\n when TokenStates::COMMAND_ARGUMENT_STATE\n #puts \"COMMAND_ARGUMENT_STATE\"\n input += file.getc\n if input[-1] == '\"'\n state = TokenStates::COMMAND_CLOSE_STATE\n tokens.last.argument = input[0...-1]\n input = \"\"\n end\n when TokenStates::COMMAND_CLOSE_STATE\n #puts \"COMMAND_CLOSE_STATE\"\n input += file.getc\n if input.strip == \"-->\"\n state = TokenStates::TEXT_STATE\n tokens.last.ends = file.pos\n input = \"\"\n end\n else\n end\n end\n tokens.last.ends = file.pos + 1\n return tokens\n end\n end", "def parse_from_file\n parsed_opts = YAML.load_file(config_path)\n parsed_opts.delete_if{|k| k.to_s == 'config_path'}\n parsed_opts.each_pair{|k,v| self[k] = v}\n true\n rescue Errno::ENOENT\n false\n end", "def parse_file(path)\n begin\n _config = YAML.safe_load(File.read(path))\n rescue StandardError => _e\n str_error=\"Unable to read '#{path}'. Invalid YAML syntax:\\n\"\n\n raise str_error\n end\n end", "def yml_file_to_object(options={})\n content = read_file_content(options)\n YAML.load(content)\nend", "def parse(tags); end", "def parse_configuration(file)\n config = {}\n current = nil\n File.open(file).each_line do |line|\n case line\n when /^\\[(\\w+)(?: \"(.+)\")*\\]/\n key, subkey = $1, $2\n current = (config[key] ||= {})\n current = (current[subkey] ||= {}) if subkey\n else\n key, value = line.strip.split(' = ')\n current[key] = value\n end\n end\n config\n end", "def parse\n options = {}\n options.merge(parse_config_file(CONFIG_LOCATION))\n\n argv = parse_argv\n if argv[:config_file].kind_of?(String)\n options.merge(parse_config_file(argv[:config_file]))\n end\n\n options.merge(argv)\n end", "def parse(source); end", "def node_configs(scenario_id)\n parse_node_config_files(parse_scenario_file(scenario_id))\nend", "def parsed\n return @parsed if instance_variable_defined? :@parsed\n\n if source =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n { metadata: YAML.load($1), content: $' }\n else\n { metadata: {}, content: source }\n end\n end", "def parse_file(filename: \"\", type: \"level\")\n !filename.empty? ? file = File.binread(filename) : return\n case type\n when \"level\"\n mode = file[12].reverse.hd # game mode: 0 = solo, 1 = coop, 2 = race, 4 = unset\n title = file[38..165].split(//).delete_if{ |b| b == \"\\x00\" }.join\n author = \"\"\n map = parse_map(data: file[184..-1], type: \"new\")\n when \"attract\"\n map_length = file[0..3].reverse.hd\n demo_length = file[4..7].reverse.hd\n map_data = file[8 .. 8 + map_length - 1]\n demo_data = file[8 + map_length .. 8 + map_length + demo_length - 1]\n\n level_id = map_data[0..3].reverse.hd\n title = map_data[30..157].split(//).delete_if{ |b| b == \"\\x00\" }.join\n index = map_data[159..-1].split(//).find_index(\"\\x00\") + 158\n author = map_data[159..index]\n map = parse_map(data: map_data[index + 2..-1], type: \"new\")\n # demo = parse_demo(data: demo_data, attract: true) # no se si el attract hace falta, comparar esto con una replay normal\n when \"old\"\n title = file.split('#')[0][1..-1]\n author = \"Metanet Software\"\n map = parse_map(data: file.split(\"#\")[1], type: \"old\")\n else\n print(\"ERROR: Incorrect type (level, attract, old).\")\n return 0\n end\n {title: title, author: author, tiles: map[:tiles], objects: map[:objects]}\nend", "def config_read\n f = File.expand_path(CONFIG_FILE)\n return unless File.readable? f\n\n hash = loadYML(f)\n @used_dirs = hash['DIRS']\n @visited_files = hash['FILES']\n @bookmarks = hash['BOOKMARKS']\n @used_dirs.concat get_env_paths\nend", "def parser\n Trollop::Parser.new do\n banner USAGE\n opt :file, 'The file that will store the tags',\n type: :string, default: '/etc/facter/facts.d/ec2_tags.json'\n opt :all, 'Collect all tags'\n stop_on_unknown\n end\n end", "def parse_definition_list; end", "def parse(file)\n puts \"Not yet implemented\"\nend", "def read_codefile\n y = YamlReader.new(@@options.codefile)\n yamltab = y.parse\n end", "def parse_config_file(path)\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def ast\n @ast ||= Syntax::Parser.parse_file(path)\n end", "def grabTree(filename)\n inTree = nil\n File.open(filename, \"r\").each do |of|\n inTree = YAML::load(of)\n end\n inTree\n end", "def read_map(mapfile)\n mapfile = File.join(\"lib\", \"adventure\", \"data\", mapfile)\n xml = Document.new(File.open(mapfile))\n @@name = xml.root.attributes[\"name\"]\n\n xml.elements.each(\"Map/variable\") do |e|\n tmp = e.attributes[\"value\"].split(/\\|/)\n case e.attributes[\"name\"]\n when /MAX_INDEX/ : @@max_index = [tmp[0].to_i, tmp[1].to_i]\n when /START_ROOM/ : @@start_room = e.attributes[\"value\"]\n when /WELCOME_MESSAGE/ : @@welcome_message = e.text\n end\n end # xml.elements.each(\"Map/variable\")\n\n xml.elements.each(\"Map/message\") do |message|\n mymessage = Message.new(\n message.attributes[\"message_id\"] ,\n message.text)\n end # xml.elements.each(\"Map/message\")\n\n xml.elements.each(\"Map/item\") do |item|\n myitem = Thing.new(\n item.attributes[\"item_id\"],\n item.text(\"identifier\"),\n item.text(\"use_with\"),\n item.text(\"name\"),\n item.text(\"info\"),\n item.text(\"look_text\")\n )\n item.elements.each(\"event\") do |event|\n myevent = myitem.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # element.elements.each(\"event\") do |event|\n end # xml.elements.each(\"Map/item\") do |element|\n\n xml.elements.each(\"Map/person\") do |person|\n myperson = Person.new(\n person.attributes[\"person_id\"],\n person.text(\"identifier\"),\n person.text(\"name\"),\n person.text(\"info\"),\n person.text(\"look_text\")\n )\n person.elements.each(\"item\") do |item|\n myperson.add_thing(\n item.attributes[\"item_id\"],\n item.text(\"identifier\"),\n item.text(\"use_with\"),\n item.text(\"name\"),\n item.text(\"info\"),\n item.text(\"look_text\")\n )\n end\n person.elements.each(\"event\") do |event|\n myevent = myperson.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # person.elements.each(\"event\") do |event|\n end #xml.elements.each(\"Map/person\") do |person|\n\n xml.elements.each(\"Map/door\") do |door|\n mydoor = Door.new(\n door.attributes[\"door_id\"],\n door.text(\"identifier\"),\n door.text(\"exit\"),\n door.text(\"open\"),\n door.text(\"key\"),\n door.text(\"name\"),\n door.text(\"info\"),\n door.text(\"look_text\")\n )\n door.elements.each(\"item\") do |item|\n mydoor.add_thing(\n item.attributes[\"item_id\"],\n item.text(\"identifier\"),\n item.text(\"use_with\"),\n item.text(\"name\"),\n item.text(\"info\"),\n item.text(\"look_text\")\n )\n end\n door.elements.each(\"event\") do |event|\n myevent = mydoor.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # person.elements.each(\"event\") do |event|\n end #xml.elements.each(\"Map/door\") do |door|\n\n xml.elements.each(\"Map/room\") do |room|\n myroom = Room.new(\n room.attributes[\"room_id\"],\n room.text(\"identifier\"),\n room.text(\"exits\"),\n room.text(\"name\"),\n room.text(\"info\"),\n room.text(\"look_text\")\n )\n room.elements.each(\"event\") do |event|\n myevent = myroom.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # room.elements.each(\"event\") do |event|\n\n room.elements.each(\"item\") do |item|\n myroom.add_thing(\n item.attributes[\"item_id\"],\n item.text(\"identifier\"),\n item.text(\"use_with\"),\n item.text(\"name\"),\n item.text(\"info\"),\n item.text(\"look_text\")\n )\n end # room.elements.each(\"item\") do |item|\n\n room.elements.each(\"door\") do |door|\n mydoor = myroom.add_door(\n door.attributes[\"door_id\"],\n door.text(\"identifier\"),\n door.text(\"exit\"),\n door.text(\"open\"),\n door.text(\"key\"),\n door.text(\"name\"),\n door.text(\"info\"),\n door.text(\"look_text\")\n )\n door.elements.each(\"item\") do |item|\n mydoor.add_thing(\n item.attributes[\"item_id\"],\n item.text(\"identifier\"),\n item.text(\"use_with\"),\n item.text(\"name\"),\n item.text(\"info\"),\n item.text(\"look_text\")\n )\n end #door.elements.each(\"item\") do |item|\n door.elements.each(\"event\") do |event|\n myevent = mydoor.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # door.elements.each(\"event\") do |event|\n end # room.elements.each(\"door\") do |door|\n\n room.elements.each(\"person\") do |person|\n myperson = myroom.add_person(\n person.attributes[\"person_id\"],\n person.text(\"identifier\"),\n person.text(\"name\"),\n person.text(\"info\"),\n person.text(\"look_text\")\n )\n\n person.elements.each(\"item\") do |item|\n myperson.add_thing(\n item.attributes[\"item_id\"],\n item.text(\"identifier\"),\n item.text(\"use_with\"),\n item.text(\"name\"),\n item.text(\"info\"),\n item.text(\"look_text\")\n )\n end\n\n person.elements.each(\"event\") do |event|\n myevent = myperson.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # person.elements.each(\"event\") do |event|\n end # room.elements.each(\"person\") do |person|\n end # xml.elements.each(\"Map/room\") do |room|\n\n xml.elements.each(\"Map/event\") do |event|\n myevent = Map.add_event(\n event.attributes[\"name\"],\n event.text(\"unique\"),\n event.text(\"condition\"),\n event.text(\"phrase\"),\n event.text(\"message\")\n )\n event.elements.each(\"command\") do |command|\n myevent.add_command(\n command.text(\"action\"),\n command.text(\"object\"),\n command.text(\"helper\")\n )\n end #xml.elements.each(\"command\") do |command|\n end # xml.elements.each(\"Map/event\") do |event|\n\n xml.elements.each(\"Map/start_inventory\") do |item|\n @@inventory.add_byId(item.text)\n end\n @@current_room = Map.room(@@start_room)\n @@current_room.visit\n self\n end", "def local_yaml\n parse_yaml_string(yaml_string(local_config_file), local_config_file)\n end", "def load_state file=nil\n file=App.outpath + \"save.rb\" if file.nil?\n f=File.open(file,'r')\n content=f.read\n # puts content\n App.out= YAML.load(content)\n f.close\nend", "def parse(code, version=1.8)\n config = version == 1.8 ? CONFIG_18 : CONFIG_19\n PARSER.parse \"<code>\", source(code), config\n end", "def parse(code, version=1.8)\n config = version == 1.8 ? CONFIG_18 : CONFIG_19\n PARSER.parse \"<code>\", source(code), config\n end" ]
[ "0.67521816", "0.63717693", "0.62796634", "0.6276525", "0.6223976", "0.6051447", "0.6005092", "0.596364", "0.59565127", "0.5909066", "0.59022576", "0.5881128", "0.58657265", "0.58593446", "0.58540523", "0.58540523", "0.5822434", "0.57986236", "0.57943016", "0.57805634", "0.57576835", "0.5746216", "0.57407135", "0.57346255", "0.57346255", "0.57346255", "0.57346255", "0.56974024", "0.56876874", "0.5686711", "0.5671788", "0.5658536", "0.5629547", "0.5629488", "0.56269854", "0.5623997", "0.56145006", "0.5609021", "0.5603847", "0.559788", "0.5597516", "0.5597179", "0.55902284", "0.55849075", "0.5574346", "0.55717087", "0.55533975", "0.55493265", "0.5546163", "0.5545879", "0.55046016", "0.5502734", "0.5496483", "0.54927605", "0.54857254", "0.5474577", "0.5470474", "0.54690003", "0.5464186", "0.54600006", "0.54592556", "0.5454239", "0.541931", "0.5416676", "0.54096895", "0.54088813", "0.5403905", "0.5401363", "0.53985834", "0.5395812", "0.5383286", "0.53777486", "0.53775376", "0.5373954", "0.5373954", "0.5373954", "0.53609324", "0.5359188", "0.5357014", "0.53545195", "0.5352856", "0.53496647", "0.5334522", "0.53289604", "0.5315416", "0.5301173", "0.52872086", "0.52828884", "0.52828354", "0.52801436", "0.5278479", "0.5278252", "0.52715176", "0.5265363", "0.5262045", "0.52591515", "0.5255232", "0.5243604", "0.52371895", "0.52371895" ]
0.6176473
5
Use the ruby structure created after config parsing to set the right values to be used as environment variables
def populateSettingValuesFromConfigMap(parsedConfig) begin if !parsedConfig.nil? && !parsedConfig[:agent_settings].nil? if !parsedConfig[:agent_settings][:health_model].nil? && !parsedConfig[:agent_settings][:health_model][:enabled].nil? @enable_health_model = parsedConfig[:agent_settings][:health_model][:enabled] puts "enable_health_model = #{@enable_health_model}" end chunk_config = parsedConfig[:agent_settings][:chunk_config] if !chunk_config.nil? nodesChunkSize = chunk_config[:NODES_CHUNK_SIZE] if !nodesChunkSize.nil? && is_number?(nodesChunkSize) && (@nodesChunkSizeMin..@nodesChunkSizeMax) === nodesChunkSize.to_i @nodesChunkSize = nodesChunkSize.to_i puts "Using config map value: NODES_CHUNK_SIZE = #{@nodesChunkSize}" end podsChunkSize = chunk_config[:PODS_CHUNK_SIZE] if !podsChunkSize.nil? && is_number?(podsChunkSize) && (@podsChunkSizeMin..@podsChunkSizeMax) === podsChunkSize.to_i @podsChunkSize = podsChunkSize.to_i puts "Using config map value: PODS_CHUNK_SIZE = #{@podsChunkSize}" end eventsChunkSize = chunk_config[:EVENTS_CHUNK_SIZE] if !eventsChunkSize.nil? && is_number?(eventsChunkSize) && (@eventsChunkSizeMin..@eventsChunkSizeMax) === eventsChunkSize.to_i @eventsChunkSize = eventsChunkSize.to_i puts "Using config map value: EVENTS_CHUNK_SIZE = #{@eventsChunkSize}" end deploymentsChunkSize = chunk_config[:DEPLOYMENTS_CHUNK_SIZE] if !deploymentsChunkSize.nil? && is_number?(deploymentsChunkSize) && (@deploymentsChunkSizeMin..@deploymentsChunkSizeMax) === deploymentsChunkSize.to_i @deploymentsChunkSize = deploymentsChunkSize.to_i puts "Using config map value: DEPLOYMENTS_CHUNK_SIZE = #{@deploymentsChunkSize}" end hpaChunkSize = chunk_config[:HPA_CHUNK_SIZE] if !hpaChunkSize.nil? && is_number?(hpaChunkSize) && (@hpaChunkSizeMin..@hpaChunkSizeMax) === hpaChunkSize.to_i @hpaChunkSize = hpaChunkSize.to_i puts "Using config map value: HPA_CHUNK_SIZE = #{@hpaChunkSize}" end podsEmitStreamBatchSize = chunk_config[:PODS_EMIT_STREAM_BATCH_SIZE] if !podsEmitStreamBatchSize.nil? && is_number?(podsEmitStreamBatchSize) && podsEmitStreamBatchSize.to_i <= @podsChunkSize && podsEmitStreamBatchSize.to_i >= @podsEmitStreamBatchSizeMin @podsEmitStreamBatchSize = podsEmitStreamBatchSize.to_i puts "Using config map value: PODS_EMIT_STREAM_BATCH_SIZE = #{@podsEmitStreamBatchSize}" end nodesEmitStreamBatchSize = chunk_config[:NODES_EMIT_STREAM_BATCH_SIZE] if !nodesEmitStreamBatchSize.nil? && is_number?(nodesEmitStreamBatchSize) && nodesEmitStreamBatchSize.to_i <= @nodesChunkSize && nodesEmitStreamBatchSize.to_i >= @nodesEmitStreamBatchSizeMin @nodesEmitStreamBatchSize = nodesEmitStreamBatchSize.to_i puts "Using config map value: NODES_EMIT_STREAM_BATCH_SIZE = #{@nodesEmitStreamBatchSize}" end end # fbit config settings fbit_config = parsedConfig[:agent_settings][:fbit_config] if !fbit_config.nil? fbitFlushIntervalSecs = fbit_config[:log_flush_interval_secs] if !fbitFlushIntervalSecs.nil? && is_number?(fbitFlushIntervalSecs) && fbitFlushIntervalSecs.to_i > 0 @fbitFlushIntervalSecs = fbitFlushIntervalSecs.to_i puts "Using config map value: log_flush_interval_secs = #{@fbitFlushIntervalSecs}" end fbitTailBufferChunkSizeMBs = fbit_config[:tail_buf_chunksize_megabytes] if !fbitTailBufferChunkSizeMBs.nil? && is_number?(fbitTailBufferChunkSizeMBs) && fbitTailBufferChunkSizeMBs.to_i > 0 @fbitTailBufferChunkSizeMBs = fbitTailBufferChunkSizeMBs.to_i puts "Using config map value: tail_buf_chunksize_megabytes = #{@fbitTailBufferChunkSizeMBs}" end fbitTailBufferMaxSizeMBs = fbit_config[:tail_buf_maxsize_megabytes] if !fbitTailBufferMaxSizeMBs.nil? && is_number?(fbitTailBufferMaxSizeMBs) && fbitTailBufferMaxSizeMBs.to_i > 0 if fbitTailBufferMaxSizeMBs.to_i >= @fbitTailBufferChunkSizeMBs @fbitTailBufferMaxSizeMBs = fbitTailBufferMaxSizeMBs.to_i puts "Using config map value: tail_buf_maxsize_megabytes = #{@fbitTailBufferMaxSizeMBs}" else # tail_buf_maxsize_megabytes has to be greater or equal to tail_buf_chunksize_megabytes @fbitTailBufferMaxSizeMBs = @fbitTailBufferChunkSizeMBs puts "config::warn: tail_buf_maxsize_megabytes must be greater or equal to value of tail_buf_chunksize_megabytes. Using tail_buf_maxsize_megabytes = #{@fbitTailBufferMaxSizeMBs} since provided config value not valid" end end # in scenario - tail_buf_chunksize_megabytes provided but not tail_buf_maxsize_megabytes to prevent fbit crash if @fbitTailBufferChunkSizeMBs > 0 && @fbitTailBufferMaxSizeMBs == 0 @fbitTailBufferMaxSizeMBs = @fbitTailBufferChunkSizeMBs puts "config::warn: since tail_buf_maxsize_megabytes not provided hence using tail_buf_maxsize_megabytes=#{@fbitTailBufferMaxSizeMBs} which is same as the value of tail_buf_chunksize_megabytes" end fbitTailMemBufLimitMBs = fbit_config[:tail_mem_buf_limit_megabytes] if !fbitTailMemBufLimitMBs.nil? && is_number?(fbitTailMemBufLimitMBs) && fbitTailMemBufLimitMBs.to_i > 0 @fbitTailMemBufLimitMBs = fbitTailMemBufLimitMBs.to_i puts "Using config map value: tail_mem_buf_limit_megabytes = #{@fbitTailMemBufLimitMBs}" end end end rescue => errorStr puts "config::error:Exception while reading config settings for agent configuration setting - #{errorStr}, using defaults" @enable_health_model = false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def example_env_vars\n Parser.call(read)\n rescue Errno::ENOENT, FormatError\n {}\n end", "def config_from_env\n CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env_vars|\n if value = option_from_env(option)\n env_vars[option] = value\n end\n end\n end", "def initialize_from_env\n conf_prefix = self.env_variable_prefix.upcase\n\n ENV.keys.reject { |key|\n key !~ /^#{conf_prefix}/ # Ignore everything that doesn't match the prefix\n }.each { |key|\n variable = key[conf_prefix.size..-1].downcase\n\n self.store(variable, ENV[key])\n }\n\n after_initialize\n dump\n end", "def env\n\t\t@rootDir = Dir.new( @rootDir )\n\n\t\t# config file exist\n\t\tif Dir.exist?( @configDir )\n\t\t\t@configDir = Dir.new( @configDir )\n\t\telse\n\t\t\t@configDir = Dir.mkdir( @configDir )\n\t\tend\n\n\t\t@configFile = File.join( @configDir, @configFile )\n\n\t\t# parse config file\n\t\t@configFile = File.new( @configFile ) unless !File.exist?( @configFile )\n\n\t\t@configFile = JSON.parse( @configFile )\n\n\t\tif @configFile['webroot'] == nil\n\t\t\t@configFile['webroot'] = @@webroot\n\t\tend\n\n\t\tif @configFile['port'] == nil\n\t\t\t@configFile['port'] = @@port\n\t\tend\n\tend", "def environment_variables\n global_variables = @config.environment_variables\n process_vars = @config.process_options[@name] ? @config.process_options[@name]['env'] || {} : {}\n process_local_vars = @config.local_process_options[@name] ? @config.local_process_options[@name]['env'] || {} : {}\n global_variables.merge(process_vars.merge(process_local_vars)).each_with_object({}) do |(key, value), hash|\n hash[key.to_s] = value.to_s\n end\n end", "def env_vars\n env = {\n \"ANSIBLE_NET_USERNAME\" => auth.userid || \"\",\n \"ANSIBLE_NET_PASSWORD\" => auth.password || \"\",\n \"ANSIBLE_NET_AUTHORIZE\" => auth.authorize ? \"1\" : \"0\"\n }\n\n env[\"ANSIBLE_NET_AUTH_PASS\"] = auth.become_password || \"\" if auth.authorize\n env[\"ANSIBLE_NET_SSH_KEYFILE\"] = network_ssh_key_file if auth.auth_key\n env\n end", "def load_vars\n config = YAML.load_file(@config_file)\n @dev_port = config[\"development\"][\"port\"] ||= @default_dev_port\n @dev_pid = config[\"development\"][\"pid\"] ||= @default_dev_pid\n @dev_log = config[\"development\"][\"log\"] ||= @default_dev_log\n @prod_port = config[\"production\"][\"port\"] ||= @default_prod_port\n @prod_pid = config[\"production\"][\"pid\"] ||= @default_prod_pid\n @prod_log = config[\"production\"][\"log\"] ||= @default_prod_log\nend", "def parse envfile\n path = Pathname.new envfile\n update case path.extname\n when '.pl', '.perl' then parse_perl path\n when '.js', '.json' then parse_json path\n when '.yml', '.yaml' then parse_yaml path\n else parse_xaicron path\n end\n end", "def apply_environment_defaults\n @format = env(:format, @format) if @format.nil?\n @autopath = env(:autopath, @autopath) if @autopath.nil?\n @files = env(:files, @files) if @files.empty?\n @match = env(:match, @match) if @match.empty?\n @tags = env(:tags, @tags) if @tags.empty?\n @units = env(:units, @units) if @units.empty?\n @requires = env(:requires, @requires) if @requires.empty?\n @loadpath = env(:loadpath, @loadpath) if @loadpath.empty?\n end", "def initialize( location = 'stage', env_file = File.expand_path(\"#{__FILE__}/../../config/stage.sh\"))\n @location = location\n @env_file = env_file\n envfile_hash = process_env_file( env_file )\n #ENV explicit settings override values found in a locations config file\n @data = Hash[ SQA_ECOMM_SERVER_URL: ENV.fetch( 'SQA_ECOMM_SERVER_URL', envfile_hash['SQA_ECOMM_SERVER_URL'] ),\n SQA_ECOMM_API_SERVER_URL: ENV.fetch( 'SQA_ECOMM_API_SERVER_URL', envfile_hash['SQA_ECOMM_API_SERVER_URL'] ),\n SQA_ECOMM_DB_SERVER: ENV.fetch( 'SQA_ECOMM_DB_SERVER', envfile_hash['SQA_ECOMM_DB_SERVER'] ),\n SQA_ECOMM_DB: ENV.fetch( 'SQA_ECOMM_DB', envfile_hash['SQA_ECOMM_DB'] ),\n SQA_ECOMM_DB_UPDATE_USER: ENV.fetch( 'SQA_ECOMM_DB_UPDATE_USER', envfile_hash['SQA_ECOMM_DB_UPDATE_USER'] ),\n SQA_ECOMM_DB_UPDATE_PW: ENV.fetch( 'SQA_ECOMM_DB_UPDATE_PW', envfile_hash['SQA_ECOMM_DB_UPDATE_PW'] ),\n SQA_ECOMM_DB_READONLY_USER: ENV.fetch( 'SQA_ECOMM_DB_READONLY_USER', envfile_hash['SQA_ECOMM_DB_READONLY_USER'] ),\n SQA_ECOMM_DB_READONLY_PW: ENV.fetch( 'SQA_ECOMM_DB_READONLY_PW', envfile_hash['SQA_ECOMM_DB_READONLY_PW'] ),\n SQA_ORACLE_DB_SERVER: ENV.fetch( 'SQA_ORACLE_DB_SERVER', envfile_hash['SQA_ORACLE_DB_SERVER'] ),\n SQA_ORACLE_DB_UPDATE_USER: ENV.fetch( 'SQA_ORACLE_DB_UPDATE_USER', envfile_hash['SQA_ORACLE_DB_UPDATE_USER'] ),\n SQA_ORACLE_DB_UPDATE_PW: ENV.fetch( 'SQA_ORACLE_DB_UPDATE_PW', envfile_hash['SQA_ORACLE_DB_UPDATE_PW'] ),\n SQA_ORACLE_DB_READONLY_USER: ENV.fetch( 'SQA_ORACLE_DB_READONLY_USER', envfile_hash['SQA_ORACLE_DB_READONLY_USER'] ),\n SQA_ORACLE_DB_READONLY_PW: ENV.fetch( 'SQA_ORACLE_DB_READONLY_PW', envfile_hash['SQA_ORACLE_DB_READONLY_PW'] ),\n SQA_HJ_DB_SERVER: ENV.fetch( 'SQA_HJ_DB_SERVER', envfile_hash['SQA_HJ_DB_SERVER'] ),\n SQA_HJ_DB: ENV.fetch( 'SQA_HJ_DB', envfile_hash['SQA_HJ_DB'] ),\n SQA_HJ_DB_UPDATE_USER: ENV.fetch( 'SQA_HJ_DB_UPDATE_USER', envfile_hash['SQA_HJ_DB_UPDATE_USER'] ),\n SQA_HJ_DB_UPDATE_PW: ENV.fetch( 'SQA_HJ_DB_UPDATE_PW', envfile_hash['SQA_HJ_DB_UPDATE_PW'] ),\n SQA_HJ_DB_READONLY_USER: ENV.fetch( 'SQA_HJ_DB_READONLY_USER', envfile_hash['SQA_HJ_DB_READONLY_USER'] ),\n SQA_HJ_DB_READONLY_PW: ENV.fetch( 'SQA_HJ_DB_READONLY_PW', envfile_hash['SQA_HJ_DB_READONLY_PW'] ),\n SQA_RUDI_SERVER: ENV.fetch( 'SQA_RUDI_SERVER', envfile_hash['SQA_RUDI_SERVER'] ),\n SQA_RUDI_VERSION: ENV.fetch( 'SQA_RUDI_VERSION', envfile_hash['SQA_RUDI_VERSION'] ),\n SQA_UNIBLAB_SERVER: ENV.fetch( 'SQA_UNIBLAB_SERVER', envfile_hash['SQA_UNIBLAB_SERVER'] ),\n SQA_UNIBLAB_VERSION: ENV.fetch( 'SQA_UNIBLAB_VERSION', envfile_hash['SQA_UNIBLAB_VERSION'] ) ]\n end", "def set_env\n env = (container[:env] ||= [])\n\n # static data\n metadata = release_doc_metadata\n [:REVISION, :TAG, :DEPLOY_ID, :DEPLOY_GROUP].each do |k|\n env << {name: k, value: metadata.fetch(k.downcase).to_s}\n end\n\n [:PROJECT, :ROLE].each do |k|\n env << {name: k, value: template[:spec][:template][:metadata][:labels][k.downcase].to_s}\n end\n\n # dynamic lookups for unknown things during deploy\n {\n POD_NAME: 'metadata.name',\n POD_NAMESPACE: 'metadata.namespace',\n POD_IP: 'status.podIP'\n }.each do |k, v|\n env << {\n name: k,\n valueFrom: {fieldRef: {fieldPath: v}}\n }\n end\n\n if needs_secret_sidecar?\n vault_config = VaultClient.client.config_for(@doc.deploy_group.vault_instance)\n raise StandardError, \"Could not find Vault config for #{@doc.deploy_group.permalink}\" unless vault_config\n\n sidecar_env = (sidecar_container[:env] ||= [])\n {\n VAULT_ADDR: vault_config['vault_address'],\n VAULT_SSL_VERIFY: vault_config['tls_verify']\n }.each do |k, v|\n sidecar_env << {\n name: k,\n value: v.to_s\n }\n end\n end\n end", "def build_environment(autoinst)\n environment = {\n \"AYTESTS_FILES_DIR\" => files_dir.to_s,\n \"AYTESTS_PROVIDER\" => provider.to_s,\n \"AYTESTS_WEBSERVER_PORT\" => WEBSERVER_PORT,\n \"AYTESTS_MAC_ADDRESS\" => MAC_ADDRESS\n }\n linuxrc_file = autoinst.sub_ext(\".linuxrc\")\n environment[\"AYTESTS_LINUXRC\"] = File.read(linuxrc_file).chomp if linuxrc_file.exist?\n environment\n end", "def env_values\n @parse[@env] || @parse[@env.to_s] || {}\n end", "def load_envvars\n Pkg::Params::ENV_VARS.each do |v|\n if var = ENV[v[:envvar].to_s]\n case v[:type]\n when :bool\n self.instance_variable_set(\"@#{v[:var]}\", Pkg::Util.boolean_value(var))\n when :array\n self.instance_variable_set(\"@#{v[:var]}\", string_to_array(var))\n else\n self.instance_variable_set(\"@#{v[:var]}\", var)\n end\n end\n end\n end", "def parse(env); env; end", "def env_vars\n { \"OS_CLIENT_CONFIG_FILE\" => os_credentials_file }\n end", "def env(variable_name, variable_value, &block); end", "def args_env_vars\r\n puts \"SMS Order Notifier for Blomming, release: 1 February 2014, by: [email protected]\"\r\n puts \"CTRL+C to stop\"\r\n\r\n # get necessary environment variables\r\n @username = ENV['SMSNOTIFIER_SKEBBY_USERNAME']\r\n @password = ENV['SMSNOTIFIER_SKEBBY_PASSWORD'] \r\n @seller_cell_number = ENV['SMSNOTIFIER_SELLER_PHONENUM']\r\n\r\n if @username.nil? || @password.nil? || @seller_cell_number.nil?\r\n puts \"please set environment variables:\"\r\n puts \"export SMSNOTIFIER_SKEBBY_USERNAME=your_skebby_username\"\r\n puts \"export SMSNOTIFIER_SKEBBY_PASSWORD=your_skebby_password\"\r\n puts \"export SMSNOTIFIER_SELLER_PHONENUM=seller_cell_number as: <country_prefix><number> by example: 391234567890\"\r\n exit 1\r\n end\r\n\r\n # get Blomming YAML configuration filename\r\n if ARGV[0].nil?\r\n puts \" usage: #{$0} <blomming_config_file.yml>\" \r\n puts \"example: ruby #{$0} $CONFIG\"\r\n exit 2\r\n end\r\n\r\n blomming_config_file = ARGV[0]\r\nend", "def read_env\n dir_path = Dir.pwd\n DataCache.env_hash ||= {}\n loop do\n path = File.join dir_path, TddDeploy::Environ::ENV_FNAME\n if File.exists? TddDeploy::Environ::ENV_FNAME\n line_no = 0\n if f = File.new(path, 'r')\n begin\n f.each do |line|\n line_no += 1\n if line =~ /^\\s*(\\w+)\\s*=\\s*(.*?)\\s*$/\n key = $1.downcase\n if self.env_types.keys.include? key\n self.send \"#{key}=\".to_sym, $2\n # self.env_hash[key] = self.env_types[key] == :list ? self.str_to_list($2) : $2.to_s\n else\n raise ::ArugmentError.new(\"TddDeploy::Environ#read_env: Error in #{TddDeploy::Error::ENV_FNAME}: #{line_no}: Illegal Key: #{key}\")\n end\n else\n raise ::ArugmentError.new(\"TddDeploy::Environ#read_env: Error in #{TddDeploy::Error::ENV_FNAME}: #{line_no}: Unmatched Line: #{line}}\")\n end\n end\n ensure\n f.close\n end\n # add any missing env keys\n (self.env_types.keys - self.env_hash.keys).each do |key|\n case self.env_types[key]\n when :pseudo then next\n when :capfile then next\n when :list\n self.env_hash[key] = str_to_list(self.env_defaults[key])\n else\n self.env_hash[key] = self.env_defaults[key]\n end\n end\n return self.env_hash\n else\n raise ::RuntimeError.new(\"Unable to open #{path} for reading\")\n end\n elsif dir_path.length <= 1\n # reached root level, so initialize to defaults and exit\n return nil\n else\n # move to parent directory\n dir_path = File.expand_path('..', dir_path)\n end\n end\n nil\n end", "def load!\n configs = {}\n @array.each_with_index do |obj, idx|\n next unless obj.start_with?('--' + @env_prefix)\n\n value = extract_value(obj, idx + 1)\n key = obj.split('=').first\n .sub(/^--#{@env_prefix}_?/, '')\n .downcase.split('__')\n recursive_set(configs, key, split_env_string(value))\n end\n configs\n end", "def apply_environment_overrides\n @format = env(:format, @format)\n @autopath = env(:autopath, @autopath)\n @files = env(:files, @files)\n @match = env(:match, @match)\n @tags = env(:tags, @tags)\n @units = env(:units, @units)\n @requires = env(:requires, @requires)\n @loadpath = env(:loadpath, @loadpath)\n end", "def cloud_config_data\n env_run_cmds = []\n self.options.each_pair do |key, properties|\n if properties[:environment] && !properties[:value].nil?\n escaped_value = properties[:value].to_s.gsub(/\"/, '\\\\\\\\\\\\\\\\\\\"')\n env_run_cmds.push \"echo \\\"#{key}=\\\\\\\"#{escaped_value}\\\\\\\"\\\" >> /etc/environment\"\n end\n end\n\n user_data_config = self.cloud_config.dup\n user_data_config['runcmd'] ||= []\n user_data_config['runcmd'] = env_run_cmds.concat(user_data_config['runcmd'])\n return \"#cloud-config\\n#{user_data_config.to_yaml}\"\n end", "def config=(env, override_configurations = T.unsafe(nil)); end", "def parse_config \n path = \"#{Rails.root}/config/mebla.yml\"\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def _load_env\n require 'yaml'\n r_var = _open_sefile('env3.yml') { |f| YAML.load(f) }\n @var.delete :file_open_raised\n r_var.each { |k,v| @var[k] = v } if r_var\nend", "def local_env(body)\n env = ''\n vtmp = @var.dup\n vtmp[:pub_rsa] = '[PUBLIC RSA KEY]'\n vtmp[:prv_rsa] = '[PRIVATE RSA KEY]'\n vtmp[:user_keys] = @var[:user_keys].collect { |k,_| k }\n vtmp.each { |k,v| env << \"#{(k.to_s + ' '*20)[0,20]} => #{v.inspect}\\n\" }\n _notice \" -- Current Environment Variables --\\n#{env}\"\nend", "def configure_data\n [:bitcask, :eleveldb, :merge_index].each {|k| env[k] ||= {} }\n env[:bitcask][:data_root] ||= (data + 'bitcask').expand_path.to_s\n env[:eleveldb][:data_root] ||= (data + 'leveldb').expand_path.to_s\n env[:merge_index][:data_root] ||= (data + 'merge_index').expand_path.to_s\n env[:riak_core][:slide_private_dir] ||= (data + 'slide-data').expand_path.to_s\n env[:riak_core][:ring_state_dir] ||= (data + 'ring').expand_path.to_s\n\n TS_NODE_DIRECTORIES.each do |dir|\n env[:riak_core][:\"platform_#{dir}_dir\"] ||= send(dir).to_s\n end\n end", "def to_env\n CONFIGURABLE_WITH_ENV.each_with_object({}) do |option, env|\n unless (value = @config[option]).nil?\n env[\"#{ ViteRuby::ENV_PREFIX }_#{ option.upcase }\"] = value.to_s\n end\n end.merge(ViteRuby.env)\n end", "def set_config(env, override_configurations = T.unsafe(nil)); end", "def config\n params = {}\n\n roots.each do |root|\n file = File.join(root, \"config/autoprefixer.yml\")\n\n next unless File.exist?(file)\n\n parsed = ::YAML.load_file(file)\n next unless parsed\n\n params = parsed\n\n break\n end\n\n params = params.symbolize_keys\n params[:env] ||= Rails.env.to_s\n params\n end", "def set_vars(vars_dictionary)\n command = <<~HEREDOC\n echo \"setting Environment Variables\"\n sources ~/.bashec\n HEREDOC\n\n vars_dictionary.each do |key, value|\n command = <<~HEREDOC\n if [ -z \"#{key}\"]; then\n echo \"export#{key}=#{value}\" >> ~/.bashrc\n fi\n HEREDOC\n end\n\n return command\nend", "def set_from_env\n ENV_TO_KEY.each do |env_key, key|\n next unless (value = ENV[env_key])\n\n type, key = key if key.is_a? Array\n\n value =\n case type\n when :int then value.to_i\n when :float then value.to_f\n when :bool then !%w[0 false].include?(value.strip.downcase)\n when :list then value.split(/[ ,]/)\n when :dict then Hash[value.split(/[&,]/).map { |kv| kv.split('=') }]\n else value\n end\n\n send(\"#{key}=\", value)\n end\n end", "def env=(environment); end", "def env=(environment); end", "def export_config_to_env\n ENV['TAOBAO_API_KEY'] = config['app_key']\n ENV['TAOBAO_SECRET_KEY'] = config['secret_key']\n ENV['TAOBAO_ENDPOINT'] = config['endpoint']\n ENV['TAOBAO_AUTHORIZE'] = config['authorize']\n ENV['TAOBAO_TOKEN'] = config['token']\n ENV['TAOBAO_AUTHORIZE_REDIRECT_URI'] = config['authorize_redirect_uri']\n ENV['TAOBAO_TOKEN_REDIRECT_URI'] = config['token_redirect_uri']\n end", "def setenv(softworkdir,project,chipIsModem,apconnection)\n\t#puts \"burp\"\n # Setup some environement variables.\n $PROJNAME = project\n $SOFT_WORKDIR = softworkdir\n $TOOLPOOL = $SOFT_WORKDIR + \"/toolpool\" \n $PLUGINS_WORKDIR = $TOOLPOOL + \"/plugins\"\n $SCRIPT_WORKDIR = $TOOLPOOL + \"/scripts\"\n $SCRIPT_GENDIR = $SCRIPT_WORKDIR + \"/ChipStd\"\n $SCRIPT_PROJDIR = $SCRIPT_WORKDIR + \"/\" + $PROJNAME.split[0]\n $COMMON_PLUGINS_WORKDIR = \"./rbbase/common/plugins\"\n\n if(chipIsModem.strip.casecmp(\"yes\") == 0)\n $CHIP_IS_MODEM = true\n else\n $CHIP_IS_MODEM = false\n end\n\n if(apconnection.strip.casecmp(\"yes\") == 0)\n $APCONNECTION = true\n else\n $APCONNECTION = false\n end\n\n # Add the path the working dir where the script under development are stored. \n $LOAD_PATH.unshift(\"./rbbase/\")\n $LOAD_PATH.unshift($TOOLPOOL)\n $LOAD_PATH.unshift($PLUGINS_WORKDIR)\n $LOAD_PATH.unshift($COMMON_PLUGINS_WORKDIR)\n $LOAD_PATH.unshift($SCRIPT_WORKDIR) \n $LOAD_PATH.unshift($SCRIPT_GENDIR) \n $LOAD_PATH.unshift($SCRIPT_PROJDIR) \n\t#$LOAD_PATH.unshift($SCRIPT_WORKDIR + \"/common\")\nend", "def environment\n return @vars unless @vars.nil?\n\n # If not set, Try to find them...\n glob_path = File.join(@deployment_home, @settings.env_file_glob_path)\n regexp_find = glob_path.gsub(/\\*/, '(.*)')\n Dir[glob_path].each do | file_name |\n # Get the environment name from the file part of the glob path:\n # e.g. given ./environments/ci_mgt/kb8or.yaml\n # get ci_mgt from ./environments/*/kb8or.yaml\n /#{regexp_find}/.match(file_name)\n env_name = $1\n if env_name == @env_name\n debug \"env=#{env_name}\"\n # Ensure we set the defaults as vars BEFORE we add environment specifics:\n @vars = @settings.defaults\n env_vars = Context.resolve_env_file(file_name)\n @vars = @vars.merge(env_vars)\n @vars = @vars.merge(@overridden_vars)\n @vars['env'] = env_name\n @environment_file = file_name\n break\n end\n end\n # Now finaly, update the settings now we know the environment!\n unless @vars\n @vars = {}\n end\n @settings = @settings.new(@vars)\n update_k8context\n debug \"vars=#{vars}\"\n @vars\n end", "def forward_local_env(env_variable_patterns); end", "def initialize(config)\n\n @config = CONFIG.merge config # apply given configuration over defaults\n\n # Sanity check the supplied config for required sane values\n CONFIG_REQUIRED.each { |k| abort \"A #{k} is required\" unless @config.has_key? k }\n @config.each { |k,v| abort(\"An empty #{k} cannot be used\") if v.nil? or (v.respond_to?(:empty) && v.empty?) }\n\n log \"Initialising environment '#{config(:name)}'\"\n\n # Uncomment the below line to prohibit source and destination being the same\n abort(\"source and destination are the same\") if config(:source)==config(:destination)\n\n @paths = {source: @config[:source], destination: Dir.mktmpdir}\n if File.basename(@paths[:source]) == 'content'\n paths[:root] = File.dirname(@paths[:source])\n else\n paths[:root] = path(:source)\n paths[:source] = path(:root) + '/content'\n end\n paths[:config] = path(:root) + '/config.js'\n\n # Check paths are valid\n paths.each do |name,path|\n do_or_die(File.exists?(path), \"#{name} path '#{path}' is good\",\n \"#{name} path #{path} not found\")\n end\n\n # hold hidden tags as array\n @config[:hide_tags] = config(:hide_tags) ? config(:hide_tags).split(',') : []\n\n # hold replace regexes as hash http://rubular.com/r/MYNXsibGh3\n if config(:replace)\n h = {}\n config(:replace).scan(/([^\\s]\\w+):(.*?)(?=($|\\s\\w+:))/) { |k,v| h[k] = v }\n @config[:replace] = h\n end\n\n # Load Ghost configuration file\n do_or_die(gconfig = File.read(path(:config)),\"read config ok\",\"read config failed\")\n gconfig.gsub!(/^\\s*?\\/\\/.*?\\n/m,'') # remove comments from config\n \n # Get database file\n match_dbfile = gconfig.match(/#{config(:ghost_environment)}:\\s*{.*?database:\\s*{.*?connection:\\s*{.*?filename:.*?([\\w-]*?\\.db)/m)\n dbfile = match_dbfile.nil? ? abort(\"unable to find database file name for '#{config(:ghost_environment)}' environment in configuration file\") : match_dbfile[1]\n paths[:database] = path(:source) + '/data/' + dbfile\n \n # Open database\n dbfile = path(:database)\n do_or_die(File.exists?(dbfile),\"database #{dbfile} found\",\n \"Cannot find database file #{dbfile}\")\n do_or_die(self.db = SQLite3::Database.new(dbfile, readonly: true),'database opened',\n \"Could not initialise database #{dbfile}\")\n db.results_as_hash = true\n \n # Load settings from database\n @settings = {}\n query = \"select key,value from settings\"\n do_or_die(db.execute(query).each{|s| @settings.update s[0].to_sym => s[1]},\n 'read settings','unable to read settings')\n #settings.each { |k,v| log \"setting(#{k}) = #{v}\" }\n \n # Set the URL that will be used as the root on exported blogs\n if config.include?(:url)\n settings[:url] = config(:url)\n else\n # Get site URL from config file and put it into settings array\n match_url = gconfig.match(/#{config(:ghost_environment)}:\\s*{.*?url:\\s*'(.*?)'/m)\n url = match_url.nil? ? abort(\"unable to find url for #{config(:ghost_environment)} environment\") : match_url[1]\n settings[:url] = url\n end\n \n # Build posts query\n @queries = {}\n queries[:posts] = 'SELECT posts.*, users.name as author_name from posts' \\\n << ' INNER JOIN users ON posts.author_id = users.id'\n \n whand = ' WHERE' # will change to 'AND' for subsequent clauses\n unless config(:with_tags).nil? \n queries[:posts] << whand << ' EXISTS (' \\\n << 'SELECT 1 FROM posts_tags' \\\n << ' INNER JOIN tags ON tags.id = posts_tags.tag_id' \\\n << ' WHERE posts_tags.post_id = posts.id' \\\n << ' AND tags.name IN (' \\\n << config(:with_tags).split(',').map {|t| \"'#{t}'\" }.join(',') \\\n << '))' \n whand = ' AND'\n end\n \n unless config(:without_tags).nil?\n queries[:posts] << whand << ' NOT EXISTS (SELECT 1 FROM posts_tags' \\\n << ' INNER JOIN tags ON tags.id = posts_tags.tag_id' \\\n << ' WHERE posts_tags.post_id = posts.id' \\\n << ' AND tags.name IN (' \\\n << config(:without_tags).split(/[ ,]/).map {|t| \"'#{t}'\" }.join(',') \\\n << '))' \n whand = ' AND'\n end\n \n queries[:posts] << whand << \" posts.status == 'published'\" if config(:published) \n queries[:posts] << ' ORDER BY posts.published_at DESC'\n\n # Debugging limit\n #queries[:posts] << \" LIMIT #{config[:maximum_posts]}\" if config[:maximum_posts]\n queries[:posts] << \" LIMIT 1\" if @@limit_posts\n\n # Load export filters\n export_filters = []\n config(:export_filters).split(',').each do |f|\n f = f.to_s\n if match = f.match(/(\\S*?)\\?(.*)/)\n f = match[1]\n parameters = CGI.parse(match[2]).each_with_object({}){|(k,v),h| h[k.to_sym] = v.first}\n end\n log \"Loading #{f} export filter\"\n begin\n require_relative 'export_filters/export_'+f\n rescue LoadError\n abort(\"Failed to load export filter '#{f}'\")\n end\n export_filters << Object.const_get('ExportFilter_'+f).new(self,parameters)\n end\n\n # Run all posts through each filter\n db.execute(queries[:posts]) { |post| export_filters.each { |f| f.export_post(post) } }\n\n # Close the database\n db.close \n \n # Close all export filters\n export_filters.each { |f| f.close }\n\n # Run the publishers\n if config(:destination)\n require_relative 'publishers/publisher'\n Publisher.new(self).publish\n end\n\n # Remove temporary export directory\n FileUtils.rmtree(path(:destination), secure: true)\n\n end", "def load_overrides\n if ENV['PARAMS_FILE'] && ENV['PARAMS_FILE'] != ''\n if File.readable?(ENV['PARAMS_FILE'])\n project_root = self.instance_variable_get(\"@project_root\")\n packaging_root = self.instance_variable_get(\"@packaging_root\")\n self.config_from_yaml(ENV['PARAMS_FILE'])\n self.instance_variable_set(\"@project_root\", project_root) if project_root\n self.instance_variable_set(\"@packaging_root\", packaging_root) if packaging_root\n else\n fail \"PARAMS_FILE was set, but not to the path to a readable file.\"\n end\n end\n end", "def build_environment_hash\n parsed_variables = {}\n @env.each do |env_row|\n # Each row can potentially contain multiple environment\n # variables\n variables = extract_variables(env_row)\n\n variables.each do |variables_with_values|\n variables_with_values.each do |key, value|\n parsed_variables[key] = value\n end\n end\n end\n\n @override_envs.each do |env|\n parsed_variables = parsed_variables.merge env\n end\n\n parsed_variables\n end", "def configure var={}\n \t{path: './', version: '0.1.0', mode: 'production'}.merge(var)\n end", "def load_environment_file(f)\n do_or_die(File.exists?(f),\"Loading environments from #{f}\",\n \"Environment file #{f} does not exist\")\n supp_envs = YAML.load_file(f)\n supp_envs.each_with_object([]) do |(name,options),envs|\n\n # store the environment name inside its configuration hash\n options[:name] = name\n \n # translate alternative keywords for export filters\n %w(filter filters export-filters).each do |f|\n if options.include?(f) \n options[:export_filters] = options[f].split(/[ ,]/)\n options.delete(f) \n end \n end \n\n options = options.each_with_object({}){|(k,v),h| h[k.to_sym] = v} # symbolise keys\n\n # convert arrays into comma-delimited strings\n options = options.each_with_object({}) do |(k,v),h|\n h[k] = v.is_a?(Array) ? v.join(',') : v\n end\n\n # convert space-delimited into comma-delimited strings\n %i(destination with_tags without_tags).each do |f|\n options[f] = options[f].split(/[ ,]/).join(',') if options.include?(f)\n end\n\n envs << options # add hash to environments array\n end\n end", "def setup_config(environment, config_file, applicaton_root)\n begin\n config = YAML::load(File.open(config_file))[environment]\n @api_key = config['api-key'] unless config['api-key'].nil?\n @ssl_enabled = config['ssl'] unless config['ssl'].nil?\n @log_level = config['log-level'] unless config['log-level'].nil?\n @enabled = config['enabled'] unless config['enabled'].nil?\n @remote_port = config['remote-port'].to_i unless config['remote-port'].nil?\n @remote_host = config['remote-host'] unless config['remote-host'].nil?\n @adapter_name = config['adapter'] unless config['adapter'].nil?\n @work_dir = config['work_dir'] unless config['work_dir'].nil?\n @send_user_data = config['send-user-data'] unless config['send-user-data'].nil?\n\n @applicaton_root = applicaton_root\n\n log_config_info\n rescue Exception => e\n raise ConfigurationException.new(\"Unable to load configuration #{config_file} for environment #{environment} : #{e.message}\")\n end\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app. But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/bash '\n f.puts ' '\n f.puts 'function fcomp() '\n f.puts '{ '\n f.puts ' awk -v n1=$1 -v n2=$2 \\'BEGIN{ if (n1 == n2) print \"yes\"; else print \"no\"}\\' '\n f.puts '} '\n f.puts ' '\n f.puts 'function multiplyArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' mulResult=`echo $input1 $input2 | awk \\'{printf \"%d\", $1*$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function divideArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' divResult=`echo $input1 $input2 | awk \\'{printf \"%.2f\", $1/$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function scaleArgs() '\n f.puts '{ '\n f.puts ' inputToken=$1 '\n f.puts ' factor=$2 '\n f.puts ' numberToken=`echo $inputToken | tr -cd [0-9] ` '\n f.puts ' argPrefix=`echo $inputToken | sed -e \\'s/m$//g\\' | tr -cd [a-zA-Z-+:=] ` '\n f.puts ' multiplyArgs $numberToken $factor '\n f.puts ' # Result saved in mulResult variable '\n f.puts ' scaled_number=$mulResult '\n f.puts ' scaled_token=${argPrefix}${scaled_number}m '\n f.puts '} '\n f.puts ' '\n f.puts '# There are 5 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s /home/vcap/app /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n end\n end", "def build_environment(env, env_yaml, platform)\n # substitute vcenter resources from vcenter.yml for location defined in environment file\n env_yaml['vcenter'] = platform.vcenter[env_yaml['vcenter']]\n # merge component resources from environment file and platform definition\n # platform info will be inserted where not found in env files, env overrides will be unchanged\n #\n # Note: this function does not do error checking for components that exist in env file but\n # not in Platform definition. Such files will be retained but not have any Platform\n # component info. The Build command will run error checking before building, but to support\n # the debugging value of the list command only hash.merge! is performed at this point.\n platform.components.each do |component, _config|\n env_yaml['components'][component].merge!(platform.components[component]) { |_key, v1, _v2| v1 } unless env_yaml['components'][component].nil?\n end\n # substitute network and components for specified values from platform definition files\n env_yaml['components'].each do |component, _config|\n env_yaml['components'][component]['network'] = platform.network[env_yaml['components'][component]['network']]\n env_yaml['components'][component]['compute'] = platform.compute[env_yaml['components'][component]['compute']]\n unless env_yaml['components'][component]['runlist'].nil?\n env_yaml['components'][component]['runlist'] = run_list(env_yaml['components'][component]['runlist'], env_yaml['components'][component]['componentrole'], component)\n end\n end\n unless env_yaml['vcenter'].nil?\n # append env name to destination folder if appendenv == true\n env_yaml['vcenter']['destfolder'] += (env_yaml['vcenter']['appendenv'] ? '/' + env.to_s : '')\n # prepend app name to domain if appenddomain == true\n env_yaml['vcenter']['appenddomain'] ? env_yaml['vcenter']['domain'] = '.' + platform.name + '.' + env_yaml['vcenter']['domain'] : ''\n end\n env_yaml\n end", "def with_custom_env_variables(&block)\n saved_env = {}\n begin\n Git::Lib::ENV_VARIABLE_NAMES.each { |k| saved_env[k] = ENV[k] }\n return block.call\n ensure\n Git::Lib::ENV_VARIABLE_NAMES.each { |k| ENV[k] = saved_env[k] }\n end\n end", "def env_config\n @env_config ||= {}\n end", "def application_environment\n {\n infra: {\n provider: cluster.config.provider,\n },\n platform: {\n feature_set: current_feature_set,\n infra: {\n resources: {\n storage: {\n buckets:\n infra.settings.components.object_storage.components.each_with_object({}) do |(name, config), hash|\n hash[name] = Hash.new\n hash[name]['name'] = \"#{name}-#{bucket_base}\"\n config.to_hash.reject { |key| key.eql?(:services) }.each_pair { |key, value| hash[name][key] = value }\n end,\n services:\n infra.settings.components.object_storage.components.each_with_object({}) do |(name, config), hash|\n config.services.each do |dir|\n hash[dir] = \"#{name}\"\n end\n end\n },\n cdns: infra.settings.components.cdn.components.to_hash\n }\n }\n }\n }\n end", "def env_vars\n {\n \"VMWARE_USER\" => auth.userid || \"\",\n \"VMWARE_PASSWORD\" => auth.password || \"\",\n \"VMWARE_HOST\" => auth.host || \"\"\n }\n end", "def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend", "def read_config\n db_config = YAML.load_file('config/database.yml.production')\n set :db_user, db_config[rails_env][\"username\"]\n set :db_password, db_config[rails_env][\"password\"] \n set :db_name, db_config[rails_env][\"database\"]\nend", "def launcher_env_options(opts)\n if getenv(\"AUTH_TYPE\") == \"RANDOM\"\n ## each day we want to use different auth type ignoring weekends\n time = Time.now\n day_of_year = time.yday\n passed_weeks_of_year = time.strftime('%W').to_i - 1\n opts[:auth_type] = ALTERNATING_AUTH[\n (day_of_year - 2 * passed_weeks_of_year) % ALTERNATING_AUTH.size\n ]\n elsif getenv(\"AUTH_TYPE\")\n opts[:auth_type] = getenv(\"AUTH_TYPE\")\n end\n\n # workaround https://issues.jenkins-ci.org/browse/JENKINS-30719\n # that means to remove extra `\\` chars\n ENV['IMAGE_PRE'] = ENV['IMAGE_PRE'].gsub(/\\\\\\${/,'${') if ENV['IMAGE_PRE']\n\n keys = [:crt_path, :deployment_type,\n :hosts_spec, :auth_type,\n :ssh_key, :ssh_user,\n :app_domain, :host_domain,\n :rhel_base_repo,\n :dns, :set_hostnames,\n :use_rpm_playbook,\n :use_nfs_storage,\n :image_pre,\n :puddle_repo,\n :etcd_num,\n :pre_ansible,\n :ansible_url,\n :customized_ansible_conf,\n :kerberos_docker_base_image,\n :kerberos_kdc, :kerberos_keytab_url,\n :kerberos_docker_base_image,\n :kerberos_admin_server]\n\n keys.each do |key|\n val = getenv(key.to_s.upcase)\n opts[key] = val if val\n end\n\n opts[:use_rpm_playbook] = false unless to_bool(opts[:use_rpm_playbook])\n opts[:use_nfs_storage] = false unless to_bool(opts[:use_nfs_storage])\n end", "def load_env_variables(project)\r\n @project = project\r\n puts(\"project = #{project}\")\r\n\r\n if project.nil? then\r\n raise \"#{msg_prefix} > No project defined.\\n\"\\\r\n \"Call SET PROJECT=prj, replacing prj with your project.\"\r\n elsif !File.exist?(File.join(SAF::PROJECTS, project)) then\r\n raise \"#{msg_prefix} > Project not found: #{project}.\"\r\n end\r\n\r\n load_yml_config(project)\r\n\r\n @enable_remote_logging = load_boolean(\"ENABLE_REMOTE_LOGGING\", true)\r\n @logstash_host = load_var(\"LOGSTASH_HOST\", \"showinpoc01.fbfs.com\")\r\n @logstash_port = load_var(\"LOGSTASH_PORT\", 5514).to_i\r\n\r\n @aut_host = load_var(\"HOST\")\r\n @test_slave_host = load_var('REMOTE_HOST', 'showinpoc01.fbfs.com')\r\n @test_slave_port = load_var('REMOTE_PORT', 4444).to_i\r\n\r\n @in_browser = load_boolean(\"IN_BROWSER\", true)\r\n\r\n @browser = load_var('BROWSER', 'ie')\r\n\r\n @log_level = load_var(\"LOG_LEVEL\", \"Logger::INFO\")\r\n\r\n @screenshots = load_boolean(\"TAKE_SCREEN_SHOT\", true) # Was ist das?\r\n @screenshots_on_fail = load_boolean(\"TAKE_SCREEN_SHOT_ON_FAIL\", true)\r\n @screenshots_on_warning = load_boolean(\"TAKE_SCREEN_SHOT_ON_WARNING\",\r\n true)\r\n\r\n @yml_config.delete(\"project\")\r\n\r\n unless @yml_config.empty? then\r\n # TODO: Error class\r\n raise \"#{msg_prefix} > Unknown keys in \"\\\r\n \"#{project}'s #{SAF::PROJECT_ENV_YAML}:\\n\"\\\r\n \" #{@yml_config.keys.join(', ')}\"\r\n end\r\n end", "def load_integ_environment_vars\n env_file = File.join(__dir__, 'config/local_env_integ.yml')\n env_key_vals = YAML.load_file(env_file)\n %w[\n SqsQueueIntegTests_QueueUrl\n SqsQueueIntegTests_QueueRegion\n SqsQueueIntegTests_AccessId\n SqsQueueIntegTests_SecretKey\n ].each { |var| ENV[var] = env_key_vals.fetch(var) }\nend", "def parse_value(value)\n if value.include?('$env')\n fetch_environment_variable(value)\n else\n value\n end\n end", "def visit_EnvNode(node)\n node.env.each_pair do |key,val|\n ENV[key] = val\n end\n Yap::Shell::Execution::Result.new(status_code:0, directory:Dir.pwd, n:1, of:1)\n end", "def test_brackets\n set_env('VALUE', 'value')\n assert_equal(Config[:value], 'value')\n assert_equal(Config['VALUE'], 'value')\n end", "def generate_settings(cmdline, configuration)\n loaded = YAML::load(configuration)\n\n if loaded[:properties].nil?\n loaded[:properties] = {}\n end\n\n unless cmdline['--pattern'].nil? \n loaded[:vcs][:release_regex] = input['--pattern']\n end\n\n #User name override\n if cmdline['-c']\n (0..cmdline['-c']-1).each do |it|\n u = cmdline['<user>'][it]\n p = cmdline['<password>'][it]\n t = cmdline['<target>'][it]\n loaded[:task_systems].each do |ts|\n if ts[:name] == t\n ts[:usr] = u\n ts[:pw] = p\n end\n end\n end\n end\n \n unless cmdline['--properties'].nil? \n json_value = JSON.parse(cmdline['--properties'])\n loaded[:properties] = loaded[:properties].merge(json_value)\n end\n loaded[:verbosity] = Logging.calc_verbosity(cmdline)\n loaded \n end", "def conf\n @c ||= JSON.load(File.read('/etc/knife-kvm/config.json'))\nend", "def parse_config_file(path)\n return unless File.exists?(path)\n \n conf = YAML::load(ERB.new(IO.read(path)).result)[Rails.env]\n \n conf.each do |key,value|\n self.send(\"#{key}=\", value) if self.respond_to?(\"#{key}=\")\n end unless conf.nil?\n end", "def setup_docker_env_vars_str\n \"eval \\\"$(docker-machine env #{project_config['docker-machine']['name']})\\\" && \"\nend", "def ReadGlobalConfig()\n\n # Load config file\n begin\n conf = YAML.load_file(\"#{$confdir}/#{$globalConfFile}\")\n rescue\n puts \"Unable to locate #{$confdir}/#{$globalConfFile}\"\n conf = {}\n end\n\n Dir.glob(\"#{$confdir}/#{$globalConfDir}/*.yaml\") {|f|\n begin\n conf.merge!(YAML.load_file(f))\n rescue\n puts \"Unable to locate #{f}\"\n conf = {}\n end\n }\n\n $sections.each {|o|\n conf[o] = [] if conf[o].nil?\n }\n conf[:globalConfFile] = \"#{$confdir}/#{$globalConfFile}\"\n conf[:globalConfDir] = \"#{$confdir}/#{$globalConfDir}\"\n\n altConfFile = \"#{$curdir}/.rake/#{$globalConfFile}\"\n if File.exists?(altConfFile)\n begin\n puts \"Reading local config file #{altConfFile}\" if $verbose\n c = YAML.load_file(altConfFile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n }\n rescue\n puts \"Error loading #{altConfFile}\"\n end\n end\n \n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n end\n }\n\n return conf\nend", "def set_env(papers, site_host, site_name, nwo)\n ENV['REVIEW_REPOSITORY'] = nwo\n ENV['DOI_PREFIX'] = \"10.21105\"\n ENV['PAPER_REPOSITORY'] = papers\n ENV['JOURNAL_URL'] = site_host\n ENV['JOURNAL_NAME'] = site_name\n end", "def exports\n File.exist?(ENV_LOG) or return {}\n env = {}\n File.read(ENV_LOG).each_line do |row|\n (var, val) = row.strip.split(\"=\")\n env[var] = val\n end\n env\n end", "def load_environment!(opts=nil)\n env_path = File.join(root_path, 'sc-config')\n env_path = File.join(root_path, 'sc-config.rb') if !File.exists?(env_path)\n \n @environment = {}\n if File.exists?(env_path)\n f = File.read(env_path)\n eval(f) # execute the config file as if it belongs.\n end\n\n # Override any all options with load_opts\n if build_numbers = @load_opts[:build_numbers]\n @load_opts.delete(:build_numbers)\n build_numbers.each do | bundle_name, build_number |\n env = @environment[bundle_name.to_sym] ||= {}\n env[:build_number] = build_number\n end\n end\n \n (@environment[:all] ||= {}).merge!(@load_opts)\n\n end", "def global_config_from(machine)\n env = machine.env.config_global\n end", "def tools_setup(config)\n config[:tools].each_key do |name|\n tool = config[:tools][name]\n\n # populate name if not given\n tool[:name] = name.to_s if (tool[:name].nil?)\n\n # handle inline ruby string substitution in executable\n if (tool[:executable] =~ RUBY_STRING_REPLACEMENT_PATTERN)\n tool[:executable].replace(@system_wrapper.module_eval(tool[:executable]))\n end\n\n # populate stderr redirect option\n tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?)\n\n # populate background execution option\n tool[:background_exec] = BackgroundExec::NONE if (tool[:background_exec].nil?)\n\n # populate optional option to control verification of executable in search paths\n tool[:optional] = false if (tool[:optional].nil?)\n end\n end", "def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end", "def create_config_base\n # Create keys directory for environment\n FileUtils.cd(self.project_root) { FileUtils.mkdir_p \"config/environments/#{self.name}\" }\n FileUtils.cd(\"#{project_root}/config/environments/#{self.name}\") { FileUtils.mkdir_p %w{steps keys} }\n # Create ssh key for puppet user if environment is vagrant\n generate_puppet_user_keys('vagrant') if self.name == 'vagrant'\n end", "def read_dot_env(envs_root)\n defaultEnvFile = '.env.development'\n puts \"going to read env file from root folder #{envs_root}\"\n\n env_files = get_env_files(envs_root, defaultEnvFile)\n target_env_file_path = ''\n\n for path in env_files\n if File.exist?(path)\n target_env_file_path = path\n break\n end\n end\n\n dotenv = begin\n # https://regex101.com/r/cbm5Tp/1\n dotenv_pattern = /^(?:export\\s+|)(?<key>[[:alnum:]_]+)=((?<quote>[\"'])?(?<val>.*?[^\\\\])\\k<quote>?|)$/\n\n if File.exist?(target_env_file_path)\n raw = File.read(target_env_file_path)\n else\n defaultEnvPath = File.expand_path(File.join(envs_root, \"../#{defaultEnvFile}\"))\n unless File.exist?(defaultEnvPath)\n # try as absolute path\n defaultEnvPath = defaultEnvFile\n end\n defaultRaw = File.read(defaultEnvPath)\n raw = defaultRaw + \"\\n\" + raw if defaultRaw\n end\n\n raw.split(\"\\n\").inject({}) do |h, line|\n m = line.match(dotenv_pattern)\n next h if m.nil?\n\n key = m[:key]\n # Ensure string (in case of empty value) and escape any quotes present in the value.\n val = m[:val].to_s.gsub('\"', '\\\"')\n h.merge(key => val)\n end\n rescue Errno::ENOENT\n puts('**************************')\n puts(\"*** Missing #{defaultEnvFile} file ****\")\n puts('**************************')\n return [{}, false] # set dotenv as an empty hash\n end\n\n [dotenv, false]\nend", "def get_env(format, app, node = self.node)\n return '' unless node.attribute?(app)\n\n if node[app]['env'].nil?\n Chef::Log.info(\"Attribute 'env' for application '#{app}' is not defined!\")\n return ''\n end\n\n appenv = streamline_appenv(node[app]['env'])\n generate_config_part(format, 'settings', appenv)\n end", "def initialize\n configure_via_yaml\n configure_via_env\n end", "def import_env_file(path)\n return unless File.file?(path)\n File.readlines(path).each do |line|\n next if line.start_with?('#') || line.strip.empty?\n line_to_env(line)\n end\nend", "def configure_settings\n @env = deep_merge(env.dup, configuration[:env]) if configuration[:env]\n @vm = vm.merge(configuration[:vm]) if configuration[:vm]\n end", "def busser_env\n root = config[:root_path]\n gem_home = gem_path = remote_path_join(root, \"gems\")\n gem_cache = remote_path_join(gem_home, \"cache\")\n\n [\n shell_env_var(\"BUSSER_ROOT\", root),\n shell_env_var(\"GEM_HOME\", gem_home),\n shell_env_var(\"GEM_PATH\", gem_path),\n shell_env_var(\"GEM_CACHE\", gem_cache),\n ].join(\"\\n\")\n .tap { |str| str.insert(0, reload_ps1_path) if windows_os? }\n end", "def scan\n @mapping.each do |key, values|\n @overrides[key] = values.pop if values.last.is_a? Proc\n env_name = values.find { |v| ENV[v] }\n @storage[key] = if env_name\n ENV[env_name].empty? ? '' : YAML.parse(ENV[env_name]).to_ruby\n end\n end\n end", "def configure\n @environment = facts.fetch(\"chef_environment\"){\"development\"}.downcase\n @fqdn = facts.fetch(\"fqdn\"){\"\"}\n @app_names = facts.fetch(\"trebuchet\"){[]}\n end", "def test_Enviroment_006_GetEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_006_GetEnv\")\r\n puts2(\"#######################\")\r\n\r\n sEnvVarName = \"COMPUTERNAME\" # Is this one platform independent?\r\n\r\n puts2(\"\")\r\n puts2(\"Retrieve all OS variables using getenv()\")\r\n hMyEnvVars = getenv() # Get them all\r\n\r\n # Loop through the hash and display each variable name and its setting\r\n hMyEnvVars.each do | key, value |\r\n puts2(\" OS variable: \\\"#{key.to_s}\\\" is set to \\\"#{value}\\\" \")\r\n end\r\n\r\n puts2(\"\")\r\n puts2(\"Retrieve a specific OS variable using getenv\")\r\n hMyEnvVars = getenv(sEnvVarName)\r\n\r\n # Loop through the hash and display each variable name and its setting\r\n hMyEnvVars.each do | key, value |\r\n puts2(\" OS variable: \\\"#{key.to_s}\\\" is set to \\\"#{value}\\\" \")\r\n end\r\n\r\n end", "def construct_environment(envs)\n envs.each do |key, value|\n if value\n value = value.to_s\n value = nil if value.length == 0\n end\n ENV[key.to_s] = value\n end\nend", "def get_env_data(env)\n config_path = \"#{File.expand_path(\"../../\", __FILE__).gsub('features', '')}config/config.yml\"\n yml = YAML::load(File.read(config_path))\n yml[env.downcase]\nend", "def load(options = {})\n @provider_dir = Path.provider\n\n # load base\n @base_services = load_all_json(Path.named_path([:service_config, '*'], Path.provider_base), Config::Tag)\n @base_tags = load_all_json(Path.named_path([:tag_config, '*'], Path.provider_base), Config::Tag)\n @base_common = load_json( Path.named_path(:common_config, Path.provider_base), Config::Object)\n @base_provider = load_json( Path.named_path(:provider_config, Path.provider_base), Config::Provider)\n\n # load provider\n @nodes = load_all_json(Path.named_path([:node_config, '*'], @provider_dir), Config::Node)\n @common = load_json( Path.named_path(:common_config, @provider_dir), Config::Object)\n @secrets = load_json( Path.named_path(:secrets_config, @provider_dir), Config::Secrets)\n @common.inherit_from! @base_common\n\n # For the default environment, load provider services, tags, and provider.json\n log 3, :loading, 'default environment...'\n env('default') do |e|\n e.services = load_all_json(Path.named_path([:service_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.tags = load_all_json(Path.named_path([:tag_config, '*'], @provider_dir), Config::Tag, :no_dots => true)\n e.provider = load_json( Path.named_path(:provider_config, @provider_dir), Config::Provider, :assert => true)\n e.services.inherit_from! @base_services\n e.tags.inherit_from! @base_tags\n e.provider.inherit_from! @base_provider\n validate_provider(e.provider)\n end\n\n # create a special '_all_' environment, used for tracking the union\n # of all the environments\n env('_all_') do |e|\n e.services = Config::ObjectList.new\n e.tags = Config::ObjectList.new\n e.provider = Config::Provider.new\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n end\n\n # For each defined environment, load provider services, tags, and provider.json.\n environment_names.each do |ename|\n next unless ename\n log 3, :loading, '%s environment...' % ename\n env(ename) do |e|\n e.services = load_all_json(Path.named_path([:service_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.tags = load_all_json(Path.named_path([:tag_env_config, '*', ename], @provider_dir), Config::Tag, :env => ename)\n e.provider = load_json( Path.named_path([:provider_env_config, ename], @provider_dir), Config::Provider, :env => ename)\n e.services.inherit_from! env('default').services\n e.tags.inherit_from! env('default').tags\n e.provider.inherit_from! env('default').provider\n validate_provider(e.provider)\n end\n end\n\n # apply inheritance\n @nodes.each do |name, node|\n Util::assert! name =~ /^[0-9a-z-]+$/, \"Illegal character(s) used in node name '#{name}'\"\n @nodes[name] = apply_inheritance(node)\n end\n\n # do some node-list post-processing\n cleanup_node_lists(options)\n\n # apply control files\n @nodes.each do |name, node|\n control_files(node).each do |file|\n begin\n node.eval_file file\n rescue ConfigError => exc\n if options[:continue_on_error]\n exc.log\n else\n raise exc\n end\n end\n end\n end\n end", "def setup\n preference_file = \"#{defaults[:root_dir]}/config.yml\"\n preferences = {}\n if File.exists? preference_file\n require 'yaml'\n File.open(preference_file) { |file| preferences = YAML.load(file) }\n end\n base_file_variations(absolute_paths(defaults.merge(preferences)))\n end", "def app_config\n {\n env: Rails.env,\n host: ENV[\"RENDER_EXTERNAL_URL\"],\n veue: {\n env: ENV[\"VEUE_ENV\"] || \"dev\",\n revision: ENV[\"RENDER_GIT_COMMIT\"] || `git rev-parse HEAD`,\n branch: ENV[\"RENDER_GIT_BRANCH\"] || `git branch --show-current`,\n },\n service: {\n id: ENV[\"RENDER_SERVICE_ID\"],\n name: ENV[\"RENDER_SERVICE_NAME\"],\n pod: ENV[\"RENDER_POD_NAME\"],\n },\n appsignal: {\n key: ENV[\"APPSIGNAL_FRONTEND_KEY\"],\n },\n }\n end", "def process_config\n input = File.open(\"lib/templates/config_template.sh\",\"r\")\n config = input.read\n input.close()\n output = File.new(@bigframe_home + \"/conf/config.sh\", \"w\") \n if output\n output.syswrite(config %[@hadoop_home, @tpchds_local])\n end\n output.close()\n end", "def environ\n\t\tif @os.to_i == 0\n\t\t\tputs \"[\".light_red + \"X\".white + \"] Your target appears to be Winblows\".light_red + \"!\".white\n\t\t\tputs \"[\".light_red + \"X\".white + \"] This option is only available for *nix machines\".light_red + \"!\".white\n\t\telse\n\t\t\tputs \"[\".light_green + \"*\".white + \"] Testing for \".light_green + \"/proc/self/environ\".white + \" RCE Vuln\".light_green + \".....\".white\n\n\t\t\tfilez = [ \"proc/self/./environ\", \"proc/self/environ\" ]\n\n\t\t\t@ua=0\n\t\t\t@found=0\n\t\t\t@accept=0\n\t\t\twhile @found.to_i < 1\n\t\t\t\tfilez.each do |file|\n\t\t\t\t\tif $module_required['Min'].to_i == 0\n\t\t\t\t\t\t@thegoods=\"/#{file}\"\n\t\t\t\t\telse\n\t\t\t\t\t\t@thegoods=\"#{@stepstone}#{file}\"\n\t\t\t\t\tend\n\t\t\t\t\tbody = basicregex(@thegoods, 69)\n\t\t\t\t\t#Regex for /proc/self/environ file\n\t\t\t\t\tif body =~ /HTTP_USER_AGENT=/ or body =~ /HTTP_ACCEPT=/ or body =~ /DOCUMENT_ROOT=/ or body =~ /VHOST_ROOT=/ or body =~ /HTTP_HOST/\n\t\t\t\t\t\t@environ = 'true'\n\t\t\t\t\t\tif body =~ /HTTP_USER_AGENT=/\n\t\t\t\t\t\t\t@ua = 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif body =~ /HTTP_ACCEPT=/\n\t\t\t\t\t\t\t@accept = 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\t#Successful injection will match our regex, failure won't (concat on exec proves its working)\n\t\t\t\t\t\tif body =~ /:#{@rnd}:(.+):#{@rnd}:/ \n\t\t\t\t\t\t\t@envirores = $1 #make results available\n\t\t\t\t\t\tend\n\t\t\t\t\t\t@found = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\t@environ = 'false'\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif @found.to_i == 0\n\t\t\t\t\t@found = 2 #break cause we are out of file options to test, will use value to offset from true success...\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif @environ == 'true'\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] File Found: \".light_green + \"/proc/self/environ\".white\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] User-Agent is present in response\".light_green + \"!\".white if @ua.to_i == 1\n\t\t\t\tputs \"[\".light_green + \"*\".white + \"] Accept Header is present in response\".light_green + \"!\".white if @accept.to_i == 1\n\t\t\t\tenvirosupport\n\t\t\telse\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Sorry, \".light_red + \"/proc/self/environ\".white + \" doesn't appear to be available\".light_red + \".....\".white\n\t\t\t\tputs \"[\".light_red + \"X\".white + \"] Returning to Previous Menu\".light_red + \"...\".white\n\t\t\tend\n\t\tend\n\tend", "def construct_env host, opts\n env = additive_hash_merge(host[:host_env], opts[:host_env])\n\n env.each_key do |key|\n separator = host['pathseparator']\n separator = ':' if key == 'PATH' && (not host.is_powershell?)\n env[key] = env[key].join(separator)\n end\n env\n end", "def container_env(engine)\n env = if @cluster.env_variables['PLATFORM'].include?('aws')\n {\n 'KUBECONFIG' => '/kubeconfig',\n\n 'BRIDGE_AUTH_USERNAME' => @cluster.config_file.admin_credentials[0],\n 'BRIDGE_AUTH_PASSWORD' => @cluster.config_file.admin_credentials[1],\n 'BRIDGE_BASE_ADDRESS' => 'https://' + @cluster.tectonic_console_url,\n 'BRIDGE_BASE_PATH' => '/'\n }\n else\n {\n 'KUBECONFIG' => '/kubeconfig',\n\n 'BRIDGE_AUTH_USERNAME' => @cluster.tectonic_admin_email,\n 'BRIDGE_AUTH_PASSWORD' => @cluster.tectonic_admin_password,\n 'BRIDGE_BASE_ADDRESS' => 'https://' + @cluster.tectonic_console_url,\n 'BRIDGE_BASE_PATH' => '/'\n }\n end\n\n return env.map { |k, v| \"-e #{k}='#{v}'\" }.join(' ').chomp if engine == 'docker'\n return env.map { |k, v| \"--set-env #{k}='#{v}'\" }.join(' ').chomp if engine == 'rkt'\n raise 'unknown container engine'\n end", "def setup_env\n # use the correct ruby bin\n path = ENV[\"PATH\"].dup\n ruby_dir = RbConfig::CONFIG['bindir']\n if !path.include? ruby_dir then\n ENV[\"PATH\"] = \"#{ruby_dir}:#{path}\"\n end\n\n # stick ourselves in RUBYLIB to speedup exec time\n ENV[\"RUBYLIB\"] = File.expand_path(\"../../../..\", __FILE__)\n\n # load helper script\n ENV[\"RUBYOPT\"] = '-rbixby-client/script'\n end", "def import_config()\n # The config is top down.. anything after a [group] gets added as part\n # of that group until a new [group] is found. \n group = nil\n open(self.config_file).each do |line| \n line.strip!\n unless (/^\\#/.match(line))\n if(/\\s*=\\s*/.match(line))\n param, value = line.split(/\\s*=\\s*/, 2) \n var_name = \"#{param}\".chomp.strip\n value = value.chomp.strip\n new_value = ''\n if (value)\n if value =~ /^['\"](.*)['\"]$/\n new_value = $1\n else\n new_value = value\n end\n else\n new_value = ''\n end \n\n if group\n self.add_to_group(group, var_name, new_value)\n else\n self.add(var_name, new_value)\n end\n \n elsif(/^\\[(.+)\\]$/.match(line).to_a != [])\n group = /^\\[(.+)\\]$/.match(line).to_a[1]\n self.add(group, {})\n \n end\n end\n end \n end", "def private_env_vars\n {\n 'DISCONTINUE_API' => \"http://#{ENV['MACHINE_IP']}:8080\",\n 'AWS_REGION' => build.build_config.aws_region,\n 'S3_BUCKET' => build.build_config.aws_cache_bucket,\n 'AWS_ACCESS_KEY_ID' => build.build_config.aws_access_key,\n 'AWS_SECRET_ACCESS_KEY' => build.build_config.aws_access_secret,\n }\n end", "def environment_manifest(testdir)\n manifest = <<-MANIFEST\n File {\n ensure => directory,\n owner => puppet,\n mode => 0700,\n }\n\n file { \"#{testdir}\": }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/modules\",\n :manifestpath => \"#{testdir}/manifests\",\n :env_name => \"default environment\")}\n\n #{generate_environment(\n :modulepath => \"#{testdir}/testing-modules\",\n :manifestpath => \"#{testdir}/testing-manifests\",\n :env_name => \"legacy testing environment\")}\n\n file {\n \"#{testdir}/dynamic\":;\n \"#{testdir}/dynamic/testing\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/dynamic/testing/modules\",\n :manifestpath => \"#{testdir}/dynamic/testing/manifests\",\n :env_name => \"dynamic testing environment\")}\n\n file {\n \"#{testdir}/environments\":;\n \"#{testdir}/environments/testing\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/environments/testing/modules\",\n :manifestpath => \"#{testdir}/environments/testing/manifests\",\n :env_name => \"directory testing environment\")}\n\n file {\n \"#{testdir}/environments/testing_environment_conf\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/environments/testing_environment_conf/nonstandard-modules\",\n :manifestpath => \"#{testdir}/environments/testing_environment_conf/nonstandard-manifests\",\n :env_name => \"directory testing with environment.conf\")}\n\n file { \"#{testdir}/environments/testing_environment_conf/environment.conf\":\n ensure => file,\n content => '\n modulepath = nonstandard-modules:$basemodulepath\n manifest = nonstandard-manifests\n config_version = local-version.sh\n '\n }\n\n file {\n \"#{testdir}/environments/testing_environment_conf/local-version.sh\":\n ensure => file,\n content => '#! /usr/bin/env bash\n echo \"local testing_environment_conf\"'\n ;\n }\n\n ###################\n # Services\n\n file {\n \"#{testdir}/services\":;\n \"#{testdir}/services/testing\":;\n #{generate_module('service_mod',\n \"service testing environment\",\n \"#{testdir}/services/testing/modules\")}\n }\n\n #######################\n # Config version script\n\n file {\n \"#{testdir}/static-version.sh\":\n ensure => file,\n content => '#! /usr/bin/env bash\n echo \"static\"'\n ;\n }\n MANIFEST\n end", "def default_environment=(env); end", "def process_environment(env)\n request_data = { \n :url => env['REQUEST_URI'],\n :ip_address => env['HTTP_X_FORWARDED_FOR'] ? env['HTTP_X_FORWARDED_FOR'] : env['REMOTE_ADDR']\n }\n request_data[:user] = env['HTTP_USER_EMAIL'] if env['HTTP_USER_EMAIL']\n\n env['rack.input'].rewind\n parameters = ''\n env['rack.input'].each { |line| parameters += line }\n request_data[:parameters] = parameters if parameters\n\n server_name = env[\"SERVER_NAME\"].split('.').first\n env_name = @email_options['environment_name'][server_name]\n\n { :environment_data => env.map { |l| \" * #{l}\" }.join(\"\\n\"),\n :request_data => request_data,\n :server_name => server_name,\n :env_name => env_name\n }\n end", "def read_env(file = '.env')\n if !ENV['ENV']\n File.open(file, \"r\").each_line do |line|\n a = line.chomp(\"\\n\").split('=',2)\n a[1].gsub!(/^\"|\"$/, '') if ['\\'','\"'].include?(a[1][0])\n eval \"ENV['#{a[0]}']='#{a[1] || ''}'\"\n end\n end\n end", "def env_vars\n {\n \"AWS_ACCESS_KEY_ID\" => auth.userid || \"\",\n \"AWS_SECRET_ACCESS_KEY\" => auth.password || \"\",\n \"AWS_SECURITY_TOKEN\" => auth.auth_key\n }.delete_nils\n end", "def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end" ]
[ "0.70209014", "0.70209014", "0.70209014", "0.70209014", "0.68703663", "0.65631396", "0.6512647", "0.6511904", "0.6506707", "0.6472019", "0.64699167", "0.6466354", "0.6464643", "0.6440466", "0.643739", "0.6430409", "0.6411087", "0.63769996", "0.6376613", "0.6372308", "0.6335205", "0.63284534", "0.6314702", "0.6312619", "0.6309448", "0.6308119", "0.6292937", "0.62520987", "0.6193784", "0.6193427", "0.61646974", "0.61611515", "0.6151677", "0.61325234", "0.61078095", "0.6106085", "0.60990894", "0.60990894", "0.60944223", "0.6083591", "0.6073525", "0.6057645", "0.60421944", "0.60409147", "0.60353464", "0.60273415", "0.5990739", "0.5975612", "0.5970443", "0.5949164", "0.59458494", "0.59399575", "0.5936971", "0.59313107", "0.59305847", "0.59305847", "0.5921082", "0.5905556", "0.59008884", "0.5897855", "0.5896646", "0.58946455", "0.5890656", "0.58871293", "0.58868027", "0.5879676", "0.58792406", "0.5877162", "0.5876825", "0.5871728", "0.5856247", "0.5852478", "0.5849015", "0.58464766", "0.5838463", "0.5838387", "0.5835506", "0.5828765", "0.58264107", "0.58211714", "0.58171916", "0.58054876", "0.58033353", "0.5799038", "0.5797092", "0.5794831", "0.579432", "0.5793382", "0.57882625", "0.578108", "0.5777552", "0.5777385", "0.5768012", "0.5762755", "0.5755622", "0.57522917", "0.5743233", "0.5737158", "0.5732753", "0.5722582", "0.571241" ]
0.0
-1
GET /people GET /people.json
def index =begin search_inputs = params[:search_inputs] klass = class_for(search_inputs[:model]) || Person search_term = search_inputs[:search_term] || "" institutions = search_inputs[:institutions] || "" tag_list = search_inputs[:tag_list] || "" @records = Search.new(model: klass, search_term: search_term, tag_list: tag_list, institutions: institutions, page: params[:page]).search @search_inputs = params[:search_inputs] =end #@people = Person.all.order(:name).page(params[:page]).per(20) #@people = Person.all.limit(25) #@people = Person.all #@people = Person.all.order(:name).page(params[:page]) if params[:search_inputs].present? @search_inputs = OpenStruct.new(params[:search_inputs]) else @search_inputs = OpenStruct.new(model: "Person") end @records = Search.new(@search_inputs).search @records = @records.page(params[:page]).per(20) respond_to do |format| format.html format.js { render :file => "/people/search_people.js.erb" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end", "def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end", "def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def fetch_people\n @people = People.find(params[:id])\n end", "def people(query={})\n response = self.simple_client.get(\"/api/v1/people?#{query.to_query}\")\n # TODO modularize, re-use\n if response[\"page\"]\n return WillPaginate::Collection.create(response[\"page\"],response[\"per_page\"]) do |pager|\n pager.replace(response[\"people\"])\n pager.total_entries = response[\"total_entries\"]\n end\n else\n return response\n end\n end", "def index\n @people = User.order(:nickname).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @people }\n end\n end", "def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def index\n\t\t@people = People.all\n\t\t#render json: \"test\"\n\t\tresponse = @people\n\t\trender json: response\n\t\treturn response\n\tend", "def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end", "def show\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_person }\n end\n end", "def show\n \t@person = Person.find(params[:id])\n respond_to do |format|\n format.json { render json: @person, status: :ok }\t\n end \t \t\n end", "def index\n # this is like a 'select * from people' in SQL, but using ORM\n @people = Person.all \n\n # render is the return of our method and at the same time help us to render the object\n render json: @people \n end", "def show\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend", "def show\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend", "def search_people(query)\n get(\"/v1/search/people\", query: query)\n end", "def index\n respond_with(@people)\n end", "def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end", "def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end", "def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end", "def show\n if @person\n render json: @person\n else\n # :not_found is the http status code 404\n render status: :not_found\n end\n end", "def index\n @people = Person.all\n respond_with(@people)\n end", "def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end", "def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend", "def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end", "def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end", "def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end", "def getPeople\n\t\t\t\tbegin\n\t\t\t\t\t# Call getPeopleData method to retrieve data from SalesLoft API\n\t\t\t\t\t# [TODO] LOG [DEBUG MESSAGE]\n\t\t\t\t\tresponse_body = getPeopleData\n\t\t\t\t\t\n\t\t\t\t\t# Return Response\n\t render json: {\n\t \tresponse_data: response_body,\n\t \toperation: \"get_people_data\",\n\t \tstatus: \"success\",\n\t \ttimestamp:Time.now, \n\t \tuuid: SecureRandom.uuid, \n\t \tresponse_code: 200,\n\t \tmessage: \"Data Retrieved\"\n\t }\n \trescue StandardError => e\n \t\t# [TODO] LOG [ERROR MESSAGE]\n \t\trender json: {\n\t \tresponse_data: e.message,\n\t \toperation: \"people_data\",\n\t \tstatus: \"error\",\n\t \ttimestamp:Time.now, \n\t \tuuid: SecureRandom.uuid, \n\t \tresponse_code: 500,\n\t \tmessage: \"Error Occured\"\n\t } \n \tend # End rescue block\n\t\t\tend", "def index\n @people = Person.paginate(:page => params[:offset], :per_page => 20)\n\n people_hash()\n respond_to do |format|\n format.html\n format.json { render :json => @people_hash }\n format.xml { render :xml => @people_hash }\n end\n end", "def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end", "def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end", "def index\n @people = Person.where( :user_id => current_user.id)\n if current_user.role? :admin \n @people = Person.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @people }\n end\n end", "def people\n Harvest::Resources::Person\n end", "def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end", "def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end", "def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end", "def show\n @person_search = PersonSearch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_search }\n end\n end", "def index\n @people = People.all\n end", "def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end", "def get\n @person\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { respond_with @person }\n end\n end", "def get_people\n return @people\n end", "def index\n @people_tasks = TasksPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people_tasks }\n end\n end", "def people\n success? ? @data['people'] : nil\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @person_hash }\n format.xml { render :xml => @person_hash }\n end\n end", "def index\n\n @people = Person.filter(params.slice(:name_like))\n @people = @people.where([\"union_id = ?\", current_person.union_id]) if request.format.json? && !owner?\n @people = @people.where(\"not invited_by_id is null\").order([:last_name, :first_name, :id])\n \n respond_to do |format|\n format.html \n format.json \n end\n end", "def index\n\t\t@people = Person.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @people }\n\t\tend\n\tend", "def people(term, params = {})\n args = '&' + paramify(params) unless params.empty?\n get(\"/catalog/people?term=#{term}#{args}\")\n end", "def show\n\t\t@household = Household.find(params[:id])\n\t\t@people = @household.people\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @household }\n\t\tend\n\tend", "def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end", "def show\n @person = Person.find(params[:id])\n respond_with(@person)\n end", "def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @people = Person.all\n end", "def index\n @personas = Persona.all\n @users = User.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end", "def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end", "def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def parse_json\n people = JSON.parse(self.get_response_body)\n end", "def index\n \t@people = Person.all\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end", "def index\n @root = \"people\"\n \n @people = Person.find(:all)\n end", "def show\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_person }\n end\n end", "def index\n @people = do_search_people(@person, :friends, :with_tags => !request.xhr?,\n :url => hash_for_contacts_path)\n end", "def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end", "def people(company_id, project_id=nil)\n url = project_id ? \"/projects/#{project_id}\" : \"\"\n url << \"/contacts/people/#{company_id}\"\n records \"person\", url\n end", "def people\n @people = Person.find(:all, :order => 'family_name, given_name')\n\n respond_to do |format|\n format.html # people.html.erb\n format.xml { render :xml => @people }\n end\n end", "def show\n @person = Person.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { render :json => @person.to_json(:include => [:fieldvalues, :address, :city, :province]) }\n end\n end", "def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end", "def person_search(fname, lname, where)\n\n base_url = \"https://proapi.whitepages.com/find_person/1.0/?api_key=8249b41718b02c013694000c6900061e;outputtype=JSON\"\n url = \"#{base_url};firstname=#{fname};lastname=#{lname};where=#{where}\"\n uri = URI.parse(url)\n connection = Net::HTTP.new(uri.host, 443)\n connection.use_ssl = true\n\n resp = connection.request_get(uri.path + '?' + uri.query)\n\n### make sure to throw an error if we get a 200 returned\n if resp.code != '200'\n raise \"web service error\"\n end\n\n data = resp.body\n\n # we convert the returned JSON data to native Ruby\n # data structure - a hash\n result = JSON.parse(data)\n\n # if the hash has 'Error' as a key, we raise an error\n if result.has_key? 'Error'\n raise \"web service error\"\n end\n\n return result\nend", "def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end", "def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @person }\n end\n end" ]
[ "0.75080985", "0.7490487", "0.7490487", "0.73151547", "0.72153556", "0.7154834", "0.7154834", "0.71427387", "0.7037789", "0.70082515", "0.699553", "0.6980208", "0.6980208", "0.6980208", "0.6980208", "0.6980208", "0.6980208", "0.6980208", "0.6980208", "0.6980208", "0.69641876", "0.69490534", "0.69461334", "0.69406116", "0.6938621", "0.6937802", "0.6917734", "0.6871483", "0.68068767", "0.6775969", "0.67745465", "0.6766889", "0.672547", "0.67123616", "0.6692382", "0.6644189", "0.6631563", "0.6629149", "0.66256624", "0.65888447", "0.65675926", "0.6565907", "0.65656215", "0.6547712", "0.65423214", "0.65148896", "0.6494928", "0.64870197", "0.6485584", "0.6451885", "0.64392316", "0.6416873", "0.63995874", "0.6376986", "0.636471", "0.63639534", "0.63622177", "0.63439906", "0.6339633", "0.63140225", "0.62725", "0.6266563", "0.6265709", "0.62582797", "0.6246227", "0.6238676", "0.62363565", "0.62321496", "0.6221649", "0.6221649", "0.6221649", "0.6221649", "0.6221649", "0.6221649", "0.6221649", "0.6221649", "0.6221649", "0.6212862", "0.62024826", "0.6192468", "0.61878675", "0.6187699", "0.61845034", "0.6177552", "0.6167871", "0.6160915", "0.61309254", "0.6128048", "0.6121064", "0.61200917", "0.61131346", "0.6099265", "0.608527", "0.608527", "0.60802835", "0.60800946", "0.60616535", "0.60499364", "0.6049774", "0.6039911", "0.60394" ]
0.0
-1
GET /people/1 GET /people/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end", "def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end", "def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def get_person(id)\n self.class.get(url(\"people/#{id}\"), headers: @token.headers).parsed_response\n end", "def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def index\n @people = Person.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def show\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n \t@person = Person.find(params[:id])\n respond_to do |format|\n format.json { render json: @person, status: :ok }\t\n end \t \t\n end", "def show\n @person_info = PersonInfo.find(params[:id])\n\n render json: @person_info\n end", "def show\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_person }\n end\n end", "def index\n \t@people = Person.all\n respond_to do |format|\n format.json { render json: @people, status: :ok }\n end\n end", "def show\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend", "def fetch_people\n @people = People.find(params[:id])\n end", "def show\n\t\tperson = Person.find_by_id(self.params[\"id\"].to_i)\n\t\tif person\n\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end", "def index\n @people = User.order(:nickname).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @people }\n end\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def show\n @projects_person = ProjectsPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projects_person }\n end\n end", "def show\n if @person\n render json: @person\n else\n # :not_found is the http status code 404\n render status: :not_found\n end\n end", "def index\n\t\t@people = People.all\n\t\t#render json: \"test\"\n\t\tresponse = @people\n\t\trender json: response\n\t\treturn response\n\tend", "def index\n # this is like a 'select * from people' in SQL, but using ORM\n @people = Person.all \n\n # render is the return of our method and at the same time help us to render the object\n render json: @people \n end", "def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end", "def show\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personnage }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def show\n @person = Person.find(params[:id])\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n @registry = Registry.where('email = ?', @person.email).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end", "def get\n @person\n end", "def index\n @person = Person.find((params[:person_id]))\n @person_identification_docs = PersonIdentificationDoc.where(\"person_id = ?\", params[:person_id])\n\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @person_identification_docs }\n end\n end", "def people(query={})\n response = self.simple_client.get(\"/api/v1/people?#{query.to_query}\")\n # TODO modularize, re-use\n if response[\"page\"]\n return WillPaginate::Collection.create(response[\"page\"],response[\"per_page\"]) do |pager|\n pager.replace(response[\"people\"])\n pager.total_entries = response[\"total_entries\"]\n end\n else\n return response\n end\n end", "def index\n respond_with(@people)\n end", "def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end", "def index\n @people = Person.includes(:registry).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @people }\n end\n end", "def show\n respond_to do |format|\n people = @mob.user_idz.split(',').map{|i| User.find(i).name }.join(', ')\n format.json { render json: @mob.attributes.merge(people: people, users: @mob.users, date: Time.now.strftime('%-m/%-d/%Y')) }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @person }\n format.json { respond_with @person }\n end\n end", "def index\n @people = search Person.involved_in(@conference)\n\n respond_to do |format|\n format.html { @people = @people.paginate page: page_param }\n format.json\n end\n end", "def index\n @projects_people = ProjectsPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects_people }\n end\n end", "def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end", "def show\n @person_interest = PersonInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_interest }\n end\n end", "def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end", "def show\n @person = Person.find(params[:id])\n respond_with(@person)\n end", "def show\n @person_search = PersonSearch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person_search }\n end\n end", "def show\n @type_person = TypePerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_person }\n end\n end", "def index\n @people = Person.all\n respond_with(@people)\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def show\n @person = Person.find(params[:id])\n end", "def show\n @person = Person.find(params[:id])\n end", "def show\n @person = Person.find(params[:id])\n end", "def show\n @person = Person.find(params[:id])\n end", "def show\n @people = People.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @people }\n end\n end", "def show\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bob }\n end\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def show\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_person }\n end\n end", "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end", "def index\n @people = Person.paginate(:page => params[:offset], :per_page => 20)\n\n people_hash()\n respond_to do |format|\n format.html\n format.json { render :json => @people_hash }\n format.xml { render :xml => @people_hash }\n end\n end", "def show\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missing_person }\n end\n end", "def show\n render json: User.find(params[:id])\n end", "def index\n @people = People.all\n end", "def show\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasks_person }\n end\n end", "def show\n @person = User.friendly.find(params[:id])\n add_breadcrumb @person.nickname, cooperative.person_path(@person)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @person }\n end\n end", "def get_people_info(page_size=2)\n\t\toptions = {\n\t\t\theaders: headers,\n\t\t\tquery: { page_size: page_size }\n\t\t}\n\t\tresult = self.class.get(\"/people/#{display_name}/#{email_address}/#{title}\", options)\n\tend", "def index\n\n @people = Person.filter(params.slice(:name_like))\n @people = @people.where([\"union_id = ?\", current_person.union_id]) if request.format.json? && !owner?\n @people = @people.where(\"not invited_by_id is null\").order([:last_name, :first_name, :id])\n \n respond_to do |format|\n format.html \n format.json \n end\n end", "def index\n @people = Person.where( :user_id => current_user.id)\n if current_user.role? :admin \n @people = Person.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @people }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @person_hash }\n format.xml { render :xml => @person_hash }\n end\n end", "def show\n render :json => User.find(params[:id])\n end", "def showName\n render json: User.findByName(params[\"name\"])\n end", "def show\n\t\t@household = Household.find(params[:id])\n\t\t@people = @household.people\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @household }\n\t\tend\n\tend", "def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n @waitlist = WaitList.find(params[:id])\n @person = Person.find(@waitlist.people_id)\n @profile = Profile.find_by_person_id(@waitlist.people_id)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @waitlist }\n end\n end", "def search\n render json: PersonEvent.first(10)\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def index\n @people = Person.all\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end", "def show\n @user = User.find_by_name(params[:name])\n @participants = Participant.find_all_by_user_id(@user.id).paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def search_people(query)\n get(\"/v1/search/people\", query: query)\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end" ]
[ "0.73654115", "0.72936606", "0.7278633", "0.7278633", "0.72337806", "0.7217525", "0.716031", "0.716031", "0.716031", "0.716031", "0.716031", "0.716031", "0.716031", "0.716031", "0.716031", "0.7136041", "0.70801747", "0.7075092", "0.7065", "0.70224607", "0.69983834", "0.6986985", "0.69744563", "0.6929027", "0.68760574", "0.68760574", "0.68652725", "0.6810626", "0.67777824", "0.66640544", "0.6654375", "0.6651314", "0.66410434", "0.6638454", "0.66379553", "0.6557829", "0.6557659", "0.65524924", "0.65249896", "0.6520648", "0.6509694", "0.6500432", "0.6496628", "0.64962804", "0.64820164", "0.64756525", "0.647556", "0.64733195", "0.64645255", "0.6456497", "0.6433031", "0.64279926", "0.6424956", "0.64244276", "0.64076334", "0.6405426", "0.6400368", "0.63981986", "0.6380732", "0.6372527", "0.6372527", "0.6372527", "0.6372527", "0.63567555", "0.63324976", "0.6331585", "0.63282025", "0.62920433", "0.62472034", "0.6246875", "0.6243954", "0.6234468", "0.62338513", "0.62321746", "0.62129444", "0.6208583", "0.62077475", "0.62047845", "0.61933184", "0.61844766", "0.617426", "0.61671674", "0.61666703", "0.6162547", "0.61584187", "0.61507523", "0.6148985", "0.6148985", "0.6148985", "0.6148985", "0.6148985", "0.6148985", "0.6148985", "0.6148985", "0.6148985", "0.61454284", "0.6139399", "0.6138872", "0.6133765", "0.6119954", "0.6115466" ]
0.0
-1
POST /people POST /people.json
def create @person = Person.new(person_params) @record = @person respond_to do |format| if @person.save format.html { redirect_to @person, notice: 'Person was successfully created.' } format.json { render :show, status: :created, location: @person } format.js { render :file => "/basic/create.js.erb" } else format.html { render :new } format.json { render json: @person.errors, status: :unprocessable_entity } format.js { render :file => "/basic/faulty_create.js.erb" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def create\n @person = Person.new(person_params)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def create\n @person = Person.new(person_params)\n\n if @person.save\n render json: { status: 'POST Success', id: @person.id }, status: :ok\n else\n render json: { status: 'Error', message:'Error registering a new person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html do\n redirect_to people_url, notice: 'Person was successfully created.'\n end\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n \t@person = Person.new(person_params) \t\n respond_to do |format|\n if @person.save\n format.json {render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to people_path, notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: @person }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = @account.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @people = People.new(people_params)\n\n respond_to do |format|\n if @people.save\n format.html { redirect_to root_path, notice: 'Um VIP ' + @people.name.to_s + ' foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @people }\n else\n format.html { render :new }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person_info = PersonInfo.new(person_info_params(params[:person_info]))\n\n if @person_info.save\n render json: @person_info, status: :created, location: @person_info\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def create\n @person = Person.new\n \tpopulate_attributes(@person, params[:person])\n \n respond_to do |format|\n if @person.save\n @person = Person.find(@person.id)\n populate_attributes(@person, params[:person])\n @person.save\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_person = UserPerson.new(params[:user_person])\n\n respond_to do |format|\n if @user_person.save\n format.html { redirect_to @user_person, notice: 'User person was successfully created.' }\n format.json { render json: @user_person, status: :created, location: @user_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully created.\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @people = People.new(params[:people])\n\n respond_to do |format|\n if @people.save\n flash[:notice] = 'People was successfully created.'\n format.html { redirect_to(@people) }\n format.xml { render :xml => @people, :status => :created, :location => @people }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @people.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n @person = Person.new(person_params)\n respond_to do |format|\n if @person.save!\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n \n #save name(s)\n #params[:name].each {|name| \n # @name = Name.new\n # @name.name = name\n # @name.person_id = @person.id\n # @name.save\n #}\n\n respond_to do |format|\n if @person.save\n flash[:notice] = 'Person was successfully created.'\n format.html { redirect_to(@person) }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n else\n format.html { render :action => \"new\", :layout => \"main\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @person.save\n respond_with(@person, :location => people_path)\n end", "def create\n # if “Content-Type” header is set as “application/json” then ...\n if request.content_type == \"application/json\" \n # Person.new is like a \"Insert into People values ...\" in SQL\n @person = Person.new(person_params)\n # .save is the commit to database\n if @person.save\n # :created is the http status code 201\n render json: @person, status: :created\n # :bad_request is the http status code 400\n else\n render json: @person.errors, status: :bad_request #:unprocessable_entity\n end\n else\n render status: :bad_request\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: @person }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(params[:person])\n \n respond_to do |format|\n if @person.save\n format.html { redirect_to \"people/#{@person.id}\" }\n format.json { render :nothing }\n format.xml { render :nothing }\n else \n format.html { render :action => \"new\" }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.js {}\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully created.\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.js {}\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @people = People.new(people_params) \n @people.user_created_id = current_user.id \n respond_to do |format|\n if @people.save\n format.html { redirect_to @people, notice: 'Persona creada con éxito.' }\n format.json { render :show, status: :created, location: @people }\n else\n format.html { render :new }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end \n end", "def create\n\t\t@person = Person.new(person_params)\n\n\t\trespond_to do |format|\n\t\t\tif @person.save\n\t\t\t\tformat.html { redirect_to @person, notice: 'Person was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @person }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @person.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @person = Person.new(person_params)\r\n set_field\r\n\r\n respond_to do |format|\r\n if @person.save\r\n format.json { render :show, status: :created, location: @person }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @person.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @persona = Persona.new(params[:persona])\n \n respond_to do |format|\n if @persona.save\n format.json { render :json => @persona,\n :status => :created, :location => @persona }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n # @person.addresses.build()\n respond_to do |format|\n if @person.save\n # @person.addresses.create\n # @person.companies.create\n\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n @addresses = @person.addresses\n @page_title = 'Add a new person'\n addresses = @person.addresses.build\n companies = @person.companies.build\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def people_params\n params.permit(people: [:first_name, :last_name, :email, :phone])\n end", "def create\n @person = Person.new(params[:person])\n flash[:notice] = 'Person was successfully created.' if @person.save\n respond_with(@person)\n end", "def create\n @person = Person.new(params[:person])\n current_organization.people << @person\n if @person.save\n redirect_to people_path, notice: @person.name.to_s + ' was successfully created.'\n else\n render action: \"new\"\n end\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: \"Person was successfully created.\" }\n flash.alert = \"Person updated\"\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n# next line commented out and following line added 2 aug 17 for connecting users to people (step 17)\n# Person.create(person_params)\n current_user.people.create(person_params) # check nomster/flixter code in this area\n\n redirect_to new_person_path # change to redirect to page showing person created, maybe entire tree\n end", "def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def create\n @person = Person.new(person_params)\n authorize! :create, @person\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: t('.create_ok') }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end", "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n format.js\n format.json { render json: @person, status: :created, location: @person }\n else\n format.js\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.debug(\"PeopleController.create: person_params: #{person_params.inspect}\")\n\n @person = Person.new(person_params)\n logger.debug(\"PeopleController.create: @person: #{@person.inspect}\")\n\n respond_to do |format|\n if @person.save \n # TBD: setup specs for this: or we will be adding to our 'technical debt'!\n Notifier.notice(@person, 'new account').deliver\n format.html do\n sign_in @person\n flash[:success] = \"Welcome to Talk Invite!\"\n redirect_to @person\n end\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @person = Person.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Клиент создан' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @personnage = Personnage.new(params[:personnage])\n\n respond_to do |format|\n if @personnage.save\n format.html { redirect_to @personnage, notice: 'Personnage was successfully created.' }\n format.json { render json: @personnage, status: :created, location: @personnage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personnage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @related_person = RelatedPerson.new(related_person_params)\n\n respond_to do |format|\n if @related_person.save\n format.html { redirect_to @related_person, notice: 'Related person was successfully created.' }\n format.json { render :show, status: :created, location: @related_person }\n else\n format.html { render :new }\n format.json { render json: @related_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @request_person = RequestPerson.new(request_person_params)\n\n respond_to do |format|\n if @request_person.save\n format.html { redirect_to @request_person, notice: 'Request person was successfully created.' }\n format.json { render :show, status: :created, location: @request_person }\n else\n format.html { render :new }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n filter_sampled_persons_ineligibilties\n\n @person = Person.new(params[:person])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.save\n create_relationship_to_participant\n\n path = people_path\n msg = 'Person was successfully created.'\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully created for #{@provider}.\"\n end\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @person.errors }\n end\n end\n end", "def create\n @person = Person.new( person_params )\n respond_to do |format|\n if @person.save\n format.html { render :edit, notice: t( 'people.msg.new_ok' )}\n else\n format.html { render :new }\n end\n end\n end", "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end", "def create\n\t\t@person = Person.create(person_params)\n\t\tredirect_to person_url(@person)\n\tend", "def create\n @person = Person.new(params[:person])\n work = Work.find(@person.work_id) if @person.work_id.present?\n expression = Expression.find(@person.expression_id) if @person.expression_id.present?\n manifestation = Manifestation.find(@person.manifestation_id) if @person.manifestation_id.present?\n\n respond_to do |format|\n if @person.save\n if work\n @person.works << work\n end\n if expression\n @person.expressions << expression\n end\n if manifestation\n @person.manifestations << manifestation\n end\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params['csv_file'].present?\n require 'csv'\n params[:people] = []\n csv_text = File.read(params['csv_file'].path)\n csv = CSV.parse(csv_text, :headers => true)\n csv.each do |row|\n params[:people] << row.to_hash\n end\n people = Person.create(people_params[:people])\n render json: people.as_json(methods: :error_messages), status: :ok\n elsif params['person'].present?\n person = Person.new(person_params)\n if person.save\n render json: person.as_json(methods: :error_messages), status: :ok\n else\n render json: { errors: person.error_messages }, status: :unprocessable_entity\n end\n else\n render json: { message: 'CSV file not found.' }, status: :not_found and return\n end\n end", "def create\n @team_person = TeamPerson.new(team_person_params)\n\n respond_to do |format|\n if @team_person.save\n format.html { redirect_to @team_person, notice: 'Team person was successfully created.' }\n format.json { render :show, status: :created, location: @team_person }\n else\n format.html { render :new }\n format.json { render json: @team_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if !params[:name].nil? && !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n pet = user.pets.create(name:params[:name], observations: params[:observations])\n if pet\n render json: pet, status: :created\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'Pet name not provided'}, status: :bad_request\n end\n end", "def create\n @people_number = PeopleNumber.new(people_number_params)\n\n respond_to do |format|\n if @people_number.save\n format.html { redirect_to @people_number, notice: 'People number was successfully created.' }\n format.json { render :show, status: :created, location: @people_number }\n else\n format.html { render :new }\n format.json { render json: @people_number.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @projects_person = ProjectsPerson.new(params[:projects_person])\n\n respond_to do |format|\n if @projects_person.save\n format.html { redirect_to @projects_person, notice: 'Projects person was successfully created.' }\n format.json { render json: @projects_person, status: :created, location: @projects_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @projects_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tasks_person = TasksPerson.new(params[:tasks_person])\n\n respond_to do |format|\n if @tasks_person.save\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully created.' }\n format.json { render json: @tasks_person, status: :created, location: @tasks_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @addresses_person = AddressesPerson.new(addresses_person_params)\n\n respond_to do |format|\n if @addresses_person.save\n format.html { redirect_to @addresses_person, notice: 'Addresses person was successfully created.' }\n format.json { render :show, status: :created, location: @addresses_person }\n else\n format.html { render :new }\n format.json { render json: @addresses_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @persona = Persona.new(params[:persona])\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'Persona was successfully created.' }\n format.json { render json: @persona, status: :created, location: @persona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n \n if @person.save\n redirect_to action: 'list'\n else\n render action: 'new'\n end\n end", "def people_params\n params.require(:people).permit(:first_name,:surname, :type_identification, :identification_document, \n :email, :date_birth, :sex, :civil_status, :phone, :cellphone, :address )\n end", "def create\n @persona = Persona.new(params[:persona])\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'la Persona fue creada exitosamente.' }\n format.json { render json: @persona, status: :created, location: @persona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @personaje = Personaje.new(params[:personaje])\n\n respond_to do |format|\n if @personaje.save\n format.html { redirect_to @personaje, notice: 'Personaje was successfully created.' }\n format.json { render json: @personaje, status: :created, location: @personaje }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def create\n @person = Person.new(params[:person].merge :creator_site_id => Site.current_id)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to(@person, :notice => 'Person was successfully created.') }\n format.xml { render :xml => @person, :status => :created, :location => @person }\n format.json { render :json => @person, :status => :created, :location => @person }\n else\n status = @person.errors.delete(:status) || :unprocessable_entity\n\n format.html { render :action => 'new' }\n format.xml { render :xml => @person.errors, :status => status }\n format.json { render :json => @person.errors, :status => status }\n end\n end\n end", "def create\n @contactinfo = Contactinfo.new(params[:contactinfo])\n @contactinfo.user_id = current_user.id\n \n respond_to do |format|\n if @contactinfo.save\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully created.' }\n format.json { render :json => @contactinfo, :status => :created, :location => @contactinfo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contactinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @persona = Persona.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'Datos personales registrados exitosamente.' }\n format.json { render :show, status: :created, location: @persona }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person_interest = PersonInterest.new(params[:person_interest])\n\n respond_to do |format|\n if @person_interest.save\n format.html { redirect_to @person_interest, notice: 'Person interest was successfully created.' }\n format.json { render json: @person_interest, status: :created, location: @person_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_interest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@person = Person.new(params[:person])\n\n\t\trespond_to do |format|\n\t\t\tif @person.save\n\t\t\t\tformat.html { redirect_to(@person, :notice => 'Person was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @person, :status => :created, :location => @person }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def new\n @user_person = UserPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_person }\n end\n end", "def people_params\n params.require(:person).permit(:name, :surname, :mail, :home, :phone, :age, :pilot, :member, :guest, :status, :id_number)\n end", "def create\n @type_person = TypePerson.new(params[:type_person])\n\n respond_to do |format|\n if @type_person.save\n format.html { redirect_to @type_person, notice: 'Type person was successfully created.' }\n format.json { render json: @type_person, status: :created, location: @type_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @type_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(admin_person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to [:admin, @person], notice: 'Person was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:admin, @person] }\n else\n format.html { render action: 'new' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n filtered_params = person_params\n filtered_params[:roles] ||= [:leaser]\n filtered_params[:status] ||= [:pending]\n\n @person = Person.new(filtered_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n format.xml { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.xml { render xml: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create\n @person = Person.new(person_params)\n\n if @person.save\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end", "def create\n p params\n family = Family.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password],\n phone_number: params[:phone_number],\n street_address: params[:street_address],\n secondary_address: params[:secondary_address],\n city: params[:city],\n state: params[:state],\n zip_code: params[:zip_code],\n photo: params[:photo])\n # save the information from user input to create a new family.\n family.save!\n if family.save!\n render json: family.as_json\n else\n render json: {errors: family.errors.full_messages}\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n track_activity @person\n format.html { redirect_to @person, notice: 'Person was successfully created.' }\n format.json { render json: @person, status: :created, location: @person }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.info(params)\n # check if all the criterias are filled\n # first I just continue to create iff name, positionl, institution exists\n if params.has_key?(:name) && params.has_key?(:position) && params.has_key?(:institution)\n # check if the person already exists? The person might exists as a mentor of other maybe\n unless Person.exists?(name: params[:name])\n @person = Person.new_person(params[:name], params[:position], params[:institution])\n if @person != nil && @person.save\n render json: @person.as_json, status: :created\n return\n end\n else\n render json: {error: 'person exists'}, status: :bad_request\n end\n end\n #render json: {warning: 'not implemented'}, status: 200\n end", "def create\n @person = current_user.people.new(person_params)\n\n respond_to do |format|\n if @person.save\n format.html { redirect_to [:logbook, @person], notice: 'Person was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n format.js\n else\n format.html { redirect_to logbook_people_path, notice: 'Person was not saved.' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.js { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @car = Car.new(car_params)\n\n respond_to do |format|\n if @car.save\n if @person\n @car.people << @person\n format.html { redirect_to @person, notice: \"#{@person.name} got a new car!\" }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { redirect_to @car, notice: 'Car created!' }\n format.json { render :show, status: :created, location: @car }\n end\n else\n format.html { render :new }\n format.json { render json: @car.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @person = Person.new(person_params)\n @person.user = current_user\n authorize @person\n\n flash[:notice] = \"Person was successfully created.\" if @person.save\n respond_with(@person)\n end", "def create\n @documents_person = DocumentsPerson.new(documents_person_params)\n\n respond_to do |format|\n if @documents_person.save\n format.html { redirect_to @documents_person, notice: 'Documents person was successfully created.' }\n format.json { render :show, status: :created, location: @documents_person }\n else\n format.html { render :new }\n format.json { render json: @documents_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pet = @person.pets.build(pet_params)\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to person_path(@person), notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @person }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @persona = Persona.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html {redirect_to personas_url, notice: 'Persona was successfully created.'}\n format.json {render :show, status: :created, location: @persona}\n else\n format.html {render :new}\n format.json {render json: @persona.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @key_person = KeyPerson.new(params[:key_person])\n\n respond_to do |format|\n if @key_person.save\n format.html { redirect_to @key_person, notice: 'Key person was successfully created.' }\n format.json { render json: @key_person, status: :created, location: @key_person }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @people_student = People::Student.new(people_student_params)\n\n respond_to do |format|\n if @people_student.save\n format.html { redirect_to @people_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @people_student }\n else\n format.html { render :new }\n format.json { render json: @people_student.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6787028", "0.67639786", "0.67471504", "0.67430043", "0.6740321", "0.6729967", "0.6695623", "0.66938925", "0.66387355", "0.6607146", "0.6599289", "0.6555189", "0.6555189", "0.6555189", "0.6555189", "0.65208775", "0.65106755", "0.6495074", "0.6495074", "0.6495074", "0.6495074", "0.6495074", "0.6495074", "0.6495074", "0.6495074", "0.64876723", "0.6459417", "0.6442595", "0.6437779", "0.6429813", "0.6427936", "0.63512456", "0.63290733", "0.6310523", "0.63032746", "0.6259273", "0.6258431", "0.6255561", "0.6206324", "0.62054753", "0.61961675", "0.61902815", "0.6186374", "0.61862135", "0.6181989", "0.6140023", "0.61319715", "0.60855216", "0.60846394", "0.60837996", "0.6066986", "0.605435", "0.6054217", "0.60392874", "0.6034725", "0.6025633", "0.60253185", "0.5989397", "0.59855026", "0.59618807", "0.59562093", "0.5956128", "0.595379", "0.59522164", "0.59299463", "0.5909894", "0.5907757", "0.59064245", "0.5894328", "0.58793783", "0.5868149", "0.5862134", "0.5854718", "0.58434165", "0.58431077", "0.58411676", "0.5839441", "0.58392113", "0.58365375", "0.58350027", "0.58311385", "0.5829603", "0.5828112", "0.58262116", "0.5817968", "0.5817968", "0.5817968", "0.5817968", "0.5817968", "0.5817968", "0.5817968", "0.5817133", "0.5813984", "0.58083624", "0.5805334", "0.57937825", "0.57876796", "0.57728964", "0.57716477", "0.5750112", "0.5739503" ]
0.0
-1
PATCH/PUT /people/1 PATCH/PUT /people/1.json
def update @record = @person respond_to do |format| if @person.update(person_params) format.html { redirect_to @person, notice: 'Person was successfully updated.' } format.json { render :show, status: :ok, location: @person } format.js { render :file => "/basic/update.js.erb" } else format.html { render :edit } format.json { render json: @person.errors, status: :unprocessable_entity } format.js { render :file => "/basic/update.js.erb" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to people_path, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end", "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n if @person.update_attributes(person_params)\n render :json => @person\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n\n end", "def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end", "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.display_name} Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @people = People.find(params[:id])\n\n respond_to do |format|\n if @people.update_attributes(params[:people])\n flash[:notice] = 'People was successfully updated.'\n format.html { redirect_to(@people) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @people.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def update\n if @person.update(person_params)\n render :show, status: :ok, location: api_v2_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html do\n redirect_to @person, notice: 'Person was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n if @user_person.update_attributes(params[:user_person])\n format.html { redirect_to @user_person, notice: 'User person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @request_person.update(request_person_params)\n format.html { redirect_to @request_person, notice: 'Request person was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_person }\n else\n format.html { render :edit }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n set_associations\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Данные клиента обновлены.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @people.user_updated_id = current_user.id\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to @people, notice: 'Persona actualizada con éxito.' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to root_path(@people), notice: 'VIP ' + @people.name.to_s + ' foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @person.update(person_params)\n\t\t\t\tformat.html { redirect_to @person, notice: 'Person was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @person }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @person.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient].except(:person_attributes))\n format.html { redirect_to people_url, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @people = Person.pluck(:name, :id)\n puts \"*** From update: \" \n\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.js {}\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.js {}\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n\n\t\trespond_to do |format|\n\t\t\tif @person.update_attributes(params[:person])\n\t\t\t\tformat.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def put!\n request! :put\n end", "def update\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @people = args[:people] if args.key?(:people)\n end", "def update\n respond_to do |format|\n if @person.update(admin_person_params)\n format.html { redirect_to [:admin, @person], notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(person_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n\t\t@person = Person.find_by(id: params[:id])\n\t\t# @person.save\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n track_activity @person\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n flash[:notice] = 'Person was successfully updated.' if @person.update_attributes(params[:person])\n respond_with(@person)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\", :layout => \"main\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to(@person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @key_person = KeyPerson.find(params[:id])\n\n respond_to do |format|\n if @key_person.update_attributes(params[:key_person])\n format.html { redirect_to @key_person, notice: 'Key person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = \"Person was successfully updated.\" if @person.update(person_params)\n respond_with(@person)\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n flash[:notice] = 'Person was successfully updated.'\n format.html { redirect_to people_url }\n format.xml { head :ok }\n else\n flash[:warning] = 'Please check every information that you are entering and fill the required fields.'\n format.html { render :edit }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n if @tasks_person.update_attributes(params[:tasks_person])\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to result_path(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Cadastro atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @person.update_attributes(params[:person])\n redirect_to people_path, notice: @person.name.to_s + ' was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@person = Person.find_by(id: params[:id])\n\t\[email protected]_attributes(person_params)\n\n\t\t# Same as below!\n\t\t# @person.name = params[:person][:name]\n\t\t# @person.age = params[:person][:age]\n\t\t# @person.is_a_clown = params[:person][:is_a_clown]\n\t\t# @person.save\n\n\t\t# redirect_to 'index'\n\t\tredirect_to person_url(@person) # the prefix from rake routes, could also use path..\n\tend", "def update\n respond_to do |format|\n if @documents_person.update(documents_person_params)\n format.html { redirect_to @documents_person, notice: 'Documents person was successfully updated.' }\n format.json { render :show, status: :ok, location: @documents_person }\n else\n format.html { render :edit }\n format.json { render json: @documents_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @personnage = Personnage.find(params[:id])\n\n respond_to do |format|\n if @personnage.update_attributes(params[:personnage])\n format.html { redirect_to @personnage, notice: 'Personnage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personnage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:person][:company_name]\n params[:person][:company] = Company.find_or_create_by_name(params[:person][:company_name])\n params[:person].delete(:company_name)\n end\n @person = Person.find(params[:id])\n\n authorize! :edit, @person\n \n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = people_type.find(params[:id])\n\n respond_to do |format|\n case params[:type]\n when \"Coordinator\" \n @person.update_attributes(params[:coordinator])\n when \"Professor\"\n puts \"zicaaaaaa\" \n puts params[:professor]\n @person.update_attributes(params[:professor])\n puts @person.name\n when \"Student\"\n @person.update_attributes(params[:student])\n end\n if @person.save\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n filtered_params = person_params\n filtered_params[:roles] ||= []\n filtered_params[:status] ||= []\n\n respond_to do |format|\n if @person.update(filtered_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n format.xml { render :show, status: :created, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.xml { render xml: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n if @contactinfo.update_attributes(params[:contactinfo])\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contactinfo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n if @bob.update_attributes(params[:bob])\n format.html { redirect_to @bob, notice: 'Bob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bob.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tperson = Person.find_by_id(user_params[\"id\"])\n\t\tif person\n\t\t\tperson.favoriteCity = params[\"update\"]\n\t\t\tif person.save\n\t\t\t\trender json: {id: person.id, name: person.name, favoriteCity: person.favoriteCity}\n\t\t\telse\n\t\t\t\trender body: 'Person Invalid', status: 404\n\t\t\tend\n\t\telse\n\t\t\trender body: 'Person Not Found', status: 404\n\t\tend\n\tend" ]
[ "0.7046178", "0.6955489", "0.68781364", "0.66859853", "0.6622123", "0.6622123", "0.6622123", "0.6622123", "0.6622123", "0.6618028", "0.66086507", "0.66086507", "0.6599896", "0.6584526", "0.65779114", "0.6543081", "0.6543081", "0.6543081", "0.65398455", "0.6506056", "0.65049976", "0.65038633", "0.6448661", "0.6431934", "0.6430893", "0.64121807", "0.6402824", "0.63849497", "0.6384165", "0.6384165", "0.63723207", "0.63716125", "0.63647574", "0.63647574", "0.63647574", "0.63647574", "0.63647574", "0.63647574", "0.63647574", "0.63647574", "0.6340482", "0.62984276", "0.6292263", "0.6288777", "0.62864923", "0.6280137", "0.62458956", "0.6242642", "0.62406826", "0.62330395", "0.623182", "0.62309235", "0.6225137", "0.6223023", "0.6208863", "0.6184499", "0.61706775", "0.6163983", "0.6163983", "0.6156549", "0.6149321", "0.61389315", "0.61285555", "0.6124913", "0.6117892", "0.6116136", "0.61117524", "0.61117524", "0.6108765", "0.6090523", "0.60682195", "0.60651743", "0.60651743", "0.6062671", "0.60625017", "0.60625017", "0.60557216", "0.6041787", "0.60377216", "0.6032268", "0.60320866", "0.6022594", "0.6017544", "0.6016622", "0.60005254", "0.59978473", "0.5992661", "0.59877443", "0.59761226", "0.5974281", "0.5953125", "0.5951671", "0.594596", "0.59447116", "0.59416914", "0.59333724", "0.5932402", "0.59318256", "0.5929482", "0.59239054", "0.5915161" ]
0.0
-1
DELETE /people/1 DELETE /people/1.json
def destroy @person.destroy respond_to do |format| format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n @user_person = UserPerson.find(params[:id])\n @user_person.destroy\n\n respond_to do |format|\n format.html { redirect_to user_people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = people_type.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => \"index\" }\n format.json { head :ok }\n end\n end", "def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.user.destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n track_activity @person\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"#{@person.name} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n head :no_content\n end", "def destroy\n @person.destroy\n head :no_content\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: \"Person was successfully destroyed\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Клиент удален из базы.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Uppgifterna om personen raderades.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n authorize! :destroy, @person\n \n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person_info = PersonInfo.find(params[:id])\n @person_info.destroy\n\n head :no_content\n end", "def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @people.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Um VIP ' + @people.name.to_s + ' foi deletado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n Person.find(params[:id]).destroy\n redirect_to action: 'list'\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy if @person.users.empty?\n \n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @key_person = KeyPerson.find(params[:id])\n @key_person.destroy\n\n respond_to do |format|\n format.html { redirect_to key_people_url }\n format.json { head :ok }\n end\n end", "def destroy\n @personaje = Personaje.find(params[:id])\n @personaje.destroy\n\n respond_to do |format|\n format.html { redirect_to personajes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_with(@person)\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html do\n redirect_to people_url(page: index_page),\n notice: 'Person was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n redirect_to people_url\n end", "def delete\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person.destroy\n @application_session.destroy\n session[:cos_session_id] = nil\n render_json :status => :ok\n end", "def destroy\n @contactinfo = Contactinfo.find(params[:id])\n @people_id = @contactinfo.people_id\n @contactinfo.destroy\n\n respond_to do |format|\n format.html { redirect_to person_path(@people_id) }\n format.json { head :ok }\n end\n end", "def destroy\n @request_person.destroy\n respond_to do |format|\n format.html { redirect_to request_people_url, notice: 'Request person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n the_org = @person.org_id\n the_name = @person.name\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to org_path(the_org), status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end", "def destroy\n @personnage = Personnage.find(params[:id])\n @personnage.destroy\n\n respond_to do |format|\n format.html { redirect_to personnages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @emu_person.destroy\n respond_to do |format|\n format.html { redirect_to emu_people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # .destroy is like a \"delete from people ...\"\n if @person.destroy\n # :ok is the http status code 200\n render status: :ok\n else\n render status: :not_found\n end\n \n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to( :action => 'index' ) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.js\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @people = People.find(params[:id])\n @people.destroy\n\n respond_to do |format|\n format.html { redirect_to(peoples_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_person.destroy\n respond_to do |format|\n format.html { redirect_to visit_people_url, notice: 'Visit person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = @person.user\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_person = TypePerson.find(params[:id])\n @type_person.destroy\n\n respond_to do |format|\n format.html { redirect_to type_people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect(person_animals_url, :delete, 'animal') }\n format.json { head :no_content }\n end\n end", "def destroy\n @person_info.destroy\n respond_to do |format|\n format.html { redirect_to person_infos_url, notice: 'Person info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @personal.destroy\n respond_to do |format|\n format.html { redirect_to personals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @missing_person = MissingPerson.find(params[:id])\n @missing_person.destroy\n\n respond_to do |format|\n format.html { redirect_to missing_people_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_with(@person)\n end", "def destroy\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to personas_url, notice: 'Datos personales eliminados exitosamente.' }\n format.json { head :no_content }\n end\n end", "def delete(*rest) end", "def destroy\n @hr_person.destroy\n respond_to do |format|\n format.html { redirect_to hr_people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.756637", "0.75528497", "0.755258", "0.755258", "0.755258", "0.7542481", "0.75265175", "0.75265175", "0.75265175", "0.75265175", "0.7441367", "0.7421742", "0.7409622", "0.7409622", "0.7409622", "0.7409622", "0.7409622", "0.7394193", "0.7350797", "0.72796255", "0.72706586", "0.7260598", "0.7246104", "0.72252226", "0.7197943", "0.7190502", "0.71817994", "0.71802", "0.7170023", "0.71682984", "0.71682984", "0.7163834", "0.7163834", "0.7163834", "0.7163834", "0.7163834", "0.7163834", "0.7163834", "0.7163834", "0.71539164", "0.7147595", "0.7146055", "0.7127867", "0.7101654", "0.70904356", "0.7089944", "0.7089944", "0.7089382", "0.70886695", "0.7076807", "0.7074651", "0.7074651", "0.7074651", "0.7070304", "0.7063507", "0.7055805", "0.70451087", "0.703561", "0.7027976", "0.7018861", "0.70165795", "0.7010724", "0.7000156", "0.69915384", "0.6984465", "0.6971561", "0.69680536", "0.6957204", "0.69547415", "0.69316834", "0.69281024", "0.6915689", "0.69143337", "0.69114643", "0.68945926", "0.68663406", "0.6857808", "0.68527496", "0.6851665", "0.683777", "0.6830001", "0.68195575", "0.6814807", "0.67907983", "0.678965", "0.67795503", "0.67779905", "0.6777111", "0.6774407", "0.677231" ]
0.7168784
37
Use callbacks to share common setup or constraints between actions.
def set_person @person = Person.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def person_params params.require(:person).permit(:form_of_address, :firstname, :lastname, :email, :phone, :phone2, :description, :gender, :language, :website, :institution_ids => [], :functionality_list => [], :target_group_list => [], :topic_ids => []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
GET /displays/1 GET /displays/1.json
def show @display = Display.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @display } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @displays = Display.all\n end", "def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end", "def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end", "def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end", "def show\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_type }\n end\n end", "def show\n @system = System.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system }\n end\n end", "def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end", "def show\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @display_item }\n end\n end", "def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end", "def show\n @human = Human.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @human }\n end\n end", "def show\n @host = Host.find_by(hostname: params[:id])\n\n render json: @host\n end", "def show\n @host = Host.find(params[:id])\n\n render json: @host\n end", "def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end", "def show\n @hydraulic_system = HydraulicSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hydraulic_system }\n end\n end", "def show\n @metric_type = MetricType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metric_type }\n end\n end", "def show\n @host = Host.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @host }\n end\n end", "def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end", "def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end", "def show\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cloud }\n end\n end", "def show\n @dash_type = DashType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dash_type }\n end\n end", "def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end", "def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end", "def show\n @registry = Registry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registry }\n end\n end", "def show\n @networking = Networking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @networking }\n end\n end", "def show\n @visual_fidelity = VisualFidelity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @visual_fidelity }\n end\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def show\n render json: UserBoards.find(params[\"id\"])\n end", "def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end", "def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end", "def show\n @heat_source = HeatSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_source }\n end\n end", "def show\n @drive_system = DriveSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drive_system }\n end\n end", "def show\n @width = Width.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @width }\n end\n end", "def show\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ami }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @machine = Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gather }\n end\n end", "def show\n @lab_device = LabDevice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_device }\n end\n end", "def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end", "def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend", "def index\n @attribute_displays = AttributeDisplay.all\n end", "def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @monitor_profile }\n end\n end", "def show\n @hostela = Hostela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hostela }\n end\n end", "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @capture = Capture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capture }\n end\n end", "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", "def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monitor_profile }\n end\n end", "def show\n render json: Server.where(name: params[:name]).first\n end", "def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end", "def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end", "def show\n @standard_measurement = StandardMeasurement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @standard_measurement }\n end\n end", "def show\r\n @machine = Machine.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end", "def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end", "def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end", "def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end", "def show\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fabric }\n end\n end", "def show\n @server = Server.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @dimension = Dimension.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @dimension }\n end\n end", "def show\n @media_type = MediaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @media_type }\n end\n end", "def show\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_log }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n @availablity = Availablity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @availablity }\n end\n end", "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @graphic }\n end\n end", "def show\n @url = Url.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end", "def show\n @game_system = GameSystem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_system }\n end\n end", "def builder\n @display = Display.find(params[:id])\n @displays = Display.all\n end", "def show\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board_info }\n end\n end", "def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end", "def show\n @camera_catalogue = CameraCatalogue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camera_catalogue }\n end\n end", "def show\n @screen_setting = ScreenSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screen_setting }\n end\n end", "def index\n @report_displays = ReportDisplay.all\n end", "def show\n @watch_site = WatchSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @watch_site }\n end\n end", "def show\n @col = Col.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @col }\n end\n end", "def show\n @widget = Widget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @widget }\n end\n end", "def show\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_type }\n end\n end", "def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end", "def show\n @screening = Screening.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screening }\n end\n end", "def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end", "def show\n @robot_design = RobotDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @robot_design }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def show\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n format.html { render :layout => 'collab'}# show.html.erb\n format.json { render json: @collab }\n end\n end", "def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end", "def show\n @machine_id_standard = MachineIdStandard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @machine_id_standard }\n end\n end", "def show\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @color_saturation }\n end\n end", "def show\n @camera = Camera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @camera }\n end\n end", "def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @display }\n end\n end", "def show\n @core_machine = Core::Machine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_machine }\n end\n end", "def show\n puts \"=================show=================\"\n @server = Server.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @server }\n end\n end", "def show\n @medium = Medium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium }\n end\n end", "def show\n @medium = Medium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium }\n end\n end", "def show\n @content_url = ContentUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_url }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end", "def show\n @systemadmin = Systemadmin.find(params[:id])\n @pSAdmins = Host.find_all_by_primary_sadmin_id(params[:id])\n @secSAdmins = Host.find_all_by_secondary_sadmin_id(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @systemadmin }\n end\n end", "def show\n @platform = Platform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @platform }\n end\n end", "def index\n @displaydata = Displaydatum.all\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end" ]
[ "0.7406387", "0.67018", "0.65529764", "0.6539569", "0.6536577", "0.6519089", "0.6515544", "0.64929235", "0.6418445", "0.64058226", "0.64058226", "0.6384856", "0.63755006", "0.637004", "0.6350795", "0.63322103", "0.6331071", "0.6294739", "0.6294739", "0.62918437", "0.6291266", "0.6286383", "0.62692636", "0.62670445", "0.626582", "0.6265147", "0.6257318", "0.6237762", "0.6231677", "0.6231677", "0.62273705", "0.62247473", "0.6219364", "0.6209996", "0.620088", "0.620088", "0.620088", "0.620088", "0.61897093", "0.6188918", "0.6170593", "0.616505", "0.61599916", "0.61527133", "0.6151619", "0.61485535", "0.61473596", "0.6142939", "0.6135963", "0.6132332", "0.6125669", "0.6121364", "0.6116329", "0.61158615", "0.610751", "0.610751", "0.61074406", "0.6106047", "0.61056066", "0.6099683", "0.6098631", "0.6093626", "0.60812014", "0.6076647", "0.60710245", "0.60710245", "0.60708106", "0.6055393", "0.60421604", "0.6041089", "0.6040233", "0.6034976", "0.60319185", "0.6022615", "0.60199714", "0.601702", "0.6016055", "0.60143477", "0.6014191", "0.60141766", "0.6014114", "0.6013185", "0.6011491", "0.6010457", "0.6009757", "0.60063046", "0.6006232", "0.60049886", "0.60031986", "0.59987617", "0.5995131", "0.59947366", "0.59947366", "0.5993826", "0.5992928", "0.5986114", "0.5985261", "0.59851855", "0.5985075", "0.5983515" ]
0.7049758
1
GET /displays/new GET /displays/new.json
def new @display = Display.new respond_to do |format| format.html # new.html.erb format.json { render :json => @display } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud }\n end\n end", "def new\n @page_id = params[:id]\n @display_item = DisplayItem.new\n @display_item.page_id = @page_id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @display_item }\n end\n end", "def create\n @display = Display.new(params[:display])\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, :notice => 'Display was successfully created.' }\n format.json { render :json => @display, :status => :created, :location => @display }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @display.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @heat_type = HeatType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_type }\n end\n end", "def new\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end", "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @system }\n end\n end", "def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @display }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @human = Human.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end", "def new\n @human = Human.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end", "def new\n @hardware = Hardware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hardware }\n end\n end", "def new\n @present = Present.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @present }\n end\n\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @slab = Slab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slab }\n end\n end", "def new\n @show = Show.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show }\n end\n end", "def new\n @show = Show.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show }\n end\n end", "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end", "def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end", "def new\n @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end", "def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end", "def new\n @hostela = Hostela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hostela }\n end\n end", "def new\n @lab = Lab.find(params[:lab_id])\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end", "def new\n @experiment_control = ExperimentControl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @dash_type = DashType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dash_type }\n end\n end", "def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def new\n @gather = Gather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gather }\n end\n end", "def new\n @sitio = Sitio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitio }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @experiment }\n end\n end", "def create\n @display = Display.new(display_params)\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, notice: 'Display was successfully created.' }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @screening = Screening.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screening }\n end\n end", "def new\n @content_url = ContentUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_url }\n end\n end", "def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end", "def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end", "def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end", "def new\n @dimension = Dimension.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dimension }\n end\n end", "def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end", "def new\n @specie = Specie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specie }\n end\n end", "def new\n @mi = Mi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi }\n end\n end", "def new\n @machine = Machine.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @machine }\n end\n end", "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def new\n @gl_type = GlType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl_type }\n end\n end", "def new\n @board = Board.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end", "def new\r\n @machine = Machine.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @machine }\r\n end\r\n end", "def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end", "def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @mostsmallresource = Mostsmallresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def new\n @screeninginfo = Screeninginfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screeninginfo }\n end\n end", "def new\n @overlay = Overlay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @overlay }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end", "def new\n @experiment_software = ExperimentSoftware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @experiment_software }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @show_house = ShowHouse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show_house }\n end\n end", "def new\n @mtype = Mtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtype }\n end\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "def new\n @hardware_type = HardwareType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hardware_type }\n end\n end", "def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\n end\n end", "def new\n @grid = Grid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grid }\n end\n end", "def new\n @site_type = SiteType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_type }\n end\n end", "def new\n @width = Width.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @width }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dashboard }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.json { render json: @site }\n end\n end", "def new\n @widget = Widget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @widget }\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @server = Server.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @server }\n end\n end", "def new\n @ctype = Ctype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ctype }\n end\n end", "def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end", "def new\n @asset = Asset.new\n @title = 'New Asset'\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asset }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n # open data/default_ecosystems.json and parse\n # object returned is an array of hashes... Ex:\n # p @ecosystems[0] # will return a Hash\n # p @ecosystems[0][\"category\"] # => \"native\"\n #@ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/default_ecosystems.json\" , \"r\" ).read )\n #@name_indexed_ecosystems = JSON.parse( File.open( \"#{Rails.root}/public/data/name_indexed_ecosystems.json\" , \"r\" ).read )\n #@ecosystem = @ecosystems[0]\n\n respond_to do |format|\n format.html\n end\n end", "def new\n @content_explore = ContentExplore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content_explore }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @cm = Cm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cm }\n end\n end", "def new\n @showitem = Showitem.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @showitem }\n end\n end", "def new\n @brand = Brand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brand }\n end\n end", "def new\n @gl = Gl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl }\n end\n end", "def new\n @fabric = Fabric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fabric }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @color = Color.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color }\n end\n end" ]
[ "0.6886341", "0.685189", "0.684743", "0.6839169", "0.6816413", "0.6801673", "0.67967474", "0.67844576", "0.6777947", "0.6776038", "0.6770538", "0.67643064", "0.67564976", "0.6720139", "0.6720139", "0.6720139", "0.6720139", "0.67104584", "0.6678559", "0.6678559", "0.6673926", "0.6668302", "0.666702", "0.666702", "0.66611516", "0.66579837", "0.6649733", "0.6648669", "0.6643991", "0.6639115", "0.66195285", "0.66195285", "0.66092175", "0.66068876", "0.6600569", "0.66002154", "0.65971655", "0.6588014", "0.65753967", "0.65753967", "0.65753967", "0.65716803", "0.6571036", "0.65702623", "0.65702623", "0.65702623", "0.6569953", "0.656954", "0.6569414", "0.6567547", "0.6564315", "0.6561367", "0.65605277", "0.6551005", "0.6549767", "0.65454775", "0.6544388", "0.65436", "0.654187", "0.65379363", "0.6537186", "0.65355766", "0.65355766", "0.65352607", "0.6532701", "0.6532701", "0.65325224", "0.65292865", "0.65285075", "0.6528056", "0.65224785", "0.6521018", "0.652045", "0.6518822", "0.6518238", "0.6512", "0.6511618", "0.6504735", "0.6504735", "0.65012723", "0.6497847", "0.6496915", "0.6492105", "0.6490389", "0.64900506", "0.6487904", "0.6487904", "0.6487904", "0.6487904", "0.6487904", "0.6487904", "0.6486574", "0.6485805", "0.64813983", "0.6476369", "0.6475014", "0.64744294", "0.64734477", "0.6472815", "0.6470802" ]
0.77718985
0
POST /displays POST /displays.json
def create @display = Display.new(params[:display]) respond_to do |format| if @display.save format.html { redirect_to @display, :notice => 'Display was successfully created.' } format.json { render :json => @display, :status => :created, :location => @display } else format.html { render :action => "new" } format.json { render :json => @display.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @displays = Display.all\n end", "def create\n @display = Display.new(display_params)\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, notice: 'Display was successfully created.' }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @display = Display.new(display_params)\n screens_num = params[:split_in];\n # creamos las screens necesarias\n saved = @display.save\n \n create_screens(screens_num)\n\n respond_to do |format|\n if saved\n format.html { \n flash[:success]= 'Display was successfully created.' \n redirect_to displays_path \n }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @display }\n end\n end", "def index\n @displaydata = Displaydatum.all\n end", "def create\n @displaydatum = Displaydatum.new(displaydatum_params)\n\n respond_to do |format|\n if @displaydatum.save\n format.html { redirect_to @displaydatum, notice: 'Displaydatum was successfully created.' }\n format.json { render :show, status: :created, location: @displaydatum }\n else\n format.html { render :new }\n format.json { render json: @displaydatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def builder\n @display = Display.find(params[:id])\n @displays = Display.all\n end", "def create\n @display = Display.new(params[:display])\n\n respond_to do |format|\n if @display.save\n flash[:notice] = 'Display was successfully created.'\n format.html { redirect_to(@display) }\n format.xml { render :xml => @display, :status => :created, :location => @display }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @display.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @attribute_display = AttributeDisplay.new(attribute_display_params)\n\n respond_to do |format|\n if @attribute_display.save\n format.html { redirect_to @attribute_display, notice: 'Attribute Display was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attribute_display }\n else\n format.html { render action: 'new' }\n format.json { render json: @attribute_display.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end", "def create\n @report_display = ReportDisplay.new(report_display_params)\n\n respond_to do |format|\n if @report_display.save\n format.html { redirect_to @report_display, notice: 'Report display was successfully created.' }\n format.json { render :show, status: :created, location: @report_display }\n else\n format.html { render :new }\n format.json { render json: @report_display.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @report_displays = ReportDisplay.all\n end", "def display_params\n params.require(:display).permit(:name, :active, :order, :resolution)\n end", "def create\n @display_unit = DisplayUnit.new(display_unit_params)\n\n if @display_unit.save\n render :show, status: :created, location: @display_unit\n else\n render json: @display_unit.errors, status: :unprocessable_entity\n end\n end", "def index\n @attribute_displays = AttributeDisplay.all\n end", "def scaffold\n response_json = RestClient.post(api_path, params.except(:action, :controller))\n\n render template: \"rspec/show\", locals: JSON.parse(response_json)\n end", "def visualize\n @server = Server.find(params[:id])\n add_breadcrumb @server.name, [@server]\n add_breadcrumb \"visualizing\", [:visualize, @server]\n\n wp_service = VisualizationService.new(@server, :wordpress)\n dp_service = VisualizationService.new(@server, :drupal)\n @wordpress_data = wp_service.gather\n @drupal_data = dp_service.gather\n\n respond_to do |format|\n format.html\n format.json { render json: { server: @server,\n wp_data: @wordpress_data, dp_data: @drupal_data} }\n end\n end", "def index\n @captures = Capture.all\n\n render json: @captures\n end", "def display_params\n params.require(:display).permit(:Price, :name, :resolution, :brand, :aspect_ratio, :size, :ports,\n :response_time, :refresh_rate, :speakers, :dimensions, :panel, \n :release, :stand_misc, :gpu_sync,:image)\n end", "def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end", "def new\n @printing_screen = PrintingScreen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @printing_screen }\n end\n end", "def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end", "def new\n @hardware = Hardware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @hardware }\n end\n end", "def show\n render json: @capture\n end", "def show\n @displays = Display.all\n @names=[]\n @displays.each do |display|\n @names.push display.name\n end\n end", "def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end", "def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end", "def create\n @system_overview = SystemOverview.new(system_overview_params)\n\n respond_to do |format|\n if @system_overview.save\n format.html { redirect_to @system_overview, notice: 'System overview was successfully created.' }\n format.json { render :show, status: :created, location: @system_overview }\n else\n format.html { render :new }\n format.json { render json: @system_overview.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @stage\n end", "def update\n respond_to do |format|\n if @display.update(display_params)\n format.html { redirect_to @display, notice: 'Display was successfully updated.' }\n format.json { render :show, status: :ok, location: @display }\n else\n format.html { render :edit }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @measure\n end", "def show\n render json: @assign_stage\n end", "def set_display\n @display = Display.find(params[:id])\n end", "def set_display\n @display = Display.find(params[:id])\n end", "def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end", "def new\n @screening = Screening.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screening }\n end\n end", "def show\n render json: @disponible\n end", "def show\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @display_item }\n end\n end", "def index \n ip_addr = request.env['REMOTE_ADDR'] \n @browse_by = [[\"Browse By\",''],[\"Guides\",'1'],[\"Places\",'2']]\n @characteristics = [\"Latest\",'1'],[\"Most Popular\",'2'],[\"Highest Rated\",'3'],[\"Stress Factor\",'4']\n @notice = notice\n @guides = Guide.where(\"publish=?\",true).order(\"CREATED_AT DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guides }\n end\n end", "def show\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_type }\n end\n end", "def show\n render json: @laboratory\n end", "def show\n @experiment_software = ExperimentSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @experiment_software }\n end\n end", "def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end", "def index\r\n @machines = Machine.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @machines }\r\n end\r\n end", "def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end", "def new\n @screenshot = Screenshot.new\n @screenshot.sizes.build(height: 900, width: 1200)\n @screenshot.sizes.build(height: 600, width: 768)\n @screenshot.sizes.build(height: 480, width: 320)\n @button = \"Send\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screenshot }\n end\n end", "def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def show\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def new\n @display = Display.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @display }\n end\n end", "def setup\n allow_cors unless !ConcertoConfig[:public_concerto]\n @preview = params.has_key?(:preview) && params[:preview] == \"true\"\n begin\n @screen = Screen.find(params[:id])\n allow_screen_if_unsecured @screen\n auth! action: (@preview ? :preview : :display)\n rescue ActiveRecord::ActiveRecordError\n render json: {}, status: 404\n rescue CanCan::AccessDenied\n render json: {}, status: 403\n else\n # If we got the dimensions then keep them so we can indicate its orientation in the screen list.\n if params['width'].present? and params['height'].present? and !@preview\n height = params['height'].to_i rescue nil\n width = params['width'].to_i rescue nil\n @screen.update_columns(height: height, width: width)\n Rails.logger.debug(\"updated screen #{@screen.id} dimensions #{width}w x #{height} h\")\n end\n\n # field_configs = [] # Cache the field_configs\n @screen.run_callbacks(:frontend_display) do\n # Inject paths into fake attribute so they gets sent with the setup info.\n # Pretend that it's better not to change the format of the image, so we detect it's upload extension.\n if [email protected]?\n template_format = File.extname(@screen.template.media.preferred.first.file_name)[1..-1]\n @screen.template.path = frontend_screen_template_path(@screen, @screen.template, format: template_format)\n else\n template_format = nil\n @screen.template.path = nil\n end\n css_media = @screen.template.media.where({key: 'css'})\n if !css_media.empty?\n @screen.template.css_path = media_path(css_media.first)\n end\n @screen.template.positions.each do |p|\n p.field_contents_path = frontend_screen_field_contents_path(@screen, p.field, format: :json)\n p.field.config = {}\n FieldConfig.default.where(field_id: p.field_id).each do |d_fc|\n p.field.config[d_fc.key] = d_fc.value\n # field_configs << d_fc\n end\n @screen.field_configs.where(field_id: p.field_id).each do |fc|\n p.field.config[fc.key] = fc.value\n # field_configs << fc\n end\n # add how to handle when content cannot be loaded or has run out\n p.field.config['screens_clear_last_content'] = ConcertoConfig['screens_clear_last_content']\n end\n end\n\n frontend_cache_key = @screen.frontend_cache_key\n response.headers[\"X-Concerto-Frontend-Setup-Key\"] = frontend_cache_key\n\n @screen.time_zone = ActiveSupport::TimeZone::MAPPING[@screen.time_zone]\n if stale?(etag: frontend_cache_key, public: true)\n respond_to do |format|\n format.json {\n render json: @screen.to_json(\n only: [:name, :id, :time_zone, :locale],\n include: {\n template: {\n include: {\n positions: {\n except: [:created_at, :updated_at, :template_id, :field_id],\n methods: [:field_contents_path],\n include: {\n field: {\n methods: [:config],\n only: [:id, :name, :config]\n }\n }\n },\n },\n only: [:id, :name],\n methods: [:path, :css_path]\n }\n }\n )\n }\n end\n end\n\n unless @preview\n @screen.mark_updated\n end\n end\n end", "def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end", "def show\n @capture = Capture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capture }\n end\n end", "def new\n @screeninginfo = Screeninginfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screeninginfo }\n end\n end", "def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_records }\n end\n end", "def new\n @experiment_software = ExperimentSoftware.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @experiment_software }\n end\n end", "def show\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.add_missing_hosts # TODO: Does this need to be here???\n @schema = self.schema\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @physical_rack }\n format.csv {export_csv @physical_rack}\n end\n end", "def create\n params.permit!\n @display_item = DisplayItem.new(params[:display_item])\n @page_version = PageVersion.new\n @page_version.name = \"Display item create\"\n respond_to do |format|\n if @display_item.save && @page_version.save\n #format.html { redirect_to @display_item, notice: 'Display item was successfully created.' }\n #format.json { render json: @display_item, status: :created, location: @display_item }\n format.html { redirect_to edit_page_path(@display_item.page_id)}\n else\n format.html { render action: \"new\" }\n format.json { render json: @display_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n json_response(@board.lists)\n end", "def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end", "def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end", "def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end", "def new\n @heat_type = HeatType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_type }\n end\n end", "def create\n @overview = Overview.new(overview_params)\n\n respond_to do |format|\n if @overview.save\n format.html { redirect_to @overview, notice: 'Overview was successfully created.' }\n format.json { render action: 'show', status: :created, location: @overview }\n else\n format.html { render action: 'new' }\n format.json { render json: @overview.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end", "def show\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unsigned_columns_test }\n end\n end", "def new\n @page_id = params[:id]\n @display_item = DisplayItem.new\n @display_item.page_id = @page_id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @display_item }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dataset }\n end\n end", "def new\n @experiment_control = ExperimentControl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment_control }\n end\n end", "def new\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @machine }\n end\n end", "def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end", "def show\n @computer = Computer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @computer }\n end\n end", "def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end", "def destroy\n @display.destroy\n respond_to do |format|\n format.html { redirect_to displays_url, notice: 'Display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def display\n @json = Rma.search(params[:rmaName])\n # render :text => @json.inspect\n end", "def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end", "def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end", "def show\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment_biomechanical }\n end\n end", "def index\n @machines = @location.machines\n @machine = Machine.new\n @titles = Title.all\n\n respond_to do |format|\n format.html {require_user}\n format.json { render json: @machines }\n end\n end", "def show\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gather }\n end\n end", "def show\n json_response(@browser)\n end", "def new\n @hardware_type = HardwareType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hardware_type }\n end\n end", "def new\n @slab = Slab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slab }\n end\n end", "def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end", "def show\n @screenshot = Screenshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screenshot }\n end\n end", "def show\n @robot_design = RobotDesign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @robot_design }\n end\n end", "def index\n @lab_flows = LabFlow.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lab_flows }\n end\n end", "def index\n @builds = Build.all\n render json: @builds\n end", "def new\n @screen_setting = ScreenSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screen_setting }\n end\n end", "def new\n @show_house = ShowHouse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show_house }\n end\n end", "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json do\n stats = @mode.stats.map(&:to_simple)\n render json: stats, status: :ok\n end\n end\n end", "def index\n @screens = Screen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @screens }\n end\n end", "def new\n @hostela = Hostela.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hostela }\n end\n end", "def index\n @manuals = Manual.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @manuals }\n end\n end", "def show\n render json: @processo\n end", "def index\n @disponibles = Disponible.take(50)\n\n render json: @disponibles, include: '**'\n end", "def index\n @blood_pressures = BloodPressure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blood_pressures }\n end\n end", "def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end" ]
[ "0.68353724", "0.6693141", "0.66206634", "0.62149626", "0.60705906", "0.606343", "0.6028818", "0.5991701", "0.59580225", "0.5944896", "0.5805641", "0.57829994", "0.5702711", "0.5686948", "0.56582", "0.5646385", "0.56419927", "0.5515144", "0.5499322", "0.54961264", "0.54907817", "0.5475609", "0.5455905", "0.54540926", "0.5451036", "0.54332495", "0.54253244", "0.5422652", "0.5411762", "0.5384961", "0.538149", "0.53781724", "0.5341474", "0.5341474", "0.53353095", "0.5299151", "0.5296943", "0.5294927", "0.528286", "0.52803016", "0.527558", "0.5272638", "0.52653444", "0.5260671", "0.524789", "0.5243267", "0.52411395", "0.52403706", "0.5239967", "0.5239046", "0.5238115", "0.5236542", "0.5230205", "0.52273905", "0.5227264", "0.52256685", "0.52245826", "0.5222497", "0.521531", "0.521438", "0.5209645", "0.5204976", "0.520361", "0.52024716", "0.5191356", "0.5189488", "0.51769525", "0.51746887", "0.5166978", "0.5166702", "0.51655936", "0.5151625", "0.5146559", "0.5146559", "0.5144905", "0.5143084", "0.5142191", "0.51403016", "0.51403016", "0.5138553", "0.5135372", "0.5131636", "0.5128704", "0.512123", "0.51184505", "0.5117302", "0.5114261", "0.5112566", "0.51123345", "0.5105147", "0.5102093", "0.5100181", "0.5096157", "0.5096123", "0.5094921", "0.50863826", "0.5085641", "0.507978", "0.50785846", "0.5076343" ]
0.66608626
2
PUT /displays/1 PUT /displays/1.json
def update @display = Display.find(params[:id]) respond_to do |format| if @display.update_attributes(params[:display]) format.html { redirect_to @display, :notice => 'Display was successfully updated.' } format.json { head :no_content } else format.html { render :action => "edit" } format.json { render :json => @display.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @display.update(display_params)\n format.html { redirect_to @display, notice: 'Display was successfully updated.' }\n format.json { render :show, status: :ok, location: @display }\n else\n format.html { render :edit }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @display.update(display_params)\n format.html { \n flash[:success]= 'Display was successfully updated.'\n redirect_to displays_path \n }\n format.json { render :show, status: :ok, location: @display }\n else\n format.html { render :edit }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @display = Display.find(params[:id])\n\n respond_to do |format|\n if @display.update_attributes(params[:display])\n flash[:notice] = 'Display was successfully updated.'\n format.html { redirect_to(@display) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @display.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @system_overview.update(system_overview_params)\n format.html { redirect_to @system_overview, notice: 'System overview was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_overview }\n else\n format.html { render :edit }\n format.json { render json: @system_overview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attribute_display.update(attribute_display_params)\n format.html { redirect_to @attribute_display, notice: 'attribute_display was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attribute_display.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @display_item = DisplayItem.find(params[:id])\n\n respond_to do |format|\n if @display_item.update_attributes(params[:display_item])\n format.html { redirect_to @display_item, notice: 'Display item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @display_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end", "def index\n @displays = Display.all\n end", "def update\n if @display_unit.update(display_unit_params)\n render :show, status: :ok, location: @display_unit\n else\n render json: @display_unit.errors, status: :unprocessable_entity\n end\n end", "def update\n @heat_type = HeatType.find(params[:id])\n\n respond_to do |format|\n if @heat_type.update_attributes(params[:heat_type])\n format.html { redirect_to @heat_type, notice: 'Heat type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_display\n @display = Display.find(params[:id])\n end", "def set_display\n @display = Display.find(params[:id])\n end", "def update\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n if @hardware_type.update_attributes(params[:hardware_type])\n format.html { redirect_to @hardware_type, notice: 'Hardware type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hardware_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n if @hardware.update_attributes(params[:hardware])\n format.html { redirect_to @hardware, :notice => 'Hardware was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @hardware.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @displaydatum.update(displaydatum_params)\n format.html { redirect_to @displaydatum, notice: 'Displaydatum was successfully updated.' }\n format.json { render :show, status: :ok, location: @displaydatum }\n else\n format.html { render :edit }\n format.json { render json: @displaydatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: UserBoards.update(params[\"id\"], params[\"user_board\"])\n end", "def update_screen_resolution\n width = params.require(:width)\n height = params.require(:height)\n current_settings.update(screen_width: width, screen_height: height)\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def set_system_overview\n @system_overview = SystemOverview.find(params[:id])\n end", "def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @report_display.update(report_display_params)\n format.html { redirect_to @report_display, notice: 'Report display was successfully updated.' }\n format.json { render :show, status: :ok, location: @report_display }\n else\n format.html { render :edit }\n format.json { render json: @report_display.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @display = Display.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @display }\n end\n end", "def update\n @metric_type = MetricType.find(params[:id])\n\n respond_to do |format|\n if @metric_type.update_attributes(params[:metric_type])\n format.html { redirect_to @metric_type, notice: 'Metric type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metric_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def builder\n @display = Display.find(params[:id])\n @displays = Display.all\n end", "def update\n respond_to do |format|\n if @overview.update(overview_params)\n format.html { redirect_to @overview, notice: 'Overview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @overview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @swatch.update(swatch_params)\n format.html { redirect_to @swatch, notice: 'Swatch was successfully updated.' }\n format.json { render :show, status: :ok, location: @swatch }\n else\n format.html { render :edit }\n format.json { render json: @swatch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n flash.now[:success] = \"System was successfully updated.\"\n format.html { redirect_to @system }\n #proper response to http PUT is also no_content\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dash_type = DashType.find(params[:id])\n\n respond_to do |format|\n if @dash_type.update_attributes(params[:dash_type])\n format.html { redirect_to @dash_type, notice: 'Dash type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dash_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @species.update(species_params)\n format.html { redirect_to @species, notice: 'Species was successfully updated.' }\n format.json { render :show, status: :ok, location: @species }\n else\n format.html { render :edit }\n format.json { render json: @species.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @human = Human.find(params[:id])\n\n respond_to do |format|\n if @human.update_attributes(params[:human])\n format.html { redirect_to @human, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @human = Human.find(params[:id])\n\n respond_to do |format|\n if @human.update_attributes(params[:human])\n format.html { redirect_to @human, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @standard_measurement = StandardMeasurement.find(params[:id])\n\n respond_to do |format|\n if @standard_measurement.update_attributes(params[:standard_measurement])\n format.html { redirect_to @standard_measurement, notice: 'Standard measurement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @standard_measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @system_stat.update(system_stat_params)\n format.html { redirect_to @system_stat, notice: 'System stat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_stat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:user_id])\n @board = @user.boards.find(params[:id])\n @board.update_column(:content, params[:board].as_json)\n respond_to do |format|\n format.json { render json: @board }\n end\n end", "def show\n @asset = WirelessDevice.find(params[:id])\n @content_title = @title = \"Editing #{@asset.title}\"\n @submit_value = \"Update\"\n asset_show\n end", "def update\n respond_to do |format|\n if @admin_hardware_type.update(admin_hardware_type_params)\n format.html { redirect_to @admin_hardware_type, notice: 'Hardware type was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_hardware_type }\n else\n format.html { render :edit }\n format.json { render json: @admin_hardware_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @experiment_control = ExperimentControl.find(params[:id])\n\n respond_to do |format|\n if @experiment_control.update_attributes(params[:experiment_control])\n format.html { redirect_to @experiment_control, notice: 'Experiment control was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @experiment_control.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @system = System.find(params[:id])\n\n respond_to do |format|\n if @system.update_attributes(params[:system])\n format.html {redirect_to systems_url, flash[:info]='System was successfully updated.' }\n format.js { flash[:info]='System was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n record = Asset.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @screencast = Screencast.find(params[:id])\n\n respond_to do |format|\n if @screencast.update_attributes(params[:screencast])\n format.html { redirect_to @screencast, notice: 'Screencast was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @screencast.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @display = Display.new(params[:display])\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, :notice => 'Display was successfully created.' }\n format.json { render :json => @display, :status => :created, :location => @display }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @display.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @metadata_schema = MetadataSchema.find(params[:id])\n\n respond_to do |format|\n if @metadata_schema.update_attributes(params[:metadata_schema])\n @metadata_schemas = MetadataSchema.arrange(:order => :created_at)\n format.html { redirect_to @metadata_schema, notice: 'Metadata schema was successfully updated.' }\n format.json { head :no_content }\n format.js { render 'create.js'}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metadata_schema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @screen_setting = ScreenSetting.find(params[:id])\n\n respond_to do |format|\n if @screen_setting.update_attributes(params[:screen_setting])\n format.json { render json: @screen_setting, status: :ok }\n else\n format.json { render json: @screen_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @display = Display.new(display_params)\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, notice: 'Display was successfully created.' }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hardware.update(permitted_params[:hardware])\n format.html { redirect_to @hardware, notice: 'Hardware was successfully updated.' }\n format.json { render :show, status: :ok, location: @hardware }\n else\n format.html { render :edit }\n format.json { render json: @hardware.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @visual_fidelity = VisualFidelity.find(params[:id])\n\n respond_to do |format|\n if @visual_fidelity.update_attributes(params[:visual_fidelity])\n format.html { redirect_to @visual_fidelity, notice: 'Visual fidelity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @visual_fidelity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @disponible = Disponible.find(params[:id])\n\n if @disponible.update(disponible_params)\n head :no_content\n else\n render json: @disponible.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'[email protected]_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @show_type.update(show_type_params)\n format.html { redirect_to @show_type, notice: 'Show type was successfully updated.' }\n format.json { render :show, status: :ok, location: @show_type }\n else\n format.html { render :edit }\n format.json { render json: @show_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @media_type = MediaType.find(params[:id])\n\n respond_to do |format|\n if @media_type.update_attributes(params[:media_type])\n format.html { redirect_to @media_type, notice: 'Media type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @media_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end", "def create\n @display = Display.new(display_params)\n screens_num = params[:split_in];\n # creamos las screens necesarias\n saved = @display.save\n \n create_screens(screens_num)\n\n respond_to do |format|\n if saved\n format.html { \n flash[:success]= 'Display was successfully created.' \n redirect_to displays_path \n }\n format.json { render :show, status: :created, location: @display }\n else\n format.html { render :new }\n format.json { render json: @display.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series].merge({:version_attributes=>{},:thumbnail_attributes=>{:name=>params[:series][:name],:original_link=>params[:series][:thumbnail_link],:remote_image_url=>params[:series][:thumbnail_link]} }))\n format.html { redirect_to @series, :notice => 'Series was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n if @cloud.update_attributes(params[:cloud])\n format.html { redirect_to @cloud, :notice => 'Cloud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cloud.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @serving_format.update(serving_format_params)\n format.html { redirect_to @serving_format, notice: \"Serving format was successfully updated.\" }\n format.json { render :show, status: :ok, location: @serving_format }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @serving_format.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @heat_source = HeatSource.find(params[:id])\n\n respond_to do |format|\n if @heat_source.update_attributes(params[:heat_source])\n format.html { redirect_to @heat_source, notice: 'Heat source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_source.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @experiment = Experiment.find(params[:id])\n @title = \"Microarray experiments\"\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to(@experiment, :notice => 'Microarray experiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @screen.update(screen_params)\n format.html { redirect_to @screen, notice: 'Screen was successfully updated.' }\n format.json { render :show, status: :ok, location: @screen }\n else\n format.html { render :edit }\n format.json { render json: @screen.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n @resource_type = args[:resource_type] if args.key?(:resource_type)\n end", "def update\n @shelter = Shelter.find(params[:id])\n @shelter.update_attributes(params[:shelter])\n \n respond_with(@shelter, :location => admin_shelter_path(@shelter))\n end", "def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end", "def update\n @gather = Gather.find(params[:id])\n\n respond_to do |format|\n if @gather.update_attributes(params[:gather])\n format.html { redirect_to @gather, notice: 'Gather was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gather.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @width = Width.find(params[:id])\n\n respond_to do |format|\n if @width.update_attributes(params[:width])\n format.html { redirect_to @width, notice: 'Width was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @width.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @show = Show.find(params[:id])\n\n respond_to do |format|\n if @show.update_attributes(params[:show])\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @microsite.update(microsite_params)\n format.html { redirect_to @microsite, notice: 'Microsite was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @microsite }\n else\n format.html { render action: 'edit' }\n format.json { render json: @microsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entry = Entry.find(params[:id])\n\t\n\[email protected]_list = \"\"\n\t@systems = params[:systems]\n\[email protected] do |s|\n\t\[email protected]_list.add(s)\n\tend\t\n\t\n\[email protected]_list = \"\"\n\t@components = params[:components]\n\[email protected] do |c|\n\t\[email protected]_list.add(c)\n\tend\n\t\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to(@entry, :notice => 'Entry was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @hydraulic_system = HydraulicSystem.find(params[:id])\n\n respond_to do |format|\n if @hydraulic_system.update_attributes(params[:hydraulic_system])\n format.html { redirect_to @hydraulic_system, notice: 'Hydraulic system was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hydraulic_system.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n if @illustration.update_attributes(params[:illustration])\n format.html { redirect_to @illustration, :notice => 'Illustration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @illustration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n if @mostsmallresource.update_attributes(params[:mostsmallresource])\n format.html { redirect_to @mostsmallresource, notice: 'Mostsmallresource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallresource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @show = Show.find(params[:id])\n\n respond_to do |format|\n if @show.update_attributes(params[:show])\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @show = Show.find(params[:id])\n\n respond_to do |format|\n if @show.update_attributes(params[:show])\n format.html { redirect_to @show, notice: 'Show was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @show.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @record = Asset.find(params[:id])\n @record.update_attributes(params[:@record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end", "def update\n respond_to do |format|\n if @monitorium.update(monitorium_params)\n format.html { redirect_to @monitorium, notice: 'Monitoria atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @monitorium }\n else\n format.html { render :edit }\n format.json { render json: @monitorium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @availablity = Availablity.find(params[:id])\n\n respond_to do |format|\n if @availablity.update_attributes(params[:availablity])\n format.html { redirect_to @availablity, notice: 'Availablity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @availablity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n if @ami.update_attributes(params[:ami])\n format.html { redirect_to @ami, notice: 'Ami was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n find_asset\n @asset.update!(asset_params)\n\n render json: @asset, adapter: :json\n end", "def update\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n if @collab.update_attributes(params[:collab])\n format.html { redirect_to @collab, notice: 'Collab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collab.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @display_zone = DisplayZone.find(params[:id])\n\n respond_to do |format|\n if @display_zone.update_attributes(params[:display_zone])\n flash[:notice] = 'DisplayZone was successfully updated.'\n format.html { redirect_to(@display_zone) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @display_zone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @screen = Screen.find(params[:id])\n\n respond_to do |format|\n if @screen.update_attributes(params[:screen])\n flash[:notice] = 'Screen was successfully updated.'\n format.html { redirect_to hiring_screen_url(@screen) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @screen.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cpu.update(cpu_params)\n format.html { redirect_to cpus_url }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cloud.update(cloud_params)\n format.html { redirect_to @cloud, notice: 'Cloud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stable = Stable.find(params[:id])\n\n respond_to do |format|\n if @stable.update_attributes(params[:stable])\n format.html { redirect_to @stable, notice: 'Stable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sensor.update(sensor_params)\n format.html { redirect_to @sensor, notice: 'Sensor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sensor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sensor.update(sensor_params)\n format.html { redirect_to @sensor, notice: 'Sensor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sensor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @visual.update(visual_params)\n format.html { redirect_to @visual, notice: 'Visual was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @visual.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @host = Host.find(params[:id])\n\n if @host.update(params[:host])\n head :no_content\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end", "def show\n @hardware = Hardware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @hardware }\n end\n end" ]
[ "0.6391333", "0.6046896", "0.6025971", "0.599391", "0.59579", "0.5889966", "0.5852696", "0.5840017", "0.5769007", "0.5767611", "0.5656527", "0.5615269", "0.5615269", "0.5611087", "0.55896235", "0.55652785", "0.5553896", "0.55279565", "0.5514554", "0.5513218", "0.5500137", "0.5495694", "0.5486728", "0.54850763", "0.5468113", "0.54631096", "0.5460321", "0.54565287", "0.54563886", "0.54481214", "0.54400635", "0.54400635", "0.5436593", "0.5433063", "0.5422616", "0.54170537", "0.54119056", "0.54111326", "0.5405725", "0.5405543", "0.53986824", "0.53945225", "0.53878486", "0.53843397", "0.53709", "0.5354257", "0.53494257", "0.5347804", "0.53463966", "0.5341651", "0.53394455", "0.5338771", "0.53322667", "0.5330871", "0.53292114", "0.53285825", "0.532673", "0.53248096", "0.5323771", "0.5317215", "0.53114283", "0.53106505", "0.53090525", "0.5303902", "0.53031445", "0.52998906", "0.52955943", "0.5292924", "0.5287683", "0.5283574", "0.52831656", "0.52806413", "0.52765375", "0.5272179", "0.5266711", "0.52549326", "0.5254623", "0.52536845", "0.5253054", "0.5252692", "0.52524644", "0.52524155", "0.52524155", "0.5251504", "0.5246771", "0.5246638", "0.5245196", "0.52421415", "0.5240205", "0.52399665", "0.5239895", "0.5236615", "0.5234499", "0.5231529", "0.52300835", "0.52274597", "0.52274597", "0.52274543", "0.52250105", "0.5223754" ]
0.64890707
0
DELETE /displays/1 DELETE /displays/1.json
def destroy @display = Display.find(params[:id]) @display.destroy respond_to do |format| format.html { redirect_to displays_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to(displays_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @display.destroy\n respond_to do |format|\n format.html { redirect_to displays_url, notice: 'Display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_type = HeatType.find(params[:id])\n @heat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @displaydatum.destroy\n respond_to do |format|\n format.html { redirect_to displaydata_url, notice: 'Displaydatum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @display_item = DisplayItem.find(params[:id])\n @display_item.destroy\n\n respond_to do |format|\n format.html { redirect_to display_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attribute_display.destroy\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @display.destroy\n respond_to do |format|\n format.html { \n redirect_to displays_url \n flash[:warning]= 'Display was successfully destroyed.' \n }\n format.json { head :no_content }\n end\n end", "def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humen_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to metric_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_display.destroy\n respond_to do |format|\n format.html { redirect_to report_displays_url, notice: 'Report display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @absent.destroy\n\n respond_to do |format|\n format.html { redirect_to absents_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unsigned_columns_test = UnsignedColumnsTest.find(params[:id])\n @unsigned_columns_test.destroy\n\n respond_to do |format|\n format.html { redirect_to unsigned_columns_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @display_type = DISPLAY_TYPE_SIMPLE\n\n begin\n @database = set_ar(params).find(params[:id])\n\n @database.destroy\n\n flash[:notice] = t(:success_deleted, :id => @database.id)\n redirect_to(:action => :index)\n rescue => e\n flash[:error] = t(:error_default, :message => e.message)\n render :action => :index\n end\n end", "def destroy\n @matrixspecy.destroy\n respond_to do |format|\n format.html { redirect_to matrixspecies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end", "def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diagnoz = Diagnoz.find(params[:id])\n @diagnoz.destroy\n\n respond_to do |format|\n format.html { redirect_to diagnozs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capture = Capture.find(params[:id])\n @capture.destroy\n\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hydraulic_system = HydraulicSystem.find(params[:id])\n @hydraulic_system.destroy\n\n respond_to do |format|\n format.html { redirect_to hydraulic_systems_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hardware_type = HardwareType.find(params[:id])\n @hardware_type.destroy\n\n respond_to do |format|\n format.html { redirect_to hardware_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ami = Ami.find(params[:id])\n @ami.destroy\n\n respond_to do |format|\n format.html { redirect_to amis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure_instance.destroy\n respond_to do |format|\n format.html { redirect_to measure_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render json: UserBoards.delete(params[\"id\"])\n end", "def destroy\n @hardware = Hardware.find(params[:id])\n @hardware.destroy\n\n respond_to do |format|\n format.html { redirect_to hardwares_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset = Resource.find(params[:id])\n @asset.destroy\n respond_to do |format|\n format.html { redirect_to admin_resources_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @auto = Auto.find(params[:id])\n @auto.destroy\n\n respond_to do |format|\n format.html { redirect_to autos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_log = HeatLog.find(params[:id])\n @heat_log.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @human_condition = HumanCondition.find(params[:id])\n @human_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to human_conditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to \"/dynamics/#{@board.dynamic_id}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @dispatch = Dispatch.find(params[:id])\n @dispatch.destroy\n\n respond_to do |format|\n format.html { redirect_to dispatches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ssd.destroy\n respond_to do |format|\n format.html { redirect_to ssds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visual.destroy\n respond_to do |format|\n format.html { redirect_to visuals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { render :action => :admin_dash, :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @standard_measurement = StandardMeasurement.find(params[:id])\n @standard_measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to standard_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_stat.destroy\n respond_to do |format|\n format.html { redirect_to system_stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_overview.destroy\n respond_to do |format|\n format.html { redirect_to system_overviews_url, notice: 'System overview was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asset = WirelessDevice.find(params[:id])\n asset_destroy(wireless_url)\n end", "def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @experiment_biomechanical = ExperimentBiomechanical.find(params[:id])\n @experiment_biomechanical.destroy\n\n respond_to do |format|\n format.html { redirect_to experiment_biomechanicals_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @heat_source = HeatSource.find(params[:id])\n @heat_source.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_sources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n current_admin_user\n @tablet = Tablet.find(params[:id])\n @tablet.destroy\n\n respond_to do |format|\n format.html { redirect_to tablets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @matchsindiv = Matchsindiv.find(params[:id])\n @matchsindiv.destroy\n\n respond_to do |format|\n format.html { redirect_to matchsindivs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capture.destroy\n respond_to do |format|\n format.html { redirect_to captures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @automovile.destroy\n respond_to do |format|\n format.html { redirect_to automoviles_url, notice: \"Automovile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @visual_fidelity = VisualFidelity.find(params[:id])\n @visual_fidelity.destroy\n\n respond_to do |format|\n format.html { redirect_to visual_fidelities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cloud = Cloud.find(params[:id])\n @cloud.destroy\n\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_device = LabDevice.find(params[:id])\n @lab_device.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_devices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @width = Width.find(params[:id])\n @width.destroy\n\n respond_to do |format|\n format.html { redirect_to widths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @band.destroy\n respond_to do |format|\n format.html { redirect_to bands_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @onecolumnmodel = Onecolumnmodel.find(params[:id])\n @onecolumnmodel.destroy\n\n respond_to do |format|\n format.html { redirect_to onecolumnmodels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'[email protected]_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @dbh_measurement.destroy\n respond_to do |format|\n format.html { redirect_to dbh_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure_group = MeasureGroup.find(params[:id])\n @measure_group.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gather = Gather.find(params[:id])\n @gather.destroy\n\n respond_to do |format|\n format.html { redirect_to gathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @host_tpl = HostTpl.find(params[:id])\n @host_tpl.destroy\n\n respond_to do |format|\n format.html { redirect_to host_tpls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades2 = Humanidades2.find(params[:id])\n @humanidades2.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades2s_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @bg_setup = BgSetup.find(params[:id])\n @bg_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to bg_setups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_hardware_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_hardware_types_url, notice: 'Hardware type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @host = Host.find(params[:id])\n @host.destroy\n\n head :no_content\n end", "def destroy\n @screenshot = Screenshot.find(params[:id])\n @screenshot.destroy\n\n respond_to do |format|\n format.html { redirect_to screenshots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @host = Host.find_by(hostname: params[:id])\n @host.destroy\n\n head :no_content\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_houses_url(:realty_type => params[:realty_type]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @show = Show.find(params[:id])\n @show.destroy\n\n respond_to do |format|\n format.html { redirect_to shows_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7295277", "0.7247227", "0.6883154", "0.68739027", "0.68485904", "0.6832466", "0.68277794", "0.68199867", "0.67659575", "0.67593324", "0.66454387", "0.66435814", "0.66037893", "0.66037893", "0.6603657", "0.66025704", "0.66011417", "0.6591571", "0.65859663", "0.654852", "0.6547301", "0.6539368", "0.65370345", "0.653463", "0.65177315", "0.65098584", "0.6500602", "0.65005946", "0.65001744", "0.6499055", "0.6498172", "0.6496811", "0.6494762", "0.6488702", "0.6486984", "0.6479335", "0.647856", "0.647633", "0.647549", "0.64725953", "0.6469588", "0.64663666", "0.64626807", "0.6462259", "0.64601827", "0.64574164", "0.6456481", "0.6456301", "0.64532655", "0.64530164", "0.645289", "0.644847", "0.6447398", "0.6436605", "0.6433558", "0.6430735", "0.6421653", "0.64212275", "0.6421089", "0.6420256", "0.6413673", "0.64081687", "0.64081556", "0.64067644", "0.6406413", "0.6405786", "0.6405407", "0.640348", "0.64008456", "0.6400495", "0.6394211", "0.6392525", "0.6390567", "0.6387759", "0.63870436", "0.6385801", "0.6384105", "0.63805944", "0.6375608", "0.6374974", "0.6374461", "0.6372629", "0.63706034", "0.6366839", "0.6365866", "0.6362469", "0.63620794", "0.6361788", "0.6359617", "0.6354654", "0.6354016", "0.6353142", "0.6352521", "0.634964", "0.63495064", "0.634833", "0.6347253", "0.6343705", "0.6343146", "0.63411695" ]
0.748138
0
Compatibility methods for Rails 2 templates
def pickle_path options.paths? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rendered_templates; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def _render_template(options); end", "def _render_template(options); end", "def extensions_for(template_class); end", "def extensions_for(template_class); end", "def template() false end", "def apply_template_before?; end", "def templates; end", "def render_template(context, options); end", "def view_renderer; end", "def view_renderer; end", "def determine_template(options); end", "def template_name; end", "def template_name; end", "def rendered_format; end", "def rendered_format; end", "def __in_erb_template;\n end", "def __in_erb_template;\n end", "def get_template(template); end", "def template_engine\n @template_engine ||= :erb\n end", "def render_plain\n template_content\n end", "def render_template(view, template, layout_name, locals); end", "def template_source\n raise NotImplementedError\n end", "def template(name); end", "def liquid_renderer; end", "def apply_template_after?; end", "def prefer(template_class, *extensions); end", "def template_text\n self.to_html ? self.body_html : self.body\n end", "def render_with_liquid?; end", "def render_with_liquid?; end", "def user_template\n super\n end", "def deprecated\n return unless object.has_tag?(:deprecated)\n\n erb(:deprecated)\nend", "def helper\n @template\n end", "def renderer\n Cms::RenderTemplate.new\n end", "def erb(template) render template end", "def to_html\t\t\t\t\n\t\thtml = if visible?\n\t\t\t#\t\t\tif Utils::TemplateHelper.template_exist? self.class\n\t\t\thtml = Utils::TemplateHelper.render_template self.class, :binding => binding, :preprocessing => true\n\t\t\t#\t\t\telse\n\t\t\t#\t\t\t\thtml = Utils::TemplateHelper.render_template(WComponent, :binding => binding, :resource => \"default.#{TEMPLATE_EXTENSION}\")\n\t\t\t#\t\t\tend\n\t\telse\n\t\t\t\"\"\n\t\tend\n\t\treturn Utils::TemplateHelper.render_template(WComponent, :binding => binding,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t:resource => \"wrapper.#{TEMPLATE_EXTENSION}\")\n\tend", "def render_erb\n end", "def helpers\n ActionController::Base.helpers # you can also try @template.helpers OR self.class.helpers OR include ActionView::Helpers\n end", "def template_page(site); end", "def to_html\n render template\n end", "def tpl_ext; return @@tpl_ext; end", "def erb(template, options = {}, locals = {})\n template = template.to_sym\n options[:layout] = options[:layout].present? ? options[:layout] : !request.xhr?\n \n super\n end", "def markup_context; end", "def template_for(file); end", "def text_helper\n gem 'actionpack'\n require 'action_controller' # bringing this in for autolinks\n helper = Object.new\n helper.extend ActionView::Helpers::TextHelper\n helper.extend ActionView::Helpers::TagHelper\n helper\nend", "def template_extensions\n %w(mod dat)\n end", "def render(options=nil, deprecated_status_or_extra_options=nil, &block)\n if ::Rails::VERSION::STRING >= '2.0.0' && deprecated_status_or_extra_options.nil?\n deprecated_status_or_extra_options = {}\n end\n \n unless block_given?\n unless integrate_views?\n if @template.respond_to?(:finder)\n (class << @template.finder; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n else\n (class << @template; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n end\n (class << @template; self; end).class_eval do\n define_method :render_file do |*args|\n @first_render ||= args[0] unless args[0] =~ /^layouts/\n end\n \n define_method :pick_template do |*args|\n @_first_render ||= args[0] unless args[0] =~ /^layouts/\n PickedTemplate.new\n end\n end\n end\n end\n\n if matching_message_expectation_exists(options)\n expect_render_mock_proxy.render(options, &block)\n @performed_render = true\n else\n if matching_stub_exists(options)\n @performed_render = true\n else\n super(options, deprecated_status_or_extra_options, &block)\n end\n end\n end", "def render; end", "def render; end", "def render; end", "def render; end", "def render; end", "def template_map\n \n end", "def template\n return @template\n end", "def url_template; end", "def url_template; end", "def template_tag\n if @tag\n @tag\n else\n TEMPLATE_TAG\n end\n end", "def rendered=(_arg0); end", "def rendering_options\n end", "def render( template, scope )\n\t\treturn ''\n\tend", "def template\n @template ||= self.class.template\n end", "def default_render\n response.content_type.blank? ? respond_to(:html) : super \n end", "def _wrapper_formats; end", "def add_template_pages; end", "def template_name=(_arg0); end", "def template_name=(_arg0); end", "def fulldoc_template; end", "def template_engine_gem_str(css_framework = '')\n case css_framework.to_s\n when 'semantic'\n 'semantic_ui'\n else\n 'bootstrap'\n end\nend", "def template\n @template\n end", "def render!; raise NotImplementedError end", "def template_for file, page = true, klass = ERB\n template = @template_cache[file]\n\n return template if template\n\n if page then\n template = assemble_template file\n erbout = 'io'\n else\n template = file.read\n template = template.encode @options.encoding\n\n file_var = File.basename(file).sub(/\\..*/, '')\n\n erbout = \"_erbout_#{file_var}\"\n end\n\n if RUBY_VERSION >= '2.6'\n template = klass.new template, trim_mode: '-', eoutvar: erbout\n else\n template = klass.new template, nil, '-', erbout\n end\n @template_cache[file] = template\n template\n end", "def render(context, options); end", "def template\n @__template\n end", "def initialize_template_class_with_engine_additions(assigns)\n # I'd like to just return this, but I get problems finding methods in helper\n # modules if the method implemention from the regular class is not called\n # \n # ActionView::Base.new(ActionController::Base.view_paths.dup, assigns, self)\n renderer = initialize_template_class_without_engine_additions(assigns)\n renderer.finder.view_paths = ActionController::Base.view_paths.dup\n renderer\n end", "def render_deprecations\n\t\ttemplate = self.load_template( DEPRECATIONS_TEMPLATE )\n\t\treturn template.result( binding() )\n\tend", "def revert!\n ::ActionView::Template.class_eval do\n alias_method :compile!, :cb_original_compile! # rubocop:disable Lint/DuplicateMethods\n undef_method :cb_patched_compile!\n end\n end", "def template\n templater.template\n end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def initialize_template(record)\n source = record.body || \"\"\n virtual_path = \"pages/#{I18n.locale}_#{record.name}_#{record.permalink}\"\n handler = ActionView::Template.registered_template_handler('erb')\n details = {\n :format => Mime['html'],\n :updated_at => record.updated_at,\n :virtual_path => virtual_path\n }\n ActionView::Template.new(source, \"DbPageTemplate - #{virtual_path}\", handler, details)\n end", "def template_map\n return TEMPLATE_MAP\n end", "def _template\n @template\n end", "def render_erb(template_path, params) \n view = ActionView::Base.new(ActionController::Base.view_paths, {}) \n \n class << view \n include ApplicationHelper, FeeCalcsHelper\n end \n \n view.render(:file => \"#{template_path}.html.erb\", :locals => params) \n end", "def process_default_render exp\n process_layout\n process_template template_name, nil\n end", "def >>(klass); @template.hook(klass); end", "def _normalize_render(*args, &block); end", "def render(object = T.unsafe(nil)); end", "def t\n @template\n end", "def asset_class\n return Template\n end", "def find_template(views, name, engine, &block)\n I18n.fallbacks[I18n.locale].each { |locale|\n super(views, \"#{name}.#{locale}\", engine, &block) }\n super(views, name, engine, &block)\n end", "def markup_context=(_arg0); end", "def templates_for(file); end" ]
[ "0.66565067", "0.65028983", "0.65028983", "0.65028983", "0.65028983", "0.65028983", "0.65028983", "0.65028983", "0.64364225", "0.64364225", "0.64215994", "0.64215994", "0.63985896", "0.6364262", "0.6347739", "0.6285156", "0.6234638", "0.6234638", "0.61536205", "0.6146451", "0.6146451", "0.60836005", "0.60836005", "0.60685146", "0.60685146", "0.594101", "0.592933", "0.5929161", "0.59228605", "0.5890726", "0.58906287", "0.58839923", "0.5871253", "0.5867184", "0.5853721", "0.585221", "0.585221", "0.584639", "0.58317983", "0.58264476", "0.5814928", "0.57960945", "0.57923585", "0.5791621", "0.57783526", "0.5762962", "0.574622", "0.573799", "0.5736587", "0.5730066", "0.5716473", "0.5703296", "0.5702417", "0.5666447", "0.562792", "0.562792", "0.562792", "0.562792", "0.562792", "0.5626891", "0.56259954", "0.56258327", "0.56258327", "0.5624969", "0.56026703", "0.55811256", "0.5576031", "0.5570137", "0.55678993", "0.5566464", "0.5563388", "0.5562624", "0.5562624", "0.5556187", "0.5555624", "0.5540798", "0.5534886", "0.553299", "0.55302006", "0.55282664", "0.55161124", "0.5503907", "0.550302", "0.54836226", "0.5482154", "0.5482154", "0.5482154", "0.5482154", "0.54765475", "0.54741955", "0.5441318", "0.5430849", "0.54305834", "0.5427111", "0.5425633", "0.5422187", "0.54191834", "0.5414402", "0.541363", "0.5397548", "0.5394151" ]
0.0
-1
List the house contract based on the houseid/userid/roleId combination
def contracts #if isAuth(@userhouselink.house) # only house owner or admin can delete id = params[:id] print "contracts id=" + id.to_s #houseId_userId_roleNumber houseId,userId,role = id.to_s.split("_") print "houseId=" + houseId.to_s + ", userId=" + userId.to_s + ", role=" + role.to_s if(houseId && userId && role) @user_house_contracts = UserHouseContract.where(:house_id => houseId, :user_id => userId, :role => role) else @errMsg = "Invalid input format." print @errMsg render 'error', :status => :unprocessable_entity end # #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n if User.find(session[:id]).role_type == \"admin\"\n @house_interest_lists = HouseInterestList.all\n elsif User.find(session[:id]).role_type == \"buyer\"\n @house_interest_lists = HouseInterestList.where(\"user_id = ?\", session[:id])\n else\n # TODO Filter all houses which are added by realtor and his companies houses\n @house_interest_lists = HouseInterestList.where(\"house_id in ?\", House.where(\"user_id\", session[:id]))\n @house_interest_lists = HouseInterestList.where(\"user_id = ?\", session[:id])\n end\n end", "def index\n session[:previous_url] = request.referer\n @houses = House.all\n @role = session[:role]\n if @role == \"househunter\"\n @househunter = Househunter.find_by(:users_id => session[:user_id])\n elsif @role == \"realtor\"\n @realtor = Realtor.find_by(:users_id => session[:user_id])\n end\n end", "def show\n session[:previous_url] = request.referer\n @company_name = Company.find(House.find(params[:id]).companies_id).name\n @houseid = params[:id]\n @role = session[:role]\n\n if @role ==\"househunter\"\n @househunter = Househunter.find_by(:users_id => session[:user_id])\n @interested_househunter = InterestedHousehunter.find_by(:house_id => params[:id], :househunter_id => @househunter.id)\n elsif @role == \"realtor\"\n @realtor = Realtor.find_by(:users_id => session[:user_id])\n end\n\n end", "def index\n @users = BranchOffice.find(params[:branch_office_id]).users.employee\n authorize @users\n end", "def index\n @houses = House.all if admin_signed_in? || hunter_signed_in?\n if realtor_signed_in?\n @houses = House.where(real_estate_company_id: current_realtor.real_estate_company_id)\n end\n end", "def index\n @loanables = current_user.loanables.includes(:loan_contracts).all\n end", "def index\n @q = current_user.houses.ransack(params[:q])\n @houses = @q.result(distinct: true).page params[:page]\n #@houses = current_user.houses.all.page params[:page]\n authorize @houses\n end", "def index\n @greenhouse = Greenhouse.find(params[:greenhouse_id])\n @customers = @greenhouse.customers.order(id: :asc)\n end", "def show\n\t @household = Household.find(params[:id])\n\t @users = @household.users\n\tend", "def show\n @house = House.find(params[:id])\n begin\n company = Company.find(@house.company_id)\n companyName = company.name\n rescue\n end\n realtor= User.find(@house.realtor_id)\n\n realtorName = realtor.name\n\n @list_price = get_formatted_price(@house.list_price)\n\n if([email protected]? && @house.floors > 0)\n @floors = @house.floors.to_s+\" floor\"\n if @house.floors > 1\n @floors += \"s\"\n end\n end\n\n @ago = get_time_ago\n @basements = (@house.basement)?\"Contains basement!\":\"(Does not contain a basement)\"\n\n @contactExists = (!companyName.nil? || !realtorName.nil?)\n\n if(@contactExists)\n if(!companyName.nil?)\n @companyName = companyName\n @companyHref = \"/companies/#{company.id}\"\n end\n if(!realtorName.nil?)\n @realtorName= realtorName\n @realtorHref = \"/users/#{@house.realtor_id}\"\n @realtorContact = realtor.email\n end\n end\n\n ctas = []\n if(current_user.nil?)\n\n elsif(isOnlyHouseHunter? || isHouseHunter?(current_user))\n ctas.push({\"text\":\"I'm Interested!\",\"action\":\"javascript:void(0)\",\"successErrorMessaging\":true,\n \"success\":\"Thank you for your interest!\",\"failure\":\"Something went wrong.\",\"id\":\"interestCta\"})\n end\n\n if !logged_in?\n @is_my_old_house = false\n else\n @is_my_old_house = isRealtor?(current_user) && @house.realtor_id == current_user.id && @house.company_id != current_user.company_id\n end\n\n if( (isRealtor?(current_user) && @house.realtor_id == current_user.id && @house.company_id == current_user.company_id) || isOnlyAdmin?)\n # ctas.push({\"text\":\"Interests & Inquiries\",\"action\":\"/\"})\n ctas.push({\"text\":\"Remove\",\"id\":\"removeHouse\"})\n ctas.push({\"text\":\"Edit\",\"action\":edit_house_path(@house)})\n end\n @ctas = ctas\n\n if(logged_in?)\n @show_inq_form = is_user_interested(@house.id,current_user.id) || isOnlyAdmin?\n else\n @show_inq_form = false\n end\n @hide_class_inq_form = (@show_inq_form)?\"\":\" hide\"\n\n\n get_interests_inquiries_text(@house.id,logged_in?,@current_user)\n\n @viewing_own_house = (logged_in? && current_user.id == @house.realtor_id) || isOnlyAdmin?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @house }\n end\n end", "def show_lawyer_list\n authorize!(:show_lawyer_list,current_user) unless current_user.role?:secretary\n #session[:verified_secretary_id1] = params[:service_provider_id]\n if params[:search].nil?\n @employees = Employee.paginate :page => params[:page], :order => 'employees.created_at DESC', :per_page=>20, :include=>[:user=>[:role,:service_provider_employee_mappings]]\n else\n @employees = Employee.get_employees(params)\n end\n end", "def household_users\n User.where(id: household_user_ids)\n end", "def index\n @household_members = HouseholdMember.all\n end", "def index\n\tif params[:id]\n\t\trender show\n\telse \n\t\t# everybody coud only see his own data\n\t\tif @current_user.is_admin?\n\t\t\t@subcontractors = Subcontractor.all\n\t\telse\n\t\t\tif current_user.subcontractor\n\t\t\t\t@subcontractors = [current_user.subcontractor]\n\t\t\telse\n\t\t\t\t@subcontractors = []\n\t\t\tend\n\t\tend\n\tend\n end", "def index\n @user = User.find(params[:user_id])\n @user_contract_ideas = @user.user_contract_ideas\n end", "def index\n opts = {\n }.delete_if { |key, value| value.blank? }\n opts[:title] = /.*#{params[:key]}.*/ unless params[:key].blank?\n\n @houses = House.where(opts).select do |house|\n current_user.allow?(house.id, :view)\n end\n @houses = paginate(Kaminari.paginate_array(@houses))\n end", "def show\n #@contracts = @user.contracts\n end", "def index\n @user = current_user\n @contract_items = ContractItem.all\n end", "def index\n \n #To display the new Clearing house entry to admins\n if(is_user_admin?)\n @clearing_house = ClearingHouse.new\n end\n #------\n #Only for admins, can be removed I believe\n @clearing_houses = ClearingHouse.all\n @permissions = ClearingHouse.where(\"user_id =?\", current_user_id)\n \n \n end", "def index\n @user_household_ledgers = UserHouseholdLedger.all\n end", "def index\n @company = Company.find(params[:company_id])\n @users = @company.users.where(\"role > 0\").paginate(:page => params[:page], :per_page => 15)\n end", "def index\n\t if current_user.household == nil\n\t \t@households = Household.all\n\t else redirect_to household_path(current_user.household)\n\t end\n\tend", "def show\n curr_user = Member.find_by(email: session[:user_id])\n if (curr_user && curr_user.id.to_s == params[:id]) || session[:is_admin?]\n @member = Member.find(params[:id])\n checkout_list = History.where(member_email: @member.email, status: \"Checkedout\")\n @book_list = []\n book_id_list = checkout_list.map { |x| x[:book_id] }\n book_id_list.each do |id|\n @book_list << id\n end\n else\n flash[:notice] = \"No Monkey Business!\"\n redirect_to '/books' \n end\n end", "def index\n if current_user\n @bids = current_user.bids\n elsif current_contractor\n @bids = current_contractor.bids\n end\n end", "def index\n client_application_id = current_user.client_application_id.to_s\n @roles = Role.where(client_application_id: client_application_id)\n end", "def indexUser\n #to show a list of the contract for the user\n @packages = Package.where(\"user_id == ?\", current_user.id)\n @journeys = Journey.where(\"driverID_id == ?\", current_user.id)\n @matches = Match.where(\"packageID_id IN (?) or journeyID_id IN (?)\", @packages.ids, @journeys.ids)\n @delivery_orders = DeliveryOrder.where(\"matchID_id IN (?)\", @matches.ids)\n end", "def show\n @people = Role.where(event_id: @event.id).where(accepted: true)\n @pending_people = Role.where(event_id: @event.id).where(accepted: false)\n @invited_people = Invitation.where(event_id: @event.id).where(accepted: false)\n @total_cost = @event.get_total_cost(@role)\n @total_paid = 0\n @role.expenses.each { |expense| @total_paid += expense.amount.to_f if expense.approved}\n @total_owed = @total_cost - @total_paid\n @pending_expenses = @event.expenses.where(approved: false)\n end", "def index\n\n #@user_role = params[:user_role]\n #@user_id = params[:user_id]\n\n if params[:api_id]\n @api_id = params[:api_id]\n @employes = Employe.where(:organisme_id => @api_id).all\n else\n @employes = Employe.all\n end\n\n end", "def show\n @sponsor = Program.find(params[:sponsor_id])\n if is_admin?(@sponsor)\n @role = Role.find(params[:id])\n @roles_users = @sponsor.roles_users.for_role(@role).all\n @all_users = User.order(:last_name).to_a\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n else\n redirect_to(sponsor_path(params[:sponsor_id]))\n end\n end", "def index\n @collaborators = User\n .includes(:chef_account)\n .where.not(id: params[:ineligible_user_ids])\n .limit(20)\n\n if params[:q]\n @collaborators = @collaborators.search(params[:q])\n end\n\n respond_to do |format|\n format.json\n end\n end", "def index\n if current_user.has_role? :admin\n @booklists = Booklist.all\n else\n @booklists = Booklist.where(user_id: current_user.id).order(:serial)\n end\n end", "def show\n case @user.role\n when \"property_manager\"\n @buildings = Building.where(:property_manager_id => @user.id)\n when \"account_manager\"\n @buildings = Building.where(:account_manager_id => @user.id)\n when \"regional_manager\"\n @buildings = Building.where(:regional_manager_id => @user.id)\n when \"super_admin\", \"admin\"\n @buildings = Building.all \n end\n end", "def index\n @house_lists = HouseList.all\n end", "def index\n current_user\n if params[:user_id].present?\n @clients = User.find_by_id(current_user).clients\n @jobs = User.find_by_id(current_user).invoices\n else\n @clients = User.all\n end\n end", "def read_all(user_guid)\n organizations_list = []\n orgs_list = @client.organizations\n\n orgs_list.each do |org|\n owner = org.managers.find { |manager| manager.guid == user_guid }\n billing = org.billing_managers.find { |billing| billing.guid == user_guid }\n auditor = org.auditors.find { |auditor| auditor.guid == user_guid }\n\n if owner || billing || auditor\n organizations_list << Organization.new(org.name, 0, org.users.count, org.guid, false)\n end\n end\n\n organizations_list.sort! { |first_org, second_org| first_org.name.downcase <=> second_org.name.downcase }\n end", "def index\n if (current_user.role == \"customer\" || current_user.role == \"supervisor\")\n if params[:org_id].present?\n add_breadcrumb 'Organizations', 'organizations_path'\n add_breadcrumb \"#{Organization.where(:id => params[:org_id])[0].company_name}\", '#' \n add_breadcrumb \"Contacts\", 'organization_contacts_path(:org_id => \"#{params[:org_id]}\")'\n @organization_contacts = OrganizationContact.where(:delflag => false, :organization_id => \"#{params[:org_id]}\").paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_contacts }\n end\n else\n @organization_contacts = OrganizationContact.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_contacts }\n end\n end \n else\n redirect_to error_users_path and return\n end\n end", "def index\n @can_see_all = [\"Super Admin\", \"Recruitment Company Manager\", \"Recruirment Company Administrator\"]\n if @can_see_all.include?(current_user.role)\n @clients = Client.all\n elsif current_user.role == \"Consultant\"\n @clients = []\n current_user.projects.each do |p|\n @clients << p.client if [email protected]?(p.client)\n end\n else\n @clients = current_user.clients\n end\n end", "def index\n # p 'in users, BookingsController'\n @conversations = Conversation.where(user_id: @user.id)\n # p @conversations\n if @conversations\n conversations_serializer = parse_json @conversations\n json_response \"Indexed user's conversations successfully\", true, {conversations: conversations_serializer}, :ok\n else\n json_response \"Cannot find conversations for user\", false, {}, :not_found\n end\n # @flat = Flat.order(created_at: :desc)\n # @flat = policy_scope(Flat).order(created_at: :desc)\n\n # authorize @cars\n end", "def index\n @rol_id = Role.find_by(:name => params[:param]).id\n\n @investigations = Investigation.find_by_sql(\"select * from investigations i\n inner join (select * from users_roles ur where ur.role_id = #{@rol_id}) as ur on i.user_id = ur.user_id\")\n end", "def index\n @hpcs = Hpc.where(admin_user: current_user.admin_user).paginate(page: params[:page],:per_page => 30)\n end", "def index\n my_authorize_action_within_clubs!(:list, Club, @current_partner.clubs.collect(&:id))\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: ClubsDatatable.new(view_context,@current_partner,nil,nil,@current_agent) }\n end\n end", "def index\n if current_user.role == \"su\"\n @organizations = Organization.all\n elsif current_user.role == \"ru\"\n @organizations = Organization.find_by_sql(\"select * from organizations where id in (select organization_id from org_users where user_id = #{current_user.id}) \")\n elsif current_user.role == \"sub\"\n @projects = Project.find_by_sql(\"select * for projects where id in (select project_id from user_project where user_id = '#{current_user.id}')\")\n end \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @award = Award.find(params[:id])\n @title = \"Team Standings for #{@award.company_type} & #{@award.company_size_range} Employees | Bike Commuter Challenge\" \n\n if @award.isindividual == nil || @award.isindividual == false\n\n if @award.goal == 'Participation Rate'\n goal = 'team_participation desc'\n elsif @award.goal == 'Total Mileage'\n goal = 'mileage desc'\n elsif @award.goal == 'Number of Newbies'\n goal = 'newbies desc'\n elsif @award.goal == 'Number of Commutes'\n goal = 'total_commutes desc'\n elsif @award.goal == 'Total Commuters'\n goal = 'total_commuters desc'\n else goal = 'company asc'\n end\n\n @teams = Team.where(:company_type => @award.company_type,\n :company_size_range => @award.company_size_range,)\n .order(\"#{goal}\")\n \n @award_list = Award.where(:company_type => @award.company_type,\n :company_size_range => @award.company_size_range)\n \n else\n\n commuters = User.joins(:commutes).select(\"distinct(users.id)\")\n @users = Array.new\n commuters.each do |commuter|\n @users << User.find_by_id(commuter)\n end\n \n @award_list = Award.where(:isindividual => true)\n \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @award }\n end\n end", "def index\n if user_signed_in?\n @my_purcahses = Reservation.joins(:user).where(users: {id: current_user})\n @my_purcahses = @my_purcahses.joins(:membership)\n @my_purcahses = @my_purcahses.includes(:charges).includes(active_claim: :contact)\n end\n end", "def index\n if session[:user_id].nil?\n @inventory_owns = InventoryOwn.all\n else\n @conditions = Condition.all\n @inventory_owns = InventoryOwn.where(deleted: false).find_all_by_user_id(session[:user_id])\n end\n end", "def index\n @contractors = current_contractor\n end", "def listings\n authorize! :read, @user\n end", "def index\n @houseguests = Houseguest.all\n end", "def index\n #@jobs = Job.all\n smart_listing_create :jobs, current_user.employer.jobs, partial: \"partials/bidding_job_listing\"\n end", "def alliance_members( house )\n HHouse.joins( :al_alliances ).merge( al_alliances.where( h_peer_house_id: house.id ) )\n end", "def index\n @user_with_halls = UserWithHall.all\n end", "def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end", "def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end", "def list_of_owners\n @owners = Owner.find(:all, :order=>\"state,city\")\n @report_name = \"List of Owners\"\n end", "def show_all_loan_entries\n @loans = Loan.disbursed_loans.paginate(page: params[:page], per_page: 2)\n\n authorize AccountingEntry\n end", "def index\n authorize! :read, Lovedone\n\n if current_user.admin?\n @lovedones_all = Lovedone.all\n # @primarycontacts = PrimaryContact.all\n @following_followers = Follower.where(\"request_status LIKE 'approved'\" ) \n @invited_followers = Follower.where(\"request_status LIKE 'invited'\" ) \n else\n @lovedones_all = Lovedone.all\n @lovedones = current_user.company.lovedones\n\n @following_followers = Follower.where(\"user_id = ? AND request_status LIKE 'approved'\" , current_user.id)\n @invited_followers = Follower.where(\"user_id = ? AND request_status LIKE 'invited'\" , current_user.id) \n end\n end", "def show\n puts \"##################user id is #{@user.id}\"\n @owned_challenges = Challenge.where(owner_id: params[:id])\n @activities = Activity.where(user_id: @user.id)\n puts \"##################activities is #{@activities}\"\n end", "def index\n @user = User.find(session[:user_id])\n @personal_info = PersonalInfo.find_by(users_id: session[:user_id])\n if !@personal_info.nil?\n @hall = Hall.find(@personal_info.halls_id)\n end\n end", "def list_inviting_agent_and_property\n if user_valid_for_viewing?(['Vendor'], params[:udprn].to_i)\n #if true\n @current_user = Vendor.find(533)\n vendor_id = @current_user.id\n invited_vendors = InvitedVendor.where(email: @current_user.email, source: Vendor::INVITED_FROM_CONST[:family]).select([:agent_id, :udprn])\n udprns = invited_vendors.map(&:udprn)\n bulk_details = PropertyService.bulk_details(udprns)\n response = []\n\n bulk_details.each_with_index do |detail, index|\n detail[:address] = PropertyDetails.address(detail)\n response_hash = {}\n response_hash[:udprn] = detail[:udprn]\n response_hash[:address] = detail[:address]\n agent_fields = [:agent_id, :assigned_agent_first_name, :assigned_agent_last_name, :assigned_agent_email, :assigned_agent_mobile,\n :assigned_agent_office_number, :assigned_agent_image_url, :assigned_agent_branch_name, :assigned_agent_branch_number,\n :assigned_agent_branch_address, :assigned_agent_branch_website, :assigned_agent_branch_logo]\n property_attrs = [:beds, :baths, :receptions, :property_type, :property_status_type ]\n agent_fields.each {|field| response_hash[field] = detail[field] }\n property_attrs.each {|field| response_hash[field] = detail[field] }\n response.push(response_hash)\n end\n\n render json: response, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end", "def index\n if current_user.customer?\n @contracts = Contract.where(customer: current_user)\n else\n @contracts = Contract.where(ninja: current_user).or(Contract.where(ninja: nil))\n end\n end", "def index\n if session[:role] == 'student'\n @hold_requests = HoldRequest.where(user_id: session[:user_id])\n elsif session[:role] == 'librarian'\n librarian = Librarian.where(user_id: session[:user_id])[0]\n library = Library.where(id: librarian[:library_id])[0]\n books_in_library = Book.where(library_id: library[:id]).pluck(:isbn).to_a\n @hold_requests = HoldRequest.where(isbn: books_in_library)\n else\n @hold_requests = HoldRequest.all\n end\n\n end", "def index\n #@projects = Project.all\n projectids = []\n allprojects = Role.find_by_sql([\"select id, authorizable_id from roles join roles_users on roles.id = roles_users.role_id where roles.authorizable_type = 'Project' and roles_users.user_id = ?\", current_user])\n projectids = allprojects.collect{|p| p.authorizable_id}\n @projects = Project.find(:all, :conditions => {:id => projectids})\n \n @adminrole = []\n @userrole = []\n \n @projects.each do |project|\n if current_user.is?(\"admin\", project) or current_user.is?(\"manager\", project) or current_user.is?(\"editor\", project) or current_user.is?(\"owner\", project)\n @adminrole << project\n elsif current_user.is?(\"user\", project)\n @userrole << project\n end \n end\n p \"admin\"\n p @adminrole\n \n alltargetlists = Role.find_by_sql([\"select id, authorizable_id from roles join roles_users on roles.id = roles_users.role_id where roles.authorizable_type = 'TargetList' and roles_users.user_id = ?\", current_user])\n targetlistids = alltargetlists.collect{|t| t.authorizable_id}\n @target_lists = TargetList.find(:all, :conditions => {:id => targetlistids})\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n end\n end", "def index\n # if current_user.admin?\n @room_histories = RoomHistory.all\n # else\n # @room_histories = RoomHistory.where(user_id: current_user)\n # end\n end", "def filtered_list\n if !(current_user.belongs_to_common_pool || current_user.belongs_to_back_office)\n @lawfirms = []\n @assigned_lawfirm_users.each do |lawyer|\n @lawfirms << lawyer.company if lawyer.company\n end\n @lawfirms.uniq!\n @logged_by_users = [[\"----livians----\",\"\"]]\n @logged_by_users += @cluster_livian_users.collect{|livian|[livian.full_name,livian.id]}\n @logged_by_users << [\"----lawyers----\",\"\"]\n @logged_by_users += @assigned_lawfirm_users.collect{|lowyer|[lowyer.full_name,lowyer.id]}\n @lawyers = (params[:search].present? && params[:search][:company_id].present?) ? get_company_lawyers(current_user,params[:search][:company_id],\"communications\") : @assigned_lawfirm_users\n else\n filtere_list_for_cp_or_bo\n end\n end", "def index\n @negociated_prices = NegociatedPrice.all\n @users = User.all\n @clients = @users.where(:client => true).order('name ASC')\n @contracted = @clients.where(:negociated_price => true).order('name ASC')\n @user = current_user\n @admin = @user.admin\n unless @admin\n redirect_to :root, :alert => t(\"notice.access\")\n end\n end", "def show\n @users = current_user.cursos.find(params[:id]).users.all.with_role(:alumno)\n @cursos = current_user.cursos.all\n @presences = Presence.where(curso: params[:id]).paginate(:page => params[:page])\n end", "def index\n if current_user.role == \"admin\"\n @user_role_change = true\n @users = User.all\n elsif current_user.member.category == \"kore\" \n @user_role_change = false\n circle = Circle.where(:id => current_user.member.main_circle).first\n members = circle.members\n @users = []\n members.each do |m|\n @users << m.user if m.user\n end\n puts @users\n else\n redirect_to root_path\n end\n end", "def show\n @organisme_employe = Organisme.where(:api_id => @employe.organisme_id)\n @role_employe = Role.where(:id => @employe.role_id)\n end", "def index\n @enterprises = Enterprise.includes(:devices).all\n if current_user.role_id == 1\n render \"su_index\"\n elsif current_user.role_id == 2\n render \"admin_index\"\n end\n end", "def index\n\n # http://localhost:3000/api/users?online=false&jurist=false&lawyer=true\n\n exception_roles = [:admin, :blocked]\n\n @users = User.includes(:roles).where.not(roles: {name: exception_roles }).includes(:cities)\n\n if param? params[:online]\n\n @users = @users.where(online: true)\n\n end\n\n params_array = []\n\n # city = nil\n\n # if param? params[:city_id]\n\n # city = City.find params[:city_id]\n\n # end \n\n if param? params[:lawyer]\n\n params_array << :lawyer\n\n end\n\n if param? params[:jurist]\n \n params_array << :jurist\n\n end\n\n if param? params[:client]\n \n params_array << :client\n\n end\n\n if params_array.size > 0\n\n @users = @users.includes(:roles).where(roles: {name: params_array })\n\n end\n \n if params[:offset]\n\n collection = api_paginate(@users) do |param_collection|\n\n ActiveModel::SerializableResource.new(\n\n param_collection.to_a,\n\n set_render_options\n )\n\n end \n\n render json: collection\n\n else\n\n render( {json: @users}.merge set_render_options )\n\n end \n\n end", "def index\n @contracts = Contract.all\n authorize @contracts\n end", "def index\n @invoices = Invoice.where( :user_id => current_user.id).all\n if current_user.role? :admin \n @invoices = Invoice.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invoices }\n end\n end", "def contracts\n\t\t@user = User.find_by_username(params[:profile_id])\n\t\tif [email protected]?\n\t\t\tredirect_to root_path\n\t\tend\n\n\t\tcontracts = []\n\t\tif current_admin.present? || (current_user.meets_contract_preferences?(@user) && [email protected]_blocking_user?(current_user))\n\t\t\t(@user.posted_contracts.where(status: \"Open\") + @user.posted_bounties.where(status: \"Open\")).each do | c |\n\t\t\t\tcontracts << {\n\t\t\t\t\t:id => c.id,\n\t\t\t\t\t:start=> c.start_date_time,\n\t\t\t\t\t:end=> c.end_date_time,\n\t\t\t\t\t:title=> \"$#{c.price_in_dollars}\",\n\t\t\t\t\t:type => c.contract_type\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\t\trender :json => contracts\n\tend", "def index\n if current_user.role == \"user\"\n @reservations = current_user.reservations.includes(:alleys, :user).order(:date)\n elsif current_user.role == \"cashier\"\n @reservations = Reservation.includes(:alleys, :user).by_date Date.today\n else\n @reservations = Reservation.includes(:alleys, :user).order(:date).all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def room_list\n\t\t@room = Accommodation.find_all_by_host_id(@current_user.id)\n\t\t@date = RoomBooking.find_all_by_room_id(@room)\n \tend", "def index\n\n @organization_id = params[:organization_id].to_i\n @search_text = params[:search_text]\n @role = params[:role].split(\",\") if params[:role]\n @id_filter_list = params[:ids]\n\n # Start to set up the query\n conditions = []\n values = []\n\n if @organization_id.to_i > 0\n conditions << 'users_organizations.organization_id = ?'\n values << @organization_id\n else\n conditions << 'users_organizations.organization_id IN (?)'\n values << @organization_list\n end\n\n\n unless @search_text.blank?\n # get the list of searchable fields from the asset class\n searchable_fields = User.new.searchable_fields\n # create an OR query for each field\n query_str = []\n first = true\n # parameterize the search based on the selected search parameter\n search_value = get_search_value(@search_text, @search_param)\n # Construct the query based on the searchable fields for the model\n searchable_fields.each do |field|\n if first\n first = false\n query_str << '('\n else\n query_str << ' OR '\n end\n\n query_str << \"UPPER(users.#{field})\"\n query_str << ' LIKE ? '\n # add the value in for this sub clause\n values << search_value.upcase\n end\n query_str << ')' unless searchable_fields.empty?\n\n conditions << [query_str.join]\n end\n\n unless @id_filter_list.blank?\n conditions << 'object_key in (?)'\n values << @id_filter_list\n end\n\n if params[:show_active_only].nil?\n @show_active_only = 'active'\n else\n @show_active_only = params[:show_active_only]\n end\n\n if @show_active_only == 'active'\n conditions << 'users.active = ?'\n values << true\n elsif @show_active_only == 'inactive'\n conditions << 'users.active = ?'\n values << false\n end\n\n # Get the Users but check to see if a role was selected\n @users = User.unscoped.distinct.joins(:organization).order('organizations.organization_type_id', 'organizations.short_name', :last_name).joins(:organizations).includes(:organization,:roles).where(conditions.join(' AND '), *values)\n\n unless @role.blank?\n all_users = @users\n @users = @users.with_role(@role[0])\n @role[1..-1].each do |r|\n @users = @users.or(all_users.with_role(r))\n end\n end\n\n if params[:sort] && params[:order]\n case params[:sort]\n when 'organization'\n @users = @users.reorder(\"organizations.short_name #{params[:order]}\")\n # figure out sorting by role + privilege some other way\n # when 'role_name'\n # @users = @users.joins(:roles).merge(Role.unscoped.order(name: params[:order]))\n # when 'privilege_names'\n # @users = @users.joins(:roles).merge(Role.order(privilege: params[:order]))\n else\n @users = @users.reorder(params[:sort] => params[:order])\n end\n end\n\n # Set the breadcrumbs\n if @organization_list.count == 1\n org = Organization.find(@organization_list.first)\n add_breadcrumb org.short_name, users_path(:organization_id => org.id)\n end\n if @role.present?\n role_string = @role.kind_of?(Array) ? Role.find_by(name: @role).try(:label).try(:parameterize).try(:underscore) : @role\n add_breadcrumb role_string.titleize, users_path(:role => role_string) if role_string\n end\n\n # remember the view type\n @view_type = get_view_type(SESSION_VIEW_TYPE_VAR)\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json {\n # render :json => {\n # :total => @users.count,\n # :rows => @users.limit(params[:limit]).offset(params[:offset]).collect{ |u|\n # u.as_json.merge!({\n # organization_short_name: u.organization.short_name,\n # organization_name: u.organization.name,\n # role_name: [email protected]? && (@role.kind_of?(Array) ? !Role.find_by(name:@role.first).privilege : !Role.find_by(name: @role).privilege) ? (@role.kind_of?(Array) ? u.roles.roles.where(name: @role).last.label : u.roles.roles.find_by(name: @role).label) : u.roles.roles.last.label,\n # privilege_names: u.roles.privileges.collect{|x| x.label}.join(', '),\n # all_orgs: u.organizations.map{ |o| o.to_s }.join(', ')\n # })\n # }\n # }\n # }\n\n end\n end", "def get_cashiers\n @cashiers = User.where(role_id: KASIR_ROLE_ID)\n end", "def show\n @vacant_roles = []\n @filled_roles = []\n @project.project_roles.each do |role|\n if role.member_id then\n @filled_roles << role\n else\n @vacant_roles << role\n end\n end\n end", "def contract_other_people\n result = []\n booking_line_resources.each do |resource|\n result << { :name => resource.resource_user_name,\n :surname => resource.resource_user_surname,\n :document_id => resource.resource_user_document_id,\n :phone => resource.resource_user_phone,\n :email => resource.resource_user_email } if resource.resource_user_name != customer_name and \n resource.resource_user_surname != customer_surname\n if resource.pax == 2\n result << { :name => resource.resource_user_2_name,\n :surname => resource.resource_user_2_surname,\n :document_id => resource.resource_user_2_document_id,\n :phone => resource.resource_user_2_phone,\n :email => resource.resource_user_2_email } if resource.resource_user_2_name != customer_name and \n resource.resource_user_2_surname != customer_surname\n \n end\n end\n\n return result\n end", "def index\n @esod_contractors = Esod::Contractor.all\n end", "def index\n authorize! :read, parent_organization\n @teams = MnoEnterprise::Team.where(organization_id: params[:organization_id])\n end", "def list\n # We don't use pagination here since we want to display the roles in a\n # nice tree. Additionally, there won't be more than ~100 roles in a\n # normal scenario anyway - far less!\n @roles = Role.find(:all)\n end", "def access_list\n\t\tif(MARKETPLACE_MODE_ONLINE_SHOP)\n\t\t\treturn {}\n\t\telse\n\t\t\tacl = self.acl\n\t\t\tacl = {} if(acl.blank?)\n\t\t\tacl[:creator_user_id] = self.user_id\n\t\t\treturn self.acl\n\t\tend\n\tend", "def index\n if current_user.role == 'Party'\n @customers = current_user.party.customers\n else\n @customers = Customer.all\n end\n end", "def index\n\t\t@households = current_user.households\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @households }\n\t\tend\n\tend", "def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end", "def index\n no_deals and return unless (Deal.all.find_by(buyer: current_user.id).present? || Deal.all.find_by(profile_id: current_user.profile.id))\n if current_user.has_role?(:stylist)\n @deals = Deal.all.where(profile_id: current_user.id)\n elsif current_user.has_role?(:scrub)\n @deals = Deal.all.where(:buyer => current_user.id)\n end\n \n end", "def list\n employee = params[:employee].blank? ? '' : params[:employee]\n leave_type = params[:leave_type].blank? ? 0 : params[:leave_type].to_i\n designation = params[:designation].blank? ? 0 : params[:designation].to_i\n dept = params[:dept].blank? ? 0 : params[:dept].to_i\n year = params[:year].blank? ? Time.now.year : params[:year].to_i\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n sortcolumn = params[:sortcolumn].blank? ? EmployeeHelper::DEFAULT_SORT_COLUMN : params[:sortcolumn]\n sortdir = params[:sortdir].blank? ? EmployeeHelper::DEFAULT_SORT_DIR : params[:sortdir]\n \n sort = ApplicationHelper::Sort.new(sortcolumn, sortdir)\n \n filters = { :employee => employee,\n :designation => designation,\n :dept => dept }\n \n if employee.blank? && leave_type == 0 && designation == 0 && dept == 0\n @data = LeaveSummaryHelper.get_all(pgnum, pgsize, sort)\n \n else\n @data = LeaveSummaryHelper.get_filter_by(filters, pgnum, pgsize, sort)\n end\n \n criteria_leavetypes = LeaveType.order(:name).where(:admin_adjust => true)\n \n if leave_type != 0\n criteria_leavetypes = criteria_leavetypes.where(:id => leave_type)\n end\n \n @leavetypes = criteria_leavetypes.all\n @year = year\n \n respond_to do |fmt|\n fmt.html { render :partial => 'list' }\n fmt.json { render :json => [@data, @leavetypes] }\n end\n end", "def index\n if params[:name] || params[:expansion]\n owned_cards = OwnedCard.search(params[:name], params[:expansion], current_user.id)\n else\n owned_cards = OwnedCard.where(user_id: current_user.id)\n end\n @owned_cards = owned_cards.includes(:printing, :loans, :user, :card, :expansion)\n .paginate(page: params[:page]).decorate\n @loan = Loan.new\n end", "def index\n @hr_config_contracts = Hr::Config::Contract.all\n end", "def list(*args)\n params = arguments(args).params\n\n if (user_name = params.delete('user'))\n response = get_request(\"/users/#{user_name}/orgs\", params)\n elsif args.map(&:to_s).include?('every')\n response = get_request('/organizations', params)\n else\n # For the authenticated user\n response = get_request('/user/orgs', params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "def index\n @users_listing = Listing.where(owner: current_user)\n @offers = Offer.where(listing: @users_listing)\n # photographers portfolios, \n @portfolio_ids = []\n @offers.each do |offer|\n #offer has a photographer id and portfolio has a user id.\n @portfolio_ids << Portfolio.find_by(user: offer.photographer).id\n end\n end", "def index\n authorize! :read, PhoneCall\n\n authorized_phone_calls = []\n phone_calls.where(params.permit(:state))\n .includes(:to_role, :user, consult: [:initiator, :subject])\n .order('created_at ASC')\n .each do |p|\n authorized_phone_calls.push(p) if can? :read, p\n end\n\n index_resource authorized_phone_calls.serializer\n end", "def indirect_contracts\n Contract.where(:user_id => descendant_ids)\n end", "def show\n @event = Event.find_by_id(params[:id])\n #event.participants returns a collection and we CANT perform query on it\n host = @event.participants.select { |p| p.role == \"host\" }\n @users = @event.users.select { |u| u.id != host.first.user_id } #excludes the host\n end", "def index\n @contract_employees = ContractEmployee.all\n end", "def guest_list\n extract_data = ExtractData.new(@data_file)\n locations = extract_data.load_file\n customers = FindCustomers.new(locations, @radius, @home_latitude, @home_longitude).search\n if customers.empty?\n puts \"\\n No guests found.\"\n else\n puts \"\\nGuest list\\n\"\n puts \"==========\\n\"\n customers.each {|customer|p \"#{customer[\"user_id\"]} -- #{customer[\"name\"]}\"}\n end\n nil\n rescue => e\n puts \"There was an error retrieving the guest list. \\n\"\n puts \"ERROR: #{e.message}\"\n puts \"\\n #{e.backtrace}\"\n end", "def index\n @hours = Hour.where(user_id: current_user.id).to_a\n @clients = Client.where(user_id: current_user.id).to_a\n invoices_hid = @hours.uniq.pluck(:invoice_id)\n @invoices = Invoice.where(id: invoices_hid)\n end", "def list(*args)\n params = args.extract_options!\n normalize! params\n\n response = if (user_name = params.delete(\"user\"))\n get_request(\"/users/#{user_name}/orgs\", params)\n else\n # For the authenticated user\n get_request(\"/user/orgs\", params)\n end\n return response unless block_given?\n response.each { |el| yield el }\n end", "def index\n if params[\"search\"]\n if params[\"show_all\"] == \"true\"\n @houses = current_user.houses.search(params[\"search\"])\n else\n @houses = current_user.houses.active.search(params[\"search\"])\n end\n else\n if params[\"show_all\"] == \"true\"\n @houses = current_user.houses\n else\n @houses = current_user.houses.active\n end\n end\n end" ]
[ "0.7065561", "0.6148539", "0.5889526", "0.5803619", "0.58031493", "0.5802085", "0.57494056", "0.5730157", "0.5725203", "0.56907874", "0.5658419", "0.56570804", "0.5607655", "0.5600839", "0.559615", "0.55758566", "0.5557621", "0.55381143", "0.5494804", "0.5486327", "0.54849654", "0.5462554", "0.544316", "0.54429805", "0.5428459", "0.5424161", "0.5406232", "0.537332", "0.53719264", "0.5347248", "0.5333848", "0.5332961", "0.5326276", "0.53124267", "0.5306748", "0.5306285", "0.5306049", "0.5297661", "0.5296774", "0.5295942", "0.5292493", "0.5292419", "0.5286846", "0.5276897", "0.5273245", "0.5271033", "0.525483", "0.52471906", "0.523661", "0.5231702", "0.522947", "0.52216923", "0.5218958", "0.52183634", "0.521797", "0.5217695", "0.52082497", "0.5206199", "0.5198406", "0.51957685", "0.51863635", "0.51810277", "0.5173069", "0.51677346", "0.51669705", "0.5164536", "0.5158741", "0.51576865", "0.5155695", "0.5155172", "0.5152268", "0.5152239", "0.5147143", "0.5139808", "0.51378024", "0.51361", "0.5130614", "0.5122695", "0.5122523", "0.51193213", "0.5116086", "0.5111153", "0.5108475", "0.510826", "0.5106661", "0.50967234", "0.5092863", "0.509062", "0.50847995", "0.5084154", "0.50815326", "0.508016", "0.507548", "0.5074405", "0.50648373", "0.5059669", "0.5058097", "0.50554925", "0.50510204", "0.5050655" ]
0.7446135
0
Gets the applicableArchitectures property value. Contains properties for Windows architecture.
def applicable_architectures return @applicable_architectures end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applicable_architectures=(value)\n @applicable_architectures = value\n end", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (res.body =~ /(i386|x86)/i)\r\n\t\t\tarch = $1\r\n\t\t\tif (arch =~ /i386|x86/i)\r\n\t\t\t\treturn ARCH_X86\r\n\t\t\t\t# TODO, more\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def arch\n x86_64? ? \"amd64\" : \"i386\"\n end", "def supported_archs\n @supported_archs ||= Dir.glob(File.join(__dir__, 'consts', 'sys_nr', '*.rb'))\n .map { |f| File.basename(f, '.rb').to_sym }\n .sort\n end", "def architecture\n @architecture ||= `uname -m`\n end", "def actual_arch\n arch = nil\n\n if explicit_arch.nil? == false\n arch = explicit_arch\n elsif datastore['ARCH']\n arch = datastore['ARCH']\n elsif assoc_exploit\n arch = assoc_exploit.target_arch || ARCH_X86\n end\n\n # If we still have an invalid architecture, then we suck.\n if arch.nil?\n raise NoCompatiblePayloadError, \"An architecture could not be determined by the generic payload\"\n elsif arch.kind_of?(String)\n arch = [ arch ]\n end\n\n return arch\n end", "def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end", "def architecture\n data[:architecture]\n end", "def architecture # rubocop:disable Lint/DuplicateMethods\n @architecture ||= @name.match(PLATFORM_REGEX)[3]\n end", "def architecture\n return 'x86_64'\n end", "def get_arch\n if defined?(@arch) then return @arch else @arch = nil end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n machine = %x{pev -c #{ntdlls.first} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n machine = %x{pev -c #{file} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n arches = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/ARCH/text()')\n arch = arches.first\n if arches.count(arch) == arches.size\n arch = Integer(arch.to_s)\n @arch = '64-bit' if arch == 9\n @arch = '32-bit' if arch == 0\n else\n @arch = '32/64-bit' unless @arch\n end\n rescue Exception => e\n # puts \"error(get_arch): #{e}\"\n end\n end\n @arch\n end", "def architecture\n `uname -m`.strip\n end", "def architecture\n `uname -m`.strip\n end", "def arch\n return `uname -m`.chomp\n end", "def architecture\n 'x86_64'\n end", "def architecture\n 'x86_64'\n end", "def arch\n if windows? && windows_arch_i386?\n \"i386\"\n elsif solaris?\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n end\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end", "def canonical_arch\n Config::CONFIG['arch'].sub(/[\\.0-9]*$/, '')\n end", "def target_arch\n (target and target.arch) ? target.arch : (arch == []) ? nil : arch\n end", "def arch?(what)\n\t\treturn true if (what == ARCH_ANY)\n\n\t\treturn arch.index(what) != nil\n\tend", "def rpm_arch\n @lead.arch\n end", "def archs_for_command cmd\n cmd = cmd.to_s # If we were passed a Pathname, turn it into a string.\n cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?\n cmd.gsub! ' ', '\\\\ ' # Escape spaces in the filename.\n\n archs = IO.popen(\"/usr/bin/file #{cmd}\").readlines.inject([]) do |archs, line|\n case line\n when /Mach-O (executable|dynamically linked shared library) ppc/\n archs << :ppc7400\n when /Mach-O 64-bit (executable|dynamically linked shared library) ppc64/\n archs << :ppc64\n when /Mach-O (executable|dynamically linked shared library) i386/\n archs << :i386\n when /Mach-O 64-bit (executable|dynamically linked shared library) x86_64/\n archs << :x86_64\n else\n archs\n end\n end\n archs.extend(ArchitectureListExtension)\nend", "def _ARCH; Config._ARCH; end", "def get_arch\n arch = `uname -m`\n if arch.include?(\"64\")\n return \"64\"\n else\n return \"32\"\n end\nend", "def safe_architecture\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end", "def machine_arch(arg = nil)\n set_or_return(:machine_arch, arg, kind_of: String, required: true)\n end", "def show_machine_arch\n\t\t\tputs \" Machine: #{ELF_MACHINE_ARCH_LIST[@elf_machine.to_i]} (#{@elf_machine.to_i})\"\n\t\tend", "def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend", "def arch?(node = __getnode)\n node[\"platform_family\"] == \"arch\"\n end", "def arch(internal = false)\n internal ? '64-bit' : 'x86_64'\n end", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid 7.6 7.5 7.4 7.2 7.1 7.0 6.0.5),\n 'ubuntu' => %w(14.10 14.04 13.10 13.04 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2014.09 2014.03 2013.09 2012.09),\n 'centos' => %w(7.0.1406 6.6 6.5 6.4 6.3 6.0 5.11 5.10 5.9 5.8),\n 'oracle' => %w(6.5 5.10),\n 'redhat' => %w(7.0 6.5 6.4 6.3 6.2 6.1 6.0 5.10 5.9 5.8 5.7 5.6)\n }\nend", "def is_allowed?\n self.allowed.include?(@architecture)\n end", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid\n 8.4 8.2 8.1 8.0\n 7.10 7.9 7.8 7.7 7.6 7.5 7.4 7.2 7.1 7.0\n 6.0.5),\n 'ubuntu' => %w(16.04\n 15.10 15.04\n 14.10 14.04\n 13.10 13.04\n 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2016.03\n 2015.09 2015.03\n 2014.09 2014.03\n 2013.09 2012.09),\n 'centos' => %w(7.2.1511 7.1.1503 7.0.1406\n 6.8 6.7 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.11 5.10 5.9 5.8 5.7 5.6 5.5 5.4 5.3 5.2),\n 'oracle' => %w(7.1 7.0\n 6.6 6.5\n 5.10),\n 'redhat' => %w(7.1 7.0\n 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.10 5.9 5.8 5.7 5.6)\n }\nend", "def objdump_arch(arch)\n case arch\n when :amd64 then 'i386:x86-64'\n else arch.to_s\n end\n end", "def platforms\n return @platforms\n end", "def arch_lookup(sys_type)\n return \"x86_64\" if sys_type == \"x64-based PC\"\n return \"i386\" if sys_type == \"X86-based PC\"\n\n sys_type\n end", "def architecture(file)\n return :invalid unless File.exist?(file)\n\n f = File.open(file)\n str = ELFTools::ELFFile.new(f).machine\n {\n 'Advanced Micro Devices X86-64' => :amd64,\n 'Intel 80386' => :i386,\n 'ARM' => :arm,\n 'AArch64' => :aarch64,\n 'MIPS R3000' => :mips\n }[str] || :unknown\n rescue ELFTools::ELFError # not a valid ELF\n :invalid\n ensure\n f&.close\n end", "def calculate_doublepulsar_arch(s)\n s == 0 ? ARCH_X86 : ARCH_X64\n end", "def arch_32_bit; :i386; end", "def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end", "def determine_if_x86_64\n (identify_windows_architecture =~ /64/) == 0\n end", "def platforms; platform_names; end", "def name\n @architecture\n end", "def only_on(*architectures)\n architectures = architectures.map do |name|\n if name.respond_to?(:to_str)\n [name]\n else name\n end\n end\n\n os_names, os_versions = Autoproj.workspace.operating_system\n matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }\n if matching_archs.empty?\n return\n elsif matching_archs.none? { |arch| !arch[1] || os_versions.include?(arch[1].downcase) }\n return\n end\n\n yield\nend", "def platforms\n [ RUBY_PLATFORM ].tap do |list|\n list.push \"JVM #{java_version}\" if jruby?\n end\n end", "def arch_to_s\n\t\treturn arch.join(\", \")\n\tend", "def arch\n @header.arch\n end", "def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end", "def objdump_arch_supported?(bin, arch)\n return false if bin.nil?\n\n arch = objdump_arch(arch)\n `#{::Shellwords.join([bin, '--help'])}`.lines.any? { |c| c.split.include?(arch) }\n end", "def fix_windows_manifest\n return manifest if manifest['windows'].nil?\n\n builds_32bit = {}\n builds_64bit = {}\n\n manifest['windows'].each do |platform_version, build_data|\n build_data.each do |architecture, builds|\n builds.each do |version, build|\n case architecture\n when 'x86_64'\n if %w{chef angrychef}.include?(project_name)\n # In the beginning (Chef 10) there was only 1 Chef package\n # architecture, and it was 32 bit. However, it was always stored\n # under the x86_64 manifest architecture and it was returned for\n # both x86_64 and i386 requests (1 package was used for both 32\n # and 64 bit Windows machines). This continued until Chef 12.4.2\n # - this was the first package to be stored under the i386\n # manifest architecture. There was still only 1 package and it\n # was 32 bit, but now it had the correct manifest architecture.\n # Starting with Chef 12.7 we started building 2 packages for Chef\n # - a 32 bit package for i386 architecture and a 64 bit package\n # for x86_64 architecture.\n #\n # Until Chef reaches version 12.9 we want to continue servering\n # all stable channel requests _only_ with the 32 bit package,\n # regardless of whether the user specifies x86_64 or i386\n # architecture. Once Chef 12.9 is released we will start returning\n # the correct package based upon requested architecture but only\n # for version 12.9+\n if Opscode::Version.parse(version) >= Opscode::Version.parse(\"12.7.0\")\n builds_64bit[version] = build\n else\n builds_32bit[version] ||= build\n end\n elsif project_name == 'chefdk'\n # ChefDK is still only built to produce a 32-bit package. But like Chef,\n # it works on both 32-bit systems and 64-bit systems. It also may\n # sometimes be tagged as x86_64 or i386. But we want to use each\n # package for all customer architectures.\n builds_32bit[version] = build\n builds_64bit[version] = build\n else\n builds_64bit[version] = build\n end\n when 'i386', 'i686'\n builds_32bit[version] = build\n if project_name == 'chefdk'\n builds_64bit[version] = build\n end\n else\n raise \"Unknown Windows architecture '#{architecture}'\"\n end\n end\n end\n end\n\n manifest['windows'] = {\n '2008r2' => {\n 'i386' => builds_32bit,\n 'x86_64' => builds_64bit\n }\n }\n\n manifest\n end", "def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end", "def minimum_supported_operating_system\n return @minimum_supported_operating_system\n end", "def get_exotic_archname(platform_type)\n case platform_type\n when /aarch64/\n \"ARM\"\n when /ppc64le/\n \"Power\"\n else\n nil\n end\nend", "def supported_platforms\n latest_extension_version.try(:supported_platforms) || []\n end", "def arch_for_filename(path)\n file = File.basename(path, File.extname(path))\n\n case file\n when /686/, /386/\n '32-bit'\n when /86_64/, /amd64/\n '64-bit'\n else\n parts = file.split('_')\n\n if parts.empty?\n raise \"Could not determine arch for filename `#{file}'!\"\n end\n\n parts.last.capitalize\n end\n end", "def DoArchitecturesMatch(arch_1, arch_2)\n ppc_archs = [\"ppc\", \"ppc64\"]\n\n # exact match\n if arch_1 == arch_2\n return true \n # ppc exception\n elsif Builtins.contains(ppc_archs, arch_1) &&\n Builtins.contains(ppc_archs, arch_2)\n return true\n end\n\n # else\n false\n end", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def default_platform_list\n [\n metadata.platform,\n *ruby_versions,\n *platforms,\n RbConfig::CONFIG['build']\n ]\n end", "def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def platform_types\n @platform_types.to_hash\n end", "def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end", "def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end", "def arch_specific_objdump(arch)\n {\n aarch64: 'aarch64-linux-gnu-objdump',\n amd64: 'x86_64-linux-gnu-objdump',\n i386: 'i686-linux-gnu-objdump'\n }[arch]\n end", "def platforms\n get(\"project/platforms\")[\"platforms\"]\n end", "def index\n @architectures = Architecture.all\n end", "def choose_platform_set(config, reason, desired_platforms, library_properties)\n\n # if there are no properties or no architectures, defer entirely to desired platforms\n if library_properties.nil? || library_properties.architectures.nil? || library_properties.architectures.empty?\n # verify that all platforms exist\n desired_platforms.each { |p| assured_platform(reason, p, config) }\n return inform_multiline(\"No architectures listed in library.properties, using configured platforms\") do\n desired_platforms.each { |p| puts \" #{p}\" } # this returns desired_platforms\n end\n end\n\n if library_properties.architectures.include?(\"*\")\n return inform_multiline(\"Wildcard architecture in library.properties, using configured platforms\") do\n desired_platforms.each { |p| puts \" #{p}\" } # this returns desired_platforms\n end\n end\n\n platform_architecture = config.platform_info.transform_values { |v| v[:board].split(\":\")[1] }\n supported_platforms = platform_architecture.select { |_, a| library_properties.architectures.include?(a) }\n\n if config.is_default\n # completely ignore default config, opting for brute-force library matches\n # OTOH, we don't need to assure platforms because we defined them\n return inform_multiline(\"Default config, platforms matching architectures in library.properties\") do\n supported_platforms.keys.each do |p| # rubocop:disable Style/HashEachMethods\n puts \" #{p}\"\n end # this returns supported_platforms\n end\n end\n\n desired_supported_platforms = supported_platforms.select { |p, _| desired_platforms.include?(p) }.keys\n desired_supported_platforms.each { |p| assured_platform(reason, p, config) }\n inform_multiline(\"Configured platforms that match architectures in library.properties\") do\n desired_supported_platforms.each do |p|\n puts \" #{p}\"\n end # this returns supported_platforms\n end\nend", "def get_archs(lib_path)\n cmd('lipo', '-info', lib_path).split(':').last.strip.split(/\\s/)\nend", "def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend", "def available_platform\n downloads.collect(&:platform).flatten.uniq\n end", "def operating_systems\n collect\n end", "def arch_dir_value\n case @arch_dir\n when Proc\n @arch_dir.call(self)\n else\n @arch_dir\n end\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw/\n end", "def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end", "def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end", "def cross_universal?\n intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS)\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend", "def get_metadata_operating_systems(metadata)\n return unless metadata.is_a?(Hash)\n return unless metadata['operatingsystem_support'].is_a?(Array)\n\n metadata['operatingsystem_support'].each do |os_info|\n next unless os_info['operatingsystem'] && os_info['operatingsystemrelease']\n\n os_name = case os_info['operatingsystem']\n when 'Amazon', 'Archlinux', 'AIX', 'OSX'\n next\n when 'OracleLinux'\n 'oracle'\n when 'Windows'\n 'win'\n else\n os_info['operatingsystem'].downcase\n end\n\n os_info['operatingsystemrelease'].each do |release|\n version = case os_name\n when 'ubuntu', 'osx'\n release.sub('.', '')\n when 'sles'\n release.gsub(%r{ SP[14]}, '')\n when 'win'\n release = release.delete('.') if release.include? '8.1'\n release.sub('Server', '').sub('10', '10-pro')\n else\n release\n end\n\n yield \"#{os_name}-#{version.downcase}-x86_64\".delete(' ')\n end\n end\n end", "def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end", "def windows?\n return @windows if defined?(@windows)\n @windows = (RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i)\n end", "def mac_os_enrollment_assignments\n return @mac_os_enrollment_assignments\n end", "def platform_tuple\n [platform_shortname, platform_version_for_package, machine]\n end", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend", "def compatible_encoders\n encoders = []\n\n c_platform, c_arch = normalize_platform_arch\n\n framework.encoders.each_module_ranked(\n 'Arch' => c_arch, 'Platform' => c_platform) { |name, mod|\n encoders << [ name, mod ]\n }\n\n return encoders;\n end", "def determine_if_x86_64\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :expect_all_exit_codes => true)\n result.exit_code == 0\n end", "def determine_if_x86_64\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :expect_all_exit_codes => true)\n result.exit_code == 0\n end", "def platforms=(value)\n @platforms = value\n end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def GetArchOfELF(filename)\n bash_out = Convert.to_map(\n SCR.Execute(\n path(\".target.bash_output\"),\n Ops.add(Ops.add(Directory.ybindir, \"/elf-arch \"), filename)\n )\n )\n return \"unknown\" if Ops.get_integer(bash_out, \"exit\", 1) != 0\n Builtins.deletechars(Ops.get_string(bash_out, \"stdout\", \"unknown\"), \"\\n\")\n end", "def get_platform\n platform=[]\n testos=`uname -a`\n # puts \"osname is #{testos}\"\n platform << \"raspberry\" if (/arm-linux/ =~ RUBY_PLATFORM) != nil and `uname -a`.include?('armv6')\n platform << \"raspberry\" if `uname -a`.include?('armv6')\n platform << \"raspberry 2\" if (/armv7l-linux/ =~ RUBY_PLATFORM) != nil and !`uname -a`.include?('armv6')\n platform << \"mac\" if (/darwin/ =~ RUBY_PLATFORM) != nil\n platform << \"arm\" if (/arm/ =~ RUBY_PLATFORM) != nil\n platform << \"x86\" if (/x86/ =~ RUBY_PLATFORM) != nil\n platform << \"i686\" if (/i686/ =~ RUBY_PLATFORM) != nil\n platform << \"microsoft\" if testos.include?('Microsoft')\n platform << \"debian\" if testos.include?('Debian')\n platform << \"ubuntu\" if testos.include?('Ubuntu')\n platform << \"linux\" if (/linux/ =~ RUBY_PLATFORM) != nil\n platform\n end", "def supported_platform?\n linux? || darwin?\n end", "def get_architect_prompts(opts = {})\n data, _status_code, _headers = get_architect_prompts_with_http_info(opts)\n return data\n end", "def get_architect_prompts(opts = {})\n data, _status_code, _headers = get_architect_prompts_with_http_info(opts)\n return data\n end", "def platform_dnlif arch\n @options['advopts'] = @defadvopts.checked?\n # No need to thread - this is simple and fast. just call the {platform}_dnilf\n case arch\n when /\\.exe$/\n dnlif_exe\n when /\\.install$/\n dnlif_linux arch\n when /\\.tgz$/\n dnlif_osx\n else\n alert \"Can't do dnlif #{arch}\"\n end\n end", "def yum_repo_platform_string\n platform = platform?('fedora') ? 'fedora' : 'rhel'\n release = platform?('amazon') ? '7' : '$releasever'\n \"#{platform}-#{release}-$basearch\"\n end", "def get_ay_fusion_guest_os(options)\n guest_os = \"sles11\"\n if not options['arch'].to_s.match(/i386/) and not options['arch'].to_s.match(/64/)\n guest_os = guest_os+\"-64\"\n end\n return guest_os\nend", "def is_module_arch?(mod)\n mod_arch = mod.target.arch || mod.arch\n mod_arch.include? session.arch\n end" ]
[ "0.754819", "0.67374974", "0.6482059", "0.6465427", "0.63852566", "0.6374508", "0.6170374", "0.61428696", "0.61124086", "0.6077849", "0.60704404", "0.59934604", "0.59934604", "0.5914384", "0.5903381", "0.5903381", "0.5887445", "0.58827317", "0.5850506", "0.5844784", "0.5811597", "0.5805093", "0.5751756", "0.56881666", "0.56513315", "0.5601903", "0.5534912", "0.5526871", "0.55183744", "0.5478017", "0.54630417", "0.54297966", "0.5397369", "0.5376647", "0.5365875", "0.533649", "0.53322685", "0.53280586", "0.52829075", "0.5250091", "0.52371687", "0.5235382", "0.522228", "0.5221495", "0.5219109", "0.52178943", "0.5185626", "0.5088753", "0.5068697", "0.5053969", "0.50328386", "0.501141", "0.50057054", "0.5001455", "0.49928728", "0.4984767", "0.49629334", "0.49574608", "0.49389455", "0.4938929", "0.4938929", "0.4903678", "0.48841232", "0.4869912", "0.4869572", "0.48576438", "0.4834422", "0.4810386", "0.47427464", "0.4708688", "0.47069702", "0.46882695", "0.4687494", "0.46812975", "0.46812975", "0.46217903", "0.4619706", "0.46056497", "0.4599748", "0.4594312", "0.45810142", "0.45716333", "0.45384544", "0.45382518", "0.4529041", "0.4529041", "0.4520252", "0.4496278", "0.4496278", "0.44876146", "0.44799984", "0.44773665", "0.44666538", "0.4456007", "0.44487303", "0.44487303", "0.44414592", "0.44349104", "0.44308084", "0.44175026" ]
0.8083377
0
Sets the applicableArchitectures property value. Contains properties for Windows architecture.
def applicable_architectures=(value) @applicable_architectures = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applicable_architectures\n return @applicable_architectures\n end", "def supported_archs\n @supported_archs ||= Dir.glob(File.join(__dir__, 'consts', 'sys_nr', '*.rb'))\n .map { |f| File.basename(f, '.rb').to_sym }\n .sort\n end", "def only_on(*architectures)\n architectures = architectures.map do |name|\n if name.respond_to?(:to_str)\n [name]\n else name\n end\n end\n\n os_names, os_versions = Autoproj.workspace.operating_system\n matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }\n if matching_archs.empty?\n return\n elsif matching_archs.none? { |arch| !arch[1] || os_versions.include?(arch[1].downcase) }\n return\n end\n\n yield\nend", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (res.body =~ /(i386|x86)/i)\r\n\t\t\tarch = $1\r\n\t\t\tif (arch =~ /i386|x86/i)\r\n\t\t\t\treturn ARCH_X86\r\n\t\t\t\t# TODO, more\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def machine_arch(arg = nil)\n set_or_return(:machine_arch, arg, kind_of: String, required: true)\n end", "def determine_system_architecture\n @info[:arch] = @shell.query('UNAME', 'uname -m')\n @info[:arch].gsub!(/i\\d86/, 'i386')\n end", "def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end", "def arch\n x86_64? ? \"amd64\" : \"i386\"\n end", "def arch?(what)\n\t\treturn true if (what == ARCH_ANY)\n\n\t\treturn arch.index(what) != nil\n\tend", "def choose_platform_set(config, reason, desired_platforms, library_properties)\n\n # if there are no properties or no architectures, defer entirely to desired platforms\n if library_properties.nil? || library_properties.architectures.nil? || library_properties.architectures.empty?\n # verify that all platforms exist\n desired_platforms.each { |p| assured_platform(reason, p, config) }\n return inform_multiline(\"No architectures listed in library.properties, using configured platforms\") do\n desired_platforms.each { |p| puts \" #{p}\" } # this returns desired_platforms\n end\n end\n\n if library_properties.architectures.include?(\"*\")\n return inform_multiline(\"Wildcard architecture in library.properties, using configured platforms\") do\n desired_platforms.each { |p| puts \" #{p}\" } # this returns desired_platforms\n end\n end\n\n platform_architecture = config.platform_info.transform_values { |v| v[:board].split(\":\")[1] }\n supported_platforms = platform_architecture.select { |_, a| library_properties.architectures.include?(a) }\n\n if config.is_default\n # completely ignore default config, opting for brute-force library matches\n # OTOH, we don't need to assure platforms because we defined them\n return inform_multiline(\"Default config, platforms matching architectures in library.properties\") do\n supported_platforms.keys.each do |p| # rubocop:disable Style/HashEachMethods\n puts \" #{p}\"\n end # this returns supported_platforms\n end\n end\n\n desired_supported_platforms = supported_platforms.select { |p, _| desired_platforms.include?(p) }.keys\n desired_supported_platforms.each { |p| assured_platform(reason, p, config) }\n inform_multiline(\"Configured platforms that match architectures in library.properties\") do\n desired_supported_platforms.each do |p|\n puts \" #{p}\"\n end # this returns supported_platforms\n end\nend", "def architecture # rubocop:disable Lint/DuplicateMethods\n @architecture ||= @name.match(PLATFORM_REGEX)[3]\n end", "def DoArchitecturesMatch(arch_1, arch_2)\n ppc_archs = [\"ppc\", \"ppc64\"]\n\n # exact match\n if arch_1 == arch_2\n return true \n # ppc exception\n elsif Builtins.contains(ppc_archs, arch_1) &&\n Builtins.contains(ppc_archs, arch_2)\n return true\n end\n\n # else\n false\n end", "def actual_arch\n arch = nil\n\n if explicit_arch.nil? == false\n arch = explicit_arch\n elsif datastore['ARCH']\n arch = datastore['ARCH']\n elsif assoc_exploit\n arch = assoc_exploit.target_arch || ARCH_X86\n end\n\n # If we still have an invalid architecture, then we suck.\n if arch.nil?\n raise NoCompatiblePayloadError, \"An architecture could not be determined by the generic payload\"\n elsif arch.kind_of?(String)\n arch = [ arch ]\n end\n\n return arch\n end", "def platforms=(value)\n @platforms = value\n end", "def target_arch\n (target and target.arch) ? target.arch : (arch == []) ? nil : arch\n end", "def architecture\n @architecture ||= `uname -m`\n end", "def is_allowed?\n self.allowed.include?(@architecture)\n end", "def _ARCH; Config._ARCH; end", "def architecture\n return 'x86_64'\n end", "def get_arch\n if defined?(@arch) then return @arch else @arch = nil end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n if ntdlls.length > 0\n machine = %x{pev -c #{ntdlls.first} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n end\n else\n search = File.join(@path, 'sources/{setup.exe,winsetup.dll}')\n setup = Dir.glob(search, File::FNM_CASEFOLD)\n setup.each do |file|\n machine = %x{pev -c #{file} | grep -i Machine}\n if $?.success?\n @arch = '64-bit' if machine =~ /0x8664/\n @arch = '32-bit' if machine =~ /14c/\n break\n end\n end # end of setup block\n begin\n get_xmlinfo if not defined?(@xmlinfo)\n arches = REXML::XPath.match(@xmlinfo, '/WIM/IMAGE/WINDOWS/ARCH/text()')\n arch = arches.first\n if arches.count(arch) == arches.size\n arch = Integer(arch.to_s)\n @arch = '64-bit' if arch == 9\n @arch = '32-bit' if arch == 0\n else\n @arch = '32/64-bit' unless @arch\n end\n rescue Exception => e\n # puts \"error(get_arch): #{e}\"\n end\n end\n @arch\n end", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid 7.6 7.5 7.4 7.2 7.1 7.0 6.0.5),\n 'ubuntu' => %w(14.10 14.04 13.10 13.04 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2014.09 2014.03 2013.09 2012.09),\n 'centos' => %w(7.0.1406 6.6 6.5 6.4 6.3 6.0 5.11 5.10 5.9 5.8),\n 'oracle' => %w(6.5 5.10),\n 'redhat' => %w(7.0 6.5 6.4 6.3 6.2 6.1 6.0 5.10 5.9 5.8 5.7 5.6)\n }\nend", "def set_architecture\n @architecture = Architecture.find(params[:id])\n end", "def not_on(*architectures)\n architectures = architectures.map do |name|\n if name.respond_to?(:to_str)\n [name]\n else name\n end\n end\n\n os_names, os_versions = Autoproj.workspace.operating_system\n matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }\n if matching_archs.empty?\n return yield\n elsif matching_archs.all? { |arch| arch[1] && !os_versions.include?(arch[1].downcase) }\n return yield\n end\n\n # Simply get the current list of packages, yield the block, and exclude all\n # packages that have been added\n current_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set\n yield\n new_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set -\n current_packages\n\n new_packages.each do |pkg_name|\n Autoproj.workspace.manifest.add_exclusion(pkg_name, \"#{pkg_name} is disabled on this operating system\")\n end\nend", "def enable_msys_apps(mingwarch=nil)\n vars = with_msys_install_hint{ msys_apps_envvars(mingwarch) }\n if vars[\"PATH\"]\n phrase = \"Temporarily enhancing PATH for MSYS/MINGW...\"\n if defined?(Gem)\n Gem.ui.say(phrase) if Gem.configuration.verbose\n else\n puts phrase if $DEBUG\n end\n end\n vars.each do |key, val|\n ENV[key] = val\n end\n end", "def canonical_arch\n Config::CONFIG['arch'].sub(/[\\.0-9]*$/, '')\n end", "def architecture\n 'x86_64'\n end", "def architecture\n 'x86_64'\n end", "def safe_architecture\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end", "def fix_windows_manifest\n return manifest if manifest['windows'].nil?\n\n builds_32bit = {}\n builds_64bit = {}\n\n manifest['windows'].each do |platform_version, build_data|\n build_data.each do |architecture, builds|\n builds.each do |version, build|\n case architecture\n when 'x86_64'\n if %w{chef angrychef}.include?(project_name)\n # In the beginning (Chef 10) there was only 1 Chef package\n # architecture, and it was 32 bit. However, it was always stored\n # under the x86_64 manifest architecture and it was returned for\n # both x86_64 and i386 requests (1 package was used for both 32\n # and 64 bit Windows machines). This continued until Chef 12.4.2\n # - this was the first package to be stored under the i386\n # manifest architecture. There was still only 1 package and it\n # was 32 bit, but now it had the correct manifest architecture.\n # Starting with Chef 12.7 we started building 2 packages for Chef\n # - a 32 bit package for i386 architecture and a 64 bit package\n # for x86_64 architecture.\n #\n # Until Chef reaches version 12.9 we want to continue servering\n # all stable channel requests _only_ with the 32 bit package,\n # regardless of whether the user specifies x86_64 or i386\n # architecture. Once Chef 12.9 is released we will start returning\n # the correct package based upon requested architecture but only\n # for version 12.9+\n if Opscode::Version.parse(version) >= Opscode::Version.parse(\"12.7.0\")\n builds_64bit[version] = build\n else\n builds_32bit[version] ||= build\n end\n elsif project_name == 'chefdk'\n # ChefDK is still only built to produce a 32-bit package. But like Chef,\n # it works on both 32-bit systems and 64-bit systems. It also may\n # sometimes be tagged as x86_64 or i386. But we want to use each\n # package for all customer architectures.\n builds_32bit[version] = build\n builds_64bit[version] = build\n else\n builds_64bit[version] = build\n end\n when 'i386', 'i686'\n builds_32bit[version] = build\n if project_name == 'chefdk'\n builds_64bit[version] = build\n end\n else\n raise \"Unknown Windows architecture '#{architecture}'\"\n end\n end\n end\n end\n\n manifest['windows'] = {\n '2008r2' => {\n 'i386' => builds_32bit,\n 'x86_64' => builds_64bit\n }\n }\n\n manifest\n end", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid\n 8.4 8.2 8.1 8.0\n 7.10 7.9 7.8 7.7 7.6 7.5 7.4 7.2 7.1 7.0\n 6.0.5),\n 'ubuntu' => %w(16.04\n 15.10 15.04\n 14.10 14.04\n 13.10 13.04\n 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2016.03\n 2015.09 2015.03\n 2014.09 2014.03\n 2013.09 2012.09),\n 'centos' => %w(7.2.1511 7.1.1503 7.0.1406\n 6.8 6.7 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.11 5.10 5.9 5.8 5.7 5.6 5.5 5.4 5.3 5.2),\n 'oracle' => %w(7.1 7.0\n 6.6 6.5\n 5.10),\n 'redhat' => %w(7.1 7.0\n 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.10 5.9 5.8 5.7 5.6)\n }\nend", "def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end", "def ruby_arch\n case Common.target_platform\n when /darwin/\n 'x86_64-darwin10'\n when 'linux-x86_64'\n 'x86_64-linux'\n when 'linux-x86'\n 'i686-linux'\n when /windows/\n 'x64-mingw64'\n end\nend", "def show_machine_arch\n\t\t\tputs \" Machine: #{ELF_MACHINE_ARCH_LIST[@elf_machine.to_i]} (#{@elf_machine.to_i})\"\n\t\tend", "def arch?(node = __getnode)\n node[\"platform_family\"] == \"arch\"\n end", "def enable_i386_arch!\n execute 'dpkg --add-architecture i386' do\n only_if do\n cmd = 'dpkg --print-architecture; ' \\\n 'dpkg --print-foreign-architectures'\n !shell_out!(cmd).stdout.lines.include?('i386')\n end\n notifies :run, 'execute[apt-get update]', :immediately\n end\n end", "def objdump_arch(arch)\n case arch\n when :amd64 then 'i386:x86-64'\n else arch.to_s\n end\n end", "def run_command_with_os_architecture(script, interpreter, options)\n options ||= {}\n options = options.dup\n arch = options.delete(:architecture)\n\n with_os_architecture(nil, architecture: arch) do\n shell_out(\n build_powershell_command(script, interpreter),\n **options\n )\n end\n end", "def arch_32_bit; :i386; end", "def arch\n if windows? && windows_arch_i386?\n \"i386\"\n elsif solaris?\n if intel?\n \"i386\"\n elsif sparc?\n \"sparc\"\n end\n else\n Ohai[\"kernel\"][\"machine\"]\n end\n end", "def objdump_arch_supported?(bin, arch)\n return false if bin.nil?\n\n arch = objdump_arch(arch)\n `#{::Shellwords.join([bin, '--help'])}`.lines.any? { |c| c.split.include?(arch) }\n end", "def architecture\n data[:architecture]\n end", "def default_platform_list\n [\n metadata.platform,\n *ruby_versions,\n *platforms,\n RbConfig::CONFIG['build']\n ]\n end", "def supports(platform, *version_args)\n version = new_args_format(:supports, platform, version_args)\n constraint = validate_version_constraint(:supports, platform, version)\n @platforms[platform] = constraint.to_s\n @platforms[platform]\n end", "def architecture(file)\n return :invalid unless File.exist?(file)\n\n f = File.open(file)\n str = ELFTools::ELFFile.new(f).machine\n {\n 'Advanced Micro Devices X86-64' => :amd64,\n 'Intel 80386' => :i386,\n 'ARM' => :arm,\n 'AArch64' => :aarch64,\n 'MIPS R3000' => :mips\n }[str] || :unknown\n rescue ELFTools::ELFError # not a valid ELF\n :invalid\n ensure\n f&.close\n end", "def calculate_doublepulsar_arch(s)\n s == 0 ? ARCH_X86 : ARCH_X64\n end", "def simulator?\n arches.include?(\"i386\") || arches.include?(\"x86_64\")\n end", "def platforms\n [ RUBY_PLATFORM ].tap do |list|\n list.push \"JVM #{java_version}\" if jruby?\n end\n end", "def archs_for_command cmd\n cmd = cmd.to_s # If we were passed a Pathname, turn it into a string.\n cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?\n cmd.gsub! ' ', '\\\\ ' # Escape spaces in the filename.\n\n archs = IO.popen(\"/usr/bin/file #{cmd}\").readlines.inject([]) do |archs, line|\n case line\n when /Mach-O (executable|dynamically linked shared library) ppc/\n archs << :ppc7400\n when /Mach-O 64-bit (executable|dynamically linked shared library) ppc64/\n archs << :ppc64\n when /Mach-O (executable|dynamically linked shared library) i386/\n archs << :i386\n when /Mach-O 64-bit (executable|dynamically linked shared library) x86_64/\n archs << :x86_64\n else\n archs\n end\n end\n archs.extend(ArchitectureListExtension)\nend", "def architecture_params\n params.require(:architecture).permit(:name, :description)\n end", "def architecture\n `uname -m`.strip\n end", "def architecture\n `uname -m`.strip\n end", "def rpm_arch\n @lead.arch\n end", "def arch_platform?(node = __getnode)\n node[\"platform\"] == \"arch\"\n end", "def minimum_supported_operating_system=(value)\n @minimum_supported_operating_system = value\n end", "def index\n @architectures = Architecture.all\n end", "def set_ami_spec\n ami_arch = @@ec2.describe_images([self.ami_id]).first\n if (ami_arch[:aws_architecture] == \"i386\" && self.ami_spec.blank? && self.spot_price.blank?)\n self.ami_spec = \"c1.medium\"\n self.spot_price = 0.50\n elsif (ami_arch[:aws_architecture] == \"x86_64\" && self.ami_spec.blank? && self.spot_price.blank?)\n self.ami_spec = \"m1.large\"\n self.spot_price = 1.00\n end\n end", "def setup\r\n super\r\n @@payload_arch_mappings = {\r\n ARCH_X86 => [ 'x86' ],\r\n ARCH_X64 => [ 'x86_64' ],\r\n ARCH_MIPS => [ 'mips' ],\r\n ARCH_MIPSLE => [ 'mipsel' ],\r\n ARCH_MIPSBE => [ 'mips' ],\r\n ARCH_MIPS64 => [ 'mips64' ],\r\n ARCH_MIPS64LE => [ 'mips64el' ],\r\n\r\n # PowerPC stubs are currently over the 16384 maximum POST size\r\n # ARCH_PPC => [ 'powerpc' ],\r\n # ARCH_PPC64 => [ 'powerpc64' ],\r\n # ARCH_PPC64LE => [ 'powerpc64le' ],\r\n\r\n ARCH_SPARC => [ 'sparc' ],\r\n ARCH_SPARC64 => [ 'sparc64' ],\r\n ARCH_ARMLE => [ 'armel', 'armhf' ],\r\n ARCH_AARCH64 => [ 'aarch64' ],\r\n ARCH_ZARCH => [ 's390x' ],\r\n }\r\n\r\n # Architectures we don't offically support but can shell anyways with interact\r\n @@payload_arch_bonus = %W{\r\n mips64el sparc64 s390x\r\n }\r\n\r\n # General platforms (OS + C library)\r\n @@payload_platforms = %W{\r\n linux-glibc\r\n }\r\n end", "def platform_dnlif arch\n @options['advopts'] = @defadvopts.checked?\n # No need to thread - this is simple and fast. just call the {platform}_dnilf\n case arch\n when /\\.exe$/\n dnlif_exe\n when /\\.install$/\n dnlif_linux arch\n when /\\.tgz$/\n dnlif_osx\n else\n alert \"Can't do dnlif #{arch}\"\n end\n end", "def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:extension_id, :version)))\n end", "def applicable_device_types=(value)\n @applicable_device_types = value\n end", "def arch(internal = false)\n internal ? '64-bit' : 'x86_64'\n end", "def executables=(value)\n @executables = Array(value)\n end", "def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def ruby_arch_setup(do_escape = false)\n Packager.info \"Creating ruby env setup\"\n if do_escape\n setup = Regexp.escape(\"arch=$(shell gcc -print-multiarch)\\n\")\n # Extract the default ruby version to build for on that platform\n # this assumes a proper setup of /usr/bin/ruby\n setup += Regexp.escape(\"ruby_ver=$(shell ruby -r rbconfig -e \") + \"\\\\\\\"print RbConfig::CONFIG[\\'ruby_version\\']\\\\\\\")\" + Regexp.escape(\"\\n\")\n setup += Regexp.escape(\"ruby_arch_dir=$(shell ruby -r rbconfig -e \") + \"\\\\\\\"print RbConfig::CONFIG[\\'archdir\\']\\\\\\\")\" + Regexp.escape(\"\\n\")\n setup += Regexp.escape(\"ruby_libdir=$(shell ruby -r rbconfig -e \") + \"\\\\\\\"print RbConfig::CONFIG[\\'rubylibdir\\']\\\\\\\")\" + Regexp.escape(\"\\n\")\n\n setup += Regexp.escape(\"rockruby_archdir=$(subst /usr,,$(ruby_arch_dir))\\n\")\n setup += Regexp.escape(\"rockruby_libdir=$(subst /usr,,$(ruby_libdir))\\n\")\n else\n setup = \"arch=$(shell gcc -print-multiarch)\\n\"\n # Extract the default ruby version to build for on that platform\n # this assumes a proper setup of /usr/bin/ruby\n setup += \"ruby_ver=$(shell ruby -r rbconfig -e \\\"print RbConfig::CONFIG[\\'ruby_version\\']\\\")\\n\"\n setup += \"ruby_arch_dir=$(shell ruby -r rbconfig -e \\\"print RbConfig::CONFIG[\\'archdir\\']\\\")\\n\"\n setup += \"ruby_libdir=$(shell ruby -r rbconfig -e \\\"print RbConfig::CONFIG[\\'rubylibdir\\']\\\")\\n\"\n\n setup += \"rockruby_archdir=$(subst /usr,,$(ruby_arch_dir))\\n\"\n setup += \"rockruby_libdir=$(subst /usr,,$(ruby_libdir))\\n\"\n end\n Packager.info \"Ruby env setup is:\\n#{setup}\"\n setup\n end", "def arch_lookup(sys_type)\n return \"x86_64\" if sys_type == \"x64-based PC\"\n return \"i386\" if sys_type == \"X86-based PC\"\n\n sys_type\n end", "def restrict_available_arch(pv, arch_names)\n condition = {:errata_arches => {:name => arch_names}}\n pv.cdn_repo_links.joins(:cdn_repo => [:arch]).where(condition).tap do |links|\n pv.cdn_repo_links.where('cdn_repo_links.id not in (?)', links).each(&:destroy)\n end\n\n pv.channel_links.joins(:channel => [:arch]).where(condition).tap do |links|\n pv.channel_links.where('channel_links.id not in (?)', links).each(&:destroy)\n end\n end", "def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end", "def exclude_simulator_archs(installer)\n Pod::UI.puts \"Fixing Xcode 12 duplicate architectures\"\n\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['EXCLUDED_ARCHS[sdk=*simulator*]'] = 'arm64 arm64e armv7 armv7s armv6 armv8'\n end\n end\n\n installer.pods_project.save\nend", "def arch_specific_objdump(arch)\n {\n aarch64: 'aarch64-linux-gnu-objdump',\n amd64: 'x86_64-linux-gnu-objdump',\n i386: 'i686-linux-gnu-objdump'\n }[arch]\n end", "def arch_for_filename(path)\n file = File.basename(path, File.extname(path))\n\n case file\n when /686/, /386/\n '32-bit'\n when /86_64/, /amd64/\n '64-bit'\n else\n parts = file.split('_')\n\n if parts.empty?\n raise \"Could not determine arch for filename `#{file}'!\"\n end\n\n parts.last.capitalize\n end\n end", "def arch\n return `uname -m`.chomp\n end", "def windows_enabled=(value)\n @windows_enabled = value\n end", "def determine_if_x86_64\n (identify_windows_architecture =~ /64/) == 0\n end", "def cross_universal?\n intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS)\n end", "def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end", "def gem_platforms(name, options) # :nodoc:\n platform_names = Array(options.delete :platform)\n platform_names.concat Array(options.delete :platforms)\n platform_names.concat @current_platforms if @current_platforms\n\n return true if platform_names.empty?\n\n platform_names.any? do |platform_name|\n raise ArgumentError, \"unknown platform #{platform_name.inspect}\" unless\n platform = PLATFORM_MAP[platform_name]\n\n next false unless Gem::Platform.match_gem? platform, name\n\n if engines = ENGINE_MAP[platform_name]\n next false unless engines.include? Gem.ruby_engine\n end\n\n case WINDOWS[platform_name]\n when :only then\n next false unless Gem.win_platform?\n when :never then\n next false if Gem.win_platform?\n end\n\n VERSION_MAP[platform_name].satisfied_by? Gem.ruby_version\n end\n end", "def modern_apps=(value)\n @modern_apps = value\n end", "def util_reset_arch\n util_set_arch @orig_arch\n end", "def util_reset_arch\n util_set_arch @orig_arch\n end", "def mac_os_enrollment_assignments=(value)\n @mac_os_enrollment_assignments = value\n end", "def update\n respond_to do |format|\n if @architecture.update(architecture_params)\n format.html { redirect_to @architecture, notice: 'Architecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @architecture }\n else\n format.html { render :edit }\n format.json { render json: @architecture.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_defaults\n kind_list = self.availability_types\n kind_list.each do |default_avail_types|\n if DEFAULT_AVAILABILITY_TYPES[:kind].include?(default_avail_types.kind)\n default_avail_types.checked = true\n end\n end\n\n self.both_license_types = true\n end", "def set_arc_compatibility_flag!\n set_hash_value('set_arc_compatibility_flag', true)\n end", "def nvmdimm_perform_config=(nvmdimm_perform_config)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"BW Optimized\", \"Balanced Profile\", \"Latency Optimized\"])\n unless validator.valid?(nvmdimm_perform_config)\n fail ArgumentError, \"invalid value for \\\"nvmdimm_perform_config\\\", must be one of #{validator.allowable_values}.\"\n end\n @nvmdimm_perform_config = nvmdimm_perform_config\n end", "def name\n @architecture\n end", "def can_post_install?\n return false unless has_os?\n\n ![\"vmware_esxi\", \"hyperv\", \"suse11\", \"suse12\"].include?(os_image_type.downcase)\n end", "def build_flags_cross\n # Unclear if we need config_site CONFIG_SITE=/etc/dpkg-cross/cross-config.i386\n [] << '-a' << cross_arch\n end", "def pcie_ari_support=(pcie_ari_support)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"Auto\", \"disabled\", \"enabled\"])\n unless validator.valid?(pcie_ari_support)\n fail ArgumentError, \"invalid value for \\\"pcie_ari_support\\\", must be one of #{validator.allowable_values}.\"\n end\n @pcie_ari_support = pcie_ari_support\n end", "def windows_mobile_restriction=(value)\n @windows_mobile_restriction = value\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def determine_if_x86_64\n if self[:platform] =~ /solaris/\n result = exec(Beaker::Command.new(\"uname -a | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n else\n result = exec(Beaker::Command.new(\"arch | grep x86_64\"), :accept_all_exit_codes => true)\n result.exit_code == 0\n end\n end", "def update_platforms\n # TODO: Check auth and policy\n if policy(@extension).manage?\n params[:supported_platforms] ||= []\n @version.supported_platforms = SupportedPlatform.where(name: params[:supported_platforms])\n @version.save\n end\n\n redirect_to({ action: :show }.merge(params.slice(:username, :extension_id, :version)))\n end", "def os=(value)\n if value == @defaults['os']\n @values.delete 'os' if @values.key? 'os'\n else\n @values['os'] = value\n end\n end", "def options\n [['--build32', 'Force a 32-bit build.']]\n end", "def platforms; platform_names; end", "def management_mode=(management_mode)\n validator = EnumAttributeValidator.new('String', [\"IntersightStandalone\", \"UCSM\", \"Intersight\"])\n unless validator.valid?(management_mode)\n fail ArgumentError, \"invalid value for \\\"management_mode\\\", must be one of #{validator.allowable_values}.\"\n end\n @management_mode = management_mode\n end", "def media_types=(value)\n @media_types = value\n end", "def is_mac_sync_app_enabled=(value)\n @is_mac_sync_app_enabled = value\n end", "def get_arch\n arch = `uname -m`\n if arch.include?(\"64\")\n return \"64\"\n else\n return \"32\"\n end\nend" ]
[ "0.6752265", "0.5448921", "0.5242476", "0.5205646", "0.5181193", "0.5133941", "0.50813645", "0.5079059", "0.50757474", "0.50558347", "0.49650002", "0.49574012", "0.4948594", "0.4945317", "0.48942187", "0.48512644", "0.4807871", "0.47687423", "0.4767766", "0.4755526", "0.47236475", "0.4708668", "0.46894684", "0.46880046", "0.46799445", "0.46494675", "0.46494675", "0.46373236", "0.46204212", "0.45985973", "0.453453", "0.45034006", "0.44928038", "0.4492138", "0.44765818", "0.44573003", "0.43895635", "0.43876094", "0.43842685", "0.43669257", "0.43522546", "0.4327038", "0.42928573", "0.42902634", "0.428906", "0.42773214", "0.4256736", "0.42443603", "0.4233054", "0.41984522", "0.41984522", "0.41946673", "0.4176576", "0.4175297", "0.41616786", "0.41432834", "0.41090354", "0.4104534", "0.40878564", "0.4071882", "0.40632156", "0.40354225", "0.40163675", "0.40157044", "0.40090865", "0.39960873", "0.39618975", "0.39578483", "0.39428028", "0.39419806", "0.3938308", "0.39138466", "0.39113232", "0.39030305", "0.38774022", "0.38750213", "0.38574517", "0.38529465", "0.3849691", "0.3849691", "0.38438267", "0.38306397", "0.3811697", "0.38068354", "0.38042775", "0.37996164", "0.37948054", "0.37927517", "0.37925586", "0.3787639", "0.3782368", "0.3782368", "0.3776861", "0.3773311", "0.3770578", "0.37613335", "0.37610525", "0.37599736", "0.37521014", "0.37510595" ]
0.8062361
0
Gets the applicableDeviceTypes property value. Contains properties for Windows device type.
def applicable_device_types return @applicable_device_types end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applicable_device_types=(value)\n @applicable_device_types = value\n end", "def allowed_types\n\t\t[Device]\n\tend", "def platform_types\n get(\"platform-types\")[\"types\"]\n end", "def allowed_types\n\t\t[Device, Domain]\n\tend", "def allowed_types\n\t\t[Domain,Device]\n\tend", "def device_type\n return @device_type\n end", "def platform_types\n @platform_types.to_hash\n end", "def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end", "def options_for_supported_types\n Mapping::SUPPORTED_TYPES.map do |type|\n [type.titleize.to_s, type]\n end\n end", "def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end", "def media_types\n return @media_types\n end", "def get_device_types_info(dtid, opts = {})\n data, _status_code, _headers = get_device_types_info_with_http_info(dtid, opts)\n return data\n end", "def device_compliance_setting_states\n return @device_compliance_setting_states\n end", "def device_type=(value)\n @device_type = value\n end", "def allowed_types\n\t\t[Device, EmailAddress]\n\tend", "def device_type\n self[:type]\n end", "def possible_types\n @data.flat_map { |iso2, data| data[:possible] }.uniq\n end", "def operational_attribute_types\n\t\treturn self.attribute_types.values.find_all {|attrtype| attrtype.operational? }.uniq\n\tend", "def object_types\n feature_object_types.collect(&:category).select{|c| c}\n end", "def device_type\n provider.device_type\n end", "def types\n @opt_types.values\n end", "def device_type\n matching = {\n ScreenSize::IOS_35 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_35,\n ScreenSize::IOS_40 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_40,\n ScreenSize::IOS_47 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_47, # also 7 & 8\n ScreenSize::IOS_55 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_55, # also 7 Plus & 8 Plus\n ScreenSize::IOS_58 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_58,\n ScreenSize::IOS_65 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_65,\n ScreenSize::IOS_IPAD => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_97,\n ScreenSize::IOS_IPAD_10_5 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_105,\n ScreenSize::IOS_IPAD_11 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_PRO_3GEN_11,\n ScreenSize::IOS_IPAD_PRO => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_PRO_129,\n ScreenSize::IOS_IPAD_PRO_12_9 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_PRO_3GEN_129,\n ScreenSize::MAC => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::DESKTOP\n }\n return matching[self.screen_size]\n end", "def direct_types\n (self[\"directTypes\"] || ['*']).map { |t| Registry.get_type(t) }\n end", "def create_types\n\t\t[Device]\n\tend", "def create_types\n\t\t[Device]\n\tend", "def client_app_types\n return @client_app_types\n end", "def software_types\n types = []\n self['852j'].each do |j|\n if j =~ /\\Acd-?rom/i\n types << 'CR'\n end\n if j =~ /\\Asoftware/i\n types << 'CS'\n end\n end\n types.uniq!\n return types\n end", "def human_types\n types.map { |type| Core::TYPES_DESC[type] }\n end", "def types\n @data.keys & TYPES\n end", "def resourceType\n 'DeviceDefinition'\n end", "def conf_media_type\n @conf_kit_media_types = Kitting::KitMediaType.where(:kit_type => \"configurable\",:customer_number => \"SYSTEM\")\n end", "def device_type\n self[:type]\n end", "def allowed_types\n\t\treturn [EmailAddress, Device, Domain, Organization, User, Location, Service, NetApplication, WebApplication]\n\tend", "def get_restriction_types\n get_restrictions_data['types']\n end", "def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end", "def available_types\n @bridge.available_log_types\n end", "def update_types\n\t\t[Device]\n\tend", "def update_types\n\t\t[Device]\n\tend", "def applicable_architectures\n return @applicable_architectures\n end", "def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end", "def device_type\n self[:type]\n end", "def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end", "def allowed_device_count\n return @allowed_device_count\n end", "def media_types=(value)\n @media_types = value\n end", "def operational_attribute_types\n\t\treturn self.directory.schema.operational_attribute_types\n\tend", "def types\n get_metadata unless @types\n return @types\n end", "def get_device_type(request)\n return nil if disabled_by_referer_set?(request) ||\n disabled_by_referer_matching?(request) ||\n disabled_by_referer_not_matching?(request)\n\n @rules.each do |regex, device_type|\n return device_type if request.url =~ regex\n end\n nil\n end", "def device_type\n case request.user_agent\n when /mobile/i\n \"mobile\"\n when /iPad/i\n \"tablet\"\n when /Android/i\n \"tablet\"\n else\n \"desktop\"\n end\n end", "def device_typemap # :nodoc:\n @device_typemap ||= DEVICE_TYPEMAP.dup\n end", "def minimum_supported_operating_system\n return @minimum_supported_operating_system\n end", "def devices\n return @devices\n end", "def software_mm_comp_file_types\n %w[b f g i]\n end", "def datatypes\n value.document.fetch(\"#{value.key}_type\", [])\n end", "def device_states\n return @device_states\n end", "def get_available_log_types\n @driver.logs.available_types\n end", "def target_types\n return @target_types\n end", "def available_settings\n return @@settings_by_type[self.resource_type]\n end", "def is_device? type\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end", "def devices\n @devices\n end", "def devices\n @_devices ||= begin\n n = self.num_devices\n ptr2 = MemoryPointer::new( Device, n )\n error = OpenCL.clGetProgramInfo(self, DEVICES, Device.size*n, ptr2, nil)\n error_check(error)\n ptr2.get_array_of_pointer(0, n).collect { |device_ptr|\n Device::new(device_ptr)\n }\n end\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include? type.to_s.downcase\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include? type.to_s.downcase\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end", "def is_device?(type)\n\t\trequest.user_agent.to_s.downcase.include?(type.to_s.downcase)\n\tend", "def fstype\n return self['fstype'] if has_key?('fstype')\n Chef::Log.info([\n self['fstype'], current[:fstype],\n File.exists?(device) && `file -s '#{device}'`.chomp,\n self,\n ].inspect)\n return current[:fstype] if current[:fstype]\n return unless File.exists?(device)\n dev_type_str = `file -s '#{device}'`.chomp\n case\n when dev_type_str =~ /SGI XFS/ then self['fstype'] = 'xfs'\n when dev_type_str =~ /Linux.*(ext[2-4])/ then self['fstype'] = $1\n else\n raise \"Can't determine filesystem type of #{device} -- set it explicitly in node[:volumes]\"\n end\n self['fstype']\n end", "def guest_types_descriptions\n {\n \"dosGuest\" => \"Microsoft MS-DOS\",\n \"win31Guest\" => \"Microsoft Windows 3.1\",\n \"win95Guest\" => \"Microsoft Windows 95\",\n \"win98Guest\" => \"Microsoft Windows 98\",\n \"winMeGuest\" => \"Microsoft Windows Millenium Edition\",\n \"winNTGuest\" => \"Microsoft Windows NT\",\n \"win2000ProGuest\" => \"Microsoft Windows 2000 Professional\",\n \"win2000ServGuest\" => \"Microsoft Windows 2000 Server\",\n \"win2000AdvServGuest\" => \"Microsoft Windows 2000 Advanced Server\",\n \"winXPHomeGuest\" => \"Microsoft Windows XP Home Edition\",\n \"winXPProGuest\" => \"Microsoft Windows XP Professional (32-bit)\",\n \"winXPPro64Guest\" => \"Microsoft Windows XP Professional (64-bit)\",\n \"winNetWebGuest\" => \"Microsoft Windows Server 2003 Web Edition (32-bit)\",\n \"winNetStandardGuest\" => \"Microsoft Windows Server 2003 Standard Edition (32-bit)\",\n \"winNetEnterpriseGuest\" => \"Microsoft Windows Server 2003 Enterprise Edition (32-bit)\",\n \"winNetDatacenterGuest\" => \"Microsoft Windows Server 2003 Datacenter Edition (32-bit)\",\n \"winNetBusinessGuest\" => \"Microsoft Windows Small Business Server 2003\",\n \"winNetStandard64Guest\" => \"Microsoft Windows Server 2003 Standard Edition (64-bit)\",\n \"winNetEnterprise64Guest\" => \"Microsoft Windows Server 2003 Enterprise Edition (64-bit)\",\n \"winLonghornGuest\" => \"Microsoft Windows Longhorn (32-bit)\",\n \"winLonghorn64Guest\" => \"Microsoft Windows Longhorn (64-bit)\",\n \"winNetDatacenter64Guest\" => \"Microsoft Windows Server 2003 Datacenter Edition (64-bit)\",\n \"winVistaGuest\" => \"Microsoft Windows Vista (32-bit)\",\n \"winVista64Guest\" => \"Microsoft Windows Vista (64-bit)\",\n \"windows7Guest\" => \"Microsoft Windows 7 (32-bit)\",\n \"windows7_64Guest\" => \"Microsoft Windows 7 (64-bit)\",\n \"windows7Server64Guest\" => \"Microsoft Windows Server 2008 R2 (64-bit)\",\n \"windows8Guest\" => \"Microsoft Windows 8 (32-bit)\",\n \"windows8_64Guest\" => \"Microsoft Windows 8 (64-bit)\",\n \"windows8Server64Guest\" => \"Microsoft Windows Server 2012 (64-bit)\",\n \"windowsHyperVGuest\" => \"Microsoft Windows Hyper-V\",\n \"freebsd64Guest\" => \"FreeBSD (64-bit)\",\n \"freebsdGuest\" => \"FreeBSD (32-bit)\",\n \"redhatGuest\" => \"Red Hat Linux 2.1\",\n \"rhel2Guest\" => \"Red Hat Enterprise Linux 2.1\",\n \"rhel3Guest\" => \"Red Hat Enterprise Linux 3 (32-bit)\",\n \"rhel3_64Guest\" => \"Red Hat Enterprise Linux 3 (64-bit)\",\n \"rhel4Guest\" => \"Red Hat Enterprise Linux 4 (32-bit)\",\n \"rhel4_64Guest\" => \"Red Hat Enterprise Linux 4 (64-bit)\",\n \"rhel5Guest\" => \"Red Hat Enterprise Linux 5 (32-bit)\",\n \"rhel5_64Guest\" => \"Red Hat Enterprise Linux 5 (64-bit)\",\n \"rhel6Guest\" => \"Red Hat Enterprise Linux 6 (32-bit)\",\n \"rhel6_64Guest\" => \"Red Hat Enterprise Linux 6 (64-bit)\",\n \"rhel7Guest\" => \"Red Hat Enterprise Linux 7 (32-bit)\",\n \"rhel7_64Guest\" => \"Red Hat Enterprise Linux 7 (64-bit)\",\n \"centosGuest\" => \"CentOS 4/5/6 (32-bit)\",\n \"centos64Guest\" => \"CentOS 4/5/6 (64-bit)\",\n \"oracleLinux64Guest\" => \"Oracle Linux 4/5/6 (64-bit)\",\n \"oracleLinuxGuest\" => \"Oracle Linux 4/5/6 (32-bit)\",\n \"suseGuest\" => \"Suse Linux (32-bit)\",\n \"suse64Guest\" => \"Suse Linux (64-bit)\",\n \"slesGuest\" => \"Novell SUSE Linux Enterprise 8/9 (32-bit)\",\n \"sles64Guest\" => \"Novell SUSE Linux Enterprise 8/9 (64-bit)\",\n \"sles10Guest\" => \"Novell SUSE Linux Enterprise 10 (32-bit)\",\n \"sles10_64Guest\" => \"Novell SUSE Linux Enterprise 10 (64-bit)\",\n \"sles11Guest\" => \"Novell SUSE Linux Enterprise 11 (32-bit)\",\n \"sles11_64Guest\" => \"Novell SUSE Linux Enterprise 11 (64-bit)\",\n \"sles12Guest\" => \"Novell SUSE Linux Enterprise 12 (32-bit)\",\n \"sles12_64Guest\" => \"Novell SUSE Linux Enterprise 12 (64-bit)\",\n \"nld9Guest\" => \"Novell Linux Desktop 9\",\n \"oesGuest\" => \"Novell Open Enterprise Server\",\n \"sjdsGuest\" => \"Sun Java Desktop System\",\n \"mandrakeGuest\" => \"Mandrake Linux\",\n \"mandrivaGuest\" => \"Mandriva Linux (32-bit)\",\n \"mandriva64Guest\" => \"Mandriva Linux (64-bit)\",\n \"turboLinuxGuest\" => \"Turbolinux (32-bit)\",\n \"turboLinux64Guest\" => \"Turbolinux (64-bit)\",\n \"ubuntu64Guest\" => \"Ubuntu Linux (64-bit)\",\n \"ubuntuGuest\" => \"Ubuntu Linux (32-bit)\",\n \"debian4Guest\" => \"Debian GNU/Linux 4 (32-bit)\",\n \"debian4_64Guest\" => \"Debian GNU/Linux 5 (64-bit)\",\n \"debian5Guest\" => \"Debian GNU/Linux 5 (32-bit)\",\n \"debian5_64Guest\" => \"Debian GNU/Linux 5 (64-bit)\",\n \"debian6Guest\" => \"Debian GNU/Linux 6 (32-bit)\",\n \"debian6_64Guest\" => \"Debian GNU/Linux 6 (64-bit)\",\n \"debian7Guest\" => \"Debian GNU/Linux 7 (32-bit)\",\n \"debian7_64Guest\" => \"Debian GNU/Linux 7 (64-bit)\",\n \"asianux3Guest\" => \"Asianux Server 3 (32-bit)\",\n \"asianux3_64Guest\" => \"Asianux Server 3 (64-bit)\",\n \"asianux4Guest\" => \"Asianux Server 4 (32-bit)\",\n \"asianux4_64Guest\" => \"Asianux Server 4 (64-bit)\",\n \"opensuseGuest\" => \"OpenSUSE Linux (32-bit)\",\n \"opensuse64Guest\" => \"OpenSUSE Linux (64-bit)\",\n \"fedoraGuest\" => \"Fedora Linux\",\n \"fedora64Guest\" => \"Fedora Linux (64-bit)\",\n \"other24xLinuxGuest\" => \"Other 2.4.x Linux (32-bit)\",\n \"other26xLinuxGuest\" => \"Other 2.6.x Linux (32-bit)\",\n \"other3xLinuxGuest\" => \"Other Linux 3.x Guest\",\n \"otherLinuxGuest\" => \"Other Linux (32-bit)\",\n \"genericLinuxGuest\" => \"Other Linux\",\n \"other24xLinux64Guest\" => \"Other 2.4.x Linux (64-bit)\",\n \"other26xLinux64Guest\" => \"Other 2.6.x Linux (64-bit)\",\n \"other3xLinux64Guest\" => \"Other Linux 3.x Guest (64-bit)\",\n \"otherLinux64Guest\" => \"Other Linux (64-bit)\",\n \"solaris6Guest\" => \"Sun Microsystems Solaris 6\",\n \"solaris7Guest\" => \"Sun Microsystems Solaris 7\",\n \"solaris8Guest\" => \"Sun Microsystems Solaris 8\",\n \"solaris9Guest\" => \"Sun Microsystems Solaris 9\",\n \"solaris10Guest\" => \"Oracle Solaris 10 (32-bit)\",\n \"solaris10_64Guest\" => \"Oracle Solaris 10 (64-bit)\",\n \"solaris11_64Guest\" => \"Oracle Solaris 11 (64-bit)\",\n \"os2Guest\" => \"IBM OS/2\",\n \"eComStationGuest\" => \"Serenity Systems eComStation 1.x\",\n \"eComStation2Guest\" => \"Serenity Systems eComStation 2.0\",\n \"netware4Guest\" => \"Novell NetWare 4\",\n \"netware5Guest\" => \"Novell NetWare 5.1\",\n \"netware6Guest\" => \"Novell NetWare 6.x\",\n \"openServer5Guest\" => \"SCO OpenServer 5\",\n \"openServer6Guest\" => \"SCO OpenServer 6\",\n \"unixWare7Guest\" => \"SCO UnixWare 7\",\n \"darwinGuest\" => \"Apple Mac OS X 10.5 (32-bit)\",\n \"darwin64Guest\" => \"Apple Mac OS X 10.5 (64-bit)\",\n \"darwin10Guest\" => \"Apple Mac OS X 10.6 (32-bit)\",\n \"darwin10_64Guest\" => \"Apple Mac OS X 10.6 (64-bit)\",\n \"darwin11Guest\" => \"Apple Mac OS X 10.7 (32-bit)\",\n \"darwin11_64Guest\" => \"Apple Mac OS X 10.7 (64-bit)\",\n \"darwin12_64Guest\" => \"Mac OS 10.8 (64-bit)\",\n \"darwin13_64Guest\" => \"Mac OS 10.9 (64-bit)\",\n \"vmkernelGuest\" => \"VMWare ESX 4.x\",\n \"vmkernel5Guest\" => \"VMWare ESXi 5.x\",\n \"otherGuest\" => \"Other (32-bit)\",\n \"otherGuest64\" => \"Other (64-bit)\"\n }\n end", "def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end", "def supported_metrics\n supported_metrics = Set.new\n self.trackers.all.each do |tracker|\n metrics = tracker.tracker_type.data_type\n metrics.each do |metric|\n supported_metrics.add?(metric)\n end\n end\n return supported_metrics\n end", "def types\n configuration[:types]\n end", "def type\n @values.fetch('ai.device.type') { \n @values['ai.device.type'] = nil\n }\n end", "def device_identities\n return @device_identities\n end", "def FieldTypes\n @_FieldTypes ||= OLEProperty.new(@ole, 9, [VT_BSTR], [VT_BSTR, VT_BSTR])\n end", "def platforms\n return @platforms\n end", "def tf_types\n {\n Api::Type::Boolean => 'schema.TypeBool',\n Api::Type::Double => 'schema.TypeFloat',\n Api::Type::Integer => 'schema.TypeInt',\n Api::Type::String => 'schema.TypeString',\n # Anonymous string property used in array of strings.\n 'Api::Type::String' => 'schema.TypeString',\n Api::Type::Time => 'schema.TypeString',\n Api::Type::Enum => 'schema.TypeString',\n Api::Type::ResourceRef => 'schema.TypeString',\n Api::Type::NestedObject => 'schema.TypeList',\n Api::Type::Array => 'schema.TypeList',\n Api::Type::KeyValuePairs => 'schema.TypeMap',\n Api::Type::Map => 'schema.TypeSet',\n Api::Type::Fingerprint => 'schema.TypeString'\n }\n end", "def describe_types\n [@options[:type]].flatten.join('/')\n end", "def get_activites_supportedtypes()\n @restv9.get_activites_supportedobjecttypes()\n end", "def possible_reciprocal_types\n [reciprocal_type]\n end", "def operating_systems\n collect\n end", "def field_types\r\n return @field_types\r\n end", "def types\n @data.flat_map { |iso2, data| data[:valid] }.uniq\n end", "def types\n @types ||= case @type\n when KEXINIT\n %i[long long long long\n string string string string string string string string string string\n bool]\n when NEWKEYS then []\n when CHANNEL_OPEN then %i[string long long long]\n when CHANNEL_OPEN_CONFIRMATION then %i[long long long long]\n when CHANNEL_DATA then %i[long string]\n when CHANNEL_EXTENDED_DATA then %i[long long string]\n when CHANNEL_EOF, CHANNEL_CLOSE, CHANNEL_SUCCESS, CHANNEL_FAILURE then [:long]\n when CHANNEL_REQUEST\n parts = %i[long string bool]\n case @data[1]\n when \"exec\", \"subsystem\", \"shell\" then parts << :string\n when \"exit-status\" then parts << :long\n when \"pty-req\" then parts.concat(%i[string long long long long string])\n when \"env\" then parts.contact(%i[string string])\n else\n request = Packet.registered_channel_requests(@data[1])\n raise \"don't know what to do about #{@data[1]} channel request\" unless request\n\n parts.concat(request[:extra_parts])\n end\n else raise \"don't know how to parse packet type #{@type}\"\n end\n end", "def types_filter\n types_filter = self[:types_filter] || []\n return types_filter if types_filter.any?\n options.fetch 'types_filter', []\n end", "def platforms; platform_names; end", "def index\n @devicetypes = Devicetype.all\n end", "def attribute_types\n\t\treturn self.attr_oids.collect {|oid| self.schema.attribute_types[oid] }\n\tend", "def windows_mobile_restriction\n return @windows_mobile_restriction\n end", "def swiftype_config\n swiftype_config_reader.data\n end", "def may_attribute_types( *additional_object_classes )\n\t\treturn self.object_classes( *additional_object_classes ).\n\t\t\tcollect {|oc| oc.may }.flatten.uniq\n\tend", "def client_app_types=(value)\n @client_app_types = value\n end", "def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end", "def find_device_type\n case request.user_agent\n # when /mac|ios/i\n # :ios\n when /android/i\n :android\n else\n nil\n end\n end", "def number_of_types\n return GameData::Type.all.size\n end", "def number_of_types\n return GameData::Type.all.size\n end", "def contact_types\n values = categories.map(&:contact_type_id)\n values.empty? ? @contact_types : values\n end", "def water_types\n self.waters.map{|water| water.water_type.category}.uniq.sort\n end", "def category_types\n @category_types.each\n end", "def reference_types\n types = []\n\n # Will need the 008[24] and 006[7]\n f8_24 = self['008[24]']\n f6_7 = self['006[7]']\n\n\n\n if (f8_24.include? 'e') || (f6_7.include? 'e')\n types << 'EN'\n end\n\n if f6_7.include? 'd'\n types << 'DI'\n types << 'DR'\n end\n\n if f8_24.include? 'd'\n types << 'DI'\n end\n\n if f8_24.include? 'r'\n types << 'DR'\n end\n\n types << 'EN' if @xv6XX.match? /encyclopedias/i\n types << 'DI' if @xv6XX.match? /dictionaries/i\n types << 'DR' if @xv6XX.match? /directories/i\n\n types.uniq!\n return types\n end", "def root_device_type\n data[:root_device_type]\n end" ]
[ "0.76458436", "0.6872334", "0.630855", "0.6050196", "0.59861934", "0.5977894", "0.592861", "0.5922494", "0.5885626", "0.58193094", "0.5695545", "0.5625735", "0.5588949", "0.5587785", "0.5554366", "0.55500036", "0.5540546", "0.5490816", "0.5484551", "0.54590076", "0.5453824", "0.5444348", "0.5430775", "0.54122305", "0.53993607", "0.53993607", "0.5394898", "0.5383728", "0.53836644", "0.5381681", "0.5361587", "0.5354359", "0.5335996", "0.53120923", "0.53062576", "0.52817845", "0.5243138", "0.52364653", "0.52364653", "0.5226004", "0.5216088", "0.5214445", "0.5195038", "0.5182345", "0.5180564", "0.516574", "0.5140148", "0.50988925", "0.5088546", "0.5083428", "0.5059682", "0.5054053", "0.5048453", "0.50463396", "0.50461775", "0.5042299", "0.50362587", "0.5031364", "0.50312346", "0.50284106", "0.5026828", "0.5024508", "0.502265", "0.502265", "0.5013423", "0.5004235", "0.5001826", "0.49986315", "0.4987492", "0.49873543", "0.49808595", "0.4978256", "0.49737158", "0.49701512", "0.49698743", "0.49532723", "0.49484187", "0.4944602", "0.4940576", "0.49323282", "0.49292386", "0.49187863", "0.4907075", "0.49031737", "0.4900692", "0.48972726", "0.48967233", "0.48881584", "0.4884193", "0.48742753", "0.4868695", "0.4862361", "0.48617852", "0.48565862", "0.48565862", "0.48509002", "0.48414433", "0.48399746", "0.4833536", "0.48280948" ]
0.84048593
0
Sets the applicableDeviceTypes property value. Contains properties for Windows device type.
def applicable_device_types=(value) @applicable_device_types = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applicable_device_types\n return @applicable_device_types\n end", "def allowed_types\n\t\t[Device]\n\tend", "def set_UsageTypes(value)\n set_input(\"UsageTypes\", value)\n end", "def device_type=(value)\n @device_type = value\n end", "def target_types=(value)\n @target_types = value\n end", "def media_types=(value)\n @media_types = value\n end", "def client_app_types=(value)\n @client_app_types = value\n end", "def set_device_type\n @device_type = DeviceType.find(params[:id])\n check_internal_device\n end", "def device_type=(s)\n self[:type] = s\n end", "def update_types\n\t\t[Device]\n\tend", "def update_types\n\t\t[Device]\n\tend", "def devices=(value)\n @devices = value\n end", "def options_for_supported_types\n Mapping::SUPPORTED_TYPES.map do |type|\n [type.titleize.to_s, type]\n end\n end", "def allowed_types\n\t\t[Device, Domain]\n\tend", "def type=(value)\n if value == @defaults['ai.device.type']\n @values.delete 'ai.device.type' if @values.key? 'ai.device.type'\n else\n @values['ai.device.type'] = value\n end\n end", "def set_defaults\n kind_list = self.availability_types\n kind_list.each do |default_avail_types|\n if DEFAULT_AVAILABILITY_TYPES[:kind].include?(default_avail_types.kind)\n default_avail_types.checked = true\n end\n end\n\n self.both_license_types = true\n end", "def types=(types)\n @types = Array(types) if types\n end", "def allowed_types\n\t\t[Domain,Device]\n\tend", "def set_devicetype\n @devicetype = Devicetype.find(params[:id])\n end", "def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end", "def set_TariffTypes(value)\n set_input(\"TariffTypes\", value)\n end", "def device_type=(s)\n self[:type] = s\n end", "def device_type=(device_type)\n validator = EnumAttributeValidator.new('String', [\"None\", \"CiscoUcsServer\", \"CiscoUcsFI\", \"CiscoUcsChassis\", \"CiscoNexusSwitch\"])\n unless validator.valid?(device_type)\n fail ArgumentError, \"invalid value for \\\"device_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @device_type = device_type\n end", "def device_type=(s)\n self[:type] = s\n end", "def conf_media_type\n @conf_kit_media_types = Kitting::KitMediaType.where(:kit_type => \"configurable\",:customer_number => \"SYSTEM\")\n end", "def device_type_params\n params.require(:device_type).permit(:code,\n :name,\n :internal_api_server_type,\n :internal_web_server_type,\n :desktop_type,\n :web_server_type,\n :mobile_type)\n end", "def set_device_type\n @device_type = DeviceType.find(params[:id])\n end", "def set_device_type\n @device_type = DeviceType.find(params[:id])\n end", "def allowed_types\n\t\t[Device, EmailAddress]\n\tend", "def flow_types=(value)\n @flow_types = value\n end", "def set_bootable_devices(boot_source_type, options)\n bootable_devices = options[:bootable_devices]\n logger.info(\"bootable devices are %s\" % [bootable_devices.to_s])\n unless bootable_devices.empty?\n bootable_devices_instance_ids = []\n bootable_devices.each do |bootable_device|\n bootable_device = find_boot_device(bootable_device)\n if bootable_device\n logger.info(\"parsed boot device is %s\" % [bootable_device.to_s])\n bootable_devices_instance_ids << bootable_device[:instance_id]\n end\n end\n instance_ids = boot_source_settings.map {|e| e[:instance_id]}\n logger.info(\"instance ids are %s\" % [instance_ids.to_s])\n bootable_devices_to_disable = instance_ids.reject {|instance_id| bootable_devices_instance_ids.include? instance_id}\n logger.info(\"instance ids to disable are %s \" % [bootable_devices_to_disable.to_s])\n bootable_devices_to_disable.each do |bootable_device_to_disable|\n logger.info(\"Disabling boot device %s\" % [bootable_device_to_disable])\n change_boot_source_state(:instance_id => boot_source_type, :enabled_state => \"0\",\n :source => bootable_device_to_disable)\n end\n end\n end", "def token_types=(theTokenTypes)\n\t\traise LexerSetupError, \"Token types can be specified only once.\" unless token_types.nil?\n\t\t@token_types = theTokenTypes\n\tend", "def device_compliance_setting_states=(value)\n @device_compliance_setting_states = value\n end", "def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end", "def device_typemap # :nodoc:\n @device_typemap ||= DEVICE_TYPEMAP.dup\n end", "def minimum_supported_operating_system=(value)\n @minimum_supported_operating_system = value\n end", "def target_devices(*devices)\n visit edit_url\n # reset the currently selected devices\n page.evaluate_script(\"$('#offer_device_types option').each(function() { $(this).attr('selected', null); })\")\n devices.each do |device|\n # re-select the given devices\n page.evaluate_script(\"$('#offer_device_types option[value=\\\"#{device}\\\"]').attr('selected', 'selected')\")\n end\n click_button 'Save Changes'\n end", "def create_types\n\t\t[Device]\n\tend", "def create_types\n\t\t[Device]\n\tend", "def supported(files)\n files.select { |f| SUPPORTED_TYPES.include?(f.extname.delete('.')) }\n end", "def update!(**args)\n @supported_types = args[:supported_types] if args.key?(:supported_types)\n end", "def update_device_types_info(dtid, device_type_info, opts = {})\n data, _status_code, _headers = update_device_types_info_with_http_info(dtid, device_type_info, opts)\n return data\n end", "def all_usb_devices=(all_usb_devices)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(all_usb_devices)\n fail ArgumentError, \"invalid value for \\\"all_usb_devices\\\", must be one of #{validator.allowable_values}.\"\n end\n @all_usb_devices = all_usb_devices\n end", "def oil_types=(vals = [])\n if vals.is_a?(Array)\n OilTypes.collect {|t| t[1]}.each do |type|\n if vals.member?(type)\n send(type+\"=\",true)\n else\n send(type+\"=\",false)\n end\n end\n end\n end", "def platform_types\n get(\"platform-types\")[\"types\"]\n end", "def allowed_types\n\t\treturn [EmailAddress, Device, Domain, Organization, User, Location, Service, NetApplication, WebApplication]\n\tend", "def content_types=(value)\n @content_types = value\n end", "def applicable_architectures=(value)\n @applicable_architectures = value\n end", "def device_type_params\n params.require(:device_type).permit(:classification, :description)\n end", "def allowed_device_count=(value)\n @allowed_device_count = value\n end", "def devicetype_params\n params.require(:devicetype).permit(:type)\n end", "def set_genders(gender_types = GenderType.individual_only)\n @gender_types = gender_types\n end", "def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"storage.PhysicalDisk\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end", "def set_temperature_device_type\n\n\ttemperature_device_type = TemperatureDeviceType.find_by_temperature_device_type_code(self.temperature_device_type_code)\n\t if temperature_device_type != nil \n\t\t self.temperature_device_type = temperature_device_type\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"value of field: 'temperature_device_type_code' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def guest_types_descriptions\n {\n \"dosGuest\" => \"Microsoft MS-DOS\",\n \"win31Guest\" => \"Microsoft Windows 3.1\",\n \"win95Guest\" => \"Microsoft Windows 95\",\n \"win98Guest\" => \"Microsoft Windows 98\",\n \"winMeGuest\" => \"Microsoft Windows Millenium Edition\",\n \"winNTGuest\" => \"Microsoft Windows NT\",\n \"win2000ProGuest\" => \"Microsoft Windows 2000 Professional\",\n \"win2000ServGuest\" => \"Microsoft Windows 2000 Server\",\n \"win2000AdvServGuest\" => \"Microsoft Windows 2000 Advanced Server\",\n \"winXPHomeGuest\" => \"Microsoft Windows XP Home Edition\",\n \"winXPProGuest\" => \"Microsoft Windows XP Professional (32-bit)\",\n \"winXPPro64Guest\" => \"Microsoft Windows XP Professional (64-bit)\",\n \"winNetWebGuest\" => \"Microsoft Windows Server 2003 Web Edition (32-bit)\",\n \"winNetStandardGuest\" => \"Microsoft Windows Server 2003 Standard Edition (32-bit)\",\n \"winNetEnterpriseGuest\" => \"Microsoft Windows Server 2003 Enterprise Edition (32-bit)\",\n \"winNetDatacenterGuest\" => \"Microsoft Windows Server 2003 Datacenter Edition (32-bit)\",\n \"winNetBusinessGuest\" => \"Microsoft Windows Small Business Server 2003\",\n \"winNetStandard64Guest\" => \"Microsoft Windows Server 2003 Standard Edition (64-bit)\",\n \"winNetEnterprise64Guest\" => \"Microsoft Windows Server 2003 Enterprise Edition (64-bit)\",\n \"winLonghornGuest\" => \"Microsoft Windows Longhorn (32-bit)\",\n \"winLonghorn64Guest\" => \"Microsoft Windows Longhorn (64-bit)\",\n \"winNetDatacenter64Guest\" => \"Microsoft Windows Server 2003 Datacenter Edition (64-bit)\",\n \"winVistaGuest\" => \"Microsoft Windows Vista (32-bit)\",\n \"winVista64Guest\" => \"Microsoft Windows Vista (64-bit)\",\n \"windows7Guest\" => \"Microsoft Windows 7 (32-bit)\",\n \"windows7_64Guest\" => \"Microsoft Windows 7 (64-bit)\",\n \"windows7Server64Guest\" => \"Microsoft Windows Server 2008 R2 (64-bit)\",\n \"windows8Guest\" => \"Microsoft Windows 8 (32-bit)\",\n \"windows8_64Guest\" => \"Microsoft Windows 8 (64-bit)\",\n \"windows8Server64Guest\" => \"Microsoft Windows Server 2012 (64-bit)\",\n \"windowsHyperVGuest\" => \"Microsoft Windows Hyper-V\",\n \"freebsd64Guest\" => \"FreeBSD (64-bit)\",\n \"freebsdGuest\" => \"FreeBSD (32-bit)\",\n \"redhatGuest\" => \"Red Hat Linux 2.1\",\n \"rhel2Guest\" => \"Red Hat Enterprise Linux 2.1\",\n \"rhel3Guest\" => \"Red Hat Enterprise Linux 3 (32-bit)\",\n \"rhel3_64Guest\" => \"Red Hat Enterprise Linux 3 (64-bit)\",\n \"rhel4Guest\" => \"Red Hat Enterprise Linux 4 (32-bit)\",\n \"rhel4_64Guest\" => \"Red Hat Enterprise Linux 4 (64-bit)\",\n \"rhel5Guest\" => \"Red Hat Enterprise Linux 5 (32-bit)\",\n \"rhel5_64Guest\" => \"Red Hat Enterprise Linux 5 (64-bit)\",\n \"rhel6Guest\" => \"Red Hat Enterprise Linux 6 (32-bit)\",\n \"rhel6_64Guest\" => \"Red Hat Enterprise Linux 6 (64-bit)\",\n \"rhel7Guest\" => \"Red Hat Enterprise Linux 7 (32-bit)\",\n \"rhel7_64Guest\" => \"Red Hat Enterprise Linux 7 (64-bit)\",\n \"centosGuest\" => \"CentOS 4/5/6 (32-bit)\",\n \"centos64Guest\" => \"CentOS 4/5/6 (64-bit)\",\n \"oracleLinux64Guest\" => \"Oracle Linux 4/5/6 (64-bit)\",\n \"oracleLinuxGuest\" => \"Oracle Linux 4/5/6 (32-bit)\",\n \"suseGuest\" => \"Suse Linux (32-bit)\",\n \"suse64Guest\" => \"Suse Linux (64-bit)\",\n \"slesGuest\" => \"Novell SUSE Linux Enterprise 8/9 (32-bit)\",\n \"sles64Guest\" => \"Novell SUSE Linux Enterprise 8/9 (64-bit)\",\n \"sles10Guest\" => \"Novell SUSE Linux Enterprise 10 (32-bit)\",\n \"sles10_64Guest\" => \"Novell SUSE Linux Enterprise 10 (64-bit)\",\n \"sles11Guest\" => \"Novell SUSE Linux Enterprise 11 (32-bit)\",\n \"sles11_64Guest\" => \"Novell SUSE Linux Enterprise 11 (64-bit)\",\n \"sles12Guest\" => \"Novell SUSE Linux Enterprise 12 (32-bit)\",\n \"sles12_64Guest\" => \"Novell SUSE Linux Enterprise 12 (64-bit)\",\n \"nld9Guest\" => \"Novell Linux Desktop 9\",\n \"oesGuest\" => \"Novell Open Enterprise Server\",\n \"sjdsGuest\" => \"Sun Java Desktop System\",\n \"mandrakeGuest\" => \"Mandrake Linux\",\n \"mandrivaGuest\" => \"Mandriva Linux (32-bit)\",\n \"mandriva64Guest\" => \"Mandriva Linux (64-bit)\",\n \"turboLinuxGuest\" => \"Turbolinux (32-bit)\",\n \"turboLinux64Guest\" => \"Turbolinux (64-bit)\",\n \"ubuntu64Guest\" => \"Ubuntu Linux (64-bit)\",\n \"ubuntuGuest\" => \"Ubuntu Linux (32-bit)\",\n \"debian4Guest\" => \"Debian GNU/Linux 4 (32-bit)\",\n \"debian4_64Guest\" => \"Debian GNU/Linux 5 (64-bit)\",\n \"debian5Guest\" => \"Debian GNU/Linux 5 (32-bit)\",\n \"debian5_64Guest\" => \"Debian GNU/Linux 5 (64-bit)\",\n \"debian6Guest\" => \"Debian GNU/Linux 6 (32-bit)\",\n \"debian6_64Guest\" => \"Debian GNU/Linux 6 (64-bit)\",\n \"debian7Guest\" => \"Debian GNU/Linux 7 (32-bit)\",\n \"debian7_64Guest\" => \"Debian GNU/Linux 7 (64-bit)\",\n \"asianux3Guest\" => \"Asianux Server 3 (32-bit)\",\n \"asianux3_64Guest\" => \"Asianux Server 3 (64-bit)\",\n \"asianux4Guest\" => \"Asianux Server 4 (32-bit)\",\n \"asianux4_64Guest\" => \"Asianux Server 4 (64-bit)\",\n \"opensuseGuest\" => \"OpenSUSE Linux (32-bit)\",\n \"opensuse64Guest\" => \"OpenSUSE Linux (64-bit)\",\n \"fedoraGuest\" => \"Fedora Linux\",\n \"fedora64Guest\" => \"Fedora Linux (64-bit)\",\n \"other24xLinuxGuest\" => \"Other 2.4.x Linux (32-bit)\",\n \"other26xLinuxGuest\" => \"Other 2.6.x Linux (32-bit)\",\n \"other3xLinuxGuest\" => \"Other Linux 3.x Guest\",\n \"otherLinuxGuest\" => \"Other Linux (32-bit)\",\n \"genericLinuxGuest\" => \"Other Linux\",\n \"other24xLinux64Guest\" => \"Other 2.4.x Linux (64-bit)\",\n \"other26xLinux64Guest\" => \"Other 2.6.x Linux (64-bit)\",\n \"other3xLinux64Guest\" => \"Other Linux 3.x Guest (64-bit)\",\n \"otherLinux64Guest\" => \"Other Linux (64-bit)\",\n \"solaris6Guest\" => \"Sun Microsystems Solaris 6\",\n \"solaris7Guest\" => \"Sun Microsystems Solaris 7\",\n \"solaris8Guest\" => \"Sun Microsystems Solaris 8\",\n \"solaris9Guest\" => \"Sun Microsystems Solaris 9\",\n \"solaris10Guest\" => \"Oracle Solaris 10 (32-bit)\",\n \"solaris10_64Guest\" => \"Oracle Solaris 10 (64-bit)\",\n \"solaris11_64Guest\" => \"Oracle Solaris 11 (64-bit)\",\n \"os2Guest\" => \"IBM OS/2\",\n \"eComStationGuest\" => \"Serenity Systems eComStation 1.x\",\n \"eComStation2Guest\" => \"Serenity Systems eComStation 2.0\",\n \"netware4Guest\" => \"Novell NetWare 4\",\n \"netware5Guest\" => \"Novell NetWare 5.1\",\n \"netware6Guest\" => \"Novell NetWare 6.x\",\n \"openServer5Guest\" => \"SCO OpenServer 5\",\n \"openServer6Guest\" => \"SCO OpenServer 6\",\n \"unixWare7Guest\" => \"SCO UnixWare 7\",\n \"darwinGuest\" => \"Apple Mac OS X 10.5 (32-bit)\",\n \"darwin64Guest\" => \"Apple Mac OS X 10.5 (64-bit)\",\n \"darwin10Guest\" => \"Apple Mac OS X 10.6 (32-bit)\",\n \"darwin10_64Guest\" => \"Apple Mac OS X 10.6 (64-bit)\",\n \"darwin11Guest\" => \"Apple Mac OS X 10.7 (32-bit)\",\n \"darwin11_64Guest\" => \"Apple Mac OS X 10.7 (64-bit)\",\n \"darwin12_64Guest\" => \"Mac OS 10.8 (64-bit)\",\n \"darwin13_64Guest\" => \"Mac OS 10.9 (64-bit)\",\n \"vmkernelGuest\" => \"VMWare ESX 4.x\",\n \"vmkernel5Guest\" => \"VMWare ESXi 5.x\",\n \"otherGuest\" => \"Other (32-bit)\",\n \"otherGuest64\" => \"Other (64-bit)\"\n }\n end", "def boot_types\n @types = {}\n type_names.each do |name , ivars |\n @types[name] = type_for( name , ivars)\n end\n type_type = @types[:Type]\n @types.each do |name , type |\n type.set_type(type_type)\n end\n end", "def set_sw_dev_type\n @sw_dev_type = SwDevType.find(params[:id])\n end", "def supports_device_licensing=(value)\n @supports_device_licensing = value\n end", "def set_ChannelType(value)\n set_input(\"ChannelType\", value)\n end", "def single_access_allowed_request_types(value = nil)\n config(:single_access_allowed_request_types, value, [\"application/rss+xml\", \"application/atom+xml\"])\n end", "def device_type_params\n params.require(:device_type).permit(:name)\n end", "def platforms=(value)\n @platforms = value\n end", "def compliant_app_list_type=(value)\n @compliant_app_list_type = value\n end", "def compliant_app_list_type=(value)\n @compliant_app_list_type = value\n end", "def device_type\n matching = {\n ScreenSize::IOS_35 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_35,\n ScreenSize::IOS_40 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_40,\n ScreenSize::IOS_47 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_47, # also 7 & 8\n ScreenSize::IOS_55 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_55, # also 7 Plus & 8 Plus\n ScreenSize::IOS_58 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_58,\n ScreenSize::IOS_65 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPHONE_65,\n ScreenSize::IOS_IPAD => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_97,\n ScreenSize::IOS_IPAD_10_5 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_105,\n ScreenSize::IOS_IPAD_11 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_PRO_3GEN_11,\n ScreenSize::IOS_IPAD_PRO => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_PRO_129,\n ScreenSize::IOS_IPAD_PRO_12_9 => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::IPAD_PRO_3GEN_129,\n ScreenSize::MAC => Spaceship::ConnectAPI::AppPreviewSet::PreviewType::DESKTOP\n }\n return matching[self.screen_size]\n end", "def set_media_fixed_or_sfp(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end", "def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end", "def metric_devices=(value)\n @metric_devices = value\n end", "def windows_mobile_restriction=(value)\n @windows_mobile_restriction = value\n end", "def update\n respond_to do |format|\n if @devicetype.update(devicetype_params)\n format.html { redirect_to @devicetype, notice: 'Devicetype was successfully updated.' }\n format.json { render :show, status: :ok, location: @devicetype }\n else\n format.html { render :edit }\n format.json { render json: @devicetype.errors, status: :unprocessable_entity }\n end\n end\n end", "def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"virtualization.VmwareVirtualDisk\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end", "def set_FuelType(value)\n set_input(\"FuelType\", value)\n end", "def get_available_types()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('uiconf', 'getAvailableTypes', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def get_device_types_info(dtid, opts = {})\n data, _status_code, _headers = get_device_types_info_with_http_info(dtid, opts)\n return data\n end", "def managed_devices=(value)\n @managed_devices = value\n end", "def trigger_types=(value)\n @trigger_types = value\n end", "def update_preferred_modes params\n self.preferred_trip_types = params.map{ |m| m.to_s.gsub('mode_',\"\")}\n self.save\n end", "def set_media_sfp(opts)\n opts = check_params(opts,[:media_types])\n super(opts)\n end", "def device_sharing_allowed=(value)\n @device_sharing_allowed = value\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include? type.to_s.downcase\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include? type.to_s.downcase\n end", "def available_types\n gather do |c|\n c.respond_to?(:model_types) ? c.model_types : []\n end\n end", "def platform_type=(platform_type)\n validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n unless validator.valid?(platform_type)\n fail ArgumentError, \"invalid value for \\\"platform_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @platform_type = platform_type\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end", "def mime_types(*types)\n types.flatten.each do |t|\n @mime_types << t\n end\n @mime_types\n end", "def is_device?(type)\n\t\trequest.user_agent.to_s.downcase.include?(type.to_s.downcase)\n\tend", "def sets_occupancy_bldg_system_types(occ_type)\n @standards_building_type = occ_type[:standards_building_type]\n @bar_division_method = occ_type[:bar_division_method]\n @system_type = occ_type[:system_type]\n OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.SpatialElement.sets_occupancy_bldg_system_types', \"Element ID: #{xget_id} @standards_building_type #{@standards_building_type}, @bar_division_method #{@bar_division_method} and @system_type: #{@system_type}\")\n return true\n end", "def set_WordSense(value)\n set_input(\"WordSense\", value)\n end", "def preferred_types(supported_types)\n @preferred_auth_policies.select{|uri| supported_types.member? uri}\n end", "def is_device?(type)\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end", "def devices=(devices)\n @devices.clear\n @devices += devices\n @devices\n end", "def resourceType\n 'DeviceDefinition'\n end", "def check_types(value)\n if types && types.none? { |type| type === value }\n Lita.logger.fatal(\n I18n.t(\"lita.config.type_error\", attribute: name, types: types.join(\", \"))\n )\n abort\n end\n end", "def drive_type=(value)\n @drive_type = value\n end", "def drive_type=(value)\n @drive_type = value\n end", "def device_block_enable_restrictions=(value)\n @device_block_enable_restrictions = value\n end", "def device_states=(value)\n @device_states = value\n end", "def disk_type=(value)\n @disk_type = value\n end", "def set_devices(storage_config)\n storage_config = deep_copy(storage_config)\n Builtins.y2milestone(\"entering set_devices with %1\", storage_config)\n first_set = false\n failed = false\n auto_targetmap = Builtins.listmap(storage_config) do |drive|\n device = \"\"\n Builtins.y2milestone(\"Working on drive: %1\", drive)\n # FIXME: Check if physical drives > 1\n if Ops.get_string(drive, \"device\", \"\") == \"ask\"\n dev = DiskSelectionDialog()\n if dev != nil\n first_set = true\n device = dev\n end\n\n next { device => drive }\n end\n if !first_set &&\n (Ops.get_string(drive, \"device\", \"\") == \"\" ||\n Ops.get_string(drive, \"device\", \"\") == \"ask\")\n device = Storage.GetPartDisk\n Builtins.y2milestone(\"device: %1\", device)\n first_set = true\n next { device => drive }\n elsif Ops.get_string(drive, \"device\", \"\") != \"\"\n dev = Ops.get_string(drive, \"device\", \"\")\n if dev == \"\"\n dev = \"error\"\n Builtins.y2error(\"Missing device name in partitioning plan\")\n failed = true\n end\n\n next { dev => drive }\n end\n end\n\n return nil if failed\n\n auto_targetmap = Builtins.mapmap(auto_targetmap) do |device, d|\n # Convert from Old Style\n if Builtins.haskey(d, \"use\")\n Builtins.y2milestone(\n \"converting from \\\"use\\\" to new style: %1\",\n device\n )\n if Ops.get_string(d, \"use\", \"\") == \"free\"\n Ops.set(d, \"prefer_remove\", false)\n elsif Ops.get_string(d, \"use\", \"\") == \"all\"\n Ops.set(d, \"prefer_remove\", true)\n elsif Ops.get_string(d, \"use\", \"\") == \"linux\"\n Ops.set(d, \"keep_partition_num\", GetNoneLinuxPartitions(device))\n Ops.set(d, \"prefer_remove\", true)\n else\n uselist = Builtins.filter(\n Builtins.splitstring(Ops.get_string(d, \"use\", \"\"), \",\")\n ) { |s| s != \"\" }\n Builtins.y2milestone(\"uselist: %1\", uselist)\n keeplist = []\n all = GetAllPartitions(device)\n Builtins.y2milestone(\"all list: %1\", all)\n Builtins.foreach(all) do |i|\n if !Builtins.contains(uselist, Builtins.sformat(\"%1\", i))\n keeplist = Builtins.add(keeplist, i)\n end\n end\n Builtins.y2milestone(\"keeplist: %1\", keeplist)\n Ops.set(d, \"keep_partition_num\", keeplist)\n\n if Ops.greater_than(Builtins.size(keeplist), 0)\n Ops.set(d, \"prefer_remove\", true)\n end\n end\n else\n Ops.set(d, \"use\", \"all\")\n end\n # see if <usepart> is used and add the partitions to <keep_partition_num>\n Builtins.foreach(Ops.get_list(d, \"partitions\", [])) do |p|\n if Ops.get_integer(p, \"usepart\", -1) != -1\n Ops.set(\n d,\n \"keep_partition_num\",\n Builtins.add(\n Ops.get_list(d, \"keep_partition_num\", []),\n Ops.get_integer(p, \"usepart\", -1)\n )\n )\n end\n end\n Ops.set(\n d,\n \"keep_partition_num\",\n Builtins.toset(Ops.get_list(d, \"keep_partition_num\", []))\n )\n { device => d }\n end\n\n Builtins.y2milestone(\n \"processed autoyast partition plan: %1\",\n auto_targetmap\n )\n deep_copy(auto_targetmap)\n end", "def fstype\n return self['fstype'] if has_key?('fstype')\n Chef::Log.info([\n self['fstype'], current[:fstype],\n File.exists?(device) && `file -s '#{device}'`.chomp,\n self,\n ].inspect)\n return current[:fstype] if current[:fstype]\n return unless File.exists?(device)\n dev_type_str = `file -s '#{device}'`.chomp\n case\n when dev_type_str =~ /SGI XFS/ then self['fstype'] = 'xfs'\n when dev_type_str =~ /Linux.*(ext[2-4])/ then self['fstype'] = $1\n else\n raise \"Can't determine filesystem type of #{device} -- set it explicitly in node[:volumes]\"\n end\n self['fstype']\n end" ]
[ "0.6758772", "0.5762656", "0.570532", "0.56365144", "0.5500077", "0.5481403", "0.5264788", "0.526408", "0.512341", "0.5111277", "0.5111277", "0.5079081", "0.50491333", "0.50402194", "0.50382125", "0.50145364", "0.50114244", "0.49923953", "0.49885377", "0.49813613", "0.49722448", "0.49718565", "0.49679378", "0.492626", "0.4923802", "0.49191493", "0.48686033", "0.48686033", "0.48685914", "0.4856956", "0.47949415", "0.47431585", "0.473284", "0.47303832", "0.47226003", "0.4712865", "0.4697851", "0.46925196", "0.46925196", "0.46909508", "0.46786416", "0.46471292", "0.46058303", "0.45647192", "0.45639908", "0.45595762", "0.45592517", "0.453174", "0.45147872", "0.44997662", "0.4481445", "0.44645253", "0.44614136", "0.44524", "0.44413403", "0.44257882", "0.44162142", "0.44110885", "0.4405869", "0.43999994", "0.4392286", "0.4386946", "0.43793756", "0.43793756", "0.4374567", "0.43584713", "0.4353308", "0.43516532", "0.434542", "0.43452418", "0.43377423", "0.43268606", "0.43229532", "0.43070605", "0.43043822", "0.42950457", "0.42931765", "0.42664957", "0.42545968", "0.4250605", "0.4250605", "0.42490846", "0.42459553", "0.424556", "0.4238227", "0.4235688", "0.42356142", "0.4230973", "0.42309445", "0.42290068", "0.42271268", "0.42243296", "0.4222417", "0.42217472", "0.42217472", "0.42190576", "0.42139557", "0.42095366", "0.4205413", "0.41923767" ]
0.82789534
0
Gets the committedContainedApps property value. The collection of contained apps in the committed mobileAppContent of a windowsUniversalAppX app.
def committed_contained_apps return @committed_contained_apps end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def committed_contained_apps=(value)\n @committed_contained_apps = value\n end", "def managed_apps\n return @managed_apps\n end", "def apps\n return @apps\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def mobile_apps\n return @mobile_apps\n end", "def installed_apps\n return @installed_apps\n end", "def installed_apps\n return @installed_apps\n end", "def apps\n @apps.keys\n end", "def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end", "def client_applications\n return @client_applications\n end", "def dock_apps(user = CURRENTUSER)\n\n\tplist = CFPropertyList::List.new(:file => \"/Users/#{user}/Library/Preferences/com.apple.dock.plist\")\n\tresults=CFPropertyList.native_types(plist.value)\n\tapps=[]\n\tfor key, value in results['persistent-apps']\n\t\tfor key, value in key\n\t\t\tif value.class == Hash\n\t\t\t\tfor x, y in value\n\t\t\t\t\tif x == \"file-label\"\n\t\t\t\t\t\tapps.push(y)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn apps\nend", "def apps_single_app_mode_list\n return @apps_single_app_mode_list\n end", "def known_client_applications\n return @known_client_applications\n end", "def apps\n unless @apps\n load!\n end\n\n @apps\n end", "def registered_applications\n @registered_applications ||= current_user.registered_applications.all\n end", "def managed_apps=(value)\n @managed_apps = value\n end", "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def apps=(value)\n @apps = value\n end", "def apps\n collect\n end", "def app_list\n host_os_family.app_list( self )\n end", "def apps\n apps_found = []\n server_xml = Liberty.server_xml(@app_dir)\n if Liberty.web_inf(@app_dir)\n apps_found = [@app_dir]\n elsif server_xml\n apps_found = Dir.glob(File.expand_path(File.join(server_xml, '..', '**', '*.war')))\n Liberty.expand_apps(apps_found)\n end\n apps_found\n end", "def applications\n @applications ||= [default_application]\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def known_client_applications=(value)\n @known_client_applications = value\n end", "def get_apps(scope)\n\t\tcase scope\n\t\twhen :added\n\t\t\treturn ClientApplication.select(\"client_applications.*\").\n\t\t\tjoins(:oauth_tokens).\n\t\t\twhere(\"oauth_tokens.invalidated_at is null and oauth_tokens.authorized_at is not null and oauth_tokens.type = 'AccessToken'\").\n\t\t\twhere(\"client_applications.id = oauth_tokens.client_application_id and oauth_tokens.user_id = #{id}\").\n\t\t\tgroup(\"client_applications.id\").\n\t\t\torder(\"oauth_tokens.authorized_at DESC\")\n\t\t\n\t\twhen :created\n\t\t\treturn apps\n\t\tend\n\tend", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def managed_app_registrations\n return @managed_app_registrations\n end", "def managed_app_statuses\n return @managed_app_statuses\n end", "def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def installed_apps=(value)\n @installed_apps = value\n end", "def installed_apps=(value)\n @installed_apps = value\n end", "def applications_for_interview\n apps = application_for_offerings.delete_if {|a| !a.invited_for_interview? }\n end", "def apps(criteria = {})\n all_available_apps.filter_with_criteria(criteria)\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def app_environments\n @app_environments ||= apps.map { |app| app.app_environments }.flatten\n end", "def pre_authorized_applications\n return @pre_authorized_applications\n end", "def applications_list\n get \"applications\"\n end", "def client_applications=(value)\n @client_applications = value\n end", "def client_applications_from_verified_publisher_only\n return @client_applications_from_verified_publisher_only\n end", "def apps_visibility_list\n return @apps_visibility_list\n end", "def compliant_apps_list=(value)\n @compliant_apps_list = value\n end", "def compliant_apps_list=(value)\n @compliant_apps_list = value\n end", "def mobile_app_categories\n return @mobile_app_categories\n end", "def mobile_apps=(value)\n @mobile_apps = value\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def applications\n get(PLURAL_PATH, RESOURCE)\n end", "def managed_app_policies\n return @managed_app_policies\n end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def apps_install_allow_list\n return @apps_install_allow_list\n end", "def past_applications\n return [] if offering.other_award_types.empty?\n offerings_to_include = offering.other_award_types.collect(&:offerings).flatten.uniq.compact\n conditions = \"offering_id IN (#{offerings_to_include.collect(&:id).join(\",\")}) && offering_id != #{offering_id}\"\n all = person.application_for_offerings.find(:all, :conditions => conditions, :include => :statuses)\n all.select{|a| a.passed_status?(:complete) rescue false}\n end", "def mounted_apps_of(file)\n Padrino.mounted_apps.select { |app| File.identical?(file, app.app_file) }\n end", "def client_application_ids\n return @client_application_ids\n end", "def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end", "def mobile_app_configurations\n return @mobile_app_configurations\n end", "def kiosk_mode_apps\n return @kiosk_mode_apps\n end", "def authorized_apps(user)\n authorized_apps = []\n user.attributes.each do |k, v|\n authorized_apps.push(k) if v == 'Y'\n end\n authorized_apps\n end", "def non_root_apps\n apps.select(&:url_path?)\n end", "def apps_launch_block_list\n return @apps_launch_block_list\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def valid_apps\n apps.select { |app| app.valid? }\n end", "def protected_apps\n return @protected_apps\n end", "def mirrored_app_components\n mirrored_components & app_components\n end", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list\n\t\tdoc = xml(get('/apps'))\n\t\tdoc.elements.to_a(\"//apps/app/name\").map { |a| a.text }\n\tend", "def list_container_applications(opts = {})\n data, _status_code, _headers = list_container_applications_with_http_info(opts)\n data\n end", "def client_application_publisher_ids\n return @client_application_publisher_ids\n end", "def modern_apps\n return @modern_apps\n end", "def applications\n Application.for(self)\n end", "def darwin_app_list; end", "def authorized_gae_applications\n settings[:authorized_gae_applications]\n end", "def applications\n apps = {}\n Dir[File.join(@path, '*')].each do |store_dir|\n name = File.basename(store_dir)\n \n apps[name] = ApplicationConfiguration.new name, store_dir\n end\n \n apps\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def applications()\n return MicrosoftGraph::Applications::ApplicationsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def client_app_types\n return @client_app_types\n end", "def app_roles\n return @app_roles\n end", "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end", "def user_apps\n Application.with_user(session[:user_id])\n end", "def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def app_consent_requests\n return @app_consent_requests\n end", "def applist(options:)\n path = \"/query/apps\"\n response = nil\n multipart_connection(port: 8060) do |conn|\n response = conn.get path\n end\n\n if response.success?\n regexp = /id=\"([^\"]*)\"\\stype=\"([^\"]*)\"\\sversion=\"([^\"]*)\">([^<]*)</\n apps = response.body.scan(regexp)\n printf(\"%30s | %10s | %10s | %10s\\n\", \"title\", \"id\", \"type\", \"version\")\n printf(\"---------------------------------------------------------------------\\n\")\n apps.each do |app|\n printf(\"%30s | %10s | %10s | %10s\\n\", app[3], app[0], app[1], app[2])\n end\n end\n end", "def apps_hide_list\n return @apps_hide_list\n end", "def applications(params = {}) # rubocop:disable Style/OptionHash\n page_limit = params.delete(:page_limit) { 1 }\n\n applications_array = []\n 1.upto page_limit do |i|\n response = request_applications(params.merge(page: i))\n applications_array += response[\"applications\"]\n break if response[\"paginationComplete\"]\n end\n applications_array\n end", "def deployed_app_count\n return @deployed_app_count\n end", "def list_apps\n render :text => app_configs.keys\n end", "def list_apps\n check_scope!\n\n apps = App.accessible_by(@context).unremoved.includes(:app_series).order(:title)\n apps = apps.where(scope: params[:scopes]) if params[:scopes].present?\n\n # Filter by latest revisions or versions.\n # This is kinda tricky, but we need to handle the apps which revisions were moved to a space\n # before we migrated to the new way how app is published to a space.\n apps = apps.select(&:latest_accessible_in_scope?)\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end", "def apps_by_family(family)\n apps(:appfamily => family)\n end", "def managed_app_registrations=(value)\n @managed_app_registrations = value\n end", "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end", "def app_definitions\n return @app_definitions\n end", "def list_applications(workspace_id)\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n url = @api_url + \"/api/workspaces/#{workspace_id}/applications\"\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n applications = JSON.parse(r.body)['data']\n #application_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"applications dump is #{JSON.pretty_generate(applications)}\\napplication count is #{application_count}\"\n\n applications.each do |application|\n results.push(application)\n end\n return results\n end", "def combined_app_root(include_gen_root=true)\n local_app_root = File.expand_path('../../../app', __FILE__)\n app_root = [@ctx_app_root ||= @context.app_root]\n app_root << @context.gen_root if include_gen_root\n app_root << local_app_root if local_app_root != @ctx_app_root\n app_root\n end", "def pre_authorized_applications=(value)\n @pre_authorized_applications = value\n end" ]
[ "0.7249253", "0.65224946", "0.6446249", "0.63637567", "0.63637567", "0.6301004", "0.6301004", "0.62364256", "0.6193645", "0.6193645", "0.61709696", "0.59477043", "0.59101737", "0.5873077", "0.5834695", "0.58264476", "0.5772239", "0.57623154", "0.5684509", "0.55921525", "0.5574309", "0.55709374", "0.55575144", "0.5540656", "0.5530454", "0.54977095", "0.54977095", "0.5463939", "0.5427201", "0.5399059", "0.5398933", "0.5362629", "0.53589183", "0.53557426", "0.5350314", "0.53396225", "0.53396225", "0.53361094", "0.53273475", "0.5320688", "0.5274715", "0.5273574", "0.5270355", "0.526113", "0.523987", "0.51945317", "0.5192232", "0.5192232", "0.51840526", "0.5178902", "0.51711994", "0.5151016", "0.5107924", "0.5088213", "0.50665563", "0.50631356", "0.5058244", "0.5053708", "0.5045593", "0.5041891", "0.5037797", "0.5026103", "0.5022618", "0.50171536", "0.50112283", "0.5007644", "0.50034493", "0.49834195", "0.49623033", "0.4947449", "0.4941522", "0.4941522", "0.49314538", "0.4899301", "0.48949614", "0.48805884", "0.4868748", "0.48549685", "0.48545554", "0.48426765", "0.4839639", "0.48368108", "0.48227972", "0.48099267", "0.479165", "0.47825608", "0.47777653", "0.4767937", "0.4763006", "0.4750304", "0.47305447", "0.47139797", "0.47114745", "0.47025824", "0.47020832", "0.46941707", "0.4688147", "0.46623927", "0.46622866", "0.46373886" ]
0.7778579
0
Sets the committedContainedApps property value. The collection of contained apps in the committed mobileAppContent of a windowsUniversalAppX app.
def committed_contained_apps=(value) @committed_contained_apps = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def committed_contained_apps\n return @committed_contained_apps\n end", "def managed_apps=(value)\n @managed_apps = value\n end", "def apps=(value)\n @apps = value\n end", "def installed_apps=(value)\n @installed_apps = value\n end", "def installed_apps=(value)\n @installed_apps = value\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def compliant_apps_list=(value)\n @compliant_apps_list = value\n end", "def compliant_apps_list=(value)\n @compliant_apps_list = value\n end", "def known_client_applications=(value)\n @known_client_applications = value\n end", "def mobile_apps=(value)\n @mobile_apps = value\n end", "def client_applications=(value)\n @client_applications = value\n end", "def set_apps(apps_attrs)\n (apps_attrs || []).each do |app|\n AppEnvironment.from_hash(api, {'app' => app, 'environment' => self})\n end\n end", "def apps=(selected_apps)\n filter = ( APPS && selected_apps )\n filter = filter.select{|item| !item.blank?}\n # mark (APPS && selected_apps) != (selected_apps && APPS)\n self.apps_mask = filter.map{|app| 2**APPS.index(app) }.sum\n end", "def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end", "def pre_authorized_applications=(value)\n @pre_authorized_applications = value\n end", "def documents_block_managed_documents_in_unmanaged_apps=(value)\n @documents_block_managed_documents_in_unmanaged_apps = value\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def compliant_apps_list\n return @compliant_apps_list\n end", "def managed_apps\n return @managed_apps\n end", "def set_app_groups\n @sys_app_groups = bc_sys_app_groups\n @usr_app_groups = bc_usr_app_groups\n @dev_app_groups = bc_dev_app_groups\n @apps_menu_group = bc_custom_apps_group\n end", "def managed_app_registrations=(value)\n @managed_app_registrations = value\n end", "def documents_block_unmanaged_documents_in_managed_apps=(value)\n @documents_block_unmanaged_documents_in_managed_apps = value\n end", "def apps\n unless @apps\n load!\n end\n\n @apps\n end", "def apps_single_app_mode_list=(value)\n @apps_single_app_mode_list = value\n end", "def managed_app_policies=(value)\n @managed_app_policies = value\n end", "def managed_app_statuses=(value)\n @managed_app_statuses = value\n end", "def client_application_ids=(value)\n @client_application_ids = value\n end", "def modern_apps=(value)\n @modern_apps = value\n end", "def apps\n return @apps\n end", "def client_applications_from_verified_publisher_only=(value)\n @client_applications_from_verified_publisher_only = value\n end", "def protected_apps=(value)\n @protected_apps = value\n end", "def mobile_app_categories=(value)\n @mobile_app_categories = value\n end", "def installed_apps\n return @installed_apps\n end", "def installed_apps\n return @installed_apps\n end", "def client_application_publisher_ids=(value)\n @client_application_publisher_ids = value\n end", "def applications\n @applications ||= [default_application]\n end", "def apps\n apps_found = []\n server_xml = Liberty.server_xml(@app_dir)\n if Liberty.web_inf(@app_dir)\n apps_found = [@app_dir]\n elsif server_xml\n apps_found = Dir.glob(File.expand_path(File.join(server_xml, '..', '**', '*.war')))\n Liberty.expand_apps(apps_found)\n end\n apps_found\n end", "def applications(options = {})\n @applications = api.get_applist if !@applications\n @applications\n end", "def registered_applications\n @registered_applications ||= current_user.registered_applications.all\n end", "def mobile_apps\n return @mobile_apps\n end", "def apps_install_allow_list=(value)\n @apps_install_allow_list = value\n end", "def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end", "def i_cloud_block_managed_apps_sync=(value)\n @i_cloud_block_managed_apps_sync = value\n end", "def set_ContainedWithin(value)\n set_input(\"ContainedWithin\", value)\n end", "def set_ContainedWithin(value)\n set_input(\"ContainedWithin\", value)\n end", "def app_list\n host_os_family.app_list( self )\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def apps\n @apps.keys\n end", "def dock_apps(user = CURRENTUSER)\n\n\tplist = CFPropertyList::List.new(:file => \"/Users/#{user}/Library/Preferences/com.apple.dock.plist\")\n\tresults=CFPropertyList.native_types(plist.value)\n\tapps=[]\n\tfor key, value in results['persistent-apps']\n\t\tfor key, value in key\n\t\t\tif value.class == Hash\n\t\t\t\tfor x, y in value\n\t\t\t\t\tif x == \"file-label\"\n\t\t\t\t\t\tapps.push(y)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn apps\nend", "def apps(criteria = {})\n all_available_apps.filter_with_criteria(criteria)\n end", "def client_app_types=(value)\n @client_app_types = value\n end", "def app_roles=(value)\n @app_roles = value\n end", "def kiosk_mode_apps=(value)\n @kiosk_mode_apps = value\n end", "def apps\n collect\n end", "def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end", "def find_application\n unless self.app_name.blank?\n my_apps = []\n # in the case of an array, the new finder will not work\n Array(self.app_name).each do |individual_name|\n new_apps = App.active.by_short_or_long_name(individual_name)\n logger.info \"new_apps\" + new_apps.inspect\n my_apps += new_apps unless new_apps.blank?\n logger.info \"my_apps\" + my_apps.inspect\n end\n unless my_apps.blank? || my_apps.length != Array(self.app_name).length\n self.apps << my_apps - self.apps\n else\n self.application_lookup_failed = true\n end\n end\n # be sure the call back returns true or else the call will fail with no error message\n # from the validation loop\n return true\n end", "def connected_organizations=(value)\n @connected_organizations = value\n end", "def defender_guarded_folders_allowed_app_paths=(value)\n @defender_guarded_folders_allowed_app_paths = value\n end", "def apps\n apps_search = []\n App.all.each do |app|\n apps_search << {\n title: app.name,\n description: app.package_id,\n url: app_path(id: app.id)\n }\n end\n gon.apps = apps_search\n end", "def allowed_domain_guids_for_sync_app=(value)\n @allowed_domain_guids_for_sync_app = value\n end", "def client_applications\n return @client_applications\n end", "def update_app_list\n # Differentiate between a null app_nids params and no app_nids params\n return unless params[:organization].key?(:app_nids) && (desired_nids = Array(params[:organization][:app_nids]))\n\n existing_apps = @organization.app_instances.active\n\n existing_apps.each do |app_instance|\n desired_nids.delete(app_instance.app.nid) || app_instance.terminate\n end\n\n desired_nids.each do |nid|\n begin\n @organization.app_instances.create(product: nid)\n rescue => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n end\n\n end\n\n # Force reload\n existing_apps.reload\n end", "def app_environments\n @app_environments ||= apps.map { |app| app.app_environments }.flatten\n end", "def deployed_app_count=(value)\n @deployed_app_count = value\n end", "def apps_single_app_mode_list\n return @apps_single_app_mode_list\n end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def known_client_applications\n return @known_client_applications\n end", "def applications\n list = Array.new\n\n if @db != nil\n is_ok = false\n\n begin\n stm = @db.prepare( 'SELECT qApp FROM qryResults GROUP BY qApp ORDER BY qApp')\n rs = stm.execute\n\n rs.each do |row|\n list.push row['qApp']\n end\n\n stm.close\n is_ok = true\n rescue ::SQLite3::Exception => e\n Maadi::post_message(:Warn, \"Repository (#{@type}:#{@instance_name}) encountered an SELECT Applications error (#{e.message}).\")\n end\n end\n\n return list\n end", "def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end", "def applications_for_interview\n apps = application_for_offerings.delete_if {|a| !a.invited_for_interview? }\n end", "def combined_app_root(include_gen_root=true)\n local_app_root = File.expand_path('../../../app', __FILE__)\n app_root = [@ctx_app_root ||= @context.app_root]\n app_root << @context.gen_root if include_gen_root\n app_root << local_app_root if local_app_root != @ctx_app_root\n app_root\n end", "def mirrored_app_components\n mirrored_components & app_components\n end", "def media_content_rating_apps=(value)\n @media_content_rating_apps = value\n end", "def applications\n apps = {}\n Dir[File.join(@path, '*')].each do |store_dir|\n name = File.basename(store_dir)\n \n apps[name] = ApplicationConfiguration.new name, store_dir\n end\n \n apps\n end", "def app_consent_requests=(value)\n @app_consent_requests = value\n end", "def production_companies=(production_companies_from_response)\n @production_companies = Enceladus::ProductionCompany.build_collection(production_companies_from_response)\n end", "def valid_apps\n apps.select { |app| app.valid? }\n end", "def apps_visibility_list=(value)\n @apps_visibility_list = value\n end", "def add_user_visible_apps(user_id: nil, app_ids: nil)\n body = {\n data: app_ids.map do |app_id|\n {\n type: \"apps\",\n id: app_id\n }\n end\n }\n\n users_request_client.post(\"users/#{user_id}/relationships/visibleApps\", body)\n end", "def addApplicationContext(appCtxt)\n @applications[appCtxt.id] = appCtxt\n eachNode { |n|\n n.addApplicationContextToStates(appCtxt)\n }\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def exempt_apps=(value)\n @exempt_apps = value\n end", "def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def mounted_apps_of(file)\n Padrino.mounted_apps.select { |app| File.identical?(file, app.app_file) }\n end", "def filter_apps\n @apps = ThirdpartyService.get_app_version(@url, AUTH, @http)['list']\n filter_result = render_to_string(partial: 'home/app_list', layout: false)\n render json: { filter_result: filter_result }\n end", "def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end", "def security_require_company_portal_app_integrity=(value)\n @security_require_company_portal_app_integrity = value\n end", "def app_definitions=(value)\n @app_definitions = value\n end", "def set_global_appdata(params = {})\r\n deletes = context.remove_null_values(params)\r\n @context.call_myspace_api(:appdata_global_put, :body => params) if params.length > 0\r\n @context.call_myspace_api(:appdata_global_delete, :keys => deletes.join(';')) if deletes.length > 0\r\n end", "def apps_hide_list=(value)\n @apps_hide_list = value\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def apps_launch_block_list=(value)\n @apps_launch_block_list = value\n end", "def fix_app_permissions(apps)\n apps.map { |path|\n fix_facl(path, app_acl_template(path))\n }.select { |report| report.updated || report.error }\n end", "def authorized_apps(user)\n authorized_apps = []\n user.attributes.each do |k, v|\n authorized_apps.push(k) if v == 'Y'\n end\n authorized_apps\n end", "def reset_apps\n # Set default hash value to false, so attempts to uninstall\n # non-existent apps will fail\n @apps = Hash.new(false)\n @apps.merge!(DEFAULT_APPS)\n end", "def all_apps\n json = ENV[\"OOD_APPS\"] || File.read(ENV[\"OOD_CONFIG\"] || File.expand_path(\"../config.json\", __FILE__))\n JSON.parse(json).map { |app| App.new(app.to_h) }\nend", "def apps_grid(apps)\n initialize_grid(\n apps,\n name: \"apps\",\n order: \"apps.created_at\",\n order_direction: \"desc\",\n per_page: 100,\n include: [{ user: :org }, :latest_version_app, { taggings: :tag }],\n )\n end", "def pre_authorized_applications\n return @pre_authorized_applications\n end" ]
[ "0.647464", "0.62848115", "0.6057803", "0.5866532", "0.5866532", "0.58548427", "0.58548427", "0.5799521", "0.5799521", "0.57533014", "0.56424147", "0.55927914", "0.5431217", "0.53694624", "0.53576523", "0.5320876", "0.5204975", "0.5072575", "0.5072575", "0.50648826", "0.5023209", "0.50228095", "0.4947042", "0.49342334", "0.49131468", "0.48892304", "0.4849224", "0.4849097", "0.48274806", "0.48092476", "0.47918218", "0.47777215", "0.47730827", "0.4752563", "0.4752563", "0.4725721", "0.47154346", "0.47102377", "0.46986008", "0.46893156", "0.46622562", "0.46304667", "0.46103984", "0.45701173", "0.45641053", "0.45634678", "0.45513436", "0.45399007", "0.45399007", "0.45364597", "0.4536003", "0.44731918", "0.44466937", "0.444494", "0.44293404", "0.44215795", "0.4420691", "0.4409307", "0.44003218", "0.43857586", "0.4374128", "0.43725002", "0.43659207", "0.43643543", "0.43637818", "0.4363211", "0.43627056", "0.43587965", "0.435877", "0.43575278", "0.43488804", "0.43413305", "0.43310106", "0.43217662", "0.431622", "0.43117803", "0.42916572", "0.4282339", "0.42802858", "0.4277964", "0.42721108", "0.42659166", "0.42611107", "0.42572653", "0.42525235", "0.4225365", "0.42249727", "0.42202497", "0.42164195", "0.4213979", "0.42137116", "0.42091256", "0.4195242", "0.41907564", "0.41851738", "0.41850832", "0.41842246", "0.41791174", "0.41484272", "0.41340682" ]
0.78734946
0
Instantiates a new windowsUniversalAppX and sets the default values.
def initialize() super @odata_type = "#microsoft.graph.windowsUniversalAppX" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(window_or_handle)\n @main_window = case window_or_handle\n when Window\n window_or_handle\n when Integer\n Window.new window_or_handle\n else\n raise WinGui::Errors::InitError, \"Unable to create App from #{window_or_handle.inspect}\"\n end\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsUniversalAppXContainedApp\"\n end", "def initialize(application_name)\n @application_name = application_name\n\n # Get the message id's for the Skype Control messages\n @api_discover_message_id =\n Win32::RegisterWindowMessage('SkypeControlAPIDiscover')\n @api_attach_message_id =\n Win32::RegisterWindowMessage('SkypeControlAPIAttach')\n\n instance = Win32::GetModuleHandle(nil)\n\n @window_class = Win32::WNDCLASSEX.new\n @window_class[:style] = Win32::CS_HREDRAW | Win32::CS_VREDRAW\n @window_class[:lpfnWndProc] = method(:message_pump)\n @window_class[:hInstance] = instance\n @window_class[:hbrBackground] = Win32::COLOR_WINDOW\n @window_class[:lpszClassName] =\n FFI::MemoryPointer.from_string 'ruby-skype'\n\n @window = Win32::CreateWindowEx(Win32::WS_EX_LEFT,\n FFI::Pointer.new(@window_class.handle),\n 'ruby-skype',\n Win32::WS_OVERLAPPEDWINDOW,\n 0, 0, 0, 0, Win32::NULL, Win32::NULL,\n instance, nil)\n end", "def new(*args, &bk)\n setup_application!\n super(*args, &bk)\n end", "def create_optional_windows\n @macmm_optional_windows = []\n $game_system.macmm_optional_windows.reverse.each { |sym|\n cw = MA_CustomizableMenu::CUSTOM_WINDOWS[sym]\n if cw.nil?\n manual_custom_window(sym)\n else\n auto_custom_window(sym)\n end\n }\n end", "def initialize\n @msg_win = MessageWindow.new\n @opts_win = OptionsWindow.new\n @board_win = BoardWindow.new\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsAppXAppAssignmentSettings\"\n end", "def default_root\n # child WindowLayout classes can return *their* NSView subclass from self.nsview_class\n view_class = self.class.targets || NSWindow\n view_class.alloc.initWithContentRect([[0, 0], [0, 0]],\n styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,\n backing: NSBackingStoreBuffered,\n defer: false)\n end", "def initialize()\n props = project_properties\n \n @app_id = props[:id]\n @app_name = props[:name]\n @app_is_desktop = props[:desktop]\n end", "def test_default\n w = Window_Selectable_Implemented.new(0,0,160,128,$data_items.compact)\n @windows.push(w)\n end", "def create_base_ui\n @base_ui = BaseUI.new(@viewport, button_texts)\n end", "def create_base_ui\n @base_ui = UI::GenericBase.new(@viewport, button_texts)\n end", "def test_default\n w = Window_Confirmation.new(0,0,320,nil)\n @windows.push(w)\n return true\n end", "def initialize(raw_app)\r\n @raw_app = raw_app\r\n end", "def create_base_ui\n btn_texts = button_texts\n @base_ui = UI::GenericBaseMultiMode.new(@viewport, btn_texts, [UI::GenericBase::DEFAULT_KEYS] * btn_texts.size)\n @ctrl = @base_ui.ctrl\n end", "def window\n @window ||= UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n end", "def test_default\n w = Window_SkillDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end", "def init_desktop_js(registered_windows = [], options = {})\n user = options[:current_user] || \"Anonymous\"\n name = \"FirstWindow\"\n javascript_tag <<-_JS\n MyDesktop = new Ext.app.App({\n\tinit :function(){\n\t Ext.QuickTips.init();\n\t},\n\n\tgetModules : function(){\n\t return [\n\t #{build_window_lists(registered_windows)}\t\n\t ];\n\t},\n\n // config for the start menu\n getStartConfig : function(){\n return {\n title: '#{user}',\n iconCls: 'user',\n toolItems: [{\n text:'Konfigurasi',\n iconCls:'settings',\n\t handler : showMessage,\n scope:this\n },'-',{\n text:'Keluar',\n iconCls:'logout',\n\t handler: makeSureLogOut,\n scope:this\n }]\n };\n }\n });\n var windowIndex = 0; \n _JS\n end", "def initialize(options = {}, &blk)\n options ||= {}\n options[:type] = :application\n init(options, &blk)\n end", "def test_default\n w = Window_ItemDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end", "def initialize(app, config = T.unsafe(nil)); end", "def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end", "def window\n Window_Base.new(0, 0, 0, 0)\n end", "def main_window\r\n super\r\n # Make help window, status window, and skill window\r\n @help_window = Window_Help.new\r\n @status_window = Window_SkillStatus.new(@actor)\r\n @skill_window = Window_Skill.new(@actor)\r\n # Associate help window\r\n @skill_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end", "def test_default\n w = Window_EquipDetails.new(0,0,640,96,nil)\n @windows.push(w)\n return true\n end", "def default(app)\n @default_app = app\n end", "def create_dummy_window\n wy = @command_window.y + @command_window.height\n wh = Graphics.height - wy\n @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)\n @dummy_window.viewport = @viewport\n @dummy_window.hide\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.iosVppAppAssignmentSettings\"\n end", "def initialize(rect)\n mask = NSBorderlessWindowMask\n backing = NSBackingStoreBuffered\n initWithContentRect(rect, styleMask:mask, backing:backing, defer:true)\n # self.level = NSStatusWindowLevel\n self.backgroundColor = NSColor.clearColor # NSColor.blackColor \n self.hasShadow = true\n self.alphaValue = 0.75\n self.opaque = false\n self.hidesOnDeactivate = true\n # self.collectionBehavior = NSWindowCollectionBehaviorCanJoinAllSpaces\n @initial_location = NSPoint.new\n end", "def CreateApplicationElement(arg0, arg1)\n ret = _invoke(1610744102, [arg0, arg1], [VT_I4, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def initialize(window)\n \t# all setup is done in reset so it can be reused\n reset(window)\n end", "def window_controller\n @window_controller ||= begin\n window_controller = UIWindowController.new\n window_controller.window = UIWindow.alloc.initWithContentRect(\n [[0, 0], [300, 200]],\n styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask,\n backing: NSBackingStoreBuffered,\n defer: false\n )\n window_controller.window.title = \"Hello World\"\n window_controller\n end\n end", "def create_base_ui\n @base_ui = UI::GenericBase.new(@viewport, button_texts)\n @mouse_button_cancel = @base_ui.ctrl.last\n end", "def initialize(app, events = T.unsafe(nil), options = T.unsafe(nil)); end", "def initialize(options = {})\n @options = default_options.merge(options)\n @app = @options.delete(:app)\n end", "def initialize\n @application = \"precidix\"\n super\n end", "def new\n\t\t@application = Application.new\t\t\n\tend", "def main_window\r\n super\r\n # Make main command window\r\n main_command_window\r\n # Make play time window\r\n @playtime_window = Window_PlayTime.new\r\n @playtime_window.x = 0\r\n @playtime_window.y = 224\r\n # Make steps window\r\n @steps_window = Window_Steps.new\r\n @steps_window.x = 0\r\n @steps_window.y = 320\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 0\r\n @gold_window.y = 416\r\n # Make status window\r\n @status_window = Window_MenuStatus.new\r\n @status_window.x = 160\r\n @status_window.y = 0\r\n end", "def initialize!(app); end", "def create_all_windows\n en_tm_sb_caw\n create_target_window\n end", "def initialize(*args)\n super\n mon_initialize\n end", "def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n super(@win)\n @title_prefix = title_prefix\n set_max_contents_len(cols)\n end", "def initialize\n super(RESOLUTION[0], RESOLUTION[1], {:update_interval => UP_MS_DRAW, :fullscreen => ISFULLSCREEN})\n $program = self # global pointer to window creation object\n controls_init # prep the input controls scheme manager\n gl_version = glGetString(GL_VERSION).to_s\n gl_version = gl_version.split(' ')\n @openGL_version = Gem::Version.new(gl_version[0])\n puts(\"Using OpenGL version: #{@openGL_version} On a #{gl_version[1]} Driver Version: #{gl_version[2]}\")\n puts(\"*\" * 70)\n @@active_state = Map.new( { :level => \"\" } )\n end", "def initialize(info={})\n super(update_info(info,\n 'Platform' => %w{ java linux osx solaris win },\n 'Payload' => { 'BadChars' => '', 'DisableNops' => true },\n 'Targets' =>\n [\n [\n 'Universal (Javascript XPCOM Shell)', {\n 'Platform' => 'firefox',\n 'Arch' => ARCH_FIREFOX\n }\n ],\n [\n 'Native Payload', {\n 'Platform' => %w{ java linux osx solaris win },\n 'Arch' => ARCH_ALL\n }\n ]\n ],\n 'DefaultTarget' => 0\n ))\n\n register_options([\n OptString.new('ADDONNAME', [ true, \"The addon name.\", \"HTML5 Rendering Enhancements\" ]),\n OptBool.new('AutoUninstall', [ true,\n \"Automatically uninstall the addon after payload execution\",\n true\n ])\n ], self.class)\n end", "def main_window\r\n super\r\n # Make actor command window\r\n s1 = $data_system.words.attack\r\n s2 = $data_system.words.skill\r\n s3 = $data_system.words.guard\r\n s4 = $data_system.words.item\r\n @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])\r\n @actor_command_window.y = 160\r\n @actor_command_window.back_opacity = 160\r\n @actor_command_window.active = false\r\n @actor_command_window.visible = false\r\n # Make other windows\r\n @party_command_window = Window_PartyCommand.new\r\n @help_window = Window_Help.new\r\n @help_window.back_opacity = 160\r\n @help_window.visible = false\r\n @status_window = Window_BattleStatus.new\r\n @message_window = Window_Message.new\r\n end", "def createWindow\n windowMask = NSTitledWindowMask |\n NSClosableWindowMask |\n NSMiniaturizableWindowMask |\n NSResizableWindowMask\n self.window = NSWindow.alloc\n .initWithContentRect( WINDOW_RECT,\n styleMask: windowMask,\n backing: NSBackingStoreBuffered,\n defer: true)\n self.window.contentMinSize = WINDOW_MIN_SIZE\n self.window.preventsApplicationTerminationWhenModal = false\n self.window.allowsConcurrentViewDrawing = true\n self.window.hasShadow = true\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.application\"\n end", "def message_initialize(no_message, message_z, message_viewport_args)\n if no_message.is_a?(::Yuki::Message)\n @message_window = no_message\n @inherited_message_window = true\n elsif no_message\n @message_window = false\n else\n # if $game_temp.in_battle\n # @message_window = ::Scene_Battle::Window_Message.new\n # @message_window.wait_input = true\n # else\n message_viewport_args = [:main, message_z] if message_viewport_args.empty?\n @message_window = message_class.new(Viewport.create(*message_viewport_args), self)\n # end\n @message_window.z = message_z\n end\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def initialize(app); end", "def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end", "def initialize(info={})\n super(update_info(info,\n 'Name' => 'SCRNSAVE T1180 (User-land Persistence)',\n 'Description' => %q{\n To achieve persistence the attacker can modify 'SCRNSAVE.EXE' value in the registry and change its data to point to any malicious file, next the attacker has to enable the screensaver on the endpoint and change screensaver timeout by modifying the registry data for 'ScreenSaveActive' and 'ScreenSaveTimeOut'. Once this is completed, anytime the user leaves their desktop unattended for the specified amount of time, the screensaver function automatically kicks in and executes the attackers malicious PE/Appl.\n },\n 'License' => UNKNOWN_LICENSE,\n 'Author' =>\n [\n 'Module Author: r00t-3xp10it',\n 'Special Thanks: shanty damayanti',\n ],\n \n 'Version' => '$Revision: 1.4',\n 'DisclosureDate' => '11 02 2019',\n 'Platform' => 'windows',\n 'Arch' => 'x86_x64',\n 'Privileged' => 'false', # Thats no need for privilege escalation.\n 'Targets' =>\n [\n # Affected systems are.\n [ 'Windows 2008', 'Windows xp', 'windows vista', 'windows 7', 'windows 9', 'Windows 10' ]\n ],\n 'DefaultTarget' => '6', # Default its to run againts windows 10\n 'References' =>\n [\n [ 'URL', 'https://attack.mitre.org/techniques/T1180/' ],\n [ 'URL', 'https://github.com/r00t-3xp10it/msf-auxiliarys' ],\n [ 'URL', 'https://ired.team/offensive-security/t1180-screensaver-hijack' ],\n [ 'URL', 'https://www.howtogeek.com/225305/how-to-find-and-set-screen-savers-on-windows-10/' ]\n\n\n ],\n\t\t\t'DefaultOptions' =>\n\t\t\t\t{\n 'LOOT_FOLDER' => '/root/.msf4/loot', # Default logs storage directory\n 'APPL_PATH' => '%windir%\\\\System32\\\\calc.exe', # Default PE/appl (payload) to run (test)\n\t\t\t\t},\n 'SessionTypes' => [ 'meterpreter' ]\n \n ))\n \n register_options(\n [\n OptString.new('SESSION', [ true, 'The session number to run this module on', 1]),\n OptString.new('TIME_OUT', [ true, 'Set inactivity timeout before screensaver runs', 10]),\n OptString.new('APPL_PATH', [ true, 'Set absoluct path of malicious PE/Appl to run'])\n ], self.class)\n\n register_advanced_options(\n [\n OptBool.new('LOG_OFF', [ false, 'Logoff current user to force registry refresh?', false]),\n OptString.new('LOOT_FOLDER', [ true, 'Set the absoluct path where to store revert.rc (local)'])\n ], self.class)\n\n end", "def main_window\r\n super\r\n # Make status window\r\n @status_window = Window_Status.new(@actor)\r\n end", "def main_window\r\n super\r\n # Make help window, item window\r\n @help_window = Window_Help.new\r\n @item_window = Window_Item.new\r\n # Associate help window\r\n @item_window.help_window = @help_window\r\n # Make target window (set to invisible / inactive)\r\n @target_window = Window_Target.new\r\n @target_window.visible = false\r\n @target_window.active = false\r\n end", "def apply_system_defaults\n if @region.nil? && @zone.nil?\n @region, @zone = Rudy::DEFAULT_REGION, Rudy::DEFAULT_ZONE\n elsif @region.nil?\n @region = @zone.to_s.gsub(/[a-z]$/, '').to_sym\n elsif @zone.nil?\n @zone = \"#{@region}b\".to_sym\n end\n \n @environment ||= Rudy::DEFAULT_ENVIRONMENT\n @role ||= Rudy::DEFAULT_ROLE\n @localhost ||= Rudy.sysinfo.hostname || 'localhost'\n @auto = false if @auto.nil?\n end", "def main_window\r\n super\r\n # Make actor command window\r\n s1 = SDK::Scene_Commands::Scene_Battle::Attack\r\n s2 = SDK::Scene_Commands::Scene_Battle::Skill\r\n s3 = SDK::Scene_Commands::Scene_Battle::Guard\r\n s4 = SDK::Scene_Commands::Scene_Battle::Item\r\n @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])\r\n @actor_command_window.y = 160\r\n @actor_command_window.back_opacity = 160\r\n @actor_command_window.active = false\r\n @actor_command_window.visible = false\r\n # Make other windows\r\n @party_command_window = Window_PartyCommand.new\r\n @help_window = Window_Help.new\r\n @help_window.back_opacity = 160\r\n @help_window.visible = false\r\n @status_window = Window_BattleStatus.new\r\n @message_window = Window_Message.new\r\n end", "def initialize\n super(ApplicationController, {}, DEFAULTS.dup)\n end", "def main_window\r\n super\r\n # Make help window\r\n @help_window = Window_Help.new\r\n # Make command window\r\n @command_window = Window_ShopCommand.new\r\n # Make gold window\r\n @gold_window = Window_Gold.new\r\n @gold_window.x = 480\r\n @gold_window.y = 64\r\n # Make dummy window\r\n @dummy_window = Window_Base.new(0, 128, 640, 352)\r\n # Make buy window\r\n @buy_window = Window_ShopBuy.new($game_temp.shop_goods)\r\n @buy_window.active = false\r\n @buy_window.visible = false\r\n @buy_window.help_window = @help_window\r\n # Make sell window\r\n @sell_window = Window_ShopSell.new\r\n @sell_window.active = false\r\n @sell_window.visible = false\r\n @sell_window.help_window = @help_window\r\n # Make quantity input window\r\n @number_window = Window_ShopNumber.new\r\n @number_window.active = false\r\n @number_window.visible = false\r\n # Make status window\r\n @status_window = Window_ShopStatus.new\r\n @status_window.visible = false\r\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.mobileLobApp\"\n end", "def create_app_object(appname)\n app = OpenStruct.new\n appsettings = JSON.parse(File.read(appname))\n appsettings[\"appvariables\"].each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"tabshash\"],appsettings[\"tabshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"fileshash\"],appsettings[\"fileshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n injectfunctions($defaultshortcuts[\"viewshash\"],appsettings[\"viewshash\"]).each { |k,v| app.public_send(\"#{k}=\", v) }\n return app\nend", "def initialize(args={})\n set_defaults do\n self.event_id = '020001'\n self.start_reason = 'User Initiated'\n self.terminate_reason = 'User Requested'\n end\n super\n end", "def initialize\n # Get game window title from Game.ini\n ini = Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L')\n @title = \"\\0\" * 256\n ini.call('Game', 'Title', '', @title, 256, '.\\\\Game.ini')\n @title.delete!(\"\\0\")\n # Set game window to an instance variable, using the title we found.\n @main = Win32API.new('user32', 'FindWindowA', 'PP', 'L').call('RGSS Player', @title)\n # Set variables to call for creating showing, and destroying the window.\n @create_window = Win32API.new('user32','CreateWindowEx','lpplllllllll','l')\n @show_window = Win32API.new('user32','ShowWindow',%w(l l),'l')\n @destroy_window = Win32API.new('user32','DestroyWindow','p','l')\n # Set variables to get the window size, position, text, etc, etc.\n @window_text = Win32API.new('user32','GetWindowText',%w(n p n ),'l') \n @metrics = Win32API.new('user32', 'GetSystemMetrics', 'I', 'I')\n @set_window_pos = Win32API.new('user32', 'SetWindowPos', 'LLIIIII', 'I')\n @window_rect = Win32API.new('user32','GetWindowRect',%w(l p),'i')\n # Define the coordinates to display the window.\n @x = (@metrics.call(0) - 576) / 2\n @y = (@metrics.call(1) - 22) / 2 \n # Updates the client area of the window.\n @update_window = Win32API.new('user32','UpdateWindow','p','i') \n # Set a button that will register when button is pressed.\n @input = Win32API.new('user32','GetAsyncKeyState','i','i')\n end", "def create_base\n @base = UI::GenericBase.new(@viewport, BUTTON_TEXTS.collect { |txt| get_text(txt) }, BUTTON_KEYS)\n end", "def initialize(rows, cols, row, col, title_prefix)\n @win = Window.new(rows, cols, row, col)\n @title_prefix = title_prefix\n @max_contents_len = @win.maxx - 3 # 2 for borders\n end", "def initialize(...)\n super\n mon_initialize\n end", "def create_choice_window\n @choice_window = Window_RegChoice.new\n @choice_window.set_handler(:register, method(:open_eula))\n @choice_window.set_handler(:cancel, method(:go_game))\n @choice_window.openness = 0\n if $game_temp.registration_step == 0\n @help_window.set_text(Vocab.registration_step1)\n @choice_window.activate\n @choice_window.open\n end\n end", "def set_defaults\n\t self.year ||= Date.today.cwyear\n\t self.start_week ||= 1\n self.end_week ||= Date.new(Date.today.cwyear, 12, 28).cweek #calc for number of weeks in current year\n\t self.hours_in_week ||= 40\n\t self.holiday ||= 8\n\t self.billable_rate ||= 90\n self.billable_per_week ||= self.hours_in_week\n \tend", "def initialize\n super ACTUAL_WIDTH, ACTUAL_HEIGHT, fullscreen: FULLSCREEN\n\n Gosu::enable_undocumented_retrofication\n \n Controllers::ControllerSupervisor.window = self\n\n Controllers::MapController.new(nil)\n\n Controllers::DialogueController.new\n Controllers::BackgroundController.new\n Controllers::HudController.new\n Controllers::ParticleController.new\n \n Controllers::MenuController.new\n Controllers::TransitionController.new\n end", "def initialize(api_id)\n @api_id = api_id\n @app_info = nil\n @channels = {}\n initialize_stats\n logger.debug \"Created application\"\n end", "def app\n @app ||= LiuLunch\n end", "def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config\n create_app\n create_design\n create_spec\n create_docs\n end", "def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end", "def windows(opts = {})\n WindowCollection.new self, opts\n end", "def ui_default s\n\t\t\tUI_DEFAULTS[s]\n\t\tend", "def new(**settings)\n __new_without_defaults__(\n **default_settings.merge(settings)\n )\n end", "def new_ui(with=Dumon::GtkTrayUi)\n with.new\n end", "def app_class=(_arg0); end", "def app_class=(_arg0); end", "def app\n TicTacToeAiNApp # most examples use App.new - reason why we don't need .new here? ?????\n end", "def initialize(defbases = nil)\n @plus = Util::UniqueStringList.new(:ws)\n @min = Util::UniqueStringList.new(:ws)\n @default = Util::UniqueStringList.new(:ws, defbases)\n end", "def main_window\r\n super\r\n # Make message window\r\n @message_window = Window_Message.new\r\n end", "def generate\n generate_manifest\n fix_windows_manifest\n end", "def initialize (wurfl_id,useragent,fallback=nil) \n # A hash to hold keys and values specific to this handset\n @capabilityhash = Hash::new \n @wurfl_id = wurfl_id.to_s\n @user_agent = useragent.to_s\n @fallback = fallback\n end", "def setup_application\n Souffle::Daemon.change_privilege\n Souffle::Config[:server] = true if Souffle::Config[:daemonize]\n @app = Souffle::Server.new\n end", "def set_defaults\n end", "def set_defaults\n end", "def app_not_scoped(*keys)\n self.entry(:app, *keys) || begin\n substitution_args = if keys.last.kind_of?(Array)\n keys.pop\n elsif keys.last.kind_of?(Hash)\n [keys.pop]\n else\n []\n end\n if keys.last.kind_of?(String)\n self.substitute_entry keys.last, *substitution_args\n else\n self.entry(:app_default_value)\n end\n end\n end", "def create\r\n @icons_app.each do |k,v|\r\n v.create\r\n end\r\n # local variables\r\n \r\n refresh_settings\r\n \r\n #splitter position\r\n gfxgui_settings = @app_settings['guigfx']\r\n \r\n # window size\r\n ww = gfxgui_settings[:ww_mainwin]\r\n hh = gfxgui_settings[:hh_mainwin]\r\n \r\n # continue to insert item into giochi menu\r\n FXMenuSeparator.new(@giochimenu)\r\n FXMenuCommand.new(@giochimenu, \"Opzioni\").connect(SEL_COMMAND, method(:mnu_cuperativa_options))\r\n FXMenuSeparator.new(@giochimenu)\r\n FXMenuCommand.new(@giochimenu, \"&Esci\").connect(SEL_COMMAND, method(:onCmdQuit))\r\n \r\n # Reposition window to specified x, y, w and h\r\n position(0, 0, ww, hh)\r\n \r\n # Create the main window and canvas\r\n super \r\n # Show the main window\r\n show(PLACEMENT_SCREEN)\r\n \r\n # default game or last selected\r\n game_type = @app_settings[\"curr_game\"]\r\n #p @supported_game_map\r\n # initialize only an enabled game. An enabled game is a supported game.\r\n # Game disabled are not in the @supported_game_map. This to avoid to build poperties and\r\n # custom widgets\r\n if @supported_game_map[game_type]\r\n if @supported_game_map[game_type][:enabled]\r\n initialize_current_gfx(game_type)\r\n end\r\n else\r\n # default game is not supported, initialize the first enable game\r\n @log.debug(\"Default game not enabled, look for the first enabled one\")\r\n @supported_game_map.each do |k, game_info_h|\r\n game_type = k\r\n if game_info_h[:enabled]\r\n initialize_current_gfx(game_type)\r\n break\r\n end\r\n end\r\n end\r\n log_sometext(\"Benvenuta/o nella Cuperativa versione #{VER_PRG_STR}\\n\")\r\n @log.info(\"TheApp Create OK\") \r\n end", "def initialize(starting_language)\n @music_volume = 100\n @sfx_volume = 100\n @message_speed = 3\n @battle_mode = true\n @show_animation = true\n @language = starting_language\n self.message_frame = GameData::Windows::MESSAGE_FRAME.first\n end", "def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end", "def auto_custom_window(symbol)\n cw = MA_CustomizableMenu::CUSTOM_WINDOWS[symbol]\n window = Window_MACMM_AutoCustom.new(cw)\n set_custom_window_y(window)\n @macmm_optional_windows << window\n instance_variable_set(:\"@macmm_#{symbol.to_s}_window\", window)\n end", "def initialize(name, location = nil)\n @name = name.to_sym\n @url_map = Innate::URLMap.new\n self.location = location if location\n\n APP_LIST[@name] = self\n\n @options = self.class.options.sub(@name)\n end", "def create_defaults\n import_layout(self.layout_dir(:absolute => true))\n import_content(self.content_dir(:absolute => true))\n end", "def initialize(attributes = {})\n attr_with_defaults = {\n daily_reminder: true,\n weekly_reminder: true,\n mine_only: false\n }.merge(attributes)\n super(attr_with_defaults)\n end", "def application_root=(_arg0); end", "def init_quick_defaults\n @quick_defaults=Hash.new\n @quick_defaults['enabled']=false\n @quick_defaults['launch']='ONETIME'\n @quick_defaults['launch_now']=true\n @quick_defaults['description']='Created with nessus_rest'\n end", "def default_application\n if @default_application\n @default_application\n elsif @applications && [email protected]?\n @default_application ||= @applications.first\n else\n @default_application ||= Hsquare::Application.new\n end\n end", "def test_defaultIndex\n w = Window_Confirmation.new(320,80,320,\"Are you sure ?\", \"Yes\", \"No\", 0)\n @windows.push(w)\n return true\n end" ]
[ "0.6252148", "0.58806974", "0.5633095", "0.5610413", "0.539812", "0.5367561", "0.53484225", "0.528339", "0.5231668", "0.5147744", "0.51375055", "0.51279587", "0.5097683", "0.5095246", "0.50710464", "0.5061951", "0.50201494", "0.4995328", "0.4979578", "0.49622387", "0.49612227", "0.49600473", "0.49534857", "0.49426755", "0.49385503", "0.4892044", "0.48843986", "0.4884372", "0.4878664", "0.48667642", "0.4858027", "0.48438537", "0.48199567", "0.48182583", "0.481739", "0.481137", "0.4811247", "0.4795368", "0.47636694", "0.47463122", "0.47458345", "0.47427532", "0.47376564", "0.47335792", "0.47242048", "0.47049105", "0.4690597", "0.46872035", "0.46799183", "0.4678452", "0.4678452", "0.46716887", "0.46640107", "0.46549097", "0.46494547", "0.46434438", "0.46333417", "0.4631339", "0.46195182", "0.46161705", "0.4587731", "0.45835525", "0.4582313", "0.45819786", "0.45793816", "0.45766973", "0.45660833", "0.45617208", "0.45602253", "0.45574525", "0.45543596", "0.45491686", "0.45324862", "0.45323867", "0.45253637", "0.45211878", "0.45049906", "0.45003295", "0.44970334", "0.44970334", "0.44937983", "0.44902888", "0.44809812", "0.44769293", "0.44718647", "0.4471324", "0.44696426", "0.44696426", "0.4468438", "0.44659755", "0.44651505", "0.44626558", "0.44625443", "0.4461797", "0.4461526", "0.44611296", "0.44549817", "0.44522184", "0.44515896", "0.44510055" ]
0.6203908
1
The deserialization information for the current model
def get_field_deserializers() return super.merge({ "applicableArchitectures" => lambda {|n| @applicable_architectures = n.get_enum_value(MicrosoftGraph::Models::WindowsArchitecture) }, "applicableDeviceTypes" => lambda {|n| @applicable_device_types = n.get_enum_value(MicrosoftGraph::Models::WindowsDeviceType) }, "committedContainedApps" => lambda {|n| @committed_contained_apps = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileContainedApp.create_from_discriminator_value(pn) }) }, "identityName" => lambda {|n| @identity_name = n.get_string_value() }, "identityPublisherHash" => lambda {|n| @identity_publisher_hash = n.get_string_value() }, "identityResourceIdentifier" => lambda {|n| @identity_resource_identifier = n.get_string_value() }, "identityVersion" => lambda {|n| @identity_version = n.get_string_value() }, "isBundle" => lambda {|n| @is_bundle = n.get_boolean_value() }, "minimumSupportedOperatingSystem" => lambda {|n| @minimum_supported_operating_system = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WindowsMinimumOperatingSystem.create_from_discriminator_value(pn) }) }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end", "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", "def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def metadata\n self.class.metadata\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "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", "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", "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", "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", "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", "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", "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", "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", "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", "def _before_validation\n serialize_deserialized_values\n super\n end", "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", "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", "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" ]
[ "0.6510734", "0.63224316", "0.6322254", "0.63094735", "0.62954384", "0.6238735", "0.6232461", "0.62155676", "0.6200175", "0.6199403", "0.6173917", "0.61733985", "0.61705345", "0.61631054", "0.61620396", "0.6158031", "0.6156071", "0.6142402", "0.613998", "0.6138061", "0.61200523", "0.6089013", "0.60869795", "0.6079146", "0.60785794", "0.6070405", "0.6063533", "0.60625833", "0.6061235", "0.60584134", "0.6055769", "0.6051312", "0.60465735", "0.6046329", "0.6031944", "0.6029311", "0.6028314", "0.60255736", "0.6022033", "0.60210633", "0.6009887", "0.5988654", "0.59844214", "0.59793943", "0.5975247", "0.5969614", "0.596824", "0.5966432", "0.5965554", "0.596292", "0.5951651", "0.5950895", "0.59456754", "0.59448177", "0.593984", "0.59362113", "0.5935833", "0.59319806", "0.59312665", "0.59307545", "0.5930406", "0.5926444", "0.5926136", "0.59240156", "0.5922303", "0.591605", "0.591336", "0.5913327", "0.59130335", "0.5910617", "0.5906052", "0.5906045", "0.59042066", "0.5903306", "0.5902868", "0.59027255", "0.5902389", "0.5902219", "0.5901496", "0.58978146", "0.5891392", "0.5890228", "0.5885622", "0.5885429", "0.5884738", "0.5883899", "0.5883899", "0.5883899", "0.58811784", "0.5878516", "0.5877111", "0.5869185", "0.5844199", "0.58430207", "0.58408237", "0.58383596", "0.58362466", "0.5836192", "0.5835942", "0.5834559", "0.583357" ]
0.0
-1
Gets the identityName property value. The Identity Name.
def identity_name return @identity_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_name=(value)\n @identity_name = value\n end", "def name\n \"identity\"\n end", "def name\n \"identity\"\n end", "def name\n @name ||= metadata.attributes['Name'].value\n end", "def iname\n attributes['name']\n end", "def iname\n attributes['name']\n end", "def iname\n attributes['name']\n end", "def identity()\n\t\t\treturn @metadata.attributes[:identity].to_i\n\t\tend", "def name\n # The name must be a string\n id.to_s\n end", "def name\n @name ||= parse_name(id.name)\n end", "def name\n @name.to_s\n end", "def name\n @name.to_s\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def get_name\n return @m_name\n end", "def name\n @name || @id.to_s.capitalize\n end", "def name()\n return @name\n end", "def name\n @name ? @name.to_s : unique_id\n end", "def name\n self._id.to_s\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @attributes.fetch('name', nil)\n end", "def name\n @attributes.fetch('name', nil)\n end", "def identity\n return @identity\n end", "def get_name\n @name\n end", "def name_id\n @name_id ||= document.elements[\"/samlp:Response/saml:Assertion/saml:Subject/saml:NameID\"].text\n end", "def name_id\n @name_id ||= document.elements[\"/samlp:Response/saml:Assertion/saml:Subject/saml:NameID\"].text\n end", "def getName()\n return @name ;\n end", "def get_name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def name\n return @name\n end", "def get_name()\n @name\n end", "def get_name()\n @name\n end", "def name\n @attributes[:name]\n end", "def name\n @name || object_id.to_s\n end", "def getName()\n return @name\n end", "def identity_resource_identifier\n return @identity_resource_identifier\n end", "def to_s\n @name\n end", "def\n get_name()\n @name\n end", "def identifier_value\n user.icn\n end", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def getName\r\n\t\t\t\t\treturn @name\r\n\t\t\t\tend", "def name_value\n send(self.class.name_attribute)\n end", "def to_s\n @name\n end", "def to_s\n @name\n end", "def to_s\n @name\n end", "def name_str\n self.anon ? \"Anonymous\" : self.user.name\n end", "def retrieve_name\n return @name\n end", "def name\n @name.empty? ? to_s : @name\n end", "def name\n return @name\n end", "def get_name\n return \"Name: \" + @name\n end", "def name\n attributes.fetch(:name)\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def name\n @attributes[:name]\n end", "def to_s\n @name\n end", "def getName()\n\t\t\treturn @_name\n\t\tend", "def getName()\r\n\t\treturn @name\r\n\tend", "def user_name\n return User.find(user_id).name\n end", "def user_name\n return User.find(user_id).name\n end", "def getName\n return @name\n end", "def getName\n return @name\n end", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def get_name\n\t\treturn @name\n\tend", "def name\n @attributes[:Name]\n end", "def return_name\n @name\n end", "def display_name\n @name\n end", "def identity\n data = perform_get(IDENTITY_PATH)\n data || {}\n end", "def to_s\r\n @name\r\n end", "def to_s\n @name\n end", "def name\n @name ||= section.symstr.name_at(header.st_name)\n end", "def property_name\n property.identifing_name\n end", "def name\n @name ||= @data[:cn].last\n end", "def name\n @name ||= self.class.non_namespaced_name\n end", "def name\n @content[pn(:Name)]\n end", "def get_name\n @name\n end", "def get_name\n @name\n end", "def get_name\n @name\n end", "def get_name\n @name\n end" ]
[ "0.77704644", "0.68171906", "0.670793", "0.63422227", "0.63371587", "0.63371587", "0.63371587", "0.6310999", "0.6257595", "0.62386453", "0.61399966", "0.61399966", "0.61110246", "0.61110246", "0.61110246", "0.61110246", "0.60955626", "0.60774475", "0.60698193", "0.60634214", "0.60491097", "0.60491097", "0.60491097", "0.60491097", "0.6026621", "0.6011759", "0.59649247", "0.59649247", "0.59640694", "0.59544754", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5936006", "0.5914587", "0.5914587", "0.58956623", "0.58952445", "0.5886203", "0.5871859", "0.5861505", "0.58471197", "0.584649", "0.5829946", "0.5829946", "0.5829946", "0.5829946", "0.5829946", "0.5826533", "0.5824174", "0.5824174", "0.5824174", "0.5820062", "0.5818252", "0.58068424", "0.58024246", "0.5791386", "0.5783992", "0.5777595", "0.5777595", "0.5777595", "0.5777595", "0.5775599", "0.5768543", "0.576649", "0.57647586", "0.57647586", "0.57554305", "0.57554305", "0.5753051", "0.5753051", "0.5753051", "0.57239115", "0.57181", "0.5717781", "0.57113165", "0.57091796", "0.56844264", "0.5679627", "0.5678896", "0.5676792", "0.5670009", "0.56687963", "0.56541485", "0.56541485", "0.56541485", "0.56541485" ]
0.8184187
0
Sets the identityName property value. The Identity Name.
def identity_name=(value) @identity_name = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(vmname)\n execute(:set_name, VMID: vm_id, VMName: vmname)\n end", "def set_name(name)\n @name = name\n end", "def set_name(name)\n unless name.nil?\n @name = name\n end\n @name\n end", "def set_name(a_name)\n @name = a_name\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_name=(name)\n @name = name\n end", "def name=(value)\n @name = attributes[:name] = value\n end", "def identity=(value)\n @identity = value\n end", "def setName(n)\n @name = n\n end", "def name=(name)\n @name ||= name.to_s\n end", "def set(name)\n @name = name\n self\n end", "def name(value)\n @ole.Name = value\n nil\n end", "def name(value)\n @ole.Name = value\n nil\n end", "def name(value)\n @ole.Name = value\n nil\n end", "def name(value)\n @ole.Name = value\n nil\n end", "def setName(name)\n @name = name\n end", "def name_setter(new_name)\n @name = new_name\n end", "def name=(name)\n @name = name.to_s\n end", "def name=(name)\n @name = name.to_s\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(name)\n @content[pn(:Name)] = name\n end", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def setName(name)\r\n\t\t\t\t\t@name = name\r\n\t\t\t\tend", "def name=( n )\n self.id = ( n )\n end", "def set_name(value)\n jrdd.setName(value)\n value\n end", "def set_name(name)\n @person[:name] = name\n end", "def set_Name(value)\n set_input(\"Name\", value)\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(val)\n @name = val\n end", "def name=(value)\n @name = value\n end", "def name=(value)\n @name = value\n end", "def name=(name)\n attributes[:name] = name\n end", "def name=(str)\n C.LLVMSetValueName(self, str)\n str\n end", "def name=(val)\n @name = val\n end", "def change_name=(name)\n @name = name\n end", "def name=(name)\n @name = name\n end", "def name= (nm)\n _c_set_name(Slaw._ensure_utf8(nm))\n end", "def name=(value)\n @name = value.to_s\n end", "def name=(_name)\n write_attribute(:name, _name.strip)\n end", "def name= (new_name)\n @name = new_name\n end", "def set_name=(name)\n # '@' represents the member variable\n @name = name\n end", "def identity=(v)\n @identity = v\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def name=(new_name)\n @name = new_name\n end", "def set_name(name_in)\n @name = name_in.clone();\n end", "def name=(name)\n @name = name\n end", "def name=(new_name)\n\t\t@name = new_name\n\tend", "def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name, value)\n end", "def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name, value)\n end", "def name=(name)\n\t\tif name == \"\"\n\t\t\traise \"Name can't be blank!\" # Report an error if the name is blank\n\t\tend\n\t\t@name = name # Store the name in an instance variable\n\tend", "def iname=(val)\n attributes['name'] = val\n end", "def iname=(val)\n attributes['name'] = val\n end", "def iname=(val)\n attributes['name'] = val\n end", "def set_name\n @name = Name.find(params[:id])\n end", "def set_name\n @name = Name.find(params[:id])\n end", "def set_name\n @name = Name.find(params[:id])\n end", "def name=(nm)\n @name = nm\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "def name=(name)\n if name.nil?\n fail ArgumentError, 'invalid value for \"name\", name cannot be nil.'\n end\n @name = name\n end", "def name=(value)\n @name = value.nil? ? nil : String(value)\n end", "def name=(name)\r\n @name = name\r\n end", "def name=(name)\n write_attribute(:name, name.downcase)\n end", "def name=(name_to_be_set)\n @name = name_to_be_set\n end", "def name=(name)\r\n @name = name.capitalize\r\n end" ]
[ "0.64760625", "0.63080764", "0.62054354", "0.6166203", "0.6107941", "0.6107941", "0.6107941", "0.6107941", "0.6107941", "0.6107941", "0.6107941", "0.6107941", "0.6071007", "0.6032065", "0.6002141", "0.5986748", "0.59534484", "0.59531736", "0.5943592", "0.5943592", "0.5943592", "0.5943592", "0.59395504", "0.5902", "0.58770204", "0.58770204", "0.58752346", "0.5874537", "0.5874537", "0.5874537", "0.58738625", "0.58738625", "0.58738625", "0.58738625", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.5864788", "0.58496803", "0.5837681", "0.5837681", "0.5837681", "0.5837681", "0.5837681", "0.5813164", "0.58088416", "0.5805114", "0.5804797", "0.58027714", "0.58027714", "0.57915276", "0.5790837", "0.5790837", "0.5787562", "0.5766532", "0.5758221", "0.5752025", "0.5746875", "0.57416916", "0.5738113", "0.5733824", "0.57283413", "0.57279605", "0.5686544", "0.5683748", "0.56828874", "0.56828874", "0.5663889", "0.5663038", "0.5652399", "0.5650634", "0.5650634", "0.56495124", "0.56493866", "0.56493866", "0.56493866", "0.56343716", "0.56343716", "0.56343716", "0.56289333", "0.5626143", "0.5626143", "0.5619675", "0.5609092", "0.5607375", "0.5600375", "0.5600172" ]
0.80607766
0
Gets the identityPublisherHash property value. The Identity Publisher Hash.
def identity_publisher_hash return @identity_publisher_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_publisher_hash=(value)\n @identity_publisher_hash = value\n end", "def subscriber_hash(email)\n # Simple hash of the email address.\n Digest::MD5.hexdigest(email)\n end", "def publisher_id\n @@publisher_id\n end", "def subscriber_hash(email)\n Digest::MD5.hexdigest(email.downcase) unless email.nil?\n end", "def publisher\n return @publisher\n end", "def publisher\n return @publisher\n end", "def publisher\n return @publisher\n end", "def publisher\n return @publisher\n end", "def hash\n guid.hash\n end", "def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end", "def verified_publisher\n return @verified_publisher\n end", "def public_key_hash\n Crypto.hash_public_key(public_key)\n end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def hash!\n\t\t@@email.downcase!\n\t\thash = Digest::MD5.hexdigest(@@email)\n\t\treturn hash\n\tend", "def app_publisher\n return @app_publisher\n end", "def app_publisher\n return @app_publisher\n end", "def public_key\n @pub\n end", "def pub_hash\n @pub_hash ||= WebOfScience::MapPubHash.new(self).pub_hash\n end", "def hash\n return @id.hash\n end", "def publisher_name\n return @publisher_name\n end", "def to_bytes\n @public_key\n end", "def hash\n id.hash\n end", "def hash\n @id.hash\n end", "def hash\n return @revision.hash if @revision\n return object_id\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\r\n id.hash\r\n end", "def publisher_domain\n return @publisher_domain\n end", "def publisher_id=(pub_id)\n @@publisher_id = pub_id\n end", "def hash\n bytes.hash\n end", "def sha\n id.sha\n end", "def hash\n return to_s.hash\n end", "def public_key\n @public_key.to_der\n end", "def hash\n @id\n end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end", "def hash\n @id\n end", "def hexhash\n hash.to_s(16)\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n @hash || calculate_hash!\n end", "def hash\n value_id.hash\n end", "def hash\n to_pem.hash\n end", "def hash\n to_pem.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def public_key_hash(hex)\n\t\trmd160(sha256(hex))\n\tend", "def public_key\n return self.authentication.public_key\n end", "def public_key\n return self.authentication.public_key\n end", "def pubkey_hash160\n if set_pubkey_hash160\n set_pubkey_hash160 \n elsif multisig_pubkey\n hash160 multisig_pubkey\n else\n hash160( pubkey )\n end\n end", "def hashed_email\n @hashed_email ||= Digest::MD5.hexdigest(email.downcase.gsub(/\\s/, ''))\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n \tcustom_unique_id.hash\n end", "def public_key\n return @children['public-key'][:value]\n end", "def hash_id\n @hid\n end", "def hash\n `window.location.hash`\n end", "def hash\n id.hash + 32 * bs_request.hash\n end", "def hash\n @hash\n end", "def sha\n result_hash['sha']\n end", "def publishing_house\n scalar('publisher_tesim') || ''\n end", "def pub_id\n\t\treturn self.id\n\tend", "def publisher=(value)\n @publisher = value\n end", "def publisher=(value)\n @publisher = value\n end", "def publisher=(value)\n @publisher = value\n end", "def publisher=(value)\n @publisher = value\n end", "def hash\n id\n end", "def hash\n address.hash\n end", "def hash\n _window.hash\n end", "def hash\n title.hash\n end", "def publisher\n vm.storage_profile.image_reference.publisher\n end", "def hash\n node_id.hash\n end", "def hash\n self.respond_to?(:id) && self.id ? self.id.to_i : self.to_hash.hash\n end", "def hash\n name.hash ^ version.hash\n end", "def hash #:nodoc:\n uuid.hash\n end", "def public_key\n @cert.public_key\n end", "def get_public_key\n return @public_key\n end", "def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def public_key\n @priv.public_key\n end", "def to_script_pubkey\n v = ver == 0 ? ver : ver + 0x50\n ([v, prog.length] + prog).pack('C*').unpack(\"H*\").first\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is_a?(Fixnum) ? result : result.hash\n end\n end", "def public_key\n @cert.public_key\n end", "def hash\n [author_email, author_name, author_time, branch, commit_time, committer_email, committer_name, default_branch, message, repository_url, sha, tag].hash\n end", "def publisher\n @publisher ||= Publisher.new(self)\n end", "def sha\n @sha ||= ENV['HEROKU_SLUG_COMMIT'] || ENV['GIT_SHA'] || `git rev-parse HEAD`.chomp\n end", "def hash\n @hash.hash\n end", "def public_key_for_push_header\n trim_encode64(curve.public_key.to_bn.to_s(2))\n end", "def public_key_data\n @public_key\n end", "def hash\n to_s.hash\n end", "def hash\n return super unless has_size?\n\n res = 0\n each do |el|\n res += el.hash\n end\n return res\n end", "def get_hash()\n return @@hash;\n end" ]
[ "0.7262022", "0.62221134", "0.61998796", "0.6110589", "0.59888893", "0.59888893", "0.59888893", "0.59888893", "0.594417", "0.57995397", "0.5771863", "0.5764781", "0.5687812", "0.56190515", "0.5553423", "0.5553423", "0.5543121", "0.554274", "0.553105", "0.55155444", "0.54994816", "0.54689676", "0.54511636", "0.54242474", "0.5410043", "0.5409327", "0.5409327", "0.5409327", "0.5409327", "0.5409327", "0.5409327", "0.5409327", "0.5409327", "0.5409327", "0.53915864", "0.53573287", "0.5346651", "0.5338249", "0.5308832", "0.53001934", "0.52762604", "0.5273311", "0.52718276", "0.5267745", "0.5261815", "0.52576613", "0.52576613", "0.52576613", "0.52565575", "0.5246867", "0.52421147", "0.52421147", "0.5241648", "0.5235578", "0.5232858", "0.5232858", "0.52225196", "0.52200186", "0.52167016", "0.52167016", "0.5189936", "0.5165759", "0.5162757", "0.51619416", "0.515269", "0.51472205", "0.5140455", "0.5134314", "0.51289713", "0.5126615", "0.5126615", "0.5126615", "0.5126615", "0.5124309", "0.51152694", "0.51151544", "0.51029694", "0.5101508", "0.5101142", "0.5098066", "0.50952786", "0.509214", "0.5086377", "0.5085714", "0.5082341", "0.5072874", "0.50697404", "0.5068304", "0.50668955", "0.50668955", "0.5054973", "0.5048098", "0.50460833", "0.5045951", "0.5042678", "0.50362295", "0.50326914", "0.5029824", "0.50275034", "0.50165576" ]
0.7749287
0
Sets the identityPublisherHash property value. The Identity Publisher Hash.
def identity_publisher_hash=(value) @identity_publisher_hash = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_publisher_hash\n return @identity_publisher_hash\n end", "def publisher_id=(pub_id)\n @@publisher_id = pub_id\n end", "def publisher=(value)\n @publisher = value\n end", "def publisher=(value)\n @publisher = value\n end", "def publisher=(value)\n @publisher = value\n end", "def publisher=(value)\n @publisher = value\n end", "def verified_publisher=(value)\n @verified_publisher = value\n end", "def outgoing_command_hasher=(hasher)\n @out_command_hasher = hasher\n end", "def set_publisher\n\t\t\t@publisher = Publisher.find(params[:id])\n\t\tend", "def sgx_le_pub_key_hash0=(sgx_le_pub_key_hash0)\n pattern = Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n if !sgx_le_pub_key_hash0.nil? && sgx_le_pub_key_hash0 !~ pattern\n fail ArgumentError, \"invalid value for \\\"sgx_le_pub_key_hash0\\\", must conform to the pattern #{pattern}.\"\n end\n\n @sgx_le_pub_key_hash0 = sgx_le_pub_key_hash0\n end", "def app_publisher=(value)\n @app_publisher = value\n end", "def app_publisher=(value)\n @app_publisher = value\n end", "def sgx_le_pub_key_hash1=(sgx_le_pub_key_hash1)\n pattern = Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n if !sgx_le_pub_key_hash1.nil? && sgx_le_pub_key_hash1 !~ pattern\n fail ArgumentError, \"invalid value for \\\"sgx_le_pub_key_hash1\\\", must conform to the pattern #{pattern}.\"\n end\n\n @sgx_le_pub_key_hash1 = sgx_le_pub_key_hash1\n end", "def hashes=(value)\n @hashes = value\n end", "def incoming_command_hasher=(hasher)\n @in_command_hasher = hasher\n end", "def set_hash_id_instance(salt)\n @hid = Hashids.new(salt, 12)\n end", "def set_publisher\n @publisher = Publisher.find(params[:id])\n end", "def set_publisher\n @publisher = Publisher.find(params[:id])\n end", "def subscriber_hash(email)\n # Simple hash of the email address.\n Digest::MD5.hexdigest(email)\n end", "def set_hash(hash, hash_type = 'SHA256')\n @hash = hash\n @hash_type = hash_type\n end", "def publisher_id\n @@publisher_id\n end", "def hash= hash\n `window.location.hash = hash`\n end", "def subscriber_hash(email)\n Digest::MD5.hexdigest(email.downcase) unless email.nil?\n end", "def set_publisher\n @publisher = Publisher.cached_find(params[:publisher_id])\n end", "def publisher_name=(v)\n @publisher_name = v\n end", "def _hash=(_hash)\n if !_hash.nil? && _hash.to_s.length > 40\n fail ArgumentError, 'invalid value for \"_hash\", the character length must be smaller than or equal to 40.'\n end\n if !_hash.nil? && _hash.to_s.length < 40\n fail ArgumentError, 'invalid value for \"_hash\", the character length must be great than or equal to 40.'\n end\n @_hash = _hash\n end", "def publisher=(publisher_name)\n record.publisher = Publisher.find_by_name(publisher_name)\n @publisher = record.publisher || publisher_name\n end", "def book_publisher=(book_publisher)\n if !book_publisher.nil? && book_publisher.to_s.length > 50\n fail ArgumentError, 'invalid value for \"book_publisher\", the character length must be smaller than or equal to 50.'\n end\n\n @book_publisher = book_publisher\n end", "def pub_hash\n @pub_hash ||= WebOfScience::MapPubHash.new(self).pub_hash\n end", "def create_invite_hash!\n self.invite_hash = Digest::SHA2.new(256).update(\"#{self.serializable_hash}+#{Time.now}+jibffffrrrji!@#sh\").to_s[2..12]\n end", "def sha=(sha)\n @sha = sha ? string(sha) : nil\n end", "def publisher_name=(value)\n @publisher_name = value\n end", "def set hash\n hash.each_pair do |k,v|\n self.send(:\"#{k}=\", v)\n end\n \n self\n end", "def sgx_le_pub_key_hash2=(sgx_le_pub_key_hash2)\n pattern = Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n if !sgx_le_pub_key_hash2.nil? && sgx_le_pub_key_hash2 !~ pattern\n fail ArgumentError, \"invalid value for \\\"sgx_le_pub_key_hash2\\\", must conform to the pattern #{pattern}.\"\n end\n\n @sgx_le_pub_key_hash2 = sgx_le_pub_key_hash2\n end", "def set_outgoing_hash\n \n \t\tdata = \tself.class.get_payumoney_key + \"|\" + self.id.to_s + \"|\" + self.amount.to_s + \"|\" + get_product_info + \"|\" + get_first_name + \"|\" + get_email + \"|||||\" + get_udf5 + \"||||||\" + self.class.get_payumoney_salt\n\n \t\tself.outgoing_hash = Digest::SHA512.hexdigest(data)\n \tend", "def set_publisher\n @publisher = Publisher.find(params[:id])\n end", "def script_pubkey=(script_pubkey)\n values = [script_pubkey].pack('H*').unpack(\"C*\")\n @ver = values[0] == 0 ? values[0] : values[0] - 0x50\n @prog = values[2..-1]\n end", "def publisher=(new_publisher)\n if new_publisher.respond_to?(:name) &&\n new_publisher.respond_to?(:email) &&\n new_publisher.respond_to?(:url)\n # It's a complete Author object, just set it.\n @publisher = new_publisher\n else\n # We're not looking at an Author object, this is probably a string,\n # default to setting the publisher's name.\n if @publisher.nil?\n @publisher = FeedTools::Author.new\n end\n @publisher.name = new_publisher\n end\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def set_PublicKey(value)\n set_input(\"PublicKey\", value)\n end", "def hasher\n Hashids.new(@hash_id_state[:salt], @hash_id_state[:length])\n end", "def configure\n yield self\n @id_salt = DEFAULT_SALT if @id_salt.nil?\n set_hash_id_instance(@id_salt)\n end", "def serialize(hash, salt)\n hash + salt\n end", "def set_hash_tag\n @hash_tag = HashTag.find(params[:id])\n end", "def set(hash, &block)\n @compiler.set(hash, &block)\n end", "def store_encryption_key_sha\n self.encryption_key_sha = ENCRYPTION_KEY_SHA\n end", "def set_guestbook_signature\n @guestbook_signature = GuestbookSignature.find(params[:id])\n end", "def publisher_url=(v)\n @publisher_url = v ? URI.parse(v) : nil\n end", "def hash\n if @sha512hash != nil\n return @sha512hash.to_i(16)\n else\n super\n end\n end", "def pubkey_hash160\n if set_pubkey_hash160\n set_pubkey_hash160 \n elsif multisig_pubkey\n hash160 multisig_pubkey\n else\n hash160( pubkey )\n end\n end", "def set_user_signature\n @user_signature = UserSignature.find(params[:id])\n end", "def hash=(_arg0); end", "def set_user_push_key\n @user_push_key = UserPushKey.find(params[:id])\n end", "def identity_version=(value)\n @identity_version = value\n end", "def sgx_le_pub_key_hash3=(sgx_le_pub_key_hash3)\n pattern = Regexp.new(/^([0-9a-fA-F]{1,16})$|^(platform-default)$/)\n if !sgx_le_pub_key_hash3.nil? && sgx_le_pub_key_hash3 !~ pattern\n fail ArgumentError, \"invalid value for \\\"sgx_le_pub_key_hash3\\\", must conform to the pattern #{pattern}.\"\n end\n\n @sgx_le_pub_key_hash3 = sgx_le_pub_key_hash3\n end", "def []=(node, value)\n return @hash[node.sha1] = value\n end", "def set_hmac\n @hmac = Hmac.find(params[:id])\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def set_public_key\n @public_key = PublicKey.find(params[:id])\n end", "def generate_email_hash\n self.email_hash = Digest::MD5.hexdigest(self.email) if self.email.present?\n end", "def client_application_publisher_ids=(value)\n @client_application_publisher_ids = value\n end", "def set (hash)\n @data.merge! hash\n end", "def pub_hash_update(delete: false)\n publication.pub_hash[:identifier] = pub_hash_reject\n publication.pub_hash[:identifier] << identifier unless delete\n end", "def hash(ts)\n sig = [\n Rackspace::Email::Api.configuration.user_key,\n Rackspace::Email::Api.configuration.user_agent,\n ts,\n Rackspace::Email::Api.configuration.api_key\n ].join('')\n\n Base64.encode64(Digest::SHA1.digest(sig))\n end", "def set_publisher\n @publisher = Publisher.includes(:circulations).where(:id => params[:id], :admin_id => @current_user.id).first\n end", "def friend_public_key= value\n self[:friend_public_key] = value.to_s\n end", "def publish\n # TODO: move all of the _sm_ property processes into the wrapper\n _sm_header.published_at = Time.now\n _sm_header.publisher_pid = Process.pid\n\n payload = encode\n\n raise Errors::BrokerNotConfigured if broker_missing?\n broker.publish(_sm_header, payload)\n\n SS.add(_sm_header.message_class, 'publish')\n end", "def publisher\n @publisher ||= Publisher.new(self)\n end", "def set_WithPublicId(value)\n set_input(\"WithPublicId\", value)\n end", "def public_key=(k)\n return self.authentication.public_key = k\n end" ]
[ "0.641728", "0.61349046", "0.5713129", "0.5713129", "0.5713129", "0.5713129", "0.53256893", "0.5321547", "0.5266213", "0.5255182", "0.5234663", "0.5234663", "0.5196565", "0.51780987", "0.5134948", "0.51230896", "0.5120138", "0.5120138", "0.5106773", "0.5087401", "0.5058881", "0.5056991", "0.50484157", "0.50271684", "0.49907503", "0.4901322", "0.4886858", "0.48863184", "0.48833546", "0.48485136", "0.48174617", "0.48048285", "0.47824478", "0.4763706", "0.47491997", "0.4737013", "0.47261608", "0.4724869", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47132212", "0.47106606", "0.47105768", "0.470709", "0.4705407", "0.46743038", "0.46688557", "0.4653811", "0.46391186", "0.4619819", "0.4617983", "0.46176386", "0.46170866", "0.46051538", "0.45998964", "0.45944965", "0.458451", "0.45825118", "0.45780385", "0.45780385", "0.4573479", "0.4570877", "0.45686045", "0.45414114", "0.4533534", "0.4525442", "0.45225036", "0.4511718", "0.45116934", "0.44989574", "0.44938076" ]
0.8067959
0
Gets the identityResourceIdentifier property value. The Identity Resource Identifier.
def identity_resource_identifier return @identity_resource_identifier end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_resource_identifier=(value)\n @identity_resource_identifier = value\n end", "def resource_id\n return @resource_id\n end", "def resource_id\n return @resource_id\n end", "def resource_id\n return @resource_id\n end", "def resource_id\n\t\t\t\t\treturn self.send(self.class.resource_id_column)\n\t\t\t\tend", "def resource identifier\n Resource.new(Conjur::Authz::API.host, credentials)[self.class.parse_resource_id(identifier).join('/')]\n end", "def resource_id=(value)\n @resource_id = value\n end", "def resource_id=(value)\n @resource_id = value\n end", "def resource_id=(value)\n @resource_id = value\n end", "def id_of(resource_type, resource_name)\n output_of(resource_type, resource_name, :id)\n end", "def resource_id\n send self.class.resource_id\n end", "def resource_id\n return \"%s:%s\" % [self.resource_type, self.id]\n end", "def identity\n data = perform_get(IDENTITY_PATH)\n data || {}\n end", "def ensure_identifier\n # ensure an existing identifier is reserved (if needed for EZID)\n return resource.identifier.to_s if resource&.identifier&.identifier.present?\n\n resource.ensure_identifier(mint_id)\n end", "def safe_resource_identity(new_resource)\n new_resource.identity.to_s\n rescue => e\n \"unknown identity (due to #{e.class})\"\n end", "def provider_resource_id\n return @provider_resource_id\n end", "def polymorphic_id_for(resource)\n value_for(resource).id\n end", "def amazon_resource_id\n return @amazon_resource_id\n end", "def bare_identifier\n resource.identifier_str.gsub(/^doi:/, '')\n end", "def physical_resource_id\n \"#{self.class.name.split('::').last}-#{Carnivore.uuid}\"\n end", "def resource_id\n self.end_user_login\n end", "def identifier\n @record.uri.to_s\n end", "def identifier\n @identifiers[0]\n end", "def identity()\n\t\t\treturn @metadata.attributes[:identity].to_i\n\t\tend", "def primary_key\n @resource_options.fetch :primary_key, :\"#{singular_resource_name}_id\"\n end", "def identity_name\n return @identity_name\n end", "def identifier\n attributes.fetch(:identifier)\n end", "def identifier\n rdf_resource\n end", "def identifier_value\n user.icn\n end", "def resource_app_id\n return @resource_app_id\n end", "def amazon_resource_id=(value)\n @amazon_resource_id = value\n end", "def identifier\n self.class.identifier_for(send(self.class.identifying_attribute))\n end", "def resource_id\n @arn\n end", "def id\n self[:identifier]\n end", "def authority_key_identifier\n extensions[R509::Cert::Extensions::AuthorityKeyIdentifier]\n end", "def identifier\n @identifier ||= \"#{ATTRIBUTE_PREFIX}.#{Model::to_id @schema_ref}.#{Model::to_id @reference}\"\n end", "def identifier\n @identifier || (file && storage.try(:identifier))\n end", "def resource_id_column\n\t\t\t\t\t\traise \"Not implemented.\"\n\t\t\t\t\tend", "def reg_id\n @reg_id ||= StudentResource.find_by_system_key(system_key, false)\n end", "def identifier\n @info.identifier\n end", "def identifier\n @info.identifier\n end", "def dbi_resource_id\n data[:dbi_resource_id]\n end", "def resource_id_param\n params[:id]\n end", "def reg_id\n if read_attribute(:reg_id).blank?\n @reg_id ||= StudentResource.find_by_system_key(system_key, false)\n update_attribute(:reg_id, @reg_id)\n else\n @reg_id ||= read_attribute(:reg_id)\n end\n @reg_id\n end", "def oid\n id(get_oid())\n end", "def identity\n return @identity\n end", "def resource_reference\n return @resource_reference\n end", "def identifier\n id_value || super\n end", "def identifier\n @identifier ||= self.revlist.last\n end", "def identifier(resource_type, name)\n raise NotImplementedError, :identifier\n end", "def identity_version\n return @identity_version\n end", "def identifier\n sid_value || super\n end", "def resource_id(res)\n if res.is_a?(String)\n return res.split(/\\//).last.to_i\n else\n return res.href.split(/\\//).last.to_i\n end\n end", "def get_id()\n return @id\n end", "def id\n read_attribute(self.class.primary_key)\n end", "def id\n read_attribute(self.class.primary_key)\n end", "def provider_resource_id=(value)\n @provider_resource_id = value\n end", "def dbi_resource_id\n @dbi.dbi_resource_id\n end", "def dbi_resource_id\n @dbi.dbi_resource_id\n end", "def record_identifier(record)\n record.id\n end", "def incident_id\n @incident_id || IncidentId.new(self)\n end", "def get_identifier\n identifier = get_project_name\n fail(\n ActiveRecord::RecordNotFound,\n \"Project identifier not specified\"\n ) if identifier.nil?\n identifier.to_s\n end", "def resource_owner_id\n request.headers[\"Resource-Owner-Id\"]\n end", "def identifier\n @json['profile']['identifier'] rescue nil\n end", "def persistent_resource_id(resource)\n url = polymorphic_url(resource)\n content_tag :p, class: :id do\n content_tag(:strong) do\n \"#{Seek::Config.application_name} ID: \"\n end + ' ' + link_to(url, url)\n end\n end", "def r(resource_type, resource_name)\n resources.getIdentifier(resource_name.to_s, resource_type.to_s,\n activity.getApplicationInfo.packageName)\n end", "def get_identifier\n return @task_arn\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n return @resource_name\n end", "def resource_name\n return @resource_name\n end", "def identifier\n id || name || default_identifier\n end", "def ident\n ensure_valid\n @ident\n end", "def resource_owner_id\n env['HTTP_X_AUTHENTICATED_USERID']\n end", "def subject_key_identifier\n extensions[R509::Cert::Extensions::SubjectKeyIdentifier]\n end", "def resource_name\n @resource_name ||= get_resource_name\n end", "def custom_key_identifier\n return @custom_key_identifier\n end", "def custom_key_identifier\n return @custom_key_identifier\n end", "def ca_certificate_identifier\n data[:ca_certificate_identifier]\n end", "def principal_id\n return @principal_id\n end", "def principal_id\n return @principal_id\n end", "def id\n \"p-#{resource.id}\"\n end", "def key_id\n metadata[\"keyid\"]\n end", "def lease_id\n properties[\"x-ms-lease-id\"]\n end", "def incident_id\n @attrs['IncidentID']\n end", "def identity_type\n return @identity_type\n end", "def get_resource_type_identifier(type)\n get_type_identifier(type, Occi::Core::Resource.kind)\n end", "def roleid\n [ account, kind, identifier ].join(':')\n end", "def id\n special_attribute('@rid'.freeze)\n end", "def getIdString\r\n\t\t\t\t\r\n\t\t\t\t\treturn @idString\r\n\t\t\t\t\t\r\n\t\t\t\tend", "def getIdString\r\n\t\t\t\t\r\n\t\t\t\t\treturn @idString\r\n\t\t\t\t\t\r\n\t\t\t\tend", "def to_i\n @id\n end", "def to_i\n @id\n end", "def to_i\n @id\n end", "def to_i\n @id\n end", "def id\n @properties[self.class.primary_key].to_i unless new_record?\n end", "def get_id()\n return @id\n end", "def get_resource resource_uuid\n return resource_uuid if resource_uuid.is_a?(Resource)\n \n tmp = @resources.find{|res|res.uuid == resource_uuid}\n \n raise \"unknown resource with uuid #{resource_uuid}\" unless tmp\n \n tmp\n end", "def id\n ref = JSONModel::parse_reference(self.uri)\n\n if ref\n ref[:id]\n else\n nil\n end\n end", "def identifier\n identifiers = geo_concern.identifier\n if identifiers.nil? || identifiers.empty?\n geo_concern.id\n elsif identifiers.is_a?(String)\n identifiers\n else\n identifiers.first\n end\n end", "def internal_resource\n attributes[:internal_resource]\n end" ]
[ "0.79088676", "0.67911166", "0.67911166", "0.67911166", "0.6789129", "0.6429631", "0.6417267", "0.6417267", "0.6417267", "0.6131746", "0.6023177", "0.5972557", "0.58868754", "0.58250946", "0.579673", "0.57639194", "0.5756805", "0.57225823", "0.5676673", "0.56735003", "0.567346", "0.566339", "0.56387377", "0.55561894", "0.5543455", "0.55342036", "0.5525684", "0.54866827", "0.54585373", "0.5441553", "0.54360104", "0.54265857", "0.54253983", "0.5425199", "0.5412619", "0.53977907", "0.5384951", "0.5373439", "0.5358859", "0.53550965", "0.53550965", "0.53512657", "0.5327293", "0.53236246", "0.5305434", "0.5284972", "0.5283936", "0.52825093", "0.52802706", "0.52779907", "0.5249664", "0.5245514", "0.52351207", "0.5218827", "0.51971614", "0.51971614", "0.5180897", "0.51806307", "0.51806307", "0.51642454", "0.5150468", "0.51262903", "0.512152", "0.5121237", "0.5119297", "0.5119131", "0.5118597", "0.5111723", "0.5111723", "0.5111723", "0.5046972", "0.5026925", "0.5026428", "0.49821666", "0.49784917", "0.4978407", "0.4978407", "0.4977339", "0.49767226", "0.49767226", "0.4975231", "0.4969142", "0.4968921", "0.496859", "0.4957766", "0.49551123", "0.49373037", "0.49341664", "0.49310187", "0.49310187", "0.49229482", "0.49229482", "0.49229482", "0.49229482", "0.49160078", "0.49009916", "0.4892562", "0.48875996", "0.48850894", "0.48806766" ]
0.85948515
0
Sets the identityResourceIdentifier property value. The Identity Resource Identifier.
def identity_resource_identifier=(value) @identity_resource_identifier = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_id=(value)\n @resource_id = value\n end", "def resource_id=(value)\n @resource_id = value\n end", "def resource_id=(value)\n @resource_id = value\n end", "def resource_id(resource_id)\n Apipie.set_resource_id(@controller, resource_id)\n end", "def identity_resource_identifier\n return @identity_resource_identifier\n end", "def amazon_resource_id=(value)\n @amazon_resource_id = value\n end", "def identifier=(identifier)\n instance_set(:identifier, identifier)\n end", "def set_identifier\n @identifier = Identifier.find(params[:id])\n end", "def set_identifier\n @identifier = Identifier.find(params[:id])\n end", "def provider_resource_id=(value)\n @provider_resource_id = value\n end", "def identifier=(value)\n setId(value)\n end", "def id=(identifier)\n @id = identifier\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def resource=(value)\n @resource = value\n end", "def resource=(value)\n @resource = value\n end", "def resource=(value)\n @resource = value\n end", "def resource=(value)\n @resource = value\n end", "def resource=(value)\n @resource = value\n end", "def resource=(value)\n @resource = value\n end", "def resource_app_id=(value)\n @resource_app_id = value\n end", "def identifier=(identifier)\n if identifier.nil?\n fail ArgumentError, 'identifier cannot be nil'\n end\n\n if identifier.to_s.length > 50\n fail ArgumentError, 'invalid value for \"identifier\", the character length must be smaller than or equal to 50.'\n end\n\n if identifier.to_s.length < 4\n fail ArgumentError, 'invalid value for \"identifier\", the character length must be great than or equal to 4.'\n end\n\n @identifier = identifier\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def resource=(resource)\n set_or_terminate do\n @resource = resource\n end\n end", "def identifier=(identifier)\n if identifier.nil?\n fail ArgumentError, \"identifier cannot be nil\"\n end\n\n if identifier.to_s.length > 15\n fail ArgumentError, \"invalid value for 'identifier', the character length must be smaller than or equal to 15.\"\n end\n\n @identifier = identifier\n end", "def identifier=(identifier)\n if identifier.nil?\n fail ArgumentError, \"identifier cannot be nil\"\n end\n\n if identifier.to_s.length > 15\n fail ArgumentError, \"invalid value for 'identifier', the character length must be smaller than or equal to 15.\"\n end\n\n @identifier = identifier\n end", "def set_resource\n @user = current_user\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def identifier=(identifier)\n if identifier.nil?\n fail ArgumentError, \"identifier cannot be nil\"\n end\n\n if identifier.to_s.length > 25\n fail ArgumentError, \"invalid value for 'identifier', the character length must be smaller than or equal to 25.\"\n end\n\n @identifier = identifier\n end", "def set_identifiers\n identifier.tap do |i|\n i.value = user.icn\n i.system = SYSTEM_ID\n i.type = identifier_type\n end\n end", "def resource=(record)\n instance_variable_set(\"@#{resource_name}\", record)\n end", "def set_identity\n @identity = Identity.find_by uuid: params['uuid']\n end", "def openid_identifier=(value)\n write_attribute(:openid_identifier, value.blank? ? nil : OpenIdAuthentication.normalize_identifier(value))\n reset_persistence_token if openid_identifier_changed?\n rescue OpenIdAuthentication::InvalidOpenId => e\n @openid_error = e.message\n end", "def openid_identifier=(value)\n write_attribute(:openid_identifier, value.blank? ? nil : OpenIdAuthentication.normalize_identifier(value))\n reset_persistence_token if openid_identifier_changed?\n rescue OpenIdAuthentication::InvalidOpenId => e\n @openid_error = e.message\n end", "def set_resource(resource_key, id, object)\n resource_cache(resource_key)[id] = object\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_resource(resource = nil)\n resource ||= resource_class.find_by_id(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def set_resource(resource = nil)\n resource ||= resource_class_name.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def resource identifier\n Resource.new(Conjur::Authz::API.host, credentials)[self.class.parse_resource_id(identifier).join('/')]\n end", "def set_Identifier(value)\n set_input(\"Identifier\", value)\n end", "def identity=(value)\n @identity = value\n end", "def resource_reference=(value)\n @resource_reference = value\n end", "def set_resource_item\n @resource_item = ResourceItem.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_resource\n @resource = Resource.find(params[:id])\n end", "def set_imagecollection_imagesource(identifier: nil)\n fail 'The image collection identifier needs to be set.' if identifier.nil?\n @elementHash[:imageidentifier] = identifier\n @elementHash\n end", "def set_digital_object_identifier\n @digital_object_identifier = DigitalObjectIdentifier.find(params[:id])\n end", "def set_resource_ivar(resource) #:nodoc:\n instance_variable_set(\"@#{resource_instance_name}\", resource)\n end", "def set_resource(resource_variable = nil)\n resource_variable ||= resource_class.find(params[:id])\n instance_variable_set(:\"@#{resource_name}\", resource_variable)\n end", "def resource=(v)\n @resource = v.to_s\n if USE_STRINGPREP\n @resource = IDN::Stringprep.nodeprep(@resource)\n end\n end", "def set_Identifier(value)\n set_input(\"Identifier\", value)\n end", "def set_resource(resource = nil)\n resource ||= resource_class.find_by!(id: params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def ensure_identifier\n # ensure an existing identifier is reserved (if needed for EZID)\n return resource.identifier.to_s if resource&.identifier&.identifier.present?\n\n resource.ensure_identifier(mint_id)\n end", "def resource=(new_resource)\n @resource = @resource.merge(new_resource)\n end", "def set_resource_ivar(resource) #:nodoc:\n instance_variable_set(\"@#{resource_instance_name}\", resource)\n end", "def set_resource(resource = nil)\n\t\t\t\tresource ||= resource_class.find_by(id: params[:id])\n\t\t\t\tif !resource\n\t\t\t\t\trespond_with_error(resource_name + \" med id \" + params[:id] + \" hittades inte\", :not_found)\n\t\t\t\tend\n\t\t\t\tinstance_variable_set(\"@#{resource_name}\", resource)\n\t\t\tend", "def set_resource(resource = nil)\n resource ||= resource_class.find(params[:id])\n check_action_whitelisted!(params[:action])\n authorize! params[:action].to_sym, resource\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def set_resource(resource = nil)\n resource ||= resource_class.friendly.find(params[:id])\n instance_variable_set(\"@#{resource_name}\", resource)\n end", "def update_identity(identity_uuid, params = {})\n scope 'default'\n put_one(\"identity\", identity_uuid, params)\n end", "def set_resident\n @resident = Resident.find(params[:id])\n end", "def set_resident\n @resident = Resident.find(params[:id])\n end", "def set_resident\n @resident = Resident.find(params[:id])\n end", "def set_resident\n @resident = Resident.find(params[:id])\n end", "def set_resource\n @resource = resource_class.find_by(id: params[:id])\n end", "def resource=(new_resource)\n instance_variable_set(:\"@#{resource_name}\", new_resource)\n end", "def set_current_identity\n Identity.current_identity = @current_identity\n end", "def resource_id\n return @resource_id\n end", "def resource_id\n return @resource_id\n end", "def resource_id\n return @resource_id\n end", "def identifier_uris=(value)\n @identifier_uris = value\n end", "def assign_id\n self.id = self.class.identifier(self.module, resource, action)\n end", "def identity=(v)\n @identity = v\n end", "def set_identifier\n self.identifier ||= SecureRandom.uuid\n end", "def set_identifier\n self.identifier = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end", "def set_resource\n @resource = @resource_class.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n @identity = @identity.user_id == session[:user_id] ? @identity : nil\n end", "def update!(**args)\n @resource_id = args[:resource_id] if args.key?(:resource_id)\n end", "def principal_id=(value)\n @principal_id = value\n end", "def principal_id=(value)\n @principal_id = value\n end", "def set_resource_ivar(resource) #:nodoc:\n instance_variable_set(\"@#{resource_instance_name}\", resource)\n end", "def set_InvoiceID(value)\n set_input(\"InvoiceID\", value)\n end", "def set_resource_management4\n @resource_management4 = ResourceManagement4.find(params[:id])\n end" ]
[ "0.70811224", "0.70811224", "0.70811224", "0.6454386", "0.63288367", "0.6233248", "0.58926857", "0.57745105", "0.57745105", "0.574675", "0.5626062", "0.5456853", "0.53346324", "0.53346324", "0.53346324", "0.5314172", "0.5314172", "0.5314172", "0.5314172", "0.5314172", "0.5314172", "0.5248898", "0.52417225", "0.52361166", "0.52271587", "0.5200084", "0.5200084", "0.5179016", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.5175261", "0.51713794", "0.51713794", "0.5161999", "0.5138888", "0.5133905", "0.5127196", "0.50853944", "0.50853944", "0.5065224", "0.5053695", "0.5033836", "0.5028462", "0.50182503", "0.5010125", "0.49874613", "0.49575868", "0.49486485", "0.49456394", "0.49456394", "0.49456394", "0.49456394", "0.49456394", "0.49456394", "0.49193195", "0.49187994", "0.4915915", "0.4892789", "0.48896578", "0.486978", "0.48575178", "0.48459226", "0.4827202", "0.48266035", "0.4819932", "0.481724", "0.48009288", "0.48008245", "0.47873846", "0.47873846", "0.47873846", "0.47873846", "0.4785714", "0.4773597", "0.4759638", "0.47489408", "0.47489408", "0.47489408", "0.47453862", "0.47430342", "0.4728852", "0.47277084", "0.47164834", "0.47125095", "0.46975523", "0.46909812", "0.46903047", "0.46903047", "0.46856093", "0.4672183", "0.4665682" ]
0.84304595
0
Gets the identityVersion property value. The identity version.
def identity_version return @identity_version end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_version=(value)\n @identity_version = value\n end", "def version_id\n return @version_id\n end", "def version_number\n return @version_number\n end", "def version_number\n @version\n end", "def version\n version_property ? version_property.ruby_value : nil\n end", "def version\n @attributes[:version]\n end", "def version\n @attributes[:version]\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n attributes.fetch(:version)\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n return @version\n end", "def version\n read_property 'Version'\n end", "def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend", "def version_id=(value)\n @version_id = value\n end", "def identity()\n\t\t\treturn @metadata.attributes[:identity].to_i\n\t\tend", "def version_number\n @version ||= nil\n end", "def version\n @version\n end", "def version\n return last_version if versionable?\n version_number\n end", "def version\n @version ||= create_version\n end", "def version\n @context[:version]\n end", "def version\n @version ||= __determine_version\n end", "def version_id\n self.get_column(\"Entry_ID/Version\")\n end", "def version\n self[:version]\n end", "def version\n @__version\n end", "def version\n @version || 0\n end", "def version_property\n @version_property ||= RiCal::PropertyValue::Text.convert(self, \"2.0\")\n end", "def version_external_identifier\n read('version_external_identifier')\n end", "def application_version\n return @application_version\n end", "def application_version\n return @application_version\n end", "def config_version\n @attributes[:config_version]\n end", "def version_number\n if self.unversioned?\n 0\n else\n self.versions.current.number\n end\n end", "def version\n Cleaner.extract_version @id\n end", "def version\n @db.send(:get_int_pragma, 'user_version')\n end", "def version\n @version ||= data.version\n end", "def version(value = nil)\n if value.nil?\n @version\n else\n @version = value\n end\n end", "def version\n\t\treturn @version ||= self.find_version\n\tend", "def version\n return @discovery_document['version']\n end", "def to_s\n @version\n end", "def to_s\n @version\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def version\n @version_obj ||= fetcher.get(Fastly::Version, service_id, version_number)\n end", "def to_s\n @version\n end", "def version\n @ole.Version\n end", "def version(version = nil)\n @version = version if version\n @version\n end", "def version\n root.attribute('version').value.split('.').map { |n| n.to_i }\n end", "def version\n LOG_STAT()\n id = id_gen()\n LOG_CALL(id, true, __method__)\n defer { LOG_CALL(id, false, 'version') }\n return VERSION\n end", "def version\n fetch('vehicle.version')\n end", "def ver\n @values['ver']\n end", "def _version\n special_attribute('@version'.freeze)\n end", "def get_version\n request('getVersion')\n end", "def environment_version\n metadata[:environment_version]\n end", "def app_version\n return @app_version\n end", "def app_version\n return @app_version\n end", "def client_version\n ClientVersion\n end", "def version\n version_file = File.join(RAILS_ROOT, \"config\", \"version.ini\")\n current_version = if File.exists? version_file\n File.read(version_file)\n else\n \"0.0.1\"\n end\n current_version.strip\n end", "def version\n @version.dup\n end", "def version\n @version.dup\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def application_version\n read('application_version')\n end", "def version\n @version ||= version_hex.to_s(16).chars.entries.join('.')\n end", "def version\n get_scm_data if @_version.nil?\n @_version\n end", "def current_version\n @version\n end", "def version_id\n \"#{size}+#{timestamp}-#{md5}\"\n end", "def version\n self.class.version\n end", "def version_name\n if inside_association?\n \"#{proxy_reflection.name}_version\"\n else\n \"version\"\n end\n end", "def version\n @version ||= @doc.at('/document/@SSLyzeVersion').value.split(' ',2).last\n end", "def version\n v = @properties['VERSION']\n\n unless v\n raise InvalidEncodingError, \"Invalid calendar, no version field!\"\n end\n\n v = v.to_f * 10\n v = v.to_i\n end", "def versioning\n identifier(audit_db, \"_v_#{name}\")\n end", "def version\n VERSION\n end", "def apiversion\n @attributes.fetch('apiversion', nil)\n end", "def version_number=(value)\n @version_number = value\n end", "def version_info\n (Wrapper.msc_who_am_i @msc_ptr).to_s\n end", "def current_version\n version_number rev\n end", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def version\n resolved_version\n end", "def version # :nodoc:\n if document.present?\n document.version\n else\n @metadata[:version]\n end\n end", "def version_info\n return @children['version-info'][:value]\n end", "def logical_version_number\n @logical_version_number || self.current_version\n end", "def identity\n return @identity\n end", "def get_server_version\n server_info[:server_version]\n end", "def version\n endpoint.config.version\n end" ]
[ "0.8012434", "0.7202184", "0.71312004", "0.70702577", "0.67199373", "0.6626703", "0.6626703", "0.66263837", "0.66263837", "0.66263837", "0.66263837", "0.66263837", "0.65953803", "0.65953803", "0.65953803", "0.65953803", "0.65953803", "0.65953803", "0.65953803", "0.65953803", "0.65953803", "0.65569365", "0.6499464", "0.6489007", "0.6371239", "0.63615656", "0.6319364", "0.6316389", "0.6301781", "0.6258936", "0.62235284", "0.6197023", "0.6136604", "0.61290145", "0.6106888", "0.6091804", "0.6091525", "0.60847074", "0.60847074", "0.60770684", "0.6065244", "0.6043318", "0.60401416", "0.60344", "0.59874725", "0.59849393", "0.59825873", "0.59771436", "0.59771436", "0.59684044", "0.59684044", "0.59460557", "0.594423", "0.5935911", "0.59315586", "0.5920827", "0.5919594", "0.59175014", "0.59138644", "0.5905267", "0.5893232", "0.58847237", "0.58847237", "0.5855406", "0.58543396", "0.58489525", "0.58489525", "0.584517", "0.584517", "0.584517", "0.584517", "0.584517", "0.584517", "0.584517", "0.584517", "0.584517", "0.5842971", "0.58394295", "0.582095", "0.58084065", "0.5799399", "0.57962674", "0.5782534", "0.57788795", "0.5775026", "0.57653695", "0.57555807", "0.5754605", "0.57543516", "0.57468325", "0.5739142", "0.5724524", "0.5724524", "0.57244426", "0.57231265", "0.568831", "0.56834567", "0.5680281", "0.5672061", "0.56675303" ]
0.86396176
0
Sets the identityVersion property value. The identity version.
def identity_version=(value) @identity_version = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_id=(value)\n @version_id = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version=(value)\n @version = value\n end", "def version_number=(value)\n @version_number = value\n end", "def setVersion(version)\r\n\t\t\t\t\t@version = version\r\n\t\t\t\tend", "def version=(version)\n @version = version\n end", "def version=(v)\n @version = v\n end", "def set(new_version)\n self.version = new_version\n end", "def version=(version)\n mutate_config(:version) { version.dup }\n end", "def version=(version) # :nodoc:\n @fields['version'] = version.to_s\n end", "def identity_version\n return @identity_version\n end", "def identity=(v)\n @identity = v\n end", "def version=(value)\n @children['version'][:value] = value\n end", "def version=(value)\n @children['version'][:value] = value\n end", "def version=(arg)\n @version = arg.to_s\n end", "def requested_access_token_version=(value)\n @requested_access_token_version = value\n end", "def set_version\n @version = Version.find(params[:id])\n end", "def identity=(value)\n @identity = value\n end", "def application_version=(value)\n @application_version = value\n end", "def application_version=(value)\n @application_version = value\n end", "def exif_version=(exif_version)\n if !exif_version.nil? && exif_version !~ Regexp.new(/^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$/)\n fail ArgumentError, 'invalid value for \"exif_version\", must conform to the pattern /^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=)?$/.'\n end\n\n @exif_version = exif_version\n end", "def major_version=(val)\n self.major_number = val\n end", "def app_version=(value)\n @app_version = value\n end", "def app_version=(value)\n @app_version = value\n end", "def notification_key_version_id=(value)\n @children['notification-key-version-id'][:value] = value\n end", "def configuration_version=(value)\n @configuration_version = value\n end", "def version=(version)\n case version\n when VersionNumber\n @version = version\n when Hash\n major = version['major']\n minor = version['minor']\n patch = version['patch']\n build = version['build']\n\n @version = VersionNumber.new(major,minor,patch,build)\n when String\n @version = VersionNumber.parse(version.to_s)\n else\n raise(InvalidMetadata,\"version must be a Hash or a String\")\n end\n end", "def default_version=(v)\n @default_version = v\n end", "def set_version\n if @properties\n @properties.each{|p| p.extend(version_module)}\n else\n @property.extend(version_module)\n end\n end", "def sslversion=(value)\n Curl.set_option(:sslversion, value_for(value, :enum, :sslversion), handle)\n end", "def ver=(value)\n @values['ver'] = value\n end", "def db_version=(version)\n Neo4j::Transaction.run do\n migration_meta_node[:_db_version] = version\n end\n end", "def version(value = nil)\n if value.nil?\n @version\n else\n @version = value\n end\n end", "def set_version\n self.version ||= latest_version + 1\n end", "def set_version_user(version, user)\n unless @versions.key?(OcflTools::Utils.version_int_to_string(version))\n raise OcflTools::Errors::RequestedKeyNotFound, \"Version #{version} does not yet exist!\"\n end\n\n @versions[OcflTools::Utils.version_int_to_string(version)]['user'] = user\n end", "def version(version)\n @@version = version\n end", "def set_model_version\n @model_version = ModelVersion.find(params[:id])\n end", "def min_version=(version)\n unless MIN_MAX_VERSIONS.include? version\n raise ArgumentError, \"Invalid SSL min_version #{version.inspect}\\n\" +\n \"Please specify one of #{MIN_MAX_VERSIONS.inspect}\"\n end\n\n @min_version = version\n end", "def version(version = nil)\n @version = version if version\n @version\n end", "def ver=(value)\n if value == @defaults['ai.application.ver']\n @values.delete 'ai.application.ver' if @values.key? 'ai.application.ver'\n else\n @values['ai.application.ver'] = value\n end\n end", "def version=(version)\n swap(\n @config,\n /\\$config\\['app_version'\\] = '.*?';/i,\n \"$config['app_version'] = '#{version}';\"\n )\n end", "def set_version(override_version=nil)\n versioned_request = VersionCake::VersionedRequest.new(request, override_version)\n @requested_version = versioned_request.extracted_version\n @derived_version = versioned_request.version\n @is_latest_version = versioned_request.is_latest_version?\n if !versioned_request.is_version_supported?\n raise UnsupportedVersionError.new('Unsupported version error')\n end\n @_lookup_context.versions = versioned_request.supported_versions\n end", "def ibooks_version(val)\n @book.ibooks_version=val\n end", "def ssl_version=(version)\n unless SSL_VERSIONS.include? version\n raise ArgumentError, \"Invalid SSL version #{version.inspect}\\n\" +\n \"Please specify one of #{SSL_VERSIONS.inspect}\"\n end\n\n @ssl_version = version\n end", "def soap_version=(version)\n raise ArgumentError, \"Invalid SOAP version: #{version}\" unless SOAP::Versions.include? version\n @version = version\n end", "def assign_specification_version(specification:)\n specification.version = value\n self\n end", "def version_number\n @version\n end", "def major_version=(val)\n if (val.kind_of?(Integer))\n @major_version = val & 0xf\n else\n raise ArgumentError, \"Expected Integer, but #{val.class} provided.\" \n end \n end", "def ver=(value)\n if value == @defaults['ver']\n @values.delete 'ver' if @values.key? 'ver'\n else\n @values['ver'] = value\n end\n end", "def openurl_ver=(ver)\n @openurl_ver = ver\n @admin[\"ctx_ver\"][\"value\"] = ver\n end", "def version_number\n @version ||= nil\n end", "def version=(string)\n @table[:version] = Version::Number.new(string) if string\n end", "def __assign_version(data)\n data[self.class::VERSION_MEMBER] = self.class::VERSION_NUMBER\n end", "def version_id\n return @version_id\n end", "def version=(newversion)\t\n notice \"Version of #{resource[:name]} does not match the required version.\"\n destroy\n create\n end", "def template_version_id=(template_version_id)\n pattern = Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n if !template_version_id.nil? && template_version_id !~ pattern\n fail ArgumentError, \"invalid value for \\\"template_version_id\\\", must conform to the pattern #{pattern}.\"\n end\n\n @template_version_id = template_version_id\n end", "def version(str)\n @version = str\n end", "def setVersions(versions)\r\n\t\t\t\t\t@versions = versions\r\n\t\t\t\tend", "def http_version=(value)\n Curl.set_option(:http_version, value_for(value, :enum, :http_version), handle)\n end", "def update_identity(identity_uuid, params = {})\n scope 'default'\n put_one(\"identity\", identity_uuid, params)\n end", "def set_version revision\n # this call is idempotent for a given kudu run\n return if version_updated\n if /\\d+\\.\\d+\\.\\d+/ =~ revision\n self.version = revision\n else\n major_minor_file = File.join(directory, 'MAJOR_MINOR_VER')\n major_minor = File.exist?(major_minor_file) ? IO.read(major_minor_file) : '1.0'\n self.version = major_minor + \".\" + revision\n end\n ver_file = File.join(directory, 'VERSION')\n IO.write(ver_file, self.version)\n end", "def version=(val)\n if (val.kind_of?(Integer)) \n make_major_minor_version(val & 0xff)\n elsif(val.kind_of?(String))\n raise ArgumentError, \"Value should be 1-byte, but was #{val.length}.\" if (val.length != 1) \n make_major_minor_version(val.unpack('C')[0])\n else\n raise ArgumentError, \"Expected Integer, but #{val.class} provided.\" \n end\n end", "def schema_version=(schema_version)\n if schema_version.nil?\n fail ArgumentError, 'invalid value for \"schema_version\", schema_version cannot be nil.'\n end\n @schema_version = schema_version\n end", "def requirement=(version_requirement)\n @requirement = VersionRequirement.create(version_requirement.to_s)\n end", "def version(ver)\n Runner.instance.version = ver\n end", "def identity(options = {})\n self._identity = options\n end", "def os_version=(value)\n if value == @defaults['ai.device.osVersion']\n @values.delete 'ai.device.osVersion' if @values.key? 'ai.device.osVersion'\n else\n @values['ai.device.osVersion'] = value\n end\n end", "def version_number\n return @version_number\n end", "def platform_version=(value)\n @platform_version = value\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_identity\n @identity = Identity.find(params[:id])\n end", "def set_version_control\n @version_control = VersionControl.find(params[:id])\n end", "def ssl_version= ssl_version\n @agent.ssl_version = ssl_version\n end", "def version value = nil\n return @version if value.nil?\n @version = value\n end", "def set_identity\n @identity = Identity.find_by uuid: params['uuid']\n end", "def max_version=(version)\n unless MIN_MAX_VERSIONS.include? version\n raise ArgumentError, \"Invalid SSL max_version #{version.inspect}\\n\" +\n \"Please specify one of #{MIN_MAX_VERSIONS.inspect}\"\n end\n\n @max_version = version\n end", "def versioning_enabled=(value)\n @@versioning_enabled = value\n end", "def version(version_rule)\n raise \"No version plan is defined - cannot use 'version'\" unless version_plan\n\n @version_rule = version_rule\n end", "def operating_system_version=(value)\n @operating_system_version = value\n end", "def operating_system_version=(value)\n @operating_system_version = value\n end", "def initialize(version)\n @version = version\n end", "def app_version=(v)\n Axlsx.validate_string v\n @app_version = v\n end", "def set_version(version)\n file_sub(GEMSPEC, /(\\.version\\s*=\\s*).*/, \"\\\\1'#{version}'\")\n file_sub(VERSION_RB, /^(\\s*VERSION\\s*=\\s*).*/, \"\\\\1'#{version}'\")\nend", "def resp_version=(resp_version)\n if resp_version.nil?\n fail ArgumentError, 'invalid value for \"resp_version\", resp_version cannot be nil.'\n end\n @resp_version = resp_version\n end", "def attachment_template_version_id=(attachment_template_version_id)\n pattern = Regexp.new(/^vrsn_[a-zA-Z0-9]+$/)\n if !attachment_template_version_id.nil? && attachment_template_version_id !~ pattern\n fail ArgumentError, \"invalid value for \\\"attachment_template_version_id\\\", must conform to the pattern #{pattern}.\"\n end\n\n @attachment_template_version_id = attachment_template_version_id\n end", "def mark_version\n @rubygems_version = Gem::VERSION\n end", "def set_version_message(version, message)\n unless @versions.key?(OcflTools::Utils.version_int_to_string(version))\n raise OcflTools::Errors::RequestedKeyNotFound, \"Version #{version} does not yet exist!\"\n end\n\n @versions[OcflTools::Utils.version_int_to_string(version)]['message'] = message\n end", "def committed_content_version=(value)\n @committed_content_version = value\n end", "def set_version\n if request.post?\n @page = Comatose::Page.find_is_snippet params[:id]\n @version_num = params[:version]\n @page.revert_to!(@version_num)\n end\n redirect_to :controller=>self.controller_name, :action=>'index'\n end", "def set_package_version\n @package_version = PackageVersion.find(params[:id])\n end", "def ssl_version=(ssl_version); end", "def ssl_version=(ssl_version); end" ]
[ "0.69507086", "0.6835644", "0.6835644", "0.6835644", "0.6835644", "0.6835644", "0.6835644", "0.6835644", "0.6835644", "0.6835644", "0.6761322", "0.6648685", "0.6618371", "0.6590801", "0.65704435", "0.6199865", "0.615906", "0.6068511", "0.6020224", "0.6013223", "0.6013223", "0.5992168", "0.59852374", "0.5936682", "0.59277964", "0.585333", "0.585333", "0.5785774", "0.57259583", "0.57193047", "0.57193047", "0.56943727", "0.5655311", "0.56432205", "0.5582131", "0.5518161", "0.5492743", "0.548328", "0.54704183", "0.5441468", "0.5418354", "0.5412758", "0.5379186", "0.53564423", "0.535484", "0.5342685", "0.53340656", "0.5321461", "0.5302183", "0.52806145", "0.5272071", "0.5260669", "0.5255747", "0.5250589", "0.5224927", "0.5155278", "0.51300174", "0.51160455", "0.5104407", "0.5104145", "0.51040965", "0.50998515", "0.5093437", "0.50860476", "0.50686777", "0.50650436", "0.5061168", "0.50552565", "0.504844", "0.5043545", "0.5031832", "0.5031106", "0.5023056", "0.49804372", "0.4979733", "0.49785", "0.4975784", "0.4975784", "0.4975784", "0.49723285", "0.4971248", "0.49683765", "0.4955439", "0.4938575", "0.49315608", "0.4919675", "0.4908895", "0.4908895", "0.49037725", "0.49018437", "0.48984474", "0.48865232", "0.48821416", "0.4876862", "0.4875431", "0.48748958", "0.48738724", "0.4870908", "0.4870411", "0.4870411" ]
0.842419
0
Gets the isBundle property value. Whether or not the app is a bundle.
def is_bundle return @is_bundle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bundled?\n $BUNDLE || ENV.key?(\"BUNDLE\")\n end", "def is_bundle=(value)\n @is_bundle = value\n end", "def bundle?\n @descriptive_detail.bundle?\n end", "def bundle_exists?\n File.exists? self.bundle_dir\n end", "def bundle?\n @product_composition.human == \"MultipleComponentRetailProduct\"\n end", "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def bundler?\n @bundler ||= File.exist?(\"#{ Dir.pwd }/Gemfile\")\n end", "def not_priced?\n bundle? || has_variants?\n end", "def bundle()\n merge(notbundle: 'true')\n end", "def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end", "def bundle_name; bundle.bundle_name; end", "def bundle\n @bundle ||= Bundle.load(@path)\n end", "def bundle_id\n return @bundle_id\n end", "def bundled?(filename); end", "def complete_app_install?(app_bundle_dir)\n base_dir = File.dirname(app_bundle_dir)\n plist = File.join(base_dir, METADATA_PLIST)\n File.exist?(plist)\n end", "def is_js_bundle(path)\n path = path.to_s\n file_extension = extract_file_extension path\n\n if file_extension\n JS_EXTENSIONS.include? file_extension\n else\n JS_EXTENSIONS.any? {|ext| path.include? \"/#{ext}/\" }\n end\n end", "def bundle_id\n read('bundle_id')\n end", "def match_bundle_type\n self.original_file_types & BUNDLE_TYPES\n end", "def vendored_bundler?\n false\n end", "def bundle_for(bundle_name)\n bundle_name = bundle_name.to_sym\n @bundles ||= {}\n return @bundles[bundle_name] ||= Bundle.new(bundle_name, environment_for(bundle_name))\n end", "def application?\n gem_dir\n end", "def application?\n gem_dir\n end", "def started? (name)\n bundle = list_bundles.find {|b| b[:name] == name}\n bundle[0][:context] == 'Started'\n end", "def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end", "def bundle_id\n @attributes[:bundle_id]\n end", "def bundle_id\n @attributes[:bundle_id]\n end", "def bundle_directory\n @yaml[\"paths\"][\"bundle_directory\"]\n end", "def path\n @bundle_filename\n end", "def bundle_name\n info_plist[\"CFBundleDisplayName\"] || info_plist[\"CFBundleName\"]\n end", "def gem?\n @gem\n end", "def files(bundle = true)\n (@app and bundle) ? ::Asset.bundle[@type] : [@path]\n end", "def needs_rebundle?\n # Right now compression is the only option that requires rebundling\n @options_hash != options_hash.hash\n end", "def vendor_bundle?(some_path)\n # Cache bundle information, as it is (1) time consuming to fetch and (2) not going to change while we run\n if @vendor_bundle_cache.nil?\n bundle_info = Host.run_and_capture(\"bundle show --paths\")\n if !bundle_info[:success]\n # if the bundle show command fails, assume there isn't a bundle\n @vendor_bundle_cache = false\n else\n # Get all the places where gems are stored. We combine a few things here:\n # by preemptively switching to the parent directory, we can both ensure that\n # we skip any gems that are equal to the working directory AND exploit some\n # commonality in the paths to cut down our search locations\n #\n # NOT CONFUSING THE WORKING DIRECTORY WITH VENDOR BUNDLE IS SUPER IMPORTANT\n # because if we do, we won't be able to run CI on this library itself.\n bundle_paths = bundle_info[:out].lines\n .map { |l| Pathname.new(l.chomp) }\n .select(&:exist?)\n .map(&:realpath)\n .map(&:parent)\n .uniq\n wd = Pathname.new(\".\").realpath\n @vendor_bundle_cache = bundle_paths.select do |gem_path|\n gem_path.ascend do |part|\n break true if wd == part\n end\n end\n end\n end\n\n # no bundle existed\n return false if @vendor_bundle_cache == false\n\n # With vendor bundles located, check this file against those\n @vendor_bundle_cache.any? do |gem_path|\n some_path.ascend do |part|\n break true if gem_path == part\n end\n end\n end", "def is_framework_package?(name)\n options.current_execution_environment.packages.include?(name) || options.extra_packages.include?(name)\n end", "def plugin_deployment?\n DeploymentOption.plugins.include?(deployment_option)\n end", "def bundle_environment_for(bundle_name)\n bundle_name = bundle_name.to_sym\n return environment[bundle_name] || (next_library.nil? ? {} : next_library.bundle_environment_for(bundle_name))\n end", "def is_app_instance?\n if @service_type == 'http' && @path_name == '/' && @balancer_configuration == 'app'\n return true\n end\n\n false\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundle\n content.split('bundle ').last.split(\",\").map(&:to_i).to_s\n end", "def bundles_thin?\n dependencies.assoc('thin')\n end", "def beta?\n developer_dir[/Xcode-[Bb]eta.app/, 0]\n end", "def bundler_option?\n RSpec::Mate::Options['--bundler']\nend", "def current?\n # If this is called before the plugins are loaded (i.e. by a plugin's application file), then\n # it is definitely not the top-level app\n if Origen.application_loaded?\n Origen.app == self\n else\n Origen.root == root\n end\n end", "def installer_AdobeUberInstaller?\n installer_type == \"AdobeUberInstaller\"\n end", "def app_starting?\n @launching\n end", "def production?\n settings.environment == 'production'\n end", "def has_visor?\n File.exists?(\"#{ENV['HOME']}/Library/Application\\ Support/SIMBL/Plugins/Visor.bundle/\")\n end", "def production?\n self.environment == ENV_PROD\n end", "def bundle_code\n @attributes[:bundle_code]\n end", "def library?\n @library.nil? ? false : @library\n end", "def installed?\n !!@installed\n end", "def standalone?\n not $SLICED_APP\n end", "def standalone?\n not $SLICED_APP\n end", "def production?\n @environment == :production\n end", "def production?\n ENV[\"RACK_ENV\"] == \"production\"\n end", "def is?(application)\n JavaBuildpack::Util::JavaMainUtils.manifest(application).key?(SPRING_BOOT_VERSION) ||\n @jar_finder.is?(application)\n end", "def current_library?\n !current_library.nil?\n end", "def bladeserver?\n physical_type == \"BLADE\"\n end", "def bundle_id=(value)\n @bundle_id = value\n end", "def installed?\n false\n end", "def bundles\n return @bundles\n end", "def has_assets?\n assets.none?\n end", "def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end", "def app_installed?(app_id)\n @bridge.app_installed?(app_id)\n end", "def document?\n self.type == \"Assetabler::Document\"\n end", "def bundle_location_for(bundle_name)\n bundle_name = bundle_name.to_sym\n is_local_client = client_directories.include?(bundle_name.to_s)\n is_local_framework = framework_directories.include?(bundle_name.to_s)\n\n ret = nil\n if is_local_client || is_local_framework\n bundle_type = is_local_framework ? :framework : :client\n ret = {\n :bundle_name => bundle_name,\n :bundle_type => bundle_type,\n :source_root => File.join(root_path, bundle_type.to_s.pluralize, bundle_name.to_s)\n }\n else\n ret = next_library.nil? ? nil : next_library.bundle_location_for(bundle_name)\n end\n\n return ret\n end", "def production?\n\n return true if Rails.env.production?\n\n end", "def standalone?\n Merb.root == ::MerbAdmin.root\n end", "def set_bundle\n @bundle = Bundle.find(params[:id])\n end", "def current_bundle_code\n\tcase lane_context[:PLATFORM_NAME]\n\twhen :android\n\t\tget_gradle_version_code(gradle_path: lane_context[:GRADLE_FILE])\n\twhen :ios\n\t\tget_info_plist_value(path: 'ios/AllAboutOlaf/Info.plist',\n\t\t key: 'CFBundleVersion')\n\telse\n\t\traise 'wtf'\n\tend\nend", "def is_css_bundle(path)\n path = path.to_s\n\n file_extension = extract_file_extension path\n\n if file_extension\n CSS_EXTENSIONS.include? file_extension\n else\n CSS_EXTENSIONS.any? {|ext| path.include? \"/#{ext}/\" }\n end\n end", "def developer?\n config[\"developer\"] == true\n end", "def bundle_path\n \"/#{url_token}.bundle\"\n end", "def app_name_configured?\n names = Agent.config[:app_name]\n return names.respond_to?(:any?) && names.any?\n end", "def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end", "def production?\n @production ||= true\n end", "def bundles=(value)\n @bundles = value\n end", "def assets_enabled?\n return false if @site.config['bootstrap'].nil?\n @site.config['bootstrap']['assets'] == true\n end", "def bundles_rack?\n dependencies.assoc('rack')\n end", "def installer_package?\n installer_type.blank?\n end", "def installer?\n @kind == :installer\n end", "def default_production?\n @@default_production\n end", "def bundle!\n unless File.file?('Gemfile')\n log \"Gemfile is missing or not a valid file.\"\n end\n\n begin\n require 'bundler'\n rescue LoadError\n log \"Gemfile exists, but bundler is not installed\"\n log \"Run `gem install bundler` to install bundler.\"\n end\n\n begin\n Bundler.require(*@bundle)\n rescue Bundler::BundlerError => error\n log error.message\n log \"Run `bundle install` to install missing gems\"\n end\n\n return true\n end", "def live?\n configuration.release_stage?\n end", "def sandboxable?\n self.get?\n end", "def production?\n environment == :production\n end", "def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end", "def merge_version?\n !!@merge_version\n end", "def external_frame?(f)\n !!(f =~ %r{bundle/gems})\n end", "def transferable?\n !bundle? && !part_of_bundle? && unreserved? or\n bundle? && bundled_vouchers.all?(&:unreserved?)\n end", "def production?\n return true unless top_level?\n groups = requirements.flat_map { |r| r.fetch(:groups).map(&:to_s) }\n\n case package_manager\n when \"hex\" then groups.empty? || groups.any? { |g| g.include?(\"prod\") }\n when \"npm_and_yarn\"\n groups.include?(\"optionalDependencies\") ||\n groups.include?(\"dependencies\")\n when \"composer\" then groups.include?(\"runtime\")\n when \"pip\" then groups.empty? || groups.include?(\"default\")\n when \"bundler\"\n groups.empty? ||\n groups.include?(\"runtime\") ||\n groups.include?(\"default\") ||\n groups.any? { |g| g.include?(\"prod\") }\n else true\n end\n end", "def manifest_available?\n VALID_IIIF_CONTENT_TYPES.include?(first('content_metadata_type_ssm').to_s)\n end", "def has_current_application?\n not self.current_application.nil?\n end", "def bibtex_mode?\n MODE[@mode] == :bibtex\n end", "def bundle_installer\n @bundle_installer ||= BundleInstaller.new(:library => self) \n end", "def prod?\n is_prod\n end", "def running?\n @applications.each { |a| return true if a.running? }\n return false\n end", "def has_installer?\n !installer_path.nil?\n end" ]
[ "0.7860241", "0.7747696", "0.71905863", "0.6793058", "0.66005206", "0.65717113", "0.64848053", "0.6107878", "0.6011536", "0.59816766", "0.59372455", "0.5902744", "0.587771", "0.5790042", "0.5768125", "0.57109594", "0.57063776", "0.5587821", "0.555296", "0.55318785", "0.5520237", "0.5520237", "0.54376316", "0.5426911", "0.5398138", "0.5398138", "0.53458816", "0.5307455", "0.53037065", "0.5295668", "0.52872497", "0.5279085", "0.5278587", "0.5254266", "0.52478296", "0.5247637", "0.52373743", "0.5235955", "0.5235955", "0.5235955", "0.5195165", "0.5187671", "0.5171601", "0.51581246", "0.5144424", "0.50944585", "0.50790465", "0.5069854", "0.5069717", "0.50504696", "0.504775", "0.5043619", "0.5028728", "0.5017362", "0.5017362", "0.5012958", "0.5012009", "0.5007528", "0.500432", "0.50035655", "0.50029516", "0.49976227", "0.4995923", "0.49718562", "0.49591452", "0.49591452", "0.49543962", "0.49483907", "0.49315798", "0.49224317", "0.49209163", "0.49199703", "0.4917131", "0.49117032", "0.49105886", "0.49073735", "0.49025938", "0.49002233", "0.4887217", "0.48854926", "0.4883186", "0.4880281", "0.48788905", "0.4877701", "0.4873586", "0.48709533", "0.4870225", "0.4864724", "0.48558787", "0.4854859", "0.48404282", "0.48340154", "0.4830451", "0.48276564", "0.4822904", "0.4820381", "0.48188472", "0.48117507", "0.48064426", "0.47982758" ]
0.86101365
0
Sets the isBundle property value. Whether or not the app is a bundle.
def is_bundle=(value) @is_bundle = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_bundle\n return @is_bundle\n end", "def bundled?\n $BUNDLE || ENV.key?(\"BUNDLE\")\n end", "def set_bundle\n @bundle = Bundle.find(params[:id])\n end", "def bundle()\n merge(notbundle: 'true')\n end", "def bundle?\n @descriptive_detail.bundle?\n end", "def set_bundle(bundle, tags)\n args = [\"bundle=#{u(bundle)}\", \"tags=#{u(tags)}\"]\n get('tags/bundles/set?' << args.join('&amp;'))\n nil\n end", "def bundle_id=(value)\n @bundle_id = value\n end", "def bundles=(value)\n @bundles = value\n end", "def set_product_bundle\n @product_bundle = ProductBundle.find(params[:id])\n end", "def default_resource_bundle=(resource_bundle)\n\t\tresource_bundles.update_all( :is_default => false )\n\t\tresource_bundles.detect{ |rb| rb.id == resource_bundle.id}.update_attribute(:is_default, true)\n\tend", "def bundle?\n @product_composition.human == \"MultipleComponentRetailProduct\"\n end", "def bundle_exists?\n File.exists? self.bundle_dir\n end", "def bundle_for(bundle_name)\n bundle_name = bundle_name.to_sym\n @bundles ||= {}\n return @bundles[bundle_name] ||= Bundle.new(bundle_name, environment_for(bundle_name))\n end", "def bundle\n @bundle ||= Bundle.load(@path)\n end", "def bundler?\n @bundler ||= File.exist?(\"#{ Dir.pwd }/Gemfile\")\n end", "def no_bundler\n @bundler = false\n end", "def use_bundler(**opts)\n @bundler = opts\n self\n end", "def use_bundler(**opts)\n @bundler = opts\n self\n end", "def update_bundle(bundle_name, opts = {})\n self.bundle_installer.update(bundle_name, opts)\n end", "def bundle(bundle_name, type, *filelist)\n raise \"Invalid bundle type, must be one of #{VALID_TYPES.inspect}\" unless VALID_TYPES.include?(type)\n # verify ordered files exist\n basedir = type_to_path(type)\n filelist.each do|name|\n path = File.join(basedir, bundle_name.to_s, name)\n path << \".#{type.to_s}\" unless path.match(/\\.#{type.to_s}$/)\n raise \"Missing reference to file: #{name} at #{path}\" unless File.exist?(path)\n\n # add a reference\n @bundles[type] ||= {}\n @bundles[type][bundle_name] ||= []\n @bundles[type][bundle_name] << {:name => name, :path => path}\n end\n end", "def set_support_bundle\n @support_bundle = SupportBundle.find(params[:id])\n end", "def bundle(name)\n RubyAem::Resources::Bundle.new(@client, name)\n end", "def not_priced?\n bundle? || has_variants?\n end", "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def bundle_installer\n @bundle_installer ||= BundleInstaller.new(:library => self) \n end", "def complete_app_install?(app_bundle_dir)\n base_dir = File.dirname(app_bundle_dir)\n plist = File.join(base_dir, METADATA_PLIST)\n File.exist?(plist)\n end", "def set_bundlelink\n @bundlelink = Bundlelink.friendly.find(params[:id])\n end", "def tag_wrangler=(is_tag_wrangler)\n is_tag_wrangler == \"1\" ? self.is_tag_wrangler : self.is_not_tag_wrangler\n end", "def bundle_install_options\n super + [\"--deployment\"]\n end", "def set_app()\n self.is_app = 1\n save()\n end", "def install_bundle\n if options[:bundle_install]\n system('bundle', 'install')\n end\n end", "def match_bundle_type\n self.original_file_types & BUNDLE_TYPES\n end", "def vendored_bundler?\n false\n end", "def needs_rebundle?\n # Right now compression is the only option that requires rebundling\n @options_hash != options_hash.hash\n end", "def run_bundle\n end", "def bundle_name; bundle.bundle_name; end", "def run_bundle; end", "def bundle!\n unless File.file?('Gemfile')\n log \"Gemfile is missing or not a valid file.\"\n end\n\n begin\n require 'bundler'\n rescue LoadError\n log \"Gemfile exists, but bundler is not installed\"\n log \"Run `gem install bundler` to install bundler.\"\n end\n\n begin\n Bundler.require(*@bundle)\n rescue Bundler::BundlerError => error\n log error.message\n log \"Run `bundle install` to install missing gems\"\n end\n\n return true\n end", "def write_bundle_config\n config = <<-CONFIG\n---\nBUNDLE_PATH: rubygems\nBUNDLE_DISABLE_SHARED_GEMS: \"1\"\nBUNDLE_WITHOUT: test\n CONFIG\n dot_bundle = File.join(destination_directory, 'app', '.bundle')\n FileUtils.mkdir_p(dot_bundle)\n File.open(File.join(dot_bundle, 'config'), 'wb') do |config_file|\n config_file.print(config)\n end\n end", "def initialize(app_bundle_path)\n @path = File.expand_path(app_bundle_path)\n\n if !App.valid?(app_bundle_path)\n if App.cached_app_on_simulator?(app_bundle_path)\n raise RuntimeError, %Q{\nApp is \"cached\" on the simulator.\n\n#{app_bundle_path}\n\nThis can happen if there was an incomplete install or uninstall.\n\nTry manually deleting the application data container and relaunching the simulator.\n\n$ rm -r #{File.dirname(app_bundle_path)}\n$ run-loop simctl manage-processes\n}\n else\n raise ArgumentError,\n%Q{App does not exist at path or is not an app bundle.\n\n#{app_bundle_path}\n\nBundle must:\n\n1. be a directory that exists,\n2. have a .app extension,\n3. contain an Info.plist,\n4. and the app binary (CFBundleExecutable) must exist\n}\n end\n end\n end", "def image_bundle\n @image_bundle ||=\n Hoosegow::ImageBundle.new.tap do |image|\n image.add(File.expand_path('../../*', __FILE__), :ignore_hidden => true)\n image.add(File.join(@inmate_dir, \"*\"), :prefix => 'inmate')\n image.ruby_version = @ruby_version\n end\n end", "def is_js_bundle(path)\n path = path.to_s\n file_extension = extract_file_extension path\n\n if file_extension\n JS_EXTENSIONS.include? file_extension\n else\n JS_EXTENSIONS.any? {|ext| path.include? \"/#{ext}/\" }\n end\n end", "def bundle_id\n return @bundle_id\n end", "def bundle()\n puts \"TODO\"\n end", "def bundler_option?\n RSpec::Mate::Options['--bundler']\nend", "def start_bundle(symbolic_name)\n bundles = \n begin\n JSON.parse(RestClient.get(psc_api_url('osgi/bundles'), :accept => '*/*')).\n select { |b| symbolic_name === b['symbolic_name'] }\n rescue => e\n warn \"Starting #{symbolic_name} failed: #{e}\"\n e.backtrace.each { |l| trace \" #{l}\" }\n return false\n end\n if bundles.empty?\n warn \"No bundle matching #{symbolic_name.inspect}\"\n return false\n end\n begin\n bundles.each { |b|\n trace \"Attempting to start #{b.inspect}\"\n RestClient.put(psc_api_url(\"osgi/bundles/#{b['id']}/state\"),\n '{ state: STARTING }', :content_type => 'application/json')\n }\n rescue => e\n warn e\n return false\n end\nend", "def files(bundle = true)\n (@app and bundle) ? ::Asset.bundle[@type] : [@path]\n end", "def run_bundle ; end", "def run_bundle ; end", "def bundled?(filename); end", "def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allow_all_bundle_ids = args[:allow_all_bundle_ids] if args.key?(:allow_all_bundle_ids)\n @allowed_bundle_ids = args[:allowed_bundle_ids] if args.key?(:allowed_bundle_ids)\n @apple_developer_id = args[:apple_developer_id] if args.key?(:apple_developer_id)\n end", "def bundle_id\n read('bundle_id')\n end", "def app_is_installed?\n if installed_app_bundle_dir ||\n simctl.app_container(device, app.bundle_identifier)\n true\n else\n false\n end\n end", "def bundle\n my_env = ENV.to_hash\n\n if defined?(Bundler)\n Bundler.with_clean_env do\n result = super\n end\n else\n result = super\n end\n\n ENV.replace(my_env)\n result\n end", "def install_bundle(bundle_name, opts = {})\n self.bundle_installer.install(bundle_name, opts)\n end", "def bundle_dependencies\r\n if options[:run_bundle]\r\n say \"Bundling application dependencies using bundler...\"\r\n in_root { run 'bundle install' }\r\n end\r\n end", "def bundle_dependencies\n if options[:run_bundle]\n say \"Bundling application dependencies using bundler...\"\n in_root { run 'bundle install' }\n end\n end", "def bundle_path\n \"/#{url_token}.bundle\"\n end", "def vendor_bundle?(some_path)\n # Cache bundle information, as it is (1) time consuming to fetch and (2) not going to change while we run\n if @vendor_bundle_cache.nil?\n bundle_info = Host.run_and_capture(\"bundle show --paths\")\n if !bundle_info[:success]\n # if the bundle show command fails, assume there isn't a bundle\n @vendor_bundle_cache = false\n else\n # Get all the places where gems are stored. We combine a few things here:\n # by preemptively switching to the parent directory, we can both ensure that\n # we skip any gems that are equal to the working directory AND exploit some\n # commonality in the paths to cut down our search locations\n #\n # NOT CONFUSING THE WORKING DIRECTORY WITH VENDOR BUNDLE IS SUPER IMPORTANT\n # because if we do, we won't be able to run CI on this library itself.\n bundle_paths = bundle_info[:out].lines\n .map { |l| Pathname.new(l.chomp) }\n .select(&:exist?)\n .map(&:realpath)\n .map(&:parent)\n .uniq\n wd = Pathname.new(\".\").realpath\n @vendor_bundle_cache = bundle_paths.select do |gem_path|\n gem_path.ascend do |part|\n break true if wd == part\n end\n end\n end\n end\n\n # no bundle existed\n return false if @vendor_bundle_cache == false\n\n # With vendor bundles located, check this file against those\n @vendor_bundle_cache.any? do |gem_path|\n some_path.ascend do |part|\n break true if gem_path == part\n end\n end\n end", "def bundle_id\n @attributes[:bundle_id]\n end", "def bundle_id\n @attributes[:bundle_id]\n end", "def create\n @bundle = Bundle.new(params[:bundle])\n @bundle.created_by_user_id=@user\n \n respond_to do |format|\n if @bundle.save\n flash[:notice] = 'Bundle was successfully created.'\n format.html { redirect_to(@bundle) }\n format.xml { render :xml => @bundle, :status => :created, :location => @bundle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bundle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def run_bundle\n\t\t\t$stdout.puts Rainbow(\"Bundle ...\").green\n\t\t\tr.bundle\n\t\t\t$stdout.puts Rainbow(\"Success: Production env 'bundle' command run for app\").green\n\t\tend", "def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n flash[:notice] = 'Bundle was successfully updated.'\n format.html { redirect_to(@bundle) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bundle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n flash[:notice] = 'Bundle was successfully updated.'\n format.html { redirect_to(@bundle) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bundle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bundle_environment_for(bundle_name)\n bundle_name = bundle_name.to_sym\n return environment[bundle_name] || (next_library.nil? ? {} : next_library.bundle_environment_for(bundle_name))\n end", "def bundle_directory\n @yaml[\"paths\"][\"bundle_directory\"]\n end", "def set_standalone_model(boolean)\n self.standalone_model = boolean\n end", "def new_bundle(product_name)\n file = new_file(\"#{product_name}.bundle\")\n file.explicit_file_type = 'wrapper.cfbundle'\n file.include_in_index = '0'\n file.source_tree = 'BUILT_PRODUCTS_DIR'\n file.last_known_file_type = nil\n file\n end", "def started? (name)\n bundle = list_bundles.find {|b| b[:name] == name}\n bundle[0][:context] == 'Started'\n end", "def bundles_changes(notification)\n if notification.userInfo[:changed_bundle].productIdentifier == @productIdentifier\n @installed = notification.userInfo[:status] == :added\n NSNotificationCenter.defaultCenter.postNotificationName('ShopBundleStatusChanged',\n object:nil)\n\n end\n end", "def create\n @bundle = Bundle.new(params[:bundle])\n\n respond_to do |format|\n if @bundle.save\n format.html { redirect_to @bundle, notice: 'Bundle was successfully created.' }\n format.json { render json: @bundle, status: :created, location: @bundle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "def is_signed=(value)\n @is_signed = value\n end", "def active_update\n respond_to do |format|\n if Bundle.exists?(id:params[:id])\n @bundle = Bundle.find(params[:id])\n\n if BundlesItemsDesign.exists?(bundle_id:params[:id])\n\n @bundle.active = 'y'\n if @bundle.save!\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n else\n format.html { redirect_to @bundle, notice: 'something go wrong.' }\n end\n else\n format.html { redirect_to @bundle, notice: \"Bundle item design doesn't exist yet, you need to have a least one.\" }\n end\n else\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def set_is_master\n if self.product.has_master?\n self.is_master = false\n else\n self.is_master = true\n end\n true\n end", "def activate!\n @include_dirs.each do |dir|\n $LOAD_PATH << dir if File.directory?(dir)\n end\n\n # use Bundler if a Gemfile is present\n bundle! unless @bundle.empty?\n\n return true\n end", "def create\n @bundle = Bundle.new(params[:bundle])\n\n respond_to do |format|\n if @bundle.save\n flash[:notice] = 'Bundle was successfully created.'\n format.html { redirect_to(@bundle) }\n format.xml { render :xml => @bundle, :status => :created, :location => @bundle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bundle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bundles_thin?\n dependencies.assoc('thin')\n end", "def is_framework_package?(name)\n options.current_execution_environment.packages.include?(name) || options.extra_packages.include?(name)\n end", "def bundle\n return unless File.exist?(\"Gemfile\")\n\n # Only need bundler/setup to get our paths right--we don't need to\n # actually require the gems, since we find the generate_backend.rb's\n # and just require them directly.\n require 'bundler/setup'\n end", "def bundle\n return unless File.exist?(\"Gemfile\")\n\n # Only need bundler/setup to get our paths right--we don't need to\n # actually require the gems, since we find the generate-backend.rb's\n # and just require them directly.\n require 'bundler/setup'\n end", "def show_bundle(id)\n BrickFTP::API::Bundle.find(id)\n end", "def show_bundle(id)\n BrickFTP::API::Bundle.find(id)\n end", "def translation_admin=(is_translation_admin)\n is_translation_admin == \"1\" ? self.is_translation_admin : self.is_not_translation_admin\n end", "def package_manager\n false\n end", "def bundle\n return unless File.exists?(\"Gemfile\")\n\n # Only need bundler/setup to get our paths right--we don't need to\n # actually require the gems, since we find the generate-backend.rb's\n # and just require them directly.\n require 'bundler/setup'\n end", "def installer_AdobeUberInstaller?\n installer_type == \"AdobeUberInstaller\"\n end", "def remove_bundle(bundle_name, opts = {})\n self.bundle_installer.remove(bundle_name, opts)\n end", "def update!(**args)\n @bundle_identifier = args[:bundle_identifier] if args.key?(:bundle_identifier)\n @localized_app_name = args[:localized_app_name] if args.key?(:localized_app_name)\n @open_app_url = args[:open_app_url] if args.key?(:open_app_url)\n end", "def set_bundler_config(key, *values)\n output, status = popen_capture(\"#{@ruby_bin}/bundle\", 'config', '--local', key, *values)\n if status.exitstatus != 0\n puts output\n raise SetupError.new(\"'Bundler' error. Please run 'gem install bundler' first.\")\n end\n end", "def bundle_package(*args, &block)\n ruby_package(*args) do |pkg|\n Autoproj.env_add_path 'ROCK_BUNDLE_PATH', pkg.srcdir\n if block_given?\n pkg.instance_eval(&block)\n end\n end\nend", "def environment_for(bundle_name=nil)\n\n # If no bundle name is provided, then just return the base environment.\n return base_environment if bundle_name.nil?\n \n # Get the bundle location info. This will return nil if the bundle\n # is not found anywhere. In that case, return nil to indicate bundle\n # does not exist.\n bundle_location = bundle_location_for(bundle_name)\n return nil if bundle_location.nil?\n\n # A bundle was found, so collect the base environment and any bundle-\n # specific configs provided by the developer.\n base_env = base_environment\n config_env = bundle_environment_for(bundle_name)\n\n # Now we have the relevant pieces. Join them together. Start with the\n # base environment and fill in some useful defaults...\n ret = base_env.dup.merge(config_env).merge(bundle_location)\n ret[:required] = [:sproutcore] if ret[:required].nil?\n\n # Add local library so we get proper deployment paths, etc.\n ret[:library] = self\n\n # Done! return...\n return ret\n end", "def path\n @bundle_filename\n end", "def bundle_capture(app_name, bundle_name=nil)\n\t\txml(post(\"/apps/#{app_name}/bundles\", :bundle => { :name => bundle_name })).elements[\"//bundle/name\"].text\n\tend", "def has_visor?\n File.exists?(\"#{ENV['HOME']}/Library/Application\\ Support/SIMBL/Plugins/Visor.bundle/\")\n end", "def production?\n @production ||= true\n end", "def create_bundle(attributes)\n BrickFTP::API::Bundle.create(attributes)\n end", "def create_bundle(attributes)\n BrickFTP::API::Bundle.create(attributes)\n end", "def prepare_bundle_env_for_env(standalone: false)\n path = File.join(DESTROOT, \"bundle\", \"bin\", \"bundle-env\")\n content = File.read(path)\n placeholder = \"{{IS_STANDALONE}}\"\n raise \"Could not find placeholder #{placeholder} in '#{path}'\" unless content.include?(placeholder)\n content.gsub!(placeholder, standalone.to_s)\n if !standalone\n homebrew_placeholder = \"{{IS_INSTALLED_VIA_HOMEBREW}}\"\n raise \"Could not find placeholder #{homebrew_placeholder} in '#{path}'\" unless content.include?(homebrew_placeholder)\n content.gsub!(homebrew_placeholder, standalone.to_s)\n end\n File.write(path, content)\n puts \"Updated '#{path}' for IS_STANDALONE environment '#{standalone}'\"\n end" ]
[ "0.7101724", "0.6549954", "0.6123661", "0.5884388", "0.5600334", "0.55814475", "0.5572675", "0.548277", "0.5374566", "0.537286", "0.5306937", "0.5306665", "0.50813246", "0.5070391", "0.50437355", "0.5022118", "0.4991801", "0.4991801", "0.49761167", "0.4884269", "0.48604423", "0.48459613", "0.48271817", "0.48231125", "0.47924063", "0.47871375", "0.47699088", "0.47556838", "0.47509328", "0.47276244", "0.47152403", "0.47069126", "0.4680491", "0.4674808", "0.46119606", "0.46106645", "0.46003154", "0.45930874", "0.45760363", "0.45669025", "0.4558711", "0.45548308", "0.45064917", "0.44896567", "0.44743142", "0.4466912", "0.44662791", "0.44636124", "0.44636124", "0.44634295", "0.44632775", "0.4461221", "0.44541463", "0.4449899", "0.4438309", "0.44178346", "0.44091475", "0.4387525", "0.43820092", "0.43785587", "0.43721047", "0.43721047", "0.43649423", "0.43567726", "0.4353732", "0.4353732", "0.43497923", "0.4313209", "0.43121237", "0.43044034", "0.43034273", "0.4289791", "0.42837107", "0.42756748", "0.42429757", "0.42233458", "0.42182866", "0.41970298", "0.41961637", "0.41896594", "0.41848183", "0.4161013", "0.4135771", "0.41337043", "0.4131301", "0.41270074", "0.41142687", "0.41023102", "0.4100041", "0.40991268", "0.40871698", "0.407993", "0.40723917", "0.40674424", "0.40535286", "0.40446", "0.4043214", "0.40406585", "0.40406585", "0.4037197" ]
0.8297566
0
Gets the minimumSupportedOperatingSystem property value. The minimum operating system required for a Windows mobile app.
def minimum_supported_operating_system return @minimum_supported_operating_system end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_supported_operating_system=(value)\n @minimum_supported_operating_system = value\n end", "def os_minimum_version\n return @os_minimum_version\n end", "def os_minimum_version\n return @os_minimum_version\n end", "def operating_system_version\n return @operating_system_version\n end", "def operating_system_version\n return @operating_system_version\n end", "def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end", "def os_minimum_version=(value)\n @os_minimum_version = value\n end", "def os_minimum_version=(value)\n @os_minimum_version = value\n end", "def mobile_platform\n return @children['mobile-platform'][:value]\n end", "def os_version\n @os_version ||= begin\n version = nil\n wql = service.run_wql('select version from Win32_OperatingSystem')\n if wql[:xml_fragment]\n version = wql[:xml_fragment].first[:version] if wql[:xml_fragment].first[:version]\n end\n fail ::WinRM::WinRMError, 'Unable to determine endpoint os version' if version.nil?\n Gem::Version.new(version)\n end\n end", "def os_platform\n return @parsed_ua.os ? @parsed_ua.os : 'Unknown'\n end", "def platform_version\n version = capabilities['platformVersion']\n version.nil? ? nil : version.to_s\n end", "def os_maximum_version\n return @os_maximum_version\n end", "def os_maximum_version\n return @os_maximum_version\n end", "def platform\n osver[0]\n end", "def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def osver\n return `uname -r`.chomp\n end", "def platform_version\n osver[1]\n end", "def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end", "def platform\n System::get_property('platform')\n end", "def user_os_simple\r\n ua = request.env['HTTP_USER_AGENT'].downcase\r\n return \"Windows\" if ua.index('win')\r\n return \"Linux\" if ua.index('Linux')\r\n return \"Macintosh\" if ua.index('Macintosh')\r\n return \"unknown\"\r\n end", "def platform\n fetch('device.platform')\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def arch\n return `uname -m`.chomp\n end", "def detect_platform()\r\n\t\tprint_status(\"Attempting to automatically detect the platform...\")\r\n\r\n\t\tpath = datastore['PATH'] + '/HtmlAdaptor?action=inspectMBean&name=jboss.system:type=ServerInfo'\r\n\t\tres = send_request_raw(\r\n\t\t\t{\r\n\t\t\t\t'uri' => path\r\n\t\t\t}, 20)\r\n\r\n\t\tif (not res) or (res.code != 200)\r\n\t\t\tprint_error(\"Failed: Error requesting #{path}\")\r\n\t\t\treturn nil\r\n\t\tend\r\n\r\n\t\tif (res.body =~ /<td.*?OSName.*?(Linux|Windows).*?<\\/td>/m)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def platform\n if self.version_sets.nil?\n raise 'The application has no version sets and Spaceship does not know what to do here.'\n end\n\n if self.version_sets.length == 1\n version_sets[0].platform\n elsif self.platforms == %w(ios appletvos)\n 'ios'\n end\n Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets'])['platformString']\n end", "def detect_os(compare_os = nil)\n return case request.user_agent.downcase\n when /windows/i\n :windows\n when /macintosh/i\n :mac\n else\n :unknown\n end\n end", "def os\n return `uname -s`.chomp\n end", "def get_recommended_value\n os_value\n end", "def os\n if application && c = application.comment.detect { |c| OperatingSystems::ANDROID_VERSION_REGEX.match?(c) }\n OperatingSystems.normalize_os(c)\n end\n end", "def platform\n window.execute_script('navigator.platform')\n end", "def windows_mobile_restriction\n return @windows_mobile_restriction\n end", "def os\n return @os if @os\n raw_os = RbConfig::CONFIG['target_os']\n match = raw_os.match(/([a-z]+)/)\n if match\n @os = match[1]\n else\n @os = raw_os\n end\n end", "def supported_platforms\n latest_extension_version.try(:supported_platforms) || []\n end", "def platform_version\n return @platform_version\n end", "def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end", "def os\n Agent.os_for_user_agent string\n end", "def os\n app = app_with_comments\n return unless app\n\n OperatingSystems.normalize_os(app.comment[2]) if app.comment[2]\n end", "def platform\n return @platform\n end", "def user_os_simple\n @user_os_simple ||= begin\n ua = ''\n ua = request.env['HTTP_USER_AGENT'].downcase if request.env['HTTP_USER_AGENT']\n if ua.index('win')\n \"Windows\"\n elsif ua.index('linux')\n \"Linux\"\n elsif ua.index('macintosh')\n \"Macintosh\"\n elsif ua.index('ipod') # iPod Touch\n \"iPod\"\n elsif ua.index('iphone')\n \"iPhone\"\n elsif ua.index('ipad')\n \"iPad\"\n else\n \"unknown\"\n end\n end\n end", "def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end", "def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end", "def actual_platform\n platform = nil\n\n if explicit_platform.nil? == false\n platform = explicit_platform\n elsif datastore['PLATFORM']\n platform = datastore['PLATFORM']\n elsif assoc_exploit\n platform = assoc_exploit.target_platform\n end\n\n # If we still have an invalid platform, then we suck.\n if platform.nil?\n raise NoCompatiblePayloadError, \"A platform could not be determined by the generic payload\"\n elsif platform.kind_of?(String)\n platform = Msf::Module::PlatformList.transform(platform)\n end\n\n return platform\n end", "def platform\n type = os_type(:nice)\n type = case type\n when /Linux/i then linux_type\n else type\n end\n \n # Grab the Solaris version; turns '5.9' into '9', for example. (Solaris has a really\n # bizarre numbering scheme.)\n #\n # FIXME: This should include patchlevel.\n if type =~ /Solaris/i\n if @solaris_version.nil?\n @solaris_version = @platform.exec(\"uname\", \"-r\").strip\n @solaris_version = $2 if @solaris_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*$/i\n end\n \n type += @solaris_version\n end\n \n # Grab the OS X version by looking at the Darwin kernel version.\n #\n # FIXME: This should include minor version, too (e.g., 10.4.7).\n if type =~ /OSX/i\n if @osx_version.nil?\n @osx_version = @platform.exec(\"uname\", \"-r\").strip\n if @osx_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+).*$/i\n minor_version = [ $1.to_i - 4, 0 ].max # i.e., Darwin 8.x => OS X 10.4, 7.x => OS X 10.3, etc.\n @osx_version = \"10.%d\" % minor_version\n else\n @osx_version = '-unknown-%s' % @osx_version\n end\n end\n \n type += @osx_version\n end\n \n # Grab the Windows version by System.getProperty\n if type =~ /Windows/i\n os_name = JavaSystem.getProperty('os.name');\n sun_os_patch_level = JavaSystem.getProperty('sun.os.patch.level');\n if @windows_version.nil?\n @windows_version = case os_name \n when /Windows 2003/i: \"win2k3\"\n when /Windows XP/i: \"winxp\"\n else os_name.gsub(/ /, '_')\n end\n unless sun_os_patch_level == \"unknown\"\n patch = ''\n sun_os_patch_level.split(/ /).each do |t|\n patch = \"#{patch}#{t[0..0]}\"\n end\n @windows_version += '-' + patch\n end \n end\n \n type = @windows_version\n end\n \n \"%s-%s\" % [ type.downcase, processor_type.downcase ]\n end", "def platform_name\n capabilities['platformName']\n end", "def architecture\n @architecture ||= `uname -m`\n end", "def get_os_name\n\t\t\t\treturn SystemDetector.get_os_name\n\t\t\tend", "def device_operating_system_summary\n return @device_operating_system_summary\n end", "def architecture\n `uname -m`.strip\n end", "def architecture\n `uname -m`.strip\n end", "def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end", "def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end", "def os\n app = app_with_comments\n return if app.nil?\n\n if (os_string = app.comment.detect { |c| ANDROID_REGEX.match?(c) })\n OperatingSystems.normalize_os(os_string)\n end\n end", "def os_version\n if !@os_version\n if Facter['operatingsystemrelease'] &&\n Facter['operatingsystemrelease'].value &&\n !Facter['operatingsystemrelease'].value.empty?\n @os_version = Facter['operatingsystemrelease'].value\n else\n raise \"Unable to determine proper OS value on this platform\"\n end\n end\n @os_version.dup\n end", "def os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: #{host_os.inspect}\"\n end\n )\nend", "def operating_system_version=(value)\n @operating_system_version = value\n end", "def operating_system_version=(value)\n @operating_system_version = value\n end", "def os(platform: self.platform)\n platform = self.platform unless fetch_all('computer.platform').include?(platform)\n fetch(\"computer.os.#{platform.downcase}\")\n end", "def platform\n \"win\"\n end", "def os_windows_other\n\t\t\t\t\tnot_os_windows_2k12.not_os_windows_8.not_os_windows_7.not_os_windows_2k8.not_os_windows_vista.not_os_windows_2k3.not_os_windows_xp.not_os_windows_2k.not_os_windows_nt\n\t\t\t\tend", "def platform_name; non_framework_platforms.first; end", "def detect_architecture()\r\n\t\tprint_status(\"Attempting to automatically detect the architecture\")\r\n\t\tres = send_serialized_request(\"osarch.bin\")\r\n\t\tif (res.body =~ /(i386|x86)/i)\r\n\t\t\tarch = $1\r\n\t\t\tif (arch =~ /i386|x86/i)\r\n\t\t\t\treturn ARCH_X86\r\n\t\t\t\t# TODO, more\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def target_platform\n (target and target.platform) ? target.platform : platform\n end", "def os \n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|bccwin|wince/\n :windows\n when /darwin|mac os|linux|solaris|bsd/\n :nix\n else\n raise Error::WebDriverError, \"unknown os: #{host_os.inspect}\"\n end\n)\nend", "def major\n if @name == :opera || (@name == :netscape && self >= Version.new(5, :netscape))\n return \"#{@tokens[0]}.#{@tokens[1].to_s[0...1]}\"\n elsif [:internet_explorer, :navigator].include?(@name) && @tokens[1] == 0\n return \"#{@tokens[0]}\"\n elsif @tokens.size == 1\n return \"#{@tokens[0]}\"\n elsif @tokens[2].is_a?(String)\n return \"#{@tokens[0]}.#{@tokens[1]}#{@tokens[2]}\"\n else\n return \"#{@tokens[0]}.#{@tokens[1]}\"\n end\n end", "def os\n if app = detect_product(IOS)\n [IOS, app.version].compact.join(' ') if app.version\n elsif app = detect_product(DARWIN)\n [IOS, OperatingSystems::Darwin::IOS[app.version.to_s]].compact.join(' ') if app.version\n elsif app = app_with_comments\n comments = app.comment.join\n if WINDOWS_NT_REGEX.match?(app.comment[0])\n OperatingSystems.normalize_os(app.comment[0])\n elsif ANDROID_REGEX.match?(comments)\n if comments.start_with?(LINUX)\n OperatingSystems.normalize_os(comments)\n elsif comments.start_with?(ANDROID) && matches = ANDROID_SDK_REGEX.match(comments)\n [ANDROID, OperatingSystems::Android::SDK[matches[:sdk]]].compact.join(' ') if matches[:sdk]\n end\n elsif app.comment[1]\n OperatingSystems.normalize_os(app.comment[1])\n end\n end\n end", "def platform\n kernel.platform\n end", "def browser_os\n if ENV['BROWSER_OS']\n raise \"You must also specify the variable GRID_HUB on the command line to use this option.\" if selenium_grid_hub.nil?\n raise \"Unrecognized BROWSER_OS value: #{ENV['BROWSER_OS']}.\" unless ENV['BROWSER_OS'] =~ /^windows|mac|linux$/i\n ENV['BROWSER_OS'].downcase.to_sym\n else\n nil\n end\n end", "def target_os\n @@forced ? @@forced.target : RbConfig::CONFIG['target_os']\n end", "def number_of_processors\n if RUBY_PLATFORM =~ /linux/\n return `cat /proc/cpuinfo | grep processor | wc -l`.to_i\n elsif RUBY_PLATFORM =~ /darwin/\n return `sysctl -n hw.logicalcpu`.to_i\n elsif RUBY_PLATFORM =~ /win32/\n # this works for windows 2000 or greater\n require 'win32ole'\n wmi = WIN32OLE.connect(\"winmgmts://\")\n wmi.ExecQuery(\"select * from Win32_ComputerSystem\").each do |system| \n begin\n processors = system.NumberOfLogicalProcessors\n rescue\n processors = 0\n end\n return [system.NumberOfProcessors, processors].max\n end\n end\n raise \"can't determine 'number_of_processors' for '#{RUBY_PLATFORM}'\"\nend", "def platform_version_windows(arg)\n # Make a best guess and assume a server OS\n # See: http://msdn.microsoft.com/en-us/library/windows/\n # desktop/ms724832(v=vs.85).aspx\n {\n '6.3' => '2012r2', '6.2' => '2012', '6.1' => '2008r2',\n '6.0' => '2008', '5.2' => '2003r2', '5.1' => 'xp', '5.0' => '2000'\n }[arg.match(/^[0-9]+\\.[0-9]+/).to_s]\n end", "def os_value\n if @value_os.nil?\n @value_os = get_os_value\n end\n @value_os\n end", "def os_name\n if (os_name = @host.at('tag[name=operating-system]'))\n os_name.inner_text\n end\n end", "def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end", "def host_os_family; end", "def platform\n RUBY_PLATFORM\n end", "def os_version # rubocop:disable Lint/DuplicateMethods\n @os_version ||= @name.match(PLATFORM_REGEX)[2]\n end", "def my_os\n if ENV['LAUNCHY_HOST_OS'] then\n Launchy.log \"#{self.name} : Using LAUNCHY_HOST_OS override of '#{ENV['LAUNCHY_HOST_OS']}'\"\n return ENV['LAUNCHY_HOST_OS']\n else\n ::Config::CONFIG['host_os']\n end\n end", "def define_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise GetMeSubsError.new(\"Unknown os: #{host_os.inspect}\")\n end\n )\n end", "def platform\n data[:platform]\n end", "def platform\n @attributes[:platform]\n end", "def kernel_hardware\n uname('-m')\n end", "def os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"Non supported os: #{host_os.inspect}\"\n end\n )\nend", "def detect_platform\n @@platform_features ||= {\n :interpreter => detect_interpreter,\n :interpreter_language => detect_interpreter_language,\n :ipv4 => detect_reachable_ip,\n :ruby_version => RUBY_VERSION,\n }.merge(detect_os).merge(detect_hardware)\n end", "def platform_type\n return @platform_type\n end", "def platform_type\n return @platform_type\n end", "def windows_mobile?\n !!(ua =~ /Windows CE/)\n end", "def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end", "def platform\n if os.include?('Android')\n 'Android'\n else\n nil\n end\n end", "def platform_shortname\n if platform_family == 'rhel'\n 'el'\n else\n platform\n end\n end", "def name\n RUBY_PLATFORM\n end", "def os_cpu_cores\n case RbConfig::CONFIG['host_os']\n when /darwin/\n Integer(`sysctl -n hw.ncpu`)\n when /linux/\n Integer(`cat /proc/cpuinfo | grep processor | wc -l`)\n else\n raise StandardError, \"Unsupported platform\"\n end\nend", "def client_os? system\n detect_os == system.to_sym\n end", "def os\n os_parser.os\n end", "def os_type\n\n if @ostype\n return @ostype\n end\n\n res = :invalid\n\n Rouster.os_files.each_pair do |os, f|\n [ f ].flatten.each do |candidate|\n if self.is_file?(candidate)\n next if candidate.eql?('/etc/os-release') and ! self.is_in_file?(candidate, os.to_s, 'i') # CentOS detection\n @logger.debug(sprintf('determined OS to be[%s] via[%s]', os, candidate))\n res = os\n end\n end\n break unless res.eql?(:invalid)\n end\n\n @logger.error(sprintf('unable to determine OS, looking for[%s]', Rouster.os_files)) if res.eql?(:invalid)\n\n @ostype = res\n res\n end", "def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end", "def detect_os\n @@os_features ||= nil\n return @@os_features if @@os_features\n @@os_features ||= {}\n\n # Mac Miner\n mac_miner = lambda do\n version = `sw_vers -productVersion`.match(/\\d+\\.\\d+(?:\\.\\d+)?/)[0]\n @@os_features.merge!({\n :platform => \"darwin\",\n :os_distro => \"Mac OSX\",\n :os_version => version,\n :os_nickname => case version.split(\".\")[0..1].join(\".\")\n when \"10.0\"; \"Cheetah\"\n when \"10.1\"; \"Puma\"\n when \"10.2\"; \"Jaguar\"\n when \"10.3\"; \"Panther\"\n when \"10.4\"; \"Tiger\"\n when \"10.5\"; \"Leopard\"\n when \"10.6\"; \"Snow Leopard\"\n when \"10.7\"; \"Lion\"\n when \"10.8\"; \"Mountain Lion\"\n when \"10.9\"; \"Mavericks\"\n when \"10.10\"; \"Yosemite\"\n else; \"Unknown Version of OSX\"\n end,\n :install_method => \"install\",\n :hostname => `hostname`.chomp,\n })\n if Pathname.which(\"brew\")\n @@os_features[:install_cmd] = \"brew install\"\n elsif Pathname.which(\"port\")\n @@os_features[:install_cmd] = \"port install\"\n else\n @@os_features[:install_method] = \"build\"\n end\n @@os_features\n end\n\n # Linux Miner\n linux_miner = lambda do\n # Ensure LSB is installed\n if not Pathname.which(\"lsb_release\")\n pkg_mgrs = {\n \"apt-get\" => \"install -y lsb\", # Debian/Ubuntu/Linux Mint/PCLinuxOS\n \"up2date\" => \"-i lsb\", # RHEL/Oracle\n \"yum\" => \"install -y lsb\", # CentOS/Fedora/RHEL/Oracle\n \"zypper\" => \"--non-interactive install lsb\", # OpenSUSE/SLES\n \"pacman\" => \"-S --noconfirm lsb-release\", # ArchLinux\n \"urpmi\" => \"--auto lsb-release\", # Mandriva/Mageia\n \"emerge\" => \"lsb_release\", # Gentoo\n \"slackpkg\" => \"\", # Slackware NOTE - doesn't have lsb\n }\n ret = false\n pkg_mgrs.each do |mgr,args|\n if Pathname.which(mgr)\n if mgr == \"slackpkg\" && File.exists?(\"/etc/slackware-version\")\n ret = true\n else\n ret = system(\"sudo #{mgr} #{args}\")\n end\n break if ret\n end\n end\n end\n\n arch_family = `arch 2> /dev/null`.chomp\n pkg_arch = arch_family\n install_method = \"install\"\n if File.exists?(\"/etc/slackware-version\") || Pathname.which(\"slackpkg\")\n # Slackware\n nickname = File.read(\"/etc/slackware-version\").strip\n version = nickname.split[1..-1].join(\" \")\n major_release = version.to_i\n distro = \"Slackware\"\n pkg_fmt = major_release < 13 ? \"tgz\" : \"txz\"\n install = \"slackpkg -batch=on -default_answer=y install\"\n local_install = \"installpkg\"\n elsif File.exists?(\"/etc/oracle-release\") || File.exists?(\"/etc/enterprise-release\")\n if File.exists?(\"/etc/oracle-release\")\n nickname = File.read(\"/etc/oracle-release\").strip\n else\n nickname = File.read(\"/etc/enterprise-release\").strip\n end\n version = nickname.match(/\\d+(\\.\\d+)?/)[0]\n major_release = version.to_i\n distro, pkg_fmt, install, local_install = \"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"\n else\n version = `lsb_release -r 2> /dev/null`.strip.split[1..-1].join(\" \")\n major_release = version.to_i\n nickname = `lsb_release -c 2> /dev/null`.strip.split[1..-1].join(\" \")\n lsb_release_output = `lsb_release -a 2> /dev/null`.chomp\n distro, pkg_fmt, install, local_install = case lsb_release_output\n when /(debian|ubuntu|mint)/i\n pkg_arch = \"amd64\" if arch_family == \"x86_64\"\n [$1, \"deb\", \"apt-get install -y\", \"dpkg -i\"]\n when /(centos|fedora)/i\n [$1, \"rpm\", \"yum install -y\", \"yum localinstall -y\"]\n when /oracle/i\n [\"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /redhat|rhel/i\n [\"RHEL\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /open\\s*suse/i\n [\"OpenSUSE\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /suse.*enterprise/i\n [\"SLES\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /archlinux/i\n [\"ArchLinux\", \"pkg.tar.xz\", \"pacman -S --noconfirm\", \"pacman -U --noconfirm\"]\n when /(mandriva|mageia)/i\n [$1, \"rpm\", \"urpmi --auto \", \"rpm -Uvh\"]\n when /pc\\s*linux\\s*os/i\n [\"PCLinuxOS\", \"rpm\", \"apt-get install -y\", \"rpm -Uvh\"]\n when /gentoo/i\n [\"Gentoo\", \"tgz\", \"emerge\", \"\"]\n else\n install_method = \"build\"\n [`lsb_release -d 2> /dev/null`.strip.split[1..-1].join(\" \")]\n end\n end\n ret = {\n :platform => \"linux\",\n :os_distro => distro,\n :pkg_format => pkg_fmt,\n :pkg_arch => pkg_arch,\n :os_version => version,\n :install_method => install_method,\n :install_cmd => install,\n :local_install_cmd => local_install,\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n # Solaris Miner\n solaris_miner = lambda do\n distro = `uname -a`.match(/(open\\s*)?(solaris)/i)[1..-1].compact.map { |s| s.capitalize }.join\n version = `uname -r`.strip\n nickname = \"#{distro} #{version.split('.')[-1]}\"\n if distro == \"OpenSolaris\"\n nickname = File.read(\"/etc/release\").match(/OpenSolaris [a-zA-Z0-9.]\\+/i)[0].strip\n end\n @@os_features.merge!({\n :platform => \"solaris\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg install\",\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n })\n end\n\n # *BSD Miner\n bsd_miner = lambda do\n distro = `uname -s`.strip\n version = `uname -r`.strip\n @@os_features.merge!({\n :platform => \"bsd\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg_add -r\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # BeOS Miner\n beos_miner = lambda do\n version = `uname -r`.strip\n distro = `uname -s`.strip\n @@os_features.merge!({\n :platform => \"beos\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"build\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # Windows Miner\n windows_miner = lambda do\n sysinfo = `reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\"`.chomp\n\n hostname = `reg query \"HKEY_LOCAL_MACHINE\\\\System\\\\CurrentControlSet\\\\Control\\\\ComputerName\\\\ComputerName\"`.chomp\n hostname = hostname.match(/^\\s*ComputerName\\s+\\w+\\s+(.*)/i)[1].strip\n\n version = sysinfo.match(/^\\s*CurrentVersion\\s+\\w+\\s+(.*)/i)[1].strip << \".\"\n version << sysinfo.match(/^\\s*CurrentBuildNumber\\s+\\w+\\s+(.*)/i)[1].strip\n\n nickname = sysinfo.match(/^\\s*ProductName\\s+\\w+\\s+(.*)/i)[1].strip\n nickname = \"Microsoft #{nickname}\" unless nickname =~ /^Microsoft/\n\n try_boot_ini = `type C:\\\\boot.ini 2> nul | findstr /C:\"WINDOWS=\"`.chomp\n unless try_boot_ini.empty?\n nickname = try_boot_ini.match(/WINDOWS=\"([^\"]+)\"/i)[1].strip\n end\n\n install_method, install_cmd = case ::RbConfig::CONFIG['host_os'].downcase\n when /mingw/; [\"build\", nil]\n when /mswin/; [\"install\", \"install\"]\n when /cygwin/; [\"install\", \"setup.exe -q -D -P\"] # TODO - Does this detect cygwin properly?\n end\n ret = {\n :os_distro => nickname.split(/\\s+/).reject { |s| s =~ /microsoft|windows/i }.join(\" \"),\n :hostname => hostname,\n :os_nickname => nickname,\n :os_version => version,\n :platform => \"windows\", # TODO - Cygwin / MinGW\n :install_method => install_method,\n :install_cmd => install_cmd,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n case ::RbConfig::CONFIG['host_os'].downcase\n when /darwin/; mac_miner[]\n when /mswin|mingw/; windows_miner[]\n when /linux/; linux_miner[]\n when /bsd/; bsd_miner[]\n when /solaris/; solaris_miner[]\n else\n case `uname -s`.chomp.downcase\n when /linux/; linux_miner[]\n when /darwin/; mac_miner[]\n when /solaris/; solaris_miner[]\n when /bsd/; bsd_miner[]\n when /dragonfly/; bsd_miner[]\n when /haiku/; beos_miner[]\n when /beos/; beos_miner[]\n end\n end\n\n @@os_features.freeze\n end" ]
[ "0.7969517", "0.71976584", "0.71976584", "0.6334428", "0.6334428", "0.63101476", "0.6273507", "0.6273507", "0.6257329", "0.6246654", "0.62266916", "0.6124294", "0.61151314", "0.61151314", "0.6106756", "0.59954673", "0.59906447", "0.59522414", "0.5950611", "0.59461236", "0.59259695", "0.5912128", "0.58453673", "0.58453673", "0.58453673", "0.58359516", "0.58326334", "0.58323646", "0.5794642", "0.579075", "0.57835716", "0.5783388", "0.578294", "0.57538724", "0.5735113", "0.57199883", "0.5716418", "0.5709739", "0.5660542", "0.56531525", "0.5645604", "0.5645499", "0.5632154", "0.5612385", "0.56112", "0.56110615", "0.5603391", "0.55698216", "0.5560469", "0.5547707", "0.5546351", "0.5546351", "0.5537745", "0.5537745", "0.55303806", "0.55234575", "0.5511188", "0.5505922", "0.5505922", "0.5495256", "0.5478084", "0.54688793", "0.5465242", "0.5459637", "0.54594254", "0.5454282", "0.5452845", "0.5444523", "0.5397439", "0.53973573", "0.5390795", "0.5381097", "0.537788", "0.5369853", "0.5366448", "0.5357321", "0.53447026", "0.53395253", "0.533784", "0.53367543", "0.5335913", "0.53259337", "0.53100276", "0.5301653", "0.5299653", "0.52904963", "0.5281027", "0.52703226", "0.52703226", "0.5269908", "0.52628577", "0.5259897", "0.52593553", "0.52530134", "0.52455306", "0.52434796", "0.5242192", "0.52408636", "0.5240187", "0.5235494" ]
0.8513557
0
Sets the minimumSupportedOperatingSystem property value. The minimum operating system required for a Windows mobile app.
def minimum_supported_operating_system=(value) @minimum_supported_operating_system = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_supported_operating_system\n return @minimum_supported_operating_system\n end", "def os_minimum_version=(value)\n @os_minimum_version = value\n end", "def os_minimum_version=(value)\n @os_minimum_version = value\n end", "def operating_system_version=(value)\n @operating_system_version = value\n end", "def operating_system_version=(value)\n @operating_system_version = value\n end", "def os_minimum_version\n return @os_minimum_version\n end", "def os_minimum_version\n return @os_minimum_version\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def version_supported?\n\tKitchenplan::Log.debug \"#{self.class} : Is platform version lower than #{@lowest_version_supported}?\"\n\treturn false if self.version.to_s < @lowest_version_supported\n\ttrue\n end", "def windows_mobile_restriction=(value)\n @windows_mobile_restriction = value\n end", "def platform=(value)\n @platform = value\n end", "def os_maximum_version=(value)\n @os_maximum_version = value\n end", "def os_maximum_version=(value)\n @os_maximum_version = value\n end", "def platform_version=(value)\n @platform_version = value\n end", "def setUseMobileUserAgent(value)\n @fields['use_mobile_user_agent'] = value\n self\n end", "def setUseMobileUserAgent(value)\n @fields['use_mobile_user_agent'] = value\n self\n end", "def minimum_required_patch_version=(value)\n @minimum_required_patch_version = value\n end", "def os=(value)\n if value == @defaults['os']\n @values.delete 'os' if @values.key? 'os'\n else\n @values['os'] = value\n end\n end", "def set_min_cpu_platform 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_min_cpu_platform_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", "def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end", "def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end", "def virtual_cpus=(value)\n FFI::Libvirt.virDomainSetVcpus(self, value) == 0\n end", "def os_version=(value)\n if value == @defaults['ai.device.osVersion']\n @values.delete 'ai.device.osVersion' if @values.key? 'ai.device.osVersion'\n else\n @values['ai.device.osVersion'] = value\n end\n end", "def os=(value)\n if value == @defaults['ai.device.os']\n @values.delete 'ai.device.os' if @values.key? 'ai.device.os'\n else\n @values['ai.device.os'] = value\n end\n end", "def platform=(platform)\n fail ArgumentError, \"unknown platform #{platform}\" \\\n unless Cisco::Util::PLATFORMS.include?(platform)\n @platform = platform\n end", "def meets_minimum_system_requirements?(resources)\n return true if @option_no_minimum_system_requirements\n (resources['cpu'] >= 4 && resources['ram'] >= 8192)\n end", "def cpu_power_management=(cpu_power_management)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"custom\", \"disabled\", \"energy-efficient\", \"performance\"])\n unless validator.valid?(cpu_power_management)\n fail ArgumentError, \"invalid value for \\\"cpu_power_management\\\", must be one of #{validator.allowable_values}.\"\n end\n @cpu_power_management = cpu_power_management\n end", "def osdeps_operating_system= (os)\n raise RuntimeError, \"#{self.class} needs to overwrite osdeps_operating_system=\"\n end", "def windows_enabled=(value)\n @windows_enabled = value\n end", "def check_platforms\n default_platform_attrs = ProductModel.platforms.stringify_keys\n self.design_platform = default_platform_attrs.merge(booleanize_hashs(design_platform))\n self.customize_platform = default_platform_attrs.merge(booleanize_hashs(customize_platform))\n end", "def set_operating_system\n @operating_system = OperatingSystem.find(params[:id])\n end", "def min_android_security_patch_level=(value)\n @min_android_security_patch_level = value\n end", "def platform_version_windows(arg)\n # Make a best guess and assume a server OS\n # See: http://msdn.microsoft.com/en-us/library/windows/\n # desktop/ms724832(v=vs.85).aspx\n {\n '6.3' => '2012r2', '6.2' => '2012', '6.1' => '2008r2',\n '6.0' => '2008', '5.2' => '2003r2', '5.1' => 'xp', '5.0' => '2000'\n }[arg.match(/^[0-9]+\\.[0-9]+/).to_s]\n end", "def platform_version\n version = capabilities['platformVersion']\n version.nil? ? nil : version.to_s\n end", "def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end", "def core_multi_processing=(core_multi_processing)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"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\", \"32\", \"33\", \"34\", \"35\", \"36\", \"37\", \"38\", \"39\", \"40\", \"41\", \"42\", \"43\", \"44\", \"45\", \"46\", \"47\", \"48\", \"all\"])\n unless validator.valid?(core_multi_processing)\n fail ArgumentError, \"invalid value for \\\"core_multi_processing\\\", must be one of #{validator.allowable_values}.\"\n end\n @core_multi_processing = core_multi_processing\n end", "def partner_unsupported_os_version_blocked=(value)\n @partner_unsupported_os_version_blocked = value\n end", "def ios_mobile_application_management_enabled=(value)\n @ios_mobile_application_management_enabled = value\n end", "def define_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise GetMeSubsError.new(\"Unknown os: #{host_os.inspect}\")\n end\n )\n end", "def device_operating_system_summary=(value)\n @device_operating_system_summary = value\n end", "def operating_system_version\n return @operating_system_version\n end", "def operating_system_version\n return @operating_system_version\n end", "def minimum=(value)\n @minimum = value\n end", "def windows_restriction=(value)\n @windows_restriction = value\n end", "def set_Minimum(value)\n set_input(\"Minimum\", value)\n end", "def device_manufacturer=(value)\n @device_manufacturer = value\n end", "def device_manufacturer=(value)\n @device_manufacturer = value\n end", "def platforms=(value)\n @platforms = value\n end", "def detect_platform\n @@platform_features ||= {\n :interpreter => detect_interpreter,\n :interpreter_language => detect_interpreter_language,\n :ipv4 => detect_reachable_ip,\n :ruby_version => RUBY_VERSION,\n }.merge(detect_os).merge(detect_hardware)\n end", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def os_version\n @os_version ||= begin\n version = nil\n wql = service.run_wql('select version from Win32_OperatingSystem')\n if wql[:xml_fragment]\n version = wql[:xml_fragment].first[:version] if wql[:xml_fragment].first[:version]\n end\n fail ::WinRM::WinRMError, 'Unable to determine endpoint os version' if version.nil?\n Gem::Version.new(version)\n end\n end", "def platform\n if self.version_sets.nil?\n raise 'The application has no version sets and Spaceship does not know what to do here.'\n end\n\n if self.version_sets.length == 1\n version_sets[0].platform\n elsif self.platforms == %w(ios appletvos)\n 'ios'\n end\n Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets'])['platformString']\n end", "def os_version\n if !@os_version\n if Facter['operatingsystemrelease'] &&\n Facter['operatingsystemrelease'].value &&\n !Facter['operatingsystemrelease'].value.empty?\n @os_version = Facter['operatingsystemrelease'].value\n else\n raise \"Unable to determine proper OS value on this platform\"\n end\n end\n @os_version.dup\n end", "def supported_platforms\n latest_extension_version.try(:supported_platforms) || []\n end", "def detect_os(compare_os = nil)\n return case request.user_agent.downcase\n when /windows/i\n :windows\n when /macintosh/i\n :mac\n else\n :unknown\n end\n end", "def target_os\n @@forced ? @@forced.target : RbConfig::CONFIG['target_os']\n end", "def check_platform\n mobile_override = params[:mobile] && params[:mobile] == \"1\"\n desktop_override = params[:mobile] && params[:mobile] == \"0\"\n if ( (browser.mobile? and !browser.ipad?) or mobile_override ) and !request.xhr? and !desktop_override\n @platform = 'mobile'\n request.format = :mobile\n else\n @platform = 'desktop'\n end\n end", "def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end", "def platform(arg = nil)\n set_or_return(:platform, arg, kind_of: String, required: true)\n end", "def os=(value)\n @children['os'][:value] = value\n end", "def cpu_frequency_floor=(cpu_frequency_floor)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(cpu_frequency_floor)\n fail ArgumentError, \"invalid value for \\\"cpu_frequency_floor\\\", must be one of #{validator.allowable_values}.\"\n end\n @cpu_frequency_floor = cpu_frequency_floor\n end", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid 7.6 7.5 7.4 7.2 7.1 7.0 6.0.5),\n 'ubuntu' => %w(14.10 14.04 13.10 13.04 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2014.09 2014.03 2013.09 2012.09),\n 'centos' => %w(7.0.1406 6.6 6.5 6.4 6.3 6.0 5.11 5.10 5.9 5.8),\n 'oracle' => %w(6.5 5.10),\n 'redhat' => %w(7.0 6.5 6.4 6.3 6.2 6.1 6.0 5.10 5.9 5.8 5.7 5.6)\n }\nend", "def windows_mobile_restriction\n return @windows_mobile_restriction\n end", "def os_platform\n return @parsed_ua.os ? @parsed_ua.os : 'Unknown'\n end", "def cisco_oprom_launch_optimization=(cisco_oprom_launch_optimization)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(cisco_oprom_launch_optimization)\n fail ArgumentError, \"invalid value for \\\"cisco_oprom_launch_optimization\\\", must be one of #{validator.allowable_values}.\"\n end\n @cisco_oprom_launch_optimization = cisco_oprom_launch_optimization\n end", "def default_platform_list\n [\n metadata.platform,\n *ruby_versions,\n *platforms,\n RbConfig::CONFIG['build']\n ]\n end", "def has_physical_device=(value)\n @has_physical_device = value\n end", "def map_custom_windows_desktop_versions(desktop_version)\n server_version = Util.map_windows_version(desktop_version)\n\n # Windows desktop 10 officially maps to server 2016.\n # However, we don't test on server 2016 at this time, so we default to 2012r2\n server_version = \"2012r2\" if server_version == \"2016\"\n\n server_version\n end", "def set_device\n # if HTTP_USER_AGENT is blank/nil defaults to blank, i.e. desktop \n agent = request.env[\"HTTP_USER_AGENT\"].blank? ? \"\" : request.env[\"HTTP_USER_AGENT\"].downcase \n if agent =~ tablet_agents\n \"tablet\"\n elsif (agent =~ mobile_agents_one) || (agent[0..3] =~ mobile_agents_two)\n \"mobile\"\n else\n \"desktop\"\n end \n end", "def opera_mini?(expected_version = nil)\n ua =~ /Opera Mini/ && detect_version?(full_version, expected_version)\n end", "def platform_version\n osver[1]\n end", "def supports(platform, *version_args)\n version = new_args_format(:supports, platform, version_args)\n constraint = validate_version_constraint(:supports, platform, version)\n @platforms[platform] = constraint.to_s\n @platforms[platform]\n end", "def os\n if application && c = application.comment.detect { |c| OperatingSystems::ANDROID_VERSION_REGEX.match?(c) }\n OperatingSystems.normalize_os(c)\n end\n end", "def has_physical_device=(value)\n @has_physical_device = value\n end", "def set_MinCorpus(value)\n set_input(\"MinCorpus\", value)\n end", "def set_MinCorpus(value)\n set_input(\"MinCorpus\", value)\n end", "def set_MinCorpus(value)\n set_input(\"MinCorpus\", value)\n end", "def set_MinCorpus(value)\n set_input(\"MinCorpus\", value)\n end", "def minimum_warning_patch_version=(value)\n @minimum_warning_patch_version = value\n end", "def os_ver=(value)\n if value == @defaults['osVer']\n @values.delete 'osVer' if @values.key? 'osVer'\n else\n @values['osVer'] = value\n end\n end", "def minimum_image_magick_version\n @@minimum_version ||= Gem::Version.create('6.6.3')\n end", "def os_maximum_version\n return @os_maximum_version\n end", "def os_maximum_version\n return @os_maximum_version\n end", "def mobile_platform\n return @children['mobile-platform'][:value]\n end", "def determine_os\n @os = 'linux'\n end", "def determine_os\n @os = \"linux\"\n end", "def set_variant\n if request.user_agent =~\n /mobile|android|touch|webos|hpwos|iphone|iPhone|iPad|ipod|\n android|blackberry|opera|mini|windows\\sce|palm|smartphone|iemobile|\n ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle/\n\n request.variant = :mobile\n else\n request.variant = :desktop\n end\n end", "def onboard_scu_storage_support=(onboard_scu_storage_support)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(onboard_scu_storage_support)\n fail ArgumentError, \"invalid value for \\\"onboard_scu_storage_support\\\", must be one of #{validator.allowable_values}.\"\n end\n @onboard_scu_storage_support = onboard_scu_storage_support\n end", "def applicable_device_types=(value)\n @applicable_device_types = value\n end", "def platforms\n [ RUBY_PLATFORM ].tap do |list|\n list.push \"JVM #{java_version}\" if jruby?\n end\n end", "def os_windows_other\n\t\t\t\t\tnot_os_windows_2k12.not_os_windows_8.not_os_windows_7.not_os_windows_2k8.not_os_windows_vista.not_os_windows_2k3.not_os_windows_xp.not_os_windows_2k.not_os_windows_nt\n\t\t\t\tend", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie/sid\n 8.4 8.2 8.1 8.0\n 7.10 7.9 7.8 7.7 7.6 7.5 7.4 7.2 7.1 7.0\n 6.0.5),\n 'ubuntu' => %w(16.04\n 15.10 15.04\n 14.10 14.04\n 13.10 13.04\n 12.04 10.04),\n # platform_family: 'rhel'\n 'amazon' => %w(2016.03\n 2015.09 2015.03\n 2014.09 2014.03\n 2013.09 2012.09),\n 'centos' => %w(7.2.1511 7.1.1503 7.0.1406\n 6.8 6.7 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.11 5.10 5.9 5.8 5.7 5.6 5.5 5.4 5.3 5.2),\n 'oracle' => %w(7.1 7.0\n 6.6 6.5\n 5.10),\n 'redhat' => %w(7.1 7.0\n 6.6 6.5 6.4 6.3 6.2 6.1 6.0\n 5.10 5.9 5.8 5.7 5.6)\n }\nend", "def platform\n osver[0]\n end", "def applicable_architectures=(value)\n @applicable_architectures = value\n end", "def target_platform\n (target and target.platform) ? target.platform : platform\n end", "def os=(v)\n @os = v.is_a?(String) ? [v] : v\n end", "def detect_os\n @@os_features ||= nil\n return @@os_features if @@os_features\n @@os_features ||= {}\n\n # Mac Miner\n mac_miner = lambda do\n version = `sw_vers -productVersion`.match(/\\d+\\.\\d+(?:\\.\\d+)?/)[0]\n @@os_features.merge!({\n :platform => \"darwin\",\n :os_distro => \"Mac OSX\",\n :os_version => version,\n :os_nickname => case version.split(\".\")[0..1].join(\".\")\n when \"10.0\"; \"Cheetah\"\n when \"10.1\"; \"Puma\"\n when \"10.2\"; \"Jaguar\"\n when \"10.3\"; \"Panther\"\n when \"10.4\"; \"Tiger\"\n when \"10.5\"; \"Leopard\"\n when \"10.6\"; \"Snow Leopard\"\n when \"10.7\"; \"Lion\"\n when \"10.8\"; \"Mountain Lion\"\n when \"10.9\"; \"Mavericks\"\n when \"10.10\"; \"Yosemite\"\n else; \"Unknown Version of OSX\"\n end,\n :install_method => \"install\",\n :hostname => `hostname`.chomp,\n })\n if Pathname.which(\"brew\")\n @@os_features[:install_cmd] = \"brew install\"\n elsif Pathname.which(\"port\")\n @@os_features[:install_cmd] = \"port install\"\n else\n @@os_features[:install_method] = \"build\"\n end\n @@os_features\n end\n\n # Linux Miner\n linux_miner = lambda do\n # Ensure LSB is installed\n if not Pathname.which(\"lsb_release\")\n pkg_mgrs = {\n \"apt-get\" => \"install -y lsb\", # Debian/Ubuntu/Linux Mint/PCLinuxOS\n \"up2date\" => \"-i lsb\", # RHEL/Oracle\n \"yum\" => \"install -y lsb\", # CentOS/Fedora/RHEL/Oracle\n \"zypper\" => \"--non-interactive install lsb\", # OpenSUSE/SLES\n \"pacman\" => \"-S --noconfirm lsb-release\", # ArchLinux\n \"urpmi\" => \"--auto lsb-release\", # Mandriva/Mageia\n \"emerge\" => \"lsb_release\", # Gentoo\n \"slackpkg\" => \"\", # Slackware NOTE - doesn't have lsb\n }\n ret = false\n pkg_mgrs.each do |mgr,args|\n if Pathname.which(mgr)\n if mgr == \"slackpkg\" && File.exists?(\"/etc/slackware-version\")\n ret = true\n else\n ret = system(\"sudo #{mgr} #{args}\")\n end\n break if ret\n end\n end\n end\n\n arch_family = `arch 2> /dev/null`.chomp\n pkg_arch = arch_family\n install_method = \"install\"\n if File.exists?(\"/etc/slackware-version\") || Pathname.which(\"slackpkg\")\n # Slackware\n nickname = File.read(\"/etc/slackware-version\").strip\n version = nickname.split[1..-1].join(\" \")\n major_release = version.to_i\n distro = \"Slackware\"\n pkg_fmt = major_release < 13 ? \"tgz\" : \"txz\"\n install = \"slackpkg -batch=on -default_answer=y install\"\n local_install = \"installpkg\"\n elsif File.exists?(\"/etc/oracle-release\") || File.exists?(\"/etc/enterprise-release\")\n if File.exists?(\"/etc/oracle-release\")\n nickname = File.read(\"/etc/oracle-release\").strip\n else\n nickname = File.read(\"/etc/enterprise-release\").strip\n end\n version = nickname.match(/\\d+(\\.\\d+)?/)[0]\n major_release = version.to_i\n distro, pkg_fmt, install, local_install = \"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"\n else\n version = `lsb_release -r 2> /dev/null`.strip.split[1..-1].join(\" \")\n major_release = version.to_i\n nickname = `lsb_release -c 2> /dev/null`.strip.split[1..-1].join(\" \")\n lsb_release_output = `lsb_release -a 2> /dev/null`.chomp\n distro, pkg_fmt, install, local_install = case lsb_release_output\n when /(debian|ubuntu|mint)/i\n pkg_arch = \"amd64\" if arch_family == \"x86_64\"\n [$1, \"deb\", \"apt-get install -y\", \"dpkg -i\"]\n when /(centos|fedora)/i\n [$1, \"rpm\", \"yum install -y\", \"yum localinstall -y\"]\n when /oracle/i\n [\"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /redhat|rhel/i\n [\"RHEL\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /open\\s*suse/i\n [\"OpenSUSE\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /suse.*enterprise/i\n [\"SLES\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /archlinux/i\n [\"ArchLinux\", \"pkg.tar.xz\", \"pacman -S --noconfirm\", \"pacman -U --noconfirm\"]\n when /(mandriva|mageia)/i\n [$1, \"rpm\", \"urpmi --auto \", \"rpm -Uvh\"]\n when /pc\\s*linux\\s*os/i\n [\"PCLinuxOS\", \"rpm\", \"apt-get install -y\", \"rpm -Uvh\"]\n when /gentoo/i\n [\"Gentoo\", \"tgz\", \"emerge\", \"\"]\n else\n install_method = \"build\"\n [`lsb_release -d 2> /dev/null`.strip.split[1..-1].join(\" \")]\n end\n end\n ret = {\n :platform => \"linux\",\n :os_distro => distro,\n :pkg_format => pkg_fmt,\n :pkg_arch => pkg_arch,\n :os_version => version,\n :install_method => install_method,\n :install_cmd => install,\n :local_install_cmd => local_install,\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n # Solaris Miner\n solaris_miner = lambda do\n distro = `uname -a`.match(/(open\\s*)?(solaris)/i)[1..-1].compact.map { |s| s.capitalize }.join\n version = `uname -r`.strip\n nickname = \"#{distro} #{version.split('.')[-1]}\"\n if distro == \"OpenSolaris\"\n nickname = File.read(\"/etc/release\").match(/OpenSolaris [a-zA-Z0-9.]\\+/i)[0].strip\n end\n @@os_features.merge!({\n :platform => \"solaris\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg install\",\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n })\n end\n\n # *BSD Miner\n bsd_miner = lambda do\n distro = `uname -s`.strip\n version = `uname -r`.strip\n @@os_features.merge!({\n :platform => \"bsd\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg_add -r\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # BeOS Miner\n beos_miner = lambda do\n version = `uname -r`.strip\n distro = `uname -s`.strip\n @@os_features.merge!({\n :platform => \"beos\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"build\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # Windows Miner\n windows_miner = lambda do\n sysinfo = `reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\"`.chomp\n\n hostname = `reg query \"HKEY_LOCAL_MACHINE\\\\System\\\\CurrentControlSet\\\\Control\\\\ComputerName\\\\ComputerName\"`.chomp\n hostname = hostname.match(/^\\s*ComputerName\\s+\\w+\\s+(.*)/i)[1].strip\n\n version = sysinfo.match(/^\\s*CurrentVersion\\s+\\w+\\s+(.*)/i)[1].strip << \".\"\n version << sysinfo.match(/^\\s*CurrentBuildNumber\\s+\\w+\\s+(.*)/i)[1].strip\n\n nickname = sysinfo.match(/^\\s*ProductName\\s+\\w+\\s+(.*)/i)[1].strip\n nickname = \"Microsoft #{nickname}\" unless nickname =~ /^Microsoft/\n\n try_boot_ini = `type C:\\\\boot.ini 2> nul | findstr /C:\"WINDOWS=\"`.chomp\n unless try_boot_ini.empty?\n nickname = try_boot_ini.match(/WINDOWS=\"([^\"]+)\"/i)[1].strip\n end\n\n install_method, install_cmd = case ::RbConfig::CONFIG['host_os'].downcase\n when /mingw/; [\"build\", nil]\n when /mswin/; [\"install\", \"install\"]\n when /cygwin/; [\"install\", \"setup.exe -q -D -P\"] # TODO - Does this detect cygwin properly?\n end\n ret = {\n :os_distro => nickname.split(/\\s+/).reject { |s| s =~ /microsoft|windows/i }.join(\" \"),\n :hostname => hostname,\n :os_nickname => nickname,\n :os_version => version,\n :platform => \"windows\", # TODO - Cygwin / MinGW\n :install_method => install_method,\n :install_cmd => install_cmd,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n case ::RbConfig::CONFIG['host_os'].downcase\n when /darwin/; mac_miner[]\n when /mswin|mingw/; windows_miner[]\n when /linux/; linux_miner[]\n when /bsd/; bsd_miner[]\n when /solaris/; solaris_miner[]\n else\n case `uname -s`.chomp.downcase\n when /linux/; linux_miner[]\n when /darwin/; mac_miner[]\n when /solaris/; solaris_miner[]\n when /bsd/; bsd_miner[]\n when /dragonfly/; bsd_miner[]\n when /haiku/; beos_miner[]\n when /beos/; beos_miner[]\n end\n end\n\n @@os_features.freeze\n end", "def os\n return @os if @os\n raw_os = RbConfig::CONFIG['target_os']\n match = raw_os.match(/([a-z]+)/)\n if match\n @os = match[1]\n else\n @os = raw_os\n end\n end", "def parse_operating_system(lines)\n parse_indented_section(lines, 'Operating system:', :os)\n\n if @tags[:os]\n @extra[:server] ||= {}\n @extra[:server][:os] = {\n name: @tags[:os],\n version: @tags[:os_full]\n }\n end\n end" ]
[ "0.71812075", "0.68334085", "0.68334085", "0.587645", "0.587645", "0.5864988", "0.5864988", "0.55708003", "0.55708003", "0.55708003", "0.5568457", "0.52787787", "0.5254271", "0.5254271", "0.5193076", "0.5176393", "0.5176393", "0.50513387", "0.5029917", "0.49848616", "0.4969703", "0.4969703", "0.4959561", "0.49577475", "0.4946953", "0.4943028", "0.48880795", "0.48632544", "0.4859979", "0.48479527", "0.4846983", "0.4836765", "0.483448", "0.48300186", "0.48230994", "0.48176524", "0.48114705", "0.47978297", "0.479608", "0.47937742", "0.47899204", "0.47620013", "0.47620013", "0.47594947", "0.47357386", "0.47350487", "0.47159114", "0.47159114", "0.47146216", "0.4706976", "0.47057745", "0.4702426", "0.46972698", "0.46899715", "0.46875164", "0.46666455", "0.46597117", "0.46482527", "0.4648235", "0.46455234", "0.4637613", "0.46356076", "0.46351853", "0.46339938", "0.46281698", "0.46240658", "0.46137404", "0.46126798", "0.46120268", "0.46025273", "0.45946816", "0.4594664", "0.4591898", "0.45858938", "0.45784265", "0.45698684", "0.45698684", "0.45698684", "0.45698684", "0.45689747", "0.45639867", "0.4560973", "0.4556588", "0.4556588", "0.4555352", "0.45412654", "0.45410204", "0.45315218", "0.45137674", "0.45116696", "0.45093688", "0.4508272", "0.45001388", "0.44995838", "0.449885", "0.44958767", "0.4482727", "0.44723773", "0.44717073", "0.44602895" ]
0.8417662
0
Serializes information the current object
def serialize(writer) raise StandardError, 'writer cannot be null' if writer.nil? super writer.write_enum_value("applicableArchitectures", @applicable_architectures) writer.write_enum_value("applicableDeviceTypes", @applicable_device_types) writer.write_collection_of_object_values("committedContainedApps", @committed_contained_apps) writer.write_string_value("identityName", @identity_name) writer.write_string_value("identityPublisherHash", @identity_publisher_hash) writer.write_string_value("identityResourceIdentifier", @identity_resource_identifier) writer.write_string_value("identityVersion", @identity_version) writer.write_boolean_value("isBundle", @is_bundle) writer.write_object_value("minimumSupportedOperatingSystem", @minimum_supported_operating_system) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n end", "def serialize(object) end", "def serialize; end", "def serialize; end", "def serialize\n \n end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def dump\r\n super + to_s\r\n end", "def serialize\n self.to_hash.to_json\n end", "def serialized\n serializer_class.new(self).serializable_hash\n end", "def serialize\n @raw_data\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end", "def serialize\n @serializer.serialize(self.output)\n end", "def serialize(_object, data); end", "def serialize(_object, data); end", "def to_json\n\t\t\tself.instance_variable_hash\n\t\tend", "def serializer; end", "def serialize!\n end", "def serialize(object)\n object.serializable_hash\n end", "def serialize(object)\n object.to_s\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def inspect\n serialize.to_s\n end", "def serialize\n YAML::dump(self)\n end", "def inspect()\n serialize.to_s()\n end", "def inspect()\n serialize.to_s()\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end", "def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end", "def serialize(object, data); end", "def serialize\n JSON.generate(to_h)\n end", "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end", "def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end", "def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end", "def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend", "def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end", "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end", "def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end", "def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend", "def inspect\n serialize.to_s\n end", "def inspect\n serialize.to_s\n end", "def inspect\n serialize.to_s\n end", "def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end", "def serializable_hash\n self.attributes\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end", "def serialize\n JSON.dump(@hash)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end", "def to_s\r\n dump\r\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end", "def serialize(io)\n Encoder.encode(io, self)\n io\n end", "def _dump() end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end", "def _dump()\n #This is a stub, used for indexing\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end", "def inspect\n self.to_hash.inspect\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end", "def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end", "def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end", "def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end" ]
[ "0.7951372", "0.7645999", "0.7579812", "0.7579812", "0.7440032", "0.720861", "0.720861", "0.7207583", "0.7016516", "0.70007193", "0.6992252", "0.69838214", "0.69723576", "0.69666415", "0.69666415", "0.6942002", "0.69417155", "0.6933786", "0.6913977", "0.6891677", "0.68810964", "0.687664", "0.687664", "0.687664", "0.6875119", "0.68510306", "0.68364877", "0.68364877", "0.6825542", "0.6815931", "0.68061364", "0.68006235", "0.67944074", "0.67717844", "0.67341864", "0.67289317", "0.66964674", "0.66828746", "0.6673492", "0.6668077", "0.6666333", "0.6659732", "0.6656788", "0.66513675", "0.6635875", "0.66275525", "0.66275525", "0.66275525", "0.6627384", "0.66165835", "0.66141444", "0.6611379", "0.6597342", "0.65968686", "0.6594517", "0.6592636", "0.6583964", "0.6580536", "0.65803635", "0.6575503", "0.65716475", "0.65712893", "0.6566952", "0.6560253", "0.65554273", "0.65410006", "0.65378475", "0.65346783", "0.6527361", "0.6525178", "0.65242875", "0.65235287", "0.65174305", "0.65141636", "0.6508169", "0.6499713", "0.6498714", "0.6496881", "0.6486202", "0.6482482", "0.64814615", "0.6479782", "0.6476621", "0.6475453", "0.64677024", "0.64633876", "0.64619535", "0.6461202", "0.6457243", "0.64497435", "0.6439583", "0.6433183", "0.643078", "0.6424316", "0.6420337", "0.6420337", "0.6420337", "0.6420337", "0.6420337", "0.6418776", "0.64156514" ]
0.0
-1
the old profile page had review filter on the main profile page. These are the params used to come across in the query string. Here I'm redirecting to the new profile reviews page, WITHOUT those parameters...I am not attempting to translate the old param values in the the new ones.
def redirect_old_review_filters old_params = [:min_rating, :N, :Ne, :Nf, :Nrc, :Ns, :page, :sort] if old_params.inject(false) { |memo, key| memo |= params.has_key?(key) } permanent_redirect_to :profile_mode => @profile_mode, :screen_name => params[:screen_name], :controller => 'profile_reviews', :action => 'index', :N => params[:N] return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_review_status # :norobots:\n pass_query_params\n id = params[:id].to_s\n desc = NameDescription.find(id)\n if is_reviewer?\n desc.update_review_status(params[:value])\n end\n redirect_to(:action => 'show_name', :id => desc.name_id,\n :params => query_params)\n end", "def redirect_legacy_filter_params\n if params[:filter_public_domain].present? && params[:filter_public_domain] != \"0\"\n new_params = params.to_unsafe_h.deep_dup\n new_params.delete(:filter_public_domain)\n new_params[:f] ||= {}\n new_params[:f][:rights_facet] ||= {}\n new_params[:f][:rights_facet] = [\"http://creativecommons.org/publicdomain/mark/1.0/\"]\n\n # for safety, run through url_for with only_path\n redirect_to url_for(new_params.merge(only_path: true)), :status => :moved_permanently\n elsif params[:filter_copyright_free].present? && params[:filter_copyright_free] != \"0\"\n new_params = params.to_unsafe_h.deep_dup\n new_params.delete(:filter_copyright_free)\n new_params[:f] ||= {}\n new_params[:f][:rights_facet] ||= {}\n new_params[:f][:rights_facet] = [\"Copyright Free\"]\n\n # for safety, run through url_for with only_path\n redirect_to url_for(new_params.merge(only_path: true)), :status => :moved_permanently\n end\n end", "def correct_review\n where = params[\"review_id\"].blank? ? :id : :review_id \n @review = Review.find(params[where])\n redirect_to(root_path) unless current_user?(@review.user)\n end", "def filter_redirect; end", "def filter_redirect; end", "def strip_reheat_params(env)\n return unless param = Storehouse.reheat_param\n\n query = env['QUERY_STRING']\n query = query.gsub(/#{param}=?([^&]+)?&?/, '')\n env['QUERY_STRING'] = query\n end", "def cleanup_parameters\n original_count = params.keys.size\n\n # Eliminate \"noise\" parameters.\n params.delete_if { |k, v| k.blank? || v.blank? }\n %w[utf8 commit].each { |k| params.delete(k) }\n\n # If parameters were removed, redirect to the corrected URL.\n will_redirect unless params.keys.size == original_count\n end", "def back_with_params(o = {})\n rejected_keys = [:password] # these won't be passed back to the page\n back_to = request.referer ? request.referer : '/'\n params_string = params.blank? ? '' : \"?#{ build_query(o.merge(params).delete_if { |k, v| rejected_keys.include?(k.to_sym) }) }\"\n \n back_to + params_string\n end", "def sanitize_page_params\n params[:per_page] = params[:per_page].to_i\n params[:go_to_page] = params[:go_to_page].to_i\n end", "def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end", "def redirect_hash_facet_params\n if params[:f].respond_to?(:transform_values) && params[:f].values.any? { |x| x.is_a?(Hash) }\n original_f_params = params[:f].to_unsafe_h\n corrected_params = {}\n\n corrected_params[:f] = original_f_params.transform_values do |value|\n value.is_a?(Hash) ? value.values : value\n end\n\n redirect_to helpers.safe_params_merge_url(corrected_params), :status => :moved_permanently\n end\n end", "def inject_last_query_into_params\n if current_search_session\n current_search_params = current_search_session.query_params.empty? ? {} : current_search_session.query_params\n params.merge!(current_search_params.reject {|k,v| [\"controller\",\"action\"].include?(k)})\n end\n end", "def legacy\n redirect_to(params.update(action:'main'))\n end", "def redirect_to_full_path\n redirect_to swinfo_full_path(params[:item].strip,\n (params[:sort] || DEFAULT_SORT_ORDER).strip,\n (params[:page] || '1').strip)\n end", "def add_facet_params_and_redirect(field, value)\n new_params = add_facet_params(field, value)\n\n # Delete page, if needed. \n new_params.delete(:page)\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly. \n Blacklight::Solr::FacetPaginator.request_keys.values.each do |paginator_key| \n new_params.delete(paginator_key)\n end\n new_params.delete(:id)\n\n url = params_for_url (new_params[:q].empty? ? new_params[:f] : new_params[:q].merge(new_params[:f]))\n if field.include? Blacklight.config[:facet][:a_to_z][:common_key_name]\n return url + \"&catalog_facet.prefix=\" + value\n else\n return url\n end\n end", "def filter_redirect=(_arg0); end", "def filter_redirect=(_arg0); end", "def search_redirect\n @objects = params.except(\"utf8\")\n @objects = @objects.except(\"button\")\n \n @general_queries = GeneralInfo.search @objects\n \n flash[:general_queries] = get_user_keys @general_queries\n \n if @objects[:profession] == \"1\"\n redirect_to specific_designer_search_path \n elsif @objects[:profession] == \"2\"\n redirect_to specific_model_search_path \n elsif @objects[:profession] == \"3\"\n redirect_to specific_photographer_search_path \n else\n redirect_to root_path\n end\n end", "def add_facet_params_and_redirect(field, item)\n new_params = add_facet_params(field, item)\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly.\n new_params.except! *Blacklight::Solr::FacetPaginator.request_keys.values\n\n new_params\n end", "def the_update_redirect; {:action => 'index'}; end", "def add_facet_params_and_redirect(field, item)\n new_params = add_facet_params(field, item)\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly.\n request_keys = blacklight_config.facet_paginator_class.request_keys\n new_params.except! *request_keys.values\n\n # Force controller#action to be catalog#index.\n new_params[:action] = \"index\"\n new_params[:controller] = \"catalog\"\n new_params\n end", "def add_facet_params_and_redirect(field, item)\n new_params = add_facet_params(field, item)\n\n # Delete page, if needed. \n new_params.delete(:page)\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly. \n Blacklight::Solr::FacetPaginator.request_keys.values.each do |paginator_key| \n new_params.delete(paginator_key)\n end\n new_params.delete(:id)\n\n # Force action to be index. \n new_params[:action] = \"index\"\n new_params \n end", "def prev_location_description # :nologin: :norobots:\n redirect_to_next_object(:prev, LocationDescription, params[:id].to_s)\n end", "def add_tag_params_and_redirect(tag)\n new_params = add_tag_params(tag)\n\n # Delete page, if needed.\n new_params.delete(:page)\n\n Blacklight::Solr::FacetPaginator.request_keys.values.each do |paginator_key|\n new_params.delete(paginator_key)\n end\n new_params.delete(:id)\n\n # Force action to be index.\n new_params[:controller] = \"catalog\"\n new_params[:action] = \"index\"\n new_params\n end", "def rel_prev_href_params(records, original_params = original_request_params.clone)\n @rel_prev_href_params ||= records.is_a?(WillPaginate::Collection) && records.previous_page ?\n original_params.merge({ :page => records.previous_page }) : nil\n end", "def link_to_previous_advanced_search(params)\n link_to(parseHistoryShowString(params), parseHistoryQueryString(params))\n end", "def redirect_original(request, state_params, site)\n response = Rack::Response.new\n # Note that app_callback_url is added by OmniAuth.config.before_request_phase\n # any value provided by a client will be overwritten in that method so that we\n # don't use/trust values sent by the client\n return_url = state_params[\"app_callback_url\"]\n query = OauthStateMiddleware.query_string(request.params, SecureRandom.hex(64))\n return_url << \"?\"\n return_url << signed_query_string(query, site.secret)\n response.redirect return_url\n response.finish\n end", "def search_redirect\n return if SEARCH_CONTROLLERS.include?(params[:controller]&.to_sym)\n query = request_parameters\n return if query.slice(:q, :title, :creator, :identifier).blank?\n redirect_to query.merge!(controller: DEFAULT_SEARCH_CONTROLLER)\n end", "def merge_default_redirect_params(redirect_route, extra_params={})\n merged_redirect_url = redirect_route.dup\n extra_params.each do |key, value|\n if value.present?\n if redirect_route.include?('?')\n merged_redirect_url += \"&#{key}=#{value}\"\n else\n merged_redirect_url += \"?#{key}=#{value}\"\n end\n end\n end\n merged_redirect_url\n end", "def merge_default_redirect_params(redirect_route, extra_params={})\n merged_redirect_url = redirect_route.dup\n extra_params.each do |key, value|\n if value.present?\n if redirect_route.include?('?')\n merged_redirect_url += \"&#{key}=#{value}\"\n else\n merged_redirect_url += \"?#{key}=#{value}\"\n end\n end\n end\n merged_redirect_url\n end", "def visitor_review_params\n params.fetch(:visitor_review, {})\n end", "def update!(**args)\n @location_reviews = args[:location_reviews] if args.key?(:location_reviews)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def add_facet_params_and_redirect(field, value)\n new_params = super\n\n # Delete :qt, if needed - added to resolve NPE errors\n new_params.delete(:qt)\n\n new_params\n end", "def test_review_page__review_read_display_id_qs\r\n permanent_redirect_test '/review/read/443881e2-c379-11db-84ee-0017f900008?s_kwcid=ContentNetwork|749319894', '/Ear-Force-X2-Wireless-Headphones-for-Xbox-review-a1b2?s_kwcid=ContentNetwork%7C749319894'\r\n end", "def query_string_params\n super + [:chg]\n end", "def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:crm_borrowed_items_search_details] != nil\n @search = session[:crm_borrowed_items_search_details]\n else\n @search = CrmBorrowedItemsSearchDetails.new\n end\n \n new_search = false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| new_search = true unless @search.send(k) == search_params[k] }\n else\n new_search = true\n end\n \n if new_search\n session[:crm_borrowed_items_search_details] = []\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:crm_borrowed_items_search_details] = @search\n end\n \n end", "def add_facet_params_and_redirect(field, item)\n new_params = filter(field).add(item).to_h\n\n # Delete any request params from facet-specific action, needed\n # to redir to index action properly.\n request_keys = blacklight_config.facet_paginator_class.request_keys\n new_params.extract!(*request_keys.values)\n\n new_params\n end", "def reset_search_params source_params\n sanitize_search_params(source_params).except(:page, :counter).with_indifferent_access\n end", "def link_back_to_catalog(opts={:label=>nil})\n pageNumber = 1\n query_params = session[:search] ? session[:search].dup : {}\n if query_params[:per_page].nil?\n query_params[:per_page] = \"20\"\n end\n test = (query_params[:counter].to_i % query_params[:per_page].to_i)\n if (query_params[:counter].to_i % query_params[:per_page].to_i).to_s == '0'\n pageNumber = (query_params[:counter].to_i / query_params[:per_page].to_i)\n else\n pageNumber = (query_params[:counter].to_i / query_params[:per_page].to_i) + 1\n end\n\n query_params[:page] = pageNumber.to_s\n\n\n if !query_params[:q_row].nil?\n if (!query_params[:q_row].nil? && query_params[:q_row].size == 2)\n if query_params[:q_row][1] == ''\n query_params[:q] = query_params[:q_row][0]\n query_params.delete(:q_row)\n query_params[:search_field] = query_params[:search_field_row][0]\n query_params.delete(:search_field_row)\n query_params.delete(:op_row)\n query_params.delete(:boolean_row)\n query_params.delete(:advanced_query)\n #query_params.delete(:total)\n end\n session[:search] = query_params\n end\n end\n Rails.logger.debug(\"es287_debug !!!!!!#{__FILE__}:#{__LINE__} search = #{session[:search].inspect}\")\n Rails.logger.debug(\"es287_debug !!!!!!#{__FILE__}:#{__LINE__} query_params = #{query_params.inspect}\")\n query_params.delete :counter\n # query_params.delete(:total)\n if params[:controller] == 'search_history'\n link_url = url_for(action: 'index', controller: 'search', only_path: false, protocol: 'https')\n #link_url = url_for(query_params)\n else\n Rails.logger.debug(\"es287_debug !!!!!!#{__FILE__}:#{__LINE__} qp = #{query_params.inspect}\")\n link_url = url_for(query_params)\n end\n\n if link_url =~ /bookmarks/ || params[:controller] == 'bookmarks'\n opts[:label] ||= t('blacklight.back_to_bookmarks')\n link_url = bookmarks_path\n end\n\n opts[:label] ||= t('blacklight.back_to_search')\n\n link = {}\n link[:url] = link_url\n link[:label] = opts[:label]\n\n return link\n end", "def redirect_original(request, state_params, site)\n response = Rack::Response.new\n # Note that app_callback_url is added by OmniAuth.config.before_request_phase\n # any value provided by a client will be overwritten in that method so that we\n # don't use/trust values sent by the client\n return_url = state_params[\"app_callback_url\"]\n query = query_string(request, SecureRandom.hex(64))\n return_url << \"?\"\n return_url << signed_query_string(query, site.secret)\n response.redirect return_url\n response.finish\n end", "def similar_list_page options_changed\n param_hash_to_link_hash params.merge( options_changed )\n end", "def hashify_query_string\n if request.query_string && request.query_string.length > 0\n redirect_to request.url.gsub('?', '#')\n return true\n end\n return false\n end", "def prev_name_description # :nologin: :norobots:\n redirect_to_next_object(:prev, NameDescription, params[:id].to_s)\n end", "def reset_filter_params\n params[:search] = nil\n params[:status] = nil\n params[:unassigned] = nil\n params[:assigned_to_me] = nil\n params[:needs_attention] = nil\n params[:year] = nil\n end", "def check_query\n redirect_to :action=>'show', :id=>params[:query]\n end", "def review_params\n\n params_new = params.require(:review).permit(:rating, :comments)\n params_new[:customer_id] = session[:customer_id]\n @bookings = Booking.find(params[:id])\n params_new[:listing_id] = @bookings.listing_id\n params_new[:anonymous] = params[:anonymous]\n params_new\n end", "def additional_params\n params.to_unsafe_hash.delete_if do |key, _|\n SHOW_PAGE_PARAMS_KEYS.include?(key)\n end\n end", "def sp_session_request_url_with_updated_params\n return unless sp_session[:request_url].present?\n request_url = URI(sp_session[:request_url])\n url = if request_url.path.match?('saml')\n sp_session[:final_auth_request] = true\n complete_saml_url\n else\n sp_session[:request_url]\n end\n\n # If the user has changed the locale, we should preserve that as well\n if url && locale_url_param && UriService.params(url)[:locale] != locale_url_param\n UriService.add_params(url, locale: locale_url_param)\n else\n url\n end\n end", "def reset_search_params\n Parameters.sanitize(to_h).except(:page, :counter)\n end", "def prev_location # :nologin: :norobots:\n redirect_to_next_object(:prev, Location, params[:id].to_s)\n end", "def edit_user\n session[:prev_url] = request.referer if request.referer.present?\n end", "def link_back_to_catalog(opts={:label=>'Back to Search Results'})\n query_params = session[:search].dup || {}\n query_params.delete :counter\n query_params.delete :total\n # use ordered parameters of session[:orderly_search_params] instead\n query_params.delete :q\n query_params.delete :search_field\n query_params.delete :f\n orderly_query_params = session[:orderly_search_params]\n query = orderly_query_params ? orderly_query_params[:q] : {}\n facet_query = orderly_query_params ? orderly_query_params[:f] : {}\n orderly_query_faceting_parameters = params_for_url (query.empty? ? facet_query : query.merge(facet_query))\n other_params = catalog_index_path(query_params)\n link_url = other_params.include?(\"?\") ? other_params.split(\"?\")[0] + orderly_query_faceting_parameters + \"&\" + other_params.split(\"?\")[1] : other_params + orderly_query_faceting_parameters \n link_to opts[:label], link_url\n end", "def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:adv_crm_contacts_search_details] != nil\n @search = session[:adv_crm_contacts_search_details]\n else\n @search = CrmContactsAdvancedSearchDetails.new\n end\n \n newSearch=false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| \n if @search.send(k) != search_params[k]\n newSearch=true\n \n end\n }\n else\n newSearch=true\n end\n \n if newSearch\n session[:adv_crm_contacts_search_details]=[]\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:adv_crm_contacts_search_details] = @search\n end\n \n end", "def new_page_params\n return {} if params[:filter].blank?\n\n params[:filter].permit(:page_num, :length)\n end", "def legacy\n case params[:path][0]\n when 'list'\n if (params[:path][1] == 'novita.php')\n redirect_to :controller => 'books', :action => 'recent'\n elsif (params[:path][1] == 'sconti.php')\n redirect_to :controller => 'books', :action => 'offers'\n else\n redirect_to :controller => 'books', :action => 'list', :id => params[:path][1].sub('.php','').sub('_',' ')\n end\n when 'search.php'\n redirect_to :controller => 'books', :action => 'search'\n when 'links.php'\n redirect_to :controller => 'books', :action => 'links'\n else\n redirect_to '/' \n end\n end", "def modify_search_query\n query_data = params['q'] && params['q'][Garage::SearchPredicate]\n if query_data.present?\n params['q'][Garage::SearchPredicate] = query_data.split(' ')\n end\n end", "def prepare_saved_search_params\n # get previous advanced search from session if any\n if session[:crm_communication_search_details] != nil\n @search = session[:crm_communication_search_details]\n else\n @search = CrmCommunicationSearchDetails.new\n end\n \n newSearch=false\n search_params = params[:search]\n \n if !search_params.blank?\n search_params.keys.map{ |k| \n if @search.send(k) != search_params[k]\n newSearch=true\n \n end\n }\n else\n newSearch=true\n end\n \n if newSearch\n session[:crm_communication_search_details]=[]\n \n if !search_params.blank?\n search_params.keys.map{|k| @search.send(k+'=', search_params[k])}\n end \n session[:crm_communication_search_details] = @search\n end\n \n end", "def replace\n \n logger.info \"in replace\"\n logger.info params[:action]\n logger.info params[:id]\n \n @previous = params[:id]\n render :layout => false # no impact.\n end", "def show\r\n \r\n @free_filter = params[:freefilter]\r\n @uhd_filter = params[:uhdfilter]\r\n @search_string = params[:search] \r\n @start_dates = BroadcastEvent.current.distinct.pluck(:formatted_local_start_date).sort\r\n\r\n if params[:sport_name] && params[:sport_name] != params[:sport_name].downcase\r\n # handle URLs with uppercase sport name\r\n new_downcase_path = (\"/\" + params[:region_name] + \"/\" + params[:sport_name]).downcase\r\n redirect_to new_downcase_path, status: 301\r\n\r\n elsif params[:region_name] && params[:region_name] != params[:region_name].downcase\r\n # handle URLs with uppercase region name \r\n new_downcase_path = (\"/\" + params[:region_name]).downcase\r\n redirect_to new_downcase_path, status: 301\r\n\r\n elsif @search_string && @search_string != \"\"\r\n # GET /guides/:region_name/?search=:search\r\n @broadcast_events = @region.broadcast_events.joins(:program).where(formatted_local_start_date: @start_dates).where(\"programs.title like ? or programs.episode_title like ?\", \"%#{@search_string}%\", \"%#{@search_string}%\").includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n elsif @sport\r\n # GET /guides/:region_name/:sport_name \r\n @broadcast_events = @region.broadcast_events.where(formatted_local_start_date: @start_dates).where(sports: {id: @sport.id}).includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n else\r\n # GET /guides/:region_name\r\n @broadcast_events = @region.broadcast_events.where(formatted_local_start_date: @start_dates).includes(:program, :broadcast_service, :region, :channel, :keyword, :sport).ordered_for_tv_guide\r\n \r\n end \r\n \r\n if @free_filter && (@free_filter == \"true\")\r\n # GET /guides/:region_name/?freefilter=:freefilter\r\n # GET /guides/:region_name/:sport_name/?freefilter=:freefilter\r\n @broadcast_events = @broadcast_events.joins(:channel => :provider).where(channels: {providers: {service_tier: \"Free\"}})\r\n end\r\n if @uhd_filter && (@uhd_filter == \"true\")\r\n # GET /guides/:region_name/?uhd_filter=:uhd_filter\r\n # GET /guides/:region_name/:sport_name/?uhd_filter=:uhd_filter\r\n @broadcast_events = @broadcast_events.where(channels: {four_k_flag: true})\r\n end\r\n\r\n end", "def adjust_for_parameters(params)\n params = params[\"filter\"] if params[\"filter\"]\n \n #self.paginate = false\n if params && params[\"paginate\"]\n self.paginate = true\n self.paginate = false if params[\"do_viewall\"]\n elsif params && params[\"viewall\"]\n self.paginate = false\n self.paginate = true if params[\"do_paginate\"]\n end\n \n #--- set up perpage\n if params && params[\"perpage\"]\n self.set_items_per_page(params[:perpage])\n end\n\n params[\"dropdowns\"].each_pair do |name,value|\n dropdowns[name][\"value\"] = value if dropdowns[name]\n end if params && params[\"dropdowns\"] # do params\n \n params[\"custom_fields\"].each_pair do |name,value|\n custom_fields[name][\"value\"] = CUSTOM_DEFAULT_VALUE \n custom_fields[name][\"value\"] = value if custom_fields[name] && value!=CUSTOM_VALUE_FOR_ALL \n end if params && params[\"custom_fields\"] # do params\n \n params[\"boolean_fields\"].each_pair do |name,value|\n boolean_fields[name][\"value\"] = BOOLEAN_VALUE_FOR_ALL \n boolean_fields[name][\"value\"] = value if boolean_fields[name] && value!=BOOLEAN_VALUE_FOR_ALL \n end if params && params[\"boolean_fields\"] # do params\n \n if params[:sort_by] #&& params[:old_sort_by] && params[:old_sort_by_order]\n \n self.sort_by = params[:sort_by]\n self.sort_by_order = params[:old_sort_by_order] == 'ASC' ? 'ASC' : 'DESC'\n if params[:old_sort_by] == params[:sort_by] && params[:sort_by_order_flip] == 'yes'\n self.sort_by_order = params[:old_sort_by_order] == 'DESC' ? 'ASC' : 'DESC' \n end\n \n self.sql_sortorder = \"#{self.sort_by} #{self.sort_by_order}\"\n self.sql_sortorder += \", #{self.secondary_sort}\" unless self.secondary_sort.blank?\n \n end # if sort_order \n \n params[\"dates\"].each_pair do |name,value|\n if dates[name]\n dates[name][\"value\"] = Date.new(\n value[\"date(1i)\"].to_i,\n value[\"date(2i)\"].to_i,\n value[\"date(3i)\"].to_i\n )\n end\n end if params && params[\"dates\"] # do params\n \n self.search_string = RFilter.sanitize_sql(params[\"search_for\"]) if params && params[\"search_for\"]\n\n generate_sql_conditions\n end", "def gocardless_redirect_params\n {\n params: {\n description: 'Demo GoCardless',\n session_token: \"#{current_user.id}\",\n success_redirect_url: \"#{root_url}/confirm_mandate\",\n prefilled_customer: {\n email: \"#{current_user.email}\"\n }\n }\n }\n end", "def link_to_previous_search(params)\n query_part = params[:qt] == Blacklight.config[:default_qt] ? params[:q] : \"#{params[:qt]}:(#{params[:q]})\"\n facet_part = \n if params[:f]\n tmp = \n params[:f].collect do |pair|\n \"#{Blacklight.config[:facet][:labels][pair.first]}:#{pair.last}\"\n end.join(\" AND \")\n \"{#{tmp}}\"\n else\n \"\"\n end\n link_to(\"#{query_part} #{facet_part}\", catalog_index_path(params))\n end", "def index\n # this is our list page for our review\n # variable is @.\n # creating a filter variable for price\n @price = params[:price]\n #creating a filter variable for cuisine\n @cuisine = params[:cuisine]\n # adding location filter using geocoder\n @location = params[:location]\n\n #filtering properly by get all the reviews \"Review\" model from the database\n #creating new review variable as ruby list[]\n #@reviews = [\"The Smile\", \"Baby Bo's\", \"Chipotle\", \"nandos\"]\n @reviews = Review.all\n\n # filtering by price. this will toggle on/off depend when it has filter\n if @price.present?\n #take all of the review we have and replace the original review with filtered ones\n # find the value of the price in db that matches the param above\n @reviews = @reviews.where(price: @price)\n end\n\n #filter by cuisine\n if @cuisine.present?\n @reviews = @reviews.where(cuisine: @cuisine)\n end\n #search near the location\n if @location.present?\n # .near is what geo lcation given to us - see docs\n @reviews = @reviews.near(@location)\n end\n\n end", "def redirect_updated_user(user, user_params)\n#store update result\n success = user.update(user_params)\n#set action\n action = params[:user][:action]\n#set messages\n messages = user_errors(user) if !success\n#set appropriate path\n path = controller\n path = \"#{action}_#{controller}\" if !success && controller == \"users\"\n path = \"#{action}_#{controller}\" if !success && controller == \"quests\"\n path = \"error_#{action}\" if !success && non_quest_attribute\n\n case path\n#first set of paths are for attribute index pages\n when \"family_members\"\n redirect_to user_family_members_path(user)\n\n when \"subscriptions\"\n redirect_to user_subscriptions_path(user)\n\n when \"priority_items\"\n redirect_to user_priority_items_path(user)\n\n when \"disciplines\"\n redirect_to user_disciplines_path(user)\n\n when \"inspirations\"\n redirect_to user_inspirations_path(user)\n\n when \"quests\"\n redirect_to user_objectives_path(user)\n\n when \"family_members\"\n redirect_to user_family_members_path(user)\n#next set of paths are for invalid update to user for quests new and edit\n when \"new_quests\"\n redirect_to quest_new_page, set: flash[:messages] = messages\n\n when \"edit_quests\"\n redirect_to quest_edit_page, set: flash[:messages] = messages\n#these two sets are for invalid update to user for nested attributes new and edit\n when \"error_new\"\n redirect_to attribute_new_page, set: flash[:messages] = messages\n\n when \"error_edit\"\n redirect_to attribute_edit_page, set: flash[:messages] = messages\n#lastly invalid update to user for editing user\n when \"edit_users\"\n redirect_to edit_user_url, set: flash[:messages] = messages\n\n else\n redirect_to user\n end\n end", "def current_url(new_params)\n url_for params: params.permit!.merge(new_params) # allow all params already passed\n end", "def post\n\t redirect_to search_path( query: params[:query] )\n\tend", "def sanitize_params\n params.require(:page)\n params.permit(:q, :page, :city)\n\n params[:page] = params[:page].to_i\n end", "def filter_params\n if not @params_filtered\n # these values are automatically persisted\n # via the session\n @current_map = select_param :map, :symbol => true\n @current_language = select_param :lang\n @current_scope = select_param :scope\n @current_id = select_param :id\n # update the view state with values that must be communicated down-stream\n properties = PropertySet.new()\n properties[:language] = @current_language\n properties[:scope] = @current_scope\n properties[:map] = @current_map\n properties[:home] = Globals::DEFAULT[:id]\n @view_state[:properties] = properties\n @view_state[:languages] = Globals::LANGUAGES\n @view_state[:scopes] = Globals::SCOPES\n @view_state[:maps] = Globals::MAPS\n @view_state[:notice] = PropertySet.new()\n @view_state[:error] = PropertySet.new()\n @view_state[:success] = PropertySet.new()\n @params_filtered = true\n end\n end", "def redirection_params\n options.slice(:redirect_uri).stringify_keys\n end", "def restore_for_guest_user\n if resetting_search?\n session.delete :search\n elsif actively_searching?\n session[:search] = {\n model: search_key,\n params: {\n s: params[:s].dup,\n fs: params[:fs].dup,\n f: params[:f].dup,\n scope: params[:scope].dup\n }\n }\n elsif session[:search] && session[:search]['model'] == controller_name\n redirect_to session[:search]['params'].merge(action: params[:action])\n end\n end", "def redirection_to\n URI(\"#{ENV['DOMAIN_URL']}/deposits/?#{query_params}\").to_s\n end", "def search_redirect\n # URI::encode handles spaces and other characters in search field\n redirect_to \"/blog/search/#{URI::encode params[:query]}\"\n end", "def generate_next_url\n if eds_session.has_key? :query_string\n url = HTMLEntities.new.decode eds_session[:query_string]\n\n #blacklight expects the search term to be in the parameter 'q'.\n #q is moved back to 'query-1' in 'generate_api_query'\n #should probably pull from Info method to determine replacement strings\n #i could turn the query into a Hash, but available functions to do so delete duplicated params (Addressable)\n url.gsub!(\"query-1=AND,TI:\", \"q=\")\n url.gsub!(\"query-1=AND,AU:\", \"q=\")\n url.gsub!(\"query-1=AND,SU:\", \"q=\")\n url.gsub!(\"query-1=AND,\", \"q=\")\n\n #Rails framework doesn't allow repeated params. turning these into arrays fixes it.\n url.gsub!(\"facetfilter=\", \"facetfilter[]=\")\n url.gsub!(\"limiter=\", \"limiter[]=\")\n\n #i should probably pull this from the query, not the URL\n if (params[:search_field]).present?\n url << \"&search_field=\" << params[:search_field].to_s\n end\n return url\n else\n return ''\n end\n end", "def modify_page(i)\n query = env['QUERY_STRING']\n found_page = false\n if query && !query.empty?\n query = query.sub(/page=(\\d+)(\\z|&)/) do\n found_page = true\n \"page=#{$1.to_i+i}#{$2}\"\n end \n if found_page == false && i == 1\n query += \"&page=2\"\n end\n elsif i == 1\n query = \"page=2\"\n end\n\n \"#{env['PATH_INFO']}?#{query}\"\n end", "def instagram_users_redirect\n if params[:user].present?\n redirect_to search_results_path(params[:source], params[:user])\n else\n flash[:errors] = \"Please enter a username to search.\"\n redirect_to search_path\n end\n end", "def prev_rss_log # :norobots:\n redirect_to_next_object(:prev, RssLog, params[:id].to_s)\n end", "def stringify_nonpagination_query_params\n other_params = @paginable_params.select do |param|\n ![:page, :sort_field, :sort_direction, :search, :controller, :action].include?(param)\n end\n return other_params.empty? ? '' : \"&#{other_params.collect{ |k, v| \"#{k}=#{v}\" }.join('&')}\"\n end", "def process_params!(params)\n #params.dup.update(user: current_user)\n params.merge!(current_user: current_user)\n end", "def original_params\n @original_params || params\n end", "def amend origin_url\n origin_url.sub! /^\"?([^\"]*)\"?/, '\\\\1' # Remove any enclosing quotes\n query_str = (match = origin_url.match /^[^?]*\\?(.*)/ ) ? match[1] : \"\"\n query_params = query_str.empty? ? {} : Hash[ CGI.parse(query_str).map { |elmt| [elmt.first.to_sym, elmt.last.first] } ]\n # Format refers to how to present the content: within a dialog, or on a page\n @mode = query_params[:mode]\n end", "def filter\n if !params[:category_url_name].blank? && !params[:archive_date].blank?\n redirect_to news_category_archive_path(params[:category_url_name], params[:archive_date])\n elsif !params[:category_url_name].blank?\n redirect_to news_category_path(params[:category_url_name])\n elsif !params[:archive_date].blank?\n redirect_to news_archive_path(params[:archive_date])\n else\n redirect_to news_path\n end\n end", "def ajax_get_new_page\n case params[ :type ] \n when \"following\" , \"followers\" \n data = User.fetch_follow( params[ :id ] , current_user , params[ :type ], params[ :page ] ) [ \"data\" ]\n @user_list = data[ \"users\" ] \n @user_agree = data[ \"pending\" ] \n when \"commentlike\" , \"story\"\n query = {\n \"activity_ids[before]\" => params[ :activity ] ,\n \"comment_ids[before]\" => params[ :comment ] ,\n \"like_ids[before]\" => params[ :like ] \n }\n if params[ :type ] == \"story\" \n data = User.fetch_moments( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"moments\" ]\n @user = User.fetch( params[ :id ] , current_user , nil ) [ \"data\" ]\n else \n data = User.fetch_commentlike( params[ :id ] , current_user , query ) [ \"data\" ]\n @feeds = data[ \"likes_and_comments\" ]\n end\n @qparams = data[ \"next_query_parameters\" ] \n @qparams[ \"activity_ids\" ] = { \"before\" => params[ :activity ] } if @qparams[ \"activity_ids\" ] .nil?\n @qparams[ \"comment_ids\" ] = { \"before\" => params[ :comment ] } if @qparams[ \"comment_ids\" ] .nil?\n @qparams[ \"like_ids\" ] = { \"before\" => params[ :like ] } if @qparams[ \"like_ids\" ] .nil?\n end\n render :layout => false\n end", "def link_to_prev_page\n params[:page] ||= 1\n link_to '<', request.params.update({ page: params[:page].to_i-1 }) unless params[:page].to_i == 1\n end", "def exclude_draft_and_approved solr_parameters, user_parameters\n solr_parameters[:fq] ||= []\n (Sufia.config.workflow_status - Sufia.config.review_dashboard_status).each do |s|\n solr_parameters[:fq] << '-'+Solrizer.solr_name(\"MediatedSubmission_status\", :symbol)+':'+s\n end\n end", "def prev_user # :norobots:\n redirect_to_next_object(:prev, User, params[:id].to_s)\n end", "def show\n @saved_search = SavedSearch.find(params[:id])\n @saved_search.car_model.gsub!(' ','_')\n query_str = \"year_to=#{@saved_search.year_to}&year_fr=#{@saved_search.year_fr}&modelstr=#{@saved_search.car_model}&price_fr=#{@saved_search.price_fr}&price_to=#{@saved_search.price_to}&keywords=#{@saved_search.keywords}\"\n\n redirect_to \"/ferraris?\"+query_str\n end", "def prev_user\n redirect_to_next_object(:prev, User, params[:id].to_s)\n end", "def remove_tag_params(tag, source_params=params)\n new_params = source_params.dup\n\n # need to dup the facet values too,\n # if the values aren't dup'd, then the values\n # from the session will get remove in the show view...\n new_params[:t] = (new_params[:t] || {}).dup\n new_params.delete :page\n new_params.delete :id\n new_params.delete :counter\n new_params.delete :commit\n new_params[:t].delete(tag)\n\n # Force action to be index.\n new_params[:controller] = \"catalog\"\n new_params[:action] = \"index\"\n new_params\n end", "def store_referrer_params\n { store_referrer_param_name => 1 }\n end", "def review_params\n parm = params.fetch(:review, {}).permit!\n p 'params', parm\n parm\n end", "def profile\n\n # redirect to kpass where they can edit their profile and provide a url\n # where they should return in our app. for example, we can provide the url\n # of the page the link was presented on, so they return there when they're\n # done editing their profile.\n # redirect_to \"#{ENV['KPASS_ENDPOINT']}?app_id=#{ENV['KPASS_APP_ID']}&return_to=#{URI::escape(params['return_to'])}\"\n\n profile_url = \"#{ENV['KPASS_ENDPOINT']}?app_id=#{ENV['KPASS_APP_ID']}&return_to=#{URI::escape(params['return_to'])}\"\n redirect_to profile_url\n end", "def inactive_success\r\n @review = Review.find_by_param params[:id]\r\n @web_analytics.review = @review\r\n track_review_success(@review) unless sharing?\r\n render 'inactive_success'\r\n end", "def review\n @page_title = 'Review Item: ' + @item.display_title\n @menu_title = 'Review Item'\n set_referer_as_redirect_back\n render 'review', layout: 'markup'\n end", "def slug_update\n slug = params[:slugfilter].upcase\n slug = \"\" if params[:clear]\n session[:slugfilter] = slug\n # TODO restore page state (e.g. drilldown)\n render :js => \"window.location.reload()\"\n end", "def product_revenue\n p '#{request.referer}'\n redirect_to \"http://www.google.com\" ,status: 301\n end", "def factureold_params\n params[:factureold]\n end", "def prev_rss_log\n redirect_to_next_object(:prev, RssLog, params[:id].to_s)\n end", "def pagination_prev_link\n prev_link = params.clone\n if params[:page].to_i - 1 > 0\n prev_link[:page] = prev_link[:page].to_i - 1\n prev_link\n else\n false\n end\n end", "def redirect_log_params\n params.require(:redirect_log).permit(:old_url, :new_url, :rule, :status)\n end", "def change_year\n \turl = request.referrer.split('/')\n\n #http://domain.name/:year/...\n \turl[3] = params[:new_year]\n \turl = url.join('/')\n\n\tredirect_to url\n\trescue ActionController::RedirectBackError\n\t\tredirect_to root_path\n end" ]
[ "0.61475843", "0.6129108", "0.6120188", "0.60081196", "0.60081196", "0.59394747", "0.5898609", "0.5879598", "0.58793443", "0.5776228", "0.577145", "0.5763739", "0.57447124", "0.5743676", "0.5727358", "0.5713074", "0.5713074", "0.5712933", "0.56751096", "0.5644288", "0.5622947", "0.56133974", "0.5610565", "0.5551461", "0.550346", "0.5477903", "0.5476807", "0.54766005", "0.54758394", "0.54758394", "0.54702795", "0.5443898", "0.5436672", "0.5423217", "0.53956264", "0.5392688", "0.5383061", "0.5365939", "0.5365202", "0.53650564", "0.53637034", "0.5358021", "0.5356096", "0.5344287", "0.5340089", "0.5313872", "0.5311059", "0.53096354", "0.5307534", "0.529106", "0.5286471", "0.5285681", "0.5279643", "0.52789867", "0.52770424", "0.5261922", "0.5253383", "0.5253057", "0.5251188", "0.5246289", "0.5243068", "0.5237133", "0.5216423", "0.5193794", "0.51935977", "0.5191189", "0.5183021", "0.51816314", "0.5181093", "0.5169614", "0.51649374", "0.5163784", "0.51613426", "0.5144357", "0.5142713", "0.5140274", "0.513794", "0.5137844", "0.5136721", "0.5123034", "0.5111167", "0.5105731", "0.5100793", "0.5092198", "0.5090547", "0.50893044", "0.50797033", "0.5078029", "0.50764704", "0.50742924", "0.50729156", "0.5064179", "0.5062488", "0.50577694", "0.50503826", "0.50468606", "0.5034045", "0.50318193", "0.50300694", "0.50258386" ]
0.8074964
0
params.require(:venue).permit(:name, :street, :city, :state, :country, :latitude, :longitude, :popularity_rating)
def venue_params params.require(:venue).permit(:name, :street, :city, :state, :country, :latitude, :longitude, :popularity_rating) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def venue_params\n params.require(:venue).permit(:name, :address, :longitude, :latitude, :neighborhood_id, :owner, :menu_address, :phone_number, :genre, :urbanist, :open_table_id,:spr_rank)\n end", "def venue_params\n params.require(:venue).permit(:name, :street, :zip, :city)\n end", "def venue_params\n params.require(:venue).permit(:name, :address, :postcode, :latitude, :longitude, :web, :telephone, :email)\n end", "def venue_params\n params.require(:venue).permit(:name, :street, :zipcode, :photo, :neighbourhood, :bio,\n :phone, :address_2, :contact_number)\n end", "def venue_params\n params.require(:venue).permit(:name, :address)\n end", "def venue_params\n params.require(:venue).permit(:city_id, :address_line_1, :address_line_2, :city, :market_id, :state_province, :name, :about, :image, :twitter_url, :facebook_url, :instagram_url, :youtube_url, :snapchat_url, :website_url, :address, :latitude, :longitude, :url_slug)\n end", "def place_params\n params.require(:place).permit(:name, :lat, :lng, :foursquare_venue_id)\n end", "def venue_params\n params.require(:venue).permit(:name, :phone, :email, :contact_name, \n :description, :aasm_state, :hours, :happy_hours, :full_street_address)\n end", "def venue_params\n params.require(:venue).permit(:name)\n end", "def venue_params\n params.require(:venue).permit(:name, :city, :state, :allows_explicit_lyrics)\n end", "def venue_params\n params.require(:venue).permit(:title, :name, :phone, :email, :url, :LinkAlt, :address, :postcode, :image, :image_cache, :image_alt, :content)\n end", "def venue_params\n params.require(:venue).permit(:name, :venue_type, :email, :foursquare_id, beer_ids: [])\n end", "def venue_params\n params.require(:venue).permit(:name, :date_type, :price_rating, :neighborhood, :address, :blove_count, :dinner, :drinks,\n :dessert, :coffee, :mood, :date_day, :user_fbAccessToken, :menu_link, :reservation_link,\n :polaroid_description, :monday_special, :tuesday_special, :wednesday_special, :thursday_special, \n :friday_special, :saturday_special, :sunday_special, :food_drink, :why_blove_heading_1, \n :why_blove_heading_2, :why_blove_heading_3, :why_blove_description_1, :why_blove_description_2,\n :why_blove_description_3, :price_for_two,:monday_hours, :tuesday_hours, :wednesday_hours, \n :thursday_hours, :friday_hours, :saturday_hours, :sunday_hours, :crowd, :dress_code, :parking, \n :reservations, :atmosphere, :keep_in_mind,\n :polaroid_image, :thumbnail_image, :venue_image_1, :venue_image_2, :venue_image_3, :venue_image_4, :venue_image_5)\n end", "def restaurant_params\n params.require(:restaurant)\n .permit(:local_id, :rating, :name, :site, :email, :phone, :street,\n :city, :state, :lat, :lng)\n end", "def venue_params\n params.require(:venue).permit(:name, :about, :slug, :price, :state_id, :local_govt_area_id, :address, :phone, :email, :capacity, facilities_attributes: [:id, :key, :value], images_attributes: [:id,:thumbnail, :thumbnail_id, :thumbnail_cache_id,:_destroy])\n end", "def place_params\n params.require(:place).permit(:name, :description, :neighborhood, :rating, :address, :latitude, :longitude, :location)\n end", "def spot_params\n params.require(:spot).permit(:latitude, :longitude, :address)\n end", "def venue_type_params\n params.require(:venue_type).permit(:name)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :rating)\n end", "def restaurant_params\n params.permit(:title, :cuisine_id, :rating, :has_10bis, :address, :max_delivery_time, :lat, :lng)\n end", "def parking_place_params\n params.permit(:title, :description, :latitude, :longitude)\n end", "def survivor_params\n params.require(:survivor).permit(:name, :age, :gender, :latitude, :longitude, :infected, :water_amount, :ammunition_amount, :medication_amount, :food_amount)\n end", "def street_params\n params.require(:street).permit(:name)\n end", "def offer_params\n params.require(:offer).permit(\n :business_name,\n :address_1,\n :address_2,\n :city,\n :state,\n :country,\n :postal_code,\n :postal_code_suffix,\n :phone_number,\n :latitude,\n :longitude,\n :radius\n )\n end", "def popular_location_params\n params.require(:popular_location).permit(:address, :city, :coords)\n end", "def place_params\n params.require(:place).permit(:name, :lat, :lng, :price_pax, :duration)\n end", "def place_params\n params.require(:place).permit(:latitude, :longitude, :place_name)\n end", "def spot_params\n params.require(:spot).permit(:name, :latitude, :longitude, :address, :type, :img, :telephone, :rating, :schedule, :website, :description, :activities, :price)\n end", "def place_params\n params.require(:place).permit(:name, :longitude, :latitude)\n end", "def venue_address_params\n params.require(:venue_address).permit(:venue_id, :address_id)\n end", "def event_params\n params.require(:event).permit(:title, :description, :venue, :startsat, :endsat, :latitude, :longitude)\n end", "def apartment_params\n params.require(:apartment).permit(:surface, :price, :latitude, :longitude)\n end", "def event_params\n params.permit( :title, :city_name, :start_time, :venue_name, :venue_url, \n :location, :date, :venue_address)\n end", "def food_truck_params\n params.require(:food_truck).permit(:lat, :long, :name, :phone_number, :website, :description)\n end", "def search_params\n params.require(:search).permit(:address, :latitude, :longitude)\n end", "def place_params\n params.require(:place).permit(:city, :country, :visited)\n end", "def city_params\n params.require(:city).permit(:country_id, :name, :description, :latitude, :longitude)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :description, :city, :state, :zip_code, :address)\n end", "def survivor_params\n params.require(:survivor)\n .permit(:name, :age, :gender, :lat, :lng, :infected,\n :inventory_attributes => [:water, :food, :medication, :ammo])\n end", "def town_params\n params.require(:town).permit(:city, :postcode, :latitude, :longitude)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :description, :stars)\n end", "def visited_place_params\n params.require(:visited_place).permit(:Place, :Price)\n end", "def address_params\n params.require(:address).permit(:street, :suburb, :state, :postcode)\n end", "def geolocation_params\n params.require(:geolocation).permit(:address, :latitude, :longitude, :borough, :neighborhood, :created_at, :updated_at)\n end", "def place_params\n params.require(:place).permit(:title, :description, :user_id, :lat, :lng, :category_id, :name)\n end", "def inven_params\n params.require(:inven).permit(:location, :name)\n end", "def restaurant_place_params\n params.require(:restaurant_place).permit(:name, :address)\n end", "def apartment_params\n params.require(:apartment).permit(:street, :city, :zip, :state, :beds, :baths, :sq__ft, :sale_date, :price, :latitude, :longitude)\n end", "def nearby_params\n params.require(:nearby).permit(:name, :description)\n end", "def country_params\n params.require(:country).permit(:name, :description, :subscribers, :latitude, :longitude)\n end", "def wishlist_params\n params.permit(:venue_name, :venue_photo, :venue_id)\n end", "def spot_params\n params.require(:spot).permit(:location_name, :position, :lat, :lng, :stay_time)\n end", "def market_params\n params.require(:market).permit(:name, :website, :street, :city, :state, :zip, :latitude, :longitude, :description, :image, :rating)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :price, :distance, :rating)\n end", "def survivor_params\n params.require(:survivor).permit(:name, :age, :gender, :lonlat, :infected?)\n end", "def street_params\n params.require(:street).permit(:title, :city_id)\n end", "def address_params\n params.permit(:street, :city, :county, :postcode)\n end", "def sy_club_venue_detail_params\n params.require(:sy_club_venue_detail).permit(:venue_type, :room_size, :windows_count, :fans_count, :doors_count, :room_color, :carpet_type, :yantras_count, :sy_club_id, :lighting_arrangement, :painting_in_room, :room_other_activities, :time)\n end", "def place_params\n params.require(:place).permit(:name, :address, :slug)\n end", "def spot_params\n params.require(:spot).permit(:name, :category_id, :description, :address, :tel, :url, :latitude, :longitude)\n end", "def place_params\n params.require(:place).permit(:name, :description, :address)\n end", "def provider_params\n params.require(:provider).permit(:company_name, :fantasy_name, :cpf, :cnpj, :street, :number, :neighborhood, :cep, :ie, :bank, :ag, :cc, :variation, :state_id, :city_id, :phone1, :phone2)\n end", "def petrol_station_params\n params.require(:petrol_station).permit(:name, :street, :city, :postal_code, :pb95_price, :pb98_price, :on_price, :gas_price, :likes, :unlikes)\n end", "def vendor_params\n params.require(:vendor).permit(:name, :vendor_type, :phone_number, :mobile_number, :governorate, :address, :lat, :lng)\n end", "def location_params\n params.require(:location).permit(:street_address, :city, :latitude, :longitude, :acceptable_bus_distance)\n end", "def visitor_params\n params.require(:visitor).permit(:last_name, :first_name, :group_id, :email, :contact, :zip_code, :country_id)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :cuisine, :address, :city, :state, :zip, :country)\n end", "def location_params\n params.require(:location).permit(:address, :latitude, :longitude, :perfect_address)\n end", "def restaurant_params\n\n params.require(:restaurant).permit(:name, :description, :phone_number, :address, :state, :category, :city, :zipcode, :open_hours, :close_hours,:latitude,:longitude,:image ) \n\n end", "def market_place_params\n params.require(:market_place).permit(:user_id, :business_name, :address, :district, :postcode, :business_line, :pickup_type, :latitud, :longitud, :open_hour, :close_hour, :service_days, :selling, :payment)\n end", "def team_params\n params.require(:team).permit(:name, :search,:page, :location, :location_lat, :location_long)\n end", "def futsal_field_params\n\n params.require(:futsal_field).permit(:name, :latitude, :longitude)\n\n end", "def address_params\n params.require(:address).permit(:lat, :lng, :formatted_address, :state, :city, :zipcode, :country)\n \n end", "def city_params\n params.require(:city).permit(:name, :zip_code, :lat, :lng, :city_id)\n end", "def real_estate_params\n params.require(:real_estate).permit(:street, :city, :zip, :state, :beds, :baths, :sq_ft, :category, :sale_date, :price, :lat, :lng)\n end", "def restaurant_params\n params.permit(:name, :image_url, :location, :min_price, :max_price)\n end", "def sport_params\n params.require(:sport).permit(:distance,\n :date,\n :duration,\n :populair_sport_id)\n end", "def park_params\n params.require(:park).permit(:name, :park_code, :description, :url, :latitude, :longitude, :state, :email, :phone, :fax, :directions, :directions_url, :weather)\n end", "def place_params\n params.require(:place).permit(:name, :address, :city_id)\n end", "def houseguest_params\n params.require(:houseguest).permit(:name, :location, :latitude, :longitude, :age, :occupation, :season_id, :placed, :votes_against, :votes_to_win, :hoh, :nominated, :veto, :botb, :have_not, :first_day, :last_day, :prizes, :jury, :expelled, :walked)\n end", "def review_params\n params.permit(:body, :city, :country, :user_name, :rating)\n end", "def parking_place_params\n params.require(:parking_place).permit(:place_id, :sensor_id, :title, :coord, :for_disabled, :can_book)\n end", "def event_params\n params.require(:event).permit(:id, :api_id, :url, :title, :description, :start_time, :stop_time, :venue_id, :venue_url, :venue_name, :venue_display, :venue_address, :city_name, :region_name, :region_abbr, :country_name, :all_day, :latitude, :longitude, :geocode_type, :trackback_count, :calendar_count, :comment_count, :link_count, :created, :owner, :modified)\n end", "def swit_sour_params\n params.require(:swit_sour).permit(:rating)\n end", "def vertex_params\n params.require(:vertex).permit(:latitude, :longitude, :region_id)\n end", "def state_params\n params.require(:state).permit(:name, :abbreviation, :description, :longitude, :latitude, :hashtag, :zoom)\n end", "def place_params\n params.require(:place).permit(:name, :status, :currency)\n end", "def place_params\n params.require(:place).permit(:name, :description, :lat, :lng, :encoded_image, :rate, :category_id)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :category, :phone_number)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :address, :city, :state, :zip)\n end", "def event_params\n params.require(:event).permit(:name, :phone, :url1, :url2, :location_name, :street, :street_number, :city, :state, :zip, :country, :slug)\n end", "def venue_role_params\n params[:venue_role].permit(:name)\n end", "def scooter_params\n params.require(:scooter).permit(:latitude, :longitude)\n end", "def place_params\n params.require(:place).permit(:name, :category, :address, :latitude, :longitude, :tel, :url)\n end", "def address_params\n params.permit(:street, :city, :state, :zip)\n end", "def location_params\n params.require(:location).permit(:city, :state)\n end", "def short_visit_params\n params.require(:short_visit).permit(:short_url_id, :visitor_ip, :visitor_city, :visitior_state, :visitor_country_iso, :latitude, :longitude)\n end", "def short_visit_params\n params.require(:short_visit).permit(:short_url_id, :visitor_ip, :visitor_city, :visitior_state, :visitor_country_iso, :latitude, :longitude)\n end", "def event_params\n params.require(:event).permit(:title, :venue, :street_number, :city, :state, :zip, :description, :url, :image, :category)\n end", "def restaurant_params\n params.require(:restaurant).permit(:name, :telephone, :address, :term)\n end" ]
[ "0.8762258", "0.8758704", "0.8664499", "0.85965633", "0.8529291", "0.8449578", "0.82946223", "0.8227379", "0.81355715", "0.8134661", "0.7883928", "0.7754324", "0.77355796", "0.7674995", "0.7602287", "0.7564811", "0.75022167", "0.7477081", "0.74583536", "0.7436551", "0.7428146", "0.7417661", "0.7411521", "0.7397665", "0.7385041", "0.7359675", "0.73585683", "0.73551327", "0.7340246", "0.73347294", "0.73113996", "0.73082", "0.7302451", "0.72722834", "0.7270481", "0.7221166", "0.72091734", "0.7206251", "0.72030765", "0.7199479", "0.71948737", "0.7193425", "0.7180442", "0.71794724", "0.7165264", "0.71639365", "0.7158571", "0.71573156", "0.7142753", "0.71416444", "0.7140899", "0.71389514", "0.7134671", "0.71321905", "0.7130512", "0.7126936", "0.71159923", "0.7111946", "0.7110913", "0.7109291", "0.7107985", "0.71051544", "0.7099842", "0.7096866", "0.70933366", "0.708357", "0.7083042", "0.70814496", "0.7081051", "0.70798105", "0.7068286", "0.7066852", "0.7064685", "0.7064456", "0.706213", "0.7058467", "0.70564044", "0.7053365", "0.70499504", "0.7049839", "0.7040565", "0.70404255", "0.70375174", "0.70329094", "0.7029513", "0.7025937", "0.702519", "0.7024834", "0.70112926", "0.7009643", "0.70091933", "0.70086855", "0.70080477", "0.70079684", "0.70041114", "0.6991109", "0.6990914", "0.6990914", "0.69869864", "0.6984709" ]
0.9377816
0
Initialiser. Cells are the cells in the object Children are other objects
def initialize(cells) @cells = cells @children = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n\t\t@cells = []\n\n\t\t9.times { @cells << Cell.new }\t\n\tend", "def initialize(cell)\n super(cell)\n end", "def initialize(cell, tentCell)\n super(cell, tentCell)\n end", "def initialize\n @cells = reset!\n end", "def initialize\n\t\t@width = 5\n\t\t@height = 5\n\t\t@cells = [[0,0,1,0,0],[0,1,1,1,0],[0,1,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]\n\tend", "def initialize(cells = [])\n @cells = cells || []\n end", "def initialize(cell, rowOrColumn)\n @column = rowOrColumn\n @cell = cell\n @row = rowOrColumn\n super()\n end", "def cells\n @cells ||= []\n end", "def initialize\r\n @cells = *(0..9) # Splat operator creates an array of ten items, zero to nine\r\n @cells[0] = nil # Ignore the 0th element\r\n end", "def initialize\n @left = @right = self\n @columns = {} # column_id object => Column\n @rows = {} # row_id object => Node\n end", "def initialize(cells, width, height)\n @cells = cells\n @width = width\n @height = height\n end", "def initialize(*args)\n set(*args)\n @cell_order = self.class.default_cell_order\n end", "def cells\n @cells ||= coordinates.collect {|coordinate| Cell.new(coordinate: coordinate)}\n end", "def initialise_cell_array\n\t\t@cells = []\n\t\t@room_map = {}\n\t\t@corridor_map = {}\n\t\t@corridor_seeds = []\n\t\t(0..width).each do |i|\n\t\t\t@cells[i] = []\n\t\t\t(0..height).each do |j|\n\t\t\t\t@cells[i][j] = Cell.new(i,j, Cell::UNALLOCATED)\n\t\t\tend\n\t\tend\n\tend", "def initialise_cell_array\n @cells = []\n @room_map = {}\n @corridor_map = {}\n @corridor_seeds = []\n (0..width).each do |i|\n @cells[i] = []\n (0..height).each do |j|\n @cells[i][j] = Cell.new(i, j, Cell::UNALLOCATED)\n end\n end\n end", "def initialize\n @cells=[\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n end", "def create_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n @fields[r][c] = Cell.new(r, c)\n end\n end\n end", "def initialize\n #TO DO :\n #Quand la classe s'initialize, elle doit créer 9 instances BoardCases\n #Ces instances sont rangées dans une array qui est l'attr_accessor de la classe\n\n cell_1 = BoardCase.new(1, \"1\")\n cell_2 = BoardCase.new(2, \"2\")\n cell_3 = BoardCase.new(3, \"3\")\n cell_4 = BoardCase.new(4, \"4\")\n cell_5 = BoardCase.new(5, \"5\")\n cell_6 = BoardCase.new(6, \"6\")\n cell_7 = BoardCase.new(7, \"7\")\n cell_8 = BoardCase.new(8, \"8\")\n cell_9 = BoardCase.new(9, \"9\")\n @cells = [cell_1, cell_2, cell_3, cell_4, cell_5, cell_6, cell_7, cell_8, cell_9]\n\n end", "def create_cells\n (\"A\"..@height).each do |rows|\n ([email protected]_i).each do |column|\n k=\"#{rows}#{column}\"\n cells[k]=Cell.new(k)\n end\n end\n cells\n end", "def initialize(cell, row, state)\n @state = state\n super(cell, row)\n end", "def initialize(cells=nil)\n\t unless cells.nil?\n cells.each_key do |key|\n\t self.send(\"#{key}=\",cells[key])\n\t end\n\t\tend\n end", "def initialize(cells=nil)\n\t unless cells.nil?\n cells.each_key do |key|\n\t self.send(\"#{key}=\",cells[key])\n\t end\n\t\tend\n end", "def initialize(cell1, cell2)\n @cell2 = cell2\n super(cell1)\n end", "def default_grid\n Array.new(7) { Array.new(6) { Cell.new } }\n end", "def initialize\n\t\t\t@empty_cell = '_'\n\t\t\t@board = Array.new(3) {Array.new(3,@empty_cell)}\n\t\tend", "def initialize(cells)\n cells.each_key do |key|\n\t self.send(\"#{key}=\",cells[key])\n\t end\n end", "def default_grid\n Array.new(7) { Array.new(6) { CellNode.new }}\n end", "def initialize\n\t\t@board=Hash.new \n\t\t(0..6).each{ |i|\n\t\t\t(0..6).each{ |j|\n\t\t\t\t@board[[i,j]]=Cell.new(0,0,\"\")\n\t\t\t}\n\t\t}\n\t\t#==== intitial cells\n\t\t@board[[1,1]].value=2\n\t\t@board[[2,3]].value=4\n\t\t@move_result=0\n\tend", "def initialize(key=nil, parent_cell=nil)\n @closed = false\n @processed = false\n @parent = parent_cell\n @parent.child = self if @parent\n @index = @@sequence += 1\n #puts \"creating node #{@index} with parent: #{@parent}\"\n add_cell(Cell.new(key)) if key\n end", "def initialize(prior_grid = nil)\n @cells = Array.new(Grid.size) { Array.new(Grid.size) }\n Grid.size.times do |row_index|\n Grid.size.times do |column_index|\n coordinates = Coordinates.new(row_index, column_index)\n new_state = if prior_grid\n old_cell = prior_grid.lookup(coordinates)\n old_cell.next_generation_state(prior_grid.neighbors_for(coordinates))\n else\n Cell.random_state\n end\n @cells[row_index][column_index] = Cell.new(coordinates, new_state)\n end\n end\n end", "def initialize\n @@cells = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n display_board\n end", "def initialize(initial_board=nil)\n\t\t@size = initial_board && initial_board.length || 10\n\t\t@initial_board = initial_board # used when existing patterns are passed\n\t\t@cells = []\n\t\t\n\t\tif @initial_board\n\t\t\[email protected] do |x|\n\t\t\t\[email protected]([])\n\t\t\t\[email protected] do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y, @initial_board[x][y]))\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\[email protected] do |x|\n\t\t\t\[email protected]([])\n\t\t\t\[email protected] do |y|\n\t\t\t\t\t@cells[x].push(Cell.new(self, x, y))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend", "def default_grid\n Array.new(3) { Array.new(3) {Cell.new} }\n end", "def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend", "def populateGrid\n\n\t\[email protected]_with_index do | row, i |\n\n\t\t\trow.each_with_index do | col, j |\n\n\t\t\t\[email protected][i][j] = Cell.new(i, j, false)\n\t\t\tend\n\t\tend\n\tend", "def initialize\n @cells = Array.new(9,\" \")\n end", "def start_grid\n Array.new(@lines) { Array.new(@columns) { Cell.new } }\n end", "def initialize(dimension, data)\n @dimension = dimension\n @grid = Array.new(dimension) do\n Array.new(dimension)\n end\n data.each_with_index do |e, i|\n e.each_with_index do |y, x|\n @grid[i][x] = Cell.new(y, @dimension)\n end\n end\n @grid\n end", "def initialize\n @cells = Array.new(9, \" \")\n end", "def initialize\n @cells = Array.new(9, \" \")\n end", "def initialize\n @cells = Array.new(9, \" \")\n end", "def prepare_grid\n\t\tArray.new(rows) do |row|\n\t\t\tArray.new(columns) do |col|\n\t\t\t\tCell.new(row, col)\n\t\t\tend\n\t\tend\n\tend", "def initialize table, array = []\n @cell_index = 0\n @table = table\n @cells = []\n array.each { |item| self << item }\n end", "def build_cell(cell)\n # implement in row class\n nil\n end", "def create_cells\n definition['cells'].each do |cellname|\n cells.create!(name: cellname)\n end\n end", "def initialize(size)\n @cells = []\n for i in 1..size\n new_cell = Cell.new(false)\n @cells << new_cell\n end # end cell initialization loop\n\n end", "def create_cells\n sheet.row_ids.each {|i| cell_for_row(i) }\n end", "def cells(*args)\r\n cells = TableCellCollection.new(self, extract_selector(args).merge(:tag_name => /^(th|td)$/))\r\n cells.locator_class = ChildCellLocator\r\n\r\n cells\r\n end", "def initialize(parent_notebook)\n\t\t@row = 0 # attach widgets top to bottom in grid\n\t\t@obj = nil\n\t\t@parent_notebook = parent_notebook\n\t\t@grid = Gtk::Grid.new\n\t\tsuper(:vertical, 0)\n\t\tself.pack_start(@grid, :expand => false, :fill => false, :padding => 0)\n\t\[email protected]_spacing = 8\n\tend", "def map_board\n\t\t@cell_at = []\n\t\[email protected] do |row|\n\t\t\t@cell_at[row] = []\n\t\t\[email protected] do |col|\n\t\t\t\t@cell_at[row][col] = Cell.new\n\t\t\tend\n\t\tend\n\tend", "def cells\r\n assert_exists \r\n arr_cells = get_cells\r\n row_cells = Array.new(arr_cells.length)\r\n for i in 0..arr_cells.length - 1 do\r\n row_cells[i] = TableCell.new(@container, :jssh_name, arr_cells[i])\r\n end\r\n return row_cells\r\n end", "def initialize(size)\n @cells = Array.new(size) { Array.new(size, Cell.new()) }\n @not_all_dead = true\n end", "def initialize(height, width, array)\n # Height refers to the number of rows in the grid\n @height = height\n # Width refers to the number of columns in the grid\n @width = width\n # Grid refers to the 2D array which holds the cells\n #@grid = Array.new(@height) {Array.new(@width)}\n @grid = Marshal.load(Marshal.dump(array))\n end", "def initialize(nRow, nCol)\n\t\t@rows = (1..nRow).map {\n\t\t\t(1..nCol).map { Cell.new }\n\t\t}\n\n\t\t@cols = @rows.transpose\n\tend", "def initialize\n\t\t@grid = Array.new(10){Array.new(10)}\n\tend", "def initialize\n\t\t@rows = 8\n\t\t@cols = 8\n\t\t@grid = Array.new(rows) { Array.new(cols) }\n\tend", "def initialize(cellGrass, cellwhite1, cellwhite2)\n super(cellGrass, cellwhite1, cellwhite2)\n end", "def initialize(title=\"\")\n self.cell = title if title.is_a?(Cell)\n self.text = title.to_s unless title.is_a?(Cell)\n end", "def children\n @children ||= {}\n child_definitions.keys.each{|p| @children[p] ||= cell(p)} unless child_definitions.nil?\n @children\n end", "def initialize\n\t\t\t@@cell_count += 1\n\t\t\t@name = @@cell_count.to_s\n\t\tend", "def initialize\n # The board is an array of rows, each containing an array of cells\n @board = Array.new(BOARD_HEIGHT){Array.new(BOARD_WIDTH)}\n @board.each_with_index do |y, yi|\n y.each_with_index do |x, xi|\n @board[yi][xi] = \".\"\n end\n end\n end", "def initialize()\n @grid = []\n @rows = 0\n @cols = 0\n end", "def initialize(width, height)\n\n\t\t# ensure heights and widths are odd\n\t\twidth += 1 if width.odd?\n\t\theight += 1 if height.odd?\n\t\t@width = width\n\t\t@height = height\n\n\t\t# Initilize cell array\n\t\tinitialise_cell_array()\n\n\t\t# Block the perimeter\n\t\tblock_perimeter()\n\n\t\t# Generate rooms\n generate_rooms()\n\n\t\t# Generate corridors\n\t\tgenerate_corridors()\n\n\t\t# Trim tree\n\t\ttrim_tree()\n\tend", "def initialize(width, height)\n\n # ensure heights and widths are odd\n width += 1 if width.odd?\n height += 1 if height.odd?\n @width = width\n @height = height\n\n # Initilize cell array\n initialise_cell_array()\n\n # Block the perimeter\n block_perimeter()\n\n # Generate rooms\n generate_rooms()\n\n # Generate corridors\n generate_corridors()\n\n # Trim tree\n trim_tree()\n end", "def initialize(nRows, nCols)\n\t\tpathToAssets=File.dirname(__FILE__) + \"/../../../Assets/Cells/\"\n\n\t\t@cellAssets = {\n\t\t\tempty: \tCellAsset.new(pathToAssets+\"empty.png\",nRows, nCols),\n\t\t\tbridge: \t{\n\t\t\t\thorizontal:\t{\n\t\t\t\t\tsimple: CellAsset.new(pathToAssets+\"a.png\",nRows,nCols),\n\t\t\t\t\tsimple_freeze: CellAsset.new(pathToAssets+\"a_freeze.png\",nRows,nCols),\n\t\t\t\t\tdouble: CellAsset.new(pathToAssets+\"b.png\",nRows,nCols),\n\t\t\t\t\tdouble_freeze: CellAsset.new(pathToAssets+\"b_freeze.png\",nRows,nCols),\n\t\t\t\t},\n\t\t\t\tvertical: {\n\t\t\t\t\tsimple: CellAsset.new(pathToAssets+\"c.png\",nRows,nCols),\n\t\t\t\t\tsimple_freeze: CellAsset.new(pathToAssets+\"c_freeze.png\",nRows,nCols),\n\t\t\t\t\tdouble: CellAsset.new(pathToAssets+\"d.png\",nRows,nCols),\n\t\t\t\t\tdouble_freeze: CellAsset.new(pathToAssets+\"d_freeze.png\",nRows,nCols),\n\t\t\t\t},\n\t\t\t},\n\t\t\tisle: CellAsset.new(pathToAssets+\"ring.png\",nRows,nCols),\n\t\t\tisleFull: CellAsset.new(pathToAssets+\"ringFull.png\",nRows,nCols),\n\t\t\ttransparent: CellAsset.new(pathToAssets+\"transparent.png\",nRows,nCols),\n\t\t}\n\n\t\t@cellAssetsSelected = {\n\t\t\tempty: \tCellAsset.new(pathToAssets+\"emptySelected.png\",nRows, nCols),\n\t\t\tbridge: \t{\n\t\t\t\thorizontal:\t{\n\t\t\t\t\tsimple: CellAsset.new(pathToAssets+\"a.png\",nRows,nCols),\n\t\t\t\t\tsimple_freeze: CellAsset.new(pathToAssets+\"a_freeze.png\",nRows,nCols),\n\t\t\t\t\tdouble: CellAsset.new(pathToAssets+\"b.png\",nRows,nCols),\n\t\t\t\t\tdouble_freeze: CellAsset.new(pathToAssets+\"b_freeze.png\",nRows,nCols),\n\t\t\t\t},\n\t\t\t\tvertical: {\n\t\t\t\t\tsimple: CellAsset.new(pathToAssets+\"c.png\",nRows,nCols),\n\t\t\t\t\tsimple_freeze: CellAsset.new(pathToAssets+\"c_freeze.png\",nRows,nCols),\n\t\t\t\t\tdouble: CellAsset.new(pathToAssets+\"d.png\",nRows,nCols),\n\t\t\t\t\tdouble_freeze: CellAsset.new(pathToAssets+\"d_freeze.png\",nRows,nCols),\n\t\t\t\t},\n\t\t\t},\n\t\t\tisle: CellAsset.new(pathToAssets+\"ringSelected.png\",nRows,nCols),\n\t\t\tisleFull: CellAsset.new(pathToAssets+\"ringFull.png\",nRows,nCols),\n\t\t\ttransparent: CellAsset.new(pathToAssets+\"transparent.png\",nRows,nCols),\n\t\t}\n\tend", "def initialize(grid) # new objects of class BB will be created by passing a grid to init method\n\t\t@grid = grid # usual init assignment of instance to local/self\n\tend", "def initialize(rows = self.class.blank_grid)\n @rows = rows\n end", "def initialize(width=30, height=30, random=true, random_seed=[true,false].to_a)\n\n @width=width\n @height=height\n\n #create an array\n @cells = ConwayModel::create_grid(width, height, random, random_seed)\n end", "def initialize()\n @childs = {}\n end", "def initialize()\n @childs = {}\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def initialize_copy(other)\n @cells = {}\n other.cells.each do |k, cell|\n @cells[k] = cell.dup\n end\n super(other)\n end", "def initialize\n @grid = empty_board\n end", "def initialize\n # Les 9 instances de Board_case\n case1 = Board_case.new\n case2 = Board_case.new\n case3 = Board_case.new\n case4 = Board_case.new\n case5 = Board_case.new\n case6 = Board_case.new\n case7 = Board_case.new\n case8 = Board_case.new\n case9 = Board_case.new\n\n # On insert les instances dans le tableau\n @@tab = [[case1,case2,case3],[case4,case5,case6],[case7,case8,case9]]\n end", "def initialize\n # Les 9 instances de Board_case\n case1 = Board_case.new\n case2 = Board_case.new\n case3 = Board_case.new\n case4 = Board_case.new\n case5 = Board_case.new\n case6 = Board_case.new\n case7 = Board_case.new\n case8 = Board_case.new\n case9 = Board_case.new\n\n # On insert les instances dans le tableau\n @@tab = [[case1,case2,case3],[case4,case5,case6],[case7,case8,case9]]\n end", "def cells\n if @cells.blank?\n\n @cells = []\n self.loopoff_file_names.each do |f|\n @cells << Lt::FileCell.new(:name => f,\n :size => File.size(f),\n :sha => self.file_ids_hash[File.basename(f)],\n :is_identical => self.db.repo.distinct_blobs.map(&:id).include?(self.file_ids_hash[File.basename(f)]) \n )\n end\n end\n @cells \n end", "def initialize(width, height, number_of_mines) \n @width = width\n @height = height\n @cells_played = 0\n @@cells_already_played = 0\n @@total_of_unknown_cells = width * height\n @number_of_mines = number_of_mines\n @is_still_playing = true\n @is_gamer_finished = false\n\n @map_of_board = Array.new(width+1) { Array.new(height+1) }\n\n for x in 1..@width\n for y in 1..@height\n @map_of_board[x][y] = Cell.new(x, y, UNKNOWN_CELL)\n end\n end\n\n insert_mines_in_board number_of_mines\n end", "def initialize_grid_from_node(node)\n boxes_zone = node.boxes_zone\n goals_zone = node.goals_zone\n pusher_zone = node.pusher_zone\n level = node.level\n\n @rows = level.rows\n @cols = level.cols\n @name = level.name\n @copyright = level.copyright\n\n pos = 0\n pusher_flag = false\n @grid = level.grid.collect do |cell|\n # Only keep empty spaces\n if ['@', '$', '*', '+'].include? cell\n new_cell = 's'\n else\n new_cell = cell\n end\n\n if @inside_cells.include? new_cell\n # Place goals from zone\n if goals_zone.bit_1?(pos)\n new_cell = '.'\n end\n\n # Place boxes from zone\n if boxes_zone.bit_1?(pos)\n new_cell = new_cell == '.' ? '*' : '$'\n # Place pusher from zone\n elsif !pusher_flag && pusher_zone.bit_1?(pos)\n new_cell = new_cell == '.' ? '+' : '@'\n pusher_flag = true\n end\n\n pos += 1\n end\n\n new_cell\n end\n end", "def initialize\n yield self if block_given?\n @width ||= 10\n @height ||= 20\n\n @graph = []\n @height.times do |y|\n row = []\n t = @graph.empty? ? true : false\n b = @graph.size == (@height - 1) ? true : false\n\n @width.times do |x|\n l = row.empty? ? true : false\n r = row.size == (@width - 1) ? true : false\n\n row << Room.new do |room|\n room.top = t\n room.bottom = b\n room.left = l\n room.right = r\n room.y = y\n room.x = x\n end\n\n end\n @graph << row\n end\n end", "def initialize(row, col, content = :FREE)\n\t\t\t@content = content\n\t\t\t@row = row\n\t\t\t@col = col\n\t\t\t@flagged = false\n\t\t\t@bombs_count = 0\n\t\t\t@visible = false\n\t\tend", "def make_new_cell()\n c = Cell.new\n c.onset = 0\n c.offset = 0\n c.ordinal = 0\n c.set_args(\"\", @arglist)\n @cells << c\n return c\n end", "def initialize(x, y)\n @x = x\n @y = y\n @connected_cells = []\n end", "def initialize grid\n @point = Point.new(0,0) #Instance variable of skippy's location, which is initially (0,0)\n @die = Die.new #new dice roll\n @grid = grid\n end", "def cells\n attributes.fetch(:cells)\n end", "def initialize\n @grid = []\n (0..5).each do |row|\n @grid[row] = []\n (0..6).each do |col|\n @grid[row][col] = \"_ \"\n end\n end\n end", "def initialize(*children)\n composite_initialize(*children)\n end", "def init\n initialize_columns\n load_default_behaviors # load default behaviors here rather than in application code\n\n cell_editable\n column_sortable\n\n apply_default_config\n end", "def initialize \n @rows = 8\n @columns = 8\n @grid = create_board\n end", "def composite_initialize(*children)\n @children = children\n end", "def establish_world(cell_width, cell_height)\n puts \"World is #{cell_width}x#{cell_height} cells\"\n @cell_width, @cell_height = cell_width, cell_height\n\n # Outer array is X-indexed; inner arrays are Y-indexed\n # Therefore you can look up @grid[cell_x][cell_y] ...\n # However, for convenience, we make the grid two cells wider, two cells\n # taller. Then we can populate the edge with Wall instances, and treat (0,\n # 0) as a usable coordinate. (-1, -1) contains a Wall, for example. The\n # at(), put(), and cut() methods do the translation, so only they should\n # access @grid directly\n @grid = Array.new(cell_width + 2) do |cy|\n Array.new(cell_height + 2) do |cx|\n Cell.new(cx-1, cy-1)\n end\n end\n\n # Top and bottom, including corners\n (-1 .. cell_width).each do |cell_x|\n put(cell_x, -1, Wall.new(self, cell_x, -1)) # top\n put(cell_x, cell_height, Wall.new(self, cell_x, cell_height)) # bottom\n end\n\n # Left and right, skipping corners\n (0 .. cell_height - 1).each do |cell_y|\n put(-1, cell_y, Wall.new(self, -1, cell_y)) # left\n put(cell_width, cell_y, Wall.new(self, cell_width, cell_y)) # right\n end\n\n self\n end", "def actual_cells\n @cells.compact\n end", "def initialize(worksheet, values=[], options={})\n @height = nil\n self.worksheet = worksheet\n @cells = SimpleTypedList.new Cell\n @worksheet.rows << self\n self.height = options.delete(:height) if options[:height]\n array_to_cells(values, options)\n end", "def initialize(grid=empty_grid)\n @grid = grid\n end", "def initialize (num_legs) #You can put specific table material in initialize\n\t\t@tabletop = []\n\t\t@num_legs = num_legs\n\tend", "def initialize(object, list_items, object_index: nil)\n list_items_count = list_items.count\n @rowcell = []\n list_items.each do |item|\n next unless object.include_item_or_section?(item[:when], item[:is], item[:is_not], object_index: object_index)\n\n @rowcell << rowcell_value(object, item, list_items_count)\n end\n end", "def seed\n @matrix = @matrix.each_with_index do |cell|\n x, y = *cell\n Life::Cell.new(x, y, self)\n end\n end", "def initial_setup\n # set initial values of vert_pos and sum\n vert_pos = 0\n @sum = @tree[0][0]\n\n # set initial children nodes\n @initial_child_1 = @tree[1][0]\n @initial_child_2 = @tree[1][1]\n end", "def initialize(ox, oy, tx, ty)\n # pixel movement rate\n pix = $BlizzABS.pixel\n # coordinates\n @sx, @sy, @tx, @ty = ox / pix, oy / pix, tx / pix, ty / pix\n # additional data\n @x_off, @y_off = ox - @sx * pix, oy - @sy * pix\n # nodes yet to check\n @open = {[@sx, @sy] => -1}\n # checked nodes\n @closed = Table.new($game_map.width, $game_map.height)\n end", "def initialize\n\t\t@grid = Array.new(10) {Array.new(10)}\t##need to change this\n\t\t@ships = []\n\t\t@occupied = []\n\t\t@misses=[]\n\t\t@hits = []\n\tend" ]
[ "0.7319839", "0.7152518", "0.6953881", "0.6845339", "0.6780871", "0.67352074", "0.6710445", "0.6701461", "0.66248107", "0.65675783", "0.6563345", "0.6559393", "0.65571487", "0.6544548", "0.65354687", "0.6524417", "0.65029985", "0.6488611", "0.63776654", "0.63671166", "0.6357912", "0.6357912", "0.6344266", "0.6315238", "0.6314106", "0.628194", "0.62730515", "0.6257691", "0.6228221", "0.62279135", "0.6202716", "0.6191221", "0.6186892", "0.6142685", "0.6108838", "0.61012375", "0.6096402", "0.609447", "0.60823625", "0.60823625", "0.60823625", "0.60805386", "0.6054688", "0.6042278", "0.60361135", "0.6022578", "0.6014964", "0.5978435", "0.5964138", "0.5952141", "0.59508187", "0.5936048", "0.5894143", "0.5890224", "0.58882827", "0.58808315", "0.5867679", "0.58548933", "0.5851857", "0.5845885", "0.5838271", "0.5836754", "0.5828733", "0.5828313", "0.5818514", "0.57953364", "0.5793999", "0.5776285", "0.576141", "0.576141", "0.575352", "0.575352", "0.5752276", "0.57485133", "0.5737809", "0.5737809", "0.5734898", "0.5731215", "0.57292575", "0.57180935", "0.5709607", "0.5708524", "0.5706303", "0.5689922", "0.5681817", "0.5676658", "0.5670538", "0.56606746", "0.56604683", "0.564793", "0.5642062", "0.5620947", "0.56156564", "0.56135887", "0.5611679", "0.5596441", "0.5581415", "0.5580861", "0.557299", "0.5570554" ]
0.7936095
0
For every `redirect_from` entry, generate a redirect page
def generate_redirect_from(doc) doc.redirect_from.each do |path| doc.site.pages << RedirectPage.redirect_from(doc, path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirects; end", "def generate(site)\n site.pages.select{|x| x.data.key? 'redirects' }.each do |p|\n p.data['redirects'].each do |r|\n redirect = RedirectPage.new(site, site.source, r, p.url)\n redirect.render(site.layouts, site.site_payload)\n redirect.write(site.dest)\n site.pages << redirect\n end\n end\n end", "def redirect\n redirect_model = get_model(config['redirect_model_slug'])\n if redirect_model\n redirect_model.entries.each do |entry|\n rules = entry.custom_fields_recipe['rules']\n match = entry[rules.first['name']]\n redirect_url = entry[rules.last['name']]\n if controller.request.fullpath =~ /#{match}/\n match_data = /#{match}/.match(controller.request.fullpath)\n /#{match}/.named_captures.each do |key,value|\n redirect_url.gsub!(/\\$#{key}/, match_data[key])\n end\n controller.redirect_to redirect_url and return\n end\n end\n end\n end", "def handle_temporary_redirects(service_response)\n\n case service_response.go_to['by_screen_name']\n when 'verify_email'\n redirect_to :verify_email and return\n when 'verify_device'\n redirect_to :verify_device and return\n when 'verify_sda'\n redirect_to :verify_sda and return\n when 'setup_mfa'\n redirect_to :mfa and return\n when 'authenticate_mfa'\n redirect_to :mfa and return\n when 'token_dashboard'\n redirect_to :dashboard and return\n when 'token_setup'\n redirect_to :token_setup and return\n when 'sandbox_token_dashboard'\n redirect_to \"/#{GlobalConstant::Environment.sandbox_sub_url_prefix}\" and return\n when 'mainnet_token_dashboard'\n redirect_to \"/#{GlobalConstant::Environment.main_sub_env_url_prefix}\" and return\n when 'token_deploy'\n redirect_to :token_deploy and return\n when 'token_mint'\n redirect_to :token_mint and return\n when 'token_mint_progress'\n redirect_to :token_mint_progress and return\n when 'test_economy'\n redirect_to :test_economy and return\n when 'service_unavailable'\n redirect_to :service_unavailable and return\n when 'login'\n redirect_to :login and return\n when 'logout'\n redirect_to :logout and return\n when 'developer'\n redirect_to :developer and return\n when 'company_information'\n redirect_to :company_information and return\n else\n render_error_response_for(service_response)\n end\n\n end", "def filter_redirect; end", "def filter_redirect; end", "def save_webpage_redirects\n redirections.each do |redirection|\n redirect_url = redirection.headers[:location]\n webpage_redirect = WebpageRedirect.new(url: redirect_url)\n @webpage_response.webpage_redirects << webpage_redirect\n end\n end", "def redirects()\n merge(redirects: 'true')\n end", "def handle_redirect(response)\n redirect_href = response.http_header[\"Location\"]\n redirect_href = redirect_href.first unless !redirect_href.is_a? Array\n redirect_href = expand_path(redirect_href)\n store_link('redirect', redirect_href, @link_id)\n end", "def handle_temporary_redirects(service_response)\n\n case service_response.go_to['by_screen_name']\n when 'economy_dashboard'\n redirect_to :dashboard and return\n when 'economy_planner_step_one'\n redirect_to :planner_step_one and return\n when 'economy_planner_step_two'\n redirect_to :planner_step_two and return\n when 'economy_planner_step_three'\n redirect_to :planner_step_three and return\n when 'service_unavailable'\n redirect_to :service_unavailable and return\n else\n fail \"unhandled internal redirect: #{service_response.go_to}\"\n end\n\n end", "def direct_link\n link = params[:link];\n if ( link.blank? )\n add_error(\"EMPTY DIRECT LINK\");\n redirect_to :controller=>\"general\";\n return;\n end\n begin\n as = ApplicationState.unmarshal(link.strip);\n logger.info \"******* as=#{as.to_hash().to_s}\"\n logger.info \"******* as=#{as.redirect_to_hash().to_s}\"\n # TODO see that as.user equals the current user, and hadle in-equality.\n redirect_to :controller=>\"mt_company\", :action=>\"mt_req_show\", :id=>\"330\" #as.redirect_to_hash();\n return;\n rescue Exception => e\n add_error( e.message );\n add_error( \"<pre>#{params[:link]}</pre>\")\n add_error(\"BAD DIRECT LINK\");\n redirect_to :controller=>\"general\";\n end\n end", "def redirect_url; end", "def create_redirect_action\n if params[:redirect_from].strip.size == 0\n flash[:error] = \"Original URL cannot be empty\"\n return redirect_to \"/admin\"\n end\n if params[:redirect_to].strip.size == 0\n flash[:error] = \"New URL cannot be empty\"\n return redirect_to \"/admin\"\n end\n redirect = Redirect.create(:from => params[:redirect_from].strip, :to => params[:redirect_to].strip)\n redirect.save!\n flash[:notice] = \"New redirect created.\"\n return redirect_to \"/admin\"\n end", "def index\n @redirects = Redirect.all\n end", "def follow_redirections\n self.url = RequestHelper.add_scheme(RequestHelper.decode_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && RequestHelper::REDIRECT_HTTP_CODES.include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url(self.url)\n code = response.code\n\n if RequestHelper::REDIRECT_HTTP_CODES.include?(code)\n redirect_url = self.url_from_location(response, path)\n self.url = redirect_url if redirect_url\n end\n end\n end", "def redirect_from_params\n if params[:redirect_to]\n redirect_to params[:redirect_to]\n end\n end", "def redirect where, opts={}\n where = current.request.env['HTTP_REFERER'].or('/') if where == :back\n where = \"#{current.request.path}#{where}\" if where[0,1] == '?'\n where = current.host + where unless where.include?('://')\n\n # local redirect\n if where.include?(current.host)\n redirect_var = Lux.config.redirect_var || :_r\n\n url = Url.new where\n url[redirect_var] = current.request.params[redirect_var].to_i + 1\n\n where =\n if opts.delete(:silent)\n url.delete redirect_var\n url.to_s\n else\n url[redirect_var] > 3 ? '/' : url.to_s\n end\n end\n\n @status = opts.delete(:status) || 302\n opts.map { |k,v| flash.send(k, v) }\n\n @body = %[redirecting to #{where}\\n\\n#{opts.values.join(\"\\n\")}]\n\n @headers['location'] = where\n @headers['access-control-expose-headers'] ||= 'Location'\n\n throw :done\n end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res['Location'] = url\n @res.status = 302\n finalize_response(:redirect)\n end", "def redirect\n # Does it exist?\n if url = Redirect.find_by_short_url(params[:id])\n # # Increment count\n # url.update_attributes(count: url.count + 1)\n # Add redirect to history\n RedirectHistory.create(redirect_id: url.id, notes: \"params: #{params}\")\n # Redirect\n redirect_to url.full_url\n else\n redirect_to redirects_path\n end\n end", "def redirects(value)\n _redirects(value) or fail ArgumentError, \"Unknown value for redirects: #{value}\"\n end", "def redirect(url); end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def follow_redirect\n get extract_redirection_url\n end", "def follow_redirection(&block); end", "def redirections\n result = db[\"SELECT * FROM `wp_redirection_items`\"]\n result.each { |r| puts r.inspect }\n end", "def redirect_url\n @data[:redirect_url]\n end", "def redirect_url\n @data[:redirect_url]\n end", "def redirect(options = {})\r\n end", "def send_to_redirect\n redirect_to @short_url.redirect\n end", "def follow_get_redirection(&block); end", "def follow_redirect?; end", "def follow_redirections\n self.url = self.add_scheme(decoded_uri(self.url.strip))\n attempts = 0\n code = '301'\n path = []\n\n while attempts < 5 && %w(301 302).include?(code) && !path.include?(self.url)\n attempts += 1\n path << self.url\n response = self.request_media_url\n code = response.code\n self.set_url_from_location(response, path)\n end\n end", "def redirect_url (response)\r\n\tif response.nil?\r\n\t\treturn\r\n\tend\r\n\tif response == ''\r\n\t\treturn\r\n\tend\r\n if response['location'].nil?\r\n response.body.match(/<a href=\\\"([^>]+)\\\">/i)[1]\r\n else\r\n response['location']\r\n end\r\n end", "def redirect_from\n meta_data = to_liquid[\"redirect_from\"]\n meta_data.is_a?(Array) ? meta_data.compact : [meta_data].compact\n end", "def store_redirect\n if params.key?(:redirect)\n store_redirect_url_for(params[:redirect], request.referer)\n end\n end", "def follow_redirect!(**args); end", "def index\n @pagy, @redirects = pagy(policy_scope(Redirect).all)\n authorize @redirects\n end", "def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end", "def redirect_url(immediate = false)\n moje_id_request.redirect_url(realm, return_to, immediate)\n end", "def redirect_url\n if @next_url.present?\n @next_url = CGI.unescape(@next_url)\n @next_url = nil if !ValidateLink.is_valid_redirect_path?(@next_url)\n end\n\n if !@has_valid_mfa_session\n next_url_param = @next_url.present? ? \"?next=#{CGI.escape @next_url}\" : \"\"\n GlobalConstant::WebUrls.multifactor_auth + next_url_param\n else\n @admin.has_accepted_terms_of_use? ? get_application_url : GlobalConstant::WebUrls.terms_and_conditions\n end\n end", "def filter_redirect=(_arg0); end", "def filter_redirect=(_arg0); end", "def redirect(uri)\n [ 303, {'Content-Length'=>'0', 'Content-Type'=>'text/plain',\n 'Location' => uri},\n [] ]\n end", "def redirection_history; end", "def redirect_to(url)\n self.res.status = 302\n #how would I know about location\n self.res.header[\"location\"] = url\n session.store_session(self.res)\n\n #self.res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, url)\n if already_rendered?\n raise \"Can't render/redirect twice\"\n end\n\n #following might be wrong b/c of no setter\n @already_built_response = true\n nil\n end", "def redirect?; end", "def redirect_to_origin(opts = {})\n if params[:ret].present?\n redirect_to params[:ret], opts\n else\n redirect_to opts.merge!(action: :index)\n end\n end", "def redirect(*args)\n # If this is an ajax and/or rpc request skip the redirect.\n # Allows to write more reusable code.\n\n return if request.script?\n \n if args.last.is_a? Hash\n status = args.last.fetch(:status, 303)\n else\n status = 303\n end\n\n uri = encode_uri(*args)\n\n # gmosx, THINK: this may be unnecessary!\n\n unless uri =~ /^http/\n uri = \"#{@context.host_uri}/#{uri.gsub(/^\\//, '')}\"\n end\n\n @context.status = status\n @out = \"<html><a href=\\\"#{uri}\\\">#{uri}</a>.</html>\\n\"\n @context.response_headers['location'] = uri\n\n raise RenderExit\n end", "def redirect_url(realm, return_to=nil, immediate=false)\n message = get_message(realm, return_to, immediate)\n return message.to_url(@endpoint.server_url)\n end", "def follow_redirect!\n unless last_response.redirect?\n raise Error, 'Last response was not a redirect. Cannot follow_redirect!'\n end\n\n if last_response.status == 307\n request_method = last_request.request_method\n params = last_request.params\n else\n request_method = 'GET'\n params = {}\n end\n\n # Compute the next location by appending the location header with the\n # last request, as per https://tools.ietf.org/html/rfc7231#section-7.1.2\n # Adding two absolute locations returns the right-hand location\n next_location = URI.parse(last_request.url) + URI.parse(last_response['Location'])\n\n custom_request(\n request_method,\n next_location.to_s,\n params,\n 'HTTP_REFERER' => last_request.url,\n 'rack.session' => last_request.session,\n 'rack.session.options' => last_request.session_options\n )\n end", "def redirects (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_redirects(to_native, value)\n\t\telse\n\t\t\tto_native[:redirects]\n\t\tend\n\tend", "def add_redirect_url(site)\n if site.url != site.current_url\n @collection.create_page(site.current_url, site.id)\n end\n end", "def redirect_ok; end", "def redirect_ok; end", "def redirect_to(url)\n raise \"Already built response!\" if already_built_response?\n @res[\"Location\"] = url\n @res.status = 302\n @already_built_response = true\n session.store_session(@res)\n flash.store_flash(@res)\n end", "def gringotts_redirect_to(url)\n # save url for redirecting back after we verify\n flash[:gringotts_next_url] = request.original_url\n \n # keep other flash items (e.g., success messages)\n flash.keep\n \n # last but not least ... redirect\n redirect_to url\n end", "def redirect\n #runs when users click \"login to facebook\"\n #creates a session URL from the referring page so after logging in, users can return to that url\n \n session[:return_to] = request.referrer\n redirect_to '/users/auth/facebook'\n #puts \"HERE IS THE REDIRECT URL\" + session[:return_to]\n end", "def multicast_redirect_state\n super\n end", "def redirect_to(url)\n raise \"already built response\" if already_built_response?\n @res.status = 302\n @res[\"Location\"] = url\n @already_built_response = true\n self.session.store_session(@res)\n self.flash.store_flash(@res)\n end", "def redirect_clickthroughs\n if (params[:ct])\n params.delete :ct\n headers[\"Status\"] = \"301 Moved Permanently\"\n redirect_to params, :status => 301\n end\n return true\n end", "def redirection\n short = params[\"short\"]\n\n if short.nil?\n redirect_to root_url\n else\n link = Link.find_by(shortened: short)\n\n if link.nil?\n redirect_to root_url\n else\n redirect_to link.destination\n end\n end\n end", "def too_many_redirects\n update_code(:too_many_redirects, %i(unknown redirected))\n end", "def assert_redirected_to(page_name)\n assert_match(/#{Goldberg.settings.send(page_name).url}$/,\n response.redirected_to)\n end", "def redirect_to(path)\n render(:status => 302, \"Location\" => path) { p { text(\"You are redirected to \"); a(path, :href => path) } }\n end", "def redirect_ok=(follow); end", "def redirect_url\n @_redirect_url ||= public_child_redirect_url || controller_and_action_url ||\n nil\n end", "def tag; 'RedirectMatch permanent'; end", "def redirect\n if !params[:redirect].blank? && redirection = Redirect.find_by_redirect_url(params[:redirect])\n query_string = URI.parse(request.url).query rescue nil\n redirect = query_string.blank? ? redirection.url : \"#{redirection.url}?#{query_string}\"\n redirect_to redirect\n elsif params[:redirect].blank?\n Rails.logger.warn \"Redirect with no parameter requested.\"\n head :status => 404\n else\n Rails.logger.warn \"Unknown redirection requested: #{params[:redirect]}\"\n head :status => 404\n end\n end", "def redirect(client)\n header = ['HTTP/1.1 301 Moved Permanently',\n 'location: http://localhost:9292/game',\n \"date: #{Time.now.strftime('%a, %e %b %Y %H:%M:%S %z')}\",\n 'server: ruby',\n 'content-type: text/html; charset=iso-8859-1\\r\\n\\r\\n'].join(\"\\r\\n\")\n client.puts header\n end", "def redirect_to(url)\n if already_built_response?\n raise\n else\n res.status = 302\n res.header[\"location\"] = url\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end", "def redirect_to=(value)\n @redirect_to = value\n end", "def redirect_to_google_auth(redirect)\n # initiate authentication w/ gmail\n # create url with url-encoded params to initiate connection with contacts api\n next_param = redirect\n scope_param = \"http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F\"\n secure_param = \"0\"\n session_param = \"1\"\n root_url = \"https://www.google.com/accounts/AuthSubRequest\"\n query_string = \"?scope=#{scope_param}&session=#{session_param}&secure=#{secure_param}&next=#{URI::encode(next_param)}\"\n redirect_to root_url + query_string\n end", "def redirect(url)\n raise \"To be implemented by client application\"\n end", "def redirect_to(url)\n if self.already_built_response?\n raise \"Double render error!\"\n else\n @res.status = 302\n @res.location = url\n @already_built_response = true\n end\n end", "def index\n @redirects = Redirect.all\n @redirects_only_on_api = fetch_redirects_of_api\n end", "def redirect_uri\n @payload.present? ? @payload['redirect'] : @redirect_uri\n end", "def follow_redirect(response)\n raise MalformedServerResponse.new(self, response) unless response.header.location\n if response.moved_permanently?\n new_uri = response.header.location\n logger.info(\" Permanently redirected to #{new_uri} - Storing new location.\")\n resource.update_uri new_uri\n @header.host = resource.host\n response = fetch_response\n elsif response.see_other? # Always use GET for this redirect, regardless of initial method\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n response = Request.new(:get, redirected_resource, body, header).fetch_response\n else\n redirected_resource = Resourceful::Resource.new(self.accessor, response.header['Location'])\n logger.info(\" Redirected to #{redirected_resource.uri} - Caching new location.\")\n response = Request.new(method, redirected_resource, body, header).fetch_response\n end\n end", "def redirection_form\n # Get redirection URL\n redirection_url = session[:post_last_location] || root_url\n session[:post_last_location] = nil\n\n # Get redirection params\n redirection_params = session[:params] || {}\n session[:params] = nil\n\n # Restore referer\n if session[:last_referer]\n session[:last_location] = session[:last_referer] \n session[:last_referer] = nil\n end \n\n form_id = \"redirection_form\"\n html = form_tag(redirection_url, :id => form_id) + \"\\n\"\n redirection_params.formify.each do |k, v|\n html += hidden_field_tag(k, v) + \"\\n\"\n end\n html + submit_tag(::AuthorizationHooks.redirection_submit_label) + \n \"</form>\" + javascript_tag(\"document.getElementById(\" +\n form_id.to_json + \").submit()\")\n end", "def redirect path \n full = '/' + @prefix.to_s + @version.to_s + @namespace.to_s + path\n res = Rack::Response.new\n res.redirect(full)\n res.finish\n\n #$Utter.map(full) do\n #\tputs \"Redirect: #{full}\"\n #\trun lambda { |env| [200, {\"Content-Type\" => \"application/json\"}, [$Utter.instance_exec(&block)]] }\n #end\n end", "def redirect_to(url)\n raise DoubleRenderError if already_built_response?\n res.header['location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def redirected(uri)\n @uris << uri.to_s\n update_code(:redirected, %i(unknown redirected))\n end", "def redirect_to(shortcode)\n url = ''\n url += if shortcode.ssl?\n 'https://'\n else\n 'http://'\n end\n url += shortcode.destination\n shortcode.hit\n redirect url, 301\n end", "def permanent_redirect_to(location)\n \"<?php\\nheader(\\\"HTTP/1.1 301 Moved Permanently\\\");\\nheader(\\\"Location: #{NEW_DOMAIN}/#{location}\\\");\\necho \\\"redirecting...\\\"\\n ?>\"\nend", "def custom_redirect\n redirect_to('https://carto.com/signin/') if CartoDB.extract_subdomain(request) == 'developers'\n end", "def redirect(object = nil)\n page_number = params[:original_page].blank? ? nil : params[:original_page]\n \n if params[:from] == \"pending\"\n redirect_to object.nil? ?\n pending_admin_pages_url(:page => page_number) :\n admin_page_url(:id => object, :page => page_number, :from => params[:from])\n else\n redirect_to object.nil? ?\n admin_pages_url(:page => page_number) :\n admin_page_url(:id => object, :page => page_number)\n end\n end", "def redirect(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"redirect \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def redirect_to(location, status=302, flash: nil)\n #; [!xkrfk] sets flash message if provided.\n set_flash_message(flash) if flash\n #; [!ev9nu] sets response status code as 302.\n @resp.status = status\n #; [!spfge] sets Location response header.\n @resp.headers['Location'] = location\n #; [!k3gvm] returns html anchor tag.\n href = Util.h(location)\n return \"<a href=\\\"#{href}\\\">#{href}</a>\"\n end", "def redirects_to_page\n nil\n end", "def redirects_to_page\n nil\n end", "def redirect_to(url)\n raise \"Already delivered response\" if self.already_built_response?\n res.status = 302\n res['Location'] = url\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end", "def redirect_address\n {:action => :index, :id => self.id, :workerId => self.mturk_worker_id, :assignmentId => self.mturk_assignment_id}\n end", "def redirect_client(client, url)\n client.puts(\"HTTP/1.1 302 Found\\r\\nLocation: #{url}\\r\\n\\r\\n\")\nend", "def redirect_to(url)\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res.status = 302 \n # @res.set_header('Content-Type', content_type)\n @res.set_header('location', url)\n # @res.write(content) \n session.store_session(res)\n # debugger\n @already_built_response = true \n # debugger\n end \n end", "def redirection_params\n options.slice(:redirect_uri).stringify_keys\n end", "def set_redirect_location\n @redirect_location = @shareable\n end", "def redirect_ok=(_arg0); end", "def schema_redirect\n redirect_to_glossary_entry(SCHEMA_URI_FORMAT % params[:uri_part])\n end", "def redirect_to(url)\n raise 'Already responded' if already_built_response?\n flash.store_flash(res)\n res['Location'] = url\n res.status = 302\n @already_built_response = true\n session.store_session(res)\n end", "def max_redirects; end", "def redirect\n\t\tlogger.error \"CUSTOM_ERROR: Attempt to connect with bad url extension: #{params[:from]}\"\n\t\tredirect_to root_url\n end" ]
[ "0.6977429", "0.6628007", "0.6411655", "0.6241093", "0.61140233", "0.61140233", "0.61088634", "0.60609436", "0.60413414", "0.60293114", "0.59945375", "0.5988351", "0.5974561", "0.5970313", "0.5949967", "0.59362626", "0.5935935", "0.5901778", "0.5893381", "0.58883876", "0.58608425", "0.583798", "0.58312976", "0.581076", "0.5781228", "0.5774388", "0.5774388", "0.5717806", "0.57080686", "0.5687076", "0.5676218", "0.56618845", "0.5644568", "0.5632264", "0.56294996", "0.56276494", "0.56212485", "0.56095207", "0.56029814", "0.55928326", "0.55662733", "0.55662733", "0.5550753", "0.5548669", "0.5541415", "0.55239075", "0.5507868", "0.5501765", "0.54946494", "0.5492713", "0.54908144", "0.5486165", "0.5484867", "0.5484867", "0.5481923", "0.5465733", "0.54641765", "0.54489464", "0.54486924", "0.5439321", "0.54359746", "0.5434238", "0.5429371", "0.54253596", "0.5423923", "0.542319", "0.5415234", "0.54114604", "0.540444", "0.5389647", "0.53869987", "0.538526", "0.53839374", "0.53807825", "0.5376625", "0.5375582", "0.5365016", "0.5363854", "0.535554", "0.5350212", "0.5348252", "0.53481513", "0.5347931", "0.53412086", "0.53386676", "0.5337355", "0.53276813", "0.5320687", "0.5320687", "0.5318557", "0.5316794", "0.53150266", "0.53124803", "0.5310215", "0.5309984", "0.53020144", "0.5297289", "0.52928305", "0.52876085", "0.5285809" ]
0.7692713
0
Write the code for artist_name and artist_name= so that an Artist can be retrieved from, and associated with, a Song instance
def artist_name if self.name self.name else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artist\n @artist #tells song its artist name\n end", "def set_song_and_artist\n\t\t@artist = Artist.find(params[:artist_id])\n\t @song = Song.find(params[:id])\n\tend", "def artist_name\n self.artist.name\n end", "def artist_name\n self.artist.name\n end", "def artist_name\n self.artist.name\n end", "def artist_name\n self.artist.name\n end", "def artist_name\n artist.name if artist\n end", "def artist_name\n if self.artist #if song has an artist aka TRUE\n self.artist.name #return the artist name\n else\n nil #if no artist name return nil\n end\n end", "def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end", "def artist=(artist)\n #associates an artist with a song\n @artist = artist\n end", "def artist_name\n # self.artist.name\n self.artist ? self.artist.name : ''\n end", "def artist_name\n if self.artist == nil #findining artist of song\n nil\n else\n artist.name\n end\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def set_artist\n # @artist = Artist.find(params[:id])\n # @artist = Artist.find_by(artist_name: params[:artist_id])\n end", "def artist_name\n \tif self.artist\n \t\tself.artist.name\n \tend\n end", "def artist()\n sql = \"SELECT * FROM albums WHERE artist_id = $1\"\n values = [@id]\n results = SqlRunner.run(sql,values)\n artist_data = results[0]\n artist = Artist.new(artist_data)\n end", "def artist_name\n if artist\n self.artist.name\n else\n nil\n end\n end", "def artist_name\n if self.artist\n artist.name\n else\n nil\n end\n end", "def initialize(name)\n @name = name\n @songs = [ ]\n #peter.song = (\"pit\") How to attribute song to the artist after the artist is create.\n end", "def initialize #initializes songs belonging to artist\r\n @song = artist\r\n end", "def artist_name\n @artist.name if @artist\n end", "def artist_name\n self.artist.name if self.artist \n end", "def artist_name\n if self.artist\n self.artist.name\n else\n nil\n end\n end", "def artist_name=(name)\n # Get the instance of the Artist class that represents that artist.\n self.artist = Artist.find_or_create_by_name(name)\n\n # Assign the song to the artist (Since an artist has many songs, we'll want to make this association\n # Now that we have the artist instance,\n # we'll want to again collaborate with the Artist class by calling on the Artist#add_song(some_song) method.\n self.artist.add_song(self)\n\n end", "def artist_name=(name)\n # binding.pry\n if (self.artist.nil?)\n self.artist = Artist.find_or_create_by_name(name)\n self.artist.add_song(self) \n end\n \n end", "def artist_name\n self.artist ? self.artist.name : nil\n end", "def artist_name\n artist ? artist.name : ''\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n #return the new song instance\n artist.add_song(self)\n end", "def artist_name=(name)\n # The actual assignment of the artist \"michael jackson\"\n # to the Song instance variable occurs in the .add_song \n # method in the Artist class.\n Artist.find_or_create_by_name(name).add_song(self)\n end", "def show\n @artist = @song.artist\n @artist_name = @artist ? @song.artist.name : \"no artist\"\n end", "def artist_name\n self.artist ? self.artist.name : nil\n end", "def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end", "def initialize(name) # 1. #initialize with #name accepts name for artist\n @name = name # 1. initialize with #name accepts name for artist\n @songs = [] # #3. songs keeps track of artist's songs\n end", "def artist_name\n if self.artist == nil\n nil\n else\n self.artist.name\n end\n end", "def artist_show_song\r\n\r\n\t\t#@artist = Artist.find(params[:id])\r\n\t\tsearchString = params[:url_slug]\r\n\t\t@artist = Artist.find_by_url_slug(searchString)\r\n\t\t@song = @artist.song.find.by_url_slug(params[:song_name])\r\n\r\n\t\trespond_to do |format|\r\n\t\t\tformat.html # show.html.erb\r\n\t\t\tformat.xml { render :xml => @artist }\r\n\t\tend\r\n\tend", "def artist_name=(name)\n # When instantiating, set the .artist attribute to what is input in name\n self.artist = Artist.find_or_create_by(name: name)\n\n end", "def artist_name_and_genre\n \"#{artist_name} - #{genre.name}\"\n end", "def artist_name=(name)\n #object attr\n self.artist = Artist.find_or_create_by_name(name)\n\n artist.add_song(self)\n\n end", "def artist_name=(artistName)\n Artist.find_or_create_by_name(artistName)\n Artist.find(artistName)\n end", "def artist=(artist) #assigns an artist to the song (song belongs to artist)\n @artist = artist #artist is reading from Song class artist method(reader)\n artist.add_song(self) #invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)\n end", "def set_song\n @song = Song.find(params[:id])\n @artist = @song.artist\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by(name: name)\n self.artist = artist\n end", "def set_artist\n @artist = Artist.find_by(name: params[:name])\n end", "def artist #this is a helper method\n sql = \"\n SELECT * FROM artists\n WHERE id = $1\"\n values = [@artist_id]\n\n artist_info = results[0]\n artist = Artist.new(artist_info)\n return artist.name\nend", "def artist_name\n self.try(:artist).try(:name)\n end", "def artist_name\n self.try(:artist).try(:name)\n end", "def artist_name\n self.try(:artist).try(:name)\n end", "def set_artist\n @artist = Artist.friendly.find(params[:id])\n end", "def artist\n\t\tArtist.find(artist_id)\n\tend", "def set_album_artist\n @album_artist = Artist.find(params[:id])\n end", "def artist\n artist = Spotify.album_artist!(pointer)\n Artist.new(artist) unless artist.null?\n end", "def artist=(the_artist)\n @artist = the_artist\n if @artist \n @artist.add_song(self)\n end\n @artist\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist=(artist) #attr_accessor setter part\n @artist = artist\n end", "def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n result = SqlRunner.run(sql, values)[0]\n return Artist.new(result)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n end", "def set_artist\n @artist = Artist.friendly.find(params[:id])\n end", "def get_artist\n Artist.find(params[:id])\n end", "def display_song_with_artist(db)\n\tputs \"The songs with artist's name\"\n\tputs \"----------------------------\"\n\tsongs = db.execute(\"SELECT * FROM songlist;\")\n\tsongs.each do |song|\n\t\tputs \"SONG NAME: #{song['song_name']} ; ARTIST NAME: #{song['artist_name']}.\"\n\tend\nend", "def artist()\n sql = \"SELECT artist_name FROM artists WHERE id = $1\"\n values = [@artist_id]\n result = SqlRunner.run(sql, values)\n return result[0][\"artist_name\"]\n end", "def set_artist\n\t\t@artist = Artist.find(params[:id])\n\tend", "def initialize(name)\n @name = name #the artist's name\n @songs = [] #the artist's collection of songs\n end", "def add_song(song)\n # We want to tell the song_name passed in that it belongs to the instance\n # of Artist for which this method is called on aka self.\n song.artist = self\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def album_artist\n @ole.AlbumArtist\n end", "def artist_name=(name)\n artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n self.artist = artist\n end", "def artist_name=(artist_name)\n self.artist = Artist.find_or_create_by_name(artist_name)\n self.artist.add_song(self)\n end", "def artist_name=(name)\n artist = Artist.find_or_create_by(name: name)\n self.artist = artist\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def artist=(artist)\n @artist = artist\n @artist.add_song(self)\n end", "def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end", "def artist=(artist)\n @artist = artist\n end", "def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end", "def artist=(artist)\n @artist = artist\n if artist != nil\n @artist.add_song(self)\n end\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n artist.add_song(self)\n end", "def artist=(artist)\n @artist = artist\n if artist.class == Artist\n artist.add_song(self)\n end\n end", "def set_artist\n @artist = Artist.find(params[:id] || params[:artist_id])\n end", "def set_artist\n @artist = Artist.find(params[:id])\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end", "def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end" ]
[ "0.7586012", "0.741601", "0.74090403", "0.74090403", "0.74090403", "0.74090403", "0.7334526", "0.7333408", "0.732647", "0.7317326", "0.72852516", "0.72826177", "0.72744125", "0.72744125", "0.72744125", "0.72668594", "0.72484213", "0.72325116", "0.7196208", "0.71789896", "0.7166319", "0.71653086", "0.71492356", "0.71486884", "0.7131762", "0.71147925", "0.7095347", "0.70868087", "0.70846945", "0.7049947", "0.70349145", "0.7029167", "0.7008393", "0.6996077", "0.6986712", "0.69678277", "0.6956173", "0.6950364", "0.6943308", "0.69294155", "0.6929311", "0.69089454", "0.69057906", "0.68977743", "0.68963957", "0.68862873", "0.68862873", "0.68862873", "0.68852127", "0.6870381", "0.6857895", "0.6850897", "0.6839812", "0.6830434", "0.6830434", "0.6830434", "0.6830434", "0.68249923", "0.6824699", "0.68216133", "0.68216133", "0.681676", "0.68149096", "0.68148977", "0.68123746", "0.6808287", "0.68067735", "0.6797036", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790947", "0.6790915", "0.6787909", "0.67866796", "0.6783085", "0.6780619", "0.6780619", "0.6777587", "0.67664206", "0.67623425", "0.67611915", "0.675985", "0.675563", "0.675563", "0.67478746", "0.6741803", "0.67404425", "0.6732017", "0.6732017", "0.6732017" ]
0.70510495
29
Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
def email @searches = current_user.searches if request.post? and validate_email_params # only send searches that were checked in the email form @searches = Array.new @comments = Hash.new current_user.searches.each do |s| if params[(s.id).to_s] == "1" @searches << s @comments[s.id] = params[("notes_" + (s.id).to_s)] end end email = SearchMailer.email_search(@searches, @comments, {:to => params[:to], :message => params[:message]}, url_options) email.deliver flash[:success] = I18n.t("blacklight.email.success") respond_to do |format| format.html { redirect_to catalog_path(params['id']) } format.js { render 'email_sent' } end and return end respond_to do |format| format.html format.js { render :layout => false } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emailform\n end", "def emailform\n end", "def email\n\n email = email_params\n ContactMailer.status_email(email[:email], email[:subject], email[:body]).deliver\n render nothing: true, status: 200\n\n # put logic for sending an email\n # TODO: send the email here.\n end", "def email\n\t\temail_response = EmailHandler.new(email_content).deliver_email\n\t\t\trender text: email_response + \"\\n\"\n\tend", "def email\n options = { :from => params[:email], :to => \"[email protected]\", :subject => params[:subject], :body => \"From: #{params[:user]} <#{params[:email]}>\\r\\nCategory: #{params[:category]}\\r\\nSubject:#{params[:subject]}\\r\\n\\r\\n#{params[:body]}\"}\n RequestMailer.deliver_generic(options)\n flash[:notice] = \"Your email was sent successfully\"\n redirect_to params[:redirect]\n end", "def email\n \n @searches = Array.new\n \n if request.get?\n if !params[:id].nil?\n params[:id].each do |value|\n s = Search.find(value.to_i)\n s.last_action = \"Emailed\"\n s.last_action_date = Time.now\n s.save\n @searches << s\n end\n else\n redirect_to :back and return\n end\n end\n \n if request.post?\n #if !params[:search_id].nil?\n params[:id].each do |param|\n s = Search.find(param[0].to_i)\n s.last_action = \"Emailed\"\n s.last_action_date = Time.now\n s.save\n @searches << s\n end\n #else\n # redirect_to :back and return\n # end\n end\n \n if request.post? and params[:email_selected].blank? and validate_email_params\n \n email = SearchMailer.email_search(@searches, @comments, {:to => params[:to], :message => params[:message]}, url_options, request.host_with_port)\n email.deliver\n\n flash[:success] = I18n.t(\"blacklight.email.success\")\n\n respond_to do |format|\n format.html { redirect_to catalog_path(params['id']) }\n format.js { render 'email_sent' }\n end and return\n end\n\n respond_to do |format|\n format.html\n format.js { render :layout => false }\n end\n end", "def email\n # If there is no url passed in, this will fail, so just redirect to the homepage\n redirect_to \"/\" and return if params[:u].blank?\n if request.post?\n @message = Message.new(params[:message])\n @message.subject = \"#{@message.from} has sent you a page from the NORC Blueprint Website\"\n if @message.save\n SiteMailer.deliver_page(@message, \"http://#{request.host_with_port}#{params[:u]}\")\n flash[:notice] = \"Your message was sent successfully\"\n redirect_to params[:u]\n end\n end\n end", "def index\n options = params.dup\n email = options.delete(:email)\n if ContactsMailer.receive(email, options)\n render :nothing => true, :status => :created\n else\n render :nothing => true, :status => :unprocessable_entity\n end\n end", "def my_mailer \n from_email = params[:comment][:email] \n message = params[:comment][:message] \n begin\n #First check if the senders email is valid\n if from_email =~ /^[a-zA-Z0-9._%-]+@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,4}$/\n #put all the contents of my form in a hash\n mail_info = {\"from_name\" => current_user.login,\"user_email\" => current_user.email, \"from_email\" => from_email, \"message\" => message}\n #Call the Notifier class and send the email\n Notifier.deliver_contact_mail(mail_info)\n #Display a message notifying the sender that his email was delivered.\n flash[:notice] = 'Your message was successfully delivered to the SIR Administrator.'\n #Then redirect to index or any page you want with the message\n redirect_to(:action => 'contact_mail') \n else\n #if the senders email address is not valid\n #display a warning and redirect to any action you want\n flash[:warning] = 'Your email address appears to be invalid.'\n redirect_to(:action => 'contact_mail')\n end \n rescue\n #if everything fails, display a warning and the exception\n #Maybe not always advisable if your app is public\n #But good for debugging, especially if action mailer is setup wrong\n flash[:warning] = \"Your message could not be delivered at this time. #$!. Please try again later\"\n redirect_to(:action => 'contact_mail') end\n end", "def email\n @response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])\n if request.post?\n if params[:to]\n url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}\n\n flash[:error] = I18n.t('blacklight.email.user_not_signed_in') if !user_signed_in?\n\n if params[:to].match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}$/)\n email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]}, url_gen_params)\n else\n flash[:error] = I18n.t('blacklight.email.errors.to.invalid', :to => params[:to])\n end\n else\n flash[:error] = I18n.t('blacklight.email.errors.to.blank')\n end\n\n unless flash[:error]\n email.deliver\n flash[:success] = \"Email sent\"\n redirect_to catalog_path(params['id']) unless request.xhr?\n end\n end\n\n unless !request.xhr? && flash[:success]\n respond_to do |format|\n format.js { render :layout => false }\n format.html\n end\n end\n end", "def application_request\n\t\tPony.mail(to: params[:email], from: \"[email protected]\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t # Pony.mail(to: \"[email protected]\", from: \"[email protected]\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t\tredirect_to properties_apply_path\n\tend", "def request_contact\n #Gets form values that user has typed in:\n name = contact_params[\"name\"]\n email = contact_params[\"email\"]\n telephone = contact_params[\"telephone\"]\n message = contact_params[\"message\"]\n\n #If user has not typed in an email, alert them that\n #they should type one in:\n if email.blank?\n flash[:alert] = I18n.t('home.request_contact.no_email')\n else\n #Send an email:\n ContactMailer.contact_email(email, name, telephone, message).deliver_now\n flash[:notice] = I18n.t('home.request_contact.email_sent')\n end\n #Go back to home page, where the appropriate prompt will be shown:\n redirect_to root_path\n end", "def process_contact\n # inside of all controller actions you have access a `request` object that represents the request being made\n \n # In rails all the information from the url and body are in a hash called `params`\n\n # storing values inside of instance variables will give you access to them inside of your views\n\n # byebug: if you add `byebug` anywhere within your application it will stop the execution of code at that point and allow you to dig around to debug stuff.\n get_name\n @email = params[:email]\n @message = params[:message]\n\n # if you explicitly tell rails to render a file then it will expect a file in views called `views/welcome/thank_you.html.erb`\n render :thank_you\n end", "def index\n options = params.dup\n email = options.delete(:email)\n if MailHandler.receive(email, options)\n head :created\n else\n head :unprocessable_entity\n end\n end", "def retailer_submitted_email\n load_order\n respond_with(@order) do |format|\n format.html { render :template => \"spree/order_mailer/retailer_submitted_email.html.erb\", :layout => false }\n end\n end", "def retailer_submitted_email\n load_order\n respond_with(@order) do |format|\n format.html { render :template => \"spree/order_mailer/retailer_submitted_email.html.erb\", :layout => false }\n end\n end", "def contact_us\n #\n if request.get?\n @page_title = \"Contact Us\"\n @page = Page.find_by_title(@page_title)\n end\n\t \n if request.post?\n # TODO\n pass = true\n error = \"Please check the name, email and note fields are not empty.\"\n\t \n name = params[:contact][:name] \n email = params[:contact][:email]\n phone = params[:contact][:phone]\n note = params[:contact][:note]\n\t \n pass = false if name.blank?\n pass = false if email.blank?\n pass = false if note.blank?\n\t \n\t \n #email = OrderMailer.create_sent(params[:contact][:name],params[:contact][:email],params[:contact][:phone],params[:contact][:note])\n #email.set_content_type(\"text/html\")\n \n if pass\n OrderMailer.deliver_formmessage(name,email,phone,note)\n flash[:notice] = \"Thank you! Your message has been sent, we will contact you shortly.\"\n redirect_to :action=>'contact_us', :controller=>'go'\n else\n flash[:notice] = error\n redirect_to :action=>'contact_us', :controller=>'go'\n end \n end \n render(:file => \"#{RAILS_ROOT}/app/views/templates/#{Shop.def_template_name}/frontend/#{action_name}.html.erb\", \n :layout => true)\n end", "def request_contact\n name = params[:name] # The value of the name field.\n email = params[:email] # The value of the email field.\n telephone = params[:telephone] # The value of the telephone field.\n message = params[:message] # The value of the message field.\n\n if email.blank? # Checks whether an email address has been submitted.\n flash[:alert] = I18n.t('home.request_contact.no_email') # Shows an alert if the email field is empty.\n else\n ContactMailer.contact_email(email, name, telephone, message).deliver_now # Sends an email.\n flash[:notice] = I18n.t('home.request_contact.email_sent') # Shows an notice if email has been sent successfully.\n end\n\n redirect_to root_path # Re-display the root path.\n end", "def sendReview\r\n email=params[:email]\r\n emails=email.split(\",\")\r\n description=params[:description]\r\n page_id = params[:page_id]\r\n emails.each do |one|\r\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/pages/reviewer?id=\"+page_id).deliver()\r\n end\r\n respond_to do |format|\r\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \r\n end\r\n end", "def request_contact\n email = params[:email]\n message = params[:message]\n\n if email.blank?\n flash[:alert] = t('emailErr')\n else\n flash[:notice] = t('emailSuccess')\n ContactMailer.contact_email(email, message).deliver_now\n \n end\n\n redirect_to root_path\n \n\n end", "def email\n render layout: 'wemail'\n \n end", "def send_email\n subject = params['send_email']['subject']\n body = params['send_email']['email_body']\n participant_id = params['participant_id']\n assignment_id = params['assignment_id']\n @participant = AssignmentParticipant.find_by(id: participant_id)\n @team = Team.find_by(parent_id: assignment_id)\n\n mappings = review_mappings(assignment_id, @team.id)\n respond_to do |format|\n if subject.blank? || body.blank?\n flash[:error] = 'Please fill in the subject and the email content.'\n format.html { redirect_to controller: 'student_task', action: 'email_reviewers', id: @participant, assignment_id: assignment_id }\n format.json { head :no_content }\n else\n # make a call to method invoking the email process\n unless mappings.length.zero?\n mappings.each do |mapping|\n reviewer = mapping.reviewer.user\n MailerHelper.send_mail_to_author_reviewers(subject, body, reviewer.email)\n end\n end\n flash[:success] = 'Email sent to the reviewers.'\n format.html { redirect_to controller: 'student_task', action: 'list' }\n format.json { head :no_content }\n end\n end\n end", "def contact\n # These error messages are injected into the contact form alert via JS.\n if !current_user && !check_captcha # the captcha is not used if there is a logged-in user\n render plain: \"Incorrect math question response.\", status: :bad_request\n return\n elsif params[:comment]&.blank? # name and email are optional, but comment is required\n render plain: \"Please enter a comment.\", status: :bad_request\n return\n end\n feedback_email = current_institution&.feedback_email ||\n Setting.string(Setting::Key::FEEDBACK_EMAIL)\n begin\n IdealsMailer.contact(page_url: params[:page_url],\n from_name: params[:name],\n from_email: params[:email],\n comment: params[:comment],\n to_email: feedback_email).deliver_now\n rescue => e\n LOGGER.error(\"#{e}\")\n render plain: \"An error occurred on the server. If this error \" +\n \"persists, please email us at: \" + feedback_email,\n status: :internal_server_error\n else\n render plain: \"OK\"\n end\n end", "def request_contact\n respond_to do |format|\n # form values\n name = params[:name]\n email = params[:email]\n telephone = params[:telephone]\n message = params[:message]\n\n # flash alert the user if email is blank\n if email.blank?\n flash[:alert] = I18n.t('songs.request_contact.no_email')\n format.html { redirect_to contact_path }\n else\n ContactMailer.contact_email(email, name, telephone, message).deliver_now\n format.html { redirect_to root_path }\n flash[:notice] = I18n.t('songs.request_contact.email_sent')\n format.js\n end\n end\n end", "def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end", "def request_contact\n name = params[:name]\n email = params[:email]\n telephone = params[:telephone]\n message = params[:message]\n\n if email.blank?\n flash[:alert] = I18n.t('home.request_contact.no_email')\n else\n ContactMailer.contact_email(email, name, telephone, message).deliver_now\n flash[:notice] = I18n.t('home.request_contact.email_sent')\n end\n\n redirect_to root_path\n end", "def contact\n \n ContactMailer.contact_email(params).deliver\n\n begin\n flash[:notice] = \"Successfully...\"\n rescue\n flash[:notice] = \"failed ...\"\n end\n end", "def do_email\n @manifest = Manifest.find(params[:id])\n @email = params[:email]\n \n Notifier.manifest(@email, @manifest).deliver\n \n flash[:notice] = \"El documento ha sido enviado con exito .\"\n redirect_to \"/manifests/#{@manifest.id}\"\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def contact_email\n @contact = params[:contact]\n mail(:to => \"[email protected]\", :subject => \"You have received a question from #{@contact[:name]} @ #{@contact[:email]}\", :body => \"#{@contact[:body]}\")\n end", "def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end", "def inquiry_created_email(inquiry)\n @inquiry = inquiry\n mail(to: '[email protected]',\n subject: 'New Message from your Website',\n reply_to: @inquiry.email) do |format|\n format.html { render layout: 'email' }\n end\n end", "def dispatch_email\n lead_info = params[:lead_info]\n if ContactMailer.send_email(lead_info).deliver\n flash.now[:success] = \"Great, your message has been sent! We'll try to respond as soon as possible.\"\n else\n flash.now[:error] = \"Oops, there seems to be a problem. Please email us at [email protected].\"\n end\n \n respond_to do |format|\n format.js\n end\n end", "def request_contact\n # form values\n name = params[:name]\n email = params[:email]\n telephone = params[:telephone]\n message = params[:message]\n\n respond_to do |format|\n # flash alert the user if email is blank\n if email.blank?\n format.js { flash[:alert] = I18n.t('songs.request_contact.no_email') }\n #render 'contact'\n #format.html { redirect_to contact_path }\n else if name.blank?\n format.js { flash[:alert] = I18n.t('songs.request_contact.no_name') }\n #render 'contact'\n #format.html { redirect_to contact_path }\n else if message.blank?\n format.js { flash[:alert] = I18n.t('songs.request_contact.no_message') }\n #render 'contact'\n #format.html { redirect_to contact_path }\n else\n ContactMailer.contact_email(email, name, telephone, message).deliver_now\n format.html { redirect_to root_path }\n format.js { flash[:notice] = I18n.t('songs.request_contact.email_sent') }\n end\n end\n end\n end\n #redirect_to root_path\n end", "def render_edit_email(form)\n @errors = form.errors.messages\n render :edit_email\n end", "def process_contact\n # In Rails, all of Express' req.params, req.query\n # and req.body are comined into the `params` object.\n\n # Use `render json: <object>` to inspect the object\n # as json in the browser much like we did with \n # `res.send()` in Express.\n # render json: params\n # vs. JavaScript\n # res.send({ ...req.body, ...req.query, ...req.params })\n \n # In Rails, instance variables in the controller are\n # accessible in the rendered view as well.\n # Use them to pass value to your templates.\n @full_name = params[:full_name]\n @message = params[:message]\n @email = params[:email]\n \n render :thank_you\n end", "def email\n end", "def sendQuestionnaire\n email=params[:email]\n emails=email.split(\",\")\n description=params[:description]\n questionnaire_id = params[:questionnaire_id]\n emails.each do |one|\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/questionnaires/answer_show?id=\"+questionnaire_id).deliver()\n end\n respond_to do |format|\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \n end\n end", "def do_email\n @delivery = Delivery.find(params[:id])\n @email = params[:email]\n \n Notifier.delivery(@email, @delivery).deliver\n \n flash[:notice] = \"The delivery has been sent successfully.\"\n redirect_to \"/deliveries/#{@delivery.id}\"\n end", "def contact_message\n @contact_message = params[:contact_message]\n mail to: self.class.admin_emails\n end", "def create\n @<%=model_name %> = <%=class_name %>.find_by_email(params[:email])\n \n if @<%=model_name %>.initiate_password_reset_request!\n <%= class_name %>Mailer.password_change_request(@<%= model_name %>).deliver if @<%= model_name %>.needs_password_reset_mail?\n render :action => \"mail_sent\"\n else\n flash.now[:notice] = \"That email doesn't exist in our system.\"\n render :action => \"new\"\n end\n \n end", "def email_contact(params)\n @first_name = params['firstname']\n @last_name = params['lastname']\n @email = params['email']\n @drop_down = params['selection']\n @message = params['message']\n mail to: \"[email protected]\", subject: \"You've been sent a new message!\"\n end", "def new_apply_email(feedback_params)\n @firstname = feedback_params[:firstname]\n @lastname = feedback_params[:lastname]\n @telephone = feedback_params[:telephone]\n @email = feedback_params[:email]\n @address = feedback_params[:address]\n @landlord = feedback_params[:landlord]\n @landlordnum = feedback_params[:landlordnum]\n @employer = feedback_params[:employer]\n @employername = feedback_params[:employername]\n @employernum = feedback_params[:employernum]\n @income = feedback_params[:income]\n # Initialize the message here\n # mail(to: [\"[email protected]\",\"[email protected]\", \"[email protected]\", \"[email protected]\", \"[email protected]\", \"[email protected]\"], subject: 'There is a new institution registration pending')\n mail(to: [\"*Some Email*\", \"*Some Email*\"], subject: 'Akridge LLC: A new applicant has applied')\n end", "def request_contact\n name = params[:name]\n email = params[:email]\n telephone = params[:telephone]\n message = params[:message]\n if email.blank?\n flash[:alert] = I18n.t('contact.no_email')\n else\n ContactMailer.contact_email(email,name,telephone,message).deliver_now\n flash[:notice] = I18n.t('contact.yes_email')\n end\n redirect_to root_path\n end", "def do_email\n @invoice = Factura.find(params[:id])\n @email = params[:email]\n \n Notifier.invoice(@email, @invoice).deliver\n \n flash[:notice] = \"The invoice has been sent successfully.\"\n redirect_to \"/facturas/#{@invoice.id}\"\n end", "def show\n session[:applicant_token] = params[:id] unless current_user\n @email = ERB.new(Settings.email_template).result(get_binding)\n p EMAIL: @email\n end", "def site_page_form\n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\"\n end", "def create\n @user = User.where(email: (params[:email])).first\n\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @user.generate_reset_password_token! if @user\n @url = edit_password_reset_url(@user.reset_password_token)\n\n @mail = send_mail({\n :subject=> \"Password Reset\",\n :from_name=> \"Password Reset\",\n :text=>\"Use the link provided to reset your password\",\n :email=> @user.email,\n :name=> \"#{@user.first_name}\",\n :html=> render_to_string('/mail_templates/password_reset.html.erb', :layout => false, :locals => {:address => @url, :name => @user.first_name}),\n :from_email=>\"[email protected]\"\n })\n\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n redirect_to(root_path, :notice => 'Instructions have been sent to your email.')\n end", "def send_test\n email = Email.find(params[:id])\n @templet = email\n \n if request.post?\n begin\n recip = Recipient.new\n recip.email = params[:recipient][:email]\n \n Notifier::deliver_status_notify(:project => @project, :recipient => recip, :email => email)\n \n flash[:notice] = \"Test e-mail sent successfully!\"\n redirect_to :action => 'index'\n rescue\n flash.now[:error] = \"Unable to send the test email! \" + $!\n end\n end\n end", "def new\n # User clicked on the \"Forgot Password\" link, it will show the form\n # to insert the email\n end", "def update\n remove_email_dependencies\n migrate_template_to_email\n respond_to do |format|\n if @email.save\n build_emails\n format.html {redirect_to emails_url, notice: 'Email was updated.'}\n format.json {render :index, status: :ok }\n else\n format.html {render :edit}\n format.json {render json: @email.errors, status: :unprocessable_entity}\n end\n end\n end", "def request_contact\n\n email = params[:email]\n firstname = params[:firstname]\n surname = params[:surname]\n message = params[:message]\n\n if email.blank? or !validEmail(email)\n flash[:alert] = \"Sorry, your email has not been sent. Please try again with a valid email address. \"\n else\n ContactMailer.contact_email(email, firstname, surname, message).deliver_now\n flash[:notice] = \"Your email has been successfully sent! A response will soon be on it's way :)\"\n end\n redirect_to root_path\n end", "def email; end", "def email; end", "def email; end", "def email; end", "def chngemail\n #@talk = Talk.find(params[:id])\n #@contact = Contact.find(@talk.contact_id)\n #@contact.email = params[:email]\n #if @contact.update \t\n \t#flash[:notice] = 'Contact email successfully updated.'\n #redirect_to :action => \"edit\", :id => params[:id]\n #else\n #redirect_to :action => \"edit\", :id => params[:id]\n # end\n \n #@talk.call_when_time = Time.now\n #@contact = Contact.find(params[:contact_id])\n #render :text => @contact.last_name, :layout => true \n #Contact.update (@talk.contact_id,\t { :email => params[:email] })\n @datum = params[:hovor]\n @datven = \"\"\n @datum.each_value {|value| @datven += \"value is #{value}\" }\n \n redirect_to :action => \"index\"\n #render :text => @datven, :layout => true \t\n #\tparams[:hovor][\"kdy(1i)\"] \n #redirect_to :action => \"edit\", :id => params[:id]\n end", "def show\n ReportMailer.MailReports(params[:export][:email]).deliver\n flash[:success] = \"Email sent\"\n redirect_to reports_path\n end", "def contact_form(args={})\n @name = args[:name]\n @email = args[:email]\n @message = args[:message]\n \n recipient = Rails.application.secrets.email['full_email']\n \n mail(to: recipient, subject: \"#{t('title')} contact form\")\n end", "def issued\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end", "def invite\n @invite = Invite.new(params[:invite])\n @invite.user_id = current_user.id\n render :update do |page|\n if @invite.save\n #UserMailer.send_invitation(@invite).deliver\n if params[:action] == \"invite_friends\"\n page.alert('Invitation sent successfully')\n else\n page.alert('Invitation sent successfully')\n page.redirect_to home_index_path\n end\n else\n params[:emails].present? ? page.alert('Please Enter Correct Email') : page.alert('Please Enter Atleast One Email')\n end\n end\n end", "def volunteer_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"[email protected]\", :subject => \"Volunteer inquiry\")\n end", "def mail\n flash[:notice] = \"Sorry, that page is not available.\"\n redirect_to alerts_path\n end", "def deliverForm data\n @fromContact = data['fromContact']\n @data = data\n tomail = data['toEmail'].length > 0 ? data['toEmail'] : '[email protected]'\n\n mail(to: tomail, subject: data['fromContact'] || 'Want to be a Partner')\n end", "def submit\n local_params = params\n Contact.contact(local_params[:from], local_params[:text]).deliver\n redirect_to contact_path, notice: 'Contact mail sent'\n end", "def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], config: blacklight_config }, url_options)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end", "def mail; end", "def email\n template = (params[:layout] || 'email').to_sym\n # template = :hero unless [:email, :hero, :simple, :new].include? template\n file = 'user_mailer/welcome_email'\n @user = (defined?(FactoryGirl) \\\n ? User.new( FactoryGirl.attributes_for :user )\n : User.new( email: '[email protected]', first_name: 'John', last_name: 'Smith' ))\n render file, layout: \"emails/#{template}\"\n if params[:premail] == 'true'\n puts \"\\n!!! USING PREMAILER !!!\\n\\n\"\n pre = Premailer.new(response_body[0], warn_level: Premailer::Warnings::SAFE, with_html_string: true)\n reset_response\n # pre.warnings\n render text: pre.to_inline_css, layout: false\n end\n end", "def contact_form(contact)\n @contact = contact\n\n mail to: contact.email, subject: \"Thanks for getting in touch\"\n end", "def preview\n task = MailTasks::Task.new( params[:task] )\n recipient = StoreUser.find( params[:id], :include => \"customer\", :readonly => true )\n mail = task.generate_mails( [recipient], false, mail_layout_options ).first\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n # rescue => exception\n # headers[\"Content-Type\"] = \"text/plain\"\n # render :text => exception.to_yaml, :layout => false\n end", "def wholesale_inquiry(contact)\n @contact = contact\n @url = contacts_path\n mail(:to => \"[email protected]\", :subject => \"Wholesale inquiry\")\n end", "def item_feedback\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Item Feedback <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"Item Feedback [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end", "def contact_request\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def results(user)\n @user = user # Instance variable => available in view\n mail(to: @user.email, subject: \"#{@user.first_name}: Get Your Results!\")\n # This will render a view in `app/views/user_mailer`!\n end", "def send_home_form_email(lead)\n @lead = lead\n mail( :to => @lead.email,\n :subject => \"The answer you seek\" )\n end", "def email\n @delivery = Delivery.find(params[:id])\n @company = @delivery.company\n \n end", "def create\n # Check that there is at least something entered in the recipients and body field\n if mail_params[:recipients].blank? || mail_params[:body].blank?\n flash[:error] = \"Either recipients or body missing. Retry.\"\n redirect_to '/'\n return\n end\n\n # Loop through the recipients list breaking on every ',' character (Strips whitespace first)\n mail_params[:recipients].strip.split(\",\").each do |recipient|\n DemoMailer.send_email(recipient, mail_params[:body]).deliver_later\n end\n\n flash[:success] = \"Emails Sent.\"\n redirect_to '/'\n end", "def send_page(email_alert)\n @body = email_alert.all_params.body\n settings = Setting.first\n\n\n mail to: settings.pager_email, subject: email_alert.subject, from: ENV[\"FROM_EMAIL\"]\n end", "def show_thank_you\n mail to: @guest.email, subject: \"We hope you enjoyed the show\"\n end", "def create\n @user = User.find_by_email(user_params[:email]) if user_params[:email].present?\n\n if @user\n # Reset session when logged in user resets his password\n logout if logged_in?\n # This line sends an email to the user with instructions on how to reset their password (a url with a random token)\n @user.deliver_reset_password_instructions!\n end\n # Tell the user instructions have been sent whether or not email was found.\n # This is to not leak information to attackers about which emails exist in the system.\n render\n end", "def send_email(user, user_url)\n user.recipients.each do |recipient|\n @recipient = recipient\n @user = user\n @executor = user.executors.first\n @user_url = user_url\n mail( \n :to => @recipient.email,\n :subject => 'Our Condolences') do |format|\n format.html {render 'send_email' }\n format.text { render 'send_plain_email'}\n end\n end\n end", "def correspond\n @user = current_user\n @recipient = User.find(params[:id])\n @title = \"Email #{@recipient.name}\"\n if param_posted?(:original) #if user is responding to an original mail \n # @original and @original_subject will be availabe in the correspond view\n @original_title = session[:original_title]\n @original_body = session[:original_subject]\n end\n\n @message ||= Message.new({:subject=>\"\", :body=>\"\"})\n\n if param_posted?(:message)\n #if @message.update_attributes(params[:message])\n @message.subject = params[:message][:subject]\n @message.body = params[:message][:body]\n\n if @message.valid?\n #@body_sesson and @title_session will be available to mailer and it's correspond_message view\n @body_session = session[:original_message] #creating session in the controller \n @title_session = session[:original_title]\n #passing message params including session instances to be accessible in action mailer\n UserMailer.correspond_mail(@user, @recipient, @message, \n @body_session, @title_session).deliver\n flash[:success] = \"Email sent to #{@recipient.name}\"\n redirect_to profile_path(@recipient)\n end\n end\n\n end", "def email\n return unless can_be_emailed\n\n OfferMailer.email_contract(@offer).deliver_now!\n\n if @offer.provisional?\n # If the assignment has not been sent before, set status to pending\n @offer.pending!\n else\n # If the assignment has been sent before, make sure the emailed date gets updated.\n @offer.emailed_date = Time.zone.now\n @offer.save!\n end\n render_success @offer\n end", "def mail\n mail = MailTasks::Mail.query_by_id( params[:id] )\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n end", "def in_process\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Request Services <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"On Order / In Process Request [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end", "def request_mail(from_email, content_body, requestor_type)\n @content= content_body\n @sender = from_email\n @requestor_type = requestor_type\n mail from: from_email, to: '[email protected]', subject: 'PFS general enquiry'\n end", "def notify\n ActionMailer::Base.mail(:from => \"[email protected]\", :to => \"[email protected]\", :cc => \"[email protected]\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end", "def post_email\n @email = Email.new\n @email.subject = params[:subject]\n @email.body = params[:body]\n @email.sender = User.find(params[:sender]).id\n @email.receiver = params[:receiver]\n @email.save()\n# flash[:notice] = \"Email sent successfully.\"\n if params[:linkedfrom] == 'listing'\n redirect_to :controller => :listings, :action => :listing, :id => params[:listing]\n else\n redirect_to :controller => :user, :action => :inbox\n end\n end", "def contact_submitted (contact)\n @contact = contact\n\n mail :to => \"[email protected]\"\n end", "def email_signup\n email = params[:Email] || params[:email] || \"\"\n @src = \"#{website.email_signup_url}#{email}\"\n @page_title = \"Newsletter Sign Up\"\n render_template\n end", "def send_contact_form\n UserMailer.contact_form.deliver\n end", "def send_form(formdata: {})\n # Build the mail to be sent\n frm = formdata['reporteremail']\n subject = \"[FORM] Misuse Report about #{formdata['project']}\"\n pmc_list = ASF::Committee.find(formdata['project']).mail_list\n cc_list = [\"private@#{pmc_list}.apache.org\", frm]\n to_list = BRANDLIST\n\n if true # TESTING mode\n to_list = \"[email protected]\"\n cc_list = ''\n end # TESTING mode\n\n ASF::Mail.configure\n mail = Mail.new do\n from frm\n return_path BRANDLIST\n to to_list\n cc cc_list\n end\n mail.header['X-Mailer'] = 'whimsy/www/committer/tm-report(0.0)'\n mail.subject = subject\n mail.body = formdata.to_yaml\n begin\n mail.deliver!\n rescue Exception => e\n formdata['errors'] = \"Bogosity! mail.deliver raised: #{e.message[0..255]}\"\n end\n\n # Tell user what we did\n _div.well.well_lg do\n _div.bg_danger \"BETA - THIS FORM IS NOT COMPLETE YET - DEBUGGING - formdata we would have mailed out\"\n formdata['to'] = to_list\n formdata['cc'] = cc_list\n formdata['from'] = frm\n formdata['subject'] = subject\n _div.bg_info formdata.to_yaml\n end\n _div.well.well_lg do\n _div.bg_danger \"BETA - THIS FORM IS NOT COMPLETE YET - DEBUGGING - Mail data that was sent (debug=to Shane)\"\n _pre.email mail.to_s\n end\nend", "def submission\n if @job.status?\n @application = Application.new(application_params)\n email_api = Email_api.new\n if email_api.email(@application)\n render json: @application, status: :OK\n else\n render json: @application.errors, status: :bad_request\n end\n else\n render plain: job_not_active, status: :unprocessable_entity\n end\n end", "def rails_send_email(action)\n email = rails_create_email(action)\n email.public_send(rails_mailer_deliver_method)\n end", "def send_email\r\n if User.exists? params[:id]\r\n @email_to_usr = User.find(params[:id])\r\n if params[:commit]\r\n if @sending_res = profile_mail_sending(params, @email_to_usr)\r\n return if @sending_res.kind_of? Hash\r\n redirecting(t(:email_redir), session[:last_page])\r\n else\r\n redirect_to_info_page t(:email_error)\r\n end\r\n return\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end", "def new\n @email = DirectEmail.new\n respond_with @email\n end", "def open\n mail = MailTasks::Mail.find_by_token( params[:id] )\n raise ActiveRecord::RecordNotFound unless mail # raise 404 if mail is not found\n \n options = {\n :post_back_url => url_for( :controller => \"/email\", :action => \"red_logo\" ),\n :base => [request.protocol, request.host].join\n }\n render :text => mail.content_with_layout( options ), :layout => false\n end" ]
[ "0.7690707", "0.7690707", "0.7319876", "0.7173991", "0.7116096", "0.6907408", "0.6902524", "0.6847956", "0.67486763", "0.6741648", "0.66759884", "0.6669743", "0.6640802", "0.66180766", "0.65459716", "0.65459716", "0.6534295", "0.6524143", "0.6510644", "0.648438", "0.64535683", "0.64513355", "0.6439141", "0.6433209", "0.63656247", "0.6355356", "0.63389444", "0.63333714", "0.6328019", "0.6314434", "0.62880754", "0.62829506", "0.62827784", "0.6278416", "0.62728214", "0.6268083", "0.6261357", "0.62526995", "0.62358147", "0.6229724", "0.6229559", "0.62149805", "0.6212649", "0.6208979", "0.62040615", "0.619683", "0.6186359", "0.61806273", "0.6170273", "0.6160424", "0.61570764", "0.6152237", "0.6143856", "0.6143856", "0.6143856", "0.6143856", "0.61385417", "0.6129793", "0.6128792", "0.61129236", "0.6104219", "0.6097245", "0.6091403", "0.60828525", "0.60776204", "0.60756654", "0.607317", "0.60679007", "0.6061697", "0.60609436", "0.6060052", "0.60573316", "0.60495025", "0.6040902", "0.6039359", "0.6038647", "0.6031033", "0.6024062", "0.60181373", "0.6016061", "0.6008847", "0.60060656", "0.6002696", "0.60018605", "0.6001164", "0.5989183", "0.5982096", "0.59813285", "0.59752953", "0.5971635", "0.5971502", "0.5969927", "0.59692585", "0.5958831", "0.59538907", "0.595009", "0.5948673", "0.59472793", "0.59438866", "0.5943458" ]
0.71540964
4
Sends the request to be processed
def show Marmite::Services::ShowEndpoint.new( controller: self, find_by_conditions: show_params ).call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_request; end", "def send_request\n @response = _send_request\n end", "def send_request(req); end", "def send\n http = EM::HttpRequest.new(@uri).post(@request_options)\n\n http.callback do\n process(http.response)\n end\n\n http.errback do\n fail(http.error)\n end\n end", "def do_request\n\t\t\tself.response = post_request(options)\n\t\tend", "def send_request(request)\n connect\n @handler.enqueue_request(request)\n end", "def process\n send_request @action\n end", "def send\n sleep(delay_seconds) # Delay request if needed\n http = Net::HTTP.new(@uri.host, @uri.port)\n http.use_ssl = @config_use_ssl\n begin\n res = http.start { |http| @response = http.request(@request) }\n rescue Exception => e\n @failures << \"Exception raised while making request: #{e.message}\"\n end\n if @failures.size == 0\n @send_count += 1\n if @oks.include?(res.code)\n Log.response(@response)\n else\n Log.response(@response, false)\n @failures << \"Request returned #{res.code}\"\n end\n end\n end", "def run\n make_request(@path)\n end", "def send_request method, params, &block\n message = {\n jsonrpc: \"2.0\",\n method: method,\n params: params,\n id: @next_request_id\n }\n json = message.to_json\n requests[@next_request_id] = Request.new(@next_request_id, &block)\n envelope = \"Content-Length: #{json.bytesize}\\r\\n\\r\\n#{json}\"\n queue envelope\n @next_request_id += 1\n end", "def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end", "def send_request\n setup_connection\n send_request_with_lazy_pirate unless error?\n end", "def send_request\n \t\taz = @args[:authorization] and az = \"Authorization: #{az}\\r\\n\"\n body = @args.delete(:body)\n headers = @args.delete(:headers)\n body.strip! if body\n content_type = @args[:content_type]\n \t\tr = [\n \t\t \t\"#{@args[:verb]} #{@args[:uri]} HTTP/#{@args[:version] || \"1.1\"}\\r\\n\",\n \t\t\t\"Host: #{@args[:host_header] || \"_\"}\\r\\n\",\n \t\t\taz || \"\",\n \t\t\t\"Content-Length: #{body.nil? ? 0 : body.size}\\r\\n\",\n \t\t\t\"Date: #{Time.now.httpdate}\\r\\n\",\n \t\t\tcontent_type.nil? ? \"\" : \"Content-Type: #{content_type}\\r\\n\"\n \t] + \n (headers.nil? ? [] : headers.keys.map{|key| \"#{key}: #{headers[key]}\\r\\n\"}) +\n [\"\\r\\n\", body]\n \n \t\[email protected]_data(r.join)\n \tend", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def run_request(hash)\n connection.run_request(hash[:verb], hash[:path], hash[:body],\n hash[:header])\n end", "def send_request\n request = Request.new(@floor, @direction)\n @elevator.requests_queue.append(request)\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def _send_request request_payload\n _write request_payload, stream\n end", "def send_request(method, params, &block); end", "def _send_request request, &block\n @response_waited[request.id] = block if block_given?\n send_data request.to_s + \"\\n\"\n request\n end", "def send_request\n\n uri = URI(\"https://delivery-center-recruitment-ap.herokuapp.com/\")\n time = Time.now\n time = format_date(time)\n header = {\"Content-Type\": \"X-Sent #{time}\"}\n \n # Cria os parâmetros http\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Post.new(\"https://delivery-center-recruitment-ap.herokuapp.com/\", header)\n request.body = @request_body.to_json\n response = http.request(request)\n\n #salva resposta para mostrar na tela\n self.resposta = response.body\n self.save\n end", "def process()\n begin\n @sock.sync=true\n req=WEBrick::HTTPRequest.new(WEBrick::Config::HTTP.dup)\n res=WEBrick::HTTPResponse.new(WEBrick::Config::HTTP.dup)\n WEBrick::Utils::set_non_blocking(@sock)\n WEBrick::Utils::set_close_on_exec(@sock)\n req.parse(@sock)\n $logger.debug \"PATH=#{req.path}\"\n $logger.debug \"QUERY=#{req.query_string}\"\n args=req.path.split('/')\n cmd=args.last()\n str=run(cmd, req.query_string)\n res.request_method=req.request_method\n res.request_uri=req.request_uri\n res.request_http_version=req.http_version\n res.keep_alive=false\n res.body=\"Accepted,#{req.path},#{str}\"\n res.status=200\n $logger.debug res.inspect()\n res.send_response(@sock)\n rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO=>ex\n rescue Exception => ex\n raise ex.inspect()\n end\n end", "def process()\n begin\n @sock.sync=true\n req=WEBrick::HTTPRequest.new(WEBrick::Config::HTTP.dup)\n res=WEBrick::HTTPResponse.new(WEBrick::Config::HTTP.dup)\n WEBrick::Utils::set_non_blocking(@sock)\n WEBrick::Utils::set_close_on_exec(@sock)\n req.parse(@sock)\n $logger.debug \"PATH=#{req.path}\"\n $logger.debug \"QUERY=#{req.query_string}\"\n args=req.path.split('/')\n cmd=args.last()\n str=run(cmd, req.query_string)\n res.request_method=req.request_method\n res.request_uri=req.request_uri\n res.request_http_version=req.http_version\n res.keep_alive=false\n res.body=\"Accepted,#{req.path},#{str}\"\n res.status=200\n $logger.debug res.inspect()\n res.send_response(@sock)\n rescue Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPROTO=>ex\n rescue Exception => ex\n raise ex.inspect()\n end\n end", "def send_request(message)\n message.requires_response!\n\n Pantry.logger.debug(\"[#{identity}] Sending request #{message.inspect}\")\n\n @networking.send_request(message)\n end", "def request\n self.response = prepare_response(http_communication.content)\n end", "def send_request\n if payload\n payload_type = payload.is_a?(String) ? :body : :form\n\n @http.public_send(method, url, payload_type => payload, ssl_context: ssl_options)\n else\n @http.public_send(method, url, ssl_context: ssl_options)\n end\n end", "def send_request request\n request.create_identifier! if needs_request_identifier?\n _log_result [ :send_request, :request, request ] do\n request_payload = encoder.dup.encode(request)\n opaque = _send_request(request_payload)\n response = receive_response opaque\n _log { [ :send_request, :response, response ] }\n if response\n if exc = response.exception\n exc.invoke!\n else\n response.result\n end\n else\n response\n end\n end\n end", "def send_request(request_obj)\n request(request_obj.method, request_obj.path, body: request_obj.body.to_json)\n end", "def send_request(req)\n raise TypeError if !req.is_a?(RequestContext)\n raise \"Request context seems to be sent already: #{req.state}\" if req.state != :init\n\n # possible timeout_sec values:\n # timeout_sec == -1.0 : to be overwritten to the default timeout.\n # timeout_sec == 0.0 : never be timed out.\n # timeout_sec > 0.0 : wait for the user set timeout.\n if req.timeout_sec == -1.0\n # set default timeout if no one updated the initial value.\n req.timeout_sec = config_section.timeout_sec\n end\n\n req.process_event(:on_ready)\n\n EventMachine.schedule {\n @stats[:total_request_count] += 1\n if @stats[:peak_wait_response_size] < @active_requests.size\n @stats[:peak_wait_response_size] = @active_requests.size\n end\n if !req.oneshot\n @active_requests[req.ticket] = req\n end\n\n # create receiver queue every time before publish the message.\n # This helps to receive messages from the failed receiver.\n amq.queue(endpoint_queue_name(req.endpoint), {:exclusive=>false, :auto_delete=>true})\n @requested_endpoints[req.endpoint] = 1\n\n amq.default_exchange.publish(Serializer.instance.marshal(req.request_hash),\n {:message_id => req.ticket,\n :key => endpoint_queue_name(req.endpoint),\n :reply_to=>\"command-recv.#{manifest.node_id}\"}\n )\n req.process_event(:on_sent)\n }\n end", "def submit\r\n @sess.DoRequests(@request_set)\r\n end", "def request(request)\n @socket.request(request)\n end", "def send_raw_request raw_params\n @request_id += 1\n begin\n raw_response = server.request(raw_post_request(raw_params))\n rescue NoMethodError, SocketError => e\n raise RequestError.new(\"Could not connect to Zabbix server at #{host_with_port}\")\n end\n raw_response\n end", "def _request(verb, path, params)\n Rester.wrap_request do\n Rester.request_info[:producer_name] = name\n Rester.request_info[:path] = path\n Rester.request_info[:verb] = verb\n logger.info('sending request')\n\n _set_default_headers\n start_time = Time.now.to_f\n\n begin\n response = adapter.request(verb, path, params)\n _process_response(start_time, verb, path, *response)\n rescue Errors::TimeoutError\n logger.error('timed out')\n raise\n end\n end\n end", "def send_request path, opts\n request_context = build_request path, opts\n raw_response = execute request_context\n adapt_response request_context, raw_response\n end", "def send\n post_params = {}\n self.parameters.each { |key, value|\n if value.is_a? Array\n i = 0\n value.each { |value_value|\n post_params[key.to_s + '[' + i.to_s + ']'] = value_value.to_s\n i += 1\n }\n elsif value.is_a? Hash\n value.each { |value_key, value_value|\n post_params[key.to_s + '[' + value_key.to_s + ']'] = value_value.to_s\n }\n else\n post_params[key.to_s] = value.to_s\n end\n }\n\n url = URI.parse(@@API_URL)\n http_request = Net::HTTP::Post.new(url.path)\n http_request.form_data = post_params\n http_request.basic_auth url.user, url.password if url.user\n\n response = Spree::PAYONE::Proxy::Response.new\n connection = Net::HTTP.new(url.host, url.port)\n load_ca_file connection\n connection.use_ssl = true\n connection.start { |http|\n http_response = http.request(http_request)\n response.response_body= http_response.body\n }\n\n response\n end", "def http_send_action\n http = http_inst\n req = http_post\n Response.new http.request req\n end", "def send_request(request, options)\n EM.next_tick do\n flush_buffer\n internal_send_request(request, options)\n end\n end", "def send_request(data)\n \n if $DEBUG\n puts \"[request]data--------------\"\n puts data\n puts \"--------------------------\" \n end\n \n outgoing = Blix.to_binary_data(data)\n options = {}\n \n options[:key] = \"\"\n options[:reply_to] = @reply_to\n options[:content_type] = \"text/xml\"\n options[:message_id] = \"#{@time.to_i}#{rand(9999)}\"\n @out_exch.publish(outgoing, options )\n \n incoming = nil\n while (!incoming)\n msg = @in_queue.pop\n payload = msg[:payload]\n incoming = payload unless payload == :queue_empty\n end\n # \n if $DEBUG\n puts \"[request]response data-----\"\n puts incoming\n puts \"--------------------------\" \n end\n incoming\n end", "def execute!\n validate_request!\n\n build_response!\n end", "def send_response\n\t\t\tsend_headers\n\t\t\tsend_body\n\t\t\tsend_trailer\n\t\t\tclose_connection_after_writing unless (@keep_connection_open and (@status || 200) < 500)\n\t\tend", "def send_message!\n msg = Message::Request.from_job(self)\n msg.send!\n end", "def send_request( xml )\n write( xml )\n read\n end", "def send_request path, opts = {}\n connection.send_request path, opts\n end", "def send_request_for(testcase)\n @http_client.send_request(testcase.request['method'], testcase.request['path'], testcase.request['headers'], testcase.request['body'], testcase.request['parameters'])\n end", "def submit\n http = Net::HTTP.new(URL.host, URL.port)\n http.use_ssl = true\n http.start { |send| send.request(self) }.body\n end", "def make_request\n response = @http.request(@request)\n end", "def send()\n uri = URI.parse(@service_end_point)\n signature = Amazon::FPS::SignatureUtils.sign_parameters({parameters: @params, \n aws_secret_key: @secret_key,\n host: uri.host,\n verb: @http_method,\n uri: uri.path })\n @params[Amazon::FPS::SignatureUtils::SIGNATURE_KEYNAME] = signature\n\n request = log_request(@params)\n response = self.class.get(@service_end_point, query: @params)\n response = strip_response(response)\n\n log_response(response, request)\n return response\n end", "def send_request(http_method, path: \"\", body: nil)\n body = ActiveSupport::JSON.encode(body) if body.is_a? Hash\n @connection.run_request(http_method.downcase.to_sym,\n path.to_s,\n body,\n default_headers)\n end", "def send\n @system = \"\"\n yield @system\n\n result = 'qf=xml&xml=' + render_template( 'auth' )\n\n @url.post( @uri.path, result, @headers.merge('Content-length' => result.length.to_s) )\n end", "def do_request(request, want_reply, data); end", "def send(request)\n # Translate path so that underscores are converted to minuses\n # Don't change the original input value\n request.path = request.path.gsub('_', '-')\n request.tag = 0\n data = request.serialize_to_string\n # An additional header is added to the request indicating the size of the request\n head = [data.length].pack(\"N\")\n logger.trace('Sending') {request.to_hash}\n @socket.write(head+data)\n end", "def run_request(method, url, body, headers); end", "def send!\n request = Net::HTTP::Post.new(uri.path, headers)\n request.body = @body\n request.content_type = @@content_type\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(request)\n end\n ok?(response)\n end", "def send_request(uri, request, tokens)\n begin\n request = parse_uri(uri, request, tokens)\n @raw_client.send_request(@sequence, writer_serialize(request))\n ensure\n increase_sequence\n end\n end", "def send_request(request)\n previous = @queue.last\n current = Job.new(Fiber.current, request, false)\n @queue << current\n\n # wait for the previous request to be sent\n while previous && !previous.sent\n return if Fiber.yield == :kill\n end\n\n # send the request\n self.comm_inactivity_timeout = 0\n @builder.request(request.to_a)\n current.sent = true\n self.comm_inactivity_timeout = config[:timeout]\n\n # wait for the response\n while !current.response\n return if Fiber.yield == :kill\n end\n\n # clean up and return response\n @queue.delete(current)\n current.response\n end", "def send_request(request)\n\n factory_hash = request.to_hash\n @request.body = factory_hash.to_json\n\n # send request\n response = @http.request(@request)\n http_response = HttpResponse.new(response)\n\n parser = InjectionResponseParser.new\n parser.parse(http_response)\n\n end", "def send_request(request) # :nodoc:\n response = @http.request(request)\n validate_response(response)\n JSON.parse(response.body)\n end", "def send_request(siirto_request)\n request = create_request(siirto_request)\n IO.popen(request)\n end", "def send_request(body)\n status = false\n data = false\n code = \"\"\n\n Net::HTTP.start(\"#{@subdomain}.#{@options[:host]}\", 80) do |http|\n req = Net::HTTP::Post.new(@options[:pathname])\n\n req.content_type = 'application/atom+xml'\n req.content_length = body.size - 20 # Currently a bug with the Pomegranate API I believe\n req.body = body\n\n if authentication_set?\n req.ntlm_auth(@username, @options[:domain], @password)\n end\n\n response = http.request(req)\n\n code = response.code\n\n if code == \"201\"\n data = parse_xml(response.body)\n else\n break\n end\n end\n\n {:code => code, :data => data}\n end", "def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def request\n @rpc.request\n end", "def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end", "def send_request(req, timeout = nil)\n send_update(req, timeout)\n return read_response(timeout)\n end", "def send\n http = Net::HTTP.new(@uri.host, @uri.port)\n http.read_timeout = @http_timeout\n\n # Output request XML if debug flag is set\n if debug == true\n logger.info \"Request URL: #{@uri.to_s}\"\n logger.info \"Request Timeout: #{@http_timeout}\"\n logger.info \"Request headers: #{headers}\"\n logger.info \"Request body: #{body}\"\n end\n\n if @uri.port == 443\n http.use_ssl = true\n http.ssl_timeout = @http_timeout\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n post = Net::HTTP::Post.new(@uri.path, headers)\n post.body = body\n post.content_type = 'text/xml'\n\n response = http.start { |http| http.request(post) }\n\n if debug == true\n logger.info \"Response: #{response}\"\n end\n\n if response.is_a? Net::HTTPInternalServerError\n logger.info \"#{response.class.to_s}: #{response.message}\"\n return Hashie::Mash.new({})\n end\n\n @response = Hashie::Mash.new(Response.new(self, response))\n end", "def send_request(opts)\n request = prep_request(opts)\n response = relay_request(request, opts)\n return response if response.is_a?(Net::HTTPSuccess) || response.is_a?(Net::HTTPAccepted)\n\n handle_error_response(response, opts[:endpoint])\n end", "def call(request)\n\t\t\t\t\t\traise ::Protocol::HTTP2::Error, \"Connection closed!\" if self.closed?\n\t\t\t\t\t\t\n\t\t\t\t\t\t@count += 1\n\t\t\t\t\t\t\n\t\t\t\t\t\tresponse = create_response\n\t\t\t\t\t\tresponse.send_request(request)\n\t\t\t\t\t\tresponse.wait\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn response\n\t\t\t\t\tend", "def send_request\n request_wrapper = Protobuf::Socketrpc::Request.new\n request_wrapper.service_name = @options[:service].name\n request_wrapper.method_name = @options[:method].to_s\n \n if @options[:request].class == @options[:request_type]\n request_wrapper.request_proto = @options[:request].serialize_to_string\n else\n expected = @options[:request_type].name\n actual = @options[:request].class.name\n fail :INVALID_REQUEST_PROTO, 'Expected request type to be type of %s, got %s instead' % [expected, actual]\n end\n \n log_debug '[client-cnxn] Sending Request: %s' % request_wrapper.inspect\n request_buffer = Protobuf::Rpc::Buffer.new(:write, request_wrapper)\n send_data(request_buffer.write)\n @stats.request_size = request_buffer.size\n end", "def send_request(request)\n message = RemoteMessage.new(request_message: request).serialize_to_string\n message_size = [message.length].pack('N')\n @ssl_client.write(message_size + message)\n end", "def process_http_request\n # the http request details are available via the following instance variables:\n # @http_protocol\n # @http_request_method\n # @http_cookie\n # @http_if_none_match\n # @http_content_type\n # @http_path_info\n # @http_request_uri\n # @http_query_string\n # @http_post_content\n # @http_headers\n handle(@http_request_method, @http_post_content)\n\n send_ok()\n end", "def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end", "def send_next_request\n return if request_queue.empty?\n raise \"cannot make a request while in #{@state.inspect} state\" unless @state == :idle\n request, @in_flight = request_queue.shift\n send_data([request.size, request].pack('NA*'))\n @recv_buf = ''.force_encoding('BINARY')\n @last_request = Time.now\n @state = :request\n end", "def perform(request, response); end", "def send_request(req)\n if @pending_response\n raise StateError, \"Tried to send a request while one is pending already. Make sure you read off the body.\"\n end\n\n if @pending_request\n raise StateError, \"Tried to send a request while a response is pending. Make sure you read off the body.\"\n end\n\n @pending_request = true\n\n req.stream @socket\n\n @pending_response = true\n @pending_request = false\n end", "def send_request(req, t = -1)\n connect(t)\n conn.put(req.to_s)\n end", "def send_request(conn, req, &block)\n @last_response = conn.request(req.delete(:method), req.delete(:uri), req, &block)\n end", "def send_request_as(opts = {})\n connect(opts)\n req = build_as_request(opts)\n res = client.send_recv(req)\n disconnect\n res\n end", "def request\n socket.request\n end", "def request\n @req\n end", "def send\n uri = URI(@api_url)\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == \"https\"\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end\n http.read_timeout = GlobalConstant::CompanyApi.read_timeout\n http.open_timeout = GlobalConstant::CompanyApi.open_timeout\n req_obj = get_request_obj(uri.request_uri)\n\n http_response, e = nil, nil\n begin\n http_response = http.request(req_obj)\n set_api_response_cookie(http_response)\n parse_api_response(http_response)\n rescue Net::ReadTimeout, Net::OpenTimeout => e\n # Timeouts\n exception_with_internal_code(\n e,\n 'company_api_timeout',\n 'company api timeout',\n GlobalConstant::ErrorCode.internal_server_error,\n debug_data\n )\n rescue Exception => e\n # Exceptions\n exception_with_internal_code(e, 'company_api_exception', 'company api exception', GlobalConstant::ErrorCode.internal_server_error, debug_data)\n end\n\n end", "def request \n\t\t\tif self.valid?\n\t\t\t\tpath = \"/#{Base.config.api_path}/#{self.request_action}\"\n\t\t\t\tconnection.post(path, self.to_xml).tap do |response|\n\t\t\t\t\treturn handle_response(response)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend", "def perform_request(method, path, params, body)\n CONNECTION.run_request \\\n method.downcase.to_sym,\n path,\n ( body ? MultiJson.dump(body): nil ),\n {'Content-Type' => 'application/json'}\n end", "def send_request(path, method, params = {})\n not_blank(path, :path)\n not_blank(method, :method)\n\n response, error_messages = execute_request(method, path, params)\n result = block_given? ? yield(response) : response_body(response)\n\n [result, error_messages]\n end", "def send_request(xml)\n send_frame(xml)\n response = get_frame\n end", "def execute_request(request, client:)\n connection = build_connection(request.url, client: client)\n\n headers = request.headers.dup\n\n body = request.body\n\n resp = connection.run_request(request.verb.downcase, request.url, body, headers)\n\n {\n status: Integer(resp.status),\n message: resp.reason_phrase,\n headers: Simple::HTTP::Headers.new(resp.headers.to_hash),\n body: resp.body\n }\n end", "def perform_request(method, path, params={}, body=nil, headers=nil)\n client.perform_request method, path, params, body, headers\n end", "def hsdq_send_request(message)\n hsdq_send(message.merge(type: :request))\n end", "def send(request)\n # clear socket\n puts \"flushing socket\" if @debug\n @socket.flush\n\n puts \"sending request: #{request.inspect}\" if @debug\n response = ''\n @socket.puts request.bencode\n\n while r = @socket.recv(1024)\n response << r\n break if r.length < 1024\n end\n\n puts \"bencoded reply: #{response.inspect}\" if @debug\n response = response.bdecode\n\n puts \"bdecoded reply: #{response.inspect}\" if @debug\n response\n end", "def send_request( request_name, data, want_reply=false )\n msg = @buffers.writer\n msg.write_byte CHANNEL_REQUEST\n msg.write_long @remote_id\n msg.write_string request_name\n msg.write_bool want_reply\n msg.write data.to_s\n @connection.send_message msg\n self\n end", "def invoke_method\n unless check_preconditions\n return send_response(status: :precondition_failed)\n end\n\n method = request.request_method.downcase\n status, body = make_request method\n\n send_response status: status, body: body\n end", "def send_request(method, resource, html_request = {}, token = nil, &block)\n @request = Request.new(@api_key, method, resource, html_request, token)\n @requests[@request.token] = @request\n @conn.send_data(@request.to_json)\n @request\n end", "def send_request(ref, msg_id, arg, b)\n @msg.send_request(stream, ref, msg_id, arg, b)\n end", "def do_request(request, response)\n body = make_request(request)\n\n # Always 200. A simplification, but fine for user\n # error messages.\n response.status = 200\n response['Content-Type'] = 'text/html' \n response.body = body\n end", "def send\n bytes_sent = 0\n update_header\n\n Logger.info \"head: #{header.inspect}\"\n Logger.info \"body: #{message.inspect}\"\n\n for i in 0..(chunk_count-1)\n self.header.header_length = header_length_for_chunk(i)\n bytes_sent += send_chunk chunks[i]\n end\n\n PendingRequest.create self, @connection\n\n bytes_sent\n end", "def send_response\r\n if self.response.class.name == \"Proc\"\r\n return self.response.call\r\n end\r\n self.response\r\n end", "def send_request(elevator)\n request = Request.new(@floor, @direction)\n elevator.requests_queue.append(request)\n end", "def send\n if @accepted then\n # Calculate content length before sending\n \n @headers << \"Content-Length: #{@buffer.length}\\r\\n\"\n \n if !@content_type then\n @headers << \"Content-Type: text/html\\r\\n\"\n end\n\n # Send our data and close the connection\n @server.puts @headers\n @server.puts \"\\r\\n\"\n @server.puts @buffer\n @server.close\n else\n puts \"[Rsws] ERROR: Trying to send response without first accepting it\"\n end\n end", "def process # :nodoc:\n logger.info started_request_message\n\n if websocket.possible? && allow_request_origin?\n respond_to_successful_request\n else\n respond_to_invalid_request\n end\n end", "def _send_request(connection, req_bytes)\r\n\t\tconnection.print([req_bytes.size].pack('N') + req_bytes)\r\n\t\t@request_count += 1\r\n end", "def process_http_request\n route_http_request\n end", "def request(*args)\n Request.request(self, *args)\n end" ]
[ "0.78337497", "0.7794403", "0.7487524", "0.7373616", "0.7163445", "0.7137458", "0.7057114", "0.6938887", "0.6921218", "0.6884615", "0.6871176", "0.68633646", "0.6840231", "0.68096685", "0.6784899", "0.6779854", "0.677738", "0.6767688", "0.6747331", "0.6704803", "0.66950464", "0.6656597", "0.6656597", "0.66207033", "0.6594156", "0.6589256", "0.6585159", "0.6563954", "0.6550668", "0.6547636", "0.65199023", "0.6503218", "0.64776576", "0.64642584", "0.6434909", "0.6422505", "0.6412405", "0.6411859", "0.6406294", "0.6402299", "0.63989556", "0.6395581", "0.6392102", "0.63808715", "0.63800085", "0.63782746", "0.6377706", "0.63742566", "0.6367859", "0.6350431", "0.634968", "0.6323674", "0.6308714", "0.63055646", "0.6294526", "0.6291546", "0.62904465", "0.62626034", "0.62384444", "0.6232457", "0.62206763", "0.6200763", "0.6200061", "0.6190941", "0.6187354", "0.6186012", "0.6184809", "0.616629", "0.6144848", "0.6143645", "0.6133305", "0.61279833", "0.6124928", "0.6119514", "0.6116979", "0.6116129", "0.61127824", "0.6111616", "0.610485", "0.6088655", "0.6080295", "0.60779", "0.6075079", "0.6053353", "0.6048464", "0.6045106", "0.6038975", "0.6006772", "0.60011244", "0.5992147", "0.59911036", "0.59909135", "0.59840566", "0.5980375", "0.5977102", "0.5965069", "0.59627086", "0.59500504", "0.59464693", "0.59296876", "0.59224814" ]
0.0
-1
Responds to request with show_ok status and resource
def show_ok(resource:) render json: resource, status: :ok, include: show_includes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_ok\n controller.show_ok(resource: resource)\n end", "def show\n respond_with client, resource\n end", "def show\n render status: :ok\n end", "def status_ok(resource)\n respond_to do |format|\n format.json { render json: resource.to_json, status: :ok, content_type: 'application/fhir+json' }\n format.fhir_json { render json: resource.to_json, status: :ok, content_type: 'application/fhir+json' }\n end\n end", "def call\n return show_ok if resource_found?\n\n show_not_found\n end", "def show\n render :show, status: :ok\n end", "def show\n respond_with resource\n end", "def ok_request object, options=nil\n render json: object,\n root: :data,\n status: :ok,\n include: options\n end", "def respond_ok\n response.content_type = \"application/JSON\"\n render :json => {\"status\" => \"OK\"}\n end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def show\n respond_with resource\n end", "def me\n render :show, status: :ok\n end", "def show\n head(:ok)\n end", "def success_show(opts = {})\n render opts.merge( json: get_resource )\n end", "def show\n render json: {\"status\" => \"ok\"}\n end", "def show\n render :create, status: :ok\n end", "def show\n respond_with(@scan.status)\n end", "def show\n authorize! :show, resource\n yield if block_given? # after_show\n respond_with resource\n end", "def ok_response\n {\n statusCode: 200,\n headers: {'Content-Type': 'application/json'},\n body: {ok: true}.to_json\n }\nend", "def show\n block_given? ? yield : head(:ok)\n end", "def show\n msg = MSG[:show][:success]\n common_response(msg, event: @event)\n end", "def show\n respond_with do |format|\n format.html {render status_code.to_s, status: status_code}\n end\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend", "def show\n json_response(@terminal.decorate, :ok)\n end", "def respond_with_ok\n render json: \"\"\n return false\n end", "def status\n render nothing: true, status: :ok\n end", "def render_200_response\n render :text => \"OK\", :status => 200\n end", "def show\n render json: serialize(read_resource(resource), options), status: :ok\n end", "def show\n respond_with(failures)\n end", "def show\n @errore = flash[:error]\n respond_with(resource)\n end", "def api_behavior\n if post?\n display resource, :status => :created\n # render resource instead of 204 no content\n elsif put? || delete?\n display resource, :status => :ok\n else\n super\n end\n end", "def show\n @resource = Resource.new(resource_params)\n\n respond_to do |format|\n if @resource.save\n @resource.check!\n format.html { render :show }\n else\n format.html { redirect_to root_url, notice: \"Unable to check resource\" }\n end\n end\n end", "def show\n resource = find_resource(params[:id])\n\n respond_with(resource)\n rescue ApiError => e\n render e.as_response\n end", "def ok?\n @status == 200\n end", "def show\n respond_with @articles, status: get_status\n end", "def show\n render json: @item, status: :ok\n end", "def show\n @request = Request.find(params[:id])\n respond_with(@request)\n end", "def show\n @response = Response.find(params[:id])\n\n respond_with(@response)\n end", "def call_ok?(response = {})\n response['showapi_res_code'] == 1 && response['showapi_res_error'] == 'ok'\n rescue StandardError\n false\n end", "def success\n [200, { 'Content-Type' => 'text/plain'}, ['OK']]\n end", "def show\n @resource = Resource.find(params[:id]) || not_found\n\n respond_to do |format|\n format.html{}\n end\n\n end", "def api_behavior(error)\n if resourceful? && put?\n display resource, :status => :ok\n else\n super\n end\n end", "def show\n render 'show', :status => 200, :layout => false\n end", "def my_request\n request = Request.where(user_id: @current_user.id)\n if request\n render json: {\n status: 'success',\n message: 'Requests found',\n data: request,\n },\n status: :ok\n else \n render json: {\n status: 'no-content',\n message: 'Requests not found',\n },\n status: :no_content\n end\n end", "def respond_for usecase, &block\n resp = {\n object: usecase.build_object,\n errors: usecase.errors,\n message: usecase.errors? ? \"Error\" : \"Success\"\n }\n if block_given?\n pp yield(resp)\n end\n Response.new( resp )\n end", "def show\n respond_with release\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def request_successful(response)\n\t\tresponse.code == \"200\"\n\tend", "def show\n _endpoint \"view?\" do |ctx, seq:, **|\n render \"success\" + ctx[:current_user] + seq.inspect\n end\n end", "def new_response\n {:success => true}\n end", "def show\n \n render status: 200, :json => @item\n\n end", "def show\n if can? :read, @status\n render action: :show\n else\n render file: 'public/pleaseregister'\n end\n end", "def show\n render :show, status: :ok, location: @emergency\n end", "def success_response code, meta, data\n render status: code,\n json: {\n meta: meta,\n data: data\n }\n end", "def show\n status_not_acceptable && return unless accept_header?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n resource = get_patient(params.permit(:id)[:id])\n when 'observation'\n resource = get_laboratory(params.permit(:id)[:id])\n when 'questionnaireresponse'\n resource = get_assessment(params.permit(:id)[:id])\n else\n status_bad_request && return\n end\n\n status_forbidden && return if resource.nil?\n\n status_ok(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end", "def options(request, response)\n OK\n end", "def show\n @client = Client.find(params[:id])\n respond_with(@client)\n end", "def show\n @client = Client.find(params[:id])\n respond_with(@client)\n end", "def show\n authorize :resquest_type, :show?\n end", "def render_ok(obj)\n render json: nil_protection(obj), status: :ok\n end", "def show\n render status: 501, json: { errors: ['Action not implemented.'] }\n end", "def success?\n @response.code == \"200\"\n end", "def show\n respond_to do |format|\n if @user\n format.html { render :show }\n format.json { render json: @user, status: :ok }\n else\n format.html { render(file: Rails.root.join('public', '204'), :formats => [:html], status: 204, layout: false) }\n format.json { head :no_content }\n end\n end\n end", "def show\n render partial: 'status' if request.xhr? && (params[:status] == '1')\n end", "def show\n respond_with Job.find(params[:id])\n end", "def show\n respond_with @content\n end", "def respond\n DEFAULT_RESPONSE\n end", "def echo_action\n endpoint = get_end_point request.method, request.path\n if endpoint\n endpoint_response = prepare_response endpoint\n render json: endpoint_response.first, status: endpoint_response.second\n else\n render json: { errors:[\n {\n \"code\": \"not_found\",\n \"detail\": \"Requested page `#{request.path}` does not exist\"\n }\n ]\n } , status: :not_found\n end\n \n end", "def show\n respond_with(user)\n end", "def show\n @responses = Response.find(params[:id])\n respond_with @response\n end", "def ok_status\n respond_to do |format|\n format.html { redirect_to locations_path }\n format.json { render :show, status: :created, location: @location }\n end\n end", "def show\n response_hash = @company.get_company_detail\n respond_to do |format|\n format.html {}\n format.json {render json: {message: response_hash}, status: 200}\n end\n end", "def response?(params); end", "def show\n respond_with( @answer )\n end", "def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end", "def show\n respond_with(@company)\n end", "def respond\n DEFAULT_RESPONSE\n end", "def api_behavior(error)\n if post?\n display resource, status: :created\n # render resource instead of 204 no content\n elsif put?\n display resource, status: :ok\n else\n super\n end\n end", "def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def success\n {:response=>:success}\n end", "def status\n request :get, \"_status\"\n end", "def show\n respond_with(@person)\n end", "def index_ok(resources:)\n render json: resources, status: :ok, include: index_includes\n end", "def show\n respond_with(@device)\n end" ]
[ "0.75861204", "0.7107819", "0.70973635", "0.69898677", "0.69344246", "0.6845681", "0.67787755", "0.6707929", "0.6670621", "0.6666087", "0.6666087", "0.66628885", "0.66368407", "0.6619437", "0.65775377", "0.6562515", "0.653197", "0.6495018", "0.6492195", "0.64832294", "0.6446831", "0.6419638", "0.63828754", "0.6368897", "0.6368897", "0.6360434", "0.63509464", "0.6323513", "0.6296179", "0.6287667", "0.62666327", "0.6260306", "0.62277", "0.6218891", "0.6211873", "0.62098575", "0.6186453", "0.617402", "0.6157948", "0.6111069", "0.6103763", "0.6080971", "0.6080277", "0.6064253", "0.604772", "0.60370564", "0.603571", "0.6035539", "0.60174376", "0.6014601", "0.59987676", "0.5994129", "0.5990357", "0.5978308", "0.5974369", "0.59708714", "0.59700763", "0.5968667", "0.5962552", "0.59471685", "0.59471685", "0.59470093", "0.5921967", "0.5917619", "0.5916668", "0.5909205", "0.5902044", "0.58976823", "0.58855784", "0.5884634", "0.5883969", "0.58810204", "0.587958", "0.58788306", "0.58788085", "0.58783317", "0.5864031", "0.5858695", "0.58514863", "0.5849251", "0.58466744", "0.5843254", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.58347285", "0.5824392", "0.5820407", "0.58201796", "0.5811606", "0.581066" ]
0.7460887
1
Responds to request with show_not_found status
def show_not_found render_json_error(code: :show_not_found, status: :not_found) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found\n respond_with 404\n end", "def not_found\n render status: :not_found\n end", "def not_found\n render json: nil, status: :not_found\n end", "def not_found\n respond_with 404\n end", "def not_found\n render nothing: true, status: 404\n end", "def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end", "def not_found\n render :nothing => true, :status => 404\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def not_found\n status 404\n body \"not found\\n\"\n end", "def show_not_found\n controller.show_not_found\n end", "def not_found\n render :status => 404\n end", "def not_found\n render(\n json: {\n errors: [{\n type: \"Not Found\"\n }]\n },\n status: :not_found #alias for 404 in rails\n )\n end", "def rescue_not_found\n render nothing: true, status: 404\n end", "def not_found\n render(status: :not_found, json: { errors: [{\n status: '404', code: :not_found, title: 'Not Found'\n }]})\n # render jsonapi: nil, code: 404, title: 'Invalid Path', detail: params[:path], status: :not_found\n end", "def record_not_found\n render json: \"Record not found\", status: 404\n end", "def not_found\n self.status = 404\n return unless body.empty?\n self.body = \"Not found: #{request.path}\"\n headers['Content-Type'] = 'text/plain'\n headers['X-Cascade'] = 'pass'\n headers['Cache-Control'] = 'nocache'\n end", "def not_found\n response_error(code: 404, message: 'Object not found.')\n end", "def not_found\n respond_not_found\n end", "def not_found\n render_error status: :not_found, body: 'page not found'\n end", "def not_found\n render json: { error: { message: 'There was nothing found at this address.' }}, status: :not_found\n end", "def not_found\n render plain: \"not found\"\n end", "def record_not_found\n render json: {\n error: 'Record not found.'\n }, status: :not_found\n end", "def record_not_found!\n render partial: 'errors/404', status: 404 && return\n end", "def not_found\n\n r = Result::Base.error(\n {\n internal_id: 'ac_1',\n general_error_identifier: 'resource_not_found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n )\n\n return render_api_response(r)\n\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def not_found\n res = {\n error: 'ost_page_not_found',\n error_display_text: 'Page not found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n @response = Result::Base.error(res)\n render_error_response_for(@response)\n end", "def respond_resource_not_found(path)\n log(\"#{path} Not Found\")\n make_response(nil, false, 404, \"Not Found\")\n end", "def record_not_found\n render json: { error: { message: 'Record not found.' }}, status: :not_found\n end", "def return_not_found\n return_error(error_code: 404, message: 'Not Found')\n end", "def not_found\n\n render_error( :not_found )\n\n end", "def blank; render :plain => \"Not Found.\", :status => 404 end", "def record_not_found\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end", "def respond_with_not_found(exception = nil, error_code = \"not_found\")\n msg = exception ? exception.message : \"Not Found\"\n render partial: \"api/error\", locals: { message: msg, error_code: error_code }, status: 404\n return false\n end", "def object_not_found\n render json: 'Object not found', status: :not_found\n end", "def handle_not_found(exception = nil)\n render \"shared/not_found\".freeze, status: 404\n end", "def record_not_found\n render :json => {:success=>false, :error_code => 404, :error_msg=>\"Record not Found\"}\n end", "def not_found\n\t\tself.status = 404\n\t\tself.headers = {}\n\t\tself.content = [\"Nothing Found\"]\n\t\tself\n\tend", "def halt_not_found(exception)\n halt 404, json({ message: exception.reason })\n end", "def no_found(message)\n render json: {\n errors: message,\n status: :no_found\n }, status: 404\n end", "def return_404\n render :json => {:error => \"not-found\"}.to_json, :status => 404\n end", "def not_found\n render file: 'public/404.html', status: :not_found, layout: false\n end", "def record_not_found\n render json: {error: \"Record not found\"}.to_json, status: 404\n end", "def not_found(body = nil)\n error(404, body)\n end", "def not_found!\n [404, {\"Content-Type\" => \"text/plain\"}, [\"Jsus doesn't know anything about this entity\"]]\n end", "def render_not_found(error)\n json_response({ error: { message: error.message } }, :not_found)\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n rescue\n render_404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def not_found\n render :template => \"shared/rescues/not_found\", :status => 404 \n end", "def not_found(exception)\n render json: { status: \"404\", \"#{exception.message}\": \"page not found\"}\n end", "def not_found(exception)\n render json: { error: exception.message }, status: :not_found\n end", "def record_not_found\n render json: {error: I18n.t('errors.not_found')}.to_json, status: 404\n end", "def record_not_found\n render :file => File.join(::Rails.root.to_s, 'public', '404.html'), :status => 404\n end", "def render_404\n render(\n json: {\n error_messages: ['Resource does not exist'],\n error_code: 'NOT_FOUND'\n },\n status: 404\n )\n end", "def not_found\n\trender :file => 'public/404.html', :status => :not_found, :layout => false\nend", "def page_not_found\n render 'shared/http_status', formats: [:html], locals: { code: '404', message: HttpStatusHelper::ERROR_CODE['message']['404'] }, status: 404, layout: false\n end", "def render_figgy_404 # rubocop:disable Naming/VariableNumber\n respond_to do |format|\n format.html { render \"errors/not_found\", status: :not_found }\n format.json { head :not_found }\n end\n end", "def page_not_found\n render_404\n end", "def record_not_found\n \t\trender :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n \tend", "def page_not_found\n respond_to do |format|\n\t format.html { render template: 'errors/not_found_error', layout: 'layouts/application', status: 404 }\n\t format.all { render nothing: true, status: 404 }\n\t end\n end", "def show_404\n show_error 'Page Not Found', :not_found\n end", "def render_not_found(type, id, option='id')\n payload = { errors: { general: [\"Could not find #{type} with '#{option}'=#{id}\"] } }\n render json: payload, status: 404\n end", "def not_found generator, req, res, message = nil\n message ||= \"The page <kbd>#{ERB::Util.h req.path}</kbd> was not found\"\n res.body = generator.generate_servlet_not_found message\n res.status = 404\n end", "def record_not_found\n render :file => Rails.root.join('public','404.html'), :status => \"404 Not Found\", layout: false\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def not_found\n render file: \"#{Rails.root}/public/404\", layout: true, status: :not_found\n end", "def not_found\n logger.error \"404 from #{request.referer}\"\n render :template => 'errors/404', :status => 404\n end", "def render_record_not_found\n render :template => \"error/404\", :status => 404\n end", "def show\n if false\n else\n render :file => \"/public/404.html\",:status => \"404\" \n end\n end", "def not_found\n render :format => :html\n end", "def path_not_found\n render json: {\n error: 'No route matches.'\n }, status: :not_found\n end", "def return_404_error\n\n render json: { success: false, error: I18n.t('errors.e_404'),\n status_code: 404 }, status: :not_found\n end", "def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_found\n end", "def record_not_found\n render json: ErrorSerializer.serialize({ record: \"Record not found.\" }), status: :not_found\n end", "def render_not_found\n\n respond_to do |message|\n \n message.html{ render :template => \"errors/404\", :status => 404 }\n \n end\n\n end", "def not_found\n render file: 'public/404', status: 404, formats: [:html]\n end", "def not_found\n content_type(\"text/plain\")\n @headers << \"HTTP/1.1 404 Not Found\\r\\nServer: Rsws/0.1.0\\r\\n\"\n puts \"#{@method} #{@path} 404 Not Found\"\n send\n end", "def request_not_found(response)\n response.code == 404 ||\n response['status'] == 'Bad Request' ||\n response.parsed_response['Results']['state'].size == 0\n end", "def render_404\n render json: {\n message: '404 Not Found',\n details: exception.error_codes\n }, status: 404\n end", "def not_found\n \trender file: \"#{Rails.root}/public/404.html\", layout: true, status: 404\n end", "def rescue_not_found\n render \"#{Rails.root}/public/404.html\", status: 404\n end", "def rescue_not_found\n render \"#{Rails.root}/public/404.html\", status: 404\n end", "def resource_not_found\n flash.now.alert = \"notifications.document.not_found\"\n @info = { id: params[:id] }\n render \"shared/html/404\" and return\n end", "def not_found_response\n [404, {'Content-Type' => \"text/plain\", 'Content-Length' => \"9\"}, ['Not found']]\n end", "def not_found_response(env)\n if head_request?(env)\n [ 404, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\", \"x-cascade\" => \"pass\" }, [] ]\n else\n [ 404, { \"content-type\" => \"text/plain\", \"content-length\" => \"9\", \"x-cascade\" => \"pass\" }, [ \"Not found\" ] ]\n end\n end", "def record_not_found(error)\n render json: {\n success: false,\n message: error.message\n }, status: :record_not_found\n end", "def render_record_not_found\n record_name = !controller_name.blank? ? controller_name.singularize.titleize : \"Record\"\n respond_with(nil, :status => {:msg => \"#{record_name} not found\", :code => 404})\n end", "def page_not_found\n render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false\n end", "def render_404\n render template: '/shared/record_not_found', layout: false, status: :not_found\n end", "def record_not_found\n render :partial => \"shared/error\", :layout => \"one_box\", :status => 404, :locals => {:error_title => 'No hemos encontrado lo que buscabas', :error_message => 'Puedes haber tecleado mal la dirección o la página puede haber sido movida.'}\n end", "def record_not_found\r\n if %w{m mobile}.any? {|subdomain| subdomain == request.subdomain}\r\n render 'welcome/mobile/404', :layout => 'mobile', :status => 404\r\n return\r\n end\r\n render :file => File.join(Rails.root, 'public', '404.html'), :status => 404\r\n end" ]
[ "0.87444544", "0.86586356", "0.8517404", "0.8498333", "0.84431237", "0.83946866", "0.83327377", "0.83072567", "0.83072567", "0.83072567", "0.8283587", "0.81711495", "0.8161163", "0.8159651", "0.8148798", "0.8136897", "0.8128108", "0.8109985", "0.8108956", "0.8081026", "0.8076557", "0.80730253", "0.80670065", "0.8021162", "0.80211616", "0.79836047", "0.79836047", "0.79836047", "0.795587", "0.7950099", "0.7928919", "0.791469", "0.78943753", "0.78924024", "0.78865767", "0.78513175", "0.78366", "0.7824803", "0.781572", "0.78142864", "0.78136", "0.7773127", "0.77672964", "0.7765952", "0.7759194", "0.7749674", "0.7743888", "0.7742754", "0.77351934", "0.77351934", "0.77351934", "0.77295125", "0.77133936", "0.77110887", "0.7710259", "0.7710065", "0.76931137", "0.76849705", "0.76702213", "0.7655867", "0.7650896", "0.7638505", "0.7628791", "0.7616791", "0.7612409", "0.7611501", "0.76071686", "0.76003057", "0.76003057", "0.76003057", "0.76003057", "0.76003057", "0.76003057", "0.76003057", "0.75914204", "0.75896055", "0.7583494", "0.75830334", "0.75630695", "0.7547577", "0.7544413", "0.7532797", "0.7531676", "0.75305873", "0.7522339", "0.75136787", "0.7505121", "0.7470209", "0.7468177", "0.745698", "0.745698", "0.74542665", "0.7447492", "0.7446611", "0.7445079", "0.7441533", "0.74326515", "0.74320644", "0.74212533", "0.7415421" ]
0.84642595
4
def begin_of_association_chain current_user end
def index redirect_to root_path unless session_logged_in? @tours = Tour.accessible_by(current_ability, :update) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_of_association_chain\n current_account\n end", "def begin_of_association_chain\n self.action_name != 'index' ? current_user : super\n end", "def begin_of_association_chain\n # raise self.action_name.inspect\n case self.action_name\n when 'index', 'show' : super\n when 'owned_by' :\n @user=User.find(params[:user_id])\n else\n current_user\n end\n end", "def begin_of_association_chain\n nil\n end", "def begin_of_association_chain\n return nil unless active_admin_config.scope_to?(self)\n MethodOrProcHelper.render_in_context(self, active_admin_config.scope_to_method)\n end", "def method_for_association_chain\n active_admin_config.scope_to_association_method || super\n end", "def current_user\n super\n end", "def current_user\n super\n end", "def user_for_paper_trail \n current_usuario\n end", "def end_of_association_chain_before_scopes\n if chain = association_chain.last\n if method_for_association_chain\n chain.send(method_for_association_chain)\n else\n chain\n end\n else\n resource_class\n end\n end", "def current_user\n current_parent\n end", "def current_person\n current_user\n end", "def end_of_association_chain\n parent? ? parent_association : model\n end", "def associations_after_save\n # # WARNING: the associations here are not using active_record, so they are not auto saved with user intake\n # # we are saving the associations manually here\n # collapse_associations # make obsolete ones = nil\n #\n # TODO: conflicting with 1.6.0 pre-quality. removed to check compatiblity or related errors\n # for remaining, fill login, password details only when login is empty\n # This is a 3 step process\n # \n # Thu Nov 11 00:14:24 IST 2010, ramonrails\n # Link per user, once only. compact.uniq ensures that\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # Sat Nov 20 02:03:52 IST 2010, ramonrails\n # * this logic is required when uset simply toggles the flag and saves\n _user = self.send( _what) # fetch the associated user\n unless _user.blank? || _user.nothing_assigned?\n # * default properties\n _user.autofill_login # create login and password if not already\n _user.lazy_associations[:user_intake] = self\n _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n\n case _what\n when 'senior'\n # _user.save\n # _user.is_halouser_of( group) unless _user.blank? || group.blank? # role\n _user.lazy_roles[:halouser] = group unless _user.blank? || group.blank? # role\n _user.save\n \n when 'subscriber'\n if subscribed_for_self? # senior is same as subscriber\n if was_subscribed_for_self?\n # * user and subscriber are same. not changed\n else\n # * subscriber was different. now same as senior\n self.subscriber_is_user = false # create old condition\n subscriber.is_not_subscriber_of( senior) unless subscriber.blank? || senior.blank? # remove old role first\n # subscriber.delete # remove this extra user\n self.subscriber_is_user = true # back to current situation\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n\n else # senior different from subscriber\n if was_subscribed_for_self?\n _user = senior.clone_with_profile if senior.equal?( subscriber) # same IDs, clone first\n senior.is_not_subscriber_of( senior) unless senior.blank? # senior was subscriber, not now\n else\n # all good. nothing changed\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n end\n \n when 'caregiver1'\n if caregiving_subscriber? # subscriber is caregiver\n if was_caregiving_subscriber?\n # all good. nothing changed\n else\n # was separate\n self.subscriber_is_caregiver = false # make old condition\n caregiver1.is_not_caregiver_of( senior) unless caregiver1.blank? || senior.blank?\n # caregiver1.delete # remove extra\n self.subscriber_is_caregiver = true # current condition again\n end\n \n else # subscriber different from caregiver1\n if was_caregiving_subscriber?\n _user = subscriber.clone_with_profile if subscriber.equal?( caregiver1) # same ID? clone first\n subscriber.is_not_caregiver_of( senior) unless subscriber.blank? || senior.blank? # remove caregiving role for subscriber\n else\n # all good. nothing changed\n end\n end\n if caregiving_subscriber? || (caregiver1_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior))\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver1_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver1_options\n _user.save\n # else\n # self.no_caregiver_1 = true\n # self.send(:update_without_callbacks)\n end\n \n when 'caregiver2'\n if caregiver2_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver2_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver2_options\n _user.save\n else\n self.no_caregiver_2 = true\n self.send(:update_without_callbacks)\n end\n\n when 'caregiver3'\n if caregiver3_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver3_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver3_options\n _user.save\n else\n self.no_caregiver_3 = true\n self.send(:update_without_callbacks)\n end\n end # case\n end # blank?\n end # _what\n \n # \n # Thu Jan 13 02:38:38 IST 2011, ramonrails\n # * Not required anymore\n # * lazy_associations attaches each user to this user intake\n # #\n # # * replace earlier associations. keep fresh ones\n # # * do not create duplicate associations\n # # QUESTION: what happens to orphaned users here?\n # # * reject new_record? anything not saved does not get assigned\n # # * only associate one copy of each\n # self.users = [senior, subscriber, caregiver1, caregiver2, caregiver3].reject(&:new_record?).compact.uniq\n # # # \n # # # Thu Jan 13 02:34:27 IST 2011, ramonrails\n # # # * pre_quality.feature had error dispatching emails\n # # # * This might dispatch the email more than once\n # # self.users.each(&:dispatch_emails)\n\n\n # [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # # \n # # Fri Nov 19 03:17:32 IST 2010, ramonrails\n # # * skip saving the object if already saved\n # # * happens when object is shared. subscriber == user, or, subscriber == caregiver\n # # * saving also dispatches emails. A few more triggers/callbacks. Please check model code\n # _skip = ((_what == 'subscriber') && subscribed_for_self?)\n # _skip = (_skip || (_what == 'caregiver1' && caregiving_subscriber?))\n # # \n # # Thu Nov 11 00:32:18 IST 2010, ramonrails\n # # Do not save any non-assigned data, or blank ones\n # unless _user.blank? || _user.nothing_assigned? || _skip\n # _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n # \n # # _user.autofill_login # Step 1: make them valid\n # if _user.save # Step 2: save them to database\n # # \n # # Thu Nov 11 00:13:31 IST 2010, ramonrails\n # # https://redmine.corp.halomonitor.com/issues/3696\n # # caused a bug that created multiple links to the same user\n # self.users << _user unless users.include?( _user) # Step 3: link them to user intake\n # end\n # end\n # end\n # #\n # # * add roles and options\n # # * roles are already handled by user model\n # # * this will not double write the roles\n # # senior\n # senior.is_halouser_of( group) unless senior.blank?\n # # subscriber\n # unless senior.blank? || subscriber.blank?\n # subscriber.is_subscriber_of( senior)\n # subscriber.is_caregiver_of( senior) if caregiving_subscriber?\n # end\n # # Wed Oct 27 23:55:22 IST 2010\n # # * no need to check subscriber_is_caregiver here. that is done in caregiver1 method\n # # * just call for each caregiver and assign position and other options\n # (1..3).each do |index|\n # _caregiver = self.send(\"caregiver#{index}\".to_sym)\n # _required = self.send(\"caregiver#{index}_required?\")\n # unless (_caregiver.blank? || !_required || _caregiver.nothing_assigned?)\n # _caregiver.is_caregiver_of( senior) unless _caregiver.is_caregiver_of?( senior)\n # # \n # # Thu Nov 4 05:57:16 IST 2010, ramonrails\n # # user values were stored with apply_attributes_from_hash\n # # now we persist them into database\n # _options = self.send(\"mem_caregiver#{index}_options\")\n # # \n # # Thu Nov 18 20:58:29 IST 2010, ramonrails\n # # * Do not use any other method here, cyclic dependency can occur\n # _caregiver.options_for_senior( senior, _options)\n # end\n # end\n\n end", "def startup_relationship\n Relationship.between(self.user, self.startup)\n end", "def set_user; end", "def end_of_association_chain #:nodoc:\n if chain = association_chain.last\n if method_for_association_chain\n apply_scopes_if_available(chain.send(method_for_association_chain))\n else\n # This only happens when we specify begin_of_association_chain in\n # a singleton controller without parents. In this case, the chain\n # is exactly the begin_of_association_chain which is already an\n # instance and then not scopable.\n chain\n end\n else\n apply_scopes_if_available(resource_class)\n end\n end", "def current_user(user)\n @current_user = user\n end", "def forem_user\n current_user\n end", "def set_user\n @clinician = current_user\n end", "def current_user\n user.user\n end", "def current_user\n current_usuario\n end", "def add_association(current_user)\n self.associate(current_user)\n 'New Oauth provider added'\n end", "def current_user\n return @current_user if @current_user\n \n @current_user = super.decorate if super\n @current_user\n end", "def setup \n @user = current_user\n end", "def current_user\n @user\n end", "def context; { user: current_user } end", "def set_current_user\n current_user\n authorize\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def current_user\n @current_user\n end", "def acting_user\n current_user\n end", "def acting_as_user_of_record\n old_current = User.current\n User.current = User.of_record\n yield\n ensure\n User.current = old_current\n end", "def current_user\n ActiveRecord::Base.current_user_proc.call if ActiveRecord::Base.current_user_proc\n end", "def user\n self.class == User ? self : super\n end", "def current_person() # :doc:\n if current_user\n current_user.person || current_user.build_person\n end\n end", "def current_user\n current_customer\n end", "def user; end", "def user; end", "def user_id\n self.person.user.id if self.person\n end", "def user_id\n self.person.user.id if self.person\n end", "def user_id\n self.person.user.id if self.person\n end", "def current_user\n # Designer.first\n current_designer\n end", "def associations_before_validation_and_save\n collapse_associations # make obsolete ones = nil\n #\n # TODO: conflicting with 1.6.0 pre-quality. removed to check compatiblity or related errors\n # for remaining, fill login, password details only when login is empty\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each {|user| autofill_user_login( user) }\n #\n # Fri Nov 12 18:12:01 IST 2010, ramonrails\n # * these are mandatory to dispatch emails in user model\n # * a user must know the role while saving itself\n # assign roles to user objects. it will auto save the roles with user record\n # TODO: use this instead of association_after_save that is assigning roles\n self.senior.lazy_roles[:halouser] = group unless senior.blank? # senior.is_halouser_of group\n self.subscriber.lazy_roles[:subscriber] = senior unless subscriber.blank?\n self.caregiver1.lazy_roles[:caregiver] = senior unless caregiver1.blank?\n self.caregiver2.lazy_roles[:caregiver] = senior unless caregiver2.blank?\n self.caregiver3.lazy_roles[:caregiver] = senior unless caregiver3.blank?\n self.caregiver1.lazy_options[ senior ] = mem_caregiver1_options\n self.caregiver2.lazy_options[ senior ] = mem_caregiver2_options\n self.caregiver3.lazy_options[ senior ] = mem_caregiver3_options\n #\n # # now collect the users for save as associations\n # self.users = [senior, subscriber, caregiver1, caregiver2, caregiver3].uniq.compact # omit nil, duplicates\n end", "def set_current_user\n User.current = current_user\n end", "def current_user\n # authorization initialization if not run yet\n # (in the case of paper_trial it might not have run)\n authorization_init\n @logged_in_user\n end", "def user\n object.user\n end", "def parent\n User.find(self.user_id)\n end", "def current_user\n UserDecorator.decorate(super) unless super.nil?\n end", "def current_user\n UserDecorator.decorate(super) unless super.nil?\n end", "def centralized_user_related_initializer(current_user)\n initialize_one_to_one_relationship_for_root_user\n\n case get_user_holder_policy\n # if NAC, redirect_to root_path\n when 'NAC'\n flash[:notice] = 'Denial Access in Resource Level'\n redirect_to root_path\n # if SSU, overrides the UserHolder by params[:user_holder]\n when 'SSU'\n set_user_holder_for_sessional_usage(current_user)\n # if RTU, sets UserHolder to RootUserHolder\n when 'RTU'\n @user_holder = current_user.user_holder\n # when 'OPT'\n else\n # (Default-Accept) if policy is not specified, consider as OPT-OUT\n puts \"Caution, you have not specified your policy in centralized user holder system.\"\n puts \"Your user_holder will fall back to root_user if nil\"\n if @user_holder.nil? then @user_holder = current_user.user_holder end\n return\n end\n end", "def set_current_data\n if current_user.parent?\n current_user.add_current_child\n elsif current_user.teacher? || current_user.school_manager?\n current_user.add_current_classroom\n else\n ### TODO: Exception => No Parent/Teacher/SchoolManager User.\n end\n end", "def with_chain(object)\n association_chain + [ object ]\n end", "def eventcodesignup_step2\n @user = current_user\nend", "def liaison\n inverse_accounts.last.user\n end", "def current_user_scope\n current_user\n end", "def pundit_user\n \tcurrent_usuario\n end", "def setup_associations; end", "def association_chain\n @association_chain ||=\n symbols_for_association_chain.inject([begin_of_association_chain]) do |chain, symbol|\n chain << evaluate_parent(symbol, resources_configuration[symbol], chain.last)\n end.compact.freeze\n end", "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def current_user\n current_account.user\n end", "def init_user_orcid\n return unless author_orcid\n return unless (user = resource&.user)\n return if user&.orcid\n\n user.orcid = author_orcid\n user.save\n end", "def attach_user\n @transaction.user = current_user\n end", "def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything normal, and ignore right hand side\n # if super == false, call right hand side\n\n # super comes from devise class\n # meanwhile the r.h.s comes from open struct class\n super || guest_user\n end", "def current_user\n @_decorated_current_user ||= super&.decorate\n end", "def customer\n self.user\n end", "def set_self_as_user\n @user = self.current_user\n end", "def set_user\r\n @user = current_user\r\n end", "def user\n end", "def current_user\n nil\n end", "def end_of_association_chain\n return scope_association if scoped?\n parent? ? parent_association : model\n end", "def associate_user\n if current_order.user.anonymous? and current_user\n current_order.associate_user!(current_user)\n end\n end", "def end_of_association_chain\n chain = super\n if sort_method = chain_sort_method(chain)\n chain = chain.send(sort_method, sort) \n end\n chain.page(params[:page]).per(self.class.paginate ? self.class.paginate : 999999)\n end", "def authenticate_user!(options={})\n super(options)\n @organisation ||= current_user.organisation\n Organisation.current_id = @organisation.present? ? @organisation.subtree.map(&:id) : nil\n end", "def set_current_user\n @user = current_user\n end", "def set_current_user\n @user = current_user\n end", "def owner\n user\n end", "def owner\n user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def set_user\n @user = current_user\n end", "def audit_user\n user\n # TODO Renable/refactor for Questioner 2.0\n # applicable_audit ? applicable_audit.reify(has_many: true) : user\n end", "def authorized_by(user)\n user.id == self.id\n end", "def defer_user\n\t\tif(current_user)\n\t\t\tredirect_to(user_path(current_user))\n\t\tend\n\tend", "def current_user\n current_user ||= Parent.find_by(id: session[:id])\n\n end", "def symbols_for_association_chain\n super.reverse\n end", "def scrooge_seen_association!( association )\n if @owner.scrooged? && !@loaded\n @owner.class.scrooge_callsite(callsite_signature).association!(association, @owner.id)\n end\n end", "def user\n owner\n end", "def current_user\n @current_user = current_mentor || current_student\n end", "def current_user\n @authenticated_user\n end", "def current_user\n @authenticated_user\n end", "def associated\n end", "def current_user\n ActiveRecord::Base.current_user_proc.call if ActiveRecord::Base.current_user_proc\n end", "def scoped_collection\n end_of_association_chain.includes([:customer])\n end" ]
[ "0.8182152", "0.7887554", "0.7854218", "0.73525923", "0.6838905", "0.6319382", "0.62200934", "0.62200934", "0.6209075", "0.61923635", "0.6145919", "0.6026599", "0.60245365", "0.60021377", "0.59820646", "0.597158", "0.5949079", "0.58941394", "0.58800745", "0.5863176", "0.584455", "0.58395076", "0.58386475", "0.58290577", "0.58238274", "0.5807561", "0.57898414", "0.57839906", "0.5769912", "0.5769912", "0.5769912", "0.5769912", "0.57561505", "0.5742862", "0.5717363", "0.5702319", "0.5695485", "0.56938183", "0.56871516", "0.56871516", "0.5681851", "0.5681851", "0.5681851", "0.56797534", "0.56579137", "0.5650735", "0.5644423", "0.564376", "0.56436265", "0.5639623", "0.5639623", "0.5637595", "0.56349385", "0.562888", "0.5625252", "0.5624732", "0.5615289", "0.56132936", "0.5610969", "0.56062424", "0.5605268", "0.5597755", "0.5597313", "0.5596606", "0.55949473", "0.55902886", "0.5563534", "0.55594736", "0.55545884", "0.5541993", "0.5530784", "0.5530686", "0.55294037", "0.5528787", "0.55251503", "0.55236316", "0.55236316", "0.55200726", "0.55200726", "0.5519546", "0.5519546", "0.5519546", "0.5519546", "0.5519546", "0.5519546", "0.5519546", "0.5519546", "0.5519546", "0.55157095", "0.55144393", "0.5513184", "0.55130726", "0.55054945", "0.54991937", "0.5496046", "0.5495781", "0.54887104", "0.54887104", "0.54871833", "0.54796636", "0.5475312" ]
0.0
-1
TODO: Add pagination for large data TODO: What happens with failed dealers? INFO: For current requirement only the first address is required
def load_dealers fetch_dealers.each do |row| data = parse_dealer_data(row) dealer = Dealer.where(name: data['name']).first_or_initialize dealer.attributes = data log("dealer import failed: #{dealer.errors.full_messages.join(', ')}") unless dealer.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_address_details\n @address_summary = AddressSummary.new\n # Carry forward the default country otherwise it gets lost\n @address_detail = Address.find(find_params[:search_results], params[:address][:default_country])\n if @address_detail.nil?\n @address_summary.errors.add(:postcode, :no_address_find_results)\n else\n @address_summary.postcode = @address_detail.postcode\n @show_manual_address = true\n end\n @address_read_only = true\n [@address_detail, @address_summary, @address_read_only, @show_manual_address]\n end", "def pick_address_from_list\n params.each_key do |key|\n next unless key.start_with? 'pick_address'\n\n index = key.to_s.delete_prefix('pick_address_').to_i\n\n @show_manual_address = true\n @address_read_only = true\n @address_summary = AddressSummary.new\n @address_detail = @address_list[index]\n break\n end\n end", "def do_address_identifier_search\n @address_summary = AddressSummary.new(search_params)\n @search_results = @address_summary.search\n @show_manual_address = false\n # We need to carry the default country set up forward as the address currently\n @address_detail = Address.new(default_country: params[:address][:default_country])\n end", "def populate_address_data\n @address_summary = AddressSummary.new(search_params)\n @address_detail = Address.new(address_params)\n end", "def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end", "def address_results \n @address_results\n end", "def check_addresses\n\n if location = @found_params.entities.detect {|entity| entity.name == \"from\"} || @ride.start_address\n if @ride.start_address\n address = @ride.start_address\n else\n address = geocode(location.value)\n end\n\n @ride.start_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @start_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n @time = UberService.new(@ride).time_estimates\n @time = @time / 60 if @time.class == Fixnum\n\n end\n\n if location = @found_params.entities.detect {|entity| entity.name == \"to\"} || @ride.end_address\n if @ride.end_address\n address = @ride.end_address\n else\n address = geocode(location.value)\n end\n\n @ride.end_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @end_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n end\n\n if (location = @found_params.entities.detect {|entity| entity.name == \"address\"}) && (@ride.end_address || @ride.start_address)\n\n address = geocode(location.value)\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n nice_address = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n if @ride.start_address\n @ride.end_address = address\n @end_address_nice = nice_address\n else\n @ride.end_address = address\n @start_address_nice = nice_address\n end\n\n @ride.save\n end\n\n if [email protected]_address.nil? && [email protected]_address.nil?\n @price = UberService.new(@ride).price_estimates\n end\n end", "def search\n return nil unless valid?(:search)\n\n success, addresses = call_address_service\n errors.add(:postcode, :no_address_search_results) unless success && !addresses.empty?\n addresses if success && !addresses.empty?\n end", "def auto_complete_for_payer_pay_address_one\n @payers = get_matching_payers(params[:payer_name], params[:payer_address_one])\n end", "def main_address\n addresses.first\n end", "def look_up_addresses\n if postcode.present?\n address_finder = AddressFinderService.new(postcode)\n self.temp_addresses = address_finder.search_by_postcode\n else\n self.temp_addresses = []\n end\n end", "def no_of_address data\n no_of_addresses = 1\n data.headers.each do |item|\n if item != 'city'\n no_of_addresses+=1\n end\n end\n no_of_addresses\n end", "def index\n @address = Address.new\n if !params[:address].nil?\n unless params[:address][:country_id].nil?\n @address.country_id = params[:address][:country_id]\n country_name = Geographies::Country.find(@address.country_id).name\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['country = ?', country_name], \n :order => 'country, state, city, section, name'\n end\n unless params[:address][:admin_area_id].nil?\n @address.admin_area_id = params[:address][:admin_area_id]\n state_name = Geographies::AdminArea.find(@address.admin_area_id).name\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['state = ?', state_name], \n :order => 'state, city, section, name'\n end\n elsif !params[:locality].nil?\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['city like ?', \"%#{params[:locality]}%\"], \n :order => 'city, section, name'\n elsif !params[:bluebook_member].nil?\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :conditions => ['name like ?', \"%#{params[:bluebook_member][:name]}%\"], \n :order => 'section, country, state, city, name' \n else\n @bluebook_members = BluebookMember.paginate :per_page => 20, \n :page => params[:page],\n :order => 'section, country, state, city, name'\n end\n respond_to do |format|\n format.html # index.rhtml\n end\n end", "def create\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @address = Address.create(params[:address])\n end", "def index\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end", "def popular_address\n adresses = Hash.new(0)\n @posts.each {|x| adresses[\"#{x.city} #{x.street} #{x.house} #{x.apartment}\"] += 1 }\n adresses.max_by {|key,val| val}.first\n end", "def index\n @deals = Deal.all\n # OLD CODE--- this will give me the first 3 deals in the db\n # @limit_deals = Deal.find(:all, :order => \"id desc\", :limit =>3)\n # @ret_array = []\n # @deals.each do |deal|\n # @ret_array << deal.attributes\n # end\n # @some_deals = @ret_array.to_json.html_safe\n\n # THE CODE BELOW IS FROM BEFORE THE ADDRESS WAS REMOVED FROM THE USER AND PLACED ON THE DEAL\n # @deals = Deal.includes(:user).find(:all, :order => \"id desc\", :limit => 3)\n # @ret_arr = []\n # @deals.each do |deal|\n # if deal.user\n # @ret_arr << deal.attributes.merge(deal.user.attributes.slice(\"latitude\",\"longitude\"))\n # else\n # @ret_arr << deal.attributes\n # end\n # end\n # @some_deals = @ret_arr.to_json.html_safe\n # # @deals = Deal.all\n end", "def addresses\n query(:address)\n end", "def addresses\n h2 :addresses\n @record.addresses.empty? ? p('-') : addresses_table\n gap\n end", "def validate_address(street,sid,house_nr) \n\n url = 'http://ags2.lojic.org/ArcGIS/rest/services/External/Address/MapServer/exts/AddressRestSoe/ValidateAddress?' +\n \"token=XByufiRcTeZJOARKuu3jJV2mNkBRSCD--D1YqeBZDCuEij4BnbkuzNL3QcE-l3mwAnR7Rs9CoaKo-Xp8j4Tsuw..\" +\n '&Houseno='+ house_nr.to_s + \n '&SifID='+sid.to_s + \n '&Apt='+\n '&f=json'+\n 'callback=dojo.io.script.jsonp_dojoIoScript52._jsonpCallback'\n\n html = cache \"house\" + sid + \"_house\" + house_nr ,url\n\n json = JSON.parse(html)\n\n if json \n if json.include?('Candidates')\n json['Candidates'].each{ |house|\n\n # creat the source point in meters\n srcPoint = Proj4::Point.new( house[\"X\" ] * 0.3048006 , house[\"Y\" ] * 0.3048006 , )\n\n # transform it \n point = @srcPrj.transform(@destPrj, srcPoint)\n\n # covert to degrees\n lat = point.x * Proj4::RAD_TO_DEG\n lon= point.y * Proj4::RAD_TO_DEG\n\n p = Node.new(lon,lat)\n p.kv 'addr:housenumber', house[\"Houseno\"].to_s\n#<tag k=\"addr:housenumber\" v=\"{\"Houseno\"=>4305, \"Hafhouse\"=>\"\", \"Apt\"=>\"\", \"Roadname\"=>\"W MUHAMMAD ALI BLVD\", \"FullAddress\"=>\"4305 W MUHAMMAD ALI BLVD\", \"ZIPCode\"=>\"40212\", \"Sitecad\"=>1110234909, \"X\"=>1188974.2500012815, \"Y\"=>280104.8749201}\"/>\n# p.kv 'addr:full', house[\"FullAddress\"]\n p.kv 'addr:suite', house[\"Apt\"]\n p.kv 'addr:Hafhouse', house[\"Hafhouse\"]\n p.kv 'addr:street', street\n p.kv 'addr:postcode', house[\"ZIPCode\"]\n p.kv 'building', \"yes\"\n\n @properties.push(p)\n }\n end \n end\n\n end", "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def parse_response\n @fields['address_components'].each do |field|\n parse_field(field)\n end\n define_address\n end", "def address_list_fetch(field_name)\n if values = fetch_all(field_name, nil)\n list = nil\n values.each { |value|\n if list\n list.concat(Address.parse(value))\n else\n list = Address.parse(value)\n end\n }\n if list and !list.empty?\n list\n end\n end or RMail::Address::List.new\n end", "def add_city_st_zip(options={})\n options = {\n }.merge(options)\n \n @final_data.each_index do |i|\n record = @final_data[i]\n \n # Use Indirizzo to parse address for me\n unless record[:city_state_zip].nil?\n address = Indirizzo::Address.new(record[:city_state_zip])\n @final_data[i][:city] = address.city[0].capitalize # for some reason returns as array\n @final_data[i][:state] = address.state\n @final_data[i][:zip] = address.zip\n end\n \n end\n \n \nend", "def household_with_same_address_search_results\n\t\t@new_household_address = Address.find(params[:new_household_address_id].to_i)\n\t\t@household = Household.find(params[:current_household_id].to_i)\n\t\t@address_search_results = Address.search_any_household_in_this_address(params[:new_household_address_id].to_i)\n\t\t# Rails.logger.debug(\"@address_search_results = #{@address_search_results.inspect}\")\n\trescue => err\n\t\terror_object = CommonUtil.write_to_attop_error_log_table(\"HouseholdAddressChangesController\",\"household_with_same_address_search_results\",err,current_user.uid)\n\t\tflash[:alert] = \"Error occurred when showing households residing in same address, for more details refer to error ID: #{error_object.id}.\"\n\t\tredirect_to_back\n\tend", "def test_address_auth \n c = customers(:bob)\n assert_equal(addresses(:address1), c.find_address(1))\n assert_equal(addresses(:address2), c.find_address(2))\n assert_nil(c.find_address(3))\n assert_nil(c.find_address(100000))\n end", "def get_deep_search_results(address,citystatezip)\n url_s=@@zillow_webservice_url+'GetDeepSearchResults.htm?zws-id='+@zwsid+'&address='+address.to_s+'&citystatezip='+citystatezip.to_s\n fetch_result(url_s)\n end", "def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end", "def getToolsParseAddress( address, postcode, country, normalise)\n params = Hash.new\n params['address'] = address\n params['postcode'] = postcode\n params['country'] = country\n params['normalise'] = normalise\n return doCurl(\"get\",\"/tools/parse/address\",params)\n end", "def address\n unless addresses.empty?\n addresses.first\n else\n nil\n end\n end", "def search_by_emailaddress entity_name,headers\n\n begin\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=1\",nil,headers)\n json = JSON.parse(response)\n puts json\n\n #check if entries different to null\n if json[\"entries\"]\n\n\n json[\"entries\"].each do |e|\n\n #check if email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if IP address different to null and create entity\n if e[\"ip_address\"]\n _create_entity(\"IpAddress\", {\"name\" => e[\"ip_address\"]})\n\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n #create an issue about the investigited email\n _create_issue({\n name: \"leak found related to: #{_get_entity_name}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n end\n while json[\"entries\"] do\n page_num += 1\n\n response = http_get_body(\"https://dehashed.com/search?query=#{entity_name}&page=#{page_num}\",nil, headers)\n json = JSON.parse(response)\n\n #check if entries different to null\n if json[\"entries\"]\n\n json[\"entries\"].each do |e|\n #check if Email different to null and create entity\n if e[\"email\"]\n _create_entity(\"EmailAddress\", {\"name\" => e[\"email\"]})\n end\n #check if username different to null and create entity\n if e[\"username\"]\n _create_entity(\"Person\", {\"name\" => e[\"username\"]})\n end\n #check if name different to null and create entity\n if e[\"name\"]\n _create_entity(\"Person\", {\"name\" => e[\"name\"]})\n end\n #check if phone number different to null and create entity\n if e[\"phone\"]\n _create_entity(\"PhoneNumber\", {\"name\" => e[\"phone\"]})\n end\n #check if address different to null and create entity\n #if e[\"address\"]\n # _create_entity(\"PhysicalLocation\", {\"name\" => e[\"address\"]})\n #end\n\n _create_issue({\n name: \"leak found related to: #{_get_entity_name} Source: #{e[\"obtained_from\"]}\",\n type: \"Data leak\",\n severity: 2,\n status: \"confirmed\",\n description:\"Email:#{e[\"email\"]}\\n username: #{e[\"username\"]}\\n password: *******#{e[\"password\"][-4...-1]}\\n\n # Hashed Password:#{e[\"hashed_password\"]}\\n IP Address: #{e[\"ip_address\"]}\\n phone:#{e[\"phone\"]} Source #{e[\"obtained_from\"]}\",\n details: e\n })\n end\n\n end\n return\n end\n end\n #exciption\n rescue JSON::ParserError => e\n _log_error \"Unable to parse JSON: #{e}\"\n end\n\n end", "def index\n @addresses = Address.paginate :page => params[:page], :order => 'street ASC'\n #@addresses = Address.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def addresses\n @client.request('getaddressesbyaccount', name)\n end", "def addresses; end", "def clean_data(options={})\n \n @final_data.each_index do |i|\n record = @final_data[i]\n if record[:name].nil? # remove no-name records\n @final_data.delete_at(i)\n next\n end\n if record[:address].nil? # remove no-address records, can't display!\n @last_log << \"WARNING: Address Missing for #{record[:name]}!\\n\"\n @final_data.delete_at(i)\n next\n end\n if record[:elder].nil?\n @last_log << \"WARNING: Elder Missing for #{record[:name]}!\\n\"\n end\n if !record[:extra].nil? # if extra data, then assume it is city/state/zip,\n # merge :address and existing :city_state_zip,\n # put :extra data into :city_state_zip\n \n # fix data\n @final_data[i][:address] = \"#{record[:address]}, #{record[:city_state_zip]}\"\n @final_data[i][:city_state_zip] = \"#{record[:extra]}\"\n @final_data[i][:extra] = nil\n \n end\n if record[:address] =~ /Apt/ and record[:address] !=~ /,/\n # insert comma for Apt to make it easier on google\n @final_data[i][:address] = \"#{record[:address].gsub(/ Apt/, \", Apt\")}\"\n# @last_log << \"NOTE: Funny address found for #{record[:name]}!\\n\"\n# @last_log << \" Address: #{record[:address]}!\\n\"\n end\n if [email protected]?(record[:elder]) # if No elder found, then report\n @last_log << \"WARNING: No Elder found for #{record[:name]}!\\n\"\n if record[:address] !=~ /\\w*\\s\\w*/ and record[:extra].nil?\n # if this is the case, very likely this is the address\n # shift data by 1 record\n @final_data[i][:city_state_zip] = record[:address]\n @final_data[i][:address] = record[:elder]\n @final_data[i][:elder] = \"No Elder\"\n end\n end\n \n # finally filter for problematic addresses that don't seem to picked up by Google Maps Geocoding properly!\n if record[:address] =~ /FM 2222/\n @final_data[i][:address] = \"#{record[:address].gsub(/FM 2222/, \"RM 2222\")}\"\n end\n if record[:address] =~ /Mo Pac/\n @final_data[i][:address] = \"#{record[:address].gsub(/Mo Pac/, \"MoPac\")}\"\n end\n \n end\nend", "def fill_in_with_multiple_addresses!\n expect(page).to have_content(CHOOSE_EXISTING)\n page.first('#button-new-address').trigger('click')\n fill_in_checkout_address!\n page.first('.addresses__address-use a').trigger('click')\n end", "def build_params_for_address()\n\n end", "def secondary_address\n addresses.select{ |a| a.address_rank_code == 2 }.first\n end", "def getvalues\r\n # Track via mixpanel\r\n MiscFunctions.mixPanelTrack(params[:street], params[:citystatezip], params[:product])\r\n\r\n # Determine if this is a bulk run or single property\r\n if (params[:street].nil? || params[:citystatezip].nil?) && params[:placeid].nil?\r\n @addresses = Address.all\r\n runID = \"Run: #{addresses.size}: #{Date.today.to_s}\"\r\n\r\n # Loop over records and compute PDQ score\r\n @addresses.each { |prop| PdqEngine.computeDecision(prop, params, runID) }\r\n \r\n else # if single property, create new address record or use place id if passed\r\n runID = \"#{params[:path].to_s.capitalize}: #{Date.today.to_s}\"\r\n\r\n # If we are provided a placeid (not active)\r\n if !params[:placeid].nil?\r\n geo_data = GeoFunctions.getGoogleGeoByPlaceId(params[:placeid])\r\n search_add = PdqEngine.computeDecision(geo_data, params, runID)\r\n\r\n else\r\n # These functions take \"unclean\" address from Billboard URL and clean it\r\n street = MiscFunctions.addressStringClean(params[:street])\r\n citystatezip = MiscFunctions.addressStringClean(params[:citystatezip])\r\n\r\n # Create an \"unclean\" (archive) lookup address\r\n hist_lookup_add = Address.new\r\n hist_lookup_add.street = street\r\n hist_lookup_add.citystatezip = citystatezip\r\n\r\n # Get Google place id\r\n geo_data = GeoFunctions.getGoogleGeoByAddress(street, citystatezip)\r\n search_add = PdqEngine.computeDecision(geo_data, params, runID, alt_lookup = hist_lookup_add)\r\n end\r\n @addresses = [search_add]\r\n end\r\n\r\n # update parameters to match clean-address format\r\n # params[:street] = a.street\r\n # params[:citystatezip] = a.citystatezip\r\n\r\n # Aggregate all output and render\r\n @allOutput = Output.all\r\n return render 'getvalues' if params[:path].nil?\r\n\r\n # Search here\r\n\r\n # If request coming from billboard\r\n # @calcedurl = URI.escape(\"/inspect/#{params[:street]}/#{params[:citystatezip]}\")\r\n @calcedurl = URI.escape(\"/inspect/#{search_add.street}/#{search_add.citystatezip}\")\r\n puts @calcedurl\r\n return render 'blank'\r\n end", "def get_street_address(results)\n results = results.last\n result = results.first\n if result\n return result[:street_address]\n else\n return nil\n end\n end", "def index\n @addresses = current_customer.addresses.order(is_primary_address: :desc, updated_at: :desc)\n end", "def primary_address\n primary_contacts(addresses, :address_rank_code, &:first)\n end", "def hash_for_search\n return addresses.each.inject([]) do |memo, a|\n memo.push({\n search_customer: \"#{last_name} #{first_name} #{primary_phone} #{a.format_for_search}\",\n label: \"#{last_name}, #{first_name} #{number_to_phone(primary_phone)} #{a.label}\",\n customer_id: id,\n address_id: a.id\n })\n end\n end", "def add_address(addresses, address)\n address[:postcode] = postcode\n addresses.push(AddressSummary.new_from_search(address))\n end", "def address\n @countries=Country.all\n @roles=Role.all\n if params[:body][:country_id].empty? && params[:body][:state_id].empty? && params[:body][:city_id].empty?\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>nil}}\n elsif params[:body][:country_id].present? && params[:body][:state_id].empty? && params[:body][:city_id].empty?\n @states=Country.find_by_id(params[:body][:country_id]).states\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>@states}}\n elsif params[:body][:country_id].present? && params[:body][:state_id].present? && params[:body][:city_id].empty?\n @states=Country.find_by_id(params[:body][:country_id]).states\n @cities=State.find_by_id(params[:body][:state_id]).cities\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>@states, :cities=>@cities}}\n elsif params[:body][:country_id].present? && params[:body][:state_id].present? && params[:body][:city_id].present?\n @states=Country.find_by_id(params[:body][:country_id]).states\n @cities=State.find_by_id(params[:body][:state_id]).cities\n @locations=City.find_by_id(params[:body][:state_id]).locations\n render :json=>{:header=>{:status=>200},:body=>{:countries=>@countries, :roles=>@roles, :states=>@states, :cities=>@cities, :locations=>@locations}}\n end\n end", "def get_next_page(collection, page_size = nil)\n get_next_page_helper(collection, collection.addresses, 'addresses', MODEL_CLASS, page_size)\n end", "def address_search\n coords = []\n places_near = []\n if params[:address].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:address]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n elsif params[:lat].present? && params[:lon].present?\n\t\t begin\n\t\t\t locations = Geocoder.search(\"#{params[:lat]}, #{params[:lon]}\")\n if locations.present?\n locations.each do |l|\n x = Hash.new\n x[:coordinates] = l.coordinates\n x[:address] = l.address\n coords << x\n end\n end\n\t\t rescue\n\t\t\t coords = []\n\t\t end\n end\n \n if params[:near_venue_id].present? && coords.present?\n x = Place.get_places_near(coords[0][:coordinates][0], coords[0][:coordinates][1], params[:near_venue_id])\n if x.present?\n x.each do |place|\n marker = Hash.new\n marker['id'] = place.id\n marker['lat'] = place.lat\n marker['lon'] = place.lon\n marker['popup'] = create_popup_text(place)\n marker['list'] = create_list_text(place)\n places_near << marker\n end\n end\n end\n\n respond_to do |format|\n format.json { render json: {matches: coords, places_near: places_near}.to_json }\n end\n end", "def populate_address_list_from_params\n @address_list = []\n params.each do |key, value|\n next unless key.start_with? 'address_list_'\n\n address = Address.new.from_json(value)\n @address_list << address\n end\n end", "def pullingListingAddress(buildingURL, listing)\n buildingDocContact = Nokogiri::HTML(open(URI.parse(buildingURL + \"/contact\")))\n buildingDocDetails = Nokogiri::HTML(open(URI.parse(buildingURL + \"/features\")))\n buildingDocImages = Nokogiri::HTML(open(URI.parse(buildingURL + \"/media\")))\n #REMEMBER TO ADD BROOKLYN INTO THIS!!!!!\n contactText = buildingDocContact.css(\"#community-contact-text\")\n #contactText.css(\"p\")[1].text\n #puts buildingDocImages.css(\".slides\").css(\"img\").length\n #puts buildingDocImages.css(\".slides\").css(\"img\")\n listing[:images] = []\n countInt = 0 #used for image count\n while (countInt < (buildingDocImages.css(\".slides\").css(\"img\").length)/2) do #too many photos so i cut in half\n listing[:images] << { origin_url: buildingDocImages.css(\".slides\").css(\"img\")[countInt][\"src\"] }\n countInt = countInt + 1\n end\n #retrieve_images(buildingDocImages, listing)\n #puts contactText.css(\"p\")[2].text\n #puts buildingDocContact.css(\".phone-number\")\n if listing[:description] = buildingDocDetails.css(\".row.feature\").css(\"p\").css(\"span\")[0] != nil\n listing[:description] = buildingDocDetails.css(\".row.feature\").css(\"p\").css(\"span\")[0].text\n end\n listing[:amenities] = []\n #listing[:amenities] <<\n #puts (buildingDocDetails.css(\".row.feature\").css(\"#li_cont2\")).length\n listing[:contact_name] = \"Bozzuto Management\"\n\n if contactText.css(\"p\")[1].text.include?(\"New York\")\n matchText = (/New York, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = matchText.to_s\n listing[:title] = (matchText.pre_match).to_s #Street Address, but the matching part is like \"New York, \"\n listing[:city_name] = ((/, /).match(matchTextString).pre_match).to_s\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n if contactText.css(\"p\")[1].text.include?(\"Hoboken\")\n #((/Hoboken, /) === (contactText.css(\"p\")[1].text))\n matchText = (/Hoboken, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = (matchText.pre_match).to_s\n listing[:title] = matchText.pre_match\n listing[:raw_neighborhood] = \"Hoboken\"\n listing[:city_name] = \"Jersey City\"\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n if contactText.css(\"p\")[1].text.include?(\"Brooklyn\")\n matchText = (/Brooklyn, /).match(contactText.css(\"p\")[1].text)\n #Save one match text as string to enable string manipulations\n matchTextString = (matchText.pre_match).to_s\n listing[:title] = matchText.pre_match\n listing[:city_name] = \"Brooklyn\"\n listing[:state_name] = (((/ /).match((matchText.post_match).to_s)).pre_match).to_s\n listing[:zipcode] = (((/ /).match((matchText.post_match).to_s)).post_match).to_s\n end\n listing\n end", "def address_params\n end", "def index\n @address_details = AddressDetail.all\n @customers = Customer.all\n end", "def fake_address\n {\n first_name: 'Jack',\n last_name: 'Macdowall',\n company_name: 'Macdowalls',\n line_1: '1225 Invention Avenue',\n line_2: 'Birmingham',\n postcode: 'B21 9AF',\n county: 'West Midlands',\n country: 'UK'\n }\n end", "def index\n if params[:keywords].present?\n search = Address.search do\n fulltext params[:keywords]\n\n if params[:option] == \"Assigned\"\n without(:user_id, AddressesHelper.find_nobody_id)\n elsif params[:option] == \"Free\"\n with(:user_id, AddressesHelper.find_nobody_id)\n end\n\n paginate page: params[:page] || 1,\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE\n end \n # Type Sunspot::Search::PaginatedCollection < Array\n @addresses = search.results\n elsif params[:option].present? && (params[:option] != \"All\")\n nobody_id = AddressesHelper.find_nobody_id\n if params[:option] == \"Assigned\"\n @addresses = Address.where.not(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n elsif params[:option] == \"Free\"\n @addresses = Address.where(user_id: AddressesHelper.find_nobody_id)\n .paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n else\n # paginate returns object of \n # type User::ActiveRecord_Relation < ActiveRecord::Relation\n @addresses = Address.paginate(page: params[:page],\n per_page: IPAMSConstants::RECORD_COUNT_PER_PAGE)\n end\n\n authorize @addresses\n #policy_scope(@addresses)\n end", "def getaddressesbyaccount(account)\n request :getaddressesbyaccount, account\n end", "def index\n @streets = Street.order(name: \"ASC\").paginate(:page => params[:page], :per_page => 30)\n #.limit(10)\n end", "def search\r\n @addresses = Address.find_by_address(params[:address])\r\n end", "def index\n @address_records = AddressRecord.all\n end", "def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end", "def index\n @ag_addresses = Ag::Address.all\n end", "def create_additional_addresses(amount)\n amount.times do\n profile = UserProfile.all.sample\n Address.create fake_address(profile_id: profile.id)\n end\nend", "def data_search_results(data)\n results = data.search('p.row')\n results.each do |listing|\n create_apartment(listing)\n end\nend", "def test_get_geocode_response_body_elements\n valid_geocode_request = @base_url+\"?\"+@geocode_full_address+\"&\"+@api_key\n server_response = http_request(:get, valid_geocode_request)\n pattern = {\n results: [\n {\n address_components: [\n {\n long_name: \"88\",\n short_name: \"88\",\n types: [\n \"street_number\"\n ]\n },\n {\n long_name: \"Colin P Kelly Junior Street\",\n short_name: \"Colin P Kelly Jr St\",\n types: [\n \"route\"\n ]\n },\n {\n long_name: \"South of Market\",\n short_name: \"South of Market\",\n types: [\n \"neighborhood\",\n \"political\"\n ]\n },\n {\n long_name: \"San Francisco\",\n short_name: \"SF\",\n types: [\n \"locality\",\n \"political\"\n ]\n },\n {\n long_name: \"San Francisco County\",\n short_name: \"San Francisco County\",\n types: [\n \"administrative_area_level_2\",\n \"political\"\n ]\n },\n {\n long_name: \"California\",\n short_name: \"CA\",\n types: [\n \"administrative_area_level_1\",\n \"political\"\n ]\n },\n {\n long_name: \"United States\",\n short_name: \"US\",\n types: [\n \"country\",\n \"political\"\n ]\n },\n {\n long_name: \"94107\",\n short_name: \"94107\",\n types: [\n \"postal_code\"\n ]\n }\n ],\n formatted_address: \"88 Colin P Kelly Jr St, San Francisco, CA 94107, USA\",\n geometry: {\n location: {\n lat: 37.78226710000001,\n lng: -122.3912479\n },\n location_type: \"ROOFTOP\",\n viewport: {\n northeast: {\n lat: 37.78361608029151,\n lng: -122.3898989197085\n },\n southwest: {\n lat: 37.78091811970851,\n lng: -122.3925968802915\n }\n }\n },\n place_id: \"ChIJU-lq_neAhYAR9LiPJPEp-Bw\",\n types: [\n \"street_address\"\n ]\n }\n ],\n status: \"OK\"\n }\n\n # Assert the expected JSON pattern elements matches the server response elements\n assert_json_match pattern, server_response.body\n end", "def index\n @addresses = Address.order(:number).all\n end", "def get_address(street_number:, street:, city:, state:, zip:)\n response = RestClient.get \"https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=#{street_number}+#{street}%2C+#{city}%2C+#{state}+#{zip}&benchmark=9&format=json\"\n json = JSON.parse(response.body)\n end", "def index\n @sales_addresses = Sales::Address.all\n end", "def expect_frontend_addresses(user)\n expect_list_addresses(user.reload.addresses)\n\n l = Spree::AddressBookList.new(user)\n if l.user_bill\n within(%Q{tr.address[data-address=\"#{l.user_bill.id}\"]}) do\n expect(page).to have_content(Spree.t(:default_billing_address))\n end\n end\n\n if l.user_ship\n within(%Q{tr.address[data-address=\"#{l.user_ship.id}\"]}) do\n expect(page).to have_content(Spree.t(:default_shipping_address))\n end\n end\n end", "def fetch_billing_results\n previous_response = nil\n begin\n page = get_page_number\n\n response = Select.fetch_billing_results(@start_timestamp, @end_timestamp,\n page, @page_size)\n unless !response.is_a?(Array)\n process_response(response)\n previous_response = response\n end\n end until !response.is_a?(Array)\n reset_page_number\n\n set_empty_last_fetch_soap_id(response, previous_response)\n end", "def index\n @title = \"Step 3.1: Gather Addresses\"\n @col_layout = \"two_col\"\n items_per_page = 25\n \n @pages, @mpd_contacts = paginate :mpd_contacts, :include => \"mpd_priorities\", :order => process_sort(params[:sort]), :conditions => process_conditions('letter_sent = false'), :joins => :mpd_contact_actions, :per_page => items_per_page \n\n if request.xml_http_request?\n render :partial => \"shared/mpd_contact_to_complete\", :locals => {:event => 'letter_sent'}, :layout => false\n end\n end", "def where_trent\n\n addresses = [\n '7 Kelly Street, Ultimo, NSW, Australia',\n '120 Spencer Street, Melbourne, VIC, Australia',\n '77 Castle Street, Castle Hill, NSW, 2154, Australia',\n '7114 Kundiman Street Sampaloc 1008 Manila Philippines'\n ]\n address = addresses.sample(1)\n\n return address\n\nend", "def address_search\n default_page_statuses\n\n populate_address_list_from_params\n\n # Pick the action based on the parameters\n # Search here is an initial search based on postcode\n return do_address_identifier_search if params[:search]\n # User has selected to do enter a manual address, or edit a searched address\n return set_for_manual_address if params[:manual_address]\n # User has selected to change the postcode from a previous search\n return set_for_postcode_search if params[:change_postcode]\n # user has selected address from the drop down list, get the full details for them\n return find_address_details if params[:search_results].present?\n\n # User (may) have clicked on the list of previously used addresses\n pick_address_from_list\n end", "def extract_addresses(address_list)\n addresses = []\n address_list.each do |address|\n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end\n addresses\nend", "def search_zip_code\r\n @addresses = Address.find_by_zip_code(params[:address][:zip_code])\r\n end", "def index\n @post_addresses = PostAddress.all\n end", "def each_address(&blk) # :yields: url\n addresses.each(&blk)\n end", "def list_postal_addresses\n\treturn if authorise_for_web(program_name?,'read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:postal_addresses_page] = params['page']\n\n\t\t render_list_postal_addresses\n\n\t\t return \n\telse\n\t\tsession[:postal_addresses_page] = nil\n\tend\n\n\tlist_query = \"@postal_address_pages = Paginator.new self, PostalAddress.count, @@page_size,@current_page\n\t @postal_addresses = PostalAddress.find(:all,\n\t\t\t\t :limit => @postal_address_pages.items_per_page,\n\t\t\t\t :offset => @postal_address_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_postal_addresses\nend", "def scrape_contacts; end", "def index\n @user_addresses = UserAddress.all\n end", "def employer_address_line(first_address, last_address)\n return if percentage_similarity(first_address, last_address) < 0.97\n\n (first_address.length > last_address.length) ? first_address : last_address\n end", "def index\n\t\t@addresses = Address.all\t\n\tend", "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "def postal_format_entire_address(co, person_name: nil)\n first_lines = person_name.nil? ? [co.name] : [co.name, person_name.to_s]\n\n address_lines = []\n # address_items = co.main_address.address_array(Address.max_visibility)\n address = co.main_address\n address_lines << address.street_address\n address_lines << \"#{address.post_code} #{address.city}\"\n\n first_lines + address_lines\n end", "def order_billing_address_lines\n order.bill_address.try(:full_address_array)\n end", "def payment_address!\n return unless currency.coin?\n record = payment_address\n\n # The address generation process is in progress.\n if record.address.blank?\n record\n else\n # allows user to have multiple addresses.\n payment_addresses.create!(currency: currency)\n end\n end", "def index\n @person_addresses = PersonAddress.all\n end", "def index\n @customer_addresses = CustomerAddress.all\n end", "def before_address\n @order.bill_address ||= Spree::Address.default\n @order.ship_address ||= Spree::Address.default\n\n @restaurants = Restaurant.all\n end", "def address_html(item)\n html = \"\"\n \thtml += \"#{item[:address1]}<br />\"\n \tif item[:address2].present?\n \t\thtml += \"#{item[:address2]}<br />\"\n \tend\n \tif item[:address3].present?\n \t\thtml += \"#{item[:address3]}<br />\"\n \tend\n \thtml += \"#{item[:city]} \"\n \tif item[:state].present?\n \t\thtml += \" #{item[:state]} \"\n \tend\n \thtml += \"#{item[:postal]}<br />\"\n \thtml += country_name(item[:country])\n end", "def rep_lookup\n 20.times do\n line = @file.readline\n\n representative = \"unknown\"\n #API lookup goes Here\n legislators = Sunlight::Legislator.all_in_zipcode(clean_zipcodes(line[:zipcode]))\n names = legislators.collect do |leg|\n first_name = leg.firstname\n first_initial = first_name[0]\n last_name = leg.lastname\n party = leg.party\n party_initial = party[0]\n title = leg.title\n title_abbr = title[0..2]\n title_abbr +\" \"+ first_initial + \". \" + last_name +\" (\"+party_initial+\")\"\n end\n\n puts \"#{line[:last_name]}, #{line[:last_name]}, #{line[:zipcode]}, #{names.join(\", \")}\"\n end\n end", "def lookup(street,from_number,to_number,number_step) \n if @properties.include?(street)\n return @properties[street]\n end\n qry=URI::encode(street) \n#query the street name to get the SifID\n url = \"http://ags2.lojic.org/ArcGIS/rest/services/External/Address/MapServer/exts/AddressRestSoe/ValidateStreetName?StreetName=\"+ qry + \n \"&token=XByufiRcTeZJOARKuu3jJV2mNkBRSCD--D1YqeBZDCuEij4BnbkuzNL3QcE-l3mwAnR7Rs9CoaKo-Xp8j4Tsuw..\" +\n '&f=json&dojo.preventCache=1365987076181&callback=dojo.io.script.jsonp_dojoIoScript49._jsonpCallback'\n# load the url\n html = cache street + \"\",url\n#convert jsonp into json\n data= /jsonpCallback\\(([^\\)]+)\\);$/.match(html)\n html=data[1]\n json = JSON.parse(html)\n if json \n if json.include?('Candidates') \n json['Candidates'].each{ |street_obj|\n $current_number = from_number\n while $current_number < to_number do \n print \"going to lookup \"+ $current_number.to_s + \"\\n\"\n lookup_housenumbers(street, street_obj[\"SifID\"],$current_number)\n $current_number = $current_number + number_step\n end\n }\n else\n warn \"nothing for \" + street + \"\\n\"\n return nil\n end \n end\n return p\n end", "def index\n if address_type==\"Address\"\n @addresses = Address.find(:all)\n else\n @addresses = Address.find_all_by_type(address_type)\n end\n @addresses ||= []\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @addresses }\n end\n end", "def index\n if params[:address].present? && params[:long_term_rental_income].present?\n @result = AirbnbHostPlace.compare(params[:address], params[:long_term_rental_income].to_d)\n end\n end", "def build_addresses(options={})\n raise \"override in purchase_order or sales_order\"\n end", "def valid_address?(address)\n all_addresses = get_all_addresses\n all_addresses.include? address\nend", "def index\n @addresses = Address.all\n end", "def index\n @addresses = Address.all\n end", "def address_correlate\n return nil unless (self.community.respond_to?(:launch_date) && Community.find_by_name(\"Lexington\").respond_to?(:launch_date))\n return nil if self.community.launch_date.to_date < Community.find_by_name(\"Lexington\").launch_date.to_date\n likeness = 0.94\n addr = []\n street = self.community.street_addresses\n street.each do |street_address|\n st_addr = street_address.address\n test = st_addr.jarowinkler_similar(address.split(\",\").first)\n if test > likeness\n likeness = test\n addr.clear\n addr << street_address\n elsif test == likeness\n addr << street_address\n end\n end\n\n if addr.empty?\n addr << create_st_address\n end\n\n addr.first\n end", "def index\n @account_addresses = AccountAddress.all\n end", "def create_elasticsearch_addressbase_data(title_address_data)\n id = title_address_data[:uprn]\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new \"/#{$ELASTICSEARCH_ADDRESSBASE}/#{$ELASTICSEARCH_POSTCODE_SEARCH}/#{id}\"\n request['Content-Type'] = 'application/json'\n request.body = title_address_data.to_json\n conn.request(request)\nend", "def index\n @adresses = Adress.all\n end", "def add_address # rubocop:disable Metrics/AbcSize\n return unless @bib.place.any?\n\n reg = @bib.place[0].region[0].name if @bib.place[0].region.any?\n addr = [@bib.place[0].name, @bib.place[0].city, reg]\n @item.address = addr.compact.join(\", \")\n end" ]
[ "0.6580404", "0.6275801", "0.62286896", "0.62041205", "0.61447453", "0.6120963", "0.6088918", "0.5984164", "0.5981787", "0.59658325", "0.596367", "0.5960186", "0.59379095", "0.59318125", "0.58989215", "0.58222353", "0.5803938", "0.5803726", "0.5800973", "0.5797129", "0.57801574", "0.575267", "0.57524693", "0.5749096", "0.5738324", "0.57347965", "0.5705684", "0.5704706", "0.5696878", "0.56926936", "0.56849396", "0.56795776", "0.56776243", "0.5676726", "0.5667861", "0.56668526", "0.56606776", "0.5656549", "0.5642922", "0.5639909", "0.5619787", "0.56189305", "0.5612886", "0.5612747", "0.56116813", "0.5609191", "0.5604206", "0.56031024", "0.55938053", "0.55898297", "0.5588248", "0.55860555", "0.5585684", "0.55856436", "0.55761963", "0.5575585", "0.557317", "0.55503386", "0.5549625", "0.5548691", "0.5548523", "0.5535463", "0.55331784", "0.552225", "0.5515228", "0.5508523", "0.550303", "0.5496969", "0.54942507", "0.5486576", "0.54775083", "0.5475748", "0.5467754", "0.5464067", "0.5454538", "0.5450048", "0.5447656", "0.5436144", "0.5435736", "0.54281497", "0.54239815", "0.54159987", "0.5413009", "0.5405938", "0.5405637", "0.5404033", "0.5403226", "0.53968734", "0.53915894", "0.5391427", "0.5389143", "0.5386369", "0.53848284", "0.53808695", "0.53759766", "0.53759766", "0.5371268", "0.53704655", "0.5369864", "0.536986", "0.5369392" ]
0.0
-1
insert new node at far left and swap up
def insert(root, node) if node.nil? nil elsif root.nil? self.root = node else go_to_bottom(nil,node) parent_compare(node, node.parent) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_left(obj)\n self.left, self.right = obj.left, obj\n reinsert_horizontal\n end", "def insert_into_merged_list_and_shift_left(bst_node, head)\n puts \"appending #{bst_node.value} to \" + (head.nil? ? \"nil\" : \"#{head.value}\") if $debug\n bst_node.right = head\n head = bst_node\n bst_node = bst_node.left\nend", "def insert(node)\n @prv.nxt = node.first if @prv\n node.first.prv = @prv\n node.last.nxt = self\n node\n end", "def insert(node)\n case @value <=> node.value\n when 1\n # alphabetically greater than, insert to left\n insert_into(:left, node)\n when 0\n # same value, so increase count of `self` node\n @count += 1\n when -1\n # alphabetically less than, insert to right\n insert_into(:right, node)\n end\n end", "def insertLower(node, current)\n case\n when node.value < current.value && current.left == nil\n current.left = node\n @size +=1\n return\n when node.value > current.value && current.right == nil\n current.right = node\n @size +=1\n return\n when node.value < current.value && current.left != nil\n insertLower(node, current.left)\n when node.value > current.value && current.right != nil\n insertLower(node, current.right)\n end\n end", "def insert_left(val)\n\t\t\tleft.insert(val) or self.left = Node.new(val)\n\t\tend", "def insert(node)\n if(node.value < @value)\n unless @left==nil\n @left.insert(node)\n else\n @left=node\n @left.root=self\n end\n elsif(node.value >@value)\n unless @right==nil\n @right.insert(node)\n else\n @right=node\n @right.root=self\n end\n else\n @value = node.value\n end\n end", "def test_insert_node_to_left_of_root\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n refute_equal nil, @tree.root.left\n end", "def node_insert_after!(x, prev, level)\n netx = node_next(prev, level) # 'next' is a reserved word in ruby\n \n # forward links\n x[0][level] = netx\n prev[0][level] = x\n \n # backward links\n x[3][level] = prev\n netx[3][level] = x\n end", "def push_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n @left = @mid\n @type = 1\n end", "def insert(current_node = root, value)\n # compare nodes,decide if left or right \n return nil if value == current_node.value\n\n if value < current_node.value\n current_node.left.nil? ? current_node.left = Node.new(value) : insert(current_node.left, value)\n else\n current_node.right.nil? ? current_node.right = Node.new(value) : insert(current_node.right, value)\n end\n end", "def test_insert_node_to_right\n @tree.insert(\"c\")\n @tree.insert(\"a\")\n @tree.insert(\"d\")\n refute_equal nil, @tree.root.right\n end", "def insert(value, node = root)\n return nil if value == node.data\n \n if value < node.data\n node.left.nil? ? node.left = Node.new(value) : insert(value, node.left)\n else\n node.right.nil? ? node.right = Node.new(value) : insert(value, node.right)\n end\n end", "def insert(new_value)\n if new_value > @value\n @right ? @right.insert(new_value) : (@right = Node.new(new_value))\n else\n @left ? @left.insert(new_value) : (@left = Node.new(new_value))\n end\n end", "def insert(root, new_node)\n new_node.id = @count + 1\n current = find_parent(root, new_node)\n\n current.left.nil? ? current.left = new_node : current.right = new_node\n new_node.parent = current\n\n heapify(new_node)\n @count += 1\n end", "def insert new_value\n if new_value <= @value\n @left.nil? ? @left = Node.new(new_value) : @left.insert(new_value)\n elsif new_value > @value\n @right.nil? ? @right = Node.new(new_value) : @right.insert(new_value)\n end\n end", "def insert(team)\n @left = leafify(team) and return if @left.nil?\n @right = leafify(team) and return if @right.nil?\n\n case @left.count <=> @right.count\n when 1\n do_insert(:@right, team)\n\tswap!\n when -1\n do_insert(:@left, team)\n swap!\n when 0\n\tdo_insert(:@right, team)\n end\n @count += 1\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def node_insert(node, value)\n if value < node.value\n if node.left\n node_insert(node.left, value)\n else\n node.left = BSTNode.new(value, node)\n end\n else\n if node.right\n node_insert(node.right, value)\n else\n node.right = BSTNode.new(value, node)\n end\n end\n end", "def insert_right(value)\n right.insert(value) or self.right = Node.new(value, self)\n end", "def insert(node, position)\n node_before_position = index(position-1)\n node_at_position = index(position)\n node_before_position.next = node\n node.next = node_at_position\n @size += 1\n node\n # returns inserted node\n end", "def insert(key, node = root)\n return node if node.data == key\n if child_count(node) == 0\n key < node.data ? node.left = Node.new(key) : node.right = Node.new(key)\n else\n insert(key, left_right(key, node))\n end\n end", "def insert(node, &block); end", "def insert(node, &block); end", "def insert( data, node = @root, prev_node = nil, child = \"\" ) \n return prev_node.right_child = Node.new( data ) if node.nil? && child == 'right'\n return prev_node.left_child = Node.new( data ) if node.nil? && child == 'left'\n \n if node.data == data\n return node\n elsif data > node.data\n insert(data, node.right_child, prev_node = node, child = 'right')\n elsif data < node.data\n insert(data, node.left_child, prev_node = node, child = 'left')\n end \n end", "def insert(x, node=self)\n if node.nil? \n node = Node.new(x, self)\n elsif node.val.nil?\n node.val = x\n elsif x < node.val\n if node.left.nil?\n node.left = Node.new(x, node)\n else\n node.left.val = x\n end\n elsif x > node.val\n if node.right.nil?\n node.right = Node.new(x, node)\n else\n node.right.val = x\n end\n end\n return node\n end", "def insertAfter(node, new_node)\n end", "def insert_left( item )\n # note this works both if subtree is nil or if one is already present\n new_left = BinaryTree.new( item )\n new_left.left_subtree = self.left_subtree\n @left_subtree = new_left\n end", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def push_node node, value\n if value > node.data\n if node.right\n push_node node.right, value\n else\n node.right = Node.new value\n end\n else\n if node.left\n push_node node.left, value\n else\n node.left = Node.new value\n end\n end\nend", "def insert( new_key )\n if new_key <= @key\n @left.nil? ? @left = Node.new( new_key ) : @left.insert( new_key )\n elsif new_key > @key\n @right.nil? ? @right = Node.new( new_key ) : @right.insert( new_key )\n end\n end", "def insert_above(other)\n self.up, self.down = other.up, other\n reinsert_vertical\n end", "def insert_node\n insert_node_helper(@root)\n end", "def insert node, value= nil\n\t\t\tif value < node.value\n\t\t\t\tnode.left.nil? ? node.left = Node.new(value, node) : insert(node.left, value)\n\t\t\telsif value >= node.value\n\t\t\t\tnode.right.nil? ? node.right = Node.new(value, node) : insert(node.right, value)\n\t\t\tend\t\t\n\tend", "def insert(data)\n if data <= @data\n if @left.nil?\n @left = Bst.new(data)\n else\n @left.insert(data)\n end\n else\n if @right.nil?\n @right = Bst.new(data)\n else\n @right.insert(data)\n end\n end\n end", "def insert(node, value)\n if node.left.nil? && value < node.val\n return node.left = TreeNode.new(value)\n elsif node.right.nil? && value > node.val\n return node.right = TreeNode.new(value)\n end\n\n insert(node.left, value) if value < node.val\n insert(node.right, value) if value > node.val\n\n return node\nend", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def insert_before(node)\n @prev_node = node.prev_node\n @next_node = node\n node.prev_node.next_node = self\n node.prev_node = self\n self\n end", "def insert_into_tree(root, new_value, index)\n if root.val == new_value\n return root\n elsif new_value < root.val\n if root.left\n insert_into_tree(root.left, new_value, index)\n else\n root.left = TreeNode.new(new_value, index )\n end\n else\n if root.right\n insert_into_tree(root.right, new_value, index)\n else\n root.right = TreeNode.new(new_value, index)\n end\n end\nend", "def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end", "def test_insert_adds_node_left_of_left_of_root\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n refute_equal nil, @tree.root.left.left\n end", "def insert(data)\n if @data.nil?\n @data = data\n else\n if data < @data\n if @left.nil?\n @left = Node.new(data)\n else\n @left.insert(data)\n end\n elsif data > @data\n if @right.nil?\n @right = Node.new(data)\n else\n @right.insert(data)\n end\n end\n end\n end", "def insert(node, root=nil, &block)\n return super(node, root) do | inserted_node | \n inserted_node.update_left_size(nil, 1) unless inserted_node.nil?\n block.call(inserted_node) if block\n end\n end", "def insert(value)\n current = self\n while true\n if current.value > value\n if current.left.nil?\n current.left = BST.new(value)\n break\n else\n current = current.left\n end\n else\n if current.right.nil?\n current.right= BST.new(value)\n break\n else\n current = current.right\n end\n end\n end\n end", "def insert_before value\n node = Node.new value, self, @prv\n @prv.nxt = node if @prv\n @prv = node\n end", "def push_mid_into_left\n @left.type, @left.value2, @left.right = 3, @value1, @mid.left\n @type = 1\n end", "def insert(data)\n @nodes << data\n heapify_up\n end", "def add_node(current_node, v)\n left = current_node.left if current_node.left\n right = current_node.right if current_node.right\n current_node.left = TreeNode.new(v)\n current_node.right = TreeNode.new(v)\n current_node.left.left = left\n current_node.right.right = right\nend", "def insert_into(destination, node)\n var = destination.to_s\n\n eval(%Q{\n if @#{var}.nil?\n # not trying to insert into left or right\n @#{var} = node\n else\n # insert into left or right\n @#{var}.insert(node)\n end\n })\n end", "def insert(value)\n new_node = Node.new(value)\n\n return @root = new_node if is_empty\n\n current = @root\n parent = nil\n\n while current != nil\n parent = current\n current = value <= current.value ? current.left : current.right\n end\n\n value <= parent.value ? parent.left = new_node : parent.right = new_node\n end", "def move_to_left_of(node)\n self.move_to(node, :left)\n end", "def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end", "def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end", "def insert_into_tree(tree,num)\n if num < tree.data\n tree.left.nil? ? tree.left = Node.new(num) : insert_into_tree(tree.left, num)\n end\n if num > tree.data\n tree.right.nil? ? tree.right = Node.new(num) : insert_into_tree(tree.right, num)\n end\nend", "def insert(data)\n current_node = @root\n if @root\n while current_node != nil\n if data < current_node.data && current_node.left == nil\n current_node.left = TreeNode.new(data)\n elsif data > current_node.data && current_node.right == nil\n current_node.right = TreeNode.new(data)\n elsif data < current_node.data\n current_node = current_node.left\n elsif data >= current_node.data\n current_node = current_node.right\n else\n return\n end\n end\n else\n @root = TreeNode.new(data)\n end\n end", "def insert(node)\n @tail.next = node\n @tail = @tail.next\n end", "def move_left\n move_to_left_of left_sibling\n end", "def swap_node_position(higher_node, lower_node)\n temp_element_title = higher_node.title\n temp_element_rating = higher_node.rating\n higher_node.title = lower_node.title\n higher_node.rating = lower_node.rating\n lower_node.title = temp_element_title\n lower_node.rating = temp_element_rating\n lower_node\n end", "def insert_right(value, tree)\n right = tree[:right]\n if right == nil\n right = Hash.new()\n right[:parent] = tree\n tree[:right] = right\n end\n insert(value, right)\nend", "def insert_brother_node(path, node)\n @rootNode.get_node(path).add_rightbrother_node(node)\n end", "def insert(root, node) #assumes tree already has root\n if node.rating < root.rating\n if root.left === nil\n root.left = node\n else #left subtree; not original root\n insert(root.left, node)\n end\n elsif node.rating > root.rating\n if root.right === nil\n root.right = node\n else\n insert(root.right, node)\n end\n end\n end", "def insert_at(data, index)\n\t\t@current_node = at(index)\n\t\t@insert_node = Node.new(data, @current_node)\n\n\t\t#Handeling the case that user inserts a node at head position (even though prepend exists for that)\n\t\tif @current_node != @head\n\t\t\t@old_link_node = at(index - 1)\n\t\t\t@old_link_node.next_node = @insert_node\n\t\telse\n\t\t\t@head = @insert_node\n\t\tend\n\tend", "def insert_left(value, tree)\n left = tree[:left]\n if left == nil\n left = Hash.new()\n left[:parent] = tree\n tree[:left] = left\n end\n insert(value, left)\nend", "def insert_at!(data, position)\n node, head, tail = set_insert_vars(data, position)\n\n # before: head -> position -> tail\n # after: head -> node -> tail\n head.tail = node if head\n node.tail = tail\n tail.head = node if tail\n node.head = head\n\n # set @tail for list or it will use old tail\n if position.tail?\n @tail = node\n end\n\n # orphan the old node\n position.head = nil\n position.tail = nil\n end", "def push_before(node, new_node)\n new_node.previous_node = node.previous_node\n new_node.next_node = node\n node.previous_node.next_node = new_node\n node.previous_node = new_node\n end", "def insert(value)\n current_node = @root\n until current_node.nil?\n if current_node.data < value\n if current_node.right_child.nil?\n current_node.right_child = Node.new(value)\n break\n end\n current_node = current_node.right_child\n elsif current_node.data > value\n if current_node.left_child.nil?\n current_node.left_child = Node.new(value)\n break\n end\n current_node = current_node.left_child\n else\n puts 'Input error'\n break\n end\n end\n end", "def insert(obj)\n if empty?\n @root = Node.new(obj)\n return\n end\n\n root = @root\n while root\n return if obj == root.obj\n\n if obj < root.obj\n root.left ? root = root.left : root.left = Node.new(obj)\n else\n root.right ? root = root.right : root.right = Node.new(obj)\n end\n end\n end", "def insert_right( item )\n # note this works both if subtree is nil or if one is already present\n new_right = BinaryTree.new( item )\n new_right.right_subtree = self.right_subtree\n @right_subtree = new_right\n end", "def insert(data)\n node = Node.new data\n\n if @head.nil?\n node.next_node = node\n else\n # the new node will have the same trailing node as old\n node.next_node = @head.next_node\n # the old head will become the tail\n @head.next_node = node\n end\n\n @head = node\n end", "def insert_after(idx, data)\n curr_node = node_at(idx)\n fail ArgumentError, \"index is out of range\" unless curr_node\n new_node = Node.new(data)\n new_node.next_node = curr_node.next_node\n curr_node.next_node = new_node\n end", "def insert(idx, node)\n if idx.zero?\n add_first(node)\n return\n end\n\n iterate do |curr_node, count|\n if count == idx - 1\n old_next = curr_node.next_node\n curr_node.next_node = node\n node.next_node = old_next\n old_next.prev_node = node unless old_next.nil?\n node.prev_node = curr_node\n\n return\n end\n end\n end", "def insert(data)\n @head = Node.new(data, @head)\n end", "def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end", "def insert(value, title)\n node = @root\n i = 0\n while node != nil\n parent_node = node\n node = value < node.value ? node.left : node.right\n i += 1\n end\n\n if has_root?\n parent_node.left = Node.new(value, title, parent_node, i) if value < parent_node.value\n parent_node.right = Node.new(value, title, parent_node, i) if value >= parent_node.value\n else\n @root = Node.new(value, title, nil, i)\n end\n i\n end", "def insert_before(node, obj)\n obj = obj.value if obj.is_a?(Node)\n node = Node.new(obj)\n\n if @head == node\n @head = new_node\n new_node.next = node\n else\n previous = node.previous\n previous.next = new_node\n new_node.previous = previous\n new_node.next = node\n end\n self\n end", "def insert(root, node)\n #if root rating is greater than node rating, go to the left\n if root.rating > node.rating && root.left == nil\n root.left = node\n root.left.parent = root\n root.left.skip = false\n elsif root.rating > node.rating && root.left != nil\n root = root.left\n insert(root, node)\n #if root rating is lower than node rating, go to the right\n elsif root.rating < node.rating && root.right == nil\n root.right = node\n root.right.parent = root\n root.right.skip = false\n elsif root.rating < node.rating && root.right != nil\n root = root.right\n insert(root, node)\n else\n puts \"404 (that's an error). Make sure that no Tomatometer ratings are duplicates and try again.\"\n end\n end", "def insert_before_node(node, to_insert)\n return unless node\n\n new_node = Node.new(to_insert, node.prev, node)\n\n if node.prev\n node.prev.next = new_node\n end\n\n if node == @head\n @head = new_node\n end\n\n node.prev = new_node\n @length += 1\n return new_node\n end", "def insert_node(tree_node, value)\r\n\r\n # Base Case: Found a space\r\n if tree_node.nil?\r\n tree_node = Node.new(value)\r\n\r\n elsif tree_node.value == value\r\n tree_node.value = value\r\n elsif tree_node.value < value\r\n tree_node.right = insert_node(tree_node.right, value)\r\n else\r\n tree_node.left = insert_node(tree_node.left, value)\r\n end\r\n tree_node\r\n end", "def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end", "def left_rotate( node=@tree )\n node.left = node.right\n node.right = node.right.right\n node.left.right = nil\n node.value, node.left.value = node.left.value, node.value\n end", "def insert(data)\n node = Node.new(data)\n\n if @size == 0\n @root = node\n else\n parent = @root\n\n loop do\n if data <= parent.value\n if !parent.left # found a leaf node\n parent.left = node # insert here\n break\n else\n parent = parent.left\n end\n else # data > node.value\n if !parent.right # found a leaf node\n parent.right = node # insert here\n break\n else\n parent = parent.right\n end\n end\n end\n end\n\n @size += 1\n end", "def insert_avl(node, new_node)\n #no node exists yet, inserting new node as root\n if node.nil?\n @root=new_node\n else\n # traversing left subtree\n if new_node.value < node.value\n if node.left.nil?\n node.left = new_node\n new_node.parent = node\n # rebalancing after insertion\n recursive_balance(node)\n else\n # recurse further down the left subtree\n insert_avl(node.left, new_node)\n end\n # continue with right side\n else\n if new_node.value > node.value\n if node.right.nil?\n node.right = new_node\n new_node.parent = node\n # rebalance after insertion\n recursive_balance(node)\n else\n # recurse further down right subtree\n insert_avl(node.right, new_node)\n end\n end\n end\n end\n end", "def insert(value, node = @root)\n if node.nil?\n return Node.new(value)\n end\n\n if value > node.value\n node.right_node = insert(value, node.right_node)\n elsif value < node.value\n node.left_node = insert(value, node.left_node)\n end\n\n return node\n end", "def insert_at(data, position)\n node, head, tail = set_insert_vars(data, position)\n\n # before: head -> position\n # after: head -> node -> position\n head.tail = node\n node.tail = position\n position.head = node\n node.head = head\n\n @size += 1\n end", "def insert(v)\n @stacks.shift until @stacks.first.right.nil?\n t = @stacks.first\n @stacks << TreeNode.new(v)\n if t.left.nil?\n t.left = @stacks.last\n else\n t.right = @stacks.last\n end\n t.val\n end", "def promote(node,father)\n \n if (node.getLeft() == nil)\n current = nil\n tempNode = node.getRight()\n while tempNode != nil do\n current = tempNode\n tempNode = tempNode.getLeft()\n end\n else\n tempNode = node.getLeft()\n current = tempNode\n while tempNode != nil do\n current = tempNode\n tempNode = tempNode.getRight()\n end\n end\n #Obtenemos nodo padre\n newParent = getFather(current.getData(),@root,current)\n getLastChild(current,newParent)\n \n current.setLeft(node.getLeft())\n current.setRight(node.getRight())\n \n if father.getData() < node.getData()\n father.setRight(current)\n else\n father.setLeft(current)\n end\n \n end", "def heapify_downward(i)\n #find the lowest node index that the node i could fall to\n end_node_index = find_end_of_node_path(i)\n \n #stash the value of node i for later\n start_node_value = self[i - 1] \n\n #search for the eventual final index where node i will fall\n swap_node_index = search_path_for_insert_position(i, end_node_index, start_node_value)\n \n #Move all parent nodes from the swap node index, up one level\n traversing_node_index = swap_node_index \n swap_node_value = self[traversing_node_index - 1]\n parent_value = self[parent_index(traversing_node_index) - 1]\n while traversing_node_index != i \n traversing_node_index = parent_index(traversing_node_index)\n self[traversing_node_index - 1] = swap_node_value\n swap_node_value = parent_value\n parent_value = self[parent_index(traversing_node_index) - 1]\n end\n \n #finally set the swap node index value to be our initial value \n self[swap_node_index - 1] = start_node_value \n end", "def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n node = find node\n node_after = node.next\n node_inserted = Node.new value\n node.next = node_inserted\n node_inserted.next = node_after\n node_inserted\n end", "def move_to_above_of(node)\n movement(node, :strict => true) do |to|\n self.right_sibling = to.target.record\n end\n end", "def insert(node, identifier = nil)\n if identifier\n insert_after(node, identifier)\n else \n node.next = @first_node\n @first_node = node\n end\n end", "def insert_node(new_node_val)\n new_node = Node.new(new_node_val)\n @nodes << new_node\n @_node_map[new_node_val] = new_node\n new_node\n end", "def insert_at(index,data)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n self.prepend(data)\n elsif index == self.size - 1\n self.append(data)\n else\n new_node = Node.new(data)\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n new_node.next,prev.next = current_node,new_node \n end", "def insert_after(child1, child2); end", "def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n\n end", "def add_to_tree(curr_node, new_node, queue = [])\n if curr_node.nil?\n curr_node = new_node\n elsif curr_node.left_node.nil?\n curr_node.left_node = new_node\n elsif curr_node.right_node.nil?\n curr_node.right_node = new_node\n else\n queue.push(curr_node.left_node)\n queue.push(curr_node.right_node)\n next_node = queue.shift\n next_node = add_to_tree(next_node, new_node, queue)\n end\n curr_node\n end", "def insert(node)\n\t\t#this is how you link the nodes together\n\t\[email protected] = node\n\t\t#the tail is now equal to the last node that was entered into the linked list\n\t\t@tail = @tail.pointer\n\tend", "def insert_at(i,data)\n if i<0 || i>= @size\n \treturn nil\n end\n node=Node.new\n node.value=data\n if i==0\n \tnode.next_node=@root\n \t@root=node\n else\n pre_node=at(i-1)\n node.next_node=pre_node.next_node\n pre_node.next_node=node\n end\n @size+=1\n end" ]
[ "0.7448322", "0.7152601", "0.71071416", "0.70332634", "0.7007829", "0.69527614", "0.68152666", "0.68092024", "0.6799836", "0.67880434", "0.67690784", "0.6729478", "0.6717278", "0.66991746", "0.6688645", "0.66832846", "0.66471803", "0.66450846", "0.66450846", "0.66450846", "0.65992963", "0.6580989", "0.658033", "0.6557693", "0.65480036", "0.65480036", "0.65138507", "0.6484752", "0.6484163", "0.64763075", "0.6472258", "0.6452903", "0.6438603", "0.6431665", "0.6424744", "0.64238644", "0.642257", "0.64131147", "0.6411716", "0.64037865", "0.6399119", "0.638012", "0.63746023", "0.636468", "0.6355168", "0.634648", "0.63395643", "0.63387173", "0.6338406", "0.63369703", "0.63266134", "0.63084716", "0.6291986", "0.628494", "0.62787795", "0.627717", "0.6274246", "0.6259016", "0.62540203", "0.62505656", "0.62361276", "0.6234611", "0.6233868", "0.6227765", "0.6220473", "0.6218234", "0.620927", "0.62015665", "0.6196193", "0.6193753", "0.6186192", "0.6185665", "0.61627144", "0.6161799", "0.6144214", "0.6142232", "0.6135535", "0.6135155", "0.61298317", "0.6120528", "0.61188394", "0.61169887", "0.6111033", "0.6106346", "0.61042744", "0.60995805", "0.6096928", "0.60905886", "0.6083238", "0.6078816", "0.6076026", "0.60735667", "0.60721815", "0.60704654", "0.60668933", "0.6061069", "0.6057593", "0.60531086", "0.60523874" ]
0.62356776
62
send added element to the bottomleftmost open slot
def go_to_bottom(nodes=nil, target) next_row = [] if nodes.nil? nodes = [self.root] end nodes.each do |node| if node.left.nil? node.left = target node.left.parent = node return elsif node.right.nil? node.right = target node.right.parent = node return else next_row << node.left next_row << node.right end end if next_row.count > 0 go_to_bottom(next_row, target) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(child, left, right, top, bottom, &block)\n super(child, false, &block)\n\n gtk_instance.attach(child.gtk_instance, left, right, top, bottom)\n end", "def add_a_message\n @browser.span(:id=>\"newsharecontent_message_arrow\").fire_event('onclick')\n end", "def add_button_clicked\n\t\t\n\t\t\t# Eventually create browse form\n\t\t\tcreate_browse_form\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form\n\t\tend", "def add_to_bottom\n self.position = bottom + 1\n end", "def creationHBoxSurvie( box, position , remove , positionOtherDifficulty , btnOtherMode )\n\n if box.children[positionOtherDifficulty] != btnOtherMode\n box.remove( box.children[positionOtherDifficulty] )\n box.add(btnOtherMode)\n box.reorder_child(btnOtherMode, positionOtherDifficulty)\n end\n\n box.remove(remove) #DELETE\n\n hBox = Gtk::Box.new(:horizontal)\n hBox.set_height_request(60); hBox.set_homogeneous(true)\n hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )\n hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )\n hBox.add ( Gtk::Button.new() )\n\n # gestion des evenements des boutons de choix de niveau\n hBox.children[0].signal_connect(\"clicked\"){\n Fenetre.remove(box);\n\n nbGrille = SauvegardeGrille.getInstance.getNombreGrille\n indiceRand = rand(1..(nbGrille/3))\n\n FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))\n }\n hBox.children[1].signal_connect(\"clicked\"){\n Fenetre.remove(box);\n\n nbGrille = SauvegardeGrille.getInstance.getNombreGrille\n indiceRand = rand((1+nbGrille/3)..(2*nbGrille/3))\n\n\n FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))\n }\n\n hBox.children[2].signal_connect(\"clicked\"){\n Fenetre.remove(box);\n\n nbGrille = SauvegardeGrille.getInstance.getNombreGrille\n indiceRand = rand((1+2*nbGrille/3)..nbGrille)\n\n FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))\n }\n\n setBold( hBox.children[0] , @@lg.gt(\"FACILE\") )\n setBold( hBox.children[1] , @@lg.gt(\"MOYEN\") )\n setBold( hBox.children[2] , @@lg.gt(\"DIFFICILE\") )\n\n box.add( setmargin(hBox,0,15,70,70) ) #ADD\n box.reorder_child( hBox , position ) #REORDER\n Fenetre.show_all\n end", "def create_item_window\n y = @help_window.bottom_corner\n width = Graphics.width / 2\n height = @materials_window.y - y\n @items_window = Window_ForgeList.new(0, y, width, height)\n @items_window.set_handler(:ok, method(:command_select))\n @items_window.set_handler(:cancel, method(:return_scene))\n @items_window.help_window = @help_window\n @items_window.mat_window = @materials_window\n #@items_window.gold_window = @gold_window\n end", "def add_content\n self.link(:id=>\"navigation_create_and_add_link\").fire_event(\"onmouseover\")\n self.link(:text=>\"Add content\").click\n self.wait_until { @browser.text.include? \"Collected items\" }\n self.class.class_eval { include AddContentContainer }\n end", "def create_item_window\n @index ||= 0\n wy = @help_window.y + @help_window.height\n wh = Graphics.height - wy\n @item_window = Window_BestiaryEnemyList.new(wy, wh)\n @item_window.viewport = @viewport\n @item_window.help_window = @help_window\n @item_window.set_handler(:ok, method(:on_item_ok))\n @item_window.set_handler(:cancel, method(:return_scene))\n @item_window.refresh\n @item_window.index = @index\n @item_window.activate\n end", "def bottom_item\n @current = last\n\n items\n end", "def update_detail_window\n return if item.nil? || @detail_window.nil? || self.active == false\n @detail_window.update_header(item.header, item.slot)\n end", "def addPositioned(w, left, top)\n # In order to avoid the potential for a flicker effect, it is necessary\n # to set the position of the widget before adding it to the AbsolutePanel.\n # The Widget should be removed from its parent before any positional\n # changes are made to prevent flickering.\n w.removeFromParent\n DOM.setAbsolutePixelPosition(w.getElement, left, top)\n add(w)\n end", "def add(child, x_pos, y_pos, &block)\n gtk_instance.put(child.gtk_instance, x_pos, y_pos)\n\n super(child, false, &block)\n end", "def main_window\r\n super\r\n # Make windows\r\n @help_window = Window_Help.new\r\n @left_window = Window_EquipLeft.new(@actor)\r\n @right_window = Window_EquipRight.new(@actor)\r\n @item_window1 = Window_EquipItem.new(@actor, 0)\r\n @item_window2 = Window_EquipItem.new(@actor, 1)\r\n @item_window3 = Window_EquipItem.new(@actor, 2)\r\n @item_window4 = Window_EquipItem.new(@actor, 3)\r\n @item_window5 = Window_EquipItem.new(@actor, 4)\r\n # Associate help window\r\n @right_window.help_window = @help_window\r\n @item_window1.help_window = @help_window\r\n @item_window2.help_window = @help_window\r\n @item_window3.help_window = @help_window\r\n @item_window4.help_window = @help_window\r\n @item_window5.help_window = @help_window\r\n # Set cursor position\r\n @right_window.index = @equip_index\r\n refresh\r\n end", "def bottom\n @ole.Bottom\n end", "def bottom\n @ole.Bottom\n end", "def send_to_temp m\n\t\t\t@temp_box << m\n\t\tend", "def add_item_callback\n left = @adapter\n right = RepositoryAdapter.new(@adapter.constraint)\n builder = BuilderDialog.new(@driver, left, right)\n @driver << builder\n end", "def start_item_selection\n @actor_command_window.active = false\n \n @help_window = Window_Help.new()\n #@help_window = Window_Info_Help.new(0, 384, nil) \n #@help_window = Window_Info_Help.new(0, 0, nil)\n #@help_window.width = 544\n \n #@item_back_window = Window_Base.new(0, 56, 640, 328)\n #@dataviews_window = Window_Dataviews.new(0, 56, MENU_CONFIG::DATAVIEWS)\n #@dataviews_window.active = false\n #@dataviews_window.opacity = 0\n \n #@item_window = Window_Item.new(0, 96, 640, 272, @dataviews_window.apply_dataview($game_party.items))\n @item_window = Window_Item.new(0, 56, 544, 232, $game_party.items)\n #@item_window.opacity = 0\n @item_window.help_window = @help_window\n \n #@item_details_window = Window_ItemDetails.new(0,384,nil)\n #@item_details_window = Window_ItemDetails.new(0,0,nil)\n #@item_details_window.visible = false\n #@item_window.detail_window = @item_details_window\n end", "def window_handles; end", "def update_equip_window\n return if @equip_window.nil?\n @equip_window.set_item(item)\n end", "def move_to_bottom\n return unless in_list?\n insert_at_position bottom_position_in_list.to_i\n end", "def process_simple_block_opener(tk); end", "def window_update(actor)\n if actor != nil\n @actor = actor\n equips = actor.equips\n @data = []\n if equips != nil\n for item in equips\n @data.push(item)\n end\n @item_max = @data.size\n create_contents()\n @ucEquipItemsList.clear()\n for i in 0..@item_max-1\n @ucEquipItemsList.push(create_item(i))\n end\n end\n end\n refresh()\n end", "def process_complex_block_opener(tk); end", "def on_add(clicker)\n end", "def insert_at_bottom\n assume_bottom_position\n end", "def on_item_ok; item_ok(@item_window, @trade_win1, @tb_unit); end", "def move_to_bottom\n self.class.transaction do\n decrement_position_of_lower_items\n set_bottom_position\n end\n end", "def send_next_window\n @window += 1\n send_window\n end", "def dump(spot)\n return if spot.empty?\n \n window, spot_id = ensure_clickable(spot)\n @client.send_packet Packet::ClickWindow.new(window.id, spot_id, :left, new_transaction, false, spot.item)\n @client.send_packet Packet::ClickWindow.outside(new_transaction)\n spot.item = nil\n end", "def bubble_up(index)\n #YOUR WORK HERE\n end", "def insert( parent, item )\n @currentIndex = @currentIndex + 1\n return parent.render( :partial=>self.partial, :object=>item, :locals=>{ :_ => self } );\n end", "def create_item_window\n @item_window = Window_EquipItem.new(ITEM_WINDOW_X, ITEM_WINDOW_Y)\n @item_window.help_window = @help_window\n @item_window.stat_window = @stat_window\n @item_window.actor = @actor\n @item_window.set_handler(:ok, method(:on_item_ok))\n @item_window.set_handler(:cancel, method(:on_item_cancel))\n @item_window.set_handler(:start, method(:on_toggle_help))\n @slot_window.item_window = @item_window\n end", "def creationHBoxCLM( box, position , remove , positionOtherDifficulty , btnOtherMode )\n\n if box.children[positionOtherDifficulty] != btnOtherMode\n box.remove( box.children[positionOtherDifficulty] )\n box.add(btnOtherMode)\n box.reorder_child(btnOtherMode, positionOtherDifficulty)\n end\n\n box.remove(remove) #DELETE\n\n hBox = Gtk::Box.new(:horizontal)\n hBox.set_height_request(60); hBox.set_homogeneous(true)\n hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )\n hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) )\n hBox.add ( Gtk::Button.new() )\n\n # gestion des evenements des boutons de choix de niveau\n hBox.children[0].signal_connect(\"clicked\"){\n Fenetre.remove(box);\n\n nbGrille = SauvegardeGrille.getInstance.getNombreGrille\n gridsId = (1..(nbGrille/3)).to_a.shuffle\n indiceRand = -1\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0)\n indiceRand = id\n break\n end\n }\n\n if(indiceRand == -1 )\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1)\n indiceRand = id\n break\n end\n }\n end\n\n if(indiceRand == -1 )\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2)\n indiceRand = id\n break\n end\n }\n end\n\n if(indiceRand == -1 )\n indiceRand = gridsId[0]\n end\n\n\n FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))\n }\n hBox.children[1].signal_connect(\"clicked\"){\n Fenetre.remove(box);\n\n\n nbGrille = SauvegardeGrille.getInstance.getNombreGrille\n gridsId = ((1 + nbGrille/3)..(2*nbGrille/3)).to_a.shuffle\n\n indiceRand = -1\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0)\n indiceRand = id\n break\n end\n }\n\n if(indiceRand == -1 )\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1)\n indiceRand = id\n break\n end\n }\n end\n\n if(indiceRand == -1 )\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2)\n indiceRand = id\n break\n end\n }\n end\n\n if(indiceRand == -1 )\n indiceRand = gridsId[0]\n end\n\n\n\n FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))\n }\n\n hBox.children[2].signal_connect(\"clicked\"){\n Fenetre.remove(box);\n\n\n nbGrille = SauvegardeGrille.getInstance.getNombreGrille\n gridsId = ((1 + 2*nbGrille/3)..nbGrille).to_a.shuffle\n\n indiceRand = -1\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0)\n indiceRand = id\n break\n end\n }\n\n if(indiceRand == -1 )\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1)\n indiceRand = id\n break\n end\n }\n end\n\n if(indiceRand == -1 )\n gridsId.each{ |id|\n if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2)\n indiceRand = id\n break\n end\n }\n end\n\n if(indiceRand == -1 )\n indiceRand = gridsId[0]\n end\n\n\n FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand)))\n }\n\n setBold( hBox.children[0] , @@lg.gt(\"FACILE\") )\n setBold( hBox.children[1] , @@lg.gt(\"MOYEN\") )\n setBold( hBox.children[2] , @@lg.gt(\"DIFFICILE\") )\n\n box.add( setmargin(hBox,0,15,70,70) ) #ADD\n box.reorder_child( hBox , position ) #REORDER\n Fenetre.show_all\n end", "def active_element; end", "def add_slot\n @limit += 1\n end", "def ListView_SetHotItem(hwnd, i) send_listview_message(hwnd, :SETHOTITEM, wparam: i) end", "def push(element)\r\n # IMPLEMENTME!\r\n end", "def pbChooseItem\n @sprites[\"helpwindow\"].visible = false\n itemwindow = @sprites[\"itemlist\"]\n thispocket = @bag.pockets[itemwindow.pocket]\n swapinitialpos = -1\n pbActivateWindow(@sprites,\"itemlist\"){\n loop do\n oldindex = itemwindow.index\n Graphics.update\n Input.update\n pbUpdate\n if itemwindow.sorting && itemwindow.index>=thispocket.length\n itemwindow.index = (oldindex==thispocket.length-1) ? 0 : thispocket.length-1\n end\n if itemwindow.index!=oldindex\n # Move the item being switched\n if itemwindow.sorting\n thispocket.insert(itemwindow.index,thispocket.delete_at(oldindex))\n end\n # Update selected item for current pocket\n @bag.setChoice(itemwindow.pocket,itemwindow.index)\n pbRefresh\n end\n if itemwindow.sorting\n if Input.trigger?(Input::A) ||\n Input.trigger?(Input::C)\n itemwindow.sorting = false\n pbPlayDecisionSE\n pbRefresh\n elsif Input.trigger?(Input::B)\n curindex = itemwindow.index\n thispocket.insert(swapinitialpos,thispocket.delete_at(itemwindow.index))\n itemwindow.index = swapinitialpos\n itemwindow.sorting = false\n pbPlayCancelSE\n pbRefresh\n end\n else\n # Change pockets\n if Input.trigger?(Input::LEFT)\n newpocket = itemwindow.pocket\n loop do\n newpocket = (newpocket==1) ? PokemonBag.numPockets : newpocket-1\n break if !@choosing || newpocket==itemwindow.pocket\n if @filterlist; break if @filterlist[newpocket].length>0\n else; break if @bag.pockets[newpocket].length>0\n end\n end\n if itemwindow.pocket!=newpocket\n itemwindow.pocket = newpocket\n @bag.lastpocket = itemwindow.pocket\n thispocket = @bag.pockets[itemwindow.pocket]\n pbPlayCursorSE\n pbRefresh\n end\n elsif Input.trigger?(Input::RIGHT)\n newpocket = itemwindow.pocket\n loop do\n newpocket = (newpocket==PokemonBag.numPockets) ? 1 : newpocket+1\n break if !@choosing || newpocket==itemwindow.pocket\n if @filterlist; break if @filterlist[newpocket].length>0\n else; break if @bag.pockets[newpocket].length>0\n end\n end\n if itemwindow.pocket!=newpocket\n itemwindow.pocket = newpocket\n @bag.lastpocket = itemwindow.pocket\n thispocket = @bag.pockets[itemwindow.pocket]\n pbPlayCursorSE\n pbRefresh\n end\n# elsif Input.trigger?(Input::F5) # Register/unregister selected item\n# if !@choosing && itemwindow.index<thispocket.length\n# if @bag.pbIsRegistered?(itemwindow.item)\n# @bag.pbUnregisterItem(itemwindow.item)\n# elsif pbCanRegisterItem?(itemwindow.item)\n# @bag.pbRegisterItem(itemwindow.item)\n# end\n# pbPlayDecisionSE\n# pbRefresh\n# end\n elsif Input.trigger?(Input::A) # Start switching the selected item\n if !@choosing\n if thispocket.length>1 && itemwindow.index<thispocket.length &&\n !POCKETAUTOSORT[itemwindow.pocket]\n itemwindow.sorting = true\n swapinitialpos = itemwindow.index\n pbPlayDecisionSE\n pbRefresh\n end\n end\n elsif Input.trigger?(Input::B) # Cancel the item screen\n pbPlayCancelSE\n return 0\n elsif Input.trigger?(Input::C) # Choose selected item\n pbPlayDecisionSE\n return itemwindow.item\n end\n end\n end\n }\n end", "def main_window\r\n super\r\n # Make windows\r\n @left_window = Window_DebugLeft.new\r\n @right_window = Window_DebugRight.new\r\n @help_window = Window_Base.new(192, 352, 448, 128)\r\n @help_window.contents = Bitmap.new(406, 96)\r\n # Restore previously selected item\r\n @left_window.top_row = $game_temp.debug_top_row\r\n @left_window.index = $game_temp.debug_index\r\n @right_window.mode = @left_window.mode\r\n @right_window.top_id = @left_window.top_id\r\n end", "def execute_in slot\n # loads saved lesson and page, of 0, 0, by default\n # differently from what is displayed in the UI,\n # internally @lesson and @page start at 0\n puts \"@name: >#{@name}<\"\n puts \"tut_lesson_#@name -> \" + (HH::PREFS[\"tut_lesson_#@name\"] || '-missing-').to_s\n @lesson = (HH::PREFS[\"tut_lesson_#@name\"] || \"0\").to_i\n @page = (HH::PREFS[\"tut_page_#@name\"] || \"0\").to_i\n @container.slot = slot\n slot.extend HH::Tooltip\n\n execute_page\n @@open_lesson = self\n end", "def item\r\n @item_window.item\r\n end", "def push(element)\n @store.push(element)\n @top += 1\n end", "def update_item\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Activate right window\r\n @right_window.active = true\r\n @item_window.active = false\r\n @item_window.index = -1\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Play equip SE\r\n $game_system.se_play($data_system.equip_se)\r\n # Get currently selected data on the item window\r\n item = @item_window.item\r\n # Change equipment\r\n @actor.equip(@right_window.index, item == nil ? 0 : item.id)\r\n # Activate right window\r\n @right_window.active = true\r\n @item_window.active = false\r\n @item_window.index = -1\r\n # Remake right window and item window contents\r\n @right_window.refresh\r\n @item_window.refresh\r\n return\r\n end\r\n end", "def on_item_ok2; item_ok(@item_window2, @trade_win2, @tb_unit2); end", "def TreeView_SetHot(hwnd, hitem) send_treeview_message(hwnd, :SETHOT, lparam: hitem) end", "def add_item(itemToAdd)\r\n itemToAdd.set_owner(self)\r\n itemToAdd.deactivate\r\n self.items.push(itemToAdd)\r\n end", "def move_to_bottom(tag, klass)\n remove(tag, klass)\n self.instance.add(tag, klass)\n end", "def ListView_InsertItem(hwnd, pitem) send_listview_message(hwnd, :INSERTITEM, lparam: pitem) end", "def item\n @item_window.item\n end", "def add1\n bp = bpn\n bp.add_list_item('Apollo13',actors,hanks)\nend", "def window_handle; end", "def update_help\n @help_window.set_item(item)\n @cost_window.set_item(item) if @cost_window\n @image_window.set_item(item) if @image_window\n end", "def move_to_bottom\n return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items\n assume_bottom_position\n end\n end", "def button_up(id); end", "def item2\n @item_window2.item\n end", "def add_to\n add_to_button\n wait_for_ajax(2)\n end", "def <<(new_item)\n if @item_stack.empty?\n @items << new_item\n else\n @item_stack.last.html << new_item\n end\n self\n end", "def test_moveTo_Inside_Bottom\n w = Window_Base.new(200, 530, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(200, 100)\n return true\n end", "def test_alignLeft\n w = Window_Selectable_Implemented.new(0,128,160,128,$data_items.compact, 24, true, 24, 0)\n @windows.push(w)\n end", "def update_help\n super\n @help_window.set_item(item.item) if @help_window\n mat_window.set_item(item) if mat_window\n info_window.set_item(item.item) if info_window\n gold_window.set_item(item) if gold_window\n end", "def create_line_item_button\n self.get_element(@browser, 'create')\n end", "def open_add_more_vehicles_button(which)\n add_button if add_more_button_list? == false\n\n item = add_more_button_list.find { |item| item.link.text.downcase.snakecase == which.to_s.downcase.snakecase }\n item.click!\n end", "def update()\n @nameFlow.clear()\n @nameFlow = @stageWin.flow() do # | flowz0r |\n @stageWin.para @stageWin.link \"#{@stagename}\", :weight => 900\n @stageWin.click do\n # debug \"Clicked the 'Positions' stack\"\n @mainApp.clearSelections()\n posNames = []\n @positions.each do | pos |\n posNames << pos.name()\n end\n # debug \"Selecting ...\"\n @mainApp.selectPosition(posNames)\n # @positions.each do | pos |\n # @mainApp.clearSelections()\n # @mainApp.selectPosition(pos.name)\n # end\n end\n end\n @posFlow.clear()\n @posFlow = @stageWin.flow() do \n @stageWin.flow() do\n @positions.each do | pos |\n posLink = @stageWin.link(pos.name())\n tehPara = @stageWin.para posLink\n posLink.click do \n # debug tehPara.inspect()\n @mainApp.clearSelections()\n @mainApp.selectPosition(tehPara.text())\n end\n end\n end\n end\n end", "def other_side_opened\n room = $manager.find @container\n @open = true\n room.output \"The #{@generic} opens.\"\n end", "def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\t:id => \"add_content_for_element_#{element.id}\",\n\t\t\t\t\t\t:class => 'small button with_icon new_content_link'\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\tend", "def create_places_window\n y = @legend_window.y + @legend_window.height\n height = Graphics.height - @mission_window.height - @legend_window.height\n @places_window = Window_PlaceList.new(y, height)\n @places_window.set_handler(:ok, method(:place_selection))\n @places_window.set_handler(:cancel, method(:return_scene))\n @places_window.activate\n end", "def create_equip_list_window\n x = @enchant_list.width; y = @enchant_list.y\n w = Graphics.width - @enchant_list.width; h = @enchant_list.height\n @equip_window = Window_EquipEnchantList.new(x, y, w, h)\n @equip_window.help_window = @help_window\n @equip_window.active = true\n @enchant_list.equip_window = @equip_window\n @equip_window.set_item(@enchant_list.item)\n @equip_window.index = 0\n @equip_window.set_handler(:ok, method(:equip_selected))\n @equip_window.set_handler(:cancel, method(:equip_unselected))\n @equip_window.viewport = @viewport1\n end", "def create_unit_item_list\n @unit_item_list = Window_UILsub.new(50,50,WIDTH,200)\n @unit_item_list.set_handler(:ok, method(:unit_item_ok))\n @unit_item_list.set_handler(:cancel, method(:unit_item_cancel))\n @unit_item_list.deactivate\n @unit_item_list.hide\n end", "def element\n window\n end", "def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end", "def on_button_up(button_id, point)\n end", "def test_alignRight\n w = Window_Selectable_Implemented.new(320,128,160,128,$data_items.compact, 24, true, 24, 2)\n @windows.push(w)\n end", "def move_to_top\n unless @in_palette\n delete\n @parent.add_draggable(self)\n end\n end", "def gestionDroite()\n\t\t#choix technique\n\t\[email protected]{ |t|\n\t\t\[email protected]_text(\"#{t}\")\n\t\t}\n\n\t\[email protected]_connect('changed'){ |widget|\n\t\t\tHeader.penalite()\n\t\t\t@techniqueChoisie=widget.active_text()\n\t\t\t@[email protected](@techniqueChoisie)\n\t\t\t@nbEtape= recuperationNbEtape()\n\t\t\t@etapeEnCours=1\n\t\t\tactualisation()\n\t\t}\n\n\t\t#etapes\n\t\[email protected]_connect('clicked'){\n\t\t\tif @etapeEnCours-1 > 0\n\t\t\t\t@etapeEnCours=@etapeEnCours-1\n\t\t\t\tactualisation()\n\t\t\tend\n\t\t}\n\n\t\[email protected]_connect('clicked'){\n\t\t\tif @etapeEnCours+1 <= @nbEtape\n\t\t\t\t@etapeEnCours=@etapeEnCours+1\n\t\t\t\tactualisation()\n\t\t\tend\n\t\t}\n\n\t\[email protected](@boutonEtapePrec)\n\t\[email protected](@labelEtape)\n\t\[email protected](@boutonEtapeSuiv)\n\n\t\t#explication\n @boxExplication.set_hexpand(true)\n @boxExplication.set_vexpand(true)\n\n @texteContenu.set_line_wrap(true)\n @boxTexte.add(@texteContenu)\n @boxContour.pack_start(@boxTexte, :expand => true, :fill => true)\n @boxExplication.pack_start(@boxContour, :expand => true, :fill => true)\n\n\t\t#add a la box\n\t\[email protected](@labelChoix)\n\t\[email protected](@list)\n\t\[email protected](@labelChoix2)\n\t\[email protected](@boxEtape)\n\t\[email protected](@boxExplication)\n\tend", "def put_in_place\n if place==:append\n item = self\n self.class.with_tree_scope(self) do\n root.append(item)\n end\n end\n end", "def leftClicked\n\t\[email protected]\n\tend", "def create_active_members_window\n y = @left_window.bottom_corner\n @active_members_window = Window_ActiveMembers.new(0, y)\n @active_members_window.set_handler(:right, method(:pass_on_right))\n @active_members_window.set_handler(:cancel, method(:on_cancel))\n @active_members_window.set_handler(:ok, method(:on_actor_selection))\n @active_members_window.y = Graphics.height - @active_members_window.height\n @active_members_window.activate\n end", "def test_fullDamageItem\n w = Window_ItemDetails.new(0,384,640,96,$data_items[24])\n @windows.push(w)\n return true\n end", "def update\n super\n @description_window.print_description(@commande_list_window.index)\n if @window_command_command_face_define\n id = @window_command_command_face_define.index\n @window_command_face_view.name = @array_face[id]\n @window_command_face_view.draw_item\n end\n if @window_command_variable\n @window_command_variable_description.print_description(@window_command_variable.index)\n end\n end", "def push(component)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if component.handle.ptr == nil\n raise \"component is disposed\"\n end\n Native.Layout_push(@handle.ptr, component.handle.ptr)\n component.handle.ptr = nil\n end", "def push(element)\n # IMPLEMENT ME!\n end", "def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end", "def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end", "def create_reserve_members_window\n x = Graphics.width/2\n y = @right_window.bottom_corner\n @reserve_members_window = Window_ReserveMembers.new(x, y)\n @reserve_members_window.set_handler(:left, method(:pass_on_left))\n @reserve_members_window.set_handler(:cancel, method(:on_cancel))\n @reserve_members_window.set_handler(:ok, method(:on_actor_selection))\n @reserve_members_window.y = Graphics.height - @reserve_members_window.height\n @reserve_members_window.deactivate\n end", "def create_slot_window\n @slot_window = Window_EquipSlot.new(SLOT_WINDOW_X, SLOT_WINDOW_Y)\n @slot_window.help_window = @help_window\n @slot_window.actor = @actor\n @slot_window.set_handler(:ok, method(:on_slot_ok))\n @slot_window.set_handler(:cancel, method(:return_scene))\n @slot_window.set_handler(:up, method(:status_return))\n @slot_window.set_handler(:x, method(:command_clear))\n @slot_window.set_handler(:start, method(:on_toggle_help))\n @slot_window.set_handler(:pagedown, method(:next_actor))\n @slot_window.set_handler(:pageup, method(:prev_actor))\n end", "def command_select\n @items_window.smooth_move(0 - @items_window.width, @items_window.y)\n @materials_window.smooth_move(0 - @materials_window.width, @materials_window.y)\n #@gold_window.smooth_move(0 - @gold_window.width, @gold_window.y)\n @details_window.smooth_move(Graphics.width, @details_window.y)\n @confirm_window.set_item(@items_window.item)\n @confirm_window.open\n end", "def item_selected\n if @last_frame < Graphics.frame_count\n @option_window.item.value = popup.selected_value\n @option_window.refresh\n @help_window.refresh\n close_popup\n else\n popup.activate\n end\n end", "def test_detail_window\n detail_window = Window_ItemDetails.new(0,384,640,96,nil)\n detail_window.visible = false\n help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n w = Window_Selectable_Implemented.new(0,256,160,128,$data_items.compact)\n w.help_window = help_window\n w.detail_window = detail_window\n @windows.push(w)\n @windows.push(help_window)\n @windows.push(detail_window)\n end", "def add_bottom (card)\n @cards.unshift(card);\n end", "def current_item\n current_window.item\n end", "def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end", "def move_to_bottom(klass)\n remove(klass)\n self.instance.add(klass)\n end", "def test_block_cursor\n w = Window_Selectable_Implemented.new(480,128,160,128,$data_items.compact)\n w.block_cursor = true;\n @windows.push(w)\n end", "def test_moveTo_Outside_Bottom\n w = Window_Base.new(200, 150, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.moveTo(200, 530)\n return true\n end", "def pbListWindow(cmds, width = Graphics.width / 2)\r\n list = Window_CommandPokemon.newWithSize(cmds, 0, 0, width, Graphics.height)\r\n list.index = 0\r\n list.rowHeight = 24\r\n pbSetSmallFont(list.contents)\r\n list.refresh\r\n return list\r\nend", "def fit_to_bottom_of( sibling_view )\n new_height = sibling_view.frame.origin.y - self.frame.origin.y\n self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.width, new_height)\n end", "def add component, title\n component.row = @row+@row_offset+0 # FFI changed 1 to 0 2011-09-12 \n component.col = @col+@col_offset+0 # FFI changed 1 to 0 2011-09-12 \n component.width = @width-2\n component.height = @height-2\n component.form = @form\n component.override_graphic(@graphic)\n @current_component = @bmanager.add component, title\n set_current_component\n set_form_row ## FFI added 2011-09-12 to get cursor at start when adding\n $log.debug \" ADD got cb : #{@current_component} \"\n end", "def scroll_up()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.SplitsComponent_scroll_up(@handle.ptr)\n end", "def test_default\n w = Window_Selectable_Implemented.new(0,0,160,128,$data_items.compact)\n @windows.push(w)\n end", "def pick_game_element\n @level.add_mouse(@input_controller.mouse_screen_coords)\n end" ]
[ "0.5934024", "0.58491117", "0.57798165", "0.5734739", "0.5547285", "0.55358326", "0.54540944", "0.54123014", "0.5362697", "0.5359288", "0.5346858", "0.5331006", "0.5304069", "0.52547014", "0.52547014", "0.5254105", "0.5228458", "0.51974076", "0.51938343", "0.5189093", "0.51879823", "0.517799", "0.51758814", "0.5172747", "0.5172229", "0.51629543", "0.5156719", "0.5154052", "0.5148442", "0.5145075", "0.5141364", "0.5133123", "0.51324636", "0.512755", "0.51214755", "0.5118758", "0.5099393", "0.5094597", "0.5087436", "0.5082959", "0.50804806", "0.5076662", "0.50728476", "0.50707924", "0.50689346", "0.50645196", "0.5063556", "0.5063071", "0.5055512", "0.50451565", "0.50441635", "0.5037572", "0.50373787", "0.5034346", "0.50331753", "0.50242573", "0.50146204", "0.50113547", "0.5006643", "0.5004648", "0.49777335", "0.49761903", "0.49746636", "0.4964339", "0.49621245", "0.49616513", "0.49554214", "0.49520135", "0.49489373", "0.49475855", "0.4945946", "0.4941728", "0.49397862", "0.49377465", "0.49370918", "0.4929127", "0.49219838", "0.4914662", "0.49072522", "0.48994684", "0.48932612", "0.48917776", "0.48902932", "0.4888425", "0.48882154", "0.48870406", "0.48869896", "0.48807096", "0.48766124", "0.48724774", "0.4871718", "0.48695683", "0.48583913", "0.48520228", "0.485107", "0.48486516", "0.48467675", "0.4846387", "0.48456377", "0.48431844", "0.484257" ]
0.0
-1
compare parent and child, recursively checking up the tree
def parent_compare(child, parent) unless parent.nil? if child.rating < parent.rating swap(child, parent) parent_compare(child, child.parent) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_compare(child, parent)\n\t\tunless parent.nil?\n\t\t\tif child.value < parent.value\n\t\t\t\tswap(child, parent)\n\t\t\t\tparent_compare(child, child.parent)\n\t\t\tend \n\t\tend\n\tend", "def child_compare(parent)\n\t\tunless parent.nil?\n\t\t\tif parent.left.nil? && parent.right.nil?\n\t\t\t\tnil\n\t\t\telsif parent.right.nil?\n\t\t\t\tif parent.value > parent.left.value\n\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\tend\n\t\t\telse\t\t\n\t\t\t\tif parent.value > parent.left.value || parent.value > parent.right.value\n\t\t\t\t\tif parent.left.value < parent.right.value\n\t\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\t\t\tchild_compare(parent.left)\n\t\t\t\t\telse\n\t\t\t\t\t\tswap(parent.right, parent)\n\t\t\t\t\t\tchild_compare(parent.right)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def child_compare(parent)\n\t\tunless parent.nil?\n\t\t\tif parent.left.nil? && parent.right.nil?\n\t\t\t\tnil\n\t\t\telsif parent.right.nil?\n\t\t\t\tif parent.rating > parent.left.rating\n\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\tend\n\t\t\telse\t\t\n\t\t\t\tif parent.rating > parent.left.rating || parent.rating > parent.right.rating\n\t\t\t\t\tif parent.left.rating < parent.right.rating\n\t\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\t\t\tchild_compare(parent.left)\n\t\t\t\t\telse\n\t\t\t\t\t\tswap(parent.right, parent)\n\t\t\t\t\t\tchild_compare(parent.right)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def tree_equal?(other)\n self == other && children == other.children\n end", "def child_of?(parent); end", "def is_parent_greater_than_child(index, parent)\n @tree[parent].rating > @tree[index].rating\n end", "def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end", "def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end", "def child? \n parent_id = self[acts_as_nested_set_options[:parent_column]]\n !(parent_id == 0 || parent_id.nil?) && (self[acts_as_nested_set_options[:left_column]] > 1) && (self[acts_as_nested_set_options[:right_column]] > self[acts_as_nested_set_options[:left_column]])\n end", "def child_check(level, child_data, local_nesting, expected, match_value)\n matched = child_data.select do |item|\n nest_match_attributes(item, local_nesting, expected, match_value)\n end\n level[:comparison].compare(matched.count)\nend", "def child?\n parent_id = self[nested_set_parent]\n !(parent_id == 0 || parent_id.nil?) && (self[nested_set_left] > 1) && (self[nested_set_right] > self[nested_set_left])\n end", "def is_same_tree(p, q)\n\tif (p == nil) ^ (q == nil) \n\t\treturn false\n\tend\n\tq1 = []\n\tq2 = []\n\tq1.push p\n\tq2.push q\n\twhile q1 != [] and q2 != []\n\t\tc1 = q1.shift\n\t\tc2 = q2.shift\n\t\tif c1 == nil and c2 == nil\n\t\telsif (c1 == nil) ^ (c2 == nil)\n\t\t\treturn false\n\t\telsif c1.val != c2.val\n\t\t\treturn false\n\t\telse\n\t\t\tq1.push c1.left\n\t\t\tq1.push c1.right\n\t\t\tq2.push c2.left\n\t\t\tq2.push c2.right\n\t\tend\n\tend\n\tif q1 != [] or q2 != []\n\t\treturn false\n\tend\n\treturn true\n \nend", "def test_parent\n setup_test_tree\n\n assert_nil(@root.parent, \"Root's parent should be nil\")\n assert_equal(@root, @child1.parent, \"Parent should be root\")\n assert_equal(@root, @child3.parent, \"Parent should be root\")\n assert_equal(@child3, @child4.parent, \"Parent should be child3\")\n assert_equal(@root, @child4.parent.parent, \"Parent should be root\")\n end", "def is_same_tree(p, q)\n return true if p == nil && q == nil\n return false if p == nil || q == nil\n return false if q.val != p.val\n is_same_tree(p.left, q.left) && is_same_tree(p.right, q.right)\nend", "def is_child_of?(_parent)\n return false if (self == _parent) or self.root?\n _parent == self.parent\n end", "def is_same_tree(p, q)\n return true if p.nil? && q.nil?\n return false if p.nil? || q.nil? || p.val != q.val\n return is_same_tree(p.left, q.left) && is_same_tree(p.right, q.right)\nend", "def verify_parent_is_not_descendant\n unless self[tree_parent_id_field].nil?\n errors.add(:base, I18n.t(:cyclic, :scope => [:mongo_mapper, :errors, :messages, :tree])) if self.descendants.include?(parent)\n end\n end", "def test_parentage\n setup_test_tree\n\n assert_nil(@root.parentage, \"Root does not have any parentage\")\n assert_equal([@root], @child1.parentage, \"Child1 has Root as its parent\")\n assert_equal([@child3, @root], @child4.parentage, \"Child4 has Child3 and Root as ancestors\")\n end", "def hasChildren\n if (@left == nil) && (@right == nil)\n return 0\n elsif (@left != nil) && (@right != nil)\n return 2\n else\n return 1\n end\n end", "def heap_down(parentIndex)\n # compare node @ parentIndex to its children\n # if parent <= both children, min heap :-) base case\n # if parent > either/both child, swap places with the smaller child, then min_heap_down(childIndex), recursion!\n # when no more children to compare to, base case :-)\n \n # first find out if parent has LC or RC\n indexLC = parentIndex * 2 + 1 \n indexRC = indexLC + 1\n \n if @store.length > indexRC\n # both LC & RC exist, need to compare with both children\n if (@store[parentIndex].key > @store[indexLC].key) && (@store[parentIndex].key > @store[indexRC].key)\n # both LC & RC broke the heap property, which one is smaller?\n @store[indexLC].key > @store[indexRC].key ? (indexOfSmallerChild = indexRC) : (indexOfSmallerChild = indexLC)\n swap(parentIndex, indexOfSmallerChild)\n heap_down(indexOfSmallerChild)\n \n elsif @store[parentIndex].key > @store[indexLC].key\n # only LC broke the heap property\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n \n elsif @store[parentIndex].key > @store[indexRC].key\n # only RC broke the heap property\n swap(parentIndex, indexRC)\n heap_down(indexRC)\n \n else \n # both children are bigger than parent -> min heap :-) base case\n return\n end\n \n elsif @store.length > indexLC\n # only LC exists\n if @store[parentIndex].key <= @store[indexLC].key\n # min heap :-) base case\n return \n else\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n end\n \n else\n # no children, base case\n return\n end\n end", "def check_children(value, node)\n if value < node.value\n node.left\n else\n node.right\n end\n end", "def is_leaf?\n self.left_child == nil and\n self.right_child == nil\n end", "def check_invariants()\n index = 0\n left = index*2+1\n right = index*2+2\n\n while (left < @ary.size)\n if @ary[left].key < @ary[index].key\n raise \"Smaller left child with parent index=#{index} and value=#{@ary[index].key} and left child #{@ary[left].key}\"\n end\n\n if (right < @ary.size) && @ary[right].key < @ary[index].key\n raise \"Smaller right child with parent index=#{index} and value=#{@ary[index].key} and right child #{@ary[right].key}\"\n end\n\n index = index + 1\n left = index*2+1\n right = index*2+2\n\n end\n end", "def parent?\n !children.empty?\n end", "def identical?(node1, node2)\n if node1.nil? || node2.nil?\n return false\n elsif node1.value != node2.value\n return false\n elsif node1.left_child.nil? && node2.left_child.nil? && node1.right_child.nil? && node2.right_child.nil?\n return true\n else\n left_identical = identical?(node1.left_child, node2.left_child)\n right_identical = identical?(node1.right_child, node2.right_child)\n return left_identical && right_identical\n end\nend", "def is_child?\n !is_parent?\n end", "def as_child(parent)\n x = self\n return x if x == parent \n while x.parent and x.parent != parent\n x = x.parent\n end\n if x.parent == parent\n x\n end\n end", "def common_ancestor(p , q)\n diff = depth(p) - depth(q)\n deep = diff > 0 ? p : q\n shallow = diff > 0 ? q : p\n deep = moveUp(deep, diff.abs)\n\n while deep != shallow && shallow != nil && deep != nil\n shallow = shallow.parent\n deep = deep.parent\n end\n\n if shallow == nil || deep == nil\n return nil\n else\n return shallow\n end\nend", "def child_check\n if @children.nil? or @children.empty?\n get_children unless @already_fetched_children\n @already_fetched_children = true\n end\n end", "def touch?( other )\n\t\tcommon_leaves = [ ]\n\t\tother.leaves.each do |leaf|\n\t\t\[email protected]?(leaf) and common_leaves << leaf\n\t\tend\n\t\tif common_leaves.size > 0\n\t\t\tcommon_leaves.first\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def validate_up\n index_in_parent_assert\n parent.validate_up\n ui.puts \"#{indent}ok child is in parent (#{short} in #{parent.short})\"\n end", "def check_subtree(tree1, tree2)\n # due to the depth of T1 being much larger than T2 a BFS seems more logical\n bfs(tree1.head, tree2,head)\nend", "def child_of?(parent, scope = {})\n if !scope.empty? && parent.respond_to?(:child_by_id)\n parent.child_by_id(self.id, scope).is_a?(self.class)\n else\n parent.respond_to?(left_col_name) && self[left_col_name] > parent[left_col_name] && self[right_col_name] < parent[right_col_name]\n end\n end", "def is_only_child?\n return false if parent.nil? # root\n 1 == parent.children.size\n end", "def asgn_left?\n OP_ASSIGN.include?(parent_type) && parent.node.children.first.equal?(node)\n end", "def ==(obj)\n self.class.name == obj.class.name && children == obj.children\n end", "def == other\n self.class == other.class and\n @parent == other.parent and\n @name == other.name\n end", "def hasParent?(node)\n if node.parent != nil\n true\n else\n false\n end\nend", "def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end", "def inorder(node)\n if node.left_child\n inorder(node.left_child)\n end\n puts node.value\n if node.right_child\n inorder(node.right_child)\n end\nend", "def validate_parent_instance_node(instance_node, _child_node)\n !node_validations.collect do |node_validation|\n node_validation.validate_instance_node(instance_node, self)\n end.include?(false)\n end", "def find_lca_with_parents(node1, node2)\n one = depth(node1)\n two = depth(node2)\n\n diff = (one - two).abs\n\n if one > two\n diff.times do |i|\n two = two.parent\n end\n else\n diff.times do |i|\n one = one.parent\n end\n end\n\n\n until one == two\n one = one.parent\n two = two.parent\n end\n\n two\nend", "def verify\n 1.upto(@leaf_count - 1) do |node|\n next if @nodes[node] ==\n HashTree.node_hash(node, @nodes[HashTree.left_child(node)],\n @nodes[HashTree.right_child(node)])\n raise \"Tree integrity verification failed\" \n end\n self\n end", "def < other_node\n return true if other_node.nil?\n\n self.val < other_node.val && self < other_node.left && self < other_node.right\n end", "def has_changed_parent?\n self.parent_id_changed?\n end", "def parent?(id)\n self.parent_id == id\n end", "def is_sibling_of?(other)\n (other != self) and (other[tree_parent_id_field] == self[tree_parent_id_field])\n end", "def is_parent_of?(_child)\n return false if self == _child\n _child.is_child_of?(self)\n end", "def check_subtree(t1, t2)\n # Pre-compute sizes of each subtree in t1 and t2\n t1_sizes = compute_subtree_sizes(t1)\n t2_sizes = compute_subtree_sizes(t2)\n\n # Check if t2 is subtree of t1\n check_subtree_helper(t1, t2, t1_sizes, t2_sizes)\nend", "def is_ancestor_of?(other)\n other[tree_path_field].include?(self._id)\n end", "def is_descendant_of?(_parent)\n return false if (self == _parent) or self.root?\n verify_parent = self # start with beeing self\n while !verify_parent.root? do\n verify_parent = verify_parent.parent\n return true if _parent == verify_parent\n end\n false\n end", "def has_parent?\n !root?\n end", "def check_children(ast)\n check_has_only_assoc_children ast\n ast.children.each do |child_ast|\n check_assoc_child_has_two_children child_ast\n end\n end", "def sibling_of?(node)\n self.read_attribute(self.ancestry_base_class.ancestry_column) == node.read_attribute(self.ancestry_base_class.ancestry_column)\n end", "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end", "def child?\n !_parent_id.nil?\n end", "def parent_correct?(id,parent)\n p __method__ if @debug == true\n\n # get the suggested pathname .. using the pathname library here.\n path = Pathname.new(id).dirname\n\n # get the parent ci from the rest interface\n xml = RestClient.get \"#{@base_url}/ci/#{path}\", {:accept => :xml, :content_type => :xml}\n\n # get the parent type from the xml\n parenttype = XmlSimple.xml_in(xml,{'KeepRoot' => true}).keys.to_s\n # check if the actual parenttype is among the valid ones\n return true if parent.include? parenttype\n\n return false\n end", "def has_one_child\n if self.left_child.nil? && !self.right_child.nil?\n self.right_child\n elsif !self.left_child.nil? && self.right_child.nil?\n self.left_child\n else\n nil\n end\n end", "def isLeftChild?\r\n return nil if isRoot?\r\n self == parent.leftChild\r\n end", "def same_parent?(other)\n same_scope?(other) && parent_id == other.ordered_tree_node.parent_id\n end", "def changed?\n !!parent\n end", "def find_parent(value, tree_node = @root)\n return nil if @root.value == value \n # puts \"tree_node.value\", tree_node.value\n # puts \"tree_node.left.value\", tree_node.left.value\n # puts \"tree_node.right.value\", tree_node.right.value\n return tree_node if tree_node.left.value == value || tree_node.right.value == value \n\n if tree_node.value > value \n tree_node = tree_node.left\n find_parent(value, tree_node)\n else\n tree_node = tree_node.right\n find_parent(value,tree_node)\n end \n\n end", "def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end", "def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end", "def ancestors_traverse(tree, item, &block)\n x = nil # sub-tree object containing node to be located\n parent = nil # sub-tree object - parent of x, or soon its successor\n found = false\n\n found, x, parent = bst_search(tree, item)\n\n return false if ! found # no point in going further\n\n locator = tree\n parent = nil\n found = false\n\n while( !found && locator)\n if item.data < locator.node.data\n # descend left\n block.call(locator)\n parent = locator\n locator = locator.left_child\n elsif item.data > locator.node.data\n # descend right\n block.call(locator)\n parent = locator\n locator = locator.right_child\n else\n found = true\n end\n end\n return found\n end", "def has_childs\n access = Access.where(:parent_id=>id).first\n if access.blank?\n return false\n else\n return true\n end\n end", "def is_immediate_parent?( parent_hash )\n \n is_parent = false\n\n @parents.each { |this_parent| break if is_parent = this_parent.equal?( parent_hash ) }\n \n return is_parent\n \n end", "def node_and_parent_same_text?(node)\n node.parent.text.strip == node.text.strip\n end", "def is_a_leaf?\n self.left_child.nil? && self.right_child.nil?\n end", "def has_parent?\n parent_id != nil\n end", "def child?\n !root?\n end", "def child?\n !root?\n end", "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend", "def is_descendant_of?(other)\n self[tree_path_field].include?(other._id)\n end", "def check_subtree(small, large)\n start_node = bsearch(large.root, small.root.value)\n return false if start_node.nil?\n traverse_in_order(small.root) == traverse_in_order(start_node)\nend", "def convertable?(node)\n while(node = node.parent) do\n return false if SKIP.include?(node.name)\n end\n true\n end", "def rec_contains_cycle(slow, fast_parent)\n return false if !slow or !fast_parent \n if (slow == fast_parent.left or slow == fast_parent.right)\n return is_ancestor(slow, fast_parent) \n return true\n end\n if fast_parent.left\n if (rec_contains_cycle(slow.left, fast_parent.left.left) or \n rec_contains_cycle(slow.left, fast_parent.left.right) or\n rec_contains_cycle(slow.right, fast_parent.left.left) or \n rec_contains_cycle(slow.right, fast_parent.left.right)) then\n return true\n end\n end\n if fast_parent.right\n if (rec_contains_cycle(slow.left, fast_parent.right.left) or \n rec_contains_cycle(slow.left, fast_parent.right.right) or\n rec_contains_cycle(slow.right, fast_parent.right.left) or \n rec_contains_cycle(slow.right, fast_parent.right.right)) then\n return true\n end\n end\n false \nend", "def direct_child_of?(parent, scope = {})\n if !scope.empty? && parent.respond_to?(:direct_child_by_id)\n parent.direct_child_by_id(self.id, scope).is_a?(self.class)\n else\n parent.respond_to?(parent_col_name) && self[parent_col_name] == parent.id\n end\n end", "def is_subtree(root)\n\nend", "def == other_tree\n one = []\n two = []\n each { |node| one << node }\n other_tree.each { |node| two << node }\n one == two\n end", "def include?(proof)\n root = acc[proof.siblings.length]\n n = proof.payload\n proof.siblings.each_with_index do |sibling, height|\n if ((1<<height) & proof.position) == 0\n n = Utreexo.parent(n, sibling)\n else\n n = Utreexo.parent(sibling, n)\n end\n end\n n == root\n end", "def has_parent?\n !parent.nil?\n end", "def test_movie_valid_parent\n movie = Movie.find( movies(:king_kong).id )\n parent = Movie.find( movies(:batman_series).id )\n movie.parent = parent\n assert movie.save\n assert_equal( 2, parent.children.size )\n end", "def parent?(node, maybe_child = nil)\n if maybe_child.nil?\n !offsprings(node).empty?\n else\n offsprings(node).include? maybe_child\n end\n end", "def item_check(tree)\n if tree[0] == nil\n tree[1]\n else\n tree[1] + item_check(tree[0]) - item_check(tree[2])\n end\nend", "def ar_verify_parent_resource\r\n parent= ardata.parent_resources.select { |res| res.model == @parent_resource.class }\r\n \r\n real_parent= @resource.send(parent.first.singular)\r\n \r\n if @parent_resource.to_param != real_parent.to_param\r\n @parent_resource= real_parent\r\n ar_set_parent_instance_var if @parent_resource\r\n end\r\n end", "def test_remove_from_parent_bang\n setup_test_tree\n\n assert(@root.has_children?, \"Should have children\")\n assert([email protected]_leaf?, \"Root is not a leaf here\")\n\n child1 = @root[0]\n assert_not_nil(child1, \"Child 1 should exist\")\n assert_same(@root, child1.root, \"Child 1's root should be ROOT\")\n assert(@root.include?(child1), \"root should have child1\")\n child1.remove_from_parent!\n assert_same(child1, child1.root, \"Child 1's root should be self\")\n assert([email protected]?(child1), \"root should not have child1\")\n\n child1.remove_from_parent!\n assert_same(child1, child1.root, \"Child 1's root should still be self\")\n end", "def filter_up(element)\n element_index = @tree.index(element)\n parent = element_index / 2\n element_is_greater_than_child = @tree[parent] && @tree[parent].rating > element.rating\n while element_is_greater_than_child\n swap_node_position(@tree[parent], element)\n parent = element_index / 2\n element_is_greater_than_child = @tree[parent] && @tree[parent].rating > element.rating\n end\n end", "def has_xor_parents?(a, b)\n a.parents != b.parents && !(a.parents & b.parents).empty?\n end", "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend", "def verify_details(parent, child, field, name)\n if parent[field] == child[field]\n puts \"\\t#{field.to_s} matches for #{name} on both results page and internal page\"\n else\n puts \"\\t#{field.to_s} does not match for #{name} on results page vs internal page\"\n end\n end", "def valid_tree(current_node)\n return true if current_node.nil?\n\n return false if current_node.left != nil && current_node.left.key > current_node.key\n\n return false if current_node.right != nil && current_node.right.key < current_node.key\n\n return valid_tree(current_node.right) && valid_tree(current_node.left)\n end", "def sort_children\n @children.sort! do |a, b|\n if (a.leaf? && b.leaf?) || (!a.leaf? && !b.leaf?)\n a.name <=> b.name\n elsif a.leaf? && !b.leaf?\n -1\n else\n 1\n end\n end\n @children.each(&:sort_children)\n end", "def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend", "def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end", "def child?\n !root?\n end", "def test_left_child\n @root << @left_child1\n @root << @right_child1\n assert_same(@left_child1, @root.left_child, \"The left child should be 'left_child1\")\n assert_not_same(@right_child1, @root.left_child, \"The right_child1 is not the left child\")\n end", "def test_sort_by_ancestry_missing_parent_middle_of_tree\n AncestryTestDatabase.with_model do |model|\n n1, _, _, n4, n5, _ = build_tree(model)\n\n records = model.sort_by_ancestry([n5, n4, n1])\n if CORRECT\n assert_equal [n1, n4, n5].map(&:id), records.map(&:id)\n else\n assert_equal [n1, n5, n4].map(&:id), records.map(&:id)\n end\n end\n end", "def bst_search(tree, node)\n locator = tree\n parent = nil\n found = false\n while( !found && locator)\n if node.data < locator.node.data\n # descend left\n parent = locator\n locator = locator.left_child\n elsif node.data > locator.node.data\n # descend right\n parent = locator\n locator = locator.right_child\n else\n found = true\n end\n end\n return found, locator, parent\n end", "def common_ancestor(node1, node2)\n depth1 = find_depth(node1)\n depth2 = find_depth(node2)\n\n if(depth1 >= depth2)\n long_depth = depth1\n short_depth = depth2\n long_node = node1\n short_node = node2\n else\n long_depth = depth2\n short_depth = depth1\n long_node = node2\n short_node = node1\n end\n\n until(long_depth == short_depth)\n long_node = long_node.parent\n long_depth -= 1\n end\n\n return simul_parents(short_node, long_node)\n\nend" ]
[ "0.7698191", "0.76954085", "0.73967916", "0.6939286", "0.6810775", "0.6622524", "0.64040846", "0.64040846", "0.6366886", "0.6350879", "0.632821", "0.6301763", "0.6298614", "0.62883073", "0.6266008", "0.62332404", "0.6211303", "0.61859876", "0.6176367", "0.611656", "0.6078743", "0.60708374", "0.60404897", "0.6035074", "0.60248554", "0.6001745", "0.5969249", "0.5929797", "0.5917605", "0.58978295", "0.58884823", "0.58752763", "0.587258", "0.5858447", "0.5852394", "0.581822", "0.58085907", "0.5806051", "0.5798954", "0.57972", "0.5788845", "0.5787812", "0.5787227", "0.5784253", "0.57812023", "0.5780838", "0.57726836", "0.5762556", "0.57470196", "0.57462436", "0.5742618", "0.57417", "0.5735752", "0.5733205", "0.57278275", "0.5723024", "0.57177484", "0.5716481", "0.57114494", "0.57031506", "0.57027084", "0.56994355", "0.56938356", "0.56938356", "0.56818604", "0.56791985", "0.5675744", "0.56748176", "0.5673997", "0.5672222", "0.56645554", "0.56645554", "0.5663328", "0.5659151", "0.56570476", "0.5653305", "0.5639341", "0.56342906", "0.56106126", "0.5609242", "0.5603659", "0.5595013", "0.5579941", "0.5577347", "0.55761933", "0.5574066", "0.5573166", "0.55729914", "0.5568556", "0.5560918", "0.55606836", "0.5549909", "0.5549288", "0.5547223", "0.554658", "0.5542371", "0.5535306", "0.5531537", "0.5528247", "0.55248666" ]
0.72217125
3
compare parent to both left, right kids, recursively checking down the tree
def child_compare(parent) unless parent.nil? if parent.left.nil? && parent.right.nil? nil elsif parent.right.nil? if parent.rating > parent.left.rating swap(parent.left, parent) end else if parent.rating > parent.left.rating || parent.rating > parent.right.rating if parent.left.rating < parent.right.rating swap(parent.left, parent) child_compare(parent.left) else swap(parent.right, parent) child_compare(parent.right) end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_compare(parent)\n\t\tunless parent.nil?\n\t\t\tif parent.left.nil? && parent.right.nil?\n\t\t\t\tnil\n\t\t\telsif parent.right.nil?\n\t\t\t\tif parent.value > parent.left.value\n\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\tend\n\t\t\telse\t\t\n\t\t\t\tif parent.value > parent.left.value || parent.value > parent.right.value\n\t\t\t\t\tif parent.left.value < parent.right.value\n\t\t\t\t\t\tswap(parent.left, parent)\n\t\t\t\t\t\tchild_compare(parent.left)\n\t\t\t\t\telse\n\t\t\t\t\t\tswap(parent.right, parent)\n\t\t\t\t\t\tchild_compare(parent.right)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def parent_compare(child, parent)\n\t\tunless parent.nil?\n\t\t\tif child.rating < parent.rating\n\t\t\t\tswap(child, parent)\n\t\t\t\tparent_compare(child, child.parent)\n\t\t\tend \n\t\tend\n\tend", "def parent_compare(child, parent)\n\t\tunless parent.nil?\n\t\t\tif child.value < parent.value\n\t\t\t\tswap(child, parent)\n\t\t\t\tparent_compare(child, child.parent)\n\t\t\tend \n\t\tend\n\tend", "def asgn_left?\n OP_ASSIGN.include?(parent_type) && parent.node.children.first.equal?(node)\n end", "def is_same_tree(p, q)\n\tif (p == nil) ^ (q == nil) \n\t\treturn false\n\tend\n\tq1 = []\n\tq2 = []\n\tq1.push p\n\tq2.push q\n\twhile q1 != [] and q2 != []\n\t\tc1 = q1.shift\n\t\tc2 = q2.shift\n\t\tif c1 == nil and c2 == nil\n\t\telsif (c1 == nil) ^ (c2 == nil)\n\t\t\treturn false\n\t\telsif c1.val != c2.val\n\t\t\treturn false\n\t\telse\n\t\t\tq1.push c1.left\n\t\t\tq1.push c1.right\n\t\t\tq2.push c2.left\n\t\t\tq2.push c2.right\n\t\tend\n\tend\n\tif q1 != [] or q2 != []\n\t\treturn false\n\tend\n\treturn true\n \nend", "def rec_contains_cycle(slow, fast_parent)\n return false if !slow or !fast_parent \n if (slow == fast_parent.left or slow == fast_parent.right)\n return is_ancestor(slow, fast_parent) \n return true\n end\n if fast_parent.left\n if (rec_contains_cycle(slow.left, fast_parent.left.left) or \n rec_contains_cycle(slow.left, fast_parent.left.right) or\n rec_contains_cycle(slow.right, fast_parent.left.left) or \n rec_contains_cycle(slow.right, fast_parent.left.right)) then\n return true\n end\n end\n if fast_parent.right\n if (rec_contains_cycle(slow.left, fast_parent.right.left) or \n rec_contains_cycle(slow.left, fast_parent.right.right) or\n rec_contains_cycle(slow.right, fast_parent.right.left) or \n rec_contains_cycle(slow.right, fast_parent.right.right)) then\n return true\n end\n end\n false \nend", "def is_same_tree(p, q)\n return true if p == nil && q == nil\n return false if p == nil || q == nil\n return false if q.val != p.val\n is_same_tree(p.left, q.left) && is_same_tree(p.right, q.right)\nend", "def leaf?\n right - left == 1\n end", "def is_same_tree(p, q)\n return true if p.nil? && q.nil?\n return false if p.nil? || q.nil? || p.val != q.val\n return is_same_tree(p.left, q.left) && is_same_tree(p.right, q.right)\nend", "def is_leaf?\n self.left_child == nil and\n self.right_child == nil\n end", "def hasChildren\n if (@left == nil) && (@right == nil)\n return 0\n elsif (@left != nil) && (@right != nil)\n return 2\n else\n return 1\n end\n end", "def leaf?\n left.nil? && right.nil?\n end", "def heap_down(parentIndex)\n # compare node @ parentIndex to its children\n # if parent <= both children, min heap :-) base case\n # if parent > either/both child, swap places with the smaller child, then min_heap_down(childIndex), recursion!\n # when no more children to compare to, base case :-)\n \n # first find out if parent has LC or RC\n indexLC = parentIndex * 2 + 1 \n indexRC = indexLC + 1\n \n if @store.length > indexRC\n # both LC & RC exist, need to compare with both children\n if (@store[parentIndex].key > @store[indexLC].key) && (@store[parentIndex].key > @store[indexRC].key)\n # both LC & RC broke the heap property, which one is smaller?\n @store[indexLC].key > @store[indexRC].key ? (indexOfSmallerChild = indexRC) : (indexOfSmallerChild = indexLC)\n swap(parentIndex, indexOfSmallerChild)\n heap_down(indexOfSmallerChild)\n \n elsif @store[parentIndex].key > @store[indexLC].key\n # only LC broke the heap property\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n \n elsif @store[parentIndex].key > @store[indexRC].key\n # only RC broke the heap property\n swap(parentIndex, indexRC)\n heap_down(indexRC)\n \n else \n # both children are bigger than parent -> min heap :-) base case\n return\n end\n \n elsif @store.length > indexLC\n # only LC exists\n if @store[parentIndex].key <= @store[indexLC].key\n # min heap :-) base case\n return \n else\n swap(parentIndex, indexLC)\n heap_down(indexLC)\n end\n \n else\n # no children, base case\n return\n end\n end", "def same_parent?(other)\n same_scope?(other) && parent_id == other.ordered_tree_node.parent_id\n end", "def is_parent_greater_than_child(index, parent)\n @tree[parent].rating > @tree[index].rating\n end", "def find_lca_with_parents(node1, node2)\n one = depth(node1)\n two = depth(node2)\n\n diff = (one - two).abs\n\n if one > two\n diff.times do |i|\n two = two.parent\n end\n else\n diff.times do |i|\n one = one.parent\n end\n end\n\n\n until one == two\n one = one.parent\n two = two.parent\n end\n\n two\nend", "def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end", "def root?\n parent_id = self[parent_col_name]\n (parent_id == 0 || parent_id.nil?) && self[right_col_name] && self[left_col_name] && (self[right_col_name] > self[left_col_name])\n end", "def < other_node\n return true if other_node.nil?\n\n self.val < other_node.val && self < other_node.left && self < other_node.right\n end", "def tree_equal?(other)\n self == other && children == other.children\n end", "def find_parent(current_node, key)\n return nil if current_node.nil?\n\n if current_node.left && (current_node.left.key == key) || current_node.right && (current_node.right.key == key)\n return current_node\n end\n\n if key < current_node.key\n current_node = find_parent(current_node.left, key)\n else\n current_node = find_parent(current_node.right, key)\n end\n end", "def left_right(key, node)\n case child_count(node)\n when 1\n node.left.nil? ? node.right : node.left\n when 2\n node.data > key ? node.left : node.right\n end\n end", "def child_of?(parent); end", "def valid_tree(current_node)\n return true if current_node.nil?\n\n return false if current_node.left != nil && current_node.left.key > current_node.key\n\n return false if current_node.right != nil && current_node.right.key < current_node.key\n\n return valid_tree(current_node.right) && valid_tree(current_node.left)\n end", "def left_child?(node_id)\n (node_id & 1) == 0 # node_id % 2 == 0\n end", "def child? \n parent_id = self[acts_as_nested_set_options[:parent_column]]\n !(parent_id == 0 || parent_id.nil?) && (self[acts_as_nested_set_options[:left_column]] > 1) && (self[acts_as_nested_set_options[:right_column]] > self[acts_as_nested_set_options[:left_column]])\n end", "def root?\n parent_id = self[nested_set_parent]\n (parent_id == 0 || parent_id.nil?) && (self[nested_set_left] == 1) && (self[nested_set_right] > self[nested_set_left])\n end", "def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end", "def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end", "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end", "def child?\n parent_id = self[nested_set_parent]\n !(parent_id == 0 || parent_id.nil?) && (self[nested_set_left] > 1) && (self[nested_set_right] > self[nested_set_left])\n end", "def child_of?(parent, scope = {})\n if !scope.empty? && parent.respond_to?(:child_by_id)\n parent.child_by_id(self.id, scope).is_a?(self.class)\n else\n parent.respond_to?(left_col_name) && self[left_col_name] > parent[left_col_name] && self[right_col_name] < parent[right_col_name]\n end\n end", "def ancestors(node, key)\n if node.nil?\n return false\n elsif node.value == key\n return true\n end\n\n if ancestors(node.left_child, key) || ancestors(node.right_child, key)\n puts node.value\n return true\n else\n return false\n end\nend", "def isLeftChild?\r\n return nil if isRoot?\r\n self == parent.leftChild\r\n end", "def compare(context, left, right)\n return compare_with_node_set(\n context, left.to_node_set(context), right) if left.node_set?\n return compare_with_node_set(\n context, right.to_node_set(context), left, reverse: true) if right.node_set?\n do_compare(left, right)\n end", "def find_parent(root, data)\n return root if root.id == data.id / 2\n\n ltree = !root.left.nil? ? find_parent(root.left, data) : nil\n return ltree unless ltree.nil?\n\n !root.right.nil? ? find_parent(root.right, data) : nil\n end", "def common_ancestor(p , q)\n diff = depth(p) - depth(q)\n deep = diff > 0 ? p : q\n shallow = diff > 0 ? q : p\n deep = moveUp(deep, diff.abs)\n\n while deep != shallow && shallow != nil && deep != nil\n shallow = shallow.parent\n deep = deep.parent\n end\n\n if shallow == nil || deep == nil\n return nil\n else\n return shallow\n end\nend", "def root?\n parent_id = self[acts_as_nested_set_options[:parent_column]]\n (parent_id == 0 || parent_id.nil?) && (self[acts_as_nested_set_options[:left_column]] == 1) && (self[acts_as_nested_set_options[:right_column]] > self[acts_as_nested_set_options[:left_column]])\n end", "def findParent(root, data, parent=true)\n if root.title == data\n # base case, data matches\n return parent\n else\n if root.left\n left = findParent(root.left, data, root)\n end\n if root.right\n right = findParent(root.right, data, root)\n end\n if left\n return left\n elsif right\n return right\n else\n # no match found toward the left or the right\n return nil\n end\n end\n end", "def find_parent(key, node = root)\n return nil if node.nil?\n key = find(key) if !key.is_a? Node\n if node.left == key || node.right == key\n return node\n else\n find_parent(key, left_right(key.data, node))\n end\n end", "def prune_from_tree\n return if self.right.nil? || self.left.nil?\n diff = self.right - self.left + 1\n\n #TODO: implemente :dependent option\n # delete_method = acts_as_nested_set_options[:dependent] == :destroy ?\n # :destroy_all : :delete_all\n\n #TODO: implement prune method\n # self.class.base_class.transaction do\n # nested_set_scope.send(delete_method,\n # [\"#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?\",\n # left, right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)\", diff],\n # [\"#{quoted_left_column_name} >= ?\", right]\n # )\n # nested_set_scope.update_all(\n # [\"#{quoted_right_column_name} = (#{quoted_right_column_name} - ?)\", diff],\n # [\"#{quoted_right_column_name} >= ?\", right]\n # )\n # end\n end", "def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end", "def leaf?\n persisted? && right.to_i - left.to_i == 1\n end", "def check_invariants()\n index = 0\n left = index*2+1\n right = index*2+2\n\n while (left < @ary.size)\n if @ary[left].key < @ary[index].key\n raise \"Smaller left child with parent index=#{index} and value=#{@ary[index].key} and left child #{@ary[left].key}\"\n end\n\n if (right < @ary.size) && @ary[right].key < @ary[index].key\n raise \"Smaller right child with parent index=#{index} and value=#{@ary[index].key} and right child #{@ary[right].key}\"\n end\n\n index = index + 1\n left = index*2+1\n right = index*2+2\n\n end\n end", "def find_parent(value, tree_node = @root)\n return nil if @root.value == value \n # puts \"tree_node.value\", tree_node.value\n # puts \"tree_node.left.value\", tree_node.left.value\n # puts \"tree_node.right.value\", tree_node.right.value\n return tree_node if tree_node.left.value == value || tree_node.right.value == value \n\n if tree_node.value > value \n tree_node = tree_node.left\n find_parent(value, tree_node)\n else\n tree_node = tree_node.right\n find_parent(value,tree_node)\n end \n\n end", "def is_a_leaf?\n self.left_child.nil? && self.right_child.nil?\n end", "def parent(node)\n value = node.value\n parent_node = nil\n current_node = @root\n while (current_node)\n if value > current_node.value\n parent_node = current_node #always keep a pointer to the parent\n #before traversing down\n current_node = current_node.right\n elsif value < current_node.value\n parent_node = current_node\n current_node = current_node.left\n else\n return parent_node\n end\n end\n nil\n end", "def rotateWithRightChild(k1)\n # puts \"Checking the data for rotateWithRightChild #{k1.data}\"\n k2 = k1.right\n k1.right = k2.left\n k2.left = k1\n return k2\n end", "def test_parent\n setup_test_tree\n\n assert_nil(@root.parent, \"Root's parent should be nil\")\n assert_equal(@root, @child1.parent, \"Parent should be root\")\n assert_equal(@root, @child3.parent, \"Parent should be root\")\n assert_equal(@child3, @child4.parent, \"Parent should be child3\")\n assert_equal(@root, @child4.parent.parent, \"Parent should be root\")\n end", "def identical?(node1, node2)\n if node1.nil? || node2.nil?\n return false\n elsif node1.value != node2.value\n return false\n elsif node1.left_child.nil? && node2.left_child.nil? && node1.right_child.nil? && node2.right_child.nil?\n return true\n else\n left_identical = identical?(node1.left_child, node2.left_child)\n right_identical = identical?(node1.right_child, node2.right_child)\n return left_identical && right_identical\n end\nend", "def check_children(value, node)\n if value < node.value\n node.left\n else\n node.right\n end\n end", "def ancestors_traverse(tree, item, &block)\n x = nil # sub-tree object containing node to be located\n parent = nil # sub-tree object - parent of x, or soon its successor\n found = false\n\n found, x, parent = bst_search(tree, item)\n\n return false if ! found # no point in going further\n\n locator = tree\n parent = nil\n found = false\n\n while( !found && locator)\n if item.data < locator.node.data\n # descend left\n block.call(locator)\n parent = locator\n locator = locator.left_child\n elsif item.data > locator.node.data\n # descend right\n block.call(locator)\n parent = locator\n locator = locator.right_child\n else\n found = true\n end\n end\n return found\n end", "def rotateWithLeftChild(k2)\n k1 = k2.left\n k2.left = k1.right\n k1.right = k2\n return k1\n end", "def find_parent(root, parent_to_find)\n\n if((defined?(root.left.data))) || ((defined?(root.right.data)))\n if(root.right == parent_to_find) || (root.left == parent_to_find) \n return root\n else\n if(parent_to_find < root)\n find_parent(root.left, parent_to_find)\n else\n find_parent(root.right,parent_to_find)\n end \n end\n end \n end", "def parent?(id)\n self.parent_id == id\n end", "def get_pointer_from_parent(tree_node)\n parent = tree_node.parent\n return nil unless parent\n pointer = tree_node.value > parent.value ? :@right : :@left\n end", "def parent_correct?(id,parent)\n p __method__ if @debug == true\n\n # get the suggested pathname .. using the pathname library here.\n path = Pathname.new(id).dirname\n\n # get the parent ci from the rest interface\n xml = RestClient.get \"#{@base_url}/ci/#{path}\", {:accept => :xml, :content_type => :xml}\n\n # get the parent type from the xml\n parenttype = XmlSimple.xml_in(xml,{'KeepRoot' => true}).keys.to_s\n # check if the actual parenttype is among the valid ones\n return true if parent.include? parenttype\n\n return false\n end", "def is_balanced?\n diff = (self.left.depth - self.right.depth).abs\n if diff <= 1\n true\n else\n false\n end\n end", "def has_parent?\n parent_id != nil\n end", "def in_order_traversal(node)\n\n while node\n\n #Left as far as possible\n while(node.left)\n node = node.left\n end\n\n print \"#{node.value} \"\n\n prev = node\n node = node.parent\n\n while node\n if node.left == prev\n print \"#{node.value} \"\n\n if node.right\n node = node.right\n break\n end\n end\n\n prev = node\n node = node.parent\n end\n\n end\nend", "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\n p tree.value\n return tree if tree.value == value\n\nend", "def lca(node1, node2)\n root = node1\n while (root.parent)\n return root if root.val == node2.val\n root = root.parent\n end\n\n while (root)\n return root if root.val >= [node1.val, node2.val].min && root.val <= [node1.val, node2.val].max\n root = root.right if root.val < [node1.val, node2.val].min\n root = root.left if root.val > [node1.val, node2.val].max\n end\nend", "def inorder(node)\n if node.left_child\n inorder(node.left_child)\n end\n puts node.value\n if node.right_child\n inorder(node.right_child)\n end\nend", "def is_immediate_parent?( parent_hash )\n \n is_parent = false\n\n @parents.each { |this_parent| break if is_parent = this_parent.equal?( parent_hash ) }\n \n return is_parent\n \n end", "def right_child?(node_id)\n (node_id & 1) == 1 # node_id % 2 == 1\n end", "def parent?\n !root?\n end", "def parent_for_new(tree_node, value)\n return tree_node if !tree_node.left && value < tree_node.value\n return tree_node if !tree_node.right && value > tree_node.value\n\n if value > tree_node.value\n return parent_for_new(tree_node.right, value)\n else\n return parent_for_new(tree_node.left, value)\n end\n end", "def test_parentage\n setup_test_tree\n\n assert_nil(@root.parentage, \"Root does not have any parentage\")\n assert_equal([@root], @child1.parentage, \"Child1 has Root as its parent\")\n assert_equal([@child3, @root], @child4.parentage, \"Child4 has Child3 and Root as ancestors\")\n end", "def is_leaf\n return @left == nil\n end", "def common_ancestor(node1, node2)\n depth1 = find_depth(node1)\n depth2 = find_depth(node2)\n\n if(depth1 >= depth2)\n long_depth = depth1\n short_depth = depth2\n long_node = node1\n short_node = node2\n else\n long_depth = depth2\n short_depth = depth1\n long_node = node2\n short_node = node1\n end\n\n until(long_depth == short_depth)\n long_node = long_node.parent\n long_depth -= 1\n end\n\n return simul_parents(short_node, long_node)\n\nend", "def bst_search(tree, node)\n locator = tree\n parent = nil\n found = false\n while( !found && locator)\n if node.data < locator.node.data\n # descend left\n parent = locator\n locator = locator.left_child\n elsif node.data > locator.node.data\n # descend right\n parent = locator\n locator = locator.right_child\n else\n found = true\n end\n end\n return found, locator, parent\n end", "def touch?( other )\n\t\tcommon_leaves = [ ]\n\t\tother.leaves.each do |leaf|\n\t\t\[email protected]?(leaf) and common_leaves << leaf\n\t\tend\n\t\tif common_leaves.size > 0\n\t\t\tcommon_leaves.first\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def has_parent?\n !root?\n end", "def dfs_rec(tree, value)\n return nil if tree.nil?\n\n p tree.value\n return tree if tree.value == value\n\n left = dfs_rec(tree.left, value)\n return left if left && left.value == value\n\n\n right = dfs_rec(tree.right, value)\n return right if right && right.value == value\n\nend", "def set_parent!(p)\n unless p.nil? || p.is_a?(Warehouse)\n if p.to_s.blank?\n p = nil\n else\n p = Warehouse.find_by_id(p)\n return false unless p\n end\n end\n if p == parent && !p.nil?\n # Nothing to do\n true\n elsif p.nil? || (p.active? && move_possible?(p))\n # Insert the project so that target's children or root projects stay alphabetically sorted\n sibs = (p.nil? ? self.class.roots : p.children)\n to_be_inserted_before = sibs.detect {|c| c.name.to_s.downcase > name.to_s.downcase }\n if to_be_inserted_before\n move_to_left_of(to_be_inserted_before)\n elsif p.nil?\n if sibs.empty?\n # move_to_root adds the project in first (ie. left) position\n move_to_root\n else\n move_to_right_of(sibs.last) unless self == sibs.last\n end\n else\n # move_to_child_of adds the project in last (ie.right) position\n move_to_child_of(p)\n end\n #Issue.update_versions_from_hierarchy_change(self)\n true\n else\n # Can not move to the given target\n false\n end\n end", "def rebalance_for_left_delete\n\t\t\trebalance = false\n\t\t\t[if black?\n\t\t\t\tif @right.black?\n\t\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t\t# make whole sub-tree 1 level lower and ask rebalance\n\t\t\t\t\t\trebalance = true\n\t\t\t\t\t\twith_right(@right.with_color(:red))\n\t\t\t\t\telse\n\t\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\t\tbalanced_rotate_left\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t# flip this sub-tree into another type of 3-children node\n\t\t\t\t\tret = rotate_left\n\t\t\t\t\t# try to rebalance in sub-tree\n\t\t\t\t\tleft, rebalance = ret.left.rebalance_for_left_delete\n\t\t\t\t\traise 'should not happen' if rebalance\n\t\t\t\t\tret.with_left(left)\n\t\t\t\tend\n\t\t\telse # red\n\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t# make right sub-tree 1 level lower\n\t\t\t\t\twith_right(@right.with_color(color)).with_color(@right.color)\n\t\t\t\telse\n\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\tbalanced_rotate_left\n\t\t\t\tend\n\t\t\tend, rebalance]\n\t\tend", "def hasParent?(node)\n if node.parent != nil\n true\n else\n false\n end\nend", "def is_match?(root1, root2)\n return true if root1.nil? && root2.nil?\n return false if root1.nil? || root2.nil? || root1.val != root2.val\n\n is_match?(root1.left, root2.left) && is_match?(root1.right, root2.right)\nend", "def parent?\n !children.empty?\n end", "def get_parent(k)\n parent = (k - 1) / 2\n parent if parent >= 0\nend", "def parents\n self.class.where('forestify_left_position < ?', self.forestify_left_position).where('forestify_right_position > ?', self.forestify_right_position)\n end", "def second_chk(obj)\n lft = self.left * obj\n if lft != nil\n return Prod.new(lft,self.right).reduce\n else\n rht = self.right * obj\n if rht != nil\n return Prod.new(self.left,rht).reduce\n else\n return nil unless self.top\n return Prod.new(self,obj).reduce\n end\n end\n # return nil\n end", "def validate_traversal_ids(current_node, parent = null_node)\n expect(current_node.traversal_ids).to be_present\n expect(current_node.traversal_ids).to eq parent.traversal_ids + [current_node.id]\n\n current_node.children.each do |child|\n validate_traversal_ids(child, current_node)\n end\n end", "def leaf_similar(root1, root2)\n leaves1 = []\n leaves2 = []\n\n dfs(root1, leaves1)\n dfs(root2, leaves2)\n\n leaves1 == leaves2\nend", "def lowest_common_ancestor(root, p, q)\n p_val = p.val\n q_val = q.val\n node = root\n\n while node\n if p_val < node.val && q_val < node.val\n node = node.left\n elsif p_val > node.val && q_val > node.val\n node = node.right\n else\n return node\n end\n end\nend", "def lowest_common_ancestor_recursive(root, p, q)\n if p.val < q.val\n a, b = p, q\n else\n a, b = q, p\n end\n \n if root.val < a && root.val < b\n ancestor_helper(root.right, a, b)\n elsif root.val > a && root.val > b\n ancestor_helper(root.left, a, b)\n else\n root\n end\nend", "def delete(key)\n node = search key\n if node.l.key == nil && node.r.key == nil\n # It's leaf, just replace it to null-node for its parent.\n if node.p \n null_node = RBNode.new nil, BLACK\n node.p.l == node ? node.p.l = null_node : node.p.r = null_node\n null_node.p = node.p\n adjust(null_node)\n else\n @root = nil\n end\n elsif has_one_child(node)\n child = node.r && node.r.key ? node.r : node.l\n # Only color case: child must be red leaf. node must be black.\n if node.p\n node.p.l == node ? node.p.l = child : node.p.r = child\n child.p = node.p\n else\n @root = child\n child.p = nil\n end\n child.color = node.color # must be black\n else\n succ = find_succ node\n # succ must be in right subtree of node. \n # succ has at most one child in right branch.\n\n # succ is right child of node.\n if succ && succ.key\n if succ == node.r\n if node.p \n node.p.l == node ? node.p.l = succ : node.p.r = succ\n else\n @root = succ\n end\n succ.l, succ.p = node.l, node.p\n succ.l.p = succ\n if succ.r\n if succ.color == BLACK\n if succ.r.color == RED \n succ.r.color = BLACK \n else\n succ.color = node.color\n adjust(succ.r)\n end\n end\n end\n else\n node.key, succ.key = succ.key, node.key\n if succ.p \n succ.p.l == succ ? succ.p.l = succ.r : succ.p.r = succ.r\n end\n if succ.r \n succ.r.p = succ.p \n if succ.color == BLACK\n succ.r.color == RED ? succ.r.color == BLACK : adjust(succ.r)\n end\n end \n end\n end\n end\n end", "def preoder_tree_walk(x)\n unless x.nil?\n p x.key\n preoder_tree_walk(x.left)\n preoder_tree_walk(x.right)\n end\n end", "def children_count\n 0 if @left.nil? && @right.nil?\n 1 if @left.nil? || @right.nil?\n 2\n end", "def self_and_siblings\n scope.where( tree.columns.parent => parent_id ).preorder\n end", "def parent?\n !parents.empty?\n end", "def test_sort_by_ancestry_missing_parent_middle_of_tree\n AncestryTestDatabase.with_model do |model|\n n1, _, _, n4, n5, _ = build_tree(model)\n\n records = model.sort_by_ancestry([n5, n4, n1])\n if CORRECT\n assert_equal [n1, n4, n5].map(&:id), records.map(&:id)\n else\n assert_equal [n1, n5, n4].map(&:id), records.map(&:id)\n end\n end\n end", "def update_parent(node, num, new_node)\n\t\tparent = node.parent\n\t\tunless parent.nil?\n\t\t\tif parent.key > num\n\t\t\t\tparent.left = new_node\n\t\t\telse\n\t\t\t\tparent.right = new_node\n\t\t\tend\n\t\tend\n\tend", "def lowest_common_ancestor(root, p, q)\n return root if [nil, p, q].index(root)\n left = lowest_common_ancestor(root.left, p, q)\n right = lowest_common_ancestor(root.right, p, q)\n left && right ? root : left || right\nend", "def isRightChild?\r\n return nil if isRoot?\r\n self == parent.rightChild\r\n end", "def is_child_of?(_parent)\n return false if (self == _parent) or self.root?\n _parent == self.parent\n end", "def swap_parent_reference_to_node(parent, first_node, second_node)\n unless parent.nil?\n kids = parent.kids\n index = kids.index first_node\n kids[index] = second_node\n end\n end", "def find_path(root, p, path)\n return false unless root\n path.push(root)\n return true if root.val == p.val || find_path(root.left, p, path) || find_path(root.right, p, path)\n path.pop\n false\nend", "def check_subtree(tree1, tree2)\n # due to the depth of T1 being much larger than T2 a BFS seems more logical\n bfs(tree1.head, tree2,head)\nend", "def is_a_parent?\r\n count_of_sub_jobs = Job.where(\"parent_job_id = #{id}\").count\r\n if count_of_sub_jobs == 0\r\n false\r\n else\r\n true\r\n end\r\n end" ]
[ "0.66738623", "0.6379302", "0.6372852", "0.62830114", "0.6165596", "0.61002564", "0.6074607", "0.6064618", "0.60307646", "0.600181", "0.59663904", "0.5957884", "0.5940037", "0.5921143", "0.5893615", "0.589213", "0.5883418", "0.5883418", "0.588056", "0.58666825", "0.581503", "0.5808501", "0.580624", "0.5794626", "0.57768965", "0.57712954", "0.5766891", "0.57556957", "0.57556957", "0.57062465", "0.56911784", "0.5686612", "0.56861573", "0.56838465", "0.56679446", "0.566332", "0.56592077", "0.56435287", "0.564173", "0.56348825", "0.56336766", "0.55925554", "0.55911463", "0.55848825", "0.55838996", "0.55834246", "0.55796635", "0.5574695", "0.557374", "0.5573192", "0.5566675", "0.5548727", "0.5540179", "0.5539419", "0.55309993", "0.5513253", "0.5511738", "0.54968464", "0.54949343", "0.54899204", "0.5480792", "0.54799193", "0.5476033", "0.5442357", "0.54399693", "0.54377836", "0.54354644", "0.54348516", "0.54315597", "0.5428667", "0.5423839", "0.54148674", "0.5411173", "0.54080456", "0.5396649", "0.53859377", "0.5385027", "0.5372919", "0.5372125", "0.53696555", "0.53624", "0.535666", "0.5340827", "0.53402513", "0.53360856", "0.5335254", "0.5334174", "0.5334054", "0.5329293", "0.532866", "0.5327377", "0.53234315", "0.5321661", "0.53207767", "0.53186506", "0.53119475", "0.5310397", "0.52866906", "0.5283611", "0.52817196" ]
0.6884053
0
swap a parent and child node
def swap(child, parent) if child.rating < parent.rating temp_left = child.left temp_right = child.right child.parent = parent.parent parent.parent = child unless parent.left.nil? if parent.left == child child.left = parent else child.left = parent.left end end unless parent.right.nil? if parent.right == child child.right = parent else child.right = parent.right end end parent.left = temp_left parent.right = temp_right if child.parent.nil? self.root = child end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_children\r\n tempChild = leftChild\r\n self.leftChild= rightChild\r\n self.rightChild= tempChild\r\n end", "def swap_parent_reference_to_node(parent, first_node, second_node)\n unless parent.nil?\n kids = parent.kids\n index = kids.index first_node\n kids[index] = second_node\n end\n end", "def swap(child, parent)\n\t\tif child.value < parent.value\n\t\t\ttemp = parent.value\n\t\t\tparent.value = child.value\n\t\t\tchild.value = temp\n\t\tend\n\tend", "def swap(parent, child)\n top = parent.parent\n sibling = relationship(parent, child) == BinaryNodeRelationship::LEFT_CHILD ? parent.right : parent.left\n bottom_left = child.left\n bottom_right = child.right\n\n child.parent = top\n if relationship(parent, child) == BinaryNodeRelationship::LEFT_CHILD\n child.left = parent\n else\n child.right = parent\n end\n\n unless top.nil?\n if relationship(top, parent) == BinaryNodeRelationship::LEFT_CHILD\n top.left = child\n else\n top.right = child\n end\n end\n\n if sibling.nil?\n # If the sibling node doesn't exist, then the child must be a left child.\n child.right = nil\n else\n if relationship(parent, sibling) == BinaryNodeRelationship::LEFT_CHILD\n child.left = sibling\n else\n child.right = sibling\n end\n sibling.parent = child\n end\n parent.left = bottom_left\n bottom_left.parent = parent unless bottom_left.nil?\n parent.right = bottom_right\n bottom_right.parent = parent unless bottom_right.nil?\n\n parent.parent = child\n @root = child if root?(child)\n end", "def swap_nodes_references_to_parents(first_node, second_node)\n # no need to worry about nil references, it just works\n first_node.parent, second_node.parent = [second_node.parent, first_node.parent]\n end", "def swap_parents_references_to_nodes(first_node, second_node)\n # store a reference to the second's parent while it is overwritten\n temp_parent = second_node.parent\n\n swap_parent_reference_to_node(first_node.parent, first_node, second_node)\n swap_parent_reference_to_node(temp_parent, second_node, first_node)\n end", "def promote_child(node)\n if node.right\n parent = node\n child = node.right\n\n while child.right\n parent = parent.right\n child = child.right\n end\n\n parent.right = child.left\n nil\n else\n node.left\n end\n end", "def move_to_child_of(node)\n move_to node, :child\n end", "def move_to_child_of(node)\n move_to node, :child\n end", "def move_to_child_of(node)\n move_to node, :child\n end", "def replace_child src_parent, src_idx, new_child\n old = src_parent.children[src_idx]\n no('no') unless old\n old.parent_clear!\n new_child.parent_id = src_parent.parse_id\n src_parent.children[src_idx] = new_child\n old\n end", "def swap_node_position(higher_node, lower_node)\n temp_element_title = higher_node.title\n temp_element_rating = higher_node.rating\n higher_node.title = lower_node.title\n higher_node.rating = lower_node.rating\n lower_node.title = temp_element_title\n lower_node.rating = temp_element_rating\n lower_node\n end", "def move_to_child_of(node)\n if node\n movement(node) do |to|\n to.parent = node\n to.position = nil if parent_id_changed?\n end\n else\n move_to_root\n end\n end", "def update_children(node, new_node)\n\t\tleft \t= node.left\n\t\tright = node.right\n\t\tleft.parent = new_node unless left.nil? \n\t\tright.parent = new_node unless right.nil?\n\tend", "def move_to_child_of(node)\n self.move_to node, :child\n end", "def move_to_child_of(node)\n self.move_to node, :child\n end", "def move_to_child_of(node)\n self.move_to(node, :child)\n end", "def swap(node_or_tags); end", "def swap(node_or_tags); end", "def parent=(parent_node); end", "def parent=(parent_node); end", "def heapify_up\n # Swap the current_node (starting with last child) with it's parent if it is smaller\n previous_current_node = nil\n current_node = @nodes.size - 1\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n parent_node = parent(current_node)\n \n # Bounds check for when the current_node is the root\n break if current_node.zero? \n\n # Swap with the parent if the parent is bigger\n if @nodes[current_node] < @nodes[parent_node]\n @nodes[current_node], @nodes[parent_node] = @nodes[parent_node], @nodes[current_node]\n current_node = parent_node\n end\n end\n end", "def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end", "def swap(index1, index2)\n @tree[index1], @tree[index2] = @tree[index2], @tree[index1]\n end", "def change_parent(child, parent)\n\t\tif child.is_a?(Node) #if its a node, modify the relation so its parent is the new_node\n\t\t\t\n\t\t\t#relation = child.parent_relationships.first #hierarchy relationship should always be first <- no longer true potentially\n\t\t\trelation = child.parent_relationships.find_by link_collection_id: nil #the first one not explicitly defined, so hierarchy\n\t\t\t#binding.pry\n\t\t\tif (parent != nil) #if there is a parent for it\n\n\t\t\t\tif relation != nil #if it already has a parent relation. should be .any?\n\t\t\t\t\trelation.parent_id = parent.id\n\t\t\t\t\trelation.save\n\t\t\t\t\tchild.save\n\t\t\t\t\tparent.save\n\t\t\t\telse #if it doesn't have a parent already\n\t\t\t\t\trelation = Link.new(child_id: child.id, parent_id: parent.id, work_id: self.id)\n\t\t\t\t\trelation.save\n\t\t\t\t\tchild.save\n\t\t\t\tend\n\t\t\t\t#parent.child_relationships << relation\n\n\t\t\telse #if it doesn't have a new parent to be assigned\n\t\t\t\tif (relation != nil) #if it exists, delete it\n\t\t\t\t\trelation.delete\n\t\t\t\tend #if it doesn't exist and doesn't need to, do nothing\n\t\t\tend\n\t\t\n\t\telsif child.is_a?(Note)\n\t\t\t#prev_parent_id = child.node_id\n\t\t\tif (parent != nil) #if it has a new parent parent already\n\t\t\t\tchild.node_id = parent.id\n\t\t\t\tchild.save\n\t\t\t\tparent.notes << child\n\t\t\t\tparent.save\n\t\t\telse #if it doesn't have a parent, don't set it to anything\n\t\t\t\tchild.node_id = nil\n\t\t\t\tchild.save\t\t\t\n\t\t\tend\n\n\t\t\t#update the notes of the other node, if it exists\n\t\t\t#if Node.exists?(prev_parent_id) #automatically false if nil, so if it has no prev_parent, works even if it thinks it does\n\t\t\t#\tprev_parent = Node.find(prev_parent_id)\n\t\t\t#\tprev_parent.combine_notes()\n\t\t\t#\tprev_parent.save\n\t\t\t#end\n\t\t\n\t\telsif child.is_a?(LinkCollection)\n\t\t\tif (parent != nil) #if it has a new parent\n\t\t\t\tchild.links.each do |link| #reassign its links to that parent\n\t\t\t\t\tlink.change_parent(parent)\n\t\t\t\tend\n\t\t\telse #if a new parent wasn't found for it\n\t\t\t\tchild.links.each do |link| #reassign its links to nil\n\t\t\t\t\tlink.change_parent(nil)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def rearrange\n yield\n other = Tag.where(id: self.other_id).first\n operation = self.operation\n self.operation = self.other_id = nil\n\n begin\n case operation\n when 'nest_under'\n self.update_attribute :parent_id, other.id\n self.update_attribute :siblings_position, 0\n raise 'Cyclic nesting!' if other.parent_id == id\n when 'move_above'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position - 1\n when 'move_below'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position + 1\n end\n rescue\n self.errors.add :other_id, INVALID_TAG_OPERATION\n raise ActiveRecord::Rollback\n end\n end", "def rearrange_children!\n @rearrange_children = true\n end", "def move_to_child_of(category)\n self.update_attribute(:parent_id, category.id) unless self.parent_id == category.id\n end", "def assign_to_parent(element)\n element.remove!\n element.parent = parent\n end", "def unwrap(node)\n node.children.each do |child|\n node.parent << child\n end\n node.remove\n end", "def link_nodes(child, parent)\n # link the child's siblings\n child.left.right = child.right\n child.right.left = child.left\n \n child.parent = parent\n \n # if parent doesn't have children, make new child its only child\n if parent.child.nil?\n parent.child = child.right = child.left = child\n else # otherwise insert new child into parent's children list\n current_child = parent.child\n child.left = current_child\n child.right = current_child.right\n current_child.right.left = child\n current_child.right = child\n end\n parent.degree += 1\n child.marked = false\n end", "def swim index\n parent_index = (index - 1) / 2\n\n # continue to bubble upward while we have not reached the root,\n # and while we are less than the parent element\n while (index > 0 && less_than?(index, parent_index))\n \n # swap the two values\n swap_values_at(index, parent_index)\n index = parent_index\n # set new parent index based on the bubble up\n parent_index = (index - 1) / 2\n end\n end", "def exclusive_child(parent)\n\t\t\t\tparent.children = @children\n\t\t\t\t\n\t\t\t\t@children&.each_value do |child|\n\t\t\t\t\tchild.parent = parent\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tparent.clear_cache!\n\t\t\t\t\n\t\t\t\t@children = {parent.id => parent}\n\t\t\t\tself.clear_cache!\n\t\t\t\t\n\t\t\t\tparent.parent = self\n\t\t\tend", "def swap(node_or_tags)\n replace node_or_tags\n self\n end", "def link_nodes(child, parent)\n # link the child's siblings\n child.left.right = child.right\n child.right.left = child.left\n\n child.parent = parent\n\n # if parent doesn't have children, make new child its only child\n if parent.child.nil?\n parent.child = child.right = child.left = child\n else # otherwise insert new child into parent's children list\n current_child = parent.child\n child.left = current_child\n child.right = current_child.right\n current_child.right.left = child\n current_child.right = child\n end\n parent.degree += 1\n child.marked = false\n end", "def parent=(other); end", "def node_leave_parent(node, parent)\n node.parents.delete(parent)\n end", "def move!\r\n return unless create_new_parent?\r\n parent_arg = find_new_parent\r\n self.move_to_child_of(parent_arg)\r\n if parent_arg\r\n self.debate_id = parent_arg.debate_id\r\n self.children.update_all(\"debate_id = #{parent_arg.debate_id}\")\r\n end\r\n end", "def swap(p_i, c_i)\n @nodes[p_i], @nodes[c_i] = @nodes[c_i], @nodes[p_i]\n end", "def hand_off_to!(other)\n verify_hand_off_to(other)\n other.children.replace children\n other.parent = parent\n @children = EmptyClass\n @parent = nil\n end", "def promote(node,father)\n \n if (node.getLeft() == nil)\n current = nil\n tempNode = node.getRight()\n while tempNode != nil do\n current = tempNode\n tempNode = tempNode.getLeft()\n end\n else\n tempNode = node.getLeft()\n current = tempNode\n while tempNode != nil do\n current = tempNode\n tempNode = tempNode.getRight()\n end\n end\n #Obtenemos nodo padre\n newParent = getFather(current.getData(),@root,current)\n getLastChild(current,newParent)\n \n current.setLeft(node.getLeft())\n current.setRight(node.getRight())\n \n if father.getData() < node.getData()\n father.setRight(current)\n else\n father.setLeft(current)\n end\n \n end", "def move_under new_parent\n ensure_exists!\n ensure_no_cycle! new_parent\n if parent\n parent.remove_child self\n else\n trace.remove_root self\n end\n if new_parent\n new_parent.add_child self\n @parent_span_id = new_parent.span_id\n else\n trace.add_root self\n @parent_span_id = 0\n end\n @parent = new_parent\n self\n end", "def parent=(node)\n # this is for deleting child when we are reassigning parent\n if @parent != nil\n @parent.children.delete(self)\n end\n\n @parent = node\n if node\n node.children << self unless node.children.include?(self)\n end\n end", "def replace_child! child, nu\n idx = index_of_child child\n self[idx] = nu\n # debugger; 'make sure to_ruby works'\n nil\n end", "def replace_with(child); end", "def swap!\n @left, @right = @right, @left\n end", "def move_from_old_parent\n parent.remove(self)\n end", "def move_up\n # Ensure each parent node to this node (the goal here is to hit a question node) is valid\n !survey.node_maps.select do |i|\n i.node == self\n end.collect do |node_map|\n # Parent must be an answer - cannot move into the position of a Question!\n next unless !node_map.parent.nil? && node_map.parent.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer)\n\n # I know this looks overly complicated, but we need to always work with the survey.node_maps - never children/parent of the relation\n parent_node = survey.node_maps.select do |j|\n node_map.parent == j\n end.first\n\n parent_parent = survey.node_maps.select do |j|\n node_map.parent.parent == j\n end.first\n\n node_map.parent = parent_parent\n parent_parent.children << node_map\n\n survey.node_maps.select do |j|\n node_map.children.include?(j)\n end.each do |c|\n c.parent = parent_node\n parent_node.children << c\n end\n\n parent_node.parent = node_map\n node_map.children << parent_node\n end\n end", "def map_nodes!(&ruby_block)\n @child = ruby_block.call(@child)\n @child.parent = self unless @child.parent\n end", "def parent=(node)\n if self.parent == nil\n @parent = node\n node.children << self unless node == nil || node.children.include?(self)\n else\n self.parent.children.delete(self)\n @parent = node\n node.children << self unless node == nil || node.children.include?(self)\n end\n end", "def child_node=(_); end", "def move_down\n # Ensure each parent node to this node (the goal here is to hit a question node) is valid\n !survey.node_maps.select do |i|\n i.node == self\n end.collect do |node_map|\n # Must have children to move lower!\n # And the children are also answers!\n next unless !node_map.children.empty? && !node_map.children.select { |j| j.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer) }.empty?\n\n # I know this looks overly complicated, but we need to always work with the survey.node_maps - never children/parent of the relation\n parent_node = survey.node_maps.select do |j|\n node_map.parent == j\n end.first\n\n children = survey.node_maps.select do |j|\n node_map.children.include?(j)\n end\n\n children_children = survey.node_maps.select do |j|\n children.collect(&:children).flatten.include?(j)\n end\n\n children.each do |c|\n parent_node.children << c\n end\n\n children.each do |c|\n c.children << node_map\n end\n\n children_children.each do |i|\n node_map.children << i\n end\n end\n end", "def restructure\n node_id = params[:node_id].to_i\n parent_id = params[:parent_id].to_i\n prev_id = params[:prev_id].to_i\n next_id = params[:next_id].to_i\n\n render :text => \"Do nothing\" and return if parent_id.zero? && prev_id.zero? && next_id.zero?\n\n @realty_category ||= parent.realty_categories.find(node_id)\n\n if prev_id.zero? && next_id.zero?\n @realty_category.move_to_child_of parent.realty_categories.find(parent_id)\n elsif !prev_id.zero?\n @realty_category.move_to_right_of parent.realty_categories.find(prev_id)\n elsif !next_id.zero?\n @realty_category.move_to_left_of parent.realty_categories.find(next_id)\n end\n end", "def promote_node_two_children(parent_node,target_node, max_left_sub_tree, max_left_sub_tree_parent_node)\n\n if parent_node.value <= max_left_sub_tree.value\n parent_node.right = max_left_sub_tree\n promote_node(max_left_sub_tree_parent_node, max_left_sub_tree.left)\n\n\n max_left_sub_tree.left = target_node.left if !target_node.left.nil?\n\n max_left_sub_tree.right = target_node.right if !target_node.right.nil?\n\n\n\n\n\n\n else\n parent_node.left = max_left_sub_tree\n promote_node(max_left_sub_tree_parent_node, max_left_sub_tree.left)\n\n\n max_left_sub_tree.left = target_node.left if !target_node.left.nil?\n\n max_left_sub_tree.right = target_node.right if !target_node.right.nil?\n\n\n end\n\n end", "def add_child(child_node) \n child_node.parent = self \n end", "def update_parent(node, num, new_node)\n\t\tparent = node.parent\n\t\tunless parent.nil?\n\t\t\tif parent.key > num\n\t\t\t\tparent.left = new_node\n\t\t\telse\n\t\t\t\tparent.right = new_node\n\t\t\tend\n\t\tend\n\tend", "def heapify_down\n # Swap the current_node (starting with root) with its smallest child until it's smaller than both of its children\n previous_current_node = nil\n current_node = 0\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n right_child = right_child_node current_node\n left_child = left_child_node current_node\n\n # Bounds check for when current_node is one of the last two nodes\n # Or if there are only two nodes total\n if right_child >= @nodes.size\n # Correctly order nodes if there are only two nodes\n if @nodes.size == 2 && @nodes[left_child] < @nodes[current_node]\n @nodes[current_node], @nodes[left_child] = @nodes[left_child], @nodes[current_node] \n end\n break\n end\n\n # If current_node is greater than either of its children\n if @nodes[current_node] > @nodes[left_child] || @nodes[current_node] > @nodes[right_child]\n # Swap with the smallest child\n if @nodes[left_child] <= @nodes[right_child]\n @nodes[current_node], @nodes[left_child] = @nodes[left_child], @nodes[current_node]\n current_node = left_child\n else\n @nodes[current_node], @nodes[right_child] = @nodes[right_child], @nodes[current_node]\n current_node = right_child\n end\n end\n end\n end", "def parent=(newParent)\n return if newParent == @parent\n remove_item if @parent\n @parent = newParent\n @content.each_index do |pos|\n update_sortable(pos, @content[pos]) if @parent\n end\n end", "def change_order\r\n ids = params[:child_nodes]\r\n \r\n # Update\r\n ProductPackageNode.transaction do\r\n ids.each_index do |index|\r\n ProductPackageNode.update ids[index], :position => index + 1\r\n end\r\n end\r\n \r\n render :nothing => true\r\n end", "def parent=(new_parent) \n parent.children.delete(self) if @parent #=> this is the old parent removing the child that is being adopted \n @parent = new_parent #=> I have a new mommy! \n new_parent.children << self unless @parent == nil || new_parent.children.include?(self) \n end", "def move_to_child_with_index(node, index)\n raise ActiveRecord::ActiveRecordError, \"index can't be nil\" unless index\n\n tenacious_transaction do\n new_siblings = (node.try(:children) || ordered_tree_scope.roots).\n reload.\n lock(true).\n reject { |root_node| root_node == self }\n\n if new_siblings.empty?\n node ? move_to_child_of(node) : move_to_root\n elsif new_siblings.count <= index\n move_to_right_of(new_siblings.last)\n elsif\n index >= 0 ? move_to_left_of(new_siblings[index]) : move_to_right_of(new_siblings[index])\n end\n end\n end", "def bubble_down(index)\n left = index*2+1 #left child\n right = index*2+2 #right child\n\n smaller_child_index = pick_smaller(left, right)\n\n while (smaller_child_index!=nil && @ary[smaller_child_index].key < @ary[index].key)\n\n @ary[index], @ary[smaller_child_index] = @ary[smaller_child_index], @ary[index] #swap\n\n index = smaller_child_index\n left = index*2+1 #left child\n right = index*2+2 #right child\n smaller_child_index = pick_smaller(left, right)\n\n end\n end", "def rearrange_children\n if rearrange_children?\n self.disable_timestamp_callback()\n self.children.each do |child|\n child.update_path!\n child.save\n # child.reload # might not need to reload?\n end\n self.enable_timestamp_callback()\n end\n @rearrange_children = false\n true\n end", "def remove_child(node)\n if node.parent == nil\n raise \"this is an orphan\"\n end \n node.parent = nil\n end", "def right_rotate(node)\n l_child = node.l\n if node.p\n node == node.p.l ? node.p.l = l_child : node.p.r = l_child\n else\n @root = l_child\n end\n node.l = l_child.r\n l_child.r.p = node\n l_child.r = node\n l_child.p = node.p\n node.p = l_child\n end", "def swap_with(other)\n self.class.base_class.transaction do\n old_position = position\n update_attribute(:position, other.position)\n other.update_attribute(:position, old_position)\n end\n end", "def return_to_parent\n @current_node = @current_node.parent.parent\n # @current_node.depth = @current_node.depth - 1\n end", "def swap old, new_parent\n plugged.hide\n\n old.remove self\n new_parent.add self\n \n realize\n \n take_window plugged \n plugged.show \n \n @parent = new_parent\n end", "def promote_container_children_to_current_level(parent, container)\n container.children.reverse_each {|c| parent.add_child(c) } \n parent.remove_child(container)\n end", "def update_children\n self.children.each do |child|\n child.update_children\n unless child.new_record?\n child.save\n child.move_to_child_of(self) if child.parent_id != self.id\n end\n end if self.changed?\n end", "def hand_off_to!(other)\n verify_hand_off_to(other)\n\n other.normal_children.replace normal_children\n other.fallback_child = fallback_child\n @normal_children = []\n @fallback_child = nil\n if parent\n if normal?\n parent.normal_children.delete(self)\n parent.normal_children << other\n else\n parent.fallback_child = other\n end\n other.parent = parent\n @parent = nil\n end\n end", "def calculate_up_child\n # Guard condition for movement not possible\n return nil if blank_y + 1 == size\n\n # Make the movement\n new_state = swap_up\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y + 1)\n end", "def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend", "def replace_children(parent, start_child_index, stop_child_index, t)\n raise NotImplementedError\n end", "def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend", "def parent=(node)\n if self.parent\n self.parent.children.delete(self)\n end\n @parent = node\n node.children << self unless node == nil || node.children.include?(self)\n end", "def two_child_delete(node)\n next_highest = find_next_highest(node.right)\n\n # Will two ever be called?\n case number_of_children(next_highest)\n when 0 then zero_child_delete(next_highest)\n when 1 then one_child_delete(next_highest)\n when 2 then two_child_delete(next_highest)\n end\n\n next_highest.left = node.left\n next_highest.right = node.right\n\n if node == @root\n @root = next_highest\n else\n parent, direction = find_parent(node)\n case direction\n when 'left'\n parent.left = next_highest\n when 'right'\n parent.right = next_highest\n end\n end\n node.data\n end", "def parent=(node) #node == new parents\n unless self.parent == nil # root node\n self.parent.children.delete(self)\n end\n # self = (Parents, [Mark]) = > (Parents, [])\n\n @parent = node # \n # debugger\n node.children << self unless node.nil? \n\n # (Bob & Mary, [Karen, Tom])\n # (Bob & Mary, [Karen, Tom, Mark])\n end", "def move_to(new_parent)\n self.parent = new_parent.is_a?(String) ?\n find!(new_parent) : new_parent\n end", "def moveWithChildren(bname, newParent)\n # Make sure the parent exists and find the parent\n raise \"Brick node: #{newParent} does not exist.\" unless @tree.has_key?(newParent)\n \n # Make sure the child exists\n raise \"Brick node: #{bname} does not exist.\" unless @tree.has_key?(bname)\n\n # Remove link to the brick from old parent\n oldParentName = self.getParent(bname)['brick']\n self.removeChildLink(oldParentName, bname)\n\n # Update the brick's parent \n @tree[bname]['parent'] = newParent\n \n # Add link to the brick to the new parent \n self.addChildLink(newParent,bname)\n end", "def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end", "def merge_parents(old_parent, new_parent)\n transplant(old_parent, new_parent)\n delete(:id => old_parent)\n end", "def convert_to_mirror(node)\n return if node.nil?\n\n # We will do a post-order traversal of the binary tree.\n convert_to_mirror(node.left) unless node.left.nil?\n convert_to_mirror(node.right) unless node.right.nil?\n\n # Let's swap the left and right nodes at current level.\n temp = node.left\n node.left = node.right\n node.right = temp\nend", "def parent=(parent_node=nil)\n # if parent_node.nil?\n @parent = parent_node\n #emove_child(parent_node) if parent_node.nil?\n #add_child(parent_node) if parent_nod.nil?\n # add_child(parent_node)\n #add_child(parent_node)\n #parent.children << child_node unless parent.children.include?(child_node)\n # add_child(self)\n # else\n # remove_child(parent_node)\n # end\n #parent_node.parent = parent_node\n end", "def left_child=(child)\n child.owner = self\n @left_child = child\n end", "def remove(node)\n if node.parent.nil?\n @root = nil\n return\n end\n if node.parent.left == node\n node.parent.left = nil\n elsif node.parent.right == node\n node.parent.right = nil\n end\n end", "def two_child_delete(node)\n return node if node.left.nil?\n \n until node.nil? do\n return node if node.left.nil?\n node = node.left\n end\n\n end", "def restore_parent\n Page.with_deleted\n .find(parent_id)\n .restore(recursive: true) if parent_id\n\n rebuild!\n end", "def rewrite_child(child, name = nil)\n end", "def set_child(name, node)\n send :\"#{name}=\", node\n end", "def convert_binary_tree_to_mirror(root)\n return if !root\n temp_node = Node.new()\n # recursively call the method on both left and right subtrees\n convert_binary_tree_to_mirror(root.left_child)\n convert_binary_tree_to_mirror(root.right_child)\n\n # swap the left and right subtrees\n temp_node = root.left_child\n root.left_child = root.right_child\n root.right_child = temp_node\n\n return root\nend", "def move_orphans_to_parent\n orphan_questions = Question.where(qset_id: self.id)\n orphan_questions.update_all(qset_id: self.parent.id)\n end", "def replace_parent( *args )\n \n new_parent = nil\n existing_parent = nil\n \n case args.size\n when 1\n new_parent = args[ 0 ]\n when 2\n # existing_parent = args[ 0 ]\n new_parent = args[ 1 ]\n end\n \n unregister_parent\n register_parent( new_parent )\n\n return self\n \n end", "def update_children_with_new_parent\n if path_changed? and not new_record? then\n old_path = (path_was.blank? ? id.to_s : \"#{path_was}.#{id}\")\n self.class.where(\"path <@ ?\", old_path).update_all([ \"path = TEXT2LTREE(REPLACE(LTREE2TEXT(path), ?, ?))\", old_path, my_path ])\n end\n end", "def graft!(other)\n verify_graft(other)\n other.parent = parent\n parent.children.add other\n parent.children.delete self\n end", "def assignSiblingNode(sibling)\n\t\t@siblingNode = sibling \n\tend", "def map_nodes!(&ruby_block)\n @left = ruby_block.call(@left)\n left.parent = self unless left.parent\n @right = ruby_block.call(@right)\n right.parent = self unless right.parent\n end", "def add_child(child_node)\n child_node.parent = self \n end", "def deleteNode node\n node.val = node.next.val\n node.next = node.next.next\nend", "def previous_sibling=(other); end" ]
[ "0.7920206", "0.7836606", "0.7603572", "0.7519623", "0.7362544", "0.71404225", "0.6972435", "0.69414866", "0.69414866", "0.69414866", "0.6917175", "0.69125867", "0.68733317", "0.6865146", "0.6836016", "0.68043", "0.6798682", "0.6732176", "0.6732176", "0.66964984", "0.66964984", "0.6633763", "0.661728", "0.6595677", "0.6546233", "0.6523254", "0.6470882", "0.6444657", "0.63811314", "0.63683295", "0.6353615", "0.63471085", "0.6311348", "0.63081706", "0.6304919", "0.6301416", "0.6280709", "0.6269048", "0.6255992", "0.6208317", "0.6199026", "0.6196913", "0.6167084", "0.6165861", "0.61524665", "0.61449146", "0.61313665", "0.61257386", "0.6123549", "0.61023086", "0.60895073", "0.6035433", "0.6032532", "0.6028742", "0.6019937", "0.60158694", "0.5975361", "0.5962808", "0.596232", "0.595206", "0.5949858", "0.59172666", "0.5913075", "0.5911925", "0.5902718", "0.58993477", "0.58748996", "0.5871258", "0.5867523", "0.5865822", "0.58600545", "0.58589643", "0.5848895", "0.58475083", "0.5845896", "0.5839472", "0.5832775", "0.58316815", "0.5816367", "0.57936245", "0.57934535", "0.5788698", "0.57855445", "0.57764024", "0.5775874", "0.5770195", "0.5760274", "0.5752331", "0.5729482", "0.5729253", "0.5728723", "0.5724154", "0.5716303", "0.57131016", "0.57096267", "0.57092875", "0.5704483", "0.5700342", "0.56977916", "0.5689524" ]
0.77118224
2
locate the node, swap in bottomrightmostnode (brmn)
def delete(root, data) target = find(root, data) unless data.nil? unless target.nil? brmn = find_bottom_right_most_node(root) if brmn != target target.title = brmn.title target.rating = brmn.rating # remove link to brmn from former parent unless brmn.parent.nil? if brmn.parent.right.title == brmn.title brmn.parent.right = nil else brmn.parent.left = nil end brmn.parent = nil end unless target.parent.nil? parent_compare(target, target.parent) end child_compare(target) else self.root = nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_node_position(higher_node, lower_node)\n temp_element_title = higher_node.title\n temp_element_rating = higher_node.rating\n higher_node.title = lower_node.title\n higher_node.rating = lower_node.rating\n lower_node.title = temp_element_title\n lower_node.rating = temp_element_rating\n lower_node\n end", "def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end", "def borrowFromRight( node, index)\n child = node.arr[index]\n sibling = node.arr[index + 1]\n # node key is inserted as the last key in child.\n child.keys[child.n] = node.keys[index]\n # Sibling's first child is inserted as the last child of child.\n if (!(child.leaf))\n child.arr[(child.n) + 1] = sibling.arr[0]\n end\n # First key from sibling is inserted into node.\n node.keys[index] = sibling.keys[0]\n \n # Moving all keys in sibling one step left\n i = 1\n while (i < sibling.n)\n sibling.keys[i - 1] = sibling.keys[i]\n i += 1\n end\n i = 1\n # Moving the child pointers one step behind\n while (!sibling.leaf && i <= sibling.n)\n sibling.arr[i - 1] = sibling.arr[i]\n i += 1\n end\n # Increase child key count and decrease sibling key count.\n child.n += 1\n sibling.n -= 1\n return\n end", "def test_swap_with_next\n element_d = @rbtree.fetch_element(\"d\")\n assert_equal(\"d\", element_d.key)\n assert_equal(\"D\", element_d.value)\n assert_equal false, element_d.swap_with_next # Fail - no successor\n assert_equal(\"d\", element_d.key) # unchanged\n assert_equal(\"D\", element_d.value) # unchanged\n assert_equal 4, @rbtree.size\n assert_equal %w{a b c d}, @rbtree.keys\n assert_equal %w{A B C D}, @rbtree.values\n \n element_c = @rbtree.fetch_element(\"c\")\n assert_equal(\"c\", element_c.key)\n assert_equal(\"C\", element_c.value)\n assert_equal true, element_c.swap_with_next # Success\n assert_equal(\"d\", element_c.key) # swapped\n assert_equal(\"D\", element_c.value) # swapped\n element_d = element_c.next\n assert_equal(\"c\", element_d.key) # swapped\n assert_equal(\"C\", element_d.value) # swapped\n assert_nil element_d.next\n element_b = element_c.prev\n assert_equal(\"b\", element_b.key) # still there\n assert_equal(\"B\", element_b.value) # still there\n assert_equal 4, @rbtree.size\n assert_equal %w{a b d c}, @rbtree.keys\n assert_equal %w{A B D C}, @rbtree.values\n # NOTE: tree is now totally screwed up. If you try to search on C, you won't find it!\n \n element_a = @rbtree.fetch_element(\"a\")\n assert_equal(\"a\", element_a.key)\n assert_equal(\"A\", element_a.value)\n assert_equal true, element_a.swap_with_next # Success\n assert_equal(\"b\", element_a.key) # swapped\n assert_equal(\"B\", element_a.value) # swapped\n element_b = element_a.next\n assert_equal(\"a\", element_b.key) # swapped\n assert_equal(\"A\", element_b.value) # swapped\n assert_nil element_a.prev\n element_c = element_b.next\n assert_equal(\"d\", element_c.key) # still there; value changed because of the swap we did above\n assert_equal(\"D\", element_c.value) # still there; value changed because of the swap we did above\n assert_equal 4, @rbtree.size\n assert_equal %w{b a d c}, @rbtree.keys\n assert_equal %w{B A D C}, @rbtree.values\n # NOTE: tree is now totally screwed up. If you try to search on A, you won't find it!\n end", "def move_to_bottom_of(node)\n movement(node, :strict => true) do |to|\n self.left_sibling = to.target.record\n end\n end", "def calculate_right_child\n # Guard condition for movement not possible\n return nil if blank_x - 1 < 0\n\n # Make the movement\n new_state = swap_right\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x - 1, blank_y)\n end", "def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end", "def right_borrows_from_mid\n @right.type, @right.mid, @right.value1 = 2, @right.left, @value2\n if @mid.type == 3\n @right.left, @value2 = @mid.right, @mid.value2\n else\n @right.left, @value2 = @mid.mid, @mid.value1\n end\n @mid.type -= 1\n end", "def heapify_down\n # Swap the current_node (starting with root) with its smallest child until it's smaller than both of its children\n previous_current_node = nil\n current_node = 0\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n right_child = right_child_node current_node\n left_child = left_child_node current_node\n\n # Bounds check for when current_node is one of the last two nodes\n # Or if there are only two nodes total\n if right_child >= @nodes.size\n # Correctly order nodes if there are only two nodes\n if @nodes.size == 2 && @nodes[left_child] < @nodes[current_node]\n @nodes[current_node], @nodes[left_child] = @nodes[left_child], @nodes[current_node] \n end\n break\n end\n\n # If current_node is greater than either of its children\n if @nodes[current_node] > @nodes[left_child] || @nodes[current_node] > @nodes[right_child]\n # Swap with the smallest child\n if @nodes[left_child] <= @nodes[right_child]\n @nodes[current_node], @nodes[left_child] = @nodes[left_child], @nodes[current_node]\n current_node = left_child\n else\n @nodes[current_node], @nodes[right_child] = @nodes[right_child], @nodes[current_node]\n current_node = right_child\n end\n end\n end\n end", "def BSTtoDLL(node)\n if !node\n return node\n end\n\n l_head = BSTtoDLL(node.left)\n r_head = BSTtoDLL(node.right)\n\n if l_head\n rightmost = l_head\n while rightmost.right != nil\n rightmost = rightmost.right\n end\n node.left = rightmost\n rightmost.right = node\n else\n l_head = node\n end\n\n if r_head\n node.right = r_head\n r_head.left = node\n else\n node.right = nil\n end\n\n return l_head\n\nend", "def move_to_bottom\n last_sib = last_sibling\n move_to_right_of(last_sib) if last_sib && self != last_sib\n end", "def convert_to_mirror(node)\n return if node.nil?\n\n # We will do a post-order traversal of the binary tree.\n convert_to_mirror(node.left) unless node.left.nil?\n convert_to_mirror(node.right) unless node.right.nil?\n\n # Let's swap the left and right nodes at current level.\n temp = node.left\n node.left = node.right\n node.right = temp\nend", "def move_to_right_of(node)\n move_to node, :right\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def bubble_down()\n\t\t# remove max and swap with last node\n\t\t@elements[0] = @elements.pop\n\t\ti = 0\n\t\twhile(i < @elements.length)\n\t\t\tmax_idx = i\n\t\t\t# find greater of left and right child\n\t\t\tif((2*i + 1) < @elements.length && @elements[2*i + 1][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 1\n\t\t\tend\n\t\t\tif((2*i + 2) < @elements.length && @elements[2*i + 2][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 2\n\t\t\tend\n\t\t\t# if left or right child is greater, swap and update i\n\t\t\tif(max_idx != i)\n\t\t\t\tswap(i, max_idx)\n\t\t\t\ti = max_idx\n\t\t\t# if not, we are done\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def go_to_bottom(nodes=nil, target)\n\t\tnext_row = []\n\n\t\tif nodes.nil?\n\t\t\tnodes = [self.root]\n\t\tend\n\n\t\tnodes.each do |node|\n\t\t\tif node.left.nil?\n\t\t\t\tnode.left = target\n\t\t\t\tnode.left.parent = node\n\t\t\t\treturn\n\t\t\telsif node.right.nil?\n\t\t\t\tnode.right = target\n\t\t\t\tnode.right.parent = node\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tnext_row << node.left\n\t\t\t\tnext_row << node.right\n\t\t\tend\n\t\tend\n\n\t\tif next_row.count > 0\n\t\t\tgo_to_bottom(next_row, target)\n\t\tend\n\tend", "def go_to_bottom(nodes=nil, target)\n\t\tnext_row = []\n\n\t\tif nodes.nil?\n\t\t\tnodes = [self.root]\n\t\tend\n\n\t\tnodes.each do |node|\n\t\t\tif node.left.nil?\n\t\t\t\tnode.left = target\n\t\t\t\tnode.left.parent = node\n\t\t\t\treturn\n\t\t\telsif node.right.nil?\n\t\t\t\tnode.right = target\n\t\t\t\tnode.right.parent = node\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tnext_row << node.left\n\t\t\t\tnext_row << node.right\n\t\t\tend\n\t\tend\n\n\t\tif next_row.count > 0\n\t\t\tgo_to_bottom(next_row, target)\n\t\tend\n\tend", "def remove_topmost_node\n (@n = @open.shift)\n @closed << @n\n @full_path << @n\n end", "def moved_node\n current_tree.find(node_2.id)\n end", "def convert_binary_tree_to_mirror(root)\n return if !root\n temp_node = Node.new()\n # recursively call the method on both left and right subtrees\n convert_binary_tree_to_mirror(root.left_child)\n convert_binary_tree_to_mirror(root.right_child)\n\n # swap the left and right subtrees\n temp_node = root.left_child\n root.left_child = root.right_child\n root.right_child = temp_node\n\n return root\nend", "def reorder\n sibs = siblings\n return if sibs.empty?\n sibs.each do |s|\n if self.ranking >= s.ranking\n self.move_to_left_of(s) and return\n end\n end\n self.move_to_right_of(sibs.last)\n end", "def swap(node_or_tags); end", "def swap(node_or_tags); end", "def postorder(node)\n postorder node.left_node if node.left_node \n postorder node.right_node if node.right_node \n visit node\n end", "def heapify_downward(i)\n #find the lowest node index that the node i could fall to\n end_node_index = find_end_of_node_path(i)\n \n #stash the value of node i for later\n start_node_value = self[i - 1] \n\n #search for the eventual final index where node i will fall\n swap_node_index = search_path_for_insert_position(i, end_node_index, start_node_value)\n \n #Move all parent nodes from the swap node index, up one level\n traversing_node_index = swap_node_index \n swap_node_value = self[traversing_node_index - 1]\n parent_value = self[parent_index(traversing_node_index) - 1]\n while traversing_node_index != i \n traversing_node_index = parent_index(traversing_node_index)\n self[traversing_node_index - 1] = swap_node_value\n swap_node_value = parent_value\n parent_value = self[parent_index(traversing_node_index) - 1]\n end\n \n #finally set the swap node index value to be our initial value \n self[swap_node_index - 1] = start_node_value \n end", "def move_to_above_of(node)\n movement(node, :strict => true) do |to|\n self.right_sibling = to.target.record\n end\n end", "def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend", "def move_to_right_of(node)\n self.move_to node, :right\n end", "def move_higher \n prev_sib = previous_sibling\n move_to_left_of(prev_sib) if prev_sib\n end", "def recursive_south(node)\n # get the position of the node and separate into an array\n pos = node.position.chars\n # base case is hardcoded as [\"H\", \"8\"]\n # going south, then east for board creation --> check number first\n if pos[1] != \"8\"\n # recursive call going south\n # change number position, create new node with new position, add to board, move south\n num = pos[1].ord + 1\n s_node = Node.new(pos[0] + num.chr)\n @board.add_node(s_node)\n # handle north - south edges within this call\n @board.create_edge(node, s_node)\n recursive_south(@board.nodes[s_node.position])\n end\n # handle east - west edges in new function\n if pos[0] != \"A\"\n east_west_edges(node)\n end\n # recursive call moving east\n if pos[1] == \"1\" && pos[0] != \"H\"\n recursive_east(node)\n end\n\n end", "def convert_to_mirror_iterative(node)\n return if node.nil?\n\n queue = [node]\n while queue.any?\n current = queue.shift\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n current.left = current.left\n current.right = current.right\n end\nend", "def bubble_down(index)\n left = index*2+1 #left child\n right = index*2+2 #right child\n\n smaller_child_index = pick_smaller(left, right)\n\n while (smaller_child_index!=nil && @ary[smaller_child_index].key < @ary[index].key)\n\n @ary[index], @ary[smaller_child_index] = @ary[smaller_child_index], @ary[index] #swap\n\n index = smaller_child_index\n left = index*2+1 #left child\n right = index*2+2 #right child\n smaller_child_index = pick_smaller(left, right)\n\n end\n end", "def set_default_left_and_right\n maxright = dataset.nested.max(self.class.qualified_right_column).to_i || 0\n # adds the new node to the right of all existing nodes\n self.left = maxright + 1\n self.right = maxright + 2\n end", "def move_to_bottom\n return if self == self_and_siblings(true).last\n move_to(self_and_siblings.last.position_in_list)\n end", "def set_default_left_and_right\n unless @skip_nested_set_callbacks\n maxright = base_class.first(scoped(:order => \"#{right_column_name} DESC\")).try(right_column_name) || 0\n # adds the new node to the right of all existing nodes\n self[left_column_name] = maxright + 1\n self[right_column_name] = maxright + 2\n end\n end", "def move_to_right_of(node)\n self.move_to(node, :right)\n end", "def move_to_right_of(node)\n self.move_to node, :right\n end", "def right_sibling\n siblings.\n where( arel[position_column].gt(self[position_column]) ).\n reorder( arel[position_column].asc ).\n first\n end", "def reverse node\n prev = nil\n while node\n tmp = node.next\n node.next = prev\n prev = node\n node = tmp\n end\n prev # not in book\n end", "def insert_brother_node(path, node)\n @rootNode.get_node(path).add_rightbrother_node(node)\n end", "def move_right\n move_to_right_of right_sibling\n end", "def move_right\n move_to_right_of right_sibling\n end", "def find_end_of_node_path(i)\n left_index = left_child_index(i)\n right_index = right_child_index(i)\n \n if left_index > @heap_size && right_index > @heap_size\n i\n elsif right_index > @heap_size\n left_index\n else\n max_child_index = -1\n left_child_value = self[left_index - 1]\n right_child_value = self[right_index - 1]\n if right_child_value && left_child_value > right_child_value\n max_child_index = left_index\n else\n max_child_index = right_index\n end\n find_end_of_node_path max_child_index\n end\n end", "def branch(left, right)\n left,right = [left,right].sort_by{|n| n.x}\n if nodes = selected.branch(left, right)\n index = @branches.index( self.selected )\n @branches.delete_at index\n @branches.insert index, *nodes\n self.selected = @selected_node.children.first\n end\n end", "def swim index\n parent_index = (index - 1) / 2\n\n # continue to bubble upward while we have not reached the root,\n # and while we are less than the parent element\n while (index > 0 && less_than?(index, parent_index))\n \n # swap the two values\n swap_values_at(index, parent_index)\n index = parent_index\n # set new parent index based on the bubble up\n parent_index = (index - 1) / 2\n end\n end", "def swap_parent_reference_to_node(parent, first_node, second_node)\n unless parent.nil?\n kids = parent.kids\n index = kids.index first_node\n kids[index] = second_node\n end\n end", "def calculate_up_child\n # Guard condition for movement not possible\n return nil if blank_y + 1 == size\n\n # Make the movement\n new_state = swap_up\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y + 1)\n end", "def set_next_node(data)\n data_placed = false\n temp = @root\n until data_placed\n if data == temp.value\n data_placed = true\n elsif data < temp.value\n if temp.left_child.nil?\n temp.left_child = Node.new(data, temp)\n data_placed = true\n else\n temp = temp.left_child\n end\n else # data > temp.value\n if temp.right_child.nil?\n temp.right_child = Node.new(data, temp)\n data_placed = true\n else\n temp = temp.right_child\n end\n end\n end\n end", "def calculate_down_child\n # Guard condition for movement not possible\n return nil if blank_y - 1 < 0\n\n # Make the movement\n new_state = swap_down\n\n # Avoids loop\n parents_array = parent_states(10)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x, blank_y - 1)\n end", "def swap(_first_key_previous, _first_key_element, _second_key_previous, _second_key_element)\n if _first_key_element.present? and _second_key_element.present?\n if _first_key_previous.blank? #Frist key element is head element\n temp_element = _second_key_element.next\n\n _second_key_element.next = _first_key_element.next\n self.head = _second_key_element\n\n _first_key_element.next = temp_element\n _second_key_previous.next = _first_key_element\n elsif _second_key_previous.blank? #Second key element is head element\n temp_element = _first_key_element.next\n\n _first_key_element.next = _second_key_element.next\n self.head = _first_key_element\n\n _second_key_element.next = temp_element\n _first_key_previous.next = _second_key_element\n else # None of the elemenet is head\n\n # Not sure what was the issue in this login\n # temp_element = _second_key_element.next\n\n # _second_key_element.next = _first_key_element.next\n # _first_key_previous.next = _second_key_element\n\n # _first_key_element.next = temp_element\n # _second_key_previous.next = _first_key_element\n\n\n _first_key_previous.next = _second_key_element\n _second_key_previous.next = _first_key_element\n\n temp_element = _second_key_element.next\n _second_key_element.next = _first_key_element.next\n _first_key_element.next = temp_element\n\n end\n else\n puts \"element not found\"\n end\n end", "def right_rotate(node)\n l_child = node.l\n if node.p\n node == node.p.l ? node.p.l = l_child : node.p.r = l_child\n else\n @root = l_child\n end\n node.l = l_child.r\n l_child.r.p = node\n l_child.r = node\n l_child.p = node.p\n node.p = l_child\n end", "def adjust(node)\n sib = sibling node\n if sib && sib.color == RED\n # case 3 - 1\n sib == node.p.r ? left_rotate(node.p) : right_rotate(node.p)\n sib.color, node.p.color = node.p.color, sib.color\n adjust(node)\n elsif sib && sib.color == BLACK\n return if sib.key == nil\n if sib.l.color == BLACK && sib.r.color == BLACK\n # case 3 - 2, sib.p is black, change color\n if sib.p.color == RED\n sib.color, sib.p.color = RED, BLACK\n else\n sib.color = RED\n adjust(node.p)\n end \n elsif sib.l.color == RED && sib.r.color == BLACK && node == node.p.l\n # case 3 - 4 - 3\n right_rotate(sib)\n sib.color, sib.p.color = sib.p.color, sib.color\n adjust(node) \n elsif sib.r.color == RED && sib.l.color == BLACK && node == node.p.r\n # case 3 - 4 - 4\n left_rotate(sib)\n sib.color, sib.p.color = sib.p.color, sib.color\n adjsut(node)\n elsif sib.r.color == RED && node == node.p.l\n # case 3 - 4 - 2\n left_rotate(node.p)\n # sib's color must be black\n sib.color, node.p.color = node.p.color, sib.color\n sib.r.color = BLACK\n elsif sib.l.color == RED && node == node.p.r\n # case 3 - 4 - 1\n right_rotate(node.p)\n sib.color, node.p.color = node.p.color, sib.color\n sib.l.color = BLACK\n end\n end\n end", "def swap_children\r\n tempChild = leftChild\r\n self.leftChild= rightChild\r\n self.rightChild= tempChild\r\n end", "def convert_to_mirror_preorder(node)\n return if node.nil?\n\n # swap the left and right nodes at current level.\n temp = node.left\n node.left = node.right\n node.right = temp\n\n # pre-order traversal\n convert_to_mirror(node.left) unless node.left.nil?\n convert_to_mirror(node.right) unless node.right.nil?\nend", "def postorder(node)\n return if !node\n postorder(node.left_child)\n postorder(node.right_child)\n print node.value, \" \"\n end", "def swap(node_or_tags)\n replace node_or_tags\n self\n end", "def swap_right\n # Creates new state matrix\n new_state = current_state_dup\n\n # Swap values\n new_state[blank_y][blank_x] = new_state[blank_y][blank_x - 1]\n new_state[blank_y][blank_x - 1] = 0\n\n # Returns new matrix\n new_state\n end", "def explore_upwards(node)\n node = node.parent until node.parent.nil? || node.parent.left == node\n node.parent.nil? ? nil : node.parent.data\nend", "def remove_found_node(node)\n #at most one child of new_node, new_node will be removed directly\n if node.left.nil? or node.right.nil?\n #the root is deleted\n if node.parent.nil?\n @root=nil\n node=nil\n return\n end\n r = node\n else\n # new_node has two children --> will be replaced by successor\n r = successor(node)\n node.value = r.value\n end\n\n if r.left.nil?\n p = r.right;\n else\n p = r.left;\n end\n\n unless p.nil?\n p.parent = r.parent;\n end\n if r.parent.nil?\n this.root = p;\n else\n if r==r.parent.left\n r.parent.left=p;\n else\n r.parent.right = p\n # balancing must be done until the root is reached.\n end\n end\n recursive_balance(r.parent)\n r = nil\n end", "def mid_borrows_from_right\n @mid.type, @mid.value1, @value2, @mid.mid = 2, @value2, @right.value1, @right.left\n @right.shift_left\n @right.type = 2\n end", "def explore_downwards(node)\n node = node.left until node.left.nil?\n node.data\nend", "def reverse_direction node\n case node\n when :up\n :down\n when :down\n :up\n when :left\n :right\n when :right\n :left\n else\n nil\n end\n end", "def swap_parents_references_to_nodes(first_node, second_node)\n # store a reference to the second's parent while it is overwritten\n temp_parent = second_node.parent\n\n swap_parent_reference_to_node(first_node.parent, first_node, second_node)\n swap_parent_reference_to_node(temp_parent, second_node, first_node)\n end", "def heapify_up\n # Swap the current_node (starting with last child) with it's parent if it is smaller\n previous_current_node = nil\n current_node = @nodes.size - 1\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n parent_node = parent(current_node)\n \n # Bounds check for when the current_node is the root\n break if current_node.zero? \n\n # Swap with the parent if the parent is bigger\n if @nodes[current_node] < @nodes[parent_node]\n @nodes[current_node], @nodes[parent_node] = @nodes[parent_node], @nodes[current_node]\n current_node = parent_node\n end\n end\n end", "def shift\n return default if (node = @tree.minimum).nil? \n @tree.delete node\n node.to_a\n end", "def shift\n node = first\n first = node.nxt\n first.prv = nil\n node.nxt = nil\n node\n end", "def find_next node\r\n return if node == nil\r\n\r\n if node.left != nil\r\n return node.left\r\n end\r\n\r\n node.right\r\nend", "def move_node!(tg,tga,i)\n #first just add node i in\n tga[0].each_index do |ii|\n if (i == tga[0][ii][0])\n tg[0].push(tga[0][ii])\n tga[0][ii] = nil\n break\n end\n end\n #then add the edges, only add edges for which both nodes exist in tg \n tga[1].each_index do |ii|\n if tg[0].index{|item| item[0] == tga[1][ii][0]} && tg[0].index{|item| item[0] == tga[1][ii][1]}\n tg[1].push(tga[1][ii])\n tga[1][ii] = nil\n end\n end\n tga[0].compact!\n tga[1].compact!\nend", "def attempt_set_position_in_list(target_logical_position)\n DB.open do |db|\n ordered_siblings = db[self.class.node_model.table_name].filter(\n :root_record_id => self.root_record_id, :parent_id => self.parent_id\n ).order(:position)\n siblings_count = ordered_siblings.count\n\n target_logical_position = [target_logical_position, siblings_count - 1].min\n\n current_physical_position = self.position\n current_logical_position = ordered_siblings.where { position < current_physical_position }.count\n\n # If we are already at the correct logical position, do nothing\n return if (target_logical_position == current_logical_position)\n\n # We'll determine which node will fall to the left of our moved node, and\n # which will fall to the right. We're going to set our physical position to\n # the halfway point of those two nodes. For example, if left node is\n # position 1000 and right node is position 2000, we'll take position 1500.\n # If there's no gap, we'll create one!\n #\n left_node_idx = target_logical_position - 1\n\n if current_logical_position < target_logical_position\n # If the node is being moved to the right, we need to adjust our index to\n # compensate for the fact that everything logically shifts to the left as we\n # pop it out.\n left_node_idx += 1\n end\n\n left_node_physical_position =\n if left_node_idx < 0\n # We'll be the first item in the list (nobody to the left of us)\n nil\n else\n ordered_siblings.offset(left_node_idx).get(:position)\n end\n\n right_node_idx = left_node_idx + 1\n\n right_node_physical_position =\n if right_node_idx >= siblings_count\n # We'll be the last item in the list (nobody to the right of us)\n nil\n else\n ordered_siblings.offset(right_node_idx).get(:position)\n end\n\n new_position =\n if left_node_physical_position.nil? && right_node_physical_position.nil?\n # We're first in the list!\n new_position = TreeNodes::POSITION_STEP\n else\n if right_node_physical_position.nil?\n # Add to the end\n left_node_physical_position + TreeNodes::POSITION_STEP\n else\n left_node_physical_position ||= 0\n\n if (right_node_physical_position - left_node_physical_position) <= 1\n # We need to create a gap to fit our moved node\n right_node_physical_position = ensure_gap(right_node_physical_position)\n end\n\n # Put the node we're moving halfway between the left and right nodes\n left_node_physical_position + ((right_node_physical_position - left_node_physical_position) / 2)\n end\n end\n\n self.class.dataset.db[self.class.table_name]\n .filter(:id => self.id)\n .update(:position => new_position,\n :system_mtime => Time.now)\n end\n end", "def mid_borrows_from_left\n @mid.type, @mid.mid, @mid.value1, @mid.left = 2, @mid.left, @value1, @left.right\n @left.type, @value1 = 2, @left.value2\n end", "def heapify_down(custom_start_index = 0)\n current_index = custom_start_index\n next_index = nil\n while(self.has_left_child(current_index))\n if(\n self.has_right_child(current_index) && \n self.pair_is_in_correct_order(self.get_right_child_index(current_index), self.get_left_child_index(current_index)))\n \n next_index = self.get_right_child_index(current_index)\n else\n next_index = self.get_left_child_index(current_index)\n end\n \n break if(self.pair_is_in_correct_order(current_index, next_index))\n self.swap(current_index, next_index)\n current_index = next_index\n end\n end", "def insert_into_merged_list_and_shift_left(bst_node, head)\n puts \"appending #{bst_node.value} to \" + (head.nil? ? \"nil\" : \"#{head.value}\") if $debug\n bst_node.right = head\n head = bst_node\n bst_node = bst_node.left\nend", "def reverse\n #reassign first node to point to nil\n prior_node=nil\n current_node = @first\n next_node = @first.next_node\n current_node.next_node=nil\n\n while next_node\n prior_node = current_node\n current_node = next_node\n next_node = current_node.next_node\n current_node.next_node = prior_node\n end\n last=@last\n @last=@first\n @first=last\n end", "def right_child_node(index)\n index * 2 + 2\n end", "def swap_nodes_references_to_parents(first_node, second_node)\n # no need to worry about nil references, it just works\n first_node.parent, second_node.parent = [second_node.parent, first_node.parent]\n end", "def test_add_second_node_to_right\n tree = BinarySearchTree.new\n tree.insert(50, \"movie a\")\n movie_b = tree.insert(60, \"movie b\")\n assert tree.root.right_node\n end", "def swap(index1, index2)\n @tree[index1], @tree[index2] = @tree[index2], @tree[index1]\n end", "def move_to_top\n first_sib = first_sibling\n move_to_left_of(first_sib) if first_sib && self != first_sib\n end", "def swap(parent, child)\n top = parent.parent\n sibling = relationship(parent, child) == BinaryNodeRelationship::LEFT_CHILD ? parent.right : parent.left\n bottom_left = child.left\n bottom_right = child.right\n\n child.parent = top\n if relationship(parent, child) == BinaryNodeRelationship::LEFT_CHILD\n child.left = parent\n else\n child.right = parent\n end\n\n unless top.nil?\n if relationship(top, parent) == BinaryNodeRelationship::LEFT_CHILD\n top.left = child\n else\n top.right = child\n end\n end\n\n if sibling.nil?\n # If the sibling node doesn't exist, then the child must be a left child.\n child.right = nil\n else\n if relationship(parent, sibling) == BinaryNodeRelationship::LEFT_CHILD\n child.left = sibling\n else\n child.right = sibling\n end\n sibling.parent = child\n end\n parent.left = bottom_left\n bottom_left.parent = parent unless bottom_left.nil?\n parent.right = bottom_right\n bottom_right.parent = parent unless bottom_right.nil?\n\n parent.parent = child\n @root = child if root?(child)\n end", "def breadth_first_search(target)\n queue = [@root]\n while ! queue.empty?\n node = queue.shift\n if node.value == target\n return node\n else\n if node.value > target && node.left_child != nil\n queue = queue << node.left_child\n end\n if node.value < target && node.right_child != nil \n queue = queue << node.right_child\n end\n end\n end\n return nil\n end", "def pull_node(xn)\n # nothing to do with node\n end", "def test_insert_node_to_right\n @tree.insert(\"c\")\n @tree.insert(\"a\")\n @tree.insert(\"d\")\n refute_equal nil, @tree.root.right\n end", "def merge( node, index)\n left = node.arr[index]\n right = node.arr[index + 1]\n start = left.n\n # Adding a key from node to the left child.\n left.keys[start] = node.keys[index]\n \n # Copying the keys from right to left.\n i = 0\n while (i < right.n)\n left.keys[start + 1 + i] = right.keys[i]\n i += 1\n end\n \n # Copying the child pointers from right to left.\n i = 0\n while (!left.leaf && i <= right.n)\n left.arr[start + 1 + i] = right.arr[i]\n i += 1\n end\n \n # Moving all keys after index in the current node one step forward.\n i = index + 1\n while (i < node.n)\n node.keys[i - 1] = node.keys[i]\n i += 1\n end\n \n # Moving the child pointers after (index+1) in the current node one step forward.\n i = index + 2\n while (i <= node.n)\n node.arr[i - 1] = node.arr[i]\n i += 1\n end\n # Updating the key count of child and the current node\n left.n += right.n + 1\n node.n -= 1\n return\n end", "def placeNodeNearClosestNode( base, value )\n result = 0\n if( value <= base.payload )\n if( base.leftNode )\n # Check if we're still less than the node to the left\n if( value > base.leftNode.payload)\n # Time to insert a node between leftNode and base:\n # Add a new node with leftNode as its left and base as its right\n # Set the old leftNode's rightNode to be the new node\n # Set the base's left node to be the new node\n node = Node.new(value, base.leftNode, base, nodeArray.count) \n nodeArray.push(node)\n base.leftNode.rightNode = node\n base.leftNode = node\n else\n result = -1 # Continue searching to the left\n end\n else\n # The base is the current minimum\n # Add a new far left node with the base to its right\n node = Node.new(value, nil, base, nodeArray.count) \n nodeArray.push(node)\n base.leftNode = node\n self.lowestValue = node # Update the lowest value counter with this new low\n end\n elsif( value > base.payload )\n if( base.rightNode)\n # Check if we're still more than the node to the right\n if( value <= base.rightNode.payload)\n # Time to insert a node between base and rightNode:\n # Add a new node with current as its left and rightNode as its right\n # Set the old rightNode's leftNode to be the new node\n # Set the base's right node to be the new node\n node = Node.new(value, base, base.rightNode, nodeArray.count)\n nodeArray.push(node)\n base.rightNode.leftNode = node\n base.rightNode = node\n else\n result = 1 # Continue searching to the right\n end\n else\n # The base is the current maximum\n # Add a new far right node with the base to its left\n node = Node.new(value, base, nil, nodeArray.count)\n nodeArray.push(node)\n base.rightNode = node\n self.highestValue = node # Update the highest value counter with this new max\n end\n end\n return result\nend", "def move_node_to_head(node) \n removed = remove_node(node)\n\n add_head(removed)\n end", "def insertBack(object=nil) #we need more of these\n tempNode = Node.new(object)\n tempNode.next = @last\n tempNode.prev = @last.prev\n @last.prev.next = tempNode\n @last.prev = tempNode\n @size += 1\n return @last.prev \n \n end", "def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end", "def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end", "def rebalance_for_right_insert\n\t\t\tif @right.left.red?\n\t\t\t\twith_right(@right.rotate_right)\n\t\t\telse\n\t\t\t\tself\n\t\t\tend.rotate_left\n\t\tend", "def recursive_east(node)\n # get the position of the node and separate into an array\n pos = node.position.chars\n # immediately want to create and add new node to board\n letter = pos[0].ord + 1\n new_node = Node.new(letter.chr + pos[1])\n @board.add_node(new_node)\n # now call recursive_south with newly created node\n recursive_south(@board.nodes[new_node.position])\n end", "def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend", "def left_borrows_from_mid\n @left.type, @left.value1, @value1, @left.mid = 2, @value1, @mid.value1, @mid.left\n @mid.shift_left\n @mid.type -= 1\n end", "def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end", "def successor(node)\n return if node.nil?\n # if right subtree exists, return leftmost node under it\n # i.e. this is the next higher number than the one at current node\n r = node.right\n if r\n return nil if r.nil?\n while r.left\n r = r.left\n end\n return r\n else\n # if there is no right subtree, we have to go up to parent because\n # there is no number greater than the current node\n # so we have to keep going up parents until we figure out that the\n # child was the left child of the parent because that must mean\n # the parent has to be greater in value than the current node\n current = node\n parent = current.parent\n while parent && parent.left != current\n current = parent\n parent = parent.parent\n end\n return parent\n end\nend", "def sift_down(current_idx, end_idx, heap)\n child_one_idx = current_idx * 2 + 1\n while child_one_idx <= end_idx\n child_two_idx = -1\n if (current_idx * 2 + 2) <= end_idx\n child_two_idx = current_idx * 2 + 2\n end\n\n if child_two_idx != -1 && heap[child_two_idx] < heap[child_one_idx]\n idx_to_swap = child_two_idx\n else\n idx_to_swap = child_one_idx\n end\n\n if heap[idx_to_swap] < heap[current_idx]\n self.swap(current_idx, idx_to_swap, heap)\n current_idx = idx_to_swap\n child_one_idx = current_idx * 2 + 1\n else\n break\n end\n end\n \n end", "def postorder_traversal(node=@root)\n return if (node == nil)\n puts node.value.to_s\n postorder_traversal(node.left)\n postorder_traversal(node.right)\n end", "def node_insert_after!(x, prev, level)\n netx = node_next(prev, level) # 'next' is a reserved word in ruby\n \n # forward links\n x[0][level] = netx\n prev[0][level] = x\n \n # backward links\n x[3][level] = prev\n netx[3][level] = x\n end", "def shift\n node = self.double_link_linked_list.delete_head\n node ? node.value : nil\n end", "def postorder\n # left -> right -> root\n return postorder_helper(@root)\n end", "def delete(key)\n node = search key\n if node.l.key == nil && node.r.key == nil\n # It's leaf, just replace it to null-node for its parent.\n if node.p \n null_node = RBNode.new nil, BLACK\n node.p.l == node ? node.p.l = null_node : node.p.r = null_node\n null_node.p = node.p\n adjust(null_node)\n else\n @root = nil\n end\n elsif has_one_child(node)\n child = node.r && node.r.key ? node.r : node.l\n # Only color case: child must be red leaf. node must be black.\n if node.p\n node.p.l == node ? node.p.l = child : node.p.r = child\n child.p = node.p\n else\n @root = child\n child.p = nil\n end\n child.color = node.color # must be black\n else\n succ = find_succ node\n # succ must be in right subtree of node. \n # succ has at most one child in right branch.\n\n # succ is right child of node.\n if succ && succ.key\n if succ == node.r\n if node.p \n node.p.l == node ? node.p.l = succ : node.p.r = succ\n else\n @root = succ\n end\n succ.l, succ.p = node.l, node.p\n succ.l.p = succ\n if succ.r\n if succ.color == BLACK\n if succ.r.color == RED \n succ.r.color = BLACK \n else\n succ.color = node.color\n adjust(succ.r)\n end\n end\n end\n else\n node.key, succ.key = succ.key, node.key\n if succ.p \n succ.p.l == succ ? succ.p.l = succ.r : succ.p.r = succ.r\n end\n if succ.r \n succ.r.p = succ.p \n if succ.color == BLACK\n succ.r.color == RED ? succ.r.color == BLACK : adjust(succ.r)\n end\n end \n end\n end\n end\n end" ]
[ "0.6861301", "0.6621641", "0.63294697", "0.62387097", "0.620867", "0.6160486", "0.61226386", "0.60626054", "0.60581636", "0.60091597", "0.6008396", "0.59560114", "0.5921214", "0.5921214", "0.5921214", "0.5899254", "0.58901775", "0.58901775", "0.5870264", "0.5817148", "0.5799608", "0.579895", "0.5788102", "0.5788102", "0.5778501", "0.57757753", "0.5769654", "0.5740516", "0.5712301", "0.5698496", "0.5688735", "0.56879455", "0.5686794", "0.5683719", "0.5676856", "0.5671879", "0.56700945", "0.56691414", "0.56440336", "0.5637826", "0.5629821", "0.562918", "0.562918", "0.5615103", "0.5589014", "0.55803156", "0.55797637", "0.5571466", "0.5562938", "0.55528355", "0.5552579", "0.55411184", "0.5540845", "0.5540717", "0.5539445", "0.55297273", "0.5527954", "0.5515662", "0.5514199", "0.5503734", "0.55002856", "0.5492918", "0.5489103", "0.5486845", "0.5464871", "0.5458765", "0.54400736", "0.54337656", "0.5430379", "0.5427738", "0.54247665", "0.5424364", "0.54228926", "0.5422708", "0.54224247", "0.5417276", "0.54122657", "0.5411301", "0.54077303", "0.54048246", "0.54026175", "0.5390253", "0.5375745", "0.53723973", "0.5369923", "0.5355697", "0.5347989", "0.534518", "0.5343934", "0.5339705", "0.5339305", "0.53369486", "0.53357285", "0.53214794", "0.5317797", "0.5307183", "0.53049266", "0.5296414", "0.5291307", "0.5289099", "0.52866155" ]
0.0
-1
stack + api_clients + commits | + commit_deployments | | + statuses | + statuses + github_hooks + hooks + merge_requests + tasks + chunks
def perform(stack) Shipit::ApiClient.where(stack_id: stack.id).delete_all commits_ids = Shipit::Commit.where(stack_id: stack.id).pluck(:id) tasks_ids = Shipit::Task.where(stack_id: stack.id).pluck(:id) commit_deployments_ids = Shipit::CommitDeployment.where(task_id: tasks_ids).pluck(:id) Shipit::CommitDeploymentStatus.where(commit_deployment_id: commit_deployments_ids).delete_all Shipit::CommitDeployment.where(id: commit_deployments_ids).delete_all Shipit::Status.where(commit_id: commits_ids).delete_all Shipit::Commit.where(id: commits_ids).delete_all Shipit::GithubHook.where(stack_id: stack.id).destroy_all Shipit::Hook.where(stack_id: stack.id).delete_all Shipit::MergeRequest.where(stack_id: stack.id).delete_all tasks_ids.each_slice(100) do |ids| Shipit::OutputChunk.where(task_id: ids).delete_all Shipit::Task.where(id: ids).delete_all end stack.destroy! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any_status_hook\n repo = params[:name]\n link = \"https://github.com/#{repo}\"\n sha = params[:sha]\n state = params[:state]\n context = params[:context]\n description = params[:description]\n target = params[:target_url]\n\n return if state == 'pending' || (state == 'success' && context == 'github/pages')\n\n if repo == 'Charcoal-SE/metasmoke' && context.start_with?('ci/circleci')\n ci_counter = Redis::CI.new(sha)\n if state == 'success'\n ci_counter.sucess_count_incr\n return unless ci_counter.sucess_count == 3\n context = 'ci/circleci'\n else\n ci_counter.sucess_count_reset\n end\n end\n\n message = \"[ [#{repo.sub('Charcoal-SE/', '')}](#{link}) ]\"\n message += \" #{context} \"\n message += if target.present?\n \"[#{state}](#{target})\"\n else\n state\n end\n message += \" on [#{sha.first(7)}](#{link}/commit/#{sha.first(10)})\"\n message += \": #{description}\" if description.present?\n\n ActionCable.server.broadcast 'smokedetector_messages', message: message\n end", "def status_hook\n # We're not interested in PR statuses or branches other than deploy\n unless params[:branches].index { |b| b[:name] == 'deploy' }\n render(plain: 'Not a commit on deploy. Uninterested.') && return\n end\n\n # Create a new CommitStatus\n\n if CommitStatus.find_by(commit_sha: params[:sha])\n render plain: 'Already recorded status for commit', status: 200\n return\n end\n\n if params[:state] == 'pending'\n render plain: \"We don't record pending statuses\", status: 200\n return\n end\n\n commit_sha = params[:sha]\n status = params[:state]\n commit_message = params[:commit][:commit][:message]\n ci_url = params[:target_url]\n\n ActionCable.server.broadcast 'smokedetector_messages', commit_status: {\n status: status,\n ci_url: ci_url,\n commit_sha: commit_sha,\n commit_message: commit_message\n }\n CommitStatus.create(commit_sha: commit_sha, status: status)\n\n render plain: 'OK', status: 200\n end", "def ci_hook\n case request.headers['HTTP_X_GITHUB_EVENT']\n when 'pull_request'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n case data['action']\n when 'opened', 'synchronize'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'pending',\n description: 'An Approve review is required before pull requests can be merged.',\n context: 'metasmoke/ci'\n )\n end\n render plain: \"#{commits.length} commits set to pending.\"\n else\n render(plain: 'Not a newly-opened or updated PR; not interested.') && return\n end\n when 'pull_request_review'\n data = JSON.parse(request.raw_post)\n pull_request = data['pull_request']\n review = data['review']\n if data['action'] == 'submitted' && review['state'] == 'approved'\n commits = JSON.parse(Net::HTTP.get_response(URI.parse(pull_request['commits_url'])).body)\n commits.each do |commit|\n APIHelper.authorized_post(\n \"https://api.github.com/repos/Charcoal-SE/SmokeDetector/statuses/#{commit['sha']}\",\n state: 'success',\n description: 'PR approved :)',\n context: 'metasmoke/ci'\n )\n end\n\n render plain: \"#{commits.length} commits approved.\"\n else\n render(plain: 'Not a submitted Approve review; not interested.') && return\n end\n else\n render(plain: \"Pretty sure we don't subscribe to that event.\") && return\n end\n end", "def git_upload_pack\n enqueue_fetch_statistics_update\n\n render_ok\n end", "def deploy_steps\n [\n \"deploy:bump_version\",\n \"plugins:fetch[#{heroku_plugin_set}]\",\n \"plugins:install[fetched]\",\n \"deploy:build\",\n \"deploy:commit\",\n \"deploy:push\",\n \"deploy:cleanup\"\n ].join(' ')\nend", "def github_post\n {\n \"create\" => ->(release) { start_deployment(release) },\n \"update_status\" => ->(release) { update_deployment(release) }\n }\n end", "def post_receive_payloads(refs, project=nil)\n\t\tproject ||= @project\n\t\tpayloads = []\n\t\trefs.each do |ref|\n\t\t\toldhead, newhead, refname = ref.split(',')\n\n\t\t\t# Only pay attention to branch updates\n\t\t\tnext if not refname.match(/refs\\/heads\\//)\n\t\t\tbranch = refname.gsub('refs/heads/', '')\n\n\t\t\tif newhead.match(/^0{40}$/)\n\t\t\t\t# Deleting a branch\n\t\t\t\tGitHosting.logger.debug \"Deleting branch \\\"#{branch}\\\"\"\n\t\t\t\tnext\n\t\t\telsif oldhead.match(/^0{40}$/)\n\t\t\t\t# Creating a branch\n\t\t\t\tGitHosting.logger.debug \"Creating branch \\\"#{branch}\\\"\"\n\t\t\t\trange = newhead\n\t\t\telse\n\t\t\t\trange = \"#{oldhead}..#{newhead}\"\n\t\t\tend\n\n\t\t\trevisions_in_range = %x[#{GitHosting.git_exec} --git-dir='#{GitHosting.repository_path(project)}' rev-list --reverse #{range}]\n\t\t\t#GitHosting.logger.debug \"Revisions in Range: #{revisions.split().join(' ')}\"\n\n\t\t\tcommits = []\n\t\t\trevisions_in_range.split().each do |rev|\n\t\t\t\trevision = project.repository.find_changeset_by_name(rev.strip)\n\t\t\t\tcommit = {\n\t\t\t\t\t:id => revision.revision,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"revision\", \n\t\t\t\t\t\t:id => project, :rev => rev, :only_path => false, \n\t\t\t\t\t\t:host => Setting['host_name'], :protocol => Setting['protocol']\n\t\t\t\t\t),\n\t\t\t\t\t:author => {\n\t\t\t\t\t\t:name => revision.committer.gsub(/^([^<]+)\\s+.*$/, '\\1'),\n\t\t\t\t\t\t:email => revision.committer.gsub(/^.*<([^>]+)>.*$/, '\\1')\n\t\t\t\t\t},\n\t\t\t\t\t:message => revision.comments,\n\t\t\t\t\t:timestamp => revision.committed_on,\n\t\t\t\t\t:added => [],\n\t\t\t\t\t:modified => [],\n\t\t\t\t\t:removed => []\n\t\t\t\t}\n\t\t\t\trevision.changes.each do |change|\n\t\t\t\t\tif change.action == \"M\"\n\t\t\t\t\t\tcommit[:modified] << change.path\n\t\t\t\t\telsif change.action == \"A\"\n\t\t\t\t\t\tcommit[:added] << change.path\n\t\t\t\t\telsif change.action == \"D\"\n\t\t\t\t\t\tcommit[:removed] << change.path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tcommits << commit\n\t\t\tend\n\n\t\t\tpayloads << {\n\t\t\t\t:before => oldhead,\n\t\t\t\t:after => newhead,\n\t\t\t\t:ref => refname,\n\t\t\t\t:commits => commits,\n\t\t\t\t:repository => {\n\t\t\t\t\t:description => project.description,\n\t\t\t\t\t:fork => false,\n\t\t\t\t\t:forks => 0,\n\t\t\t\t\t:homepage => project.homepage,\n\t\t\t\t\t:name => project.identifier,\n\t\t\t\t\t:open_issues => project.issues.open.length,\n\t\t\t\t\t:owner => {\n\t\t\t\t\t\t:name => Setting[\"app_title\"],\n\t\t\t\t\t\t:email => Setting[\"mail_from\"]\n\t\t\t\t\t},\n\t\t\t\t\t:private => !project.is_public,\n\t\t\t\t\t:url => url_for(:controller => \"repositories\", :action => \"show\", \n\t\t\t\t\t\t:id => project, :only_path => false, \n\t\t\t\t\t\t:host => Setting[\"host_name\"], :protocol => Setting[\"protocol\"]\n\t\t\t\t\t),\n\t\t\t\t\t:watchers => 0\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\t\tpayloads\n\tend", "def add_standard_git_tasks\n command(:remove_cache, :in_app_dir => false) do |app|\n directory = dir_for_app(app)\n if File.exists?(directory)\n puts \"Removing cached app #{app} at #{directory}\"\n FileUtils.rm_rf directory\n end\n end\n\n command(:clone, :in_app_dir => false) do |app|\n url = Zim.current_suite.application_by_name(app).git_url\n\n app_directory = dir_for_app(app)\n container_directory = File.dirname(app_directory)\n FileUtils.mkdir_p container_directory unless File.exists?(container_directory)\n directory_exists = File.directory?(app_directory)\n\n if directory_exists\n found = false\n in_app_dir(app) do\n `git remote -v`.split(\"\\n\").each do |line|\n elements = line.split(/[ \\t]+/)\n if elements[0] == 'origin' && elements[1] == url && elements[2] == '(fetch)'\n found = true\n break\n end\n end\n end\n unless found\n mysystem(\"rm -rf #{app_directory}\")\n directory_exists = false\n end\n end\n\n mysystem(\"git clone #{url}\") unless directory_exists\n end\n\n command(:gitk) do\n mysystem('gitk --all &') if Zim.cwd_has_unpushed_changes?\n end\n\n command(:fetch) do\n git_fetch\n end\n\n command(:reset) do\n git_reset_branch\n end\n\n command(:reset_origin) do\n git_reset_branch(\"origin/#{current_default_branch}\")\n end\n\n command(:git_reset_if_unchanged) do\n git_reset_if_unchanged\n end\n\n command(:diff_origin) do\n git_diff\n end\n\n command(:hub_pull_request) do\n hub_pull_request(Zim::Config.parameter_by_name('PR_MESSAGE'))\n end\n\n command(:goto_default_branch) do\n git_checkout\n end\n\n command(:pull) do\n git_pull\n end\n\n command(:git_prune) do\n git_prune\n end\n\n command(:git_gc) do\n git_gc\n end\n\n command(:push) do |app|\n run(:git_reset_if_unchanged, app)\n git_push if Zim.cwd_has_unpushed_changes?\n end\n\n command(:remove_local_branches) do |app|\n git_local_branch_list.select {|b| b != current_default_branch}.each do |branch|\n mysystem(\"git branch -D #{branch}\")\n end\n end\n\n command(:clean, :in_app_dir => false) do |app|\n run(:clone, app)\n run(:git_gc, app)\n run(:fetch, app)\n run(:reset, app)\n run(:goto_default_branch, app)\n run(:remove_local_branches, app)\n run(:pull, app)\n end\n\n command(:branch) do |app|\n git_checkout(Zim::Config.parameter_by_name('BRANCH'), true)\n end\n\n command(:real_clean, :in_app_dir => false) do |app|\n run(:clean, app)\n run(:reset_origin, app)\n end\n\n command(:ultra_clean, :in_app_dir => false) do |app|\n run(:real_clean, app)\n run(:git_prune, app)\n run(:git_gc, app)\n end\n\n desc 'Run following commands for each branch in the tag zim:branches (comma separated)'\n command(:each_zim_branch, :block_command => true) do |app_key|\n app = Zim.current_suite.application_by_name(app_key)\n branches = (app.tag_value('zim:branches') || current_default_branch).split(',')\n branches.each do |branch|\n git_checkout(branch)\n Zim::Driver.run_commands(app, Zim.current_commands)\n end\n\n # Return false so subsequent tasks not run\n false\n end\n\n desc 'Run ultra_clean and then each_zim_branch. Typically the first task.'\n command(:zimup, :in_app_dir => false, :block_command => true) do |app|\n run(:ultra_clean, app)\n run(:each_zim_branch, app)\n false\n end\n end", "def deploy\n update_repositories\n sync_service_environment_files\n # deploy_services\n response\n end", "def handle_repos_response(queue, uri, parameters, response, execution_time)\n # Decode JSON\n body = JSON.parse(response.body)\n\n #@logger.info(\"Handle Repos Response\", :uri => uri, :project => parameters[:project], :start => body['start'], :size => body['size'])\n\n request_count = 0\n\n # Fetch addition repo pages\n unless body['isLastPage']\n request_async(\n queue,\n \"rest/api/1.0/projects/%{project}/repos\",\n {:project => parameters[:project]},\n {:query => {'start' => body['nextPageStart']}},\n 'handle_repos_response'\n )\n\n client.execute!\n end\n\n # Iterate over each repo\n body['values'].each { |repo|\n #@logger.info(\"Add repo\", :project => parameters[:project], :repo => repo['slug'])\n\n # Send get pull requests request\n request_async(\n queue,\n \"rest/api/1.0/projects/%{project}/repos/%{repo}/pull-requests\",\n {:project => parameters[:project], :repo => repo['slug']},\n {:query => {'state' => 'ALL'}},\n 'handle_pull_requests_response')\n # Semd Branch requests request\n request_async(\n queue,\n \"rest/api/1.0/projects/%{project}/repos/%{repo}/branches\",\n {:project => parameters[:project], :repo => repo['slug']},\n {:query => {'state' => 'ALL'}},\n 'handle_branch_response')\n\n request_async(\n queue,\n \"rest/api/1.0/projects/%{project}/repos/%{repo}/commits\",\n {:project => parameters[:project], :repo => repo['slug']},\n {:query => {'state' => 'ALL'}},\n 'handle_commits_response')\n request_count +=1\n\n if request_count > 1\n request_count = 0\n client.execute!\n end\n\n # Push repo event into queue\n event = LogStash::Event.new(repo)\n event.set(\"[@metadata][index]\", \"repo\")\n event.set(\"[@metadata][id]\", repo['id'])\n queue << event\n }\n\n if request_count > 0\n # Send HTTP requests\n client.execute!\n end\n end", "def fetch_github_information\n self.associated_commit_shas = []\n self.branch_name = nil\n self.username = nil\n\n return if self.dev_build\n\n GithubService.run(self.project.github_root_url, self.project.github_repo) do |service|\n if self.is_branch_build\n self.associated_commit_shas = service.github_commits(10, self.commit_sha)\n self.branch_name = nil\n self.username = nil\n else\n self.associated_commit_shas = []\n info = service.user_and_branch_for_pull_request(self.pull_request_number)\n self.username = info[:user]\n self.branch_name = info[:branch]\n end\n end\n end", "def commits\n @commits ||= ApiFactory.new 'GitData::Commits'\n end", "def github_combined_status\n expires_in = ->(reply) { cache_duration(reply) }\n Samson::DynamicTtlCache.cache_fetch_if true, cache_key(@commit), expires_in: expires_in do\n results = Samson::Parallelizer.map(\n [\n -> { octokit_error_as_status('checks') { github_check_status } },\n -> { octokit_error_as_status('status') { github_commit_status } }\n ],\n &:call\n ).compact.select { |result| result[:statuses].any? }\n\n results.empty? ? NO_STATUSES_REPORTED_RESULT.dup : merge_statuses(results)\n end\n end", "def repo_commits(repos)\n repos_commits = []\n repos.each do |repo|\n repos_commits << HTTParty.get(repo[\"commits_url\"].gsub(\"{/sha}\", \"\"))[0]\n end\n repos_commits\nend", "def deploy_tree(endpoint, tree_name, branch_name, repo_url, repo_path, config_obj, tree_deploy_counter)\n # rubocop:enable Metrics/ParameterLists\n base = config_obj['base_dir']\n email_body = ''\n\n stream do |body_content|\n body_content << \"endpoint: #{endpoint}\\n\"\n body_content << \"tree: #{tree_name}\\n\"\n body_content << \"branch: #{branch_name}\\n\"\n body_content << \"repo_url: #{repo_url}\\n\"\n body_content << \"repo_path: #{repo_path}\\n\"\n body_content << \"base: #{base}\\n\"\n body_content << \"\\n\"\n\n logger.info(\"endpoint: #{endpoint}\")\n logger.info(\"tree: #{tree_name}\")\n logger.info(\"branch: #{branch_name}\")\n logger.info(\"repo_url: #{repo_url}\")\n logger.info(\"repo_path: #{repo_path}\")\n logger.info(\"base: #{base}\")\n\n if Dir.exist?(base)\n Dir.chdir(base)\n\n if repo_path.nil?\n repo_exists = nil\n abort('No repo path was set.')\n else\n repo_exists = Dir.exist?(\"./#{repo_path}\")\n end\n\n if repo_exists\n Dir.chdir(repo_path)\n deploy_command = 'git pull'\n elsif branch_name.eql? ''\n deploy_command = \"git clone #{repo_url} #{repo_path}\"\n else\n deploy_command = \"git clone -b #{branch_name} --single-branch #{repo_url} #{repo_path}\"\n\n end\n\n body_content << \"Running #{deploy_command}\\n\"\n logger.info(\"Running #{deploy_command}\")\n\n Open3.popen2e(deploy_command) do |_stdin, stdout_err, wait_thr|\n # rubocop:disable Lint/AssignmentInCondition\n email_body << \"endpoint: #{endpoint}\\n\"\n email_body << \"tree: #{tree_name}\\n\"\n email_body << \"branch: #{branch_name}\\n\"\n email_body << \"repo_url: #{repo_url}\\n\"\n email_body << \"repo_path: #{repo_path}\\n\"\n email_body << \"base: #{base}\\n\\n\"\n email_body << \"Deploy command: #{deploy_command}\\n\\n\"\n while line = stdout_err.gets\n body_content << line\n email_body << line\n logger.info(line)\n end\n # rubocop:enable Lint/AssignmentInCondition\n\n exit_status = wait_thr.value\n if exit_status.success?\n status 200\n # body body_content\n else\n status 500\n # body body_content\n pony_email_options = config_obj['pony_email_options']\n pony_email_defaults = { body: email_body.to_s, subject: 'Tree Planter Deployment Problem' }\n email_reseults(pony_email_options, pony_email_defaults) if config_obj['send_email_on_failure']\n end\n end # end Open3\n\n tree_deploy_counter.increment(labels: {\n tree_name: tree_name,\n branch_name: branch_name,\n repo_path: repo_path,\n endpoint: endpoint\n })\n else\n status 500\n msg = \"#{base} cannot be found\"\n body_content << \"#{msg}\\n\"\n logger.info(msg)\n end\n end\n end", "def process_meta(repo, versions)\n @releases.push(\"#{repo_human(repo)} #{versions.last + @increment}\")\n @footer_locations.push(build_footer_locations(repo, versions.last + @increment))\n @tags.push(repo.sub('cockpit-', ''))\nend", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Github pages..'\n puts %x[git push origin HEAD:gh-pages --force]\nend", "def commits\n event_hash = GithubService.new(self).event_info\n event_hash.each_with_object(Hash.new(0)) do |event, hash|\n if event[:type] == \"PushEvent\" || event[:type] == \"CreateEvent\"\n hash[event[:repo][:name]] += 1\n end\n end\n end", "def commits\n @commits ||= ApiFactory.new 'Projects::Commits'\n end", "def do_hook(c)\n sp = c[\"head_commit\"][\"message\"].split \"#\"\n taskid = sp[-1].to_i\n da_task = self.tasks.find(taskid)\n\n if da_task then\n commit = Commit.new\n commit.author_email = c[\"head_commit\"][\"author\"][\"email\"]\n commit.author_name = c[\"head_commit\"][\"author\"][\"name\"]\n commit.message = c[\"head_commit\"][\"message\"]\n commit.url = c[\"head_commit\"][\"url\"]\n commit.sha = c[\"head_commit\"][\"id\"]\n commit.date = c[\"head_commit\"][\"timestamp\"]\n commit.task_id = taskid\n commit.save\n end\n end", "def commits!\n response = @client.get_json(\"#{path}/commits\")\n @commits = response.map do |commit| \n Commit.new(client: @client, user: @user, repo: self, sha: commit['sha']) \n end\n @commits\n end", "def metasmoke_push_hook\n Rails.cache.delete_matched %r{code_status/.*##{CurrentCommit}}\n end", "def setup_worker_data\n @repo_full_name = project.repo_config.full_name\n logger.debug(\"Checking for new commits: #{project.project_name} (#{repo_full_name})\")\n\n # Get all the most recent builds sorted by newest timestamps.\n @builds = FastlaneCI::Services.build_service.list_builds(project: project)\n\n # Get the branch names associated with the user-defined commit triggers.\n @branches = project.find_triggers_of_type(trigger_type: :commit).map(&:branch).to_set\n end", "def process_repos\n url_template = if @options.preview\n 'https://api.github.com/search/issues?q=is:pr+repo:cockpit-project/REPO+label:release-note'\n else\n 'https://api.github.com/search/issues?q=is:pr+repo:cockpit-project/REPO+label:release-note+is%3Aclosed'\n end\n tags_template = 'https://api.github.com/repos/cockpit-project/REPO/tags'\n\n @repos.map do |repo|\n # Grab relevant issues for the repo\n url = url_template.sub('REPO', repo)\n\n # Process versions\n url_tags = tags_template.sub('REPO', repo)\n versions = get_json(url_tags).map { |tag| tag['name'].to_i }.sort\n # Set the Cockpit version from the first repo (which is always Cockpit)\n @cockpit_version ||= versions.last + @increment\n\n notes = get_json(url)['items']\n .map { |issue| format_issue(issue, repo) }\n\n process_meta(repo, versions) unless notes.empty?\n\n notes\n end\nend", "def mock_deploys_with(statuses)\n expect_actions_executor_runs(statuses.map do |status|\n status = { 'node' => status } if status.is_a?(Array)\n expected_actions_for_deploy_on(\n services: status.keys.map { |node| [node, %w[service]] }.to_h,\n mocked_deploy_result: status\n )\n end.flatten)\n end", "def recent_commits\n public_events = @client.user_public_events @user[:login]\n public_events.select! { |e| e[:type] == \"PushEvent\" }\n commits = []\n public_events.each do |e|\n e[:payload][:commits].each do |c|\n c[:html_url] = \"https://github.com/#{e[:repo][:name]}/commit/#{c[:sha]}\"\n c[:shortcut] = \"#{e[:repo][:name]}@#{c[:sha][0..7]}\"\n end\n commits.concat e[:payload][:commits]\n end\n commits.take 15\nend", "def list\n if today?\n commits = commits_today(repo, branch)\n elsif yesterday?\n commits = commits_yesterday(repo, branch)\n elsif this_week?\n commits = commits_this_week(repo, branch)\n elsif last_week?\n commits = commits_last_week(repo, branch)\n elsif this_month?\n commits = commits_this_month(repo, branch)\n elsif after && before\n commits = commits_between(repo, branch, after, before)\n elsif after\n commits = commits_after(repo, branch, after)\n elsif before\n commits = commits_before(repo, branch, before)\n else\n commits = all_commits(repo, branch)\n end\n\n write_json(commits.map(&:to_h))\n end", "def commit_status(sha, ref)\n # implement inside child\n end", "def run\n user_credentials = Hash.new('')\n user_credentials[:user_id] = @user_id\n user_credentials[:user_token] = @user_token\n\n # Repos in a clean state are required in order to change to the proper tag\n cleanup_repos(dirty_repos)\n update_repos\n\n dir = dot_futureadvisor\n github_tag = GithubReleaseTag.new(user_credentials)\n\n # Iterate through each of the services listed above\n # to retrieve latest dashboard tag or branch\n Services::SERVICES.each_pair do |service_name, service|\n repo = service[:name]\n\n # Grab either the tag (if on prod) or branch name (if opts[:prod] is 'false')\n tag_or_branch = @prod ? github_tag.latest_valid_tag(service) : service[:dev_branch]\n puts \"Updating #{repo} to #{tag_or_branch}\"\n puts Open3.capture3(\"pushd #{dir} 2>&1; ./bin/dev update_repo #{repo} #{tag_or_branch} 2>&1; popd 2>&1\")\n\n if service_name == :managementgateway\n puts \"removing server.pid file from #{repo}\"\n `pushd #{dir}; rm -f tmp/pids/server.pid; popd`\n end\n end\n\n # We need to start up all the containers, not just fa/fe/mg, or else\n # they won't have access to necessary services and will exit\n puts 'Initializing containers'\n puts Open3.capture3(\"pushd #{dir} 2>&1; ./bin/dev init2 2>&1; popd 2>&1\")\n end", "def stub_pipeline_info_command(heroku_token, github_token)\n stub_pipelines_command(heroku_token)\n\n response_info =\n fixture_data(\"api.heroku.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/pipeline-couplings\")\n stub_request(:get, \"https://api.heroku.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/pipeline-couplings\")\n .with(headers: default_heroku_headers(heroku_token))\n .to_return(status: 200, body: response_info, headers: {})\n\n response_info = fixture_data(\"api.heroku.com/apps/27bde4b5-b431-4117-9302-e533b887faaa\")\n stub_request(:get, \"https://api.heroku.com/apps/27bde4b5-b431-4117-9302-e533b887faaa\")\n .with(headers: default_heroku_headers(heroku_token))\n .to_return(status: 200, body: response_info, headers: {})\n\n response_info = fixture_data(\"kolkrabbi.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/repository\")\n stub_request(:get, \"https://kolkrabbi.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/repository\")\n .to_return(status: 200, body: response_info)\n\n response = fixture_data(\"api.github.com/repos/atmos/hubot/index\")\n stub_request(:get, \"https://api.github.com/repos/atmos/hubot\")\n .with(headers: default_github_headers(github_token))\n .to_return(status: 200, body: response, headers: {})\n\n response_info = fixture_data(\"api.github.com/repos/atmos/hubot/branches/production\")\n stub_request(:get, \"https://api.github.com/repos/atmos/hubot/branches/production\")\n .to_return(status: 200, body: response_info, headers: {})\n end", "def stacks\n rows = []\n Launcher::Stacks.new.all_statuses { |s| rows << [s[:name], s[:updated_at], s[:status]] }\n Launcher::Log.ok \"\\n\", Terminal::Table.new(:headings => [\"Name\", \"Updated At\", \"Status\"], :rows => rows)\n end", "def show\n @repo = Hubstats::Repo.where(name: params[:repo]).first\n @pull_requests = Hubstats::PullRequest.belonging_to_repo(@repo.id).merged_in_date_range(@start_date, @end_date).order(\"updated_at DESC\").limit(50)\n @pull_count = Hubstats::PullRequest.belonging_to_repo(@repo.id).merged_in_date_range(@start_date, @end_date).count(:all)\n @deploys = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_in_date_range(@start_date, @end_date).order(\"deployed_at DESC\").limit(50)\n @deploy_count = Hubstats::Deploy.belonging_to_repo(@repo.id).deployed_in_date_range(@start_date, @end_date).count(:all)\n @comment_count = Hubstats::Comment.belonging_to_repo(@repo.id).created_in_date_range(@start_date, @end_date).count(:all)\n @users = Hubstats::User.with_pulls_or_comments_or_deploys(@start_date, @end_date, @repo.id).only_active.order(\"login ASC\").limit(50)\n @active_user_count = Hubstats::User.with_pulls_or_comments_or_deploys(@start_date, @end_date, @repo.id).only_active.length\n @qa_signoff_count = Hubstats::QaSignoff.belonging_to_repo(@repo.id).signed_within_date_range(@start_date, @end_date).count(:all)\n @net_additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).sum(:additions).to_i -\n Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).sum(:deletions).to_i\n @additions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).average(:additions)\n @deletions = Hubstats::PullRequest.merged_in_date_range(@start_date, @end_date).belonging_to_repo(@repo.id).average(:deletions) \n\n stats\n end", "def get_my_pull_requests\n repos_to_get = GITHUB_REPOS.kind_of?( Array ) ? GITHUB_REPOS : get_my_repos\n\n repos_to_get.each do |repo|\n status = []\n pulls_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/pulls?state=open\"\n\n get_json( pulls_url ).each_with_index do |item, index|\n sha = item[ 'head' ][ 'sha' ]\n status_url = \"#{ GITHUB_REPOS_URL }/#{ repo }/commits/#{ sha }/status\"\n\n status << get_json( status_url )\n\n unless item[ 'assignee' ].nil?\n if item[ 'assignee' ][ 'login' ] == ENV[ 'GITHUB_USERNAME' ]\n color = ''\n state = status[ index ][ 'state' ]\n\n unless status[ index ][ 'statuses' ].empty?\n color = \"| color=#{ determine_status_color( state )}\"\n end\n\n puts \"#{ repo }: ##{ item[ 'number' ] } #{ item[ 'title' ] } #{ color } | href=#{ item[ 'html_url' ] }\"\n end\n end\n end\n end\nend", "def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend", "def process\n Puppet.debug \"Sending status for #{self.host} to StackState server at #{STACKSTATE_URL}\"\n\n payload = <<-END\n {\n \"collection_timestamp\": #{self.time.to_i},\n \"events\": {\n \"puppet\": [\n {\n \"context\": {\n \"category\": \"Changes\",\n \"data\": {\n \"configuration_version\": \"#{self.configuration_version.to_s}\",\n \"transaction_uuid\": \"#{self.transaction_uuid}\",\n \"catalog_uuid\": \"#{self.catalog_uuid}\",\n \"status\": \"#{self.status}\"\n },\n \"element_identifiers\": [\n \"urn:host:/#{self.host}\"\n ],\n \"source\": \"Puppet\",\n \"source_id\": \"#{self.transaction_uuid}\",\n \"source_links\": [\n {\n \"title\": \"Puppet console\",\n \"url\": \"https://#{PUPPETCONSOLE_HOST}/#/node_groups/inventory/node/#{self.host}/reports\"\n }\n ]\n },\n \"event_type\": \"ConfigurationChangedEvent\",\n \"msg_title\": \"Puppet run for #{self.host} #{self.status}\",\n \"msg_text\": \"Puppet run for #{self.host} #{self.status} on configuration version #{self.configuration_version.to_s} in #{self.environment}\",\n \"source_type_name\": \"ConfigurationChangedEvent\",\n \"tags\": [\n \"environment:#{self.environment}\"\n ],\n \"timestamp\": #{self.time.to_i}\n }\n ]\n },\n \"internalHostname\": \"#{self.host}\",\n \"metrics\": [],\n \"service_checks\": [],\n \"topologies\": []\n }\nEND\n\n Puppet.debug \"StackState event payload: #{payload}\"\n result = post_json(\"#{STACKSTATE_URL}/intake?api_key=#{STACKSTATE_API_KEY}\", payload)\n Puppet.debug \"HTTP POST result: #{result.code}\"\n end", "def deploy\n\t\t\tdeployPlanString = @repo.get_file_content('.deploy_plan.xml',@params['commit']||@params['branch'])\n\t\t\txmlRoot = XmlUtils.get_xml_root(deployPlanString)\n\t\t\t# select plan\n\t\t\tplanNode = XmlUtils.single_node(xmlRoot,'plan')\n\t\t\t# for each deploy\n\t\t\tdeployNode = XmlUtils.single_node(planNode,'deploy')\n\t\t\t# create client for kind/method\n\t\t\t@site_client = DesignShell::SiteClient.new({\n\t\t\t\t:site_url => @params['site_url'],\n\t\t\t\t:site_username => @params['site_username'],\n\t\t\t\t:site_password => @params['site_password'],\n\t\t\t})\n\t\t\tds = @site_client.deploy_status\n\t\t\tsite_repo_url = ds && ds['repo_url'].to_nil\n\t\t\tsite_branch = ds && ds['branch'].to_nil\n\t\t\tsite_commit = ds && ds['commit'].to_nil\n\t\t\trepo_url = @repo.url\n\t\t\t# @todo must limit uploads to build folder\n\t\t\tfromPath = MiscUtils.ensure_slashes(XmlUtils.peek_node_value(deployNode,'fromPath','/'),false,true) # eg. /build/bigcommerce effectively selects a subfolder that should be debased\n\t\t\ttoPath = MiscUtils.ensure_slashes(XmlUtils.peek_node_value(deployNode,'toPath','/'),false,true) # eg. / effectively the new base for these files\n\t\t\tif site_repo_url && site_repo_url==repo_url && site_branch && site_commit\n\t\t\t\t# incremental\n\t\t\t\tchanges = @repo.changesBetweenCommits(site_commit,@repo.head.to_s)\n\t\t\t\tuploads,deletes = convertChangesToUploadsDeletes(changes)\n\t\t\t\tuploads.delete_if { |fp| !fp.begins_with?(fromPath) }\n\t\t\t\tdeletes.delete_if { |fp| !fp.begins_with?(fromPath) }\n\t\t\t\t@site_client.delete_files(deletes,fromPath,toPath)\n\t\t\t\t@site_client.upload_files(@repo.path,uploads,fromPath,toPath)\n\t\t\t\t@site_client.deploy_status = {\n\t\t\t\t\t:repo_url => @repo.url,\n\t\t\t\t\t:branch => @repo.branch,\n\t\t\t\t\t:commit => @repo.head.to_s,\n\t\t\t\t :fromPath => fromPath,\n\t\t\t\t :toPath => toPath\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t# complete\n\t\t\t\t# for now, just deploy all files in wd, creating folders as necessary\n\t\t\t\t# later, delete remote files not in wd except for eg. .deploy-status.xml and perhaps upload folders\n\t\t\t\tuploads = MiscUtils.recursive_file_list(@repo.path,false)\n\t\t\t\tuploads.delete_if do |fp|\n\t\t\t\t\t!fp.begins_with?(fromPath) || fp.begins_with?('.git/')\n\t\t\t\tend\n\t\t\t\t@site_client.upload_files(@repo.path,uploads,fromPath,toPath)\n\t\t\t\t@site_client.deploy_status = {\n\t\t\t\t\t:repo_url => @repo.url,\n\t\t\t\t\t:branch => @repo.branch,\n\t\t\t\t\t:commit => @repo.head.to_s,\n\t\t\t\t\t:fromPath => fromPath,\n\t\t :toPath => toPath\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def commits_in_current_repo commit_fields\n CommitListBuilder.new(commit_fields).add_commits_in_current_repo.to_table\nend", "def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end", "def github_push(payload)\n\n pushType = payload[\"repository\"][\"full_name\"].split(\"/\")[1].split(\"-\")[0]\n if pushType == \"assignment\"\n TestGraderWorker.perform_async(payload)\n end\n\n org = payload[\"repository\"][\"organization\"]\n repo = payload[\"repository\"][\"name\"]\n repo_array = repo.split(\"-\")\n\n project_name = repo_array[0]\n type = repo_array[1]\n user = repo_array[2]\n\n expected_repo = \"#{org}/#{project_name}-expected\" \n student_repo = \"#{org}/#{project_name}-#{user}\"\n grade_repo = \"#{org}/#{project_name}-grade\"\n #results_repo = \"#{org}/#{project_name}-results-#{type}\"\n\n organization = Organization.new.github_client\n case type\n when \"grader\"\n if not organization.repository?(expected_repo)\n organization.create_repository(\n \"#{project_name}-expected\", organization: org, auto_init: true)\n end\n when \"expected\"\n when \"grade\"\n #when \"results\"\n # if not organization.repository?(grade_repo)\n # organization.create_repository(\n # \"#{project_name}-grade\", organization: org, auto_init: true)\n # end\n else\n if not organization.repository?(grade_repo)\n organization.create_repository(\n \"#{project_name}-grade\", organization: org, auto_init: true)\n end\n end\n\tend", "def index\n @commits = @project.repo.log(10)\n respond_with @commits\n end", "def test_integration_branch\n # No commits should be processed for this push because we're only listening for\n # commits landing on the \"master\" branch.\n modified_payload = modify_payload(payload).merge({'ref' => 'refs/heads/development'})\n svc = service({'server_url' => 'nowhere', 'username' => 'someone', 'password' => '12345', 'integration_branch' => 'master', 'central_repository' => '1'}, modified_payload)\n svc.xmlrpc_client = @server\n svc.receive_push\n\n assert @server.closed_bugs.length == 0\n assert @server.bug_posts.length == 0\n\n # This time, we should close a bug and post 4 comments because these commits were\n # pushed to our integration branch.\n modified_payload = modify_payload(payload).merge({'ref' => 'refs/heads/master'})\n svc = service({'server_url' => 'nowhere', 'username' => 'someone', 'password' => '12345', 'integration_branch' => 'master', 'central_repository' => '1'}, modified_payload)\n svc.xmlrpc_client = @server\n svc.receive_push\n\n assert @server.closed_bugs.include?(1)\n assert @server.bug_posts.include?(4)\n end", "def update_hooks\n hook_url = \"https://your.domain/jira/gitlab_hook\"\n\n gl_api_endpoint = 'https://gitlab.your.domain/api/v3'\n gl_admin_token = 'xxxxxxxxxxxxxxxxxxxx'\n\n gl = Jk::Gitlabz.new(gl_api_endpoint, gl_admin_token)\n\n # Added our custom push hook url to each repo\n gl.get_project_name_id_hash().each { |repo, proj_id|\n gl.add_hook_to_proj(proj_id, hook_url)\n }\nend", "def setup\n @commit_data = {\n :id => \"a-real-deal-id-#{get_iterator}\",\n :commit_message => 'Creating Git Resource',\n :author_name => 'Collin',\n :author_email => '[email protected]',\n :attributes => \"{ \\\"title\\\" : \\\"test #{get_iterator}\\\" }\",\n :rendered => \"<h1>Test #{get_iterator}</h1>\"\n }\n @commit_sha = Regulate::Git::Interface.save(@commit_data)\n end", "def fetch_commits(repo_user,repo_name, sha, commits_size)\n uri = URI(API_BASE_URL+ \"/repos/#{repo_user}/#{repo_name}/commits?sha=#{sha}&per_page=#{commits_size}\")\n body = response_body(uri)\n if body.instance_of? Array\n body\n elsif body.key?('message') && body['message'].downcase == \"not found\"\n raise \"Unable to fetch #{uri}\" \n else\n puts \"WARNING unexpected body = #{body}\"\n []\n end\n end", "def test_get_tags\n post '/repos', {:name => GIT_REPO}\n post \"/repos/#{GIT_REPO}.git/branches/master/files\", {:name => \"myfile.txt\", :data => \"Hello There\", :encoding => \"utf-8\", :user => \"Rune Madsen\", :email => \"[email protected]\", :message => \"My First Commit\"}\n sha = JSON.parse(last_response.body)[\"commit_sha\"]\n post \"/repos/#{GIT_REPO}.git/tags\", {:tag => \"version1\", :message => \"hello\", :sha => sha, :type => \"commit\", :user => \"Rune Madsen\", :email => \"[email protected]\"}\n get \"/repos/#{GIT_REPO}.git/tags\"\n end", "def add_server_repo(tenant_config, tenant_status)\n\n # If configuring a Resource Pack tenant, bypass default server repo\n if tenant_status['resource_pack'] == true\n logger.info \"Resource Pack Tenant Feature is ACTIVE in tenant FCONFIG\"\n logger.info \"Bypassing Server Repo Configuration.\"\n else\n tenant_id = tenant_config['tenant_config.id']\n tenant_name = tenant_config['tenant_name']\n tenant_env = tenant_config['env']\n chef_connect = chef_api_connect\n mysql_connect = mysql_api_connect(tenant_env, rootuser=true)\n client = mysql_connect[0] # mysql connection\n fconfigdb = mysql_connect[1] # tenant config schema for env\n\n # Required values for server repo\n environ = chef_connect.search.query(:environment, \"name:#{tenant_env}\")\n environ.rows.each do |envitem|\n @server_repo_url = envitem['default_attributes']['fconfig']['server_repo_url']\n @server_repo_user = envitem['default_attributes']['fconfig']['server_repo_user']\n @server_repo_pass = envitem['default_attributes']['fconfig']['server_repo_pass']\n @server_repo_name = envitem['default_attributes']['fconfig']['server_repo_name']\n @server_repo_access = envitem['default_attributes']['fconfig']['server_repo_studentaccess']\n end\n\n server_repo_sql = \"USE #{fconfigdb};\n INSERT INTO server_repo(\n id, name, description, tenant_config_id, server_url,\n username, password, last_updated_by, last_updated_on,\n created_by, created_on, has_student_access)\n VALUES(\n replace(uuid(),'-','') ,\n '#{@server_repo_name}',\n 'ClassFlow Resource Pack',\n '#{tenant_id}',\n '#{@server_repo_url}',\n '#{@server_repo_user}',\n '#{@server_repo_pass}',\n 'SYSTEM', NOW(), 'SYSTEM', NOW(),\n '#{@server_repo_access}');\"\n\n#=begin\n push_sql = client.query(\"#{server_repo_sql}\")\n#=end\n logger.info \"Added default server repo for tenant #{tenant_name}\"\n tenant_status['server_repo'] = true\n end\n return tenant_status\n end", "def git_push_commits\n shellout(\"git push #{config[:remote]} #{config[:branch]}\")\n end", "def stage\n\n path_to_dot_git = File.join( @git_folder_path, \".git\" )\n git_add_cmd = \"git --git-dir=#{path_to_dot_git} --work-tree=#{@git_folder_path} add -A\"\n log.info(x) { \"[git] add command => #{git_add_cmd}\" }\n %x[#{git_add_cmd}];\n log.info(x) { \"[git] has recursively added resources to version management.\" }\n\n end", "def update_github\n unless environment_is_production\n puts 'NOT updating github because environment is not production'\n return false\n end\n\n puts 'pushing database to github'\n\n @scraper_log.info \"------------------------------\"\n @scraper_log.info \"updating git\"\n @scraper_log.info \"------------------------------\"\n x = Subexec.run \"git add #{@db_dump_file} #{@status_file_name}\"\n x = Subexec.run \"git commit -m 'Updated database dump file and status.json with new hr.gov.ge data'\"\n x = Subexec.run \"git push origin master\"\nend", "def add_commits_in_current_repo\n existing_branches.each do |branch_name|\n add_commits_in_branch branch_name\n end\n @commit_list\n end", "def add_hook_for_server_check target, project_name, branch = 'master', log: '/tmp/log', host: 'http://localhost'\n File.open \"#{target}/hooks/post-receive\", 'w' do |file|\n file.write <<-HOOK\n#!/bin/bash\n\nwhile read oldrev newrev refname\ndo\n branch=$(git rev-parse --symbolic --abbrev-ref $refname)\n if [ \"$branch\" == \"#{branch}\" ]; then\n echo \"curl -X PATCH '#{host}/api/projects/#{project_name}/#{branch}'\" >>\"#{log}\"\n curl -X PATCH \"#{host}/api/projects/#{project_name}/#{branch}\" >>\"#{log}\" 2>&1 &\n fi\ndone\n HOOK\n file.chmod 0755\n end\n true\n end", "def process_pull_requests(merge_pretest_success)\n pull_requests = []\n mergeability_in_flux = false\n pull_request_statuses = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = {} } }\n $repo_to_pull_regex.keys.each do |repo|\n $stderr.puts \"\\nProcessing repo '#{repo}'\"\n pull_request_statuses[:closed_prs][repo] = \"#{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pulls?q=is%3Apr+is%3Aclosed\"\n list_pull_requests(repo).each do |req|\n id = req['number']\n $stderr.puts \"Analyzing pull request: #{GITHUB_BASE_URL}/#{Properties['github_user']}/#{repo}/pull/#{id}\"\n\n branch = req['base']['ref']\n\n # We only want to consider pull requests into branches we care about\n if $branches.include?(branch) || $branches.include?('*')\n\n $stderr.puts \" Updated at: #{req['updated_at']}\"\n # We only want to consider pull requests that have been modified in\n # the last twelve hours, to stop us from doing extra work when we\n # don't need to. Also, just to ensure that we don't forget a pull\n # request forever on accident, there is a 10% chance we'll consider\n # a pull request even if it is inactive\n if Time.now - Time.parse(req['updated_at']) < (12*60*60) || (rand(20) < 1)\n login = req['user']['login']\n comments = nil\n # Skip if it's not mergeable\n mergeable = is_mergeable?(id, repo)\n $stderr.puts \" Mergeable: #{mergeable}\"\n if mergeable\n comments = get_comments(id, repo) if comments.nil?\n set_mergeable(id, repo, login, comments)\n else\n if set_not_mergeable(id, repo, login) == MERGEABLE\n mergeability_in_flux = true\n end\n next\n end\n\n comments = get_comments(id, repo) if comments.nil?\n\n # We only want to consider pull requests where the last trigger we found\n # is from a trusted user\n permission_denied = Array.new(Properties['settings'].length, false)\n # Has a merge or test been requested by a trusted user?\n Properties['settings'].values.each_with_index do |settings, i|\n updated_at, changed_after_eval = get_updated_at(req, comments, settings)\n trigger_regex = /\\[#{settings['name']}\\]/i\n if req['title'] =~ trigger_regex || req['body'] =~ trigger_regex\n if user_trusted?(login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, comments, settings]\n permission_denied[i] = false\n next\n else\n $stderr.puts \" User '#{login}' not trusted\"\n permission_denied[i] = true\n end\n end\n\n comments = sort_comments(comments)\n comments.each do |comment|\n if comment['body'] =~ trigger_regex\n comment_login = comment['user']['login']\n if user_trusted?(comment_login, repo, settings)\n pull_requests << [req, updated_at, changed_after_eval, comments, settings]\n permission_denied[i] = false\n break\n else\n $stderr.puts \" User '#{comment_login}' not trusted\"\n permission_denied[i] = true\n end\n end\n end\n end\n if permission_denied.include? true\n create_or_update_comment(id, repo, ACTION_PREFIX, ACTION_NOT_TEAM, comments)\n end\n else\n $stderr.puts \" Skipping due to age and inactivity\"\n end\n else\n create_or_update_comment(id, repo, ACTION_PREFIX, ACTION_UNSUPPORTED_BRANCH)\n end\n end\n end\n\n if mergeability_in_flux\n $stderr.puts \"Waiting till next run to see if mergeability is in flux\"\n exit\n end\n\n # Consider the pull requests we have deemed valid in\n # order of the time they were last updated, oldest first\n sorted_pull_requests = pull_requests.sort_by do |req_info|\n req_info[1]\n end\n\n skipped_count = {}\n $branches.each do |branch|\n skipped_count[branch] = {}\n end\n\n # If we're only allowing sequential tests in this tag, we want to find\n # any pull request in the 'running tests' state and signal that there\n # is a test running.\n sorted_pull_requests.each do |req_info|\n req = req_info[0]\n comments = req_info[3]\n settings = req_info[4]\n branch = req['base']['ref']\n\n if !settings['allow_multiple']\n comments.each do |comment|\n begin\n fields = extract_bot_comment_fields(comment['body'], settings)\n if (comment['user']['login'] == Properties['bot_github_user']) && fields[:state] == :running\n submitted_tests = submitted_tests_for_branch(branch)\n submitted_tests[settings['name']] = true\n break\n end\n rescue Exception => e\n next\n end\n end\n end\n end\n\n sorted_pull_requests.each do |req_info|\n # Process the pull request\n req = req_info[0]\n updated_at = req_info[1]\n changed_after_eval = req_info[2]\n comments = req_info[3]\n settings = req_info[4]\n branch = req['base']['ref']\n repo = req['base']['repo']['name']\n\n process_pull_request(req, updated_at, changed_after_eval, comments, settings, merge_pretest_success)\n\n submitted_tests = submitted_tests_for_branch(branch)\n\n if !settings['allow_multiple'] && submitted_tests[settings['name']]\n # If we're only allowing sequential tests on this tag and there is a test running,\n # and we are waiting to test, we need to correctly determine the position in the\n # test queue that we are at and post it in a bot comment on the pull request\n comments = get_comments(req['number'], repo)\n\n bot_comment = get_comment_with_prefix(req['number'], repo, settings['test_prefix'], comments)\n if bot_comment\n fields = extract_bot_comment_fields(bot_comment['body'], settings)\n if (waiting_in_queue_state?(fields[:state]))\n skipped_count_branch = skipped_count[branch] ? skipped_count[branch] : skipped_count['*']\n skipped_count_branch[settings['name']] = 0 if skipped_count_branch[settings['name']].nil?\n skipped_count_branch[settings['name']] += 1\n queued_comment = compose_bot_comment(settings['test_prefix'], :state => :wait_in_queue, :content => waiting_in_queue_comment_segment(skipped_count_branch[settings['name']].to_s))\n pull_request_statuses[:enqueued][req['html_url']][:title] = req['title'].force_encoding(\"UTF-8\")\n pull_request_statuses[:enqueued][req['html_url']][:queue_pos] = skipped_count_branch[settings['name']]\n pull_request_statuses[:enqueued][req['html_url']][:repo] = repo\n create_or_update_comment(req['number'], repo, settings['test_prefix'], queued_comment , comments)\n $stderr.puts \" Pull ##{req['number']} in repo '#{repo}' is at build position ##{skipped_count_branch[settings['name']]}\"\n # Get ahead of the game and pretest requests\n if settings['pretest_settings_key'] && settings['pretest_comment'] && settings['pretest_queue_threshold'] && (skipped_count_branch[settings['name']] >= settings['pretest_queue_threshold'])\n trusted_trigger_time, _ = get_trusted_trigger_time(req, comments, Properties['settings'][settings['pretest_settings_key']])\n create_or_update_comment(req['number'], repo, settings['pretest_comment'].gsub('[', '\\[').gsub(']', '\\]'), settings['pretest_comment'], comments) unless trusted_trigger_time\n end\n elsif fields[:state] == :running\n pull_request_statuses[:running][req['html_url']][:title] = req['title'].force_encoding(\"UTF-8\")\n pull_request_statuses[:running][req['html_url']][:status] = \"merging\"\n pull_request_statuses[:running][req['html_url']][:repo] = repo\n end\n end\n end\n end\n # Commit merge queue records to disk\n IO.write(MERGE_QUEUE_RECORD, pull_request_statuses.to_json, {:mode => 'w'})\n end", "def git\n\tend", "def create_commits\n present_commits = user.repositories.find_by(name: repository_name).commits.pluck(:sha)\n commits_details = []\n commits.each do |commit|\n commits_details << get_commit_hash(commit) unless present_commits.include?(commit['sha'])\n end\n Commit.bulk_insert values: commits_details\n end", "def index\n @git_commits = GitHubber.all\n commit_hashes = @git_commits.map { |commit| commit.sha }\n approved_commits = StageCommit.where(\"sha in (?)\", commit_hashes).map{ |reviews| reviews.sha }\n @git_commits.reject!{|git_commit| approved_commits.include?(git_commit.sha) }\n @stage_commit = StageCommit.new\n end", "def commits_all(num_commits)\n # Check for 'master' branch and switch to that if it exists\n # main_branch = nil\n # @repo.heads().each do |head|\n # main_branch = \"master\" if head.name == \"master\"\n # end\n main_branch = @repo.head().name\n # Get commits on that branch\n if num_commits > 50\n i = num_commits / 25\n (0..i).each do |i|\n yield @repo.commits(main_branch, 25, i*25)\n end\n else\n yield @repo.commits(main_branch, num_commits)\n end\n end", "def git(args, &block)\n Sprout::GitTask.define_task(args, &block)\nend", "def get_commits\n # get the last build number\n build_tag = last_build_git_data\n @last_build_number = build_tag[:build_number]\n if @last_build_number == 0\n puts \"unable to get last build number using git describe. It returned #{build_tag[:describe]} but \\\nexpecting something that has letters followed by numbers. Unable to continue\"\n exit 1\n end\n\n # Jenkins will tag the build before running the deploy, @last_build_number - 1 will get the previous built version to get the diff.\n # However, if prev_build is set, use that instead. \n from_build = (@prev_build.nil?) ? (@last_build_number.to_i - 1) : @prev_build.to_i\n \n # now fetch all commits for anything between the current revision and the last build number\n last_build_tag = \"#{build_tag[:tag_name]}#{from_build}\"\n # puts \"looking for commits between #{last_build_tag} and #{@build_revision}\"\n \n commits = @repo.commits_between(last_build_tag, @build_revision)\n if (commits && commits.length > 0)\n load_tasks(commits)\n else\n puts \"No commits logs (other than possibly merges) were found between tag #{last_build_tag} and build revision #{build_revision}. \\n\nNothing to report on, exiting. \"\n exit 1\n end\n end", "def commit_and_tag(bump_info)\n @logger.log '===> executing commands'\n @command.exec 'git add .'\n @command.exec \"git commit -m '#{bump_info.commit_message}'\"\n @command.exec \"git tag v#{bump_info.after_version}\"\n end", "def commits_context\n it 'List Repository Prospects' do\n get :repo_commits, params: { id: 'amura-assignment',\n since_date: since_date,\n until_date: until_date }\n expect(response).to have_http_status(200)\n expect(response.headers).to include('Content-Type' =>\n 'application/json; charset=utf-8')\n end\n end", "def status\n unless block_given?\n return status {|sha| sha}\n end\n \n lines = []\n git.status.each_pair do |path, state|\n ab, xyz, target = path.split('/', 3)\n source = \"#{ab}#{xyz}\"\n \n sha = assoc_sha(source, target)\n type = assoc_type(source, target)\n \n status = case assoc_type(source, target)\n when :create\n type = self[sha]['type']\n [type || 'doc', yield(sha)]\n when :link\n ['link', \"#{yield(source)} to #{yield(target)}\"]\n when :update\n ['update', \"#{yield(target)} was #{yield(source)}\"]\n when :delete\n ['delete', yield(sha)]\n else\n ['unknown', path]\n end\n \n if status\n status.unshift state_str(state)\n lines << status\n end\n end\n \n indent = lines.collect {|(state, type, msg)| type.length }.max\n format = \"%s %-#{indent}s %s\"\n lines.collect! {|ary| format % ary }\n lines.sort!\n lines.join(\"\\n\")\n end", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend", "def deploy!\n puts \"Adding and committing compiled output for deployment..\"\n puts %x[git add .]\n puts %x[git commit -a -m \"temporary commit for deployment\"]\n puts 'Deploying to Heroku..'\n puts %x[git push heroku HEAD:master --force]\nend", "def create_commits commits_array\n commits_array = [commits_array] if commits_array.is_a? Hash\n normalize_commit_data commits_array\n commits_array.each do |commit_data|\n create_commit add_default_commit_data(commit_data)\n end\nend", "def process_repos\n stdout.out_success \"Commit message: (used for the commit on each repo to describe the purpose of updating the '#{settings['target_submodule_name']}' submodule).\"\n commit_message = strip_chars(gets.chomp(), ' \"\\'')\n # cleanup from the last build\n prep_build\n submodule_head_sha = determine_submodule_sha\n stdout.verbose(\"\\nNow starting the process of all the repos you've chosen to update\\n\")\n @requested_repos.each do |repo_to_clone|\n stdout.out_success(\"\\nProcessing repo: '#{repo_to_clone['name']}'\")\n git.clone_repo_to(repo_to_clone['name'], settings['build_dir'])\n chdir_to_repo(repo_to_clone['name'])\n git.checkout_branch(repo_to_clone['branch'])\n submodule_relative_path = \"#{repo_to_clone['submodule_dir']}/#{settings['target_submodule_name']}\"\n unless File.directory? submodule_relative_path\n stdout.out_warn(\"Submodule path not found: #{submodule_relative_path}\")\n stdout.out_warn(\"This is the expected path to the #{settings['target_submodule_name']} submodule\")\n stdout.out_warn(\"Skipping...\")\n next\n end\n if git.submodule_up_to_date(submodule_relative_path, submodule_head_sha)\n stdout.out_warn \"The repo: #{repo_to_clone['name']} submodule #{settings['target_submodule_name']} is already up to date. Skipping\"\n else\n pull_commit_submodule(repo_to_clone, commit_message)\n end\n end\n stdout.out_success(\"Done\")\n if repos_to_push.count > 0\n single_plural = repos_to_push.count == 1 ? 'Repo has been updated and is' : 'Repos have been updated and are'\n stdout.out_success \"\\n#{repos_to_push.count} #{single_plural} ready to push.\"\n stdout.out_success 'Starting confirmations to make actual pushes to Origin'\n repos_to_push.each do |repo|\n repo_path = \"#{@settings['build_dir']}/#{repo['name']}\"\n assert_path_exists repo_path, \"Was cd'ing to the repo #{repo['name']} in order to push it to origin but the dir was not there??\"\n chdir_to_repo repo['name']\n git.assert_known_branch repo['branch']\n if confirm_push(repo['name'], repo['branch'])\n git.push_to_origin(repo['name'], repo['branch'])\n else\n stdout.out_warn(\"Skipping push of repo #{repo['name']}\")\n end\n end\n end\n end", "def commit_info(params)\n user, repo = params[\"user\"], params[\"repo\"]\n shas = get_last_30_days_commits(user, repo)\n commit_hash = {}\n file_arr = []\n hydra = Typhoeus::Hydra.new\n shas.each do |sha|\n request = Typhoeus::Request.new(\"#{GithubApiConstants::GITHUB_ROOT}/repos/#{user}/#{repo}/commits/#{sha}?access_token=#{GITHUB_ACCESS_TOKEN}\")\n request.on_complete do |response|\n if response.success?\n parsed_sha_info = JSON.parse(response.response_body)\n author = parsed_sha_info[\"commit\"][\"author\"][\"name\"]\n files = parsed_sha_info[\"files\"].collect { |f| f[\"filename\"] }\n commit_hash[files] = author\n file_arr << files\n else\n raise RepoExceptionHandler::GithubAPILimitReached.new(GithubApiConstants::GITHUB_API_LIMIT_REACHED_MESSAGE)\n end\n end\n hydra.queue(request)\n end\n hydra.run\n return commit_hash, file_arr\n end", "def update_status(payload, status)\n sha = payload.after\n repo = payload.repository.full_name\n state, description = status.first\n\n # setup http post\n uri = URI.parse(\"#{GITHUB_ROOT}/repos/#{repo}/statuses/#{sha}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n # post to GitHub\n params = {:state => state, :description => description, :context => CONTEXT}\n http.post(uri.path, params.to_json, HEADERS)\nend", "def perform_after_commit\n bm_after_commit('Efs::TwitterUser.import_from!') do\n Efs::TwitterUser.import_from!(id, uid, screen_name, profile_text, @reserved_friend_uids, @reserved_follower_uids)\n end\n\n bm_after_commit('InMemory::TwitterUser.import_from') do\n InMemory::TwitterUser.import_from(id, uid, screen_name, profile_text, @reserved_friend_uids, @reserved_follower_uids)\n end\n\n bm_after_commit('S3::Friendship.import_from!') do\n S3::Friendship.import_from!(id, uid, screen_name, @reserved_friend_uids, async: true)\n end\n\n bm_after_commit('S3::Followership.import_from!') do\n S3::Followership.import_from!(id, uid, screen_name, @reserved_follower_uids, async: true)\n end\n\n bm_after_commit('S3::Profile.import_from!') do\n S3::Profile.import_from!(id, uid, screen_name, profile_text, async: true)\n end\n\n status_tweets = @reserved_statuses.map { |t| t.slice(:uid, :screen_name, :raw_attrs_text) }\n favorite_tweets = @reserved_favorites.map { |t| t.slice(:uid, :screen_name, :raw_attrs_text) }\n mention_tweets = @reserved_mentions.map { |t| t.slice(:uid, :screen_name, :raw_attrs_text) }\n\n # S3\n\n bm_after_commit('S3::StatusTweet.import_from!') do\n S3::StatusTweet.import_from!(uid, screen_name, status_tweets)\n end\n\n bm_after_commit('S3::FavoriteTweet.import_from!') do\n S3::FavoriteTweet.import_from!(uid, screen_name, favorite_tweets)\n end\n\n bm_after_commit('S3::MentionTweet.import_from!') do\n S3::MentionTweet.import_from!(uid, screen_name, mention_tweets)\n end\n\n # EFS (Automatically deleted)\n\n # bm_after_commit('Efs::StatusTweet.import_from!') do\n # Efs::StatusTweet.import_from!(uid, screen_name, status_tweets)\n # end\n #\n # bm_after_commit('Efs::FavoriteTweet.import_from!') do\n # Efs::FavoriteTweet.import_from!(uid, screen_name, favorite_tweets)\n # end\n #\n # bm_after_commit('Efs::MentionTweet.import_from!') do\n # Efs::MentionTweet.import_from!(uid, screen_name, mention_tweets)\n # end\n\n # In memory (Automatically deleted)\n\n bm_after_commit('InMemory::StatusTweet.import_from') do\n InMemory::StatusTweet.import_from(uid, status_tweets)\n end\n\n bm_after_commit('InMemory::FavoriteTweet.import_from') do\n InMemory::FavoriteTweet.import_from(uid, favorite_tweets)\n end\n\n bm_after_commit('InMemory::MentionTweet.import_from') do\n InMemory::MentionTweet.import_from(uid, mention_tweets)\n end\n end", "def regional_rolling_deploy(stack_id:, layer_id:, app_id:, revision: '')\n log(\"Starting opsworks deploy for app #{app_id}\\n\\n\")\n\n instances = @opsworks_client.describe_instances(layer_id: layer_id)[:instances]\n\n instances_by_group = instances.map {|v| v.to_h}.group_by { |d| d[:availability_zone] }\n\n instances_by_group.each do |region, instance_group|\n # Only deploy to online instances\n online_instance = instance_group.select{|k| k[:status] == 'online'}\n instances_ids = online_instance.map{|k| k[:instance_id]}\n instances_names = online_instance.map{|k| k[:hostname]}\n\n next if instances_names.empty?\n\n puts \"#{instances_names} in #{region}\"\n\n begin\n load_balancers = {}\n log(\"=== Starting deploy for #{instances_names} ===\")\n\n online_instance.each do |instance|\n instance = Aws::OpsWorks::Types::Instance.new(instance)\n load_balancers[instance.instance_id] = detach_from_elbs(instance: instance)\n end\n\n wait_for_detach(@lb_wait_params)\n\n deploy(\n stack_id: stack_id,\n app_id: app_id,\n instance_id: instances_ids,\n revision: revision\n )\n ensure\n online_instance.each do |instance|\n instance = Aws::OpsWorks::Types::Instance.new(instance)\n attach_to_elbs(instance: instance, load_balancers: load_balancers[instance.instance_id]) if load_balancers[instance.instance_id]\n end\n\n wait_for_re_attach(@lb_wait_params)\n\n log(\"=== Done deploying on #{instances_names} ===\\n\\n\")\n end\n end\n\n log(\"SUCCESS: completed opsworks deploy for all instances on app #{app_id}\")\n end", "def branch_commits\n\tcommits = {}\n\tresp = github_api(\"branches\")\n\tresp.each do |b|\n\t\t#puts b\n\t\tcommit_dates = []\n\t\tsha = b[\"commit\"][\"sha\"]\n\t\twhile true\n\t\t\tr = github_api(\"commits?sha=#{sha}&per_page=100\")\n\t\t\t# puts r\n\t\t\tif r.count != 1 \n\t\t\t\tsha = r[r.count - 1][\"sha\"]\n\t\t\t\tcommit_dates = commit_dates.concat(r[0..-1].map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\t#puts commit_dates\n\t\t\telse\n\t\t\t\tcommit_dates = commit_dates.concat(r.map {|c| c[\"commit\"][\"committer\"][\"date\"]})\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tcommits[b[\"name\"]] = commit_dates\n\tend\n\tcommits\nend", "def with_pipeline_status\n statuses = project.ci_pipelines.latest_status_per_commit(map(&:id), ref)\n\n each do |commit|\n commit.set_status_for_ref(ref, statuses[commit.id])\n end\n\n self\n end", "def github_service_response_headers\n {\"Content-Type\" => \"application/json\"}\n end", "def add_git_facts\n # see if we're in a git repo. first, we need a directory that exists\n dir = @path.expand_path.ascend.find {|p| p.directory? }\n \n Dir.chdir(dir) do\n root_result = Cmds.new \"git rev-parse --show-toplevel\"\n \n unless root_result.ok?\n @result.in_git_repo = false\n @result.is_git_root = false\n return\n end\n \n @result.in_git_repo = true\n \n git = @result.git = Result.new\n git.root = Pathname.new root_result.out.chomp\n @result.is_git_root = @path == git.root\n \n user = git.user = Result.new\n \n ['name', 'email'].each {|key|\n user[key] = begin\n Cmds.chomp! \"git config user.#{ key }\"\n rescue\n end\n }\n \n git.origin = begin\n Cmds.chomp! \"git remote get-url origin\"\n rescue\n end\n \n match = GITHUB_SSH_URL_RE.match(git.origin) ||\n GITHUB_HTTPS_URL_RE.match(git.origin)\n \n git.is_github = !! match\n \n return unless match\n \n git.owner = match['owner']\n git.name = match['name']\n git.full_name = \"#{ git.owner }/#{ git.name }\"\n \n if true == @args['github_api']\n github = git.github = Result.new\n github.api_url = \"https://api.github.com/repos/#{ git.owner }/#{ git.name }\"\n \n response = Net::HTTP.get_response URI(github.api_url)\n \n if response.is_a? Net::HTTPSuccess\n # parse response body and add everything to github result\n parsed = JSON.parse response.body\n parsed.each {|k, v| github[k] = v}\n else\n # assume it's private if we failed to find it\n github.private = true\n end\n \n end\n end\n end", "def create\n @stage_commit = StageCommit.new(stage_commit_params)\n\n respond_to do |format|\n if @stage_commit.save\n GitHubber.promote_to_prod(@stage_commit.sha)\n old_commits=GitHubber.all_before_hash(@stage_commit.sha)\n logged_commits = StageCommit.where(\"sha in (?)\", old_commits).map{ |reviews| reviews.sha }\n skipped_commits = old_commits - logged_commits\n\n skipped_commits.each do |skipped_sha|\n StageCommit.create(:sha => skipped_sha, :approver => @stage_commit.approver, :comment => \"Auto Approved in Commit #{@stage_commit.sha} and Message #{@stage_commit.comment}\")\n end\n\n format.html { redirect_to @stage_commit, notice: 'Stage commit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage_commit }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage_commit.errors, status: :unprocessable_entity }\n end\n end\n end", "def gollum_hook\n # This only fires when we want to update the charcoal-se.org website, so we just unconditionally\n # kick off a build of the charcoal-se.org website.\n APIHelper.authorized_post(\n 'https://api.github.com/repos/Charcoal-SE/charcoal-se.github.io/actions/workflows/build.yml/dispatches',\n data: { 'ref' => 'site' }\n )\n end", "def commits(commit=head)\n commits_for(commit)\n end", "def pre_perform!\n return unless perform_hooks?\n unless hooks.pre_hooks.any?\n GitPusshuTen::Log.message \"No pre deploy hooks to perform.\"\n return\n end\n \n ##\n # Connect to the remote environment and perform the pre deploy hooks\n hooks.render_commands(hooks.pre_hooks).each do |name, commands|\n adjusted_name = name.sub(/^\\d+\\)\\s/, '')\n \n GitPusshuTen::Log.message(\"Performing pre deploy hook: #{y(adjusted_name)}\")\n standard environment.execute_as_user(\"cd '#{e.app_dir}'; #{commands}\")\n end\n end", "def github_push(payload)\n pushType = payload[\"repository\"][\"full_name\"].split(\"/\")[1].split(\"-\")[0]\n if pushType == \"assignment\"\n TestGraderWorker.perform_async(payload)\n end\n\tend", "def git_receive_pack\n render_ok\n end", "def test\n @config.for_each_github_repo do |client, repo_info|\n log_debug \"Checking CI for Github repository #{repo_info[:slug]}\"\n last_status = client.repository_workflow_runs(repo_info[:slug])[:workflow_runs].\n select { |run| run[:head_branch] == 'master' }.\n max_by { |run| run[:created_at] }[:conclusion]\n error \"Last workflow status for repository #{repo_info[:slug]} is #{last_status}\" unless last_status == 'success'\n end\n end", "def statuses\n @repo ||= pr_json.base.repo.full_name\n @sha ||= head_commit\n statuses = {}\n api.statuses(@repo, @sha).each do |status|\n statuses[status.context] ||= []\n statuses[status.context].push(context: status.context,\n state: status.state,\n date: status.updated_at)\n end\n statuses.map do |_, val|\n val.sort { |a, b| b[:date] <=> a[:date] }[0]\n end\n end", "def release_status\n return unless DeployGroup.enabled?\n return unless current_version = version(@reference)\n return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence\n\n # code above is hot ... so keep it optimized and re-fetch here only if something bad was found\n interfering_stage_ids = deploy_scope.where(reference: higher_references).pluck(:stage_id)\n interfering_stages = Stage.where(id: interfering_stage_ids).pluck(:name)\n\n {\n state: \"error\", # `pending` is also supported in deploys.js, but that seems even worse\n statuses: [{\n state: \"Old Release\",\n description:\n \"#{higher_references.join(', ')} was deployed to deploy groups in this stage\" \\\n \" by #{interfering_stages.join(\", \")}\"\n }]\n }\n end", "def release_status\n return unless DeployGroup.enabled?\n return unless current_version = version(@reference)\n return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence\n\n # code above is hot ... so keep it optimized and re-fetch here only if something bad was found\n interfering_stage_ids = deploy_scope.where(reference: higher_references).pluck(:stage_id)\n interfering_stages = Stage.where(id: interfering_stage_ids).pluck(:name)\n\n {\n state: \"error\", # `pending` is also supported in deploys.js, but that seems even worse\n statuses: [{\n state: \"Old Release\",\n description:\n \"#{higher_references.join(', ')} was deployed to deploy groups in this stage\" \\\n \" by #{interfering_stages.join(\", \")}\"\n }]\n }\n end", "def build_status_report(sha, state)\n $github_client.create_status(\n self.repo.name, sha,\n state, \n { context: \"Perkins CI\", \n description: github_state_description , \n target_url: github_state_url \n }\n ) rescue \"error sending github state!!!! notify this\"\n puts \"Sending Github #{state} status to #{self.repo.name}\".green\n end", "def index_process_commit(arr, hash)\n\n commit_hash_str = arr[0].strip\n author_email_str = arr[2].strip\n created_at_tstamp = DateTime.parse(arr[3].strip)\n parent_hash = arr[4].strip\n\n #add commit hash\n hash[:commit_hash] = commit_hash_str[0..254]\n puts \"WARNING! Hash too long #{commit_hash_str}\" if commit_hash_str.length > 254\n\n #add email\n hash[:author_email] = author_email_str[0..254]\n puts \"WARNING! Email too long #{author_email_str}\" if author_email_str.length > 254\n \n #add author id \n dev = Developer.search_or_add author_email_str\n if dev.nil?\n unless %w(initial.commit\n license.bot@0039d316-1c4b-4281-b951-d872f2087c98\n initial.commit@0039d316-1c4b-4281-b951-d872f2087c98\n ).include? author_email_str\n puts \"WARNING! Email invalid for #{author_email_str}\"\n end\n else\n hash[:author_id] = dev.id \n end\n\n #add Date/Time created\n hash[:created_at] = created_at_tstamp\n\n #add parent_commit_hash\n hash[:parent_commit_hash] = parent_hash[0..254]\n puts \"WARNING! Parent hash too long #{parent_hash}\" if parent_hash.length > 254\n\n add_commit_to_db(hash)\n\n arr.clear\n\n end", "def submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals)\n pr_key = pr_name + \":\" + pr_number\n\n # Grab the stored payload\n stored_payload_value = @redis.hget(pr_key, current_commit_hash)\n\n # Ensure that a key actually exists\n if !stored_payload_value.nil?\n stored_payload = JSON.parse(stored_payload_value)\n plus_ones = stored_payload['plus_one_count'].to_i\n authors = stored_payload['authors']\n creator = stored_payload['creator'].to_s\n\n # Check if the commenting user is the creator or has already commented\n is_comment_user_creator_or_author = authors.include?(comment_user) || creator === comment_user\n\n plus_ones_to_add = is_comment_user_creator_or_author ? 0 : approvals\n\n # If there is no net change\n if plus_ones_to_add === 0\n return 200\n end\n\n plus_ones = plus_ones + plus_ones_to_add\n\n # Ensure the count isn't negative\n if plus_ones < 0\n plus_ones = 0\n end\n\n # Update authors list\n if !authors.include?(comment_user)\n authors.push(comment_user)\n end\n\n payload_to_store = {\n :plus_one_count => plus_ones,\n :authors => authors,\n :creator => creator,\n }\n\n # Store the new payload data\n @redis.hset(pr_key, current_commit_hash, payload_to_store.to_json)\n\n if plus_ones >= NEEDED_PLUS_ONES\n status = 'success'\n else\n status = 'pending'\n end\n\n @client.create_status(\n pr_name,\n current_commit_hash,\n status,\n {\n 'description' => '(' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') required approvals.',\n 'context' => 'robinpowered/commodus'\n }\n ) \n else\n return 404\n end\n\n return 200\n end", "def event_processing\n Github::Client.initialize(request)\n end", "def git_fetch\n Command.new(\"git\", \"fetch\", \"--tags\").run!.raise!\nend", "def run\n git_uri, branches = Cbm::GitBranchesParser.new(git_branches_root).parse\n\n pipeline_file = Cbm::PipelineGenerator.new(\n git_uri,\n branches,\n resource_template_file,\n job_template_file,\n common_resources_template,\n resource_type_template_file,\n group_per_branch).generate\n Cbm::PipelineUpdater.new(\n url,\n username,\n password,\n team,\n pipeline_file,\n load_vars_from_entries,\n pipeline_name_or_default(git_uri)).set_pipeline\n end", "def status status\n yield\n ActiveRecord::Base.connection_pool.with_connection do \n @log.update(success_status: status, is_error: 0, error_status: nil, error_message: nil)\n end\n rescue => e\n ActiveRecord::Base.connection_pool.with_connection do \n @log.update(success_status: 0, is_error: 1, error_status: status, error_message: e.to_s)\n end\n Rails.logger.debug \"Exception at status \" + status.to_s + \" : \" + e.message + \" --- \" + e.backtrace.to_s\n raise\n ensure\n # call to request url\n # request_url(repo, status, caller_locations(2,2)[0].label)\n end", "def commits\n read_repo\n if @branches.count < 1\n render :template => 'repositories/newrepo'\n return\n end\n\n @commits = @repository.commits(@branch)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repository }\n end\n end", "def github_check_status\n base_url = \"repos/#{@project.repository_path}/commits/#{@commit}\"\n preview_header = {Accept: 'application/vnd.github.antiope-preview+json'}\n\n check_suites = GITHUB.get(\"#{base_url}/check-suites\", headers: preview_header).to_attrs.fetch(:check_suites)\n check_runs = GITHUB.get(\"#{base_url}/check-runs\", headers: preview_header).to_attrs.fetch(:check_runs)\n\n # ignore pending unimportant\n check_suites.reject! do |s|\n check_state(s[:conclusion]) == \"pending\" &&\n (\n IGNORE_PENDING_CHECKS.include?(s.dig(:app, :name)) ||\n @project.ignore_pending_checks.to_s.split(\",\").include?(s.dig(:app, :name))\n )\n end\n\n overall_state = check_suites.\n map { |suite| check_state(suite[:conclusion]) }.\n max_by { |state| STATE_PRIORITY.index(state.to_sym) }\n\n statuses = check_runs.map do |check_run|\n {\n state: check_state(check_run[:conclusion]),\n description: ApplicationController.helpers.markdown(check_run[:output][:summary]),\n context: check_run[:name],\n target_url: check_run[:html_url],\n updated_at: check_run[:started_at]\n }\n end\n statuses += missing_check_runs_statuses(check_suites, check_runs)\n\n {state: overall_state || 'pending', statuses: statuses}\n end", "def filesync_deploy\n @logger.debug('Pem::filesync_deploy') { 'starting filesync deploy' }\n\n ssl_options = {\n 'client_cert' => OpenSSL::X509::Certificate.new(File.read(@conf['filesync_cert'])),\n 'client_key' => OpenSSL::PKey::RSA.new(File.read(@conf['filesync_cert_key'])),\n 'ca_file' => @conf['filesync_ca_cert'],\n }\n\n conn = Faraday.new(url: \"https://#{@conf['master']}:8140\", ssl: ssl_options) do |faraday|\n faraday.request :json\n faraday.options[:timeout] = 300\n faraday.adapter Faraday.default_adapter\n end\n\n @logger.debug('Pem::filesync_deploy') { 'Hitting filesync commit endpoint...' }\n conn.post '/file-sync/v1/commit', 'commit-all' => true\n @logger.debug('Pem::filesync_deploy') { 'Done.' }\n\n @logger.debug('Pem::filesync_deploy') { 'Hitting filesync force-sync endpoint...' }\n conn.post '/file-sync/v1/force-sync'\n @logger.debug('Pem::filesync_deploy') { 'Done.' }\n\n @logger.debug('Pem::filesync_deploy') { 'Hitting puppet-admin-api env endpoint...' }\n conn.delete '/puppet-admin-api/v1/environment-cache'\n @logger.debug('Pem::filesync_deploy') { 'Done.' }\n\n @logger.debug('Pem::filesync_deploy') { 'completed filesync deploy' }\n end", "def bootstrap_stack(ops, config, input, options_hash)\n puts \"Creating stack #{config['stack']['name']} ...\"\n stack = ops.create_stack(config['stack'])\n\n if config['permissions']\n stack.grant_access(config['permissions'])\n else\n puts \"Warning! No permissions defined in config. Granting full access to everyone.\"\n stack.grant_full_access \n end\n\n layers = []\n config['layers'].each do |l|\n layer_aws_config = l['config']\n layer = stack.create_layer(layer_aws_config)\n\n if not l.has_key?('instances')\n puts \"Warning! no instances key for layer #{layer_aws_config['name']}\"\n else\n l['instances'].each do |i|\n layer.create_instance(i)\n end\n layers.push(layer)\n end\n\n if l['elb']\n stack.create_elb(l['elb']) if options_hash[:create_elbs]\n layer.attach_elb(l['elb']['name']) if options_hash[:attach_elb]\n update_alarms(l['elb']['alarms']) if l['elb']['alarms']\n end\n\n if l['load_based_auto_scaling'] and l['load_based_auto_scaling']['enabled']\n layer.configure_load_based_auto_scaling(config['load_based_auto_scaling'], l, {:enable => options_hash[:enable_auto_scaling]})\n end\n\n if l['time_based_auto_scaling'] and l['time_based_auto_scaling']['enabled']\n layer.configure_time_based_auto_scaling(config['time_based_auto_scaling'], l)\n end\n\n end\n\n config['apps'].each do |a, value|\n stack.create_app(a, config['apps'][a])\n end\n\n if options_hash[:start_instances]\n instances = []\n\n layers.each do |l|\n started = l.send_start\n instances += started\n\n if options_hash[:load_instances_to_start] and options_hash[:load_instances_to_start][l.name] > 0\n started_load_instances = l.start_load_instances(options_hash[:load_instances_to_start][l.name])\n instances += started_load_instances\n end\n end\n\n ops.wait_for_instances_status(instances, \"online\", [\"stopped\", \"requested\", \"pending\", \"booting\", \"running_setup\"])\n end\n\n puts \"\\n\\nStack #{config['stack']['name']} successfully created.\"\n return stack\nend", "def index\n\n\n# # Exchange your oauth_token and oauth_token_secret for an AccessToken instance.\n# def prepare_access_token(oauth_token, oauth_token_secret)\n# consumer = OAuth::Consumer.new(\"e24305f14f7f9a67c465\", \"604015f905f6207ec29f3661b952397663d58347\",\n# { :site => \"https://api.github.com/\",\n# :scheme => :header\n# })\n# # now create the access token object from passed values\n# token_hash = { :oauth_token => oauth_token,\n# :oauth_token_secret => oauth_token_secret\n# }\n# access_token = OAuth::AccessToken.from_hash(consumer, token_hash )\n# return access_token\n# end\n\n# # Exchange our oauth_token and oauth_token secret for the AccessToken instance.\n# access_token = prepare_access_token(\"abcdefg\", \"hijklmnop\")\n# # use the access token as an agent to get the home timeline\n# @response = access_token.request(:get, \"https://api.github.com/repos/rails/rails/collaborators\")\n\n\n# curl https://api.github.com/repos/rails/rails/collaborators?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\n\n\n # url = \"https://github.com/login/oauth/authorize\"\n\n # @token = JSON.parse(open(url).read)\n\n @repo = Repo.new\n end", "def start_processing\n Repository::Config.new(@repo, @log, @process, @type).status(3) {\n RepoContributor.store_contributors(@repo, git_stats.authors)\n RepoCommit.store_commits(@repo, git_stats.commits)\n }\n end", "def index\n branch = shift_argument || 'master'\n validate_arguments!\n\n Heroku::Auth.check\n\n unless remotes = git_remotes\n error('No Heroku remotes detected.'.red)\n end\n\n unless remote = remotes.key(app)\n error(\"Remote for #{app} was not found.\".red)\n end\n\n begin\n pack = Pack.detect.new(app, remote, options)\n pack.deploy!(branch)\n display('Deployment successful.'.green)\n rescue Pack::NotFound\n error('No suitable deploy pack found.'.red)\n rescue Pack::AmbiguousApp\n error('Ambiguous application, multiple deploy packs apply.'.red)\n rescue CommandExecutionFailure\n error('Deployment aborted.'.red.blink)\n end\n end", "def work\n setup\n\n # status\n status_url = @base_url + \"/status\"\n res = get(status_url)\n output_res(res, @logger)\n\n if res.code.to_i != 200\n msg = 'response code is not 200'\n failure(msg, @logger)\n end\n\n if res.body != 'ok'\n msg = 'response body is not ok'\n failure(msg, @logger)\n end\n\n # slack/feed\n register_url = @base_url + '/v1/slack/feed'\n text = 'rss2slack_register, markezine, <https://markezine.jp/rss/new/20/index.xml>'\n body = make_body(@var, text)\n res = post(register_url, body)\n output_res(res, @logger)\n # {\"attachments\":[{\"fallback\":\"successflluy registerd markezine\",\"color\":\"good\",\"fields\":[{\"title\":\"successflluy registerd markezine\",\"short\":false}],\"footer\":\"from Rss2Slack\",\"ts\":1511707196}],\"username\":\"Rss2Slack\"}\n\n if res.code.to_i != 200\n msg = 'response code is not 200'\n failure(msg, @logger)\n end\n\n json = JSON.parse(res.body)\n if json.nil? || json.empty?\n msg = 'response body is nil or empty'\n failure(msg, @logger)\n end\n\n username = json['username']\n if username != 'Rss2Slack'\n msg = 'username is not Rss2Slack'\n failure(msg, @logger)\n end\n\n attachments = json['attachments']\n if attachments.nil? || attachments.empty?\n msg = 'attachments is nil or empty'\n failure(msg, @logger)\n end\n\n attachment = attachments[0]\n if attachment.nil? || attachment.empty?\n msg = 'attachment is nil or empty'\n failure(msg, @logger)\n end\n\n fields = attachment['fields']\n if fields.nil? || fields.empty?\n msg = 'fields is nil or empty'\n failure(msg, @logger)\n end\n\n field = fields[0]\n if !field['title'].to_s.include?('successflluy registerd')\n msg = 'response title is invalid'\n failure(msg, @logger)\n end\n\n @logger.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')\n @logger.debug('@ @')\n @logger.debug('@ Successfully integration test! @')\n @logger.debug('@ @')\n @logger.debug('@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@')\nrescue => e\n failure(e, @logger)\nend", "def gitaly_payload(action)\n return unless %w[git-receive-pack git-upload-pack git-upload-archive].include?(action)\n\n {\n repository: repository.gitaly_repository.to_h,\n address: Gitlab::GitalyClient.address(repository.shard),\n token: Gitlab::GitalyClient.token(repository.shard),\n features: Feature::Gitaly.server_feature_flags(repository.project),\n use_sidechannel: Feature.enabled?(:gitlab_shell_upload_pack_sidechannel, repository.project, default_enabled: :yaml)\n }\n end", "def push_changes(type, full_module_name, version, opts={})\n Response.wrap_helper_actions() do\n repo_dir = opts[:override_repo_dir_location] ? opts[:override_repo_dir_location] : local_repo_dir(type, full_module_name, version, opts)\n repo = create(repo_dir, opts[:local_branch])\n push_repo_changes_aux(repo, opts)\n end\n end", "def github_fetch_tags\n tags = []\n page_i = 0\n count_pages = calculate_pages(@client, \"tags\", {})\n\n iterate_pages(@client, \"tags\") do |new_tags|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching tags... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n tags.concat(new_tags)\n end\n print_empty_line\n\n if tags.count == 0\n Helper.log.warn \"Warning: Can't find any tags in repo. \\\nMake sure, that you push tags to remote repo via 'git push --tags'\"\n else\n Helper.log.info \"Found #{tags.count} tags\"\n end\n # tags are a Sawyer::Resource. Convert to hash\n tags.map { |resource| stringify_keys_deep(resource.to_hash) }\n end" ]
[ "0.61647576", "0.58703977", "0.584306", "0.57866275", "0.5592362", "0.55889255", "0.5503179", "0.54864395", "0.5481213", "0.547735", "0.54599607", "0.5425859", "0.5423382", "0.5401531", "0.5398338", "0.53948724", "0.5391921", "0.53889024", "0.5387526", "0.5312344", "0.52846366", "0.52800745", "0.5247905", "0.5237181", "0.5228268", "0.52223504", "0.52192235", "0.5214343", "0.52135575", "0.52115583", "0.5205994", "0.5201663", "0.5196187", "0.5172117", "0.5158225", "0.51457584", "0.5138776", "0.51305324", "0.5120093", "0.5117698", "0.5105212", "0.5104871", "0.51028657", "0.5099908", "0.50988704", "0.50897574", "0.5088643", "0.50850666", "0.50507015", "0.5048308", "0.50433576", "0.50384504", "0.5036368", "0.50338614", "0.5029488", "0.50293505", "0.50235885", "0.5017078", "0.5012936", "0.5009534", "0.4998722", "0.49951932", "0.49951932", "0.49911818", "0.49890712", "0.498593", "0.49813953", "0.4975854", "0.49726465", "0.49717483", "0.49716246", "0.49707553", "0.49686366", "0.4967799", "0.4965701", "0.49628615", "0.49391326", "0.4937838", "0.49296674", "0.4929181", "0.49280828", "0.49250677", "0.49250677", "0.4919466", "0.49140054", "0.49130362", "0.4907842", "0.4902044", "0.48992437", "0.48965693", "0.4890966", "0.48891595", "0.48880094", "0.4886049", "0.4885674", "0.4883952", "0.48773238", "0.487132", "0.48654875", "0.48654714", "0.48647645" ]
0.0
-1
Returns the AWS SQS Client
def sqs @sqs ||= Aws::SQS::Client.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_sns_client\n return @aws_sns_client if @aws_sns_client\n\n @aws_sns_client = Aws::SNS::Client.new(region: self.class.sms_aws_region)\n end", "def sqs\n @sqs ||= Chore::Queues::SQS.sqs_client\n end", "def new_sqs_client type\n ::AWS::SQS.new aws_identity(type)\n end", "def s3_client\n region = @options[:region] || ENV[\"AWS_REGION\"]\n @s3_client ||= Aws::S3::Client.new(region: region)\n end", "def s3_client\n @s3_client ||= AWS::S3.new(aws_credentials)\n end", "def s3_client\n log_warning('unable to connect to s3') do\n @s3_client ||= Aws::S3::Client.new\n end\n end", "def s3_client\n @s3 ||= Aws::S3::Client.new\n end", "def client\n credentials = Aws::Credentials.new(settings[:aws_access_key_id],\n settings[:aws_secret_access_key])\n region = settings[:aws_default_region]\n\n Aws::SES::Client.new(credentials: credentials, region: region)\n end", "def s3_client\n @s3_client ||= Aws::S3::Client.new(\n access_key_id: @access_key_id,\n secret_access_key: @secret_access_key,\n region: @region\n )\n end", "def aws_logs_client\n return @aws_logs_client if @aws_logs_client\n\n @aws_logs_client = Aws::CloudWatchLogs::Client.new(region: self.class.sms_aws_region)\n end", "def client\n @client ||= Aws::S3::Client.new(\n access_key_id: access_key,\n secret_access_key: secret_key,\n region: region\n )\n end", "def client\n @asg ||= Aws::AutoScaling::Client.new(region: ENV['aws_region'])\n end", "def sqs_queue(queue_name)\n SQSQueue.new(queue_name)\n end", "def s3_client\n Aws::S3::Client.new(\n access_key_id: ENV['s3_access_id'],\n secret_access_key: ENV['s3_access_secret'],\n region: ENV['s3_region']\n )\n end", "def initialize (aws_access_key_id, aws_secret_access_key, queue_name, params = {})\n\n @aws_access_key_id = aws_access_key_id\n @aws_secret_access_key = aws_secret_access_key\n @queue_name = queue_name\n\n @sqs = RightAws::SqsGen2.new(aws_access_key_id, aws_secret_access_key, params)\n\n @queue = @sqs.queue @queue_name\n end", "def sns\n @sns ||= Aws::SNS::Client.new(\n http_idle_timeout: @sns_keep_alive_timeout,\n http_continue_timeout: @sns_continue_timeout\n )\n end", "def run_me\n region = \"us-west-2\"\n queue_name = \"my-queue\"\n message_body = \"This is my message.\"\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 a message to the queue named '#{queue_name}'...\"\n\n if message_sent?(sqs_client, queue_url, message_body)\n puts \"Message sent.\"\n else\n puts \"Message not sent.\"\n end\nend", "def aws_pinpoint_client\n return @aws_pinpoint_client if @aws_pinpoint_client\n\n @aws_pinpoint_client = Aws::Pinpoint::Client.new(region: self.class.sms_aws_region)\n end", "def client\n @credentials ||= Aws::Credentials.new(@access_id, @access_key)\n @client ||= Aws::CloudFormation::Client.new(\n credentials: @credentials,\n region: @region\n )\n end", "def connection\n @connection ||= AWS::S3.new\n end", "def get_client\n token = Rails.application.credentials[:production][:square][:square_access_token]\n client = Square::Client.new(\n access_token: token,\n environment: \"production\",\n )\n return client\n end", "def client\n @client ||= Aws::KMS::Client.new(\n access_key_id: access_key_id,\n secret_access_key: secret_key,\n region: region\n )\n end", "def s3_client\n role_credentials = aws_assume_role\n s3 = Aws::S3::Client.new(\n credentials: role_credentials,\n force_path_style: true,\n http_proxy: ENV['TAXI_HTTP_PROXY']\n )\n s3\n end", "def glue_client\n log_warning('unable to connect to AWS glue') do\n @glue_client ||= Aws::Glue::Client.new\n end\n end", "def initialize( aws_access_key_id, aws_secret_access_key, options = {} )\n @aws_access_key_id, @aws_secret_access_key = aws_access_key_id, aws_secret_access_key\n opts = DEFAULT_SQS_OPTIONS.merge(options)\n @endpoint = opts[:endpoint]\n end", "def poller\n @poller ||= Aws::SQS::QueuePoller.new(queue_url: address, client: sqs)\n end", "def cloudwatchevents_client\n log_warning('error connecting to AWS events') do\n @cloudwatchevents_client ||= Aws::CloudWatchEvents::Client.new\n end\n end", "def client\n @client ||= Aws::ElasticTranscoder::Client.new\n end", "def load_client\n @aws_client ||= Aws::EC2::Client.new(region: Mnemosyne.config.region)\n end", "def client\n @client ||= Aws::ElasticTranscoder::Client.new\n end", "def create_aws_connection\n Ankus::Aws.new @credentials[:aws_access_id], @credentials[:aws_secret_key], @credentials[:aws_region], @log, @mock\n end", "def send msg\n verify_config\n\n options = Hash.new\n [:access_key_id, :secret_access_key, :region].each do |arg|\n if @config['sqs'].has_key? arg.to_s\n options[arg] = @config['sqs'][arg.to_s]\n end\n end\n\n sqs = AWS::SQS.new options\n\n queue = sqs.queues.create @config['sqs']['queue_name']\n queue.send_message msg\n end", "def list_queues()\n result = make_request('ListQueues')\n\n if result['ListQueuesResult']\n value = result['ListQueuesResult']\n elsif result['ListQueuesResponse']\n value = result['ListQueuesResponse']['ListQueuesResult']\n else\n value = nil\n end\n\n unless value.nil?\n return value\n else\n raise Exception, \"Amazon SQS Error Code: \" + result['Error'][0]['Code'][0] +\n \"\\n\" + result['Error'][0]['Message'][0]\n end\n end", "def initialize(logger, stop_semaphore, poller_options = {}, client_options = {}, aws_options_hash)\n @logger = logger\n @stopped = stop_semaphore\n @queue = client_options[:sqs_queue]\n @from_sns = client_options[:from_sns]\n @max_processing_time = client_options[:max_processing_time]\n @sqs_delete_on_failure = client_options[:sqs_delete_on_failure]\n @options = DEFAULT_OPTIONS.merge(poller_options)\n begin\n @logger.info(\"Registering SQS input\", :queue => @queue)\n sqs_client = Aws::SQS::Client.new(aws_options_hash)\n if uri?(@queue)\n queue_url = @queue\n else\n queue_url = sqs_client.get_queue_url({\n queue_name: @queue,\n queue_owner_aws_account_id: client_options[:queue_owner_aws_account_id]\n }).queue_url\n end\n\n @poller = Aws::SQS::QueuePoller.new(queue_url,\n :client => sqs_client\n )\n @logger.info(\"[#{Thread.current[:name]}] connected to queue.\", :queue_url => queue_url)\n rescue Aws::SQS::Errors::ServiceError => e\n @logger.error(\"Cannot establish connection to Amazon SQS\", :error => e)\n raise LogStash::ConfigurationError, \"Verify the SQS queue name and your credentials\"\n end\n end", "def loadSNSClient\n @snsClient = Aws::SNS::Client.new(access_key_id: ENV['h_aws_access_key_id'],\n secret_access_key: ENV['h_aws_secret_access_key'],\n region: 'us-east-1')\n end", "def s3_client(**opt)\n opt.slice!(*client_params) if opt.present?\n Aws::S3::Client.new(S3_OPTIONS.merge(opt))\n end", "def s3\n @s3 ||= ::AWS::S3.new(region: 'us-east-1')\n end", "def es_client\n self.class.es_client\n end", "def getMessagesFromSQS()\n sqs = Aws::SQS::Client.new\n queue = sqs.create_queue({:queue_name=>@queuename})\n \n poller = Aws::SQS::QueuePoller.new(queue.queue_url)\n poller.poll(idle_timeout: 20) do |msg|\n @queue << msg\n while(true)\n if(@queue.length() < @noOfThreads)\n break\n end\n end\n end\n @run = false\nend", "def client_class\n Stomp::Client\n end", "def make_request(action, queue_url = nil, params = {})\n # Add Actions\n params['Action'] = action\n params['Version'] = '2009-02-01'\n params['AWSAccessKeyId'] = @aws_access_key_id\n params['Expires']= (Time.now + 10).gmtime.iso8601\n params['SignatureMethod'] = 'HmacSHA1'\n params['SignatureVersion'] = '2'\n \t \n # Sign the string\n sorted_params = params.sort_by { |key,value| key }\n joined_params = sorted_params.collect { |key, value| \"#{CGI.escape(key)}=#{CGI.escape(value)}\"}.join(\"&\")\n\n if queue_url && !queue_url.empty?\n endpoint_uri = URI.parse(queue_url)\n else\n endpoint_uri = URI.parse(self.endpoint)\n end\n\n endpoint_hostname = endpoint_uri.host\n endpoint_path = endpoint_uri.path\n\n string_to_sign = \"GET\\n#{endpoint_hostname}\\n#{endpoint_path}\\n\" + joined_params\n\n digest = OpenSSL::Digest::Digest.new('sha1')\n hmac = OpenSSL::HMAC.digest(digest, @aws_secret_access_key, string_to_sign)\n params['Signature'] = Base64.encode64(hmac).chomp\n\n # Construct request\n query = params.collect { |key, value| CGI.escape(key) + \"=\" + CGI.escape(value) }.join(\"&\")\n\n if queue_url && !queue_url.empty?\n query = endpoint_uri.path + \"?\" + query\n else\n query = \"/?\" + query\n end\n\n # You should always retry a 5xx error, as some of these are expected\n retry_count = 0\n try_again = true\n uri = URI.parse(self.endpoint)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(query)\n\n while try_again do\n # Send Amazon SQS query to endpoint\n response = http.start { |http|\n http.request(request)\n }\n # Check if we should retry this request\n if response == Net::HTTPServerError && retry_count <= 5\n retry_count ++\n sleep(retry_count / 4 * retry_count)\n else\n try_again = false\n xml = response.body.to_s\n return XmlSimple.xml_in(xml)\n end\n end\n end", "def create_from_connection_string(connection_string, &block)\n service_options = { client: Azure::Storage::Common::Client::create_from_connection_string(connection_string, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }\n Azure::Storage::Queue::QueueService.new(service_options, &block)\n end", "def s3_connection\n @s3connection ||= connect_to_s3\nend", "def get_aws(name)\n buckets.fetch(name)\n rescue KeyError\n puts \"No S3 bucket named #{name}\"\n exit\n end", "def ec2_client(region)\n begin\n client = Aws::EC2::Client.new(region: region)\n rescue => e\n puts e\n exit\n end\nend", "def queue(name)\n if @@reset_next\n Aws.empty_connection_pools!\n @sqs = nil\n @@reset_next = false\n @sqs_queues = {}\n end\n\n @sqs_queue_urls[name] ||= sqs.get_queue_url(queue_name: name).queue_url\n @sqs_queues[name] ||= Aws::SQS::Queue.new(url: @sqs_queue_urls[name], client: sqs)\n end", "def connect()\n access_key = ENV[\"AWS_ACCESS_KEY_ID\"] || raise(\"Missing environment variable AWS_ACCESS_KEY_ID\")\n secret_key = ENV[\"AWS_SECRET_ACCESS_KEY\"] || raise(\"Missing environment variable AWS_SECRET_ACCESS_KEY\")\n\n logger = Logger.new('/dev/null')\n RightAws::S3.new(access_key, secret_key, :logger => logger)\n end", "def receive_message\n sqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])\n resp = sqs.receive_message(queue_url: ENV['SQS_ENDPOINT'])\n\n if resp.messages.count > 0\n process_message(resp.messages[0])\n end\n end", "def service\n ::S3::Service.new(:access_key_id => access_key_id,\n :secret_access_key => secret_access_key,\n :use_ssl => use_ssl)\n end", "def new_i3s_client(options = {})\n OneviewSDK::ImageStreamer::Client.new(options.merge(token: @token))\n end", "def initialize options = {}\n @config = options[:config]\n @config ||= AWS.config\n @config = @config.with(options)\n @client = config.send(Inflection.ruby_name(self.class.to_s) + '_client')\n end", "def createS3Connection\n begin\n s3 = AWS::S3.new(:access_key_id => session[:s3username],\n :secret_access_key => session[:s3password],\n :s3_endpoint => session[:s3address],\n :use_ssl => session[:use_ssl]\n )\n return s3\n rescue Exception => error\n return nil\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating connection: #{error}.\"\n end\n end", "def create_queue(name)\n params = {}\n params['QueueName'] = name\n result = make_request('CreateQueue', nil, params)\n\n unless result.include?('Error')\n queue_url = result['CreateQueueResult'][0]['QueueUrl'][0]\n return AWS::SQS::Queue.new(name, queue_url, self)\n else\n raise Exception, \"Amazon SQS Error Code: \" + result['Error'][0]['Code'][0] +\n \"\\n\" + result['Error'][0]['Message'][0]\n end\n end", "def messaging_client\r\n @messaging_client ||= Messaging::Client.new(config: config)\r\n end", "def cloud_formation\n require 'aws-sdk'\n @cloud_formation ||= Aws::CloudFormation::Client.new(region: aws_region)\n end", "def connection(_instance_opts = nil)\n # Typical practice is to cache the connection as an instance variable.\n # Do what makes sense for your platform.\n # @options here is the parsed options that the calling\n # app handed to us at process invocation. See the Connection class\n # for more details.\n @connection ||= TrainPlugins::Aws::Connection.new(@options)\n end", "def get_s3_bucket_object(bucket_name)\n resource.bucket(bucket_name)\n end", "def connect_to_s3()\n\n Aws::S3::Client.new(\n access_key_id: ENV['S3_KEY'],\n secret_access_key: ENV['S3_SECRET'],\n region: ENV['AWS_REGION'],\n force_path_style: ENV['PATH_STYLE']\n )\n \nend", "def get_client\n @client\n end", "def aws_connect\n AWS::S3::Base.establish_connection!(\n :access_key_id => 'AKIAIFIQT4URJKGNI5KA',\n :secret_access_key => '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'\n )\n end", "def client\n @@client\n end", "def s3_object\n @s3_object ||= AWS::S3::S3Object.find(key, bucket) if self.class.open_aws && key\n rescue\n nil\n end", "def instance_queue\n @instance_queue ||= sqs.queue(instance_id)\n return @instance_queue\n end", "def client\n key, secret = credentials\n @client ||= Cloudkick::Base.new(key, secret)\n end", "def client(region,access_key_id=nil,secret_access_key=nil)\n self.ec2_client ||= Aws::EC2::Client.new(region: region, access_key_id: access_key_id, secret_access_key: secret_access_key )\n end", "def s3_bucket(bucket_name)\n S3Bucket.new(bucket_name)\n end", "def route53\n @route53 ||= Aws::Route53::Client.new(\n credentials: @credentials,\n region: @region\n )\n end", "def get_client\n config.client.new(self)\n end", "def queues(options = {})\n Azure::Queue::QueueService.new(default_client(options))\n end", "def connection\n Fog::Storage.new provider: 'AWS'\n end", "def create_resource\n begin\n @response = sqs.create_queue(queue_name: to_camel(@name))\n yield self if block_given?\n self\n rescue Aws::SQS::Errors::QueueDeletedRecently\n sleep 5\n retry\n end\n end", "def establish_s3_connection\n @s3_connection = AWS::S3::Base.establish_connection!(get_keys)\nend", "def client\n @client || Client.connection\n end", "def s3_resource(**opt)\n client = opt[:client] || s3_client(**opt)\n Aws::S3::Resource.new(client: client)\n end", "def bucket; ::AWS::S3.new({ secure: true }).buckets[DC::SECRETS['bucket']]; end", "def s3_bucket(name)\n s3_client.buckets[name]\n end", "def client\n self.class.client\n end", "def client\n self.class.client\n end", "def load_client\n user_agent_suffix = \"fluent-#{NAME}\"\n\n options = {\n user_agent_suffix: user_agent_suffix\n }\n\n if @region\n options[:region] = @region\n end\n\n if @aws_key_id && @aws_sec_key\n options.update(\n access_key_id: @aws_key_id,\n secret_access_key: @aws_sec_key,\n )\n elsif @profile\n credentials_opts = {:profile_name => @profile}\n credentials_opts[:path] = @credentials_path if @credentials_path\n credentials = Aws::SharedCredentials.new(credentials_opts)\n options[:credentials] = credentials\n elsif @role_arn\n credentials = Aws::AssumeRoleCredentials.new(\n client: Aws::STS::Client.new(options),\n role_arn: @role_arn,\n role_session_name: \"fluent-plugin-kinesis-aggregation\",\n external_id: @external_id,\n duration_seconds: 60 * 60\n )\n options[:credentials] = credentials\n end\n\n if @debug\n options.update(\n logger: Logger.new(log.out),\n log_level: :debug\n )\n end\n\n if @http_proxy\n options[:http_proxy] = @http_proxy\n end\n\n @client = Aws::Kinesis::Client.new(options)\n end", "def client\n @client ||= self.class.client\n end", "def read_message(adapter, queue_url)\n result = adapter.sqs_client.receive_message(\n queue_url: queue_url,\n max_number_of_messages: 1,\n wait_time_seconds: adapter.options[:mq_aws_sqs_read_timeout],\n message_attribute_names: [\"All\"]\n )\n return nil if result.messages.count == 0\n return result.messages.first if result.messages.count == 1\n\n raise Mimi::Messaging::ConnectionError, \"Unexpected number of messages read\"\n end", "def get_queue\n return @queue unless @queue.nil?\n\n Domo::Queue::Redis::JobQueue.active_queue(@redis_client, @dataset_id, @stream_id, pipeline_id)\n end", "def client\n @client\n end", "def client\n @client\n end", "def client\n @client\n end", "def driver\n 'aws'\n end", "def createEC2Client(region,credentials)\n begin\n return Aws::EC2::Client.new(region: region,credentials: credentials)\n rescue Exception => e\n puts \"\\e[31mCould not create new EC2 client\"\n puts \"#{e.message}\\e[0m\"\n exit 1\n end\nend", "def q_url\n return @q_url if @q_url\n @q_url = @sqs_queue.url\n @q_url\n end", "def set_sqs_integration\n @sqs_integration = SqsIntegration.find(params[:id])\n end", "def client\n\t\treturn @client\n\tend", "def get(headers = {}, &block)\n self.connect\n SMQueue.dbg { [:smqueue, :get, headers].inspect }\n subscription_headers = {\"ack\" => \"client\", \"activemq.prefetchSize\" => 1 }\n if client_id = configuration.client_id\n subscription_headers[\"client_id\"] = client_id\n end\n if sub_name = configuration.subscription_name\n subscription_headers[\"subscription_name\"] = sub_name\n end\n # if a client_id is supplied, then user wants a durable subscription\n # N.B. client_id must be unique for broker\n subscription_headers.update(headers)\n #p [:subscription_headers_before, subscription_headers]\n subscription_headers = normalize_keys(subscription_headers)\n if configuration.durable and client_id = configuration.client_id || subscription_headers[\"client_id\"]\n subscription_name = configuration.subscription_name || subscription_headers[\"subscription_name\"] || client_id\n # activemq only\n subscription_headers[\"activemq.subscriptionName\"] = subscription_name\n # JMS\n subscription_headers[\"durable-subscriber-name\"] = subscription_name\n end\n #p [:subscription_headers_after, subscription_headers]\n\n destination = configuration.name\n SMQueue.dbg { [:smqueue, :get, :subscribing, destination, :subscription_headers, subscription_headers].inspect }\n connection.subscribe destination, subscription_headers\n message = nil\n SMQueue.dbg { [:smqueue, :get, :subscription_headers, subscription_headers].inspect }\n begin\n # TODO: refactor this\n if block_given?\n SMQueue.dbg { [:smqueue, :get, :block_given].inspect }\n # todo: change to @running - (and set to false from exception handler)\n # also should check to see if anything left to receive on connection before bailing out\n while true\n SMQueue.dbg { [:smqueue, :get, :receive].inspect }\n # block until message ready\n message = connection.receive\n SMQueue.dbg { [:smqueue, :get, :received, message].inspect }\n case message.command\n when \"ERROR\"\n SMQueue.dbg { [:smqueue, :get, :ERROR, message].inspect }\n when \"RECEIPT\"\n SMQueue.dbg { [:smqueue, :get, :RECEIPT, message].inspect }\n else\n SMQueue.dbg { [:smqueue, :get, :yielding].inspect }\n if !message_seen?(message.headers[\"message-id\"])\n yield(message)\n end\n SMQueue.dbg { [:smqueue, :get, :message_seen, message.headers[\"message-id\"]].inspect }\n message_seen message.headers[\"message-id\"]\n SMQueue.dbg { [:smqueue, :get, :returned_from_yield_now_calling_ack].inspect }\n ack(subscription_headers, message)\n SMQueue.dbg { [:smqueue, :get, :returned_from_ack].inspect }\n end\n end\n else\n SMQueue.dbg { [:smqueue, :get, :single_shot].inspect }\n message = connection.receive\n SMQueue.dbg { [:smqueue, :get, :received, message].inspect }\n if !(message.command == \"ERROR\" or message.command == \"RECEIPT\")\n SMQueue.dbg { [:smqueue, :get, :message_seen, message.headers[\"message-id\"]].inspect }\n message_seen message.headers[\"message-id\"]\n SMQueue.dbg { [:smqueue, :get, :ack, message].inspect }\n ack(subscription_headers, message)\n SMQueue.dbg { [:smqueue, :get, :returned_from_ack].inspect }\n end\n end\n rescue Object => e\n SMQueue.dbg { [:smqueue, :get, :exception, e].inspect }\n handle_error e, \"Exception in SMQueue#get: #{e.message}\", caller\n ensure\n SMQueue.dbg { [:smqueue, :get, :ensure].inspect }\n SMQueue.dbg { [:smqueue, :unsubscribe, destination, subscription_headers].inspect }\n connection.unsubscribe destination, subscription_headers\n SMQueue.dbg { [:smqueue, :disconnect].inspect }\n connection.disconnect\n end\n SMQueue.dbg { [:smqueue, :get, :return].inspect }\n message\n end", "def s3_bucket\n return @s3_bucket if defined? @s3_bucket\n\n s3 = AWS::S3.new(@task.aws_config)\n @s3_bucket = s3.buckets[@task.bucket]\n end", "def bucket; ::AWS::S3.new( { :secure => false } ).buckets[DC::SECRETS['bucket']]; end", "def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end", "def redshift\n @redshift ||= Aws::Redshift::Client.new aws_config\n end", "def client\n @client ||= Client.new(configuration)\n end", "def client\n @client ||= VAHealthcareMessaging::Client.new(config: MHV_CONFIG, session: { user_id: correlation_id })\n end", "def initialize(aws_region:)\n @ec2_client ||= Aws::EC2::Client.new(region: aws_region)\n end", "def initialize(name:, client: sqs, **config)\n super\n @sqs = client\n end", "def provider\n 'AWS'\n end" ]
[ "0.76662487", "0.73675054", "0.72776425", "0.69445866", "0.6934433", "0.6890007", "0.6863533", "0.6842974", "0.67306465", "0.6724365", "0.6619779", "0.6612059", "0.6589289", "0.6540269", "0.6493663", "0.62928706", "0.62598026", "0.6164521", "0.6153829", "0.60942745", "0.6053614", "0.6042387", "0.6027962", "0.59634143", "0.59230614", "0.5887951", "0.58099747", "0.58016515", "0.5796907", "0.5784274", "0.5758512", "0.57297736", "0.57288986", "0.57129484", "0.5659202", "0.56552315", "0.5621977", "0.5575526", "0.55623454", "0.555271", "0.5542012", "0.55087024", "0.54896426", "0.54692656", "0.5436355", "0.5410675", "0.54097", "0.5408189", "0.54018795", "0.5379404", "0.5373959", "0.53437376", "0.52992", "0.5291785", "0.5276913", "0.5261583", "0.52590436", "0.52329427", "0.52327967", "0.5223739", "0.5214828", "0.5210417", "0.5202459", "0.5193894", "0.5187932", "0.5182259", "0.5179674", "0.5172555", "0.5171056", "0.5168245", "0.5164125", "0.5150444", "0.5148588", "0.5146494", "0.51414144", "0.5133818", "0.5127644", "0.5127644", "0.51255465", "0.5124635", "0.5123205", "0.51131135", "0.51117086", "0.51117086", "0.51117086", "0.51093775", "0.51080936", "0.51071155", "0.5072481", "0.5056004", "0.5055803", "0.5050564", "0.5035383", "0.50234294", "0.50065994", "0.5002349", "0.49869752", "0.4971148", "0.49602652", "0.49584252" ]
0.82289195
0
Returns the AWS SNS Client
def sns @sns ||= Aws::SNS::Client.new( http_idle_timeout: @sns_keep_alive_timeout, http_continue_timeout: @sns_continue_timeout ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_sns_client\n return @aws_sns_client if @aws_sns_client\n\n @aws_sns_client = Aws::SNS::Client.new(region: self.class.sms_aws_region)\n end", "def loadSNSClient\n @snsClient = Aws::SNS::Client.new(access_key_id: ENV['h_aws_access_key_id'],\n secret_access_key: ENV['h_aws_secret_access_key'],\n region: 'us-east-1')\n end", "def client\n credentials = Aws::Credentials.new(settings[:aws_access_key_id],\n settings[:aws_secret_access_key])\n region = settings[:aws_default_region]\n\n Aws::SES::Client.new(credentials: credentials, region: region)\n end", "def new_sqs_client type\n ::AWS::SQS.new aws_identity(type)\n end", "def aws_logs_client\n return @aws_logs_client if @aws_logs_client\n\n @aws_logs_client = Aws::CloudWatchLogs::Client.new(region: self.class.sms_aws_region)\n end", "def s3_client\n log_warning('unable to connect to s3') do\n @s3_client ||= Aws::S3::Client.new\n end\n end", "def s3_client\n @s3_client ||= AWS::S3.new(aws_credentials)\n end", "def sqs\n @sqs ||= Aws::SQS::Client.new\n end", "def s3_client\n region = @options[:region] || ENV[\"AWS_REGION\"]\n @s3_client ||= Aws::S3::Client.new(region: region)\n end", "def client\n @client ||= Aws::S3::Client.new(\n access_key_id: access_key,\n secret_access_key: secret_key,\n region: region\n )\n end", "def s3_client\n @s3 ||= Aws::S3::Client.new\n end", "def s3_client\n @s3_client ||= Aws::S3::Client.new(\n access_key_id: @access_key_id,\n secret_access_key: @secret_access_key,\n region: @region\n )\n end", "def sns_topic\n @sns_topic ||= if sns_topic_arn.present?\n Aws::SNS::Resource.new(region: 'eu-west-2').topic(sns_topic_arn)\n end\n end", "def aws_pinpoint_client\n return @aws_pinpoint_client if @aws_pinpoint_client\n\n @aws_pinpoint_client = Aws::Pinpoint::Client.new(region: self.class.sms_aws_region)\n end", "def client\n @asg ||= Aws::AutoScaling::Client.new(region: ENV['aws_region'])\n end", "def client\n @client ||= Aws::KMS::Client.new(\n access_key_id: access_key_id,\n secret_access_key: secret_key,\n region: region\n )\n end", "def s3_client\n Aws::S3::Client.new(\n access_key_id: ENV['s3_access_id'],\n secret_access_key: ENV['s3_access_secret'],\n region: ENV['s3_region']\n )\n end", "def cloudwatchevents_client\n log_warning('error connecting to AWS events') do\n @cloudwatchevents_client ||= Aws::CloudWatchEvents::Client.new\n end\n end", "def load_client\n @aws_client ||= Aws::EC2::Client.new(region: Mnemosyne.config.region)\n end", "def s3_client\n role_credentials = aws_assume_role\n s3 = Aws::S3::Client.new(\n credentials: role_credentials,\n force_path_style: true,\n http_proxy: ENV['TAXI_HTTP_PROXY']\n )\n s3\n end", "def client\n @client ||= NPS::Client.new\n end", "def client\n @credentials ||= Aws::Credentials.new(@access_id, @access_key)\n @client ||= Aws::CloudFormation::Client.new(\n credentials: @credentials,\n region: @region\n )\n end", "def get_client\n config.client.new(self)\n end", "def client_class\n Stomp::Client\n end", "def get_client\n @client\n end", "def glue_client\n log_warning('unable to connect to AWS glue') do\n @glue_client ||= Aws::Glue::Client.new\n end\n end", "def new_i3s_client(options = {})\n OneviewSDK::ImageStreamer::Client.new(options.merge(token: @token))\n end", "def client\n @client ||= Aws::ElasticTranscoder::Client.new\n end", "def messaging_client\r\n @messaging_client ||= Messaging::Client.new(config: config)\r\n end", "def client\n @client ||= Aws::ElasticTranscoder::Client.new\n end", "def create_savon_client(endpoint, namespace)\n client = Savon::Client.new do |wsdl, httpi|\n wsdl.endpoint = endpoint\n wsdl.namespace = namespace\n AdsCommon::Http.configure_httpi(@api.config, httpi)\n end\n return client\n end", "def initialize options = {}\n @config = options[:config]\n @config ||= AWS.config\n @config = @config.with(options)\n @client = config.send(Inflection.ruby_name(self.class.to_s) + '_client')\n end", "def redshift\n @redshift ||= Aws::Redshift::Client.new aws_config\n end", "def create_aws_connection\n Ankus::Aws.new @credentials[:aws_access_id], @credentials[:aws_secret_key], @credentials[:aws_region], @log, @mock\n end", "def client\n @client ||= Savon::Client.new do\n wsdl.endpoint = Kraut.endpoint\n wsdl.namespace = \"urn:SecurityServer\"\n end\n end", "def client\n @client\n end", "def client\n @client\n end", "def client\n @client\n end", "def client \n @client ||= Savon::Client.new do\n wsdl.document = self.endpoint\n end\n end", "def sns_topic(sns_topic_arn)\n SNSTopic.new(sns_topic_arn)\n end", "def sqs\n @sqs ||= Chore::Queues::SQS.sqs_client\n end", "def client\n @@client ||= Orchestrate::Application::Connect.client\n end", "def get_client\n token = Rails.application.credentials[:production][:square][:square_access_token]\n client = Square::Client.new(\n access_token: token,\n environment: \"production\",\n )\n return client\n end", "def client\n @@client\n end", "def service\n ::S3::Service.new(:access_key_id => access_key_id,\n :secret_access_key => secret_access_key,\n :use_ssl => use_ssl)\n end", "def es_client\n self.class.es_client\n end", "def client\n Savon.client options\n end", "def client\n @client ||= self.class.client\n end", "def client\n self.class.client\n end", "def client\n self.class.client\n end", "def s3_client(**opt)\n opt.slice!(*client_params) if opt.present?\n Aws::S3::Client.new(S3_OPTIONS.merge(opt))\n end", "def getclient\n return @client\n end", "def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end", "def run_me\n region = \"us-west-2\"\n queue_name = \"my-queue\"\n message_body = \"This is my message.\"\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 a message to the queue named '#{queue_name}'...\"\n\n if message_sent?(sqs_client, queue_url, message_body)\n puts \"Message sent.\"\n else\n puts \"Message not sent.\"\n end\nend", "def dnspod()\n AWS::Route53.new(:access_key_id => @aws_access_key_id,\n :secret_access_key => @aws_access_key).client\n end", "def connect()\n access_key = ENV[\"AWS_ACCESS_KEY_ID\"] || raise(\"Missing environment variable AWS_ACCESS_KEY_ID\")\n secret_key = ENV[\"AWS_SECRET_ACCESS_KEY\"] || raise(\"Missing environment variable AWS_SECRET_ACCESS_KEY\")\n\n logger = Logger.new('/dev/null')\n RightAws::S3.new(access_key, secret_key, :logger => logger)\n end", "def client\n @config.send(\"#{config_prefix}_client\")\n end", "def client\n @client ||= Client.new(configuration)\n end", "def client\n\t\treturn @client\n\tend", "def client\n @client\n end", "def client\n @client\n end", "def sns_topic\n data.sns_topic\n end", "def connection\n @connection ||= AWS::S3.new\n end", "def client\n @client || Client.connection\n end", "def client(region,access_key_id=nil,secret_access_key=nil)\n self.ec2_client ||= Aws::EC2::Client.new(region: region, access_key_id: access_key_id, secret_access_key: secret_access_key )\n end", "def ec2_client(region)\n begin\n client = Aws::EC2::Client.new(region: region)\n rescue => e\n puts e\n exit\n end\nend", "def load_client\n user_agent_suffix = \"fluent-#{NAME}\"\n\n options = {\n user_agent_suffix: user_agent_suffix\n }\n\n if @region\n options[:region] = @region\n end\n\n if @aws_key_id && @aws_sec_key\n options.update(\n access_key_id: @aws_key_id,\n secret_access_key: @aws_sec_key,\n )\n elsif @profile\n credentials_opts = {:profile_name => @profile}\n credentials_opts[:path] = @credentials_path if @credentials_path\n credentials = Aws::SharedCredentials.new(credentials_opts)\n options[:credentials] = credentials\n elsif @role_arn\n credentials = Aws::AssumeRoleCredentials.new(\n client: Aws::STS::Client.new(options),\n role_arn: @role_arn,\n role_session_name: \"fluent-plugin-kinesis-aggregation\",\n external_id: @external_id,\n duration_seconds: 60 * 60\n )\n options[:credentials] = credentials\n end\n\n if @debug\n options.update(\n logger: Logger.new(log.out),\n log_level: :debug\n )\n end\n\n if @http_proxy\n options[:http_proxy] = @http_proxy\n end\n\n @client = Aws::Kinesis::Client.new(options)\n end", "def createEC2Client(region,credentials)\n begin\n return Aws::EC2::Client.new(region: region,credentials: credentials)\n rescue Exception => e\n puts \"\\e[31mCould not create new EC2 client\"\n puts \"#{e.message}\\e[0m\"\n exit 1\n end\nend", "def client\n @client ||= es_node.client(true).data(false).node.client\n end", "def client\n @client ||= VAHealthcareMessaging::Client.new(config: MHV_CONFIG, session: { user_id: correlation_id })\n end", "def client\n @client ||= Client.new\n end", "def createS3Connection\n begin\n s3 = AWS::S3.new(:access_key_id => session[:s3username],\n :secret_access_key => session[:s3password],\n :s3_endpoint => session[:s3address],\n :use_ssl => session[:use_ssl]\n )\n return s3\n rescue Exception => error\n return nil\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem creating connection: #{error}.\"\n end\n end", "def aws_connect\n AWS::S3::Base.establish_connection!(\n :access_key_id => 'AKIAIFIQT4URJKGNI5KA',\n :secret_access_key => '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'\n )\n end", "def client\n set_connection unless @client\n @client\n end", "def client\n @client ||= ::Twilio::REST::Client.new(@account_sid, @auth_token)\n end", "def client\n @client ||= Client.current\n end", "def client\n Exchange::GemLoader.new('redis').try_load unless defined?(::Redis)\n @client ||= ::Redis.new(:host => config.host, :port => config.port)\n end", "def client\n self.class.client\n end", "def client\n @client ||= Savon.client(client_options)\n return @client unless block_given?\n yield @client\n end", "def srch_client\n\t\t\t\t@@client ||= Srchio::Client.new(:searcher_id => srch_config[:searcher_id])\n\t\t\tend", "def client\n Savon::Client.new do |savon|\n savon.ssl_verify_mode :none\n savon.wsdl base_url\n savon.namespaces namespaces\n savon.env_namespace 'SOAP-ENV'\n savon.raise_errors false\n #savon.namespace_identifier #none\n savon.convert_request_keys_to :lower_camelcase\n savon.strip_namespaces true\n savon.pretty_print_xml true\n savon.log log_env\n savon.open_timeout 10 #seconds\n savon.read_timeout 45 #seconds\n end\n end", "def public_client\n return @public_client\n end", "def orchestrate_client\n client\n end", "def client\n @client ||= begin\n client_config = {\n wsdl: config.wsdl,\n namespace: config.soap_namespace,\n log_level: config.log_level,\n element_form_default: :qualified,\n namespaces: NAMESPACES\n }\n\n client_config[:proxy] = config.http_proxy if config.http_proxy.present?\n\n Savon::Client.new client_config\n end\n end", "def client\n # @client ||= MyService::Client.new(SinaToken.consumer.key, SinaToken.consumer.secret, token, secret)\n end", "def route53\n @route53 ||= Aws::Route53::Client.new(\n credentials: @credentials,\n region: @region\n )\n end", "def ecs\n Amazon::Ecs.configure do |options|\n options[:aWS_access_key_id] = @@key_id\n options[:associate_tag] = @@associate_id\n options[:aWS_secret_key] = @@secretkey\n end \n return Amazon::Ecs \nend", "def s3\n @s3 ||= ::AWS::S3.new(region: 'us-east-1')\n end", "def connect_to_s3()\n\n Aws::S3::Client.new(\n access_key_id: ENV['S3_KEY'],\n secret_access_key: ENV['S3_SECRET'],\n region: ENV['AWS_REGION'],\n force_path_style: ENV['PATH_STYLE']\n )\n \nend", "def client(sid = nil, auth = nil)\n ::Twilio::REST::Client.new(\n sid || ENV['TWILIO_ACCOUNT_SID'],\n auth || ENV['TWILIO_AUTH_TOKEN']\n )\n end", "def client\n @parent.instance_variable_get(:@client)\n end", "def provider\n 'AWS'\n end", "def client\n @redis\n end", "def client\n Thread.current[:client]\n end", "def initialize( aws_access_key_id, aws_secret_access_key, options = {} )\n @aws_access_key_id, @aws_secret_access_key = aws_access_key_id, aws_secret_access_key\n opts = DEFAULT_SQS_OPTIONS.merge(options)\n @endpoint = opts[:endpoint]\n end", "def build_aws_sns_message(device_type: 'all')\n option = { notification_id: id }\n option.merge!(deep_link: deep_link) if deep_link.present?\n AwsSnsMessage.new(message, device_type, option).build\n end", "def provider\n 'AWS'\n end", "def provider\n 'AWS'\n end", "def message\n body = request.body.read\n if Aws::SNS::MessageVerifier.new.authentic?(body)\n json = JSON.parse(body)\n Rails.logger.debug(\"SNS: Received message: #{json}\")\n if json['Token']\n topic = ::Aws::SNS::Topic.new(Figaro.env.aws_et_sns_topic_arn)\n response = topic.confirm_subscription(token: json['Token'])\n Rails.logger.debug(\"SNS: Confirmed subscription for topic: #{Figaro.env.aws_et_sns_topic_arn}: #{response}\")\n else\n msg = JSON.parse(json['Message'])\n Rails.logger.debug(\"SNS: Message is for job: #{msg['jobId']} with state #{msg['state']}\")\n job = Job.where(external_id: msg['jobId']).first\n if job\n Jobs::Read.call(job: job)\n else\n Rails.logger.debug(\"No Job for job id #{msg['jobId']}\")\n end\n end\n end\n render nothing: true, status: 200, content_type: 'text/html'\n end", "def get_client(uri, http_type, method)\n return @client\n end" ]
[ "0.8669044", "0.73946285", "0.7279516", "0.6532922", "0.649756", "0.6448559", "0.64463377", "0.6383555", "0.6354256", "0.6325573", "0.63059914", "0.62951267", "0.6238947", "0.62069494", "0.62035877", "0.6196929", "0.6169629", "0.6125074", "0.6058878", "0.60009885", "0.59267396", "0.58528847", "0.5809", "0.58025336", "0.5734596", "0.5726456", "0.5706016", "0.5648213", "0.5631505", "0.56272984", "0.55592275", "0.5543806", "0.5534498", "0.55199695", "0.5519005", "0.55024976", "0.55024976", "0.55024976", "0.54886925", "0.54687643", "0.5449378", "0.5439497", "0.54260343", "0.5422686", "0.5412427", "0.5410016", "0.5406698", "0.5405795", "0.538833", "0.538833", "0.5385423", "0.53825414", "0.5368736", "0.53629845", "0.53592336", "0.53546", "0.535427", "0.5337793", "0.53271323", "0.532344", "0.532344", "0.5317199", "0.5283638", "0.5256125", "0.5241264", "0.5231415", "0.52312726", "0.5221158", "0.5220685", "0.52132416", "0.5198663", "0.51946896", "0.5193217", "0.5179124", "0.5163208", "0.51588607", "0.5157594", "0.51417065", "0.51381487", "0.5132448", "0.51282877", "0.5111827", "0.5106223", "0.50821894", "0.5078423", "0.5062044", "0.5053557", "0.50530666", "0.5029771", "0.5026115", "0.50228477", "0.50175047", "0.5016089", "0.5014741", "0.5007625", "0.50040823", "0.50011235", "0.50011235", "0.499857", "0.4997509" ]
0.8201545
1
Returns the URL of the queue. The queue will be created when it does
def get_queue_url(queue) _queue_name = EventQ.create_queue_name(queue.name) response= sqs.get_queue_url( queue_name: aws_safe_name(_queue_name), queue_owner_aws_account_id: @aws_account, ) return response.queue_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queue_url(job)\n sqs.create_queue(queue_name: job.queue_name)[:queue_url]\n end", "def q_url\n return @q_url if @q_url\n @q_url = @sqs_queue.url\n @q_url\n end", "def url_for queue_name, options = {}\n client_opts = {}\n client_opts[:queue_name] = queue_name\n client.get_queue_url(client_opts.merge(options))[:queue_url]\n end", "def queue_url(*_)\n if Settings.active_job_queue.url\n Settings.active_job_queue.url\n else\n super\n end\n end", "def build_url(base_url, queue_name)\n return \"#{base_url}/#{queue_name}\"\n end", "def queue_url(queue_name_or_url)\n if URI.parse(queue_name_or_url).scheme\n queue_name_or_url\n else\n list_queues(queue_name_or_url).map do |sqs|\n sqs.queue_url\n end.each do |url|\n return url if URI.parse(url).path.split('/').last == queue_name_or_url\n end\n end\n end", "def wait_for_queue_url(queue_name)\n queue_url = nil\n until queue_url\n queue_url = @sqs.queue_url_by_name(queue_name)\n unless queue_url\n print '-'\n STDOUT.flush\n sleep 1\n end\n end\n queue_url\n end", "def queue\n @queue ||= channel.queue(queue_name)\n end", "def name\n @queue_string\n end", "def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end", "def queue(queue = 'default')\n get_queue(queue)\n end", "def name\n @queue.queue_name\n end", "def wait_for_queue_url(queue_name)\n queue_url = nil\n do_sleep(180) do\n queue_url = @sqs.queue_url_by_name(queue_name)\n end\n sleep 30\n queue_url\n end", "def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end", "def name\n @queue.name\n end", "def [](queue_name_or_url)\n self.new queue_url(queue_name_or_url)\n end", "def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end", "def queue\n # Probably should be a UUID in the real world\n @queue ||= channel.queue(self.object_id.to_s)\n end", "def relative_queue\n gcp_task\n .name\n .match(%r{/queues/([^/]+)})\n &.captures\n &.first\n &.sub(/^#{self.class.config.gcp_queue_prefix}-/, '')\n end", "def queue\n @queue ||= QueueManager.fetch(@name,@visibility)\n end", "def storage_queue_host\n ENV[\"AZURE_STORAGE_QUEUE_HOST\"]\n end", "def storage_queue_host\n ENV['AZURE_STORAGE_QUEUE_HOST']\n end", "def on_queue(url)\n true\n end", "def href\n \"#{PATH_BASE}/#{@queue.name}/messages/#{@id}\"\n end", "def queue(queue_name)\n @queues[queue_name]\n end", "def queue\n @handle.queue_name if @handle\n end", "def queue\n @queue ||= Queue.new\n end", "def get_queue\n return @queue unless @queue.nil?\n\n Domo::Queue::Redis::JobQueue.active_queue(@redis_client, @dataset_id, @stream_id, pipeline_id)\n end", "def get_current_queue\n log_everything(\"Get current queue\")\n craft_firebase_command(\"minesweeper/queue.json\")\nend", "def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end", "def queue(\n queue_name,\n url: nil,\n method: nil,\n reservation_sid: nil,\n post_work_activity_sid: nil,\n **keyword_args\n )\n append(Queue.new(\n queue_name,\n url: url,\n method: method,\n reservation_sid: reservation_sid,\n post_work_activity_sid: post_work_activity_sid,\n **keyword_args\n ))\n end", "def queue(name)\n if @@reset_next\n Aws.empty_connection_pools!\n @sqs = nil\n @@reset_next = false\n @sqs_queues = {}\n end\n\n @sqs_queue_urls[name] ||= sqs.get_queue_url(queue_name: name).queue_url\n @sqs_queues[name] ||= Aws::SQS::Queue.new(url: @sqs_queue_urls[name], client: sqs)\n end", "def set_url_queue\n @url_queue = UrlQueue.find(params[:id])\n end", "def queue_urls\n @queue_urls ||= init_urls\n end", "def create_queue(queue_name, default_visibility_timeout=nil)\n self.new\\\n Adapter.create_queue(\n queue_name,\n default_visibility_timeout\n )['CreateQueueResponse']['CreateQueueResult']['QueueUrl']\n end", "def sqs_queue(queue_name)\n SQSQueue.new(queue_name)\n end", "def url\n @@url ||= (ENV[\"AMQP_URL\"] || \"amqp://guest:guest@localhost/\")\n end", "def queue\n @queue ||= SizedQueue.new @queue_size\n end", "def url\n check_validity!\n\n build_redis_url without_namespace: true\n end", "def queue\n @queue ||= produce_queue\n end", "def url\n \"#{File.join(job.url, number.to_s)}/\"\n end", "def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end", "def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end", "def build_jobs_url\n \"http://#{host_name}:#{port}/jobs\"\n end", "def create\n @url_queue = UrlQueue.new(url_queue_params)\n\n respond_to do |format|\n if @url_queue.save\n format.html { redirect_to @url_queue, notice: 'Url queue was successfully created.' }\n format.json { render :show, status: :created, location: @url_queue }\n else\n format.html { render :new }\n format.json { render json: @url_queue.errors, status: :unprocessable_entity }\n end\n end\n end", "def url\n return nil unless @uploader.upyun_bucket_host\n\n [@uploader.upyun_bucket_host, @path].join(\"/\")\n end", "def queue_for(num)\n \"#{queue}.#{num}\"\n end", "def domain\n return 'ADS-QUEUE'\n end", "def personal_queue\n unless (local_queues = self.queues).empty?\n local_queues[0]\n end\n end", "def queue_key\n queue_name.is_a?(Proc) ? default_queue_key : queue_name.to_sym\n end", "def build_queue(queue_name)\n QC::Queue.new(queue_name)\n end", "def url\n if @uploader.upyun_bucket_domain\n \"http://\" + @uploader.upyun_bucket_domain + '/' + @path\n else\n nil\n end\n end", "def waiting_queue_name\n @waiting_queue_name\n end", "def init_urls\n Hash[@@client.list_queues.queue_urls.map { |u| [u[(u.rindex(\"/\") + 1)..-1], u] }]\n end", "def default_queue\n @queues[nil]\n end", "def setup_queue\n queue = Queue.find self.queue_name\n unless queue\n queue = Queue.create _id: self.queue_name\n end\n end", "def get_queued_links()\n\t\thydra.queued_requests.map do |req|\n\t\t\treq.url\n\t\tend\n\tend", "def instance_queue\n @instance_queue ||= sqs.queue(instance_id)\n return @instance_queue\n end", "def job_queue_name\n 'email'\n end", "def job_queue_name\n 'email'\n end", "def queue\n @queue.pending\n end", "def queue(*args)\n @queue = args.first unless args.empty?\n (@queue || :default).to_s\n end", "def queue_config\n Backburner.configuration\n end", "def queue() = @queue ||= CommandQueue.new", "def queue_key\n Digest::SHA256.hexdigest(queues.sort.join(\";\"))\n end", "def create_queue(queue_name, options = {})\n query = {}\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n uri = queue_uri(queue_name, query)\n\n headers = {}\n StorageService.add_metadata_to_headers(options[:metadata] || {}, headers) if options[:metadata]\n\n call(:put, uri, nil, headers, options)\n nil\n end", "def queue_name(name = nil)\n name || self.class.to_s.gsub('Consumer', '')\n end", "def queued(options={})\n url_params = options.empty? ? '' : \"?locator=#{locator(options)}\"\n response = get(\"buildQueue#{url_params}\")\n response['build']\n end", "def action(queue_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n -f #{[Conn[:host_api], 'queues', Conn[:vhost], queue_name].join('/')} | jq '.messages_ready'`\n end", "def getQueueBy_id( queue_id)\n params = Hash.new\n params['queue_id'] = queue_id\n return doCurl(\"get\",\"/queue/by_id\",params)\n end", "def queue(queue_name, &block)\n q = create_queue(queue_name)\n block.call(q) if block\n q\n end", "def uri\n @uri ||= File.join(self.class.base_uri, channel)\n end", "def queue\n @queue ||= []\n end", "def queue(queue)\n @configuration.queue = queue\n end", "def setup_queue\n Thread.current[:carrot] = Carrot.new(:host=>'mediashelf1.dtic.dk')\n @q = Carrot.queue(@queue_name)\n end", "def request_queue_name(name)\n \"fluffle.requests.#{name}\"\n end", "def url\n connection.build_url(url_chunk, params).to_s\n end", "def queue_key\n result = queue_name\n result = try(:arguments).presence && result.call if result.is_a?(Proc)\n result&.to_sym\n end", "def url\n Blobs::URI.blob(container.name, name)\n end", "def create_queues\n queue\n exchange\n end", "def queue(options={})\n# puts 'in queue'\n set_auto_attributes\n upload_if_needed\n\n response = SimpleWorker.service.queue(self.class.name, sw_get_data, options)\n# puts 'queue response=' + response.inspect\n# @task_set_id = response[\"task_set_id\"]\n @task_id = response[\"task_id\"]\n response\n end", "def mock_queue(name=nil)\n MockQueue.new(name || \"anonymous-#{rand(2**32).to_s(16)}\")\n end", "def to_s\n \"/jsonStatsApi.do?queues=#{@queues.join('%7C')}\"\n end", "def job_class\n SingleInstanceQueueJob\n end", "def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end", "def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end", "def queue_key\n super || default_queue_key\n end", "def mturk_url\n MTurkUtils.get_task_url self\n end", "def url\n unless new_record?\n Engine.routes.url_helpers.quickie_url(self, :host => Kublog.default_url_options[:host])\n end\n end", "def url\n easy = EasyFactory.new(self).get\n url = easy.url\n Typhoeus::Pool.release(easy)\n url\n end", "def _q\n @queue||=[]\n end", "def queue(queue, klass, **options)\n check_exists\n SideJob.queue(queue, klass, options.merge({parent: self, by: \"job:#{id}\"}))\n end", "def delete_queue(queue_url)\n request({\n 'Action' => 'DeleteQueue',\n :parser => Fog::Parsers::AWS::SQS::Basic.new,\n :path => path_from_queue_url(queue_url),\n })\n end", "def queue(_); end", "def queue(_); end", "def queue(blog_name, options = {})\n validate_options([:limit, :offset], options)\n get(blog_path(blog_name, 'posts/queue'), options)\n end", "def enqueue_url(url)\n if http_url = HttpUrl.parse(url)\n return false if has_file?(http_url.to_filename) \n url = http_url.to_s\n raise \"FATAL: invalid URL\" if url =~ /[\\n\\r]/\n queue_no = select_queue(url)\n fh = (@next_queue_files[queue_no] ||= File.open(File.join(@next_queue_dir, queue_no.to_s), 'a+'))\n fh.puts url\n true\n else\n false\n end\n end", "def messages_queue\n $messages_queue ||= client.queue(\"messages\", :durable => true, :auto_delete => false)\nend", "def to_id\n queue.to_id + '_' + ppg\n end", "def queue_job; end" ]
[ "0.8356241", "0.7993868", "0.78340125", "0.7714697", "0.7523829", "0.7433941", "0.6970222", "0.6856534", "0.68550134", "0.6828697", "0.6806844", "0.68064815", "0.6769797", "0.6768849", "0.6765052", "0.67594606", "0.6718448", "0.66820514", "0.66189307", "0.6608374", "0.6574295", "0.65610623", "0.6547704", "0.6537122", "0.6507018", "0.64827836", "0.6424986", "0.638915", "0.63776237", "0.63144296", "0.62828034", "0.6274268", "0.6271115", "0.6266281", "0.6239945", "0.6229833", "0.62166137", "0.6170452", "0.6156549", "0.61284786", "0.61063814", "0.610096", "0.610096", "0.60983515", "0.60686487", "0.60686356", "0.6056738", "0.6038642", "0.60293275", "0.60117257", "0.6011101", "0.5967617", "0.5964461", "0.5960532", "0.59453464", "0.5927518", "0.59242266", "0.59015316", "0.5900792", "0.5900792", "0.58911586", "0.58851963", "0.584708", "0.58354765", "0.580921", "0.57648903", "0.5761085", "0.57470155", "0.5746579", "0.574481", "0.57304126", "0.5706622", "0.5705474", "0.5688519", "0.5684772", "0.5682116", "0.5679362", "0.5677156", "0.5654608", "0.56512386", "0.5647412", "0.56434506", "0.5639428", "0.5638474", "0.5637639", "0.5637639", "0.56302583", "0.5621013", "0.56204766", "0.5614921", "0.55961525", "0.5582692", "0.5576568", "0.55708086", "0.55708086", "0.5555984", "0.55525595", "0.5505281", "0.550248", "0.54957104" ]
0.7745954
3
Submitted by Tamiko Terada METHOD to change a string into a float or integer
def numberfy(input_string) if input_string.include?(".") input_string.to_f else input_string.to_i end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _floatify(str, increment = true)\n if (( inf = str.to_s.match(/^([+-])?inf/i) ))\n (inf[1] == \"-\" ? -1.0 : 1.0) / 0.0\n elsif (( number = str.to_s.match(/^\\((-?\\d+)/i) ))\n number[1].to_i + (increment ? 1 : -1)\n else\n Float str.to_s\n end\n rescue ArgumentError\n raise Redis::CommandError, \"ERR value is not a valid float\"\n end", "def convert_float(str)\n return nil if !str\n str.gsub! /[^0-9.]/, \"\"\n neg = str.match /\\((.*?)\\)/\n float = str.to_f\n neg ? -float : float\n end", "def to_float_or_int str\n Integer(str) rescue Float(str) rescue nil\n end", "def string_to_number(string)\n string.to_f\nend", "def convert_i_f(value)\n if (value =~ /\\./)\n value = value.to_f\n elsif\n value = value.to_i\n end\n return value\nend", "def to_float(string)\n string.to_f\n rescue\n 0.0\n end", "def convert_string_to_number(str); end", "def float_or_interger(str)\n if str.include?\".\"\n num =str.to_f\n else\n num = str.to_i\n end\n return num\nend", "def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend", "def string_to_number(string)\n case string\n when /^\\d+$/\n string.to_i\n when /^\\d+.\\d$/\n string.to_f\n else \n string\n end\n end", "def string_to_number(string)\n case string\n when /^\\d+$/\n string.to_i\n when /^\\d+.\\d$/\n string.to_f\n else\n string\n end\n end", "def str_to_number(s)\r\n\t\tval_str = s.to_s()\r\n\t\tif INT_REGEX.match(val_str)\r\n\t\t\treturn val_str.to_i()\r\n\t\telsif FLOAT_REGEX.match(val_str)\r\n\t\t\treturn val_str.to_f()\r\n\t\telse\r\n\t\t\traise ArgumentError, \"can't understand numeric format '#{s}'\"\r\n\t\tend\r\n\tend", "def atof(string_float)\n sum = 0\n float_sum = 0\n decimal_split = string_float.split('.')\n if (decimal_split[0] != nil)\n sum = atoi(decimal_split[0])\n end\n\n if (decimal_split[1] != nil)\n decimal_split[1].each_byte.reverse_each do |char|\n float_sum = (float_sum * 0.1) + ((char - ZERO_ASCII_CODE)*0.1)\n end\n end\n\n return sum + float_sum\nend", "def cast_to_num(str)\n Integer(str)\n rescue ArgumentError\n Float(str)\n rescue ArgumentError\n nil\n end", "def parse_number(string)\n if string.include? \".\"\n string.to_f\n elsif string.include? \"E\"\n Complex(string).to_f\n else\n string.to_i\n end\n end", "def integer_or_float(x)\n if x.include?(\".\")\n return x.to_f\n else\n return x.to_i\n end\nend", "def atof(s)\n sep = s.split('.')\n\n integer = atoi(sep[0]) # convert integer to int\n mantissa = atoi(sep[1]) # convert mantissa to int\n neg = false\n\n # Remember if float is negative\n if integer < 0 \n neg = true\n integer = integer.abs\n end\n\n mantissaLength = sep[1].length\n place = 10.0 ** mantissaLength\n\n sum = integer / 1.0 # convert integer to float\n\n # Add the mantissa to the integer\n for i in 0..mantissaLength-1\n tmp = (mantissa % 10)/place\n sum += tmp\n place /= 10.0\n mantissa /= 10\n end\n\n sum = neg ? -sum : sum # Make number negative if necessary\n\n # Fix funky float operations\n return (sum*(10**mantissaLength)).round / (10.0 ** mantissaLength)\nend", "def to_a str\n str.split(' ').map{|v| Float(v) rescue v}\nend", "def to_float_or_int(v)\n v.match('\\.').nil? ? Integer(v) : Float(v)\n end", "def str_to_val(s)\n case s\n when /^\\d+$/ then s.to_i\n when /^\\d+\\.\\d*/ then s.to_f\n when /^true$/ then true\n when /^false$/ then false\n else s\n end\nend", "def to_stringified_float(int)\r\n # your code goes here\r\n # use of methods\r\n\r\n int.to_f.to_s\r\nend", "def parse(string)\n string = string.tr(\",\", \".\").delete(\"~\")\n if (match = string.match(/^(\\d*\\.?\\d*)$/))\n match[1].to_f\n elsif (match = string.match(/^(\\d*\\.?\\d*)%$/))\n match[1].to_f / 100\n elsif (match = string.match(/^(\\d*\\.?\\d*)[:\\/](\\d*\\.?\\d*)$/))\n match[1].to_f / match[2].to_f\n elsif (match = string.match(/^(.+)\\=(.+)$/))\n match[1].strip.to_l / match[2].strip.to_l\n end\n rescue ArgumentError\n # to_l raises when string isn't a valid length.\n nil\n end", "def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend", "def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend", "def number\n number = number.to_s\n if number.includes?('.')\n number = number.to_f\n else\n number = number.to_i\n end\nend", "def to_non_shorthand(value_string)\n return_float = 0\n if !value_string.nil? && value_string != \"N/A\"\n if value_string.include?(\"B\")\n return_float = value_string.delete(\"B\").to_f * 1000000000\n elsif value_string.include?(\"M\")\n return_float = value_string.delete(\"M\").to_f * 1000000\n elsif value_string.include?(\"K\")\n return_float = value_string.delete(\"K\").to_f * 1000000\n end\n end\n return_float\n end", "def parse(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\nend", "def to_float(value)\n return value.to_f if value.is_a?(Numeric)\n value = value.to_s if value.is_a?(Symbol)\n value.to_f if value.is_a?(String) && value.match?(NUMBER_PATTERN)\n end", "def __s2f(other)\n return other if other.is_a? Numeric\n if /^0[Xx][0-9a-fA-F]+$/ =~ other\n other.to_i(0).to_f\n else\n other.to_f\n end\n end", "def convert_string_to_number(str)\n matches = RE_NUMBER_STR.match(str)\n\n s = matches[:sign] == '-' ? -1 : 1\n i = matches[:integer].to_i\n f = matches[:fractional].to_i\n d = matches[:fractional] ? matches[:fractional].length : 0\n t = matches[:exponent_sign] == '-' ? -1 : 1\n e = matches[:exponent].to_i\n\n # I know this formula looks nutty, but it's exactly what's defined in the\n # spec, and it works.\n value = s * (i + f * 10**-d) * 10**(t * e)\n\n # Maximum and minimum values aren't defined in the spec, but are enforced\n # here for sanity.\n if value > Float::MAX\n value = Float::MAX\n elsif value < -Float::MAX\n value = -Float::MAX\n end\n\n value\n end", "def frac_to_float(str)\n numerator, denominator = str.split(\"/\").map(&:to_f)\n denominator ||= 1\n numerator/denominator\n end", "def parse_string string\n string.split(separator).map(&:to_f)\n end", "def convert_string_to_number(str)\n matches = RE_NUMBER_STR.match(str)\n\n s = matches[:sign] == '-' ? -1 : 1\n i = matches[:integer].to_i\n f = matches[:fractional].to_i\n d = matches[:fractional] ? matches[:fractional].length : 0\n t = matches[:exponent_sign] == '-' ? -1 : 1\n e = matches[:exponent].to_i\n\n # I know this looks nutty, but it's exactly what's defined in the spec,\n # and it works.\n s * (i + f * 10**-d) * 10**(t * e)\n end", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def set(value)\n return nil if value.blank?\n begin\n value.to_s =~ /\\./ ? Float(value) : Integer(value)\n rescue\n value\n end\n end", "def get_float(node)\n node.content.squish.gsub(/[^\\d\\.]+/, '').to_f if node.present? && node.content.present?\n end", "def to_stringified_float(int)\n # your code goes here\n return (int.to_f).to_s\nend", "def get_float\n gets.chomp.to_f\nend", "def test_parse_float_string\n assert_equal 0.0, parse_float_string(\"\\x00\\x00\\x00\\x80\")\n assert_equal -100.0, parse_float_string(\"\\x00\\x00\\xc8\\xc2\").round(2)\n assert_equal -122.44, parse_float_string(\"\\x48\\xe1\\xf4\\xc2\").round(2)\n end", "def is_number? string\n true if Float(string) rescue false\nend", "def xml2value(content_string) Float(content_string.strip) end", "def float_or_nil(str)\n return nil if IGNORE_LIST.include?(str)\n return nil if str == -1\n Float(str || '')\n rescue ArgumentError\n nil\n end", "def convert_to_test_value value, data_type\n if data_type == \"float\"\n test_value = (value.to_f * 1000).to_i\n else\n test_value = value.to_i\n end\n test_value\nend", "def parse_number(num)\n if num.is_float?\n num.to_f\n else\n num.to_i\n end\n end", "def string_to_number(s)\n s.to_i\nend", "def string_to_number(s)\n s.to_i\nend", "def parse_float(value)\n Float(value.to_s.gsub(',','.'))\n rescue ArgumentError\n nil\n end", "def numeric(object)\n object.to_s =~ /(^[-+]?[0-9]+$)|(\\.0+)$/ ? object.to_i : Float(object)\n end", "def float_format(string)\n custom = split_float string\n output_array = add_commas custom[:integer_part]\n output_array.join + \".\" + custom[:decimal_part]\nend", "def string_to_number(string)\n string.to_i\nend", "def format_to_float(str)\n return str.to_f if !str.include?(\":\")\n \n array = str.split(\":\").reverse!\n total = 0.0\n array.each_with_index do |x, i|\n if i == 0\n total += x.to_f\n else\n total += (x.to_f * (60 ** i))\n end\n end\n \n total\n end", "def modify(cost)\n answer = ''\n if cost == cost.to_f || cost == cost.to_i\n return cost\n else \n cost = cost.to_s\n arr = cost.split('.')\n arr[0].each_char do |c|\n if isNum?(c) \n answer += c.to_s\n end\n end\n end\n return answer.to_i + arr[1].to_i.round(2)* 0.01\nend", "def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend", "def _f(str)\n _n(str).gsub(/([\\d]+\\.?)(.*)/, '\\2')\n end", "def convert(num)\n return num = num * 0.453592\nend", "def typecast_to_numeric(value, method)\n if value.is_a?(String)\n value = value.strip.gsub(/,/, '.').gsub(/[^\\d\\-\\.]/, '').gsub(/\\.(?!\\d*\\Z)/, '')\n value.empty? ? nil : value.send(method)\n elsif value.respond_to?(method)\n value.send(method)\n else\n nil\n end\n end", "def parse_value value\r\n case value\r\n when /\\d+/\r\n value.to_f\r\n else\r\n value\r\n end\r\n end", "def convert(value, type)\n begin\n case type\n when 'json' then JSON.parse(value)\n when 'base64' then JSON.parse(Base64.decode64(value))\n when 'integer' then Integer(value)\n when 'number' then Float(value)\n else\n value.to_s\n end\n rescue ArgumentError\n value.to_s\n end\n end", "def convert_to_euros_1(dollars)\n dollars * 0.95 if dollars.is_a?(Numeric)\nend", "def convert_number_string_to_integer(number_string)\n Integer(number_string.gsub(\" \", \"\"))\nend", "def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 11 )\n\n end", "def convertToNum(price)\n \treturn Float(price.gsub(/\\s+/, \"\").gsub(\"USD \",\"\"))\n end", "def entero_pelado(num)\n if num.is_a? String\n num.replace(',', '') if num.include? ','\n num = num.to_f if num.include? '.'\n end\n num.to_i\nend", "def string_to_value(string)\n case string\n when '1p'\n 1\n when '2p'\n 2\n when '5p'\n 5\n when '10p'\n 10\n when '20p'\n 20\n when '50p'\n 50\n when '£1'\n 100\n when '£2'\n 200\n end\n end", "def is_number?(string)\n # catch and return false if it isn't an integer\n true if Float(string) rescue false \nend", "def int_or_float(num)\n return num.include?(\".\") ? num.to_f : num.to_i\nend", "def to_stringified_float(int)\n x = int.to_f\n return puts x.to_s\n # your code goes here\nend", "def jeff_parse_float(val)\n if val.nil?\n Float(0)\n else\n val.to_s.gsub(\",\", \"\").to_f\n end\n end", "def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end", "def convert_float( text_value )\r\n (!text_value.empty?) ? text_value.to_f : 0.0\r\nend", "def float?(str)\n true if Float(str) rescue false\n end", "def is_float?(input)\n input.to_f.to_s == input\nend", "def atoi(s)\n offset = '0'.ord\n neg = false\n sum = 0\n\n begin\n s.each_byte do |i|\n if i == 45 # the number is negative\n neg = true\n next\n elsif i == 46 # Number is a float, disregard mantissa\n break \n elsif (i < 48 || i > 57) # Not a valid number\n raise InvalidNumberException, \"Error: Invalid Number\"\n end\n\n # Get value of char as int and add to current sum\n tmp = i - offset\n sum = (sum * 10) + tmp\n end \n\n # Make number negative if it was originally negative\n return neg ? -sum : sum\n\n rescue InvalidNumberException => e\n abort(e.message) # inform user about error\n end\nend", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def convert_strings_to_floats(user_id)\n float_array = []\n strip_usd_from_the_strings(user_id).each do |fare|\n float_array << fare.to_f\n end\n float_array\nend", "def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :double_string_lit\n @value.to_f\n else\n self.to_i.to_f\n end\n end", "def read_float(str, n)\n float_ptn = /[+-]?\\d*\\.?\\d+/;\n i = 0;\n val = [0];\n while((str =~ float_ptn) && (i < n))\n i += 1;\n val << $&.to_f;\n str = $'\n end\n raise \"Not enough float numbers in the string.\" if(i < n);\n val[0] = i;\n return val;\nend", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def strip_to_int(input)\n return input unless input.present?\n return input if input[/[\\d.,]+/].nil?\n\n input[/[\\d.,]+/].gsub(',','.').to_i if input.present?\n end", "def check_value(text)\n\n #this method recieves a string representing a payment value in the format 19,470.99\n #Then it takes off the comma (\",\") and parse it to float format as 19470.99\n begin\n return text.gsub(\",\",\"\").to_f\n rescue\n return nil\n end\n\n end", "def hex_to_float(txt)\n # Numerals::Format[:hexbin].read(txt, type: Float)\n # txt.scanf(\"%A\").first\n Float(txt)\nend", "def typecast_value_float(value)\n Float(value)\n end", "def type_cast(v)\n ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v\n end", "def float\n Util.from_bytes :float, value\n end", "def parse_value(string)\n string = string.strip\n if string =~ /^\\d+\\.\\d+$/\n string.to_f\n elsif string =~ /^\\d+$/\n string.to_i\n elsif string.encap_by?('\"')\n string.uncapsulate('\"', limit: 1).gsub('\\\\\"', '\"')\n elsif string.encap_by?(\"'\")\n string.uncapsulate(\"'\", limit: 1).gsub(\"\\\\'\", \"'\")\n elsif string =~ /^\\/.*\\/[mix]?+$/\n string.to_regex\n elsif string =~ /^true$/i\n true\n elsif string =~ /^false$/i\n false\n elsif string =~ /^(null|nil)$/i\n nil\n elsif string =~ /^\\(?\\d+(\\.\\d+)?\\.{2,3}\\d+(\\.\\d+)?\\)?$/\n Range.new(*[string.split(/\\.+/, 2).map(&:to_i), string =~ /\\.{3}/].flatten)\n elsif string =~ /^\\[.*\\]$/\n string.uncapsulate('[', limit: 1).qsplit(',').map { |value| parse_value(value) }\n else\n string\n end\n end", "def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend", "def convert_to_numeric(val)\n return BigDecimal(val, Float::DIG) if val.is_a?(Float)\n return val if val.is_a?(Numeric)\n # Eliminate any commas, $'s (or other currency symbol), or _'s.\n cursym = Regexp.quote(FatTable.currency_symbol)\n clean_re = /[,_#{cursym}]/\n val = val.to_s.clean.gsub(clean_re, '')\n return nil if val.blank?\n case val\n when /(\\A[-+]?\\d+\\.\\d*\\z)|(\\A[-+]?\\d*\\.\\d+\\z)/\n BigDecimal(val.to_s.clean)\n when /\\A[-+]?[\\d]+\\z/\n val.to_i\n when %r{\\A([-+]?\\d+)\\s*[:/]\\s*([-+]?\\d+)\\z}\n Rational($1, $2)\n end\n end", "def strip_to_int(input)\n return input unless input.present?\n return input if input[/[\\d.,]+/].nil?\n\n input[/[\\d.,]+/].gsub(',','.').to_i if input.present?\n end", "def numberfy(string)\n message = string.downcase.split(//)\n message.each do |char|\n (ALPHA.include? char) ? number = ALPHA_HASH[char] : number = char\n @numeric_message << number\n end\n end", "def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def numericize\n\t\tcollect(&:to_f)\n\tend", "def decimal_pelado(num)\n num.sub! ',', '' if num.is_a?(String) && num.include?(',')\n num.to_f\nend", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend", "def no_float(str)\n\t(str.to_f) == 0\ntotal_cents = ((str).to_f * 100).to_i\nend", "def is_number?(str)\n true if Float(str) rescue false\n end", "def string_to_integer(string)\nend", "def convert_value(value_node)\n if value_node.nil?\n return\n end\n if value_node['type'] == 'REAL' || value_node['value'].include?('.')\n return value_node['value'].to_f\n else\n return value_node['value'].to_i\n end\n end" ]
[ "0.7880569", "0.76887447", "0.7662379", "0.74015605", "0.7341799", "0.7297155", "0.7295221", "0.72076696", "0.71883386", "0.71503234", "0.7052117", "0.7029434", "0.7016831", "0.69424295", "0.6936431", "0.6873007", "0.682689", "0.6819563", "0.6817027", "0.681161", "0.6742396", "0.6718844", "0.6702483", "0.666457", "0.66400605", "0.66228664", "0.6614529", "0.6613549", "0.6609935", "0.66098195", "0.66010535", "0.6571501", "0.65647197", "0.6556578", "0.65446687", "0.6508467", "0.64914405", "0.64909965", "0.6490513", "0.6480617", "0.64395875", "0.64119714", "0.6410402", "0.64028066", "0.6382321", "0.6382321", "0.63777655", "0.6360824", "0.63423", "0.63321674", "0.6322334", "0.63183355", "0.6307255", "0.6305224", "0.6298036", "0.62683266", "0.62566924", "0.62522453", "0.6251656", "0.62465626", "0.62405837", "0.62377745", "0.62374574", "0.62357175", "0.6227457", "0.6222255", "0.6220982", "0.62196136", "0.62196046", "0.621616", "0.6202176", "0.6194713", "0.6193972", "0.6190626", "0.61898094", "0.61824375", "0.618054", "0.61731523", "0.61731523", "0.61485267", "0.6138816", "0.61383057", "0.61349237", "0.61326456", "0.61319524", "0.6131574", "0.6130352", "0.61219114", "0.61218727", "0.6116219", "0.61118144", "0.61084354", "0.61084193", "0.60937446", "0.60827", "0.6078189", "0.60715866", "0.60690963", "0.6065458", "0.60635775" ]
0.7362033
4
METHOD to validate user operator
def valid_operator(user_operator) possible_operators = [ "add", "+", "subtract", "-", "multiply", "x", "*", "divide", "/" ] possible_operators.include?(user_operator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_operator\n if device_limit.to_i < 0\n errors.add(:device_limit, 'Device limit count is invalid')\n return\n end\n if event_limit.to_i < 0\n errors.add(:event_limit, 'Event limit count is invalid')\n return\n end\n if discount.to_i < 0 or discount.to_i > 100\n errors.add(:discount, 'Discount is invalid')\n return\n end\n end", "def valid_input\n if !@operand_one or !@operand_two or !RomanMathmaticalOperation.is_roman(@operand_one) or !RomanMathmaticalOperation.is_roman(@operand_two)\n raise RomanMathmaticalOperationError, \"This #{@operand_one} or #{@operand_two} is not valid\"\n end\n\n unless OPERATORS.include?(@operator)\n raise RomanMathmaticalOperationError, \"Operator missmatch\"\n end\n end", "def validate_operator_conforms(operator, field, errors)\n errors << \"Dataset operator conformity validation failed for operator: #{operator} against field: #{field}\" unless operator_conforms?(operator, field)\n errors\n end", "def is_operator char\n\t\t@@allowed_operator.include? char\n\tend", "def valid_find_operator\n\t\toperator = ' OR '\n\t\tif params[:operator] and !params[:operator].blank? and \n\t\t\t\t['AND','OR'].include?(params[:operator])\n\t\t\toperator = \" #{params[:operator]} \"\n\t\tend\n\t\toperator\n\tend", "def validate_value value\n allowed_chars = [:+, :-, :*, :/, :^]\n raise ArgumentError, \"Operator must be +, -, *, /\" unless allowed_chars.include? value.to_sym\n true\n end", "def validate_operation\n ops = [\"add\", \"sub\", \"mult\", \"div\", \"exp\", \"sqrt\"]\n if ops.include?(@operation) == false\n puts \" \"\n puts \"Please put in a valid operation\"\n puts \" \"\n get_operation\n end\nend", "def operator?\n admin? or group_name == 'operator'\n end", "def operator; end", "def operator_params\n params.require(:operator).permit(:first_name, :last_name, :company_email, :password)\n end", "def is_operator?(x)\n #x.size == 1 && ( x == '+' || x == '-' || x == '*' || x =='/')\n x =~ /^[\\+\\-\\*\\/]$/\nend", "def operator?\n @operator || false\n end", "def validate(p)\n if is_operator(p)\n args_list(p).each { |operator_or_filter| validate(operator_or_filter)}\n elsif ! is_value_filter(p) and !is_key_filter(p)\n raise Exception(\"Not a valid operator or filter - #{p}\")\n end\n end", "def input_checker(f)\n if f == \"addition\" || f == \"+\" || f == \"subtraction\" || f == \"-\" || f == \"multiplication\" || f == \"*\" || f == \"division\" || f == \"/\" || f == \"exponent\" || f == \"^\" || f == \"square\" || f == \"square root\"\n return f\n else\n abort(\"try again, that's not an operator\")\n end\nend", "def validate\n # @expression && [email protected]?\n if !@expression || @expression.blank?\n return\n elsif !Calculator.valid?(@expression)\n @expression = nil\n @mode = :invalid\n end\n end", "def operator_validator(line)\n operators = ['+', '-', '>', '<', '!', '*', '=']\n ret_arr = []\n operators.each do |n|\n arr = line.chars\n counter = 0\n while counter < arr.length\n if arr[counter] == n\n if operators.include?(arr[counter - 1]) && n == '='\n counter += 1\n next\n end\n dummy_arr = []\n if arr[counter + 1] == '='\n dummy_arr << (arr[counter] + '=')\n dummy_arr << (arr[counter - 1] == ' ' ? -1 : counter - 1)\n dummy_arr << (arr[counter + 2] == ' ' ? -1 : counter + 2)\n counter += 2\n else\n dummy_arr << (arr[counter])\n dummy_arr << (arr[counter - 1] == ' ' ? -1 : counter - 1)\n dummy_arr << (arr[counter + 1] == ' ' ? -1 : counter + 1)\n counter += 1\n end\n ret_arr << dummy_arr\n else\n counter += 1\n end\n end\n end\n ret_arr\n end", "def check_operators(token, evaluation, line, file_read, ops)\n op1 = ops[0]\n op2 = ops[1]\n unless ['-', '+', '/', '*'].include?(token) && !(token == '/' && op2.to_i.zero?)\n puts \"Line #{line}: Could not evaluate expression\"\n error_eval(5, line, nil, file_read)\n return false\n end\n evaluation.push(op1.to_i.send(token.to_sym, op2.to_i))\n end", "def operator_conforms?(operator, field)\n true\n end", "def operator_function \n puts \"What is the operator? +, -, /, *?\"\n @operator = gets.strip \n operator_case_test\nend", "def valid_operation(user_input)\n user_input.downcase!\n \n case user_input\n when \"add\", \"+\"\n puts \"\\n*** ADDING ***\"\n add(*get_numbers)\n when \"subtract\", \"-\"\n puts \"\\n*** SUBTRACTING ***\"\n subtract(*get_numbers)\n when \"multiply\", \"*\"\n puts \"\\n*** MULTIPLYING ***\"\n multiply(*get_numbers)\n when \"divide\", \"/\"\n puts \"\\n*** DIVIDING ***\"\n divide(*get_numbers)\n else\n puts \"\\nERROR, please enter one operator(name or symbol)\"\n print \"=> \"\n valid_operation(gets.chomp)\n end\n \nend", "def check_operation x, num1, num2\n case x\n when \"+\" then num1 + num2\n when \"-\" then num1 - num2\n when \"*\" then num1 * num2\n when \"/\" then num1 / num2\n when \"exp\" then num1 ** num2\n when \"sqrt\" then Math.sqrt num1\n else \"Invalid operation choosen\"\n end\nend", "def show\n authorize @operator\n end", "def operator_params\n params.require(:operator).permit(\n :first_name,\n :last_name,\n :employee_number,\n :badge,\n :suspended,\n :site_id\n )\n end", "def operator?(str)\n if str == \"+\" || str == \"-\" || str == \"*\" || str == \"/\" || str == \"%\" || str == \"^\"\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n end", "def test_valid_input\n assert_equal(nil, RomanMathmaticalOperation.new(\"X\", \"+\",\"V\").send(:valid_input))\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"+\",nil).send(:valid_input)}\n assert_equal(\"This X or is not valid\", exception.message)\n exception = assert_raise(\"RomanMathmaticalOperationError\") {RomanMathmaticalOperation.new(\"X\", \"%\",\"V\").send(:valid_input)}\n assert_equal(\"Operator missmatch\", exception.message)\n end", "def operator\n return @operator\n end", "def operator\n return @operator\n end", "def operator\n return @operator\n end", "def valid_operation?(operator, operands)\n unless operands.size == 2 && operands.all?(&:numeric?)\n raise InputError, \"Must have at least two numeric values in the stack to perform an operation.\"\n end\n if operator.division? && operands.last.to_f.zero?\n raise InputError, \"Cannot divide by zero.\"\n end\n\n true\n end", "def operator_case_test \n case @operator \n when \"+\"\n puts \"accepted\"\n second_number_function \n when \"-\"\n puts \"accepted\"\n second_number_function\n when \"/\"\n puts \"accepted\"\n second_number_function \n when \"*\" \n puts \"accepted\"\n second_number_function \n else puts \"Operator not recognized.\"\n operator_function \n end \nend", "def check_op (oper)\n if oper == 'add' || oper == '+'\n puts \"+ + Let's add 'em up! + +\"\n return operator = '+'\n elsif oper == 'subtract' || oper == '-'\n puts \"- - Let's subtract! - -\"\n return operator = '-'\n elsif oper == 'multiply' || oper == '*'\n puts \"* * It's time to multiply! * *\"\n return operator = '*'\n elsif oper == 'divide' || oper == '/'\n puts \"/ / Let's divide 'em up! / /\"\n return operator = '/'\n elsif oper == 'exponent' || oper == '**'\n puts \"^ ^ Let's power 'em up! ^ ^\"\n return operator = '**'\n elsif oper == 'remainder' || oper == '%'\n puts \"% % Let's find the remainder! % %\"\n return operator = '%'\n end\nend", "def set_Operator(value)\n set_input(\"Operator\", value)\n end", "def set_Operator(value)\n set_input(\"Operator\", value)\n end", "def input_operator()\n\twhile true\n\t\tputs \"What do you want to do?\"\n\t\tputs \"+ -> add\"\n\t\tputs \"- -> subtract\"\n\t\tputs \"* -> multiply\"\n\t\tputs \"/ -> divide\"\n\t\t\n\t\top = gets.strip\n\t\tcase op\n\t\twhen \"+\"\n\t\t\treturn \"+\"\n\t\twhen \"-\"\n\t\t\treturn \"-\"\n\t\twhen \"/\"\n\t\t\treturn \"/\"\n\t\twhen \"*\"\n\t\t\treturn \"*\"\n\t\telse\n\t\t\tputs \"Please enter only + - * or /\"\n\t\tend\n\tend\nend", "def operator?(str)\n return ['+', '-', '*', '/', '%', '^'].include?(str)\n end", "def validate\n return HESResponder(\"Field and value required.\", \"ERROR\") unless params[:field] && params[:value]\n fs = ['email','username', 'altid']\n f = params[:field]\n if !fs.include?(f)\n return HESResponder(\"Can't check this field.\", \"ERROR\")\n end\n f = f.to_sym\n v = params[:value]\n if @promotion.users.where(\"LOWER(#{f}) = ?\", v.downcase).count > 0\n return HESResponder(f.to_s.titleize + \" is not unique within promotion.\", \"ERROR\")\n else\n return HESResponder()\n end\n end", "def operation_check(op)\n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\",\"exponent\",\"**\",\"modulo\",\"%\"]\n until valid_operations.include?(op)\n puts \"Please enter a valid input, refer to the list above:\"\n op = gets.chomp\n end\n return op\nend", "def process_operator_token(token, operand_a, operand_b)\n if token == '+'\n operand_a + operand_b\n elsif token == '-'\n operand_a - operand_b\n elsif token == '*'\n operand_a * operand_b\n elsif token == '/'\n raise 'Tried to divide by zero!' if operand_b == 0\n\n operand_a / operand_b\n else\n raise \"Invalid Operator: #{token}\"\n end\nend", "def validate_answer(answer)\n end", "def operator\n self.class.operator\n end", "def operator\n case @matches[2]\n when \"plus\" then :+\n when \"minus\" then :-\n when \"divided by\" then :/\n when \"multiplied by\" then :*\n end\n end", "def literal_validation; end", "def literal_validation; end", "def operator!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n\n type = OPERATOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line \n if @input.peek(1).between?(?*, ?+) || @input.peek(1) == ?- || @input.peek(1) == ?/\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 1)\n\n end", "def expression_operator()\n\n\n\n # \n if (TOKENS[look_ahead(1)] >= 25 && TOKENS[look_ahead(1)] <= 26) || look_ahead(1) == :ECOMMERCIAL || look_ahead(1) == :EQUAL || (TOKENS[look_ahead(1)] >= 35 && TOKENS[look_ahead(1)] <= 46)\n match()\n else\n raise \"Expected set\"\n end\n\n\n\n end", "def validate_operations\n ops_by_program = group_ops_by_parameter(PROGRAM, operations)\n\n msg = nil\n\n if ops_by_program.length != 1\n programs = ops_by_program.keys.join(\", \")\n msg = \"Job contains Operations with more than one program (#{programs}).\"\n msg += \" Please replan.\"\n elsif operations.length > MAX_OPS\n msg = \"Max number of ops is #{MAX_OPS} for a single Job.\"\n msg += \" You have #{operations.length} ops. Please replan.\"\n elsif ops_by_program.keys.first == \"lib_qPCR2\" && operations.length > 12\n msg = \"lib_qPCR2 program is limited to 12 reactions.\"\n msg += \" You have #{operations.length} ops. Please replan.\"\n end\n\n if msg.present?\n operations.each do |op|\n op.error :job_failed_validation, msg\n end\n end\n\n ops_by_program.keys.first\n end", "def operator?(str)\n @operators.has_key? str\n end", "def operator_name\n compliance_data[:operator_name]\n end", "def valid?\n valid = [email protected]?\n if @operator == 'NOT'\n valid &&= @left.valid?\n else\n valid &&= @left.valid? && @right.valid?\n end\n valid\n end", "def parse_addop()\n\t\tif(next_TokenGrabbed(\"+\") or next_TokenGrabbed(\"-\"))\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def is_op(str)\n\t['+', '-', '^', '=', '<', '>'].include?(str)\nend", "def prescedence_of operator\n case operator\n when \"*\" then 2\n when \"/\" then 2\n when \"+\" then 1\n when \"-\" then 1\n when \"(\" then 0 \n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def operators\n [:is]\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def is_operator? token\n OPERATOR_MAP.keys.include?(token)\n end", "def operator?(item)\n return item.eql?(item.match(/[A-Z\\-<>(>=)(<=)(<=>)]+/m).to_s) ? true : false\n end", "def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend", "def valid?(_) true end", "def valid?(_) true end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def inputPrecedence(operator)\n if operator == \"+\" || operator == \"-\"\n\t\t\treturn 1\n\t\tend\n\n if operator == \"*\" || operator == \"/\" || operator == \"%\"\n\t\t\treturn 2\n\t\tend\n\n if operator == \"^\"\n\t\t\treturn 4\n\t\tend\n\n if operator == \"(\"\n\t\t\treturn 5\n\t\tend\n\n end", "def operator_params\n params.require(:operator).permit(:operator_name, :operator_spec_id, :description, :tenant_id)\n end", "def operator=(value)\n @operator = value\n end", "def operator=(value)\n @operator = value\n end", "def operator=(value)\n @operator = value\n end", "def validate_question params\n\n end", "def valid?(input)\n OPERATORS.include?(input) || numeric?(input)\n end", "def valid_user\n #puts \"VALID USER - USER DEVICE TOKENS #{@device_tokens} #{@first_name} #{@phone_number} #{@last_name} \"\n return (!@phone_number.nil? && !@phone_number.empty? && !@first_name.nil? && !@first_name.empty? && !@last_name.nil? && !@last_name.empty? && !@device_tokens.nil? && !@device_tokens.empty?)\n\n end", "def inputPrecedence(operator)\n if ['+', '-'].include? operator\n return 1\n elsif ['*', '/', '%'].include? operator\n return 2\n elsif '^'.eql? operator\n return 4\n else\n return 5\n end\n end", "def operator\n @operator ||= (name.split('::').last.chomp('Assay').downcase + '?').to_sym\n end", "def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1 + value2\n when '-'\n value1 - value2\n when '*'\n value1 * value2\n when '/'\n value1 / value2\n end\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validate_command\n if requester != player\n errors.add(:allowed, I18n.t(\"errors.not_authorized\"))\n end\n unless airlift?\n if game.actions_taken == 4\n errors.add(:allowed, I18n.t(\"player_actions.no_actions_left\"))\n end\n if proposal.turn_nr != game.turn_nr\n errors.add(:allowed, I18n.t(\"movement_proposals.expired\"))\n end\n if destination_is_not_a_neighbor? && another_player_is_not_at_destination?\n errors.add(:allowed, I18n.t(\"movement_proposals.not_allowed\"))\n end\n end\n end", "def oper(user, password)\n send_msg(\"OPER #{user} #{password}\")\n end", "def validation(parsed_array)\n if parsed_array.length > 3\n puts \"Sorry, this calculator can't handle operations that complex.\"\n # If the array length is greater than 3, the user likely entered more than one operator. Returns nil.\n elsif parsed_array.length < 3\n puts \"Hmm. It doesn't look like the operation you've entered is valid for this calculator.\"\n # If the array length is less than 3, the user likely didn't enter enough information,\n # or didn't enter it in a manner that the parser could handle. Returns nil.\n elsif (parsed_array[0] =~ /^[-+]?\\d+(\\.\\d+)?$/).nil? || (parsed_array[2] =~ /^[-+]?\\d+(\\.\\d+)?$/).nil?\n puts \"Hmm. It doesn't look like the operation you've entered is valid for this calculator.\"\n # This checks if the 1st and 3rd elements of the array match a regex that\n # permits an optional +/- sign at the start of string, digits 0-9, and optional digits 0-9 after the decimal point.\n # Returns nil.\n else\n return parsed_array\n # If none of the above applies, returns the parsed array unmodified.\n end\nend", "def validate!; end", "def validate!; end", "def validate!; end", "def match_operator(p, value)\n if p[0] == '!'\n @@operator_map[p[0]].call(_match(p[1], value))\n elsif p[0] == '^'\n @@operator_map[p[0]].call(_match(p[1][0], value), _match(p[1][1], value))\n else\n @@operator_map[p[0]].call(p[1].each {|operator_or_filter| _match(operator_or_filter, value)})\n end\n end", "def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end", "def validate\n \n \n end", "def validate!\n # Expression must be present.\n if expression.to_s.length == 0\n raise SkyDB::Query::ValidationError.new(\"Invalid expression for selection group: '#{expression.to_s}'\")\n end\n end", "def is_valid; end", "def validator; end", "def add_operator( operator )\r\n @operators << operator\r\n end", "def answer\n operators[@operator].call\n end", "def assert_privilege_parameters!(user_or_attribute, operation, object_or_attribute)\n unless user_or_attribute.is_a?(PM::User) || user_or_attribute.is_a?(PM::UserAttribute)\n raise(ArgumentError, \"user_attribute_pe must be a User or UserAttribute.\")\n end\n\n unless [PM::Operation, Symbol, String].any? { |allowed_type| operation.is_a?(allowed_type) }\n raise(ArgumentError, \"operation must be an Operation, Symbol, or String.\")\n end\n\n unless object_or_attribute.is_a?(PM::Object) || object_or_attribute.is_a?(PM::ObjectAttribute)\n raise(ArgumentError, \"object_or_attribute must either be an Object or ObjectAttribute.\")\n end\n end", "def operator_params\n params.require(:operator).permit(:operator_name, :operator_spec_id, :description, :is_active, :deleted_at, :tenant_id)\n end", "def request_operations_numbers(user_input, valid_operators)\n puts \"What operation would you like to perform?\"\n operation = gets.chomp\n if valid_operators.values.flatten.include?(operation)\n user_input[:operation] = operation\n else\n puts \"Whoa nelly! You don't make sense. You can add, subtract, multiply, or divide.\"\n exit\n end\n puts \"What's the first number you would like to use?\"\n num_1 = gets.chomp\n user_input[:num_1] = num_1\n\n puts \"What's the second number you would like to use?\"\n num_2 = gets.chomp\n user_input[:num_2] = num_2\nend", "def operator\n @operator ||= case [min, max]\n when [0, 0] then ''\n when [0, 1] then '?'\n when [1, Infinity] then '+'\n else\n [min, max].map {|n| n == 0 || n == Infinity ? '' : n.to_s }.join('*')\n end\n end", "def operator\n @operator ||= case [min, max]\n when [0, 0] then ''\n when [0, 1] then '?'\n when [1, Infinity] then '+'\n else\n [min, max].map {|n| n == 0 || n == Infinity ? '' : n.to_s }.join('*')\n end\n end", "def validate_access(operation, obj, *args)\n if @access_context.cannot?(\"#{operation}_with_token\".to_sym, obj)\n if obj.is_a? Class\n obj = obj.to_s\n end\n logger.info('allowy.access-denied.insufficient-scope', op: \"#{operation}_with_token\", obj: obj, user: user, roles: roles)\n raise CloudController::Errors::ApiError.new_from_details('InsufficientScope')\n end\n\n if @access_context.cannot?(operation, obj, *args)\n if obj.is_a? Class\n obj = obj.to_s\n end\n logger.info('allowy.access-denied.not-authorized', op: operation, obj: obj, user: user, roles: roles)\n raise CloudController::Errors::ApiError.new_from_details('NotAuthorized')\n end\n end", "def operators\n {\n \"+\" => -> {@num1 + @num2},\n \"-\" => -> {@num1 - @num2}\n }\n end", "def format_userinput_for_division(operator, valid_operators, num_1, num_2, user_input)\n if num_1 =~ /^(\\d)+$/ && num_2 =~ /^(\\d)+$/\n unless divide_by_zero(num_2.to_i)\n exit\n end\n modulo = (num_1.to_i % num_2.to_i)\n if modulo != 0\n result = (num_1.to_f / num_2.to_f)\n return result\n else\n format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n result = division(user_input[:num_1], user_input[:num_2])\n return result\n end\n else\n format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n result = division(user_input[:num_1], user_input[:num_2])\n return result\n end\nend", "def operator_node\n key_op_val? && @elements[1]\n end" ]
[ "0.71468246", "0.68399924", "0.6823085", "0.6731083", "0.65548277", "0.65451396", "0.65140384", "0.6379725", "0.6262707", "0.6242223", "0.6209113", "0.6187763", "0.61659664", "0.61523", "0.6121679", "0.60405684", "0.5977044", "0.5974359", "0.5951384", "0.5947278", "0.5944696", "0.58843815", "0.58751434", "0.58548206", "0.58398545", "0.5821055", "0.5821055", "0.5821055", "0.579731", "0.57970285", "0.57856095", "0.5753589", "0.5753589", "0.57459104", "0.5744979", "0.5738584", "0.57171065", "0.5715003", "0.5682531", "0.5656929", "0.5650624", "0.56441396", "0.56441396", "0.5640725", "0.56391025", "0.56201434", "0.5606939", "0.5579647", "0.5578368", "0.5566967", "0.5565035", "0.55576265", "0.55454135", "0.55373335", "0.5534148", "0.553393", "0.5528338", "0.5522836", "0.5522836", "0.552271", "0.5515843", "0.5512663", "0.550997", "0.550997", "0.55023736", "0.54985166", "0.5490402", "0.5481378", "0.5481378", "0.5481378", "0.54785013", "0.5475003", "0.5467509", "0.54669577", "0.5460385", "0.5459191", "0.54582214", "0.54556745", "0.5455562", "0.54409826", "0.5439938", "0.5439938", "0.5439938", "0.5435895", "0.543049", "0.54252714", "0.54205346", "0.5416429", "0.54140514", "0.54131347", "0.5412146", "0.5406859", "0.5400017", "0.53938264", "0.53746784", "0.53746784", "0.537336", "0.53616846", "0.5349488", "0.5348594" ]
0.7872635
0
METHOD to calculate values based on allowed operators
def calculator_method(operator, number_1, number_2) case operator when "add" total = number_1 + number_2 when "+" total = number_1 + number_2 when "subtract" total = number_1 - number_2 when "-" total = number_1 - number_2 when "multiply" total = number_1 * number_2 when "x" total = number_1 * number_2 when "*" total = number_1 * number_2 when "divide" total = number_1.to_f / number_2.to_f when "/" total = number_1.to_f / number_2.to_f end return total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n operator = ops[0]\n operand = ops[1]\n \n case operator\n when '+'\n sum += operand \n when '-'\n sum -= operand\n when '*'\n sum *= operand\n when '/'\n sum /=operand\n else \n end\n end \n sum \nend", "def calculate(starting_value, operations)\n for i in 0...operations.length\n # just in case an unexpected operator is given:\n if '*/+-'.include?(operations[i][0]) == false\n puts 'unexpected operator!'\n break\n end\n \n if operations[i][0] == \"*\"\n starting_value *= operations[i][1]\n elsif operations[i][0] == \"+\"\n starting_value += operations[i][1]\n elsif operations[i][0] == \"-\"\n starting_value -= operations[i][1]\n else\n starting_value /= operations[i][1]\n end\n end\n starting_value\nend", "def operators\n {\n \"+\" => -> {@num1 + @num2},\n \"-\" => -> {@num1 - @num2}\n }\n end", "def calculate(x, operator, y)\n\t# lots of ways to do the below part ...\n\t# if/elsif would have worked,\n\t# as would a case statement\n\treturn x + y if operator == '+'\n\treturn x - y if operator == '-'\n\treturn x * y if operator == '*'\n\treturn x / y if operator == '/'\nend", "def prescedence_of operator\n case operator\n when \"*\" then 2\n when \"/\" then 2\n when \"+\" then 1\n when \"-\" then 1\n when \"(\" then 0 \n end\n end", "def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend", "def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1 + value2\n when '-'\n value1 - value2\n when '*'\n value1 * value2\n when '/'\n value1 / value2\n end\nend", "def calculator(operator_active, num1, num2)\n case operator_active\n when \"+\"\n return num1 + num2\n when \"-\"\n return num1 - num2\n when \"*\"\n return num1 * num2\n when \"/\"\n return num1 / num2\n end\nend", "def arithmetic(a, b, operator)\n $oper = operator\n case $oper\n when 'add'\n return a + b\n\n when 'subtract'\n return a - b\n\n when 'multiply'\n return a * b\n\n when 'divide'\n return a / b\n \n end\nend", "def calculate( a, operator, c )\n\tif operator == \"+\"\n\t\ta + c\n\telsif operator == \"-\"\n\t\ta - c\n\telsif operator == \"*\"\n\t\ta * c\n\telsif operator == \"/\"\n\t\ta/c\n\t\t\n\tend\n\t\nend", "def logical_calc(arr, op)\n op=='AND' ? arr.reduce(:&) : op=='OR' ? arr.reduce(:|) : arr.reduce(:^)\nend", "def evaluate(ops)\n \t\tops = tokens(ops)\n \t\tmethods = {:+ => Proc.new{plus()}, :- => Proc.new{minus()}, :* => Proc.new{times()}, :/ => Proc.new{divide()}}\n \t\tops.each do |op|\n \t\t\tif methods.has_key?(op)\n \t\t\t\tmethods[op].call\n \t\t\telse\n \t\t\t\tpush(op)\n \t\t\tend\n \t\tend\n \t\tvalue()\n end", "def applyOperator(num1, num2, operator)\n\n\t\tif operator == \"+\"\n\t\t\treturn num1.to_i + num2.to_i\n\t\tend\n\n\t\tif operator == \"-\"\n\t\t\treturn num1.to_i - num2.to_i\n\t\tend\n\n\t\tif operator == \"*\"\n\t\t\treturn num1.to_i * num2.to_i\n\t\tend\n\n\t\tif operator == \"/\"\n\t\t\treturn num1.to_i / num2.to_i\n\t\tend\n\n\t\tif operator == \"%\"\n\t\t\treturn num1.to_i % num2.to_i\n\t\tend\n\n\t\tif operator == \"^\"\n\t\t\treturn num1.to_i ** num2.to_i\n\t\tend\n\n end", "def calculate_answer(operator, a, b)\n if operator == \"add\"\n a + b \n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n elsif operator == \"exponent\"\n a ** b\n elsif operator == \"modulus\"\n a % b\n end\nend", "def calculate_answer(operator, a, b)\n\tif operator == \"add\"\n \ta + b\n\telsif operator == \"subtract\"\n \t\ta - b\n\telsif operator == \"multiply\"\n \ta * b\n\telsif operator == \"divide\"\n \ta / b\n\telsif operator == \"square\"\n \t\ta ** b\n\telsif operator == \"bmi\"\n \t\ta / (b ** 2)\n\tend\nend", "def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend", "def operator\n case @matches[2]\n when \"plus\" then :+\n when \"minus\" then :-\n when \"divided by\" then :/\n when \"multiplied by\" then :*\n end\n end", "def Calculator(leftParam, rightParam, operator)\n\n case operator\n\n when \"+\"\n return leftParam + rightParam;\n when \"*\"\n\n i = 0\n result = 0\n while i < leftParam #2\n result = result + rightParam #@\n i= i + 1\n end\n\n return result\n end\nend", "def applyOperator(num1, num2, operator)\n #eval((num1.to_s + operator + num2.to_s).gsub(\"^\", \"**\"))\n @operators[operator][:action].call(num1.to_i, num2.to_i)\n end", "def calculate_answer(operator, a, b)\n\n if operator == \"add\"\n return result= a + b\n elsif operator == \"subtract\"\n return result = a - b\n elsif operator == \"multiply\"\n return result = a * b\n elsif operator == \"divide\"\n return result = a / b\n\nend", "def conditions()\n {:+ => :plus, :- => :minus, :/ => :divide, :* => :times}\n end", "def operator; end", "def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend", "def operators= new_ops\n @operators = new_ops.gsub(/[^+*-]/, '').split(//)\n reset\n end", "def process_operator_token(token, operand_a, operand_b)\n if token == '+'\n operand_a + operand_b\n elsif token == '-'\n operand_a - operand_b\n elsif token == '*'\n operand_a * operand_b\n elsif token == '/'\n raise 'Tried to divide by zero!' if operand_b == 0\n\n operand_a / operand_b\n else\n raise \"Invalid Operator: #{token}\"\n end\nend", "def calculator_method(number_one, operator, number_two)\n if operator == \"+\"\n return result = number_one + number_two\n elsif operator == \"-\"\n return result = number_one - number_two\n elsif operator == \"*\"\n return result = number_one * number_two\n else operator == \"/\"\n return result = number_one / number_two\n end\nend", "def calculator(operator, *numbers)\n result = 0\n if operator == \"*\"\n result = 1\n else\n result = numbers[0]\n numbers.shift\n end\n\n numbers.each do |arg|\n #result = arg operator.send result\n result = result.send(operator,arg)\n end\n return result\nend", "def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end", "def calculate_answer(operator, a, b)\r\n\r\n if operator == \"add\"\r\n return result= a + b\r\n elsif operator == \"subtract\"\r\n return result = a - b\r\n elsif operator == \"multiply\"\r\n return result = a * b\r\n elsif operator == \"divide\"\r\n return result = a / b\r\n\r\n end\r\n\r\nend", "def sum (operator, a, b)\n if operator == \"add\"\n a + b\n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n end\nend", "def operator\n @operator ||= case [min, max]\n when [0, 0] then ''\n when [0, 1] then '?'\n when [1, Infinity] then '+'\n else\n [min, max].map {|n| n == 0 || n == Infinity ? '' : n.to_s }.join('*')\n end\n end", "def operator\n @operator ||= case [min, max]\n when [0, 0] then ''\n when [0, 1] then '?'\n when [1, Infinity] then '+'\n else\n [min, max].map {|n| n == 0 || n == Infinity ? '' : n.to_s }.join('*')\n end\n end", "def calculate(op1, operator, op2)\n\tstring = op1.to_s + operator + op2.to_s\n\n\t# operator is assumed to be a string; \n\t# make one big string of it and the two operands \n\teval(string) # evaluate and return a value - never use eval ! eval is EVIL lol \nend", "def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend", "def perform_calc(opr, val1, val2)\n result = 0\n case opr\n when '*'\n result = val1.to_f * val2.to_f\n when \"/\"\n result = val1.to_f / val2.to_f\n when \"+\"\n result = val1.to_f + val2.to_f\n when \"-\"\n result = val1.to_f - val2.to_f\n end\n result.round(2)\n end", "def calculate\n\t\tplace_in_containers()\n\n\t\t# Checks for mismatch between the number of operands and operators.\n\t\t# The only valid number of operators for N operands is (N - 1).\n\t\tunless @operands.size - @operators.size == 1\n\t\t\t@valid = false\n\t\t\[email protected](\"Operand/Operator mismatch.\")\n\t\tend\n\n\t\t# Checks for operators present before the first two operands\n\t\t# are written. This is incorrect RPN syntax.\n\t\tif (@instructions[0..1] & [1010, 1011, 1100, 1101]).any?\n\t\t\t@valid = false\n\t\t\[email protected](\"Operator present before first two operands.\")\n\t\tend\n\n\t\t# Checks for an empty operand stack. In this case, there is\n\t\t# nothing more to do in the method.\n\t\tif @operands.empty?\n\t\t\[email protected](\"No operands.\")\n\t\t\treturn [0, false]\n\t\tend\n\n\t\t# Runs a loop until fewer than two operands or fewer than 1\n\t\t# operators are present in their respective containers.\n\t\tuntil @operands.size == 1 || @operators.size == 0 do\n\t\t\t# Pops the first operator from the front of the queue.\n\t\t\toperator = @operators.shift\n\n\t\t\t# Pops the top and second-to-top operands off of the stack.\n\t\t\topright = @operands.pop\n\t\t\topleft = @operands.pop\n\n\t\t\t# Returns prematurely before division by zero occurs.\n\t\t\tif operator == \"/\" && opright == 0\n\t\t\t\tputs \"division by zero\"\n\t\t\t\treturn [0, false]\n\t\t\tend\n\n\t\t\t# Sends the operator and the right operand to the left operand\n\t\t\t# and thereby invokes FixedNum#+, the method used for adding\n\t\t\t# integers.\n\t\t\[email protected](opleft.send(operator, opright))\n\t\tend\n\n\t\t# Returns the last element of @operands and the value of @valid.\n\t\t[@operands[-1], @valid]\n\tend", "def arithmetic_op(op,ins_1,ins_2,do_sanitizing=true)\n begin\n amount = ''\n if do_sanitizing\n ins_2 = Money::InputSanitizer.sanitize_money_live_converter(ins_2)\n if ( ins_1.currency == ins_2.currency )\n amount = ins_1.amount.to_f.public_send(op,ins_2.amount.to_f)\n else\n amount = ins_1.amount.to_f.public_send(op,ins_2.convert_to(ins_1.currency).amount.to_f)\n end\n else\n amount = ins_1.amount.to_f.public_send(op,ins_2.to_f)\n end\n if (['==','<','>'].include?(op))\n return amount\n else\n Money::LiveConverter.new(amount,ins_1.currency)\n end\n rescue RuntimeError => e\n puts \"#{e.message}\"\n end\n end", "def answer\n operators[@operator].call\n end", "def calculate_expressions(expr)\n res = 0\n if expr.count(\"a-zA-Z\") > 0\n res = \"Incorrect expression or Number\"\n else\n while(has_operators?(expr))\n @logger.info \"Expression=#{expr}\"\n part_expr = \"\"\n operator = next_operator(expr)\n @logger.info \"Operator=#{operator}\"\n idx = expr.index(operator)\n val1 = find_prv_operand(expr, idx)\n val2 = find_next_operand(expr, idx)\n res = perform_calc(operator, val1, val2)\n part_expr = \"#{val1}#{operator}#{val2}\"\n @logger.info \"#{part_expr}=#{res}\"\n expr.gsub!(part_expr, res.to_s)\n end\n res = res.round(2)\n end\n res\n end", "def evaluate(operator=\"and\")\n unless operator == \"and\" || operator == \"or\"\n raise(ArgumentError, \"operator must be 'and' or 'or'\")\n end\n \n result_data = {}\n\n @conditions.each do |condition|\n result_data[condition[0]] = condition[1].call\n end\n \n result = case operator\n when \"and\"\n result_data.all? { |name, result| result }\n when \"or\"\n result_data.any? { |name, result| result }\n end\n \n return result, result_data\n end", "def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend", "def sum (operator, a, b)\n if operator == \"exponents\"\n a ** b\n elsif operator == \"square root\"\n Math.sqrt(a)\n end\nend", "def operator_case_test \n case @operator \n when \"+\"\n puts \"accepted\"\n second_number_function \n when \"-\"\n puts \"accepted\"\n second_number_function\n when \"/\"\n puts \"accepted\"\n second_number_function \n when \"*\" \n puts \"accepted\"\n second_number_function \n else puts \"Operator not recognized.\"\n operator_function \n end \nend", "def inputPrecedence(operator)\n if ['+', '-'].include? operator\n return 1\n elsif ['*', '/', '%'].include? operator\n return 2\n elsif '^'.eql? operator\n return 4\n else\n return 5\n end\n end", "def calculate(integer, operator, integer1)\n\tif operator == \"+\"\n\t\tp integer + integer1\n\telsif operator == \"-\"\n\t\tp integer - integer1\n\telsif operator == \"*\"\n\t\tp integer * integer1\n\telsif operator == \"/\"\n\t\tp integer / integer1\n\telse\n\t\tp \"I'm sorry that's not a valid equation!\"\n\t\t\n\tend\nend", "def valid_operator(user_operator)\n possible_operators = [ \"add\", \"+\", \"subtract\", \"-\", \"multiply\", \"x\", \"*\", \"divide\", \"/\" ]\n possible_operators.include?(user_operator)\nend", "def check_operators(token, evaluation, line, file_read, ops)\n op1 = ops[0]\n op2 = ops[1]\n unless ['-', '+', '/', '*'].include?(token) && !(token == '/' && op2.to_i.zero?)\n puts \"Line #{line}: Could not evaluate expression\"\n error_eval(5, line, nil, file_read)\n return false\n end\n evaluation.push(op1.to_i.send(token.to_sym, op2.to_i))\n end", "def calculate operator, num1, num2\n puts \"#{num1} #{operator} #{num2} = #{num1.send(operator, num2)}\"\nend", "def evaluate(input)\n if input.operator?\n perform_operation(input)\n else\n input\n end\n end", "def calculate_by_type(number_set, operator)\n case operator\n when ADDITION then add(number_set)\n when SUBTRACTION then subtract(number_set)\n when DIVISION then divide(number_set)\n when MULTIPLICATION then multiply(number_set)\n else raise ArgumentError, \"Sorry Dave. I don't support #{operator} yet.\"\n end\n end", "def check_op (oper)\n if oper == 'add' || oper == '+'\n puts \"+ + Let's add 'em up! + +\"\n return operator = '+'\n elsif oper == 'subtract' || oper == '-'\n puts \"- - Let's subtract! - -\"\n return operator = '-'\n elsif oper == 'multiply' || oper == '*'\n puts \"* * It's time to multiply! * *\"\n return operator = '*'\n elsif oper == 'divide' || oper == '/'\n puts \"/ / Let's divide 'em up! / /\"\n return operator = '/'\n elsif oper == 'exponent' || oper == '**'\n puts \"^ ^ Let's power 'em up! ^ ^\"\n return operator = '**'\n elsif oper == 'remainder' || oper == '%'\n puts \"% % Let's find the remainder! % %\"\n return operator = '%'\n end\nend", "def operate_value(operation, operand_type, operand)\n if operand_type == 0\n value = operand\n else\n value = $game_variables[operand]\n end\n if operation == 1\n value = -value\n end\n return value\n end", "def _calc operator\n (operand1, operand2) = @stack.pop 2\n @stack.unshift @stack.first\n @stack.push operand1.send(operator.to_sym, operand2)\nend", "def calculator(x, operator, y)\r\n\r\n\tif ['+', '-', '*', '/'].include? operator\r\n\t\tcalculation = x.send(operator.to_sym, y) #send x to object (operator which has been converted to a symbol) and y. calculation will now = x (operator) y\r\n\telse\r\n\t\tputs \"ERROR! Invalid input. Please try again.\"\r\n\tend\r\n\treturn calculation #previously had this set to 'print' instead of 'return' which was causing issues when needing to print a history of values returned\r\nend", "def do_math(operand, val1, val2)\n case operand\n when \"+\"\n val1 + val2\n when \"-\"\n val1 - val2\n when \"*\"\n val1 * val2\n when \"/\"\n val1 / val2\n end\nend", "def calculate\n @equations = self.class.permutate(@inputs, @operators)\n @results = {}\n @equations.each do |eq|\n @results[eq] = eval(eq)\n end\n end", "def math_eval(str)\n # iterate over string values\n # perhaps utilize a queue till you hit a symbol?\n # left operand and right operand (do we care about order of operations?)\n copy = str\n total = 0\n tokens = []\n\n copy.chars.each_with_index do |ch, idx|\n if ch == '*' || ch == '/' || ch == '+' || ch == '-'\n divided = str.split(ch)\n tokens << divided.shift.to_i\n tokens << ch\n copy = divided\n end\n if idx == copy.length - 1\n tokens << copy\n end\n # break if ch.match(/()+\\-*/) && operator != ''\n # operator = ch.match(/()+\\-*/)\n # left_operand = ch if ch.match(/0-9/) && operator == ''\n # right_operand += ch if ch.match(/0-9/) && operator != ''\n end\n return tokens\n\n p \"operator: #{operator}, left_operand: #{left_operand}, right_operand: #{right_operand}\"\n return left_operand.to_i if operator == ''\n return left_operand.to_i + right_operand.to_i if operator == '+'\n return left_operand.to_i - right_operand.to_i if operator == '-'\n return left_operand.to_i / right_operand.to_i if operator == '/'\n return left_operand.to_i * right_operand.to_i if operator == '*'\nend", "def calc(op, arr)\n return op.to_i if arr.empty?\n\n right = calc(arr[0], arr[1..-1])\n return nil unless right\n\n case op.to_s\n when /\\A-?\\d+\\z/\n (op.to_i + right).abs\n when 'x2'\n right * 2\n when '/2'\n right.even? ? right / 2 : nil\n else\n raise \"unexpected op #{op.inspect}\"\n end\nend", "def inputPrecedence(operator)\n if operator == \"+\" || operator == \"-\"\n\t\t\treturn 1\n\t\tend\n\n if operator == \"*\" || operator == \"/\" || operator == \"%\"\n\t\t\treturn 2\n\t\tend\n\n if operator == \"^\"\n\t\t\treturn 4\n\t\tend\n\n if operator == \"(\"\n\t\t\treturn 5\n\t\tend\n\n end", "def operate( op, val = nil )\n case val\n when Coord\n @rel |= true\n @ops.push [ op, val ]\n when Numeric, NilClass\n if @rel == false\n @ops[-1][1] = calculate( op, @ops[-1][1], val )\n else\n @ops.push [ op, val ]\n end\n end\n end", "def operate_value(operation, operand_type, operand)\r\n value = operand_type == 0 ? operand : $game_variables[operand]\r\n operation == 0 ? value : -value\r\n end", "def check_operation x, num1, num2\n case x\n when \"+\" then num1 + num2\n when \"-\" then num1 - num2\n when \"*\" then num1 * num2\n when \"/\" then num1 / num2\n when \"exp\" then num1 ** num2\n when \"sqrt\" then Math.sqrt num1\n else \"Invalid operation choosen\"\n end\nend", "def calculator num1, operator, num2\n # Our 'if' statement checks to see if we have found the string of plus or minus and uses the according operator.\n if operator == \"plus\"\n return num1 + num2\n else\n return num1 - num2\n end\n end", "def arithmetic(a, b, operator)\n if operator == \"add\"\n a + b\n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a/b\n else\n print \"hahaa\"\n end\nend", "def calculator(operation, num1, num2)\n \n if [\"+\", \"-\", \"*\" , \"/\"].include?(operation)\n num1.method(operation).(num2)\n else\n puts \"Invalid operation!\"\n nil\n end\nend", "def applyOperator(num1, num2, operator)\n return num1.send(operator, num2)\n end", "def read_operator_node(node)\n first_node = node.children.first\n solution = first_node.is_a?(GivenThatOperatorNode) ? read_operator_node(first_node) : first_node\n\n push_connector(node)\n #group =\n node.children[1..-1].inject(solution) do |sum, i|\n i = read_operator_node(i) if i.is_a?(GivenThatOperatorNode)\n if MULTIPLICATIVE_OPERATORS.include?(node.value)\n sum = sum | i\n else # Assume it's in ADDITIVE_OPERATORS\n sum = sum & i\n end\n end\n end", "def handle_operation(equation)\n # Check for first of either multiplication or division\n multiply_or_division = equation.find_index { |o| o == '*' || o == '/' }\n # Then check for addition or subtraction\n addition_or_subtraction = equation.find_index { |o| o == '+' || o == '-' }\n\n # Multiplication/Division first, then try addition/subtraction\n operator_location = multiply_or_division || addition_or_subtraction\n\n # Grab operator to do the maths\n operator = equation[operator_location]\n\n # Locate the numbers it is operating on\n first_int = equation[operator_location - 1].to_f\n second_int = equation[operator_location + 1].to_f\n\n # Perform operation\n operator_result = first_int.send(operator, second_int)\n\n # Replace in complete array and remove surrounding numbers\n equation[operator_location] = operator_result\n equation.delete_at(operator_location + 1)\n equation.delete_at(operator_location - 1)\n equation\n end", "def handle_plus_minus(tokens)\n last_value = 0\n last_op = '+'\n tokens.each do |token|\n case token\n when '+', '-'\n last_op = token\n else\n last_value = (last_op == '+') ? last_value + token : last_value - token\n end\n end\n last_value\nend", "def my_calculate(*params)\n\n puts \"\\nStarting....\"\n\n operations = {}\n operands = []\n\n \n params.reverse.each do |p|\n\n puts \"param p is #{p.inspect}. Its class is #{p.class}\"\n\n #determine what p is\n operations = p if p.is_a?(Hash)\n operands << p if p.is_a?(Fixnum)\n\n end\n\n # perform operations\n\n #check the default operation\n if operations.size == 0\n\n puts \"\\n Performing add... for default operation\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n\n else\n\n operations.each do | key, val|\n \n if val == true \n if key == :add\n puts \"\\n Performing add...\"\n result = my_add(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :subtract\n puts \"\\n Performing subtract...\"\n result = my_subtract(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :multiply\n puts \"\\n Performing multiply...\"\n result = my_multiply(operands)\n puts \"Result is #{result}.\"\n \n elsif key == :divide\n puts \"\\n Performing divide...\"\n result = my_divide(operands)\n puts \"Result is #{result}.\"\n \n else\n puts \"Unknow operation #{key}. It is ignored.\"\n \n \n end\n end\n \n \n end\n end\n \nend", "def operators\n [:is]\n end", "def calculate(operator, num1, num2)\n # Use case when to invoke each method\n case operator\n when \"add\", \"+\"\n puts \"#{num1} + #{num2} = #{add(num1, num2)}\"\n # Do I need a return here\n when \"subtract\", \"-\"\n puts \"#{num1} - #{num2} = #{subtract(num1, num2)}\"\n when \"multiply\", \"*\"\n puts \"#{num1} * #{num2} = #{multiply(num1, num2)}\"\n when \"divide\", \"/\"\n puts \"#{num1} / #{num2} = #{divide(num1, num2)}\"\n when \"modulo\", \"%\"\n puts \"#{num1} % #{num2} = #{mod(num1, num2)}\"\n when \"exponify\", \"**\"\n puts \"#{num1}^#{num2} = #{exponify(num1, num2)}\"\n end\nend", "def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b \n elsif op == \"multiply\"\n return a * b \n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend", "def operator_validator(line)\n operators = ['+', '-', '>', '<', '!', '*', '=']\n ret_arr = []\n operators.each do |n|\n arr = line.chars\n counter = 0\n while counter < arr.length\n if arr[counter] == n\n if operators.include?(arr[counter - 1]) && n == '='\n counter += 1\n next\n end\n dummy_arr = []\n if arr[counter + 1] == '='\n dummy_arr << (arr[counter] + '=')\n dummy_arr << (arr[counter - 1] == ' ' ? -1 : counter - 1)\n dummy_arr << (arr[counter + 2] == ' ' ? -1 : counter + 2)\n counter += 2\n else\n dummy_arr << (arr[counter])\n dummy_arr << (arr[counter - 1] == ' ' ? -1 : counter - 1)\n dummy_arr << (arr[counter + 1] == ' ' ? -1 : counter + 1)\n counter += 1\n end\n ret_arr << dummy_arr\n else\n counter += 1\n end\n end\n end\n ret_arr\n end", "def basic_op(operator, value1, value2)\n value1.send(operator.value2)\nend", "def evaluate_operator(left, right)\n left >= right\n end", "def calculator_1(operator, num1, num2)\n outcome = num1.send(operator, num2)\nend", "def calc(num1, mathop, num2)\n if mathop == \"+\"\n return num1 + num2\n elsif mathop == \"-\"\n return num1 - num2\n elsif mathop == \"*\"\n return num1 * num2\n elsif mathop == \"/\"\n return num1 / num2\n else\n return \"I did not recognize your input, please try again.\"\n end\nend", "def oper\n return @oper\n end", "def calculation(operant)\n\tnum1 = rand(10)\n\tnum2 = rand(10)\n\t if operant == '*'\n\t prob = \"#{num1} * #{num2}\"\n\t ans = num1 * num2\n\t correct_chk(ans,prob)\n\t elsif operant == '-'\n\t prob = \"#{num1} - #{num2}\"\n\t ans = num1 - num2\n\t correct_chk(ans,prob)\n\t else operant == '+'\n\t prob = \"#{num1} + #{num2}\"\n\t ans = num1 + num2\n\t correct_chk(ans,prob)\n\t end\n end", "def match_operator(p, value)\n if p[0] == '!'\n @@operator_map[p[0]].call(_match(p[1], value))\n elsif p[0] == '^'\n @@operator_map[p[0]].call(_match(p[1][0], value), _match(p[1][1], value))\n else\n @@operator_map[p[0]].call(p[1].each {|operator_or_filter| _match(operator_or_filter, value)})\n end\n end", "def doMath(num1, num2, operator)\n # puts \"#{num1} #{operator} #{num2} \"\n case operator\n when \"+\"\n answer = num1 + num2\n when \"-\"\n answer = num1 - num2\n when \"*\"\n answer = num1 * num2\n when \"/\"\n answer = num1 / num2\n else\n answer = nil\n end\n # puts answer\n return answer\nend", "def optimize\n operand\n end", "def modeler_description\r\n return \"A and B are the operands corresponding to the selected schedules A and B. The entered formula can use operators + - * and / any float numbers and at least one operand. Brackets are allowed. All Operations are carried minute by minute. The division is the only irregular operator; when the enumerator is an operand it's meaning is (schedule value != 0), so the output would be Boolean represented by zeroes and ones\"\r\n end", "def get_result(operator, *n)\n return $operations[operator].call(*n).to_s\nend", "def calc(expr)\n expr.split.each_with_object([]) { |e, a|\n if e.match(/\\d+/)\n a << e.to_f\n else\n y, x = a.pop, a.pop\n a << x.send(e, y)\n end\n }.last || 0\nend", "def calculate(value,operation)\n check_calculation_requirements(value)\n calculation_requirements.map do |requirement|\n send(requirement).send(operation,value.send(requirement))\n end\n end", "def calc_operator token\n ##\n # We need two operands to perform an operation, so we \n # raise `InvalidTokenError` if we don't have those \n # (as at that moment of execution operator-tokens are invalid).\n raise InvalidTokenError if @stack.length < 2\n arg2 = pop!\n arg1 = pop!\n res = get_operation(token).call(arg1, arg2)\n @stack.push(res)\n res\n end", "def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b\n elsif op == \"multiply\"\n return a * b\n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend", "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend", "def evaluate() \n # operand stack\n opStack = []\n \n # iterate over the tokens\n @postfix.split(\"\").each do |c|\n # check if an operator\n if %w[+ - * / ^].include? c\n # pop the stack for the two operands where\n # a [operator] b\n b, a = opStack.pop, opStack.pop\n \n # evaluate the string as an arithmetic expression\n # replace all '^' characters with '**' operator\n opStack.push(eval(\"(#{a})#{c}(#{b})\".gsub(/\\^/,'**')))\n else\n # push any operands onto stack\n opStack.push(c)\n end\n end\n \n # Last item in stack should be the final answer!\n opStack.pop\n end", "def precedence\n case @operator\n when '+', '-'\n # addition and subtraction\n 0\n when '*', '/'\n # multiplication and division\n 1\n when '**', '^'\n # powers / roots (e.g. 2^(1/2))\n 2\n end\n end", "def operator\n self.class.operator\n end", "def operators\n @arr.map{|h| h[:operator]}.uniq\n end", "def basic_op(operator, value1, value2)\n value1.send(operator, value2)\nend", "def calculate(key)\n while key =~ /\\(/ && key =~ /\\)/\n key.gsub!(/\\(([^\\(\\)]+)\\)/) do |calculation|\n calculate(calculation.gsub(/[\\(\\)]/, ''))\n end\n end\n\n (left, op, right) = key.split(/\\s/)\n\n left = (\n left =~ /[^\\d.]/ ? self.fetch(left) : BigDecimal.new(left)\n ) || zero()\n\n right = (\n right =~ /[^\\d.]/ ? self.fetch(right) : BigDecimal.new(right)\n ) || zero()\n\n op = op == \":\" ? \"/\" : op\n op = op == \"x\" ? \"*\" : op\n\n # make sure at least 1 hand is a float\n left *= 1.0 if [left.class, right.class].include?(Fixnum)\n\n value = ( left.send(op, right) ) rescue zero()\n return checked(value)\n end", "def next_operator(expr)\n return '*' if expr.index('*')\n return '/' if expr.index('/')\n return '+' if expr.index('+')\n return '-' if expr.index('-')\n end", "def operators\n hash_key_operators\n end", "def operator\n return @operator\n end", "def operator\n return @operator\n end" ]
[ "0.7253338", "0.7205134", "0.7165941", "0.71519744", "0.70692754", "0.7048209", "0.7030856", "0.68696004", "0.68678373", "0.6843849", "0.683048", "0.67676485", "0.676318", "0.6742941", "0.674119", "0.6716485", "0.6698805", "0.6693024", "0.667439", "0.66666836", "0.66640687", "0.6634655", "0.66294265", "0.6581289", "0.65764797", "0.6575398", "0.65712667", "0.65686566", "0.65661687", "0.6548329", "0.65397197", "0.65397197", "0.6526382", "0.6523228", "0.65231586", "0.64985025", "0.648615", "0.6485178", "0.6464437", "0.6458281", "0.64538497", "0.64381874", "0.6400754", "0.6393573", "0.6389601", "0.6376522", "0.6373291", "0.63640326", "0.6337494", "0.63308257", "0.6324118", "0.63234186", "0.6318706", "0.6317981", "0.630897", "0.628477", "0.6275939", "0.6273935", "0.62530947", "0.6240806", "0.62359643", "0.6232327", "0.62172633", "0.62123215", "0.6185472", "0.61806494", "0.6175548", "0.6148454", "0.6146893", "0.6141998", "0.61098135", "0.6105549", "0.6100975", "0.6097493", "0.6094363", "0.60909766", "0.6074876", "0.60621876", "0.6053454", "0.6048123", "0.6047811", "0.6039108", "0.60347724", "0.60298544", "0.6028687", "0.6016888", "0.6006795", "0.59915686", "0.5987901", "0.5987354", "0.5987337", "0.59779304", "0.59738255", "0.5970586", "0.59626776", "0.5958149", "0.59579635", "0.5927946", "0.5925645", "0.5925645" ]
0.6631697
22
METHOD to check if a string is a valid number
def can_be_number(string) forced_as_f = string.to_f # force string to be a float forced_as_i = string.to_i # force string to be an integer return string == forced_as_f.to_s || string == forced_as_i.to_s # see if either of the forced strings equal the original end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\n end", "def is_number?(string)\n true if Integer(string) && Integer(string) >= 0 rescue false\n end", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\n end", "def is_num(str)\n\treturn true if str =~ /^\\d+$/\n true if Int(str) rescue false\nend", "def is_number?(str)\n true if Float(str) rescue false\n end", "def ValidNumber? (string)\t\t\t\t\t\t\t\t\n\t### Check if a non-numeric character ever appears in the string using /\\D/\n\t### If so, we know it's not a 'NUMBER' as defined\n\t### Also check if string is empty\n\treturn ( not(/\\D/ =~ string) && not(string.length.zero?) ), string.to_i\nend", "def number?(string)\n string.to_i.to_s == string\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def is_number? string\n true if Float(string) rescue false\n end", "def is_number? string\n true if Float(string) rescue false\n end", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend", "def is_a_number?(str)\n str.match(/\\d/)\nend", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end", "def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end", "def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend", "def is_number?(string)\n true if Float(string) rescue false\n end", "def is_number?(string)\n true if Float(string) rescue false\n end", "def valid_looking_string?(str)\n str =~ /\\d/\n end", "def is_number(str)\n str.to_f.to_s == str.to_s || str.to_i.to_s == str.to_s\n end", "def is_a_number?(s)\n \ts.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n\tend", "def valid_number?(num)\n num.to_s unless num.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match num\nend", "def is_numeric(str)\n true if Integer(str) rescue false\nend", "def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend", "def number?(str)\n !!Integer(str)\nrescue ArgumentError, TypeError\n false\nend", "def valid_number?(num)\n /^\\d+$/.match(num) \n end", "def is_number?(str)\n return str == str.to_f.to_s || str == str.to_i.to_s\nend", "def numeric?(string)\n !!(string =~ /\\A\\d+\\Z/)\nend", "def valid_num?(number)\n number == number.to_i.to_s\nend", "def value_is_integer?(string)\n return string.strip.numeric?\n end", "def is_numeric(s)\n begin\n Integer(s)\n rescue\n puts \"please enter a number\" \n end\nend", "def valid_number?(input)\n /^-?\\d+$/.match(input)\nend", "def is_numeric?(s)\n # input -> s: a string\n # output -> true if the string is a number value, false otherwise\n begin\n if Float(s)\n return true\n end\n rescue\n return false\n end\n end", "def valid_number?(n_s)\n n_s.to_i.to_s == n_s && n_s.to_i != 0\nend", "def valid_number?(num)\n num.to_i.to_s == num\nend", "def valid_number?(input)\n input.to_i.to_s == input\nend", "def is_number? string\n true if Float(string) rescue false\nend", "def check_for_number(s)\r\n #check for number. real numbers either have . or , separators\r\n index = s =~ /[^-\\d\\.,]/ \r\n return index == nil\r\n end", "def is_number?(string)\n # catch and return false if it isn't an integer\n true if Float(string) rescue false \nend", "def validate_str_is_integer(value)\n !!(value =~ /\\A[-+]?[0-9]+\\z/)\n end", "def is_numeric?\n self.match(/^[0-9]+$/)\n end", "def _is_numeric?(str)\n Float(str) != nil rescue false\n end", "def validate_str_is_integer(value)\n !!(value =~ /\\A[-+]?[0-9]+\\z/)\n end", "def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def test_is_nummeric\n assert(StringChecker.is_numeric?(\"+20\"))\n assert(StringChecker.is_numeric?(\"-020\"))\n assert(StringChecker.is_numeric?(\"123\"))\n assert(StringChecker.is_numeric?(\"0123\"))\n assert(!StringChecker.is_numeric?(\"1.2\"))\n assert(!StringChecker.is_numeric?(\"asdf\"))\n assert(!StringChecker.is_numeric?(\" \"))\n end", "def validnum?(num)\n num == num.to_i.to_s\nend", "def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend", "def is_numeric(str)\n Float(str) != nil rescue false\n end", "def not_a_number?(n)\n \tn.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? true : false\n end", "def valid_int_str?(str)\n str =~ /^[+\\-]?[\\d]*$/ # optional sign, then only digits\n end", "def valid_integer?(string)\n string.to_i.to_s == string\nend", "def valid_integer?(string)\n string.to_i.to_s == string\nend", "def is_numeric?(s)\n !!Float(s) rescue false\n end", "def is_string_a_valid_integer?(str)\n (str =~ /^-?[0-9]+$/) == 0 ? true : false\nend", "def isNum?(num)\n /[0-9]/.match(num.to_s) != nil\nend", "def number?\n !!strip.match(/^-?\\d\\.?\\d*$/)\n end", "def number?(code)\n valid?(code, NUMBER_CHARACTERS)\n end", "def valid_number?(number)\n number.to_f.to_s == number || number.to_i.to_s == number\nend", "def valid_integer?(string)\r\n string.to_i.to_s == string\r\nend", "def valid_number?(num)\n num =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\Z/\nend" ]
[ "0.8375915", "0.8356822", "0.8346799", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8339616", "0.8283314", "0.81380934", "0.80820465", "0.80809504", "0.80753464", "0.80707777", "0.80702", "0.80702", "0.8060842", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.80534357", "0.8045443", "0.8045443", "0.8024214", "0.8024214", "0.7995303", "0.7985539", "0.7985539", "0.798149", "0.7975164", "0.7973988", "0.793765", "0.7930368", "0.7921245", "0.7903428", "0.78924733", "0.7877412", "0.7847084", "0.77539873", "0.77525187", "0.7721314", "0.7691628", "0.76909", "0.7690273", "0.7688005", "0.76872826", "0.7685984", "0.7679679", "0.76696324", "0.7650391", "0.7649522", "0.7638678", "0.7627916", "0.76234597", "0.7599083", "0.75980836", "0.75913215", "0.75819707", "0.7562722", "0.7552641", "0.75482833", "0.7534888", "0.7520411", "0.75198454", "0.7501303", "0.7501303", "0.7498617", "0.74923974", "0.7483999", "0.7483511", "0.7481214", "0.74623555", "0.7453087", "0.74510217" ]
0.0
-1
In integer math, there are no fractions. So if you are using integer literals, you will be using integer math, which means, for example... 1 / 2 => 0 In floating point math, there are fractions. So... 1.0 / 2.0 => 0.5 write your code here
def ftoc (tempin) if tempin==32 then 0 elsif tempin==212 then 100 else fraction = 5.0/9.0 tempout = (tempin -32) *fraction puts "temp output is: "+tempout.to_s tempout end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_division_by_zero; 5 / 0; end", "def do_division_by_zero; 5 / 0; end", "def do_division_by_zero; 5 / 0; end", "def /(other)\n to_i / other.to_i\n end", "def accurate_division(int, int_two)\n int = int.to_f\n int_two = int_two\n q = int / int_two\n return q.round(3)\nend", "def division num1, num2\n total = num1.to_i / num2.to_i\n puts \"--> The total is... #{total}\"\nend", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def divide(num1, num2)\n num2.to_f / num1.to_f;\nend", "def p002rubynumbers \n\t\n\t puts 1+2\n\t puts 2*3\n\t #Integer division\n\t #When you do arithematic with integers, you'll get integer answers\n\t puts 3/2\n\t puts 10-11\n\t puts 1.5 /2.6\n\nend", "def divide(input_number)\n $number /= input_number\n return $number\nend", "def zero_div\n x = 5\n 1/0\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division is: #{f}\"\n end", "def divisionm(num_1,num_2)\n return num_1 / num_2\nend", "def asterisks_for(an_integer)\n an_integer > 2 ? '*' * (an_integer / 5.0).round : '-'\nend", "def numerator() end", "def divide(first_number, second_number)\n first_number / second_number\nend", "def division(value1, value2)\n result = value1 / value2\n puts \"The sum of #{ value1 } / #{ value2 } = #{ result }\"\nend", "def pre_divide; end", "def fractional; end", "def post_divide; end", "def fraction_calculator fraction_one, fraction_two, operator\n num_one = Rational(fraction_one)\n num_two = Rational(fraction_two)\n \n final_result = case operator\n when '/' then num_one / num_two\n when '*' then num_one * num_two\n when '+' then num_one + num_two\n when '-' then num_one - num_two\n end\n\n String(final_result)\n\n print String(final_result)\n\nend", "def divide (a,b)\n f = a.to_i / b.to_i\n puts \"Division of both number is: #{f}\"\n end", "def divide(number_one, number_two)\nnumber_one / number_two\nend", "def divideme(first_number,second_number) # divides the numbers\r\n if second_number.to_i == 0\r\n puts \"Sorry cannot divide by zero\"\r\n else\r\n if first_number.to_i % second_number.to_i == 0\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_i / second_number.to_i).to_s)\r\n else\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_f / second_number.to_f).to_s)\r\n end\r\n end\r\nend", "def divideThem(numOne, numTwo)\n numOne / numTwo\nend", "def denominator() end", "def do_math(num1, num2, operation)\n case operation\n when '+'\n num1.to_i + num2.to_i\n when '-'\n num1.to_i - num2.to_i\n when '*'\n num1.to_i * num2.to_i\n when '/'\n num1.to_f / num2.to_f\n end\nend", "def divide(numerator, denominator)\n puts \"#{numerator} / #{denominator} = #{numerator / denominator}\\n\"\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def divide(number_1, number_2)\n return number_1 / number_2\nend", "def div_stringed(num1, num2)\r\n\r\nend", "def /(value)\n mul(value) ;\n end", "def divisione(a, b)\n puts \"DIVIDENDO #{a} / #{b}\"\n a / b\nend", "def div(x, y)\n x / y\nend", "def divide(first_number, second_number)\n return first_number / second_number\nend", "def divide(num1, num2)\n p num1/num2\nend", "def divide(num1, num2)\n return num1 / num2\nend", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def decimal\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n x = numerator.to_f/denominator.to_f\n puts x\n end\n end", "def display_result(num1, num2, operator)\n # say \"num1: #{num1}, num2: #{num2}, operator #{operator}\"\n case operator\n when '1'\n result = num1.to_i + num2.to_i\n say \"#{num1} + #{num2} = #{result}\"\n when '2'\n result = num1.to_i - num2.to_i\n say \"#{num1} - #{num2} = #{result}\"\n when '3'\n begin\n result = num1.to_f / num2.to_f\n say \"#{num1} / #{num2} = #{result}\"\n rescue\n say(\"Div by 0\")\n end\n else\n result = num1.to_i * num2.to_i\n say \"#{num1} * #{num2} = #{result}\"\n end\n result.to_s\nend", "def divide(n1, n2)\n divide = n1 / n2\n return divide\nend", "def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend", "def division\n\tputs \"which numbers would you like to divide\"\n\tdiv_number1 = gets.chomp.to_f\n\tdiv_number2 = gets.chomp.to_f\n\tif div_number2.to_f == 0\n\t\tputs \"That is not possible, you failed fourth grade math.\"\t\t\n\telse\n\t\tputs div_number1.to_f / div_number2.to_f\n\tend\nend", "def lucas(number)\n golden_ratio = (1 + 5**0.5) / 2\n (golden_ratio**number).round.to_i\nrescue StandardError\n 'Error: Provide number only!'\nend", "def divide(a, b)\n puts \"DIVIDING #{a} / #{b}\"\n a / b\nend", "def divide(a,b)\n a/b\nend", "def get_number(result)\n # This is not mathematical correct, because we cant subtract\n puts \"Well done, #{result} == 24\" if 1 / 3 + 4 * 6 == result\n # But, if we can, here is solution: 6.0 / (1.0 - 3.0 / 4.0)\nend", "def test_Rational_ArithmeticOperations\n\t\tassert_equal(1.0, Rational(\"1/2\") + Rational(\"1/2\"))\n\t\tassert_equal(0.0, Rational(\"1/2\") - Rational(\"1/2\"))\n\t\tassert_equal(0.25, Rational(\"1/2\") * Rational(\"1/2\"))\n\t\tassert_equal(1.0, Rational(\"1/2\") / Rational(\"1/2\"))\n\t\tassert_equal(0, Rational(\"1/2\") % Rational(\"1/2\"))\n\t\tassert_equal(4.0, Rational(\"2\") ** Rational(\"2\"))\n\t\t# assert_equal(1, -@ Rational(\"2\"))\n\tend", "def string\n if denominator.to_i == 0\n puts \"ERROR\"\n else\n puts numerator.to_s + \"/\" + denominator.to_s\n end\n end", "def divide(first_number, second_number)\n return first_number / second_number\n end", "def DISABLED_test_integer_divide_sequence\n assert_tokenises_as '2/2', IntegerToken.new(2), DivideOpToken.instance, IntegerToken.new(2)\n assert_tokenises_as '2/-2', IntegerToken.new(2), DivideOpToken.instance, IntegerToken.new(-2)\n end", "def division(input_number1, input_number2)\n\tquotient = input_number1 / input_number2\n\tputs \"The quotient of #{input_number1} and #{input_number2}th is #{quotient}.\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend", "def DivisionStringified(num1,num2)\n result = num1.to_f / num2.to_f\n result.round.to_s.chars.map(&:to_i).size <= 3 ? result.round : result.round(3)\nend", "def divide(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n elsif x.is_a?(Integer) && y.is_a?(Integer) && x % y != 0\n return x.to_f / y\n else\n return x / y\n end\nend", "def three(number)\n puts 'Always ' + (((number + 5) * 2 - 4) / 2 - number).to_s\nend", "def divide(one,two)\n\treturn \"I don't think so\" if two ==0\n\tone / two\nend", "def arithmetic2(a,b)\r\r\n if a < b \r\r\n a / 2\r\r\n else\r\r\n \tb / 2\r\r\n end \r\r\nend", "def divide(first_parameter, second_parameter)\n (first_parameter / second_parameter).to_f\n end", "def divide(a, b)\n divide = a / b\n return divide\nend", "def calculate_bonus(int, bonus)\n if bonus\n p int / 2\n else\n p 0\n end\nend", "def round() end", "def / other\n other = Fraction.new(other) if other.instance_of? Fixnum\n self * other.inv\n end", "def modulo_of(fraction); end", "def calculate(integer, operator, integer1)\n\tif operator == \"+\"\n\t\tp integer + integer1\n\telsif operator == \"-\"\n\t\tp integer - integer1\n\telsif operator == \"*\"\n\t\tp integer * integer1\n\telsif operator == \"/\"\n\t\tp integer / integer1\n\telse\n\t\tp \"I'm sorry that's not a valid equation!\"\n\t\t\n\tend\nend", "def round\n end", "def Divide(val)\n self.value /= val\n end", "def determine_rest(number, unit)\n\tnumber - ((number / unit) * unit)\nend", "def floor() end", "def change(x)\n x /= 2.2\n puts \"#{x} kilos.\"\nend", "def div(p0) end", "def difficulty\n 1-correct.to_f/(correct+incorrect)\n end", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def arithmetic1 (n)\nn*5-20\nend", "def /(fixnum)\n Money.new(amount / fixnum, currency) \n end", "def double_integer(i)\r\n (i*2)\r\nend", "def arithmetic1(n)\r\r\n n * 5 - 20\r\r\nend", "def divide(num1, num2)\n\tresults = \"\"\n\tif num2 == 0\n\t\t\"False\"\n\telse\n\tresults = num1/num2\nend\n\n\t\t\t\n\t# if number == 0\n\t# \treturn \"Cant't divide a number by 0\"\n\t# else numbers.inject do |divedend, number|\n\t# quo = (divedend /= number).round(2)\n\n\n\t# end\n\n\t# if number.zero?\n # \treturn \"Cannot divide by 0!\"\n\t# else\n # \tquo\n\t# end\n\n\t\n\t# if number != 0 \n\t\t# \treturn quo\n\t# else \n\t\t# \treturn \"error\"\n\t# end\n\n\t# end\n\nend", "def potatoes(p0, w0, p1)\n # your code\n a = (129 / 100.to_f)\n a * 91\nend", "def convert( temp_in_farenheit)\n (temp_in_farenheit.to_f - 32) * 5/9\nend", "def test_Rational_InstanceMethods_fdiv\n\t\t# assert_equal(11/4, Rational(\"11/2\")/2)\n\t\tassert_equal(2.75, Rational(\"11/2\").fdiv(2))\n\tend", "def mathy(num)\n return (num*10) + 30\nend", "def /(value)\n arithmetic_op('/',self,value,false) unless value == 0\n end", "def /(other)\n\tself.num / other.num\nend", "def sanitize_interest(int)\n\t int < 1.0 ? int : (int / 100.0)\n end", "def divide(dividend:, divisor:)\n dividend / divisor\nend", "def divide(x,y)\n x / y\n end", "def p002rubynumbers\n\tputs 1 + 2\n\tputs 2 *3\n\tputs 3 / 2\n\tputs 10 - 11\n\tputs 1.5 / 2.6\nend", "def divide(x, y)\n if x == 0 || y == 0\n return \"We dont do math on zeros\"\n end\n\n x / y\nend", "def divide(num1, num2)\n if(num2 == 0)\n raise \"can not divide by 0 in this app\"\n end\n num1/num2\nend", "def divide a, b\n if b == 0\n return \"Division by zero is undefined.\"\n else\n return \"a / b = #{a/b}\"\n end\nend", "def divide(number1, number2)\n number2.zero? ? 'Erro! Divisão por zero não é possível' : number1 / number2\n end", "def solution(value)\n value.round(2)\nend", "def dec_remainder_of_two_floats(f_dividend, f_divisor)\n # your code goes here\n puts (f_divisor/f_dividend).round(1)\nend", "def /(n) self * 1.quo(n) end", "def division(first_number, second_number, third_number)\n# Conditional that removes divide by zero error\n\t\tif second_number == 0\n\tresult = \"You can't divide by zero\"\nelsif third_number == 0\n\tresult = \"You can't divide by zero\"\nelse\n\t\t\t\tif (first_number == \"\") || (second_number == \"\") || (third_number == \"\")\n\tnil\nelsif (first_number == []) || (second_number == []) || (third_number == [])\n\tnil\nelse\n\tresult = first_number / second_number / third_number\nend\nend\n\tresult\n\nend", "def safeDivide( top, bottom )\n if( (top == nil) or ( bottom == nil ) or ( bottom == 0.0 )) then\n return 0.0;\n end\n return top/bottom;\nend", "def mathy\n print \"what is the first number?\"\n first = gets.chomp.to_i\n\n print \"what is the second number\"\n second = gets.chomp.to_i\n\n puts \"\\n #{first} + #{second} = #{first + second}\\n\n #{first} - #{second} = #{first - second} \\n\n #{first} * #{second} = #{first * second} \\n\n #{first} / #{second} = #{first / second}\"\nend", "def /(value)\n value.respond_to?(:amount) ? (self.amount / value.convert_to(self.units).amount).to_f : self.class.new((self.amount / BigDecimal.new(value.to_s)), self.units)\n end", "def bagi(a1=10, a2=10)\n\ta1 / a2\nend", "def Division\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n if numero2 == 0\n puts \"\\nNo es posible dividir entre 0\"\n else\n puts \"\\nDivision: #{numero1 / numero2}\"\n end\n end" ]
[ "0.71012163", "0.71012163", "0.71012163", "0.6869738", "0.6840164", "0.67509156", "0.6730201", "0.6719234", "0.6633448", "0.6600493", "0.6586154", "0.65727", "0.65411144", "0.65374625", "0.6472743", "0.644004", "0.64253", "0.64150524", "0.6413298", "0.6397246", "0.6368068", "0.63637584", "0.63367873", "0.63308215", "0.6330695", "0.63244283", "0.63173246", "0.63074124", "0.6302156", "0.6302156", "0.6302156", "0.62935776", "0.6271154", "0.626919", "0.6257266", "0.6251267", "0.62406725", "0.6238503", "0.6212407", "0.61934817", "0.6160382", "0.6137494", "0.6137326", "0.6137142", "0.61080265", "0.61040634", "0.6101633", "0.61007965", "0.6099766", "0.60706604", "0.6067472", "0.6057173", "0.6050998", "0.6040317", "0.6034901", "0.6030507", "0.6026372", "0.6016239", "0.5992493", "0.5989541", "0.5980442", "0.597933", "0.597873", "0.5977287", "0.59758717", "0.597356", "0.5968828", "0.5965309", "0.59502417", "0.5937958", "0.59298587", "0.5914546", "0.59053737", "0.59049875", "0.59049153", "0.59037274", "0.58956003", "0.58942735", "0.5885824", "0.58662295", "0.58601964", "0.5858774", "0.5853448", "0.58501005", "0.5849919", "0.5845655", "0.5844946", "0.58352226", "0.58256876", "0.58227205", "0.58181846", "0.5817074", "0.58055973", "0.5792909", "0.57926494", "0.5788459", "0.57856286", "0.57848114", "0.578317", "0.5781269", "0.5780046" ]
0.0
-1
Configures the arguments for the command
def set_options(opts) @total_news = 25 opts.version = EndiFeed::VERSION opts.banner = <<MSG Usage: endifeed [options] [arguments] Description: EndiFeed, get the latest news from endi.com / El Nuevo Dia Newspaper. Options: MSG opts.set_program_name 'EndiFeed' opts.on('-n [total]', Integer, '--news', 'total of news to fetch') do |total| @total_news = total end opts.on_tail('-v', '--version', 'display the version of EndiFeed') do puts opts.version exit end opts.on_tail('-h', '--help', 'print this help') do puts opts.help exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_arguments (args)\n end", "def cmd(options={})\n arguments\n end", "def parse_arguments\n @command_line_options = {}\n @config.insert 0, '<command_line>', @command_line_options\n\n @options = OptionParser.new do |opts|\n opts.on('-a', '--application STRING', 'set application name') do |application|\n @command_line_options[:application] = application\n end\n\n opts.on('-d', '--destination DIR', 'set destination directory', \"default: #{@config[:destination_directory]}\") do |directory|\n @command_line_options[:destination_directory] = directory\n end\n\n opts.on('-n', '--dryrun', 'do not switch') do\n @command_line_options[:dryrun] = true\n end\n\n opts.on('-V', '--version STRING', 'set application version to deploy') do |version|\n @command_line_options[:version] = version\n end\n end\n @options.parse!\n end", "def configure_args\n @args = {}\n OptionParser.new do |opt|\n opt.on('-c', '--configure STRING', String) { |arg| push_arg_if_present( \"configure\", arg, \"boolean\") }\n opt.on('-d', '--deploy STRING', String) { |arg| push_arg_if_present( \"deploy\", arg, \"boolean\") }\n opt.on('-on', '--org_name STRING', String) { |arg| push_arg_if_present( \"org_name\", arg, \"string\") }\n opt.on('-od', '--org_desc STRING', String) { |arg| push_arg_if_present( \"org_desc\", arg, \"string\") }\n opt.on('-cd', '--contact_desc STRING', String) { |arg| push_arg_if_present( \"contact_desc\", arg, \"string\") }\n opt.on('-odo', '--org_domain STRING', String) { |arg| push_arg_if_present( \"org_domain\", arg, \"string\") }\n opt.on('-oe', '--org_email STRING', String) { |arg| push_arg_if_present( \"org_email\", arg, \"string\") }\n opt.on('-op', '--org_phone STRING', String) { |arg| push_arg_if_present( \"org_phone\", arg, \"string\") }\n opt.on('-of', '--org_facebook STRING', String) { |arg| push_arg_if_present( \"org_facebook\", arg, \"string\") }\n opt.on('-ot', '--org_twitter STRING', String) { |arg| push_arg_if_present( \"org_twitter\", arg, \"string\") }\n opt.on('-oi', '--org_instagram STRING', String) { |arg| push_arg_if_present( \"org_instagram\", arg, \"string\") }\n opt.on('-ow', '--org_website STRING', String) { |arg| push_arg_if_present( \"org_website\", arg, \"string\") }\n opt.on('-cp', '--color_primary STRING', String) { |arg| push_arg_if_present( \"color_primary\", arg, \"string\") }\n opt.on('-cs', '--color_secondary STRING', String) { |arg| push_arg_if_present( \"color_secondary\", arg, \"string\") }\n opt.on('-l', '--logo STRING', String) { |arg| push_arg_if_present( \"logo\", arg, \"string\") }\n opt.on('-lo', '--logo_option STRING', String) { |arg| push_arg_if_present( \"logo_option\", arg, \"string\") }\n opt.on('-su', '--smtp_username STRING', String) { |arg| push_arg_if_present( \"smtp_username\", arg, \"string\") }\n opt.on('-sp', '--smtp_password STRING', String) { |arg| push_arg_if_present( \"smtp_password\", arg, \"string\") }\n opt.on('-sa', '--smtp_address STRING', String) { |arg| push_arg_if_present( \"smtp_address\", arg, \"string\") }\n opt.on('-so', '--smtp_port STRING', String) { |arg| push_arg_if_present( \"smtp_port\", arg, \"integer\") }\n opt.on('-as', '--account_sid STRING', String) { |arg| push_arg_if_present( \"account_sid\", arg, \"string\") }\n opt.on('-at', '--auth_token STRING', String) { |arg| push_arg_if_present( \"auth_token\", arg, \"string\") }\n opt.on('-ae', '--admin_email STRING', String) { |arg| push_arg_if_present( \"admin_email\", arg, \"string\") }\n opt.on('-ap', '--admin_password STRING', String) { |arg| push_arg_if_present( \"admin_password\", arg, \"string\") }\n opt.on('-af', '--admin_first_name STRING', String) { |arg| push_arg_if_present( \"admin_first_name\", arg, \"string\") }\n opt.on('-al', '--admin_last_name STRING', String) { |arg| push_arg_if_present( \"admin_last_name\", arg, \"string\") }\n opt.on('-hc', '--heroku_command STRING', String) { |arg| push_arg_if_present( \"heroku_command\", arg, \"string\") }\n opt.on('-ha', '--heroku_app_name STRING', String) { |arg| push_arg_if_present( \"heroku_app_name\", arg, \"string\") }\n opt.on('-sn', '--form_name STRING', String) { |arg| push_arg_if_present( \"form_name\", arg, \"string\") }\n opt.on('-f', '--faq STRING', String) { |arg| push_arg_if_present( \"faq\", arg, \"yml\") }\n opt.on('-s', '--form STRING', String) { |arg| push_arg_if_present( \"form\", arg, \"yml\") }\n end.parse!\nend", "def args(argv)\n Docopt.docopt(docopt, version: @version, argv:argv)\n end", "def initialize(*arguments)\n options = arguments.extract_options!\n self.class.aggregated_properties.each do |arg|\n instance_variable_set(\"@#{arg}\", arguments.shift)\n end\n options.each do |arg, argv|\n instance_variable_set(\"@#{arg}\", argv)\n end\n end", "def set_arguments(*args)\n @arguments = Arguments.new\n add_arguments(*args)\n end", "def initialize_cmd_args(args, new_name_args)\n args = args.dup\n args.shift(2 + @name_args.length) \n cmd_args = new_name_args + args\n end", "def set_opts(args)\n @jar_args = \" #{args}\"\n end", "def configure_command(cmd)\n end", "def configure!(args)\n self.class.options.each do |name, opts|\n argv = args.detect{|k,v| (Array(opts[:aliases]) + Array(opts[:short]) + [name]).include?(k.to_sym)}\n argv = argv.last if argv\n argv ||= opts[:default]\n if(argv)\n check_type!(name, argv, opts[:type])\n self.send(\"#{name}=\", argv)\n else\n if(opts[:required])\n raise ArgumentError.new \"Missing required argument: #{name}\"\n end\n end\n end\n if(ipaddress && gateway.nil?)\n self.gateway = ipaddress.sub(%r{\\d+$}, '1')\n end\n end", "def initialize(args = [])\n self.args = args\n self.options = default_options\n extract_options!\n end", "def cli_args!(args)\n ChefBackup::Config.config = args\nend", "def initialize\n @argv_option = {}\n @config = {}\n end", "def command_arguments(options={})\n args = []\n args.concat(['--type', options[:type].to_s]) if options[:type]\n args.concat(['--line-break', options[:line_break].to_s]) if options[:line_break]\n args.concat(['--charset', options[:charset].to_s]) if options[:charset]\n\n if options[:type].to_s == 'js'\n args << '--nomunge' unless options[:munge]\n args << '--preserve-semi' if options[:preserve_semicolons]\n args << '--disable-optimizations' unless options[:optimize]\n end\n\n args\n end", "def parse_arguments\n @cmd_line_arguments = {}\n\n @options = OptionParser.new do |opt|\n opt.on('-C', '--change-dir DIR', 'Change working directory to DIR') do |directory|\n @cmd_line_arguments[:working_directory] = directory\n end\n\n opt.on('-d', '--debug', 'Debug mode') do\n @cmd_line_arguments[:debug] = true\n end\n\n opt.on('-e', '--environment NAME', 'set environment to NAME') do |environment|\n @cmd_line_arguments[:environment] = environment\n end\n\n opt.on('-G', '--generate-json', 'Generate json files, which are commited to api') do\n @cmd_line_arguments[:generate_json_file] = true\n @cmd_line_arguments[:action] ||= :generate\n end\n\n opt.on('--generate-report', 'Generate report csv in output directory') do\n @cmd_line_arguments[:generate_report] = true\n end\n\n opt.on('-g', '--group NAME[,NAME]', Array, 'set groups') do |groups|\n @cmd_line_arguments[:groups] ||= []\n @cmd_line_arguments[:groups] += groups\n end\n\n opt.on('-j', '--job JOB[,JOB,...]', Array, 'Limit action to JOB, which is a regexpression') do |jobs|\n @selected_jobs += jobs\n end\n\n opt.on('-l', '--list', 'List available jobs') do\n @cmd_line_arguments[:action] = :list\n end\n\n opt.on('-p', '--project NAME', 'set project') do |project|\n @cmd_line_arguments[:project] = project\n end\n\n opt.on('-o', '--output-directory DIR', 'generate json file into DIR directory', 'default: ' + @config.output_directory) do |directory|\n @cmd_line_arguments[:output_directory] = directory\n end\n\n opt.on('-q', '--quiet', 'be quiet') do\n @cmd_line_arguments[:quiet] = true\n end\n\n opt.on('-r', '--run', 'Run all configured jobs or all jobs passed with -j') do\n @cmd_line_arguments[:action] = :run\n end\n\n opt.on('-R', '--report', 'show report') do\n @cmd_line_arguments[:report] = true\n end\n\n opt.on('-s', '--save-response', 'save respone in output directory') do\n @cmd_line_arguments[:save_response] = true\n end\n\n opt.separator \"\n\n Examples:\n # List all available jobs\n #{File.basename $0} -l\n\n # List all available jobs in a specific directory\n #{File.basename $0} -C api-helper -p LISU -l\n\n # Run all configured jobs\n #{File.basename $0} -r\n\n # Run all configured jobs and show a report\n #{File.basename $0} -r --report\n\n # Run all configured jobs in a specific directory\n #{File.basename $0} -C api-helper -p LISU -r\n\n # Run Job_A and Job_B, which must configured in project.yml or group.yml\n #{File.basename $0} -r -j Job_A -j Job_B\n\n # Run all Jobs, which beginn with JOB\n #{File.basename $0} -r -j JOB.*\n\n # Run all Jobs, which contains with JOB\n #{File.basename $0} -r -j .*JOB.*\n\n # Generate json files, which are going to be requested, for all configured jobs\n #{File.basename $0} -G\n\n # Generate json file, which are going to be requested, for Job_A\n #{File.basename $0} -G -j Job_A\n\n # Run jobs for delti group and generate json files\n #{File.basename $0} -r -G -g delti\n\n Available template macros:\n\n Variables and Responses:\n response('<job_name>', '<name>') - return value from the response of a job (see examples)\n response('<job_name>', - return value from the response of a job in another group (must be run before)\n '<name>',\n group: '<group_name>')\n var('<name>', - return variable defined in Job in Vars section.\n default: nil, when default is set (not nil) and variable is undefined, return default\n ignore_error: false) when variable is undefined, do not throw an error\n\n Date and Time:\n now() - returns today (now) in seconds\n yesterday() - returns yesterday in iso8601\n time([<day_shift>[, format: <format>]]) - returns time in specificied format\n defaults: day_shift = 0, format = :seconds\n format:\n :seconds : return time in seconds\n :iso8601 : return timestamp in iso8601\n :iso8601utc : return timestamp in iso8601 (utc)\n\n Examples:\n # get variable test\n var('test')\n\n # get value pdfToken from register response\n response('Delti_Create_DE', 'pdfToken')\n\n # get value pdfToken from register response, where job name is defined as variable in cancel job\n response(var('CreateJob'), 'pdfToken')\n\n # get value token from GenerateToken response in group auth\n response('GenerateToken', 'token', group: 'auth')\n\n # return time of today in seconds\n time()\n\n # return timestamp of today in iso8601\n time(format: :iso8601)\n\n # return timestamp of yesterday in iso8601\n time(-1, format: :iso8601)\n\n # return timestamp of last year in iso8601\n time(-365, format: :iso8601)\n\n # return timestamp of tomorrow in iso8601\n time(1, format: :iso8601)\n\n # return credential\n credential('PROJECT_NAME_username')\n\n # return basic auth header value\n basicauth('PROJECT_NAME_username', 'PROJECT_NAME_password')\n \"\n end\n @options.parse!\n\n @config.insert 0, '<command_line>', @cmd_line_arguments\n\n unless File.directory?(@config.output_directory)\n Dir.mkdir @config.output_directory\n end\n\n Dir.chdir @config.working_directory\n end", "def initialize(given_args=ARGV)\n @options, @arguments, @extras = self.class.parse_options!(given_args)\n end", "def command_setup(args)\n setup(args)\n end", "def initialize(args=[], options={}, config={})\n super\n @options = @options.dup\n end", "def initialize(**args)\n super(command: self.class.command.new(args), executed: [])\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # url of the city database\n city_db_url = OpenStudio::Measure::OSArgument.makeStringArgument('city_db_url', true)\n city_db_url.setDisplayName('City Database Url')\n city_db_url.setDescription('Url of the City Database')\n city_db_url.setDefaultValue('')\n args << city_db_url\n\n # project id to update\n project_id = OpenStudio::Measure::OSArgument.makeStringArgument('project_id', true)\n project_id.setDisplayName('Project ID')\n project_id.setDescription('Project ID to generate reports for.')\n project_id.setDefaultValue('0')\n args << project_id\n\n # datapoint id to update\n datapoint_id = OpenStudio::Measure::OSArgument.makeStringArgument('datapoint_id', true)\n datapoint_id.setDisplayName('Datapoint ID')\n datapoint_id.setDescription('Datapoint ID to generate reports for.')\n datapoint_id.setDefaultValue('0')\n args << datapoint_id\n\n return args\n end", "def initialize(parsed_arguments)\n @command = parsed_arguments[:command]\n @options = parsed_arguments[:options]\n @arguments = parsed_arguments[:arguments]\n end", "def initialize(argv = [])\n @arguments ||= argv\n end", "def setup_options\n parser = OptionParser.new do |o|\n o.banner = 'Usage: bundle exec qpush-server [options]'\n\n o.on('-c', '--config PATH', 'Load PATH for config file') do |arg|\n load(arg)\n Server.log.info(\"* Server config: #{arg}\")\n end\n\n o.on('-h', '--help', 'Prints this help') { puts o && exit }\n end\n parser.parse!(@argv)\n end", "def to_args\n args = [\n \"--name \\\"#{name}\\\"\",\n \"--version \\\"#{version}\\\"\",\n \"--user \\\"#{user}\\\"\",\n \"--group \\\"#{group}\\\"\",\n \"--iteration \\\"#{iteration}\\\"\",\n \"--homepage \\\"#{homepage}\\\"\",\n \"--home \\\"#{home}\\\"\",\n \"--architecture \\\"#{architecture}\\\"\",\n \"--description \\\"#{description}\\\"\",\n \"--maintainer \\\"#{maintainer}\\\"\",\n \"--vendor \\\"#{vendor}\\\"\"\n ]\n args.push \"--dependencies #{dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless dependencies.nil? || dependencies.empty?\n args.push \"--build-dependencies #{build_dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless build_dependencies.nil? || build_dependencies.empty?\n args.push \"--compile-cache-dir \\\"#{compile_cache_dir}\\\"\" unless compile_cache_dir.nil? || compile_cache_dir.empty?\n args.push \"--before-precompile \\\"#{before_precompile}\\\"\" unless before_precompile.nil? || before_precompile.empty?\n args.push \"--after-precompile \\\"#{after_precompile}\\\"\" unless after_precompile.nil? || after_precompile.empty?\n args.push \"--before-install \\\"#{before_install}\\\"\" unless before_install.nil? || before_install.empty?\n args.push \"--after-install \\\"#{after_install}\\\"\" unless after_install.nil? || after_install.empty?\n args.push \"--before-remove \\\"#{before_remove}\\\"\" unless before_remove.nil? || before_remove.empty?\n args.push \"--after-remove \\\"#{after_remove}\\\"\" unless after_remove.nil? || after_remove.empty?\n\n args.push \"--license \\\"#{license}\\\"\" unless license.nil? || license.empty?\n args.push \"--buildpack \\\"#{buildpack}\\\"\" unless buildpack.nil? || buildpack.empty?\n args.push \"--buildpack_list \\\"#{buildpack_list}\\\"\" unless buildpack_list.nil? || buildpack_list.empty?\n args.push \"--force-os \\\"#{force_os}\\\"\" unless force_os.nil? || force_os.empty?\n args.push \"--runner \\\"#{runner}\\\"\" unless runner.nil? || runner.empty?\n args.push \"--logrotate-frequency \\\"#{logrotate_frequency}\\\"\" unless logrotate_frequency.nil? || logrotate_frequency.empty?\n args.push \"--logrotate-backlog \\\"#{logrotate_backlog}\\\"\" unless logrotate_backlog.nil?\n args.push \"--env #{env.variables.map{|v| \"\\\"#{v}\\\"\"}.join(\" \")}\" if env.present?\n args.push \"--auto\" if auto\n args.push \"--verbose\" if verbose\n args.push \"--store-cache\" if store_cache\n args.push \"--debug\" if debug\n args.push \"--verify\" if verify\n args.push \"--no-clean\" if !clean\n args.push \"--no-edge\" if !edge\n args.push \"--tmpdir\" if !tmpdir\n args\n end", "def command_options(arg=nil)\n @command_options ||= default_options(match)\n @command_options.merge!(arg) if arg\n @command_options\n end", "def commander _args\n \"commander _args;\" \n end", "def process_argv!\n super\n if raw_script_name =~ /(\\w+)-([\\w\\-]+)/\n self.command = $2\n else\n self.command = rest.shift\n end\n end", "def arguments=(value)\n @arguments = value.to_s.strip # TODO: Parse\n end", "def moped_arguments\n [hosts, options]\n end", "def options_arguments\n @options_arguments ||= Launchr::OrderedHash.new\n @options_arguments\n end", "def args(args = [])\n args << \"--out=#{::File.basename(r.path)}\"\n args << \"--dir=#{::File.dirname(r.path)}\"\n args << \"--checksum=sha-256=#{r.checksum}\" if r.checksum\n args << \"--header='#{r.header}'\" if r.header\n args << \"--check-certificate=#{r.check_cert}\"\n args << \"--file-allocation=falloc\"\n args << \"--max-connection-per-server=#{r.connections}\"\n args << r.source\n end", "def parse_arguments\n OptionParser.new do |parser|\n # parser.banner = \"Usage: init.rb -c <integer>\"\n parser.on(\"-c\", \"--count COUNT\", Integer, \"Specify number of uuid's to generate\") do |c|\n @options[:count] = c\n end\n parser.on(\"-f\", \"--file FILE\", \"Specify path to save csv file example -f '/path/to/file.csv'\") do |path|\n @options[:path] = path\n end\n end.parse!\n end", "def arguments command\n @@auto_completion_arguments[command]\n end", "def initialize(*args)\n super\n\n @config = @bot.config\n @db = @config.db\n @keywords = eval(\"/#{@config.keywords.join(\"|\")}/i\")\n @passwd = config['command']['password'] ||\n Digest::SHA1.hexdigest(\"impersonate!\")\n @users = []\n end", "def parse_options!(args)\n option_parser.parse!(args)\n\n if args.empty?\n abort(\"You must give exactly one command to execute.\")\n else\n @options.command = args.join(\" \")\n end\n end", "def configure_with_args(args)\n args.select { |k,v| DEFAULT_CONFIGURATION_OPTIONS.keys.include?(k) }.each do |key,val|\n instance_variable_set \"@#{key.to_s}\", val\n end\n end", "def configure_with_args(args)\n args.select { |k,v| DEFAULT_CONFIGURATION_OPTIONS.keys.include?(k) }.each do |key,val|\n instance_variable_set \"@#{key.to_s}\", val\n end\n end", "def add_default_command_options(options)\n defaults = self[:default_run_options]\n options = defaults.merge(options)\n\n env = self[:default_environment]\n env = env.merge(options[:env]) if options[:env]\n options[:env] = env unless env.empty?\n\n shell = options[:shell] || self[:default_shell]\n options[:shell] = shell unless shell.nil?\n\n options\n end", "def initialize(*args)\n return self if args.empty?\n parsed_args = args.first.is_a?(Hash) ? args.first : parse_string_args(args)\n\n self.executable = parsed_args[:executable]\n self.arguments = parsed_args[:arguments]\n end", "def spawn_args\n result = Array.new\n unless environment.empty?\n result << environment\n end\n result.concat(command_line)\n opts = Hash.new\n opts[:chdir] = directory.to_s unless directory.nil?\n opts[:pgroup] = pgroup unless pgroup.nil?\n opts[:umask] = umask unless umask.nil?\n opts[:unsetenv_others] = unsetenv_others unless unsetenv_others.nil?\n opts[:close_others] = close_others unless close_others.nil?\n rlimit.each do |key, value|\n opts[\"rlimit_#{key}\".to_sym] = value\n end\n redirection.each do |key, value|\n opts[key] = value\n end\n result << opts\n result\n end", "def args\n Mysh.parse_args(cooked_body)\n end", "def effectiveCommander _args\n \"effectiveCommander _args;\" \n end", "def options\n @options ||= args.dig(:options) || {}\n end", "def initialize(args = {})\n parse_args(args)\n end", "def process_arguments\n @e_addr = @options.email\n @r_name = @options.run_names\n @m_name = @options.machine_names\n @action = @options.action\n @snfs = @options.snfs\n end", "def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end", "def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end", "def initialize(argv=[])\n super()\n #@text = Text.new(STDOUT, STDERR, STDIN, config)\n @text ||= Megam::Text.new(STDOUT, STDERR, STDIN, config)\n command_name_words = self.class.snake_case_name.split('_')\n\n # Mixlib::CLI ignores the embedded name_args\n\n @name_args = parse_options(argv)\n\n @name_args.delete(command_name_words.join('-'))\n\n @name_args.reject! { |name_arg| command_name_words.delete(name_arg) }\n\n # meg node run_list add requires that we have extra logic to handle\n # the case that command name words could be joined by an underscore :/\n command_name_words = command_name_words.join('_')\n @name_args.reject! { |name_arg| command_name_words == name_arg }\n if config[:help]\n msg opt_parser\n exit 1\n end\n\n # copy Mixlib::CLI over so that it cab be configured in meg.rb\n # config file\n Meggy::Config[:verbosity] = config[:verbosity]\n end", "def args (configLoc)\n conf = File.dirname(__FILE__) + \"/#{configLoc}\"\n args = Array.new\n args << \"--private_token=#{ENV['TOKEN']}\"\n args << \"--config=#{conf}\"\n return args\n end", "def initialize(args)\n @options = args.last.is_a?(::Hash) ? args.pop : {}\n super(args.flatten)\n end", "def initialize(argv = [])\n super() # having to call super in initialize is the most annoying anti-pattern :(\n @ui = Chef::Knife::UI.new(STDOUT, STDERR, STDIN, config)\n\n command_name_words = self.class.snake_case_name.split(\"_\")\n\n # Mixlib::CLI ignores the embedded name_args\n @name_args = parse_options(argv)\n @name_args.delete(command_name_words.join(\"-\"))\n @name_args.reject! { |name_arg| command_name_words.delete(name_arg) }\n\n # knife node run_list add requires that we have extra logic to handle\n # the case that command name words could be joined by an underscore :/\n command_name_joined = command_name_words.join(\"_\")\n @name_args.reject! { |name_arg| command_name_joined == name_arg }\n\n # Similar handling for hyphens.\n command_name_joined = command_name_words.join(\"-\")\n @name_args.reject! { |name_arg| command_name_joined == name_arg }\n\n if config[:help]\n msg opt_parser\n exit 1\n end\n\n # Grab a copy before config merge occurs, so that we can later identify\n # where a given config value is sourced from.\n @original_config = config.dup\n\n # copy Mixlib::CLI over so that it can be configured in config.rb/knife.rb\n # config file\n Chef::Config[:verbosity] = config[:verbosity] if config[:verbosity]\n end", "def arguments\n @arguments ||= Launchr::OrderedHash.new\n @arguments\n end", "def initialize(*args)\n raise ArgumentError, \"Must pass arguments to Command.new\" if args.empty?\n @options = default_options.merge(args.extract_options!)\n @command = sanitize_command(args.shift)\n @args = args\n @options.symbolize_keys!\n @stdout, @stderr, @full_stdout, @full_stderr = String.new, String.new, String.new, String.new\n @uuid = Digest::SHA1.hexdigest(SecureRandom.random_bytes(10))[0..7]\n end", "def x_set_command_options(context)\n defaults = { uuid: false }\n defaults.merge!(dry_run: true) if context.options.key?(:dry_run)\n defaults\n end", "def parse_args(args, kwargs)\n return unless self.class.Args\n command_args = self.class.Args.new(self, *args, **kwargs)\n command_args.validate\n command_args\n end", "def arguments\n @args ||= {}\n unless @args.size > 0\n ARGV.each_with_index do |arg, index|\n if arg.start_with?('-')\n if index + 1 < ARGV.size\n next_arg = ARGV[index + 1]\n if next_arg.start_with?('-') then\n @args.update(argument_present_or_direct(arg))\n else\n @args.update(arg => next_arg)\n end\n else\n @args.update(argument_present_or_direct(arg))\n end\n end\n end\n end\n @args\n end", "def parse_cmd_arguments( args ) # {{{\n\n original_args = args.dup\n options = OpenStruct.new\n\n # Define default options\n options.verbose = false\n options.colorize = false\n options.process = []\n options.sources = []\n options.debug = false\n options.db_path = \"data/databases/test.sqlite3\"\n options.db_type = \"sqlite3\"\n options.read = false\n options.automatic = false\n options.interval = 3600 # update normally only every hour\n options.rate = false\n options.username = \"\"\n options.manual_input = false\n options.joke_count = false\n options.random_intervals = false\n options.random_interval_time = 25\n\n pristine_options = options.dup\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{__FILE__.to_s} [options]\"\n\n opts.separator \"\"\n opts.separator \"General options:\"\n\n opts.on(\"-d\", \"--db-path PATH\", \"Use the database which can be found in PATH\") do |d|\n options.db_path = d\n end\n\n opts.on(\"-t\", \"--db-type TYPE\", \"Use the database of class TYPE (e.g. sqlite3)\") do |t|\n options.db_type = t\n end\n\n opts.on(\"-r\", \"--read\", \"Read jokes that are stored in the DB\") do |r|\n options.read = r\n end\n\n opts.on(\"-r\", \"--rate\", \"Rate jokes that are stored in the DB for user account\") do |r|\n options.rate = r\n end\n\n opts.on(\"-u\", \"--username OPT\", \"Use username OPT\") do |u|\n options.username = u\n end\n\n opts.on(\"-m\", \"--manual-input\", \"Input a joke manually to the Database\") do |m|\n options.manual_input = m\n end\n\n opts.on(\"-j\", \"--joke-count\", \"Count how many jokes we have in the Database\") do |j|\n options.joke_count = j\n end\n\n opts.on(\"-r\", \"--random-intervals\", \"Use random intervals when downloading to mask our usage pattern\") do |r|\n options.random_intervals = r\n end\n\n opts.separator \"\"\n opts.separator \"Specific options:\"\n\n # Boolean switch.\n opts.on(\"-a\", \"--automatic\", \"Run automatically every #{options.interval.to_s} seconds unless the --interval option is given\") do |a|\n options.automatic = a\n end\n\n opts.on(\"-i\", \"--interval OPT\", \"Run every OPT seconds (works only with --automatic together)\") do |i|\n options.interval = i.to_i\n end\n\n # Set of arguments\n opts.on(\"-p\", \"--process OPT\", @configurations, \"Process one or more detected configuration (OPT: #{ @configurations.sort.join(', ') })\" ) do |d|\n options.process << d\n end\n\n # Set of arguments\n opts.on(\"-s\", \"--sources OPT\", @configurations, \"Use only these sources for read and rate (OPT: #{ @configurations.sort.join(', ') })\" ) do |d|\n options.sources << d\n end\n\n # Boolean switch.\n opts.on(\"-v\", \"--verbose\", \"Run verbosely\") do |v|\n options.verbose = v\n end\n\n opts.on(\"-d\", \"--debug\", \"Run in debug mode\") do |d|\n options.debug = d\n end\n\n # Boolean switch.\n opts.on(\"-q\", \"--quiet\", \"Run quietly, don't output much\") do |v|\n options.verbose = v\n end\n\n opts.separator \"\"\n opts.separator \"Common options:\"\n\n # Boolean switch.\n opts.on(\"-c\", \"--colorize\", \"Colorizes the output of the script for easier reading\") do |c|\n options.colorize = c\n end\n\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n puts opts\n exit\n end\n\n # Another typical switch to print the version.\n opts.on_tail(\"--version\", \"Show version\") do\n puts `git describe --tags`\n exit\n end\n end\n\n opts.parse!(args)\n\n # Show opts if we have no cmd arguments\n if( original_args.empty? )\n puts opts\n exit\n end\n\n options\n end", "def get_args( from: '', required: false, default_value: [], comment: '' )\n cmd_options = @options['command_line_options'][from]\n # Auto documentation of this option\n @doc.push \"Option to pass arguments from: #{from},\\tdefault_value :#{default_value},\\tcomment :#{comment}\"\n if cmd_options.class == Array\n cmd_options = cmd_options.join ' '\n cmd_options = \"\\\"#{cmd_options}\\\"\" # return with quotes\n else\n @errors.push \" Arguments option #{from} should be an Array. #{cmd_options.class} found\"\n end\n end", "def argv=(args)\n puts \"setting argv to #{args.inspect}\"\n eval \"opal.runtime.cs(opal.runtime.Object, 'ARGV', #{args.inspect});\"\n end", "def optparse_args\n if short\n [\"--#{name}\", \"-#{short}\", desc, :REQUIRED]\n else\n [\"--#{name}\", desc, :REQUIRED]\n end\n end", "def initialize(argv = [])\n @arguments ||= argv\n @theme ||= cli.ec2_tag_theme\n @host ||= cli.host\n @domain ||= cli.domain\n end", "def arguments\n tailing_args = tailing_non_options\n\n if tailing_args.any? { |arg| arg[0,1] == '-' }\n tailing_args.unshift('--')\n end\n\n return leading_non_options + options + tailing_args\n end", "def initialize(args=ARGV)\n @args = args\n end", "def arguments\n parser.arguments\n end", "def generate_create_cli_arguments(options)\n options.map do |key, value|\n # If value is false, option is not set\n next if value.to_s == \"false\"\n # If value is true, consider feature flag with no value\n opt = value.to_s == \"true\" ? [] : [value]\n opt.unshift(\"--#{key.to_s.tr(\"_\", \"-\")}\")\n end.flatten.compact\n end", "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "def prep_args(*args)\n args = args.flatten.compact\n args = args.first.to_s.split(/\\s+/) if args.size == 1\n cmd = sudo? ? :sudo : args.shift\n \n # Symbols to switches. :l -> -l, :help -> --help\n args.collect! do |a|\n if a.is_a?(Symbol)\n a = (a.to_s.size == 1) ? \"-#{a}\" : a.to_s\n end\n a\n end\n [cmd, args]\n end", "def arguments\n \"\"\n end", "def parse_command_line_args(args)\n opts = OptionParser.new do |opts|\n opts.banner = 'Usage: tbibtools [OPTIONS] [FILES] < IN > OUT'\n opts.separator ''\n opts.separator 'tbibtools is a free software with ABSOLUTELY NO WARRANTY under'\n opts.separator 'the terms of the GNU General Public License version 2 or newer.'\n opts.separator ''\n \n opts.on('-c', '--config=FILE', String, 'Configuration file') do |value|\n @configuration.config value\n end\n\n opts.on('-e', '--regexp=REGEXP', String, 'Display entries matching the regexp') do |value|\n @configuration.filter Regexp.new(value)\n end\n\n opts.on('-f', '--format=STRING', String, 'Re-format entries (order matters)') do |value|\n @configuration.format *value.split(/,/)\n end\n\n opts.on('--[no-]formatted', 'Unformatted output') do |bool|\n unless bool\n @configuration.entry_format = []\n @configuration.entry_format_default = []\n end\n end\n\n opts.on('-i', '--[no-]case-sensitive', 'Case insensitive') do |bool|\n @configuration.sort_case bool\n end\n \n opts.on('-l', '--format-list=[STRING]', String, 'Format string for list (implies --ls)') do |value|\n @configuration.shortcut_ls\n @configuration.list_format value if value\n end\n\n opts.on('--ls', 'Synonym for: -f list,stripPrelude (\"list\" implies \"unwrap\")') do |bool|\n @configuration.shortcut_ls if bool\n end\n\n opts.on('-o', '--output=FILE', String, 'Output file') do |value|\n @configuration.output value\n end\n\n opts.on('-P', '--strip-prelude', 'Strip the prelude: same as -f stripPrelude but helps to maintain the original formatting') do |bool|\n @configuration.strip_prelude\n end\n\n opts.on('-q', '--query=FIELD=REGEXP', String, 'Show entries for which field matches the regexp') do |value|\n field, rx = value.split(/=/, 2)\n @configuration.query field => Regexp.new(rx, Regexp::IGNORECASE)\n end\n\n opts.on('-s', '--sort=STRING', String, 'Sort (default: sort by key; key = _id, type = _type)') do |value|\n @configuration.sort_key value\n end\n\n opts.on('-S', '--[no-]expand-strings', 'Replace/expand strings') do |bool|\n @configuration.expand_strings bool\n end\n\n opts.on('--strip=FIELDS', String, 'Ignore/strip fields') do |value|\n @configuration.strip value.split(/,/)\n end\n\n opts.on('-u', '--unsorted', 'Unsorted output') do |bool|\n @configuration.sort_key nil\n end\n\n opts.separator ''\n opts.separator 'Other Options:'\n \n opts.on('--debug', Integer, 'Show debug messages') do |v|\n $DEBUG = true\n $VERBOSE = true\n end\n \n opts.on('-v', '--verbose', 'Run verbosely') do |v|\n $VERBOSE = true\n end\n \n opts.on('-h', '--help', 'Show this message') do\n puts opts\n exit 1\n end\n\n opts.separator ''\n opts.separator 'Available formats:'\n format_rx = /^(format|preprocess|head|body|tail)_/\n format_names = (['nnIsYear', 'sortCrossref', 'downcaseType', 'upcaseType'] + \n @configuration.methods.find_all{|m| m =~ format_rx}.collect{|m| m.sub(format_rx, '')}).uniq.sort.join(', ')\n opts.separator format_names\n\n opts.separator ''\n opts.separator 'Known format shortcuts:'\n acc = []\n @configuration.methods.find_all{|m| m =~ /^shortcut_/}.sort.each do |meth|\n fn = meth.sub(/^shortcut_/, '')\n fs = @configuration.send(meth, acc)\n opts.separator \"#{fn}: #{fs.join(',')}\"\n end\n end\n @configuration.input *opts.parse!(args)\n self\n end", "def initialize(argv)\n @options = {\n :command => 'execute',\n :rpcname => nil,\n :verbose => false\n }\n @argv = argv.clone\n if @argv.first =~ /^[a-z0-9][a-z0-9_-]*$/i\n self.options[:command] = @argv.shift\n end\n if @argv.first =~ /^[a-z0-9_-]+\\.[a-z0-9_\\.-]+$/i\n self.options[:rpcname] = @argv.shift\n end\n end", "def command_line_params\n params = \"\"\n\n # Disallow password auth. We need to fail if no trusted key is set up.\n params += \"-o PasswordAuthentication=no \"\n\n # Disallow other keyoard-interactive auth methods.\n params += \"-o ChallengeResponseAuthentication=no \"\n\n # Automatically add unknown hosts to the \"known hosts\" file, without prompting.\n params += \"-o StrictHostKeyChecking=no \"\n\n # Also silence warnings since StrictHostKeyChecking=no always issues a warning\n params += \"-o LogLevel=ERROR \"\n\n if !@fail_on_host_changes\n # Ignore when the signature of a host changes. This usually happens when a machine is upgraded,\n # but could also happen due to man-in-the-middle attacks.\n params += \"-o UserKnownHostsFile=/dev/null \"\n end\n\n params\n end", "def java_args=(args)\n Buildr.application.deprecated \"Use ENV['JAVA_OPTS'] instead\"\n ENV['JAVA_OPTS'] = Array(args).join(' ')\n end", "def add_build_options(c)\n c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'\n c.option 'future', '--future', 'Publishes posts with a future date'\n c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'\n c.option 'watch', '-w', '--watch', 'Watch for changes and rebuild'\n c.option 'force_polling', '--force_polling', 'Force watch to use polling'\n c.option 'lsi', '--lsi', 'Use LSI for improved related posts'\n c.option 'show_drafts', '-D', '--drafts', 'Render posts in the _drafts folder'\n c.option 'unpublished', '--unpublished', 'Render posts that were marked as unpublished'\n c.option 'quiet', '-q', '--quiet', 'Silence output.'\n c.option 'verbose', '-V', '--verbose', 'Print verbose output.'\n end", "def parse_args\r\n if(cmd.args =~ /\\=/)\r\n self.names = InputFormatter.titlecase_arg(cmd.args.before(\"=\"))\r\n self.action_args = cmd.args.after(\"=\")\r\n elseif (cmd.args && one_word_command)\r\n self.names = InputFormatter.titlecase_arg(cmd.args)\r\n self.action_args = \"\"\r\n else\r\n self.names = enactor.name\r\n self.action_args = cmd.args\r\n end\r\n\r\n self.names = self.names ? self.names.split(/[ ,]/) : nil\r\n\r\n self.combat_command = cmd.switch ? cmd.switch.downcase : nil\r\n end", "def parse_command_line(args)\n all_opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{PROGRAM_NAME} [OPTIONS] PASSWORD\"\n opts.separator ''\n\n opts.on(\n '-t',\n '--load-timeout [TIMEOUT_SECONDS]',\n Integer,\n 'Timeout in seconds to wait for',\n 'gitlab-rails console to load',\n 'and process the change.',\n \"Defaults to #{DEFAULT_LOAD_TIMEOUT} seconds.\"\n ) do |timeout|\n @options.load_timeout = timeout\n end\n\n opts.on(\n '-v',\n '--verbose',\n 'Print out debug info when processing.'\n ) do\n @options.debug = true\n end\n\n opts.on(\n '-h',\n '--help',\n 'Help Message'\n ) do\n puts opts\n @options.help_requested = true\n end\n end\n\n all_opts.parse!(args)\n\n unless @options.help_requested\n fail('ERROR: You must specify the password to set') if (ARGV.length < 1)\n\n @options.password = ARGV[0]\n fail('ERROR: Password cannot be empty') if @options.password.strip.empty?\n end\n end", "def setup\n begin\n @options = OptParser.parse(ARGV)\n rescue ParserExceptions::MissingArgument\n exit(1)\n end\n\n end", "def manage_args(*args)\n end", "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end", "def initialize(argv=ARGV)\n @options = {}\n end", "def arguments\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n # URL of the DEnCity server that will be posted to\n hostname = OpenStudio::Ruleset::OSArgument::makeStringArgument('hostname', true)\n hostname.setDisplayName('URL of the DEnCity Server')\n hostname.setDefaultValue('http://www.dencity.org')\n args << hostname\n\n # DEnCity server user id at hostname\n user_id = OpenStudio::Ruleset::OSArgument::makeStringArgument('user_id',true)\n user_id.setDisplayName('User ID for DEnCity Server')\n args << user_id\n\n # DEnCIty server user id's password\n auth_code = OpenStudio::Ruleset::OSArgument::makeStringArgument('auth_code', true)\n auth_code.setDisplayName('Authentication code for User ID on DEnCity server')\n args << auth_code\n\n # Building type for DEnCity's metadata\n building_type = OpenStudio::Ruleset::OSArgument::makeStringArgument('building_type', false)\n building_type.setDisplayName('Building type')\n args << building_type\n\n # HVAC system for DEnCity's metadata\n primary_hvac = OpenStudio::Ruleset::OSArgument::makeStringArgument('primary_hvac', false)\n primary_hvac.setDisplayName('Primary HVAC system in building')\n args << primary_hvac\n\n args\n\n end", "def initialize_argument_list\n args = ArgumentList.new\n args.x = args.y = args.width = args.height = 0\n args.text = ''\n args.options = {}\n\n args\nend", "def args\n raw_args\n end", "def initialize\n require 'bcrypt'\n super\n\n @options.banner = \"Usage: #{__FILE__} goals [options]\"\n @options.on('-i', '--interactive', \"Updates display in real-time\") do |o|\n @interactive = true\n end\n end", "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end", "def set_from_args(options)\n assign(options)\n rescue ConfigError => e\n alert_logger.warn format(\n 'Failed to configure from arguments: %s',\n e.message\n )\n end", "def args()\n #This is a stub, used for indexing\n end", "def initialize(args)\n\t\t\t\t# Initialize types\n\t\t\t\t@@valid_types = {bool: [], string: [String, \"\"], int: [Integer, 0], float: [Float, 0.0], choice: [String, \"\"], list: [Array, []], action: []}\n\n\t\t\t\t# Copy arguments\n\t\t\t\t@app_name = args[:name]\n\t\t\t\t@app_version = args[:version]\n\t\t\t\t@description = args[:description]\n\t\t\t\t@usage = args[:usage]\n\n\t\t\t\t# Copy messages\n\t\t\t\tmessages = args[:messages] || {}\n\t\t\t\tif messages.is_a?(Hash) then\n\t\t\t\t\t@messages = messages\n\t\t\t\telse\n\t\t\t\t\[email protected](msg: \"CowtechLib::OptionParser::initialize msgs argument must be an hash.\")\n\t\t\t\tend\n\n\t\t\t\t# Initialize variables\n\t\t\t\t@console = Console.new\n\t\t\t\t@inserted = {name: [], short: [], long: []}\n\t\t\t\t@options = {}\n\t\t\t\t@options_map = {}\n\t\t\t\t@args = []\n\t\t\t\t@cmdline = ARGV.clone\n\n\t\t\t\tself << {name: \"help\", short: \"-h\", long: \"--help\", type: :bool, help: \"Show this message.\", priority: 1000}\n\t\t\tend", "def parse\n # Parse all arguments first\n option_parser.parse!(arguments)\n\n # Get the first argument, this is our command\n cmd = arguments.pop\n raise OptionParser::MissingArgument, 'command' unless cmd\n\n # Set the command if it's present\n options.command = cmd.to_sym\n end", "def initialize(cmd, args=[], env={})\n @command, @arguments, @environment = cmd, Array(args), env\n @stdout, @stderr = \"\", \"\"\n end", "def initialize_config(args = {})\n Localeapp.configure # load defaults\n load_config_file\n set_command_line_arguments(args)\n end", "def initialize(*args)\n @options = Launchr::OrderedHash.new\n @arguments = Launchr::OrderedHash.new\n @options_arguments = Launchr::OrderedHash.new\n @config = Hash.new\n @filtered_argv = []\n \n # Set the banner\n @banner = self.class.banner\n @header = self.class.header\n @footer = self.class.footer\n\n @summary_indent = self.class.summary_indent\n @summary_width = self.class.summary_width\n @spaced_summary = self.class.spaced_summary\n \n # Dupe the class options for this instance\n klass_options = self.class.options\n klass_options.keys.inject(@options) { |memo, key| memo[key] = klass_options[key].dup; memo }\n\n # Dupe the class arguments for this instance\n klass_arguments = self.class.arguments\n klass_arguments.keys.inject(@arguments) { |memo, key| memo[key] = klass_arguments[key].dup; memo }\n\n # Dupe the class arguments for this instance\n klass_options_arguments = self.class.options_arguments\n klass_options_arguments.keys.inject(@options_arguments) { |memo, key| memo[key] = klass_options_arguments[key].dup; memo }\n \n # check argument and option :name keys dont conflict\n name_collision = klass_options.keys & klass_arguments.keys\n raise ArgumentError, \"An option cannot have the same name as an argument: #{name_collision.join(', ')}\" unless name_collision.empty?\n\n koso, kolo = [], []\n klass_options.each do |name, kargs|\n koso << (kargs[:short_strip] || \"\")\n kolo << (kargs[:long_strip] || \"\")\n end\n \n kasa, kala = [], []\n klass_arguments.each do |name, kargs|\n kasa << (kargs[:short_strip] || \"\")\n kala << (kargs[:long_strip] || \"\")\n end\n\n # Check that argument an option --long switches dont conflict\n loa_collision = kolo & kala - [\"\"]\n opt_name = klass_options.keys[kolo.index(loa_collision.first) || 0]\n arg_name = klass_arguments.keys[kala.index(loa_collision.first) || 0]\n raise ArgumentError, \"Collision: switch '#{loa_collision.first}' for option(#{opt_name.inspect}) and argument(#{arg_name.inspect}) cannot be the same\" unless loa_collision.empty?\n\n # Check that argument an option -s short switches dont conflict\n soa_collision = koso & kasa - [\"\"]\n opt_name = klass_options.keys[kolo.index(soa_collision.first) || 0]\n arg_name = klass_arguments.keys[kala.index(soa_collision.first) || 0]\n raise ArgumentError, \"Collision: switch '#{soa_collision.first}' for option(#{opt_name.inspect}) and argument(#{arg_name.inspect}) cannot be the same\" unless soa_collision.empty?\n \n # Set the default configuration values for this instance\n @options.each do |config_key, config_opts|\n config_opts[:on] ||= :on\n config_opts[:boolean] ||= false\n config_opts[:requires] ||= nil\n config_opts[:proc] ||= nil\n config_opts[:show_options] ||= false\n config_opts[:exit] ||= nil\n \n if config_opts.has_key?(:default)\n @config[config_key] = config_opts[:default]\n end\n end\n\n @arguments.each do |config_key, config_opts|\n config_opts[:on] ||= :on\n config_opts[:boolean] ||= false\n config_opts[:requires] ||= nil\n config_opts[:proc] ||= nil\n config_opts[:show_options] ||= false\n config_opts[:exit] ||= nil\n \n if config_opts.has_key?(:default)\n @config[config_key] = config_opts[:default]\n end\n end\n\n @options_arguments.each do |config_key, config_opts|\n config_opts[:on] ||= :on\n config_opts[:boolean] ||= false\n config_opts[:requires] ||= nil\n config_opts[:proc] ||= nil\n config_opts[:show_options] ||= false\n config_opts[:exit] ||= nil\n \n if config_opts.has_key?(:default)\n @config[config_key] = config_opts[:default]\n end\n end\n \n super(*args)\n end", "def set_config(*args); end", "def set_config(*args); end", "def set_config(*args); end", "def set_config(*args); end", "def set_config(*args); end", "def arguments=(value)\n @arguments = value\n end", "def prepare_options!\n @cli_options = ARGV.dup.uniq\n @save_options = !!@cli_options.delete('--save')\n\n if options.rails?\n sources.concat(detect_sources)\n set_rails_defaults\n end\n end", "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end" ]
[ "0.6851698", "0.6839158", "0.67602855", "0.6481678", "0.63648564", "0.62990767", "0.62857676", "0.6284748", "0.62606597", "0.6217661", "0.62170756", "0.6206977", "0.61065453", "0.6098411", "0.6085733", "0.6068653", "0.6066898", "0.6066203", "0.6052572", "0.60509276", "0.6050172", "0.60475737", "0.604358", "0.60383314", "0.6038032", "0.6032305", "0.60310954", "0.6012138", "0.6000615", "0.59860724", "0.5983728", "0.5964592", "0.5935815", "0.5932833", "0.5931317", "0.59261113", "0.59251076", "0.59251076", "0.59208953", "0.59193677", "0.59062946", "0.58986676", "0.58581597", "0.58566797", "0.5851321", "0.5845786", "0.5838691", "0.5838691", "0.5834977", "0.5834036", "0.5829993", "0.58252233", "0.5816813", "0.5802293", "0.57914597", "0.5786869", "0.5782371", "0.5771018", "0.576961", "0.57584655", "0.5752905", "0.57385606", "0.5736331", "0.5734386", "0.57335234", "0.5733366", "0.57303995", "0.57287824", "0.5725426", "0.57187295", "0.57176906", "0.57098067", "0.5707044", "0.57069606", "0.5703905", "0.5690252", "0.56896615", "0.56865406", "0.56794494", "0.56774485", "0.56743574", "0.5674034", "0.56733704", "0.5672888", "0.5668557", "0.5667396", "0.5663717", "0.5661575", "0.56501096", "0.5645372", "0.56437325", "0.564213", "0.56411904", "0.5635619", "0.5635619", "0.5635619", "0.5635619", "0.5635619", "0.56307393", "0.5629184", "0.56261486" ]
0.0
-1
Parses the commandline arguments and runs the executable
def parse opts = OptionParser.new(&method(:set_options)) opts.parse!(@args) get_news end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run(argv = [])\n execute(parse_options(argv))\n end", "def run\n begin\n raise TooManyArgumentsError.new(@arguments) if @arguments.length > 1\n \n print_version if @options.version?\n scan if @options.scan?\n rename_given_file unless @arguments.empty?\n run_gui if @arguments.empty?\n \n raise Error\n rescue => e\n puts e.to_s\n \n exit(1)\n end\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\\n\\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n os \n process_command\n \n puts \"\\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end", "def run\n if parsed_options? && arguments_valid?\n log \"Start at #{DateTime.now}\\n\"\n output_options\n\n process_arguments\n process_command\n log \"Finished at #{DateTime.now}\"\n else\n output_usage\n end\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\\\n\\\\n\" if @options.verbose\n\n process_arguments \n process_command\n \n puts \"\\\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run(arguments)\n config = Configuration.load_applicable\n run_command(config, arguments)\n\n ExitCodes::OK\n rescue => ex\n ErrorHandler.new(@ui).handle(ex)\n end", "def run(argv)\n options = parse(argv)\n invoke!(options.to_h)\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n process_arguments \n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n else\n output_usage\n end\n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n if process_arguments == false\n return\n end\n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n \n if parsed_options? && arguments_valid? \n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n if arguments = parse_arguments\n begin\n process(arguments)\n rescue RuntimeError => ex\n Console.puts ex.message, :red\n exit 1\n end\n else\n if show_help?\n show_help(nil, Console.width).each do |line|\n Console.puts line, :cyan\n end\n else\n show_usage(nil, Console.width).each do |line|\n Console.puts line, :yellow\n end\n end\n exit 2\n end\n end", "def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def run\n if parsed_options? && arguments_valid?\n log \"Start at #{DateTime.now}\\n\"\n output_options\n process_command\n log \"Finished at #{DateTime.now}\"\n else\n output_usage\n end\n end", "def run\n\n\t\tif parsed_options? && arguments_valid?\n\n\t\t puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n\t\t output_options if @options.verbose # [Optional]\n\n\t\t process_arguments\n\t\t process_command\n\n\t\t puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n\t\telse\n\t\t output_usage\n\t\tend\n\n\tend", "def run\n unless parsed_options? && arguments_valid? \n output_usage and return\n end\n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n end", "def run(args)\n safely_mkdir(MAIN_DIR)\n safely_mkdir(MOD_DIR)\n safely_mkdir(PACK_DIR)\n\n return HELP_TEXT if args.include?('-h') || args.include?('--help')\n return VERSION if args.include?('-v') || args.include?('--version')\n\n case args[0]\n when 'help'\n return HELP_COMMANDS[args[1].to_sym] if HELP_COMMANDS.key?(args[1].to_sym)\n return HELP_TEXT\n when 'fetch'\n return CommandFetch.run(args[1])\n when 'manifest'\n return CommandFetch.install_manifest(args[1])\n when 'installmod'\n return CommandInstall.run_mod(args[1])\n when 'installpack'\n return CommandInstall.run_pack(args[1]).to_s # remove\n else\n end\n end", "def run\n\n if parsed_options? && arguments_valid? \n\n puts \"Start at #{Time.new.to_s}\\n\\n\" if @options.verbose\n\n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n\n puts \"\\nFinished at #{Time.new.to_s}\" if @options.verbose\n\n else\n output_usage\n end\n\n end", "def run\n testable = Parser.new(@argv).parse\n Executor.new(testable).execute\n end", "def run\n if parsed_options? && arguments_valid?\n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n output_options if @options.verbose\n\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\\\n\\\\n\" if @options.verbose\n \n output_options if @options.verbose # [Optional]\n \n process_arguments \n process_command\n \n puts \"\\\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end\n end", "def run\n if options_valid? && option_combinations_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def run(argv = ARGV)\n parser.parse(argv)\n end", "def run\n standard_exception_handling do\n handle_env(ENV)\n handle_options(ARGV)\n config.cmdline = CmdlineBuilder.new(config, Dir.pwd, $0, ENV)\n @output_stream.puts config.output\n end\n end", "def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end", "def run\n # puts \"parsed_options? >>> #{parsed_options?}\"\n # puts \"arguments_valid? >>> #{arguments_valid?}\"\n if parsed_options? && arguments_valid?\n \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n \n process_arguments\n \n output_options if @options.verbose # [Optional]\n \n process_command\n \n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n \n else\n output_usage\n end\n \n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n output_options if @options.verbose\n process_arguments \n start\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end \n end", "def run\n\t\tif parsed_options? && arguments_valid?\n\t\t\toutput_options if @options[:verbose]\n\t\t\toutput_arguments if @options[:verbose]\n\t\t\tprocess_arguments\n\t\t\tprocess_command\n\t\telse\n\t\t\toutput_usage\n\t\tend\n\tend", "def run\n # puts arguments_valid?\n if parsed_options?\n puts \"Start at #{DateTime.now}\" if verbose?\n\n output_options if verbose?\n\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if verbose?\n else\n puts 'The options passed are not valid!'\n end\n end", "def parse(args)\n @args = args\n @instruction = args.join(' ')\n until @args.empty?\n arg = @args[0]\n if @instructions.key? arg\n @args.shift\n buff = args_extract(arg, @instructions[arg][0])\n @to_exec << [arg, buff]\n else\n bad_argument_exit(arg)\n end\n end\n run\n end", "def run\n @arguments = ArgumentParser.get_arguments VALID_ARGUMENTS\n print_help if (@arguments[:options][:help])\n print_version if (@arguments[:options][:version])\n if (@arguments[:keywords][:export])\n handle_export\n elsif (@arguments[:keywords][:import])\n handle_import\n else\n print_help\n end\n end", "def run(arguments)\n run_command(arguments)\n\n ExitCodes::OK\n rescue => ex\n ErrorHandler.new(@ui).handle(ex)\n end", "def run(argv = ARGV)\n #p [:argv, argv]\n begin\n # cheating\n if argv.include?('-h') or argv.include?('--help')\n puts help_text\n else\n app = from_argv(argv)\n app.run\n end\n rescue Exception => e\n if exit_status == 0\n exit_status 1\n end\n puts \"\\nERROR: #{e}\"\n ensure\n exit(exit_status)\n end\n end", "def run(arguments)\n parse(arguments)\n configure\n execute\n end", "def run \n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\"\n process_arguments(@validoptions.args)\n puts \"Finished at #{DateTime.now}\"\n else\n raise BoilerMakerErr.new(\"Could not parse options. An unknown error has ocurred.\")\n exit $!\n end\n end", "def run(args)\n # force immediate output\n $stdout.sync = true\n\n # setup logging\n Giblog.setup\n\n # Parse cmd line\n cmdline = CmdLineParser.new args\n Giblog.logger.debug { \"cmd line args: #{cmdline.args}\" }\n\n exit_code = execute_conversion(cmdline)\n Giblog.logger.info { \"Giblish is done!\" } if exit_code.zero?\n exit_code\n end", "def run(args)\n opts.parse!(args)\n\n command = args.shift\n if command.nil?\n puts opts\n else\n meth = command.gsub(\"-\", \"_\").to_sym\n if respond_to?(meth)\n send(meth)\n else\n puts %(`#{command}` is not a #{opts.program_name} command. See `#{opts.program_name} --help` for a list of available commands.)\n end\n end\n end", "def execute(args)\n # Analyze arguments\n remaining_args = @options.parse(args)\n if @display_help\n puts @options\n elsif (remaining_args.size > 2)\n puts 'Please specify just 1 file to be loaded on startup.'\n puts @options\n else\n activate_log_debug(true) if @debug\n log_info 'Loading GUI libraries...'\n require 'gtk2'\n Gdk::Threads.init\n require 'ruby-serial'\n require 'filesrebuilder/Model/Data'\n require 'filesrebuilder/GUIFactory'\n require 'filesrebuilder/GUIcontroller'\n require 'filesrebuilder/_Gtk/_object'\n require 'rUtilAnts/Platform'\n RUtilAnts::Platform::install_platform_on_object\n gui_factory = GUIFactory.new\n gui_controller = GUIController.new(gui_factory)\n gui_factory.gui_controller = gui_controller\n Gtk::Settings.default.gtk_button_images = true\n log_info 'Executing application...'\n main_widget = gui_factory.new_widget('Main')\n gui_controller.set_main_widget(main_widget)\n main_widget.show\n gui_controller.run_callback_dirline_progress_bars\n gui_controller.load_from_file(remaining_args[0]) if (remaining_args.size == 1)\n Gtk.main\n log_info 'Quitting application...'\n end\n end", "def run( args )\n args = args.dup\n\n parse args\n init args\n self.__send__(*@command)\n end", "def run\n code = 0\n opt = OptionParser.new\n define_options(opt)\n default_options(opt)\n define_exit_codes(opt)\n argv = opt.parse!\n\n if @help\n puts_msg(opt.help)\n\n else\n begin\n main(argv)\n rescue Exception => e\n arr = @@exit_code_map[e.class]\n code = arr ? arr[0] : 1\n puts_err e.to_s\n puts_err \"[ERROR]\"\n end\n end\n\n exit(code)\n end", "def initialize(*args)\n return self if args.empty?\n parsed_args = args.first.is_a?(Hash) ? args.first : parse_string_args(args)\n\n self.executable = parsed_args[:executable]\n self.arguments = parsed_args[:arguments]\n end", "def run\n begin\n process_arguments\n rescue ArgumentError\n output_usage\n end\n end", "def run(*args)\n cli.run(*args)\n end", "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end", "def run args\n if host.nil?\n fail_with \"This system is not supported.\"\n elsif (task.verb = extract_verb(args)).nil?\n fail_with \"Not sure what you meant.\"\n else\n parse_cmdline task.verb, args\n send \"handle_#{task.verb.def.name}\", task.verb\n end\n ensure\n Base.threads.each &:join\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\" if @options.verbose\n output_options if @options.verbose # [Optional]\n process_arguments\n # add parameters\n args = {}\n # TODO: use correct syntax for set\n args[:verbose] = @options.verbose if @options.verbose\n args[:input] = @options.input if @options.input\n args[:output] = @options.output if @options.output\n args[:map_name] = @options.map_name if @options.map_name\n args[:not_installed] = @options.cwd if @options.cwd\n \n program = Guy.new args\n program.work\n puts \"Finished at #{DateTime.now}\" if @options.verbose\n else\n output_usage\n end \n end", "def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_options\n end\n end", "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def run(args = [], runtime_options = {})\r\n begin\r\n parse!(args.dup, runtime_options)\r\n rescue OptionParser::InvalidOption => e\r\n # Don't cry, script. Generators want what you think is invalid.\r\n end\r\n\r\n # Generator name is the only required option.\r\n unless options[:generator]\r\n usage if args.empty?\r\n options[:generator] ||= args.shift\r\n end\r\n\r\n # Look up generator instance and invoke command on it.\r\n Rails::Generator::Base.instance(options[:generator], args, options).command(options[:command]).invoke!\r\n rescue => e\r\n puts e\r\n puts \" #{e.backtrace.join(\"\\n \")}\\n\" if options[:backtrace]\r\n raise SystemExit\r\n end", "def cli(commandline_arguments)\n CLITest.new(BIN_P).run(commandline_arguments)\n end", "def run\n \n if parsed_options?\n \n process_command\n end\n \n end", "def parse_command_line(args)\n test_configuration = {}\n\n option_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: run-tests.rb [options]'\n opts.separator 'Specific options:'\n\n opts.on('--blinkr', 'Execute broken link checks') do |opt|\n test_configuration[:blinkr] = opt\n end\n\n opts.on('--dcp', 'Execute dcp broken link checks') do |opt|\n test_configuration[:dcp] = opt\n end\n\n opts.on('--base-url RHD_BASE_URL', String, 'Run the tests against the specified host e.g http://developers.stage.redhat.com') do |host|\n test_configuration[:base_url] = host\n end\n\n opts.on('-c CONFIG_FILE', 'specify the config.yaml file for broken link checks') do |opt|\n test_configuration[:config] = opt\n end\n\n opts.on('--ignore-internal', \"Ignore internal URL's\") do |opt|\n test_configuration[:ignore_internal] = opt\n end\n\n opts.on('--ignore-external', \"Ignore external URL's\") do |opt|\n test_configuration[:ignore_external] = opt\n end\n\n opts.on('--ignore-ssl', 'Disable SSL certificate checking for staging environments') do |opt|\n test_configuration[:ignore_ssl] = opt\n end\n\n #\n # Options supporting the execution of the tests within Docker\n #\n opts.on('--use-docker', 'Run the specified test type using Docker') do\n test_configuration[:docker] = true\n end\n\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n Kernel.exit(1)\n end\n end\n\n begin\n option_parser.parse!(args)\n rescue OptionParser::InvalidOption => e\n puts e\n option_parser.parse(%w(-h))\n end\n bind_test_type_environment_variable(test_configuration)\n build_test_execution_command(test_configuration)\n test_configuration\n end", "def run\n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n output_options if @options.verbose # [Optional]\n process_arguments \n process_command\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n else\n Trollop::die \"user error, replace user and continue\"\n end\n end", "def cli(commandline_arguments)\n CLITest.new(BINARY).run(commandline_arguments)\n end", "def main\n if system(ARGV.join(\" \"))\n exit 0\n else\n main\n end\nend", "def run_app(command, arguments)\nend", "def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end", "def run(args)\n sub_args = parse_command_line(args)\n return if @help_requested\n\n cmd = sub_args.shift\n if @sub_commands.key?(cmd)\n sub_cmd = @sub_commands[cmd].new\n sub_cmd.run(sub_args)\n else\n help\n\n if cmd || !args.empty?\n fail(\n Simp::Cli::ProcessingError,\n \"ERROR: Did not recognize sub-command '#{cmd} #{args.join(' ')}'\"\n )\n end\n\n fail(Simp::Cli::ProcessingError, 'ERROR: Did not provide sub-command')\n end\n end", "def command_line_info\n puts \"\\nCommand line arguments:\\n\\n\"\n puts \"This program will accept a single command line argument on launch. Arguments can be passed to draughts_app.rb directly or to draughts.sh\\n\"\n puts \"Example: draughts.sh --help\\n\\n\"\n puts \"-h or --help Display all command line arguments\"\n puts \"-i or --info Display instructions on how to play\"\n puts \"-v or --version Display current application and Ruby version\"\n puts \"start Skip menu and immediately start a new game\"\n puts \"wins Print win counts\"\n puts \"\"\nend", "def run(args)\n ret = DEFAULTS.merge({})\n\n # create option parser\n o = ::OptionParser.new do |o|\n o.banner = \"Usage: #@app [options]\"\n o.separator \" \"\n\n # add command-line options\n o.separator \"Options:\"\n\n o.on('-A', '--allow USER', 'Allow Jabber subscription from USER.') do |v|\n add_allowed(ret, v)\n end\n\n o.on('-c', '--config FILE', 'Use configuration file FILE.') do |v|\n Joggle::ConfigParser.run(v) do |key, val|\n if key == 'engine.allow'\n add_allowed(ret, val)\n elsif key == 'engine.update.range'\n add_update_range(ret, val)\n else\n ret[key] = val\n end\n end\n end\n\n o.on('-D', '--daemon', 'Run as daemon (in background).') do |v|\n ret['cli.daemon'] = true\n end\n\n o.on('--foreground', 'Run in foreground (the default).') do |v|\n ret['cli.daemon'] = false\n end\n\n o.on('-L', '--log-level LEVEL', 'Set log level to LEVEL.') do |v|\n ret['runner.log.level'] = v\n end\n\n o.on('-l', '--log FILE', 'Log to FILE.') do |v|\n ret['runner.log.path'] = v\n end\n\n o.on('-p', '--password PASS', 'Jabber password (INSECURE!).') do |v|\n ret['jabber.pass'] = v\n end\n\n o.on('-s', '--store FILE', 'Use FILE as backing store.') do |v|\n ret['runner.store.path'] = v\n end\n\n o.on('-u', '--username USER', 'Jabber username.') do |v|\n ret['jabber.user'] = v\n end\n\n o.separator ' '\n\n o.on_tail('-v', '--version', 'Print version string.') do\n puts \"Joggle %s, by %s\" % [\n Joggle::VERSION,\n 'Paul Duncan <[email protected]>',\n ]\n exit\n end\n\n o.on_tail('-h', '--help', 'Print help information.') do\n puts o\n exit\n end\n end\n\n # parse arguments\n o.parse(args)\n\n # return results\n ret\n end", "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end", "def run( args )\n cmd_str = args.shift\n cmd = case cmd_str\n when 'create'; CreateCommand.new(@out, @err)\n when 'freeze'; FreezeCommand.new(@out, @err)\n when 'unfreeze'; UnfreezeCommand.new(@out, @err)\n when 'info'; InfoCommand.new(@out, @err)\n when nil, '-h', '--help'\n help\n when '-v', '--version'\n @out.puts \"Docbones #{::Docbones::VERSION}\"\n nil\n else\n raise \"Unknown command #{cmd_str.inspect}\"\n end\n\n cmd.run args if cmd\n\n rescue StandardError => err\n @err.puts \"ERROR: While executing docbones ... (#{err.class})\"\n @err.puts \" #{err.to_s}\"\n exit 1\n end", "def go(argv)\n logger.debug(\"Using args passed in: #{argv.inspect}\")\n\n cmd = nil\n\n @optparse = OptionParser.new do |opts|\n cmd = super(argv, opts, @config)\n\n opts.on('-v', '--version', 'Print the version') do\n puts \"#{name} #{version}\"\n abort\n end\n end\n\n @optparse.parse!(argv)\n\n logger.debug(\"Parsed config: #{@config.inspect}\")\n\n cmd.execute(argv, @config)\n end", "def execute(sub_argv)\n\n $logger.info \"RubyVersion, sub_argv = #{sub_argv}\"\n\n options = {}\n\n opts = OptionParser.new do |o|\n o.banner = 'Usage: openstudio ruby_version'\n end\n\n # Parse the options\n argv = parse_options(opts, sub_argv)\n return 0 if argv == nil\n\n $logger.debug(\"RubyVersion command: #{argv.inspect} #{options.inspect}\")\n\n unless argv == []\n $logger.error 'Arguments passed to the ruby_version command.'\n return 1\n end\n\n safe_puts RUBY_VERSION\n\n 0\n end", "def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end", "def test_arguments\n with_fixture 'arguments' do\n assert system(\"ruby\", ocra, \"arguments.rb\", *DefaultArgs)\n assert File.exist?(\"arguments.exe\")\n system(\"arguments.exe foo \\\"bar baz\\\"\")\n assert_equal 5, $?.exitstatus\n end\n end", "def invoke(argv)\n system(\n argv.join(' ')\n )\n end", "def run(argv)\n load_tasks\n\n if argv.empty?\n print_help\n else\n build_task(argv).run\n end\n end", "def run\n\n if parsed_options? && arguments_valid? && client_configured?\n\n puts \"Start at #{DateTime.now}\\n\\n\" if @options.verbose\n\n output_options if @options.verbose # [Optional]\n\n process_arguments\n process_command\n\n puts \"\\nFinished at #{DateTime.now}\" if @options.verbose\n\n else\n output_usage\n end\n\n end", "def run(argv)\n # parse and analyze the command line\n options = Trollop::with_standard_exception_handling @args_parser do\n opts = @args_parser.parse(argv)\n\n raise Trollop::CommandlineError.new \"Too many arguments\" if argv.length > 1\n \n opts\n end\n \n path = (argv.shift or '.')\n \n Dir.chdir(path) do\n #include CRake\n load(options.input)\n end\n \n code = gen_cmake_code\n \n puts code # tem for debugging\n \n write_cmake_lists\n \n puts 'Calling CMake...'\n call_cmake\n end", "def process_args\n args = @args.dup\n @options[:operands] = nil\n unless args.length >= 2\n puts @opts\n exit 1\n end\n @options[:operands] = args.shift(2)\n @options[:output_filename] = args.shift unless args.empty?\n @options[:output] ||= @options[:output_filename] || $stdout\n\n run\n end", "def run\n write_parameter_file\n Tandem.run_commandline_application\n end", "def run!(options = {})\n run_option_parser.parse!(ARGV.dup) unless ARGV.empty?\n @running = true\n super(options)\n end", "def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.message\n exit 1\n end\n puts format_data(data)\n end", "def run_from_command_line\n handle_exceptions do\n remotes.load\n handle_options\n execute_command_from_command_line\n end\n end", "def run\n input = OptionParser.new do |opts|\n opts.banner = \"Usage: #{File.basename($0)} [options]\"\n\n opts.on(\"--debug\", \"Turn on debugging output.\") do |debug|\n $DEBUG = @options[:debug] = debug\n end\n\n opts.on(\"-n <path>\", \"--new\", \"Create a new Corrupt application.\") do |path|\n @options[:path] = path\n end\n\n opts.on(\"-v\", \"--version\", \"Print the version.\") do |v|\n output(Corrupt.to_version)\n exit\n end\n end\n\n begin\n @argv << '--help' if @argv.empty?\n input.parse!(@argv)\n take_action!\n rescue OptionParser::InvalidOption => error\n error(\"#{error}\\nTry passing '--help'\")\n rescue OptionParser::MissingArgument => error\n error(\"#{error}\\nTry passing '--help'\")\n end\n end", "def command_parse(argv)\n end", "def run(argv = [])\n @options.parse!(argv)\n\n @rackup = argv.delete_at(0)\n @rackup = File.join(Dir.pwd, 'config.ru') if @rackup.nil?\n\n if File.directory?(@rackup)\n @rackup = File.join(@rackup, 'config.ru')\n end\n\n if !File.exist?(@rackup)\n abort \"The Rackup file #{@rackup} does not exist\"\n end\n\n stop = Ramaze::Bin::Runner::Commands[:stop].new\n start = Ramaze::Bin::Runner::Commands[:start].new\n params = [@rackup]\n\n unless @pid.nil?\n params.push(\"-P #{@pid}\")\n end\n\n stop.run([@pid])\n start.run(params)\n end", "def __main__(args)\n Fifa::Task.new($opts = parse(args[1..-1])).exec\n exit(1) if Fifa::Logger.errors?\nend", "def exe(*args)\r\n app.exe(self, args)\r\n end", "def run(args)\n opts = parse_options(args)\n unless @end_program\n crawler = Spiderman::Crawler.new(opts)\n crawler.crawl\n end\n end", "def execute\n cli_options = OptionManager.new.execute\n argv = parse_options(cli_options[:parser])\n \n return unless argv\n \n if [nil, ''].include? cli_options[:values][:cmd]\n env.ui.info cli_options[:parser]\n else\n with_target_vms(argv) do |machine|\n manage_machine(machine, cli_options) \n end\n end\n 0\n end", "def run!\n trace = false\n require_program :version, :description\n\n global_option('-h', '--help', 'Help on any command', :hide => true)\n global_option('--version', 'Display version information', :hide => true)\n\n # special case --debug so all commands can output relevant info on it\n $terminal.debug = options_parse_debug\n\n # special case --trace because we need to use it in the runner\n trace = options_parse_trace\n\n # special case --version so it is processed before an invalid command\n options_parse_version\n\n # help is a special branch prior to command execution\n options_parse_help\n\n unless trace\n begin\n run_active_command\n rescue InvalidCommandError => e\n run_help(provided_arguments)\n rescue \\\n OptionParser::InvalidOption => e\n RHC::Helpers.error e.message\n 1\n rescue \\\n ArgumentError,\n OptionParser::ParseError => e\n\n help_bindings = CommandHelpBindings.new(active_command, commands, self)\n usage = RHC::HelpFormatter.new(self).render_command_syntax(help_bindings)\n message = case e\n when OptionParser::AmbiguousOption\n \"The option #{e.args.join(' ')} is ambiguous. You will need to specify the entire option.\"\n else\n e.message\n end\n\n RHC::Helpers.error message\n say \"#{usage}\"\n 1\n rescue RHC::Exception, RHC::Rest::Exception => e\n RHC::Helpers.error e.message\n e.code.nil? ? 128 : [1, (e.code || 1).to_i].max\n end\n else\n run_active_command\n end\n end", "def go_with_args(argv=[])\n catch(:exit_err) { catch(:exit_zero) { @cli_obj.go(argv) } }\n end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def parse_command_line(args)\n all_opts = OptionParser.new do |opts|\n opts.banner = \"Usage: #{PROGRAM_NAME} [OPTIONS] PASSWORD\"\n opts.separator ''\n\n opts.on(\n '-t',\n '--load-timeout [TIMEOUT_SECONDS]',\n Integer,\n 'Timeout in seconds to wait for',\n 'gitlab-rails console to load',\n 'and process the change.',\n \"Defaults to #{DEFAULT_LOAD_TIMEOUT} seconds.\"\n ) do |timeout|\n @options.load_timeout = timeout\n end\n\n opts.on(\n '-v',\n '--verbose',\n 'Print out debug info when processing.'\n ) do\n @options.debug = true\n end\n\n opts.on(\n '-h',\n '--help',\n 'Help Message'\n ) do\n puts opts\n @options.help_requested = true\n end\n end\n\n all_opts.parse!(args)\n\n unless @options.help_requested\n fail('ERROR: You must specify the password to set') if (ARGV.length < 1)\n\n @options.password = ARGV[0]\n fail('ERROR: Password cannot be empty') if @options.password.strip.empty?\n end\n end", "def process(options = {})\n command = command_line(options)\n Kernel.system(command)\n end", "def parse!\n begin\n @opts = OptionParser.new(&method(:set_opts))\n @opts.parse!(@args)\n @options\n rescue Exception => e\n raise e if e.is_a?(SystemExit)\n\n $stderr.puts e.message\n exit 1\n end\n exit 0\n end", "def run(args = ARGV)\n @args = args\n validate!\n Spanx::CLI.subclass_class(args.shift).new.run(args)\n end" ]
[ "0.73103446", "0.72798985", "0.7119934", "0.7116121", "0.71020675", "0.7100862", "0.7098278", "0.7090309", "0.7084803", "0.70708126", "0.70662713", "0.70662713", "0.70662713", "0.70662713", "0.70662713", "0.70662713", "0.70338595", "0.7031114", "0.69899166", "0.6985908", "0.6978106", "0.69479537", "0.6933611", "0.6928481", "0.69072807", "0.69052786", "0.6904396", "0.6896035", "0.6881299", "0.6880544", "0.6826697", "0.6821332", "0.6820463", "0.6772183", "0.6744142", "0.674339", "0.67132187", "0.6699873", "0.6696901", "0.66606784", "0.66564745", "0.6654377", "0.6636762", "0.66362745", "0.6628673", "0.6604775", "0.66007507", "0.65987515", "0.65929574", "0.6587419", "0.65737164", "0.6566625", "0.65506536", "0.6544018", "0.65296805", "0.6521762", "0.647241", "0.64456695", "0.6411727", "0.63991517", "0.6389448", "0.63679177", "0.6354918", "0.6340638", "0.6336244", "0.6324552", "0.6321833", "0.6318837", "0.63160187", "0.63123554", "0.6304451", "0.62964016", "0.6290224", "0.6275188", "0.6273629", "0.6265097", "0.6256671", "0.62488633", "0.62458616", "0.6242227", "0.6229306", "0.62242484", "0.61952597", "0.61949146", "0.61835515", "0.6158534", "0.61546797", "0.61407435", "0.6140395", "0.61340576", "0.61340576", "0.61340576", "0.61340576", "0.61340576", "0.61340576", "0.61340576", "0.61340576", "0.6126784", "0.6120919", "0.6118129", "0.6113321" ]
0.0
-1
one represents the percentage of characters in the string that are lowercase letters, one the percentage of characters that are uppercase letters, and one the percentage of characters that are neither. You may assume that the string will always contain at least one character.
def letter_percentages(str) percentages = {} str_length = str.length.to_f percentages[:lowercase] = ((str.count('a-z') / str_length) * 100).round(1) percentages[:uppercase] = ((str.count('A-Z') / str_length) * 100).round(1) percentages[:neither] = 100 - percentages[:lowercase] - percentages[:uppercase] percentages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_percentages(str)\n hsh = { lowercase: 0, uppercase: 0, neither: 0 }\n\n str.chars.each do |elem|\n if elem =~ /[a-z]/\n hsh[:lowercase] += 1\n elsif elem =~ /[A-Z]/\n hsh[:uppercase] += 1\n else\n hsh[:neither] += 1\n end\n end\n hsh.transform_values! { |v| format('%.1f', v.fdiv(str.length) * 100).to_f }\nend", "def letter_percentages(str)\n percentages = {}\n percentages[:lowercase] = (str.count('a-z').to_f / str.size) * 100\n percentages[:uppercase] = (str.count('A-Z').to_f / str.size) * 100\n percentages[:neither] = (str.count('^A-Za-z').to_f / str.size) * 100\n percentages\nend", "def letter_percentages(string)\n lowercase = 0.0\n uppercase = 0.0\n neither = 0.0\n string.each_char do |char|\n if char.upcase == char && char.downcase == char\n neither += 1\n elsif char.downcase == char\n lowercase += 1\n else\n uppercase += 1\n end\n end\n\n l_perc = ((lowercase / string.size) * 100).round(2)\n u_perc = ((uppercase / string.size) * 100).round(2)\n n_perc = ((neither / string.size) * 100).round(2)\n\n { lowercase: l_perc, uppercase: u_perc, neither: n_perc }\nend", "def letter_percentages(string)\n percentages = { lowercase: 0.0, uppercase: 0.0, neither: 0.0 }\n\n string.chars.each do |char|\n if char.downcase!\n percentages[:uppercase] += 100.0/string.size\n elsif char.upcase!\n percentages[:lowercase] += 100.0/string.size\n else\n percentages[:neither] += 100.0/string.size\n end\n end\n\n percentages.transform_values! { |percent| percent.round(2) }\nend", "def letter_percentages(str)\n count_lowercase = 0\n count_uppercase = 0\n count_neither = 0\n\n str.each_char do |char|\n if %w(1 2 3 4 5 6 7 8 9 0).include?(char)\n count_neither += 1\n elsif ('A'..'Z').include?(char)\n count_uppercase += 1\n elsif ('a'..'z').include?(char)\n count_lowercase += 1\n else\n count_neither += 1\n end\n\n end\n\n percent_lowercase = (count_lowercase.to_f / str.length) * 100\n percent_uppercase = (count_uppercase.to_f / str.length) * 100\n percent_neither = (count_neither.to_f / str.length) * 100\n\n hsh = {\n lowercase: percent_lowercase,\n uppercase: percent_uppercase,\n neither: percent_neither\n }\nend", "def letter_percentages(string)\n case_hash = { lowercase: 0, uppercase: 0, neither: 0 }\n\n string.each_char do |char|\n case\n when char =~ /[A-Z]/ then case_hash[:uppercase] += 1\n when char =~ /[a-z]/ then case_hash[:lowercase] += 1\n else case_hash[:neither] += 1\n end\n end\n\n characters = string.length.to_f\n case_hash.keys.each do |key|\n case_hash[key] /= characters\n case_hash[key] *= 100\n end\n\n case_hash\nend", "def letter_percentages(string)\n low, up, non = [0, 0, 0]\n\n string.each_char do |chr|\n case chr\n when /[a-z]/ then low += 1\n when /[A-Z]/ then up += 1\n else non += 1\n end\n end\n\n convert = 100 / string.size.to_f\n low *= convert\n up *= convert\n non *= convert\n\n percentages = { lowercase: low, uppercase: up, neither: non}\nend", "def letter_percentages(string)\n total_count = string.size\n character_hash = {}\n\n character_hash[:lowercase] = (string.count(\"a-z\").to_f / total_count) * 100\n character_hash[:uppercase] = (string.count(\"A-Z\").to_f / total_count) * 100\n character_hash[:neither] = (string.count(\"^a-zA-Z\").to_f / total_count) * 100\n\n character_hash\nend", "def letter_percentages(string)\n\n percent_hash = { lowercase: [], uppercase: [], neither: [] }\n counts = { lowercase: 0, uppercase: 0, neither: 0 }\n characters = string.chars\n\n counts[:lowercase] = characters.count { |ch| ch =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |ch| ch =~ /[A-Z]/ }\n counts[:neither] = characters.count { |ch| ch =~ /[^A-Za-z]/ }\n\n percent_hash[:lowercase] = format(\"%0.2f\", (counts[:lowercase] / string.size.to_f) * 100)\n percent_hash[:uppercase] = format(\"%0.2f\", (counts[:uppercase] / string.size.to_f) * 100)\n percent_hash[:neither] = format(\"%0.2f\", (counts[:neither] / string.size.to_f) * 100)\n percent_hash\nend", "def letter_percentages(string)\n chars = string.split('')\n\n hash_of_percentages = { lowercase: 0.0, uppercase: 0.0, neither: 0.0}\n hash_of_percentages = calculate_chars(chars, hash_of_percentages)\n\n total_chars = chars.length\n hash_of_percentages = calculate_percentages(hash_of_percentages, total_chars)\n\n return hash_of_percentages\nend", "def calculate_percentage(string) #def calculate_percentage(\"Aand\")\n characters = sanitize(string) #characters = sanitize(\"Aand\") --> {\"a\" => 2, \"n\" => 1, \"d\" => 1}\n characters.each do |letter, count| #|a, 2| |n, 1| |d,2|\n characters[letter] = count.to_f/string.length # 2/4 1/4 1/4\n end\nend", "def frequency(string,char)\n\t\tstring.count(char) / string.length.to_f\n\tend", "def letter_percentages(string)\n letter_case_count = letter_case_count(string)\n result = {}\n letter_case_count.each do |type, num|\n result[type] = (num / letter_case_count.values.sum.to_f * 100).round(1)\n end\n result\nend", "def letter_case_count(str)\n lowercase_str = 'a-z'\n uppercase_str = 'A-Z'\n neither_str = '^A-Za-z'\n\n lowercase_count = str.count(lowercase_str)\n uppercase_count = str.count(uppercase_str)\n neither_count = str.count(neither_str)\n\n puts \"{ lowercase: #{lowercase_count}, uppercase: #{uppercase_count}, neither: #{neither_count} }\"\nend", "def letter_case_count(string)\n lower_c_count = string.count('a-z')\n upper_c_count = string.count('A-Z')\n other_c_count = string.count('^a-zA-Z')\n { lowercase: lower_c_count, uppercase: upper_c_count, neither: other_c_count }\nend", "def letter_case_count(string)\n letter_count = { lowercase: 0, uppercase: 0, neither: 0 }\n letter_count[:lowercase] = string.count('a-z')\n letter_count[:uppercase] = string.count('A-Z')\n letter_count[:neither] = string.count('^a-z', '^A-Z')\n letter_count\nend", "def solve s\n s.chars.map{|letter| letter.upcase == letter ? 'upper' : 'lower'}.count('upper') > 0.5*s.length ? s.upcase : s.downcase\nend", "def letter_case_count3(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\n counts\nend", "def calculate_percent(str, criteria)\n size = str.size.to_f\n percent = str.count(criteria)/size * 100\n percent.round(2)\nend", "def letter_case_count(str)\r\n lower = str.chars.select{|char| char.match?(/[a-z]/)}.size\r\n upper = str.chars.select{|char| char.match?(/[A-Z]/)}.size\r\n neither = str.chars.select{|char| char.match?(/[^A-Z]/i)}.size\r\n hash = {lower: lower, upper: upper, neither: neither}\r\nend", "def rubbishness(name)\n name.each_char.map { |x|\n case x\n when /[A-Z]/\n 1\n when '?', '=', '!'\n -2\n else\n 0\n end\n }.inject(&:+) + (name.size / 100.0)\n end", "def mostly_uppercase?(statement)\n upper, lower = statement.scan(/[[:alpha:]]/).partition {|x| x.upcase == x}\n ratio = upper.length.to_f / lower.length.to_f\n ratio > SHOUTING_THRESHOLD\n end", "def letter_case_count(string)\n uppercase_counter = 0\n lowercase_counter = 0\n neither_counter = 0\n string.chars.each do |letter|\n case letter\n when /[A-Z]/ then uppercase_counter += 1\n when /[a-z]/ then lowercase_counter +=1\n else neither_counter += 1\n end\n end\n { lowercase: lowercase_counter, uppercase: uppercase_counter, neither: neither_counter }\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\n counts\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars\n counts[:lowercase] = characters.count { |char| char =~ /[a-z]/ }\n counts[:uppercase] = characters.count { |char| char =~ /[A-Z]/ }\n counts[:neither] = characters.count { |char| char =~ /[^A-Za-z]/ }\n counts\nend", "def letter_case_count(string)\n counts = {}\n \n counts[:lowercase] = string.count('a-z')\n counts[:uppercase] = string.count('A-Z')\n counts[:neither] = string.count('^a-zA-Z')\n counts\nend", "def letter_case_count(string)\n counter = {}\n\n counter[:lowercase] = string.count('a-z')\n counter[:uppercase] = string.count('A-Z')\n counter[:neither] = string.count('^a-zA-Z')\n\n counter\nend", "def score(str)\n score = 0.0\n mine = @secret.each_byte.map{ |x| x.to_s(2) }.join\n theirs = str.each_byte.map{ |x| x.to_s(2) }.join\n\n mine.each_byte.zip(theirs.each_byte) do |a,b|\n score += 1 if a == b\n end\n (score / mine.length)\n end", "def caps(string_1)\n length_1 = string_1.length\n if length_1 > 10 then string_1.upcase! end\n puts string_1\nend", "def letter_case_count(string)\n hash = {}\n hash[:lowercase] = string.count('a-z')\n hash[:uppercase] = string.count('A-Z')\n hash[:neither] = string.count('^a-zA-Z')\n hash\nend", "def love(string1, string2)\n matches = string1.count(string2) #.count returns number of matches \n total = string1.length + string2.length #\n puts total/matches;\nend", "def letter_case_count(string)\n counts = {}\n characters = string.chars # breaks up string into array of strings\n counts[:lowercase] = characters.count {|char| char =~ /[a-z]/}\n counts[:uppercase] = characters.count {|char| char =~ /[A-Z]/}\n counts[:neither] = characters.count {|char| char =~ /[^A-Za-z]/}\n counts\nend", "def letter_case_count(str)\n h = { lowercase: 0, uppercase: 0, neither: 0 }\n str.each_char do |c|\n if c.between?('a', 'z')\n # if char =~ /[a-z]/\n h[:lowercase] += 1\n elsif c.between?('A', 'Z')\n # elsif char =~ /[A-Z]/\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n h\nend", "def letter_case_count(str)\n h = { lowercase: 0, uppercase: 0, neither: 0 }\n str.each_char do |c|\n if c.between?('a', 'z')\n h[:lowercase] += 1\n elsif c.between?('A', 'Z')\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n h\nend", "def sillycase(str)\n midpoint = (str.length/2.0).ceil\n p midpoint\n first_half = str[0...midpoint].downcase\n p first_half\n second_half = str[midpoint..-1].upcase\n p second_half\n return first_half + second_half\nend", "def letter_case_count(str)\n letter_count = {}\n letter_count[:lowercase] = str.count('a-z')\n letter_count[:uppercase] = str.count('A-Z')\n letter_count[:neither] = str.count('^a-zA-z')\n letter_count\nend", "def letter_case_count(string)\n h = {lowercase: 0, uppercase: 0, neither: 0}\n \n string.chars.each do |char|\n if char =~ /[a-z]/\n h[:lowercase] += 1\n elsif char =~ /[A-Z]/\n h[:uppercase] += 1\n else\n h[:neither] += 1\n end\n end\n\n h\nend", "def character_percent_complete(character)\n level_total=self.levels.select{|level| character.levels.include?(level) }\n (level_total.length/7.0*100).round\n end", "def letter_case_count(str)\n count_hash = { \n lowercase: 0,\n uppercase: 0,\n neither: 0\n }\n\n str.chars.each do |character|\n if /[[:lower:]]/.match(character)\n count_hash[:lowercase] += 1\n elsif /[[:upper:]]/.match(character)\n count_hash[:uppercase] += 1\n else\n count_hash[:neither] += 1\n end\n end\n\n count_hash\nend", "def letter_case_count(str)\n count_hash = { \n lowercase: 0,\n uppercase: 0,\n neither: 0\n }\n\n str.chars.each do |character|\n if /[[:lower:]]/.match(character)\n count_hash[:lowercase] += 1\n elsif /[[:upper:]]/.match(character)\n count_hash[:uppercase] += 1\n else\n count_hash[:neither] += 1\n end\n end\n\n count_hash\nend", "def letter_case_count(string)\n final = { lowercase: 0, uppercase: 0, neither: 0 }\n string.split('').each do |el|\n final[:neither] += 1 unless ('a'..'z').include?(el.downcase)\n final[:lowercase] += 1 if el.downcase == el && ('a'..'z').include?(el.downcase)\n final[:uppercase] += 1 if el.upcase == el && ('a'..'z').include?(el.downcase)\n end\n final\nend", "def scrabble_score(str)\n str = str.upcase.delete(\"^A-Z\")\n return 0 if str.nil? || str.empty?\n str.chars.map{ |chr| $dict[chr] }.reduce(:+)\nend", "def letter_case_count(string)\n case_count = { lowercase: 'a-z', uppercase: 'A-Z', neither: '^a-zA-Z' }\n case_count.map { |type, pattern| [type, string.count(pattern)] }.to_h\nend", "def letter_case_count(string)\n hash = {}\n string.chars.each do |char|\n case char\n when char =~ /[a-z]/\n if hash.keys.include?(:lowercase)\n hash[:lowercase] += 1\n else\n hash[:lowercase] = 1\n end\n when char =~ /[A-Z]/\n if hash.keys.include?(:uppercase)\n hash[:uppercase] += 1\n else\n hash[:uppercase] = 1\n end\n else\n if hash.keys.include?(:neither)\n hash[:neither] += 1\n else\n hash[:neither] = 1\n end\n end\nend\n\nletter_case_count('abCdef 123') == { lowercase: 5, uppercase: 1, neither: 4 }\nletter_case_count('AbCd +Ef') == { lowercase: 3, uppercase: 3, neither: 2 }\nletter_case_count('123') == { lowercase: 0, uppercase: 0, neither: 3 }\nletter_case_count('') == { lowercase: 0, uppercase: 0, neither: 0 }", "def letter_case_count(str)\n hsh = { lowercase: 0,\n uppercase: 0,\n neither: 0 }\n str.chars.each do |char|\n if char.ord >= 'a'.ord && char.ord <= 'z'.ord\n hsh[:lowercase] += 1\n elsif char.ord >= 'A'.ord && char.ord <= 'Z'.ord\n hsh[:uppercase] += 1\n else\n hsh[:neither] += 1\n end\n end\n hsh\nend", "def ex_oh(str)\n str.downcase.scan(/x/).count == str.downcase.scan(/o/).count\nend", "def letter_case_count(string)\n result = {}\n result[:lowercase] = string.count('a-z')\n result[:uppercase] = string.count('A-Z')\n result[:neither] = string.length - result.values.inject(:+)\n result\nend", "def letter_case_count_bk(str)\n res = {}\n res[:lowercase] = str.count(\"a-z\")\n res[:uppercase] = str.count(\"A-Z\")\n res[:neither] = str.size() - (res[:lowercase] + res[:uppercase])\n res\nend", "def letter_case_count(string)\n hash = { lowercase: 0, uppercase: 0, neither: 0 }\n str_arr = string.chars\n str_arr.each do |char|\n if char =~ /[a-z]/\n hash[:lowercase] += 1\n elsif char =~ /[A-Z]/\n hash[:uppercase] += 1\n else\n hash[:neither] += 1\n end\n end\n hash\nend", "def letter_case_count(str)\n counts = { lowercase: 0, uppercase: 0, neither: 0 }\n str.chars.each do |char|\n if char.match?(/[a-z]/)\n counts[:lowercase] += 1\n elsif char.match?(/[A-Z]/)\n counts[:uppercase] += 1\n else\n counts[:neither] += 1\n end\n end\n\n counts\nend", "def staggered_case_decide(string, use_all_char=false)\n alt_cap = ''\n need_upper = true\n split_str = string.chars\n split_str.each do |char|\n if use_all_char\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n else\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n end\n alt_cap\nend", "def letter_case_count(string)\n count = { lowercase: 0, uppercase: 0, neither: 0 }\n\n string.chars.each do |char|\n if (\"A\"..\"Z\").include?(char)\n count[:uppercase] += 1\n elsif (\"a\"..\"z\").include?(char)\n count[:lowercase] += 1\n else\n count[:neither] += 1\n end\n end \n count\nend", "def first_non_repeating_letter(str)\n return '' if str.empty? || str.chars.uniq.size <= str.size/2\n str.chars.each { |e| return e if str.downcase.count(e.downcase) == 1 }\nend", "def calc_camel_case(\n string:\n )\n string_array = string.split('')\n result = (string_array[0].eql? string_array[0].downcase) ? 1 : 0\n # scan all characters for upper case\n string_array.each { |char| result += 1 if char.eql? char.upcase }\n # Return result\n result\nend", "def letter_case_count(str)\n letter_case_hash = {}\n letter_case_hash[:lowercase] = str.count('a-z')\n letter_case_hash[:uppercase] = str.count('A-Z')\n letter_case_hash[:neither] = str.count('^a-zA-z')\n letter_case_hash\nend", "def letter_case_count(string)\n hash = { lowercase: 0, uppercase: 0, neither: 0 }\n str_arr = string.chars\n counter = 0\n while counter < str_arr.size\n if str_arr[counter] =~ /[a-z]/\n hash[:lowercase] += 1\n elsif str_arr[counter] =~ /[A-Z]/\n hash[:uppercase] += 1\n else\n hash[:neither] += 1\n end\n counter += 1\n end\n hash\nend", "def string_behavior (strings)\n\n strings.each do |str|\n if not str =~ /[A-Z]/ and str.length > 4\n puts \"long and lowercase\"\n elsif not str =~ /[A-Z]/\n puts \"lowercase\"\n elsif str.length > 4\n puts \"long\"\n\n else\n puts str\n end\n end\n end", "def all_caps(string)\n\tif string.length > 10\n\t return string.upcase!\n \telse\n \t return string\n \tend\nend", "def most_frequent_letter(string)\nend", "def count_letters(word)\r\n\r\n end", "def count_string s,ss\n s.downcase.scan(/(?=#{ss.downcase})/).count\nend", "def count_upcased_letters(string)\n string.chars.count { |character| /[A-Z]/.match character }\nend", "def pass_strength_simple(password)\n\t\tup= password.count(\"A-Z\") #possible values for uppercase letters\n\t\tlo= password.count(\"a-z\") #possible values for lowercase letters\n\t\tnu= password.count(\"0-9\") #possible values for number\n\t\tsy= password.length - up - lo - nu\n\t\tsum = 0\n\t\tif 0 < up\n\t\t\tsum += 26\n\t\tend\n\t\tif 0 < lo\n\t\t\tsum += 26\n\t\tend\n\t\tif 0 < nu\n\t\t\tsum += 10\n\t\tend \n\t\tif 0 < sy\n\t\t\tsum += 32\n\t\tend\n\t\treturn sum ** password.length\n\tend", "def frequency(char)\n return 0 if (@size.nil? || @size <= 0)\n @map[char.upcase] * 100/@size\n end", "def count_char(string, char)\n string.downcase.count(char.downcase)\nend", "def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end", "def all_caps(string)\n if string.length > 10 then\n string.upcase\n else\n string\n end\nend", "def getCount(inputStr)\n inputStr.downcase.count('aeiou')\nend", "def getCount(inputStr)\n inputStr.downcase.count('aeiou')\nend", "def LetterCountI(str)\n g_word, g_count = '', 0\n str.split.each do |word|\n word.chars.each do |char|\n if word.downcase.count(char) > g_count\n g_count = word.downcase.count(char)\n g_word = word\n end\n end\n end\n\n g_count <= 1 ? -1 : g_word\nend", "def letter_case_count(string)\n result = { lowercase: 0, uppercase: 0, neither: 0 }\n\n string.each_char do |char|\n case char\n when ('a'..'z') then result[:lowercase] += 1\n when ('A'..'Z') then result[:uppercase] += 1\n else result[:neither] += 1\n end\n end\n\n result\nend", "def str_count(word, letter)\n # Code here\n word.count(letter)\nend", "def word_worth(word)\n word.chars.sum { |char| char.ord - 'A'.ord + 1 }\nend", "def hey(string)\n if string.count(\"/A-Z/\") == 10 # Test 3\n p \"Whoa, chill out!\"\n elsif string[0] == \"T\" # Test one passes\n p \"Whatever.\"\n elsif string[0] == \"W\" && string[9] == \"!\" # Test 2\n p \"Whoa, chill out!\"\n elsif string[0] == \"D\" # Test 4\n p \"Sure.\"\n elsif string[0] == \"Y\" # Test 5\n p \"Sure.\"\n elsif string.count(\"/a-z/\") == 10 # Test 6\n p \"Sure.\"\n elsif string[0] == \"L\" # Test 7\n p \"Whatever.\"\n elsif string[0] == \"I\" && string[1] == \"t\" # Test 8\n p \"Whatever.\"\n elsif string[0] == \"W\" && string[31] == \"?\" # Test 9\n p \"Whoa, chill out!\"\n elsif string[0] == \"1\" && string[10] == \"!\" # Test 10\n p \"Whoa, chill out!\"\n elsif string[0] == \"1\" # Test 11\n p \"Whatever.\"\n elsif string[0] == \"4\" # Test 12\n p \"Sure.\"\n elsif string[0] == \"Z\" # Test 13\n p \"Whoa, chill out!\"\n elsif string[2] == \"H\" # Test 14\n p \"Whoa, chill out!\"\n elsif string[0] == \"E\" # Test 15\n p \"Whatever.\"\n elsif string[4] == \"!\" # Test 16\n p \"Sure.\"\n elsif string == \"\" # Test 17\n p \"Fine. Be that way!\"\n elsif string[0] == \" \" # Test 18\n p \"Fine. Be that way!\"\n elsif string[0] == \"\\t\" # Test 19\n p \"Fine. Be that way!\"\n elsif string[1] == \"D\" # Test 20\n p \"Whatever.\"\n end\n end", "def str_count(word, letter)\n p word.count(letter)\nend", "def count_char(string, char)\n string.downcase.chars.count(char.downcase)\nend", "def letter_case_count(str)\n letter_case_counts = { lowercase: 0, uppercase: 0, neither: 0 }\n\n str.each_char do |chr|\n if chr.match?(/[A-Z]/)\n letter_case_counts[:uppercase] += 1\n elsif chr.match?(/[a-z]/)\n letter_case_counts[:lowercase] += 1\n else\n letter_case_counts[:neither] += 1\n end\n end\n\n letter_case_counts\nend", "def percent_match(other)\n max = [length, other.length].max\n 1.0 - levenshtein_distance_to(other).to_f / max\n end", "def letter_case_count(str)\n result = {}\n characters = str.chars\n result[:lowercase] = characters.count { |ch| ch =~ /[a-z]/ }\n result[:uppercase] = characters.count { |ch| ch =~ /[A-Z]/ }\n result[:neither] = characters.count { |ch| ch =~ /[^A-Za-z]/ }\n\n result\nend", "def score_text_two(text)\n txt = text.downcase\n txt_length = txt.length.to_f\n total_score = 0\n\n ALL_LETTERS.each_with_index do |l, i|\n l_freq = (txt.count(l) / txt_length) * 100\n total_score += (l_freq - CHAR_FREQ[i]).abs\n end\n\n space_ratio = txt.scan(/.\\s./).count / txt_length\n total_score += ((space_ratio * 100) - 14.0).abs\n\n return total_score\nend", "def percent\n self.scan(/./).join('%')\n end", "def letter_case_count(string)\n result = {}\n arr = string.chars\n \n result[:lowercase] = arr.count { |char| char =~ /[a-z]/ }\n result[:uppercase] = arr.count { |char| char =~ /[A-Z]/ }\n result[:neither] = arr.count { |char| char =~ /[^a-zA-z]/ }\n result\nend", "def letter_case_count(string)\n uppercase_count = string.count(string.upcase)\n lowercase_count = string.count(string.downcase)\n\n hash = {\n :lowercase => lowercase_count,\n :uppercase => uppercase_count,\n }\n\nend", "def compare *s\n s.map {|s| s.to_s.uppercase[/^[A-Z]* $|/].sum}.reduce &:==\nend", "def all_caps(string)\n string.length > 10 ? string.upcase : string\nend", "def capped(string)\n\tif string.length >= 10\n\t\tstring.upcase\n\telse\n\t\t\"'#{string}' isn't at least 10 chars long\"\n\tend\nend", "def score_text(txt)\n txt_length = txt.length.to_f\n total_score = 0\n\n e_ratio = txt.count('e') / txt_length\n t_ratio = txt.count('t') / txt_length\n a_ratio = txt.count('a') / txt_length\n o_ratio = txt.count('o') / txt_length\n i_ratio = txt.count('i') / txt_length\n\n space_ratio = txt.count(' ') / txt_length\n\n total_score += 1 if i_ratio > 0.01 && i_ratio < 0.10\n total_score += 2 if e_ratio > 0.10 && e_ratio < 0.20\n total_score += 2 if t_ratio > 0.08 && t_ratio < 0.26\n total_score += 2 if a_ratio > 0.07 && a_ratio < 0.20\n total_score += 2 if o_ratio > 0.05 && o_ratio < 0.20\n total_score += 4 if space_ratio > 0.1 && space_ratio < 0.4\n\n # capital_ratio = txt.scan(/[ABCDEFGHIOUT]/).count / txt_length\n # total_score += 4 if capital_ratio > 0 && capital_ratio < 0.2\n\n return total_score\nend", "def get_first_half_of_string(string)\n\tnumber_of_characters = string.chars.count\n\thalf = (number_of_characters/2.0).ceil\n\tstring.slice(0, half)\nend", "def all_caps(string)\n \n if string.length > 10\n string.upcase\n else\n string\n end\nend", "def staggered_case(string, start_on_0 = true)\n result = ''\n need_upper = start_on_0\n string.chars.each do |char|\n if need_upper\n result += char.upcase\n else\n result += char.downcase\n end\n need_upper = !need_upper\n end\n result\nend", "def lov(x,y)\n a = x.strip\n b = y.strip \n t = a.size + b.size \n c = a.count(b)\n s = t / c\n puts \"The total characters: #{t}\"\n puts \"Common characters: #{c}\"\n puts \"Total characters (#{t}) divided by common (#{c}) equals:\"\nend", "def first_non_repeating_letter(s) \n counts = Hash.new(0)\n s.split(\"\").reduce(counts) { |k, v| k[v] += 1; k}\n p counts\n counts.key(1).nil? ? \"\" : counts.key(1)\nend", "def basis_functions_length(character)\n characters.include?(character) ? 1 : 0\n end", "def double_letter_count(string)\n\tcount = 0\n \tval = 0\n \twhile count < string.length\n if string[count] == string[count + 1]\n val +=1\n end\n count +=1\n end\n\treturn val\n end", "def first_non_repeating_letter(str)\n str.chars.each { |char| return char if str.downcase.count(char.downcase) == 1 }\n ''\nend", "def all_caps(str)\n if str.length > 10\n str.upcase\n else\n str\n end\nend", "def all_caps(str)\n if str.length > 10\n str.upcase\n else\n str\n end\nend", "def calculate_alphabet(str)\nend", "def all_caps(str)\n if str.length > 10 \n str.upcase\n else\n str\n end\nend" ]
[ "0.72065175", "0.71859896", "0.71580446", "0.7116647", "0.7090129", "0.70728993", "0.7062781", "0.7021826", "0.69425255", "0.69388753", "0.679409", "0.6360381", "0.6263177", "0.6212856", "0.62003666", "0.6186049", "0.6178867", "0.60719454", "0.6059661", "0.6053832", "0.6011851", "0.5991964", "0.5987261", "0.59839714", "0.5946724", "0.5946724", "0.5946723", "0.5916132", "0.5899799", "0.5889296", "0.5887448", "0.5876643", "0.58700347", "0.58619285", "0.58435935", "0.5841558", "0.58415276", "0.5821742", "0.58188653", "0.5818438", "0.5818438", "0.58015245", "0.5796534", "0.57874745", "0.5782858", "0.5767512", "0.5767408", "0.57664293", "0.5766154", "0.5763014", "0.5754292", "0.5747303", "0.57471585", "0.5718975", "0.5711287", "0.5702294", "0.5701903", "0.5677121", "0.5675426", "0.5670251", "0.56581604", "0.565598", "0.56376654", "0.56272125", "0.5625039", "0.5624319", "0.56235003", "0.5616433", "0.56082815", "0.56082815", "0.5605628", "0.56053025", "0.55924284", "0.5592335", "0.5590114", "0.55853224", "0.55835104", "0.5582897", "0.55796605", "0.5569478", "0.5567858", "0.5564261", "0.55624473", "0.5561179", "0.5550945", "0.5548784", "0.5546309", "0.5544701", "0.55431503", "0.5542253", "0.55417466", "0.55350137", "0.5531636", "0.5528336", "0.55255944", "0.55136096", "0.55073357", "0.55073357", "0.55034316", "0.55009556" ]
0.7353618
0
We skip check when: association isn't a `HasOne` or `HasMany` association has `through` option associated class doesn't exist
def preconditions %i[ has_one has_many ].include?(association.macro) && association.through_reflection.nil? && association.klass rescue StandardError false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unused_preload_associations_for?(klass, association)\n Bullet.collected_unused_eager_association_notifications.select do |notification|\n notification.base_class == klass.to_s && notification.associations.include?(association)\n end.present?\n end", "def preconditions\n %i[\n has_one\n has_many\n ].include?(association.macro) && association.through_reflection.nil? && association.klass\n rescue NameError\n false\n end", "def check_association(model, association)\n raise(Sequel::UndefinedAssociation, \"Invalid association #{association} for #{model.name}\") unless reflection = model.association_reflection(association)\n raise(Sequel::Error, \"Eager loading is not allowed for #{model.name} association #{association}\") if reflection[:allow_eager] == false\n reflection\n end", "def detecting_unpreloaded_association_for?(klass, association)\n Bullet.collected_n_plus_one_query_notifications.select do |notification|\n notification.base_class == klass.to_s && notification.associations.include?(association)\n end.present?\n end", "def check_unused_preload_associations; end", "def unused_preload_associations_for?(klazz, association)\n unused_preload_associations[klazz].present? && unused_preload_associations[klazz].include?(association)\n end", "def eager_graph_check_association(model, association)\n if association.is_a?(SQL::AliasedExpression)\n SQL::AliasedExpression.new(check_association(model, association.expression), association.alias)\n else\n check_association(model, association)\n end\n end", "def at_least_one? association\n errors.add(:base, \"must add at least one #{association}\") if association.blank?\n end", "def preloadable_association?( association )\n @klass.preloadable_associations.include?( association.to_sym )\n end", "def ignored_association?(association)\n ignored_associations.include? association.to_sym\n end", "def detect_through_associations\n reflections.each do |association, reflection|\n next if ignored_association?(association) || version_association?(association)\n self.through_associations << reflection.options.symbolize_keys[:through].try(:to_sym)\n end\n self.through_associations = through_associations.compact.uniq.reject {|association| ignored_association?(association) }\n end", "def process_association(class_name, assoc)\n\n STDERR.print \"\\t\\tProcessing model association #{assoc.name.to_s}\\n\" if @options.verbose\n\n # Skip \"belongs_to\" associations\n return if assoc.macro.to_s == 'belongs_to'\n\n # Only non standard association names needs a label\n \n # from patch #12384\n # if assoc.class_name == assoc.name.to_s.singularize.camelize\n \n assoc_class_name = (assoc.class_name.respond_to? 'underscore') ? assoc.class_name.pluralize.singularize.camelize : assoc.class_name \n if assoc_class_name == assoc.name.to_s.singularize.camelize\n assoc_name = ''\n else\n assoc_name = assoc.name.to_s\n end \n\n if assoc.macro.to_s == 'has_one' \n assoc_type = 'one-one'\n elsif assoc.macro.to_s == 'has_many' && (! assoc.options[:through])\n assoc_type = 'one-many'\n else # habtm or has_many, :through\n return if @habtm.include? [assoc.class_name, class_name, assoc_name]\n assoc_type = 'many-many'\n @habtm << [class_name, assoc.class_name, assoc_name]\n end \n # from patch #12384 \n # @graph.add_edge [assoc_type, class_name, assoc.class_name, assoc_name]\n @graph.add_edge [assoc_type, class_name, assoc_class_name, assoc_name] \n end", "def is_foreign_key?\n association.present?\n end", "def has_no_restrict_dependent?\n self.class.reflect_on_all_associations.all? do |assoc|\n ( ([:restrict_with_error, :restrict_with_exception].exclude? assoc.options[:dependent]) ||\n (assoc.macro == :has_one && self.send(assoc.name).nil?) ||\n (assoc.macro == :has_many && self.send(assoc.name).empty?) )\n end\n end", "def has_association_to klass, ident\n @associated_objects[klass].include?(ident)\n end", "def detecting_unpreloaded_association_for?(klazz, association)\n unpreload_associations[klazz].present? && unpreload_associations[klazz].include?(association)\n end", "def identify_single_through_associations\n return reflect_on_all_associations.select { |a|\n (a.macro == :has_one) && !a.options[:through].blank? }.map { |a|\n a.name.to_s\n }\n end", "def belongs_to?\n not property? and not multiple?\n end", "def has_associations?\n (!self.pulves.empty? ||\n !self.labours.empty? || \n !self.factures.empty? || \n !self.ventes.empty?)\n end", "def options_for_association_conditions(association, record = nil)\n return nil if association.through?\n return nil unless association.has_one? || association.has_many?\n # Find only orphaned objects\n {association.foreign_key => nil}\n end", "def property?\n @options[:association].nil?\n end", "def check_associations\n to_check = [:assignments, :responses, :forms, :report_reports, :questions, :broadcasts]\n to_check.each{|a| raise DeletionError.new(:cant_delete_if_assoc) unless self.send(a).empty?}\n end", "def options_for_association_conditions(association)\n return nil if association.options[:through]\n case association.macro\n when :has_one, :has_many\n # Find only orphaned objects\n \"#{association.foreign_key} IS NULL\"\n when :belongs_to, :has_and_belongs_to_many\n # Find all\n nil\n end\n end", "def has_association?(attr_name)\n _associations.has_key?(attr_name.to_sym)\n end", "def reciprocal_association?(assoc_reflect)\n possible_reciprocal_types.include?(assoc_reflect[:type]) &&\n (begin; assoc_reflect.associated_class; rescue NameError; end) == self[:model] &&\n assoc_reflect[:conditions].nil? &&\n assoc_reflect[:block].nil?\n end", "def preloader_for(reflection)\n if reflection.options[:through]\n ThroughAssociation\n else\n Association\n end\n end", "def check\n if unique_has_one_association?\n check_unique_has_one\n else\n check_remaining\n end\n end", "def ensure_correct_class!(model_instance)\n unless model_instance.kind_of?(model_class)\n raise %{Whoa! The LowCardAssociation '#{association_name}' for class #{model_class} somehow\nwas passed a model of class #{model_instance.class} (model: #{model_instance}),\nwhich is not of the correct class.}\n end\n end", "def inside_association?\n # TODO: see if we can memoize\n self.respond_to?(:proxy_owner)\n end", "def apply_rbac_through_association?(klass)\n klass != VimPerformanceDaily && klass != VimPerformanceTag && (klass < MetricRollup || klass < Metric)\n end", "def association?(key)\n # TODO(lsmola) remove this if there will be better dependency scan, probably with transitive dependencies filled\n # in a second pass, then we can get rid of this hardcoded symbols. Right now we are not able to introspect these.\n return true if [:parent, :genelogy_parent].include?(key)\n\n inventory_collection.dependency_attributes.key?(key) ||\n !inventory_collection.association_to_foreign_key_mapping[key].nil?\n end", "def multiple? #nodoc\n @options[:association] == :has_many || @options[:association] == :has_and_belongs\n end", "def implementation_no_master_association\n defined?(foreign_key_name) && foreign_key_name.blank?\n end", "def associated?\n @associated\n end", "def association?(object, associations); end", "def handle_belongs_to(model, associated)\n __method = __method__\n # trace __FILE__, __LINE__, self, __method__, \" : model.class=#{model.class} associated=#{associated.class} has?=#{has?}\"\n associated = [associated] unless associated.is_a?(Array)\n # trace __FILE__, __LINE__, self, __method__, \" : associated.size=#{associated.size}\"\n if has?\n associated.each do |associate|\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n inverse = associate.class.belongs_to_association(collection)\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n if inverse\n # trace __FILE__, __LINE__, self, __method, \" : setting inverse associate.class##{inverse.local_attr} to #{model.class}\"\n associate.send(:\"#{inverse.local_attr}=\", model)\n # trace __FILE__, __LINE__, self, __method\n end\n end\n end\n end", "def creating_object_association_for?(object, association)\n object_associations[object.bullet_key].present? &&\n object_associations[object.bullet_key].include?(association)\n end", "def is_association?(model_name, association_name)\n associations = @associations[model_name]\n !!(associations && associations[association_name])\n end", "def has_many_through_translatable?\n options[:through] && through_reflection.klass.is_translatable?\n end", "def valid_association_for_combining?(name)\n\t\t\treflections[name].macro.in? [:has_and_belongs_to_many, :has_many]\n\t\tend", "def has_one(association_name, options = {})\n database.schema[self].associations << HasManyAssociation.new(self, association_name, options)\n end", "def has_one_through(name, through_name, source_name)\n\n define_method(name) do\n through_options = self.class.assoc_options[through_name]\n source_options = through_options.model_class.assoc_options[source_name]\n\n source_table = source_options.table_name\n through_table = through_options.table_name\n source_foreign_key = source_options.foreign_key\n source_primary_key = source_options.primary_key\n through_foreign_key = through_options.foreign_key\n through_primary_key = through_options.primary_key\n\n query = <<-SQL\n SELECT\n #{source_table}.*\n FROM\n #{through_table}\n JOIN\n #{source_table}\n ON\n #{through_table}.#{source_foreign_key} = #{source_table}.#{source_primary_key}\n WHERE\n #{through_table}.#{through_primary_key} = ?\n SQL\n\n column = DBConnection.execute(query, self.send(through_foreign_key))\n source_options.model_class.parse_all(column).first\n end\n\n end", "def is_association?(model_name, association_name)\n associations = @associations[model_name]\n associations && associations[association_name]\n end", "def has_one(goal, options = { })\n goal.belongs_to(self) unless options[:skip_belongs_to]\n self.associate(:has_one, goal, options)\n end", "def eager_loading_use_associated_key?\n false\n end", "def _load_associated_objects(opts, dynamic_opts={})\n if opts.can_have_associated_objects?(self) && opts[:type] == :many_to_one && opts.associated_class.respond_to?(:cache_get_pk)\n _load_associated_object(opts, dynamic_opts)\n else\n super\n end\n end", "def association\n @association ||= options[:association]\n end", "def validate_single_association(reflection)\n association = association_instance_get(reflection.name)\n record = association && association.reader\n association_valid?(reflection, record) if record && (record.changed_for_autosave? || custom_validation_context?)\n end", "def has_many(goal, options = { })\n goal.belongs_to(self) unless options[:skip_belongs_to]\n self.associate(:has_many, goal, options)\n end", "def association?(column)\n case column\n when String\n model.associations.map(&:to_s).include?(column)\n else\n model.association_reflection(column)\n end\n end", "def associated_class\n self[:class] ||= self[:class_name].constantize\n end", "def association_reflection(association)\n uar = used_association_reflections\n Sequel.synchronize{uar[association] ||= true}\n super\n end", "def association_condition?(name)\n !association_condition_details(name).nil?\n end", "def has_one(name, scope = nil, **options)\n # args = options.except(:null_object)\n\n # Call the real belongs_to so that the association gets defined.\n super(name, scope, **options.except(:null_object))\n\n # Modify the association if need be.\n if options[:null_object]\n add_null_object_support(name, options)\n end\n end", "def options_for_association_conditions(association, record)\r\n if association.name == :phase\r\n Phase::find_all_for_enrollment(record.enrollment)\r\n elsif association.name == :deferral_type\r\n DeferralType::find_all_for_enrollment(record.enrollment)\r\n else\r\n super\r\n end\r\n end", "def has_one_through(name, assoc1, assoc2)\n define_method(name) do\n #grabbing the association we created in belongs_to\n params1 = self.class.assoc_params[assoc1] #Cat.assoc_params[:human]\n \n #house\n params2 = params1.other_class.assoc_params[assoc2] #Human.assoc_params[:house]\n\n primary_key1 = self.send(params1.foreign_key)\n results = DBConnection.execute(<<-SQL, primary_key1)\n SELECT \n #{params2.other_table}.*\n FROM \n #{params2.other_table}\n JOIN \n #{params1.other_table}\n ON \n #{params1.other_table}.#{params2.foreign_key}\n = #{params2.other_table}.#{params2.primary_key}\n WHERE \n #{params1.other_table}.#{params1.primary_key}\n = ?\n SQL\n\n params2.other_class.parse_all(results).first\n end\n end", "def associated_class\n self[:class] ||= self[:class_name].constantize\n end", "def def_association(opts)\n if !opts[:is_used] && @unused_associations_data && (data = @unused_associations_data[name]) && (unused = data[opts[:name].to_s])\n set_unused_options_for_association(opts, unused)\n end\n \n super\n end", "def validate_associations_for_combining(associations)\n\t\t\tassociations.each do |name|\n\t\t\t\tunless reflections.key? name\n\t\t\t\t\traise ArgumentError.new(\"No such association: #{name}\")\n\t\t\t\tend\n\t\t\t\tunless valid_association_for_combining?(name)\n\t\t\t\t\traise ArgumentError.new(\"Association type not allowed: #{reflection[name].macro}\")\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def cache_has_one(association, options = {})\n options[:embed] ||= true\n options[:inverse_name] ||= self.name.underscore.to_sym\n raise InverseAssociationError unless self.reflect_on_association(association)\n self.cached_has_ones[association] = options\n\n build_denormalized_association_cache(association, options)\n end", "def association?(attribute)\n @_associations.key?(attribute.to_sym)\n end", "def save_habtm_association?(assoc)\n @record.class.paper_trail_save_join_tables.include?(assoc.name) ||\n PaperTrail.request.enabled_for_model?(assoc.klass)\n end", "def associations?\n @_associations && @_associations.size > 0\n end", "def cache_supported_on_inverse_model?\n inverse_of && inverse_of.belongs_to?\n end", "def should_propagate_dependent_option? record\n # When we really want to delete associated records? when these are\n # not being used by any translations. This means that either +record+\n # has no translations, or that its translations use a different set of records\n all_records = record.translations.map do |translation|\n translation.without_current_locale(translation.locale) do\n translation.send(name).to_a\n end\n end.flatten\n (all_records & record.send(name)).empty?\n end", "def can_have_associated_objects?(obj)\n true\n end", "def association_autocomplete?(assoc, request)\n (c = associated_model_class(assoc)) && c.autocomplete_options_for(:association, request)\n end", "def ensure_not_referenced_by_adoption\n if adoptions.empty?\n return true\n else\n errors.add(:base, 'Adoption present')\n return false\n end\n end", "def ensure_not_referenced_by_any_adoption\n if adoptions.empty?\n return true\n else\n errors.add(:base, 'Adoption present')\n return false\n end\n end", "def eager_loading_use_associated_key?\n true\n end", "def association_invalide\n @validations.keys.detect do |nom_association|\n !@validations[nom_association].call\n end\n end", "def all_associations_exist?(association_names)\n\t\t\t\tassociation_names.all? do |name| \n\t\t\t\t\tfound_reflection = find_reflection( extract_association(name) )\n\t\t\t\t\tfound_reflection && !(name.to_s.include?(\"_id\") && (found_reflection.macro == :belong_to) ) # TODO very hacky, make it work together with rails scoped_by\n\t\t\t\tend\n\t\t\tend", "def klass_equal?(assoc, join_association)\n return true unless assoc._reflection.polymorphic?\n\n assoc._polymorphic_klass == join_association.base_klass\n end", "def association(name)\n association = super\n reflection = self.class.reflect_on_association(name)\n case reflection.try(:macro)\n when :belongs_to\n association.extend(HasAggregatedExtension) if reflection.options[:aggregated]\n when :has_one\n association.extend(HasCurrentExtension) if reflection.options[:is_current]\n else # do nothing\n end\n association\n end", "def copyable_association?(association)\n versionable_reflection?(association) &&\n !ignored_association?(association) &&\n !version_association?(association) &&\n !through_association?(association)\n end", "def has_many_with_protect(association_id, options = {}, &extension) #:nodoc:\n reflection = create_reflection(:has_many, association_id, options, self)\n \n # This would break if has_many :dependent behaviour changes. One\n # solution is removing both the second when and the else branches but\n # the exception message wouldn't be exact.\n case reflection.options[:dependent]\n when :protect\n module_eval \"before_destroy 'raise ReferentialIntegrityProtectionError, \\\"Can\\\\'t destroy because there\\\\'s at least one #{reflection.class_name} in this #{self.class_name}\\\" if self.#{reflection.name}.find(:first)'\"\n options.delete(:dependent)\n when true, :destroy, :delete_all, :nullify, nil, false\n #pass\n else\n raise ArgumentError, 'The :dependent option expects either true, :destroy, :delete_all, :nullify or :protect'\n end\n\n has_many_without_protect(association_id, options, &extension)\n end", "def test_has_many_through_has_one_with_has_one_through_source_reflection\n assert_equal [member_types(:founding)], members(:groucho).nested_member_types\n end", "def true_class\n return AssociationProxyWrapper\n end", "def _load_associated_object(opts, dynamic_opts)\n klass = opts.associated_class\n cache_lookup = opts.fetch(:many_to_one_pk_lookup) do \n opts[:many_to_one_pk_lookup] = opts[:type] == :many_to_one &&\n opts[:key] &&\n opts.primary_key == klass.primary_key\n end\n if cache_lookup &&\n !dynamic_opts[:callback] &&\n (o = klass.send(:primary_key_lookup, ((fk = opts[:key]).is_a?(Array) ? fk.map{|c| send(c)} : send(fk))))\n o\n else\n super\n end\n end", "def can_have_associated_objects?(obj)\n !self[:keys].any?{|k| obj.get_column_value(k).nil?}\n end", "def validate_entity_association\n ids = [self.unit_id, self.collection_id, self.item_id].reject(&:nil?).length\n if ids > 1\n errors.add(:base, \"Instance can be associated with only one entity\")\n elsif ids == 0\n errors.add(:base, \"Instance must be associated with an entity\")\n end\n end", "def association\n @association ||= model.reflect_on_association(@name)\n end", "def associated_class\n if options[:class_name]\n options[:class_name].constantize\n else\n klass.relative_const_get(attribute.to_s.camelize)\n end\n end", "def check_presence(klass, filter)\n table = klass.name.tableize\n instance = klass.new\n ids = []\n msg = ''\n filter.attributes.map(&:to_s).each do |attr|\n join = attr.pluralize.tableize\n\n # Determine if its an association so we can check for orphans\n if models.map(&:name).include?(attr.camelize)\n # Determine if the model is a child in the relationship\n if singular?(attr)\n ids = klass.joins(\"LEFT OUTER JOIN #{join} ON #{join}.id = #{table}.#{attr}_id\")\n .where(join.to_sym => { id: nil })\n msg = \" #{ids.count} orphaned records due to nil or missing #{attr}\"\n end\n\n elsif instance.send(attr.to_sym).is_a?(ActiveRecord::Associations::CollectionProxy)\n # If the instance is an association in the other direction just make sure\n # it has children\n\n # Skip this one becausue Guidance <--> Themes is a many to many join and this\n # particular validation is handled elsewhere\n\n else\n unless attr == 'password'\n # Find any records where the field is blank or nil\n ids = if filter.options.present? && filter.options[:if].present?\n klass.where(attr.to_sym => [nil, '']).select { |r| r.send(filter.options[:if]) }.map(&:id)\n else\n klass.where(attr.to_sym => [nil, ''])\n end\n msg = \" #{ids.count} records with a empty #{attr} field\"\n end\n end\n end\n [ids, msg]\n end", "def belongs_to?; false; end", "def method_missing(meth, *args, &block)\n meth = meth.to_s\n collectible_class = active_record_class_from_association_method_name meth\n begin\n if collectible_class.method_defined?(:user_pointers) && User.method_defined?(meth)\n self.method(meth).call *args, &block\n else\n # puts \"Failed to define method '#{meth}'\"\n super\n end\n rescue Exception => e\n # puts \"D'OH! Couldn't create association between User and #{collectible_class}\"\n super\n end\n end", "def can_have_associated_objects?(obj)\n !self[:left_primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end", "def multiple_associations?\n associations.any? { |col,assocs| assocs.length > 1 }\n end", "def fix_association(current_user)\n if self.user == current_user # duplicate\n 'Already associated with this Oauth'\n elsif self.user # conflict\n 'Oauth is associated with another user'\n else # unassigned\n self.add_association(current_user)\n end\n end", "def klass\n @klass ||= association ? association.klass : model\n end", "def synced_for?(instance)\n base_class = instance.mapping.database_model\n reflection = base_class.reflect_on_association(name)\n association_id = associated_salesforce_id(instance)\n\n return false unless association_id\n reflection.klass.exists?(\n mapping_for(reflection).lookup_column => association_id,\n )\n end", "def can_have_associated_objects?(obj)\n !self[:primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end", "def add_solr_eager_loaded_association association_name\n name = association_name.to_s\n unless self.solr_eager_loaded_associations.include?(name)\n self.solr_eager_loaded_associations << name\n end\n end", "def has_one_valid?(relation)\n relation = klass.reflect_on_association(relation)\n\n return true if relation[:relation] ==\n ::Mongoid::Relations::Referenced::One\n\n invalid_relation(\n ::Mongoid::Relations::Referenced::One, relation[:relation]\n )\n end", "def find!(target)\n @associations.each do |a|\n return a if a.include? target\n end\n raise InvalidAssociation, \"Could not lookup association for: #{target}\"\n end", "def has_many_association(name)\n options = self.class.has_many_associations[name.to_sym]\n if options[:as]\n has_many_polymorphic_association(options[:as])\n elsif options[:class_name]\n has_many_association_with_custom_class_name(\n options[:class_name],\n options[:foreign_key] || self.class.name.underscore\n )\n else\n foreign_key = options[:foreign_key] || self.class.name.underscore\n name.camelize.constantize.where(\"#{foreign_key}_id\": id)\n end\n end", "def is_relationship?\n %w(belongs_to has_many many_to_many).include?(self.type.to_s)\n end", "def hmt(goal, options)\n thru = options[:through]\n self.has_many(thru)\n self.has_many(goal, :through => thru, :skip_belongs_to => true)\n unless options[:bidi] == false\n goal.has_many(thru)\n goal.has_many( self, { :through => thru, :skip_belongs_to => true })\n end\n end", "def we_can_set_the_inverse_on_this?(record)\n if @reflection.has_inverse?\n inverse_association = @reflection.polymorphic_inverse_of(record.class)\n inverse_association && inverse_association.macro == :has_one\n else\n false\n end\n end", "def target_association(mapping)\n @target_association ||= mapping.associations.detect do |association|\n association.name == @association\n end\n @target_association || raise(ArgumentError, \":with must correspond to a defined association\")\n end" ]
[ "0.70514137", "0.68552464", "0.684273", "0.6782048", "0.6423", "0.6415613", "0.628376", "0.62309015", "0.6226636", "0.6216277", "0.61456573", "0.61237365", "0.61225384", "0.6017212", "0.6014498", "0.60036373", "0.60026085", "0.60016125", "0.5968144", "0.5964782", "0.59437877", "0.59079975", "0.58733004", "0.58646697", "0.58519113", "0.58117574", "0.58029056", "0.5777342", "0.5766441", "0.57506984", "0.57477653", "0.57401896", "0.57290107", "0.5718974", "0.5703059", "0.5693883", "0.5676574", "0.56722766", "0.56658334", "0.5650248", "0.56192803", "0.56121117", "0.56091744", "0.56077653", "0.55899245", "0.5572372", "0.5568016", "0.5563091", "0.5562553", "0.5542359", "0.5539488", "0.55325806", "0.55275446", "0.5508843", "0.5501638", "0.5500688", "0.5495067", "0.5486196", "0.54759854", "0.54695696", "0.54674804", "0.54584455", "0.54427433", "0.54373264", "0.54369897", "0.54273266", "0.5426255", "0.5425952", "0.5420226", "0.54174405", "0.54132545", "0.54117256", "0.5408054", "0.5404192", "0.5398677", "0.5398664", "0.53908515", "0.53878355", "0.5371138", "0.53691113", "0.53671163", "0.536529", "0.5353295", "0.53462666", "0.5335671", "0.53329843", "0.53265893", "0.531908", "0.5317867", "0.53148633", "0.5314451", "0.53078663", "0.5303579", "0.53013647", "0.52946854", "0.5292217", "0.5285421", "0.5284367", "0.5283058", "0.52692646" ]
0.69059914
1
Table of possible statuses | index | status | | | | | persisted | ok | | missing | fail |
def check if unique_has_one_association? check_unique_has_one else check_remaining end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @status = Status.last || Status.new(available: \"unavailable\", created_at: DateTime.now)\n end", "def statuses; end", "def states\n [\n 'CREATE_IN_PROGRESS',\n 'CREATE_IN_PROGRESS',\n 'CREATE_FAILED',\n 'CREATE_COMPLETE',\n 'ROLLBACK_IN_PROGRESS',\n 'ROLLBACK_FAILED',\n 'ROLLBACK_COMPLETE',\n 'DELETE_IN_PROGRESS',\n 'DELETE_FAILED',\n 'DELETE_COMPLETE',\n 'UPDATE_IN_PROGRESS',\n 'UPDATE_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_COMPLETE',\n 'UPDATE_ROLLBACK_IN_PROGRESS',\n 'UPDATE_ROLLBACK_FAILED',\n 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS',\n 'UPDATE_ROLLBACK_COMPLETE',\n 'REVIEW_IN_PROGRESS'\n ]\n end", "def index\n @entity_statuses = EntityStatus.all\n end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def statuses\n statuses = {\n \"Not started\" => 1,\n \"In Progress\" => 2,\n \"Finished\" => 3\n }\n return statuses\n end", "def index_status()\n\n read_index_alias = to_read_index_alias_name()\n write_index_alias = to_write_index_alias_name()\n parsed = @http.get(\"http://#{@host}:#{@port}/#{write_index_alias}/_status\")\n @logger.error(\"+++++ write index_status\", :write_index_alias => write_index_alias, :parsed => parsed)\n\n if parsed.key?(\"ok\")\n\n @logger.error(\"***** index_status ok\")\n\n indices = parsed[\"indices\"]\n index_name = indices.keys.first\n index = indices[index_name]\n docs = index[\"docs\"]\n num_docs = docs[\"num_docs\"]\n\n return index_name, num_docs, write_index_alias, read_index_alias\n\n else\n\n error = parsed[\"error\"]\n @logger.error(\"***** index_status error\", :error => error)\n\n index_name = to_index_name(0, @application, @domain)\n return index_name, 0, write_index_alias, read_index_alias\n\n end\n\n end", "def index\n @statuses = Status.all\n end", "def index\n @statuses = Status.all\n end", "def status(*) end", "def status_enum\n [\n [STATUSES.active],\n [STATUSES.resolved],\n [STATUSES.cancelled],\n [STATUSES.deleted]\n ]\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def status_enum\n status_list\n end", "def status\n STATUSES[self.status_id]\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n\t\t:not_acceptable\n\tend", "def status\n\t\t:not_acceptable\n\tend", "def status\n @status = valid? ? :ok : :unprocessable_entity\n end", "def index\n @health_statuses = HealthStatus.all\n end", "def good\n @status\n end", "def index\n @status = OpenStruct.new({ articles_count: Article.count,\n articles_recent_count: Article.last_x_days(30).count,\n sources_disabled_count: Source.where(:state => 1).count,\n alerts_last_day_count: Alert.total_errors(1).count,\n delayed_jobs_active_count: DelayedJob.count,\n responses_count: ApiResponse.total(1).count,\n events_count: RetrievalStatus.joins(:source).where(\"state > ?\",0).where(\"name != ?\", \"relativemetric\").sum(:event_count), #where(\"state > 0 AND name != 'relativemetric'\").sum(:event_count),\n requests_count: ApiRequest.where(\"created_at > ?\", Time.now - 1.day).count, #where(\"created_at > NOW() - INTERVAL 1 DAY\").count,\n users_count: User.count,\n version: VERSION,\n couchdb_size: RetrievalStatus.new.get_alm_database[\"disk_size\"] || 0,\n mysql_size: RetrievalHistory.table_status[\"data_length\"],\n update_date: Status.update_date,\n cache_key: Status.update_date })\n end", "def index\n @status_requests = StatusRequest.all\n end", "def status\n {\n name: name,\n state: state,\n grouped: false,\n prioritized: prioritized,\n pairwise: pairwise,\n subjects: subjects.size,\n users: users.length\n }\n end", "def status\n @status\n end", "def status\n @status\n end", "def status_fields\n %i[\n monitoring\n monitoring_reason\n monitoring_plan\n exposure_risk_assessment\n public_health_action\n isolation\n pause_notifications\n symptom_onset\n severe_symptom_onset\n case_status\n assigned_user\n last_date_of_exposure\n continuous_exposure\n user_defined_symptom_onset\n extended_isolation\n ]\n end", "def status_column\n :active\n end", "def index\n @deployment_statuses = DeploymentStatus.all\n end", "def index\n @reqstatuses = Reqstatus.all\n end", "def custom_status\n {}\n end", "def status\n return :completed if completed?\n return :failed if failed?\n :pending\n end", "def all_status\n\t status = Status.all\n\t return render_json_response(status, :ok)\n end", "def retrieve_status\n \n end", "def status\n fixity_graph.query({ predicate: premis_status_predicate }).map(&:object) +\n fixity_graph.query({ predicate: fedora_status_predicate }).map(&:object)\n end", "def status\n value_for('status')\n end", "def status\n result_statuses = {}\n results.each{|result| result_statuses[result.status] ||= 0; result_statuses[result.status]+=1;}\n result_statuses\n end", "def status\n result_statuses = {}\n results.each{|result| result_statuses[result.status] ||= 0; result_statuses[result.status]+=1;}\n result_statuses\n end", "def status\n state = (active_instance.nil? ? 999 : active_instance.status)\n case state\n when 0 \n 'missing'\n when 1 \n 'none'\n when 2 \n 'pending'\n when 3 \n 'unready'\n when 4 \n 'failed'\n when 5 \n 'ready'\n when 666 \n 'deleted'\n when 999\n 'inactive'\n else \n 'hold'\n end\n end", "def change_status(index_no)\n index_exist(index_no)? index_change_status(index_no) : conf_message(index_no, \"does not exist\")\n end", "def status\n super\n end", "def statuses\n api.get('status')\n end", "def status\n raise NotImplementedError\n end", "def status\n 'unknown'\n end", "def index\n @vacancy_request_statuses = VacancyRequestStatus.all\n end", "def status(*status)\n all.select { |b| status.include?(b.status) }\n end", "def status\n refund? ? 3 : redeemed? ? 1 : (used_status? ? 2 : 0)\n end", "def report_clusterstatus(as: :table, using_persisted: false)\n rows = using_persisted ? restore_solr_status : check_cluster\n\n case as\n when :table\n # order first by STATUS then by COLLECTION (name)\n rows = sort_rows(rows)\n\n table = Terminal::Table.new(\n headings: [\n 'Collection',\n 'Replica Factor',\n 'Shards',\n 'Shard Active',\n 'Shard Down',\n 'Shard Good',\n 'Shard Bad',\n 'Replica UP',\n 'Replica DOWN',\n 'Status',\n 'Recoverable'\n ],\n rows: rows.map do |row|\n [\n row[:collection],\n row[:num_replicas],\n row[:num_shards],\n row[:shard_active],\n row[:shard_non_active],\n row[:shard_good],\n row[:shard_bad],\n row[:replicas_up],\n row[:replicas_down],\n row[:gstatus] ? 'OK' : 'BAD',\n row[:recoverable] ? 'YES' : 'NO'\n ]\n end\n )\n puts table\n when :native\n status = rows.each_with_object({}) do |row, acc|\n name = row[:collection]\n row.delete(:collection)\n acc[name] = row\n end\n status\n when :json\n status = rows.each_with_object({}) do |row, acc|\n name = row[:collection]\n row.delete(:collection)\n acc[name] = row\n end\n status.to_json\n when :simple\n status = 'green'\n bad_collections = []\n\n rows.each do |row|\n if row[:status] == :bad && row[:recoverable] == false\n status = 'red'\n bad_collections << {\n collection: row[:collection],\n base_url: row[:bad_urls],\n recoverable: false\n }\n elsif row[:status] == :bad && row[:recoverable] == true\n status = 'orange' unless status == 'red'\n bad_collections << {\n collection: row[:collection],\n base_url: row[:bad_urls],\n recoverable: true\n }\n elsif row[:bad_urls].count > 0\n bad_collections << {\n collection: row[:collection],\n base_url: row[:bad_urls],\n recoverable: true\n }\n end\n end\n { status: status, bad_collections: bad_collections }\n end\n end", "def status\n return \"draft\" if self.draft?\n return \"sent\" if self.sent?\n return \"batch\" if self.batch_sent?\n end", "def default_values\n\t\tself.status = 0\n\tend", "def status_infos\n @dbi.status_infos\n end", "def status_infos\n @dbi.status_infos\n end", "def status\n @status ||= @repo.status(:unknown => true)\n end", "def index\n @service_statuses = ServiceStatus.all\n end", "def index\n @status2s = Status2.all\n end", "def index\n @project_statuses = ProjectStatus.all\n end", "def status\n \"approved\"\n end", "def index\n @project_statuses = Project::Status.all\n end", "def index\n @sa_request_statuses = SaRequestStatus.all\n end", "def status_map(status)\n case status\n when nil then 'pass'\n when :passed then 'pass'\n when :failed then 'fail'\n when :undefined then 'error'\n when :skipped then 'ignore'\n when :comment then 'ignore'\n else 'pass'\n end\n end", "def committable?(status)\n ! status.nil? && (200..399).include?(status)\n end", "def status\n super || StatusType.active\n end", "def index\n @relationship_statuses = RelationshipStatus.all\n end", "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end", "def get_status\n\t\tstatus\n\tend", "def index\n @married_statuses = MarriedStatus.all\n end", "def status(memoize = true)\n if @status[:updated].nil? or not memoize or (memoize and not @status[:updated].nil? and \n ((Time.now - @status[:updated]) >= self.class.status_update_threshold))\n response = Crocodoc.connection.get 'document/status', :uuids => @uuid\n response = response.body.first\n @status[:updated] = Time.now\n @status[:status] = STATUSES[response['status']]\n @status[:viewable] = response['viewable']\n @status[:error] = response['error'] if response.member?('error')\n end\n return @status\n end", "def status\n\t\treturn @status\n\tend", "def getStatus\n @status\n end", "def status_detail\n @status_detail ||= []\n end", "def status\n uniform_status? ? statuses.first : :bad_request\n end", "def status\n request :get, \"_status\"\n end", "def status\r\n if @status == \"paid\"\r\n :completed\r\n elsif @tatus == \"refused\"\r\n :refused\r\n else\r\n :pending_payment\r\n end\r\n end", "def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend", "def status\n if closed?\n return \"closed\"\n elsif submitted?\n return retrieved? ? \"retrieved\" : \"submitted\"\n else\n \"new\"\n end\n end", "def status\n return :code => info[:statuscode].to_i, :messages => info[:messages]\n end", "def index\n @reqdevstatuses = Reqdevstatus.all\n end", "def success_states\n [\n 'CREATE_COMPLETE',\n 'DELETE_COMPLETE',\n 'UPDATE_COMPLETE'\n ]\n end", "def status_params\n end", "def index\n @contract_statuses = ContractStatus.all\n end", "def to_status\n time = Time.now.to_i\n last = @db.execute(\"SELECT value from #{@settings} where key = 'LAST_SYNC'\").flatten[0].to_i\n\n sync_state = last == 0 || time > (last + @conf[:sync].to_i)\n\n status_str = ''\n monitor_ids = []\n\n if sync_state then\n status_str = \"SYNC_STATE=yes\\nMISSING_STATE=#{@conf[:missing_state]}\\n\"\n \n @db.execute(\"REPLACE INTO #{@settings} VALUES ('LAST_SYNC', #{time.to_s})\")\n end\n\n vms = DomainList.state_info(@host, @host_id)\n\n # ----------------------------------------------------------------------\n # report state changes in vms\n # ----------------------------------------------------------------------\n vms.each do |uuid, vm|\n next if vm[:ignore] == true\n\n if vm[:id] == -1\n filter = \"WHERE uuid = '#{uuid}'\"\n else\n # in ec2 id could first be -1 but later added, check also uuid\n filter = \"WHERE id = '#{vm[:id]}' OR uuid = '#{uuid}'\"\n end\n\n vm_db = @db.execute(\"SELECT * FROM #{@dataset} #{filter}\").first\n\n monitor_ids << uuid\n\n if vm_db.nil?\n @db.execute(\n \"INSERT INTO #{@dataset} VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n [uuid,\n vm[:id].to_i,\n vm[:name],\n vm[:deploy_id],\n time,\n 0,\n vm[:state],\n @conf[:hyperv]]\n )\n\n status_str << vm_to_status(vm)\n \n next\n end\n\n # Updates timestamp and uuid/deploy_id (e.g. VM recreated in KVM)\n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"state = '#{vm[:state]}', \" \\\n 'missing = 0, ' \\\n \"timestamp = #{time}, \" \\\n \"uuid = '#{uuid}', \" \\\n \"deploy_id = '#{vm[:deploy_id]}' \"\\\n \"#{filter}\"\n )\n\n if sync_state || vm_db[col_name_to_idx('state')] != vm[:state]\n status_str << vm_to_status(vm)\n end\n end\n\n # ----------------------------------------------------------------------\n # check missing VMs\n # ----------------------------------------------------------------------\n uuids = @db.execute(\"SELECT uuid FROM #{@dataset}\").flatten!\n uuids ||= []\n\n (uuids - monitor_ids).each do |uuid|\n vm_db = @db.execute(\n \"SELECT * FROM #{@dataset} WHERE uuid = '#{uuid}'\"\n ).first\n\n next if vm_db.nil?\n\n miss = vm_db[col_name_to_idx('missing')]\n\n if miss >= @conf[:times_missing]\n status_str << vm_db_to_status(vm_db, @conf[:missing_state])\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE uuid = \\\"#{uuid}\\\"\")\n else\n status_str << vm_db_to_status(vm_db) if sync_state\n \n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"timestamp = #{time}, \" \\\n \"missing = #{miss + 1} \" \\\n \"WHERE uuid = '#{uuid}'\"\n )\n end\n end\n\n status_str\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def status\n\t\t\t\ttrue\n\t\t\tend", "def getStatus\n @@statuses[@status]\n end", "def index\n @learning_statuses = LearningStatus.all\n end", "def status\n { 'status' => success ? 'sent' : 'failed' }\n end" ]
[ "0.7586717", "0.72169495", "0.65638685", "0.65629876", "0.6541373", "0.6541373", "0.6541373", "0.6541373", "0.6541373", "0.6541373", "0.6541373", "0.6541373", "0.6541373", "0.6508803", "0.6508803", "0.6508803", "0.6508803", "0.64868414", "0.64868414", "0.64801353", "0.6460762", "0.6429706", "0.6429706", "0.6372506", "0.6321387", "0.63181293", "0.6297548", "0.62401056", "0.6173805", "0.6173805", "0.6172894", "0.6172894", "0.6165784", "0.6145812", "0.6132779", "0.612225", "0.61209005", "0.6111685", "0.61046886", "0.61046886", "0.6097476", "0.6095716", "0.6086737", "0.60790807", "0.6077732", "0.6071811", "0.60621625", "0.6055962", "0.60555756", "0.60303915", "0.6021055", "0.6021055", "0.59946495", "0.59734106", "0.59655845", "0.59646064", "0.59589314", "0.59240216", "0.5917674", "0.5915754", "0.59103465", "0.5900179", "0.5896667", "0.588497", "0.588259", "0.588259", "0.5878677", "0.5878615", "0.5867239", "0.5859817", "0.584979", "0.5839818", "0.5837415", "0.583726", "0.58345115", "0.5826186", "0.58253014", "0.58234674", "0.5818933", "0.58134663", "0.5808841", "0.5808547", "0.58059067", "0.57997286", "0.57801515", "0.5779901", "0.57790434", "0.57785404", "0.5777737", "0.5777158", "0.5768595", "0.5763705", "0.57634854", "0.57584053", "0.57561266", "0.57513076", "0.57513076", "0.5746858", "0.5743818", "0.5739359", "0.5738434" ]
0.0
-1
Boot Firefox, go to loginpage, wait for user to login, and return cookies
def cookies_from_selenium driver = Selenium::WebDriver.for :firefox driver.navigate.to "https://min.e-boks.dk/logon.aspx?logontype=oces" loop do break if driver.title =~ %r(^e-Boks ) sleep 1 end cookies = driver.manage.all_cookies driver.quit cookies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login \n headless = Headless.new\n headless.start\n \n @browser = Watir::Browser.start LOGIN_URL\n\n # Delete all expired cookies\n delete_cookies_if_expire\n # Use unexpired cookies that match the given email and password\n the_cookies = use_cookies\n\n # Fresh login\n if the_cookies.nil?\n browser.text_field(id: 'username').set email\n browser.text_field(id: 'password').set password\n browser.button(name: 'button').click\n save_cookies\n # Cookies still exist\n else\n browser.cookies.clear\n the_cookies.each do |cookies|\n browser.cookies.add(cookies[:name], cookies[:value])\n end\n browser.goto BASE_URL \n end\n end", "def bb_login(username, password, bb_url)\n mech = Mechanize.new\n mech.log = Logger.new $stderr\n\n # Load website and log us in\n page = mech.get(bb_url)\n forms = format_forms(page)\n form = page.form_with :name => 'login'\n form.user_id = USERNAME\n form.password = PASSWORD\n form.submit\n\n #save the cookie jar for next request\n ret_jar = mech.cookie_jar\n return ret_jar\nend", "def login\n @browser.login\n end", "def login_clark\n top_login_button.click\n login_page.text\n \n user_email.send_keys($test_data['prod_email'])\n user_password.send_keys($test_data['prod_password'])\n\n login_button.click\n sleep 3\n profile_displayed\n end", "def login_user_with_interface(username, password)\n activate_authlogic \n visit login_path\n click_link \"Connexion | Inscription\"\n fill_in 'user_session_username', :with => username\n fill_in 'user_session_password', :with => password\n click_button \"Connexion\"\n wait_for_ajax \nend", "def login\n begin\n File.open(\"#{Settings.root}/tmp/cookies.txt\").read \n rescue Exception => e\n `curl --user-agent \"#{user_agent}\" -s -c #{Settings.root}/tmp/cookies.txt http://online.wsj.com/home-page` \n `curl --user-agent \"#{user_agent}\" -s -c #{Settings.root}/tmp/cookies.txt -d \"[email protected]&password=2p2aia5\" http://commerce.wsj.com/auth/submitlogin` \n end\n true\n end", "def login_user_for_feature(user)\n visit new_user_session_path\n close_cookies_alert\n fill_in 'Email', with: user.email\n fill_in 'Password', with: user.password\n click_on 'Log in'\n user_should_be_logged_in\n page_should_finish_loading\nend", "def service_log_in(user)\n # Get the jsession_id from the initial navigation to the site.\n jsession_id = BaseTest.driver.manage.cookie_named('JSESSIONID')[:value]\n\n # This is a pretty insecure site, and simple to do, you might have more complexity in your own implementation.\n auth_headers = { 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',\n 'Accept-Encoding' => 'gzip, deflate',\n 'Accept-Language' => 'en-US,en;q=0.8',\n 'Cache-Control' => 'max-age=0',\n 'Content-Length' => '179',\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Cookie' => \"JSESSIONID=#{jsession_id}\",\n 'Origin' => 'http://demo.borland.com',\n 'Referer' => 'http://demo.borland.com/InsuranceWebExtJS/index.jsf',\n 'Host' => 'demo.borland.com',\n 'Upgrade-Insecure-Requests' => '1',\n 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36' }\n\n auth_body = \"login-form=login-form&login-form%3Aemail=#{ERB::Util.url_encode(user.email)}{&login-form%3Apassword=#{user.password}&login-form%3Alogin.x=34&login-form%3Alogin.y=7&javax.faces.ViewState=j_id1%3Aj_id2\"\n\n auth_response = make_request(AllPages.login_page.base_url + AllPages.login_page.url + \";jsessionid=#{jsession_id}\", 'post', auth_headers, auth_body, [200])\n\n DemoBaseTest.driver.manage.add_cookie({ :name => 'UserSessionFilter.sessionId', :value => jsession_id, :exipres => 'Thu, 06-Oct-2016 20:25:20 GMT' })\n BaseTest.driver.navigate.refresh\n end", "def emulate_javascript_set_cookie\n @browser.get(HOST + \"Login.asp\")\n @browser.get(HOST + \"Search.asp\")\n end", "def open\n @browser.goto @@site_url + \"/login.php\"\n\tWatir::Wait.until { self.loaded? LoginPage.title}\n self\n end", "def login\n\t\tnavigate(@login_path)\n\n\t\tlogin_form = find_by_xpath(@signin_xpath)\n\t\tlogin_field = find_by_id('login_field')\n\t\tpassword_field = find_by_id('password')\n\n\t\tlogin_field.send_keys(@username); sleep 1\n\t\tpassword_field.send_keys(@password); sleep 1\n\n\t\tlogin_form.click; sleep 15\n\tend", "def Surveyhead_login(email,passwd)\n\n # New IE instance creation\n driver = Selenium::WebDriver.for :firefox, :profile => \"Selenium\"\n ff = Watir::Browser.new driver\n #ff.maximize\n\n ff.goto('http://www.p.surveyhead.com')\n # Setting login credentials (email/password)\n #ff.link(:id,\"memLogin\").click\n ff.text_field(:name, \"txtEmail\").set(email)\n ff.text_field(:name, \"txtPassword\").set(passwd)\n\n ff.button(:value,\"Login\").click\n sleep 15\n if(ff.link(:id,\"sb-nav-close\").exists?)\n\t ff.link(:id,\"sb-nav-close\").click\n end\n sleep 5\n \n if(ff.div(:id=>\"loadingSurveys\").exists?)\n\t while ff.div(:id=>\"loadingSurveys\").visible? do\n\t\t sleep 0.5\n\t\t puts \"waiting for surveys to load\"\n\t end\n end\n \n raise(\"Sorry! System Failed to login to Usampadmin\") unless ff.link(:text,'Logout').exists?\n return ff\n\n end", "def log_in\n visit \"/gp/login.do\"\n fill_in \"id\", :with => @user\n fill_in \"clave\", :with => @password\n first(\".bLogin a\").click\n end", "def login(browser = getBrowser(@displays, @headless))\n if @displayProgress\n puts \"\\x1B[90mAttempting to establish connection with: #{@login_uri}\\x1B[0m\"\n end\n browser.goto(@login_uri)\n browser.text_field(:name => 'username').set @username\n browser.text_field(:name => 'password').set @pin\n browser.checkbox(:name => 'remember').set\n browser.input(:type => 'submit', :value => 'Continue').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed first page\\x1B[0m\"\n end\n browser.select_list(:name => 'firstAnswer').option(:value => getCharAt(browser.label(:for => 'lettera').text.gsub(/[^0-9]/, ''), @security)).select\n browser.select_list(:name => 'secondAnswer').option(:value => getCharAt(browser.label(:for => 'letterb').text.gsub(/[^0-9]/, ''), @security)).select\n browser.input(:type => 'submit', :value => 'Log in').click\n if browser.link(:id => 'confirmpd').exists?\n browser.link(:id => 'confirmpd').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed occasional confirmation page\\x1B[0m\\n\"\n end\n end\n if @displayProgress\n puts \"\\x1B[90mSuccessfully logged in to BarclayCard\\x1B[0m\\n\"\n end\n browser\n end", "def login(browser = getBrowser(@displays, @headless))\n if @displayProgress\n puts \"\\x1B[90mAttempting to establish connection with: #{@login_uri}\\x1B[0m\"\n end\n browser.goto(@login_uri)\n browser.text_field(:name => 'frmLogin:strCustomerLogin_userID').set @username\n browser.text_field(:name => 'frmLogin:strCustomerLogin_pwd').set @password\n browser.checkbox(:name => 'frmLogin:loginRemember').set\n browser.input(:id => 'frmLogin:btnLogin1').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed first page\\x1B[0m\"\n end\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo1').option(:value => \"&nbsp;#{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo1').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo2').option(:value => \"&nbsp;#{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo2').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.select_list(:name => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo3').option(:value => \"&nbsp;#{getCharAt(browser.label(:for => 'frmentermemorableinformation1:strEnterMemorableInformation_memInfo3').when_present(5).text.gsub(/[^0-9]/, ''), @security)}\").select\n browser.input(:id => 'frmentermemorableinformation1:btnContinue').click\n until browser.link(:title => 'View the latest transactions on your Lloyds Account').exists? do\n # Email Confirmation Page\n if browser.input(:id => 'frm2:btnContinue2', :type => 'image').exists?\n browser.input(:id => 'frm2:btnContinue2', :type => 'image').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) email confirmation page\\x1B[0m\\n\"\n end\n end\n # Offers Page\n if browser.link(:title => 'Not right now').exists?\n browser.link(:title => 'Not right now').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) offers page\\x1B[0m\\n\"\n end\n end\n # Occasional 'Important Update' Page\n if browser.checkbox(:id => 'frmmandatoryMsgs:msgList1:0:chktmpMsgRead1').exists?\n browser.checkbox(:id => 'frmmandatoryMsgs:msgList1:0:chktmpMsgRead1').set\n if @displayProgress\n puts \"\\x1B[90mTicked checkbox to confirm I've read a message\\x1B[0m\\n\"\n end\n end\n if browser.checkbox(:id => 'frmmandatoryMsgs:tmpAllMsgsRead').exists?\n browser.checkbox(:id => 'frmmandatoryMsgs:tmpAllMsgsRead').set\n if @displayProgress\n puts \"\\x1B[90mTicked checkbox to never show a message again\\x1B[0m\\n\"\n end\n end\n if browser.input(:id => 'frmmandatoryMsgs:continue_to_your_accounts2').exists?\n browser.input(:id => 'frmmandatoryMsgs:continue_to_your_accounts2').click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) important information page\\x1B[0m\\n\"\n end\n end\n if browser.li(:class => 'primaryAction').link(:index => 0).exists?\n browser.li(:class => 'primaryAction').link(:index => 0).click\n if @displayProgress\n puts \"\\x1B[90mSuccessfully bypassed (occasional) offers page\\x1B[0m\\n\"\n end\n end\n end\n if @displayProgress\n puts \"\\x1B[90mSuccessfully logged in to Lloyds\\x1B[0m\\n\"\n end\n sleep(2)\n browser\n end", "def Surveyhead_sm_login(email,passwd)\n \n # New IE instance creation\n driver = Selenium::WebDriver.for :firefox, :profile => \"Selenium\"\n ff = Watir::Browser.new driver\n #ff.maximize\n\n # Opening Usampadmin site\n ff.goto('http://www.sm.p.surveyhead.com')\n\n # Setting login credentials (email/password)\n ff.text_field(:name, \"txtEmail\").set(email)\n ff.text_field(:name, \"txtPassword\").set(passwd)\n #Click login button\n ff.button(:value, \"Login\").click\n sleep 15\n if(ff.link(:id,\"sb-nav-close\").exists?)\n\t ff.link(:id,\"sb-nav-close\").click\n end\n sleep 5\n \n if(ff.div(:id=>\"loadingSurveys\").exists?)\n\t while ff.div(:id=>\"loadingSurveys\").visible? do\n\t\t sleep 0.5\n\t\t puts \"waiting for surveys to load\"\n\t end\n end\n \n \n # Checkpoint to verify that login was successful\n raise(\"Sorry! System Failed to login to Usampadmin\") unless ff.link(:text,'Logout').exists?\n return ff\n end", "def login\n mech = Mechanize.new\n page = mech.get(LOGIN_URL)\n username_field = page.form.field_with(id: \"user_email\")\n username_field.value = USER\n password_field = page.form.field_with(id: \"user_password\")\n password_field.value = PASS\n page.form.submit\n end", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie']\n end", "def login_from_cookie\n return if logged_in?\n return unless cookies[REMEMBER_ME_TOKEN]\n user = User.find_by_remember_token(cookies[REMEMBER_ME_TOKEN])\n if user && user.remember_token?\n self.current_user = user\n if !satellite_request?\n set_rememberme_token\n finalize_successfull_logon(:target => request.url)\n end\n end\n end", "def login(user,pass)\n enter_text(user_field, user)\n enter_text(pass_field, pass)\n sleep 1\n # wait_for_login_done\n end", "def login_user\n visit \"/login\"\n fill_in \"session[name]\", with: \"DJ\"\n fill_in \"session[password]\", with: \"pw\"\n click_link_or_button(\"Login\")\n end", "def login_site(user, pass)\n @b.goto \"https://cursos.alura.com.br/loginForm\"\n sleep @sleep_padrao\n 2.times do\n if @b.url == \"https://cursos.alura.com.br/loginForm\"\n @b.text_field(id: 'login-email').set user #preencher\n @b.text_field(id: 'password').set pass #preencher\n @b.button(class: \"#{@button_login}\").click\n sleep @sleep_padrao\n else\n break\n end\n end\nend", "def login_and_get_initial_page(user_name, password)\n login_page = retrieve_url(\"https://my.idc.ac.il/my.policy\")\n # Check if moved to error page already, and return to main page.\n if login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\" || login_page.uri.to_s == \"https://my.idc.ac.il/my.logout.php3?errorcode=19\"\n @scrape_logger.info(\"#{__method__} - arrived session TO page on login. Clicking link to return...\")\n puts \"#{__method__} - arrived session TO page on login. Clicking link to return...\" # to do remove\n login_page = login_page.link_with(:text=>\"click here.\").click\n end\n if login_page.uri.to_s != \"https://my.idc.ac.il/my.policy\"\n raise \"failed_to_reach_login_page_exception uri:#{login_page.uri.to_s}\"\n end\n login_form = login_page.form(\"e1\")\n if nil == login_form\n raise \"couldnt_find_login_form_exception #{}\"\n end\n \n login_form.username = user_name\n login_form.password = password\n user_home_page = agent.submit(login_form, login_form.buttons.first)\n # to do - make a better login check, like looking for the login error message\n # maybe look for some contents inside too\n if user_home_page.uri.to_s != \"http://my.idc.ac.il/idsocial/he/Pages/homepage.aspx\"\n raise \"couldnt_login_form_exception uri:#{user_home_page.uri.to_s}\"\n end\n \n return user_home_page\n end", "def login( wikipath, user, pass )\n Timeout.timeout( 300 ) do\n @agent = Mechanize.new\n @agent.agent.http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @agent.agent.http.reuse_ssl_sessions = false\n # @agent.agent.http.ca_file = ca_path\n if @cookies.nil?\n url = @dokuwiki_page_url + wikipath\n page = get( url )\n # Submit the login form\n wait_second\n page = page.form_with( id: 'dw__login' ) do |f|\n f.field_with( name: 'u' ).value = user\n f.field_with( name: 'p' ).value = pass\n f.checkbox_with( name: 'r' ).check\n end.click_button\n f = page.forms[ 1 ]\n @sectok = f.field_with( name: 'sectok' ).value\n @agent.cookie_jar.save( COOKIES )\n else\n @agent.cookie_jar.load( COOKIES )\n end\n end\n end", "def login_rave\n @session = Capybara::Session.new(:selenium)\n @session.visit \"https://conlabtesting93.mdsol.com/\"\n @session.find('#UserLoginBox').set 'defuser'\n @session.find('#UserPasswordBox').set 'password'\n @session.find('#LoginButton').click\n end", "def login_to_system(username='admin', password='dirtybird')\n self.username = username\n self.password = password\n\n # Hack to work-around issue with the login_page page object\n # where the password control is not available unless we \n # resize the browser.\n\n @browser.window.resize_to(1280, 1024)\n\n login\n end", "def execLogin\n timer = WebCrawler::startTime\n login=true\n begin\n if @vars[:loginPage]=='' then return nil end\n @session.visit @vars[:loginPage]\n @session.driver.find_css(@vars[:usernameInput]).first.set @vars[:username]\n @session.driver.find_css(@vars[:passwordInput]).first.set @vars[:password]\n if @vars[:captcha]!=''\n @session.driver.find_css(@vars[:captchaInput]).first.set @vars[:captcha]\n end\n @session.driver.find_css(@vars[:loginSubmit]).first.click\n rescue Selenium::WebDriver::Error::WebDriverError ,\n Selenium::WebDriver::Error::UnknownError => e\n WebCrawler::logError 'webcrawler.driver', e.message\n login=false\n rescue => e\n WebCrawler::logError 'webcrawler.login', e.message\n login=false\n end\n WebCrawler::logTime timer, 'login.visit', @vars[:loginPage]\n if ((@vars[:sleepLogin]).to_i)>0\n sleep(((@vars[:sleepLogin]).to_i.to_f)/1000)\n end\n return login\n end", "def login(user, pass, mechanize_agent)\n\n tries = 0\n begin \n homepage = mechanize_agent.get('http://deviantart.com')\n login_form = homepage.form_with(dom_id: \"form-login\")\n login_form.field_with(dom_id: \"login-username\").value = user\n login_form.field_with(dom_id: \"login-password\").value = pass\n login_form.submit\n rescue\n puts \"Login error. retrying...\"\n tries += 1\n if tries < 3\n sleep (2 ** tries)\n retry\n else \n puts \"Tried three times, bailing.\"\n end\n end\nend", "def login\n service_response = UserManagement::Login.new(params.merge(browser_user_agent: http_user_agent)).perform\n\n if service_response.success?\n # NOTE: delete cookie value from data\n cookie_value = service_response.data.delete(:cookie_value)\n set_cookie(\n GlobalConstant::Cookie.user_cookie_name,\n cookie_value,\n GlobalConstant::Cookie.user_expiry.from_now\n )\n end\n\n render_api_response(service_response)\n end", "def login_page\n login = @wait.until{\n element = @browser.find_element :xpath, '//form[@id=\"new_user\"]/div[1]/h3'\n element if element.displayed?\n }\n return login\n end", "def login\n @agent = Mechanize.new\n @page = @agent.get 'https://p.eagate.573.jp/gate/p/login.html'\n @page.encoding = 'utf-8'\n\n form = @page.forms[0]\n form.KID = Config::USER\n form.pass = Config::PASS\n @page = @agent.submit(form)\n end", "def do_login\n @login_results = login\n @cookie = @login_results.headers['Set-Cookie'] || @login_results.headers['set-cookie']\n end", "def login(user_data)\n agent = Mechanize.new\n page = agent.get('http://sga.itba.edu.ar/')\n login_form = page.form\n login_form.user = user_data[0]\n login_form.password = user_data[1]\n login_form.js = 1\n login_form.submit\nend", "def login\n page = agent.get('http://login.live.com/login.srf?id=2')\n form = page.forms.first\n form.login = options[:username]\n form.passwd = options[:password]\n form.PwdPad = ( \"IfYouAreReadingThisYouHaveTooMuchFreeTime\"[0..(-1 - options[:password].to_s.size )])\n query_string = page.body.scan(/g_QS=\"([^\"]+)/).first.first rescue nil\n form.action = login_url + \"?#{query_string.to_s}\"\n page = agent.submit(form)\n \n # Check for login success\n if page.body =~ /The e-mail address or password is incorrect/ ||\n page.body =~ /Sign in failed\\./\n raise( Blackbook::BadCredentialsError, \n \"That username and password was not accepted. Please check them and try again.\" )\n end\n \n page = agent.get( page.body.scan(/http\\:\\/\\/[^\"]+/).first )\n end", "def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user and user.active\r\n fill_login_data(user, true)\r\n return(redirect_to params[:return_to], allow_other_host: true)\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n # Display login\r\n route = params[:route] || 'poll'\r\n redirect_to(\"/#{route}?poll_id=login&return_to=#{params[:return_to]}\", allow_other_host: true)\r\nend", "def spike_login()\n\t\tagent = Mechanize.new\n\t\tlogin = agent.get(self.spike_root_url) #Go to login page\n\t\tloginform = agent.page.forms.first #Select login form\n\t\tloginform.username = self.username\n\t\tloginform.password = self.password\n\t\tgsr = agent.submit(loginform, loginform.buttons.first) #Submit form and log in\n\t\treturn {'agent' => agent, 'gsr' => gsr}\n\tend", "def test01_login\n\t \n\t# Open the root of the site we specified when we created the\n\t# new driver instance, above.\n\t$Browser.open \"/\"\n \n\t$Browser.click \"link=LOG IN\"\n\tputs \"I have clicked Log in link\"\n\tsleep 25\n\t$Browser.wait_for_page_to_load \n\tputs \"Im inside Loginlogoutmethod\" \n\t$Browser.type \"user_session_email\", \"[email protected]\"\n\t$Browser.type \"user_session_password\", \"123456\"\n\t$Browser.click \"user_session_submit\"\n\t\n\tsleep 20\n\t#$Browser.wait_for_page_to_load \n\tbegin\n\t\tassert $Browser.is_text_present(\"LOG OUT\")\n\t\tputs \"Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Login was Failed :(\"\n\t\t$verification_errors << $!\n\tend\n\tputs \"End of Login Method\"\nend", "def Network_site_login(email,passwd,type)\n \n # New Firefox instance creation\n driver = Selenium::WebDriver.for :firefox, :profile => \"Selenium\"\n ff = Watir::Browser.new driver\n #ff.window.resize_to(800, 600)\n #ff.maximize()\n \n #capabilities = Selenium::WebDriver::Remote::Capabilities.firefox #(:javascript_enabled => true, :proxy=> Selenium::WebDriver::Proxy.new(:http => \"localhost:5865\"))\n #driver = Selenium::WebDriver::Remote::Capabilities.firefox(:profile => \"Selenium\")\n #ff = Watir::Browser.new(:remote, :url => \"http://127.0.0.1:4444/wd/hub\", :desired_capabilities => capabilities)\n# ff = Selenium::Client::Driver.new \\\n# :host => \"localhost\",\n# :port => 4444,\n# :browser => \"*chrome\",\n# :timeout_in_second => 60,\n# :url => \"https://p.network.u-samp.com/\"\n#\n# ff.driver.start_new_browser_session(:captureNetworkTraffic => true)\n #firefox.exe -P Selenium\n #ff = custom C:\\Program Files\\Mozilla Firefox\\firefox.exe -P firefox_browser\n #ff.clear_cookies\n # Opening Usampadmin site\n #capabilities = Selenium::WebDriver::Remote::Capabilities.firefox #(:javascript_enabled => true, :proxy=> Selenium::WebDriver::Proxy.new(:http => \"localhost:5865\"))\n #ff = Watir::Browser.new(:remote, :url => \"http://127.0.0.1:4444/wd/hub\", :desired_capabilities => capabilities)\n #ff = Watir::Browser.new(:remote, :url => \"http://127.0.0.1:4444/wd/hub\", :desired_capabilities => capabilities)\n #ff = Watir::Browser.new(:remote, :desired_capabilities => capabilities)\n #ff = Watir::Browser.start(\"http://127.0.0.1:4444/wd/hub\", :firefox, :remote)\n ff.goto('https://p.network.u-samp.com/login.php')\n #ff.clear_cookies\n # Setting login credentials (email/password)\n if (type == 'Client')\n ff.radio(:value, \"Client\").set\n else\n ff.radio(:value,\"Publisher\").set\n end\n ff.text_field(:id, \"txtEmail\").set(email)\n ff.text_field(:id, \"txtPassword\").set(passwd)\n #Click login button\n \n puts \"Before loging to Network site\"\n \n ff.link(:id,\"btnLogin\").click\n sleep 5\n \n puts \"After loging to Network site\"\n \n # Checkpoint to verify that login was successful\n #ff.frame(:id,\"iframebox\").link(:text, \"Click Menu Item\").click ...\n #iframe id=\"iframebox\"\n #ff.text.should include(\"welcome\")\n# if (ff.contains_text('Welcome'))\n# puts \"Logged it to Network site\"\n# else\n# puts \"Sorry! System Failed to login to Network site\"\n# end\n return ff\n end", "def fb_login\n @driver.get(@login_url + 'login')\n email_field = @driver.find_element(:id, 'email')\n email_field.clear\n email_field.send_keys @fb_login['fb_user']\n password_field = @driver.find_element(:id, 'pass')\n password_field.clear\n password_field.send_keys @fb_login['fb_pass']\n @driver.find_element(:name, 'login').click\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n wait.until do\n @driver.find_element(:id, 'q')\n end\n end", "def login_from_cookie\n user = cookies.signed[:remember_me_token] && user_class.sorcery_adapter.find_by_remember_me_token(cookies.signed[:remember_me_token]) if defined? cookies\n if user && user.has_remember_me_token?\n set_remember_me_cookie!(user)\n session[:user_id] = user.id.to_s\n after_remember_me!(user)\n @current_user = user\n else\n @current_user = false\n end\n end", "def try_login_chain_with_cookie\n login_from_cookie || try_login_chain_without_cookie\n end", "def test05_ValidLogin_TC_24862\n\t\t$browser.cookies.clear\n\t\t$browser.goto($patch_login)\n\t\t$email.set(\"#{$user_master_email}\")\n\t\t$password.set(\"#{$user_master_password}\")\n\t\t$sign_in_button.click\n\t\tsleep 4\n\t\t\n\t\tbegin \n\t\t\tassert $logged_in_avatar.exists?\n\t\t\trescue => e\n\t\t\tputs e\n\t\t\tputs \"LS2T2: FAILED! User not logged in.\"\n\t\tend\t\n\tend", "def sign_in\n $users.logged_in_user.sign_out unless $users.current_user==nil\n # This line is required because visiting the login page doesn't\n # actually work when you're currently logged in.\n #s_o.click if s_o.present?\n visit LoginPage do |log_in|\n log_in.username.set @user_name\n log_in.login\n end\n# on(Researcher).logout_button.wait_until_present\n @session_status='logged in'\n end", "def login\n unless (@login and @password)\n raise \"Can't log in without login and password\"\n end\n \n lform = @agent.get('https://login.yahoo.com/config/login').form('login_form')\n lform.login = @login\n lform.passwd = @password\n begin\n @agent.submit(lform, lform.buttons.first)\n rescue Exception => e\n puts \"Oops: #{e}\"\n end\n end", "def test_document_server(url)\n test_name = \"Test Document Server Connection\"\n puts test_name\n get_website(url)\n login_as_guest_test\n if @browser.find_element(:css=>'.focus') #Dismisses the splashscreen if present\n @wait.until{@browser.find_element(:css=>'.focus')}.click\n end\n login_toolshelf_button_test\n login_test\nend", "def verifica_logado\n sleep(3)\n if @browser.table(:class, \"f\").exist? == true\n if @browser.table(:class, \"f\").contains_text(\"©2011 Google\")\n @browser.text_field(:name, 'Email').set($login_user)\n if ENV['FIREWATIR']\n @browser.text_field(:name, \"Passwd\").set($password_user)\n else\n @browser.password(:name, \"Passwd\").set($password_user)\n end\n @browser.button(:name, 'signIn').click\n else\n end\n elsif\n if @browser.div(:class, \"glb-bloco layout-login\").exists? ==true\n @browser.text_field(:name, \"login-passaporte\").set(\"[email protected]\")\n if ENV['FIREWATIR']\n @browser.text_field(:name, \"senha-passaporte\").set($password_user)\n else\n @browser.password(:name, \"senha-passaporte\").set($password_user)\n end\n @browser.button(:class, \"botao-acessar\").click\n end\n else\n end\n sleep(1)\nend", "def tirerack_login\n a = Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari'}\n page = a.get(\"http://www.tirerackwholesale.com/whlogin/Login.jsp\")\n form = page.form_with(:name => \"login\")\n form.customerID = LOGIN_TIRERACK\n form.passWord = PWD_TIRERACK\n page = a.submit(form)\n puts \"Logged in to Tirerack, resulting in #{page.class}\\n\"\n end", "def login\n\n # disable logging in for this step so we don't spew to stdout (since before_class methods aren't captured)\n # out = $stdout\n # page.driver.client.phantomjs_logger = out\n page.driver.client.phantomjs_logger = NetLogConsoleFilter.new\n\n visit url()\n wait_for_state(\"login\")\n assert has_selector?('button.login')\n fill(\n :username => \"pixelcop\",\n :password => \"testtest\"\n )\n click_button(\"Login\") # case sensitive\n wait_for_state(\"inventory\")\n end", "def login(email, password)\n login_link = @driver.find_element(:id, 'login-nav')\n login_link.click\n $verbose ? puts('logging in as ' + email) : nil\n # fill out login form\n complete_login_process(email, password)\n # wait for redirect to finish by checking for footer element\n handle_oauth_redirect(email)\n # accept SCP terms of service if needed\n accept_scp_tos\n $verbose ? puts('login successful') : nil\n end", "def login(username,password)\n puts \"in login\"\n sleep(2)\n switch_to_active_modal\n login_modal = find(LOGIN_MODAL)\n puts (\"login_modal is #{login_modal}\")\n find(USERNAME)\n type(USERNAME, username)\n password_field = find(PASSWORD)\n type(PASSWORD, password)\n password_field.submit()\n sleep(4)\n end", "def administrator_login user, password\r\n cf_cookies = administrator_9x_login user, password\r\n unless got_auth? cf_cookies\r\n cf_cookies = administrator_10x_login user, password\r\n end\r\n cf_cookies\r\n end", "def logon(browser, creds=credentials)\n name, email, password = creds\n browser.goto COMMUNITY_URL\n browser.url.should == COMMUNITY_URL\n\n # note, mac ff needs a couple of attempts to scroll view to Login\n login_elem = browser.link(:text, 'Login')\n scroll_right browser, login_elem\n attempt(3) { login_elem.hover }\n attempt(3) { login_elem.click }\n\n email_xpath = '//*[@id=\"login_form\"]//*[@id=\"email\"]'\n password_xpath = '//*[@id=\"login_form\"]//*[@id=\"password\"]'\n\n browser.text_field(:xpath, email_xpath).when_present.set email\n browser.text_field(:xpath, password_xpath).set password\n browser.button(:name, 'login').click\n end", "def detect_auto_login_cookie \r\n logger.info(\"-----------------detecting loginf cookie\")\r\n if session[:user_session].nil? && cookies[WebappConstants::AUTO_LOGIN_COOKIE_NAME]\r\n session[:return_to] = request.request_uri\r\n logger.info(\"doing auto login\")\r\n do_auto_login\r\n #redirect_to :controller=>:session, :action=>do_auto_login\r\n end\r\n \r\n end", "def more_login\n page(FooterTabBarPage).select_tab(\"Profile\")\n page(LoginPage).await\n page(LoginPage).login(\"valid\")\n end", "def login\n #this assumes we can get to signin from here\n login = @agent.get('http://www.xanga.com/signin.aspx')\n form = login.form('frmSigninRegister')\n \n #this assumes default domain is xanga\n form.txtSigninUsername = @user\n form.txtSigninPassword = @pw\n \n #this assumes first button will be the submit button\n page = @agent.submit(form, form.buttons.first)\n end", "def cookie_login\n @current_user = User.find(cookies[:user_id])\n return @current_user.password_hash == cookies[:password_hash] \n rescue \n return false\n end", "def signIn(login, password)\n visit root_path\n visit \"/session/new\"\n fill_in \"login\", :with => login\n fill_in \"password\", :with => password\n within(\".content\") do\n click_button \"Login\"\n end\nend", "def bl_check_session\n \n # Check if the user is logged in (has an active session)\n # If not, check if he's got a cookie (to perform the auto-login)\n # Otherwise, return user not logged-in -> requires the user to login using the bookmarklet or redirect to the site\n\n # 1. Auto-login user based on a valid and active bookmarklet token -->\n # Previously logged in using the bookmarklet\n # * User has a 'bookmarklet_session_token' attribute defined\n # * User has a valid session OR cookie on the 'host site'\n #\n # 2. Auto-login user based on the 'host site' credentials --> \n # hasn't used bookmarklet yet, but logged in with a vaild session OR cookie\n # - User doesn't have a valid 'bookmarklet_session_token'\n # - If the user has an active session (checking session[:user])\n # - OR if the user has a valid cookie (for 'remember me' functionality)\n # \n # 3. User is required to login -->\n # hasn't used the 'host site', not logged in using the bookmarklet before\n # OR session OR cookie has expired on the 'hots site'\n # - User logged out from the 'host site'\n # - User has an inactive session without a cookie or with an invalid cookie\n\n # Otherwise, check if the user has an active cookie\n login_from_cookie if session[:user].nil? && cookies[:auth_token]\n \n if session[:user] # User logged in through the host site\n \n @server_response = \"key:\"\n \n if !(@server_response = @server_response + session[:user].bookmarklet_session_token)\n \n # Create the 'bookmarklet_session_token' for subsequent bookmarklet calls\n @server_response = @server_response + generate_bookmarklet_session_token(session[:user])\n \n end\n \n else # User might have used the bookmarklet before but session or cookie expired --> force login and ensure bookmarklet token is reset\n @server_response = \"err:000\"\n end\n \n @flyc_action = \"login\"\n \n render 'bookmarklet/simple.html', :layout => false\n \n end", "def login\n\t\t\tresponse = @http.get(\"/authentication/whoami\")\n\t if(response.code == '200')\n\t set_cookie(response)\n\t puts \"\"\n\t puts \"================\"\n\t puts \"login\"\n\t login_response = @http.post(\"/authentication/login\",\"username=#{@username}&password=#{@password}&skin=#{@skin}&account=#{@account}\",{'Cookie' => @cookies.to_s})\n\t check_cookie(login_response)\n\t login_check(login_response)\n\t puts \"--------\"\n\t else\n\t puts \"Error invalid host #{response.message}\"\n\t abort #if the login site is invalid, then abort\n\t end \n\t\tend", "def login\n tries ||= 3\n puts \"========= Performing Login\"\n @log.add_message(\"Efetuando login com #{self.aliexpress.email}\\n\")\n @b.goto \"https://login.aliexpress.com/\"\n frame = @b.iframe(id: 'alibaba-login-box')\n frame.text_field(name: 'loginId').set self.aliexpress.email\n sleep 1\n frame.text_field(name: 'password').set self.aliexpress.password\n sleep 1\n frame.button(name: 'submit-btn').click\n sleep 5\n rescue => e\n puts e.message\n @log.add_message \"Erro de login, Tentando mais #{tries} vezes\"\n @log.add_message e.message\n retry unless (tries -= 1).zero?\n end", "def login\n tries ||= 3\n puts \"========= Performing Login\"\n @log.add_message(\"Efetuando login com #{self.aliexpress.email}\\n\")\n @b.goto \"https://login.aliexpress.com/\"\n frame = @b.iframe(id: 'alibaba-login-box')\n frame.text_field(name: 'loginId').set self.aliexpress.email\n sleep 1\n frame.text_field(name: 'password').set self.aliexpress.password\n sleep 1\n frame.button(name: 'submit-btn').click\n sleep 5\n rescue => e\n puts e.message\n @log.add_message \"Erro de login, Tentando mais #{tries} vezes\"\n @log.add_message e.message\n retry unless (tries -= 1).zero?\n end", "def initialize\n @browser = Watir::Browser.new\n puts 'Trying to open https://demo.bendigobank.com.au/banking/sign_in'\n @browser.goto 'https://demo.bendigobank.com.au/banking/sign_in'\n puts '>Page successfully loaded'\n puts 'Trying to log in'\n @browser.button(name: 'customer_type').click\n puts '>Successfully logged in'\n load_page\n end", "def login\r\n if cookies.signed[:remember_me]\r\n user = DcUser.find(cookies.signed[:remember_me])\r\n if user\r\n fill_login_data(user, true)\r\n return redirect_to params[:return_to]\r\n\r\n else\r\n clear_login_data # on the safe side\r\n end\r\n end\r\n# Display login \r\n route = params[:route] || 'poll'\r\n redirect_to \"/#{route}?poll_id=login&return_to=#{params[:return_to]}\"\r\nend", "def getLoginPage(driver)\n driver.navigate.to Page.find[:URL][:home]\n Page.find[:topBar][:login].call(driver).click\nend", "def access_sign_in_page\n\t\[email protected](@sign_in_url)\n\tend", "def youtrack_login username, password, http\n\t# First, login to youtrack given above credentials\n\tlogin_url = \"/youtrack/rest/user/login\"\n\tputs \"Logging into Youtrack as root...\"\n\trequest = Net::HTTP::Post.new(login_url)\n\trequest.body = \"login=#{username}&password=#{password}\"\n\trequest[\"Connection\"] = \"keep-alive\"\n\trequest[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n\tresponse = http.request(request)\n\tputs \"Success!\"\n\t# Save cookies for subsequent API requests\n\tcookies = response['set-cookie']\n\treturn cookies\nend", "def login_from_cookie\n # TODO: Can this be return nil instead?\n return false unless defined?(cookies)\n return false unless cookies.signed[:remember_me_token].present?\n\n # TODO: Simplify/DRY to:\n # `sorcery_orm_adapter.find_by(remember_me_token:`\n user =\n user_class.sorcery_orm_adapter.find_by_remember_me_token(\n cookies.signed[:remember_me_token]\n )\n\n return false unless user&.remember_me_token?\n\n set_remember_me_cookie!(user)\n session[sorcery_config.session_key] = user.id.to_s\n after_remember_me!(user)\n @current_user = user\n end", "def grab_cookies\n cookie = []\n Capybara.current_session.driver.cookies.each do |key, value|\n cookie.push(key + '=' + value.value)\n end\n cookie\nend", "def login(login = users(:zero_user).login, password = \"testpassword\",\n remember_me = true, session: self)\n login = login.login if login.is_a?(User) # get the right user field\n session.visit(\"/account/login/new\")\n\n session.within(\"#account_login_form\") do\n session.fill_in(\"user_login\", with: login)\n session.fill_in(\"user_password\", with: password)\n session.check(\"user_remember_me\") if remember_me == true\n\n session.first(:button, type: \"submit\").click\n end\n end", "def login (website, username, password = nil)\n return true if @website == website and browser.hidden(:name, 'sno').exist?\n \n @website = website\n puts \"[BrowserOperator] Login #{username} #{password}\"\n if password.nil?\n result = login_from_online_session username\n else\n result = fill_login_information username, password\n end\n \n browser.table(:id, 'table_html_body').wait_until_present(@time_out) if result\n result \n end", "def login(user, password)\n @@user = user\n password2 = password.to_s.gsub(/./, '*')\n debug \"login called for user=#{user} pass=#{password2}\"\n # trash and recreate cookie\n saveCookie(nil)\n cookie = getLoginCookie(user, password)\n if cookie\n saveCookie(cookie)\n else\n debug \"no cookie from login\"\n end\n # get the current (set of) cookie(s) and pretend that login was successful\n return cookie\n end", "def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end", "def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end", "def login\n RestClient.post(\"#{base_url}/j_spring_security_check\", {:j_username => username, :j_password => password}) do |response, request, result, &block|\n @cookies = response.cookies\n @cookies.delete('Path')\n if [301, 302, 307].include? response.code\n response\n else\n response.return!(request, result, &block)\n end\n end\n end", "def login(username, password)\n login_url = get(BASE_URL).match(/href=\"([^\"]+)\">login<\\/a>/)[1]\n form_html = get(BASE_URL + login_url)\n fnid = form_html.match(/<input type=hidden name=\"fnid\" value=\"([^\"]+)\"/)[1]\n response = post(LOGIN_SUBMIT_URL, 'fnid' => fnid, 'u' => username, 'p' => password)\n @username = username\n @password = password\n unless @cookie = response.header['set-cookie']\n raise LoginError, \"Login credentials did not work.\"\n end\n end", "def login\n @browser.goto \"instagram.com/accounts/login/\"\n @browser.text_field(:name => \"username\").set \"#{@username}\"\n @browser.text_field(:name => \"password\").set \"#{@password}\"\n @browser.button(:text => 'Log in').click\n sleep(2)\n end", "def login_to_recruiter(username, password)\n \tself.load unless current_url == self.load\n \tusername_field.set username\n \tpassword_field.set password\n \tlogin_button.click\n end", "def login_from_cookie\n return unless cookies['auth_token'] && !logged_in?\n token=cookies['auth_token'].value\n token=token[0] if token.is_a? [].class\n user = self.class.user_class.find_by_remember_token(token)\n if user && user.remember_token\n\n user.remember_me\n self.current_user = user\n cookies[:auth_token] = { :value => self.current_user.remember_token , :expires =>Time.parse( self.current_user.remember_token_expires_at) }\n\n\n end\n end", "def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend", "def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend", "def login(email_id, pass_word)\n\t\n\tputs \"************** START : Login to Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Login to Razoo ****************\"\t\nend", "def login(email_id, pass_word)\n\t\n\tputs \"************** START : Log into Razoo ****************\"\t\n\t$browser.click \"link=Log in\"\n\t$browser.wait_for_page_to_load \n\tputs \"Step 1 : Entering valid User credintials - User Name as #{email_id} and Password as #{pass_word}\"\n\t$browser.type \"user_session_email\", email_id \n\t$browser.type \"user_session_password\", pass_word\n\t$browser.click \"//button[@type='submit']\"\n\t$browser.wait_for_page_to_load \n\tbegin\n\t\tassert $browser.is_text_present(\"Login successful!\")\n\t\tputs \"Step 2 : Passed. Login was Successful!!!\"\n\trescue Test::Unit::AssertionFailedError\n\t\tputs \"Step 2 : Failed. Login Failed\"\n\tend\n\tputs \"************** END : Log into Razoo ****************\"\t\nend", "def login_from_cookie\nuser = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])\nif user && user.remember_token?\ncookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at }\nself.current_user = user\nend\nend", "def login\n login = @browser.find_element class: \"login-button\"\n login.click\n email = @browser.find_element id: \"signup_email\"\n email.send_keys \"[email protected]\"\n password = @browser.find_element id: \"signup_password\"\n password.send_keys \"BzZsjXjUTpIcq0w\"\n password.submit\n end", "def login(agent)\n logger.info(\"Logging in to #{LOGIN_URL}.\")\n\n login_page = agent.get(LOGIN_URL)\n form = login_page.form('frmFormsLogin')\n\n username, password = *scraper_args unless scraper_args.nil?\n form.Username = username || ask(\"username:\\n\")\n form.password = password || ask(\"password:\\n\") { |q| q.echo = \"•\" }\n\n prompts = agent.page.search(\".LoginPrompt\")\n if question = prompts[2].inner_html.strip rescue nil\n form.answer = ask( question ) { |q| q.echo = \"•\" }\n end\n\n agent.submit(form)\n sleep 3 # wait while the login takes effect\n end", "def login_as_alternative(user, pass)\n\tlogin_box = LoginForm.new(@browser)\n login_box.login_as user, pass\n end", "def login(url, username, password)\n token = get_token(url)\n response = https_post url, \"authenticity_token=#{}&user[login]=#{username}&user[password]=#{password}\", token[0], token[1]\n raise \"No redirect occured: server did not accept the request.\" unless response[0][\"status\"] == \"302\"\n \n return response[0]['set-cookie'].split(';')[0]\n end", "def login_page(page_name,user,pwd)\n\tbegin\n\t\ti=1\n\t\[email protected]_element(:class,\"sign-in\")\n\t\tlogin.click\n\t\[email protected]_element(:id,@a[2])\n\t\tusername.send_keys(user)\n\t\[email protected]_element(:id,@a[3])\n\t\tpassword.send_keys(pwd)\n\t\[email protected]_element(:class,\"signin_submit\")\n\t\[email protected]_screenshot(\"#{@path}/\" + page_name + i.to_s + \".png\")\n\t\tsubmit.click\n\t\ti= i + 1\n\t\tsleep 5\n\t\[email protected]_screenshot(\"#{@path}/\" + page_name + i.to_s + \".png\")\n\t\tsleep 2\n\t\[email protected]_element(:class,\"arrow-down\")\n\t\tarrow.click\n\trescue Selenium::WebDriver::Error::TimeOutError\n\t exit(1)\n end\nend", "def login_to_lfcom(username, password)\r\n visit LFSOAP::CONST_LF_LOGIN_URL\r\n fill_in 'atg_loginEmail', with: username\r\n fill_in 'atg_loginPassword', with: password\r\n click_button 'Log In'\r\n end", "def visit_server(user: nil, wait: 2, path: '/')\n url = \"http://#{Capybara.server_host}:#{Capybara.server_port}\"\n url += if user.present?\n \"/dev/log_in/#{user.id}?redirect_to=#{path}\"\n else\n path\n end\n\n p \"Visit server on: #{url}\"\n Launchy.open(url)\n\n if wait == 0\n p 'Type any key to continue...'\n $stdin.gets\n p 'Done.'\n else\n sleep wait\n end\n end", "def initialize_browser\n puts \"\\n>Initializing Firefox browser\"\n @browser = Watir::Browser.new :firefox\n @browser.send_keys :f11\n @homepage = Homepage.new(@browser)\n return @homepage\nend", "def cookie_login\n @current_player = Player.find(cookies[:player_id])\n @current_player.password_hash == cookies[:password_hash] \n rescue \n false\n end", "def firefox_1\n\n# variable declarations\nprofile =''\noutpath = datastore['DOWNLOAD_PATH']\npth =\"\\\"%appdata%\\\"\\\\Mozilla\\\\Firefox\\\\Profiles\"\n # check for proper settings enter by user ...\n if datastore['FIREFOX'] == 'nil' || datastore['DOWNLOAD_PATH'] == 'nil'\n print_error(\"Please set FIREFOX | DOWNLOAD_PATH options...\")\n print_line(\"\")\n return\n else\n print_status(\"Gattering Firefox credentials...\")\n end\n\n # check if file exist on target system\n if session.fs.file.exist?(path + \"\\\\profiles.ini\") # change the name of the file you want to check\n print_good(\" firefox profiles.ini found...\")\n # download file from target system\n client.fs.file.download(\"#{outpath}/profiles.ini\",\"#{pth}\\\\profiles.ini\") # change the name of the file you want to download\n print_good(\" Dumping credentials from target system...\")\n print_warning(\"Credentials dump: #{outpath}/profiles.ini\") # change the name of the file that you have downloaded\n # displays profile's directory names\n profile = client.fs.dir.entries(pth)\n print_status(\"Profile's directory: #{profile[2]}\")\n print_line(\"\")\n else \n print_error(\"Firefox path not found.\")\n return\n end\n rescue ::Exception => e\n print_error(\"Error Running Command: #{e.class} #{e}\")\n print_line(\"\")\nend", "def wait_a_sec_for_selenium\n sleep 1 if Capybara.current_driver == :selenium_firefox\n end", "def submit_login\n\n @@agent.get \"#{BASE_URL}/divanet/\"\n @@agent.page.form_with(name: 'loginActionForm') do |form|\n form.field_with(name: 'accessCode').value = @user.access_code #Setting.login_id\n form.field_with(name: 'password').value = @user.password #Setting.login_password\n form.click_button\n end\n\n # # ログインに成功してたらログアウトが存在するはず\n # puts true if @@agent.page.body =~ /divanet/logout/\n end", "def login\r\n print \"Logging in... \"\r\n login_page = @agent.get \"https://www.economist.com/user/login\"\r\n login_form = login_page.form_with(:id => \"user-login\")\r\n login_form[\"name\"] = @credentials['email']\r\n login_form[\"pass\"] = @credentials['password']\r\n user_page = @agent.submit login_form\r\n\r\n # we check for the email address on the page.\r\n #If not present, we assume login failed\r\n @login_success = user_page.body.include?(@credentials['email'])\r\n if (@login_success)\r\n print \"success\\n\"\r\n else\r\n print \"error\\nPlease check you credentials\"\r\n end\r\n @login_success\r\n end", "def connect(which)\n\t\taccount = Account.new(which)\n\n\t\t# Wait for page to load\n\t\tself.wait_until(TIMEOUT) do\n\t\t\tself.login_email? && self.login_email_element.visible?\n\t\tend\n\n\t\t# fill form\n\t\tself.login_email = account.email\n\t\tself.login_pwd = account.password\n\t\t# go\n\t\tself.login_go\n\t\t# Need to wait\n\t\tsleep(2)\n\tend", "def wait_for_login_element()\n wait_for :login_element, \"Error waiting for login element, you are possibly logged in \"\n end", "def wait_for_login_element()\n wait_for :login_element, \"Error waiting for login element, you are possibly logged in \"\n end" ]
[ "0.73265994", "0.71788573", "0.7105065", "0.67447335", "0.67420727", "0.67062974", "0.6684113", "0.6642855", "0.6633111", "0.65554416", "0.65110373", "0.64730686", "0.64524496", "0.6445762", "0.6437271", "0.643003", "0.63793963", "0.63672096", "0.63672096", "0.6344731", "0.6318616", "0.6298592", "0.62984836", "0.62965024", "0.62907183", "0.6288893", "0.62698793", "0.6260775", "0.625931", "0.62578243", "0.6251098", "0.62269145", "0.6223275", "0.62134075", "0.6213308", "0.6206018", "0.61872506", "0.6185918", "0.6158628", "0.61536354", "0.61483353", "0.61280406", "0.6124393", "0.6114461", "0.6111", "0.6099307", "0.60963947", "0.6089159", "0.6079534", "0.6057604", "0.60521096", "0.6048184", "0.6026927", "0.6024692", "0.601455", "0.6012871", "0.5979757", "0.5954894", "0.59450513", "0.59418154", "0.59392893", "0.59392893", "0.59361255", "0.59067565", "0.5898031", "0.5896703", "0.5894302", "0.58885074", "0.58850414", "0.5884579", "0.58826625", "0.58807945", "0.58767825", "0.58767825", "0.5871227", "0.5870245", "0.5856206", "0.58555925", "0.58516", "0.58515376", "0.58515376", "0.58515376", "0.5849752", "0.5843718", "0.58257633", "0.5817874", "0.58178157", "0.58174163", "0.58172446", "0.5806257", "0.57962424", "0.5782208", "0.57735425", "0.57675934", "0.57629025", "0.57590955", "0.5758088", "0.5752608", "0.57493794", "0.57493794" ]
0.7189555
1
Download all messages on a folder page.
def process_page(folderpage, folderpath, folderpath_hidden, agent) folderpage.search('//div[@id="messages"]/ul/li/dl').each do |msg| elm = msg.xpath('.//dt/label/input').first if elm["name"] != "did" $stderr.puts "Error. HTML may have changed, and script needs updating." $stderr.puts reason exit 1 end did = elm["value"] title = msg.xpath('.//dt/label/span').first.content sender = msg.xpath('.//dd[@class="content"]/span').first.content links = msg.xpath('.//dd[@class="content"]/ul/li/a') date = msg.xpath('.//dd[@class="actions"]/span').first.content.split('-').reverse.join('-') puts " - found Document ID: #{did} from #{date} (\"#{sender} - #{title}\")" links.each do |link| doctitle = title doctitle = "#{title} (#{link["title"]})" if link["title"] != title # Attachment query_args = link["href"].split('?', 2)[1] duid = query_args.match(/duid=(\w+)&/).captures.first url = "https://download.e-boks.dk/privat/download.aspx?#{query_args.gsub('&', '&amp;')}" # don't ask - the link is pseudo-escaped from e-boks's side file = "#{did}-#{duid}.pdf" if File.exist? "#{folderpath_hidden}/#{file}" puts " already downloaded, skipping." next else puts " downloading #{did} (#{doctitle})" File.open("#{folderpath_hidden}/#{file}", "w") { |f| f.write agent.get_file(url) } doctitle.gsub!(/\//, ':') # Determine filename, uniquifying if necessary filename = "#{date} - #{sender} - #{doctitle}" i = 2 while File.exist?("#{folderpath}/#{filename}.pdf") filename = "#{date} - #{sender} - #{doctitle} (#{i})" i += 1 end if SYMLINK File.symlink(".documents/#{file}", "#{folderpath}/#{filename}.pdf") else File.link("#{folderpath_hidden}/#{file}", "#{folderpath}/#{filename}.pdf") end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_messages(folder, archive_folder, batch_limit, href_regex, reporter=nil, &proc)\n messages = []\n \n if folder == archive_folder # don't descend into archive folder\n log.info \"skipping folder '#{folder}' because it's the archive folder\"\n return messages\n end\n \n # first, retrieve messages in the current folder, and return if we hit the limit\n message_hrefs = folder.message_hrefs href_regex\n log.info \"Total number of messages in folder '#{folder}' is: #{message_hrefs.size}\"\n \n message_hrefs.each do |message|\n begin\n message.raw # trigger the fetch of the raw data\n messages << message\n yield message if proc\n return messages if messages.size >= batch_limit\n rescue Exception => e\n log.warn \"There was a problem retrieving message from Exchange: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\")\n reporter.call(e) if reporter\n end\n end\n \n begin\n # then descend into the current folder's subfolders\n folder.folders.each do |sub_folder|\n return messages if messages.size >= batch_limit\n messages += fetch_messages(sub_folder, archive_folder, batch_limit-messages.size, href_regex, &proc)\n end\n rescue Exception => e\n log.warn \"There was a problem listing subfolders with Exchange: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\")\n reporter.call(e) if reporter\n return messages\n end\n \n messages\n end", "def download_folder\n folder = params[:fold]\n # Delete old .zip files\n FileUtilsC.delete_files_by_types(folder[0..folder.rindex('/') - 1], ['.zip'])\n\n if !folder.blank?\n # Zip folder and send zip file to client\n zipfile_name = BrowsingFile.zip_folder folder\n send_file zipfile_name, type: 'application/zip', x_sendfile: true\n end\n end", "def send_folder(path)\n response = self.create_section_response\n section = DocumentSection.from_path(path)\n Dir.chdir(DocumentFile::DOC_FILE_PATH + path) do |dir|\n if (readmes = Dir.glob(\"read*me.{html,htm,txt}\", File::FNM_CASEFOLD)).size > 0\n section.readme = {\n :type => (File.extname(readmes[0]) == \".txt\" ? \"text-plain\" : \"text-html\"), \n :text => File.read(readmes[0]), \n :file => readmes[0]\n }\n end\n end #Dir.chdir\n response[:sections] << section\n return response\n end", "def read_all_messages\n post(\"/api/read_all_messages\")\n end", "def download!\n folder = \"tmp/#{self.order_code}_\" + Time.now.strftime('%Y%m%d%H%M%S%L')\n files = []\n\n # check if the directory existence\n # create the directory if it does not exist yet\n Dir::mkdir(folder) if Dir[folder].empty?\n\n xml_file = to_xml(folder)\n\n files << xml_file\n \n self.order_items.each_with_index do |o_i, index|\n next if o_i.photo.nil? || o_i.photo.image_file_name.nil?\n\n o_photo_url = o_i.photo.image.url\n\n o_photo = open(o_photo_url, &:read)\n\n File.open(\"#{folder}/#{index}_#{o_i.photo.image_name}\", 'wb') do |file|\n file << o_photo\n end\n\n files << \"#{folder}/#{index}_#{o_i.photo.image_name}\"\n end\n \n File.open(\"#{folder}/message.txt\", 'wb') do |file|\n file << \"\"\n end\n files << \"#{folder}/message.txt\"\n\n ## zip\n Zip::File.open(\"#{folder}.zip\", Zip::File::CREATE) do |zipfile|\n files.each do |file|\n zipfile.add(file.split(\"/\").last, file)\n end\n end\n\n FileUtils.rm_rf(folder)\n\n \"#{folder}.zip\"\n end", "def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end", "def messages(*args)\n if new_record?\n raise Errors::FolderNotFound.new(@id, \"Folder does only exist locally\")\n else\n if !@conn_id.nil? && [email protected]? && selectable?\n self.class.message_class.all(@conn_id, @location.path, *args)\n else\n []\n end\n end\n end", "def folder_entries(folder, include_read: false, page: nil)\n EntriesPagination.folder_entries folder, self, include_read: include_read, page: page\n end", "def get_messages(page = 0)\r\n if page > 0\r\n message_url = \"/message_threads?page=#{page}\"\r\n else\r\n message_url = \"/message_threads\"\r\n end\r\n response = self.class.get(message_url, headers: { \"authorization\" => @user_auth_token })\r\n JSON.parse(response.body)\r\n end", "def download()\n get_page\n puts \"Page Found\"\n get_img_names\n get_img_links\n len = @imgLinks.length\n a = @imgLinks\n files = @files\n len.times do |f|\n puts \"#{a[f]} found\"\n File.open(files[f], \"w\") do |fo|\t\n fo.write open(a[f]).read\n\t\tend\n puts \"#{files[f]} downloaded\"\n end\n end", "def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end", "def list(folder)\n\t\tc = 0\n\t\tfolder = '/' + folder\t\t\t\n\t\tresp = @client.metadata(folder)\n\t\tputs \"\\n List of contents in \" + folder + \"\\n\"\n\t\tfor item in resp['contents']\t\t\n\t\t\tputs item['path']\n\n\t\t\tc=c+1\n\t\tend\t\n\t\t\n\tend", "def download\n link=params[:link]\n all_html = Nokogiri::HTML(open(link))\n create_folder\n save_html(all_html)\n #Get All CSS File\n all_html.xpath('//link/@href').each do |row|\n if check_link(row)\n css_path=row\n else\n css_path=link+row\n end\n getcss(css_path)\n end\n #Get All JS File\n all_html.xpath('//script/@src').each do |row|\n if check_link(row)\n js_path=row\n else\n js_path=link+row\n end\n\n getjs(js_path)\n end\n #Get All Images File\n all_html.xpath('//img/@src').each do |row|\n if check_link(row)\n images_path=row\n else\n images_path=link+row\n end\n\n getimages(images_path)\n end\n end", "def download_children(children, path)\n children.each do |child|\n new_path = \"#{path}/#{child.title}\"\n backup_folder_rec child.id, new_path if child.mimeType == FOLDER\n download_if_allowed_child child, new_path\n end\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def download_files files,dest,opts = {}\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n str = \"Will download #{files.size} files to #{dest} ... \"\n download_all_files files,dest\n str += \" Done !\"\n Logger.<<(__FILE__,\"INFO\",str) if opts[:v]\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end", "def get_messages( page=0 )\n\t result = []\n\t if page > 0\n\t response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n\t JSON.parse( response.body )\n\t else\n\t response = self.class.get( '/message_threads', body: { page: 1 }, headers: {'authorization' => @auth_token} )\n for page in 1..(response[\"count\"]/10 + 1)\n response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n result << JSON.parse(response.body)\n end\n result\n\t end\n\tend", "def index\n client = DropboxApi::Client.new(\"C8Eg7_xlTzAAAAAAAAAAMduh226EdjZy_X_pVqXkbOUenDBMOVpQwo0zhF9sr8bC\")\n @result = client.list_folder \"/Yann Doré\"\n pp @result.entries\n @result.has_more? \n end", "def results\n # Get folder and file\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n if @delete_type == 0 || @delete_type == 1 || @delete_type.nil?\n # Get paths and push to array\n folder_name = File.basename(params[:fold])\n path = \"<a href='/browsing_files/files?fold=#{params[:fold]}'>#{folder_name}</a>\"\n\n # Check if path exist\n check_path_exist = BrowsingFile.check_if_path_exist(@@arr_path, path)\n if check_path_exist\n @@arr_path = check_path_exist\n @@arr_path.push(\"<a href='/browsing_files/files?fold=#{params[:fold]}'>#{folder_name}</a>\")\n end # Path exist -> Set current path = old path\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n\n else # If delete folder: set current path = old path\n @path = @@temp_path\n end\n\n # Check if sub folder exist\n @@temp_path = @path if FileUtilsC.check_sub_folder_exist params[:fold]\n\n # Set default @@delete_type = 0\n @delete_type = 0\n render 'index'\n end", "def index\n @include_read = param_str_to_boolean :include_read, params\n\n if params[:folder_id].present?\n # Retrieve subscribed feeds in the passed folder\n index_folder\n else\n # Retrieve subscribed feeds regardless of folder\n index_all\n end\n rescue => e\n handle_error e\n end", "def visit_inbox\n get '/messages'\n end", "def folder_feeds(folder, include_read: false)\n FolderManager.folder_feeds folder, self, include_read: include_read\n end", "def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend", "def backup_folder_rec(folder_id, path)\n results = @client.execute!(\n api_method: @drive_api.files.list,\n parameters: { q: \"'#{folder_id}' in parents\" })\n children = results.data.items\n # puts \"Children: #{children.size}\"\n # puts 'No Children found' if children.empty?\n download_children children, path\n end", "def index_folder\n @folder = current_user.folders.find params[:folder_id]\n if @folder.present?\n # If feed subscriptions in the folder have not changed, return a 304\n if stale? EtagCalculator.etag(@folder.subscriptions_updated_at),\n last_modified: @folder.subscriptions_updated_at\n @feeds = current_user.folder_feeds @folder, include_read: @include_read\n index_feeds\n end\n else\n Rails.logger.info \"User #{current_user.id} - #{current_user.email} tried to index feeds in folder #{params[:folder_id]} which does not exist or he does not own\"\n head 404\n end\n\n end", "def read_folder(folder)\n # The spinners in the sidebar should be hidden, to indicate that feeds and folders have finished loading\n expect(page).to have_no_css '#sidebar i.fa-spinner.fa-spin', visible: true\n\n open_folder folder if folder != 'all'\n # Wait for animation to finish\n sleep 0.5\n folder_id = (folder == 'all')? 'none' : folder.id\n within \"#folders-list #folder-#{folder_id}\" do\n find(\"[data-sidebar-feed][data-feed-id='all']\").click\n end\n\n # Ensure entries have finished loading\n expect(page).to have_no_css 'div#loading'\nend", "def get_all_attachments(page_id)\n\n url = \"#{@@conf_url}/#{@@urn}/#{page_id}/child/attachment?os_username=#{@@login}&os_password=#{@@pwd}&status=current\"\n\n begin\n atts = RestClient.get url, :content_type => 'application/json', :accept => 'json'\n rescue RestClient::ExceptionWithResponse => e\n puts Nokogiri.XML(e.response)\n nil\n end\n\n unless atts.nil?\n JSON.parse(atts)[\"results\"]\n end\n end", "def crawlAllPages\n page = 1\n loop do\n puts \"Path: #{@basePath}#{page.to_s}\"\n path \"#{@basePath}#{page.to_s}\"\n\n response = crawl\n @dbm.insertCrawlerBlob response[\"beers\"]\n\n break if response[\"more\"].nil?\n page += 1\n end\n end", "def get_folders\n doc = Nokogiri::HTML(open(url))\n doc.xpath(\"//@href\").map do |url|\n url.value\n end\n end", "def list_folders\n http_get(:uri=>\"/folders\", :fields=>x_cookie)\n end", "def download\n\n session[:current_folder] = params[:folder]\n mixpanel_tab_event(\"My Vault\", \"Download File\")\n download_url = Rails.cache.fetch(\"/download_url/#{params[:id]}\", :expires_in => 10.minutes) do\n user_client.download_url(params[:id])\n end\n redirect_to download_url\n end", "def index\n @file_folders = FileFolder.all\n end", "def get_files(cookie_jar, regex, destdir, bb_pdf_index)\n mech = Mechanize.new\n mech.cookie_jar = cookie_jar\n\n page = mech.get(bb_pdf_index)\n puts \"PageTitle: \" + page.title\n\n page.links_with(:href => regex).each do |link|\n puts \"downloading: \" + link.href\n f = mech.get(link.href)\n puts \"---downloaded: \" + f.filename\n loc = destdir + f.filename\n puts \"---saving to: \" + loc\n f.save(loc)\n end\nend", "def retrieve_github_files(url)\n\n #create a virtual browser with a Chrome Windows Agent\n agent = Mechanize.new\n agent.user_agent = CHROME_USER_AGENT\n\n #retrieve the page and report if page not found (404)\n begin\n page = agent.get(url)\n rescue Exception => e\n #REPORT THE ERROR\n end\n\n #recursively download all content\n get_files_from_github_page(page)\n\n end", "def show\n @seqno = params[:id].to_i\n @total = params[:total].to_i\n\n begin\n @imap = WmailImapUtils.current_imap\n message = @imap.fetch(@seqno, ['RFC822']).first.attr['RFC822']\n @mail = Mail.new(message)\n # get the folder list\n mailbox_list\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n end\n end", "def exportMonthlyFiles()\r\n months = @messages.getMonths()\r\n months.each { |month|\r\n exportMonthlyFile(month)\r\n }\r\n end", "def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end", "def batch_messages_for_page messages, filter, request_format\n logger.info \"Getting a new page of messages\"\n\n messages.each do |message|\n filter.add(api_method: $gmail_api.users.messages.get,\n parameters: {userId: 'me', id: message.id, format: request_format})\n end\n\n begin\n filtered_message_list(filter) unless messages.empty?\n rescue StandardError => error\n puts \"*** Error : #{error.message}\"\n puts \"*** #{error.backtrace.join(\"\\n\")}\"\n\n retry if retry_it?\n end\n end", "def download_response_files!\n files_downloaded = []\n File.makedirs(cache_location + '/returns')\n with_ftp do |ftp|\n files = ftp.list('*.csv')\n files.each do |filels|\n size, file = filels.split(/ +/)[4], filels.split(/ +/)[8..-1].join(' ')\n ftp.get(file, cache_location + '/returns/' + user_suffix + '_' + file)\n files_downloaded << file\n end\n end\n files_downloaded\n end", "def get_files\n fields = \"next_page_token, files(id, name, owners, parents, mime_type, sharedWithMeTime, modifiedTime, createdTime)\"\n\n folders = []\n @files = []\n\n #Go through pages of files and save files and folders\n next_token = nil\n first_page = true\n while first_page || (!next_token.nil? && !next_token.empty?)\n results = @service.list_files(q: \"not trashed\", fields: fields, page_token: next_token)\n folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}\n @files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}\n next_token = results.next_page_token\n first_page = false\n end\n\n #Cache folders\n folders.each {|folder| @folder_cache[folder.id] = folder}\n\n #Resolve file paths and apply ignore list\n @files.each {|file| file.path = resolve_path file}\n @files.reject!{|file| Helper.file_ignored? file.path, @config}\n\n Log.log_notice \"Counted #{@files.count} remote files in #{folders.count} folders\"\n end", "def get_list_files_folder(*folder_name)\n\n\t\tfiles = Array.new\n\t\tif (folder_name.length==0)\n\t\t\tfolders = get_list_folders()\n\t\t\t#Give the folder you want to use otherwise we'll have to loop through\n\t\t\tfolder_id = folders['Adwords']\n\t\t\trefresh_access_token()\n\n\t\t\trequest_url = \"https://www.googleapis.com/drive/v2/files/#{folder_id}/children?access_token=#{@access_token}\"\n\t\t\tresponse = RestClient.get request_url\n\t\t\tresponse_body = JSON.parse(response.body)\n\t\t\t#puts pp(response_body)\n\n\t\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles.push(item['id'])\n\t\t\tend\n\n\t\t\treturn files\n\t\tend\n\tend", "def get_messages_link_and_content()\n dputs __method__.to_s\n urls = {:public => []}\n # public messages\n message_req = setup_http_request($messages, @cookie)\n res = @http.request(message_req)\n urls[:public] = messages_parsing(res.body.force_encoding('utf-8'))\n msgs = {:public => []}\n until urls.empty?\n k, uu = urls.shift\n next if uu == nil\n uu.map{|u|\n get_conversations(u, k.to_s).map do |m|\n next if not m\n msgs[k] << m\n end\n }\n end\n # ex: {:public => [{:msg=>[\"[Aujourd'hui à 09h48] Miguel L : \\\"BONJOUR GREG vous arrive jusque a la gare pardieu\\\"\", \"...\"], :url=>\"/messages/respond/kAxP4rA...\", :token => \"XazeAFsdf...\"}], :private => [{:msg => ...}]\n return msgs\n end", "def get_folder(folder_id)\n\tputs \"Getting folder: \" + folder_id\n\tresponse = request_get('/api/partner/folder/' + folder_id)\n\tputs response.body\nend", "def download_list\n task = params[:task]\n files = []\n\n case task\n when DOWNLOAD_ACTION, OPEN_ACTION, COPY_ACTION, COPY_TO_PRIVATE_ACTION\n nodes = Node.accessible_by(@context).where(id: params[:ids])\n nodes.each { |node| files += node.is_a?(Folder) ? node.all_files : [node] }\n when PUBLISH_ACTION\n nodes = Node.editable_by(@context).\n where(id: params[:ids]).\n where.not(scope: UserFile::SCOPE_PUBLIC)\n nodes.each do |node|\n files += if node.is_a?(Folder)\n node.all_files(Node.where.not(scope: UserFile::SCOPE_PUBLIC))\n else\n [node]\n end\n end\n when DELETE_ACTION\n nodes = Node.editable_by(@context).where(id: params[:ids]).to_a\n files += nodes\n nodes.each { |node| files += node.all_children if node.is_a?(Folder) }\n files.filter! { |file| file.scope == params[:scope] }\n else\n raise ApiError, \"Parameter 'task' is not defined!\"\n end\n\n render json: files,\n each_serializer: FileActionsSerializer,\n scope_name: params[:scope] || SCOPE_PRIVATE,\n action_name: task\n end", "def download\r\n @page = Page.find(params[:id])\r\n send_file \"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\", :type=>\"html\"\r\n end", "def download_files(session, dump_folder, episode)\n recordings_folder = session.collection_by_url(ENV['GOOGLE_DRIVE_FOLDER_URL'])\n episode_folder = recordings_folder.subcollections(q: [\"name contains ?\", episode])[0]\n \n if episode_folder == nil\n puts \"No calls for this episode.\"\n else\n episode_folder.files(q: [\"mimeType = ?\", \"audio/mpeg\"]) do |file|\n puts \"Downloading #{file.title} ...\"\n file.download_to_file(\"#{dump_folder}/#{file.title}\")\n end\n \n # Write episode name to file\n puts \"Recording episode name as #{episode_folder.title} ...\"\n File.write(\"#{dump_folder}/episode_name.txt\", episode_folder.title)\n end\nend", "def download_all\n raise NotImplementedError.new(\"#{self.class.name}#download_all is an abstract method.\")\n end", "def list\n require_public = ( params[:user].nil? ? false : true )\n user = ( params[:user].nil? ? session[:user] : User.first(id: params[:user]) )\n raise RequestError.new(:bad_params, \"User does not exist\") unless user\n raise RequestError.new(:bad_params, \"Depth not valid\") if params[:depth].to_i < 0\n depth = (params[:depth] ? params[:depth].to_i : -1)\n xfile = ( params[:id].nil? ? user.root_folder : WFolder.get(params[:id]) )\n raise RequestError.new(:internal_error, \"No root directory. Please contact your administrator\") if xfile.nil? && params[:id].nil?\n raise RequestError.new(:folder_not_found, \"File or folder not found\") if xfile.nil?\n if (require_public && params[:id] && session[:user].admin == false) then\n raise RequestError.new(:folder_not_public, \"Folder is not public\") if xfile.folder == true && xfile.public == false\n raise RequestError.new(:folder_not_public, \"File is not public\") if xfile.folder == false && xfile.public == false\n end\n if xfile.folder then\n @result = { folder: crawl_folder(xfile, require_public, depth), success: true }\n else \n @result = { file: xfile.description(session[:user]) , success: true }\n end\n end", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end", "def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end", "def folder_list(command)\n path = '/' + clean_up(command[1] || '')\n resp = @client.files.folder_list(path)\n\n resp.contents.each do |item|\n puts item.path\n end\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def get_folders_order\n Log.add_info(request, params.inspect)\n\n @folder_id = params[:id]\n SqlHelper.validate_token([@folder_id])\n\n if @folder_id == TreeElement::ROOT_ID.to_s\n @folders = MailFolder.get_account_roots_for(@login_user)\n else\n mail_folder = MailFolder.find(@folder_id)\n if mail_folder.user_id == @login_user.id\n @folders = MailFolder.get_childs(@folder_id, false, true)\n end\n end\n\n render(:partial => 'ajax_folders_order', :layout => false)\n end", "def read_drafts(dir); end", "def get_entries(dir, subfolder); end", "def image_list\n @folder = PulStore::Lae::Folder.find(params[:id])\n @page_title = \"Folder #{@folder.physical_number}\"\n @pages_list = get_pages_by_folder @folder.id\n respond_to do |format|\n format.html\n end\n end", "def received_messages(page = 1)\n _received_messages.paginate(:page => page, :per_page => MESSAGES_PER_PAGE)\n end", "def index\n @messages = current_user.received_messages.paginate(:page => params[:page])\n @title = \"Входящие сообщения\"\n @path = \"index\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end", "def fetch_and_store!\n # Get links from page\n # Download files from links concurrently\n download self.extract!\n end", "def index\n @folders = Folder.all\n end", "def index\n # List all folders and files in project result directory\n case params[:type]\n when 'result'\n # Get data: folder, file, path\n @content = BrowsingFile.bind_folder \"automations/#{params[:fold]}/reports\"\n @file = BrowsingFile.bind_files \"automations/#{params[:fold]}/reports\"\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=automations/%s/reports'>%s result</a>\" % [params[:fold], params[:fold]]\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n when 'checksum_comparison'\n @content = BrowsingFile.bind_folder 'public/checksum_packages'\n @file = BrowsingFile.bind_files 'public/checksum_packages'\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=public/checksum_packages'>checksum results</a>\"\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n end\n end", "def download_manual \n file = Dir.glob(\"#{Rails.root}/public/s2c_tutorial.pdf\")[0].to_s\n logger.debug file\n send_file(file)\n end", "def submission_files\n get_folder_files(SUBMISSION_PATH)\n end", "def all\n @messages = Message.order_by(:date.asc)\n render \"_allMessages\"\n end", "def folder\n query = Builder::XmlMarkup.new.Query do |xml|\n xml.Where do |xml|\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FileRef\")\n xml.Value(::File.dirname(url).sub(/\\A\\//, \"\"), :Type => \"Text\")\n end\n xml.Eq do |xml|\n xml.FieldRef(:Name => \"FSObjType\")\n xml.Value(1, :Type => \"Text\")\n end\n end\n end\n @list.items(:folder => :all, :query => query).first\n end", "def index\n @filedownloads = Filedownload.all\n end", "def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end", "def get_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def get_messages\n @connection.select('INBOX')\n @connection.search(['ALL']).each do |message_id|\n msg = @connection.fetch(message_id,'RFC822')[0].attr['RFC822']\n begin\n process_message(msg)\n rescue\n handle_bogus_message(msg)\n end\n # Mark message as deleted \n @connection.store(message_id, \"+FLAGS\", [:Deleted])\n end\n end", "def download_chapter\n\t\t\t@manga_volume == '' ? vol = '' : vol = \"/\" + @manga_volume\n\t\t\twebpages = get_page_links(\"/manga/#{@manga_name}#{vol}/#{@manga_chapter}/\")\n\t\t\tthreads = []\n\t\t\ti = 0\n\t\t\t\n\t\t\twebpages.each do |wp| \n\t\t\t\timagelink = get_image_link(wp)\n\t\t\t\tthreads << Thread.new{\n\t\t\t\t\ti += 1\n\t\t\t\t\tdownload_image(imagelink, \"#{@manga_name}_#{@manga_volume}_#{@manga_chapter}_#{i.to_s}\")\n\t\t\t\t\tprint($LOG += \"\\nDownloaded: #{imagelink} in #{@path_to_download}\\\\#{@manga_name}_#{@manga_volume}_#{@manga_chapter}_#{i.to_s}\")\n\t\t\t\t}\n\t\t\tend\n\t\t\t\n\t\t\tthreads.each(&:join)\n\t\t\tprint($LOG += \"\\nDownload complete.\")\n\t\tend", "def read_messages_via_imap\n\timap = Net::IMAP.new(server,port,usessl)\n\timap.login(mailid,password)\n\timap.select(folder)\n\tsince = included.blank? ? \"1-Jan-2000\" : included.yesterday.to_date.strftime(\"%e-%b-%Y\")\n\timap.uid_search([\"SINCE\",since]).each do |msg_id|\n\t\tnext unless mailmessages.find_by_uid(msg_id).nil?\n\t\tbody = imap.uid_fetch(msg_id,['RFC822']).first.attr['RFC822']\n\n\t\tMailfolderMailhandler::receive(body,self,msg_id)\n\t\timap.store(msg_id, \"+FLAG\", [:Deleted]) if delete_message?\n\tend\n\timap.expunge if delete_message?\n\timap.logout\n end", "def download\n Delayed::Job.enqueue(ExportJob.new(current_account))\n flash[:success] = _('Give us some time then check your email.')\n redirect_to export_pages_path\n end", "def getlist(url)\n @url = url\n doc = Nokogiri::HTML(open(@url))\n # @fileset = doc.css(\"td a\")[1..-1]\n @fileset = doc.css(\"td a\")[1,1] #revert to above after testing\n @fileset.each do |item|\n @docname = item.text\n puts \"Downloading #{@docname}\"\n # download the zip files\n download(@url, @docname, \"/vagrant/src/ruby/JobSearch/nuvi/download/\")\n # unzip(@docname, @downloadpath)\n @zipcount += 1\n end\n @zipcount == @fileset.length ? (puts \"Retrieved #{@zipcount} zip files.\") : (puts \"missed a few\")\nend", "def index\n @messages = Rails.cache.fetch('all_messages', :expires_in => 30.seconds) do\n Message.all\n end\n\n respond_to do |format|\n format.json { render json: @messages }\n end\n end", "def view_html\n\n $anterior = params[:id].to_i - 1\n $siguiente = params[:id].to_i - 1\n\n $buscar_texto = nil\n $buscar_por = nil\n\n ENV['folder'] = 'mailbox'\n load 'script/mailman_server.rb'\n\n adjuntos = ''\n\n @@messages.each do |message|\n @from = message[:from]\n @to = message[:to]\n @cc = message[:cc]\n @bcc = message[:bcc]\n @subject = message[:subject]\n @date = message[:date]\n @text = message[:text_body]\n @html = message[:html_body]\n end\n\n cc_list = @cc.length > 0 ? 'Cc: <span style=\"word-wrap: break-word;\">' + @cc + '</span><br>' : ''\n bcc_list = @bcc.length > 0 ? 'Cco: <span style=\"word-wrap: break-word;\">' + @bcc + '</span><br>' : ''\n\n @@the_message_attachments.each do |att|\n adjuntos += '<li> <a style=\"color:#666; text-decoration:none;\" href='+att.attached_file.url(:original, false)+' target=\"_blank\">'+att.attached_file_file_name+'</a> </li>'\n end\n\n adjuntos_list = (adjuntos.length > 0) ? 'Adjuntos: <ul>' + adjuntos + '</ul>' : ''\n\n # render file: 'messages/view_html'\n\n respond_to do |format|\n format.html {\n render text: '<div class=\"container-fluid\"> ' +\n '<br>' +\n 'De: ' + @from +\n '<br>' +\n 'A: <span style=\"word-wrap: break-word;\">' + @to + '</span>' +\n '<br>' +\n cc_list +\n bcc_list +\n adjuntos_list +\n '<hr class=\"col-lg-12\">' +\n '</div>' + @html, :layout => false\n }\n # format.html {\n # render text: '<div class=\"container-fluid\">' +\n # '<div class=\"col-md-12\" style=\"background-color: #ced8e1\">' +\n # '<h4>' + @subject + '</h4>' +\n # '<hr style=\"margin-top: 0px; border-top: 1px solid #235589\">' +\n # '<strong>' + @from + '</strong>' +\n # '<br>' +\n # '<div style=\"max-width: 90%; float: left\">' +\n # '<small>Para ' + @to[0..50] + '</small>' +\n # '</div>' +\n # '<div style=\"margin-left: 5px; max-width: 1%; float: left\">' +\n # '<div class=\"dropdown\">' +\n # '<button class=\"btn btn-default btn-xs\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\">' +\n # '<span class=\"caret\"></span>' +\n # '</button>' +\n # '<div class=\"dropdown-menu\"\n # style=\"word-wrap: break-word;\n # width: 500px;\n # padding: 20px;\n # height: 300px;\n # overflow: auto\">' +\n # '<table>\n # <tr>\n # <td valign=\"top\">De:</td>\n # <th>' + @from + '</th>\n # </tr>\n # <tr>\n # <td valign=\"top\">Para:</td>\n # <td>' + @to + '</td>\n # </tr>\n # <tr>\n # <td valign=\"top\">Fecha:</td>\n # <td>' + @date + '</td>\n # </tr>\n # <tr>\n # <td valign=\"top\">Asunto:</td>\n # <td>' + @subject + '</td>\n # </tr>\n # </table>\n # </div>\n # </div>\n # </div>\n # </div>\n # </div>'\n # }\n format.json {\n render json: {\n message: @html\n }\n }\n end\n\n end", "def search(query, page = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def index\n @messages = Message.none_system_message.paginate(:all, :order => \"messages.sent_at DESC\", :page => params[:page], :per_page => 20)\n @sub_partial = \"/admin/messages/inbox\" \n render_list\n end", "def index\n if cookies[:view] == 'thread'\n @messages = Message.paginate(:page => params[:page], :per_page => 20, :conditions => \"parent_id = 0\", :order => \"created_at DESC\")\n else\n @messages = Message.paginate(:page => params[:page], :per_page => 50, :order => 'created_at DESC')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.iphone # index.iphone.erb\n format.xml { render :xml => @messages }\n end\n end", "def find_folders(options={}, &block)\n options[:mailbox] ||= ''\n options[:count] ||= :all\n\n options = validate_options(options)\n mailbox = options[:mailbox] || ''\n mailbox = Net::IMAP.encode_utf7(mailbox)\n mailbox = mailbox.empty? ? '*' : \"#{mailbox}/*\"\n include = options[:include] ||= '*'\n exclude = options[:exclude] ||= nil\n include_flags = options[:include_flags] ||= nil\n exclude_flags = options[:exclude_flags] ||= [:Noselect, :All, :Drafts, :Important, :Junk, :Flagged, :Trash]\n\n start do |imap|\n info \"find_folders block\"\n info \"imap.lsub/list #{mailbox}\"\n boxes = options[:subscribed] ? imap.lsub('', mailbox) : imap.list('', mailbox)\n boxes.replace(options[:what].to_sym == :last ? boxes.last(options[:count]) : boxes.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n yield Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n else\n folders = []\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n folders << Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n folders.size == 1 && options[:count] == 1 ? folders.first : folders\n end\n end\n end", "def download_data\n file_content = nil\n begin\n file_content = FileContent.find(params[:id])\n rescue\n file_content = nil\n end\n\n # We need to figure out which groups are allowed to download this file content.\n # Unfortunately, this requires iterating through any referenced URLs and collecting\n # all applicable group_ids.\n group_ids = []\n if (!file_content.nil? &&\n !file_content.data.nil?)\n file_content.process_files.each do |process_file|\n if (!process_file.os_process.nil? &&\n !process_file.os_process.fingerprint.nil? &&\n !process_file.os_process.fingerprint.url.nil?)\n # Clear the cache, if need be.\n process_file.os_process.fingerprint.url.expire_caches\n group_ids << process_file.os_process.fingerprint.url.group_id\n end\n end\n group_ids.uniq!\n end\n\n if (!file_content.nil? &&\n !file_content.data.nil? &&\n (!group_ids.index(nil).nil? ||\n current_user.has_role?(:admin) ||\n ((current_user.groups.map{|g| g.is_a?(Group) ? g.id : g} & group_ids).size > 0)))\n send_file(RAILS_ROOT + '/' + file_content.data.to_s, :x_sendfile => true)\n else\n redirect_back_or_default('/')\n end\n end", "def send_directory(path, types)\n # TODO: use git ls\n listing = []\n Dir[File.join path, '*'].each { |child|\n stat = File.stat child\n listing << {\n :name => (File.basename child),\n :type => stat.ftype,\n :size => stat.size\n }\n }\n respond listing, types\n end", "def index\n @folders = Folder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @folders }\n end\n end", "def index\n @folders = Folder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @folders }\n end\n end", "def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end", "def index_all\n # If feed subscriptions have not changed, return a 304\n if stale? etag: EtagCalculator.etag(current_user.subscriptions_updated_at),\n last_modified: current_user.subscriptions_updated_at\n @folder = nil\n @feeds = current_user.subscribed_feeds include_read: @include_read, page: params[:page]\n index_feeds\n end\n end", "def index\n if @folders.any?\n redirect_to @folders.last\n else\n redirect_to new_folder_path\n end\n end", "def sent\n @messages = current_user.messages.order('created_at DESC').unarchived.paginate(:page => params[:page], :per_page => 10)\n end", "def publish_folders\n return unless @context.can_administer_site?\n\n folders = Folder.where(id: params[:ids])\n head(:unprocessable_entity) && return unless folders.exists?\n files = folders.flat_map(&:all_children)\n\n names_match = folder_service.find_match_names(folders)\n if names_match.empty?\n count = UserFile.publish(folders + files, @context, UserFile::SCOPE_PUBLIC)\n\n render json: { count: count }\n else\n type = :warning\n text =\n if names_match.size > 1\n \"Unable to publish: folders with names '#{names_match.join('\\', \\'')}' already exists\"\n else\n \"Unable to publish: folder with name '#{names_match.first}' already exists\"\n end\n\n render json: { messages: [{ type: type, text: text }] }\n end\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def get_specific_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def mailbox_list\n begin\n @imap = WmailImapUtils.current_imap\n folder_list = WmailImapUtils.get_mailbox_list\n @folders_count_hash = Hash[ folder_list.map do |a|\n [a.name, @imap.status(a.name, [\"UNSEEN\"])[\"UNSEEN\"]] unless a.name == \"[Gmail]\"\n end ]\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Connection Lost. Please login to your account'}\n format.js {render :js => \"window.location = '\" + authenticate_wmail_accounts_path(:redirect => params) + \"';\"}\n end\n end\n end", "def fetch_all\n downloaded = 0\n megabyte = 1024 * 1024\n mb_down = 0\n File.open(@file, 'wb+') do |file|\n @downloader.parts do |part|\n begin\n @server.request_get(part, @headers) do |res|\n res.read_body do |body|\n file.write body\n end\n end # /@server\n rescue Timeout::Error, EOFError, Errno::ECONNRESET => exception\n yield -1\n @server = Net::HTTP.start(@base_url.host, @base_url.port)\n STDERR.puts \"Connection error...\"\n retry\n end\n\n yield part\n end # /parts\n end # /File\n end", "def download_all_files files,dest,opts = {}\n @ssh.sftp.connect do |sftp|\n ## in case we have too much files !!\n RubyUtil::partition files do |sub|\n dl = []\n sub.each do |file|\n dest_file = ::File.join(dest,file.cname)\n dl << sftp.download(file.full_path,dest_file) \n end\n dl.each { |d| d.wait }\n end\n end\n files.each { |f| f.path = dest; f.downloaded = true }\n files\n end", "def messages\n\t\t@content_title = \"Messages\"\n\t\t@messages = Message.paginate(:order => 'created_at DESC', :page => params[:page])\n\tend", "def index\n @trip = Trip.find_by_name(params[:trip_id])\n @folder = @trip.folders.find_by_name(params[:folder_id])\n @descriptions = @folder.descriptions\n if request.headers['X-PJAX']\n render :layout => false\n else\n render :layout => \"folder\"\n end\n end", "def get_all()\n @conn.close\n @messages\n end", "def browse\n # Get the folders owned/created by the current_user\n @current_folder = current_user.folders.find(params[:folder_id])\n \n if @current_folder\n # Getting the folders which are inside this @current_folder\n @folders = @current_folder.children\n \n # We need to fix this to show files under a specific folder if we are viewing that folder\n @assets = @current_folder.assets.order(\"uploaded_file_file_name desc\")\n \n render :action => \"index\"\n else\n flash[:error] = \"Don't be cheeky! Mind your own folders!\"\n redirect_to root_url\n end\n end" ]
[ "0.6543573", "0.6444406", "0.6011316", "0.5998763", "0.5922031", "0.59205854", "0.59190524", "0.591469", "0.588878", "0.58723277", "0.5839488", "0.5838414", "0.5829674", "0.5797315", "0.5721657", "0.57160383", "0.5700563", "0.5658236", "0.56576896", "0.56278104", "0.56202483", "0.5596808", "0.5596057", "0.5585865", "0.55690646", "0.55429393", "0.5534731", "0.552726", "0.55265886", "0.5520195", "0.55070865", "0.5499066", "0.54946584", "0.5494023", "0.54925233", "0.54922605", "0.5489809", "0.5484681", "0.5477838", "0.5475785", "0.54677546", "0.5467267", "0.5462484", "0.54445654", "0.54304487", "0.54298633", "0.5414856", "0.54136395", "0.5390725", "0.5385263", "0.5382441", "0.5370791", "0.53706336", "0.5365916", "0.5365916", "0.5362425", "0.535535", "0.53455484", "0.534543", "0.5343448", "0.5339012", "0.5337205", "0.53356135", "0.5329653", "0.5328212", "0.53254664", "0.5324287", "0.53213656", "0.5308024", "0.53032905", "0.5301169", "0.529964", "0.5299404", "0.52983123", "0.5295684", "0.5293495", "0.5283367", "0.5275049", "0.52644634", "0.52624506", "0.5245942", "0.5239088", "0.5237344", "0.52360576", "0.52276963", "0.52276963", "0.5216377", "0.5215882", "0.52131784", "0.521282", "0.5209046", "0.5195775", "0.51854914", "0.51842344", "0.51817375", "0.5180274", "0.5179638", "0.51693386", "0.5152422", "0.51506543" ]
0.64967245
1
GET /userfiles GET /userfiles.json
def index @userfiles = Userfile.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def userfiles_get(opts = {})\n data, _status_code, _headers = userfiles_get_with_http_info(opts)\n data\n end", "def userfiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_get ...'\n end\n # resource path\n local_var_path = '/userfiles'\n\n # query parameters\n 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\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Userfile>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @userfile = Userfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @userfile }\n end\n end", "def get_files\n return @files if @files.present?\n raise \"No user token present\" unless access[:user_token].present?\n @files ||= get(proviso_url + \"files\")\n @files.presence || raise(\"No files available\")\n end", "def index\n @title = \"User uploaded files\"\n get_files(params)\n end", "def get_user_files_using_get_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.get_user_files_using_get ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling FilesApi.get_user_files_using_get\"\n end\n # resource path\n local_var_path = '/api/v2/users/{userId}/files'.sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'tag[]'] = @api_client.build_collection_param(opts[:'tag'], :multi) if !opts[:'tag'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIListOfAPIUserFile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#get_user_files_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_user_files(limit=nil, offset=nil)\n args = {}\n args['limit'] = limit unless limit.nil?\n args['offset'] = offset unless offset.nil?\n response = send_method(:get_user_files, args)\n files_from response\n end", "def index\n if params[:user_file_tag]\n @user_files = UserFile.tagged_with(params[:user_file_tag]).where(user_id: current_user.id)\n else\n @user_files = UserFile.where(user_id: current_user.id)\n end\n end", "def files_for(user)\n files.select { |f| f.can_read? user }\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def index\n # Fetches space files.\n respond_with_space_files && return if params[:space_id]\n\n # Fetches all user 'private' files.\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.\n real_files.\n editable_by(@context).\n accessible_by_private.\n where.not(parent_type: [\"Comparison\", nil]).\n includes(:taggings).\n eager_load(user: :org).\n search_by_tags(filter_tags)\n\n return render(plain: files.size) if show_count\n\n files = files.where(parent_folder_id: @parent_folder_id)\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = private_folders(@parent_folder_id).includes(:taggings).\n eager_load(user: :org).search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n user_files = Node.eager_load(user: :org).where(id: (files + folders).map(&:id)).\n order(order_params).page(page_from_params).per(page_size)\n page_dict = pagination_dict(user_files)\n\n render json: user_files, root: \"files\", adapter: :json,\n meta: files_meta.\n merge(count(UserFile.private_count(@context.user))).\n merge({ pagination: page_dict })\n end", "def files\n return get_result('files')\n end", "def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end", "def get_user_files_using_get(user_id, opts = {})\n data, _status_code, _headers = get_user_files_using_get_with_http_info(user_id, opts)\n data\n end", "def list_files(logged_in_user, order)\n files = []\n if logged_in_user.can_read(self.id)\n files = self.myfiles.find(:all, :order => order)\n end\n\n # return the files:\n return files\n end", "def index\n @fichiers = Fichier.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @fichiers }\n end\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def json_files\n file_list '**/*.json'\n end", "def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => path\n },\n :disable_body_extraction => true\n ).get(:body)\n end", "def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end", "def index\n fs = FileStore.by_hash(params[:hash])\n\n file_stores = fs.map do |item|\n {\n sha1_hash: item.sha1_hash,\n file_name: File.basename(item.file.path),\n user: {\n id: item.user_id,\n uname: item.user_uname\n }\n }\n end\n render json: file_stores\n end", "def index\n @user_file_mappings = UserFileMapping.all\n end", "def index\n @uploads = @user.uploads\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads }\n end\n end", "def index\n @riffblobs = current_user.riffblobs\n respond_to do |format|\n format.json { render json: @riffblobs.as_json }\n end\n end", "def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def shared_to_me\n files_list = []\n files = session[:user].x_files_shared_to_me.all(uploaded: true)\n files.each { |file| files_list.push( file: file.description(session[:user]) ) }\n @result = { files: files_list, success: true }\n end", "def get_files_list(path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n else\n raise\n end\n return data\n end", "def shared_by_me\n if !params[:id] then\n files_list = []\n files = session[:user].x_files_shared_by_me.all(uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n else\n file = WFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n \n users = []\n file.users_receiving.each { |user| users.push user.description }\n @result = { success: true, file: file.description(session[:user]), users: users }\n end\n end", "def get_files_list(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'FilesList')\n end", "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end", "def retrieve_cloud_files(files); end", "def new\n @userfile = Userfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @userfile }\n end\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def public\n public_files = []\n files = session[:user].x_files.all(public: true)\n files.each do |file|\n public_files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: public_files, success: true }\n end", "def index\n @asset_files = current_user.asset_files\n end", "def show\n @ufile = Ufile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ufile }\n end\n end", "def new\n @user_file = UserFile.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user_file }\n end\n end", "def get_files(file_ids)\n file_ids = [file_ids] unless file_ids.is_a? Array\n debug \"DivShare.get_files(): #{file_ids.class}\"\n files = get_user_files\n files.delete_if {|f| file_ids.include?(f.file_id) == false}\n end", "def files\n nodes_files = UserFile.where(id: nodes)\n nodes_user_files = UserFile.where(id: user_files)\n nodes_files.or(nodes_user_files).real_files\n end", "def get_files(query_obj=nil,with_nested_resources=false)\n uri = URI.parse(@uri + \"/Files\")\n results = get(uri,query_obj,with_nested_resources)\n end", "def files\n info[\"Files\"].to_a\n end", "def file_data\n @client.get_file @file_url\n end", "def userfiles_id_get(id, opts = {})\n data, _status_code, _headers = userfiles_id_get_with_http_info(id, opts)\n data\n end", "def list_all_files()\n\t\tfiles = Hash.new\n\t\trefresh_access_token()\n\t\trequest_url = \"https://www.googleapis.com/drive/v2/files?access_token=#{@access_token}\"\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\t\tresponse_body['items'].each do |item|\n\t\t\t\tfiles[item['id']] = item['title']\n\t\tend\n\t\treturn files\n\tend", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def get_all_owned_files(user_id)\n return $db.execute(\"SELECT * FROM files WHERE owner_id = ?\", user_id)\nend", "def serve_user_file\n course = params['course']\n file = params['file']\n username = params['username']\n file_format = params[:format]\n uri = \"#{username}_#{course}_#{file}.#{file_format}\"\n # puts \"Checking if /notebooks/#{uri} exists\" -- to rails logger!\n if File.exist?(\"/notebooks/#{uri}\")\n url = \"http://#{request.host}:3335/notebooks/#{uri}\"\n redirect_to url\n else\n render json: { result: false }\n end\n end", "def get_firmware_files\n response = request(:get, \"/devmgr/v2/firmware/cfw-files/\")\n status(response, 200, 'Failed to get uploaded firmware file list')\n JSON.parse(response.body)\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def get_all_files()\n return $db.execute(\"SELECT users.username, files.* \n FROM files \n INNER JOIN users ON files.owner_id = users.user_id\")\nend", "def show\n @meeting = Meeting.find(params[:meeting_id])\n @userfiles = @meeting.userfiles\n end", "def download\n file = UserFile.exist_refresh_state(@context, params[:uid])\n\n if file.state != UserFile::STATE_CLOSED\n raise ApiError, \"Files can only be downloaded if they are in the 'closed' state\"\n end\n\n if file.license.present? && !file.licensed_by?(@context)\n raise ApiError, \"You must accept the license before you can download this\"\n end\n\n file_url = file.file_url(@context, params[:inline])\n\n respond_to do |format|\n format.html do\n redirect_to URI.parse(file_url).to_s\n end\n\n format.json do\n render json: {\n file_url: file_url,\n file_size: file.file_size,\n }, adapter: :json\n end\n end\n end", "def index\n \n \n\n if params[:file]\n @file = params[:file] \n p @file\n @path = \"/home/session[:user_name]/#{@file}\"\n @path.to_s.gsub!('\\.\\.' , '')\n if File.directory?(@path)\n @files = Dir.foreach(\"/home/session[:user_name]/#{@file}\") \n else\n send_file @path\n end\n else\n @path = \"/home/session[:user_name]\"\n @files = Dir.foreach(\"/home/session[:user_name]\")\n \n end\n\n\n \n end", "def files_get(opts = {})\n files_get_with_http_info(opts)\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n @folders = current_user.folders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @folders }\n end\n end", "def get_files(remote_folder_path)\n str_url = @str_uri_folder + remote_folder_path\n\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_url)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n\n JSON.parse(response)['Files']\n\n # urlFolder = $product_uri + '/storage/folder'\n # urlFile = ''\n # urlExist = ''\n # urlDisc = ''\n # if not remoteFolderPath.empty?\n # urlFile = $product_uri + '/storage/folder/' + remoteFolderPath \n # end \n # signedURL = Aspose::Cloud::Common::Utils.sign(urlFolder)\n # response = RestClient.get(signedURL, :accept => 'application/json')\n # result = JSON.parse(response.body)\n # apps = Array.new(result['Files'].size)\n #\n # for i in 0..result['Files'].size - 1\n # apps[i] = AppFile.new\n # apps[i].Name = result['Files'][i]['Name']\n # apps[i].IsFolder = result['Files'][i]['IsFolder']\n # apps[i].Size = result['Files'][i]['Size']\n # apps[i].ModifiedDate = Aspose::Cloud::Common::Utils.parse_date(result['Files'][i]['ModifiedDate'])\n # end\n # return apps\t \n end", "def set_user_file\n @user_file = @folder.files.find(params[:id])\n end", "def user_photos(user_id=self.username)\n connection.get(\"/users/#{user_id}/photos\").body.activity\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def query_filedata(uid)\n json = {}\n id = uid.to_i\n dir = id%100\n dir = \"#{fs_root}/#{dir.to_s}/#{id}_lastread\"\n FileUtils.makedirs(dir)\n fname = \"#{dir}/jsondata\" \n #p \"query_filedata:filename #{fname}\"\n\n begin\n if FileTest::exists?(fname) \n data= nil \n open(fname, \"r\") {|f|\n data = f.read\n # f.seek(0)\n # f.write(\"\") \n # f.truncate(0)\n }\n # p \"data=#{data.inspect}\"\n json = JSON.parse(data) if data\n end\n rescue Exception=>e\n # logger.error e\n p e.inspect\n pe(e)\n \n end\n\n return json\n\n end", "def list_files\n source_dir = Path.new(params[:source_dir])\n if params.has_key?(:show_catalogues)\n show_catalogues = params[:show_catalogues]\n else\n show_catalogues = false\n end\n if params[:ext].present?\n file_type = params[:ext]\n else\n file_type = nil\n end\n render json: source_dir.files(file_type: file_type, show_catalogues: show_catalogues)\n end", "def files\n list = []\n if @data['info'].key?('files')\n @data['info']['files'].each do |file|\n list << { 'name' => file['path'], 'length' => file['length'] }\n end\n return list\n end\n\n if @data['info'].key?('name') && @data['info'].key?('length')\n list << { 'name' => @data['info']['name'], 'length' => @data['info']['length'] }\n end\n list\n end", "def user_list\n\t\tres = {}\n\t\tusers = User.where(\"lower(name) ~ ?\",params[:pattern].downcase)\n\t\tif users\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:users] = users.pluck(:name, :email, :image)\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend", "def files_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def recents\n files = session[:user].x_files.all(:last_update.gte => (DateTime.now - 20.days), folder: false, limit: 20)\n files_list = []\n files.each do |file|\n files_list.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files_list, success: true }\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def files options = {}\n ensure_connection!\n resp = connection.list_files name, options\n if resp.success?\n File::List.from_resp resp, connection\n else\n fail ApiError.from_response(resp)\n end\n end", "def userfiles_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_id_get ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserfilesApi.userfiles_id_get\"\n end\n # resource path\n local_var_path = '/userfiles/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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 => 'Userfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @up_file = UpFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @up_file }\n end\n end", "def get_file_listing\n execute!(drive.files.list).data\n end", "def favorites\n files = []\n session[:user].favorite_files.each do |file|\n files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files, success: true }\n end", "def get_files_list(request)\r\n begin\r\n data, _status_code, _headers = get_files_list_with_http_info(request)\r\n rescue ApiError => e\r\n if e.code == 401\r\n request_token\r\n data, _status_code, _headers = get_files_list_with_http_info(request)\r\n else\r\n raise\r\n end\r\n end\r\n data\r\n end", "def get_files(params)\n if params[:sort] == 'name' then\n sort = \"upload_file_name ASC\"\n else\n sort = \"created_on DESC\"\n end\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n @title << \" - #{@viewing_by.pluralize}\" \n @files = UserUpload.paginate(\n :order => sort,\n :page => params[:page],\n :conditions => [\"#{UserUpload.connection.quote_column_name(\"type\")} = ?\", @viewing_by], # and thumbnail is NULL\n :per_page => 30\n )\n else\n @files = UserUpload.paginate(\n :order => sort,\n :page => params[:page],\n # :conditions => \"#{connection.quote_column_name(\"thumbnail\")} is NULL\",\n :per_page => 30\n )\n end\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def user_photos user_id=\"self\", options={}\n response = get(\"/users/#{user_id}/photos\",options)[\"response\"]\n @photos = response[\"photos\"]\n @photos[\"items\"].map!{|item| Foursquared::Response::Photo.new(self, item)}\n end", "def manage_users\n \t@users = User.all\n\n \trespond_to do |format|\n format.json {\n render :json => @users.as_json(:only => [:id, :username, :firstname, :lastname, :email], :methods => [:avatar_url])\n }\n format.html {\n render 'manage_users'\n }\n end\n end", "def list_users\n self.class.get('/users')\n end", "def files(folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/list?parent_id=%i' % [folder]).files\n end", "def files\n @files.values\n end", "def files(params = {}, &block)\n params = convert_params(params)\n return execute_paged!(\n :api_method => self.drive.files.list,\n :parameters => params,\n :converter => proc(){ |af| wrap_api_file(af) },\n &block)\n end", "def get_stored_files(user_address)\n directory = File.absolute_path?(Rails.configuration.storagePath) ? Rails.configuration.storagePath\n : Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address))\n\n arr = [];\n\n if Dir.exist?(directory)\n Dir.foreach(directory) {|e| # run through all the elements from the folder\n next if e.eql?(\".\")\n next if e.eql?(\"..\")\n next if File.directory?(File.join(directory, e)) # if the element is a directory, skip it\n\n arr.push(e) # push the file to the array\n }\n end\n\n return arr\n end", "def user_content(user, options = {})\n options = options.clone\n username = user\n\n path = \"user/#{username}/%s.json\" % (options[:category] if options[:category])\n options.delete :category\n\n objects_from_response(:get, path, options)\n end", "def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end", "def signature_request_files(opts)\n path = \"/signature_request/files/#{opts[:signature_request_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n elsif opts[:get_data_uri]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_data_uri=#{opts[:get_data_uri]}\"\n end\n\n get(path)[:body]\n end", "def user_photos(id = 'self', options = {})\n get(\"/users/#{id}/photos\", options).photos\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def list_users\n BrickFTP::API::User.all\n end", "def list_users\n BrickFTP::API::User.all\n end", "def get_files\n fields = \"next_page_token, files(id, name, owners, parents, mime_type, sharedWithMeTime, modifiedTime, createdTime)\"\n\n folders = []\n @files = []\n\n #Go through pages of files and save files and folders\n next_token = nil\n first_page = true\n while first_page || (!next_token.nil? && !next_token.empty?)\n results = @service.list_files(q: \"not trashed\", fields: fields, page_token: next_token)\n folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}\n @files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}\n next_token = results.next_page_token\n first_page = false\n end\n\n #Cache folders\n folders.each {|folder| @folder_cache[folder.id] = folder}\n\n #Resolve file paths and apply ignore list\n @files.each {|file| file.path = resolve_path file}\n @files.reject!{|file| Helper.file_ignored? file.path, @config}\n\n Log.log_notice \"Counted #{@files.count} remote files in #{folders.count} folders\"\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def myfotosprofiles\n @fotosprofiles = current_user.fotosprofiles\n end", "def show\n @action = \"View Files\"\n if [email protected]_admin && params[:user] && params[:user] != @user.username\n session[:next_action] = 'show'\n redirect_to :controller => :login, :action => :index\n return\n end\n # debugger\n unless @guest\n if @user.p_admin\n @files = DataFile.find(:all)\n else\n # debugger\n @files = DataFile.where(\"creator_id = ? OR p_upon_token_presentation = 't'\", @user.id)\n end\n render :show\n else\n render :index\n end\n end", "def get_shared_files(user_id)\n shared_file_ids = $db.execute(\"SELECT file_id FROM file_share_table WHERE user_id = ?\", user_id)\n \n files = []\n shared_file_ids.each do |id|\n files << $db.execute(\"SELECT * FROM files WHERE id = ?\", id[\"file_id\"])[0]\n end\n return files\nend", "def get_owned_files(user_id)\n return $db.execute(\"SELECT * FROM files WHERE owner_id = ?\", user_id)\nend", "def index\n @authorized = true\n begin\n authorize! :show, UploadFile\n rescue CanCan::AccessDenied\n @authorized = false\n end\n #added to avoid raise condition when initially uploading multiple files\n check_uploads_collection unless !@authorized\n\n respond_to do |format|\n format.json {\n #TODO find_by_solr could be faster \n @multiresimages = current_user.upload_files.map do |file|\n begin\n Multiresimage.find(file.pid)\n rescue ActiveFedora::ObjectNotFoundError\n end\n end.compact\n render :json=>@multiresimages.map(&:to_jq_upload)\n }\n format.html\n end\n end", "def test_get_files_list\n request = GetFilesListRequest.new(path: remote_data_folder)\n\n result = @words_api.get_files_list(request)\n assert_equal false, result.nil?\n end", "def index\n users = User.all\n json_response(users)\n end" ]
[ "0.74386764", "0.72443485", "0.70898545", "0.70364046", "0.698765", "0.6909906", "0.688336", "0.67609966", "0.6703759", "0.6636144", "0.6633775", "0.655056", "0.6527293", "0.650271", "0.639786", "0.63615525", "0.63561296", "0.63057435", "0.6299428", "0.6281447", "0.6263779", "0.61989427", "0.6160929", "0.6147597", "0.61345047", "0.61248386", "0.6124143", "0.61170924", "0.61165124", "0.61078614", "0.60937387", "0.60900223", "0.60785764", "0.60766464", "0.6068598", "0.60680455", "0.6042089", "0.60365754", "0.6035772", "0.6018776", "0.60066944", "0.60040206", "0.6003142", "0.5982645", "0.5980494", "0.596511", "0.59605294", "0.59466565", "0.59459275", "0.594408", "0.5943936", "0.59299546", "0.59257036", "0.5924746", "0.5918933", "0.59063005", "0.5904506", "0.5903155", "0.58908826", "0.5889038", "0.5880417", "0.5871572", "0.5871183", "0.5870812", "0.5864911", "0.58631516", "0.5855933", "0.5853634", "0.5853437", "0.585123", "0.58459795", "0.58391696", "0.5834326", "0.58239776", "0.582225", "0.5821857", "0.5812365", "0.58080876", "0.5807142", "0.5805714", "0.58036", "0.5800128", "0.57947737", "0.57907814", "0.5790481", "0.5787989", "0.577279", "0.5771999", "0.57717943", "0.5758798", "0.5758798", "0.5739924", "0.57399166", "0.5737319", "0.5737267", "0.5730706", "0.57290626", "0.5713384", "0.5705441", "0.57039666" ]
0.7202668
2
GET /userfiles/1 GET /userfiles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @userfile = Userfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @userfile }\n end\n end", "def userfiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_get ...'\n end\n # resource path\n local_var_path = '/userfiles'\n\n # query parameters\n 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\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Userfile>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @userfiles = Userfile.all\n end", "def index\n @title = \"User uploaded files\"\n get_files(params)\n end", "def get_user_files_using_get_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.get_user_files_using_get ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling FilesApi.get_user_files_using_get\"\n end\n # resource path\n local_var_path = '/api/v2/users/{userId}/files'.sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'tag[]'] = @api_client.build_collection_param(opts[:'tag'], :multi) if !opts[:'tag'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIListOfAPIUserFile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#get_user_files_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def userfiles_get(opts = {})\n data, _status_code, _headers = userfiles_get_with_http_info(opts)\n data\n end", "def show\n @ufile = Ufile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ufile }\n end\n end", "def get_files\n return @files if @files.present?\n raise \"No user token present\" unless access[:user_token].present?\n @files ||= get(proviso_url + \"files\")\n @files.presence || raise(\"No files available\")\n end", "def index\n if params[:user_file_tag]\n @user_files = UserFile.tagged_with(params[:user_file_tag]).where(user_id: current_user.id)\n else\n @user_files = UserFile.where(user_id: current_user.id)\n end\n end", "def index\n @fichiers = Fichier.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @fichiers }\n end\n end", "def server_get_file(server, path)\n request(\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => path\n },\n :disable_body_extraction => true\n ).get(:body)\n end", "def get_user_files(limit=nil, offset=nil)\n args = {}\n args['limit'] = limit unless limit.nil?\n args['offset'] = offset unless offset.nil?\n response = send_method(:get_user_files, args)\n files_from response\n end", "def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def show\n @up_file = UpFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @up_file }\n end\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def index\n # Fetches space files.\n respond_with_space_files && return if params[:space_id]\n\n # Fetches all user 'private' files.\n filter_tags = params.dig(:filters, :tags)\n\n files = UserFile.\n real_files.\n editable_by(@context).\n accessible_by_private.\n where.not(parent_type: [\"Comparison\", nil]).\n includes(:taggings).\n eager_load(user: :org).\n search_by_tags(filter_tags)\n\n return render(plain: files.size) if show_count\n\n files = files.where(parent_folder_id: @parent_folder_id)\n files = FileService::FilesFilter.call(files, params[:filters])\n\n folders = private_folders(@parent_folder_id).includes(:taggings).\n eager_load(user: :org).search_by_tags(filter_tags)\n folders = FileService::FilesFilter.call(folders, params[:filters])\n\n user_files = Node.eager_load(user: :org).where(id: (files + folders).map(&:id)).\n order(order_params).page(page_from_params).per(page_size)\n page_dict = pagination_dict(user_files)\n\n render json: user_files, root: \"files\", adapter: :json,\n meta: files_meta.\n merge(count(UserFile.private_count(@context.user))).\n merge({ pagination: page_dict })\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def new\n @userfile = Userfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @userfile }\n end\n end", "def get(path = '/files/', params = {})\n request :get, path, params\n end", "def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def new\n @user_file = UserFile.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user_file }\n end\n end", "def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def index\n fs = FileStore.by_hash(params[:hash])\n\n file_stores = fs.map do |item|\n {\n sha1_hash: item.sha1_hash,\n file_name: File.basename(item.file.path),\n user: {\n id: item.user_id,\n uname: item.user_uname\n }\n }\n end\n render json: file_stores\n end", "def show\n @raw_file = RawFile.find_by_user(params[:id], current_user.id)\n\n respond_to do |format|\n format.html { render :show, :locals => { :raw_file => @raw_file } } # show.html.erb\n format.json { render :json => @raw_file }\n end\n end", "def file_get(id)\n response = get('FileService.getFile', id)\n end", "def read\n status = 200\n\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n elsif File.exists? fpath\n result = {content: File.read(fpath)}\n else\n result = {content: ''}\n end\n render json: result.to_json, status: status\n end", "def set_user_file\n @user_file = @folder.files.find(params[:id])\n end", "def get_user_files_using_get(user_id, opts = {})\n data, _status_code, _headers = get_user_files_using_get_with_http_info(user_id, opts)\n data\n end", "def userfiles_id_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_id_get ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserfilesApi.userfiles_id_get\"\n end\n # resource path\n local_var_path = '/userfiles/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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 => 'Userfile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def file_data\n @client.get_file @file_url\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def get_file(uid, info = {}, range: nil)\n range = \"bytes=#{range.begin}-#{range.end}\" if range\n chunks = object(uid).enum_for(:get, range: range)\n\n Tus::Response.new(chunks: chunks)\n end", "def shared_by_me\n if !params[:id] then\n files_list = []\n files = session[:user].x_files_shared_by_me.all(uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n else\n file = WFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n \n users = []\n file.users_receiving.each { |user| users.push user.description }\n @result = { success: true, file: file.description(session[:user]), users: users }\n end\n end", "def files_for(user)\n files.select { |f| f.can_read? user }\n end", "def index\n @uploads = @user.uploads\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uploads }\n end\n end", "def serve_user_file\n course = params['course']\n file = params['file']\n username = params['username']\n file_format = params[:format]\n uri = \"#{username}_#{course}_#{file}.#{file_format}\"\n # puts \"Checking if /notebooks/#{uri} exists\" -- to rails logger!\n if File.exist?(\"/notebooks/#{uri}\")\n url = \"http://#{request.host}:3335/notebooks/#{uri}\"\n redirect_to url\n else\n render json: { result: false }\n end\n end", "def show\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @super_file }\n end\n end", "def files_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_get ...\"\n end\n # resource path\n local_var_path = \"/files\"\n\n # query parameters\n query_params = {}\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def files\n return get_result('files')\n end", "def userfiles_id_get(id, opts = {})\n data, _status_code, _headers = userfiles_id_get_with_http_info(id, opts)\n data\n end", "def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end", "def index\n @riffblobs = current_user.riffblobs\n respond_to do |format|\n format.json { render json: @riffblobs.as_json }\n end\n end", "def index\n \n \n\n if params[:file]\n @file = params[:file] \n p @file\n @path = \"/home/session[:user_name]/#{@file}\"\n @path.to_s.gsub!('\\.\\.' , '')\n if File.directory?(@path)\n @files = Dir.foreach(\"/home/session[:user_name]/#{@file}\") \n else\n send_file @path\n end\n else\n @path = \"/home/session[:user_name]\"\n @files = Dir.foreach(\"/home/session[:user_name]\")\n \n end\n\n\n \n end", "def show\n @uploaded_file = UploadedFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uploaded_file }\n end\n end", "def show\n @meeting = Meeting.find(params[:meeting_id])\n @userfiles = @meeting.userfiles\n end", "def list_files(logged_in_user, order)\n files = []\n if logged_in_user.can_read(self.id)\n files = self.myfiles.find(:all, :order => order)\n end\n\n # return the files:\n return files\n end", "def query_filedata(uid)\n json = {}\n id = uid.to_i\n dir = id%100\n dir = \"#{fs_root}/#{dir.to_s}/#{id}_lastread\"\n FileUtils.makedirs(dir)\n fname = \"#{dir}/jsondata\" \n #p \"query_filedata:filename #{fname}\"\n\n begin\n if FileTest::exists?(fname) \n data= nil \n open(fname, \"r\") {|f|\n data = f.read\n # f.seek(0)\n # f.write(\"\") \n # f.truncate(0)\n }\n # p \"data=#{data.inspect}\"\n json = JSON.parse(data) if data\n end\n rescue Exception=>e\n # logger.error e\n p e.inspect\n pe(e)\n \n end\n\n return json\n\n end", "def get_files(params)\n if params[:sort] == 'name' then\n sort = \"upload_file_name ASC\"\n else\n sort = \"created_on DESC\"\n end\n\n # Set currently viewing by key\n if params[:key] then\n @viewing_by = params[:key]\n @title << \" - #{@viewing_by.pluralize}\" \n @files = UserUpload.paginate(\n :order => sort,\n :page => params[:page],\n :conditions => [\"#{UserUpload.connection.quote_column_name(\"type\")} = ?\", @viewing_by], # and thumbnail is NULL\n :per_page => 30\n )\n else\n @files = UserUpload.paginate(\n :order => sort,\n :page => params[:page],\n # :conditions => \"#{connection.quote_column_name(\"thumbnail\")} is NULL\",\n :per_page => 30\n )\n end\n end", "def retrieve_cloud_files(files); end", "def get\n file = XFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n raise RequestError.new(:bad_param, \"Can't get a folder\") if file.folder\n raise RequestError.new(:file_not_uploaded, \"File not completely uploaded\") unless file.uploaded\n raise RequestError.new(:bad_part, \"Incorrect content\") if file.content.nil?\n\n @result = retrieve(file, params[:part].to_i) if (!params[:direct] || params[:direct] != \"true\")\n \tsend_data(full_retrieve(file), filename: file.name) if (params[:direct] == \"true\")\n end", "def download\n file = UserFile.exist_refresh_state(@context, params[:uid])\n\n if file.state != UserFile::STATE_CLOSED\n raise ApiError, \"Files can only be downloaded if they are in the 'closed' state\"\n end\n\n if file.license.present? && !file.licensed_by?(@context)\n raise ApiError, \"You must accept the license before you can download this\"\n end\n\n file_url = file.file_url(@context, params[:inline])\n\n respond_to do |format|\n format.html do\n redirect_to URI.parse(file_url).to_s\n end\n\n format.json do\n render json: {\n file_url: file_url,\n file_size: file.file_size,\n }, adapter: :json\n end\n end\n end", "def send_file_info(last, path)\n if not last == nil\n user = current_user\n path = path.force_encoding(\"UTF-8\")\n @file_names = \"#{path.split('/').last}\" + \"\\n\"\n @access_url = \"#{HOSTING_URL}\" + \"/user_files/\"+ \"#{user.userid}\" + path.force_encoding(\"UTF-8\") \n \n else\n @file_names = \"error\"\n @access_url = \"\"\n end\n puts_message \"send_file_info end\" \n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_file }\n end\n end", "def get_fileset\n\n filesets = batched_get( { id: params[:id] } )\n if filesets.empty?\n render_json_fileset_response(:not_found )\n else\n render_json_fileset_response(:ok, fileset_transform( filesets ) )\n end\n end", "def get\n text_file = TextFile.find_by(name: params['name'])\n response = {}\n if text_file\n response = create_response(text_file)\n end\n render json: response\n end", "def download_icon_file_using_get1_with_http_info(file_id, user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.download_icon_file_using_get1 ...'\n end\n # verify the required parameter 'file_id' is set\n if @api_client.config.client_side_validation && file_id.nil?\n fail ArgumentError, \"Missing the required parameter 'file_id' when calling FilesApi.download_icon_file_using_get1\"\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling FilesApi.download_icon_file_using_get1\"\n end\n # resource path\n local_var_path = '/api/v2/users/{userId}/files/{fileId}/icon'.sub('{' + 'fileId' + '}', file_id.to_s).sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#download_icon_file_using_get1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @action = \"View Files\"\n if [email protected]_admin && params[:user] && params[:user] != @user.username\n session[:next_action] = 'show'\n redirect_to :controller => :login, :action => :index\n return\n end\n # debugger\n unless @guest\n if @user.p_admin\n @files = DataFile.find(:all)\n else\n # debugger\n @files = DataFile.where(\"creator_id = ? OR p_upon_token_presentation = 't'\", @user.id)\n end\n render :show\n else\n render :index\n end\n end", "def shared_to_me\n files_list = []\n files = session[:user].x_files_shared_to_me.all(uploaded: true)\n files.each { |file| files_list.push( file: file.description(session[:user]) ) }\n @result = { files: files_list, success: true }\n end", "def set_user_file\n @user_file = UserFile.where(user_id: current_user.id).find(params[:id])\n end", "def get_shared_files(user_id)\n shared_file_ids = $db.execute(\"SELECT file_id FROM file_share_table WHERE user_id = ?\", user_id)\n \n files = []\n shared_file_ids.each do |id|\n files << $db.execute(\"SELECT * FROM files WHERE id = ?\", id[\"file_id\"])[0]\n end\n return files\nend", "def userfiles_id_content_get_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_id_content_get ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserfilesApi.userfiles_id_content_get\"\n end\n # resource path\n local_var_path = '/userfiles/{id}/content'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/*', 'text/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_id_content_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @file_versions = FileVersion.all\n\n render json: @file_versions\n end", "def api(path)\n OodAppkit.files.api(path: path).to_s\n end", "def set_userfile\n @userfile = Userfile.find(params[:id])\n end", "def set_userfile\n @userfile = Userfile.find(params[:id])\n end", "def get_data()\n if File.exists?(FILENAME)\n results = JSON.parse(File.read(FILENAME))\n return results\n else\n # JSON only parses strings, so it makes things much faster to simply write the key as in a format that JS can use.\n {\"users\" => []}\n end\nend", "def get_files(file_ids)\n file_ids = [file_ids] unless file_ids.is_a? Array\n debug \"DivShare.get_files(): #{file_ids.class}\"\n files = get_user_files\n files.delete_if {|f| file_ids.include?(f.file_id) == false}\n end", "def show\n render json: @file, serializer: FileSerializer, :root => \"file\"\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def get_users_with_access(file_id)\n return $db.execute(\"SELECT user_id FROM shared_files WHERE file_id = ?\", file_id)\nend", "def file_get(input={}, raw=false)\n response = post('mw/File.Get', input, raw)\n end", "def json_files\n file_list '**/*.json'\n end", "def storage_file_get(args = { }, options = { })\n process_request_using_class(Requests::StorageFileGet, args, options)\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling PdfApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/pdf/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def files(params = {}, &block)\n params = convert_params(params)\n return execute_paged!(\n :api_method => self.drive.files.list,\n :parameters => params,\n :converter => proc(){ |af| wrap_api_file(af) },\n &block)\n end", "def show\n puts params[:id]\n @file_versions = FileVersion.where(versioned_file_id: params[:id]) \n #@file_versions = FileVersion.find(:versioned_file_id => params[:versioned_file_id])\n render json: @file_versions\n end", "def get_owned_files(user_id)\n return $db.execute(\"SELECT * FROM files WHERE owner_id = ?\", user_id)\nend", "def index\n @authorized = true\n begin\n authorize! :show, UploadFile\n rescue CanCan::AccessDenied\n @authorized = false\n end\n #added to avoid raise condition when initially uploading multiple files\n check_uploads_collection unless !@authorized\n\n respond_to do |format|\n format.json {\n #TODO find_by_solr could be faster \n @multiresimages = current_user.upload_files.map do |file|\n begin\n Multiresimage.find(file.pid)\n rescue ActiveFedora::ObjectNotFoundError\n end\n end.compact\n render :json=>@multiresimages.map(&:to_jq_upload)\n }\n format.html\n end\n end", "def show\n @file_record = FileRecord.find(params[:id])\n @file_versions = @file_record.file_versions.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_record }\n format.json { render json: {file_record: @file_record,file_versions: @file_versions} }\n end\n end", "def files\n nodes_files = UserFile.where(id: nodes)\n nodes_user_files = UserFile.where(id: user_files)\n nodes_files.or(nodes_user_files).real_files\n end", "def get_files_list(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'FilesList')\n end", "def get_all_files()\n return $db.execute(\"SELECT users.username, files.* \n FROM files \n INNER JOIN users ON files.owner_id = users.user_id\")\nend", "def get_all_owned_files(user_id)\n return $db.execute(\"SELECT * FROM files WHERE owner_id = ?\", user_id)\nend", "def index\n @user = User.find(params[:user_id])\n @mycontact = Mycontact.find(params[:mycontact_id])\n @meeting = Meeting.find(params[:meeting_id])\n if @meeting\n @userfiles = @meeting.userfiles\n else\n @userfiles = Userfile.all\n end\n end", "def get_files_list_with_http_info(path, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StorageApi.get_files_list ...\"\n end\n # verify the required parameter 'path' is set\n if @api_client.config.client_side_validation && path.nil?\n fail ArgumentError, \"Missing the required parameter 'path' when calling StorageApi.get_files_list\"\n end\n # resource path\n local_var_path = \"/diagram/storage/folder/{path}\".sub('{' + 'path' + '}', path.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'storageName'] = opts[:'storage_name'] if !opts[:'storage_name'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FilesList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StorageApi#get_files_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def downloaded\n files_list = []\n files = session[:user].x_files.all(:downloads.gte => 1, uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n end", "def index\n @user_file_mappings = UserFileMapping.all\n end", "def index\n @asset_files = current_user.asset_files\n end", "def file(file_type, id)\n query = \"/?client_id=#{@client_id}&#{id}\"\n path = \"#{file_type}/#{__method__}.to_s\"\n resp = http_get(path, query)\n end", "def fetch_file(file_path)\n client.get_file(file_path)\n end", "def files\n results\n rescue ApiStruct::EntityError\n result\n end", "def get_files(query_obj=nil,with_nested_resources=false)\n uri = URI.parse(@uri + \"/Files\")\n results = get(uri,query_obj,with_nested_resources)\n end", "def fetch_data(user)\n array = read_from_file(\"userdata/#{user}.txt\")\n array[0]\nend", "def files_get(opts = {})\n files_get_with_http_info(opts)\n end", "def show\n @meeting = Meeting.find(params[:id])\n @json_from_file = 0\n for file in @meeting.file.attachments\n if file.content_type == 'application/json'\n download_file_from_s3('smartmeetingsbelieving', \"./tmp/\" + file.filename.to_s(), file.filename.to_s())\n @json_from_file = File.read(\"tmp/\" + file.filename.to_s())\n end\n end\n end", "def get_files_list(path, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = get_files_list_with_http_info(path, opts)\n else\n raise\n end\n return data\n end", "def show\n @breadcrumb = 'read'\n @processed_file = ProcessedFile.find(params[:id])\n @processed_file_items = @processed_file.processed_file_items.paginate(:page => params[:page], :per_page => per_page)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_file }\n end\n end", "def show\n @fileversion = Fileversion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fileversion }\n end\n end" ]
[ "0.7591945", "0.7170485", "0.71091115", "0.7090143", "0.7037206", "0.692273", "0.67089075", "0.6702334", "0.6617328", "0.65394187", "0.65242696", "0.65155894", "0.6508128", "0.64658505", "0.64155704", "0.64118934", "0.6386925", "0.6377543", "0.6351391", "0.63489425", "0.63407546", "0.6339673", "0.6330062", "0.6320762", "0.6320493", "0.6317352", "0.63139", "0.6306396", "0.63060606", "0.63052344", "0.62707216", "0.62606645", "0.62572914", "0.6240225", "0.6231563", "0.6228909", "0.62253535", "0.62040746", "0.6201455", "0.6195107", "0.6183894", "0.6165682", "0.6160052", "0.6156829", "0.6151624", "0.61269295", "0.61168027", "0.61071503", "0.60816306", "0.60713744", "0.60520977", "0.6045232", "0.6042355", "0.6042122", "0.6039976", "0.6032354", "0.6026488", "0.60218656", "0.60067004", "0.60016656", "0.59948605", "0.5986496", "0.59705025", "0.5960277", "0.59591436", "0.5954748", "0.59484345", "0.59484345", "0.5943714", "0.5938024", "0.59204805", "0.5910963", "0.5902253", "0.5888935", "0.5888784", "0.58849496", "0.5883566", "0.58717054", "0.5869731", "0.5867045", "0.5863246", "0.5863025", "0.586201", "0.58543473", "0.58539975", "0.5853567", "0.585325", "0.5849627", "0.58492905", "0.5847271", "0.5847009", "0.58468497", "0.5845636", "0.5838223", "0.58284765", "0.58274776", "0.58265054", "0.582605", "0.58217883", "0.58202183", "0.58186024" ]
0.0
-1
POST /userfiles POST /userfiles.json
def create @userfile = Userfile.new(userfile_params) respond_to do |format| if @userfile.save format.html { redirect_to @userfile, notice: 'Userfile was successfully created.' } format.json { render :show, status: :created, location: @userfile } else format.html { render :new } format.json { render json: @userfile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @userfile = Userfile.new(params[:userfile])\n \n\n respond_to do |format|\n if @userfile.save\n format.html {\n render :json => [@userfile.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@userfile.to_jq_upload] }, status: :created, location: @userfile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @userfile.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @user_file = UserFile.new(user_file_params)\n @user_file.user = current_user\n respond_to do |format|\n if @user_file.save\n format.html { redirect_to @user_file, notice: \"User file was successfully created.\" }\n format.json { render :show, status: :created, location: @user_file }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_file = UserFile.new(params[:user_file])\n\n respond_to do |format|\n if @user_file.save\n format.html { redirect_to @user_file, :notice => 'User file was successfully created.' }\n format.json { render :json => @user_file, :status => :created, :location => @user_file }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def user_file_params\n params.require(:user_file).permit(:title, :desc, :file, :user_file_tag_list, :user_file_tag, { user_file_tag_ids: [] }, :user_file_tag_ids)\n end", "def file_upload(params_userfile)\n content_upload(params_userfile.read)\n end", "def user_file_params\n params.require(:user_file).permit(:file, :file_url)\n end", "def userfile_params\n params.require(:userfile).permit(:filename, :date_created, :owner, :size)\n end", "def upload_upload(directory:, files:)\n upload_files = {multipart: true}\n files.each {|f| upload_files[f] = File.open(f, 'rb')}\n r = aptly_request 'POST', \"api/files/#{directory}\", payload: upload_files\n JSON.parse(r.body)\n end", "def create\n @ufile = Ufile.new(params[:ufile])\n @ufile.user_id = current_user.id\n respond_to do |format|\n if @ufile.save\n format.html { redirect_to \"/ufiles\", notice: 'Ufile was successfully created.' }\n format.json { render json: @ufile, status: :created, location: @ufile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ufile.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(path = '/files/', params = {})\n request :post, path, params\n end", "def create\n files = params[:files]\n\n files.each do |file|\n\n filename = file.original_filename\n\n # Rack uploads have `#tempfiles` and test uploads are Tempfile objects. More\n # investigation required.\n file = file.tempfile if file.respond_to?(:tempfile)\n\n UploadStore.create(\n :key => filename,\n :body => file,\n :public => true\n )\n end\n\n render json: {status: 'success'}\n end", "def create_file\n project = UserFile.publication_project!(current_user, @scope)\n\n api = DIContainer.resolve(\"api.user\")\n file_dxid = api.file_new(params[:name], project)[\"id\"]\n\n file = UserFile.create!(\n dxid: file_dxid,\n project: project,\n name: params[:name],\n state: \"open\",\n description: params[:description],\n user: current_user,\n parent: current_user,\n scope: @scope,\n UserFile.scope_column_name(@scope) => @folder&.id,\n )\n\n render json: { id: file.uid }\n end", "def userfile_params\n params.require(:userfile).permit(:filename, :user_id, :mycontact_id, :meeting_id, :references)\n end", "def upload(path)\n name = ::File.basename(path)\n data = ::File.read(path)\n _post_with_file(\"/files\", file: data, filename: name) { |json| json }\n end", "def userfiles_post_with_http_info(upload_file, data_provider_id, userfile_group_id, file_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_post ...'\n end\n # verify the required parameter 'upload_file' is set\n if @api_client.config.client_side_validation && upload_file.nil?\n fail ArgumentError, \"Missing the required parameter 'upload_file' when calling UserfilesApi.userfiles_post\"\n end\n # verify the required parameter 'data_provider_id' is set\n if @api_client.config.client_side_validation && data_provider_id.nil?\n fail ArgumentError, \"Missing the required parameter 'data_provider_id' when calling UserfilesApi.userfiles_post\"\n end\n # verify the required parameter 'userfile_group_id' is set\n if @api_client.config.client_side_validation && userfile_group_id.nil?\n fail ArgumentError, \"Missing the required parameter 'userfile_group_id' when calling UserfilesApi.userfiles_post\"\n end\n # verify the required parameter 'file_type' is set\n if @api_client.config.client_side_validation && file_type.nil?\n fail ArgumentError, \"Missing the required parameter 'file_type' when calling UserfilesApi.userfiles_post\"\n end\n # resource path\n local_var_path = '/userfiles'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params['upload_file'] = upload_file\n form_params['data_provider_id'] = data_provider_id\n form_params['userfile[group_id]'] = userfile_group_id\n form_params['file_type'] = file_type\n form_params['_do_extract'] = opts[:'_do_extract'] if !opts[:'_do_extract'].nil?\n form_params['_up_ex_mode'] = opts[:'_up_ex_mode'] if !opts[:'_up_ex_mode'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n file = params[:file_store][:file]\n file_store = FileStore.new\n file_store.sha1_hash = Digest::SHA1.file(file.path).hexdigest\n file_store.file = file\n file_store.user_id, file_store.user_uname = user['id'], user['uname']\n\n if file_store.save\n File.delete file.path\n render json: { sha1_hash: file_store.sha1_hash }, status: :created\n else\n render json: file_store.errors, status: :unprocessable_entity\n end\n end", "def new\n @userfile = Userfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @userfile }\n end\n end", "def post_attachment(file_s)\n setup\n @req = Net::HTTP::Post.new(\"/uploads.json\")\n auth\n @req[\"Content-Type\"] = \"application/octet-stream\"\n @req[\"Content-Length\"] = file_s.length\n @req.body = file_s\n res = @http.request(@req)\n\n if res.code.to_i == 201\n return [true, JSON.load(res.body)[\"upload\"][\"token\"]]\n else\n return [false, JSON.load(res.body)[\"errors\"].first]\n end\n end", "def userlist_params\n params.require(:userlist).permit(:name, :file)\n end", "def create\n @user = User.find(params[:user_id])\n @mycontact = Mycontact.find(params[:mycontact_id])\n @meeting = Meeting.find(params[:meeting_id])\n @userfile = @meeting.userfiles.new(userfile_params)\n\n uploadedIo = params[:userfile][:doc]\n @userfile.filename = uploadedIo.original_filename\n meetingId = @meeting.id\n tmpFileName = meetingId.to_s + \"_\" + [uploadedIo.original_filename.split(\".\").first.downcase.parameterize, \".\", uploadedIo.original_filename.split(\".\").last].join()\n @userfile.file_name_slug = tmpFileName\n\n\n fileName = Rails.root.join('public','uploads', tmpFileName)\n File.open(fileName, 'wb') do |file|\n file.write(uploadedIo.read)\n end\n\n respond_to do |format|\n if @userfile.save\n #format.html { redirect_to @userfile, notice: 'Userfile was successfully created.' }\n format.html { redirect_to user_mycontact_meeting_userfiles_path}\n format.json { render action: 'show', status: :created, location: @userfile }\n else\n format.html { render action: 'new' }\n format.json { render json: @userfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def userfiles_download_post(multi_userfile_mod_req, opts = {})\n data, _status_code, _headers = userfiles_download_post_with_http_info(multi_userfile_mod_req, opts)\n data\n end", "def userfiles_download_post_with_http_info(multi_userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_download_post ...'\n end\n # verify the required parameter 'multi_userfile_mod_req' is set\n if @api_client.config.client_side_validation && multi_userfile_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'multi_userfile_mod_req' when calling UserfilesApi.userfiles_download_post\"\n end\n # resource path\n local_var_path = '/userfiles/download'\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/*', 'text/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(multi_userfile_mod_req)\n auth_names = ['BrainPortalSession']\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 => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_download_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @user_file = UserFile.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @user_file }\n end\n end", "def userfiles_sync_multiple_post_with_http_info(multi_userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_sync_multiple_post ...'\n end\n # verify the required parameter 'multi_userfile_mod_req' is set\n if @api_client.config.client_side_validation && multi_userfile_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'multi_userfile_mod_req' when calling UserfilesApi.userfiles_sync_multiple_post\"\n end\n # resource path\n local_var_path = '/userfiles/sync_multiple'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(multi_userfile_mod_req)\n auth_names = ['BrainPortalSession']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_sync_multiple_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n logger.debug(\"user new\")\n @user = User.new\n #@user.infiles.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def user_params\n params.require(:upload).permit(:file)\n end", "def user_file_mapping_params\n params.require(:user_file_mapping).permit(:file_id, :user_id, :file_name)\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def create\n @user_file_mapping = UserFileMapping.new(user_file_mapping_params)\n\n respond_to do |format|\n if @user_file_mapping.save\n format.html { redirect_to @user_file_mapping, notice: 'User file mapping was successfully created.' }\n format.json { render :show, status: :created, location: @user_file_mapping }\n else\n format.html { render :new }\n format.json { render json: @user_file_mapping.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testfile = Testfile.new(testfile_params)\n @material = Material.find_by(mat_name: @testfile.mat_name)\n @material.testfiles << @testfile\n @user = User.find_by_id(current_user[:id])\n @user.testfiles << @testfile\n\n \n respond_to do |format|\n if @testfile.save\n format.html { redirect_to @testfile, notice: 'Testfile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testfile }\n else\n format.html { render action: 'new' }\n format.json { render json: @testfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def write_file(post_data)\n File.open(\"public/post_data.txt\",\"w\") do |f| # open the user.json file in the /public directory (create if not present)\n f.write(post_data) # add the hash to the JSON file and save it\n end\nend", "def upload(opts, files)\n request(\n :post,\n \"#{opts['a']}#{UPLOAD_URL}?key=#{opts['t']}\",\n 'files'.to_sym => files\n )\n end", "def userfiles_compress_post_with_http_info(multi_userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_compress_post ...'\n end\n # verify the required parameter 'multi_userfile_mod_req' is set\n if @api_client.config.client_side_validation && multi_userfile_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'multi_userfile_mod_req' when calling UserfilesApi.userfiles_compress_post\"\n end\n # resource path\n local_var_path = '/userfiles/compress'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(multi_userfile_mod_req)\n auth_names = ['BrainPortalSession']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_compress_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def file_user_params\n params.require(:file_user).permit(:modify, :view, :fileId_id, :userId_id)\n end", "def user_file_create\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n username = notey_notey_params['username']\n\n uri = \"/notebooks/#{username}_#{course}_#{file}\"\n base_file = \"/notebooks/#{course}_#{file}\"\n\n if File.exist?(base_file)\n File.open(base_file, 'rb') do |input|\n File.open(uri, 'wb') do |output|\n while (buff = input.read(4096))\n output.write(buff)\n end\n end\n end\n else\n render json: { result: false }\n end\n render json: { result: true }\n end", "def files_post(file, opts = {})\n files_post_with_http_info(file, opts)\n end", "def set_user_file\n @user_file = @folder.files.find(params[:id])\n end", "def write_user(users)\nbegin\n File.open(\"./files/user_info.json\", \"w\") do |f|\n f.write(users.to_json)\n end \nrescue Errno::ENOENT\n puts \"This file does not exist, Please re-check source files\"\nend\n\nend", "def save_file_batch(files, new_obj_id)\n url = \"#{@base_url}/api/v2/files/#{new_obj_id}/create_batch\"\n resp = api_post_json(url, files.to_json)\n if resp.code != '201'\n @log.write(\"Error saving #{files.count} files #{files[0]['identifier']}...\\n\")\n @log.write(files.inspect)\n @log.write(\"\\n\" + resp.body + \"\\n\")\n #exit(1)\n end\n end", "def uploaded_file\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n currentUser = current_user.id\n @uploadedFiles = UserFileMapping.where(:user_id =>currentUser )\n respond_with(@uploadedFiles)\n end", "def _upload(api_key, file) \n url = Client.site + \"/upload.json\"\n params = { \"api_key\" => api_key, \"api_method\" => \"ruby\", \"id\" => id.to_s, \"file\" => file }\n resp = HTTPClient.post url, params \n JSON.parse(resp.content)\n end", "def upload\n @db=Database.find(params[:id])\n @files = params[:files]\n @files.each do |file|\n name = file.original_filename\n directory = @db.path\n path = File.join(directory, name)\n File.open(path, \"wb\") { |f| f.write(file.read) }\n end\n flash[:notice] = \"File uploaded\"\n respond_to do |format|\n format.html {redirect_to files_database_url(@db)}\n format.json { render json: @files }\n end\n end", "def creator_upload(username, file_name, file)\r\n dir = \"creators/#{username}\"\r\n file.original_filename = file_name + (File.extname file.original_filename)\r\n return write(dir, file)\r\n end", "def index\n @userfiles = Userfile.all\n end", "def index\n @title = \"User uploaded files\"\n get_files(params)\n end", "def set_userfile\n @userfile = Userfile.find(params[:id])\n end", "def set_userfile\n @userfile = Userfile.find(params[:id])\n end", "def files_upload(params = {})\n response = @session.do_post \"#{SCOPE}.upload\", params\n Slack.parse_response(response)\n end", "def create\n @used_object = UsedObject.new(used_object_params)\n @used_object.user = current_user\n respond_to do |format|\n if @used_object.save\n if params[:supporting_files]\n params[:supporting_files].each { |file| \n @used_object.supporting_files.create(file: file)\n }\n end\n format.html { redirect_to @used_object, notice: 'Used object was successfully created.' }\n format.json { render :show, status: :created, location: @used_object }\n else\n format.html { render :new }\n format.json { render json: @used_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@file_folder = FileFolder.new(file_folder_params)\n @folder = current_user.folders.where(\"id = ?\", params[:current_folder_id]).first\n @files = @folder.file_folders.build \n io_file = params[:file]\n respond_to do |format|\n if @files.store(io_file)\n @files = [] << @files\n format.js {render \"files_list\", status: 200}\n else\n format.js {render js: \"alert('Could not create file\", status: 400}\n end \n end \n end", "def userfiles_post(upload_file, data_provider_id, userfile_group_id, file_type, opts = {})\n data, _status_code, _headers = userfiles_post_with_http_info(upload_file, data_provider_id, userfile_group_id, file_type, opts)\n data\n end", "def create_upload_files(record)\n return unless record.mapper.respond_to?(:files)\n files_to_attach = record.mapper.files\n return [] if files_to_attach.nil? || files_to_attach.empty?\n\n uploaded_file_ids = []\n files_to_attach.each do |filename|\n file = File.open(find_file_path(filename))\n uploaded_file = Hyrax::UploadedFile.create(user: depositor, file: file)\n uploaded_file_ids << uploaded_file.id\n file.close\n end\n uploaded_file_ids\n end", "def multi_upload\n authenticate!\n attachments = []\n (attachment_params[:attachments] || []).each do |key, value|\n if value[:file]\n attachment = value[:file]\n attachment_params = {\n :filename => attachment[:filename],\n :type => attachment[:type],\n :headers => attachment[:head],\n :tempfile => attachment[:tempfile]\n }\n file = ActionDispatch::Http::UploadedFile.new(attachment_params)\n attachments << Attachment.create(file: file, user: current_user)\n end\n end\n {\n code: 0,\n data: attachments\n }\n end", "def userfiles_compress_post(multi_userfile_mod_req, opts = {})\n userfiles_compress_post_with_http_info(multi_userfile_mod_req, opts)\n nil\n end", "def upload_file(item_file)\n upload_response = @server.upload(item_file.file(item_file.metadata_full_path))\n json = JSON.parse(upload_response.body)\n json['files'].map { |f| f['id'] }\n end", "def post(name_n, file)\n begin\n raise \"API Key not set!\" if @api_key.nil?\n\n # If we were passed only a path then make a File\n file = File.new(file) unless file.is_a? File\n\n headers = { \"X-API-Key\" => @api_key }\n data = { avatar: file, name_n: name_n }\n\n r = RestClient.post(\"#{@endpoint}api/avatars\", data, headers)\n return false unless r.code == 201\n rescue => e\n @error = e\n return false\n end\n return true\n end", "def media_file_params\n params.require(:media_file).permit(:name, files: []).merge({\n user_id: current_user.id,\n })\n end", "def userfiles_sync_multiple_post(multi_userfile_mod_req, opts = {})\n userfiles_sync_multiple_post_with_http_info(multi_userfile_mod_req, opts)\n nil\n end", "def save_delicious_files(input_file, user_id)\n upload_dir = FileService.ensure_existence_upload_directory\n file_path = File.join(upload_dir, \"delicious_user-#{user_id}_#{Time.now.to_i}.html\")\n File.open(file_path, 'wb') do |file|\n file.write(input_file.read)\n end\n file_path\n end", "def upload_file\n #TODO\n end", "def upload(file, someone)\n end", "def set_user_file\n @user_file = UserFile.where(user_id: current_user.id).find(params[:id])\n end", "def parse_files_json(file)\n\n files_hash = convert_json(b2_list_file_names(file))\n files = {}\n\n files_hash[\"files\"].each do |file_hash|\n files[file_hash[\"fileName\"]] = file_hash[\"fileId\"]\n end\n\n return files\n\nend", "def create\n @file_record = FileRecord.new(file_record_params)\n @file_record.user_id = current_user.id\n\n respond_to do |format|\n if @file_record.save\n format.html { redirect_to file_records_path, notice: \"File record was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @file_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_folder_with_files(folder_name, recipient, sender) \n\tputs \"Creating folder with files.\"\n\tdata = {\n\t\t\"name\" => folder_name,\n\t\t\"from\" => sender,\n\t\t\"to\" => recipient,\n\t\t\"files\" => [{\n\t\t\t\"name\" => \"Ruby_File1.pdf\",\n\t\t\t\"copies\" => 1,\n\t\t\t\"notes\" => \"Ruby_File1 was uploaded using Ruby\",\n\t\t\t\"url\" => \"file_url1\"\n\t\t}, {\n\t\t\t\"name\" => \"Ruby_File2.pdf\",\n\t\t\t\"copies\" => 1,\n\t\t\t\"notes\" => \"Ruby_File2 was uploaded using Ruby\",\n\t\t\t\"url\" => \"file_url2\"\n\t\t}]\n\t}.to_json()\n\tputs data\n\tresponse = request_post('/api/partner/folder', data)\n\tputs response.body\nend", "def fotosprofile_params\n params.require(:fotosprofile).permit(:user_id, :mis_fotos)\n end", "def create\n hash = []\n params[:files].each do |i,file_io|\n path = File.join(Rails.root,'public','attach',file_io.original_filename)\n File.open(path, \"wb\") { |f| f.write(file_io.read)}\n attachment = Attachment.create do |attach|\n attach.name = file_io.original_filename\n attach.describe = params[:describe]\n end \n hash.push attachment\n end\n render json: hash\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def create\n @upload = @user.uploads.build(upload_params)\n authorize @upload\n\n respond_to do |format|\n if @upload.save\n format.json { render json: @upload }\n format.html { redirect_to user_uploads_path(@user) }\n else\n format.json { render json: @upload.errors }\n format.json { render :new }\n end\n end\n end", "def user_params\n params.require(:user).permit(:email, :name, :attachment)\n end", "def create\n files = params[:files]\n files.each do |image|\n @product = Product.new({ image: image, user_id: current_user.id })\n @product.save\n end\n\n respond_to do |format|\n format.html { render :new }\n end\n end", "def request_data\n {\n file: File.new(@upload_path, \"rb\"),\n data: @data.to_json\n }\n end", "def write(files, private_gist = false, description = nil)\n response = request(create_url) do |url|\n Net::HTTP::Post.new(url.path).tap {|req|\n req.body = JSON.generate(data(files, private_gist, description))\n }\n end\n\n case response\n when Net::HTTPUnauthorized\n $stderr.puts \"Invalid credentials connecting to #{api_url}\"\n false\n when Net::HTTPCreated, Net::HTTPOK\n JSON.parse(response.body)['html_url']\n else\n raise StandardError, \"#{response.code} #{response.message}\"\n end\n end", "def upload_file(upload, user, client_name)\n if upload != nil\n if user.link_picture != nil\n File.delete('public/images/' << user.link_picture)\n end\n name = upload['img'].original_filename\n directory = 'public/images/' + client_name + '/users/' + user.username\n path = File.join(directory, name)\n File.open(path, 'wb') { |f| f.write(upload['img'].read) }\n path_img = client_name + '/users/' + user.username + '/' + name\n User.where(:id => user.id).update_all(link_picture: path_img)\n end\n end", "def create\n @treq = Treq.new(params[:treq])\n \n respond_to do |format|\n if @treq.save\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n TreqNotifier.submit_treq(@treq).deliver\n format.html { redirect_to @treq, notice: 'Treq was successfully created.' }\n format.json { render json: @treq, status: :created, location: @treq }\n else\n format.html { render action: \"new\", alert: \"Test Requset has been submitted.\"}\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_export_file_params\n params.require(:user_export_file).permit(:user_id, :mode)\n end", "def files(trading_partner_id, filename)\n scope 'default'\n url = URI.parse(@api_url + '/files/')\n\n File.open(filename) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', filename),\n 'trading_partner_id' => trading_partner_id\n req['Authorization'] = \"Bearer #{default_scope.token}\"\n req['User-Agent'] = user_agent\n\n @response = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\n end\n\n JSON.parse(@response.body)\n end", "def create\n @user = User.new(user_params)\n encoded_file = params[:user][:filename]\n if !params[:user].nil? && !encoded_file.nil? && encoded_file != \"\"\n @user.remove_image_path\n @user.create_image(encoded_file)\n end\n\n respond_to do |format|\n if @user.save then\n # Setting the conversation_user ids of the new user from 0 to the users new ID\n users_conversations = ConversationUser.where(phone: @user.phone)\n users_conversations.each do |conv_user|\n conv_user.user_id = @user.id\n conv_user.save!\n end\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :ok }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:file].original_filename)\n collection.add(file)\n google_session.root_collection.remove(file)\n render json: 'Upload Successful'\n end", "def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end", "def index\n if params[:user_file_tag]\n @user_files = UserFile.tagged_with(params[:user_file_tag]).where(user_id: current_user.id)\n else\n @user_files = UserFile.where(user_id: current_user.id)\n end\n end", "def httppostfile(url, corpNum, form, files, userID, isBinary = false)\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Content-Type\" => \"multipart/form-data;boundary=\" + BaseService::BOUNDARY,\n \"Accept-Encoding\" => \"gzip,deflate\",\n \"Connection\" => \"Keep-Alive\"\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n post_body = []\n\n if form.to_s != ''\n post_body << \"--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"form\\\"\\r\\n\"\n post_body << \"Content-Type: Application/json;\\r\\n\\r\\n\"\n post_body << form.to_json + \"\\r\\n\"\n end\n if isBinary\n files.each do |fileData|\n fileName = fileData[\"fileName\"]\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << fileData[\"fileData\"].force_encoding(\"UTF-8\")\n end\n else\n files.each do |filePath|\n begin\n fileName = File.basename(filePath)\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << File.read(filePath)\n rescue\n raise PopbillException.new(-99999999, \"Failed to reading filedata from filepath\")\n end\n end\n end\n\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}--\\r\\n\"\n # Add the file Data\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, post_body.join.encode(\"UTF-8\"), headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n\n end", "def userfiles_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_get ...'\n end\n # resource path\n local_var_path = '/userfiles'\n\n # query parameters\n 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\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Userfile>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n if current_user\n @ufile = Ufile.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ufile }\n end\n else\n redirect_to \"/users/sign_in\"\n end\n end", "def add_new_med(name, med_data)\n user_list = JSON.parse(File.read(\"./files/user_info.json\"))\n user_list[\"Users\"].each do |user|\n if user[\"Name\"] == name\n user[\"Medication\"] << med_data \n end\n end \n File.write(\"./files/user_info.json\", JSON.generate(user_list))\nend", "def update\n respond_to do |format|\n if @user_file.update(user_file_params)\n format.html { redirect_to @user_file, notice: \"User file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n data =params[:data]\n\n resource = ActiveSupport::JSON.decode(data)\n @repo = Repository.find(resource[\"repo_id\"])\n dir_path = resource[\"dirPath\"];\n post = DataFile.save(params['file'], @repo.path+dir_path)\n\n\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\tGitHelper.commitAll(@git, resource[\"comment\"])\n\n\t\trender json: {success: \"file uploaded\"}\n end", "def create\n\n params['file'].each{|f|\n doc = Community::File.new(community_file_params)\n doc.file = f\n community_file_params[:title].blank? ? doc.title = f.original_filename : doc.title = community_file_params[:title]\n doc.author = current_user.email unless current_user.nil?\n doc.save\n\n file = File.read('public/uploads/community/file/file/' + doc._id.to_s + '/' + doc.file.filename)\n\n doc.import JSON.parse(file)\n } unless params['file'].nil?\n\n respond_to do |format|\n format.js {}\n format.json { head :no_content, status: :created }\n end\n end", "def create\n @user = User.new(user_params)\n @user.image = Base64.encode64(open(user_params[:image].tempfile.path) { |io| io.read })\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_file_and_give_me_a_json(additional_path, file_path)\n if self.service_base_path != nil\n message = \"{error: \\\"File not found.\\\"}\"\n File.open(file_path) do |file|\n body = { 'arquivo' => file }\n message = self.http_client.post \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json?api_key=#{self.access_token}\", body\n end\n trata_erro(message.content)\n end\n end", "def create\n @user = User.new(user_params)\n if params[:user][:data]\n @user.image = params[:user][:data].read # <= バイナリをセット\n @user.data_type = params[:user][:data].content_type # <= ファイルタイプをセット\n end\n respond_to do |format|\n if @user.save\n log_in @user\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def upload_user_bikes\n end", "def discover_files\n authorize! :create, resource_class\n respond_to do |f|\n f.json do\n render json: file_locator.to_h\n end\n end\n end", "def files_post_with_http_info(api_key, file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: FilesApi.files_post ...\"\n end\n # verify the required parameter 'api_key' is set\n fail ArgumentError, \"Missing the required parameter 'api_key' when calling FilesApi.files_post\" if api_key.nil?\n # verify the required parameter 'file' is set\n fail ArgumentError, \"Missing the required parameter 'file' when calling FilesApi.files_post\" if file.nil?\n # resource path\n local_var_path = \"/files\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'api_key'] = api_key\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(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params[\"file\"] = file\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'File')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#files_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @user=User.find(params[:user_id])\n @file_upload = @user.file_uploads.new(file_upload_params)\n\n respond_to do |format|\n if @file_upload.save\n format.html { redirect_to user_file_upload_path(@user,@file_upload), notice: 'File was successfully uploaded.' }\n format.json { render :show, status: :created, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n\n else\n format.html { render :new }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def users_post\n params = Rack::Request.new(@env).POST\n phone = params['phone']\n key = params['key']\n\n if phone_valid?(phone) && uuid_valid?(key)\n # Validate picture_id, first_name, last_name, and email\n picture_id = params['picture_id']\n error = picture_id_invalid_response!(picture_id)\n return error if error\n\n first_name = params['first_name']\n error = name_invalid_response!('First', first_name)\n return error if error\n\n last_name = params['last_name']\n error = name_invalid_response!('Last', last_name)\n return error if error\n\n email = params['email']\n error = email_invalid_response!(email)\n return error if error\n\n $pg.with do |pg|\n pg.exec_params('SELECT * FROM users_post($1, $2, $3, $4, $5)', [phone, key, first_name, last_name, email]) do |r|\n if r.num_tuples == 1\n user_id = r.getvalue(0, 0)\n body = {access_token: build_access_token(user_id, key)}\n if picture_id\n fields = Aws::S3::Resource.new.bucket('acani-chats').presigned_post({\n acl: 'public-read',\n content_length_range: 0..3145728,\n content_type: 'image/jpeg',\n key: \"users/#{user_id}/#{picture_id}.jpg\"\n }).fields\n body[:fields] = fields\n end\n return [201, body.to_json]\n end\n end\n end\n end\n set_www_authenticate_header\n [401, '{\"message\":\"Incorrect phone or key.\"}']\n end", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def users_import_params\n\t\tparams.require(:user).require(:file)\n\tend", "def on_post(path)\n acct = I3.server.remote_account\n local_path = DocumentFile::DOC_FILE_PATH + path\n \n # Sanity checks\n unless File.directory?(local_path)\n send_uploaded_file_response I3::NotFoundException.new(\n :message => \"The path '#{path}' could not be found.\")\n return\n end #unless\n \n if DocumentPlatform.check_permission(:write, acct, local_path).empty?\n send_uploaded_file_response I3::SecurityException.new(\n :message => \"You do not have permission to write to folder '#{path}'\")\n return\n end #if\n \n # We are good to go so far, so let's grab the file\n file = I3.server.cgi[\"fileToUpload\"]\n filename = file.filename\n \n # Internet Explorer will sometimes send the whole path. We only want the filename.\n filename = filename.split(\"\\\\\").last if filename =~ /\\w:\\\\/\n \n begin\n response = UploadedFile.save_as(filename, file, local_path)\n send_uploaded_file_response response\n \n rescue I3::SecurityException\n log.warn \"User #{acct.account_name} tried to upload a file to '#{path}' and was denied.\"\n send_uploaded_file_response $!\n \n rescue FileAlreadyExistsException\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n response = $!.to_shared\n response.temp_file = UploadedFile.save_as_temp(file)\n response.path = path\n response.original_filename = filename\n response.overwritable = (not DocumentPlatform.check_permission(\n :write, acct, File.join(local_path, filename)).empty?)\n send_uploaded_file_response response\n rescue\n log.warn \"User #{acct.account_name} failed to save file '#{File.join(path, filename)}'\" + \n \" (#{$!.message})\"\n send_uploaded_file_response I3::ServerException.new(\n :title => \"Could not save file\", \n :message => $!.message )\n end #begin\n \n end", "def json_params\n params.require(:json).permit(:file1,:file,:filename,:filename1,:content_type1,:content_type,:file_contents,:file_contents1,:objekt,:objekt1)\n end" ]
[ "0.68337363", "0.67957366", "0.6751274", "0.65877485", "0.6498353", "0.64395106", "0.64334106", "0.6379515", "0.63752466", "0.6269953", "0.6223095", "0.61931324", "0.61877227", "0.61765426", "0.6164663", "0.6108705", "0.6107378", "0.6081538", "0.6059723", "0.59783614", "0.59681374", "0.5966961", "0.5953629", "0.59512424", "0.5942102", "0.5912087", "0.59061337", "0.5888465", "0.58747625", "0.5870806", "0.584243", "0.583794", "0.58064", "0.5796745", "0.5783904", "0.57586265", "0.5748651", "0.5746209", "0.5745012", "0.5744623", "0.57241", "0.5720685", "0.56930584", "0.569221", "0.56458384", "0.5641856", "0.5641856", "0.5640308", "0.5635413", "0.56202745", "0.5619121", "0.56129384", "0.5608205", "0.56056106", "0.5578432", "0.55734164", "0.5559329", "0.55442655", "0.5523971", "0.55229515", "0.5522823", "0.5519575", "0.551873", "0.5514906", "0.5496316", "0.54910415", "0.54902667", "0.5477286", "0.5474377", "0.5468535", "0.5457423", "0.54529405", "0.54502165", "0.5449804", "0.5449053", "0.5435616", "0.54322094", "0.5429492", "0.54224885", "0.5418496", "0.5417961", "0.5407589", "0.54039544", "0.5394619", "0.53831345", "0.53826696", "0.5379929", "0.53785855", "0.53665555", "0.53629285", "0.53577775", "0.5352251", "0.53429914", "0.5336034", "0.53291345", "0.5328118", "0.53273535", "0.5327273", "0.53227466", "0.5317621" ]
0.66661066
3
PATCH/PUT /userfiles/1 PATCH/PUT /userfiles/1.json
def update respond_to do |format| if @userfile.update(userfile_params) format.html { redirect_to @userfile, notice: 'Userfile was successfully updated.' } format.json { render :show, status: :ok, location: @userfile } else format.html { render :edit } format.json { render json: @userfile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @userfile = Userfile.find(params[:id])\n\n respond_to do |format|\n if @userfile.update_attributes(params[:userfile])\n format.html { redirect_to @userfile, notice: 'Userfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @userfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @userfile.update(userfile_params)\n format.html { redirect_to @userfile, notice: 'Userfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @userfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_file = UserFile.find(params[:id])\n authorize! :update, @user_file\n respond_to do |format|\n if @user_file.update_attributes(params[:user_file])\n format.html { redirect_to @user_file, :notice => 'User file was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user_file.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_file.update(user_file_params)\n format.html { redirect_to @user_file, notice: \"User file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n \n if @user.update(user_params)\n # parse all elements in the hash that have _destroy = 1\n all_user_files = user_params[:user_resources_attributes]\n all_user_files.each_value do |resource|\n if resource.fetch(:_destroy) == \"1\"\n S3_BUCKET.objects[\"uploads/#{@user[:id]}/#{resource.fetch :resource_name}\"].delete if S3_BUCKET.objects[\"uploads/#{@user[:id]}/#{resource.fetch :resource_name}\"].exists?\n end\n end\n @user.save\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ufile = Ufile.find(params[:id])\n\n respond_to do |format|\n if @ufile.update_attributes(params[:ufile])\n format.html { redirect_to @ufile, notice: 'Ufile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ufile.errors, status: :unprocessable_entity }\n end\n end\n end", "def userfiles_id_put_with_http_info(id, userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_id_put ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling UserfilesApi.userfiles_id_put\"\n end\n # verify the required parameter 'userfile_mod_req' is set\n if @api_client.config.client_side_validation && userfile_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'userfile_mod_req' when calling UserfilesApi.userfiles_id_put\"\n end\n # resource path\n local_var_path = '/userfiles/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(userfile_mod_req)\n auth_names = ['BrainPortalSession']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n\n# ap params\n\n \n# user_params.delete_blanks!\n\n\n\n# @image = @user.create_avatar(file_name: user_params[:avatar][:file_name])\n \n\n respond_to do |format|\n #.delete avatar: [:file_name]\n\n if @user.update_attributes(user_params) # this automatically deletes any avatar instances, as uploaded files are saved in a seperate model\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @super_file = SuperFile.find(params[:id])\n\n respond_to do |format|\n if @super_file.update_attributes(params[:super_file])\n format.html { redirect_to @super_file, notice: 'Super file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n if @test_file.update_attributes(params[:test_file])\n format.html { redirect_to @test_file, notice: 'Test file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def multi_update\n errors = false\n return_value = []\n file_infos_params = params.permit(file_infos: [:id, :review_done, :component_id]).require(:file_infos)\n file_infos_params.each do |key, file_info_entry|\n (return_value << nil) and (errors = true) and next unless file_info_entry[:id]\n file_info = FileInfo.find(file_info_entry[:id])\n (return_value << nil) and (errors = true) and next unless file_info\n if file_info.update(file_info_entry)\n return_value << file_info_entry\n else\n return_value << file_info.errors\n errors = true\n end\n end\n respond_to do |format|\n format.json { render json: return_value }\n if errors\n format.html { redirect_to :back, notice: 'Some entries have errors'}\n else\n format.html { redirect_to :back }\n end\n end\n end", "def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end", "def update\n upload = params.require(:file)\n handler = setup_handler(upload)\n\n if handler.valid?\n handler.call\n render json: {}, status: 202\n else\n render json: { errors: handler.errors }, status: 422\n end\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n unless admin_people_file_params[:title].blank?\n unless admin_people_file_params[:description].blank?\n unless admin_people_file_params[:file].blank?\n @admin_people_file.remove_file!\n end\n end\n end\n respond_to do |format|\n if @admin_people_file.update(admin_people_file_params)\n format.html { redirect_to @admin_people_file, notice: 'People file was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_people_file }\n else\n format.html { render :edit }\n format.json { render json: @admin_people_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testfile.update(testfile_params)\n format.html { redirect_to @testfile, notice: 'Testfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_file_mapping.update(user_file_mapping_params)\n format.html { redirect_to @user_file_mapping, notice: 'User file mapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_file_mapping }\n else\n format.html { render :edit }\n format.json { render json: @user_file_mapping.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n respond_to do |format|\n if @file_example.update(file_example_params)\n format.html { redirect_to @file_example, notice: 'File example was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_example }\n else\n format.html { render :edit }\n format.json { render json: @file_example.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @up_file = UpFile.find(params[:id])\n\n respond_to do |format|\n if @up_file.update_attributes(params[:up_file])\n format.html { redirect_to @up_file, notice: 'Up file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @up_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @user_attachment.update(user_attachment_params)\n format.html { redirect_to @user_attachment, notice: 'User attachment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_attachment.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n parse_path\n validate_path!\n\n if params.include?(:dir)\n @path.mkdir\n elsif params.include?(:file)\n @path.mv_from(params[:file].tempfile)\n elsif params.include?(:touch)\n @path.touch\n else\n content = request.body.read\n\n # forcing utf-8 because File.write seems to require it. request bodies are\n # in ASCII-8BIT and need to be re encoded otherwise errors are thrown.\n # see test cases for plain text, utf-8 text, images and binary files\n content.force_encoding('UTF-8')\n\n @path.write(content)\n end\n\n render json: {}\n rescue => e\n render json: { error_message: e.message }\n end", "def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end", "def update\n @asset_file = current_user.asset_files.find(params[:id]) \n\n respond_to do |format|\n if @asset_file.update(asset_file_params)\n format.html { redirect_to @asset_file, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @asset_file }\n else\n format.html { render :edit }\n format.json { render json: @asset_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n if @file_info.update_attributes(params[:file_info])\n format.html { redirect_to @file_info, notice: 'File info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @file_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !user_signed_in?\n redirect_to :root\n else\n if current_user.user?\n redirect_to :root\n end\n end\n respond_to do |format|\n if @fileupload.update(fileupload_params)\n format.html { redirect_to @fileupload, notice: 'Fileupload was successfully updated.' }\n format.json { render :show, status: :ok, location: @fileupload }\n else\n format.html { render :edit }\n format.json { render json: @fileupload.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n logger.debug(\"user update>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\")\n #logger.debug(@user.problemselectedstring)\n @user = User.find(params[:id])\n\n if (params[:change_infile] || params[:delete_problem_button]|| params[:add_delete_infile]|| params[:first_button]|| params[:second_button]|| params[:fourth_button]|| params[:add_problem_button]|| params[:new_file])|| params[:third_button]|| params[:delete_infile]\n\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash.notice = 'Update sucessful.'\n format.html { redirect_to generate_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n else\n\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash.notice = 'Update sucessful.'\n format.html { redirect_to home_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end\n #@user.infiles.build\n if @user.fileselected && @user.fileselected.length > 0 && FileTest.exists?(Rails.root.join('public','json',@user.fileselected))\n\n @problemlist = File.read(Rails.root.join('public','json',@user.fileselected))\n @problemlisthash = JSON.parse(@problemlist)\n #logger.debug(@problemlisthash)\n @problems = @problemlisthash [\"problem-list\"]\n end\n\n if params[:change_infile]\n logger.debug(\">>>>>>>>>>>>>>>>>\")\n @user.fileselected = params[:change_infile]\n params.delete(:change_infile)\n #params.save\n logger.debug(params.inspect)\n @user.problemselectedstring = \"\"\n @user.save\n end\n\n if params[:delete_infile]\n logger.debug(\"delete file action>>>>>>>>\")\n current_user.infiles.each do |infile|\n logger.debug(infile.infile_file_name)\n logger.debug(@user.fileselected)\n if infile.infile_file_name == @user.fileselected\n logger.debug (\"deleting file\")\n infile.destroy\n end\n end\n end\n\n if params[:new_file]\n if @user.newfilename.length > 0\n\n @newproblem = {\"start\"=>\"new\", \"options\"=>[], \"value\"=>{\"accuracy-coins\"=>3, \"min-errors\"=>1, \"max-errors\"=>6, \"speed-coins\"=>3, \"min-speed\"=>1.0, \"max-speed\"=>15.0}}\n @newproblemarray = []\n\n #@problems.each_with_index do |i, index|\n @newproblemarray << @newproblem\n # if @problems[index][\"start\"] == @user.problemselectedstring\n # @problemnumber = index\n # @newproblemarray << @newproblem\n # logger.debug (\"index to add:\")\n # logger.debug (index)\n # end\n # end\n\n # @user.infiles.build\n\n #@problems.add_at(@problemnumber)\n\n #@problems << @newproblem\n\n @user.problemselectedstring = \"new\"\n @user.fileselected = @user.newfilename\n\n\n @problems = {\"problem-list\" => @newproblemarray}\n @new_json = (@problems.to_json)\n\n @localfilename = (Rails.root.join('public','json',@user.newfilename))\n\n #@user.infile.new\n\n File.open(Rails.root.join('public','json',@user.newfilename),\"w\") do |f|\n f.write(@new_json)\n #@user.infiles = f\n end\n\n #@logger.debug(@user.infiles.infile)\n\n # File.open(Rails.root.join('public','json',@user.newfilename),\"r\") do |f|\n # #f.write(@new_json)\n # # @user.infiles.object.infile_file_name = f\n # # end\n # logger.debug(\">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\")\n # #User.new(:infiles => File.open('/Users/thad/railsProjects/interfaceInputTrial/public/json/hope2.json'), 'r')\n # @user = current_user\n current_user.infiles.build\n current_user.infiles.each do |infile|\n logger.debug(\"instance methods\")\n logger.debug(infile.inspect)\n if !infile.infile_file_name \n # File.open(Rails.root.join('public','json',@user.newfilename),\"r\") do |f|\n # File.open(Rails.root.join('public','json',@user.newfilename),\"r\") do |f|\n # # #f.write(@new_json)\n infile.infile_file_name = @user.newfilename\n infile.user_id = @user.id\n infile.save\n end\n end\n # end\n\n\n #end\n #@user.infile = @localfilename\n #@user.save\n @user.newfilename = \"\"\n @user.save\n\n end # of if filename valid\n\n end # of if new file\n\n # if params[:second_button]\n\n # @problems.each_with_index do |i, index|\n # if @problems[index][\"start\"] == @user.problemselectedstring\n # @problemnumber = index\n # logger.debug (\"index to modify:\")\n # logger.debug (index)\n # end\n # end\n\n # @problems[@problemnumber][\"start\"] = @user.problemchange\n # @user.problemselectedstring = @user.problemchange\n\n # @user.save\n\n # @problems = {\"problem-list\" => @problems}\n # @new_json = (@problems.to_json)\n\n # File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n # f.write(@new_json)\n # end\n\n # end # of if second_button\n\n\n # logger.debug (\"found it.\")\n # \n # # logger.debug(@user.problemchange)\n # # logger.debug(@user.problemselectedstring)\n #logger.debug(\"getting there.............\")\n # if @user.problemchange != @user.problemselectedstring\n # # @problems = {\"problem-list\" => @problems }\n #logger.debug(\"Here are the problems\")\n #logger.debug (@problems)\n # @new_json = (@problems.to_json)\n # File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n # f.write(@problems.to_json)\n \n # if we have a problem selected\n #if @user.problemchange.length > 1\n # @problems[@problemnumber][\"start\"] = @user.problemchange\n # @user.problemselectedstring = @user.problemchange\n # logger.debug(\"problemselectedstring\")\n # logger.debug(@user.problemselectedstring)\n\n # @problems_list = {\"problem-list\" => @problems}\n #logger.debug (\"problem list\")\n #logger.debug (@problems_list)\n\n # @new_json = (@problems_list.to_json)\n # logger.debug(@new_json)\n \n # File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n # f.write(@new_json)\n # end\n \n #@user.save\n\n #end \n\n #logger.debug(params)\n # end\n #@user.active = true\n #@user.save\n #end\n\n # if params[:third_button]\n # @problems.each_with_index do |i, index|\n # if @problems[index][\"start\"] == @user.problemselectedstring\n # @problemnumber = index\n # logger.debug (\"index to modify:\")\n # logger.debug (index)\n # end\n # end\n \n # logger.debug(\"modifying options.............\")\n\n # @optionshash = []\n\n # if @user.ExactCompleteMatch == 1\n # @optionshash << \"exactCompleteMatch\"\n # end\n # if @user.ManualArithmetic == 1\n # @optionshash << \"manualArithmetic\"\n # end\n # if @user.QuickElimination == 1\n # @optionshash << \"quickElimination\"\n # end\n # if @user.ManualDone == 1\n # @optionshash << \"manualDone\"\n # end\n # if @user.Editable == 1\n # @optionshash << \"editable\"\n # end\n # if @user.ManualFactoring == 1\n # @optionshash << \"manualFactoring\"\n # end\n # if @user.ManualTranspose == 1\n # @optionshash << \"manualTranspose\"\n # end\n # if @user.ProblemScrolling == 1\n # @optionshash << \"problemScrolling\"\n # end\n # if @user.TapToFactorize == 1\n # @optionshash << \"tapToFactorize\"\n # end\n # if @user.MoveComplex == 1\n # @optionshash << \"noMoveComplex\"\n # end\n # if @user.PlusSpacing == 1\n # @optionshash << \"noFactorize\"\n # end\n # if @user.TimesSpacing == 1\n # @optionshash << \"timesSpacing\"\n # end\n # if @user.EqualsSpacing == 1\n # @optionshash << \"equalsSpacing\"\n # end\n # if @user.Subtraction == 1\n # @optionshash << \"subtraction\"\n # end\n # if @user.GameTimeOut == 1\n # @optionshash << \"gameTimeOut\"\n # end\n # #if @use\n # #if @user.problemchange.length > 1\n # @problems[@problemnumber][\"options\"] = @optionshash\n # #@user.problemselectedstring = @user.problemchange\n # #logger.debug(@optionshash)\n # #logger.debug(\"That was options hash\")\n\n # @problems_list = {\"problem-list\" => @problems}\n # #logger.debug (@problems_list)\n\n # @new_json = (@problems_list.to_json)\n\n # #logger.debug(@new_json)\n # File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n # f.write(@new_json)\n # end\n # #@user.save\n # #end\n # #logger.debug(params)\n\n # end # of if third button\n\n if params[:fourth_button]\n\n #@problems.delete_at(4)\n\n @problems.each_with_index do |i, index|\n \n if @problems[index][\"start\"] == @user.problemselectedstring\n @problemnumber = index\n logger.debug (\"index to modify:\")\n logger.debug (index)\n end\n end\n\n @newvaluehash = {\"accuracy-coins\" => @user.accuracycoins, \"min-errors\" => @user.minerrors, \"max-errors\" => @user.maxerrors, \"speed-coins\" => @user.speedcoins, \"min-speed\" => @user.minspeed, \"max-speed\" => @user.maxspeed }\n\n @problems[@problemnumber][\"value\"] = @newvaluehash\n \n @problemstowrite = {\"problem-list\" => @problems}\n @new_json = (@problemstowrite.to_json)\n\n File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n f.write(@new_json)\n end\n\n #if params[:second_button]\n\n @problems.each_with_index do |i, index|\n if @problems[index][\"start\"] == @user.problemselectedstring\n @problemnumber = index\n logger.debug (\"index to modify:\")\n logger.debug (index)\n end\n end\n\n @problems[@problemnumber][\"start\"] = @user.problemchange\n @user.problemselectedstring = @user.problemchange\n\n @user.save\n\n @problemstowrite = {\"problem-list\" => @problems}\n @new_json = (@problemstowrite.to_json)\n\n File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n f.write(@new_json)\n end\n\n #end # of if second_button\n #if params[:third_button]\n @problems.each_with_index do |i, index|\n if @problems[index][\"start\"] == @user.problemselectedstring\n @problemnumber = index\n logger.debug (\"index to modify:\")\n logger.debug (index)\n end\n end\n \n logger.debug(\"modifying options.............\")\n\n @optionshash = []\n\n if @user.ExactCompleteMatch == 1\n @optionshash << \"exactCompleteMatch\"\n end\n if @user.ManualArithmetic == 1\n @optionshash << \"manualArithmetic\"\n end\n if @user.QuickElimination == 1\n @optionshash << \"quickElimination\"\n end\n if @user.ManualDone == 1\n @optionshash << \"manualDone\"\n end\n if @user.Editable == 1\n @optionshash << \"editable\"\n end\n if @user.ManualFactoring == 1\n @optionshash << \"manualFactoring\"\n end\n if @user.ManualTranspose == 1\n @optionshash << \"manualTranspose\"\n end\n if @user.ProblemScrolling == 1\n @optionshash << \"problemScrolling\"\n end\n if @user.TapToFactorize == 1\n @optionshash << \"tapToFactorize\"\n end\n if @user.MoveComplex == 1\n @optionshash << \"noMoveComplex\"\n end\n if @user.PlusSpacing == 1\n @optionshash << \"noFactorize\"\n end\n if @user.TimesSpacing == 1\n @optionshash << \"timesSpacing\"\n end\n if @user.EqualsSpacing == 1\n @optionshash << \"equalsSpacing\"\n end\n if @user.Subtraction == 1\n @optionshash << \"subtraction\"\n end\n if @user.GameTimeOut == 1\n @optionshash << \"gameTimeOut\"\n end\n #if @use\n #if @user.problemchange.length > 1\n @problems[@problemnumber][\"options\"] = @optionshash\n #@user.problemselectedstring = @user.problemchange\n #logger.debug(@optionshash)\n #logger.debug(\"That was options hash\")\n\n @problems_list = {\"problem-list\" => @problems}\n #logger.debug (@problems_list)\n\n @new_json = (@problems_list.to_json)\n\n #logger.debug(@new_json)\n File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n f.write(@new_json)\n end\n #@user.save\n #end\n #logger.debug(params)\n\n #end # of if third button\n\n\n end # of if fourth_button\n\n if params[:delete_problem_button]\n @problems.each_with_index do |i, index|\n if @problems[index][\"start\"] == @user.problemselectedstring\n @problemnumber = index\n logger.debug (\"index to delete:\")\n logger.debug (index)\n end\n end\n\n @problems.delete_at(@problemnumber)\n @user.problemselectedstring = ''\n @user.save\n\n @problems = {\"problem-list\" => @problems}\n @new_json = (@problems.to_json)\n\n File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n f.write(@new_json)\n end\n\n end # of if delete_problem_button\n\n if params[:add_problem_button]\n\n @newproblem = {\"start\"=>\"new\", \"options\"=>[], \"value\"=>{\"accuracy-coins\"=>3, \"min-errors\"=>1, \"max-errors\"=>6, \"speed-coins\"=>3, \"min-speed\"=>1.0, \"max-speed\"=>15.0}}\n @newproblemarray = []\n\n @problems.each_with_index do |i, index|\n @newproblemarray << @problems[index]\n if @problems[index][\"start\"] == @user.problemselectedstring\n @problemnumber = index\n @newproblemarray << @newproblem\n logger.debug (\"index to add:\")\n logger.debug (index)\n end\n end\n\n\n #@problems.add_at(@problemnumber)\n\n #@problems << @newproblem\n\n @user.problemselectedstring = \"new\"\n @user.save\n\n @problems = {\"problem-list\" => @newproblemarray}\n @new_json = (@problems.to_json)\n\n File.open(Rails.root.join('public','json',@user.fileselected),\"w\") do |f|\n f.write(@new_json)\n end\n\n end # of if add_problem_button\n\n \n end", "def update\n respond_to do |format|\n if @used_object.update(used_object_params)\n if params[:supporting_files]\n params[:supporting_files].each { |file| \n @used_object.supporting_files.create(file: file)\n }\n end\n format.html { redirect_to @used_object, notice: 'Used object was successfully updated.' }\n format.json { render :show, status: :ok, location: @used_object }\n else\n format.html { render :edit }\n format.json { render json: @used_object.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def file_user_params\n params.require(:file_user).permit(:modify, :view, :fileId_id, :userId_id)\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n if @users_photo.update_attributes(params[:users_photo])\n format.html { redirect_to @users_photo, notice: 'Users photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @file_info.update(file_info_params)\n format.html { redirect_to @file_info, notice: 'File info was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_info }\n else\n format.html { render :edit }\n format.json { render json: @file_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @capa = Capa.find(params[:id])\n\n respond_to do |format|\n if @capa.update_attributes(params[:capa])\n unless params[:capa_files].blank?\n params[:capa_files]['file'].each do |a|\n @capa_file = @capa.capa_files.create!(:file => a, :capa_id => @capa.id)\n end\n end\n format.html { redirect_to @capa, notice: 'Capa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def update\n error_msg(ErrorCodes::OBJECT_ERROR, \"#{I18n.t \"endnote_files.errors.not_found\"}: #{params[:id]}\")\n render_json\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n authorize @task\n @task.updated_by = current_user\n\n files = @task.files\n files += task_params[:files] if task_params[:files]\n @task.assign_attributes(task_params)\n @task.files = files\n\n if params[:files_remove]\n\n remain_files = @task.files\n\n params[:files_remove].reverse_each do |file, state|\n if state.to_i == 1\n deleted_files = remain_files.delete_at(file.to_i)\n deleted_files.try(:remove!)\n end\n end\n\n @task.remove_files! if remain_files.empty?\n end\n respond_to do |format|\n if @task.save\n format.html { redirect_back_or_default tasks_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def set_userfile\n @userfile = Userfile.find(params[:id])\n end", "def set_userfile\n @userfile = Userfile.find(params[:id])\n end", "def update!(**args)\n @file_id = args[:file_id] if args.key?(:file_id)\n @file_name = args[:file_name] if args.key?(:file_name)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n respond_to do |format|\n if @file_upload.update(file_upload_params)\n format.html { redirect_to @file_upload, notice: 'File upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n respond_to do |format|\n if @unuse_file.update(unuse_file_params)\n format.html { redirect_to @unuse_file, notice: 'Unuse file was successfully updated.' }\n format.json { render :show, status: :ok, location: @unuse_file }\n else\n format.html { render :edit }\n format.json { render json: @unuse_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update\n respond_to do |format|\n if @datafile.update(datafile_params)\n format.html { redirect_to @datafile, notice: 'Datafile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @datafile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @userspec.update(userspec_params)\n format.html { redirect_to root_path, notice: 'Userspec was successfully updated.' }\n format.json { render :show, status: :ok, location: @userspec }\n else\n format.html { render :edit }\n format.json { render json: @userspec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n @avatar = @user.avatar\n \n @service = UserService.new(@user, @avatar)\n \n params[:user][:last_ip] = request.env['REMOTE_ADDR']\n respond_to do |format|\n if @service.update_attributes(params[:user], params[:avatar_file]) ###@user.update_attributes(params[:user])\n flash[:notice] = t('flash.notice.user_update') # 'User was successfully updated.'\n format.any(:html,:iphone) { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.any(:iphone,:html) { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @tmp = get_tmp_data(:tmp)\n if set_tmp_data(:tmp, @tmp.data.merge(tmp_params))\n format.html { redirect_to tmp_url, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @tmp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n RawFile.transaction do\n @raw_file = RawFile.find_by_user(params[:id],current_user.id)\n\n @raw_file.uploaded_file = params[:raw_file][:file]\n\n respond_to do |format|\n if @raw_file.save\n format.html { redirect_to @raw_file, :notice => 'Raw file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\", :locals => { :raw_file => @raw_file } }\n format.json { render :json => @raw_file.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n encoded_file = params[:user][:filename]\n if !params[:user].nil? && !encoded_file.nil? && encoded_file != \"\"\n @user.remove_image_path\n @user.create_image(encoded_file)\n end\n\n respond_to do |format|\n if @user.update(user_params) \n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render json: @user, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user_file\n @user_file = @folder.files.find(params[:id])\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @doc_file.update(doc_file_params)\n format.html { redirect_to @doc_file, notice: 'Doc file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @doc_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @file_version = FileVersion.find(params[:id])\n params[:versioned_file_id] = @file_version.versioned_file_id\n if update_versioned_files? \n if @file_version.update(:isActive => true)\n head :no_content\n else\n render json: @file_version.errors, status: :unprocessable_entity\n end \n else \n render json: @file_version.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @script_id = args[:script_id] if args.key?(:script_id)\n end", "def files_remote_update(options = {})\n post('files.remote.update', options)\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update_object2_with_http_info(username, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserServiceApi.update_object2 ...'\n end\n # verify the required parameter 'username' is set\n if @api_client.config.client_side_validation && username.nil?\n fail ArgumentError, \"Missing the required parameter 'username' when calling UserServiceApi.update_object2\"\n end\n # resource path\n local_var_path = '/users/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) \n\n # return_type\n return_type = opts[:return_type] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || []\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserServiceApi#update_object2\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @other_file.update(other_file_params)\n format.html { redirect_to @other_file, notice: 'Other file was successfully updated.' }\n format.json { render :show, status: :ok, location: @other_file }\n else\n format.html { render :edit }\n format.json { render json: @other_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update!(**args)\n @file_contents = args[:file_contents] if args.key?(:file_contents)\n end", "def update\n @user_photo = UserPhoto.find(params[:id])\n\n respond_to do |format|\n if @user_photo.update_attributes(params[:user_photo])\n format.html { redirect_to @user_photo, notice: 'User photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n if params[:user][:profile_pic]\n uploaded_file = params[:user][:profile_pic].path\n @user.update(profile_pic: Cloudinary::Uploader.upload(uploaded_file, :folder => \"user/profile\")[\"public_id\"])\n end\n format.html {\n flash[:success] = \"Your profile has been updated.\"\n redirect_to users_url\n }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @resource_file = ResourceFile.find(params[:id])\n\n respond_to do |format|\n if @resource_file.update_attributes(params[:resource_file])\n format.html { redirect_to @resource_file, notice: 'Resource file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @grid_fs_file.update(grid_fs_file_params)\n format.html { redirect_to @grid_fs_file, notice: 'Grid fs file was successfully updated.' }\n format.json { render :show, status: :ok, location: @grid_fs_file }\n else\n format.html { render :edit }\n format.json { render json: @grid_fs_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n @perfile = Perfile.find(params[:id])\n @perfile.direccionusuario_attributes.where(:id => current_user.id)\n respond_to do |format|\n if @perfile.perfileusuarios_attributes(params[:perfile]) and @perfile.direccionusuario.direccionusuario_attributes(params[:perfilusuario])\n format.html { redirect_to @perfile, notice: 'Perfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @perfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket_file.update(ticket_file_params)\n format.html { redirect_to @ticket_file, notice: 'Ticket file was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_file }\n else\n format.html { render :edit }\n format.json { render json: @ticket_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_photo.update(user_photo_params)\n format.html { redirect_to action: 'index' }\n format.json { head :no_content }\n flash.notice = 'User photo was successfully updated.'\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update_many\n if @users.update_all(user_params)\n render json: @users, status: :ok, location: users_url\n else\n render json: @users.errors, status: :unprocessable_entity\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def put!\n request! :put\n end", "def update\n @user = User.find(params[:id])\n\n if params[:user][:data]\n @user.image = params[:user][:data].read # <= バイナリをセット\n @user.data_type = params[:user][:data].content_type # <= ファイルタイプをセット\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\nend", "def update\n respond_to do |format|\n if @batch_file.update(batch_file_params)\n format.html { redirect_to @batch_file, notice: \"Batch file was successfully updated.\" }\n format.json { render :show, status: :ok, location: @batch_file }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @batch_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @upload_file.update(upload_file_params)\n format.html { redirect_to @upload_file, notice: 'Upload file was successfully updated.' }\n format.json { render :show, status: :ok, location: @upload_file }\n else\n format.html { render :edit }\n format.json { render json: @upload_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @upload_file.update(upload_file_params)\n format.html { redirect_to @upload_file, notice: 'Upload file was successfully updated.' }\n format.json { render :show, status: :ok, location: @upload_file }\n else\n format.html { render :edit }\n format.json { render json: @upload_file.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69275093", "0.6792722", "0.6777871", "0.66698885", "0.66286117", "0.6622167", "0.62421894", "0.6200773", "0.61399335", "0.6110376", "0.6042729", "0.60135764", "0.59915954", "0.5953033", "0.5946752", "0.59448725", "0.59307116", "0.59276414", "0.5918037", "0.5907959", "0.5885966", "0.5880603", "0.5867054", "0.58494043", "0.5843219", "0.58397174", "0.5823698", "0.58169496", "0.5811966", "0.5806187", "0.57982963", "0.57914543", "0.57897615", "0.578791", "0.57814384", "0.5779533", "0.5776492", "0.57575583", "0.575589", "0.57558495", "0.5743397", "0.57311696", "0.572745", "0.5726762", "0.5716636", "0.5708048", "0.57030773", "0.5701715", "0.5697638", "0.5686092", "0.5686092", "0.5684816", "0.5683363", "0.5681416", "0.5681171", "0.56795603", "0.56773853", "0.56683373", "0.56614125", "0.56614125", "0.5658195", "0.56516755", "0.5648651", "0.5647446", "0.56423366", "0.5637877", "0.5634379", "0.5629415", "0.56269383", "0.5624174", "0.5621127", "0.56199527", "0.5610394", "0.5605337", "0.5589386", "0.5589386", "0.5584458", "0.5583913", "0.5580501", "0.5578002", "0.5576239", "0.5568759", "0.55674434", "0.55551326", "0.55516773", "0.55442345", "0.5544013", "0.55385447", "0.553513", "0.55303913", "0.5527916", "0.5526422", "0.5525595", "0.5522475", "0.5521704", "0.5521357", "0.5513787", "0.5511034", "0.55104643", "0.55104643" ]
0.66609365
4
DELETE /userfiles/1 DELETE /userfiles/1.json
def destroy @userfile.destroy respond_to do |format| format.html { redirect_to userfiles_url, notice: 'Userfile was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @userfile = Userfile.find(params[:id])\n @userfile.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_file.destroy\n respond_to do |format|\n format.html { redirect_to user_files_url, notice: \"User file was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @user_file = UserFile.find(params[:id])\n authorize! :destroy, @user_file\n name=@user_file.uploaded_file_file_name\n @user_file.destroy\n\n respond_to do |format|\n format.html { redirect_to :back,:notice=>\"Deleted file: \"+name }\n format.json { head :ok }\n end\n end", "def destroy\n @userfile.destroy\n\n fileName = Rails.root.join('public','uploads', @userfile.file_name_slug)\n File.delete(fileName) if File.exist?(fileName)\n\n respond_to do |format|\n format.html { redirect_to user_mycontact_meeting_userfiles_path }\n format.json { head :no_content }\n end\n end", "def delete(path = '/files/', params = {})\n request :delete, path, params\n end", "def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "def destroy\n @ufile = Ufile.find(params[:id])\n @ufile.destroy\n\n respond_to do |format|\n format.html { redirect_to ufiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @[email protected]_uploads.find(params[:id])\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to user_file_uploads_path, notice: 'File was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def file_delete(path)\n params = {\n \"root\" => @root,\n \"path\" => format_path(path, false),\n }\n response = @session.do_post build_url(\"/fileops/delete\", params)\n parse_response(response)\n end", "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def delete_file(uid, info = {})\n if info[\"multipart_id\"]\n multipart_upload = object(uid).multipart_upload(info[\"multipart_id\"])\n abort_multipart_upload(multipart_upload)\n\n delete [object(\"#{uid}.info\")]\n else\n delete [object(uid), object(\"#{uid}.info\")]\n end\n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def delete\n unless FileDescriptor.exists?(filename: params[:fname])\n fpath = filePath params[:fname]\n begin\n File.delete fpath\n result = {status: 'ok'}\n status = 200\n rescue Exception => e\n result = {status: 'error', message: e.message}\n status = 500\n end\n else\n result = {status: 'error', message: 'File is open'}\n status = 403 # Forbidden\n end\n render json: result.to_json, status: status\n end", "def destroy\n @up_file = UpFile.find(params[:id])\n @up_file.destroy\n\n respond_to do |format|\n format.html { redirect_to up_files_url }\n format.json { head :no_content }\n end\n end", "def delete(path, opts = {})\n input_json = {\n path: path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/delete\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def delete(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n if id.is_a? Array then\n id = id.join(',')\n end\n\n make_post_call('/files/delete?file_ids=%s' % [id]).status == \"OK\"\n end", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def destroy\n @super_file = SuperFile.find(params[:id])\n @super_file.destroy\n\n respond_to do |format|\n format.html { redirect_to super_files_url }\n format.json { head :no_content }\n end\n end", "def delete_current_presentation(file_id, user)\n delete_url = \"https://www.googleapis.com/drive/v2/files/#{file_id}\"\n headers = { 'Authorization': \"Bearer #{user.google_access_token}\", 'Content-type': 'application/json' }\n rest_resource = RestClient::Resource.new(delete_url, :headers => headers)\n rest_resource.delete\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def userfiles_delete_files_delete_with_http_info(multi_userfile_mod_req, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserfilesApi.userfiles_delete_files_delete ...'\n end\n # verify the required parameter 'multi_userfile_mod_req' is set\n if @api_client.config.client_side_validation && multi_userfile_mod_req.nil?\n fail ArgumentError, \"Missing the required parameter 'multi_userfile_mod_req' when calling UserfilesApi.userfiles_delete_files_delete\"\n end\n # resource path\n local_var_path = '/userfiles/delete_files'\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', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(multi_userfile_mod_req)\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserfilesApi#userfiles_delete_files_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @file = current_user.past_exams.find(params[:id])\n\t\[email protected]\n respond_to do |format|\n format.html { redirect_to file_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n user_file = UserFile.find(params[:id])\n @user_file_id = user_file.id.to_s\n @allowed = Job::Max_Attachments - user_file.attachable.user_files.count\n user_file.destroy\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def deleteFile(bucket, file, client)\n\tfilename = File.basename(file)\n\tbegin\n\t \tresp = client.client.delete_objects({\n\t \t\tbucket: bucket,\n\t\t\tdelete: { objects: [\n\t\t\t\t{ key: filename }\n\t\t\t],\n\t\t\tquiet: false }\n\t\t})\n\trescue Exception => e\n\t\tputs \"Wrong file name\"\n\t\tputs e\n\t\texit\n\tend\n\treturn resp\nend", "def destroy\n file_store = FileStore.find_by_sha1_hash!(params[:id])\n if user['id'] == file_store.user_id || user['role'] == 'admin' ||\n (user['uname'] == 'file_store' && user['role'] == 'system')\n file_store.destroy\n head :no_content\n else\n render_error 403\n end\n end", "def unshare_file_in_db(file_id, user_id)\n $db.execute(\"DELETE FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, user_id)\nend", "def destroy\n @unuse_file.destroy\n respond_to do |format|\n format.html { redirect_to unuse_files_url, notice: 'Unuse file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n # Deleting a file that is on the filsystem\n # if @user.filename\n # filename = Rails.root.join('public', 'uploads', @user.filename)\n # File.delete(filename) if File.exist?(filename)\n # end\n \n # Deleting image using Paperclip\n @user.avatar = nil\n \n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @file.destroy\n respond_to do |format|\n format.html { render text: 'created', layout: false, status: :created }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_people_file.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_files_url, notice: 'People file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to user_uploads_url }\n format.json { head :no_content }\n end\n end", "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete_file(file_name)\n fail 'No Structure ID defined for structure. Can\\'t delete file' if @structure.id.nil?\n\n data = Hashie::Mash.new\n data.structure_id = @structure.id\n data.file_name = file_name\n\n push_file('api/remove_file', MultiJson.dump(data))\n end", "def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file = UserUpload.find(params[:id])\n if @file\n \[email protected]\n end\n # Render nothing to denote success\n render :text => \"\" and return\n end", "def destroy\n #Finds selected data file\n @data_file = DataFile.find(params[:id])\n #destroys data file\n @data_file.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end", "def delete_files(uuids)\n Uploadcare::FileList.batch_delete(uuids)\n end", "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_id = ?\", file_id)\nend", "def destroy\n user = User.find(params[:user_id])\n user.documents.delete(Document.find(params[:document_id]))\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n @user_file_mapping.destroy\n respond_to do |format|\n format.html { redirect_to user_file_mappings_url, notice: 'User file mapping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.delete\n end", "def test_delete_file()\n\n path = 'folder/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n request = DeleteFileRequest.new(path, versionId, storage)\n\n result = @storage_api.delete_file(request)\n assert result.code == 200,'Error while deleting document'\n\n end", "def destroy\n RawFile.transaction do\n @raw_file = RawFile.find_by_user(params[:id],current_user.id)\n @raw_file.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_files_url }\n format.json { head :no_content }\n end\n end\n rescue\n redirect_to raw_files_url, flash: {:error => $!.to_s}\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def destroy\n @file_info = FileInfo.find(params[:id])\n @file_info.destroy\n\n respond_to do |format|\n format.html { redirect_to file_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_attachment.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = 'Your image was successfully deleted.'\n redirect_to :back\n }\n format.json { head :no_content }\n end\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def delete(uuid, key)\n request(method: 'DELETE', uri: \"/files/#{uuid}/metadata/#{key}/\")\n end", "def delete(path)\n request(:delete, path)\n end", "def delete_file(uid, info = {})\n grid_info = files_collection.find(filename: uid).first\n bucket.delete(grid_info[:_id]) if grid_info\n end", "def google_delete_file(client)\n files = []\n [@fields[:files],@fields[:folders]].each do |array|\n if array.is_a?(Array)\n files += array\n elsif !array.nil?\n files.push(array)\n end\n end\n targets = files.collect {|p| CGI::unescape(p)}\n client.delete_files_by_path(targets)\n end", "def destroy(paths)\n\t\tlogin_filter\n\t\tpaths = [paths].flatten\n\t\tpaths = paths.collect { |path| namespace_path(path) }\n\t\[email protected](\"/cmd/delete\", {\"files\"=> paths, \"t\" => @token }).code == \"200\"\n\tend", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @action_file = ActionFile.find(params[:id])\n @action_file.destroy\n\n respond_to do |format|\n format.html { redirect_to action_files_url }\n format.json { head :no_content }\n end\n end", "def delete_file_from_db(file_id)\n $db.execute(\"DELETE FROM files WHERE file_id = ?\", file_id)\nend", "def delete(filename); end", "def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @filename.destroy\n respond_to do |format|\n format.html { redirect_to filenames_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n Client.transaction do\n FileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"[email protected]_s]\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n begin\n File.delete( @doc_file.docOwner)\n rescue\n end\n @doc_file.destroy\n \n respond_to do |format|\n format.html { redirect_to doc_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @file_upload.destroy\n respond_to do |format|\n format.html { redirect_to file_uploads_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n #FIXME: Double check auth is working for deletion. Also, maybe should only delete if not associated with any experiments.\n @data_file.destroy\n \n respond_to do |format|\n format.html { redirect_to(data_files_path) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete(path, **options)\n execute :delete, path, options\n end", "def delete(bucket, file); end", "def destroy\r\n \r\n #eliminar foto de perfil \r\n r = Photo.where(\"#{:user_id} =?\",params[:id])\r\n #solo eliminar si posee foto de perfil \r\n if r.present?\r\n r.destroy_all\r\n end\r\n\r\n @usuario.destroy\r\n respond_to do |format|\r\n format.html { redirect_to usuarios_url, success: 'Eliminaste un usuario correctamenteed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @incidentfile.destroy\n respond_to do |format|\n format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def destroy\n @g_file.destroy\n respond_to do |format|\n format.html { redirect_to g_files_url, notice: 'G file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def destroy\n @datafile.destroy\n respond_to do |format|\n format.html { redirect_to datafiles_url, notice: 'Datafile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @attachinaryfile.destroy\n respond_to do |format|\n format.html { redirect_to attachinaryfiles_url, notice: 'Attachinaryfile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bulletin_file = BulletinFile.find(params[:id])\n @bulletin_file.destroy\n\n respond_to do |format|\n format.html { redirect_to bulletin_files_url }\n format.json { head :no_content }\n end\n end", "def destroy_usecase_file\n @user=find_user\n if [email protected]?\n @file_use=UseCase.find_by_id(params[:id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n if [email protected]? and @user.privilige!=\"Read\" and !@file_use.nil?\n @file_use.project_files.delete(@file)\n respond_to do |format|\n format.html { redirect_to show_file_uses_url(@file.id) }\n end\n else\n redirect_to project_files_path\n end\n else\n redirect_to project_files_path\n end\n else\n redirect_to sign_in_url\n end\n\n end", "def destroy\n @feefile = Feefile.find(params[:id])\n directory= \"uploads\"\n path =File.join(directory,@feefile.feefilename)\n File.delete(path)\n @feefile.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(feefiles_url) }\n format.xml { head :ok }\n end\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n @other_file.destroy\n respond_to do |format|\n format.html { redirect_to other_files_url, notice: 'Other file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(cloud_file)\n\n payload = {\n root: \"auto\",\n path: cloud_file.path\n }\n\n connexion = Dropbox.start(:delete, access_token)\n response = connexion.post do |req|\n req.url \"fileops/delete\"\n req.body = payload\n end\n response = format_response(response)\n Filetree.new('dropbox').update([response[:path], nil])\n\n end", "def batch_delete(uuids)\n body = uuids.to_json\n request_delete(uri: '/files/storage/', content: body)\n end", "def destroy\n @file_example.destroy\n respond_to do |format|\n format.html { redirect_to file_examples_url, notice: 'File example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@users_photo = UsersPhoto.find(params[:id])\n #@users_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to users_photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @resource_file = ResourceFile.find(params[:id])\n @resource_file.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_files_url }\n format.json { head :no_content }\n end\n end", "def b2_delete_file_version(file)\n\n auth_hash = convert_json(b2_authorize_account)\n api_url = auth_hash[\"apiUrl\"]\n account_authorization_token = auth_hash[\"authorizationToken\"]\n\n file_hash = parse_files_json(file)\n file_name = file\n file_id = file_hash[file]\n\n uri = URI(\"#{api_url}/b2api/v1/b2_delete_file_version\")\n req = Net::HTTP::Post.new(uri)\n req.add_field(\"Authorization\",\"#{account_authorization_token}\")\n req.body = \"{\\\"fileName\\\":\\\"#{file_name}\\\", \\\"fileId\\\":\\\"#{file_id}\\\"}\"\n http = Net::HTTP.new(req.uri.host, req.uri.port)\n http.use_ssl = true\n res = http.start {|http| http.request(req)}\n\n case res\n when Net::HTTPSuccess then res.body\n when Net::HTTPRedirection then fetch(res['location'], limit - 1)\n else res.error!\n end\n\nend", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def destroy\n @purchase_file = PurchaseFile.find(params[:id])\n @purchase_file.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @upload_file.destroy\n respond_to do |format|\n format.html { redirect_to upload_files_url, notice: 'Upload file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.75363964", "0.7422391", "0.7362244", "0.7313111", "0.72862923", "0.71802795", "0.71015304", "0.70886976", "0.7021113", "0.69476765", "0.6907134", "0.68676865", "0.68504906", "0.6832666", "0.6823374", "0.681007", "0.6796322", "0.67942774", "0.6772355", "0.67696077", "0.6765938", "0.67476046", "0.6744208", "0.67415655", "0.6741493", "0.6732726", "0.67264956", "0.67242444", "0.67089754", "0.67074025", "0.669699", "0.6693172", "0.6685473", "0.6661296", "0.66566515", "0.6656158", "0.6655229", "0.664877", "0.66307867", "0.6629353", "0.66203874", "0.6618486", "0.66113406", "0.6610198", "0.65854293", "0.6583745", "0.6563637", "0.656272", "0.65619147", "0.654512", "0.65349495", "0.652695", "0.65063334", "0.6504914", "0.64977473", "0.64973956", "0.6491892", "0.649006", "0.64809585", "0.6479226", "0.64765924", "0.64752656", "0.64665794", "0.6453772", "0.64523613", "0.64469945", "0.6439096", "0.6437756", "0.6437531", "0.6435619", "0.643473", "0.64300066", "0.64173245", "0.64159644", "0.6410544", "0.64073414", "0.64053196", "0.6402197", "0.64019257", "0.6400958", "0.639712", "0.6395756", "0.63944596", "0.63935703", "0.63889474", "0.6383076", "0.63791925", "0.6377888", "0.637325", "0.6369967", "0.63694745", "0.63672405", "0.63619727", "0.63615626", "0.6358881", "0.63575673", "0.6357419", "0.6357419", "0.6356991", "0.63550174" ]
0.7451433
1
Use callbacks to share common setup or constraints between actions.
def set_userfile @userfile = Userfile.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def userfile_params params.require(:userfile).permit(:filename, :date_created, :owner, :size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586", "0.629103", "0.6282451", "0.6243152", "0.62413", "0.6219024", "0.6213724", "0.62103724", "0.61945", "0.61786324", "0.61755824", "0.6173267", "0.6163613", "0.6153058", "0.61521065", "0.6147508", "0.61234015", "0.61168665", "0.6107466", "0.6106177", "0.6091159", "0.60817343", "0.6071238", "0.6062299", "0.6021663", "0.60182893", "0.6014239", "0.6011563", "0.60080767", "0.60080767", "0.60028875", "0.60005623", "0.59964156", "0.5993086", "0.5992319", "0.5992299", "0.59801805", "0.59676576", "0.59606016", "0.595966", "0.59591126", "0.59589803", "0.5954058", "0.5953234", "0.5944434", "0.5940526", "0.59376484", "0.59376484", "0.5935253", "0.5930846", "0.5926387", "0.59256274", "0.5917907", "0.5910841", "0.590886", "0.59086543", "0.59060425", "0.58981544", "0.5898102", "0.5896809", "0.5895416", "0.58947027", "0.58923644", "0.5887903", "0.58830196", "0.5880581", "0.5873854", "0.58697754", "0.5869004", "0.58669055", "0.5866886", "0.58664906", "0.5864619", "0.58630043", "0.5862495", "0.5861368", "0.5859712", "0.5855544", "0.58551925", "0.5851284", "0.5850602" ]
0.0
-1
Initializes the AuthorizationRequest object Params: +client+:: +ProcessOut+ client instance
def initialize(client) @client = client @id = "" @project = nil @customer = nil @token = nil @url = "" @authorized = false @name = "" @currency = "" @return_url = "" @cancel_url = "" @custom = "" @sandbox = false @created_at = "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_request\n if request.path_info.include?('clients')\n @current_user = AuthorizeClientApiRequest.new(request.parameters[:client_uuid], request.headers).call[:user]\n elsif request.path_info.include?('apps')\n @current_device = AuthorizeDeviceApiRequest.new(request.parameters[:device_uuid], request.headers).call[:device]\n @current_user = @current_device.user unless @current_device.nil?\n else\n raise(ExceptionHandler::AuthenticationError, Message.unauthorized)\n end\n end", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize(client)\n\t self.client=client\n end", "def initialize(client)\n self.client=client\n\n\tend", "def initialize(client)\n super(nil)\n\n @client = client\n end", "def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\[email protected] = @auth_file.authorization\n\t\tend\n\tend", "def authorize_request\n puts \"Authorize request\"\n @current_user = nil\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end", "def initialize(client)\n @client = client\n end", "def set_authorized_client\n @authorized_client = AuthorizedClient.find(params[:id])\n end", "def create_authorization\n @authorization = AwsRequestAuthorization.new.tap do |authorization|\n authorization.url = url\n authorization.method = method\n authorization.query = query\n authorization.body = form_body\n authorization.region = region\n authorization.service = service\n authorization.credentials = credentials\n authorization.headers = headers\n end\n end", "def initialize(base_url,model_data)\n @base_url = base_url\n @model_data = model_data\n\n\n unless @requester_id = model_data[REQUESTER_ID]\n raise ArgumentError, \"Cannot create a #{self.class} without a requester_id\"\n end\n\n @authz_client = AuthzClient.new(resource, @requester_id, base_url)\n @id = model_data[OBJECT_ID]\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end", "def initialize(client)\n @client = client\n end" ]
[ "0.63436586", "0.6340879", "0.6340879", "0.6235493", "0.6233758", "0.61631924", "0.615039", "0.6119844", "0.6118497", "0.61141825", "0.6109101", "0.6103155", "0.6077492", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455", "0.60768455" ]
0.61766315
5
Fills the object with data coming from the API Params: +data+:: +Hash+ of data coming from the API
def fill_with_data(data) if data.include? "id" @id = data["id"] end if data.include? "project" @project = data["project"] end if data.include? "customer" @customer = data["customer"] end if data.include? "token" @token = data["token"] end if data.include? "url" @url = data["url"] end if data.include? "authorized" @authorized = data["authorized"] end if data.include? "name" @name = data["name"] end if data.include? "currency" @currency = data["currency"] end if data.include? "return_url" @return_url = data["return_url"] end if data.include? "cancel_url" @cancel_url = data["cancel_url"] end if data.include? "custom" @custom = data["custom"] end if data.include? "sandbox" @sandbox = data["sandbox"] end if data.include? "created_at" @created_at = data["created_at"] end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"url\"\n @url = data[\"url\"]\n end\n if data.include? \"name\"\n @name = data[\"name\"]\n end\n if data.include? \"amount\"\n @amount = data[\"amount\"]\n end\n if data.include? \"currency\"\n @currency = data[\"currency\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"request_email\"\n @request_email = data[\"request_email\"]\n end\n if data.include? \"request_shipping\"\n @request_shipping = data[\"request_shipping\"]\n end\n if data.include? \"return_url\"\n @return_url = data[\"return_url\"]\n end\n if data.include? \"cancel_url\"\n @cancel_url = data[\"cancel_url\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"brand\"\n @brand = data[\"brand\"]\n end\n if data.include? \"type\"\n @type = data[\"type\"]\n end\n if data.include? \"bank_name\"\n @bank_name = data[\"bank_name\"]\n end\n if data.include? \"level\"\n @level = data[\"level\"]\n end\n if data.include? \"iin\"\n @iin = data[\"iin\"]\n end\n if data.include? \"last_4_digits\"\n @last_4_digits = data[\"last_4_digits\"]\n end\n if data.include? \"exp_month\"\n @exp_month = data[\"exp_month\"]\n end\n if data.include? \"exp_year\"\n @exp_year = data[\"exp_year\"]\n end\n if data.include? \"metadata\"\n @metadata = data[\"metadata\"]\n end\n if data.include? \"sandbox\"\n @sandbox = data[\"sandbox\"]\n end\n if data.include? \"created_at\"\n @created_at = data[\"created_at\"]\n end\n \n self\n end", "def fill_with_data(data)\n if data.include? \"id\"\n @id = data[\"id\"]\n end\n if data.include? \"project\"\n @project = data[\"project\"]\n end\n if data.include? \"gateway\"\n @gateway = data[\"gateway\"]\n end\n if data.include? \"enabled\"\n @enabled = data[\"enabled\"]\n end\n if data.include? \"public_keys\"\n @public_keys = data[\"public_keys\"]\n end\n \n self\n end", "def initialize data\n @data = data\n end", "def init(data)\n\t\t\traise InvalidDataError, 'No id found' unless data.has_key?('id')\n\t\t\t@id = data['id']\n\n\t\t\traise InvalidDataError, 'No name found' unless data.has_key?('name')\n\t\t\t@name = data['name']\n\n\t\t\traise InvalidDataError, 'No created_at found' unless data.has_key?('created_at')\n\t\t\t@created_at = DateTime.strptime(String(data['created_at']), '%s') unless data['created_at'].nil?\n\n\t\t\traise InvalidDataError, 'No status found' unless data.has_key?('status')\n\t\t\t@status = data['status']\n\n\t\t\traise InvalidDataError, 'No hash_type found' unless data.has_key?('hash_type')\n\t\t\t@hash_type = data['hash_type']\n\n\t\t\traise InvalidDataError, 'No hash found' unless data.has_key?('hash')\n\t\t\t@hash = data['hash']\n\n\t\t\traise InvalidDataError, 'No last_request found' unless data.has_key?('last_request')\n\t\t\t@last_request = DateTime.strptime(String(data['last_request']), '%s') unless data['last_request'].nil?\n\n\t\t\traise InvalidDataError, 'No last_success found' unless data.has_key?('last_success')\n\t\t\t@last_success = DateTime.strptime(String(data['last_success']), '%s') unless data['last_success'].nil?\n\n\t\t\traise InvalidDataError, 'No output_type found' unless data.has_key?('output_type')\n\t\t\t@output_type = data['output_type']\n\n\t\t\traise InvalidDataError, 'No output_params found' unless data.has_key?('output_params')\n\t\t\t@output_params = parseOutputParams(data['output_params'])\n\n\t\t\t@is_deleted = true if @status == STATUS_DELETED\n\t\tend", "def initialize_data\n @data = parse_body || {}\n end", "def initialize(data)\n assert_kind_of 'data', data, Hash\n @data = data\n end", "def initialize(data = {})\n @data = data\n end", "def initialize(data = nil)\n ActiveSupport::JSON.decode(data).each do |k, v|\n self.send(\"#{k}=\", v) if self.respond_to?(\"#{k}=\")\n end if data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n self.data = (self.respond_to? :prepare_data)? prepare_data(data): data\n self\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize data\n self.data = data\n end", "def initialize(data, badges, accounts)\n @badges = badges\n @accounts = accounts\n @details = {\n name: data['name'],\n username: data['username'],\n location: data['location'],\n team: data['team'],\n endorsements: data['endorsements']\n }\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n @data = data\n end", "def initialize(data)\n\t\t@data = data\n\tend", "def initialize_defaults\n self.data = {} if data.blank?\n end", "def initialize data\n self.data = data\n parse_data\n end", "def initialize_data\n end", "def initialize(data)\n @response = data\n @id = data[\"id\"]\n @name = data[\"name\"]\n @market = data[\"market\"]\n @alias = data[\"alias\"]\n @reference = data[\"reference\"]\n @efficiency = data[\"efficiency\"]\n @first_downs = data[\"first_downs\"]\n @interceptions = data[\"interceptions\"]\n @touchdowns = data[\"touchdowns\"]\n @possession_time = data.dig('summary', \"possession_time\")\n @avg_gain = data.dig('summary', \"avg_gain\")\n @safeties = data.dig('summary', \"safeties\")\n @turnovers = data.dig('summary', \"turnovers\")\n @play_count = data.dig('summary', \"play_count\")\n @rush_plays = data.dig('summary', \"rush_plays\")\n @total_yards = data.dig('summary', \"total_yards\")\n @lost_fumbles = data.dig('summary', \"lost_fumbles\")\n @penalty_yards = data.dig('summary', \"penalty_yards\")\n @return_yards = data.dig('summary', \"return_yards\")\n end", "def initialize(data)\n @time = Time.at(data['dt'])\n @main = data['weather'][0]['main']\n @description = data['weather'][0]['description']\n @icon = \"https://openweathermap.org/img/w/#{data['weather'][0]['icon']}.png\"\n @emoji = OpenWeatherMap::Constants::CONDITION_CODE[data['weather'][0]['icon'].tr('n', 'd')]\n @temperature = data['main']['temp']\n @temp_min = data['main']['temp_min'].to_f\n @temp_max = data['main']['temp_max'].to_f\n @pressure = data['main']['pressure'].to_f\n @humidity = data['main']['humidity'].to_f\n @wind = {\n speed: data['wind']['speed'],\n direction: data['wind']['deg']\n }\n @clouds = data['clouds']['all'].to_f\n @rain = data['rain'].nil? ? nil : {\n one_hour: data['rain']['1h'],\n three_hours: data['rain']['3h']\n }\n @snow = data['snow'].nil? ? nil : {\n one_hour: data['snow']['1h'],\n three_hours: data['snow']['3h']\n }\n end", "def initialize(object)\n @id = object[\"id\"]\n @data = object[\"data\"]\n end", "def initialize(data)\n @data = data['results']\n @success = data['ok']\n @last_update = data['lastUpdate']\n\n if @data.nil?\n @data = data['stationBeanList']\n @success = true\n @last_update = Time.now.to_i\n end\n\n # build the id_hash\n @id_hash ||= {}\n @data.each do |d|\n @id_hash[d.id] = d\n end\n end", "def initialize(data)\n @routing_number = data[:routing_number]\n @account_number = data[:account_number]\n @holder_name = data[:holder_name]\n @type = data[:type]\n end", "def initialize(data)\n @data = data\n end", "def build_from_database(data)\n return nil if data.blank?\n \n # Create an instance of the object\n obj = self.new(data['data'])\n obj.raw_data = data\n obj\n end", "def initialize(data)\n data.each { |key, value| send(\"#{key}=\", value) unless key.nil? }\n end", "def from_data(data)\n obj = new\n\n @attributes.each do |key|\n value = obj.send \"parse_#{key}\", data\n obj.send \"#{key}=\", value\n end\n\n obj\n end", "def initialize(*args)\n super\n @data = {}\n end", "def initialize(data = {})\n data.each do |key, value|\n self.send(:\"#{key.to_s}=\", value)\n end\n end", "def api_data\n @api_data ||= {\n address: @ethereum_address,\n phase: 0,\n client_whitelist_detail_obj: get_client_whitelist_detail_obj\n }\n end", "def initialize aData = {}\n merge! aData\n end", "def load_data(data)\n data.symbolize_keys!\n\n @id = data[:id] || nil\n @name = data[:name]\n @color = data[:color]\n @indent = data[:indent]\n @item_order = data[:item_order]\n end", "def process_data(data)\n case data\n when Hash then Resource.new(agent, data)\n when Array then data.map { |hash| process_data(hash) }\n when nil then nil\n else data\n end\n end", "def initialize(_ = {})\n @data = {}\n end", "def initialize(data)\n @restaurant_name = data['name']\n @review_count = data['review_count']\n @latitude = data['latitude']\n @longitude = data['longitude']\n @city = data['city']\n @state = data['state']\n @zip = data['zip']\n @avg_rating = data['avg_rating']\n end", "def initialize(data, location)\n @id = nil \n @image = { \n location: location,\n image_url: data[0][:urls][:raw],\n credit: { \n source: \"unsplash.com\",\n author: data[0][:user][:username]\n }\n } \n end", "def initialize()\n\tjson_data\t= {}\nend", "def set_data_in_details\n json_data.provision_details_hash!\n end", "def initialize(data)\n @data = data\n @parameters = {}\n\n @data[@data.keys.sample].each_key do |ts|\n build_hash(ts)\n end\n end", "def initialize(data)\n super\n end", "def initialize(data)\n super\n end", "def initialize(data)\n\n end", "def initialize(data) # {{{\n @data = {}\n data.each do |k, v|\n @data.merge! @@mapping[k] ? {@@mapping[k] => v} : {k => v}\n end\n\n true\n end", "def initialize(data)\n self.class.get(data)\n end", "def initialize(data = {})\n return if !data.is_a?(Hash) || data.empty?\n\n @credential = Credential.generate_multiple([data['Credential']])\n @user_agent = data['UserAgent']\n end", "def alter_data(data = {})\n @data = @data.merge(data)\n end", "def from_data(data)\n @map = data[\"map\"]\n for driver in data[\"drivers\"]\n driver_obj_rep = driver[\"object\"]\n driver_obj_real = Driver.new\n driver_obj_real.name = driver_obj_rep[\"name\"]\n driver_obj_real.plate = driver_obj_rep[\"plate\"]\n driver_obj_real.rating = driver_obj_rep[\"rating\"]\n driver_obj_real.first_time = driver_obj_rep[\"first_time\"]\n x, y = driver[\"coord\"]\n @map[y][x] = driver_obj_real\n @drivers.push({\n \"coord\" => driver[\"coord\"],\n \"object\" => driver_obj_real\n })\n end\n\n for restaurant in data[\"restaurants\"]\n restaurant_obj_rep = restaurant[\"object\"]\n restaurant_obj_real = Restaurant.new\n restaurant_obj_real.name = restaurant_obj_rep[\"name\"]\n restaurant_obj_real.menu = restaurant_obj_rep[\"menu\"]\n x, y = restaurant[\"coord\"]\n @map[y][x] = restaurant_obj_real\n @restaurants.push({\n \"coord\" => restaurant[\"coord\"],\n \"object\" => restaurant_obj_real\n })\n end\n\n # If there's more than 1 connected cave rooms\n if populate_caves.length > 1\n raise \"There's can only one cave room!\"\n end\n end", "def __assign_params(data)\n params = { }\n \n if not @params.nil?\n @params.each_index do |i|\n params[i.to_s] = @params[i]\n end\n end\n if not @keyword_params.nil?\n params.merge! @keyword_params\n end\n \n data[:params] = Utils::Hash.map_keys!(params) { |k| k.to_s }\n end", "def set_api_response_data\n users_list = []\n @users.each do |u|\n ukd = @user_kyc_details[u.id]\n ukd_present = ukd.present?\n users_list << {\n user_id: u.id,\n case_id: ukd_present ? @user_kyc_details[u.id].id : 0,\n email: u.email,\n registration_timestamp: u.created_at.to_i,\n is_kyc_submitted: ukd_present.to_i,\n whitelist_status: ukd_present ? @user_kyc_details[u.id].whitelist_status : nil,\n action_to_perform: action_to_perform(ukd)\n }\n end\n\n meta = {\n page_number: @page_number,\n total_records: @total_filtered_users,\n page_payload: {\n },\n page_size: @page_size,\n filters: @allowed_filters,\n sortings: @sortings,\n }\n\n data = {\n meta: meta,\n result_set: 'users_list',\n users_list: users_list\n }\n\n @api_response_data = data\n\n end", "def initialize(data)\r\n @data = data.dup\r\n end", "def fetch_api_data\n addr = URI(API_URL)\n addr.query = URI.encode_www_form(form_params.transform_keys(&:to_s))\n\n data = JSON.parse(Net::HTTP.get(addr))\n\n @latest_report = {\n temp: data['main']['temp'].round.to_s + '&deg;',\n desc: data['weather'][0]['description'],\n icon: weather_icon(data['weather'][0]['icon'][0..-2].to_i),\n wind_speed: data['wind']['speed'].floor,\n wind_dir: compass_dir(data['wind']['deg'])\n }\n end", "def initialize id, data\n @id = id\n @data = data\n end", "def initialize\n @data = Data.instance\n end", "def init_data\n end", "def initialize(input_data)\n @data = input_data\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize(data)\n begin\n data = JSON.parse(data)\n rescue JSON::JSONError => e\n raise OpenWeatherMap::Exceptions::DataError, \"error while parsing data : #{e}\"\n end\n @city = OpenWeatherMap::City.new(data['city']['name'], data['city']['coord']['lon'], data['city']['coord']['lat'], data['city']['country'])\n @forecast = []\n data['list'].each do |element|\n forecast << OpenWeatherMap::WeatherConditions.new(element)\n end\n end", "def initialize(data)\n @data = expand(data)\n end", "def initialize(data={})\n @city = data['city'] || 0.0\n @highway = data['highway'] || 0.0\n end", "def initialize(fb_data)\n @data = fb_data\n end", "def initialize(response)\n @data = JSON.parse(response)\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize(hash_that_represents_json)\n\t\t@data = hash_that_represents_json\n\tend", "def data=(hash)\n @params[:data] = hash\n end", "def initialize(data, org_id)\n @data = data\n @org_id = org_id\n end", "def initialize(data=nil)\n json_obj = Validator::validate_argument(data,'Users')\n @alive = json_obj['alive']\n @full_name = json_obj['full_name']\n @id = json_obj['id']\n @username = json_obj['username']\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def data\n @values.fetch('data') { \n @values['data'] = nil\n }\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize()\n @additional_data = Hash.new\n end", "def initialize(data)\n @data = data\nend" ]
[ "0.8257124", "0.80399275", "0.79668176", "0.7144249", "0.696927", "0.6897578", "0.6859003", "0.675878", "0.6719612", "0.67161655", "0.6714151", "0.6680818", "0.6680818", "0.6680818", "0.6680818", "0.6680818", "0.6680818", "0.6680818", "0.6680818", "0.6648529", "0.6644291", "0.6644291", "0.6644291", "0.6591387", "0.6591387", "0.6591387", "0.6591387", "0.65853363", "0.65678054", "0.6563316", "0.65189874", "0.65107715", "0.6492248", "0.6478894", "0.64720124", "0.6451519", "0.6435075", "0.6411711", "0.6403114", "0.6353352", "0.6331039", "0.6329748", "0.6319512", "0.6318484", "0.63042164", "0.6287762", "0.628668", "0.6280462", "0.6230552", "0.62160474", "0.6163788", "0.6160523", "0.6158168", "0.6158168", "0.6156721", "0.6156029", "0.6107094", "0.6098971", "0.6092895", "0.6085482", "0.60695225", "0.60682684", "0.6063609", "0.6053029", "0.6051197", "0.604737", "0.60440904", "0.6042893", "0.60343295", "0.6015181", "0.6009506", "0.6008167", "0.6004488", "0.5999024", "0.59870535", "0.5981597", "0.5981597", "0.5981597", "0.5981597", "0.5981597", "0.5981597", "0.5981597", "0.5981597", "0.5979557", "0.59791434", "0.59782624", "0.59749526", "0.59648484", "0.59648484", "0.59597224", "0.59582657", "0.59582657", "0.59582657", "0.5956778", "0.5956778", "0.5956778", "0.5956778", "0.5953883", "0.5953883", "0.5944799" ]
0.82482195
1
Get the customer linked to the authorization request. Params: +options+:: +Hash+ of options
def customer(options = nil) request = Request.new(@client) path = "/authorization-requests/" + CGI.escape(@id) + "/customers" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new body = response.body body = body["customer"] customer = Customer(self._client) return_values.push(customer.fill_with_data(body)) return_values[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def retreive_customer_info(options)\n requires!(options, :subscription_id, :order_id)\n commit(build_retreive_customer_info(options), options)\n end", "def addressGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:addressGet, options)\n end", "def addressGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:addressGet, options)\n end", "def addressGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:addressGet, options)\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def contactDataGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:contactDataGet, options)\n end", "def get_customer 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_get_customer_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::Channel::V1::Customer.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def contactDataGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:contactDataGet, options)\n end", "def contactDataGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:contactDataGet, options)\n end", "def get_customer(opts = {})\n data, _status_code, _headers = get_customer_with_http_info(opts)\n data\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def get_logged_in_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_logged_in_customer ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/current_customer'\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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_logged_in_customer\",\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: CustomerApi#get_logged_in_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def customer_by_ref(customer_ref)\n client.get \"customers/#{inst_id}/byRef?merchantRef=#{customer_ref}\"\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def bankaccountGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:bankaccountGet, options)\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def authenticate_customer \n label = request_label(:authenticate_customer, customer_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/authenticate_customer\", \n :get,\n head: headers,\n query: { provider_id: provider_id, customer_id: customer_id, customer_token: customer_token }\n ).status!(label)\n end", "def bankaccountGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:bankaccountGet, options)\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def get_customer_id\n return @customer_id\n end", "def contact(options={})\n if self.padma_contact.nil? || options[:force_service_call]\n self.padma_contact = PadmaContact.find(contact_id, {select: :all, account_name: self.account_name})\n end\n ret = padma_contact\n if options[:decorated] && padma_contact\n ret = PadmaContactDecorator.decorate(padma_contact)\n end\n ret\n end", "def retrieve(options = {})\n body = options.fetch(:body, {})\n\n @client.post(\"oauth/token?grant_type=client_credentials\", body, options)\n end", "def account_info(options = {})\n request :account, :get, 'account', options\n end", "def vault_customer\n return nil if customer_details.id.nil?\n @gateway.customer.find(customer_details.id)\n end", "def current_customer\n fail AuthRequired unless authed?\n @current_customer ||= get(Customer)\n end", "def create_or_get_stripe_customer(options = {})\n return as_stripe_customer if stripe_id?\n\n create_as_stripe_customer(options)\n end", "def create(customer_id, options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests\"\n data = {\n \"name\"=> @name, \n \"currency\"=> @currency, \n \"return_url\"=> @return_url, \n \"cancel_url\"=> @cancel_url, \n \"custom\"=> @custom, \n 'customer_id'=> customer_id\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"authorization_request\"]\n \n \n return_values.push(self.fill_with_data(body))\n \n\n \n return_values[0]\n end", "def retrieve_customer(authorization, customer_id, opts = {})\n data, _status_code, _headers = retrieve_customer_with_http_info(authorization, customer_id, opts)\n return data\n end", "def customerCreate(options={})\n assert_valid_keys(options, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end", "def customerCreate(options={})\n assert_valid_keys(options, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end", "def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end", "def customerCreate(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end", "def get_account(client, options)\n accounts = get_accounts(client, options)\n if accounts.nil?\n return nil\n end\n\n return find_account(accounts, options[:email])\nend", "def customer_info(customer)\n return customer\n end", "def show\n @customer = Customer.find(params[:id])\n @google_address = @customer\n @customer_verification = @customer.customer_verification\n @business = Business.new\n @co_applicant = CoApplicant.new\n @application_ref_no = @customer.application_ref_no\n\n #authorize! :show, @customer\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def billing_contact\n get_user billing_contact_id\n end", "def current_customer\n Customer.find_by({ id: session[:customer_id] })\n end", "def retrieve_customer_with_http_info(authorization, customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.retrieve_customer ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.retrieve_customer\" if authorization.nil?\n # verify the required parameter 'customer_id' is set\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.retrieve_customer\" if customer_id.nil?\n # resource path\n local_var_path = \"/v2/customers/{customer_id}\".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_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 header_params[:'Authorization'] = authorization\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 => 'RetrieveCustomerResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#retrieve_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def authorize(options)\n response = gateway.authorize(options.fetch(:amount), options.fetch(:creditcard), options[:extra])\n transaction_id = response.success? ? response.params['transaction_id'] : nil\n [transaction_id, response]\n end", "def customer\n self.user\n end", "def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end", "def get_logged_in_customer(opts = {})\n data, _status_code, _headers = get_logged_in_customer_with_http_info(opts)\n data\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def get_hosted_profile_page(options = {})\n requires!(options, :customer_profile_id)\n\n request = build_request(:get_hosted_profile_page, options)\n commit(:get_hosted_profile_page, request)\n end", "def current_user\n current_customer\n end", "def get_customer\n if self.customer_id.present?\n\n begin\n Stripe.api_key = ENV['API_KEY']\n customer = Stripe::Customer.retrieve(\"#{self.customer_id}\")\n\n if customer.respond_to?(:deleted)\n self.status = NO_STRIPE\n else\n load_customer_info(customer)\n if customer.delinquent == true\n self.status = INACTIVE\n end\n end\n\n rescue Stripe::StripeError => stripe_error\n logger.debug(\"[Account.get_customer] stripe error = #{stripe_error.message}\")\n errors[:customer_id] << stripe_error.message\n return nil\n end\n\n return customer\n else\n return nil\n end\n end", "def get_customer_license(custid = nil)\r\n\r\n raise ArgumentError.new(\"Customer id should not be nil/blank\") if custid.nil?\r\n\r\n suburl = \"&action=get_customer_license\"\r\n suburl << \"&custid=\" + custid.to_s\r\n\r\n call_target_url(suburl) # call private method\r\n\r\n end", "def list_customer_accounts_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AccountsApi.list_customer_accounts ...\"\n end\n # resource path\n local_var_path = \"/raas/v2/accounts\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<AccountView>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AccountsApi#list_customer_accounts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def find_customer\n #TODO:how does stripe_token get assigned to user?\n if @user.stripe_token\n retrieve_customer \n else\n create_customer\n end\n end", "def show\n authorize @customer, :show?\n end", "def customer_id\n params['customer_id']\n end", "def get_token(options)\n\t\tmethod = \"GET\"\n\t\tendpoint = \"auditlogtoken\"\n\t\turi = ApiUri::build_uri(endpoint, options)\n\t\treturn @client.request_json(method, uri)\n\tend", "def show\n if params[:smb_id].present?\n if current_user\n @customer = @selector.customers.find_by_auth_token(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer }\n end\n else\n flash[:error] = \"You must login first!\"\n redirect_to log_in_path\n end\n elsif params[:friend_id].present?\n @customer = @selector.customers.find_by_auth_token(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer }\n end\n else\n if admin?\n @customer = Customer.find_by_auth_token(params[:id])\n end\n end\n \n \n end", "def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end", "def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end", "def customer_id\n return @customer_id\n end", "def request_token(options = {})\n consumer(:scheme => (@@request_scheme || :header)).get_request_token(options)\n end", "def get_customer_using_get_with_http_info(customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_using_get ...'\n end\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer_using_get\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', customer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer_id\n @booking_profile.try(:external_user_id)\n end", "def customerList(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :from, :count)\n execute(:customerList, options)\n end", "def customer\n @customer ||= Customer.new(value_for('customer'))\n end", "def show\n @customer = current_customer\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def retrieve(options)\n response = client.get(RETRIEVE_ENDPOINT, options)\n\n response.errors? && build_error_from(response.items.first) || build_detailed_address_from(response.items.first)\n end", "def get_access_token(options={})\n response=consumer.token_request(consumer.http_method,(consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path),self,options)\n OAuth::AccessToken.new(consumer,response[:oauth_token],response[:oauth_token_secret])\n end", "def security_contact\n get_user security_contact_id\n end", "def account_with_http_info(customeruuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.account ...'\n end\n # verify the required parameter 'customeruuid' is set\n if @api_client.config.client_side_validation && customeruuid.nil?\n fail ArgumentError, \"Missing the required parameter 'customeruuid' when calling CustomersApi.account\"\n end\n # resource path\n local_var_path = '/1.0.0/account/{customeruuid}'.sub('{' + 'customeruuid' + '}', customeruuid.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', 'application/xml', ])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20017')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#account\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer\n self.customer\n end", "def get_customer_using_get(customer_id, opts = {})\n data, _status_code, _headers = get_customer_using_get_with_http_info(customer_id, opts)\n data\n end", "def legal_contact\n get_user legal_contact_id\n end", "def generate_authenticated_request(options={})\n return authorization.generate_authenticated_request(options)\n end", "def query_customer_by_reference(customer_ref)\n log_operation(:query_customer_by_reference, customer_ref)\n envelope = wrap_in_envelope do |xml|\n xml['man'].QueryCustomerByReference {\n xml['man'].CustomerReference customer_ref\n }\n end\n response = post(envelope, 'QueryCustomerByReference')\n result = response.xpath('//man:QueryCustomerByReferenceResult', { 'man' => SERVICE_NAMESPACE }).first\n return result ? node_to_hash(result) : false\n end", "def add_customer_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_CUSTOMER_ID, options[:customer_id])\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n request.Set(RocketGate::GatewayRequest::EMAIL, options[:email])\r\n end", "def query_order(options)\n request :account, :get, 'order', options\n end", "def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end", "def get_account 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_get_account_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::Analytics::Admin::V1alpha::Account.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def stripe_customer_link(customer_id)\n \"https://dashboard.stripe.com/customers/\" + customer_id\n end", "def id\n customer_id\n end", "def add_customer(options)\n requires!(options, :sender)\n @post.merge!('senderEmail' => options[:sender][:email],\n 'senderFirstName' => options[:sender][:first_name],\n 'senderLastName' => options[:sender][:last_name])\n end", "def find(authorization_request_id, options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(authorization_request_id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"authorization_request\"]\n \n \n obj = AuthorizationRequest.new(@client)\n return_values.push(obj.fill_with_data(body))\n \n\n \n return_values[0]\n end", "def get_application_customer_with_http_info(application_id, customer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementApi.get_application_customer ...'\n end\n # verify the required parameter 'application_id' is set\n if @api_client.config.client_side_validation && application_id.nil?\n fail ArgumentError, \"Missing the required parameter 'application_id' when calling ManagementApi.get_application_customer\"\n end\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling ManagementApi.get_application_customer\"\n end\n # resource path\n local_var_path = '/v1/applications/{applicationId}/customers/{customerId}'.sub('{' + 'applicationId' + '}', CGI.escape(application_id.to_s)).sub('{' + 'customerId' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ApplicationCustomer' \n\n # auth_names\n auth_names = opts[:auth_names] || ['management_key', 'manager_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementApi#get_application_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_customers request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_customers_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::Channel::V1::ListCustomersResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def request_token(options={})\n @request_token ||= signing_consumer.get_request_token(options)\n end", "def authorized(options = {})\n options = { date_authorized: Date.current }.merge(options)\n\n request_params = {\n 'customerID' => customer_id,\n 'cartID' => cart_id,\n 'orderID' => order_id,\n 'dateAuthorized' => xml_date(options[:date_authorized])\n }\n\n response = TaxCloud.client.request :authorized, request_params\n TaxCloud::Responses::Authorized.parse response\n end", "def list_customers_with_http_info(authorization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.list_customers ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.list_customers\" if authorization.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\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 => 'ListCustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#list_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def contact(contact, options = {})\n get(\"contacts/#{contact}\", options).pop\n end", "def set_customer\n @customer = @organization.customers.find(params[:customer_id]) if params[:customer_id]\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\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] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer(q)\n Customer.find(self, q)\n end", "def show_customer\n @customer = Customer.find(params[:id])\n end" ]
[ "0.7612801", "0.7612801", "0.7438744", "0.71672285", "0.66973925", "0.66973925", "0.66216516", "0.6543561", "0.634384", "0.62946665", "0.6291615", "0.6291615", "0.62848425", "0.62813157", "0.6277352", "0.61704564", "0.6137568", "0.6137568", "0.6133101", "0.60970366", "0.6074944", "0.6048111", "0.5941475", "0.5936941", "0.5933071", "0.58970016", "0.5889731", "0.5889431", "0.5889383", "0.5888728", "0.58854276", "0.5874705", "0.58423793", "0.5827026", "0.58056015", "0.5789338", "0.5789338", "0.57796174", "0.5771501", "0.57503587", "0.57480824", "0.5726154", "0.5689788", "0.5676909", "0.5674004", "0.5658375", "0.56449926", "0.5630381", "0.5621225", "0.56186175", "0.56134677", "0.55816495", "0.55746996", "0.5569742", "0.55596066", "0.55584174", "0.55578023", "0.5553125", "0.5543655", "0.5537816", "0.553255", "0.55272835", "0.552439", "0.5519063", "0.5519063", "0.55125445", "0.5503132", "0.54970884", "0.54965276", "0.54962206", "0.54710627", "0.5460017", "0.5447829", "0.5431007", "0.54158324", "0.5412625", "0.5402186", "0.54004407", "0.53925985", "0.53920895", "0.53842086", "0.538021", "0.5372282", "0.53702736", "0.5363362", "0.53557456", "0.53512555", "0.5350207", "0.53397155", "0.5332392", "0.5324071", "0.5296199", "0.5294384", "0.52927303", "0.5289038", "0.52872443", "0.5277422", "0.52724284", "0.5268412", "0.52641475" ]
0.78930485
0
Create a new authorization request for the given customer ID. Params: +customer_id+:: ID of the customer +options+:: +Hash+ of options
def create(customer_id, options = nil) request = Request.new(@client) path = "/authorization-requests" data = { "name"=> @name, "currency"=> @currency, "return_url"=> @return_url, "cancel_url"=> @cancel_url, "custom"=> @custom, 'customer_id'=> customer_id } response = Response.new(request.post(path, data, options)) return_values = Array.new body = response.body body = body["authorization_request"] return_values.push(self.fill_with_data(body)) return_values[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customerCreate(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end", "def customerCreate(options={})\n assert_valid_keys(options, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end", "def customerCreate(options={})\n assert_valid_keys(options, :customerId, :freeParams)\n assert_keys_exists(options, :customerId)\n execute(:customerCreate, options)\n end", "def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end", "def create\n tpauth = Authentication.find session[:customer_oauth_id]\n if tpauth\n @customer = Customer.new(params[:customer])\n if Customer.count == 0\n # The first customer has administrative privileges.\n @customer.add_roles([:admin])\n end\n @customer.authentications << tpauth\n @customer.save\n session[:customer_id] = @customer.id\n redirect_to edit_customer_registration_path(@customer), :notice => \"Signed In!\"\n else\n redirect_to customer_sign_in_path, \"You need to authenticate first.\"\n end\n end", "def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end", "def create_authorization(options={})\n post \"/authorizations\", :body => options\n end", "def create\n authorize! :create, Customer\n @customer = Customer.new(customer_params)\n @customer.customer_admin = current_user\n\n if @customer.save\n render json: nil, status: :created\n else\n render json: @customer.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_customer_data(request, options)\r\n request.Set(RocketGate::GatewayRequest::MERCHANT_CUSTOMER_ID, options[:customer_id])\r\n request.Set(RocketGate::GatewayRequest::IPADDRESS, options[:ip])\r\n request.Set(RocketGate::GatewayRequest::EMAIL, options[:email])\r\n end", "def create_customer request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_customer_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::Channel::V1::Customer.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def create_customer\n input_param = params[:user] || params[:customer]\n if input_param\n input_param.delete(:password)\n input_param.delete(:password_confirmation)\n input_param.delete(:username)\n if current_user.is_a?(Referral) && input_param[:profile_attributes].present?\n input_param[:referral_category_id] = current_user.referral_category_id\n input_param[:profile_attributes][:referal_id] = current_user.code\n input_param[:profile_attributes][:referal] = current_user.referral_category.name if current_user.referral_category\n end\n end\n\n @customer = Customer.find_or_initialize_by_email(input_param[:email])\n @membership_order = Membership.find(session[:current_premium_id]) if session[:current_premium_id]\n \n if @customer.update_attributes(input_param)\n order.orderable = @customer\n # CustomerMailer.delay.welcome_email(@customer)\n CustomerMailer.delay.welcome_email_admin(@customer)\n \n if order.save && session[:current_premium_id].present?\n redirect_to extra_manage_orders_path\n else\n redirect_to premium_manage_orders_path\n end\n else\n @customer = Customer.new(input_param)\n flash[:errors] = @customer.errors.full_messages.uniq.join(', ')\n prepare_customer_form\n render :new\n end\n end", "def authorize(options = {})\n @post = ActiveMerchant::PostData.new\n\n self.add_receivers(options)\n self.add_customer(options)\n self.add_meta(options)\n self.add_callbacks(options)\n\n response = commit(:authorize)\n @token = response.success? ? response.token : nil\n response\n end", "def create\n @customer = User.new(customer_params)\n @customer.authority = 'customer'\n respond_to do |format|\n if @customer.save\n if !current_user\n log_in @customer, :customer\n end\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully created.'}\n format.json {render :show, status: :created, location: @customer}\n else\n format.html {render :new}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def initialize(options = {})\n requires!(options, :customer_id, :password)\n super\n end", "def create_customer(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end", "def create_customer_card(customer_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}/cards'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def create_customer_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomersApi.create_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers'\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/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.create_customer\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n \n @customer = Customer.new(customer_params)\n @user = current_user\n respond_to do |format|\n if @customer.save\n @customer.update!(user_id: @user.id)\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer\n begin\n customer = Stripe::Customer.create\n # Create customer successful - return its id\n log_info(\"Customer created with ID #{customer[:id]}\")\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating customer #{e.message}\"\n end\n status 201\n { customer_id: customer.id }.to_json\n end", "def create_customer_using_post_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer_using_post ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomerApi.create_customer_using_post\"\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(customer)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @customer = Customer.new(params[:customer])\r\n\r\n respond_to do |format|\r\n if @customer.save\r\n format.html { redirect_to '/auth/identity/register', :notice => 'Customer was successfully created.' }\r\n format.json { render :json => @customer, :status => :created, :location => @customer }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create_account\n @customer = Customer.find params[:id]\n fail unless @customer.email == params[:customer][:email]\n @customer.update_attributes!(customer_params)\n @customer_session = Authentication::CustomerSession.new(\n email: @customer.email,\n password: customer_params[:password]\n )\n @customer_session.save!\n end", "def add_customer(options)\n requires!(options, :sender)\n @post.merge!('senderEmail' => options[:sender][:email],\n 'senderFirstName' => options[:sender][:first_name],\n 'senderLastName' => options[:sender][:last_name])\n end", "def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_card_with_http_info(authorization, customer_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerCardApi.create_customer_card ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerCardApi.create_customer_card\" if authorization.nil?\n # verify the required parameter 'customer_id' is set\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerCardApi.create_customer_card\" if customer_id.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomerCardApi.create_customer_card\" if body.nil?\n # resource path\n local_var_path = \"/v2/customers/{customer_id}/cards\".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_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 header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreateCustomerCardResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerCardApi#create_customer_card\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_customer_with_http_info(authorization, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.create_customer ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.create_customer\" if authorization.nil?\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling CustomerApi.create_customer\" if body.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CreateCustomerResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_account(options)\n form_data = options.merge({ 'action' => 'createaccount' })\n res, dummy = make_api_request(form_data)\n res\n end", "def create_customer\n session[:customer_id] = nil\n session[:customer_oauth_id] = nil\n\n auth = request.env[\"omniauth.auth\"]\n # We should only have one of these.\n oauths = Authentication.where(:provider => auth[\"provider\"],\n :uid => auth[\"uid\"],\n :customer_id.ne => nil,\n :master_id => nil).order(\"created_at desc\").all\n oauth = oauths.first\n oauths.drop(1).each do |oa|\n logger.error \"sessions#create_customer: Removing extra authentications\"\n oa.destroy()\n end\n if oauth\n session[:customer_oauth_id] = oauth.id\n cust = oauth.customer\n if cust != nil\n session[:customer_id] = cust.id\n oauth.last_info = auth[\"info\"]\n oauth.save\n redirect_to my_index_websites_path, :notice => \"Signed in!\"\n else\n redirect_to new_customer_registration_path, :notice => \"Could not find you. Please create an account.\"\n end\n else\n oauth = Authentication.create_with_omniauth(auth)\n session[:customer_oauth_id] = oauth.id\n redirect_to new_customer_registration_path, :notice => \"Need to create an account.\"\n end\n end", "def create_order(options)\n request :account, :post, 'order', options\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customer_path(@customer), notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end", "def set_customer\n header = get_header()\n @customer = Authorize.authorize_request(header)\n end", "def create_customer_card(customer_id:,\n body:)\n warn 'Endpoint create_customer_card in CustomersApi is deprecated'\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/{customer_id}/cards',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def create\n @customer_company = CustomerCompany.new(customer_company_params)\n @customer_company.created_user_id = current_user.id\n respond_to do |format|\n if @customer_company.save\n format.html { redirect_to @customer_company, notice: t(\"controllers.create_success\") }\n format.json { render :show, status: :created, location: @customer_company }\n else\n @customer_companies_options = CustomerCompany.where(active: true, consortium: true).map{|m| [ m.company_customer , m.id ] }\n format.html { render :new }\n format.json { render json: @customer_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body)\r\n begin\r\n @logger.info(\"create_customer called.\")\r\n\r\n # validate required parameters\r\n @logger.info(\"Validating required parameters for create_customer.\")\r\n validate_parameters({\r\n 'body' => body\r\n })\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for create_customer.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for create_customer.\")\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for create_customer.')\r\n _request = @http_client.post _query_url, headers: _headers, parameters: body.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'create_customer')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for create_customer.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return CustomerModel.from_hash(decoded)\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def create_customer(customer_info, password)\n post_wrapper('/V1/customers',\n { customer: customer_info,\n password: password }.to_json,\n admin_headers)\n end", "def create(customer_id, attributes)\n id = commit(\"create\", customer_id, attributes)\n record = self.class.new(connection, attributes)\n record.id = id\n record\n end", "def create(options = nil)\n valid_param?(:options, options, Hash, true)\n if not options[:profile_alias]\n raise_invalid_request(\"profile_alias must be provided\")\n end\n if not options[:customer_type]\n raise_invalid_request(\"customer_type must be provided\")\n end\n if not options[:entity_type]\n raise_invalid_request(\"entity_type must be provided\")\n end\n if not options[:company_name]\n raise_invalid_request(\"company_name must be provided\")\n end\n if not options[:vertical]\n raise_invalid_request(\"vertical must be provided\")\n end\n perform_create(options)\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n format.html { redirect_to new_order_path, method: :get, notice: \"Your account was successfully created.\" }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_or_get_stripe_customer(options = {})\n return as_stripe_customer if stripe_id?\n\n create_as_stripe_customer(options)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.created\", :default => 'Customer was successfully created.') }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:user_id, :company_name, requests_attributes: [:id, :customer_id, :contact_firstname, :contact_lastname, :title, :email, :phone, :street_address, :city, :date, :zip_code])\n end", "def create\n request = Request.post('authorizations/request', 'v2', params)\n response = Response.new(request)\n update_attributes(response.serialize)\n\n response.success?\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(options = {})\n post(\"customers/#{customer_id}/deliveries\", options)\n end", "def create(*args)\n set_customer_account!(args)\n email = args[0]\n post \"/\", customer: customer, identifier: account, email: email\n end", "def create\n @customer = Customer.new(customer_params)\n \n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(params)\n r = validate_params(params, {optional: [:id, :first_name, :last_name, :comapny, :email, :phone, :fax, :website, :payment_method_nonce, :credit_card, :custom_fields]})\n return r unless r.success?\n result = @gateway.customer.create(params)\n success_with_data({result: result})\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_as_stripe_customer(options = {})\n raise Reji::CustomerAlreadyCreatedError.exists(self) if stripe_id?\n\n options[:email] = stripe_email if !options.key?('email') && stripe_email\n\n # Here we will create the customer instance on Stripe and store the ID of the\n # user from Stripe. This ID will correspond with the Stripe user instances\n # and allow us to retrieve users from Stripe later when we need to work.\n customer = Stripe::Customer.create(\n options, stripe_options\n )\n\n update({ stripe_id: customer.id })\n\n customer\n end", "def initialize(customer_id=nil)\n @customer_id = customer_id\n @client = OpenpayApi.new(ENV[\"OPEN_PAY_MERCHANT_ID\"], ENV[\"OPEN_PAY_PRIVATE_KEY\"])\n # resource_name is defined in child classes.\n @resource = @client.create(resource_name)\n end", "def authenticate_customer \n label = request_label(:authenticate_customer, customer_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/authenticate_customer\", \n :get,\n head: headers,\n query: { provider_id: provider_id, customer_id: customer_id, customer_token: customer_token }\n ).status!(label)\n end", "def create_customer_in_gateway\n return success if @payment_nonce_uuid.blank?\n\n r = \"GatewayManagement::Customer::Create::#{@gateway_nonce.gateway_type.camelize}\".constantize.\n new(customer: @customer, client_id: @client.id, gateway_nonce: @gateway_nonce).perform\n\n return r unless r.success?\n\n @gateway_customer_associations = [r.data[:gateway_customer_association]]\n\n @gateway_nonce.status = GlobalConstant::GatewayNonce.used_status\n @gateway_nonce.save!\n\n success\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(identity)\n customer = Stripe::Customer.create(\n card: posted['stripeToken'],\n plan: Lynr.config('app').fetch(:stripe, {}).plan,\n email: identity.email\n )\n end", "def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end", "def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end", "def set_customer\n @customer = Customer.find(params[:id])\n \tauthorize [:admin, @customer]\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [:admin, @customer], notice: t('messages.created', model:Customer.model_name.human) }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @customer = @user.customers.build(params[:customer])\n generated_password = Devise.friendly_token.first(6)\n\n @customer.password = generated_password\n @customer.password_visible = generated_password\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to user_customer_path(@user, @customer), notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(customer_id:)\n @customer_id = customer_id\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.fetch(:customer, {})\n params.require(:customer).permit(:id, :email, :password, :salt, :encrypted_password, :admin, :superadmin)\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(customer, opts = {})\n data, _status_code, _headers = create_customer_with_http_info(customer, opts)\n data\n end", "def create_customer(customer_data)\n ::Stripe::Customer.create(customer_data)\n end", "def add_customer(customer_id)\n self.customer_id = customer_id\n self.save\n end", "def create\n @customer = current_user.customers.build(params[:customer])\n\n respond_to do |format|\n if @customer.save \n @customer.orders.create(:user_id => @customer.user.id, \n :total => params[:total], :name => @customer.name, :phone => @customer.phone,\n :address => @customer.address, :instruction => params[:instruction]) if params[:order] == 'true'\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end", "def create_authorization_policy request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_authorization_policy_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::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def generate_authenticated_request(options={})\n return authorization.generate_authenticated_request(options)\n end", "def new_customer\n # We are going to auth a customer. We indicate that in the session\n if current_customer\n redirect_to edit_customer_registration_path(current_customer), :notice => \"You are already signed in.\"\n else\n @providers = BuspassAdmin::Application.oauth_providers\n session[:tpauth] = :customer\n @options = \"?tpauth=customer&customer_auth=#{session[:session_id]}&failure_path=#{root_path}\"\n # We will render new_customer and then that will redirect to sessions#create on /auth/;provider/callback\n state_data = { :tpauth => :customer, :customer_auth => session[:session_id], :failure_path => root_path }\n state_urldata = CGI::escape(state_data.to_json)\n @fb_options = \"?state=#{state_urldata}\"\n end\n end", "def create_order(options)\n Order.create(@current_user, options)\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer)\n .permit(\n :fantasyName,\n :customerName,\n :taxId,\n :status,\n :stateRegistration,\n :facility_id,\n :contact_id,\n operation_ids: []\n )\n end", "def send_customer(customer)\n request(customer, \"customer\", :post, {method: \"add\"})\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n redirect_to(action: \"show\", id: @customer)\n else\n render action: \"new\"\n end\n end", "def create_customer(email, token)\n raise \"Not implemented!\"\n end", "def add_customer(xml, options)\n customer = options[:customer]\n return unless customer\n\n xml.tag!('customer') do\n xml.tag!('type', customer[:type]) if customer[:type]\n xml.tag!('id', customer[:id]) if customer[:id]\n xml.tag!('email', customer[:email]) if customer[:email]\n xml.tag!('phoneNumber', customer[:phone_number]) if customer[:phone_number]\n xml.tag!('faxNumber', customer[:fax_number]) if customer[:fax_number]\n add_drivers_license(xml, options)\n xml.tag!('taxId', customer[:tax_id]) if customer[:tax_id]\n end\n end", "def create\n @customer_account = CustomerAccount.new(customer_account_params)\n\n respond_to do |format|\n if @customer_account.save\n flash[:success] = \"Customer account was successfully created!\"\n format.html { redirect_to @customer_account }\n format.json { render :show, status: :created, location: @customer_account }\n else\n format.html { render :new }\n format.json { render json: @customer_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully added.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :index }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@customer_user = CustomerUser.new(customer_user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @customer_user.save\n\t\t\t\tformat.html { redirect_to login_url, alert: \"Customer user #{@customer_user.name} was successfully created.\" }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @customer_user }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @customer_user.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n customer = Customer.new(customer_params)\n if customer.save\n session[:customer_id] = customer.id\n redirect_to '/'\n else\n redirect_to '/signup'\n end\n end", "def create_customer_using_post(customer, opts = {})\n data, _status_code, _headers = create_customer_using_post_with_http_info(customer, opts)\n data\n end" ]
[ "0.7060646", "0.6959064", "0.6959064", "0.66844", "0.65551436", "0.65031236", "0.64348817", "0.6369084", "0.6367614", "0.6260787", "0.62348676", "0.622578", "0.6216633", "0.61589926", "0.61455727", "0.61365706", "0.6065897", "0.60240555", "0.600908", "0.59845006", "0.59527653", "0.59527105", "0.5936192", "0.59354246", "0.59315896", "0.59024674", "0.5874281", "0.58565754", "0.5837755", "0.5836248", "0.5800541", "0.5791503", "0.5780869", "0.5777551", "0.57775086", "0.5775196", "0.5766756", "0.5755666", "0.5742459", "0.5742459", "0.57382786", "0.5734498", "0.5722912", "0.57226", "0.5703469", "0.570175", "0.5697307", "0.5691068", "0.56884444", "0.56819785", "0.5661208", "0.56595194", "0.5652832", "0.56489694", "0.5642747", "0.5635398", "0.5633404", "0.56320405", "0.562384", "0.562384", "0.562384", "0.562384", "0.562384", "0.562384", "0.56231374", "0.5621763", "0.56126004", "0.5611281", "0.56030804", "0.55901474", "0.55704045", "0.5569344", "0.55656314", "0.55635583", "0.5562958", "0.55629534", "0.55573475", "0.55515987", "0.55400103", "0.55357707", "0.5528868", "0.5515298", "0.5510537", "0.5501262", "0.5488893", "0.5487283", "0.54869026", "0.5482381", "0.5472794", "0.5472794", "0.547098", "0.5468902", "0.54617953", "0.54488313", "0.5445779", "0.54443234", "0.5442928", "0.54166675", "0.54030204", "0.5397386" ]
0.8213277
0
Find an authorization request by its ID. Params: +authorization_request_id+:: ID of the authorization request +options+:: +Hash+ of options
def find(authorization_request_id, options = nil) request = Request.new(@client) path = "/authorization-requests/" + CGI.escape(authorization_request_id) + "" data = { } response = Response.new(request.get(path, data, options)) return_values = Array.new body = response.body body = body["authorization_request"] obj = AuthorizationRequest.new(@client) return_values.push(obj.fill_with_data(body)) return_values[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_request_by_id(id)\n @search_requests[id]\n end", "def find_hash(id, options = {})\n options.assert_valid_keys(:request_level)\n level = find_level(options[:request_level])\n record = self.find(id, :select => level.select_field.join(', '), :include => level.include_field)\n level.receive record\n end", "def find(id, query_options = {})\n raise 'ID is required' unless id\n\n response = request(:get, credentials, \"#{api_model.api_path}/#{id}\", query: query_options)\n api_model.parse(response.parsed_response).first\n end", "def find_merge_request_with_access(id, access_level = :read_merge_request)\n merge_request = authorized_merge_requests.find_by(id: id)\n not_found! unless can?(current_user, access_level, merge_request)\n merge_request\n end", "def get_resource_by_id(authorization, \n id)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/resources/{id}'\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\n 'id' => id\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetResourceByIdResponse.from_hash(decoded)\n end", "def find(id, options = {})\n response = fetch({:key => id})\n response.parsed_response['id'] = id\n new(response.parsed_response)\n end", "def find_request(rid)\n Requests.find_by(rid: rid)\n end", "def find_by_id(id, options={})\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for(id: id)\n\n request = api_client.get(url, options)\n\n if request.success?\n self.class::INDIVIDUAL_MODEL.new(request.body)\n else\n nil\n end\n end", "def find(environment_id)\n @resource_requester.find(\n space_id: @space_id,\n environment_id: environment_id\n )\n end", "def authorization_id\n @authorization_id ||= begin\n join = AuthJoin.by_user_object_id(:key => id).first\n join && join[:auth_object_id]\n end\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end", "def find_authorizable_id\n @call_params[:path] = \"/#{@call_params[:path]}\" unless @call_params[:path].start_with? '/'\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def find(id, options = {})\n raise MethodNotAllowed.new(self, :all) unless self.class.permissions && self.class.permissions[:read]\n response_body = @application.http_get(@application.client, \"#{url}/#{CGI.escape(id)}\", options)\n response = parse_response(response_body, options)\n result = response.response_items.first if response.response_items.is_a?(Array)\n result.complete_record_downloaded = true if result\n result\n end", "def get(*args)\n require_authentication\n arguments(args, required: [:authorization_id])\n\n get_request(\"/authorizations/#{authorization_id}\", arguments.params)\n end", "def set_request\n @request = Request.find(params[:id])\n authorize @request\n end", "def get_by_user_id(args)\n JSON.parse(api_request('private.request.search', 'GET', {:sUserId => args[:user_id]}))['request'] rescue nil\n end", "def find_transfer_request_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferRequestsApi.find_transfer_request_by_id ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferRequestsApi.find_transfer_request_by_id\"\n end\n # resource path\n local_var_path = '/transfers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TransferRequest'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"TransferRequestsApi.find_transfer_request_by_id\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferRequestsApi#find_transfer_request_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @request = current_user.requests.find(params[:id])\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/tasks/#{id}\", options: options)).first, client: client)\n end", "def find(name, options = {})\n client = extract_client!(options)\n\n response = client.get(\"/api/security/permissions/#{url_safe(name)}\")\n from_hash(response, client: client)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end", "def lookup_request(account_id, order_request, opts = {})\n data, _status_code, _headers = lookup_request_with_http_info(account_id, order_request, opts)\n data\n end", "def find(restriction_id, options = {})\n restrictions_api.find(restriction_id, options).tap do |m|\n inject_repo_keys(m, @repo.repo_keys)\n end\n end", "def get_id(options)\r\n id = options[:id]\r\n\r\n id\r\n end", "def get_request( id )\n url = \"#{self.url}/#{id}?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['details'] if ok?( status ) && response['details']\n return status, ''\n end", "def authorized_for(options)\n action = options.delete(:auth_action) || options[:action]\n object = options.delete(:auth_object)\n user = User.current\n controller = options[:controller] || params[:controller]\n controller_name = controller.to_s.gsub(/::/, \"_\").underscore\n id = options[:id]\n permission = options.delete(:permission) || [action, controller_name].join('_')\n\n if object.nil?\n user.allowed_to?({ :controller => controller_name, :action => action, :id => id }) rescue false\n else\n authorizer = options.delete(:authorizer) || Authorizer.new(user)\n authorizer.can?(permission, object) rescue false\n end\n end", "def load_and_authorize_if_present(name, options={}, &block)\n key = options[:id_param] || \"#{name}_id\"\n if params[key]\n load_and_authorize(name, options, &block)\n end\n end", "def find_item_request(options)\n search_type, search_value = nil, nil\n options.each_pair do |key, value|\n if @@valid_search_types.include? key.to_s.upcase\n if search_type || search_value\n raise ArgumentError.new(\"Only one search criteria at a time is allowed: '#{options}'\")\n end\n\n search_type, search_value = key, value\n end\n end\n unless search_type && search_value\n raise ArgumentError.new(\"Missing valid search type and value: '#{options}'\")\n end\n\n request exact_search_request_hash(search_type, search_value), need_auth_id(self.patron_barcode, self.patron_library_symbol)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def set_request\n @request = Request.accessible_by(current_ability).find(params[:id])\n end", "def set_verification_request\n @verification_request = VerificationRequest.find(params[:id])\n end", "def get_redemption_request(account_slug, \r\n redemption_request_id)\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/accounts/{account_slug}/redemption-requests/{redemption_request_id}'\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'account_slug' => account_slug,\r\n 'redemption_request_id' => redemption_request_id\r\n }\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'Content-Type' => Configuration.content_type\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url, headers: _headers\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) if not (_context.response.raw_body.nil? or _context.response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "def update_authorization(id, options={})\n patch \"/authorizations/#{id}\", :body => options\n end", "def find_by_id(sess, id, options = {})\r\n q = create_query(sess)\r\n q.query.TxnIDList.Add(id)\r\n find(sess, :first, q, options)\r\n end", "def generate_authenticated_request(options={})\n return authorization.generate_authenticated_request(options)\n end", "def find(id, params = {}, header = {})\n request = requester.new(:get, \"#{to_url}/#{id}\", {}, params, header)\n build(request.resource)\n end", "def initialize(options={})\n @request_id = options[:request_id]\n @id = options[:id]\n @error = options[:error] ? FundAmericaCrowd::Error.new(options[:error]) : nil\n end", "def create(customer_id, options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests\"\n data = {\n \"name\"=> @name, \n \"currency\"=> @currency, \n \"return_url\"=> @return_url, \n \"cancel_url\"=> @cancel_url, \n \"custom\"=> @custom, \n 'customer_id'=> customer_id\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"authorization_request\"]\n \n \n return_values.push(self.fill_with_data(body))\n \n\n \n return_values[0]\n end", "def set_request_grant\n @request_grant = RequestGrant.find(params[:id])\n end", "def get(*args)\n raise_authentication_error unless authenticated?\n arguments(args, required: [:id])\n\n get_request(\"/authorizations/#{arguments.id}\", arguments.params)\n end", "def authorization(id)\n get \"/authorizations/#{id}\"\n end", "def set_account_request\n @account_request = AccountRequest.find(params[:id])\n end", "def find_resource(id)\n query_service.find_by(id: Valkyrie::ID.new(id.to_s))\n end", "def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end", "def find_resource(resource, options = {})\n resource = resource.to_s\n\n scope, query = resource_scope_and_query(resource, options)\n through = options[:through] ? options[:through].to_s : nil\n\n assoc_name = through || (options[:from] ? resource.pluralize : nil)\n assoc = Authorizer.association_method(assoc_name)\n scope = scope.send(assoc) if assoc && scope.respond_to?(assoc)\n\n record = scope.where(query).first!\n\n if through\n instance_variable_set \"@#{through.singularize}\", record\n record = record.send(resource)\n end\n\n instance_variable_set \"@#{resource}\", record\n end", "def exists\n result = find_authorizable_id\n @call_params[:authorizable_id] = result.data\n @call_params[:path] = RubyAem::Swagger.path(@call_params[:path])\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/custom_fields/#{id}\", options: options)).first, client: client)\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/user_task_lists/#{id}\", options: options)).first, client: client)\n end", "def set_request\n #@request = Request.find(params[:id])\n if Request.exists?(Request.decrypt(params[:id]))\n @request = Request.find( Request.decrypt(params[:id]) )\n end\n end", "def request_token(options={})\n @request_token ||= signing_consumer.get_request_token(options)\n end", "def find_resource(options = {})\n resource_name = controller_name.singularize\n resource = controller_name.classify.constantize\n finder_column = options[:finder] || :id\n finder_value = options[:value] || params[:id]\n resources = resource.where(finder_column => finder_value)\n if resources.length == 0\n raise RecordNotFound\n else\n instance_variable_set \"@#{resource_name}\", resources.first\n end\n end", "def set_doctor_verification_request\n @doctor_verification_request = DoctorVerificationRequest.find(params[:id])\n end", "def set_request\n @request = Request.find_by_id(params[:id])\n end", "def set_request\n @request = Request.find params[:id]\n end", "def find_invitation_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InvitationsApi.find_invitation_by_id ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling InvitationsApi.find_invitation_by_id\"\n end\n # resource path\n local_var_path = '/invitations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Invitation'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"InvitationsApi.find_invitation_by_id\",\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: InvitationsApi#find_invitation_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find(id, options = {})\n response = client.get(\"#{base_path}/#{id}\", options)\n\n return parse(response) unless block_given?\n\n yield response\n end", "def find(organization_id, id)\n path = get_path(organization_id, id)\n contact = handle_response(@client.get(path))\n raise ActiveRecord::RecordNotFound.new(\"Couldn't find Contact with id=#{id}\") unless contact.present?\n\n set_contact_data(contact, id)\n end", "def find(options)\n BorrowDirect::FindItem::Response.new find_item_request(options), self.auth_id\n end", "def scaffold_find_object(action, id, options)\n object = scaffold_get_object(id)\n raise scaffold_error_raised unless scaffold_session_value_matches?(object, options[:session])\n object\n end", "def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end", "def set_request\n @request = @software.requests.find(params[:id])\n end", "def find_transfer_request\n @transfer_request = OwnershipTransferRequest.find_by!(\n token: params[:token],\n accepted: nil\n )\n end", "def patch_authorizations_id_with_http_info(auth_id, authorization_update_request, opts = {})\n # verify the required parameter 'auth_id' is set\n if @api_client.config.client_side_validation && auth_id.nil?\n fail ArgumentError, \"Missing the required parameter 'auth_id' when calling AuthorizationsApi.patch_authorizations_id\"\n end\n # verify the required parameter 'authorization_update_request' is set\n if @api_client.config.client_side_validation && authorization_update_request.nil?\n fail ArgumentError, \"Missing the required parameter 'authorization_update_request' when calling AuthorizationsApi.patch_authorizations_id\"\n end\n # resource path\n local_var_path = '/authorizations/{authID}'.sub('{' + 'authID' + '}', CGI.escape(auth_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(authorization_update_request)\n\n # return_type\n return_type = opts[:debug_return_type] || 'Authorization'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"AuthorizationsApi.patch_authorizations_id\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n return data, status_code, headers\n end", "def get_schedule_by_id(authorization, \n id)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/schedules/{id}'\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\n 'id' => id\n }\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.get _query_url, headers: _headers\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif _context.response.status_code == 410\n raise EntitiesErrorErrorException.new 'Gone', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return GetScheduleByIdResponse.from_hash(decoded)\n end", "def find_by_id(id, options = {})\n if item = Dynamoid::Adapter.read(self.table_name, id, options)\n obj = self.new(item)\n obj.new_record = false\n return obj\n else\n return nil\n end\n end", "def request\n @request ||= Request.find request_id\n end", "def lookup_key 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_lookup_key_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::ApiKeys::V2::LookupKeyResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def find_resource(resource_id)\n query_service.find_by(id: Valkyrie::ID.new(resource_id))\n end", "def find_by_key(key, options = {})\n record = find_record_by_key(key, options)\n resource_for(record, options[:context])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end" ]
[ "0.5601527", "0.54645497", "0.5462754", "0.5349435", "0.5208992", "0.51834184", "0.5129201", "0.507622", "0.5052594", "0.50379044", "0.50206035", "0.49878615", "0.4969185", "0.4958501", "0.49483415", "0.49384612", "0.49118584", "0.48981726", "0.48665774", "0.48523477", "0.48138976", "0.48066896", "0.48060793", "0.47996402", "0.4795735", "0.4770953", "0.47560087", "0.4733887", "0.4700624", "0.46987295", "0.46894342", "0.46646148", "0.46616575", "0.46610105", "0.4658013", "0.46538347", "0.46452248", "0.4641385", "0.4640481", "0.46403456", "0.46377724", "0.46112555", "0.46091878", "0.46074218", "0.45967117", "0.45888853", "0.45742682", "0.45619297", "0.4555896", "0.45408884", "0.4539236", "0.45256302", "0.45229945", "0.4518578", "0.45162645", "0.45146754", "0.45127997", "0.45064664", "0.4498415", "0.4496562", "0.44862503", "0.44844434", "0.44829604", "0.4469257", "0.44689626", "0.44676474", "0.4465472", "0.4465472", "0.4465472", "0.4465472", "0.4465472", "0.4465472", "0.4465472", "0.4465472", "0.4465472", "0.44638413", "0.44544455", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812", "0.44510812" ]
0.81766945
0
GET /employee/list GET /employee/list.json
def list employee = params[:employee].blank? ? '' : params[:employee] staff_id = params[:staff_id].blank? ? '' : params[:staff_id] employment_status = params[:employment_status].blank? ? 0 : params[:employment_status].to_i supervisor = params[:supervisor].blank? ? '' : params[:supervisor] designation = params[:designation].blank? ? 0 : params[:designation].to_i dept = params[:dept].blank? ? 0 : params[:dept].to_i pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i sortcolumn = params[:sortcolumn].blank? ? EmployeeHelper::DEFAULT_SORT_COLUMN : params[:sortcolumn] sortdir = params[:sortdir].blank? ? EmployeeHelper::DEFAULT_SORT_DIR : params[:sortdir] sort = ApplicationHelper::Sort.new(sortcolumn, sortdir) filters = { :employee => employee, :staff_id => staff_id, :employment_status => employment_status, :supervisor => supervisor, :designation => designation, :dept => dept } if employee.blank? && staff_id.blank? && employment_status == 0 && supervisor.blank? && designation == 0 && dept == 0 @data = EmployeeHelper.get_all(pgnum, pgsize, sort) else @data = EmployeeHelper.get_filter_by(filters, pgnum, pgsize, sort) end respond_to do |fmt| fmt.html { render :partial => 'list' } fmt.json { render :json => @data } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list \n @employees = Employee.find( :all ) # return an array of all Employees\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n employees = manager.employees.active\n render json: employees.all, each_serializer: EmployeeSerializer, status: 200\n end", "def index\n @employes = Employe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employes }\n end\n end", "def index\n @employees = @client.employees\n @events = fetch_events\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\n @employees = Employee.all\n end", "def index\r\n\t\t@employees = Employee.all\r\n\tend", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def list_employees_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n format.xls\n end\n end", "def employee(employee_id)\n get(\"employees/#{employee_id}\")\n end", "def index\n @employee = Employee.all\n end", "def list_employees(order: nil,\n begin_updated_at: nil,\n end_updated_at: nil,\n begin_created_at: nil,\n end_created_at: nil,\n status: nil,\n external_id: nil,\n limit: nil,\n batch_token: nil)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/employees'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'order' => order,\n 'begin_updated_at' => begin_updated_at,\n 'end_updated_at' => end_updated_at,\n 'begin_created_at' => begin_created_at,\n 'end_created_at' => end_created_at,\n 'status' => status,\n 'external_id' => external_id,\n 'limit' => limit,\n 'batch_token' => batch_token\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def index\n @employeedetails = Employeedetail.all\n end", "def index\n @employees = User.all\n end", "def index\n @employees = User.all\n end", "def index\n @employees = User.all\n end", "def index\n @handbook_place_employees = HandbookPlaceEmployee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @handbook_place_employees }\n end\n end", "def employees\n emps = []\n url = prefix + \"liste\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n emps << User.new(u[\"id\"], @authid, @subdomain)\n end\n return emps\n else #failed\n return users\n end\n end", "def index\n # For URL like /employees/1/leave_records\n # Get the employee with id=1\n @employee = Employee.find(params[:employee_id])\n\n # Access all leave_records for that employee\n @leave_records = @employee.leave_records\n end", "def index\n @employee_details = EmployeeDetail.all\n \n end", "def show\n @employee = Employee.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end", "def index\n @employees = @employees = Employee.all\n end", "def index\n @employments = Employment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employments }\n end\n end", "def show\n @employee = Employee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employee }\n end\n end", "def index\n @service_employees = ServiceEmployee.all\n end", "def index\n if request.xhr?\n branch_id = Branch.find_by_id(params[:branch])\n lastname = params[:surname].mb_chars.downcase if params[:surname]\n @employees = Employee.with_lastname(lastname).with_branch(branch_id).all\n html_employees = render_to_string(partial: 'employees', layout: false,\n locals: { employees: @employees })\n unless @employees.blank?\n html_employee = render_to_string(partial: 'employee', layout: false,\n locals: { employee: @employees.first })\n end\n render json: { html_employees: html_employees, html_employee: html_employee }\n else\n @employees = Employee.all\n end\n end", "def index\n #Para no mostrar el empleado oculto que se usa como superuser en la base de datos y el sistema\n @employees = Employee.where(\"id != 1\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n @employee_associations = EmployeeAssociation.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employee_associations }\n end\n end", "def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end", "def show\n render json: Record.where(employee_id: params[:id])\n end", "def index\n @employees = Employee.page(params[:page]) #pagination on index of employee\n end", "def list_employees_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EmployeesApi.list_employees ...\"\n end\n # resource path\n local_var_path = \"/v2/employees\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'location_id'] = opts[:'location_id'] if !opts[:'location_id'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n header_params['Square-Version'] = \"2019-06-12\"\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListEmployeesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EmployeesApi#list_employees\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @employees = Employee.search(params[:search]).order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n respond_with(@employees)\n end", "def index\n @employee_jc_lists = EmployeeJcList.all\n end", "def index\n @employee_events = EmployeeEvent.all\n end", "def index\n @employes = Employe.all\n end", "def index\n @employees = $Vendor.employees.scopied.order(\"created_at desc\").page(params[:page]).per(25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @employees }\n end\n end", "def show\n #Find the employee with id supplied from the front-end and return direct subtree of that node including the parent node\n begin @employees = Employee.find(params[:id]).subtree.arrange_serializable(:order => :id)\n render json: @employees\n rescue => err \n render json: {error: err}\n end\n end", "def index\n @program_employees = ProgramEmployee.all\n end", "def get_employees\n @employees = User.find_user_not_admin_not_client(get_company_id)\n end", "def index\n org = Organization.find(current_employee.organization_id)\n @alerts = org.alerts\n render \"index.json.jbuilder\", status: :ok\n end", "def show\n @emp_month = EmpMonth.find(params[:id])\n @employees = Employee.where(\"grade IN (1,2)\").order(:name)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @emp_month }\n end\n end", "def index\n @admin_employees = Employee.all\n end", "def employee_all\n\t\trespond_to do |format|\n\t\t format.js\n\t\tend\n\tend", "def index\n @employers = Employer.all\n end", "def index\n @employers = Employer.all\n end", "def index\n @rowempls = Rowempl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rowempls }\n end\n end", "def employees\n emps = []\n url = prefix + \"liste\"\n users = response(url)\n if users.class == Array #success\n users.each do |u|\n emps << ShareUser.new(u[\"id\"], @authid, @subdomain)\n end\n return emps\n else #failed\n return users\n end\n end", "def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end", "def index\n @aga_employees = AgaEmployee.all\n end", "def index\n @employeds = Employed.all\n end", "def index\n @employees = Employee.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n @companies = Company.all\n end", "def index\n @offices = Office.all\n json_response(@offices)\n end", "def list\n\t\t@employee = Employee.find(:all)\n\t\t@loanaccounts = Loanaccount.paginate :page => params[:page], :per_page => 10\t#Pagination\n \trespond_to do |format|\t\t\n format.html \n \t\t\tformat.xml { render :xml => @loanaccounts }\t\t#Render to XML File\n \tend\n\tend", "def list_employees(opts = {})\n data, _status_code, _headers = list_employees_with_http_info(opts)\n return data\n end", "def list_employees(opts = {})\n data, _status_code, _headers = list_employees_with_http_info(opts)\n return data\n end", "def show\n @hisd_employee = HisdEmployee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hisd_employee }\n end\n end", "def v1_employees_get(opts = {})\n data, _status_code, _headers = v1_employees_get_with_http_info(opts)\n return data\n end", "def index\n @employees = Employee.where(\"users_id = ?\",current_user.id)\n end", "def index\n @empolyees = Empolyee.all\n end", "def index\n @contract_employees = ContractEmployee.all\n end", "def employee_index\n @v1_employee = V1::Employee.find(params[:employee_id])\n\n if @current_user.admin? or @current_user.company_id === @v1_employee.company.id\n @v1_activity = V1::Activity.where( employee_id: @v1_employee.id )\n\n render json: @v1_activity\n else\n render json: {error: 'forbidden'}, status: :forbidden\n end\n end", "def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end", "def index\n @employee_personals = EmployeePersonal.all\n end", "def index\n \n id = Employee.find_by user_id: current_user.id\n if id == nil\n\t render \"new\" \n end\n @employee = Employee.find_by user_id: current_user.id\n \n end", "def show\n @employees = @company.employees.all.order(\"employees.created_at ASC\").paginate(page: params[:page], per_page: 5)\n end", "def index\n @employee_emails = EmployeeEmail.all\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def index\n @employees_rols = EmployeesRol.all\n end", "def index\n @employees = []\n if current_user.user_type <= 1\n @employees = Employee.all\n elsif current_user.user_type == 3 # manager\n @employees = Employee.where(department_id: current_user.role.department_id)\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def listex\n url = prefix + \"listex\"\n return response(url)\n end", "def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n if params[:employee_id].present?\n @employee = Employee.find(params[:employee_id])\n @work_histories = @employee.work_histories\n skip_authorization\n else\n @work_histories = WorkHistory.all\n skip_authorization\n end\n end", "def index\n @salary_slips = SalarySlip.where(:employee_detail_id => current_user.id)\n #@salary_slips = SalarySlip.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @salary_slips }\n end\n end", "def show\n @employe = Employe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employe }\n end\n end", "def employee_details\n if current_user.role == \"SuperAdmin\"\n @employees = Employee.all\n \n render :status => 200,\n :json => { :success => true,\n \n :data => {:employees => @employees} }\n else\n render :status => 201,\n :json => { :success => false,\n \n :data => {:error => \"You dont have authority!\" }}\n end\n \nend", "def index\n @employee_contacts = EmployeeContact.all\n end", "def index\n authorize! :index, Employee\n if current_employee.admin?\n @developers = @organization.employees.developers\n else\n raise CanCan::AccessDenied.new(\"Not authorized!\", :read, Employee)\n end\n end", "def listex\n url = prefix + \"listex\"\n return response(url)\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @employee_departments = EmployeeDepartment.all\n end", "def index\n @employee_rooms = EmployeeRoom.all\n end", "def employees\n title = \"#{@list.title}-employees\"\n partners = @list.partners\n\n respond_to do |format|\n format.csv { send_csv partners.as_csv(include: :employees), title }\n format.xlsx { send_xlsx partners.as_xlsx(include: :employees), title }\n end\n end", "def index\n @employees = Employee.all\n @employees = @employees.paginate(:page => params[:page], :per_page => 8).order('name ASC')\n end", "def index\n @wing_employees = WingEmployee.all\n end", "def employees\n if EMPLOYEES_VIEW_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n @employees = Employee.where(florist_id: session[\"found_florist_id\"]).order(\"primary_poc\", \"status\", \"name\")\n render(:employees) and return\n else\n redirect_to \"/employee/#{session[\"found_user_id\"]}\" and return\n end\n end" ]
[ "0.8005089", "0.7503042", "0.72854495", "0.7276252", "0.71964896", "0.7133813", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.7084595", "0.70835644", "0.7079828", "0.707381", "0.7066723", "0.70316774", "0.6990829", "0.69896847", "0.68798614", "0.6874882", "0.6874882", "0.6874882", "0.6827054", "0.68176585", "0.68133605", "0.6780502", "0.6763545", "0.67573017", "0.6747067", "0.67463195", "0.6703606", "0.6703556", "0.6698685", "0.6693699", "0.6680311", "0.6678926", "0.66745836", "0.6666582", "0.6653739", "0.6635919", "0.66353214", "0.6628331", "0.659045", "0.6589035", "0.6561122", "0.6536608", "0.6527281", "0.65266186", "0.6524678", "0.65153223", "0.64910734", "0.64910734", "0.64734256", "0.6448618", "0.6428891", "0.6425535", "0.64245176", "0.6418649", "0.64115524", "0.6395432", "0.63951176", "0.63951176", "0.63931197", "0.63860583", "0.63838124", "0.63820803", "0.63703597", "0.6346855", "0.6329587", "0.6322784", "0.63167614", "0.6307969", "0.62816775", "0.62710077", "0.6269814", "0.6266106", "0.6265762", "0.62499654", "0.6244672", "0.624382", "0.6238851", "0.6235815", "0.62245023", "0.62234", "0.6215773", "0.62157154", "0.62051654", "0.62041837", "0.6202758", "0.6196323", "0.6195414", "0.6194434", "0.6188311", "0.61858207" ]
0.6538066
51
GET /employee/new GET /employee/new.json
def new @employee = Employee.new @employee_contact = EmployeeContact.new @employee_ec_contact = EmployeeEcContact.new @employee_job = EmployeeJob.new @employee_salary = EmployeeSalary.new @employee_qualification = EmployeeQualification.new @employee_membership = EmployeeMembership.new @employee_spouse = EmployeeSpouse.new @form_id = 'add-form' @users = User.order(:username).all @supervisors = Employee.all @designations = Designation.order(:title).all @employment_statuses = EmploymentStatus.order(:name).all @job_categories = JobCategory.order(:name).all @departments = Department.order(:name).all respond_to do |fmt| fmt.html { render :partial => 'form' } fmt.json { render :json => @employee } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n @employee = current_owner.employees.new\n @category = category\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n @hisd_employee = HisdEmployee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hisd_employee }\n end\n end", "def new\n @employe = Employe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employe }\n end\n end", "def new\n #Para no mostrar el empleado oculto que se usa como superuser en la base de datos y el sistema\n @employees = Employee.where(\"id != 1\")\n @employee = Employee.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee }\n end\n end", "def new\n @employee = Employee.new\n respond_with(@employee)\n end", "def new\n @employee = Employee.new\n respond_with(@employee)\n end", "def new\n @employ = Employ.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employ }\n end\n end", "def new\n @employer = Employer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employer }\n end\n end", "def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end", "def new\n @employee = Employee.new\n end", "def new\n @employee = Employee.new\n end", "def new\n @employee_association = EmployeeAssociation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee_association }\n end\n end", "def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @employee }\n end\n end", "def new\n @employee = Employee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @employee }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_url, notice: 'Employee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: 'Employee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @emprendedor = Emprendedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emprendedor }\n end\n end", "def new\n @employee_department = EmployeeDepartment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee_department }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @emp_job = EmpJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emp_job }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n if @employee.save\n render :show, status: :created, location: @employee\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employee_edit_path(@employee), notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end", "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @employee_position_history = EmployeePositionHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee_position_history }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee page was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # raise params.to_s\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Работник создан.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n CustomLogger.info(\"Se crea empleado: #{@employee}, usuario: #{current_user.inspect}, #{Time.now}\")\n format.html { redirect_to new_employee_path, notice: 'Empleado Creado Exitosamente!' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n CustomLogger.error(\"Error al crear empleado: #{@employee}, usuario: #{current_user.inspect}, #{Time.now}\")\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = current_owner.employees.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, status: :created, location: @employee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @employee_terminal = EmployeeTerminal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @employee_terminal }\n end\n end", "def new\n @employee = Employee.new\n @companies = Company.all\n end", "def new\n @employee = Employee.new\n @url = { controller: '/employees', action: :create }\n render :form\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @scheduled_employee = ScheduledEmployee.new(params[:scheduled_employee])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_employee }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: \"Employee was successfully created.\" }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @employee = User.new\n end", "def new\n @employee_group = EmployeeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @employee_group }\n end\n end", "def new\n @handbook_place_employee = HandbookPlaceEmployee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @handbook_place_employee }\n end\n end", "def new\n @empresa = Empresa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @empresa }\n end\n end", "def new\n @employee_type = EmployeeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @employee_type }\n end\n end", "def new\n @emp_date_detail = EmpDateDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emp_date_detail }\n end\n end", "def new\n\t\t@person = Person.new\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @salary = Salary.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @salary }\n end\n end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_url, notice: 'Funcionário foi criado com sucesso!' }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @personnage = Personnage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personnage }\n end\n end", "def new\n @create_event = CreateEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_event }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end", "def create\n @employee = Employee.new(params[:employee])\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def new\n @empsked = Empsked.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @empsked }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.user = current_user\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n p 'new called'\n @user = User.new\n\n p \"#{@user}\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @estate = Estate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estate }\n end\n end", "def new\n @exp = Exp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exp }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def new\n @address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @address }\n end\n end", "def create\n @employe = Employe.new(params[:employe])\n\n respond_to do |format|\n if @employe.save\n format.html { redirect_to @employe, notice: 'Employe was successfully created.' }\n format.json { render json: @employe, status: :created, location: @employe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employe.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end", "def create\n @employee = Employee.create(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to(@employee, :notice => 'Employee was successfully created.') }\n format.xml { render :xml => @employee, :status => :created, :location => @employee }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employee.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end", "def new\n @rowempl = Rowempl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rowempl }\n end\n end", "def new\n @experience_history = ExperienceHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experience_history }\n end\n end", "def new\n @exposition = Exposition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exposition }\n end\n end", "def new\n @record = Record.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record }\n end\n end" ]
[ "0.81893736", "0.81893736", "0.81893736", "0.7611292", "0.7589045", "0.75668526", "0.7556919", "0.7536802", "0.7536802", "0.75309247", "0.7503714", "0.74465406", "0.7384635", "0.7384635", "0.7342567", "0.7319641", "0.7319641", "0.72911775", "0.72911775", "0.723434", "0.72277004", "0.7225974", "0.7210517", "0.7175965", "0.7175965", "0.7152185", "0.7148708", "0.7138671", "0.71081537", "0.7086159", "0.708058", "0.708058", "0.708058", "0.708058", "0.708058", "0.708058", "0.7071966", "0.70688456", "0.7056969", "0.7049331", "0.7048801", "0.7041931", "0.70299286", "0.7029191", "0.7020002", "0.7006809", "0.69970447", "0.69970447", "0.69970447", "0.69970447", "0.69970447", "0.69970447", "0.69970447", "0.69794685", "0.6962726", "0.6945303", "0.6944369", "0.69422567", "0.69366515", "0.6922272", "0.69199675", "0.6906466", "0.6902274", "0.6890718", "0.6883795", "0.68619084", "0.6859006", "0.6854225", "0.6853285", "0.68473935", "0.68460333", "0.6839659", "0.68238086", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6812382", "0.6801397", "0.6780139", "0.6771622", "0.67531526", "0.67472905", "0.67459136", "0.67459136", "0.67459136", "0.6742044", "0.67347276", "0.67314374", "0.6728029", "0.67185163", "0.67157644", "0.67087704", "0.67084414", "0.67065316" ]
0.69411194
58